akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

//変数
ll A, B, Q;
vector<ll> s, t;
vector<pair<ll, ll>> x;

//解法
void solve() {

	vector<ll> s_min(Q), s_max(Q), t_min(Q), t_max(Q);
	SORTMF(x, [](pair<ll, ll>& x, pair<ll, ll>& y) {return x.first < y.first; });


	ll pos = 0;
	rep(i, A) {
		if (pos == Q) break;
		if (x[pos].first < s[0]) {
			s_min[x[pos].second] = -1;
			s_max[x[pos].second] = s[0];
			pos++;
			i--;
			continue;
		}
		if (i + 1 < A) {
			if (s[i] < x[pos].first && x[pos].first < s[i + 1]) {
				s_min[x[pos].second] = s[i];
				s_max[x[pos].second] = s[i + 1];
				pos++;
				i--;
				continue;
			}
		}
		if (s[A - 1] < x[pos].first) {
			s_min[x[pos].second] = s[A - 1];
			s_max[x[pos].second] = -1;
			pos++;
			i--;
			continue;
		}
	}

	pos = 0;
	rep(i, B) {
		if (pos == Q) break;
		if (x[pos].first < t[0]) {
			t_min[x[pos].second] = -1;
			t_max[x[pos].second] = t[0];
			pos++;
			i--;
			continue;
		}
		if (i < B - 1 && t[i] < x[pos].first && x[pos].first < t[i + 1]) {
			t_min[x[pos].second] = t[i];
			t_max[x[pos].second] = t[i + 1];
			pos++;
			i--;
			continue;
		}
		if (t[B - 1] < x[pos].first) {
			t_min[x[pos].second] = t[B - 1];
			t_max[x[pos].second] = -1;
			pos++;
			i--;
			continue;
		}
	}


	SORTMF(x, [](pair<ll, ll>& x, pair<ll, ll>& y) {return x.second < y.second; });
	
	rep(i, Q) {



		ll ans1 = 0;
		if (s_min[i] == -1 || t_min[i] == -1) {
			ans1 = LLONG_MAX;
		}
		else {
			ans1 = max(abs(s_min[i] - x[i].first), abs(t_min[i] - x[i].first));
		}

		ll ans2 = 0;
		if (s_max[i] == -1 || t_max[i] == -1) {
			ans2 = LLONG_MAX;
		}
		else {
			ans2 = max(abs(s_max[i] - x[i].first), abs(t_max[i] - x[i].first));
		}

		ll ans3 = 0;

		ll s_near = 0;
		if (s_min[i] == -1) {
			s_near = abs(s_max[i] - x[i].first);
		}
		else if (s_max[i] == -1) {
			s_near = abs(s_min[i] - x[i].first);
		}
		else {
			s_near = min(abs(s_max[i] - x[i].first), abs(s_min[i] - x[i].first));
		}

		ll t_near = 0;
		if (t_min[i] == -1) {
			t_near = abs(t_max[i] - x[i].first);
		}
		else if (t_max[i] == -1) {
			t_near = abs(t_min[i] - x[i].first);
		}
		else {
			t_near = min(abs(t_max[i] - x[i].first), abs(t_min[i] - x[i].first));
		}

		ans3 = s_near + t_near + min(s_near , t_near);

		cout << min(ans1, min(ans2, ans3)) << endl;

	}


	return;
}

int main() {

	//入力
	cin >> A >> B >> Q;
	s.resize(A);
	t.resize(B);
	x.resize(Q);
	rep(i, A) cin >> s[i];
	rep(i, B) cin >> t[i];
	rep(i, Q) {
		ll tmp;
		cin >> tmp;
		x[i].first = tmp;
		x[i].second = i;
	}

	solve();
	cout << endl;
	return 0;
}

Measured memory_bytes: 7552
"""
最小公倍数LCMを求めて、LCMを各Aで除した商を合計すればよい
"""
from math import gcd
def lcm(a,b):
    return a*b//gcd(a,b)
def main():
    mod = 10**9 +7
    N = int(input())
    A = list(map(int,input().split()))
    l = A[0]
    for i in range(1,N):
        l = lcm(l,A[i])

    ans = 0
    for a in A:
        ans += l//a
    print(ans%mod)
main()

Measured memory_bytes: 74212
#include "bits/stdc++.h"

// Begin {{{
using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0; i < (n); ++i)
#define reps(i, s, n) for (i64 i = (s); i <= (n); ++i)
#define VAR(Type, ...) Type __VA_ARGS__; IN(__VA_ARGS__)

#ifdef DEBUG
#define dump(...) _dump(#__VA_ARGS__, __VA_ARGS__);
#else
#define dump(...)
#endif

using i64 = int_fast64_t;
using pii = pair<i64, i64>;

template <class A, class B>
inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }

template <class A, class B>
inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

// IN
void IN() {}
template <class Head, class... Tail>
void IN(Head&& head, Tail&&... tail) {
  cin >> head;
  IN(forward<Tail>(tail)...);
}

// OUTS
void OUTS() {}
template <class Head, class... Tail>
void OUTS(Head&& head, Tail&&... tail) {
  cout << head << " \n"[sizeof...(tail)==0];
  OUTS(forward<Tail>(tail)...);
}

template <class T>
void OUTS(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e==&vec.back()]; }

template <class T>
void OUTS(vector<vector<T>> &df) { for (auto &vec : df) OUTS(vec); }

// OUTL
void OUTL() {}
template <class Head, class... Tail>
void OUTL(Head&& head, Tail&&... tail) {
  cout << head << "\n";
  OUTL(forward<Tail>(tail)...);
}

