akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
	int64_t H, W;
	cin >> H >> W;
	
	if( H == 1 || W == 1 ) cout << 1 << endl;
    else if ( H % 2 == 0 ) cout << H * W / 2 << endl;
  	else cout << (H - 1) * W / 2 + (W + 1) / 2 << endl;

}


Measured memory_bytes: 256
n,k=map(int,input().split())
d=list(map(int,input().split()))
dic={}
for i in d:
    dic[str(i)]=1
# print(dic)
# s=str(n)
# print(list(s))
while 1:
    s=str(n)
    # print(s)
    for i in range(len(s)):
        if s[i] in dic:
            break
    else:
        print(n)
        break
    n+=1

Measured memory_bytes: 39536
from fractions import gcd
from functools import reduce
N=int(input())
A=list(map(int,input().split()))
def lcm_base(x, y):
    return (x * y) // gcd(x, y)
def lcm(*num):
  return reduce(lcm_base, num, 1)
c=0
for i in range(N):
  X=lcm(*A)
  if X>c:
    c=X
under=c
over=0
for a in A:
  over+=c//a
print(under/over)

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


/* macro */
#define int long long
#define rep(i,a,b) for(int i=a;i<b;i++)
#define revrep(i,a,b) for(int i = a; i > b; i--)
#define exist(s,e) ((s).find(e)!=(s).end())
#define all(v) (v).begin(), (v).end()
#define each(s,itr) for(auto (itr) = s.begin(); (itr) != s.end(); (itr)++)
#define sum(v) accumulate(all(v), (0LL))
#define sec second
#define fir first
#define pb push_back



/* alias */
template<class T> using vec = vector<T>;
typedef vector<int> vi;
typedef pair<int, int> pi;


/* constant */
const int inf = pow(2, 62);
const int mod = 1e9 + 7;
int dx[8]={1,0,-1,0,-1,1,-1,1};
int dy[8]={0,1,0,-1,-1,-1,1,1};



/* io_method */
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
string readline(){string s;getline(cin, s);return s;}
template<class T> void printx(T n){cout << n;}
template<class T, class U> void printx(pair<T, U> p){cout << "(" << p.first << "," << p.second << ")";}
template<class T> void printx(vector<T> v){cout << "{";rep(i,0,v.size()){printx(v[i]);if(i != v.size()-1)printx(",");}cout << "}";}
template<class T> void print(T n){printx(n);cout << endl;}
template<class T> void print(set<T> s){cout << "{";each(s, e){if(e != s.begin()) printx(",");printx(*e);}cout << "}" << endl;}
template<class T, class U> void print(map<T, U> mp){cout << "{";each(mp, e){cout << "(" << e -> first << "," << e -> second << ")";}cout << "}" << endl;}


/* general_method */
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }




/* main */
int n;

bool isfind(string s, string pat){
    if(s.find(pat) != string::npos) return true;
    else return false;
}

int dfs(int i, string s){
    if(i == 10){

        if(isfind(s,"3") && isfind(s,"5") && isfind(s,"7") && stoll(s) <= n){
            return 1;
        }else{
            return 0;
        }
    }

    int ans = 0;

   if(s.back() == '0') ans += dfs(i + 1, s + "0");

    ans += dfs(i + 1, s + "3");
    ans += dfs(i + 1, s + "5");
    ans += dfs(i + 1, s + "7");

    return ans;



}


signed main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    n = input();

    print(dfs(0,"0"));


    




    
    
    
    
    








    

    
    




    
    



    
    

    







   




    

    

    




    



    



    

 
    
    


    

    
   
    













}






    










    




    










Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

struct num{
  int number;
  int count;
};

int cmp(const void* a, const void* b) {
  return (*(struct num*)b).number - (*(struct num*)a).number;
}

int main() {
  int b[9] = {2, 5, 5, 4, 5, 6, 3, 7, 6};
  int n, m, t, i, j, max;
  scanf("%d%d", &n, &m);
  struct num num[m];
  int dp[n+1];
  for (i = 0; i < m; i++) {
    scanf("%d", &t);
    num[i].number = t;
    num[i].count = b[t-1];
  }
  qsort(num, m, sizeof(struct num), cmp);
  dp[0] = 0;
  for (i = 1; i < n+1; i++) {
    max = INT_MIN;
    for (j = 0; j < m; j++) {
      if (i-num[j].count >= 0) {
        max = (max < dp[i-num[j].count]+1) ? dp[i-num[j].count]+1 : max;
      }
    }
    dp[i] = max;
  }
  while (n > 0) {
    i = 0;
    while (n-num[i].count < 0 || dp[n-num[i].count] != dp[n] -1) {
      i++;
    }
    n -= num[i].count;
    printf("%d", num[i].number);
  }
  printf("\n");
  return 0;
}


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

using namespace std;

int main() {
    int n, c, k, cnt = 1, ans = 0;
    scanf("%d%d%d", &n, &c, &k);
    vector<int> t(n);
    for (int i = 0; i < n; ++i) scanf("%d", t.begin() + i);
    sort(t.begin(), t.end());
    int ti = t.front();
    for (int i = 1; i < n; ++i) {
        ++cnt;
        if (cnt > c || t.at(i) > ti + k) {
            ++ans;
            ti = t.at(i);
            cnt = 1;
        }
    }
    printf("%d\n", ans + 1);
    return 0;
}


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

