akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
using namespace std;

#define ll long long
#define INF (1 << 30)
#define INFLL (1LL << 60)

#define FOR(i,a,b) for(ll i = (a);i<(b);i++)
#define REP(i,a) FOR(i,0,(a))
#define MP make_pair

int main() {
	pair<int, int> box[100010];
	int n, a, b;
	ll k;
	cin >> n >> k;
	for(int i = 0;i < n;i++){
		cin >> a >> b;
		box[i] = MP(a, b);
	}
	sort(box, box + n);

	ll sum = 0, before;
	for(int i = 0;i < n;i++){
		before = sum;
		sum += box[i].second;
		if(before < k && k <= sum){
			cout << box[i].first << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int n,m,i,j,dis[100005],rt,x,y,deg[100005],pre[100005];
vector<int> adj[100005];
void bfs(int x)
{
	int i;
	queue<int> q;
	q.push(x);
	while (!q.empty())
	{
		x=q.front();q.pop();
		for (i=0;i<adj[x].size();i++)
		{
			deg[adj[x][i]]--;
			if (!deg[adj[x][i]])
			{
				pre[adj[x][i]]=x;
				q.push(adj[x][i]);
			}
		}
	}
}
int main()
{
	scanf("%d%d",&n,&m);
	for (i=1;i<n+m;i++)
	{
		scanf("%d%d",&x,&y);
		adj[x].push_back(y);
		deg[y]++;
	}
	for (i=1;i<=n;i++) if (!deg[i]) rt=i;
	bfs(rt);
	for (i=1;i<=n;i++) printf("%d\n",pre[i]);
	return 0;
}

Measured memory_bytes: 7040
s=input()
n=len(s)
i=0
a=0
ans=0
while i<n:
    if s[i]=="A":
        a+=1
        i+=1
    elif i<n-1 and s[i:i+2]=="BC":
        ans+=a
        i+=2
        while i<n:
            if s[i]=="A":
                a+=1
                i+=1
            elif i<n-1 and s[i:i+2]=="BC":
                ans+=a
                i+=2
            else:
                a=0
                i+=1
                break
    else:
        i+=1
        a=0
print(ans)

Measured memory_bytes: 3500
#include <bits/stdc++.h> 
using namespace std;
const long INF=1000000000000000;
const long MOD=1000000007;

long dis(long a,long b,long c){
    return max(a,max(b,c))-min(a,min(b,c));
}

int main() {
    long N,M;
    cin>>N>>M;
    vector<long> ans(N+1,0);
    
    for(int i=0;i<M;i++){
        long a,b;
        cin>>a>>b;
        
        ans.at(a)++;
        ans.at(b)++;
    }
    
    for(int i=1;i<=N;i++)cout<<ans.at(i)<<endl;
}


Measured memory_bytes: 256
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i==n-1];};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll H[100010];
    rep(i,0,N) cin >> H[i];
    ll ans = 0;
    ll cnt = 0;
    rrep(i,N-2,0){
        if(H[i] >= H[i+1]){
            cnt++;
        }else{
            cnt = 0;
        }
        ans = max(ans, cnt);
    }
    print(ans);
    
}

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




int main(){
  long n,m;
  cin>>n>>m;
  if(abs(n-m)>=2){
    cout <<0;
    return 0;
  }
  long long ans=1;
  if(abs(n-m)==1){
    ans=max(n,m);
  }
  else{
    ans=2;
  }
  long long  l=min(n,m); 
  for(int i=1;i<=l;i++){
    ans*=i;
        ans%=1000000000+7;
    ans*=i;
    ans%=1000000000+7;
  }
  cout <<ans;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.MathContext;
public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        BigDecimal bm = new BigDecimal(line);
        BigDecimal circum = new BigDecimal(bm.toPlainString());
        circum = circum.multiply(new BigDecimal(2),MathContext.DECIMAL64).multiply(new BigDecimal(Math.PI),MathContext.DECIMAL64);
        BigDecimal area = bm.multiply(bm,MathContext.DECIMAL64).multiply(new BigDecimal(Math.PI),MathContext.DECIMAL64);

        circum = circum.setScale(6,BigDecimal.ROUND_HALF_UP);
        area = area.setScale(6,BigDecimal.ROUND_HALF_UP);
        System.out.println( area.toPlainString() + " " + circum.toPlainString());
    }
}

Measured memory_bytes: 17132
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <functional>
#include <stack>
#include <utility>
#include <map>
#include <queue>
#include <set>
#include <array>
#include <climits>
#include <cassert>

using namespace std;

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

const ll MOD = ll(1e9) + 7;
const ll INF = LLONG_MAX;
const ll MAX_N = ll(1e5) + 5;
const double EPS = 10e-8;
const double PI = 3.14159265359;

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)

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

int main() {
    int n, ans = 1;
    cin >> n;
    while(ans*2<=n)ans*=2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<unordered_map>
#include<bitset>
#include<math.h>
#include<vector>
#include<set>
#include<algorithm>
#include<ctype.h>
#include<unordered_set>
#include<string>
#include<iomanip>
#include<queue>
#include<limits>
#include<map>
#include<stack>
#include<iterator>
#include<cstring>
 
#include<deque>
#define pi 3.141592653589793238
#include<chrono>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define MOD 1000000007
#define INF 999999999999999999 
#define pb push_back
#define ff first
#define ss second
 
#define mt make_tuple
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
 
 
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fast;
    ll T = 1, i, j;
    
    //cin >> T;
    while (T--) {
        ll a,b, m;
        cin >> a >> b >> m;
        vector<ll> v1(a), v2(b);
        ll minf = INF, minm = INF;
        for(i = 0; i < a; i++){
            cin >> v1[i];
            minf = min(minf, v1[i]);
        }
        for(i = 0; i < b; i++){
            cin >> v2[i];
            minm = min(minm, v2[i]);
        }
        ll ans;
        ans = minf + minm;
        for(i = 0; i < m; i++){
            ll x , y, c;
            cin >> x >> y >> c;
            x--,  y--;
            ll val = max(0LL, v1[x] + v2[y] - c);
            ans = min(ans, val);
        }
        cout << ans;
    }
    return 0;
}

