akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int Inf = (int) 1e9;
		int[] dp1 = new int[N + 1];
		int[] w1 = new int[]{G[0], S[0], B[0]};
		int[] v1 = new int[]{G[1], S[1], B[1]};
		
		for(int i=0;i<=N;i++) dp1[i] = -Inf;
		dp1[0] = 0;
		for(int j=0;j<3;j++){
			for(int i=0;i<=N;i++){
				if(dp1[i] == -Inf) continue;
				if(i + w1[j] <= N){
					dp1[i + w1[j]] = Math.Max(dp1[i + w1[j]], dp1[i] + v1[j]);
				}
			}
		}
		
		int maxN = 0;
		for(int i=0;i<=N;i++){
			maxN = Math.Max(maxN, dp1[i] + N - i);
		}
		//Console.WriteLine(maxN);
		
		long[] dp2 = new long[maxN + 1];
		int[] w2 = new int[]{G[1], S[1], B[1]};
		int[] v2 = new int[]{G[0], S[0], B[0]};
		
		for(int i=0;i<=maxN;i++) dp2[i] = -Inf;
		dp2[0] = 0;
		for(int j=0;j<3;j++){
			for(int i=0;i<=maxN;i++){
				if(dp2[i] == -Inf) continue;
				if(i + w2[j] <= maxN){
					dp2[i + w2[j]] = Math.Max(dp2[i + w2[j]], dp2[i] + v2[j]);
				}
			}
		}
		
		long maxNN = 0;
		for(int i=0;i<=maxN;i++){
			maxNN = Math.Max(maxNN, dp2[i] + maxN - i);
		}
		
		Console.WriteLine(maxNN);
		
	}
	int N;
	int[] G,S,B;
	public Sol(){
		N = ri();
		G = new int[2];
		S = new int[2];
		B = new int[2];
		for(int i=0;i<2;i++){
			var d = ria();
			G[i] = d[0];
			S[i] = d[1];
			B[i] = d[2];
		}
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 206304
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll K;
    cin >> K;
    ll ans = 0;
    rep(i,0,K){
        rep(j,0,K){
            rep(k,0,K){
                ans += gcd(i+1, gcd(j+1, k+1));
            }
        }
    }
    print(ans);

}

Measured memory_bytes: 3652
def reconstruction(left, right):
    if left >= right:
        return

    global position, pre, ino, post
    root = pre[position]
    position += 1

    mid = ino.index(root)  # inoでのrootのポジション
    reconstruction(left, mid)
    reconstruction(mid + 1, right)

    post.append(root)


n = int(input())

pre = list(map(int, input().split()))
ino = list(map(int, input().split()))
post = []

position = 0
reconstruction(0, n)

print(' '.join(map(str, post)))



Measured memory_bytes: 5600
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		HashMap<Integer, Integer> a = new HashMap<>();
		for (int i = 0; i < n; i++) {
			int key = sc.nextInt();
			if (a.containsKey(key)) {
				a.put(key, a.get(key) + 1);
			} else {
				a.put(key, 1);
			}
		}
		sc.close();

		int answer = 0;
		if (k >= a.size()) {
			answer = 0;
		} else {
			List<Entry<Integer, Integer>> entries = new ArrayList<Entry<Integer, Integer>>(a.entrySet());
			Collections.sort(entries, new Comparator<Entry<Integer, Integer>>() {
				public int compare(Entry<Integer, Integer> obj1, Entry<Integer, Integer> obj2) {
					return obj1.getValue().compareTo(obj2.getValue());
				}
			});

			int fusoku = a.size() - k;
			for (int i = 0; i < fusoku; i++) {
				answer += entries.get(i).getValue();
			}
		}
		System.out.println(answer);
	}
}

Measured memory_bytes: 100376
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

constexpr int MOD = 1000000007;

int mod(ll x){
    return x > 0 ? x % MOD : (x+MOD) % MOD;
}

int modm(ll x,ll m){
    return x * m % MOD;
}

int modpow(ll x, ll p) {
    int ret = 1;
    while(p > 0) {
        if (p & 1) ret = modm(ret,x);
        x = modm(x,x);
        p >>= 1;
    }
    return ret;
}

// x * modinv(d)
int modd(ll x,ll d) {
    return modm(x,modpow(d,MOD-2));
}

