akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

struct item {
  int id;
  string address;
  int score;
};

int main() {
  int n;
  cin >> n;
  vector<item> vec;
  for (int i = 1; i <= n; ++i) {
    string s;
    int p;
    cin >> s >> p;
    vec.push_back({i, s, p});
  }

  sort(vec.begin(), vec.end(), [](auto const &lhs, auto const &rhs) {
    return (lhs.address != rhs.address) ? lhs.address < rhs.address
                                          : lhs.score > rhs.score;
  });

  for (auto &v : vec)
    cout << v.id << endl;
}

Measured memory_bytes: 3636
n = int(input())

l1 = 2
l2 = 1

if n == 0:
	print(2)
elif n==1:
	print(1)
else:
	for i in range(n-1):
		l3 = l1 + l2
		l1 = l2
		l2 = l3
	print(l3)
	
 


Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		
		long user = input.nextLong();
		
		if (user % 2 == 0) {
			long ans=0;
			for (long i=5; user / i >=1; i*=5L) {
				ans += user / (2L*i);
			}
			System.out.println(ans);
		} else {
			System.out.println("0");
		}
	}
}


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

ll n,m,q,a,b,c,d;
vector<tuple<ll,ll,ll,ll> >Q;
ll ans[15],maxv=0;
void DFS(ll pos,ll v){
    ll i;
    if(pos == n+1){
        ll temp =0;
        for(auto x : Q){
            if(ans[get<1>(x)]-ans[get<0>(x)]==get<2>(x)){
                temp += get<3>(x);
            }
        }
        maxv = max(maxv,temp);
        return;
    }
    for(i = v;i <= m;i++){
            ans[pos] = i;
            DFS(pos+1,i);
        }
}
int main(){
    ll i;
    cin >> n >> m >> q;
    REP(i,q){
        cin >> a >> b >> c >> d;
        Q.emplace_back(a,b,c,d); 
    }
    DFS(1,1);
    cout << maxv << endl;
 

    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>

using namespace std;
#define MAX 100
int main(void){
    // Your code here!
    int n;
    cin >> n;
    int A[MAX];
    for(int i = 0; i < n; i++)cin >> A[i];
    
    int Q = 0,count = 0,max;
    
    for(int i = 0; i < n; i++){
        count = 0;
        Q++;
        for(int j = 0; j < n; j++){
            if(Q <= A[j])count++;//Qよりも高い点数の数
        }
        if(count >= Q)max = Q;
    }
    cout << max << endl;
}



Measured memory_bytes: 3136
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i < b; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define debug(x) cerr <<__LINE__<< ": " <<#x<< " = " << x << endl
#define debug_vec(v) cerr<<__LINE__<<": "<<#v<<" = ";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
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 int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    int a, b;
    cin >> a >> b;
    cout << 6 - a - b << endl;
}

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


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

const int maxnum=3500;

typedef long long LL;
int n;

void solve()
{
	for (int h=1; h<=maxnum; ++h)
		for (int w=1; w<=maxnum; ++w)
		{
			int tmp=h*w*4-n*w-n*h;
			if (tmp<=0) continue;
			if ((LL(n))*h*w%tmp!=0) continue;
			printf("%d %d %d\n", h, int((LL(n))*h*w/tmp), w);
			return;
		}
}
int main()
{
	scanf("%d", &n);
	solve();
	return 0;
}


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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 100;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<char> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;
const int mod = 1000000007;


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

    for (int i = 1; i <= n; i++) {
        int x = i;
        if (x % 3 == 0) {
            cout << ' ' << i;
            continue;
        }
        [&] {
            do {
                if (x % 10 == 3) {
                    cout << ' ' << i;
                    return;
                }
                x /= 10;
            } while (x != 0);
        }();

    }

    cout << endl;
}


Measured memory_bytes: 3120
#include<stdio.h>
int main(){
  int S,h,m,s;
  scanf("%d",&S);
  h=S/3600;
  m=(S-h*3600)/60;
  s=S-h*3600-m*60;
  printf("%d:%d:%d\n",h,m,s);
  return 0;
}

Measured memory_bytes: 592
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;


public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		long a = sc.nextLong();
		long b = sc.nextLong();
		if (a <= 0 && 0 <= b) {
			System.out.println("Zero");
		} else if (a > 0 || b < 0 && (b - a + 1) % 2 == 0) {
			System.out.println("Positive");
		} else {
			System.out.println("Negative");
		}

	}
}



class FastScanner {
	public static String debug = null;

	private final InputStream in = System.in;
	private int ptr = 0;
	private int buflen = 0;
	private byte[] buffer = new byte[1024];
	private boolean eos = false;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				if (debug != null) {
					buflen = debug.length();
					buffer = debug.getBytes();
					debug = "";
					eos = true;
				} else {
					buflen = in.read(buffer);
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen < 0) {
				eos = true;
				return false;
			} else if (buflen == 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean isEOS() {
		return this.eos;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		return (int) nextLong();
	}

	public long[] nextLongList(int n) {
		return nextLongTable(1, n)[0];
	}

	public int[] nextIntList(int n) {
		return nextIntTable(1, n)[0];
	}

	public long[][] nextLongTable(int n, int m) {
		long[][] ret = new long[n][m];
		for (int i = 0; i < n; i ++) {
			for (int j = 0; j < m; j ++) {
				ret[i][j] = nextLong();
			}
		}
		return ret;
	}

	public int[][] nextIntTable(int n, int m) {
		int[][] ret = new int[n][m];
		for (int i = 0; i < n; i ++) {
			for (int j = 0; j < m; j ++) {
				ret[i][j] = nextInt();
			}
		}
		return ret;
	}
}

Measured memory_bytes: 7892
n=int(input())
h=list(map(int,input().split()))
dp=[0]*(n)
for i in range(1,n):
  if i-2>=0:
    dp[i]=min(dp[i-1]+abs(h[i-1]-h[i]),dp[i-2]+abs(h[i-2]-h[i]))
  else:
    dp[i]=dp[i-1]+abs(h[i-1]-h[i])
print(dp[-1])

Measured memory_bytes: 20492
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int a,b,c,d;
    scanf("%d %d %d",&a ,&b ,&c);
    if (a > b) {
        d = a;
        a = b;
        b = d;
    }
    if (b > c) {
        d = b;
        b = c;
        c = d;
    }
    if (a > b) {
        d = a;
        a = b;
        b = d;
    }
    