Measured memory_bytes: 4780
#include<iostream>
#include<cstdio>

using namespace std;
const int MAXN=1e5+5;
int a[MAXN];
bool vis[MAXN];
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	int t=1,cnt=0;
	vis[1]=1;
	while(1){
		if(a[t]==2){
			cnt++;
			cout<<cnt<<endl;
			return 0;
		}
		int h=a[t];//可以被点亮的灯 
		if(vis[a[h]]){
			cout<<-1<<endl;
			return 0;
		}
		else {
			cnt++;
			t=a[t];
			vis[h]=1;
		}
	}
	return 0;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
# define ll long long
# define int long long  //comment it out when MLE
//# define endl "\n"
#define gok ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
# define mo 1000000009
# define pi acos(-1)
# define fi first
# define se second
using namespace std;


signed main()
{
    gok
    int n;
    cin>>n;
    bool ch=false;
    while(n!=0)
    {
        if(7==n%10)
            ch=true;
        n/=10;
    }
    if(ch)
        cout<<"Yes";
    else
        cout<<"No";











      return 0;
    }


Measured memory_bytes: 3648
#include <bits/stdc++.h>
    
#define int long long

#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define FORR(i,m,n) for(int i=m;i>=n;i--)
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y) 
#define SORT(x) sort((x).begin(),(x).end())
#define INF 99999999999
#define MOD (int)(1e9)+7

using namespace std;

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

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

    if(n>m+1 || m>n+1){
        cout << 0 << endl;
        return 0;
    }

    int ans=1;
    FOR(i, 2, n+1){
        ans*=i;
        ans%=MOD;
    }

    FOR(i, 2, m+1){
        ans*=i;
        ans%=MOD;
    }

    if(m==n){
        ans*=2;
        ans%=MOD;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
    int card[4][13];
    int i,j,n,x;
    char mark;
    
    for(i=0;i<4;i++){
       for (j=1; j<14; j++) {
         card[i][j]=0;
    }}
           
    scanf("%d",&n);
    for(i=0;i<n;i++){
    scanf(" %c %d",&mark,&x);
    switch(mark){
    case 'S': card[0][x]=1;
            break;
    case 'H': card[1][x]=1;
            break;
    case 'C': card[2][x]=1;
            break;
    case 'D': card[3][x]=1;
            break;
    }
    }
    for(i=0;i<4;i++){
    for (j=1; j<14; j++) {
        if(card[i][j]==0){
            if(i==0)
                printf("S %d\n",j);
            else if(i==1)
                printf("H %d\n",j);
            else if(i==2)
                printf("C %d\n",j);
            else if(i==3)
                printf("D %d\n",j);
        }
    }
    }
    return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <vector>
#include <string>
#define ll long long
using namespace std;

ll mod=1000000007;
ll pow3[100010];
string L;

ll solve(int key){
    if(key==L.size()) return 1;
    if(L[key]=='0') return solve(key+1);
    return (pow3[L.size()-key-1]+2*solve(key+1))%mod;
}

int main() {
	cin >> L;
	pow3[0]=1;
	for(int i=1; i<100010; ++i) pow3[i]=(pow3[i-1]*3)%mod;
	cout << solve(0) << endl;
	return 0;
}


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

int main(){
	char input[21];
	char po;
	int i = 0;
	int b = 0;
	int check = 0;

	while(cin >> input){
			i = 0; b = 0; check = 0;
		while(1){
			if(b == 0 && input[i] == 'A'){
				po = input[i];
				b = 1;
			}else if(b == 1 && input[i] == 'Z'){
				cout << po << input[i];
				check = 1;
				b = 0;
			}
			if(input[i] == '\0') break;
			i++;
			
		}
		if(check == 0) cout << -1;
		cout << endl;
	}

}

Measured memory_bytes: 1140
# -*- coding: utf-8 -*-
import heapq
import math

def permutations(iterable, r=None):
    # permutations('ABCD', 2) --> AB AC AD BA BC BD CA CB CD DA DB DC
    # permutations(range(3)) --> 012 021 102 120 201 210
    pool = tuple(iterable)
    n = len(pool)
    r = n if r is None else r
    if r > n:
        return
    indices = list(range(n))
    cycles = list(range(n, n-r, -1))
    yield tuple(pool[i] for i in indices[:r])
    while n:
        for i in reversed(range(r)):
            cycles[i] -= 1
            if cycles[i] == 0:
                indices[i:] = indices[i+1:] + indices[i:i+1]
                cycles[i] = n - i
            else:
                j = cycles[i]
                indices[i], indices[-j] = indices[-j], indices[i]
                yield tuple(pool[i] for i in indices[:r])
                break
        else:
            return

tmp = input()
N, M, R = [int(a) for a in tmp.split()]
tmp = input()
mokutekis = [int(a) for a in tmp.split()]
Rs = []
for i in range(M):
    tmp = input()
    Rs.append([int(a) for a in tmp.split()])

roots = {}
for a, b, dist in Rs:
    roots[(a, b)], roots[(b, a)] = dist, dist

minimums = {}
for i in range(1, N+1):
    minimums[(i, i)] = 0
for m in mokutekis:
    tmp_mins = {}
    merged = [False for i in range(N+1)]
    merged[m] = True
    merged_num = 1
    now = m
    while merged_num < N:
        minimum = [None, None]
        for i in range(1, N+1):
            if merged[i]:
                continue
            if (now, i) not in roots:
                new_dist = 100000*200+1
            else:
                new_dist = minimums[(m, now)] + roots[(now, i)]
            if (m, i) not in tmp_mins or tmp_mins[(m, i)] > new_dist:
                tmp_mins[(m, i)] = new_dist
                tmp_mins[(i, m)] = new_dist
            if minimum[0] is None or minimum[1] > tmp_mins[(m, i)]:
                minimum = i, tmp_mins[(m, i)]
        minimums[(m, minimum[0])], minimums[(minimum[0], m)] = minimum[1], minimum[1]
        now = minimum[0]
        merged[now] = True
        merged_num += 1

d_min = None
for perm in permutations(range(len(mokutekis))):
    perm = list(perm)
    d = 0
    d_max = None
    for p1, p2 in zip(perm, perm[1:]+[perm[0]]):
        m1, m2 = mokutekis[p1], mokutekis[p2]
        now_d = minimums[(m1, m2)]
        if d_max is None or d_max < now_d:
            d_max = now_d
        d += now_d
    d -= now_d
    if d_min is None or d_min > d:
        d_min = d
print(d_min)


Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define pri_que priority_queue
#define vint vector<int>
#define vvint vector<vector<int>>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vs vector<string>
#define vvc vector<vector<char>>
#define vc vector<char>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define show(x) cout<<#x<<"="<<x<<endl;
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e15;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    string s; cin >> s;
    cout<<s.substr(0,4)<<' '<<s.substr(4,8)<<endl;
}