int main(void)
{
    IOS
    int n, m;
    cin >> n >> m;
    int ans = 0;
    if (abs(n-m) < 2) {
        int fn = 1,fm = 1;
        FOR(i,2,n+1) fn = modm(fn,i);
        FOR(i,2,m+1) fm = modm(fm,i);
        ans = modm(fn,fm);
    }

    if (abs(n-m) == 0) ans = modm(ans,2);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define PI 				acos(-1)
#define mp				make_pair
#define pb				push_back
#define all(a)			(a).begin(), (a).end()
#define sz(a)			a.size()
#define srt(a)			sort(all(a))
#define mem(a, h)		memset(a, (h), sizeof(a))
#define f 				first
#define s 				second
#define MOD1			998244353
#define fore(i, b, e)	for(int i = b; i < e; i++)
#define forg(i, b, e, m)	for(int i = b; i < e; i+=m)
int in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
using namespace __gnu_pbds;

typedef long long 		ll;
typedef unsigned long long 		ull;
typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//find_by_order kth largest  order_of_key <
const int tam = 100010;
const int MOD = 1e9+7;
const double EPS = 1e-9;
int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	//freopen("qwe.txt", "r", stdin);
	//freopen("asd.txt", "w", stdout);
	int n, m, q;
	cin>>n>>m>>q;
	int res[n][n];
	vector<int> posi[n];
	int a, b;
	int sus[n];
	mem(sus, 0);
	mem(res, 0);
	while(m--)
	{
		cin>>a>>b;
		posi[a-1].pb(b-1);
		sus[b-1]++;
	}
	fore(i, 0, n)
	{
		fore(j, i, n)
		{
			res[i][j] = sus[j];
			if(j > i)
				res[i][j] += res[i][j-1];
		}
		fore(j, 0, posi[i].size())
			sus[posi[i][j]]--;
	}
	while(q--)
	{
		cin>>a>>b;
		cout<<res[a-1][b-1]<<'\n';
	}
	return 0;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS2

Measured memory_bytes: 3200
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;

const int maxl=3e5+10;

ll n,m,cas,k,cnt,tot;
ll ans;
int a[maxl],b[maxl];
char s[maxl];
bool in[maxl]; 

inline void prework()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
} 

inline void mainwork()
{
	cnt=0;ans=1000;ll d;a[n+1]=0;
	for(int i=1;i<=n;i++)
	{
		d=ans/a[i];
		cnt+=d;ans-=d*a[i];
		if(a[i+1]<a[i])
			ans+=cnt*a[i],cnt=0;
	}
}

inline void print()
{
	printf("%lld",ans);
}

int main()
{
	int t=1;
	//scanf("%d",&t);
	for(cas=1;cas<=t;cas++)
	{
		prework();
		mainwork();
		print();
	}
	return 0;
}

Measured memory_bytes: 3828
#include <numeric>
#include<iostream>
#include<set>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
using namespace std;
#define inf 1000000007
#define int long long
#define rep(i,j,n) for(int i=j;i<n;i++)
typedef pair<int,int>  P;
struct edge{int to,cost;};
double pi = 3.141592653589793;
//使うやつはここから下に置こうな
int fact(int x,int y){
    if(y==1)return x;
    else if(y%2==0)return (fact(x*x%inf,y/2))%inf;
    else return fact(x*x%inf,y/2)%inf*x%inf;
}
signed main(){
    int n,c;cin>>n>>c;//nをc乗します
    cout<<fact(n,c)<<endl;
    return 0;
}



Measured memory_bytes: 3116
#include <algorithm>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using LL = long long;
#define eps 1e-8
#define fi first
#define se second
#define eb emplace_back
#define int long long
#define close \
    std::ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
#define FOR(i, x, y) for (LL i = (x), _##i = (y); i < _##i; ++i)
#define FORD(i, x, y) for (LL i = (x), _##i = (y); i > _##i; --i)
#define SORT_UNIQUE(c)         \
    (sort(c.begin(), c.end()), \
     c.resize(distance(c.begin(), unique(c.begin(), c.end()))))
#define CASET    \
    int ___T;    \
    cin >> ___T; \
    for (int __CS = 1; __CS <= ___T; __CS++)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
mt19937 dlsrand(random_device{}());
mt19937 mrand(std::chrono::system_clock::now().time_since_epoch().count());
int rnd(int x) { return mrand() % x; }
LL bin(LL x, LL n, LL MOD) {
    LL ret = MOD != 1;
    for (x %= MOD; n; n >>= 1, x = x * x % MOD)
        if (n & 1) ret = ret * x % MOD;
    return ret;
}
inline LL get_inv(LL x, LL p) { return bin(x, p - 2, p); }
const double PI = acos(-1.0);
constexpr int maxn = 1e6 + 10;
constexpr int INF = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3f;
constexpr int mod = 1e9 + 7;
void add(int &a, int b) {
    a += b;
    if (a >= mod) a -= mod;
}
void dec(int &a, int b) {
    a -= b;
    if (a < 0) a += mod;
}

int a[maxn];
int32_t main() {
    int n, m;
    // vector<int >a(n+10);
    int sum = 0;
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        sum += a[i];
    }
    long double zz = (1.0 * sum / (4 * m));
    int cc = 0;
    for(int i = 1; i <= n; i++){
        if(1.0*a[i] >= zz)cc++;
    }
    cout << ((cc>=m)?"Yes":"No");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;

typedef complex<double> P;
typedef vector<P> G;
#define here(g, i) g[i]
#define next(g, i) g[(i + 1) % g.size()]
#define prev(g, i) g[(i - 1 + g.size()) % g.size()]
const double EPS = 1e-10;
const double INF = 1e12;

struct L {
    P a, b, v;
    L(){}
    // L(P _a, P _b) {a = _a, b = _b, v = b - a;}
    L(P _a, P _b) : a(_a), b(_b), v(_b - _a) {}
    L(double _ax, double _ay, double _bx, double _by)
        : a(P(_ax, _ay)), b(P(_bx, _by)), v(b - a) {}
};

double cross(P a, P b) {
    return imag(conj(a) * b);
}