namespace
{
const int MAX_N	= 100000;
char S[ MAX_N + 5 ];
}
int main( int argc, char *argv[] )
{
int iLen;
int iA;
int iB;
char C;

	ios::sync_with_stdio( false );
	cin.tie( 0 );

	cin >> S;
	iLen = strlen( S );
	iA = iLen / 2;
	iB = iLen - iA;
	if( iA == iB )
	{
		C = S[ iB ];
		iA--;
		if( C != S[ iA ] )
		{
			cout << iB << endl;

			return 0;
		}
	}
	else
	{
		C = S[ iA ];
		iA--;
	}

	while( iA >= 0 && iB < iLen )
	{
		if( C != S[ iA ] || C != S[ iB ] )
		{
			cout << iB << endl;

			return 0;
		}

		iA--;
		iB++;
	}

	cout << iLen << endl;

	return 0;
}



Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<stack>
#include<bitset>
#include<deque>
using namespace std;
#define ll long long
#define inf 0x3f3f3f3f
#define ri register int
#define il inline
#define fi first
#define se second
#define mp make_pair
#define pi pair<int,int>
#define mem0(x) memset((x),0,sizeof (x))
#define mem1(x) memset((x),0x3f,sizeof (x))
il char gc() {
	static const int BS = 1 << 22;
	static unsigned char buf[BS], *st, *ed;
	if (st == ed) ed = buf + fread(st = buf, 1, BS, stdin);
	return st == ed ? EOF : *st++;
}
#define gc getchar
template<class T>void in(T &x) {
	x = 0;
	bool f = 0;
	char c = gc();
	while (c < '0' || c > '9') {
		if (c == '-') f = 1;
		c = gc();
	}
	while ('0' <= c && c <= '9') {
		x = (x << 3) + (x << 1) + (c ^ 48);
		c = gc();
	}
	if (f) x = -x;
}
#undef gc
#define pb push_back
// 1743
#define N 1010
#define M 5010
int n;
vector<int>sn[N];
int w[N];
int f[N], g[2][M];
void dfs(int x) {
	for (ri i = 0; i < sn[x].size(); ++i) {
		dfs(sn[x][i]);
	}
	mem1(g);
	int op = 0;
	g[0][0] = 0;
	for (ri i = 0; i < sn[x].size(); ++i) {
		int v = sn[x][i];
		op ^= 1;
		mem1(g[op]);
		for (ri j = 0; j <= w[x]; ++j) {
			if (j - w[v] >= 0) g[op][j] = min(g[op][j], g[op ^ 1][j - w[v]] + f[v]);
			if (j - f[v] >= 0) g[op][j] = min(g[op][j], g[op ^ 1][j - f[v]] + w[v]);
		}
	}
	for (ri i = 0; i <= w[x]; ++i) {
		f[x] = min(f[x], g[op][i]);
	}
}
signed main() {
	in(n);
	mem1(f);
	for (ri i = 2, p; i <= n; ++i) {
		in(p);
		sn[p].pb(i);
	}
	for (ri i = 1; i <= n; ++i) {
		in(w[i]);
	}
	dfs(1);
	puts(f[1] < f[0] ? "POSSIBLE" : "IMPOSSIBLE");
	return 0;
}


Measured memory_bytes: 384
S = input()

AA = int(S[0:2])
BB = int(S[2:4])

if AA > 0 and AA <= 12:
    A = True
else:
    A = False

if BB > 0 and BB <= 12:
    B = True
else:
    B = False

if A and B:
    print("AMBIGUOUS")
elif B:
    print("YYMM")
elif A:
    print("MMYY")
else:
    print("NA")


Measured memory_bytes: 3060
#include <stdio.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

char f[16][16];

void draw(int x, int y) {
    if (x < 0 || x >= 12 || y < 0 || y >= 12) return ;
    if (f[x][y] != '1') return ;
    f[x][y] = '0';
    rep (d, 4) draw(x+dx[d], y+dy[d]);
}

int main() {
    while (scanf("%s", f[0]) != EOF) {
        rep (i, 11) scanf("%s", f[i+1]);
        int ans = 0;
        rep (i, 12) rep (j, 12) if (f[i][j] == '1') draw(i, j), ans++;
        printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector> 
#include <cmath>
#include <algorithm>
#include <set>
#include <string>
#include <map>
#include <cerrno>
#include <stdio.h>
#include <stdlib.h>
#include <cfenv>
#include <stack>
#include <math.h>
#include <iomanip>
#include <limits>
#include <queue>
#define ll long long int
#define pb push_back
#define mp make_pair
#define MOD 2019

using namespace std;

int main(){

    int N;
    cin >> N;

    vector<int> A(N);

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

    int tmp =0;

    for(int i=0;i<N;i++){
        tmp += A[i];
        tmp *= (-1);
    }
    tmp *= (-1);
    int x = tmp/2;

    cout << 2*x << " ";
    for(int i=0;i<N-1;i++){
        x = A[i]-x;
        cout << 2*x << " ";
    }
    cout << endl;

    return 0;
}

//3*673;

Measured memory_bytes: 1664
#include <stdio.h>

int main(void)
{
  int   max=0,min=0;
  int   n=0,a=0,c=0;
  long long int mix=0;

  scanf("%d", &c);

  while (n < c) {
    n++;
  scanf("%d",&a);
  mix = mix + a;
  if (n == 1)   max = a,min = a;
  if (a >= max) max = a;
  if (a <= min) min = a;
  }

  printf("%d %d %lld\n",min,max,mix);

  return 0;
}

Measured memory_bytes: 600
import java.util.Scanner;

class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.close();

        for (int i = 1; i <= n; i++) {
            int x = i;

            if (x % 3 == 0) {
                System.out.print(" " + i);
                continue;
            }
            while (x != 0) {
                if (x % 10 == 3) {
                    System.out.print(" " + i);
                    break;

                }
                x /= 10;
            }
        }
        
        System.out.println("");

    }

}