    printf("%d %d %d\n", a, b, c);
    
    return 0;
}



Measured memory_bytes: 2100
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#include<queue>
#include<set>
#define rep(i,n) for(ll i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int,ll>P;

int main()
{
    int H,W,h,w;
    cin>>H>>W;
    cin>>h>>w;
    cout<<(H-h)*(W-w)<<endl;
}

Measured memory_bytes: 384
#include<iostream>
using namespace std;
 
long max(long num1, long num2) {
  if(num1 > num2) {
    return num1;
  } else {
    return num2;
  }
}
 
long min(long num1, long num2) {
  if(num1 < num2) {
    return num1;
  } else {
    return num2;
  }
}
 
int main() {
  int A, B, C;
  long X, Y;
  cin >> A >> B >> C >> X >> Y;
  
  long minsum = 2 * C * 0 + A * max(0, X - 0) + B * max(0, Y - 0);
  long sum = 0;
  for(long i = 0; i <= 100000; i++) {
    sum = 2 * C * i + A * max(0, X - i) + B * max(0, Y - i);
    minsum = min(sum, minsum); 
  }
  
  cout << minsum << endl;
  
  return 0;
}

Measured memory_bytes: 256
N=int(input())

def dfs(s):
    if len(s)==len(str(N)):
        return 0
    ans=0
    for c in "357":
        if int(s+c)<=N and all(a in s+c for a in "357"):
            ans+=1
        ans+=dfs(s+c)
    return ans
print(dfs(''))

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

#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); ++(i))
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); --(i))

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using int32 = int;
using int64 = long long;

const int   mod   = 1e9 + 7;
const int32 inf   = 1001001001;
const int64 infll = 1001001001001001001ll;

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

struct IoSetup { IoSetup(){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); cerr << fixed << setprecision(10); } } iosetup;

template <typename T = int64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; } 
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << p.first << " " << p.second; 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> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

struct edge {
  int to, cost;

  edge() {}
  edge(int to, int cost) : to(to), cost(cost & 1) {}
};

void solver() {
  int N = input();

  auto G = make_v(N, 0, edge());
  range(i, 0, N - 1) {
    int u = input() - 1, v = input() - 1, w = input();
    G[u].push_back(edge(v, w));
    G[v].push_back(edge(u, w));
  }

  vector< int > ans(N, -1);

  function< void(int, int) > dfs = [&](int idx, int cost) {
    ans[idx] = cost;
    for (auto e : G[idx]) {
      if (ans[e.to] == -1) dfs(e.to, (cost + e.cost) & 1);
    }
  };

  dfs(0, 0);

  range(i, 0, N) cout << ans[i] << endl;
}

signed main(int argc, char *argv[]) {
  solver();
}

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