Measured memory_bytes: 3632
import java.math.BigInteger;

public class Main {
	public static void main(String[] args) {
		var sc = new java.util.Scanner(System.in);
		var n = sc.nextInt();
		var a = new int[n];
		var counter = new BigInteger[100001];
		for(int i=0;i<counter.length;i++) {
			counter[i]=BigInteger.ZERO;
		}
		for(int i=0;i<a.length;i++) {
			var ae = sc.nextInt();
			counter[ae]=counter[ae].add(BigInteger.ONE);
		}
		var q = sc.nextInt();
		var b = new int[q];
		var c = new int[q];
		BigInteger sum = BigInteger.ZERO;
		for(int k=0;k<counter.length;k++) {
			if(!counter[k].equals(BigInteger.ZERO)) {
				sum = sum.add(BigInteger.valueOf(k).multiply(counter[k]));
			}
		}
		for(int i=0;i<q;i++) {
			b[i]=sc.nextInt();
			c[i]=sc.nextInt();
		}
		for(int i=0;i<q;i++) {
			if(!counter[b[i]].equals(BigInteger.ZERO)) {
				sum = sum.subtract(BigInteger.valueOf(b[i]).multiply(counter[b[i]]));
				sum = sum.add(BigInteger.valueOf(c[i]).multiply(counter[b[i]]));
				counter[c[i]] = counter[c[i]].add(counter[b[i]]);
				counter[b[i]] = BigInteger.ZERO;
			}
			System.out.println(sum);
		}
	}
}

Measured memory_bytes: 72028
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
// #pragma comment(linker,"/stack:200000000")
#include <bits/stdc++.h>
using namespace std;

#define PI 2*acos(0.0)
#define print(x) return cout<<x<<endl,0
#define watch(x) cerr<<#x<<"-> "<<x<<endl
#define CLEAR(x,val) memset(x,val,sizeof(x))
// #define int long long

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;

const int INF = 1000000000;
const int MOD = 1000000007; //998244353

signed main()
{	
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	cin.tie(0), cout.tie(0);
	ios::sync_with_stdio(0);
	int n;
	cin >> n;
	string s;
	cin >> s;
	for(char c : s)
	{
		int cur = (c-'A'+n)%26;
		cout<<(char)(cur+'A');
	}	
	cout<<endl;
	return 0;
}

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

from collections import deque

def main():
    N = int(input())
    A = [int(input()) for _ in range(N)]
    A.sort()
    A = deque(A)

    lnow = A.pop()
    rnow = lnow
    ret = 0
    while len(A)>0:
        lnxt = A[0]
        rnxt = A[-1]
        ll = abs(lnow - lnxt)
        rl = abs(rnow - lnxt)
        lr = abs(lnow - rnxt)
        rr = abs(rnow - rnxt)
        mx = max(ll, rl, lr, rr)
        ret += mx
        if mx == ll:
            lnow = lnxt
            x = A.popleft()
        elif  mx == rl:
            rnow = lnxt
            x = A.popleft()
        elif  mx == lr:
            lnow = rnxt
            x = A.pop()
        elif  mx == rr:
            rnow = rnxt
            x = A.pop()

    print(ret)


if __name__ == '__main__':
    main()

Measured memory_bytes: 13916
from collections import Counter

N = int(input())
sl = []
for i in range(N):
    sl.append(input())
C_sl = Counter(sl)
#print(C_sl)

print(f'AC x {C_sl["AC"]}')
print(f'WA x {C_sl["WA"]}')
print(f'TLE x {C_sl["TLE"]}')
print(f'RE x {C_sl["RE"]}')

Measured memory_bytes: 16536
#include <stdio.h>
#include <stdbool.h>

int main()
{
   int N;
   scanf("%d", &N);

   long int H[N];
   for (int i = 0; i < N; i++)
      scanf("%ld", &H[i]);

   bool flag = true;
   int max = H[0];

   if (N > 2) {
      for (int i = 1; i <= N; i++) {
         if (H[i] > max) {
            max = H[i];
         } else if (H[i] < max) {
            if (H[i]  !=  max-1) 
               flag = false;
         }
      }
   }


   if (flag)
      printf("Yes\n");
   else
      printf("No\n");

   return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for(int i = 0; i < N; i++){
    cin >> vec.at(i); 
  }
  sort(begin(vec), end(vec));
  int m = 0, n = 0, j;
  vector<int> sum1, sum2;
  for(j = 0; j < N; j++){
    if(j % 2 == 0){
      m = m + vec.at(j);
    }
    else{
      n = n + vec.at(j);
    }
  }
  if(m - n <= 0){
    cout << n - m << endl;
  }
  else{
    cout << m - n << endl;
  }
  return 0;
}

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

int main() {
  int N, M;
  cin >> N;
  vector<int> p(N);
  vector<string> s(N);
  for(int i = 0; i < N; i++)
    cin >> s.at(i);
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < N; j++) {
      if ( s.at(i) == s.at(j) )
        p.at(i)++;
    }
  }
  cin >> M;
  vector<string> t(M);
  for(int i = 0; i < M; i++)
    cin >> t.at(i);
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < M; j++) {
      if ( s.at(i) == t.at(j) )
        p.at(i)--;
    }
  }
  int max = 0;
  for(int i = 0; i < N; i++)
    if(p.at(i) > max)
      max = p.at(i);
  cout << max << endl;
}

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