Measured memory_bytes: 28816
#include <iostream>
#include <vector>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define ll long long
#define fr(i,k,N) for(ll i=k; i<N;i++)
#define rep(i,N) for(ll i=0; i<N;i++)
#define alll(v) v.begin(),v.end()
using namespace std;
template <class X> void pr(X test){cout<<test<<endl;}
template <class X> void prr(X test){for(auto it:test){cout<<it<<endl;}cout<<endl;}

int main() {
    ll n;

    cin>>n;
    ll sum = 0,x=0,z=0,w=0;
    rep(i, n) {
        string s;
        cin>>s;
        rep(j, s.size() -1){
            if(s[j] == 'A' && s[j+1] == 'B') sum ++;
        }
        if(s[0] == 'B' && s.back() == 'A') z ++;
        else if(s.back() == 'A') x ++;
        else if(s[0] == 'B') w ++;
    }
    if(z > 1) {
        sum += (z -1);
        z = 1;
    }
    if(z == 0 ){
        sum += min(x, w);
    } else {
        if(x > 0) {
            if(w > 0) {
                x--;
                w--;
                z--;
                sum+=2;
                sum+=min(x,w);
            }else{
                sum+=1;
            }
        } else {
            if(w>0) sum++;
        }
    }
    pr(sum);
    
    return 0;
}

class UF { // union find from https://github.com/kartikkukreja/blog-codes (MIT)
    // [usage]
    // auto uf = new UF(n);
    // uf->merge(a, b);
    // ...
public:
    int *id; // inner id
    int cnt; // number of all vartices
    int *sz; // sz[i] means size of i's set
    UF(int N)   {
        cnt = N;
        id = new int[N];
        sz = new int[N];
        for(int i=0; i<N; i++) {
            id[i] = i;
            sz[i] = 1;
        }
    }
    ~UF() {
        delete [] id;
        delete [] sz;
    }
    int find(int p) {
        int root = p;
        while (root != id[root]) root = id[root];
        while (p != root) {
            int newp = id[p];
            id[p] = root;
            p = newp;
        }
        return root;
    }
    void merge(int x, int y) {
        int i = find(x);
        int j = find(y);
        if (i == j) return;
        
        if (sz[i] < sz[j]) {
            id[i] = j;
            sz[j] += sz[i];
        } else {
            id[j] = i;
            sz[i] += sz[j];
        }
        cnt--;
    }
    bool connected(int x, int y) {
        return find(x) == find(y);
    }
    int count() {
        return cnt;
    }
};

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

using namespace std;
using ll = long long;

int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

int main() {
    int n;
    cin >> n;

    vector<int> a(n);
    vector<int> num(1000010);
    int g = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        g = gcd(a[i], g);
        num[a[i]]++;
    }

    int i;
    for (i = 2; i <= 1000010; i++) {
        int x = 0;
        for (int j = i; j <= 1000010; j += i) x += num[j];
        if (x > 1) break;
    }

    if (i == 1000011) {
        cout << "pairwise coprime" << endl;
        return 0;
    }

    if (g == 1) {
        cout << "setwise coprime" << endl;
    }
    else {
        cout << "not coprime" << endl;
    }
}

Measured memory_bytes: 11132
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,a;
	scanf("%d",&n);
	int m=n;
	m=m+1;
	vector<int> v(m);
	for(int i=1;i<n;++i)
	{
		scanf("%d",&a);
		v[a]++;
	}
	for(int i=1;i<(int)v.size();++i)
		printf("%d\n",v[i]);
	return 0;
}

Measured memory_bytes: 4084
import itertools

N=int(input())
S=[input() for _ in range(N)]

M=len([s for s in S if s.startswith('M')])
A=len([s for s in S if s.startswith('A')])
R=len([s for s in S if s.startswith('R')])
C=len([s for s in S if s.startswith('C')])
H=len([s for s in S if s.startswith('H')])


ans=0
for i,j,k in itertools.combinations((M,A,R,C,H), 3):
    ans+=i*j*k

print(ans)

Measured memory_bytes: 10544
import sys
input = sys.stdin.readline

N,Q = map(int,input().split())
AB = [list(map(int,input().split())) for _ in [0]*(N-1)]
PX = [list(map(int,input().split())) for _ in [0]*Q]

E = [[] for _ in [0]*N]
for a,b in AB:
    a-=1
    b-=1
    E[a].append(b)
    E[b].append(a)

V = [0]*N
for p,x in PX:
    p-=1
    V[p] += x

q = [0]
done = [False]*N
while q:
    i = q.pop()
    done[i] = True
    for j in E[i]:
        if done[j] : continue
        V[j] += V[i]
        q.append(j)

print(*V)