int main(){
	ll n;
	cin >> n;
	vector<ll> a(n+1), b(n);
	rep(i,n+1) cin >> a[i];
	rep(i,n) cin >> b[i];
	ll ans = 0;
	rep(i,n){
		if(a[i] >= b[i]){
			ans += b[i];
		}else{
			ans += a[i];
			ll amari = b[i] - a[i];
			if(a[i+1] >= amari){
				ans += amari;
				a[i+1] -= amari;
			}else{
				ans += a[i+1];
				a[i+1] = 0;
			}
		}
	}
	cout << ans << endl;
    return 0;
}



Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main()
{
    int a[105]={0};
    int t,n,m;
    cin>>t>>n;
    for(int i=0;i<n;i++)
    {
        cin>>m;
        a[m]=1;
    }
    for(int i=0;;i++)
    {
        if(a[t-i]==0)
        {
            cout<<t-i;
            break;
        }
        else if(a[t+i]==0)
        {
            cout<<t+i;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 3672
#include <stdio.h>
#define MAX 150

int is_bigger_rectangle(int,int,int,int);

int main(void) {
  int input_h, input_w;
  int h, w;
  int min_h, min_w;

  while (scanf("%d %d", &input_h, &input_w) != EOF) {
    if (0 == input_h && 0 == input_w)
      break;
    
    min_h = MAX+1;
    min_w = MAX+1;
    for (h=1; h<=MAX; h++) {
      for (w=h+1; w<=MAX; w++) {
    	if (is_bigger_rectangle(h,w,input_h,input_w) > 0) {
    	    if(is_bigger_rectangle(h,w,min_h,min_w) < 0) {
	            min_h = h;
	            min_w = w;
    	    }
	     break;
	    }
      }
    }
    printf("%d %d\n", min_h, min_w);
  }
  
  return 0;
}

// 2つの長方形の大きさを比べる．前者が大きければ1,後者が大きければ-1，等しければ0 */
int is_bigger_rectangle(int h1, int w1, int h2, int w2) {
    if (h1*h1+w1*w1 > h2*h2+w2*w2) { // 1番目の長方形の方が対角線が長い
        return 1;
    } else if (h1*h1+w1*w1 < h2*h2+w2*w2) { // 2番目の長方形のほうが対角線が長い
        return -1;
    } else { // 対角線の長さが等しい
        if (h1 > h2) { // 1番目の長方形の方が高さが大きい
            return 1;
        } else if (h1 < h2) { // 2番めの長方形のほうが高さが大きい
            return -1;
        } else { // 高さも等しい
            return 0;
        }
    }
}

Measured memory_bytes: 600
import java.util.*;
import java.util.Map.Entry;
 
class Main {
	 static int mod =  (int) (Math.pow(10,9)+7);
//	 static int mod = 998244353;
	 public static void main(String[] args) {
	        Scanner sc = new Scanner(System.in);
	        long N = sc.nextLong();
	        
			StringBuffer str=new StringBuffer();
	        
			LinkedList<l> queue = new LinkedList<l>();
			l z=new l();
			z.length=1;
			z.list[0]=0;
			z.max=0;
			queue.add(z);
			while(!queue.isEmpty()) {
				l zz = queue.poll();
				int[] list=new int[10];
				System.arraycopy(zz.list,0,list,0,10);
				int max=zz.max;
				int length=zz.length;
				if(N==length) {
					for(int j=0;j<N;j++) {
						str.append((char)(list[j]+'a'));							
					}
					str.append("\n");
				} else {
					for(int i=0;i<=max+1;i++) {
						l g=new l();
						g.length=length+1;
						g.max=Math.max(max, i);
						System.arraycopy(list,0,g.list,0,10);
						g.list[length]=i;
						queue.add(g);						
					}
				}

			}
	        System.out.println(str);
	 }
	 

}

	class l{
		int[] list=new int[10];
		int max;
		int length;
	}



Measured memory_bytes: 54852
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
const int MAX=1e5;
const int M=1e9+7;
vector<vector<ll>> dp(MAX,vector<ll>(2));
vector<vector<int>> adj(MAX);
void dfs(int u,int prev){
    dp[u][0]=1;
    dp[u][1]=1;
    for(int it:adj[u]){
        if(it!=prev){
            dfs(it,u);
          	dp[u][1]=dp[u][1]*((dp[it][1]+dp[it][0])%M)%M;
            dp[u][0]=(dp[u][0]*dp[it][1])%M;
        }
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    for(int i=0;i<n-1;i++){
        int x,y;
        cin>>x>>y;
        x--,y--;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }
    dfs(0,-1);
    int res=(dp[0][0]+dp[0][1])%M;
    cout<<res<<'\n';
    return 0;
}

Measured memory_bytes: 21008
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long int a,b,n,x,y,z,i=0,ans=0,c=0,r;
    string s;
    cin >> n >> r;
    if(n>=10)
    {
        cout << r << endl;
    }
    else
    {
        cout << r+(100*(10-n)) << endl;
    }    
        
    return 0;
}


Measured memory_bytes: 3508
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void) {

	char input[5];
	memset(input, '\0', sizeof(input));
	int counter[4];
	memset(counter, 0, sizeof(counter));
	int full_counter = 0;

	scanf("%s", &input);

	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 4; j++) {
			if (input[i] == input[j]) {
				counter[i] += 1;
			}
		}
	}

	full_counter = counter[3] + counter[2] + counter[1] + counter[0];

	if (full_counter == 8) {
		printf("Yes");
	} else{ printf("No"); }

	return 0;
}

Measured memory_bytes: 128
tableA,tableB = {},{}
def main():
    make_table()
    while True:
        try:
            s = "".join(map(lambda c: tableA[c],raw_input()))
        except:
            break
        tmp,ans = "",""
        for c in s:
            tmp += c
            if tmp in tableB:
                ans += tableB[tmp]
                tmp = ""
        print ans
    
def make_table():
    global tableA,tableB
    tableA={
        "A":"00000",
        "B":"00001",
        "C":"00010",
        "D":"00011",
        "E":"00100",
        "F":"00101",
        "G":"00110",
        "H":"00111",
        "I":"01000",
        "J":"01001",
        "K":"01010",
        "L":"01011",
        "M":"01100",
        "N":"01101",
        "O":"01110",
        "P":"01111",
        "Q":"10000",
        "R":"10001",
        "S":"10010",
        "T":"10011",
        "U":"10100",
        "V":"10101",
        "W":"10110",
        "X":"10111", 
        "Y":"11000",
        "Z":"11001",
        " ":"11010",
        ".":"11011",
        ",":"11100",
        "-":"11101",
        "'":"11110",
        "?":"11111"}
    tableB ={
        "101":" ",
        "000000":"'",
        "000011":",",
        "10010001":"-",
        "010001":".",
        "000001":"?",
        "100101":"A",
        "10011010":"B",
        "0101":"C",
        "0001":"D",
        "110":"E",
        "01001":"F",
        "10011011":"G",
        "010000":"H",
        "0111":"I",
        "10011000":"J",
        "0110":"K",
        "00100":"L",
        "10011001":"M",
        "10011110":"N",
        "00101":"O",
        "111":"P",
        "10011111":"Q",
        "1000":"R",
        "00110":"S",
        "00111":"T",
        "10011100":"U",
        "10011101":"V",
        "000010":"W",
        "10010010":"X",
        "10010011":"Y",
        "10010000":"Z"}

if __name__ == "__main__":
    main()