double dot(P a, P b) {
    return real(conj(a) * b);
}

// 2: parallel
// 1: orthogonal
// 0: otherwise
int relationLL(L l1, L l2) {
    if (cross(l1.v, l2.v) == 0) return 2;
    if (dot(l1.v, l2.v) == 0) return 1;
    return 0;
}

signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    int q;
    cin >> q;
    while (q--) {
        double v[4][2];
        rep(i, 4) rep(j, 2) cin >> v[i][j];
        L l1(v[0][0], v[0][1], v[1][0], v[1][1]);
        L l2(v[2][0], v[2][1], v[3][0], v[3][1]);
        cout << relationLL(l1, l2) << endl;
    }

}

Measured memory_bytes: 3300
# coding: utf-8
minutes = [int(input()) for _ in range(5)]
time=0
l=[]
 
for i in minutes:
    time = time + i
    if(i%10==0):
        l.append(0)
    else:
        l.append(10-i%10)
 
l.sort()
time += sum(l[:-1])
print(time)

Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;


int main(){
  int n;
  cin >> n;
  int a;
  for (int i=0; i<n; i++) {
    cin >> a;
    if (a%2==0 && (a%3!=0 && a%5!=0)) {
      cout << "DENIED" << endl;
      return 0;
    }
  }
  cout << "APPROVED" << endl;

  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <set>
#include <string>
#include <vector>
#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
const int MOD = 1000000007;
int main() {
    int N;
    cin >> N;
    string d[110];
    rep(i,0,N){
        cin>>d[i];
    }
    set<string> W;
    int i;
    string mae = "";
    for(i = 0; i < N; i++) {
        string x =d[i];
        bool shiri = true;
        if(i != 0) {
            if(x[0] != mae[mae.size() - 1]) {
                shiri = false;
            }
        }
        if(!shiri || W.count(x) != 0) {
            cout << "No" << endl;
            break;
        } else {
            W.insert(x);
            mae = x;
        }
    }
    if(i == N) {
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 256
# ABC147b


def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)

    # map(int,input().split())
    s = input()[:-1]
    ans = 0
    for i in range(len(s) // 2):
        if s[i] != s[-i-1]:
            #print(s[i], s[-i-1])
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b;
    cin>>a>>b;
    if(a<9&&b<9)
    {
        cout << "Yay!"<<endl;
    }
    else{
        cout << ":("<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
     
using namespace std;
    
#define ll long long int
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
 

int main()
{
    fio
    ll tt=1;
    //cin>>tt;
    while(tt--)
    {
        ll n,k;
        cin>>n>>k;
        ll a[n+1],i;
        for(i=1;i<=n;i++) cin>>a[i];
        ll x=1,c=0,y,z,place;
        unordered_map <ll,ll> mp,loc;
        loc[x]=0;
        mp[1]++;
        while(1)
        {
            x=a[x];
            mp[x]++;
            c++;
            if(mp[x]>1)
            {
                y=loc[x];
                z=c;
                place=x;
                break;
            }
            loc[x]=c;
        }
        if(k<z)
        {
            x=1;
            c=0;
            while(c<k)
            {
                x=a[x];
                c++;
            }
            cout<<x<<endl;
        }
        else
        {
            ll p,q;
            p=k-z;
            q=p%(z-y);
            c=0;
            x=place;
            while(c<q)
            {
                x=a[x];
                c++;
            }
            cout<<x<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 20940
#include<stdio.h>
#include <iomanip>
#include <iostream>
#include<string>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include <random>
#include <chrono>

#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;
int main() {
	int n;
	double tmp;
	cin >> n;
	tmp = n / 2;
	if (n % 2 != 0) {
		tmp++;
	}
	cout <<(double) 1 / n * tmp;

}

Measured memory_bytes: 888
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner s = new Scanner(System.in);

		while (true) {
			int n = s.nextInt();
			if (n == 0)
				break;

			int W = s.nextInt();
			int H = s.nextInt();

			int[][] field = new int[H][W];

			for (int i = 0; i < n; i++) {
				int x = s.nextInt();
				int y = s.nextInt();
				field[y - 1][x - 1] = 1;
			}

			int S = s.nextInt();
			int T = s.nextInt();

			int count = 0;
			int max = 0;

			for (int y = 0; y < H - T + 1; y++) {
				for (int x = 0; x < W - S + 1; x++) {
					for (int i = 0; i < T; i++) {
						for (int j = 0; j < S; j++) {
							// field[i + y][j + x] = 2;
							if (field[i + y][j + x] == 1)
								count++;
						}
					}
					if (max < count)
						max = count;
					count = 0;
				}
			}

			/*
			 * for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) {
			 * System.out.print(field[i][j]); } System.out.println(); }
			 */
			System.out.println(max);
		}
		s.close();
	}
}

Measured memory_bytes: 35612
#include<iostream>
#include<math.h>
using namespace std;
int main() {
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	int sum = a + b + c;
	int max = a>b ? a : b;
	max = max>c ? max : c;
	sum = sum-max+max*pow(2,k);
	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 256
icase=0
if icase==0:
    n=int(input())
    a=[]
    for i in range(n):    
        ai=int(input())
        a.append(ai)
    icnt=0
    i=1
    while icnt<n:
        icnt=icnt+1
        i=a[i-1]    
#        print("i:",i,a[i-1])
        if i==2:
            print(icnt)
            icnt=-10
            break
    if icnt!=-10:
        print(-1)
    


Measured memory_bytes: 7084
from sys import stdin
rs = lambda : stdin.readline().strip()
ri = lambda : int(rs())
ril = lambda : list(map(int, rs().split()))

def main():
    s = rs()
    if s[-1] == 's':
        s += 'es'
    else:
        s += 's'
    print(s)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9096
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int x,y,flag=0;

  cin>>x>>y;

  if(y%2)
    cout<<"No";

  else
  {
     if(x*2<=y && x*4>=y)
        cout<<"Yes";
    else
        cout<<"No";
  }
  return 0;
}


Measured memory_bytes: 3636
n = int(input())
a = list(map(int, input().split()))
q = int(input())
B = [list(map(int, input().split())) for _ in range(q)]

from collections import Counter
ans = sum(a.copy())
a = Counter(a)

for (b, c) in B:
    ans += a[b] * (c-b)
    print(ans)
    a[c] += a[b]
    a[b] = 0


Measured memory_bytes: 103924
#include <cstdio>
int n, s, t, c, mx, v[35][100005], cnt[100005];
int main() {
	scanf("%d%*d", &n);
	while(n--) {
		scanf("%d%d%d", &s, &t, &c);
		for(int i=s; i<=t; i++) {
			if(!v[c][i]) {
				v[c][i] = 1;
				cnt[i]++;
				if(cnt[i] > mx) mx = cnt[i];
			}
		}
	}
	printf("%d", mx);
	return 0;
}

Measured memory_bytes: 12288
N, Y = map(int, input().split(" "))

for i in range(N+1):
    for j in range(N+1-i):
        k = N-i-j
        if (10000*i + 5000*j + 1000*k) == Y:
            print(i, j, k)
            exit()

print("-1 -1 -1")

Measured memory_bytes: 2940
#include <stdio.h>

int main(void)
{
  int sum,pri,i;

  for(;;){
    scanf("%d", &sum);
    if(sum==0) break;

    pri=0;
    for(i=0;i<9;i++){
      scanf("%d", &pri);
      sum=sum-pri;
    }

    printf("%d\n", sum);
  }

  return 0;
}


Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;

int k[2024], f[2000005], a[2000005], g[2000005];
string s;
long long ans;

int main()
{
	cin >> s;
	int len = s.size();
	for (int i = 0; i < len; i++) a[i + 1] = s[i] - '0';
	int l = 1;
	for (int i = len; i >= 1; i--)
	{
		g[i] = l;
		l *= 10;
		l %= 2019;
	}
	
	for (int i = len; i >= 1; i--)
	{
		f[i] = (f[i + 1] + a[i] * g[i]) % 2019;
		k[f[i]]++;
	}
	int ans = k[0];
	for (int i = 0; i < 2019; i++)
		ans += k[i] * (k[i] - 1) / 2;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 6100
#include<bits/stdc++.h>

using namespace std;

typedef long long int64;

vector< int64 > Divisor(int64 n)
{
  vector< int64 > ret;
  for(int64 i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}


int main()
{
  int aa[6] = {};
  string S;

  cin >> S;

  string buff;
  bool rev = false;
  for(int i = 0; i <= S.size(); i++) {
    if(i == S.size() || S[i] == '+' || S[i] == '-') {
      int fg = 0, ptr = 0;
      if(isdigit(buff[ptr])) {
        while(ptr < buff.size() && isdigit(buff[ptr])) {
          fg = fg * 10 + buff[ptr++] - '0';
        }
        if(ptr == buff.size()) {
          aa[0] += fg * (rev ? -1 : 1);
          continue;
        }
      }
      ++ptr;
      ++ptr;
      int ps = 0;
      while(ptr < buff.size() && isdigit(buff[ptr])) {
        ps = ps * 10 + buff[ptr++] - '0';
      }
      aa[max(1, ps)] = max(1, fg) * (rev ? -1 : 1);
      buff.clear();
      if(S[i] == '-') rev = true;
      else rev = false;
    } else {
      buff += S[i];
    }
  }

  int big = 0;
  for(int i = 0; i <= 5; i++) {
    if(aa[i] != 0) big = i;
  }


  vector< int64 > beet_puro = Divisor(abs(aa[0]));

  for(int64 i: beet_puro) {

    for(int64 j : beet_puro) {
      for(int64 k : beet_puro) {
        for(int64 l : beet_puro) {
          int64 fact = i * j * k * l;
          if(fact > abs(aa[0])) continue;
          if(aa[0] % fact != 0) continue;
          int64 m = abs(aa[0]) / fact;

          for(int n = 0; n < (1 << 5); n++) {
            bool ismatch = true;
            vector< int64 > vs = {i, j, k, l, m};


            for(int64 ei = 0; ei < 5; ei++) {
              if(ei >= big) {
                vs[ei] = 0;
              } else if((n >> ei) & 1) vs[ei] *= -1;

            }

            vector< int64 > proc(6, 0);
            for(int ei = 0; ei < (1 << 5); ei++) {
              int odd = __builtin_popcount(ei);
              int64 facto = 1;
              for(int latte = 0; latte < 5; latte++) {
                if((ei >> latte) & 1) facto *= vs[latte];
              }
              if(big - odd >= 0) proc[big - odd] += facto;
            }


            for(int malta = 0; malta < 5; malta++) {
              if(proc[malta] != aa[malta]) {
                ismatch = false;
                break;
              }
            }


            if(ismatch) {
              sort(begin(vs), end(vs));
              for(int uku = 0; uku < vs.size(); uku++) {
                if(vs[uku] == 0) continue;
                cout << "(x";
                if(vs[uku] > 0) cout << "+";
                cout << vs[uku] << ")";
              }
              cout << endl;
              return (0);
            }

          }
        }
      }
    }
  }


}

Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define INF 1000000000000001
#define ll long long
using namespace std;

int main()
{
  ll N;
  cin >> N;
  vector<vector<ll>> dp(9, vector<ll>(9, 0));
  for (ll i = 1; i < N + 1; ++i)
  {
    ll front = i;
    ll back = i % 10;
    if (back == 0)
    {
      continue;
    }
    while (true)
    {
      if (front / 10 == 0)
      {
        break;
      }
      front /= 10;
    }
    // cout << front << back << endl;
    dp.at(front - 1).at(back - 1) += 1;
  }
  // cout << front << back << endl;
  ll ans = 0;
  for (ll front = 0; front < 9; ++front)
  {
    for (ll back = 0; back < 9; ++back)
    {
      ans += dp.at(front).at(back) * dp.at(back).at(front);
      // cout << dp.at(front).at(back) << ' ';
    }
    // cout << endl;
  }
  cout << ans << endl;
}


Measured memory_bytes: 764
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int sumA = 0;
		int sumB = 0;
		for(int i=0;i<4;i++)sumA += stdIn.nextInt();
		for(int j=0;j<4;j++)sumB += stdIn.nextInt();
		if(sumA >= sumB)System.out.println(sumA);
		else if(sumA < sumB)System.out.println(sumB);
	}
}

Measured memory_bytes: 12000
<?php
fscanf(STDIN, "%s", $s);
$len = strlen($s);
for($i = 0; $i < $len; $i++) {
    for($j = 0; $j < $len; $j++) {
        if($i == $j) continue;
        if($s[$i] == $s[$j]) {
            echo 'no'. "\n";
            exit;
        }
    }
}
echo 'yes'. "\n";

Measured memory_bytes: 4604
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstdio>
#include<vector>
#include<cctype>
#include<cstdlib>
#include<cstring>
#include<utility>
#include<algorithm>

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define For(i,x,y) for(int i=((int)x);i<=((int)y);i++)
#define Dep(i,y,x) for(int i=((int)y);i>=((int)x);i--)
#define Rep(i,x) for (int y,i=head[x];i;i=E[i].nxt)
using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef pair<int,int> pii;

int rd() {
	char c=getchar(); int t=0,f=1;
	while (!isdigit(c)) f=(c=='-')?-1:1,c=getchar();
	while (isdigit(c)) t=t*10+c-48,c=getchar(); return t*f;
}
void wt(int x) {
	if (x<0) putchar('-'),wt(-x);
	else { if (x>9) wt(x/10); putchar(x%10+48); }
}

const int N=100035;
const int mod=1000000007;

int n,m,x[N],y[N],sum,ans;

int main() {
	n=rd(),m=rd();
	For (i,1,n) x[i]=rd();
	For (i,1,m) y[i]=rd();
//	reverse(y+1,y+m+1);
	For (i,1,m/2) swap(y[i],y[m-i+1]);
	For (i,1,m-1)
		sum=(sum+1ll*(y[i]-y[i+1])*i%mod*(m-i)%mod)%mod;
	For (i,1,n-1)
		ans=(ans+1ll*(x[i+1]-x[i])*i%mod*(n-i)%mod*sum%mod)%mod;
	printf("%d\n",ans);
	return 0;
}






Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
bool passed[410][410];
int ans;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int H, W;
    cin >> H >> W;
    vector<string> S(H);
    queue<pair<int, int>> q;
    for (auto & s : S) cin >> s;
    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            if (S[i][j] == '#') continue;
            q.push({i, j});
            int dist = 0;
            passed[i * W + j][i * W + j] = true;
            while (!q.empty()) {
                int size = q.size();
                ans = max(dist++, ans);
                while (size--) {
                    auto f = q.front();
                    q.pop();
                    if (f.first != 0 && S[f.first - 1][f.second] != '#' &&
                        !passed[i * W + j][(f.first - 1) * W + f.second]) {
                        q.push({f.first - 1, f.second});
                        passed[i * W + j][(f.first - 1) * W + f.second] = true;
                    }
                    if (f.second != 0 && S[f.first][f.second - 1] != '#' &&
                        !passed[i * W + j][(f.first) * W + f.second - 1]) {
                        q.push({f.first, f.second - 1});
                        passed[i * W + j][(f.first) * W + f.second - 1] = true;
                    }
                    if (f.first != H - 1 && S[f.first + 1][f.second] != '#' &&
                        !passed[i * W + j][(f.first + 1) * W + f.second]) {
                        q.push({f.first + 1, f.second});
                        passed[i * W + j][(f.first + 1) * W + f.second] = true;
                    }
                    if (f.second != W - 1 && S[f.first][f.second + 1] != '#' &&
                        !passed[i * W + j][(f.first) * W + f.second + 1]) {
                        q.push({f.first, f.second + 1});
                        passed[i * W + j][(f.first) * W + f.second + 1] = true;
                    }
                }
            }
        }
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))
typedef long long ll;

#define MOD 1000000007

int main(){
    
    ll N; cin>>N;
    
    map<int,int> yakusu;
    for (int i=2;i<=N;i++){
        int j=2;
        int t = i;
        while(t!=1){
            if(t%j==0){
                if(yakusu.find(j)==yakusu.end())yakusu[j]=1;
                else yakusu[j]++;
                t/=j;
            }else{
                j++;
            }
        }
    }
    
    ll ans=1;
    for(auto itr=yakusu.begin();itr!=yakusu.end();itr++){
        ans*=(itr->second+1);
        ans%=MOD;
    }
    
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;


int main() {
  string str;
  int q;
  int flag = 0;
  cin >> str >> q;
  int qu[q];
  for(int i = 0;i<q;i++){
    cin >> qu[i];
    if(qu[i]==1){
      flag = (flag + 1)%2;
    }
    else if(qu[i]==2){
      int f;
      char c;
      cin >> f >> c;
      if((f+flag)%2==1){
        str.insert(str.begin(), c);
      }
      else if((f+flag)%2==0){
        str.push_back(c);
      }
    }
  }
  if(flag==0){
    cout<< str<< endl;
  }
  else{
    reverse(str.begin(),str.end());
    cout << str << endl;
  }
}


Measured memory_bytes: 1796
//雪花飄飄北風嘯嘯
//天地一片蒼茫

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl;

#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

ll MAX(ll a){return a;}
ll MIN(ll a){return a;}
template<typename... Args>
ll MAX(ll a,Args... args){return max(a,MAX(args...));}
template<typename... Args>
ll MIN(ll a,Args... args){return min(a,MIN(args...));}

#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

const int MOD=1000000007;

string s;
int k;

int memo[100005][105];
int dp(int i,int curr){
	if (i==sz(s)) return (curr==0);
	if (memo[i][curr]!=-1) return memo[i][curr];
	
	int res=0;
	rep(x,0,10){
		res=(res+dp(i+1,(curr+x)%k))%MOD;
	}
	
	return memo[i][curr]=res;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	memset(memo,-1,sizeof(memo));
	
	cin>>s;
	cin>>k;
	
	int curr=0;
	int ans=0;
	rep(x,0,sz(s)){
		int val=s[x]-'0';
		
		rep(y,0,val){
			//cout<<x+1<<" "<<(curr+y)%k<<" "<<dp(x+1,(curr+y)%k)<<endl;
			ans=(ans+dp(x+1,(curr+y)%k))%MOD;
		}
		curr=(curr+val)%k;
	}
	
	if (curr==0) ans++;
	ans=(ans-1+MOD)%MOD;
	
	cout<<ans<<endl;
}


Measured memory_bytes: 45308
#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
  int N,K;
  cin >> N >> K;
  vector<int> l(N);
  for(int i = 0;i<N;i++){
    cin >> l[i];
  }
  sort(l.begin(),l.end());
  reverse(l.begin(),l.end());
  int ans  =0;
  for(int i = 0;i<K;i++){
    ans += l[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int n;
	cin >> n;
	
	vector<long long> x(1000,0);
	long long ans = 1;
	for(int i = 2; i <= n; i++)
	{
		int cnt = 0;
		int tmp = i;
		
		while(tmp != 1)
		{
			for(int j = 2; j <= tmp; j++)
			{
				if(tmp % j == 0)
				{
					tmp /= j;
					x[j]++;
					break;
				}
			}
		}
	}
	
	sort(x.begin(), x.end(), [](long long& a, long long& b){ return a > b;});
	
	int i = 0;
	while(x[i] != 0)
	{
		ans *= x[i] + 1;
		ans %= 1000000007;
		i++;
	}
	
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>


int main(void){

  for(;;){

    int s,i=1,c[101]={0};
   
    (void)getchar();
    s=getchar();
    if(s=='.')break;

    switch(s){
    case '(' : c[i++]=1; break;
    case ')' : c[i++]=-1; break;
    case '[' : c[i++]=2; break;
    case ']' : c[i++]=-2; break;
    }
    
    while((s=getchar())!='.'){
      switch(s){
      case '(' : c[i++]=1; break;
      case ')' : c[i++]=-1; break;
      case '[' : c[i++]=2; break;
      case ']' : c[i++]=-2; break;
      }
      
      if(c[i-1]<0&&c[i-1]+c[i-2]==0){
        c[i-1]=0;
        c[i-2]=0;
        i-=2;
      }
    }
    
    if(c[1]==0)puts("yes");
    else puts("no");
    
  }

  return 0;
}

Measured memory_bytes: 524
#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int main(){
  string s;
  cin>>s;
  ll n;
  cin>>n;
  if(s[0]=='1'){
    rep(i,n){
      if(s[i]=='1') continue;
      COUT(s[i]);
      return 0;
    }
    COUT(s[0]);
  }
  else{
    COUT(s[0]);
  }
  
}


Measured memory_bytes: 384
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		HashMap<Character, Integer> map = new HashMap<>();
		map.put('s', sc.nextInt());
		map.put('p', sc.nextInt());
		map.put('r', sc.nextInt());
		char[] arr = sc.next().toCharArray();
		int total = 0;
		for (int i = 0; i < n; i++) {
		    if (i >= k && arr[i] == arr[i - k]) {
		        arr[i] = 'x';
		    } else {
		        total += map.get(arr[i]);
		    }
		}
		System.out.println(total);
	}
}


Measured memory_bytes: 40120
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VRSORT(v) sort(v.begin(), v.end(),greater<int>());
#define INF 999999999
#define MOD 1000000007
#define M_PI 3.14159265358979323846
#define ALL(X) (X).begin(),(X).end()

#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 0};
int dy[]={0, 1, 0, -1, 0};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
const int NIL = -1;
static mt19937 _g(time(nullptr));
 
std::string pad(int num){ char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer;}
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }


int N,K;
vector<double> P;

void input(){
  #ifdef __LOCAL
    fs::path p = __FILE__;
    fs::path input,output;
    input = output = p.parent_path();
    input += string("/input/") + string(p.stem()) + string(".txt");
    output += string("/output/") + string(p.stem()) + string(".txt");
    freopen(input.c_str(), "r", stdin);
    freopen(output.c_str(), "w", stdout);
  #endif
  cin >> N >> K;
  REP(i,N){
    double p;
    cin >> p;
    p = (p+1)/2;
    P.push_back(p);
  }

}

int solve(){
  input();
  DBG(P)
  double res = 0;
  double ans = accumulate(P.begin(),P.begin()+K,0.0);
  res = max(res,ans);
  for(int i=0;(K+i)<N;i++){
    DBG(res)
    ans += P[K+i];
    ans -= P[i];
    res = max(res,ans);
  }
  cout << fixed << setprecision(10) << res << endl;
  return 0;
}

int main()
{
  solve();
  return 0;
}


Measured memory_bytes: 2420
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,s,n) for(int i=s;i<n;i++)
#define fi first
#define se second
#define all(c) c.begin(),c.end()
typedef long long int ll;
typedef pair<int, int> P;
typedef long double ld;
void Ans(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}