Measured memory_bytes: 123228
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
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; }
int INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int kurai(int a,int b){
  int m=pow(10,b),n=pow(10,b-1);
  return (a%m)/n;
}
int ketawa(int a){
  int k=0;
  rep(i,keta(a)){
  k+=kurai(a,i+1);
  }
  return k;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
int mid(int a,int b,int c){
  vector<int> k(3);
  k[0]=a;k[1]=b;k[2]=c;
  sort(all(k));
  return k[1];
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
int modpow(int a,int b,int m=MOD){
	if(!b)return 1;	if(b&1)return modpow(a,b-1,m)*a%m;
	int memo = modpow(a,b>>1,m);
	return memo*memo%m;
}
int fact_mod(int n) {
    int f=1; 
for(int i=2;i<n+1;i++) f=f*(i%MOD)% MOD;
    return f;
}
int mod_pow(int x,int n) {
    int res=1;
    while(n>0){
        if(n&1) res=(res*x)%MOD; 
        x=(x*x)%MOD;        
n>>=1; 
    }
    return res;
}
int c_mod(int n, int r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    int a=1;
    rep(i,r) 
a=a*((n-i)%MOD)%MOD;
    int b=mod_pow(fact_mod(r), MOD-2);
    return (a%MOD)*(b%MOD)%MOD;
}
signed main(){
  int a,b;
  cin>>a>>b;
  int c=1;
  rep(i,a){
  c=min(2*c,c+b);
  }
  out(c);
}

Measured memory_bytes: 256
import numpy as np
import sys
#import copy


def xnxn(n=0, flag="v"):
    """
    args:
        int n: a number of lows to read
    example:
        input   1
        retrun  1

        input   1 2 3
        return  [1,2,3]
        input   1 2 3
                4 
        return  [[1,2,3],
                [4]]
    """
    if n == 0:
        temp = list(map(int, input().split()))
        if len(temp) == 1:
            if flag == "l":
                return temp
            else:
                return temp[0]
        elif len(temp) > 1:
            return temp
    else:
        temp = [list(map(int, input().split())) for _ in range(n)]
        return temp


def sp_xnxn(n=0):
    """
    args:
        int n: a number of lows to read
    example
        input   1
        retrun  [1]

        input   123
        return  [1,2,3]

        input   123
                4 
        return  [[1,2,3],
                [4]]
    """
    if n == 0:
        return [int(k) for k in xsxs()]
    else:
        return [[int(k) for k in xsxs()] for _ in range(n)]


def xsxs(n=0):
    """
    args:
        int n: a number of lows to read 
    example:
        input   AA
        retrun  AA

        input   A BBB CC
        return  ["A","BBB","CC"]

        input   A BB CCC
                D
        return  [["A","BBB","CC"],
                ["D"]]
    """
    if n == 0:
        temp = list(input().split())
        if len(temp) == 1:
            return temp[0]
        elif len(temp) > 1:
            return temp
    else:
        return [list(input().split()) for _ in range(n)]


def sp_xsxs(n=0):
    """
    args:
        int n: a number of lows to read 
        example:
            input   A
            retrun  ["A"]

            input   ABC
            return  ["A","B","C"]

            input   ABC
                    D
            return  [["A","B","C"],
                    ["D"]]
    """
    if n == 0:
        return [s for s in xsxs()]
    else:
        return [[s for s in xsxs()] for _ in range(n)]


n = xnxn()

if n % 10 == 3:
    print("bon")
elif n % 10 == 0 or n % 10 == 1 or n % 10 == 6 or n % 10 == 8:
    print("pon")
else:
    print("hon")


Measured memory_bytes: 27056
N,K=map(int,input().split())
S=input()
def turn(s):
    if s=="L":
        return("R")
    else:
        return("L")
   
score=0
k_count=0
change_flag=False
S2=list(S)
first_s=S[0]
for i in range(1,N):
    
    if k_count<K:
        if S2[i] != first_s:        
            S2[i]=turn(S2[i])
        if S[i-1]!=S[i] and S[i-1]!=first_s:
            k_count+=1
    if S2[i-1]==S2[i]:
        score+=1
print(score)

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

#define INF 1e+9
#define MAX_V 200001

struct edge {
    int to;
    int cost;
};

// <最短距離, 頂点の番号>
using P = pair<int, int>;

int V;
vector<edge> G[MAX_V];
int d[MAX_V];

void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d+V, INF);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;

        for (int i=0; i<G[v].size(); ++i) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

int main() {
    cin >> V;
    int E;
    cin >> E;
    for (int i=0; i<E; ++i) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        edge e = {b, 1};
        G[a].push_back(e);
    }
    dijkstra(0);
    if(d[V-1]<=2) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 11124
#include<stdio.h>
int main()
{
  int a,b,c,x,i,j,k,count=0;
  scanf("%d",&a);
  scanf("%d",&b);
  scanf("%d",&c);
  scanf("%d",&x);
  for(i=0; i<=a; i++)
    for(j=0; j<=b; j++)
      for(k=0; k<=c; k++)
        if(i*500 + j*100 + k*50==x)
          count++;
  printf("%d\n",count);
  return 0;
}





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

int main() {

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

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include<iostream>
using namespace std;
 
typedef long long ll;
const int N = 1000006;
 
ll n,m,k;
int a[N];
 
 
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	ll ans = a[n-1];
	priority_queue<pair<int,int> > pq;
	pq.push({a[n-2],2});
	for(int i=n-3;i>=0;i--){
		int x = pq.top().first,y = pq.top().second;
		pq.pop();
		ans += x;
		y--;
		if(y != 0){
			pq.push({x,y});
		}
		pq.push({a[i],2});
	}
	
	
	cout<<ans;
	
	return 0;
}


Measured memory_bytes: 6048
N = int(input())
A = list(map(int, input().split()))

Stock = 0
Money = 1000
 
for i in range(N-1):
    if A[i] < A[i + 1]:

        Stock = Money // A[i]
        Money %= A[i]
        Money += Stock * A[i+1]
print(Money)

Measured memory_bytes: 9196
use proconio::input;
use std::collections::HashMap;

fn main() {
    input! {
        k: i32,
    }
    let mut map = HashMap::new();

    let mut x = 7 % k;
    let mut count = 1;
    while !map.contains_key(&x) {
        if x == 0 {
            println!("{}", count);
            return;
        }
        map.insert(x, true);
        x = (10 * x + 7) % k;
        count += 1;
    }
    println!("-1");
}


Measured memory_bytes: 29636
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define MAX_N 40
#define INF 1000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n, e, t;
int w[300];
int cost[300];
vector<vector<int> > need[300];
vector<int> huga;

int main(){
    cin >> n >> e >> t;
    t--;
    rep(i,n) cost[i] = INF;
    rep(i,n){
        cin >> w[i];
        if(w[i]) cost[i] = 1;
    }
    rep(i,e){
        int g, c;
        cin >> g >> c;
        g--;
        vector<int> hoge;
        rep(j,c){
            int tmp;
            cin >> tmp;
            tmp--;
            hoge.push_back(tmp);
        }
        need[g].push_back(hoge);
    }
    while(true){
        int val = INF;
        int id = 0;
        rep(i,n){
            rep(u,need[i].size()){
                if(cost[i] != INF) continue;
                int cnt = 0;
                int ss = 0, ee = 10000000, mid;
                huga.clear();
                rep(j,need[i][u].size()){
                    huga.push_back(cost[need[i][u][j]]);
                }
                sort(huga.begin(),huga.end(),greater<int>());
                while(ee-ss > 1){
                    mid = (ss+ee)/2;
                    int tmp = mid;
                    rep(j,huga.size()){
                        if(tmp < huga[j]){
                            tmp = -1;
                            break;
                        }
                        tmp--;
                    }
                    if(tmp >= 0){
                        ee = mid;
                    } else{
                        ss = mid;
                    }
                }
                if(val > ee){
                    val = ee;
                    id = i;
                }
            }
        }
        if(val == INF) break;
        cost[id] = val;
    }
    if(cost[t] == INF) cost[t] = -1;
    cout << cost[t] << endl;
}

Measured memory_bytes: 3232
A, B, C, X, Y = list(map(int, input().split(' ')))
ans = A*X + B*Y

for i in range(max(X, Y)+1):
    temp_ans = 2*C*i + A*max(0, X-i) + B*max(0, Y-i)
    ans = min(ans, temp_ans)
print(ans)


Measured memory_bytes: 2940
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int a = scan.nextInt();
		int b = scan.nextInt();
		int d,r;
		double f;
		
		d = a / b;
		r = a % b;
		f = (double)a / (double)b;
		
		System.out.print(d + " " + r + " " + String.format("%.8f",f));
	}
}