int main() {
	
	int x, t;
	cin >> x >> t;
	cout << max(0, x-t) << endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize "-O3"
#pragma GCC target ("avx")
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define inf (1ll<<60)
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v),greater<int>())
#define SPEED ios::sync_with_stdio(false);cin.tie(0);cout<<fixed<<setprecision(12);
signed gcd(int a, int b){return b?gcd(b,a%b):a;}
signed lcm(int a,int b){return a*b/gcd(a,b);}
//priority_queue<int, vector<int>, greater<int> > que; //昇順

using namespace std;

const int mod=1e9+7;

signed main(){
    SPEED
    int n;
    cin >> n;
    int a = n % 111;
    if(a==0)
    {
        cout << n << endl;
        return 0;
    }
    int c=0;
    while(a<111)
    {
        ++a;
        ++c;
    }
    cout << n + c << endl;
}


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(deprecated)]

use std::cell::{Cell, Ref, RefCell, RefMut};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;
use std::usize;

const MOD_10_9_7: u64 = 1_000_000_007;
const INF: i64 = 1_000_000_000_000;
const MIN_INF: i64 = -1_000_000_000_000;

/// FYI: https://github.com/vain0x/scan-bench
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}

#[allow(unused_macros)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn main() {
    let n = read!(usize);
    if n <= 999 {
        println!("ABC");
    } else {
        println!("ABD");
    }
}


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

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

  int a[300010];
  for (int i = 0; i < 3 * N; i++) {
    cin >> a[i];
  }

  sort(a, a + 3 * N);

  long ans = 0;
  for (int i = 1; i <= N; i++) {
    ans += a[3 * N - 2 * i];
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1408
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())





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

	int a, b;
	cin >> a >> b;


	cout << max(0, a - 2 * b) << endl;



	return 0;
}

Measured memory_bytes: 892
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <math.h>
#include <algorithm>
#include <deque>
#include <climits>

using namespace std;
#define ll long long
#define ve vector
#define umap unordered_map

int main() {
    string s;
    cin>>s;
    int ans=0;
    for(int i=1;i<s.size();i++) {
        if(s[i]!=s[i-1]) ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 512
import scala.io.Source.stdin

object Main {
  def getSum(i:Int,a:Int,b:Int,sum:Int):Int =
    if(i<0) sum else getSum(i-1,(a%b)*10,b,sum+(a/b))

  def main(args:Array[String]) = {
    stdin.getLines.foreach { s =>
      val n = s.split(" ").map(_.toInt)
      val a = if(n(0) >= n(1)) n(0)-(n(0)/n(1))*n(1) else n(0)
      println(getSum(n(2),a,n(1),0))
    }
  }
}

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

int main() {
  int N;
  cin >> N;
  vector<int> v(N);
  for (int i = 0;i < N;i++) {
    cin >> v.at(i);
  }
  int count = 0;
  bool finished = false;
  for (int j = 0;j <2;) {
    for (int i=0;i < N;i++) {
      if (v.at(i) % 2 == 0) {
        v.at(i) /= 2;
        continue;
      }
      else {
        finished = true;
        break;
      }
    }
    if (finished) {
      break;
    }
    count++;
  }
  cout << count <<endl;
}
    
    


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a,b[200010];
long long sum;
int main(){
	scanf("%d",&a);
	for(int i=1;i<=a;i++){
		scanf("%d",&b[i]);
		b[i]-=i;
	}
	sort(b+1,b+a+1);
	if(a%2==0){
		for(int i=1;i<=a;i++){
			sum+=abs(b[i]-b[a/2]);
		}
		cout<<sum;
	}
	else{
		for(int i=1;i<=a;i++) {
			sum+=abs(b[i]-b[(a+1)/2]);
		}
		cout<<sum;
	}
}
	


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define R(n)for(L i=0;i<n;i++)
#define M make_pair
typedef long long L;using namespace std;int main(){L n,k,s,t,a[50];cin>>n>>k>>s>>t;R(n)cin>>a[i];map<pair<L,L>,L> p[50];R(n){for(L j=k-2;j+1;j--)for(auto&l:p[j])p[j+1][M(l.first.first&a[i],l.first.second|a[i])]+=l.second;p[0][M(a[i],a[i])]=1;}n=0;R(k)n+=p[i][M(s,t)];cout<<n;}

Measured memory_bytes: 154004
# -*- coding: utf-8 -*-
from math import pi,cos,sin

A,B,H,M = list(map(int, input().rstrip().split()))
#-----

degree_A = (H*60+M) * (2*pi/(12*60))
degree_B = M * (2*pi/60)

degree_AB = min( abs(degree_A - degree_B) , (2*pi - abs(degree_A - degree_B)) )

ans = ( A**2 + B**2 - 2*A*B*cos(degree_AB) )**0.5
print(ans)


Measured memory_bytes: 9456
#include <iostream>
#include <algorithm>
using namespace std;
using Int = long long;
int main() {
    Int N, A, B, X1, ans = 0;
    cin >> N >> A >> B >> X1;
    for (Int i = 1, X2; i < N; i++) {
        cin >> X2;
        ans += min(A * (X2 - X1), B);
        X1 = X2;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int i,j,n,taro_p=0,hana_p=0;
  char taro[101], hana[101];

  scanf("%d", &n);

  for(i=0;i<n;i++){
    scanf("%s %s", taro, hana);

    for(j=0;;j++){
      if(taro[j] > hana[j]){
        taro_p += 3;
        break;
      }else if(taro[j] < hana[j]){
        hana_p += 3;
        break;
      }else if(taro[j] + hana[j] == 0){
        hana_p++;
        taro_p++;
        break;
      }
    }
  }

  printf("%d %d\n", taro_p , hana_p);
  return 0;
}


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

int main() {
	string s;
	int day=0;
	cin>>s;///, , , , , , or , 
	
	if(s.compare("SAT") == 0)
	 day = 1;
	 
	 else if(s.compare("SUN") == 0)
	 day = 7;
	 
	 else if(s.compare("MON") == 0)
	 day = 6;
	 
	 else if(s.compare("TUE") == 0)
	 day = 5;
	 
	 else if(s.compare("WED") == 0)
	 day = 4;
	 
	  else if(s.compare("THU") == 0)
	 day = 3;
	 
	  else if(s.compare("FRI") == 0)
	 day = 2;
	 
	cout<<day<<endl;
	return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(m)]

C, D = set(), set()
for a, b in AB:
  if a == 1:
    C.add(b)
  elif b == n:
    D.add(a)

if len(C & D):
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')

Measured memory_bytes: 37168
#include <iostream>
#include <cstdint>
#include <list>
#include <vector>

template<typename T>
std::ostream& operator<<(std::ostream &os, const std::vector<T> &v)
{
  for (typename std::vector<T>::size_type i = 0; i < v.size(); ++i) {
    os << v[i];
    if (i + 1 < v.size()) { os << ' '; }
  }
  return os;
}

struct ListItem {
  uint64_t a, b;
  ListItem(uint64_t a, uint64_t b) : a(a), b(b) {}
};

int main()
{
  uint64_t N, T;
  std::cin >> N >> T;
  
  std::vector<uint64_t> t(N);
  for (uint64_t n = 0; n < N; ++n) {
    std::cin >> t[n];
  }
  
  std::list<ListItem> ls;
  uint64_t a = 0, b = 0;
  for (uint64_t n = 0; n < N; ++n) {
    if (b < t[n]) {
      ls.emplace_back(a, b);
      a = t[n];
      b = t[n] + T;
    } else {
      b = t[n] + T;
    }
  }
  ls.emplace_back(a, b);
  
  uint64_t S = 0;
  for (const ListItem &item : ls) {
    S += item.b - item.a;
  }
  std::cout << S << std::endl;
  
  return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef string st;
typedef double db;
typedef vector<long long> vecll;
typedef vector<char> vechar;
typedef vector<string> vecst;

int main(){
    st S;
    cin >> S;

    vecll abc(26);
    for(auto& i : S) abc.at(i - 'a') = 1;
    for(ll i = 0; i < 26; i++){
        if(abc.at(i) == 0) {
            cout << (char)(i + 'a') << endl;
            break;
        }
        if(i == 25) cout << "None" << endl;
    }
}

Measured memory_bytes: 512
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();
     int c=sc.nextInt();
     System.out.print(a+b>c-1?b+c:a+2*b+1);
   }
 }

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); ++i)
#define reps(i,f,n) for(int i=(f); i<=(n); ++i)
#define outl(x) cout<< (x) << '\n'
#define FAST() cin.tie(0), ios::sync_with_stdio(false)

