akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <map> 
using namespace std;

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

const long long INF = 1LL << 60;

int main()
{
	int N, K;
	cin >> N >> K;
	vector<int> A(N),num(N+10);
	for (int i = 0;i < N;i++) {
		cin >> A[i];
	}
	int res = 0;
	for (int i = 0;i < N;i++) {
		num[A[i]]++;
	}
	sort(num.begin(), num.end(), greater<int>());
	for (int i = 0;i < N;i++) {
		if (num[i] == 0) {
			num.resize(i);
			N = i;
			break;
		}
	}
	while (N>K) {
		res += num[N-1];
		N--;
		num.pop_back();
		num.resize(N);
	}
	cout << res << endl;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
int A[16][16];
ll SA[1<<16];
ll dp[1<<16];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(y,N) FOR(x,N) cin>>A[y][x];
	int mask;
	FOR(mask,1<<N) {
		FOR(x,N) FOR(y,x) if((mask&(1<<x))&&(mask&(1<<y))) SA[mask]+=A[x][y];
		dp[mask]=-1LL<<60;
	}
	dp[0]=0;
	FOR(mask,(1<<N)-1) {
		int first;
		FOR(first,N) if((mask&(1<<first))==0) break;
		int submask=((1<<N)-1)^mask^(1<<first);
		for(int sm2=submask; sm2>=0; sm2--) {
			sm2&=submask;
			
			dp[mask | sm2 | (1<<first)] = max(dp[mask | sm2 | (1<<first)], dp[mask] + SA[sm2 | (1<<first)]);
		}
	}
	
	cout<<dp[(1<<N)-1]<<endl;
	
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 1280
#include <cstdio>
#include <bitset>

static const int N = 2005;
int a[N];
std :: bitset <4000005> bs;

int main() {
  int n; scanf("%d", &n);
  for (int i = 0; i < n; ++ i) scanf("%d", &a[i]);
  bs[0] = 1;
  for (int i = 0; i < n; ++ i) bs |= bs << a[i];
  int t = bs.count();
  if (t & 1) {
    (++ t) >>= 1;
    for (int i = 0; i <= 4000000; ++ i) {
      t -= bs[i];
      if (! t) {
        printf("%d\n", i); return 0;
      }
    }
  } else {
    t >>= 1;
    for (int i = 1; i <= 4000000; ++ i) {
      t -= bs[i];
      if (! t) {
        printf("%d\n", i); return 0;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1784
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
//for(int i = 0; i<n; i++)
 
 
int main()
{
    string s, t = "keyence";
    cin >> s;
    int n = s.size() - 7;
    bool b = false;
    for(int i = 0; i < 8; i++){
        bool can = true;
        for(int j = 0; j < 7; j++){
            if(i > j){
                if(s[j] != t[j]) can = false;
            }else{
                if(s[j + n] != t[j]) can = false;
            }
        }
        if(can) b = true;
    }
    cout << (b ? "YES" : "NO") << endl;
    return 0;
}

Measured memory_bytes: 256
n, q = map(int, input().split())
s = input()
b = [0] * n
cnt = 0
for i in range(n-1):
	if s[i:i+2] == "AC":
		cnt += 1
	b[i+1] = cnt
for i in range(q):
	l, r = map(int, input().split())
	a = b[r-1] - b[l-1]
	print (a)

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

using namespace std;

int main(void){
	int a, b, c;
	cin >> a >> b >> c;

	vector<int> sa(3);

	if(a-b > 0)
		sa[0] = a-b;
	else
		sa[0] = b-a;
	if(b-c > 0)
		sa[1] = b-c;
	else
		sa[1] = c-b;
	if(c-a > 0)
		sa[2] = c-a;
	else
		sa[2] = a-c;

	sort(sa.begin(), sa.end());

	cout << (sa[0] + sa[1]) << endl;

	return 0;
}


Measured memory_bytes: 256
///apigs property
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0)
#define F first
#define S second
#define pb push_back
#define vll vector< ll >
#define vi vector< int >
#define pll pair< ll , ll >
#define pi pair< int , int >
#define all(s) s.begin() , s.end()
#define sz(s) s.size()
#define md (s + e) / 2
#define mid (l + r) / 2
#define msdp(dp) memset(dp , -1 , sizeof dp)
#define mscl(dp) memset(dp , 0 , sizeof dp)
using namespace std;
typedef long long ll;
ll q, a[555555] , b[555555], k, l, m, n, o, p;
map < ll , ll > mp;
vll adj[555555];
const ll mod = 1e9+7;
ll dp[3005][3005];
string s , t;
ll mem(ll i , ll j){
	if(i > n || j > m)return 0;
	ll &r = dp[i][j];
	if(r != -1)return r;
	ll o1 = mem(i + 1 , j) , o2 = mem(i , j + 1);
	r = max(o1 , o2);
	if(s[i] == t[j])r = max(r , mem(i + 1 , j + 1) + 1);
	return r;
}
string ss;
void solve(){
	cin >> s >> t;
	n = sz(s) , m = sz(t);
	s = ' ' + s , t = ' ' + t;
	msdp(dp);
	k = mem(1 , 1);
	ll i = 1 , j = 1;
	while(i <= n && j <= m){
		if(dp[i][j] == mem(i + 1, j)){
			i++;
		}
		else if(dp[i][j] == mem(i , j + 1)){
			j++;
		}
		else {
			ss.pb(s[i]);
			i++,j++;
		}
	}	
	cout << ss;
}
int main() {
    fast ;
	// cin >> q;
	q = 1;
    while(q--){
    	solve();
	}
}



Measured memory_bytes: 87696
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>

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

using namespace std;
typedef long long ll;

int main() {

    int n;
    cin >> n;

    if(n == 0) {
        cout << 1%2 << endl;
    }

    if(n == 1) {
        cout << 11%3 << endl;
    }
    
    if(n == 2) {
        cout << 111%5 << endl;
    }

    if(n >= 3) {
        cout << 0 << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1164
from collections import defaultdict

def main():
    N, M = map(int, input().split())
    d = defaultdict(int)
    for _ in range(M):
        a, b = map(int, input().split())
        d[a] += 1
        d[b] += 1

    for i, j in d.items():
        if j % 2 == 1:
            print('NO')
            exit()


    print('YES')


if __name__ == "__main__":
    main()

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

int main() {
    long long int N;
    cin >> N;

    long long int ans = 0;
    for(long long int i = 2; i*i <= N; i++) {
        long long int count = 0;
        while(N % i == 0) {
            N /= i;
            count++;
        }
        for(long long j = 1; j <= count; j++) {
            if(0 <= count - j) {
                count -= j;
                ans++;
            }
        }
    }
    if(N != 1) {
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <math.h>
#include <array>
#include <list>
#include <set>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef tuple<ll,int,int> tup;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vp;
int tmpmin=1e9;
int main(int argc,char const* argv[])
{
  int d,n;
  cin >> d >> n;
  if(d==0)
    {
      if(n!=100) cout << n << endl;
      else cout << n+1 << endl;
    }
  if(d==1)
    {
      if(n!=100) cout << n*100 << endl;
      else cout << n*100+100 << endl;
    }
  else if(d==2)
    {
      if(n!=100) cout << n*10000 << endl;
      else cout << n*10000+10000 << endl;
    }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef vector<int> vi;
const int inf = 1e9+7;
const int INF = 1e18+7;
const int mod = 1e9+7;
//26

vector<int> a;
int dp[200000];
signed main(){
	a.pb(1);
	int s = 6;
	rep(i,inf){
		a.pb(s);
		if(6*s > 100000)break;
		s *= 6;
	}
	s = 9;
	rep(i,inf){
		a.pb(s);
		if(6*s > 100000)break;
		s *= 9;
	}
	fill(dp, dp+200000, inf);
	int n, m = a.size(), ans = 0;
	scanf("%lld", &n);
	sort(all(a), greater<int>());
	
	dp[0] = 0;
	rrep(i,n){
		rep(j,m){
			if(i-a[j] >= 0)dp[i] = min(dp[i], dp[i-a[j]]+1);
		}
	}
	printf("%lld\n", dp[n]);
	return 0;
}





Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define MAXN 1e5

using namespace std;


int dp (){
}

long long n,m,a,b,c;
string s1,s2;

int main(){
    cin>>n;
    int l[n],l2[n];
    for (int i=0; i<n; i++){
        cin>>l[i];
        l2[i]=0;
    }
    l2[1]=abs(l[1]-l[0]);
    for (int i=2; i<n; i++){
        l2[i]+=min(abs( l[i] - l[i-1]) + l2[i-1] , abs ( l[i] - l[i-2] ) + l2[i-2]);
    }
    cout<<l2[n-1]<<endl;
}


Measured memory_bytes: 4412
# 貪欲に大きい順に入れていって，入れる場所はもっとも周りが大きくなる場所
# この方針は正しいただし，値の取り出しだけではなく挿入が起こるので，優先度付きキュー（heap）を使う必要があるっ
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
import heapq
C = []
# heapは最小値しか取り出せないことに注意
heapq.heapify(C)
ans = 0
# 初期条件として2つの値を挿入する
heapq.heappush(C,-A[0])
for i in range(1,N):
    tmp = heapq.heappop(C)
    ans += -tmp
    heapq.heappush(C, -A[i])
    heapq.heappush(C, -A[i])
print(ans)






Measured memory_bytes: 31700
//om nama sivaya
#include<bits/stdc++.h>
#define ll long long
using namespace std;
void solve(){
    int n,x,t,z;
    cin>>n>>x>>t;
    z=ceil((double)n/x);
    cout<<(int)(z*t);
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t=1;
    //cin>>t;
    while(t--)
    solve();
}

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

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	int n;
	cin>>n;
	vector<ll> a(n);
	ll sum=0;
	for(ll& x:a){
		cin>>x;
		sum+=x;
	}
	ll pf=0;
	ll res=numeric_limits<ll>::max();
	for(int i=0;i<n-1;++i){
		pf+=a[i];
		ll sf=sum-pf;
		res=min(res,abs(pf-sf));
	}
	cout<<res<<'\n';
}


Measured memory_bytes: 4764
using System;

namespace ABC123 {
  class ProblemA {
    static void Main(string[] args) {
      string str;
      int[] a = new int[6];
      for (int i = 0; i < 6; i++) {
        str = System.Console.ReadLine();
        a[i] = int.Parse(str);
      }
      System.Console.WriteLine(a[4] - a[0] <= a[5] ? "Yay!" : ":(");
    }
    

  }
}

Measured memory_bytes: 11092
from collections import Counter, defaultdict
from string import ascii_lowercase
INF = 1<<60
N = int(input())
alph_A = [INF]*26
for _ in range(N):
  S = input()
  for i, s in enumerate(ascii_lowercase):
    alph_A[i] = min(alph_A[i], S.count(s))
    
ans = ""    
for i, s in enumerate(ascii_lowercase):
  ans += s*alph_A[i]
print(ans)  
    
  
  

Measured memory_bytes: 3760
#include <bits/stdc++.h>
using namespace std;
int cumm[100009]={0};

int main()
{
    int n,x;
    cin >>n;
    for(int i=0;i<n;i++){
        cin >> x;
        cumm[x]++;
        cumm[x-1]++;
        cumm[x+1]++;
    }
    int ans = -10000;
    for(int i=0;i<100009;i++){
        ans = max(ans,cumm[i]);
    }
    cout << ans;
}


Measured memory_bytes: 640
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstdlib>
#include <ctime>
#include <deque>
using namespace std;
 
#define P 1000000007
int N, A, B, C;
int co[5010][5010];
int dp[2511][5010][2];
int ans;
 
void up(int &x, int y) {
	x = (x + y) % P;
}
 
int main() {
	cin >> N >> A >> B >> C;
	co[0][0] = 1;
	for (int i = 1; i <= 5000; i++) {
		co[i][0] = 1;
		for (int j = 1; j <= i; j++)
			co[i][j] = (co[i - 1][j] + co[i - 1][j - 1]) % P;
	}
	if (B % 2 != 0) {
		printf("0\n");
		return 0;
	}
	dp[0][0][0] = 1;
	for (int i = 0; i <= N / 2; i++)
		for (int j = 0; j <= N; j++) {
			if (dp[i][j][1]) {
				up(dp[i][j][0], dp[i][j][1]);
				up(dp[i][j + 1][1], dp[i][j][1]);
			}
			if (dp[i][j][0]) {
				up(dp[i + 1][j][1], dp[i][j][0]);
				// up(dp[i + 1][j][0], dp[i][j][0]);
			}
		}
	// for (int i = 0; i <= N / 3; i++)
	for (int j = 0; j <= C; j++)
		if (dp[B / 2][j][0])
			for (int q = 0; j + 3 * q <= C; q++) {
			// if ((B - 2 * i) % 2 != 0)
			// 	continue;
			int aa = C - j - 3 * q, bb = q, cc = A - aa;
			// printf("?? %d %d %d %d %d\n", i, j, aa, bb, cc);
			if (aa < 0 || cc < 0)
				continue;
			// printf("?? %d %d %d %d %d %d\n", i, j, aa, bb, cc, dp[i][j][0]);

			int tmp = dp[B / 2][j][0];
			tmp = 1LL * tmp * co[B / 2 + aa][aa] % P;
			tmp = 1LL * tmp * co[B / 2 + aa + bb][bb] % P;
			tmp = 1LL * tmp * co[B / 2 + aa + bb + cc][cc] % P;
			// tmp = 1LL * tmp * co[i + aa + bb + cc][cc] % P;
			// tmp = 1LL * tmp * co[i + aa + bb + cc + q][q] % P;
			
			up(ans, tmp);
		}
	printf("%d\n", ans);
}


Measured memory_bytes: 165496
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);


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

    void run() {

        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] arr = new int[n];
        int zero = 0;
        int l = 0;
        int r = 0;
        for (int i=0; i<n; i++) {
            arr[i] = sc.nextInt();
            if (arr[i] == 0) zero++;
            if (arr[i] < 0) {
                l++;
            }
            if (0 < arr[i]) r++;
        }

        long res = Long.MAX_VALUE;

        List<Integer> ll = new ArrayList<>();
        List<Integer> rr = new ArrayList<>();

        for (int i=0; i<n; i++) {
            if (arr[i] < 0) ll.add(arr[i]);
            if (0 < arr[i]) rr.add(arr[i]);
        }

//        System.out.println(ll);
//        System.out.println(rr);

        if (true) {
            for (int i=0; i<=k; i++) {
                if (zero != 0 && i == k) continue;
                int left = i;
                int right = k - i;
                if (zero != 0) {
                    right = k - i - 1;
                }
                if (l < i) continue;
                if (r < right) continue;
                long tmp = 0;
                if (i == 0) {
                    if (right >= 1) tmp = Math.abs(rr.get(right - 1));
                    res = Math.min(res, tmp);
                    continue;
                }
                tmp = Math.abs(ll.get(ll.size() - i)) + ((1 <= right) ? Math.min(Math.abs(ll.get(ll.size()-i)), rr.get(right-1))+rr.get(right-1) : 0 );
                res = Math.min(res, tmp);
            }
            System.out.println(res);
        }





    }
}


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

#define pb push_back
#define ll long long
#define ull unsigned long long
#define f(i,x,n) for(int i=x;i<n;i++)

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	ll a,b; cin>>a>>b;

	// if(k<a || k>b){
	// 	cout<<"IMPOSSIBLE";
	// 	exit(0);
	// }

	if((a+b)%2!=0){
		cout<<"IMPOSSIBLE";
		exit(0);
	}

	cout<<(a+b)/2;

	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# AISing Programming Contest 2019：C - Alternating Path
import sys
sys.setrecursionlimit(10000000)

H, W = [int(i) for i in raw_input().strip().split(' ')]
S = []
for _ in range(H):
    S.append(raw_input().strip())
C = '#.'
CR = {'#':0, '.':1}


def find(h, w, sumi):
    while True:
        if sumi[h][w] == False:
            return (h, w)
        w += 1
        if w >= W:
            w = 0
            h += 1
            if h >= H:
                return None
    return None


def chain((h, w), t, c, sumi):
    if 0 <= h < H and 0 <= w < W:
        pass
    else:
        return c
    if sumi[h][w]:
        return c
    if S[h][w] == C[t]:
        sumi[h][w] = True
        c[t] += 1
        for ptr in [(-1, 0), (0, 1), (1, 0), (0, -1)]:
            c = chain((h+ptr[0], w+ptr[1]), 1-t, c, sumi)
        return c
    return c


def main():
    sumi = [[False for _ in range(W)] for _ in range(H)]
    h, w = 0, 0
    n = 0
    while True:
        c = [0, 0]
        # print 'sumi:', sumi
        result = find(h, w, sumi)
        if not result:
            break
        h, w = result[0], result[1]
        # print 'found:', h, w
        c = chain((h, w), CR[S[h][w]], c, sumi)
        # print c
        n += c[0] * c[1]
    print n


if __name__ == '__main__':
    main()


Measured memory_bytes: 184836
from collections import deque

N = int(input())
A = sorted([(int(j),i) for i, j in enumerate(input().split())])[::-1]
d = deque([(0,0)])
dp = [[0 for _ in range(N + 1)] for _ in range(N + 1)]
while(len(d)>0):
    i, j = d.pop()
    if i + j > N - 1:
        continue
    tmp = dp[i][j] + A[i+j][0] * abs(A[i+j][1] - i)
    if tmp > dp[i+1][j]:
        if dp[i+1][j] == 0:
            d.appendleft((i+1,j))
        dp[i+1][j] = tmp
    tmp = dp[i][j] + A[i+j][0] * abs(A[i+j][1] - N + j + 1)
    if tmp > dp[i][j+1]:
        if dp[i][j+1] == 0:
            d.appendleft((i,j+1))
        dp[i][j+1] = tmp
        
ans = -1
for i in range(N):
    for j in range(N):
        if dp[i][j] > ans:
            ans = dp[i][j]
print(ans)

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

int main() {
  int N;
  char s;

  cin >> N;
  for (int i = 1; i <= N; i++){
	cin >> s;
    if(s == 'Y'){
      cout << "Four" << endl;
      break;
    }
  }
  if(s != 'Y'){
    cout << "Three" << endl;
  }  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=3005,mod=1e9+7;
ll n,ans,dp[2][N];
string s;
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cin>>n>>s;
    dp[1][1]=1;
    for(ll len=2;len<=n;len++){
        for(ll i=1;i<=len-1;i++)dp[1-(len&1)][i]+=dp[1-(len&1)][i-1],dp[1-(len&1)][i]%=mod;
        for(ll i=1;i<=len;i++)dp[len%2][i]=0;
        for(ll l,r,i=1;i<=len;i++){
            if(s[len-2]=='<')l=1,r=i-1;
            else l=i,r=len-1;
            if(l>r)continue;
            dp[len%2][i]=dp[len%2][i]+dp[1-(len%2)][r];dp[len%2][i]%=mod;
            dp[len%2][i]=dp[len%2][i]-dp[1-(len%2)][l-1]+mod;
            dp[len%2][i]%=mod;
        }
    }
    for(ll i=1;i<=n;i++)ans+=dp[n%2][i],ans%=mod;
    cout<<ans;
}

Measured memory_bytes: 764
# https://atcoder.jp/contests/abc066/tasks/arc077_a

import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def exit(*argv, **kwarg):
    print(*argv, **kwarg)
    sys.exit()


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと


def a_int(): return int(read())


def ints(): return list(map(int, read().split()))


from collections import deque

n = a_int()
A = ints()
B = deque()
is_fliped = 0
for a in A:
    if is_fliped == 0:
        B.append(a)
    else:
        B.appendleft(a)
    is_fliped = 1 - is_fliped
if is_fliped:
    B.reverse()
print(*B)


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

#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define F first
#define S second
#define pb push_back
#define pii pair <int, int>
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define ld long double
#define int long long

void SOLVE(){
    int n, m;
    cin >> n >> m;
    int sm = 0;
    for (int i = 0; i < m; i++){
        int x;
        cin >> x;
        sm += x;
    }
    cout << (sm >= n ? "Yes\n" : "No\n");
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(12);
    int Q = 1;
    //cin >> Q;
    while (Q--){
        SOLVE();
    }

    return 0;
}


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

using namespace std; 
const int MAX_N = 105; 
const int MAX_K = 100005; 
const int MOD = 1000000007; 

int dp[MAX_N][MAX_K], sum[MAX_N][MAX_K]; 
int n, k; 
int a[MAX_N]; 

int main () {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin >> n >> k; 
	for (int i = 1; i <= n; i++) {
		cin >> a[i]; 
	}

	dp[0][0] = 1; 
	for (int j = 0; j <= k; j++) {
		sum[0][j] = 1; 
	}

	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= k; j++) {
			int r = j; 
			int l = max(0, j - a[i]); 

			if (l == 0) {
				dp[i][j] = sum[i - 1][r]; 
			}
			else {
				dp[i][j] = sum[i - 1][r]; 
				dp[i][j] -= sum[i - 1][l - 1]; 
				(dp[i][j] += MOD) %= MOD; 
			}
			sum[i][j] = (sum[i][j - 1] + dp[i][j]) % MOD; 
		}
	}

	cout << dp[n][k];
	return 0; 
}

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

int main(void){
    int n,d,x,i,cnt,j;
    cnt = 0;

    cin >> n >> d >> x;

    vector<int> A(n);
    for(i=0; i<n; i++){
        cin >> A.at(i);
    }

    for(i=0; i<n; i++){
        for(j=0; j * A.at(i) + 1 <= d; j++){
            cnt++;
        }
    }

    cout << x + cnt << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n,k;
	char s[50];
	scanf("%d%d%s",&n,&k,s);
	
	if(s[k-1]=='A')
	s[k-1]='a';
	else if(s[k-1]=='B')
	s[k-1]='b';
	else
	s[k-1]='c';
	
	printf("%s",s);
	

	return 0;
}


Measured memory_bytes: 1708
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include <cassert>
#include <cmath>
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}

int main(){
    int n;cin>>n;
    int res = 0;
    for(int i=1;i<=n;i++){
        if(i%2==0)continue;
        int cnt = 0;
        for(int j=1;j<=pow(i,0.5);j++){
            if(i%j==0){
                cnt++;
                if(i/j!=j)cnt++;
            }
        }
        if(cnt==8)res++;
    }
    cout<<res;
}





Measured memory_bytes: 256
function Main(input) {
    var S = input.trim();
    S = S.replace(/BC/g,"D");
    var N = S.length;
    var output = 0;
    var Acount = 0;
    for(var i = 0; i < N; i++){
        if(S[i] == "A"){
            Acount++;
        }
        else if(S[i] == "D"){
            output += Acount;
        }
        else{
            Acount = 0;
        }
    }
    console.log(output);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7500
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
from collections import deque
import sys
def main(N, M, G, R, I, root):
    P = [-1] * N
    D = [-1] * N
    D[root] = 0
    q = deque()
    q.append(root)
    while q:
        v = q.popleft()
        for to in G[v]:
            I[to] -= 1
            if I[to] == 0:
                D[to] = D[v] + 1
                P[to] = v
                q.append(to)
    for p in P:
        print(p + 1)

if __name__ == '__main__':
    input = sys.stdin.readline
    N, M = map(int, input().split())
    G = [[] for _ in range(N)]
    R = [[] for _ in range(N)]
    I = [0] * N
    for _ in range(N - 1 + M):
        a, b = map(int, input().split())
        a, b = a - 1, b - 1
        G[a].append(b)
        R[b].append(a)
        I[b] += 1
    main(N, M, G, R, I, I.index(0))


Measured memory_bytes: 99748
using System;

namespace AtCoder.Problems
{
    public class ProblemD
    {
        public static void Main(string[] args)
        {
            var s = new SolveD();
            s.Solve();
        }

        public class Scanner
        {
            private string[] _s;
            private int _i;
            private readonly char[] _separators = new char[] { ' ' };

            public Scanner()
            {
                _s = new string[0];
                _i = 0;
            }

            public string Next()
            {
                if (_i < _s.Length) return _s[_i++];
                string st = Console.ReadLine();
                while (st == "") st = Console.ReadLine();
                _s = st.Split(_separators, StringSplitOptions.RemoveEmptyEntries);
                if (_s.Length == 0) return Next();
                _i = 0;
                return _s[_i++];
            }

            public int NextInt() => int.Parse(Next());
            public long NextLong() => long.Parse(Next());
            public ulong NextULong() => ulong.Parse(Next());
            public double NextDouble() => double.Parse(Next());

            public int[] GetIntArray(int n, int add = 0)
            {
                int[] array = new int[n];
                for (int i = 0; i < n; i++)
                {
                    array[i] = NextInt() + add;
                }
                return array;
            }

            public long[] GetLongArray(int n, long add = 0)
            {
                long[] array = new long[n];
                for (int i = 0; i < n; i++)
                {
                    array[i] = NextLong() + add;
                }
                return array;
            }

            public double[] GetDoubleArray(int n, double add = 0)
            {
                double[] array = new double[n];
                for (int i = 0; i < n; i++)
                {
                    array[i] = NextDouble() + add;
                }
                return array;
            }
        }
    }

    public class SolveD
    {
        public void Solve()
        {
            var cin = new ProblemD.Scanner();
            var n = cin.NextLong();
            var k = cin.NextLong();

            var result = GetAnswer(n, k);
            Console.WriteLine(result);
        }

        public long GetAnswer(long n, long k)
        {
            const int mod = 1000000007;
            var answer = 0L;

            for (long i = k; i <= n + 1; i++)
            {
                var start = (i - 1) * i / 2;
                var end = n * (n + 1) / 2 - (n - i) * (n - i + 1) / 2;
                answer += end - start + 1;
                answer %= mod;
            }

            return answer;
        }
    }
}


Measured memory_bytes: 27552
import java.io.File;
import java.io.IOException;
import java.util.*;
 
public class Main {
 
	public static void main(String[] args) throws IOException {
		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);
		
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int K = sc.nextInt();
		int sum = 0;
		for(int i = 0; i < N; i++){
			int x = sc.nextInt();
			sum += 2 * Math.min(x , Math.abs(x - K));
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define mod 1000000007
using ll=long long;
const int INF=1000000000;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

struct IOSetup{
    IOSetup(){
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(12);
    }
} iosetup;
 
template<typename T1,typename T2>
ostream &operator<<(ostream &os,const pair<T1,T2>&p){
    os<<p.first<<" "<<p.second;
    return os;
}
 
template<typename T>
ostream &operator<<(ostream &os,const vector<T>&v){
    for(int i=0;i<(int)v.size();i++) os<<v[i]<<(i+1==(int)v.size()?"":" ");
    return os;
}

template<typename T1,typename T2>
istream &operator>>(istream &is,pair<T1,T2>&p){
    is>>p.first>>p.second;
    return is;
}

template<typename T>
istream &operator>>(istream &is,vector<T>&v){
    for(T &x:v)is>>x;
    return is;
}

struct UnionFind{
    int con;
    vector<int> par,siz;
    UnionFind(int n):con(n),par(n),siz(n,1){
        iota(begin(par),end(par),0);
    }
    int root(int x){
        return (par[x]==x?x:(par[x]=root(par[x])));
    }
    bool sameroot(int x,int y){
        return root(x)==root(y);
    }
    bool unite(int x,int y){
        x=root(x);y=root(y);
        if(x==y) return false;
        if(siz[x]<siz[y])swap(x,y);
        siz[x]+=siz[y];
        par[y]=x;
        con--;
        return true;
    }
    int size(int x){
        return siz[root(x)];
    }
};



signed main(){
    int n,m;cin>>n>>m;
    UnionFind uf(n);
    rep(i,m){
        int u,v;cin>>u>>v;u--,v--;
        uf.unite(u,v);
    }

    cout<<uf.con-1<<endl;

    return 0;
}


Measured memory_bytes: 3992
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

enum {
  RED = 0,
  MAGENTA,
  BLUE,
  YELLOW,
  GREEN,
  CYAN
};

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

struct Dice {
  int cost;
  int top;
  int front;
  int right;
  int order;
  int x;
  int y;
  Dice() {;}
  Dice(int c, int t, int f, int r, int order, int x, int y) : cost(c), top(t), front(f), right(r), order(order), x(x), y(y) {;}
  void Rotate(int i) {
    int ntop = top;
    int nfront = front;
    int nright = right;
    if (i == 0) {
      ntop = 5 - right;
      nright = top;
    } else if (i == 1) {
      ntop = 5 - front;
      nfront = top;
    } else if (i == 2) {
      ntop = right;
      nright = 5 - top;
    } else if (i == 3) {
      ntop = front;
      nfront = 5 - top;
    }
    top = ntop;
    front = nfront;
    right = nright;
    x += dx[i];
    y += dy[i];
    cost++;
  }
};

int mapto[200];
int order[200];
int w, h;
char field[40][40];
bool visit[7][6][6][30][30];
char str[100];

int main() {
  mapto['r'] = RED;
  mapto['g'] = GREEN;
  mapto['b'] = BLUE;
  mapto['c'] = CYAN;
  mapto['m'] = MAGENTA;
  mapto['y'] = YELLOW;
  MEMSET(order, -1);
  while (scanf("%d %d", &w, &h), w|h) {
    MEMSET(visit, false);
    int sx, sy;
    REP(y, h) { scanf("%s", field[y]); }
    scanf("%s", str);
    REP(i, 6) {
      order[(int)str[i]] = i;
    }
    REP(y, h) REP(x, w) {
      if (field[y][x] == '#') {
        sx = x;
        sy = y;
        field[y][x] = 'w';
        break;
      }
    }
    queue<Dice> que;
    que.push(Dice(0, 0, 1, 2, 0, sx, sy));
    while (!que.empty()) {
      Dice dice = que.front();
      que.pop();
      //cout << dice.x << " " << dice.y << " " << dice.order << endl;
      if (dice.order == 6) {
        printf("%d\n", dice.cost);
        goto next;
      }
      REP(i, 4) {
        Dice ndice = dice;
        ndice.Rotate(i);
        if (ndice.x < 0 || ndice.x >= w || ndice.y < 0 || ndice.y >= h) { continue; }
        char f = field[ndice.y][ndice.x];
        if (f == 'k') { continue; }
        if (f != 'w' && ndice.order != order[(int)f]) { continue; }
        if (f != 'w') {
          if (mapto[(int)f] != ndice.top) { continue; }
          ndice.order++;
        }
        if (visit[ndice.order][ndice.top][ndice.front][ndice.y][ndice.x]) { continue; }
        visit[ndice.order][ndice.top][ndice.front][ndice.y][ndice.x] = true;
        que.push(ndice);
      }
    }
    puts("unreachable");
next:;
  }
}

Measured memory_bytes: 1188
#include <stdio.h>
#include <string.h>

int main(void){
	int tmp;
	int sort[100];
	char line[100][102];
	int N, L;
	int i, j;
	
	scanf("%d %d", &N, &L);
	for(i=0;i<N;i++){
		scanf("%s", line[i]);
		sort[i] = i;
	}
	for(i=1; i<N; i++){
		j = i;
		while(j > 0){
			if (strcmp(line[sort[j-1]], line[sort[j]]) > 0){
				tmp = sort[j-1];
				sort[j-1] = sort[j];
				sort[j] = tmp;
			} else {
				break;
			}
			j--;
		}
	}
	for(i=0;i<N;i++){
		printf("%s", line[sort[i]]);
	}
	printf("\n");

	return 0;
}

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

int main(){
    int ans=0,sum=0;
    bool skip=false;
    int n,m;
    string s;
    cin >>s;
    
    ans++;
    for (int i = 1; i < s.length(); i++){

        if(skip){

            ans++;

        }else{

            if(s[i-1]==s[i]){
                skip=true;
                
                if(i == s.length()-1){
                    break;
                }else {
                    i++;
                }
                ans++;

                continue;
            }else{
                ans++;
            }
        
        }
        skip=false;
    }
    


    //cout <<fixed<<setprecision(16)<< << endl;
    cout << ans << endl;

    //if(flag==1)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 640
import scala.io.StdIn.{readInt, readLine}
object Main {
    def main(args: Array[String]): Unit = {
        val len = readInt
        val arr = new Array[Card](len).map { a => 
            val line = readLine.split(" ")
            Card(line(0), line(1).toInt)
        }
        val arr2 = new Array[Card](len)
        arr.copyToArray(arr2)
        quickSort(arr)
        mergeSort(arr2)
        val q = arr.mkString("\n")
        val m = arr2.mkString("\n")
        if (q == m) println("Stable") else println("Not stable")
        println(q)
    }
    def quickSort(arr: Array[Card]): Unit = {
        def go(left: Int, right: Int): Unit = {
            if (left < right) {
                val (pivot, oneKind) = partition(arr, left, right)
                if (!oneKind) {
                    go(left, pivot - 1)
                    go(pivot + 1, right)
                }
            }
        }
        go(0, arr.length - 1)
    }
    def partition(arr: Array[Card], left: Int, right: Int): (Int, Boolean) = {
        val pivot = arr(right)
        def go(sep: Int, seek: Int, oneKind: Boolean): (Int, Boolean) = seek match {
            case s if s <= right => arr(seek) match {
                case e if e > pivot => go(sep, seek + 1, false)
                case e if e < pivot => {
                    swap(arr, sep + 1, seek)
                    go(sep + 1, seek + 1, false)
                }
                case e => {
                    swap(arr, sep + 1, seek)
                    go(sep + 1, seek + 1, oneKind)
                }
            }
            case s => (sep, oneKind)
        }
        go(left - 1, left, true)
    }
    def mergeSort(arr: Array[Card]): Unit = {
        def go(left: Int, right: Int): Unit = {
            if (left < right) {
                val mid = (left + right) / 2
                go(left, mid)
                go(mid + 1, right)
                merge(left, mid, right)
            }
        }
        def merge(left: Int, mid: Int, right: Int): Unit = {
            val tmp = arr.slice(left, mid + 1)
            var leftPtr = 0
            var rightPtr = mid + 1
            for (i <- (left to right)) {
                if (leftPtr >= tmp.length) {
                    rightPtr += 1
                } else if (rightPtr > right) {
                    arr(i) = tmp(leftPtr)
                    leftPtr += 1
                } else {
                    if (tmp(leftPtr) <= arr(rightPtr)) {
                        arr(i) = tmp(leftPtr)
                        leftPtr += 1
                    } else {
                        arr(i) = arr(rightPtr)
                        rightPtr += 1
                    }
                }
            }
        }
        go(0, arr.length - 1)
    } 

    def swap(arr: Array[Card], a: Int, b: Int): Unit = {
        val tmp = arr(a)
        arr(a) = arr(b)
        arr(b) = tmp
    }
}
case class Card(symbol: String, num: Int) {
    override def toString(): String = symbol + " " + num
    def <(a: Card): Boolean = this.num < a.num
    def <=(a: Card): Boolean = this.num <= a.num
    def >(a: Card): Boolean =  this.num > a.num
    def >=(a: Card): Boolean =  this.num >= a.num
}


Measured memory_bytes: 164908
#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<functional>
#include<algorithm>
#include<stack>
#include<queue>
#include<iomanip>
#include<set>
#include<utility>
#include<string>
#include<vector>

using namespace std;

#define LL long long

LL a, b, c;

int main() {
	cin >> a >> b >> c;
	cout << max(0ll, a - c) << " " << max(b + min(a - c, 0ll), 0ll) << endl;

	return 0;
}



Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	n := nextInt()
	x := nextInt()

	sum := 0
	cnt := 1
	for i := 0; i < n; i++ {
		sum += nextInt()
		if sum <= x {
			cnt++
		}
	}

	fmt.Println(cnt)

}

// ---- readfunc
func scanInit() {
	const cap = 64 * 1024
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1780
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#define int long long

template <class T>
bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
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 (a > b){ a = b; return 1;}return 0;}
template <class T>
void printv(vector<T> v) {for (T t : v) {cout << t << " ";}cout << '\n';}

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" <<endl;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

int main()
{
    int a1, a2, a3;
    cin >> a1 >> a2 >> a3;

    if (a1+a2+a3 >= 22) cout << "bust" << endl;
    else cout << "win" << endl;
 
    return 0;
}


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

using namespace std;
int main(){
    string s; cin>>s;
    int a,z;
    int flag=0;
    for(int i=0;i<s.length();i++){
        if(s[i]=='A' && flag==0){a=i; flag=1;}
        if(s[i]=='Z')z=i;
    }
    cout<<z-a+1<<endl;
}

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

int main()
{
  int64_t N, H, maxa = 0, ans = 0;
  cin >> N >> H;
  vector<int64_t> A(N), B(N);
  for (int i = 0; i < N; i++)
  {
    cin >> A.at(i) >> B.at(i);
    maxa = max(maxa, A.at(i));
  }
  sort(B.begin(), B.end());
  reverse(B.begin(), B.end());
  for (int i = 0; i < N; i++)
  {
    if (H <= 0)
      break;
    if (B.at(i) <= maxa)
      break;
    H -= B.at(i);
    ans++;
  }
  if (H > 0)
    ans += (H + maxa - 1) / maxa;
  cout << ans << endl;
}


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

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

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

  if (std::count(a.begin(), a.end(), 0) > 0) {
    std::cout << 0 << "\n";
    return 0;
  }

  long long prod = 1;
  for (int i = 0; i < n; i++) {
    bool overflow = __builtin_smulll_overflow(prod, a[i], &prod);
    if (overflow || prod > 1'000'000'000'000'000'000LL) {
      std::cout << -1 << "\n";
      return 0;
    }
  }
  std::cout << prod << "\n";
  return 0;
}


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

long long solve(long long N) {
    long long res = 0;
    for (long long r = 1; r*r <= N; ++r) {
        if ((N-r) % r == 0 && (N-r)/r > r) res += (N-r)/r;
    }
    return res;
}

int main() {
    long long N; cin >> N;
    cout << solve(N) << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,cc,n) for(int i=cc;i<(n);++i)
#define dreps(i,cc,n) for(int i=cc;i>(n);--i)
#define llreps(i,cc,n) for(long long i=cc;i<(n);++i)
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;


int main()
{
	char a;
	cin >> a;
	if (a >= 'a')
		cout << "a" << endl;
	else
		cout << "A" << endl;
	return 0;
}

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

using namespace std;
#define int64 long long

const int N_MAX = 200010;

int A[N_MAX], B[N_MAX];
int nNum;

inline int nextIndex(int i) {
	return i < nNum ? i + 1 : 1;
}

inline int prevIndex(int i) {
	return i > 1 ? i - 1 : nNum;
}

bool reducible(int i) {
	return B[i] - A[i] >= B[nextIndex(i)] + B[prevIndex(i)];
}

void outerInit() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	auto fi = new ifstream("test.inp");
	if (*fi) {
		cin.rdbuf(fi->rdbuf());
	}
}

void readData() {
	cin >> nNum;
	for (int i = 1; i <= nNum; ++i) cin >> A[i];
	for (int i = 1; i <= nNum; ++i) cin >> B[i];
}

void solveData() {
	set<int> reducibleIndices;
	for (int i = 1; i <= nNum; ++i) {
		if (reducible(i)) {
			reducibleIndices.insert(i);
		}
	}

	int64 result = 0;
	while (!reducibleIndices.empty()) {
		int i = *reducibleIndices.begin();
		reducibleIndices.erase(reducibleIndices.begin());

		int in = nextIndex(i);
		int ip = prevIndex(i);
		int ac = B[in] + B[ip];
		int nStep = (B[i] - A[i]) / ac;
		result += nStep;
		B[i] -= nStep * ac;

		if (reducible(in)) {
			reducibleIndices.insert(in);
		}
		if (reducible(ip)) {
			reducibleIndices.insert(ip);
		}
	}

	for (int i = 1; i <= nNum; ++i) {
		if (A[i] != B[i]) {
			cout << "-1\n";
			return;
		}
	}

	cout << result << "\n";
}

int main() {
	outerInit();

	readData();
	solveData();
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repA(i,a,b) for(int i=a;i<=b;i++)
#define repD(i,b,a) for(int i=b;i>=a;i--)
#define fill(a) memset(a,0,sizeof(a))
#define f first
#define s second
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
int main()
{
    int n;
    cin>>n;
    int t=n/500;
    t*=1000;
    n%=500;
    int t2=n/5;
    t2*=5;
    cout<<t+t2<<endl;
    return 0;
}


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

using namespace std;

int a, b, c, d;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie();
    cout.tie();

    cin >> a >> b >> c >> d;

    cout << max(a * b, c * d) << endl;

    return 0;
}


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

//2のN乗を求める計算
ll kai(ll N) {
  ll ans = 1;
  int i = 0;
  while (i < N) {
    ans = ans * 2;
    i++;
  }
  return ans;
}

int main() {
  ll H;
  cin >> H;
  ll count = 0;
  while (H >= 1) {
    count++;
    H = H/2;
  }
  cout << 2*kai(count-1)-1 << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int x,y,z;
    while (1){
            scanf("%d %d",&x,&y);
            if ( x == 0&&y == 0)
                break;
            if (x > y){
                z = x;
                x = y;
                y = z;}

                printf("%d %d\n",x,y);




    }



return 0;
}

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

string s;
ll k;
    
int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    cin >> s >> k;
    int n = s.size();

    for (int i = 0; i < n; i++) {
        if (s[i] == 'a') continue;
        int cost = 26 - (s[i] - 'a');
        // cout << i << " " << cost << " " << k << '\n';
        if (cost <= k) {
            s[i] = 'a';
            k -= cost;
        }
    }
    
    k %= 26;
    s[n - 1] = s[n - 1] + k;
    cout << s;
}   



Measured memory_bytes: 592
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>
#define FASTIO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define rep(i, l, r) for (ll i = (l); i < (r); ++i)
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define pii pair<ll, ll>
#define pll pair<ll, ll>
#define pli pair<ll, ll> 
#define pdd pair<ld, ld> 
#define pb push_back
#define reset(x,v) memset(x,v,sizeof(x))
#define mod 1000000007
using namespace std;
bool poss(int a[], int n, int mid, int k){
	if(mid == 0)
	return true;
	int c = 0;
	rep(i, 0, n){
		int z = a[i] / mid + (a[i] % mid == 0 ? -1 : 0);
		c += z;
	}	
	return c <= k;
}
int main(){
	FASTIO
	int n, k;
	cin >> n >> k;
	int a[n];
	rep(i, 0, n)
		cin >> a[i];
	int lo = 0, hi = *max_element(a, a + n), ans = *max_element(a, a + n);
	while(lo <= hi){
		int mid = (lo + hi) / 2;
		if(poss(a, n, mid, k)){
			hi = mid - 1;
			ans = mid;
		} else{
			lo = mid + 1;
		}
	}
	cout << max(ans, 1);
    return 0;
}

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

int main(){

    int N;
    char color;
    int i,j,k;
    int P=0,W=0,G=0,Y=0;

    cin >> N;

    for(i=0;i<N;i++){
        cin >> color;
        if(color == 'P')P=1;
        if(color == 'W')W=1;
        if(color == 'G')G=1;
        if(color == 'Y')Y=1;
    }

    if(P+W+G+Y == 4)cout << "Four" << endl;
    else cout << "Three" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
typedef long long ll;
typedef double dd;
#define For(i,j,k) for (int i=(int)j;i<=(int)k;++i)
#define Forr(i,j,k) for (int i=(int)j;i>=(int)k;--i)
#define Set(a,p) memset(a,p,sizeof(a))
using namespace std;

template<typename T>bool chkmax(T &a,T b) { return a<b?a=b,1:0; }
template<typename T>bool chkmin(T &a,T b) { return a>b?a=b,1:0; }

const int maxn=45;
const int maxN=(1<<18);
const int modd=1e9+7;
int n,x,y,z;
int Ans=1;
int dp[maxn][maxN];

inline void file() {
	freopen("ARC058E.in","r",stdin);
	freopen("ARC058E.out","w",stdout);
}

int main() {
//	file();
	scanf("%d%d%d%d",&n,&x,&y,&z);
	int limit=(1<<(z-1))|(1<<(y+z-1))|(1<<(x+y+z-1));
	dp[0][0]=1;
	int N=1<<(x+y+z);
	For (i,0,n-1) For (j,0,N-1) if (dp[i][j]) {
		For (k,1,10) {
			int s=(j<<k)|(1<<(k-1)); s&=N-1;
			if ((s&limit)!=limit) (dp[i+1][s]+=dp[i][j])%=modd;
		}
	}
	For (i,1,n) Ans=10ll*Ans%modd;
	For (i,0,N-1) (Ans+=modd-dp[n][i])%=modd;
	printf("%d",Ans);
	return 0;
}

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

int main() {
  string S;
  cin >> S;
  
  if(S.at(2)==S.at(3) && S.at(4)==S.at(5)){
    cout << "Yes" << endl;}
  
  else{cout << "No" << endl;}
  
  
}

Measured memory_bytes: 3596