Measured memory_bytes: 26612
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repp(i,a,b) for(ll i=a; i<b; i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
typedef long long ll;
struct edge { ll s, t, x; };
typedef pair<ll, ll> P;
typedef pair<double, P> event;
const ll MAX = 510000;
const ll MOD = 1000000007;
#define INF (ll)10000000000000000

int main() {
  int N;
  cin>>N;
  vector<int>A(N);
  rep(i,N){cin>>A[i];}
  int cnt=0;
  rep(i,N){
    if((i+1)%2==1&&A[i]%2==1){cnt++;}
  }
  cout<<cnt;
}

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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'
#define rep(i,n) for(int_fast32_t i = 0; i < ((int_fast32_t)(n)); i++)   // 0-indexed up
#define rep1(i,n) for(int_fast32_t i = 1; i <= ((int_fast32_t)(n)); i++) // 1-indexed up
#define rrep(i,n) for(int_fast32_t i = ((int_fast32_t)(n)-1); i >= 0; i--)  // 0-indexed down
#define rrep1(i,n) for(int_fast32_t i = ((int_fast32_t)(n)); i >= 1; i--)   // 1-indexed down
#define all(x) (x).begin(),(x).end()

using namespace std;

template<typename T>
using vec = vector<T>;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using ll = long long;
using ld = long double;
using vi = vec<int_fast32_t>;
using vl = vec<int_fast64_t>;
using vld = vec<ld>;
using vii = vec<vi>;
using PII = pair<int_fast32_t, int_fast32_t>;

template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

const ld Pi = std::acos(-1.0L);
constexpr ll infll = (1LL<<62)-1;
constexpr int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
//    cout << fixed << setprecision(15);

    i32 n; cin>> n;
    rep1(i,10) {
        if(n <= i * 1000) {
            cout << i*1000-n << '\n';
            return 0;
        }
    }

    // printf("ExecutionTime: %d /ms\n",1000*(int)((clock()-START_TIME)/CLOCKS_PER_SEC));
}


Measured memory_bytes: 3580
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#define lli long long int
#define uli unsigned long long int
#define inf 999999999999999999
#define rep(i,n,m) for(lli i=(lli)(n);i<(lli)(m);++i)
#define reep(i,n,m) for(int i=(int)(n);i<=(int)(m);++i)
#define per(i,m,n) for(lli i=(int)(m)-1;i>=(int)(n);--i)
#define st(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(),n.end())
#define ou(S) cout << S << endl
using namespace std;
int main(){
  double t,x;
  cin>>t>>x;
  ou(t/x);
}

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

using namespace std;

int main() {
    int n, m;

    cin >> n;

    m = n % 10;

    if(m == 2 || m == 4 || m == 5 || m == 7 || m == 9) printf("hon\n");
    else if(m == 3) printf("bon\n");
    else printf("pon\n");

    return 0;
}

Measured memory_bytes: 3596
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<utility>
#include<numeric>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<tuple>
#include<functional>
#include<iterator>
#include<cmath>
#include<cctype>

using namespace std;

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

const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = INF+7;

struct edge{int to,cost;};

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

	int q,h,s,d;
	ll n;
	cin >> q >> h >> s >> d >> n;

	s = min(min(4*q,2*h),s);
	
//	cout << "s " << s << "\n";
	if(s*2 <= d) cout << s*n << "\n";
	else 		cout << n/2 * d + (n%2)*s << "\n"; 
		
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << endl