const ll INF=1001001001;
const ll mod=1000000007;

int main(){
  int n;cin>>n;
  int c=0;
  rep(i,9){
    int j=i+1;
    int now=n;
    if(n%j!=0) continue;
    now/=j;
    if(now<10) c++;
  }
  Ans(c>0);
}

Measured memory_bytes: 256
//解説すごいなー

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], *ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);


	int N = getint();
	pair<int, int> XY[200000];
	int saidai = 0;
	int saishou = 1e9;
	int saidai2 = 0;
	int saishou2 = 1e9;
	rep(i, N) {
		int x = getint();
		int y = getint();
		if (x > y) swap(x, y);
		saidai = max(saidai, y);
		saidai2 = max(saidai2, x);
		saishou = min(saishou, x);
		saishou2 = min(saishou2, y);
		*(XY + i) = mp(x, y);
	}
	ll kotae = 1ll * (saidai - saishou2) * (saidai2 - saishou);

	sort(XY, XY + N);

	int saidai3 = saidai2;
	int saishou3 = 1e9;
	int mae = saishou;
	rep(i, N) {
		if ((*(XY + i)).first != mae) {
			kotae = min(kotae, 1ll * (saidai - saishou) * (saidai3 - min((*(XY + i)).first, saishou3)));
			if ((*(XY + i)).first > saishou3) break;
		}
		saidai3 = max(saidai3, (*(XY + i)).second);
		saishou3 = min(saishou3, (*(XY + i)).second);
		mae = (*(XY + i)).first;
	}
	kotae = min(kotae, 1ll * (saidai - saishou) * (saidai3 - saishou3));
	co(kotae);

	cin >> N;

	Would you please return 0;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