void print(int *a, int n)
{
    rep(i, n-1)cout << a[i] << ' ';
    cout << a[n-1] << '\n';
}

void insertion_sort(int *a, int n)
{
    print(a, n);
    for(int i=1; i<n; i++){
        const int v = a[i];
        int j;
        for(j=i-1; j>=0 && a[j]>v; --j)
            a[j+1] = a[j];
        a[j+1] = v;
        print(a, n);
    }
}

int main()
{
    FAST();
    int N, a[101];

    cin >> N;
    rep(i, N)cin >> a[i];
    insertion_sort(a, N);
}

Measured memory_bytes: 3140
#include<bits/stdc++.h>
using namespace std;
#define A(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
void _read();

using pi = pair<int,int>;
#define x first
#define y second
#define int long long

int dis( const pi &a, const pi &b) {
      return abs(a.first-a.second) + abs(b.first-b.second);
}
main () { _read(); 

      int n;
      cin >> n;
      vector<int> a(n),b(n);
      for( int i = 0; i < n; i++) {
            int x,y;
            cin >> x >> y;
            a[i] = x + y;
            b[i] = x - y;
      }
      int x = *max_element(A(a)) - *min_element(A(a));
      int y = *max_element(A(b)) - *min_element(A(b));
      cout << max(x,y) << '\n';
};

void _read() {
      ios_base :: sync_with_stdio(false);
      cin.tie(NULL);
      #ifdef LOCAL
      freopen("input.txt","r",stdin);
      #endif
}


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

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

using namespace std;
using lint=long long;

int main(){
	lint h,w; cin>>h>>w;
	cout<<(min(h,w)==1?1:(h*w+1)/2)<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define X first
#define Y second
#define pb emplace_back
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define EFOR(i,a,b) for(int (i)=(a);i<=(b);++(i))
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef ll LL;
typedef pii PII;
typedef pll PLL;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
const ll MOD=1e9+7;

int N;
LL A[114514];
LL B[114514];
vector<int> ps;

int main() {
  scanf("%d", &N);
  rep(i, N) {
    scanf("%lld%lld", &A[i], &B[i]);
    ps.eb(i);
  }
  sort(all(ps), [](int a, int b){return A[a]+B[a] > A[b]+B[b];});

  LL ans = 0;
  rep(i, N) {
    int idx = ps[i];
    if (i%2 == 0) ans += A[idx];
    else ans -= B[idx];
  }
  printf("%lld\n", ans);
}


Measured memory_bytes: 2296
while True:
 (m,f,r)=[int(i) for i in input().split()]
 if m == f == r == -1:
   break

 s = m + f
 if m == -1 or f == -1 or s < 30: 
        print('F')
 elif s < 50 and r < 50: 
        print('D')
 elif s < 65: 
        print('C')
 elif s < 80:
        print('B')
 else:
        print('A')
 

Measured memory_bytes: 7640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		new Main().start();
	}
	void start(){
		Scanner in = new Scanner(System.in);
		final int N = in.nextInt();
		final long P = (long)(in.nextInt());
		boolean a[] = new boolean[N];
		for(int i = 0; i < N;i++){
			a[i] = in.nextInt()%2==0;
		}

		long gusuKosu = 0l;
		for(boolean b : a){
			if(b) gusuKosu++;
		}
		long kisuKosu = (long)(a.length) - gusuKosu;

		long result = 0;
		for(long i = P; i <= kisuKosu; i+=2){
			result += combination(kisuKosu, i);
		}
		long result2 = 0;
		for(long i = 0; i <= gusuKosu; i++){
			result2 += combination(gusuKosu, i);
		}
		System.out.println(result * result2);
		in.close();

	}