int main()
{
	int a,b;
	cin>>a>>b;
	if(a>=13)
		dump(b);
	else if(a>=6)
		dump(b/2);
	else
		dump(0);
}

Measured memory_bytes: 256
n,a,b=map(int,input().split())
p=10**9+7

def cmb(n, r):
  num=1
  den=1
  for i in range(0,r):
    num*=n-i
    den*=i+1
    num%=p
    den%=p
  return num*modinv(den,p)%p
def power(x,a):
    if a==0:
        return 1
    if a==1:
        return x%p
    if a%2==0:
        return power(x,a//2)**2%p
    else:
        return power(x,a//2)**2*x%p
def modinv(x,p):
    return power(x,p-2)
ans=(pow(2,n,p)-cmb(n,a)-cmb(n,b)-1)%p
print(ans)


Measured memory_bytes: 38640
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL


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

    int n;
    cin >> n;

    vs64 a(n);
    rep (i, n) cin >> a[i];

    sort(a.begin(), a.end());
    int l, r;

    s64 ans1;
    s64 ans2;
    if (n & 1)
    {
        ans1 = -a[n / 2] - a[n / 2 + 1];
        ans2 = a[n / 2] + a[n / 2 - 1];
    }
    else
    {
        ans1 = -a[n / 2] + a[n / 2 - 1];
        ans2 = -a[n / 2] + a[n / 2 - 1];
    }

    l = 0; r = n - 1;
    rep (i, n)
    {
        s64 temp;
        if (i & 1) { temp = -2 * a[l]; ++l; }
        else { temp = 2 * a[r]; --r; }
        ans1 += temp;
    }

    l = 0; r = n - 1;
    if (n & 1)
    {

    }
    rep (i, n)
    {
        s64 temp;
        if (i & 1) { temp = 2 * a[r]; --r; }
        else { temp = -2 * a[l]; ++l; }
        ans2 += temp;
    }

    cout << MAX(ans1, ans2) << "\n";
    return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(shoki,i,n) for(int i=shoki; i<n; i++)
#define _GLIBCXX_DEBUG
using ll = long long;
using vi = vector<int>;
int main(){
    int n,a,b;
    cin>>n>>a>>b;
    int sum_all = 0;
    rep(1,i,n+1){
        int temp = i;
        int sum_i = 0;
        while(temp>0){
            sum_i += temp%10;
            temp /= 10;
        }
        if(a<=sum_i && sum_i<=b){
            sum_all += i;
        }
    }
    cout << sum_all << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
const ll MOD = 1e9+7;
const int n_max = 1e7+10;

int main(){
  int a,b; cin >> a >> b;
  if(a <= 5)cout << 0 << endl;
  else if(a <= 12) cout << b/2 << endl;
  else cout << b << endl;
  return 0;
}

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

using namespace std;

vector<string> split(const string &s, char delim) {
  vector<string> elems;
  string item;
  for (char ch: s) {
    if (ch == delim) {
      if (!item.empty()) {
        elems.push_back(item);
      }
      item.clear();
    }
    else {
      item += ch;
    }
  }
  if (!item.empty()) {
    elems.push_back(item);
  }
  return elems;
}

string to_str_with_zero(int i, int w) {
  ostringstream sout;
  sout << std::setfill('0') << std::setw(w) << i;
  string s = sout.str();
  return s;
}

int letter_to_int(char c) {
  return tolower(c) - 'a';
}

bool array_equal(vector<int> a1, vector<int>a2) {
  if (a1.size() != a2.size()) {
    return false;
  }
  for (int i=0; i<a1.size(); i++) {
    if (a1.at(i) != a2.at(i)) {
      return false;
    }
  }
  return true;
}

int gcd(int a, int b) {
  if (a == b) {
    return a;
  }
  else if (a > b) {
    return gcd(a - b, b);
  }
  else {
    return gcd(a, b - a);
  }
}

char int_to_char(int a) {
  if (a == -1) {
    return 'z';
  }
  else {
    return 'a' + a;
  }
}

long nCr(int n, int r) {
    long ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}

int divide_count(int a, int divider) {
  int r = 0;
  while(a % divider == 0) {
    a /= divider;
    r++;
  }
  return r;
}

int main() {
  std::cout << std::setprecision(9);
  int n;
  string s;
  cin >> n >> s;

  int ans = 1;
  for(int i=1; i<n; i++) {
    if(s[i] != s[i - 1]) {
      ans++;
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 3768
#include<stdio.h>

int main(){
    long n,max=-10000000,min=10000000,sum=0;
    scanf("%ld",&n);
    long a[n];
    for(int i=0;i<n;i++){
        scanf("%ld",&a[i]);
        if(max<a[i]) max=a[i];
        if(min>a[i]) min=a[i];
        sum+=a[i];
    }
    printf("%ld %ld %ld\n",min,max,sum);
    
}


Measured memory_bytes: 2724
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		if(n==1) {
			System.out.print("Hello World");
		}
		else {
			int a=sc.nextInt();
			int b=sc.nextInt();
			System.out.print(a+b);
		}

	}

}


Measured memory_bytes: 21716
//Robs Code
#include<bits/stdc++.h>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long int
#define fri(l,k) for (i=l;i<=k;i++)
#define frj(l,k) for (j=l;j>=k;j--)
#define all(x) x.begin(),x.end()
#define ed cout<<"\n";
#define pb push_back
#define pii pair<int,int>
#define _1 first
#define _2 second
#define maxi 100000007
/**********************************************************/
using namespace std;
int i,j,k,n,m,q,t,a,b,cnt,sum,tot;
signed main() 
{
    speed;
    cin>>n;
    vector<int> v(n);
    fri(0,n-1) cin>>v[i];
    int mx=INT_MIN;
    for(i=0;i<n;i++){
        if(v[i]>=mx){
            cnt++;
            mx=v[i];
        }
    }
    cout<<cnt;
    return 0;
}


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

int main(){
	int N;
  	cin >> N;
  for(int i = 1; i < 10; i++){
  	for(int j = 1; j <10; j++){
    	if(N == i*j){
        	cout << "Yes" << endl;
            return 0;
    }
  }
}
for(int l = 1; l < 10; l++){
	for(int m = 1; m< 10; m++){
    	if(N != l*m){
        	cout << "No" << endl;
          	return 0;
        }
    }
}
}

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

int main()
{
	ios::sync_with_stdio(false);
	int num, m, i, j, k, max, maxkari, cy, height,he;
	cin >> num >> m;
	max = m / num;
	for (i = max; i >= 0; i--) {
		if (m%i == 0) {
			he = i;
			break;
		}
	}
	cout << he;

	return 0;
}


Measured memory_bytes: 256
X, N = map(int, input().split(' '))
diff, rst = -1, 0
if N == 0:
    print(X)
else:
    P_ls = list(map(int, input().split(' ')))
    for i in range(101, -1, -1):
        if i not in P_ls:
            if diff == -1:
                diff = abs(X - i)
                rst = i
            else:
                diff = min(diff, abs(X - i))
                if diff == abs(X - i):
                    rst = i
    print(rst)

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


char a[8][8];
int rxx[]={ 0,-1, 0};
int ryx[]={ 1, 0,-1};
int rxy[]={-1, 0, 1};
int ryy[]={ 0,-1, 0};
int dx[]={0,7,7};
int dy[]={7,7,0};

int main(){
	for(int i=0;i<8;i++){
		for(int j=0;j<8;j++)cin>>a[i][j];
	}
	for(int i=0;i<3;i++){
		cout<<(i+1)*90<<endl;
		for(int j=0;j<8;j++){
			for(int k=0;k<8;k++)cout<<a[j*ryy[i]+k*rxy[i]+dy[i]][j*ryx[i]+k*rxx[i]+dx[i]];
			cout<<endl;
		}
		
	}
	return 0;
}

Measured memory_bytes: 1140
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int N;
    cin >> N;
    cout << (N + 1) * N / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
typedef pair<int,int> P;

int main(){
	int n;
	while( cin >> n , n ){
		vector<P> vc;

		for(int i=0 ; i < n ; i++ ){
			int c,m1,m2,m3,m4,s1,s2,s3,s4;
			cin >> c >> m1 >> s1 >> m2 >> s2 >> m3 >> s3 >> m4 >> s4;
			int time = m1*60 + s1 + m2*60 + s2 + m3*60 + s3 + m4*60 + s4;
			P p( time , c );
			vc.push_back( p );
		}
		sort( vc.begin() , vc.end() );
		cout << vc[0].second << endl;
		cout << vc[1].second << endl;
		cout << vc[vc.size()-2].second << endl;
	}
}

Measured memory_bytes: 1304
#include <iostream>
#include <string>
using namespace std;
 
int main()
{
    string arg, arg2;
     
    cin >> arg;
    cin >> arg2;
    arg += arg;
     
    if (arg.find(arg2) == string::npos)
    {
        cout << "No\n";
        return 0;
    }
    cout << "Yes\n";
    return 0;
}

Measured memory_bytes: 3220
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<functional>
#include <random>
#include<iostream>
#include<iomanip>
using namespace std;


int main() {
	int N, M;
	int A[10000];
	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		cin >> A[i];
	}
	long long a = 0;
	for (int i = 0; i < M; i++) {
		a += A[i];
	}

	if (N >= a) {
		cout << N - a;
	}
	else {
		cout << "-1";
	}
}

Measured memory_bytes: 3640
N = int(input())
*D, = map(int,input().split())
mod = 998244353

cnt = [0]*100100
for d in D:
    cnt[d] += 1
ans = int(D[0]==0 and cnt[0]==1)

check = 1
for i,c in enumerate(cnt[1:],1):
    if c == 0: break
    c0 = cnt[i-1]
    check += c
    ans *= pow(c0,c,mod)
    ans %= mod
if check != N:
    ans = 0
print(ans)

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

int plan1(int A, int T)
{
  return A*T;
}

int plan2(int B)
{
  return B;
}

int main()
{
  int N, A, B;
  cin>>N>>A>>B;

  cout<<min(plan1(A, N), plan2(B))<<endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		char[] chars = s.toCharArray();
		int count = 0;
		char c = '0';
		for(int i = 0; i < n; i++){
			if(c != chars[i]){
				count++;
				c = chars[i];
			}
		}
		System.out.println(count);
	}
}


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

int main() {
  vector<vector<int>> bingo(3, vector<int>(3));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> bingo.at(i).at(j);
    }
  }
  
  int N;
  cin >> N;
  
  int tate1 = 0;
  int tate2 = 0;
  int tate3 = 0;
  int yoko1 = 0;
  int yoko2 = 0;
  int yoko3 = 0;
  int naname1 = 0;
  int naname2 = 0;
  
  int b;
  for(int i = 0; i < N; i++){
    cin >> b;
    
    if(bingo.at(0).at(0) == b){
      tate1++;
      yoko1++;
      naname1++;
    }
    
    if(bingo.at(0).at(1) == b){
      tate2++;
      yoko1++;
    }
    
    if(bingo.at(0).at(2) == b){
      tate3++;
      yoko1++;
      naname2++;
    }
    
    if(bingo.at(1).at(0) == b){
      tate1++;
      yoko2++;
    }
    
    if(bingo.at(2).at(0) == b){
      tate1++;
      yoko3++;
      naname2++;
    }
    
    if(bingo.at(1).at(2) == b){
      tate3++;
      yoko2++;
    }
    
    if(bingo.at(2).at(1) == b){
      tate2++;
      yoko3++;
    }
    
    if(bingo.at(2).at(2) == b){
      tate3++;
      yoko3++;
      naname1++;
    }
    
    if(bingo.at(1).at(1) == b){
      tate2++;
      yoko2++;
      naname1++;
      naname2++;   
    }
  }
  
  if(tate1 == 3 || tate2 == 3 || tate3 == 3 || yoko1 == 3 || yoko2 == 3 || yoko3 == 3 || naname1 == 3 || naname2 == 3){
    cout << "Yes" << endl;
  }
  
  else{
    cout << "No" << endl;
  }
  
}


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