Measured memory_bytes: 4348
#include <iostream>
#include <cstring>
#include <iomanip>

using namespace std;
const int N = 310;
double dp[N][N][N];
int a, b, c, n;

double get(int i, int j, int k) {
    if(dp[i][j][k] >= 0) return dp[i][j][k];
    double res = 0;
    double d = i + j + k;
    res += (double) n / d;
    if(i > 0) res += get(i-1, j, k) * (double) i / (double) d;
    if(j > 0) res += get(i+1, j-1, k) * (double) j / (double) d;
    if(k > 0) res += get(i, j+1, k-1) * (double) k / (double) d;
    dp[i][j][k] = res;
    return res;
}

int main() {
    cin >> n;
    for(int i = 1; i <= n; i ++) {
        int cnt;
        cin >> cnt;
        switch(cnt) {
            case 1:
                a ++;
                break;
            case 2:
                b ++;
                break;
            case 3:
                c ++;
                break;
        }
    }
    memset(dp, -1, sizeof dp);
    dp[0][0][0] = 0.0;
    cout <<setprecision(12) << fixed << get(a, b, c) << endl;
    return 0;
}

Measured memory_bytes: 232960
#if WATCH_RUNTIME
	#include <ctime>
	clock_t startTime;
#endif

#include <cstdio>

int main(void)
{
	#if DEBUG 
	freopen("_in","r",stdin);
	#endif
	#if WATCH_RUNTIME
	startTime=clock();
	#endif
	int *a,i,N,s=0;
	scanf("%d",&N);
	a=new int [N];
	for(i=0;i<N;i++)
		scanf("%d",&a[i]);

	for(i=0;i<N;i++)
	{
		s+=a[i]-1;
	}
	printf("%d\n",s);
	delete [] a;

	#if WATCH_RUNTIME
	printf("----------\n");
	printf("\n+===============+\n");
	printf("|RUNTIME =%3dms.|\n",clock()-startTime);
	printf("+===============+\n");
	#endif

	return 0;
}

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

#define 	pi 				3.1415926536
#define 	mod 			1000000007
#define 	lli 			long long int
#define 	rep(i, n) 		for(int i = 0 ; i < n ; i++)
#define 	repn(i, n) 		for(int i = n - 1 ; i >= 0 ; i--)
#define 	loop(i, a, b)	for(int i = a ; i < b ; i++)
#define 	mod1 			1000003
#define 	hello 			"hello"
#define 	nl 				"\n"
#define 	ws 				" "
#define 	F 				first
#define 	S 				second
#define 	pb 				push_back
#define 	mp				make_pair
#define 	B 				begin()
#define 	E 				end()
#define 	all(v) 			v.begin(), v.end()
#define 	reset(a, val) 	memset(a, val, sizeof(a))
#define 	vi 				vector<int>
#define 	vs 				vector<string>
#define 	print(a) 		for(auto i : a)cout<<i<<" ";cout<<"\n"
#define 	boost 			ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;

//g++ -std=c++14
//fixed<<setprecision(9);
//max_element(mp.begin(), mp.end(), compare)


bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) { return a.second < b.second; }

bool compare(const pair<string, int> &a, const pair<string, int> &b){ return a.second < b.second; }

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

int main()
{
	boost;
	int  n, count = 1;
	cin>>n;
	int arr[n], mn;
	rep(i,n)cin>>arr[i];
	mn = arr[0];
	loop(i,1,n)
	{
		if(arr[i]<=mn)
		{
			mn = arr[i];
			count++;
		}

	}
	cout<<count<<nl;	
}

Measured memory_bytes: 1024
user_id = input()
user_id2 = input()

def checkIDinID(id1,id2):
    if id1 in id2:
        for i, c in enumerate(id1):
            if c != id2[i]:
                return False
    else:
        return False
    
    return True

if( 1 <= len(user_id) and len(user_id) <= 10):
    if checkIDinID(user_id,user_id2) == True:
        if(len(user_id) == len(user_id2)-1):
            if(user_id.islower() and user_id2.islower()):
                print("Yes")
            else:
                print("No")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")


Measured memory_bytes: 8992
#include<stdio.h>

int main(void) {
	int k, h, t, o, s;
	scanf("%d", &s);

	k = s / 1000;
	h = abs((k * 10) - (s / 100));
	t = abs(((k * 100) + (h * 10)) - (s / 10));
	o = s % 10;

	if (k == h) {
		printf("Bad");
	}
	else if(h == t)
		printf("Bad");
	else if(t==o)
		printf("Bad");
	else
		printf("Good");

	return 0;
}

Measured memory_bytes: 128
n, m, x = map(int, input().split())
arr = list(map(int, input().split()))

mn = 0
l_cost = 0
r_cost = 0

# Calculate left cost
for i in range(x):
    if i in arr:
        l_cost += 1

# Calculate right cost
for i in range(x, n + 1):
    if i in arr:
        r_cost += 1

print(min(l_cost, r_cost))


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

typedef int_fast32_t int32;
typedef int_fast64_t int64;

const int32 inf = 1e9+7;
const int32 MOD = 1000000007;
const int64 llinf = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define all(obj) (obj).begin(),(obj).end()
#define rall(obj) (obj).rbegin(),(obj).rend()
#define fi first
#define se second
#define pb(a) push_back(a)
typedef pair<int32,int32> pii;
typedef pair<int64,int64> pll;

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n;
    cin >> n;
    vector<int32> a(3),b(3);
    REP(i,3)cin >> a[i];
    REP(i,3)cin >> b[i];
    REP(_,2){
        vector<int32> dp(n+1,0);
        dp[0] = 0;
        FOR(i,1,n+1){
            dp[i] = dp[i-1] + 1;
            REP(j,3){
                if(i-a[j] >= 0)
                   chmax(dp[i], dp[i-a[j]]+b[j]);
            }
        }
        // REP(i,n+1){
        //     cout << i << " " << dp[i] << endl;
        // }
        n = dp[n];
        swap(a,b);
    }
    ANS(n);
    return 0;
}