//	long combination(long n, long r){
//		long a = 1;
//		for(long i = n; i > n-r; i--){
//			a *= i;
//		}
//		for(long i = 1; i <= r; i++){
//			a /= i;
//		}
//		return a;
//	}
	long combination( long n, long m ) {
	    if( n < m || m < 0 ) {
	        throw new IllegalArgumentException( "引数の値が不正です ( n : " + n + ", m : " + m + ")" );
	    }
	    long c = 1;
	    m = ( n - m < m ? n - m : m );
	    for( long ns = n - m + 1, ms = 1; ms <= m; ns ++, ms ++ ) {
	        c *= ns;
	        c /= ms;
	    }
	    return c;
	}


}


Measured memory_bytes: 24148
#include<bits/stdc++.h>
#define N 200050
#define int long long
#define pb push_back
#define x first
#define y second
#define all(v) v.begin(),v.end()
#define coffee prince
#define sz(a) (int)a.size()
#define ll long long
#define SIZE N
using namespace std;
int n,sz[N],dp[N],u,v,par[N],ans[N],chsz[N],fin[N];
vector< vector< int > > adj(N);

int mod = 1e9 + 7;
int MOD = mod;
int fast_exp(int base,int ex) {
    int res=1;
    while(ex>0) {
       if(ex%2==1) res=(res*base)%mod;
       base=(base*base)%mod;
       ex/=2;
    }
    return res%mod;
}

ll inv[SIZE],fac[SIZE],finv[SIZE];
void make()
{
	fac[0]=fac[1]=1;
	finv[0]=finv[1]=1;
	inv[1]=1;
	for(int i=2;i<SIZE;i++)
	{
		inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
		fac[i]=fac[i-1]*(ll) i%MOD;
		finv[i]=finv[i-1]*inv[i]%MOD;
	}
}
ll C(int a,int b)
{
	if(a<b) return 0;
	return fac[a]*(finv[b]*finv[a-b]%MOD)%MOD;
}
void dfs(int root){
    for(auto ch:adj[root]){
        if(ch==par[root])continue;
        par[ch] = root;
        dfs(ch);
        sz[root] += sz[ch];
    }
    dp[root] = fac[sz[root]];
    for(auto ch : adj[root]){
        if(ch==par[root])continue;
        dp[root] *= finv[sz[ch]];
        if(dp[root]>=mod)dp[root]%=mod;
        dp[root]*=dp[ch];
        if(dp[root]>=mod)dp[root]%=mod;
    }
    sz[root]++;
}
void updfs(int root){
    dp[root] = fac[sz[root]-1];
    for(auto ch : adj[root]){
        dp[root] *= finv[sz[ch]];
        if(dp[root]>=mod)dp[root]%=mod;
        dp[root]*=dp[ch];
        if(dp[root]>=mod)dp[root]%=mod;
    }
    ans[root] = dp[root];
    for(auto ch : adj[root]){
        if(ch==par[root])continue;
        dp[root]*=fac[sz[ch]];dp[root] %= mod;
        dp[root]*= fast_exp(dp[ch],mod-2);dp[root]%=mod;
        dp[root]*= finv[sz[root]-1]; dp[root]%=mod;
        dp[root]*= fac[sz[root]-sz[ch]-1]; dp[root]%=mod;
        sz[root] -= sz[ch];
        sz[ch]   += sz[root];
        if(ch!=par[root])updfs(ch);
        sz[ch]  -= sz[root];
        sz[root]+= sz[ch];
        dp[root] = ans[root];
    }
}
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    make();
    cin>>n;
    for(int i=0;i<n-1;i++){
        cin>>u>>v;
        u--; v--;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    dfs(0);
    updfs(0);
    for(int i=0;i<n;i++)
        cout<<ans[i]<<" ";
        return 0;
}


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

vector<int> px = {0, 1, 0, -1};
vector<int> py = {1, 0, -1, 0};