int main() {
    int N,D;
    cin >> N >> D;
    if(N % (2 * D + 1) == 0) {
        cout << N / (2 * D + 1) << endl;
    }else {
        cout << N / (2 * D + 1) + 1 << endl;
    }
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;

int main() {
  int N; cin >> N;
  map<string, int> m;
  for (int i = 0; i < N; ++i) {
    string s; cin >> s;
    m[s]++;
  }
  cout << "AC x " << m["AC"] << endl;
  cout << "WA x " << m["WA"] << endl;
  cout << "TLE x " << m["TLE"] << endl;
  cout << "RE x " << m["RE"] << endl;
}


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

int main()
{
     int n,m,a,days=0;
     cin>>n>>m;
     
     for(int i=1;i<=m;i++)
     {
         cin>>a;
         days+=a;
     }
     if(n-days<0)
     cout<<-1;
     else
     cout<<n-days<<endl;
}  

Measured memory_bytes: 3472
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    ll n;
    cin >> n;
    ll k = 1;
    ll num;
    while(1){
        ll tmp = 1;
        for(int i = 0; i < k; i++) tmp *= 26;
        if(26*(tmp-1)/25 >= n){
            num = tmp;
            break;
        }
        k++;
    }
    ll tmp = 1;
    for(int i = 0; i < k-1; i++) tmp *= 26;
    n -= 26*(tmp-1)/25;
    n--;
    vector<ll> ans(k);
    vector<char> m{'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','z'};
    for(int i = 0; i < k; i++){
        ans[i] = n % 26;
        n /= 26;
    }
    for(int i = k-1; i >= 0; i--){
        cout << m[ans[i]];
    }
}


