akhauriyash/Code-Regression huggingface dataset:
/*****And nothing else matters!******/

#include<bits/stdc++.h>
using namespace std;

#define pi 3.1415926535
#define endl "\n"
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define ll long long
#define llu unsigned long long
#define setbits(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define tc int test_case; cin >> test_case; while(test_case--)
#define f(i,a,n) for(int i = a ; i < n ; i++)
#define rf(i,n,a) for(int i = n-1 ; i >= a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define get(a,n) f(i,0,n) cin >> a[i];
#define show(a,n) f(i,0,n) cout << a[i] << " "; cout << endl;
#define sp(x) fixed << setprecision(10) << x
#define nitro ios:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define trace(x) cerr << '>' << #x << ':' << (x) << "\n"
#define trace2(x,y) cerr<< '>' << #x << ':' << (x) << " | " << #y << ':' << (y) << "\n"
#define trace3(a,b,c) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define trace4(a,b,c,d) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"

typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;
typedef map<int,int> mii;
typedef map<ll,ll> mll;

const int inf = 1e9;
const ll inf64 = 1e18;
const int mod = inf + 7;
const int N = 2e5 + 10;

int main()
{
    nitro;
    int n;
    cin >> n;
    ll ans = 0;

    for(int i = 1; i < n; i++)
    {
        int x = (n-1)/i;
        ans += x;
    }
    cout << ans;
}