Measured memory_bytes: 195584
#include<iostream>
using namespace std;
int A,B,C;
main()
{
  cin>>A>>B>>C;
  cout<<A<<" "<<B<<" "<<3*C-A-B<<" "<<4*C-2*A-B<<" "<<C<<" "<<2*A+B-2*C<<" "<<A+B-C<<" "<<2*C-B<<" "<<2*C-A<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;


int main(){
	int t;
	cin>>t;
	while(t--){
		int a[3];
		cin>>a[0]>>a[1]>>a[2];
		sort(a,a+3);
		bool f = false;
		if(a[0]*a[0] + a[1] * a[1] == a[2] * a[2])
			f = true;

		cout << (f ? "YES" : "NO")  << endl;
	}
  return 0;
}

Measured memory_bytes: 0
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    int a,b; R(a,b);
    int now=1;
    int AA=0;
    while(now<b){
        AA++;
        now+=a-1;
    }
    W(AA);
    return 0;
}

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

int main() {
    int N, x;
    cin >> N >> x;
    vector<int> a(N);
    for (int i=0; i<N; i++) {
        cin >> a[i];
    }
    
    sort(a.begin(), a.end());
    
    int ans=N-1;
    for (int i=0; i<N; i++) {
        x = x - a[i];
        if (x<0) {
            ans = i;
            break;
        }
        else if(i==N-1 && x==0){
            ans=N;
        }
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 764
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include <cmath>
#include <limits>
#include <utility>
#include <map>
#include "bits/stdc++.h"

#define rep(p,q) for(int i = p;i < q;i++)
#define ll long long

using namespace std;

const int cons = 1e9 + 7;

int n;
vector<double> v;
vector<double> l;
vector<double> r;
double speed(double t) {
	double maxV = 100;
	rep(0, n + 2) {
		double reti = 0;
		if (t <= l[i]) reti = v[i] + l[i] - t;
		else if (r[i] <= t) reti = v[i] + t - r[i];
		else reti = v[i];
		maxV = min(maxV, reti);
	}
	return maxV;
}

//D

int main(void) {

	cin >> n;
	v = vector<double>(n + 2);
	l = vector<double>(n + 2);
	r = vector<double>(n + 2);
	v[0] = 0; l[0] = 0; r[0] = 0;
	v[n + 1] = 0;
	int T = 0;
	rep(1, n + 1) {
		int ti = 0;
		cin >> ti;
		r[i] = r[i - 1] + ti;
		l[i] = r[i - 1];
		T += ti;
	}
	l[n] = r[n - 1];
	rep(1, n + 1) {
		cin >> v[i];
	}
	l[n + 1] = T; r[n + 1] = T;
	double ans = 0;
	for (double i = 0; i < T-0.1; i += 0.5) {
		double s1 = speed(i);
		double s2 = speed(i + 0.5);
		ans += 0.25*(s1 + s2);
	}
	cout << fixed<<setprecision(10)<<ans << endl;
	return 0;
}

Measured memory_bytes: 384
//1列(4通り)を質問 -> 当たったら1列（右側に）追加して(4通り)質問 -> …を繰り返すと400回以内で当たらなくなる（かendが返る）
//このとき、質問した列は黒板の右端にある。あとは、同様にして左側を特定すればよい。

#include <iostream>
#include <string>
using namespace std;

string reverse(string str) {
	string ret;
	for (int i = (int)str.length() - 1; i >= 0; i--) ret += str[i];
	return ret;
}

int n;
string query[2];

void addCharRight(int type) {
	char c0 = ((type / 2) % 2 ? '#' : '.');
	char c1 = (type % 2 ? '#' : '.');
	query[0] += c0;
	query[1] += c1;
}

void addCharLeft(int type) {
	char c0 = ((type / 2) % 2 ? '#' : '.');
	char c1 = (type % 2 ? '#' : '.');
	query[0] = reverse(query[0]);
	query[1] = reverse(query[1]);
	query[0] += c0;
	query[1] += c1;
	query[0] = reverse(query[0]);
	query[1] = reverse(query[1]);
}

void delCharRight() {
	string s[2];
	for (int i = 0; i < (int)query[0].size() - 1; i++) s[0] += query[0][i];
	for (int i = 0; i < (int)query[1].size() - 1; i++) s[1] += query[1][i];
	query[0] = s[0];
	query[1] = s[1];
}

void delCharLeft() {
	string s[2];
	for (int i = 1; i < (int)query[0].size(); i++) s[0] += query[0][i];
	for (int i = 1; i < (int)query[1].size(); i++) s[1] += query[1][i];
	query[0] = s[0];
	query[1] = s[1];
}

//return : {T, F, end}
char getQuery() {
	cout << query[0] << endl;
	cout << query[1] << endl;
	cout.flush();
	string ret;
	cin >> ret;
	return ret[0];
}

//return : {T, F, e}
char addQueryRight(int type) {
	addCharRight(type);
	char res = getQuery();
	if (res == 'e' || res == 'T') return res;
	delCharRight();
	return res;
}

char addQueryLeft(int type) {
	addCharLeft(type);
	char res = getQuery();
	if (res == 'e' || res == 'T') return res;
	delCharLeft();
	return res;
}

signed main() {
	cin >> n;
	
	int j;
	
	while (true) {
		for (j = 0; j < 4; j++) {
			char res = addQueryRight(j);
			if (res == 'e') return 0;
			if (res == 'T') break;
		}
		if (j == 4) break;
	}
	
	while (true) {
		for (j = 0; j < 4; j++) {
			char res = addQueryLeft(j);
			if (res == 'e') return 0;
			if (res == 'T') break;
		}
		if (j == 4) break;
	}
	return 0;
}

Measured memory_bytes: 720
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	int a[5],k;
	for(int i=0;i<5;i++){
		cin>>a[i];
	}
	cin>>k;
	int flag=0;
	for(int i=0;i<5;i++){
		for(int j=i+1;j<5;j++){
			if(a[j]-a[i]>k){
				flag=1;
				break;
			}
		}
	}
	if(flag==1){
		cout<<":(";
	}
	if(flag==0){
		cout<<"Yay!";
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN+1];
int head, tail, n;

void enqueue(P x){
  Q[tail] = x;
  tail = (tail + 1) % LEN;
}

P dequeue(){
  P x = Q[head];
  head = (head + 1) % LEN;
  return x;
}

int checkmin(int a, int b){
  if(a<b){
    return a;
  }else{
    return b;
  }
}

int main(void){
  int elaps = 0, c;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for(i=1; i<=n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }

  head = 1;
  tail = n+1;

  while(head != tail){
    u = dequeue();
    c = checkmin(q, u.t);
    u.t = u.t - c;
    elaps += c;
    if(u.t > 0){
      enqueue(u);
    }else{
      printf("%s %d\n", u.name, elaps);
    }
  }

  return 0;
}



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

#define int long long
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define yn(x) ((x) ? "YES" : "NO")

typedef pair <int, int> ii;
typedef pair <int, ii> iii;

const int siz = 2e5 + 10;
const int SIZ = 2e5 + 10;
const int mod = 1e9 + 7;
const int maxx = 2e9;
const int MAXX = 1e18;
const string file = "data";

int n;
int psum[siz];

void compress() {
    vector <ii> data; /// value, index;
    for (int i = 0; i <= n; i++) {
        data.push_back(ii(psum[i], i));
    }

    sort (all(data));

    int num = 0, prv = MAXX;
    for (auto &x : data) {
        if (x.fi != prv) {
            prv = x.fi;
            num++;
        }
        psum[x.se] = num;
    }
}

int fen[SIZ];

void updatePos(int index, int value) {
    for (int i = index; i < SIZ; i += i & (-i)) {
        fen[i] += value;
    }
}

int getSum(int index) {
    int sum = 0;
    for (int i = index; i > 0; i -= i & (-i)) {
        sum += fen[i];
    }
    return sum;
}

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

//    freopen ((file + ".inp").c_str(), "r", stdin);
//    freopen ((file + ".out").c_str(), "w", stdout);

    int k;
    cin >> n >> k;

    for (int i = 1; i <= n; i++) {
        int a;
        cin >> a;

        psum[i] = psum[i - 1] + a - k;
    }

    compress();

    int ans = 0;
    for (int i = 0; i <= n; i++) {
        ans += getSum(psum[i]);
        updatePos(psum[i], 1);
    }

    cout << ans << "\n";

//    cerr << "Time: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";

    return 0;
}


Measured memory_bytes: 9020
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main(void){
  vector<string> vs;
  string tmps;
  int n,l;
  
  cin >> n >> l;
  for (int i=0; i<n; i++){
    cin >> tmps;
    vs.push_back(tmps);
  }
  sort(vs.begin(), vs.end());
  for (int i=0; i<n; i++){
    cout << vs[i];
  }
  cout << endl;
  return 0;
}
  

Measured memory_bytes: 256
/*"Nothing is true."*/
#include<bits/stdc++.h>
using namespace std;
inline int min(int _a, int _b) {return _a < _b ? _a : _b;}
inline int max(int _a, int _b) {return _a > _b ? _a : _b;}
const int inf = 0x3f3f3f3f;
const double eps = 1e-8;

template <class _T> inline void rd(_T &_a) {
	int _f=0,_ch=getchar();_a=0;
	while(_ch<'0' || _ch>'9'){if(_ch=='-')_f=1;_ch=getchar();}
	while(_ch>='0' && _ch<='9')_a=(_a<<1)+(_a<<3)+_ch-'0',_ch=getchar();
	if(_f)_a=-_a;
}
const int maxn = 100100;

struct node {
	int t, x, y;
	bool operator < (const node &b) const {
		return t < b.t;
	}
} a[maxn];
int n, flag;
int main() {
	//freopen("AtCoder_89_C.in","r",stdin);
	//freopen("AtCoder_89_C.out","w",stdout);
	rd(n);
	for(int i = 1;i <= n; ++i) {
		rd(a[i].t); rd(a[i].x); rd(a[i].y);
	}
	sort(a + 1, a + n + 1);
	int nowx = 0, nowy = 0, nowt = 0;
	for(int i = 1;i <= n; ++i) {
		if(a[i].x == nowx && a[i].y == nowy && a[i].t == nowt) {
			flag = 1; break;
		}
		int dis = abs(a[i].x - nowx) + abs(a[i].y - nowy);
		if(dis > a[i].t - nowt || (a[i].t - nowt - dis) % 2 == 1) {
			flag = 1; break;
		}
		nowx = a[i].x; nowy = a[i].y; nowt = a[i].t;
	}
	if(flag) puts("No");
	else puts("Yes");
	return 0;
}



Measured memory_bytes: 1408
import java.io.*;
import java.math.*;
import java.util.*;
public class Main { 
 
	public static void main(String[] args) { 
		FastScanner I = new FastScanner(); //Input
		OutPut O = new OutPut(); //Output
		int N = I.nextInt();
		int m = N%1000;
		O.pln(m==0?0:1000-m);
	}
	public static long ceil(long num, long den) {long ans = num/den; if (num%den!=0) 
	ans++; return ans;}
	public static long GCD(long a, long b) {
		if (a==0||b==0) return Math.max(a,b);
		return GCD(Math.min(a, b),Math.max(a, b)%Math.min(a, b));
	}
	public static long FastExp(long base, long exp, long mod) {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	}
	public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());};
	}
	static class OutPut{
		PrintWriter w = new PrintWriter(System.out);
		void pln(int x) {w.println(x);w.flush();}
		void pln(long x) {w.println(x);w.flush();}
		void pln(String x) {w.println(x);w.flush();}
		void pln(char x) {w.println(x);w.flush();}
		void pln(StringBuilder x) {w.println(x);w.flush();}
		void p(int x) {w.print(x);w.flush();}
		void p(long x) {w.print(x);w.flush();}
		void p(String x) {w.print(x);w.flush();}
		void p(char x) {w.print(x);w.flush();}
		void p(StringBuilder x) {w.print(x);w.flush();}
	}
}