Measured memory_bytes: 3648
import java.util.*;


public class Main{

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> rc = new ArrayList<Integer>();
		int r,c,i,d,ck;
		
		for(c=0;;c++){
			r=0;
			ck=0;
			for(i=0;i<3;i++){
				d = sc.nextInt();
				if(i<2&&d == -1){
					ck++;
				}
				if(i == 2 && r<50 && d >49){
					r = 50;
					break;
				}
				else if(i == 2 && r<50 && d < 50){
					d = -1;
				}
				else if(i == 2 && r>50){
					d = -1;
				}
				r += d;
				if(i == 2 && d == -1 && r != -3){
					r++;
				}
			}
			if(r == -3){
				c--;
				break;
			}
			if(ck>0){
				r=0;
			}
			rc.add(r);
		}
		sc.close();
		for(i=0;i<=c;i++){
			if(rc.get(i)>79){
				System.out.println("A");
			}
			else if(rc.get(i)>64){
				System.out.println("B");
			}
			else if(rc.get(i)>49){
				System.out.println("C");
			}
			else if(rc.get(i)>29){
				System.out.println("D");
			}
			else{
				System.out.println("F");
			}
		}
	}
}


Measured memory_bytes: 26120
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt();
		int M = scan.nextInt();
		int a[] = new int[N];
		int b[] = new int[N];
		int c[] = new int[M];
		int d[] = new int[M];
		int min = 99999999;
		int index = 0;
		
		for(int i=0;i<N;i++){
			a[i] = scan.nextInt();
			b[i] = scan.nextInt();
		}
		
		for(int i=0;i<M;i++){
			c[i] = scan.nextInt();
			d[i] = scan.nextInt();
		}
		
		for(int i=0;i<N;i++){
			for(int j=0;j<M;j++){
				if(Math.abs(a[i]-c[j])+Math.abs(b[i]-d[j]) < min){
					min = Math.abs(a[i]-c[j])+Math.abs(b[i]-d[j]);
					index = j;
				}
			}
			System.out.println(index+1);
			min = 999999999;
			index = 0;
		}
			
	}

}


Measured memory_bytes: 21972
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <string>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	string noun;
	cin >> noun;	

	if (noun.back() == 's') {
		cout << noun + "es\n"; 
	} else {
		cout << noun + "s\n";
	}

	return 0;

}

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

using namespace std;
ll n , a[200006];
ll dp[200006];
ll c[200006];
const ll mod = 1e9 + 7;
int main()
{
        cin >> n;
        for(ll i=1;i<=n;i++) cin >> a[i];
        dp[0] = 1;
        for(ll i=1;i<=n;i++) {
                ll j = i;
                while(j<=n && a[j] == a[i]) j++;
                dp[j - 1] = dp[i-1];
                dp[j - 1] += c[a[i]];
                dp[j-1] %= mod;
                c[a[i]] += dp[i - 1];
                c[a[i]] %= mod;
                i = j-1;
        }
        cout << (dp[n]%mod + mod)%mod << endl;
        return 0;
}


Measured memory_bytes: 4992