akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int isprime(int n){
  for(int i = 2; i * i <= n; i++){
    if(n % i == 0)return 0 ;
  }
  return 1;
}
int main(){
  int n;
  while(1){
    scanf("%d",&n);
    if(n == 0)break;
    for(int i = n; i > 3; i--){
      if(isprime(i) == 1 && isprime(i-2) == 1){
        printf("%d %d\n",i-2,i);
        break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 2588
// 'That's all it is. A leap of faith'

#include <bits/stdc++.h>

#define append push_back
#define L first
#define R second

using namespace std;
using ll = long long;

const int N = 1e5 + 3;
const long long M = 1e6 + 7;
const long long MOD = 1e9 + 7;
const long long INF = 1e18 + 9;
const int SM = 1e3 + 5;
const int logN = 22, BL = 400;
const double EPS = 1e-9, PI = acos(-1);
const int dx[] = {1, 0, 0, -1, -1, 1, -1, 1};
const int dy[] = {0, 1, -1, 0, -1, 1, 1, -1};

template<typename Type>
long long sz(Type x) {
    return ll(x.size());
}

void debug() {
	cerr << "\n";
}
template<typename Type1, typename... Type2>
void debug(Type1 a, Type2... b) {
    cerr << a << " ";
    debug(b...);
}

int main() {
//    freopen(".in", "r", stdin);
//    freopen(".out", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    long long n, X, m; cin >> n >> X >> m;

    vector<long long> a(m * 2 + 1), f(m * 2 + 1);
    map<long long, long long> u;

    a[1] = X, u[X] = 1, f[1] = X;

    long long st = 0, nd = 0, rd = 0, x = 0, y = 0, z = 0;

    for(long long i = 2; i <= m * 2; i++) {
        a[i] = (a[i - 1] * 1ll * a[i - 1]) % m;
        f[i] = f[i - 1] + a[i];

        if(u.find(a[i]) != u.end()) {
            x = u[a[i]] - 1, y = i - u[a[i]], z = (n - x) % y;
            st = f[x], nd = (f[x + y] - f[x]) * ((n - x) / y), rd = f[x + z] - f[x];
            break;
        }

        u[a[i]] = i;
    }

    debug(st, nd, rd);

    if(n <= m * 2) cout << f[n];
    else cout << st + nd + rd;

    return 0;
}


Measured memory_bytes: 9432
S = input()
n = len(S)
ans = 0
for i in range(2 ** (n - 1)):
    p = [''] * (n - 1)
    for j in range(n - 1):
        if i >> j & 1:
            p[j] = '+'
    s = [None] * (2 * n - 1)
    s[::2] = list(S)
    s[1::2] = p
    s = ''.join(s)
    ans += eval(s)
print(ans)

Measured memory_bytes: 39152
#include <iostream>
#include <vector>
#include <algorithm>
#include <ctime>
#include <cmath>
#include <map>
#include <unordered_set>
#include <tuple>
#include <queue>
#include <set>
#include <cstring>
#include <functional>
#include <random>
#include <chrono>

#define ar array
#define all(arr) (arr).begin(), (arr).end()
#define range(i, n) for (int i=0; i < n; ++i)
#define rall(arr) (arr).rbegin(), (arr).rend()

typedef long long ll;
typedef long double ld;

using namespace std;

const ll INF = 1e18;
const int INFi = 2e9;
const int maxN = 1e5 + 5;
const int md2 = 998244353;
const int md = 1e9 + 7;

double getTime() { return clock() / (double) CLOCKS_PER_SEC; };

void solve() {
    int n; cin >> n;
    vector<int> x(n), y(n);
    range(i, n) {
        int xx, yy; cin >> xx >> yy;
        x[i] = xx + yy;
        y[i] = xx - yy;
    }
    sort(all(x));
    sort(all(y));
    cout << max(x.back() - x.front(), y.back() - y.front());
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    //cout << setprecision(15) << fixed;
    int tests = 1;
    //cin >> tests;
    range(_, tests) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 4780
import java.util.*;

public class Main {
  static int N,K;
  static int[] D;
	
  public static boolean isOK(int n) {
    while(n >0) {
      int d = n % 10;
      for(int i = 0; i<K; i++) {
        if (D[i] == d) return false;
        }
        n /= 10;
       }
     return true;
  }

   public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      N = sc.nextInt();
      K = sc.nextInt();
      D = new int[K];
      for(int i=0; i<K; i++) {
      D[i] = sc.nextInt();
      }
    
    int n = N;
    while(!isOK(n)) n++;
 
    System.out.println(n);
  }
}

Measured memory_bytes: 21460
#include<iostream>
#include<fstream>

using namespace std;
signed long long int a[100000];
signed long long int b[100000];
signed long long int c[100000];
signed long long int d[100000];
signed long long int e[100000];
signed long long int x=0;
signed long long int h[100000];
signed long long int n=0;
signed long long int t=0;
signed long long int q=0;
signed long long int i=0;
signed long long int j=0;
signed long long int k=0;
signed long long int s=0;
signed long long int f=0;
int main(){
	
	for(i=0;i<100000;i++){
		a[i]=0;
		b[i]=0;
		c[i]=0;
		d[i]=0;
		e[i]=0;
		h[i]=0;
	}
	cin>>n;
	cin>>t;
	cin>>q;
	for(i=0;i<n;i++){
		cin>>a[i];
		cin>>b[i];
	}
	for(i=0;i<q;i++){
		cin>>d[i];
	}
	for(i=0;i<n-1;i++){
		if(b[i]==1 && b[i+1]==2){
			f=a[i+1]-a[i];
			f=f/2;
			c[i]=f;
			c[i+1]=f;
			x=f+a[i];
			if(s!=0){
				for(j=0;j<s;j++){
					c[h[j]]=x-a[h[j]];
				}
			}
			s=0;			
		}else if(b[i]==1){
			h[s]=i;
			s++;
		}else if(b[i+1]==2){
			c[i+1]=a[i+1]-x;
			if(c[i+1]<0){
				c[i+1]=0;
			}
		}
	}
	for(i=0;i<q;i++){
		if(c[d[i]-1]==0 || c[d[i]-1]>t){
			if(b[d[i]-1]==1){
				e[i]=a[d[i]-1]+t;
			}else{
				e[i]=a[d[i]-1]-t;
			}
		}else{
			if(b[d[i]-1]==1){
				e[i]=a[d[i]-1]+c[d[i]-1];
			}else{
				e[i]=a[d[i]-1]-c[d[i]-1];
			}
		}
		cout<<e[i]<<endl;
	}
}
	

Measured memory_bytes: 7768
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#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 <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define acc(v) accumulate(v.begin(), v.end(),0);
#define MOD 1e+7
#define inf 1e9
#define fi first
#define se second
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, cnt = 0;
  cin >> n;
  rep(i,n) {
    int a;
    cin >> a;
    if(a & 1) cnt++;
  }
  cout << (cnt & 1 ? "NO" : "YES") << endl;
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 256
l, r = map(int, input().split())
m = 2019

if l // m == r // m:
    l %= m
    r %= m
    ans = m
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            ans = min(ans, (i * j) % m)
    print(ans)
else:
    print(0)


Measured memory_bytes: 3060
#include<cstdio>
#include<algorithm>
using namespace std;

int main(void){
  int s[100][100]={};
  int n;
  char c;

  scanf("%d",&n);

  for(int i=0;i<=n;i++){
    while((c=getchar())!='\n'){
      s[i][c-'a']++;
    }
  }
  for(int i=2;i<=n;i++){
    for(int j=0;j<26;j++){
      s[i][j]=min(s[i][j],s[i-1][j]);
    }
  }

  for(int i=0;i<26;i++){
    while(s[n][i]>0){
      putchar(i+'a');
      s[n][i]--;
    }
  }

  putchar('\n');

  return 0;
}


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

int main() {
  int a = 0, b = 0;
  
  cin >> a >> b;
  
  if ((a * b) % 2 == 0){
    cout << "Even" << endl;
  }
  else {
    cout << "Odd" << endl;
  }
}


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

int main(){
  string s;
  int i, j, k;
  set<string> st;
  set<string>::iterator it;
  cin >> s >> k;
  for(i = 0; i < k; i++)
    for(j = 0; j+i < s.size(); j++)
      st.insert(s.substr(j, i+1));
  for(i = 0, it = st.begin(); i < k-1; i++, it++);
  cout << *it << endl;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0; i<n; i++)
#define Rep(i,n) for(long long i=1; i<n; i++)
#define ll long long
#include <math.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <vector>


using namespace std;
#define PI acos(-1)
using P =pair<ll,ll>;

ll ketasu(ll a){
   ll num=1;
   while(a/10){
       num++;
       a/=10;
   }
   return num;
}

ll gcd(ll a,ll b){return b ? gcd(b,a%b) :a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

ll kosuu(ll a){
    ll sum=0;
    for(ll i=1;i*i<=a;i++){
        if(a%i==0){
            if(a!=1&&i*i!=a){
            sum+=2;
            }else{
             sum++;   
            }
        }
    }
    return sum;
}






ll di[]={1,0,-1,0};
ll dj[]={0,-1,0,1};

struct UnionFind {
    vector<int>d;
    UnionFind(int n=0):d(n,-1){}
    int find(int x){
        if((d[x])<0)return x;
        return d[x]=find(d[x]);
    }
    bool unite(int x,int y){
        x =find(x);y=find(y);
        if(x==y)return false;
        if(d[x]>d[y])swap(x,y);
        d[x]+=d[y];
        d[y]=x;
        return true;
    }
    bool same(int x,int y){return find(x)==find(y);};
    ll size(ll x){return -d[find(x)];};
};

int deg[100005];
vector<int> to[100005];





// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  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;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

mint f(int n) {
    if(n==0)return 1;
    mint x=f(2/n);
    x*=x;
    if(n%2==1)x*=2;
    return x;
}

mint choose(int n,int a){
    mint x =1,y=1;
    rep(i,a){
      x*=n-i;
      y*=a+i;
    }
    return x/y;
}
const ll m=1000005;

int main()
{
  ll n,m;
  cin>>n>>m;
  UnionFind uf(n);
  ll ans=0;
  rep(i,m){
  ll a,b;
  cin>>a>>b;
  uf.unite(a,b);
  }
  rep(i,n){
     ans=max(ans,uf.size(i));
  }
  cout<<ans<<endl;
}
 




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

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

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

  int a, b;
  cin >> a >> b;
  if (a > b) {
    cout << a - 1 << endl;
  } else {
    cout << a << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define For(i,x,y) for (register int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (register int i=(x);i<(y);i++)
#define Dow(i,x,y) for (register int i=(x);i>=(y);i--)
#define Debug(v) for (auto i:v) printf("%lld ",i);puts("")
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define ep emplace_back
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define fil(a,b) memset((a),(b),sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;
inline ll read(){
    ll x=0,f=1;char c=getchar();
    while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
    if (c=='-') f=-1,c=getchar();
    while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*f;
}

const int N = 110;
int n,m,f[N][N];
char s[N][N];

int main(){
	n=read(),m=read();
	For(i,1,n) scanf("%s",s[i]+1);
	fil(f,0x3f3f3f3f);
	f[1][1]=(s[1][1]=='#');
	For(i,1,n) For(j,1,m) if (i!=1||j!=1){
		if (s[i][j]=='.'){
			f[i][j]=min(f[i][j-1],f[i-1][j]);
		} else {
			f[i][j]=min(f[i-1][j]+(s[i-1][j]=='.'),f[i][j-1]+(s[i][j-1]=='.'));
		}
	}
	printf("%d\n",f[n][m]);
}

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

typedef long long ll;
const int maxn = 1e3 + 10;
const ll mod = 1e9 + 7;

ll n, k;

ll fact[maxn];
ll inv[maxn];


ll quickpow(ll a, ll b)
{
    ll ans = 1 % mod;
    while(b)
        {
            if(b & 1)
                ans = ans * a % mod;
            a = a * a % mod;
            b >>= 1;
        }
    return ans;
}

void init(){
    fact[0] = 1;
     for(int i = 1;i <= maxn ;i ++)
       fact[i] = fact[i - 1] * i % mod;
    inv[maxn] = quickpow(fact[maxn], mod - 2);
    for(int i = maxn - 1; i >= 0; i --)
        inv[i] = inv[i + 1] * (i + 1) % mod;
}

ll C(ll x, ll y){
    if(x < y)
        return 0;
    return fact[x] % mod * inv[y] % mod * inv[x - y] % mod;
}



int main()
{
    ll n, m;
    init();
    cin >> n >> m;
    cout << C(n, 2) + C(m, 2) << endl;
    return 0;
}


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

int main() {
  int m, d;
  cin >> m >> d;
  int count = 0;
  for(int i = 22; i <= d; i++) {
    int d1 = i % 10;
    int d10 = i / 10;
    if(d1 >= 2 && d10 >= 2) {
      int prod = d1 * d10;
      for(int j = 1; j <= m; j++) {
        if(prod == j) {
          count++;
          // cout << j << "/" << d10 << d1 << endl;
          break;
        }
      }
    }
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <string>
#include <utility>
#include <algorithm>
#include <functional>
#include <deque>
#define INF 1e18
#define MOD 1000000007
#define mod(x) ((x % MOD) + MOD) % MOD
#define MAX_N 1001

using namespace std;

typedef long long ll;
typedef pair<double,int> P;

struct vert {
  double x, y, r;
};

int N;
vert vs[MAX_N + 2];
double d[MAX_N + 2];
double cost[MAX_N+2][MAX_N+2];

void init_cost() {
  for (int i = 0; i < N+2; i++) {
    for (int j = 0; j < N+2; j++) {
      double dx = vs[i].x - vs[j].x;
      double dy = vs[i].y - vs[j].y;
      cost[i][j] = max(sqrt(dx*dx + dy*dy) - vs[i].r - vs[j].r, (double)0);
    }
  }
}

void dijkstra() {
  fill(d, d + N+2, INF);
  d[0] = 0;

  priority_queue<P, vector<P>, greater<P> > que;
  que.push(P(0, 0));

  while(!que.empty()) {
    P p = que.top(); que.pop();
    int u = p.second;
    if (d[u] < p.first) continue;
    for (int v = 0; v < N+2; v++) {
      if (d[v] > d[u] + cost[u][v] + 1e-14) {
        d[v] = d[u] + cost[u][v];
        que.push(P(d[v], v));
      }
    }
  }
}

int main() {
  double x, y, r;
  for (int i = 0; i < 2; i++) {
    cin >> x >> y;
    vs[i] = (vert){x, y, 0};
  }
  cin >> N;
  for (int i = 2; i < N+2; i++) {
    cin >> x >> y >> r;
    vs[i] = (vert){x, y, r};
  }

  init_cost();
  dijkstra();

  printf("%.10lf", d[1]);
  cout << endl;

  return 0;
}


Measured memory_bytes: 13936
#include <stdio.h>
#define N 100

int main(){
  int i,j,s,length,count=0,minj;
  int A[N];
  
  scanf("%d", &length);
  for( i=0 ; i<length ; i++ ){
    scanf("%d", &A[i]);
  }
  
  for( i=0 ; i<length ; i++ ){
    minj = i;
    for( j=i ; j<length ; j++ ){
      if( A[j] < A[minj] ){
	minj = j;
      }
    }
    if( i<minj ){
      s = A[i];
      A[i] = A[minj];
      A[minj] = s;
      count++; 
    }
  }
  
  for( i=0 ; i<length ; i++ ){
    printf("%d", A[i]);
    if( i!=length-1 ) printf(" ");
  }
  printf("\n");
  printf("%d\n", count);
  return 0;
}

Measured memory_bytes: 604
// https://atcoder.jp/contests/abc156/tasks/abc156_d
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (b)-1; i >= (a); --i)

// https://qiita.com/naru7sh/items/d42dcc720cdc9b8ee3de
// Fermat Combination
const int mod = (int)1e9 + 7;

// mod条件下の高速pow
ll modpow(ll a, ll p) {
    if (p == 0)
        return 1;
    if (p % 2 == 0) {
        ll root = modpow(a, p / 2);
        return root * root % mod;
    } else
        return a * modpow(a, p - 1) % mod;
}

ll fermatComb(ll a, ll b) {
    if (b > a - b)
        return fermatComb(a, a - b);
    ll mul = 1; //分子
    ll div = 1; //分母
    for (int i = 0; i < b; i++) {
        mul *= (a - i);
        mul %= mod;
        div *= (i + 1);
        div %= mod;
    }
    //フェルマーの小定理を利用して掛け算で計算
    return mul * modpow(div, mod - 2) % mod;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N, A, B;
    cin >> N >> A >> B;
    // nCrの計算
    ll t = modpow(2, N) - fermatComb(N, A) - fermatComb(N, B) - 1;
    while (t < 0) {
        t += mod;
    }
    cout << t << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define READ freopen("in.txt","r",stdin)
#define WRITE freopen("out.txt","w",stdout);
#define pb push_back
#define mem(arr,val) memset(arr,val,sizeof(arr))
#define sf(x) scanf("%d",&x)
#define sf2(x,y) scanf("%d %d",&x,&y)
#define sl(x) scanf("%lld",&x)
#define sl2(x,y) scanf("%lld %lld",&x,&y)
#define sl3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define sd(x) scanf("%lf",&x);
#define pii pair<int,int>
#define pLL pair<long long,long long>
#define ff first
#define sn second
#define PRINT_CASE  printf("Case %d: ",tc++)
#define mx 100005
#define lnd tree[ind<<1]
#define rnd tree[(ind<<1)+1]
#define cnd tree[ind]
#define lndp b,(b+e)>>1,(ind<<1)
#define rndp ((b+e)>>1)+1,e,(ind<<1)+1
typedef long long ll;
typedef long long int lln;
ll INF=1<<28;
//typedef long long lld;
const double pi=acos(-1.0);
int fx[]={1,-1,0,0}; //direction array
int fy[]={0,0,1,-1};
int dir[4][2]={1,0,-1,0,0,-1,0,1};

//#define INF 10000
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    else
        return gcd(b,a%b);
}
ll lcm(ll a,ll b)
{
    return a/gcd(a,b)*b;
}

bool cmp(int a, int b)
{
    return a<b;
}

struct compare
{
  bool operator()(const int& l, const int& r)
  {
      return l>r;
  }
};

vector<int>G[200005];
int arr[200005];
map<int,string>mp;
string tosixdigit(int n)
{
    string tmp="";
    char c;
    while(n)
    {
        c=(n%10)+'0';
        tmp=c+tmp;
        n/=10;
    }
    while(tmp.size()<6)
    {
        tmp='0'+tmp;
    }
    return tmp;
}
int main()
{
//    READ;
//    cout<<tosixdigit(1)<<endl;
   int n,m,x;
    sf2(n,m);
    for(int i=0;i<m;i++)
    {
        sf2(x,arr[i]);
        G[x].pb(arr[i]);
    }
    string tmp="";
    int c=0;
    for(int i=1;i<=n;i++)
    {
        c=1;
        sort(G[i].begin(),G[i].end());
        for(int j=0;j<G[i].size();j++)
        {
            tmp+=tosixdigit(i);
            tmp+=tosixdigit(c);
            c++;
            mp[G[i][j]]=tmp;
//            cout<<tmp<<endl;
            tmp="";
        }
    }
    for(int i=0;i<m;i++)
    {
        cout<<mp[arr[i]]<<endl;
    }
    return 0;
}




Measured memory_bytes: 20608
W,H,N = map(int , raw_input().split())
white = {"l_bottom":[0,0],"r_top":[W,H]}

areaZero = False

for i in xrange(N):
    x,y,a = map(int,raw_input().split())
    if a == 1:
        if x > white['r_top'][0]:
            areaZero = True 
            continue
        if x > white['l_bottom'][0]:
            white['l_bottom'][0] = x
            continue
    if a == 2:
        if x <  white['l_bottom'][0]:
            areaZero = True 
            continue
        if x < white['r_top'][0]:
            white['r_top'][0] = x
            continue
    if a ==3 :
        if y > white['r_top'][1]:
            areaZero = True 
            continue
        if y > white['l_bottom'][1]:
            white['l_bottom'][1] = y
            continue
    if a == 4 :
        if y < white['l_bottom'][1]:
            areaZero = True 
            continue
        if y < white['r_top'][1]:
            white['r_top'][1] = y
            continue
if areaZero == True:
    print 0
else:
    print (white['r_top'][0]  - white['l_bottom'][0]) * (white['r_top'][1]  - white['l_bottom'][1])

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

int main (){

    int N[3],count[2]={},ans;
    for(int i = 0; i < 3; i++) {
        cin >> N[i];
        count[N[i]%2]++;
    }

    sort(N,N+3);

    if((N[2]-(N[0]+(N[2]-N[1])))%2==0) {
        ans = (N[2]-N[1]) + (N[2]-(N[0]+(N[2]-N[1])))/2;
    }else {
        N[2]++;
        N[0]++;
        ans = (N[2]-N[1]) + (N[2]-(N[0]+(N[2]-N[1])))/2+1;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;

int main() {
  int n;
  cin >> n;
  vector<pair<int,int>> p(n);
  for(int i = 0; i < n; i++) {
    int joy;
    cin >> joy;
    p.push_back(make_pair(joy, i));
  }
  sort(p.rbegin(), p.rend());

  ll dp[n+1][n+1];
  for(int i = 0; i <= n; i++) {
    for(int j = 0; j <= n; j++) {
      dp[i][j] = 0;
    }
  }
 
  for(int i = 0; i < n; i++) {
    int joy = p[i].first;
    int index = p[i].second;
    for(int l = 0; l < i+1; ++l) {
      int r = i-l;
      ll moved_joy = ll(abs(index-(n-r-1)))*joy;
      dp[i+1][l] = max(dp[i+1][l], dp[i][l]+moved_joy);
      moved_joy = ll(abs(index-l))*joy;
      dp[i+1][l+1] = max(dp[i+1][l+1], dp[i][l]+moved_joy);
    }
  }

  ll ans = 0;
  for(int i = 0; i < n+1; ++i) {
    ans = max(ans, dp[n][i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 34956
#include <bits/stdc++.h>
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define BUF 1e5
#define INF 1<<30
using namespace std;
ll MOD = 1e9 + 7;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S,T;
ll ans = 0;
int main() {
	cin >> N >> K;
	cin >> S;
	if (S[K - 1] == 'A') {
		S[K - 1] = 'a';
	}else if (S[K - 1] == 'B') {
		S[K - 1] = 'b';
	}else if (S[K - 1] == 'C') {
		S[K - 1] = 'c';
	}
	cout << S << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3") //コンパイラ最適化用

#define _GLIBCXX_DEBUG //配列に[]でアクセス時のエラー表示
#include <algorithm>   //sort,二分探索,など
#include <bitset>      //固定長bit集合
#include <chrono>      //実行時間計測
#include <cmath>       //pow,logなど
#include <complex>     //複素数
#include <deque>       //両端アクセスのキュー
#include <functional>  //sortのgreater
#include <iomanip>     //setprecision(浮動小数点の出力の誤差)
#include <iostream>    //入出力
#include <iterator>    //集合演算(積集合,和集合,差集合など)
#include <map>         //map(辞書)
#include <numeric>     //iota(整数列の生成),gcdとlcm,accumulate
#include <queue>       //キュー
#include <set>         //集合（順序保持）
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility> //pair
#include <vector>  //可変長配列
using namespace std;
typedef long long ll;
typedef long double ld;

#define REP(i, n) for (int i = 0; i < ll(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < ll(b); i++)
#define FORD(i, a, b) for (int i = a; i > ll(b); i--)
// xにはvectorなどのコンテナ
#define ALL(x) x.begin(), x.end()
#define SIZE(x) ll(x.size()) // sizeをsize_tからllに直しておく
const long long INF = 1e12;
const int MOD = 1e9 + 7;
#define MAXR 100000 // 10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define Umap unordered_map
#define Uset unordered_set
#define int long long
const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000

// https://qiita.com/Lily0727K/items/06cb1d6da8a436369eed#c%E3%81%A7%E3%81%AE%E5%AE%9F%E8%A3%85
void print() { cout << endl; }

template <class Head, class... Tail> void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail) != 0)
        cout << " ";
    print(forward<Tail>(tail)...);
}

template <class T> void print(vector<T> &vec) {
    for (auto &a : vec) {
        cout << a;
        if (&a != &vec.back())
            cout << " ";
    }
    cout << endl;
}

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

void add(long long &a, long long b) {
    a += b;
    if (a >= MOD)
        a -= MOD;
}
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;
}

int n, cnt = 0;

void dfs(int cur, int used, int &cnt) {
    if (cur > n)
        return;
    if (used == 0b111) {
        cnt++;
    }
    dfs(cur * 10 + 7, used | 0b001, cnt);
    dfs(cur * 10 + 5, used | 0b010, cnt);
    dfs(cur * 10 + 3, used | 0b100, cnt);
}

signed main() {

    cin >> n;
    dfs(0, 0b000, cnt);
    print(cnt);
}


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

int main() {
    // freopen("leep.in", "r", stdin);
    // freopen("leep.out", "w", stdout);
    int x;
    cin >> x;
    int a, b;
    cin >> a >> b;
    for (int i = a; i <= b; i++) {
        if (i % x == 0) {
            return printf("OK\n"), 0;
        }
    }
    printf("NG\n");
    return 0;
}


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

vector<int> sosu(1000);
ll teisu=1000000007;

int main(){
    int N;
    ll ans=1;
    cin >> N;
    for(int i=2;i<=N;i++){
        int temp = i;
        int k = 0;
        for(int j=2;j<=N;j++){
            while((temp%j)==0){
                temp = temp/j;
                sosu[k]++;
            }
            k++;
        }
    }
    rep(i,N) {
        ans *= (sosu[i]+1);
        ans %= teisu;
    }
    printf("%ld\n",ans%teisu);
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<cctype>
#define qmin(x,y) (x=min(x,y))
#define qmax(x,y) (x=max(x,y))
using namespace std;

inline char gc() {
//	static char buf[100000],*p1,*p2;
//	return (p1==p2)&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
	return getchar();
}

template<class T>
int read(T &ans) {
	ans=0;char ch=gc();T f=1;
	while(!isdigit(ch)) {
		if(ch==EOF) return -1;
		if(ch=='-') f=-1;
		ch=gc();
	}
	while(isdigit(ch))
		ans=ans*10+ch-'0',ch=gc();
	ans*=f;return 1;
}

template<class T1,class T2>
int read(T1 &a,T2 &b) {
	return read(a)!=EOF&&read(b)!=EOF?2:EOF;
}

template<class T1,class T2,class T3>
int read(T1 &a,T2 &b,T3 &c) {
	return read(a,b)!=EOF&&read(c)!=EOF?3:EOF;
}

typedef long long ll;
const int Maxn=1100;
const int inf=0x3f3f3f3f;
const int mod=1000000007;

int n,m,f[Maxn][Maxn];

char getch() {
	char ch=gc();
	while(ch!='.'&&ch!='#') ch=gc();
	return ch;
}

signed main() {
//	freopen("test.in","r",stdin);
	read(n,m);
	f[1][1]=1;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			if(getch()=='.') f[i][j]+=(f[i-1][j]+f[i][j-1])%mod;
	printf("%d\n",f[n][m]);
	return 0;
}



Measured memory_bytes: 4480
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
  int H,W,h,w;
  cin>>H>>W>>h>>w;

  if(H%h==0&&W%w==0){
      cout<<"No"<<endl;
      return 0;
  }

  cout<<"Yes"<<endl;
  ll INF=1e9;
  ll plus=INF/(h*w-1)-1;
  ll ans[H+1][W+1]={};
  for(int i=1;i<=H;i++){
      for(int j=1;j<=W;j++){
          if(i%h==0&&j%w==0) ans[i][j]=-INF;
          else ans[i][j]=plus;
      }
  }

  for(int i=1;i<=H;i++){
      for(int j=1;j<=W;j++){
          cout<<ans[i][j]<<" ";
      }
      cout<<endl;
  }

  return 0;
}


Measured memory_bytes: 4864
#include <iostream>
#include <vector>

using namespace std;

int n, m;
vector<int> G[100005];
vector<int> vec;

bool dfs(int v, int pre, int g, int x, int rem)
{
	if(rem == 0) return false;
	for(int i = 0; i < G[v].size(); i++){
		if(G[v][i] == pre || G[v][i] == x) continue;
		if(G[v][i] == g) return true;
		if(dfs(G[v][i], v, g, x, rem-1)) return true;
	}
	return false;
}

int main(void)
{
	cin >> n >> m;
	int u, v;
	for(int i = 0; i < m; i++){
		cin >> u >> v;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	
	for(int i = 1; i <= n; i++){
		if(G[i].size() % 2){
			cout << "No" << endl;
			return 0;
		}
	}
	int cnt = 0;
	for(int i = 1; i <= n; i++){
		if(G[i].size() >= 6){
			cout << "Yes" << endl;
			return 0;
		}
		if(G[i].size() == 4) vec.push_back(i), cnt++;
	}
	if(cnt < 2){
		cout << "No" << endl;
		return 0;
	}
	if(cnt == 2){
		if(dfs(vec[0], -1, vec[0], vec[1], 2*n)) cout << "Yes" << endl;
		else cout << "No" << endl;
		return 0;
	}
	
	cout << "Yes" << endl;
	return 0;
}

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

class Program
{
    public void Solve()
    {
        var S=Console.ReadLine();
        Console.WriteLine((S.Length>=4&&S.Substring(0,4)=="YAKI")?"Yes":"No");
    } 
    
    static void Main()
    {
        new Program().Solve();
    }
}

Measured memory_bytes: 13140
w, h, n = map(int, input().split())
r_w = w
l_w = 0
u_h = h
d_h = 0

for i in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        l_w = max(l_w, x)
    elif a == 2:
        r_w = min(r_w, x)
    elif a == 3:
        d_h = max(d_h, y)
    elif a == 4:
        u_h = min(u_h, y)

res = max(0, r_w - l_w) * max(0, u_h - d_h)
print(res)


Measured memory_bytes: 9136
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#define endl '\n'
#define ll long long
#define mod 1000000007
#define NCONS 1000000000
//#define NCONS 100001
//#define NCONS 1001
//#define NCONS 101
#define MCONS 2001
#define LIMIT 1000000000
#define TRUE 1
#define FALSE 0
#define toRadian(degree) ((degree) * (M_PI / 180.))
#define toDegree(radian) ((radian) * (180. / M_PI))
using namespace std;
struct Point{int x; int y;};
struct PPoint{Point x; Point y;};

ll gcd(ll a, ll b) // a > b
{
    if(a < b) swap(a, b);
    if(b <= 0) return a;
    return gcd(b, a % b);
}

int main(void)
{
    cin.tie(NULL); ios_base::sync_with_stdio(false);
    int N; cin >> N; vector<ll> a(N, 0); for(int i = 0; i < N; i++) cin >> a[i];
    ll ret = a[0];
    
    for(int i = 1; i < N; i++)
    {
        ret = gcd(ret, a[i]);
    }
    cout << ret << endl;
    
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cmath>
#include <queue>
#include <sstream>

using namespace std;
typedef long long ll;
int m[510][510];

vector<pair<int, int>> from;
vector<pair<int, int>> to;

vector<string> hist;
int main() {
  int h, w;
  cin >> h >> w;
  
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin >> m[i][j];
    }
  }
  
  for (int i = 0; i < h; i++) {
    if (i % 2 == 0) {
      for (int j = 0; j < w - 1; j++) {
        if (m[i][j] % 2 == 1) {
          m[i][j + 1]++;
          from.push_back({i, j});
          to.push_back({i, j + 1});
        }
      }
      if (i != h - 1 && m[i][w - 1] % 2 == 1) {
        m[i + 1][w - 1]++;
        from.push_back({i, w - 1});
        to.push_back({i + 1, w - 1});
      }
    } else {
      for (int j = w - 1; j > 0; j--) {
        if (m[i][j] % 2 == 1) {
          m[i][j - 1]++;
          from.push_back({i, j});
          to.push_back({i, j - 1});
        }
      }
      if (i != h - 1 && m[i][0] % 2 == 1) {
        m[i + 1][0]++;
        from.push_back({i, 0});
        to.push_back({i + 1, 0});
      }
    }
  }
  cout << from.size() << endl;
  for (int i = 0; i < from.size(); i++) {
    cout << from[i].first + 1 << " " << from[i].second + 1 << " ";
    cout << to[i].first + 1 << " " << to[i].second + 1 << endl;
  }
  return 0;
}


Measured memory_bytes: 5228
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007

int main() {
    int n;
    cin >> n;
    int a[100001];
    for(int i = 0; i < n; i++){
    	cin >> a[i];
    }
    sort(a, a + n);
    int rindex = 0;
    for(int i = 1; i < n - 1; i++){
    	if(abs(a[n - 1] / 2 + a[n - 1] % 2 - a[i]) < abs(a[n - 1] / 2 + a[n - 1] % 2 - a[rindex])){
    		rindex = i;
    	}
    }
    cout << a[n - 1] << " " << a[rindex] << endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<string>

using namespace std;

string str;

int main() {
    cin >> str;
    int N = str.size();

    int ans = 0;
    char curr, prev = str.back();
    for (int i = N - 2; 0 <= i; i--) {
        curr = str[i];
        if (curr == prev)
            continue;
        prev = curr;
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3688
n,m = list(map(int,input().split()))
locations = list(map(int,input().split()))
locations = sorted(locations)
distance = list()

if n >= m:
    print(0)
else:
    for i in range(len(locations) - 1):
        distance.append(locations[i+1] - locations[i])
    
    distance = sorted(distance)

    if n != 1:
        for i in range(n-1):
            distance.pop()
    
    print(sum(distance))

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

public class MainClass
{
	public const long Giri = 1000000007;
	public const long DpInf = 99999999999999;

	public static void Main(string[] args)
	{
		var s = Console.ReadLine();
		var x = s.ToLong();
		long wa = 0;
		for(int i = 0; i < s.Length; i++)
		{
			wa += (s[i] - '0');
		}
		if(x % wa == 0 )
		
		{
			Console.WriteLine("Yes");
		}
		else
		{
			Console.WriteLine("No");
		
		}
	}
	
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str, int offset = 0)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt() + offset;
		return r;
	}
}

Measured memory_bytes: 11092
#include<stdio.h>

int main(){
	
	int n;
    for(int i=1 ; ; i++){
        scanf("%d",&n);
        if(n==0){
            break;
        }
        else{
           printf("Case %d: %d\n",i,n);
        }
    }
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	return 0;
}


Measured memory_bytes: 1912
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double ld;

#define for0(i, n) for (ll i = 0; i < (ll)(n); ++i) // 0 based indexing
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i) // 1 based indexing
#define forc(i, l, r) for (ll i = (ll)(l); i <= (ll)(r); ++i) // closed interver from l to r r inclusive
#define forr0(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i) // reverse 0 based.
#define forr1(i, n) for (ll i = (ll)(n); i >= 1; --i) // reverse 1 based

#define ff first
#define ss second
#define pb push_back

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	string s;
	cin >> s;
	ll ans= 0;
	for0(i,s.length()/2){
		if(s[i] != s[s.length()-i-1]){
			ans++;
		}
	}
	cout << ans << endl;
	
	return 0;
}


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


int main(void){
   int a,b,c,d;
   cin >> a >> b >> c >> d;
   int aokiHp = 0;
   int takahashiHp = 0;
   
   while (c > 0){
      c -= b;
      aokiHp++;
   }
   while (a > 0){
       a -= d;
      takahashiHp++;
   }
   
   if (takahashiHp >= aokiHp) cout << "Yes" << endl;
   else cout << "No" << endl;
   
  
}

Measured memory_bytes: 3624
#include <stdio.h>
#include <iostream>
using namespace std;

int main()
{
	int n;
	cin >> n;
	int i, j;
	for (i = 0; i < n; i++)
	{
		for (j = i + 1; j < n; j++)
		{
			unsigned int a = i ^ j;
			a |= a >> 1;
			a |= a >> 2;
			a |= a >> 4;
			a |= a >> 8;
			a |= a >> 16;
			a = (a & 0x55555555) + ((a >> 1) & 0x55555555);
			a = (a & 0x33333333) + ((a >> 2) & 0x33333333);
			a = (a & 0x0F0F0F0F) + ((a >> 4) & 0x0F0F0F0F);
			a = (a & 0x00FF00FF) + ((a >> 8) & 0x00FF00FF);
			a = (a & 0xFFFF) + ((a >> 16) & 0xFFFF);
			cout << a;
			if (j == n - 1) cout << endl;
			else cout << " ";
		}
	}
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
using namespace std;
long gcd(long m,long n){if(!n)return m;return gcd(n,m%n);}
long lcm(long m,long n){return m*n/gcd(m,n);}
int main()
{
	long a,b,c,d;
	cin>>a>>b>>c>>d;
	a--;
	cout<<b-a-b/c+a/c-b/d+a/d+b/lcm(c,d)-a/lcm(c,d)<<endl;
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int main(){
  int a,b;
  cin>>a>>b;
  cout<<(a%3==0 || b%3==0 || (a+b)%3==0 ? "Possible" : "Impossible")<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i ,n) for(int i = 0 ; i < (n) ; i ++ )
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
  int n,m,c;
  cin>>n>>m>>c;
  vin b(m);
  rep(i,m) cin>>b[i];
  vector<vin> a(n,vin(m));
  rep(i,n){
    rep(j,m){
      cin>>a[i][j]; 
    }
  }
  //////
  int ans=0;
  rep(i,n){
   ll sum=0;
    rep(j,m)
    sum+=b[j]*a[i][j];
    
      if(sum+c>0) ans++;
    
  }
  
  cout<<ans<<endl;
}







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


int main()
{
ll n;
cin >> n;
ll ch=1;
rep(i,20){
    if(n==ch){
    cout << "No" << endl;
    return 0;
    }
    else if(ch>n)break;
    else ch*=2;
}
ll a=ch/2;
ch=4;

cout << "Yes" << endl;
rep(i,ch-2){
    cout << i+1 << " " << i+2 << endl;
}
cout << ch-1 << " " << 1+n << endl;
rep(i,ch-2){
    cout << i+1+n << " " << i+2+n << endl;
}

if(n%2){
    rep(i,(n-ch+1)/2){
        cout << 1 << " " << ch+2*i << endl;
        cout << ch+2*i << " " << ch+2*i+1 << endl;
        cout << 1 << " " << ch+2*i+1+n << endl;
        cout << ch+2*i+n+1 << " " << ch+2*i+n << endl;
    }
}
else{
    rep(i,(n-ch)/2){
        cout << 1+n << " " << ch+2*i << endl;
        cout << ch+2*i << " " << ch+2*i+1 << endl;
        cout << 1+n << " " << ch+2*i+1+n << endl;
        cout << ch+2*i+n+1 << " " << ch+2*i+n << endl;
    }
    cout << a << " " << n << endl;
    if(n-a+1==3)cout << 3 << " " << n+n << endl;
    else cout << n+n-a+1 << " " << n+n << endl;
}
return 0;
}


Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define siz(v) (ll)(v).size()
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define repr(i, a, n) for (ll i = n - 1; (ll)a <= i; i--)
#define lb lower_bound
#define ub upper_bound
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 + 99);
vector<ll> dx = {-1, 1, 0, 0}, dy = {0, 0, -1, 1};
template <typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <typename T>
T mpow(T a, T n)
{
   T res = 1;
   for (; n; n >>= 1)
   {
      if (n & 1)
         res = res * a;
      a = a * a;
   }
   return res;
}
vector<string> v(200);

template <typename T>
class UnionFind
{
public:
   //以下公開

   //親の番号を格納する。親である場合は-(その集合のサイズ)
   vector<T> Parent;

   //作るときはParentの値を全て-1にする
   //こうすると全てバラバラになる
   UnionFind(T N)
   {
      Parent = vector<T>(N, -1);
   }

   //Aがどのグループに属しているか調べる
   T root(T A)
   {
      if (Parent[A] < 0)
         return A;
      return Parent[A] = root(Parent[A]);
   } //代入しておくことで参照を速くする

   //自分のいるグループの頂点数を調べる
   T size(T A)
   {
      return -Parent[root(A)];
   } //親である場合は-(その集合のサイズ)なので、Ａの親の

   //AとBをくっ付ける
   bool connect(T A, T B)
   {
      //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
      A = root(A);
      B = root(B);
      if (A == B)
      {
         //すでにくっついてるからくっ付けない
         return false;
      }

      //大きい方(A)に小さいほう(B)をくっ付けたい
      //大小が逆だったらひっくり返しちゃう。
      if (size(A) < size(B))
         swap(A, B);

      //Aのサイズを更新する
      Parent[A] += Parent[B];
      //Bの親をAに変更する
      Parent[B] = A;

      return true;
   }

   bool same(T A, T B)
   {
      return root(A) == root(B);
   }
};

ll dp[210][210] = {};

signed main()
{
   ll n, ans = -1;
   cin >> n;
   UnionFind<ll> u(2 * n);

   rep(i, 0, n)
   {
      cin >> v[i];
      rep(j, 0, n)
      {
         if (v[i][j] == '1')
         {
            u.connect(i, j + n);
            u.connect(i + n, j);
            dp[i][j]=1;
         }
         else
         {
            if (i != j)
               dp[i][j] = INF;
         }
      }
   }

   rep(i, 0, n)
   {
      if (u.same(i, i + n))
      {
         cout << -1 << endl;
         return 0;
      }
   }

   rep(k, 0, n) rep(i, 0, n) rep(j, 0, n)
   {
      dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
   }

   rep(i, 0, n) rep(j, 0, n)
   {
      ans = max(ans, dp[i][j]);
   }

   cout << ans+1 << endl;
}

Measured memory_bytes: 640
A,B = (int(x) for x in input().split())
if A%2==0:
  a=A//2
else:
  a=(A+1)//2  

d=1
s=0
d=int(d)
for i in range(a): 
  if A%d==0 and B%d==0:
    s=d
  d+=1
if s==1 :
  print(int(A*B))
elif B%A==0:
  print(B)
elif A%B==0:
  print(A)

else:
  print(int(A*(B/s)))

Measured memory_bytes: 3188
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;

typedef long long ll;

typedef std::pair<int, int> ipair;
bool lessPair(const ipair& l, const ipair& r){return l.second < r.second;}
bool morePair(const ipair& l, const ipair& r){return l.second > r.second;}

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 ll MOD = 1e9 + 7;
// const long long INF = 1LL<<60;
void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; }
void sub(long long &a, long long b) { a -= b; if (a < 0) a += MOD; }
void mul(long long &a, long long b) { a *= b; a %= MOD; }
ll llmin(ll a, ll b) { if (a < b) return a; else return b; }
ll llmax(ll a, ll b) { if (a < b) return b; else return a; }
ll llabs(ll a) { if (a >= 0) return a; else return - a; }
ll llmodpow(ll a, ll n) {
   if (n == 0) return 1;
   ll tmp = llmodpow(a, n / 2);
   mul(tmp, tmp);
   if (n & 1) mul(tmp, a);
   return tmp;
}

int main() {
   int r, g, b;
   cin >> r >> g >> b;
   if ((r * 100 + g * 10 + b) % 4 == 0) cout << "YES" << endl;
   else cout << "NO" << endl;
   return 0;
}


Measured memory_bytes: 256
#include <cstdio>
using namespace std;

int W, H;
const int SIZE = 20;
char f[SIZE + 1][SIZE + 1];
bool c[SIZE][SIZE];

int dfs(int x, int y){
	if(x < 0 || y < 0 || x >= W || y >= H) return 0;
	if(c[y][x] || f[y][x] == '#') return 0;
	c[y][x] = true;
	
	return 1 + dfs(x + 1, y) + dfs(x, y + 1) + dfs(x - 1, y) + dfs(x, y - 1);
}

int main(){
	int sx, sy;
	
	while(true){
		scanf("%d%d", &W, &H);
		if(H == 0 && W == 0) break;
		for(int i = 0; i < H; i++){
			scanf("%s", f[i]);
		}
		
		for(int y = 0; y < H; y++){
			for(int x = 0; x < W; x++){
				c[y][x] = false;
				if(f[y][x] == '@'){
					sx = x; sy = y;
				}
			}
		}
		
		printf("%d\n", dfs(sx, sy));
	}
	
	return 0;
}

Measured memory_bytes: 1060
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
int main() {
  ll n,m,k;
  cin>>n>>m>>k;
  vector<ll>dpa(n+1);
  vector<ll>dpb(m+1);
  for(ll i=1;i<=n;i++){
    ll a;
    cin>>a;
    dpa[i]=dpa[i-1]+a;
  }
  for(ll i=1;i<=m;i++){
    ll b;
    cin>>b;
    dpb[i]=dpb[i-1]+b;
  }
  ll ans=0;
  for(int i=0;i<=n;i++){
    ll res=i;
    ll time=k-dpa[i];
    if(time>=0){
       auto x=upper_bound(dpb.begin(),dpb.end(),time);
       ll l=x-dpb.begin();
       res+=l-1;
       ans=max(ans,res);
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 6424
#include<bits/stdc++.h>
using namespace std;
int main(){
    int k,a,b;
    cin>>k>>a>>b;
    for(int i=a;i<=b;i++)
        if(i%k==0){
        	cout<<"OK";
        	return 0;
		}
	cout<<"NG";
    return 0;
} 

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

int main()
{
ll n ;
cin >> n ;
vector<ll> a(n);
rep(i, n){
  cin >> a[i];
}
rep(i,n){
  if(i%2==0&&a[i]%2)ans++;
}
cout << ans << endl;
return 0;
}

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


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

    string A,B;
    cin >> A >> B;
    string ans="EQUAL";
    if(A==B) ans="EQUAL";
    else if(A.size()>B.size()) ans="GREATER";
    else if(A.size()<B.size()) ans="LESS";
    else{
        string x=max(A,B);
        if(x==A) ans="GREATER";
        else ans="LESS";

    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
ll mod=1000000007;
int main()
{
    ll a,b;
    cin>>a>>b;
    if(a>=1 && a<=9 && b>=1 && b<=9)
        cout<<a*b<<endl;
    else
        cout<<-1<<endl;
}


Measured memory_bytes: 256
#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 equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

int main() {
  ll n, m;
  cin >> n >> m;

  ll ans = min(n, m / 2);
  m -= n * 2;
  if (m > 0) ans += m / 4;
  cout << ans << endl;


  
  return 0;
}

Measured memory_bytes: 256