template <class T>
void OUTL(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

// OUTN
void OUTN() {}
template <class Head, class... Tail>
void OUTN(Head&& head, Tail&&... tail) {
  cout << head;
  OUTN(forward<Tail>(tail)...);
}

template <class T>
void OUTN(vector<T> &vec) { for (auto &e : vec) cout << e; }

// DEGUG
template <class T>
void _dump(const char *s, T&& x) {
  clog << '{';
  while(*s != '\0') clog << *(s++);
  clog << ": " << x << '}' << "\n";
}

template <class Head, class... Tail>
void _dump(const char *s, Head&& head, Tail&&... tail) {
  clog << '{';
  while(*s != ',') clog << *(s++);
  clog << ": " << head << "}, ";
  for (++s; !isgraph(*s); ++s);
  _dump(s, forward<Tail>(tail)...);
}
// }}} End

inline vector<int> digit(unsigned long long n) {
  vector<int> ret;
  do { ret.push_back(n % 10); n /= 10; } while (n > 0);
  return ret;
}

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

  VAR(int, N, K);

  vector<bool> bad(20, false);
  rep(i, K) {
    VAR(int, d);
    bad[d] = true;
  }

  int min_ok = INF;
  reps(i, 0, 9) {
    if (!bad[i]) chmin(min_ok, i);
  }

  auto D = digit(N);
  reverse(all(D));

  vector<int> res;
  bool isLess = false;
  bool isReach = false;

  for (auto &e : D) {

    if (bad[e] && !isReach) {
      bool found = false;
      reps(i, e, 9) {
        if (!bad[i]) {
          found = true;
          res.emplace_back(i);
          if (i > e) isReach = true;
          break;
        }
      }

      if (!found) {
        isLess = true;
        res.emplace_back(min_ok);
      }
    }

    else if (bad[e] && isReach) res.emplace_back(min_ok);
    else res.emplace_back(e);
  }

  if (isLess) res.emplace_back(min_ok);

  OUTN(res); OUTL("");

  return 0;
}


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