int main() {
  int h,w,numPoints=0,ans=0;
  cin >> h >> w;
  vector<string> a(h);
  for(int i=0; i<h; i++) cin >> a[i];
  vector<vector<bool>> isBlack(h,vector<bool>(w, false));
  queue<pair<int,int>> que;
  for(int i=0; i<h; i++){
    for(int j=0; j<w; j++) {
      if(a[i][j]=='#') {
        isBlack[i][j] = true;
        que.push({i,j});
        numPoints++;
      }
    }
  }
  while(!que.empty()) {
    vector<pair<int,int>> points;
    int numNewPoints=0;
    for(int i=0; i<numPoints; i++) {
      points.push_back(que.front());
      que.pop();
      for(int j=0; j<4; j++) {
        int nx=points[i].first+px[j];
        int ny=points[i].second+py[j];
        if(nx<0 || nx>=h || ny<0 || ny>=w) continue;
        if(isBlack[nx][ny]) continue;
        isBlack[nx][ny] = true;
        que.push({nx,ny});
        numNewPoints++;
      }
    }
    numPoints=numNewPoints;
    if(!que.empty())ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 19584
#include<stdio.h>
int main()
{
	int n, x;
	scanf("%d %d", &n, &x);
	int i, j;
	int a[200005], b[200005];
	if (x == 1 || x == 2 * n - 1)
	{
		printf("No\n");
		return 0;
	}
	printf("Yes\n");
	if (n == 2)
	{
		printf("1\n2\n3\n");
		return 0;
	}
	for (i = 0; i < 2 * n - 1; i++)
		b[i] = a[i] = 0;
	if (x != 2)
	{
		a[n - 2] = 1;
		a[n - 1] = x;
		a[n] = 2 * n - 1;
		a[n + 1] = 2;
		b[1] = b[x] = b[2 * n - 1] = b[2] = 1;
	}
	else
	{
		a[n - 2] = 2 * n - 2;
		a[n - 1] = x;
		a[n] = 1;
		a[n + 1] = 2 * n - 1;
		b[2 * n - 2] = b[x] = b[1] = b[2 * n - 2] = 1;
	}
	j = 1;
	for (i = 0; i < 2 * n - 1; i++)
	{
		if (a[i] == 0)
		{
			while (b[j] > 0)
				j++;
			a[i] = j;
			j++;
		}
	}
	for (i = 0; i < 2 * n - 1; i++)
		printf("%d\n", a[i]);
	return 0;
}

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

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set
#define pll pair<ll, ll>
#define vll vector<ll>
#define mll map<ll, ll>

using namespace std;

const ll MOD = 1000000007LL;
const ll INF = (1LL << 60LL);

int main() {
  // std::cout << std::fixed << std::setprecision(10);
  string s1;
  cin >> s1;

  string s2;
  cin >> s2;

  ll len = s1.size();

  ll ans = 0;
  for (ll i = 0; i < len; i++) {
    if (s1[i] != s2[i]) {
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3844
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define DEBUG
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
	template <typename Arg1>
	void __f(const char* name, Arg1&& arg1){
		cerr << name << " : " << arg1 << std::endl;
	}
	template <typename Arg1, typename... Args>
	void __f(const char* names, Arg1&& arg1, Args&&... args){
		const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
	}
#else
#define debug(...)
#endif
#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 ln 		"\n"
#define mp make_pair
#define pb push_back
#define sz(a)	ll(a.size())
#define F first
#define S second
#define all(c)	c.begin(),c.end()
#define rall(c) c.rbegin(), c.rend()
#define trace(c,x) for(auto &x:c)
#define pii pair<ll,ll>
#define init(a, x) memset(a,x,sizeof(a))
typedef long long ll;
typedef long double ld;
typedef	priority_queue<pii,std::vector<pii>,greater<pii> > revpr;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds;
// ordered_set X
//K-th smallest
//*X.find_by_order(k-1)
//NO OF ELEMENTS < A
//X.order_of_key(A)
const int L=1e6+7;
map<ll,ll> counter;
ll fastexpo(ll x,ll y,ll m)
{
	ll temp=1;
	while(y>0)
	{
		if(y&1)temp = ((temp%m)*(x%m))%m;
		x = ((x%m)*(x%m))%m;
		y>>=1;
	}return temp;
}
void fff()
{
	string s;
	cin >> s;
	if(s[0]>='A' && s[0]<='Z')cout<<"A\n";
	else cout<<"a\n";

}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	//int t;cin >> t;while(t--)
	fff();
	return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int n,m,ans;
int a[11][100001];
void dfs(int x)
{
	int i,j;
	if(x>=n)
	return;
	else
	{
		int sum=0;
		for(i=0;i<m;i++)
		{
			int count=0;
			for(j=0;j<n;j++)
			{
			  if(a[j][i]==1)
			  count++;	
			}
			
			sum+=max(count,n-count);
		}
		if(sum>ans)
		ans=sum;
		dfs(x+1);
		for(i=0;i<m;i++)
		{
			if(a[x][i]==1)
			a[x][i]=0;
			else
			a[x][i]=1;
		}
		dfs(x+1);
	   for(i=0;i<m;i++)
		{
			if(a[x][i]==1)
			a[x][i]=0;
			else
			a[x][i]=1;
		}
	}
}
int main()
{
	int i,j;
   while(~scanf("%d%d",&n,&m))
   {
   	if(n==0&&m==0)
   	break;
   	memset(a,0,sizeof(a));
   	ans=0;
   	for(i=0;i<n;i++)
   	{
   		for(j=0;j<m;j++)
   		{
   			scanf("%d",&a[i][j]);
		}
	}
	 dfs(0);
	 printf("%d\n",ans);
   }
  return 0;
}

Measured memory_bytes: 7484
#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
    int n,m;
    while (scanf("%d%d",&n,&m)) {
        if (!n&&!m) break;
        double grow[n][n], dp[m][n];
        for (int i=0; i<n; i++) for (int j=0; j<n; j++) scanf("%lf",&grow[i][j]);
        for (int i=0; i<n; i++) dp[0][i]=1.0;
        for (int i=1; i<m; i++) {
            for (int j=0; j<n; j++) {
                dp[i][j]=0.0;
                for (int k=0; k<n; k++) dp[i][j]=max(dp[i][j], dp[i-1][k]*grow[k][j]);
            }
        }
        double res=0.0;
        for (int i=0; i<n; i++) res=max(res, dp[m-1][i]);
        printf("%.2lf\n",res);
    }
}

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

int n;
int D[105][10];

int main() {
	scanf("%d" , &n);
	for (int i = 1; i <= n; ++i) {
		scanf("%d %d" , &D[i][1] , &D[i][2]);
		if(i >= 3 && D[i][1] == D[i][2] && D[i - 1][1] == D[i - 1][2] && D[i - 2][1] == D[i - 2][2]) {
			printf("Yes");
			return 0;
		}
	}
	printf("No");
	return 0;
}

Measured memory_bytes: 3244
m,d = map(int,input().split())

x=0

for a in range(1,m+1):
  for b in range(22,d+1):
#    print(a,b)
    if (a==(b//10)*(b%10)) and (b%10!=1):
      x+=1
#      print("hit!")
#      print(a,b)
print(x)

Measured memory_bytes: 2940
class Solution:
    def solve(self, N: int, C: int, stc) -> int:

        p = [[0 for _ in range(2*10**5)] for _ in range(C)]

        for s, t, c in stc:
            for i in range(2*s-1, 2*t):
                p[c-1][i] = 1

        ans = 0
        for i in range(2*10**5):
            q = 0
            for c in range(C):
                q += p[c][i]
            ans = max(ans, q)

        return ans


if __name__ == '__main__':

    # standard input
    N, C = map(int, input().split())
    stc = []
    for _ in range(N):
        stc.append(tuple(map(int, input().split())))

    # solve
    solution = Solution()
    print(solution.solve(N, C, stc))


Measured memory_bytes: 64332
#include<iostream>
#include<queue>
#include<vector>
#include<algorithm>
using namespace std;
#define MAX_N 100
#define INF (1<<24)
struct edge{int to,cost;};
struct state{
  int cost,pos,cnt;
  bool operator < (const state &p)const{
    return cost > p.cost;
  }
};

vector<edge> G[MAX_N];
int N,M;

int dijkstra(){
  int d[MAX_N][3];
  for(int i=0;i<MAX_N;i++)
    for(int j=0;j<3;j++)d[i][j]=INF;
  d[0][2]=0;
  priority_queue<state> Q;
  Q.push((state){0,0,2});
  while(!Q.empty()){
    state s = Q.top();Q.pop();
    if(s.cost>d[s.pos][s.cnt])continue;
    if(s.cnt>=1){
      for(int i=0;i<(int)G[s.pos].size();i++){
	int npos=G[s.pos][i].to;
	if(s.cost>=d[npos][s.cnt-1])continue;
	d[npos][s.cnt-1]=s.cost;
	Q.push((state){s.cost,npos,s.cnt-1});
      }
    }
    if(s.cnt==1)continue;
    for(int i=0;i<(int)G[s.pos].size();i++){
      int npos=G[s.pos][i].to;
      int ncost=s.cost+G[s.pos][i].cost;
      if(ncost>=d[npos][s.cnt])continue;
      d[npos][s.cnt]=ncost;
      Q.push((state){ncost,npos,s.cnt});
    }
  }
  return min(d[N-1][0],d[N-1][2]);
}

void init(){
  for(int i=0;i<MAX_N;i++){
    G[i].clear();
  }
}

int main(){
  while(cin>>N>>M&&N&&M){
    init();
    for(int i=0;i<M;i++){
      int a,b,c;
      cin>>a>>b>>c;
      a--,b--;
      G[a].push_back((edge){b,c});
      G[b].push_back((edge){a,c});
    }
    cout<<dijkstra()<<endl;
  }
  return 0;
}

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

result = 1
ok = True
if 0 in A:
    result = 0
else:
    for a in A:
        result *= a
        if result > 10 ** 18:
            ok = False
            break

if ok:
    print(result)
else:
    print(-1)


Measured memory_bytes: 84448
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

// inf
constexpr ll infl = 10000000000000000LL;
constexpr int inf = 1000000000;

int main() {
    ll k;
    cin >> k;
    constexpr int n = 50;
    vector<ll> a(n);
    for (int i = 0; i < n; ++i) {
        a[i] = i + k / n;
    }

    int i = 0;
    for (int j = 0; j < k % n; ++j) {
        a[i] += n;
        for (int k = 0; k < n; ++k) {
            if (k != i)
                a[k] -= 1;
        }
        ++i;
    }

    cout << n << endl;
    for (int i = 0; i < n; ++i) {
        cout << a[i];
        if (i < n - 1)
            cout << ' ';
        else
            cout << endl;
    }

    return 0;
}

Measured memory_bytes: 256
N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))
ans = 1000000
tmper = []
for i in range(N):
	tmper.append(abs(A-(T - H[i]*0.006)))
	ans = min(ans,abs(A-(T - H[i]*0.006)))
print(tmper.index(ans)+1)

Measured memory_bytes: 9268
#include<iostream>
#include<vector>
#define take_input freopen("input.txt", "r", stdin)
#define ll long long int 
#define pb push_back
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define fi first
#define se second
using namespace std;
#define mod 998244353


// int main(){
// 	fastIO;
// 	ll n, x, m;
// 	cin >> n >> x >> m;
// 	ll ai = x;
// 	ll count=0;
// 	ll sum=ai;
// 	n--;
// 	while(n--){
// 		if(ai*ai < m){
// 			ai = ai*ai;
// 			sum += ai;
// 		}else{
// 			ai = (ai*ai)%m;
// 			sum += ai;
// 		}
// 	}
// 	cout << sum << "\n";
// }


// ll power(ll x, ll n){
// 	ll res = 1;
// 	while(n){
// 		if(n%2) res = ((res%mod)*(x%mod))%mod;
// 		x = ((x%mod)*(x%mod))%mod;
// 		n /= 2;
// 	}
// 	return res%mod;
// }

// int main(){
// 	ll n;
// 	cin >> n;
// 	ll res = (power(10, n)-2*power(9, n)+power(8,n))%mod;
// 	cout << res << "\n";
// }
	
int main(){
	int n;
	cin >> n;
	vector< pair<int, int> > v(n);
	int flag=0;
	for(int i=0; i<n; i++){
		int s1,s2;
		cin >> s1 >> s2;
		v[i] = {s1, s2};
	}
	for(int i=0; i<n-2; i++){
		if((v[i].fi == v[i].se) &&( (v[i+1].fi == v[i+1].se) && (v[i+2].fi == v[i+2].se))){
			flag = 1;
		}
	}
	if(flag == 1){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}


// int main(){
// 	int n;
// 	cin >> n;
// 	int count=0;
// 	for(int i=1; i<n; i++){
// 		int num = n-i;
// 		for(int j=1; j*j<=num; j++){
// 			if(num%j == 0){
// 				if(num/j == j) count++;
// 				else count+=2;
// 			}
// 		}
// 	}
// 	cout << count << endl;
// }

Measured memory_bytes: 3100
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
int main(void)
{
	int i,n,s,x;
	scanf("%d",&n);
	s=0;
	x=n;
	while(x>0)	{
		s+=x%10;
		x/=10;
	}
	if(n%s==0)	printf("Yes\n");
	else printf("No\n");
	return 0;
}

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

int func(int N) {
  int f = 0;
  while (N >= 10) {
    f += N % 10;
    N /= 10;
  }
  f += N;
  return f;
}

int main() {
  int N;
  cin >> N;
  int s = func(N);
  if (N % s == 0) {
    cout << "Yes" << endl;
  }else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256