int main() {
    int a;
  cin >> a;
    if(to_string(a).find("7")!= string::npos ){
        cout << "Yes" << endl;
     }
    else{
        cout << "No" << endl;
     }
     return 0;
}

Measured memory_bytes: 3756
package main;

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
)

func main() {
	sc := NewScanner()
	N, A, B := sc.NextInt(), sc.NextInt(), sc.NextInt()
	X := sc.NextIntArray()

	ans := 0
	for i := 1; i < N; i++ {
		ans += min(A * (X[i] - X[i - 1]), B)
	}
	fmt.Println(ans)

}

func min(a int, b int) int {
	if a < b {
		return a
	}
	return b
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r:rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf) + 1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf) + 1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 6912
A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
p A[gets.to_i-1]


Measured memory_bytes: 1788
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;

int main(void){
  int N;
  while(cin>>N,N){
  	pair<int,int> sqp[200];
  	sqp[0].first=0;sqp[0].second=0;
  	int maxx=0,maxy=0,minx=0,miny=0;
  	for(int i=1,n,d;i<N;++i){
    	cin>>n>>d;
  		int x=sqp[n].first,y=sqp[n].second;
  		sqp[i].first=x;
  		sqp[i].second=y;
  		if(d%2==0) sqp[i].first=x+((d/2)?1:-1);
  		else sqp[i].second=y+((d/2)?-1:1);
  		maxx=max(sqp[i].first,maxx);
  		minx=min(sqp[i].first,minx);
  		maxy=max(sqp[i].second,maxy);
  		miny=min(sqp[i].second,miny);
  		//cerr<<maxx<<" "<<minx<<" "<<maxy<<" "<<miny<<" "<<endl;
  	}
  	cout<<(maxx-minx+1)<<" "<<(maxy-miny+1)<<endl;
  }
  return 0;
}