Measured memory_bytes: 3620
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
int N_MAX = 50;
long long INF = 123456789123456789;
typedef pair<int,int> P0;
typedef pair<long long,P0> P;
P0 dxy[4] = {P0(1,0),P0(0,1),P0(-1,0),P0(0,-1)};
int b[50][50];
long long d[50][50];
void dijkstra(P0 s, int H, int W){
  int i,h,w;
  P0 v;
  P p;
  priority_queue<P, vector<P>, greater<P>> que; // 最短距離，頂点番号
  for(i=0;i<H;i++)
    fill(d[i],d[i]+W,INF);
  d[s.first][s.second]=0;
  que.push(P(0,s));
  while(!que.empty()){
    p=que.top(); que.pop();
    v=p.second;
    if(d[v.first][v.second]<p.first) continue;
    for(i=0;i<4;i++){
      h=v.first+dxy[i].first;
      w=v.second+dxy[i].second;
      if(h<0 || h>=H || w<0 || w>=W) continue;
      if(b[h][w]==1) continue;
      if(d[h][w]>d[v.first][v.second]+1){
        d[h][w]=d[v.first][v.second]+1;
        que.push(P(d[h][w],P0(h,w)));
      }
    }
  }
  return;
}
int main()
{
  int H,W,i,j,nw=0,res;
  string s,t;
  cin >> H >> W;
  for(i=0;i<H;i++){
    cin >> s;
    for(j=0;j<W;j++){
      t=s.substr(j,1);
      if(t=="."){
        b[i][j]=0;
        nw++;
      } else {
        b[i][j]=1;
      }
    }
  }
  dijkstra(P0(0,0),H,W);
  if(d[H-1][W-1]==INF)
    res=-1;
  else
    res=nw-d[H-1][W-1]-1;
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <iomanip>

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

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

int find(int v, vector<int>& p){
    if(p[v] == -1){
        return v;
    }
    p[v] = find(p[v], p);
    return p[v];
}

void unite(int u, int v, vector<int>& p){
    int u_root = find(u, p);
    int v_root = find(v, p);

    if(u_root == v_root){
        return;
    }
    p[u_root] = v_root;
}

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

    vector<int> parent(n+m, -1);
    rep(i, n){
        int k;
        cin >> k;
        rep(j, k){
            int l;
            cin >> l;
            unite(i, n+l-1, parent);
        }
    }

    set<int> kind;
    rep(i, n){
        kind.insert(find(i, parent));
    }
    if(kind.size() == 1){
        cout << "YES" << endl;
        return 0;
    }
    cout << "NO" << endl;

    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

template<int M>
class ModInt {
   public:
    ll value;
    constexpr ModInt(ll v = 0) { value = v % M; if (value < 0) value += M; }
    constexpr ModInt pow(ll n) const { if (!n) return 1; ModInt a = pow(n >> 1); a *= a; if (n & 1) a *= *this; return a; }
    constexpr ModInt inv() const { return this->pow(M - 2); }
    constexpr ModInt operator + (const ModInt &rhs) const { return ModInt(*this) += rhs; };
    constexpr ModInt operator - (const ModInt &rhs) const { return ModInt(*this) -= rhs; };
    constexpr ModInt operator * (const ModInt &rhs) const { return ModInt(*this) *= rhs; };
    constexpr ModInt operator / (const ModInt &rhs) const { return ModInt(*this) /= rhs; };
    constexpr ModInt &operator += (const ModInt &rhs) { value += rhs.value; if (value >= M) value -= M; return *this; };
    constexpr ModInt &operator -= (const ModInt &rhs) { value -= rhs.value; if (value <  0) value += M; return *this; };
    constexpr ModInt &operator *= (const ModInt &rhs) { value = value * rhs.value % M; return *this; };
    constexpr ModInt &operator /= (const ModInt &rhs) { return (*this) *= rhs.inv(); };
    constexpr bool operator == (const ModInt &rhs) { return value == rhs.value; }
    constexpr bool operator != (const ModInt &rhs) { return value != rhs.value; }
    friend ostream &operator << (ostream &os, const ModInt &rhs) { os << rhs.value; return os; }
};

using mint = ModInt<MOD>;

int N, K;
vector<bool> seen;
vector<vector<int>> G;

mint dfs(int v, int p, int k) {
    seen[v] = true;

    mint ret = k; int base = K - 1 - ((p != -1) ? 1 : 0);
    for (auto g : G[v]) {
        if (seen[g]) continue;
        ret *= dfs(g, v, max(0, base--));
    }
    return ret;
}

int main() {
    cin >> N >> K;
    G.resize(N);
    REP(i, 0, N - 1) {
        int a, b; cin >> a >> b; a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    seen.assign(N, false);
    cout << dfs(0, -1, K) << endl;
    
    return 0;
}

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

int main() {
	int a,b,c,d;
  	cin>>a>>b>>c>>d;
  	if(a==b) cout<<"Draw"<<endl;
  	else if(a==1) cout<<"Alice"<<endl;
  	else if(b==1) cout<<"Bob"<<endl;
  	else if(a<b) cout<<"Bob"<<endl;
  	else cout<<"Alice"<<endl;
}

Measured memory_bytes: 3616
N = int(input())
List = [list(map(str,input().split())) for i in range(N)]

for i in range(N):
    List[i].append(i+1)
    List[i][1] = int(List[i][1])
List.sort(key=lambda x:x[1], reverse=True)
List.sort(key=lambda x:x[0])
for i in range(N):
    print("{}".format(List[i][2]))

Measured memory_bytes: 3064
#include <vector>
#include <iostream>
using namespace std;
int main() {
	int N, M;
	cin >> N >> M;
	vector<int> cnt(M);
	for (int i = 0; i < N; ++i) {
		int K;
		cin >> K;
		for (int j = 0; j < K; ++j) {
			int x;
			cin >> x; --x;
			++cnt[x];
		}
	}
	int ans = 0;
	for (int i = 0; i < M; ++i) {
		if (cnt[i] == N) ++ans;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main()
{
	int f[10];
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	f[a] = 1; f[b] = 1; f[c] = 1; f[d] = 1;
	if (f[1] == 1 && f[4] == 1 && f[7] == 1 && f[9] == 1)cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 256
import sys

input = sys.stdin.readline
MOD = 1000000007

N,K = map(int,input().split())

a = [0]*(N)

for _ in range(K):
    d = int(input())

    if d == 1:
        x= int(input())
        x-=1
        a[x]+=1
    else:
        x = map(int,input().split())
        for i in x:
            i-=1
            a[i] +=1

print(a.count(0))



Measured memory_bytes: 65944
#define _USE_MATH_DEFINES
#include <cmath>
#include <string>
#include <vector>
#include <utility>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <numeric>
#include <array>
#include <float.h>
#include <memory>
#include <functional>
#include <iomanip>
#include <queue>
#include <random>
#include <map>
#include <set>

#pragma warning(disable:4996)

using namespace std;

int Group(int v) {
  int ans = 0;
  if (v == 2) {
    ans = 3;
  }else if (v % 2 == 0) {
    if (v <= 6) {
      ans = 2;
    }else{
      ans = 1;
    }
  }
  else {
    if (v <= 7) {
      ans = 1;
    }
    else {
      ans = 2;
    }
  }
  return ans;
}

int main() {
  int x, y;
  bool ans = true;
  cin >> x >> y;
  int g_1 = Group(x);
  int g_2 = Group(y);
  cout << (g_1 == g_2 ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
using namespace std;

int dp[100005];

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

	int n;
	cin >> n;

	vector<int> coin{1};
	for (int i = 6; i <= n; i *= 6) coin.push_back(i);
	for (int i = 9; i <= n; i *= 9) coin.push_back(i);
	sort(coin.begin(), coin.end());
	//for (int x : coin) printf("%d ", x); puts("");

	for (int i = 1; i <= n; i++) {
		dp[i] = i;
		for (int c : coin) {
			if (c > i) break;
			dp[i] = min(dp[i], dp[i-c] + 1);
		}
	}
	//for (int i = 0; i <= n; i++) printf("%d\n", dp[i]);
	cout << dp[n] << endl;
}


Measured memory_bytes: 640
#require 'prime'
#require 'openssl'
MOD=10**9+7;  cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.chomp.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def ar2(s1,s2,de=nil) Array.new(s1){Array.new(s2,de)} end
def ar3(s1,s2,s3,de=nil) Array.new(s1){Array.new(s2){Array.new(s3,de)}} end

def desc(ar) ar.sort!{|x,y| y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+).to_i end
def ceil(a,b) (a.to_f/b).ceil end

def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end
def rui(ar) s=[0]; ar.size.times{|i| s<<s[-1]+ar[i]}; s end
def rev_rui(ar) s=[0]; ar.size.times.reverse_each{|i| s<<s[-1]+ar[i]}; s end

def puts_yesno(b) puts(b ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def pu(h) begin; require './../nemi_lib/debug.rb'; puts_val(h); rescue LoadError; end; end
########### ( ˘ω˘ )ｽﾔｧ… ###########
n,m=gsmi
a=gsmi
sum=sum a
maxs=a.max(m)
min=maxs[-1]
border=sum.to_f/(4*m)
puts_yesno min>=border

Measured memory_bytes: 1788
import sys
from sys import exit
from collections import deque
from copy import deepcopy
from bisect import bisect_left, bisect_right, insort_left, insort_right
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod=MOD):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
    def list(self):
        l = []
        for k in self:
            l.extend([k]*self[k])
        return l
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]
def pf(x,mode='counter'):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    if mode=='counter':
        return C
    S = set([1])
    for k in C:
        T = deepcopy(S)
        for x in T:
            for i in range(1,C[k]+1):
                S.add(x*(k**i))
    if mode=='set':
        return S
    if mode=='list':
        return sorted(list(S))

######################################################

N,A=ilint()
C=counter()
for a in A:
    C.add(a)
ans=0
for k in C:
    ans+=max(0,C[k]-1)
print(N-2*((ans-1)//2+1))

Measured memory_bytes: 93412
let m = 1000000007
let ( *^ ) x y = (x * y) mod m

let () = Scanf.scanf "%d %d\n" @@ fun n k ->
  let es = Array.make n [] in
  for i = 0 to n - 2 do
    Scanf.scanf "%d %d\n" @@ fun a b ->
      es.(a - 1) <- b - 1 :: es.(a - 1);
      es.(b - 1) <- a - 1 :: es.(b - 1)
  done;
  let visited = Array.make n false in
  let rec visit n v =
    if visited.(v)
    then None
    else begin
      visited.(v) <- true;
      let acc, _ = List.fold_left (fun (acc, n) u ->
        match visit n u with
        | None -> (acc, n)
        | Some x -> (acc *^ x, n - 1)) (1, if k <= n then k - 1 else k - 2) es.(v) in
      Some (max 0 n *^ acc)
    end in
  Printf.printf "%d\n" @@
  match visit k 0 with
  | None -> 0
  | Some x -> x


Measured memory_bytes: 20608
#include <stdio.h>

int main(void)
{
    int N,A,B,i,kokunai = 0,kaigai = 0;
    char S[100002];
    scanf("%d %d %d\n%s",&N,&A,&B,S);
    for (i = 0; i < N; i++) {
        if (S[i] == 'a') {
            if (kokunai < (A + B)) {
                printf("Yes\n");
                kokunai++;
            } else {
                printf("No\n");
            }
        } else if (S[i] == 'b') {
            if (kokunai < (A + B) && kaigai < B) {
                printf("Yes\n");
                kokunai++;
                kaigai++;
            } else {
                printf("No\n");
            }
        } else {
            printf("No\n");
        }
    }
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <cmath>
#include <sstream>
#include <iomanip>

using namespace std;

int main(int argc, char* argv[])
{

	int N;
	std::ostringstream oss;
	string s;

	cin >> N;

	if(N>= 1000){
		cout << "ABD";
	}else{
		cout << "ABC";
	}

	cout << endl;

	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mem(ar,num) memset(ar,num,sizeof(ar))
#define me(ar) memset(ar,0,sizeof(ar))
#define lowbit(x) (x&(-x))
#define Pb push_back
#define  FI first
#define  SE second
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define IOS ios::sync_with_stdio(false)
#define DEBUG cout<<endl<<"DEBUG"<<endl; 
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int    prime = 999983;
const int    INF = 0x7FFFFFFF;
const LL     INFF =0x7FFFFFFFFFFFFFFF;
const double pi = acos(-1.0);
const double inf = 1e18;
const double eps = 1e-6;
const LL     mod = 1e9 + 7;
LL qpow(LL a,LL b){LL s=1;while(b>0){if(b&1)s=s*a%mod;a=a*a%mod;b>>=1;}return s;}
LL gcd(LL a,LL b) {return b?gcd(b,a%b):a;}
int dr[2][4] = {1,-1,0,0,0,0,-1,1};
typedef pair<int,int> P;
int main(void)
{
   int n;
   cin>>n;
   if(n == 1)
      cout<<"Hello World" <<endl;
   else
     {
      int a,b;
      cin>>a>>b;
      cout<<a+b<<endl;
     }
 
   return 0;
}

Measured memory_bytes: 256
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')

def main():
    H,W,D=MI()
    A=LLIN(H)
    Q=I()
    LR=LLIN(Q)

    xy = [0]*(H*W+1)
    for i in range(H):
        for j in range(W):
            xy[A[i][j]]=(i,j)
    
    def calc_cost(A,B):
        x,y = xy[A]
        w,z = xy[B]
        return abs(x-w)+abs(y-z)

    cost = [0]*(H*W+1)
    for i in range(1,H*W+1):
        if i-D>0:
            cost[i] = cost[i-D] + calc_cost(i,i-D)
    for l,r in LR:
        print(cost[r]-cost[l])
    
if __name__ == '__main__':
    main()

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

int main(){
  int n,c;
  cin >> n >>c ;
  
  long long val[n],wt[n];
  for(int i=0;i<n;i++){
 	cin >> wt[i] >> val[i] ;
  }
  
  long long  dp[c+1] ;
  
  for(int i=0;i<=n;i++){
    for(int j=c;j>=0;j--){
      if(i==0 || j==0)
        dp[j]=0;
      else if(wt[i-1]<=j){
        dp[j]=max(val[i-1]+dp[j-wt[i-1]] , dp[j]) ;
      }
      
    }
  }
  
  cout<<dp[c] ;
  
  return 0;
}


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

using namespace std;

#define INF 1e9

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

    int n;
    string s;

    cin>>n>>s;

    vector<int> sum1(n+1),sum2(n+1);
    sum1[0]=0;
    sum2[n]=0;

    for(int i=0;i<n;i++){
        if(s[i]=='W')sum1[i+1]=1;
        sum1[i+1]+=sum1[i];
    }

    for(int i=n-1;i>=0;i--){
        if(s[i]=='E')sum2[i]=1;
        sum2[i]+=sum2[i+1];
    }

    int ans=INF;

    for(int i=0;i<n;i++){
        ans=min(ans,sum1[i]+sum2[i+1]);
    }

    cout<<ans<<endl;

}

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

int main(){
    int a,b;
    cin >> a >> b;
    cout << 100 << ' ' << 100 << endl;
    char g[100][100];
    for(int i=0; i<50; i++){
        for(int j=0; j<100; j++){
            g[i][j] = '.';
            g[i+50][j] = '#';
        }
    }
    for(int i=0; i<b-1; i++){
        g[(i/50)*2][(i%50)*2] = '#';
    }
    for(int i=0; i<a-1; i++){
        g[(i/50)*2 + 51][(i%50)*2] = '.';
    }
    for(int i=0; i<100; i++){
        for(int j=0; j<100; j++){
            cout << g[i][j];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++) 
#define rep(i,n); for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b); 
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define all(v) (v).begin(),(v).end()
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e18+10;

/*----------------------------------------------*/

signed main(){
  int n,r;
  cin>>n>>r;
  int ans;
  if(n>=10) ans=r;
  else ans=r+100*(10-n);
  cout<<ans<<endl;
  return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
 
int main() {
    int n;
    int a[110];
    int b[110];
    int sum1[110],sum2[110];
    int ans[110];
  
    cin >> n;
    for (int i = 0; i < n; ++i) cin >> a[i];
    for (int i = 0; i < n; ++i) cin >> b[i];
    
    if(n == 1){
      cout << a[0]+b[0] << endl;
      return 0;
    }
  
    sum1[0] = a[0];
    sum2[0] = b[0];
    
    for (int i = 0; i < n; ++i) {
      sum1[i + 1] = sum1[i] + a[i + 1];
      sum2[i + 1] = sum2[i] + b[i + 1];
      }
  
    ans[0] = sum1[0] + sum2[n-1] ;
  
    for (int i = 0; i < n; ++i) {
      ans[i + 1] = sum1[i + 1] + sum2[n - 1] - sum2[i];
      }
      
    sort(ans,ans + n,greater<int>());

    cout << ans[0] << endl;     
}

Measured memory_bytes: 256
a,b,c = map( int, input().split())
k = int(input())

for x in range(k):
    largest = max(a,b,c)
    if largest == a:
        a = 2*a
    elif largest == b:
        b = 2*b
    elif largest == c:
        c = 2*c
print(a+b+c)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cassert>
#define InfL 1000000000
#define InfLL 1000000000000000000LL
#define mod 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=(n-1);(i)>=(0);(i)--)
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<db> vd;

int main() {
	int H, W, K;
	cin >> H >> W >> K;
	vector<string> S(H);
	rep(i, H)
		cin >> S[i];
	int H2 = 1;
	rep(i, H - 1)
		H2 *= 2;
	int ans = InfL;
	rep(b, H2) {
		vector<vi> Hlinelist;
		int Hnum = 0;
		vi Hlinelisttmp;
		vi Hlinenum;
		int anstmp = -1;
		rep(i, H) {
			Hlinelisttmp.push_back(i);
			if (i == H - 1 || (b >> i) % 2) {
				Hlinelist.push_back(Hlinelisttmp);
				Hlinenum.push_back(Hlinelisttmp.size());
				Hnum++;
				Hlinelisttmp.clear();
				anstmp++;
			}
		}
		vi Hcount(Hnum, 0);
		rep(i, W) {
			vi Hcounttmp(Hnum, 0);
			rep(j, Hnum) {
				rep(k, Hlinenum[j]) {
					int h = Hlinelist[j][k];
					if (S[h][i] == '1') {
						Hcounttmp[j]++;
					}
				}
			}
			bool sep = false;
			rep(j, Hnum) {
				if (Hcount[j] + Hcounttmp[j] > K) {
					sep = true;
					if (Hcounttmp[j] > K)
						anstmp = InfL;
					break;
				}
			}
			if (sep) {
				anstmp++;
				rep(j, Hnum)
					Hcount[j] = 0;
			}
			rep(j, Hnum)
				Hcount[j] += Hcounttmp[j];

		}
		ans = min(ans, anstmp);
	}

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define ms multiset
#define pb push_back
#define pll pair<ll,ll>
#define pdd pair<ld, ld>
#define pq priority_queue
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define uid uniform_int_distribution
#define FILE ifstream in("sumsqr.in");ofstream out("sumsqr.out");
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

ll a,b,k;

ll calc(ll x){
    ll c1 = a*x/b;
    ll c2 = a*(x/b);
    return c1-c2;
}

int main() {
    fast;
    cin>>a>>b>>k;
    cout<<(k>=b-1 ? calc(b-1) : calc(k));
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
bool mp[1000001];
int p[1000001];
int M = 1000000;

bool prime(int n){
    vector<int> v;
    bool ret = 1;
    while(n > 1){
        if(v.empty() or v.back() != p[n]){
            v.pb(p[n]);
        }
        n /= p[n];
    }
    for(int i : v) {
        if(mp[i]) ret = 0;
        else mp[i] = true;
    }
    return ret;
}
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    memset(mp, 0, sizeof(mp));
    memset(p, -1, sizeof(p));
    for(int i = 2; i <= M;i++){
        if(p[i] == -1) p[i] = i;
        for(int j=i*2;j<=M;j+=i){
            if(p[j] == -1) p[j] = i;
        }
    }
    int a, n;
    cin >> n ;
    bool ans = 1;
    int num;
    for(int i=0;i<n;i++){
        cin >> a;
        if(i == 0) num = a;
        else num = __gcd(num, a);
        ans &= prime(a);
    }
    if(ans) cout << "pairwise coprime" << endl;
    else{
        if(num == 1) cout << "setwise coprime" << endl;
        else cout << "not coprime" << endl;
    }
    return 0;
}


Measured memory_bytes: 8512
#include<bits/stdc++.h>
using namespace std;
int main(){
    int64_t N;
    cin >> N;
    vector<int> div;

    if(N==1){
        cout << 0 << endl;
        return 0;
    }
    int64_t n=N;

    for(int64_t i=2; i*i<=N; i++){
        int times=0;
        while(n%i == 0){
            n = n/i;
            times++;
        }
        if(times != 0){
            div.push_back(times);
        }
    }
    if(n != 1){
        div.push_back(1);
    }

    int ans=0;
    for(int i=0; i<div.size(); i++){
        int check=1;
        int plus=0;
        while(div.at(i) >= check){
            div.at(i) -= check;
            check++;
            plus++;
        }
        ans += plus;
    }
    cout << ans << endl;
}


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

int main()
{
   int a[105];
   int sum,n;
   cin>>n;
   for(int i=0;i<n;i++)
    cin>>a[i];
   sort(a,a+n);
   sum=a[n-1]-a[0];
   cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
n,d = gets.split.map(&:to_i)

x = []

count = 0
n.times do |i|
  x[i] = gets.split.map(&:to_i)
end

sum = 0

(n-1).times do |ni|
  (n-ni-1).times do |si|
    d.times do |di|
      sum += (x[ni][di] - x[si+1+ni][di])**2

      if (d-1) == di
        if Math.sqrt(sum).to_i**2 == sum
          count += 1
        end
      end
    end
    sum = 0
  end
end

puts count


Measured memory_bytes: 1788
//#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#include <iomanip>  //setprecision(桁)
using namespace std;
#define pb push_back
#define ll long long int
#define rep(i,n) for(int i = 0;i < n;i++)
#define INF 1e+9
const ll MOD = 1000000007;

struct edge {
    int to;
    ll cost;
};

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

int V;
const int ci = 2e5+ 5;
vector<edge> G[ci];
double d[ci];

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));
            }
        }
    }
}

vector<edge> g[100005];
int main() {
    int n; cin >> n;
    rep(i,n-1){
        int u, v; ll w; cin >> u >> v >> w;
        u--; v--;
        edge e1 = {v,w};
        edge e2 = {u,w};
        g[u].push_back(e1);
        g[v].push_back(e2);
    }

    vector<ll> dist(n);
    vector<bool> vis(n,false);
    queue<int> que;
    que.push(0);
    vis[0] = true;

    while(que.size()) {
        int v = que.front();
        que.pop();
        for (int i = 0; i < g[v].size(); i++) {
            edge e = g[v][i];
            if(!vis[e.to]){
                vis[e.to] = true;
                dist[e.to] = dist[v] + e.cost; //cout << e.cost << endl;
                que.push(e.to);
            }
        }
    }
    vector<int> color(n);
    for(int i = 0; i < n; i++){
        if(dist[i] % 2 == 0){
            color[i] = 1;
        }else{
            color[i] = 0;
        }
    }
    for(auto i : color) cout << i << endl;
}


Measured memory_bytes: 15360
#include <string>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <cmath>

using namespace std;
typedef long long ll;

int main()
{
	ll N;
	cin >> N;
	string S = to_string(N);
	int L = (int)S.size();
	int ans = S[0] - '0';
	for (int i = 1; i < L; i++) {
		if (S[i] != '9') {
			ans = (ans - 1) + (L - i) * 9;
			break;
		} else {
			ans += 9;
		}
	}
	cout << ans << endl;
	return 0;
}


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

int main() {
	int a, score = 0;
	for (int i = 0; i < 5; i++) {
		cin >> a;
		if (a < 40) {
			a = 40;
		}
		score += a;
	}
	cout << score / 5 << endl;
}

Measured memory_bytes: 3096
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>

using std::cin;
using std::cout;
using std::endl;
using std::sort;
using std::vector;

int main(void) {
    int a;
    int L;
    int times;
    bool hit;
    int max;
    int min;

    while (1) {
        cin >> a >> L;
        if (a == 0 && L == 0) {
            break;
        }
        times = 0;
        hit = false;
        vector<int> keep_old;
        keep_old.push_back(a);
        do { 
            int slot = L - 1;
            vector<int> number(L, 0);
            while (a != 0) {
                number[slot] = a % 10;
                a /= 10;
                slot--;
            }
            sort(number.begin(), number.end());
            max = 0;
            min = 0;
            for (int i = 0; i < L; i++) {
                max += number[i] * pow(10, i);
                min += number[i] * pow(10, L - 1 - i);
            }
            a = max - min;
            for (int i = 0; i < keep_old.size(); i++) {
                if (a == keep_old[i]) {
                   hit = true; 
                   cout << i << " " << keep_old[i] << " " << keep_old.size() - i << endl;
                   continue;
                }
            }
            keep_old.push_back(a);
            times++;
        } while(! hit);
    }
    return 0;
}

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

using namespace std;

int main(){
  string s; cin >> s;
  sort(s.begin(),s.end());
  
  bool a = (s[0] == s[1]);
  bool b = (s[2] == s[3]);
  bool dif = (s[0] != s[2]);
  
  if(a and b and dif) cout << "Yes" << endl;
  else cout << "No" << endl;
}
    
  
  


Measured memory_bytes: 256
/*         
               JAI SHREE RAM    */
 
 
 
#include<bits/stdc++.h>
using namespace std;
 
#define ff              first
#define ss              second
#define pb              push_back
#define int             long long
#define mp              make_pair
#define pr              pair<long long,long long>
#define vr              vector<long long>
#define mod            1000000007
#define mod2            998244353
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define ll              long long
#define ld	            long double
#define w(x)            int x; cin>>x; while(x--)
#define fill(a,b)       memset(a, b, sizeof(a))
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
 

const int N = 1000001;
  vector <int> a;
int power(int x, unsigned int y) 
{ 
    int res = 1;     
   
    while (y > 0) 
    { 
        
        if (y & 1) 
            res = res*x; 
        y = y>>1; // y = y/2 
        x = x*x;  // Change x to x^2 
    } 
    return res; 
}
 
long long maxSubArray(long long a[], int sze)
{
   long long max_so_far = 0, max_ending = 0;
   for (int i = 0; i < sze; i++)
   {
       max_ending = max_ending + a[i];
       if (max_ending < 0)
           max_ending = 0;
       else if (max_so_far < max_ending)
           max_so_far = max_ending;
   }
   return max_so_far;
}
 
 
 
ll factorialNumInverse[N + 1]; 
ll naturalNumInverse[N + 1]; 
ll fact[N + 1]; 
  
 
void InverseofNumber(ll p) 
{ 
    naturalNumInverse[0] = naturalNumInverse[1] = 1; 
    for (int i = 2; i <= N; i++) 
        naturalNumInverse[i] = naturalNumInverse[p % i] * (p - p / i) % p; 
} 
void InverseofFactorial(ll p) 
{ 
    factorialNumInverse[0] = factorialNumInverse[1] = 1; 
  
    
    for (int i = 2; i <= N; i++) 
        factorialNumInverse[i] = (naturalNumInverse[i] * factorialNumInverse[i - 1]) % p; 
} 
void factorial(ll p) 
{ 
    fact[0] = 1; 
  
    // precompute factorials 
    for (int i = 1; i <= N; i++) { 
        fact[i] = (fact[i - 1] * i) % p; 
    } 
} 
  
ll Binomial(ll N, ll R, ll p) 
{ 
    // n C r = n!*inverse(r!)*inverse((n-r)!) 
    ll ans = ((fact[N] * factorialNumInverse[R]) 
              % p * factorialNumInverse[N - R]) 
             % p; 
    return ans; 
} 

 
void solve()
{
   int n;
   cin>>n;
   int a[n];
   int b[n];
   for(int i=0;i<n;i++)
   {
       cin>>a[i]>>b[i];
   }
   int f=0;
   for(int i=0;i+2<n;i++)
   {
       if(a[i]==b[i] && a[i+1]==b[i+1] && a[i+2]==b[i+2])
       {
           f=1;
           break;
       }
   }
   if(f)
   cout<<"Yes\n";
   else
   cout<<"No\n";
}
 
int32_t main()
{ 
      
      ios;
      int test;
     
      
      test=1;
   //  cin>>test;
    
      while(test--)
      {
          solve();
      }
       
    
    return 0;
	}

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

int g[15][15];

int main() {
  int n;
  cin >> n;
  rep(i, n) rep(j, n) g[i][j] = -1;
  rep(i, n) {
    int m;
    cin >> m;
    rep(j, m) {
      int a, x;
      cin >> a >> x;
      --a;
      g[i][a] = x;
    }
  }

  int ans = 0;
  rep(i, 1 << n) {
    bool ok = true;
    rep(j, n) {
      if (i >> j & 1) {
        rep(k, n) {
          if (g[j][k] == -1) continue;
          if (g[j][k] != (i >> k & 1)) ok = false;
        }
      }
    }
    if (ok) ans = max(ans, (int)bitset<16>(i).count());
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
x = [0 for i in range(n)]
for i in range(n):
    if i % 2 == 0:
        x[0] += a[i]
    else:
        x[0] -= a[i]
for i in range(1,n):
    x[i] = 2 * a[i-1] - x[i-1]
print(*x)

Measured memory_bytes: 14028
#include<iostream>
#include<string>
using namespace std;
bool find(string s, char c) {
	for (int i = 0; i < s.size(); i++)if (s[i] == c)return true;
	return false;
}
int main(){
	string s; cin >> s;
	if (find(s, 'N') == find(s, 'S') && find(s, 'E') == find(s, 'W'))cout << "Yes\n";
	else cout << "No\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <utility>
#include <climits>
#include <iomanip>
using namespace std;
#define MAXSIZE 100005
#define MAXL 100
typedef long long int lli;

int main(){
    string s;
    cin >> s;
    
    int num_lose = 0;
    for(int i = 0; i < s.length(); ++i){
        if(s[i] == 'x'){
            num_lose++;
        }
    }
    string ans = (num_lose >= 8)? "NO" : "YES";
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      int[] seq = new int[n];
      for(int i=0; i!=n; i++)
        seq[i] = Integer.parseInt(br.readLine());

      System.out.println( shellSort(seq, n) );

      StringBuilder str = new StringBuilder(n*5);
      for (int i : seq)
        str.append(i).append("\n");
      str.setLength(str.length()-1);
      System.out.println(str);
    }
  }

  public static int shellSort(int a[], int n) {
    int cnt=0;
    int m = 0;
    int[] aG = new int[100];
    for (int g=1,max=n+1; g < max; g=(g*3+1)) {
      aG[m++] = g;
    }
    StringBuilder str = new StringBuilder(m*5);
    str.append(m).append("\n");

    for(int i=(m-1); i!=-1; i--){
      cnt += insertionSort(a, n,aG[i]);
      str.append(aG[i]).append(" ");
    }

    str.setLength(str.length()-1);
    System.out.println(str);

    return cnt;
  }
  
  public static int insertionSort(int a[], final int max, final int g) {
    int cnt=0;

    for (int i=g,j=0,v=0; i < max; i++) {
      for( j=(i-g), v=a[i]; j>=0 && a[j]>v; j-=g ) {
        a[j+g] = a[j];
        cnt++;
      }
      a[j+g] = v;
    }

    return cnt;
  }
}


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

int main(){
    int N;
    cin>>N;
    vector<pair<int,int> >ans(N);
    for(int i = 0; i < N; i++){
        int a,b;
        cin>>a>>b;
        ans[i] = make_pair(a,b);
    }
    int sum=0;
    rep(i,N){
         int first=ans[i].first;
        int sec=ans[i].second;
        sum += sec-first+1;
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 256
'''
https://atcoder.jp/contests/abc084/tasks/abc084_d
'''
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations
    #from itertools import accumulate, product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 1000000007

    def primecheck(n):
        p = [True] * (n + 1)
        p[0] = False
        p[1] = False
        for i in range(2, int(n ** 0.5) + 1):
            if p[i]:
                for j in range(i * i, n + 1, i):
                    p[j] = False
        return p
    
    p = primecheck(10**5)
    cnt = 0
    res = [0]*(10**5)
    for i in range(1, 10**5, 2):
        if p[i]==p[(i+1)//2]==1:
            cnt += 1
        res[i] = cnt


    q = int(input())
    for _ in range(q):
        l, r = map(int, input().split())
        if l==1:
            print(res[r])
        elif res[l]==res[l-2]:
            print(res[r]-res[l])
        else:
            print(res[r]-res[l]+1)

if __name__ == '__main__':
    main()

Measured memory_bytes: 5816
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        long H = sc.nextLong();
        long W = sc.nextLong();
        long S= H*W;
        if(H==1||W==1){
            System.out.println(1);
        }else{
            System.out.println((S+1)/2);
        }
        
    }
}


Measured memory_bytes: 35432
N = int(input())
A = {}
ans = 0
for a in input().split():
    a = int(a)
    if a not in A:
        A[a] = 1
    else:
        A[a] += 1
    ans += a
    
Q = int(input())
for i in range(Q):
    B, C = map(int, input().split())
    if B in A:
        ans += (C-B) * A[B]
        if C not in A:
            A[C] = A[B]
        else:
            A[C] += A[B]
        A[B] = 0
        print(ans)
    else:
        print(ans)

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

n, k, q = [int(w) for w in input().split()]


score = [0] * n

for i in range(q):
    a = int(input())
    score[a - 1] += 1


for s in score:
    print('Yes' if s + k - q > 0 else 'No')


Measured memory_bytes: 9848
#include"bits/stdc++.h"
#define REP(i,n)  for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n) for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n) for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)for(ll i=(n);i>0;--i)
#define ALL(obj)  (obj).begin(),(obj).end()
using namespace std;
using ll=long long;
using ull=unsigned long long;
template<typename T>using pqg=priority_queue<T,vector<T>,greater<T>>;
constexpr auto inf=static_cast<ll>(1e18);
template<typename T=ll>inline T in(){T ret;cin>>ret;return ret;}
template<typename T=ll>inline vector<vector<T>>vec2(size_t h,size_t w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}
inline void setp(int n){cout<<fixed<<setprecision(n);}
inline void delnl(){cin.ignore(numeric_limits<streamsize>::max(),'\n');}

int main()
{
    ll n=in();
    vector<double>v(n);REP(i,n)v[i]=in();
    sort(ALL(v),greater<double>());
    while(v.size()!=1){
        auto a=v.back();v.pop_back();
        auto b=v.back();v.pop_back();
        v.push_back((a+b)/2);
    }
    setp(20);
    cout<<v[0]<<endl;
}

Measured memory_bytes: 256
import itertools

A = range(int(input()) + 1)
B = range(int(input()) + 1)
C = range(int(input()) + 1)
X = int(input())

count = 0
for i in itertools.product(A, B, C):
  if i[0] * 500 + i[1] * 100 + i[2] * 50 == X:
    count += 1
print(count)

Measured memory_bytes: 39280
def main():
    n = int(input())
    t = list(map(int, input().split()))
    m = int(input())
    p = [0] * m
    x = [0] * m
    for i in range(m):
        p[i], x[i] = map(int, input().split())
    sumt = sum(t)
    for i in range(m):
        print(sumt - t[p[i] - 1] + x[i])


if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

fn main() {
  let n = read::<i32>();
  let m = read::<i32>();
  let mut votes = vec![0; m as usize];

  for _ in 0..n {
    let k = read::<i32>();
    for _ in 0..k {
      let a = read::<i32>();
      votes[(a - 1) as usize] += 1;
    }
  }

  let mut answer = 0;
  for v in votes {
    if v == n {
      answer += 1
    }
  }

  println!("{:?}", answer);

}



Measured memory_bytes: 4352
import sys
n = int(input())
dp=[sys.maxsize]*(n+1)
def beki(arg):
  res=0
  t=1
  while t < n:
    t=t*arg
    res+=1
  return res

dp[0]=0
a = beki(9)
b = beki(6)

for i in range(n):
  dp[i+1]=min(dp[i+1],dp[i]+1)
  for j in range(1,a+1):
    if i+9**j > n:
      break
    dp[i+9**j]=min(dp[i+9**j],dp[i]+1)
  for j in range(1,b+1):
    if i+6**j > n:
      break
    dp[i+6**j]=min(dp[i+6**j],dp[i]+1)
print(dp[n])

Measured memory_bytes: 3828
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <x86intrin.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define V vector
template <typename T> bool chmin(T &a, const T &b) {if(a > b){a = b; return true;} return false;}
template <typename T> bool chmax(T &a, const T &b) {if(a < b){a = b; return true;} return false;}
template<typename A, size_t N, typename T> void Fill (A (&array)[N], const T & val) {fill ((T*)array, (T*)(array+N), val);}
V<int> dx = {-1, 1,  0, 0, -1, -1,  1, 1};
V<int> dy = { 0, 0, -1, 1, -1,  1, -1, 1};

const int INF = 1e9;

int main () {
    string s; cin >> s;
    int n = s.size();
    V<V<int>> ni(n, V<int> (26, n));//ni[i][j]:i文字目(0-indexed)以降に最初にj+'a'が登場するindex
    for (int i = n-1; i >= 0; i--) {
        if (i < n-1) rep(j, 26) ni[i][j] = ni[i+1][j];
        ni[i][s[i] - 'a'] = i;//i文字目以降で最初にs[i]が登場するのはi番目
    }
    V<int> dp(n+1, INF);//dp[i]:i文字目(0-indexed)以降で部分文字列とならない最短の文字列長
    dp[n] = 1;
    V<pair<char, int>> rec(n);//rec[i]:i文字目以降での最初の文字　次のindex
    for (int i = n-1; i >= 0; i--) {
        rep(j, 26) {//先頭の文字をX=j+'a'にする
            if (ni[i][j] == n) {//i以降にXがない
                if (chmin(dp[i], 1)) {//Xだけ
                    rec[i] = {j + 'a', n};
                }
            }
            else {//i以降にXがある
                if (chmin(dp[i], dp[ni[i][j]+1] + 1)) {//ni[i][j]番のかわりにi番を使う 
                    rec[i] = {j + 'a', ni[i][j] + 1};
                }
            }
        }
    }
    int p = 0; 
    while (p != n) {
        cout << rec[p].first;
        p = rec[p].second;
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 32420
import java.util.*;

public class Main {
	public static void main(String[] args) {  
  		Scanner sc = new Scanner(System.in);
      	int a = sc.nextInt();
      	int b = sc.nextInt();
      
      	if((a * b) %2 == 0) {
        	System.out.println("Even");  
        } else {
        	System.out.println("Odd");
        }
    }
}

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

#define INF 1000000000000


signed main()
{
	int a,b;
  cin>>a>>b;
  int k=(a+(b/2))/b;
  int l=a/b;
  if(b%2==1){
    cout<<l*l*l<<endl;
  }
  if (b%2==0){
    cout<<k*k*k+l*l*l<<endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

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

int main() {
  int a, p;
  cin >> a >> p;
  P((3 * a + p) / 2);

  return 0;

}

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

#define SZ(x) (int)((x).size())
#define xx first
#define yy second
#define pii pair<int, int>



void solve() {
    int n;
    ll d;
    cin >> n >> d;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        ll x, y;
        cin >> x >> y;
        if (x * x + y * y <= d * d)
            ans++;
    }
    cout << ans << '\n';
}
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    // int _; cin >> _; while (_--)
    solve();
    return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
#include<math.h>
#define N 100005
#define K 200005
#define MOD (int)1e9+7
#define ll long long int
using namespace std;
void add_self(int &a,int b)
{
    a+=b;
    if(a>=MOD)
    {
        a-=MOD;
    }
}
void sub_self(int &a,int b)
{
    a-=b;
    if(a<0)
    {
        a+=MOD;
    }
}
int main() {
    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
   // no of ways we have used i candies so far
   
      vector<int> findp(k+1);
      findp[0]=1;
    for(int i=0;i<n;i++)
    {
         vector<int> dp(k+1);
        for(int candy=k;candy>=0;candy-- )
        {
            
            int inc=findp[candy];
            int l=candy+1;
            int r=candy+min(k-candy,a[i]);
            if(l<=r)
            {
                add_self(dp[l],inc);
               if(r+1<=k)
                sub_self(dp[r+1],inc);
            }
            // for(int inuse=1;inuse<=min(k-candy,a[i]);inuse++)
            // {
            //     dp[candy+inuse]+=dp[candy];
            // }
        }
       
    int prefix=0;
    for(int i=0;i<=k;i++)
    {
       add_self(prefix,dp[i]);
       add_self(findp[i],prefix);
    }
  
    }
     cout<<findp[k]<<endl;
}

Measured memory_bytes: 1024