int main(){
    double pai=3.141592653589;
    int n;
    scanf("%d",&n);
    for(int i=3;i<=n;i++){
        int x=i;
        if(i%3==0){
            printf(" %d",i);
        }else{
            do{
                if(x%10==3){
                    printf(" %d",i);
                    break;
                }
                x/=10;
            }
            while(x);
        }
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 3196
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;
using namespace std;
 

int main(int argc, char* argv[])
{
    int n, m;
    scanf("%d%d", &n, &m);

    vector<vector<long> > z(n), w(n);
    vector<int> cnt(n);
    long i;
    for(i=0; i<n+m-1; i++) {
        int a, b;
        scanf("%d%d", &a, &b);
        z[a-1].push_back(b-1);    // par->child
        w[b-1].push_back(a-1);    // child->par
        cnt[b-1]++;
    }

    vector<int> topo(n);
    set<int> ss;
    for(i=0; i<n; i++) {
        if(cnt[i]==0) ss.insert(i);
    }
    int count=0;
    while(!ss.empty()) {
        auto it=ss.begin();
        topo[*it]=count;
        count++;

        long m;
        for(m=0; m<(long)z[*it].size(); m++) {
            cnt[z[*it][m]]--;
            if(cnt[z[*it][m]]==0) ss.insert(z[*it][m]);
        }
        ss.erase(it);
    }
    if(count!=n) return 12;

    for(i=0; i<n; i++) {
        int max=-1;
        int maxk=-1;
        int k;
        for(k=0; k<w[i].size(); k++) {
            if(max<topo[w[i][k]]) {
                max=topo[w[i][k]];
                maxk=w[i][k];
            }
        }
        printf("%d\n", maxk+1);
    }

    return 0;
}


Measured memory_bytes: 14836
from operator import mul
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")

MOD = 1000000007
class Combination(object):
    def __init__(self, N, MOD):
        self.fac = [0] * (N + 1)
        self.inv = [0] * (N + 1)
        self.finv = [0] * (N + 1)
        self.fac[0] = 1
        self.finv[0] = 1
        if N > 0:
            self.fac[1] = 1
            self.inv[1] = 1
            self.finv[1] = 1
 
        # 前計算
        for i in range(2, N + 1):
            self.fac[i] = self.fac[i - 1] * i % MOD
            self.inv[i] = self.inv[MOD % i] * (MOD - (MOD // i)) % MOD
            self.finv[i] = self.finv[i - 1] * self.inv[i] % MOD
 
    def com(self, N, k):
        return (self.fac[N] * self.finv[k] * self.finv[N - k]) % MOD


def main():
    H, W, A, B = map(int, input().split())

    Com = Combination(H+W, MOD)
    ans = 0
    for i in range(B, W):
        ans += Com.com((H-A-1)+i, i) * Com.com((A-1)+(W-i-1), A-1)
        ans %= MOD
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 71400
n,k=map(x->parse(Int,x),split(readline()))
A=map(x->parse(Int,x),split(readline()))
ans=s=0
for i=1:n
  s+=A[i]+1
  ans=max(ans,s)
  if i>=k
    s-=A[i-k+1]+1
  end
end
println(ans/2)

Measured memory_bytes: 166116
///
// File:  b.cpp
// Author: ymiyamoto
//
// Created on Sun Oct  1 01:34:41 2017
//

#include <cstdint>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
static vector<pair<uint64_t, uint64_t>> list;

int32_t main()
{
  uint32_t N;
  cin >> N;

  for(uint32_t i = 0; i< N;i++){
    uint64_t a, b;
    cin >> a >> b;
    list.push_back({a, b});
  }
  sort(list.begin(), list.end());

  cout << list.back().first + list.back().second << endl;

  return 0;
}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pr printf
#define P push
#define PB push_back
#define F front
#define T top
#define MP make_pair
#define Fi first
#define Se second
using namespace std;
inline long long gcd(long long a,long long b){return b==0?a:gcd(b,a%b);}
inline long long lcm(long long a,long long b){return a/gcd(a,b)*b;}
inline void read(long long &x){
	char ch;
	do ch=getchar();while(ch<48||ch>57);
	x=0;while(ch<=57&&ch>=48){x=x*10+ch-48;ch=getchar();}
}
inline void read(int &x){
	char ch;
	do ch=getchar();while(ch<48||ch>57);
	x=0;while(ch<=57&&ch>=48){x=x*10+ch-48;ch=getchar();}
}
int i,j,k,n,m;
int a[10],o[4],In[4][10],len[4],y[10];
int go(int u,int now,int sum){
	if(now>len[u])return 1e9;
	if(sum>o[u])return abs(sum-o[u]);
	int num=a[In[u][now]];
	int ans=abs(sum+num-o[u]);
	//cout<<u<<' '<<now<<' '<<sum<<' '<<num<<' '<<ans<<endl;
	return min(min(go(u,now+1,sum),go(u,now+1,sum+num)+10),ans);
}
long long Ans=1e9;
void Do(int now){
	if(now>n){
		long long ans=0;
		if(len[1]==0||len[2]==0||len[3]==0)return;
		ans+=go(1,1,0);
		ans+=go(2,1,0);
		ans+=go(3,1,0);
		//for(int i=1;i<=n;i++)cout<<y[i]<<' ';cout<<endl;
		//cout<<len[1]<<' '<<len[2]<<' '<<len[3]<<' '<<ans<<endl;cout<<endl;
		Ans=min(ans,Ans);
		return;
	}
	y[now]=1;
	In[1][++len[1]]=now;
	Do(now+1);
	len[1]--;
	y[now]=2;
	In[2][++len[2]]=now;
	Do(now+1);
	len[2]--;
	y[now]=3;
	In[3][++len[3]]=now;
	Do(now+1);
	len[3]--;
}
int main(){
	cin>>n>>o[1]>>o[2]>>o[3];
	for(i=1;i<=n;i++)cin>>a[i];
	// 3 ^ 8 = 6561 (7000)
	// 8! = 40320 (40000)
	Do(1);
	cout<<Ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <functional>
#include <string.h>

using namespace std;

//FILE *in = freopen("input.txt", "r", stdin);

int n, m;
char data[30][10];
char format[10];

void input() {
	sprintf(format, "%%0%dd", m);
	sprintf(data[0], format, n);
	strcpy(data[1], data[0]);
}

void process() {
	char les[100];
	les[m] = 0;
	for(int i = 1; ;i++) {
		sort(data[i], data[i]+m, greater<char>());
		for(int j = m-1;j>=0;j--){
			les[j]=data[i][m-j-1];
		}
		int x = atoi(data[i]);
		int y = atoi(les);
		sprintf(data[i], format, x-y);

		for(int j = 0; j < i; j++){
			if(!strcmp(data[i], data[j])) {
				printf("%d %d %d\n", j, atoi(data[j]), i - j);
				return;
			}
		}
		strcpy(data[i+1], data[i]);
	}
}

int main() {
	while(true){
		scanf("%d%d", &n, &m);
		if (n == 0 && m == 0) break;
		input();
		process();
	}
	return 0;
}

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

using namespace std;
int frq[10000] ;
int main()
{
    int n ; long long primeFactor = 1 ,sum=1 , i , j,b;
    scanf("%d",&n) ;
    for (i=2;i<=n;i++)
    {
                 primeFactor = 1 ;  b=i;
                 for (j=2;j*j<=i;j++)
                 {
                              while (b%j==0)
                              {
                                           frq[j]++;
                                           b/=j;
                              }
                 }
                 if (b!=1)
                          frq[b]++;
    }
    for (j=2;j<=i;j++)
    {
             //printf("prime factor %lld\n\n",primeFactor);
             if (frq[j])
             {
                          primeFactor*= (frq[j]+1);
                          primeFactor%=(1000000000+7);
             }

    }
    printf("%lld",primeFactor);
    return 0;
}


Measured memory_bytes: 3816
a,b = map(int,input().split())
count = 0
if a > 0:
    print("Positive")
elif a == 0:
    print(0)
else:
    if b >= 0:
        print("Zero")
    else:
        count = a-b+1
        if count%2 == 0:
            print("Positive")
        else:
            print("Negative")

Measured memory_bytes: 9136
#include<iostream>
#include<vector>
using namespace std;

int main(){
  int h,w; cin >> h >> w;
  vector<vector<char>> cell(h,vector<char>(w));
  vector<int> row;
  vector<int> column;
  
  for(int i=0;i<h;i++){
    int flag=0;
    for(int j=0;j<w;j++){
      char c; cin >> c;
      cell.at(i).at(j)=c;
      if(c=='#')flag=1;
    }
    if(flag) row.push_back(i);
  }

  for(int j=0;j<w;j++){
    int flag=0;
    for(int i=0;i<h;i++){
      char c=cell.at(i).at(j);
      if(c=='#')flag=1;
    }
    if(flag) column.push_back(j);
  }

  for(int i: row){
    for(int j: column){
      cout << cell.at(i).at(j);
    }
    cout << endl;
  }
  
}


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

using namespace std;

int main() {
  int n, t, a;
  cin >> n >> t >> a;
  a *= 1000;
  t *= 1000;

  int ans0 = 0;
  int ans1 = 1e9;
  for (int i = 0; i < n; i++) {
    int h;
    cin >> h;
    int tmp = t - h * 6;
    if (ans1 > abs(tmp - a)) {
      ans0 = i;
      ans1 = abs(tmp - a);
    }
  }
  cout << ans0 + 1 << endl;
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
bool isSquared(int num){
    for(int i = 1; i*i <= num; ++i){
        if(i*i == num) return true;
    }
    return false;
}
 
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, d;
    cin >> n >> d;
    int x[n][d];
    for (int i = 0; i < n; ++i){
        for (int j = 0; j < d; ++j) cin >> x[i][j];
    }
    
    int res = 0;
    for (int i = 0; i < n-1; ++i){
        for (int j = i+1; j < n; ++j){
            int distance_sq = 0;
            for (int dim = 0; dim < d; ++dim){
                distance_sq += abs(x[i][dim]-x[j][dim]) * abs(x[i][dim]-x[j][dim]);
            }
            
            if(isSquared(distance_sq)) res++;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define eb emplace_back
#define all(a) (a).begin(),(a).end()
#define SZ(a) (int)(a).size()
#define FOR(i, a, b) for(int i=(a); i<=(b); ++i)
#define iFOR(i, a, b) for(int i=(a); i>=(b); --i)
#define make_unique(a) sort(all((a))), (a).resize(unique(all((a)))-(a).begin())

using namespace std;

typedef pair<int,int> PII;
typedef long long LL;
typedef double DD;
typedef long double LD;
typedef pair<LL,LL> PLL;
typedef pair<DD,DD> PDD;
typedef vector<int> VI;
typedef vector<LL> VL;

vector<char> ans;
LL dp[20];
int main(){
    LL n;
    scanf("%lld",&n);
    if(n < 27){
        printf("%c",'a'+n-1);
        return 0;
    }
    dp[0] = 0;
    dp[1] = 26;
    int i;
    for(i = 2; i <= 13; i++){
        dp[i] = dp[i-1] + (dp[i-1]-dp[i-2])*26;
        if(dp[i] >= n){
             break;
        }
    }
    n -= dp[i-1];
    --n;
    FOR(x, 1, i){
        ans.pb('a'+n%26);
        n/=26;
    }
    reverse(all(ans));
    for(char e : ans) printf("%c",e);
	return 0;
}
/*
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 */


Measured memory_bytes: 3764
mod = 998244353

class BIT:
    def __init__(self, N):
        self.size = N
        self.tree = [0] * (N + 1)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

N, *XY = map(int, open(0).read().split())
X, Y = XY[::2], XY[1::2]

memo = {y: i for i, y in enumerate(sorted(Y))}
Y = [y for x, y in sorted(zip(X, map(memo.get, Y)), key=lambda p: p[0])]

P = [1]
for i in range(N):
    P.append(P[-1] * 2 % mod)

ans = P[N - 1] * N % mod
bit = BIT(N)
for i, y in enumerate(Y):
    bit.add(y + 1, 1)

    ld = bit.sum(y)
    lu = i - ld

    rd = y - ld
    ru = N - y - 1 - lu

    A, B, C, D = P[ru], P[lu], P[ld], P[rd]

    ans += ((C - 1) * (A - 1) % mod) * (B * D % mod) % mod
    ans += ((B - 1) * (D - 1) % mod) * (C * A % mod) % mod
    ans -= ((C - 1) * (A - 1) % mod) * ((D - 1) * (B - 1) % mod) % mod
    ans %= mod

print(ans)

Measured memory_bytes: 121416
#include"bits/stdc++.h"
using namespace std;

int main() {
  string s;
  string t;
  string u;
  int a;
  int b;
  
  cin >> s >>t >>a>>b>>u;
  
  if(s==u) a-=1;
  else if(t==u) b-=1;
  
  cout << a << " " <<b <<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>

int ind(int *N){
  int ret;
  if(*N < 0){
    *N *= -1;
    if(*N%2 == 1){
      *N += 1;
      *N /= 2;
      return 1;
    }else{
      *N /= 2;
      return 0;
    }
  }else{
    ret = *N%-2;
    *N /= -2;
    return ret;
  }
  return 0;
}

int main(void){
  int N;
  int i;
  int k=0; //桁
  int pre_ans[50] = {0};
  int c;

  scanf("%d", &N);

  if(N == 0){
    printf("0\n");
    return 0;
  }

  while(N!=1){
    c = ind(&N);
    pre_ans[k] = c;
    k++;
  }
  pre_ans[k] = 1;
  for(i=k;i>=0;i--){
    printf("%d", pre_ans[i]);
  }
  printf("\n");
  return 0;
}


Measured memory_bytes: 128
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		char[] s=sc.nextLine().toCharArray();
		long[] m=new long[s.length+1];
		long[] l= new long[s.length+1];
		m[0]=0;
      	l[0]=1;
		for(int i=0;i<s.length;i++){
			l[i+1]=(l[i]*10)%2019;
			m[i+1]=(m[i]+((int)s[s.length-i-1]-(int)'0')*l[i])%2019;
          	//System.out.println(m[i+1]);
		}
		long[] ms=new long[2019];
		for(int i=0;i<m.length;i++){
			ms[(int)m[i]]++;
		}
		long ans=0;
		for(int i=0;i<ms.length;i++){
			ans+=ms[i]*(ms[i]-1)/2;
          	//System.out.println(ms[i]);
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 45016
#include <stdio.h>

int binarysearch(int q[], int key, int n)
{
	int left = 0;
	int right = n;
	
	while (left < right)
	{
		int mid = (left + right) / 2;
		if (q[mid] == key)	return 1;
		else if (q[mid] > key) right = mid;
		else left = mid + 1;
	}
	return 0;
}

int main()
{
	int n,a;
	scanf("%d", &n);
	int s[100000];

	for (int i = 0; i < n; i++) {
		scanf("%d", &a);
		s[i] = a;
	}
	
	int n_t, key;
	int sum = 0;
	scanf("%d", &n_t);
	for (int i = 0; i < n_t; i++) {
		scanf("%d", &key);
		if(binarysearch(s,key,n)) sum++;
	}

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

Measured memory_bytes: 3004
#include<bits/stdc++.h>
using namespace std;
int main(){
    string str;
    cin >> str;
    int character[26]={0};
    for(int i=0; i<4; i++){
        character[str.at(i)-'A']++;
    }
    int shurui=0;
    for(int i=0; i<26; i++){
        if(character[i]==2){
            shurui++;
        }
    }
    string ans="No";
    if(shurui==2){
        ans = "Yes";
    }
    cout << ans;
    return 0;
}

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  cout << n * n * n << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = 1; i <= (int)(n); i++)
#define drep(i, n) for(int i = (n)-1; i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

// Mod int
const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%mod+mod)%mod){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%mod+mod)%mod; return *this;}
  mint operator-() const { return mint(0) - *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=mod) x-=mod; return *this;}
  mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}
//



int main() {
  double d, t, s;
  cin >> d >> t >> s;
  if (d/s <= t) cout << "Yes\n";
  else cout << "No\n";
}

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

using namespace std;
int main(){
    string s;
    cin >> s;
    bool test = false;
    for(int i=1; i<=s.size(); i++){
        if(s=="AAA" || s=="BBB")
           test = true;
    }
    if(test)  cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3564
#include<bits/stdc++.h>
typedef long long ll;
ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
ll a[100010],b[100010],c[100010];
int main(){
#ifdef XZZSB
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	int n=gi();if(n==1)return puts("YES"),0;
	for(int i=1;i<=n;++i)a[i]=gi();
	b[1]=a[1]-a[n];for(int i=2;i<=n;++i)b[i]=a[i]-a[i-1];
	ll m=0;for(int i=1;i<=n;++i)m+=a[i];
	if(m%(1ll*n*(n+1)/2))return puts("NO"),0;
	m/=1ll*n*(n+1)/2;
	for(int i=1;i<=n;++i)if((b[i]-m)%n||(b[i]-m)/n>0)return puts("NO"),0;
	puts("YES");
	return 0;
}


Measured memory_bytes: 1792
#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) << " "
int main(){
    int n,k;cin>>n>>k;
    double ans = 0.0;
    rep1(i,n){
        double tmp = 1.0/n;
        int now = i;
        while(now<k){
            now*=2;
            tmp/=2;
        }
        ans+=tmp;
    }
    printf("%.12f\n", ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s,a,b,x,y;cin>>s;
  a=s.substr(0,(s.size()-1)/2);
  b=s.substr((s.size()+1)/2,(s.size()-1)/2);
  x=a;y=b;
  reverse(x.begin(),x.end());
  reverse(y.begin(),y.end());
  if(a==x&&b==y&&a==b)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,b,n) for(int i=b;i<n;i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
int n,m;
const int MAX_N =120;
const int MAX_M =120;
double dp[MAX_N][MAX_M];//dp[i][j]:=直前にjを与え、i回目に肥料を与えたときの最大の成長
double memo[MAX_N][MAX_N];
int main(){
	while(1){
		cin>>n>>m;
		if(n==0&&m==0){
			break;
		}
		for(int i =0;i <MAX_N;i++){
			for(int j =0;j <MAX_N;j++){
				dp[i][j] =0;
				memo[i][j]=0;
			}
		}
		rep(i,n){
			rep(j,n){
				cin>>memo[i][j];
			}
		}
		rep(i,n)dp[1][i] =1.00;

		double ans =0;
		for(int i =1;i <m;i++){
			for(int j =0;j <n;j++){//直後
				for(int k =0;k <n;k++){//直前
					dp[i+1][j] =max(dp[i+1][j],dp[i][k]*memo[k][j]);
				}
			}
		}
		rep(i,n)ans=max(ans,dp[m][i]);
		ans =ans*100;
		ans =round(ans)/100;
		printf("%.2lf\n",ans);
	}
	return 0;
}

Measured memory_bytes: 1476
#ifdef _DEBUG
#define _CRT_SECURE_NO_WARNINGS
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define MGN 8
#define LINF (LONG_MAX/2)
using namespace std;
typedef long long ll; typedef unsigned long long ull;
typedef vector<int> vi; typedef vector<vi> vvi;
typedef vector<ll> vl; typedef vector<vl> vvl;
typedef vector<double> vd; typedef vector<string> vs;
typedef pair<int, int> pii; typedef pair<ll, ll> pll;
typedef vector<bool> vb; typedef vector<vb> vvb;
template <typename T>
using keyVal = pair<string, T>;
template<typename T>
bool val_greater(const keyVal<T>& left, const keyVal<T>& right) {
    return left.second > right.second;
}
vs split(string str, char sep) {
    vs v; stringstream ss(str); string t;
    while (getline(ss, t, sep)) v.push_back(t);
    return v;}
vs re_search_g(string s, regex re) {
    vs ret; smatch mc; auto it = s.cbegin();
    while (regex_search(it, s.cend(), mc, re)) {
        ret.push_back(mc[0]);
        it += mc.position(0) + mc.length();}
    return ret;}
#endif

void init_global_C() {}

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

    string S; cin >> S;
    int N = S.size();

    string O = "", E="";
    REP(i,N) {
        if (i%2==0){
            O += "1";
            E += "0";
        } else {
            O += "0";
            E += "1";
        }
    }

    int odd = 0, even = 0;
    REP(i,N) {
        if (S[i] != O[i]) odd++;
        if (S[i] != E[i]) even++;
    }

    int ans = min(odd, even);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 720
#include <stdio.h>

int main(void)
{
  int S = 0;
  int S1 = 0;
  int S2 = 0;
  int h = 0;
  int m = 0;
  int s = 0;

  scanf("%d", &S);

  S1 = S2 = S;

  h = S / 3600;
  m = S1 % 3600 / 60;
  s = S2 % 3600 % 60 ;

  printf("%d:%d:%d\n", h, m, s);

  return 0;
}

Measured memory_bytes: 592
#include <algorithm>
#include <iostream>

using namespace std;

int main() {
	int k; cin >> k;
	int n = 0;
	for (int h = 1; h <= 20000000; h++) {
		n = (n * 10 + 7) % k;
		if (n == 0) {
			cout << h << '\n';
			return 0;
		}
	}
	cout << "-1\n";
	return 0;
}


Measured memory_bytes: 3620
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int h = sc.nextInt();
      int w = sc.nextInt();
      char[][] bomb = new char[h][w];
      int[][] count = new int[h][w];
      for(int i = 0;i < h;i++)bomb[i] = sc.next().toCharArray();
      
      for(int i = 0;i < h;i++){
      	for(int j = 0;j < w;j++){
        	if(bomb[i][j]=='.'){
            	for(int k = -1;k <= 1;k++){
                	for(int l = -1;l <= 1;l++){
                    	if(i+k>=0&&j+l>=0&&i+k<=h-1&&j+l<=w-1&&bomb[i+k][j+l]=='#')count[i][j]++;
                    }
                }
            }
        }
      }
      for(int i = 0;i < h;i++){
      	for(int j = 0;j < w;j++){
        	if(bomb[i][j]=='.')System.out.print(count[i][j]);
          else System.out.print('#');
        }
        System.out.println("");
      }
    }
}

Measured memory_bytes: 21844
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<ll, ll> pll;
typedef long double ldouble;
typedef pair<double, double> pdd;

void solve() {
	char S[110];
	scanf("%s", S+1);
	int n = (int)strlen(S+1);
	for(int i=1;i<=n-8;i++) printf("%c", S[i]); puts("");
}

int main(){
	int Tc = 1; //scanf("%d\n", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		// printf("Case #%d: ", tc);
		solve();
	}
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#pragma _attribute_((optimize("-O2")))
#pragma comment(linker, "/STACK:102400000,102400000")

#include <iostream>
#include <queue>
#include <stack>
#include <cstdio>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <cstdio>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <string>
#include <sstream>
#include <time.h>
#include <iomanip>

//#define Local

using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input1.txt", "r", stdin);
	//freopen("output1.txt", "w", stdout);

	int k;
	while (cin >> k)
	{
		int m2 = 0, m4 = 0, no = 0;
		while (k--)
		{
			int tmp;
			cin >> tmp;
			if (tmp % 4 == 0)
				m4++;
			else if (tmp % 2 == 0)
				m2++;
			else
				no++;
		}
		if (no - m4 > 1)
			cout << "No" << endl;
		else
		{
			if (m2 == 0)
				cout << "Yes" << endl;
			else
			{
				if (no - m4 == 1)
					cout << "No" << endl;
				else
					cout << "Yes" << endl;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;
 
using namespace std;


template<class T> class BIT   // 1-indexed (0 is not used)
{
private:
    int num;
    vector<T> bit;
public:
    BIT(int n):bit(vector<T>(n+1, 0)), num(n) {}

    T sum(int i) {   // sum of 1..i
        if (!i) return 0;
        return bit[i] + sum(i-(i&-i));
    }

    void add(int i, T x) {
        if (i > num) return;
        bit[i] += x;
        add(i+(i&-i), x);
    }

    int lower_bound(T x) {
        T res=0;
        int N=1;
        while(N<num) N*=2;
        int i;
        for(i=N/2; i>0; i/=2) {
            if(res+i<num && bit[res+i]<x) {
                x = x - bit[res +i];
                res = res + i;
            }
        }
        return res + 1;
    }
};

ll InvNum( int n, int* a )
{
    map<int,int> mp;
    int i;
    for(i=0; i<n; i++) {
        mp[a[i]]=0;
    }
    int num=0;
    auto it=mp.begin();
    for(; it!=mp.end(); ++it) {
        num++;
        it->second=num;
    }

    ll ans=0;
    BIT<int> bit(num);
    for(i=0; i<n; i++) {
        ans += i - bit.sum(mp[a[i]]);
        bit.add(mp[a[i]], 1);
    }
    return ans;
}

int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);
    vector<int> a(n),b(n);
    int i;
    for(i=0; i<n; i++) {
        scanf("%d", &a[i]);
    }
    for(i=0; i<n; i++) {
        scanf("%d", &b[i]);
    }

    ll ans=LINF;
    int m=(n+1)/2;
    vector<pair<int,int> > aa(m), bb(n-m);
    vector<int> v(n), w(n);
    int k;
    for(k=0; k<((ll)1<<n); k++) {
        int cnt=0;
        for(i=0; i<n; i++) {
            if(k & ((ll)1<<i)) cnt++;
        }
        if(cnt!=m) continue;

        cnt=0;
        int cnt1=0;
        for(i=0; i<n; i++) {
            if(k & ((ll)1<<i)) {
                aa[cnt]=make_pair((i%2==0? a[i]: b[i]),i);
                cnt++;
            }
            else {
                bb[cnt1]=make_pair((i%2==0? b[i]: a[i]),i);
                cnt1++;
            }
        }
        sort(aa.begin(),aa.end());
        sort(bb.begin(),bb.end());

        for(i=0; i<m; i++) {
            v[i*2]=aa[i].second;
            w[i*2]=aa[i].first;
        }
        for(i=0; i<n-m; i++) {
            v[i*2+1]=bb[i].second;
            w[i*2+1]=bb[i].first;
        }
        int bad=0;
        for(i=1; i<n; i++) {
            if(w[i-1]>w[i])
                bad=1;
        }
        if(bad)
            continue;

        ll tmp=InvNum(n, &v[0]);
        ans=MIN(ans,tmp);
    }
    if(ans==LINF) {
        printf("-1\n");
    }
    else {
        printf("%lld\n", ans);
    }
    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
int main(){
    int a, b, c, i, div;
    while(scanf("%d %d %d", &a, &b, &c) == 3){
        div = 0;
        for(i=a; i<=b;i++){
            if(c % i == 0) div++;
        }
        printf("%d\n", div);
    }
return 0;
}



Measured memory_bytes: 2112
N, X = map(int, input().split())
city = list(map(int, input().split()))
city.sort()
distant = [abs(X - i) for i in city]

def gcd(a, b):
    mod = 1
    
    while (mod > 0):
        mod = a % b
        a = b
        b = mod
    
    return (a)

gc = distant[0]

for i in range(1, len(distant)):
    gc = gcd(gc, distant[i])

print(gc)

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

char op[200],po[200];

int main() {
    string x,y;
    cin >> x >> y;
    for(int i=0;i<x.size();i++){
        if(op[x[i]]&&op[x[i]]!=y[i])return cout << "No",0;
        if(po[y[i]]&&po[y[i]]!=x[i])return cout << "No",0;
        op[x[i]] = y[i];
        po[y[i]] = x[i];
    }
    cout << "Yes";
    return 0;
}


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

#define ll long long int
#define ull unsigned long long int
#define eb  emplace_back
#define all(x) x.begin(),x.end()
#define loop(a,n) for(ll i=a;i<n;i++)
#define debug(x)  cout<<#x<<" "<<x<<"\n";
#define mod 1e9+7
#define setbits(x)  __builtin_popcountll(x)
#define digits(a,x)  a=floor(log10(x)) + 1
#define ss second
#define ff first

bool prime(ll s);
ll power(ll x, ll y) ;
bool cmp(ll a, ll b)
{
    return a>b;
}
bool ispower2(ll n)
{
    
    return n && (!(n&(n-1)));
}
void solve()
{
    string s,t;cin>>s>>t;
    int ans=0;
    for(int i=0;i<=s.size()-t.size();i++)
    {
        int c=0;
        for(int j=0;j<t.size();j++)
        {
            if(s[i+j]==t[j])
            c++;
            
            // debug(c);
            
            
        }
        ans=max(c,ans);
    }
    cout<<t.size()-ans;
    
    
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    
    ll t=1;
    // cin>>t;

    while(t--)
    {
        solve();
    }
    
    return 0;
}



bool prime(ll s)
{
    if (s <= 1)  return false;
    if (s <= 3)  return true;
    if (s%2 == 0 || s%3 == 0) return false;

    for (ll i=5; i*i<=s; i=i+6)
        if (s%i == 0 || s%(i+2) == 0)
           return false;

    return true;
}

ll power(ll x, ll y) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2); 
    if (y%2 == 0) 
        return temp*temp; 
    else
        return x*temp*temp; 
} 

Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define fasterthanlight ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define test int T; cin>>T; while(T--)
#define endl "\n"
#define int long long
#define vi vector<int>
#define pb push_back
#define mod 1000000007
#define MAX 1e9
#define MIN -1e9
#define hi "visited\n" //sasta debugging
using namespace std;

//author::@whohet-->Het Patel

signed main()
{
    fasterthanlight;
    char a[26] = {'z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y'};
    int n;
    vi v;
    cin >> n;
    int tmp = n;
    while (n > 0)
    {
        v.pb(n % 26);
        if (n % 26 == 0)
        {
            n = n / 26; n--;
        }
        else
            n /= 26;
    }
    for (int i = v.size() - 1; i >= 0 ; i--)
    {

        cout << a[v[i]];

        //   cout << a[25];

    }


    //cout << "\n\n"<<"Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " seconds.\n";
    return 0;
}

Measured memory_bytes: 3632
use std::io::*;
use std::str::*;

fn read<T: FromStr>(s: &mut StdinLock) -> T {
    let s = s.by_ref().bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok().unwrap()
}


fn main() {
    let s = stdin();
    let mut s = s.lock();
    let s = &mut s;

	let st:Vec<u8> = read::<String>(s).bytes().collect();
	let tt:Vec<u8>  = read::<String>(s).bytes().collect();
	
	let mut x = Vec::<i32>::new();
	x.resize(st.len(), 0);

	let mut maxc = 0;
	for i in 0 .. st.len()-tt.len()+1 {
		for j in 0 .. tt.len() {
			if st[i+j] == tt[j] {
				x[i] += 1;
				if x[i] > maxc {
					maxc = x[i];
				}
			}
		}
	}
//	println!("maxc={}", maxc);
	println!("{}", tt.len() as i32 - maxc);
	

}


Measured memory_bytes: 2140
#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>;

int main() {
  int K,A,B;
  cin >> K >> A >> B;
  if(B/K - A/K >= 1||A%K==0||B%K==0){
    printf("OK\n");
  }
  else{
    printf("NG\n");
  }
  return 0;
}

Measured memory_bytes: 3644
//Written by Zhu Zeqi
//Come on,baby
//Hack,please
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define CLR(x) memset(x,0,sizeof x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define MAX 1000000000000000000
#define MOD 1000000007
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f
typedef long long ll;
//orz yht
using namespace std;
string i_s(int x){
	if(x==0)
	return "0";
	string ret="";
	while(x){
		ret=ret+(char)(x%10+'0');
		x/=10;
	}
	reverse(ret.begin(),ret.end());
	return ret;
}
string add(string a,string b){
	if(a=="")
	a="0";
	if(b=="")
	b="0";
	if(a.length()<b.length())
	swap(a,b);
	while(b.length()<a.length()){
		b='0'+b;
	}
	for(int i=0;i<a.length();i++){
		a[i]=a[i]+(b[i]-'0');
	}
	bool big=false;
	for(int i=a.length()-1;i>=0;i--){
		if(big){
			a[i]++;
		}
		big=false;
		if(a[i]>'9'){
			a[i]=a[i]-10;
			big=true;
		}
	}
	if(big)
	a='1'+a;
	return a;
}
string mul(string a,string b){
	vector<int> va,vb;
	if(a=="0" || b=="0")
	return "0";
	string ans;
	for(int i=0;i<a.length();i++){
		va.push_back(a[i]-'0');
	}
	for(int i=0;i<b.length();i++){
		vb.push_back(b[i]-'0');
	}
	reverse(va.begin(),va.end());
	reverse(vb.begin(),vb.end());
	vector<int> res;
	res.clear();
	res.resize(1005);
	for(int i=0;i<a.length();i++){
		for(int j=0;j<b.length();j++){
			res[i+j]+=(va[i]*vb[j]);
		}
	}
	for(int i=0;i<1005;i++){
		if(res[i]>9){
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	for(int i=0;i<1005;i++){
		ans+=(res[i]+'0');
	}
	reverse(ans.begin(),ans.end());
	int k=0;
	while(ans[k]=='0'){
		k++;
	}
	ans=ans.substr(k);
	return ans;
}
bool is_prime(int n){
	if(n<2)
    return false;
    for(int i=2;i*i<=n;i++)
    if(n%i==0)
    return false;
    return true;
}
bool a[10];
bool can(int n){
	while(n){
		if(a[n%10])
		return false;
		n/=10;
	}
	return true;
}
int main(){
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=k;i++){
		int d;
		cin>>d;
		a[d]=true;
	}
	while(!can(n))
	n++;
	cout<<n;
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace mondai0018
{
	class Program
	{
		static void Main(string[] args)
		{
			var	n	= Array.ConvertAll( Console.ReadLine().Split( ' ' ), a => int.Parse( a ) );
			Array.Sort( n );
			Array.Reverse( n );
			for( int i = 0; i < n.Length - 1; i++ ) {
				Console.Write( n[ i ] + " " );
			}
			Console.WriteLine( n[ n.Length - 1 ] );
		}
	}
}

Measured memory_bytes: 5728
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')

import datetime


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    S = iss()
    s = datetime.datetime(2019, 4, 30)
    d = datetime.datetime(int(S[:4]), int(S[5:7]), int(S[8:10]))
    if d <= s:
        print('Heisei')
    else:
        print('TBD')


if __name__ == '__main__':
    main()


Measured memory_bytes: 10492
import java.util.Scanner;
import java.util.Stack;

class Main {

    public static void main(String[] args) {
        new Main().compute();
    }

    void compute() {
        Scanner sc = new Scanner(System.in);
        int r = sc.nextInt();
        int g = sc.nextInt();
        int b = sc.nextInt();
        System.out.println((r * 100 + g * 10 + b) % 4 == 0 ? "YES" : "NO");
    }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define rep(i,n)for(int i=1;i<n+1;++i)
#include<string>
using namespace std;

int main() {
	string s;
	cin >> s;
	if (s == "Sunny")cout << "Cloudy" << endl;
	else if (s == "Cloudy")cout << "Rainy" << endl;
	else if(s=="Rainy") cout << "Sunny" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<tuple>
#include<iomanip>
#include<map>
#include<queue>
#define int long long
using namespace std;

const int INF = 1e10;
const int ZERO = 0;

signed main() {
	int N;
	cin >> N;
	vector<int> vec;
	for(int i = 6;i < 55556;i += 5) {
		bool A = true;
		for(int j = 2;j * j <= i;j++) {
			if(i % j == 0) {
				A = false;
			}
		}
		if(A == true) {
			vec.push_back(i);
		}
	}
	for(int i = 0;i < N;i++) {
		cout << vec[i] << " ";
	}
}


Measured memory_bytes: 256
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 1000000007;
long long INF = 1000000000000000;
#define MAX_V 330

typedef long long ll;

int main(void) {
  ll n; cin >> n;
  ll m = LLONG_MAX;
  for (ll i = 1; i * i <= n; i++) {
    ll j;
    if (n % i == 0) {
      j = n / i;
      m = min(m, j + i - 2);
    }
  }
  cout << m << endl;

  return 0;
}
    


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <string.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(void)
{
    int n;
    int a[100];

    cin >> n;


    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    sort(a, a+n, greater<int>());

    int alice = 0;
    int bob = 0;
    for (int i = 0; i < n; i++) {
        if (i % 2 == 0) {
            alice += a[i];
        }
        else {
            bob += a[i];
        }
    }

    int ans = alice - bob;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

int main() {
  int x;
  cin>>x;
  for(int i=x;;i++){
    bool temp=true;
    for(int j=2;j<=sqrt(i);j++){
      if(i%j==0){
        temp=false;
        break;
      }
    }
    if(temp){
      cout<<i<<endl;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
#include <deque>
#include <queue>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int a;
  	string b;
    cin >> a >> b;
    int c = b.length(), d = 1, e = 0;
    for (int i = c - 1 ; i >= 0 ; i--) e += (b[i] - '0') * d, d *= 10;
    a = a * d + e;
    if (floor(sqrt(a)) * floor(sqrt(a)) == a) cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 3616
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <tuple>
#include <cassert>
using namespace std;
typedef long long ll;
#define REP(i,n) for (int i = 0; i < n; i++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;

int main ()
{
    int X,Y;
    cin >> X >> Y;
    int ans = 0;
    if (X == 1) ans += 300000;
    if (X == 2) ans += 200000;
    if (X == 3) ans += 100000;
    if (Y == 1) ans += 300000;
    if (Y == 2) ans += 200000;
    if (Y == 3) ans += 100000;
    if (X == 1 && Y == 1) ans += 400000;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256