Measured memory_bytes: 1164
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
using namespace std;
int a,ans=0;
int main(){
    cin>>a;
    for(int i=105;i<=a;i+=2){
    	int tmp=0;
    	for(int j=1;j<=i;j++){
    		if(i%j==0)tmp++;
		}
		if(tmp==8)ans++;
	}
    cout<<ans<<endl;
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

const int INF = 1001001001;
int main(){
	int n;
	cin >> n;
	vector<int> b(n-1);
	rep(i,n-1) cin >> b[i];
	vector<int> a(n,INF);
	rep(i,n-1){
		a[i] = min(a[i],b[i]);
		a[i+1] = min(a[i+1],b[i]);
	}
	int ans = 0;
	rep(i,n) ans += a[i];
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3612
#include <stdio.h>

int main()
{
    int h, w, i;
    char str[100][101];
    scanf("%d%d", &h, &w);
    for (i=0; i<h; i++)
    {
        scanf("%s", str[i]);
    }
    for (i=0; i<h; i++)
    {
        printf("%s\n%s\n", str[i], str[i]);
    }
    return 0;
}


Measured memory_bytes: 128
#include<stdio.h>

int Array[100001];
int part(int,int);

int main(){
  int i;
  int j;
  int num;
  int data;

  scanf("%d",&num);

  for(i = 0;i < num;i++){
    scanf("%d",&Array[i]);
  }

  data = part(0,num - 1);

  for(i = 0;i < num;i++){
    if(i != 0){
      printf(" ");
    }
    if(i == data){
      printf("[");
    }
    printf("%d",Array[i]);
    if(i == data){
      printf("]");
    }
  }
  printf("\n");
  return 0;
}

int part(int d,int n){
  int change;
  int i;
  int j;
  int text;

  change = Array[n];
  i = d - 1;

  for(j = d;j < n;j++){
    if(change >= Array[j]){
      text = Array[j];
      Array[j] = Array[i + 1];
      Array[i + 1] = text;
      i++;
    }
  }

  text = Array[i + 1];
  Array[i + 1] = Array[n];
  Array[n] = text;

 return i + 1;
}



Measured memory_bytes: 2112
#![allow(unused_imports)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;
use std::ops::Bound::*;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    println!("{}", 1 - n);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 2116
#include <stdio.h>

int main(void)
{
    int n ,m;
    int A[1000];
    int i ,j ,v ,t;
    
    scanf("%d" , &n);

    for (m = 0 ; m < n ; m++) {
            scanf("%d" , &A[m]);
    }
    
    /*Insertion Sort*/
    for (i = 1 ; i <= n - 1; i++) {
        
        for (t = 0 ; t < n - 1 ; t++)
            printf("%d " , A[t]);
        printf("%d\n" , A[n - 1]);
        
        v = A[i];
        j = i - 1;
        
        while (j >= 0 && A[j] > v) {
            
            A[j+1] = A[j];
            j--;
            A[j+1] = v;
            
        }
    }
    /*for last line*/
    for (t = 0 ; t < n - 1 ; t++)
        printf("%d " , A[t]);
    printf("%d\n" , A[n - 1]);
    
    return 0;
}



Measured memory_bytes: 2064
#include <bits/stdc++.h>
using namespace std;

int main() {
  string S;
  cin >> S;
  char aa = S.at(2);
  char bb = S.at(3);
  char cc = S.at(4);
  char dd = S.at(5);
  
  if( aa==bb && cc == dd){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
/**
 * CircleInRectangle.cpp
 * Create:20180418
 * Description:5つの整数W,H,x,y,rが空白区切りで１行に与えられる。
 * 円が長方形の内部に含まれるならYes、一部でもはみ出るならNoと表記する。
 */
#include <iostream>

bool isInRange(int width, int height, int x, int y, int r){
  int minX = x - r;
  int minY = y - r;
  int maxX = x + r;
  int maxY = y + r;

  if (minX >= 0 && minY >= 0 && width >= maxX && height >= maxY){
      return true;
  }

  return false;
}

int main(int argc, char* argv[]){
  int width, height;  // 枠の長方形の大きさ
  int x, y;           // 円の中心座標
  int r;              // 円の半径

  // 入力
  std::cin >> width >> height >> x >> y >> r;

  if (isInRange(width, height, x, y, r)){
    std::cout << "Yes" << std::endl;
  } else {
    std::cout << "No" << std::endl;
  }

  return 0;
}


Measured memory_bytes: 3100