Measured memory_bytes: 25616
#include<bits/stdc++.h>
typedef long long ll;
const ll mod=1e9+7;
const ll inf=0x3f3f3f3f;
const int N=1e2+5;
using namespace std;
int main()
{
    ll n;cin>>n;
    ll ans=2;
    if(n==2) ans=1;
    for(ll i=2;i*i<=n;i++)
    {
        ll m=n;
        while(m>=i)
        {
            m%i?m%=i:m/=i;
        }
        if(m==1) ans++;
        if((n-1)%i==0&&i*i!=(n-1)) ans++;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3632
s = input()
l = s.split()   #スペースで区切る 

N = int(l[0])
A = int(l[1])
B = int(l[2])

def sum(p):
    n4 = p // 10000
    n3 = ( p - n4 * 10000 ) // 1000
    n2 = ( p - ( p // 1000 ) * 1000) // 100
    n1 = ( p - ( p // 100 ) * 100)// 10 
    n0 = p - ( p // 10 ) * 10
    s = n4 + n3 + n2 + n1 + n0
    return s
#print( n4, n3, n2, n1, n0 ) 


S = 0

for i in range(1,N+1):
    s = sum(i)
    if A <= s and s <= B:
        S += i

print(S)

Measured memory_bytes: 3064
N = int(input())
C = list(map(int,[input() for _ in range(N)]))
# 1番目と2番目の大きさの数を取り出す
first = -1
second = -2
for i in range(N):
    if first <= C[i]:
        second = first
        first = C[i]
    elif second < C[i]:
        second = C[i]
    
for j in range(N):
    if C[j] == first:
        print(second)
    else:
        print(first)

Measured memory_bytes: 23724
using System;
using System.Linq;

namespace fightx
{
    class Program
    {
        static void Main(string[] args)
        {
            /* int[] NK = Console.ReadLine().Split(" ").Select(int.Parse).ToArray();
             int[] PN = Console.ReadLine().Split(" ").Select(int.Parse).ToArray();
             Array.Sort(PN);
             int ans = 0;
             for (int a = 0; a < NK[1]; a++)
                 ans += PN[a];
             Console.WriteLine(ans);*/
            /*   string N = "a";
               char c = N[0];
               */
            string N = Console.ReadLine();
            char c = N[0];
            if (Char.IsLower(c))
            {
                Console.WriteLine("a");
            }
            else
            {
                Console.WriteLine("A");
            }





        }
    }
}

Measured memory_bytes: 17440
N,M,K = map(int, input().split())
AB = [[int(a) for a in input().split()] for _ in range(M)]
CD = [[int(c) for c in input().split()] for _ in range(K)]

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.root = [-1]*(n+1)
        self.rnk = [0]*(n+1)
        
    def find_root(self, x):
        if self.root[x] < 0:
            return x
        else:
            self.root[x] = self.find_root(self.root[x])
            return self.root[x]
        
    def unite(self, x, y):
        x = self.find_root(x)
        y = self.find_root(y)
        if x == y:
            return
        elif self.rnk[x] > self.rnk[y]:
            self.root[x] += self.root[y]
            self.root[y] = x
        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            if self.rnk[x] == self.rnk[y]:
                self.rnk[y] += 1
                
    def isSameGroup(self, x, y):
        return self.find_root(x) == self.find_root(y)
    
    def count(self, x):
        return -self.root[self.find_root(x)]


uf = UnionFind(N)
for t in AB:
    uf.unite(t[0], t[1])

ans = [0]*N
for i in range(1, N+1):
    ans[i-1] = uf.count(i)-1

for i in range(M):
    ans[AB[i][0]-1] -= 1
    ans[AB[i][1]-1] -= 1
for i in range(K):
    if uf.isSameGroup(CD[i][0], CD[i][1]):
        ans[CD[i][0]-1] -= 1
        ans[CD[i][1]-1] -= 1
print(*ans)

Measured memory_bytes: 47304
import string

s = input()

if len(s) != 26:
  mins = min(set(string.ascii_lowercase) - set(s))
  print(s + mins)
else:
  is_re = True
  for i, (nexts, prevs) in enumerate(zip(s[::-1], s[::-1][1:])):
    if nexts > prevs:
      is_re = False
      break

  if is_re:
    print(-1)
  else:
    minq = None
    for _s in s[26-i-1:]:
      if minq is None:
        minq = _s
      else:
        if _s > s[26-i-2] and minq > _s:
          minq = _s
    print(s[:26-i-2] + minq)


Measured memory_bytes: 3772
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>

typedef  long long ll;

#define rep(i,a,n) for(ll (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(ll (i)=(a);(i)>=(n);(i)--)

#define INF ll 1 << 60
#define MOD 1000000007


using namespace std;

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int gcd(long long int a,long long int b){
    long long int r;
    if(a < b){
        int tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    while(r = a % b){
        a = b;
        b = r;
    }
    return a;
}


void ys(){
    cout << "Yes" << endl;
}

void yb(){
    cout << "YES" << endl;
}

void ns(){
    cout << "No" << endl;
}

void nb(){
    cout << "NO" << endl;
}

int dig(int d){
    int ans = 1;
    if(d == 0) return ans;
    while(d != 0){
        d--;
        ans*=100;
    }
    return ans;
}

ll divisors(ll n) {
    vector<ll> res;

    for(ll i = 1; i*i <= n; ++i) {
        if(n % i != 0) continue;
        res.push_back(i-1);
        if(n/i == i) continue;
        res.push_back((n/i)-1);
    }

    ll ans = 0;

    rep(i,0,res.size()){
        if(res[i] != 0)
        if(n/res[i] == n%res[i]) ans += res[i];
    } 
    return ans;
}

void solve(void){
   ll a[3],k;
   cin >> a[0] >> a[1] >> a[2] >> k;

   sort(a,a+3);

   rep(i,0,k) a[2]*=2;

   cout << a[0]+a[1]+a[2]<<endl;
}

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


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
 public static void main(String[] args){
 Scanner sc=new Scanner(System.in);
 sc.useDelimiter(",|\n");
  int w=0,n=0;
  int[] data=new int[30];
  w=sc.nextInt();
  n=sc.nextInt();
  for(int i=0;i<w;i++){
   data[i]=i+1;
  }
  for(int j=0;j<n;j++){
   int a=sc.nextInt();
   int b=sc.nextInt();
   int tmp=data[a-1];
   data[a-1]=data[b-1];
   data[b-1]=tmp;
  }
  for(int k=0;k<w;k++){
   System.out.println(data[k]);
  }
  }
}

Measured memory_bytes: 26348
#include<iostream>
#include<string>
using namespace std;
char map[3000];
const char A = 'A';
const char T = 'T';
const char C = 'C';
const char G = 'G';
int main(){
    string s;
    map[A] = T;
    map[T] = A;
    map[C] = G;
    map[G] = C;
    while(cin>>s){
        cout<<map[s[0]]<<endl;;
    }
    return 0;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    ll N, M;
    cin >> N >> M;
    map<ll, ll> mp;
    REP(i, N){
    	ll A;
    	cin >> A;
    	mp[-A] += 1;
    }
    REP(i, M){
    	ll B, C;
    	cin >> B >> C;
    	mp[-C] += B;
    }
    ll res = 0;
    ll K = N;
    for(auto x: mp){
    	ll val = -x.first;
    	ll kazu = x.second;
    	if(kazu > K){
    		res += (val * K);
    		K = 0;
    		break;
    	}else{
    		res += (val * kazu);
    		K -= kazu;
    	}
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 12800
n,m,k=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

a,b=[0],[0]
for i in range(n):
    a.append(a[i]+A[i])
for i in range(m):
    b.append(b[i]+B[i])
ans,j=0,m
for i in range(n+1):
    if a[i]>k:
        break
    while b[j]>k-a[i]:
        j-=1
    ans=max(ans,i+j)
print(ans)

Measured memory_bytes: 47460
#include <iostream>

using namespace std;

int main(int argc, char* argv[]) {
  long long X;
  cin >> X;

  if (X < 100) {
    cout << "0" << endl;
    return 0;
  }

  long long a = X - (long long) (0.01 * X) * 100;
  long long n5 = a / 5;
  long long n4 = (a - 5 * n5) / 4;
  long long n3 = (a - 5 * n5 - 4 * n4) / 3;
  long long n2 = (a - 5 * n5 - 4 * n4 - 3 * n3) / 2;
  long long n1 = (a - 5 * n5 - 4 * n4 - 3 * n3 - 2 * n2);

  long long total = n5 * 105 + n4 * 104 + n3 * 103 + n2 * 102 + n1 * 101;

  if (total > X || (X - total) % 100 != 0)
    cout << "0" << endl;
  else
    cout << "1" << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

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

int main() {
  ll n,x;
  cin >> n >> x;
  vec y(n);
  ll mi=x;
  for(ll i=0;i<n;i++) {
    cin >> y[i];
    mi=min(mi,y[i]);
  }
  for(ll i=0;i<n;i++) {
    y[i]-=mi;
  }
  ll ans=x-mi;
  for(ll i=0;i<n;i++) {
    if(y[i]==0) continue;
    if(ans<0) ans=y[i];
    else ans=gcd(y[i],ans);
  }
  ans=max(ans,0LL);
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

int main(){
    int n,m;
    cin >> n >> m;
    cout << n*(n-1)/2 + m*(m-1)/2 << endl;
}

Measured memory_bytes: 256