akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.Iterator;
import java.util.PrimitiveIterator;
import java.util.Scanner;
import java.util.stream.IntStream;
import java.util.stream.Stream;

class Main{

	private void solve(){
		int n=gInt();
		int[][]f=new int[3][n+1];
		for(int i:rep(1,2))
			for(int j:rep(1,n))
				f[i][j]=gInt();
		for(int i:rep(1,2))
			for(int j:rep(1,n))
				f[i][j]+=Math.max(f[i-1][j],f[i][j-1]);
		System.out.println(f[2][n]);
	}


	public static void main(String[]$){
		new Main().solve();
	}

	static Scanner s=new Scanner(System.in);


	static int gInt(){
		return s.nextInt();
	}
	static long gLong(){
		return s.nextLong();
	}
	static long gDouble(){
		return s.nextLong();
	}


	static Range rep(int i){
		return new Range(i);
	}
	static Range rep(int f,int t,int d){
		return new Range(f,t,d);
	}
	static Range rep(int f,int t){
		return rep(f,t,1);
	}
	static Range rrep(int f,int t){
		return rep(f,t,-1);
	}

	static class Range implements Iterable<Integer>,PrimitiveIterator.OfInt{

		int to,cur,d;

		Range(int from,int to,int d){
			this.cur=from-d;
			this.to=to;
			this.d=d;
		}

		Range(int n){
			this(0,n-1,1);
		}

		@Override
		public Iterator<Integer> iterator(){
			return this;
		}

		@Override
		public boolean hasNext(){
			return cur+d==to||(cur!=to&&(cur<to==cur+d<to));
		}

		@Override
		public int nextInt(){
			return cur+=d;
		}
	}


	static IntStream REPS(int v){
		return IntStream.range(0,v);
	}

	static IntStream REPS(int l,int r){
		return IntStream.rangeClosed(l,r);
	}


	static IntStream ints(int n){
		return REPS(n).map(i->gInt());
	}

	static Stream<String> strs(int n){
		return REPS(n).mapToObj(i->s.next());
	}

}

Measured memory_bytes: 27728
inf=10**7
n=int(input())

ad=[6**x for x in range(10)]
ad2=[9**x for x in range(1,10)]
ad.extend(ad2)

a=[inf]*(n+1)
a[0]=0
for i in range(n+1):
    for x in ad:
        if(x+i<=n):a[x+i]=min(a[x+i],a[i]+1)



print(a[n])



Measured memory_bytes: 3828
let () = Scanf.scanf "%d %d %d\n" @@ fun a b m ->
  let as_ = Array.init a @@ fun _ -> Scanf.scanf "%d%c" @@ fun a _ -> a in
  let bs = Array.init b @@ fun _ -> Scanf.scanf "%d%c" @@ fun b _ -> b in
  let xycs = Array.init m @@ fun _ -> Scanf.scanf "%d %d %d\n" @@ fun x y c -> x, y, c in
  Printf.printf "%d\n" @@
  Array.fold_right (fun (x, y, c) -> min @@ as_.(x - 1) + bs.(y - 1) - c) xycs @@
  Array.fold_left min max_int as_ + Array.fold_left min max_int bs

Measured memory_bytes: 8704
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int y = sc.nextInt();
    int z = sc.nextInt();
    int temp = x;
     x = y;
     y = temp;
    temp = x;
     x = z;
    z = temp;
    System.out.println(x +  " " + y + " " + z);
  }
}

Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
int a[100011],b[100011],n,h,ans=0;
int main()
{
	cin >>n>>h;
	for(int i=0;i<n;i++)
	cin >>a[i]>>b[i];
	sort(b,b+n);
	reverse(b,b+n);
	sort(a,a+n);
	reverse(a,a+n);
	ans=(h+a[0]-1)/a[0];
	for(int i=0;i<n;i++)
	{
		h-=b[i];
		int cnt;
		if(h<=0)
		cnt=0;
		else
		cnt=(h+a[0]-1)/a[0];
		if(ans>i+1+cnt)
		ans=i+1+cnt;
	}
	cout <<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
d = {}
N = int(input())
for i in range(N):
  word = input()
  d[word] = d.get(word, 0) + 1
M = int(input())
for i in range(M):
  word = input()
  d[word] = d.get(word, 0) - 1
print(max(0, *d.values()))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   string s;
   cin >> s;
   if(s == "AAA" or s == "BBB"){
      cout << "No\n";
   }else{
      cout << "Yes\n";
   }
   return 0;
}

Measured memory_bytes: 256
int q[2000000];
void swap(int i, int j) {
  int t;
  t=q[i];
  q[i]=q[j];
  q[j]=t;
}
int main(void) {
  int k,s=0,i,pr,l,r;
  char com[2];
  while (1) {
    scanf("%s%d", com, &k);
    if(com[0]=='i'){
      q[i=s]=k;
      while (i>0 && q[i]>q[pr=(i-1)/2]) {
        swap(i,pr);
        i=pr;
      }
      ++s;
    } else if(com[1]=='n') break;
    else {
      printf("%d\n", q[0]);
      q[i=0]=q[--s];
      --q[s];
      while ((l=i*2+1)<s) {
        if ((r=l+1)<s && q[r] > q[l]) l=r;
        if (q[i] < q[l]) swap(i,l);
        i=l;
      }
    }
  }
  return 0;
}

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

int seed = 8937;
int random = 1821;

void makeRand(char zero, char *str)
{
    int i;
    str[0] = zero;
    for (i = 1; i < 9; i++){
        random = (seed * random + 1931) % 65536;
        str[i] = (random % 26) + 'a';
    }
    str[i++] = 'q';
    str[i] = '\0';
}

int main(void)
{
    char str[11];
    char recieve[256];
    int next[27];
    char come;
    
    come = 'k';
    memset(next, 0, sizeof(next));
    while (1){
        makeRand(come, str);
        printf("?%s\n", str);
        fflush(stdout);
        
        scanf("%s", recieve);
        
        if (strlen(recieve) == 1 && recieve[0] == 'q' && !next[26]){
            next[26] = 1;
            come = recieve[0];
        }
        else if (strlen(recieve) == 2 && recieve[0] == 'q' && !next[recieve[1] - 'a']){
            next[recieve[1] - 'a'] = 1;
            come = recieve[1];
        }
        else {
            printf("!OUT\n");
            break;
        }
    }
    
    return (0);
}

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

int main() {
  int n,m,x,min = (int)1e9;
  cin >> n >> m >> x;
  vector<int>c(n);
  vector<vector<int>>a(n,vector<int>(m));
  rep(i,n){
    cin >> c[i];
    rep(j,m){
      cin >> a[i][j];
    }
  }
  for (int bit = 1; bit < (1<<n); ++bit){
    vector<int>sum(m,0);
    int cost = 0;
    rep(i,n){
      if(bit & (1<<i)){
        cost += c[i];
        rep(j,m){
          sum[j] += a[i][j];
        }
      }
    }
    bool flag = true;
    rep(i,m) if(sum[i] < x) flag = false;
    if(cost < min && flag) min = cost;
  }
  if(min == 1e9) cout << -1 << endl;
  else cout << min << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std ;
int main() {
    char s[51] ;
    int cnt = 0 ;
    int n ;
    cin >> n ;
    for(int i = 0 ; i < n ; i++) {
        cin >> s[i] ;
    }
    for(int i = 1 ; i < n - 1 ; i++) {
        if(s[i-1]=='A' && s[i] == 'B' && s[i+1] == 'C') cnt++ ;
    }
    cout << cnt << endl ;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define M 1000000007
#define pi ld(acos(-1.0))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n) for(int i=1;i<(int)(n);i++)
#define repp(i,a,b)  for(ll i=a;i<=(ll)(b);i++)
#define Repp(i,a,b)  for(int i=a;i>=(int)(b);i--)
#define cs ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fi first
#define se second
#define ii pair<int,int>
#define bye(x) {cout<<x;return 0;}
typedef long long ll;
typedef long double ld;
using namespace std;
ll fac[100005],inv[100005];
ll power(ll a,ll b) {
    ll t=1;
    while(b) {
        if(b&1) t=(t*a)%M;
        b>>=1;a=(a*a)%M;
    }
    return t;
}
void pre() {
    fac[0]=inv[0]=1;
    for(ll i=1;i<=100000;i++) fac[i]=(fac[i-1]*i)%M;
    inv[100000]=power(fac[100000],M-2);
    for(ll i=99999;i>=1;i--) inv[i]=(inv[i+1]*(i+1))%M;
}
ll c(int n,int r) {
    if(n<0||r<0||n<r) return 0;
    return (((fac[n]*inv[r])%M)*inv[n-r])%M;
}
int main() {
    cs
    pre();
    int n,k;
    cin>>n>>k;
    vector<ll> v(n);
    for(auto &i:v) cin>>i;
    sort(v.begin(),v.end());
    
    ll ans=0;
    rep(i,n) {
        ans+=v[i]*((c(i,k-1)-c(n-i-1,k-1)+M)%M);
        ans%=M;
    }
    if(ans<0) ans+=M;
    cout<<ans;
}

Measured memory_bytes: 2560
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<cctype>
#define qmin(x,y) (x=min(x,y))
#define qmax(x,y) (x=max(x,y))
using namespace std;

inline char gc() {
//	static char buf[100000],*p1,*p2;
//	return (p1==p2)&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
	return getchar();
}

template<class T>
int read(T &ans) {
	ans=0;char ch=gc();T f=1;
	while(!isdigit(ch)) {
		if(ch==EOF) return -1;
		if(ch=='-') f=-1;
		ch=gc();
	}
	while(isdigit(ch))
		ans=ans*10+ch-'0',ch=gc();
	ans*=f;return 1;
}

template<class T1,class T2>
int read(T1 &a,T2 &b) {
	return read(a)!=EOF&&read(b)!=EOF?2:EOF;
}

template<class T1,class T2,class T3>
int read(T1 &a,T2 &b,T3 &c) {
	return read(a,b)!=EOF&&read(c)!=EOF?3:EOF;
}

typedef long long ll;
const int Maxn=210000;
const int inf=0x3f3f3f3f;
const ll mod=1000000007;

ll jc[Maxn],ijc[Maxn],inv[Maxn],n,m,q,f[Maxn];

struct node {
	ll x,y;
}a[Maxn];

ll C(int n,int k) {
	return jc[n]*ijc[k]%mod*ijc[n-k]%mod;
}

int cmp(node a,node b) {
	return a.x==b.x?a.y<b.y:a.x<b.x;
}

signed main() {
//	freopen("test.in","r",stdin);
	read(n,m);
	inv[0]=inv[1]=1;
	for(int i=2;i<=n+m;i++) inv[i]=(mod-mod/i)*inv[mod%i]%mod;
	jc[0]=ijc[0]=1;
	for(int i=1;i<=n+m;i++) jc[i]=jc[i-1]*i%mod,ijc[i]=ijc[i-1]*inv[i]%mod;
	read(q);
	for(int i=1;i<=q;i++) read(a[i].x,a[i].y);
	sort(a+1,a+q+1,cmp);
	a[0]=(node){1,1};a[++q]=(node){n,m};
	f[0]=1;
	for(int i=0;i<q;i++) for(int j=i+1;j<=q;j++) if(a[i].y<=a[j].y)
		f[j]=(mod+f[j]-f[i]*C(a[j].x-a[i].x+a[j].y-a[i].y,a[j].x-a[i].x)%mod)%mod;
	printf("%lld",(mod-f[q])%mod);
	return 0;
}



Measured memory_bytes: 7936
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <unordered_map>
#include <iomanip>

#define DEBUG(x) cout << "> " << #x << ": " << x << "\n";

using namespace std;

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

int main() {

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

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

	swap(a, b);
	swap(a, c);

	cout << a << " " << b << " " << c << "\n";

	return 0;

}

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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define ALLTRUE(xs) all_of(ALL(xs),[](bool x){return x;})
#define AND(x,y,z) set_intersection((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define ANYTRUE(xs) any_of(ALL(xs),[](bool x){return x;})
#define CONCAT(x,y) (x).insert((x).end(),(y).begin(),(y).end())
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define DUMPP(xs) for (auto x:xs) cout<<'('<<x.first<<','<<x.second<<')';cout<<endl
#define FOR(i,a,b) for (ll i=(ll)(a);i<(ll)(b);++i)
#define OR(x,y,z) set_union((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)

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

struct edge { int to,cost; };
const int MOD=1e9+7;

int N;
vector<char> cs{'A','C','G','T'};
vector<map<string, ll>> memo;

bool checker(string last4) {
  REP(i,4) {
    string tmp = last4;
    if (i>0) swap(tmp[i-1],tmp[i]);
    if (tmp.find("AGC")!=string::npos) return false;
  }
  return true;
}

ll dfs(int cur, string last3) {
  if (memo[cur][last3]) return memo[cur][last3];
  if (cur==N) return 1;

  ll ret = 0;
  for (char c:cs) {
    if (checker(last3+c)) {
      ret = (ret+dfs(cur+1,last3.substr(1,2)+c))%MOD;
    }
  }
  memo[cur][last3] = ret;
  return ret;
}

int main() {
  cin>>N;
  memo.resize(N+1);
  OUT(dfs(0,"TTT"));

  return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <cstdlib>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}





int main() {
	string O, E;
	cin >> O >> E;
	rep(i, E.size()) {
		cout << O.at(i) << E.at(i);
	}
	if (E.size() < O.size())cout << O.at(O.size()-1);
}


Measured memory_bytes: 256
import itertools
N = int(input())
digits = [3, 5, 7]


def get_A_product(digits, N):
    A = []
    flag = False
    p = 3
    while True:
        for tup in itertools.product(digits, repeat=p):
            a = int("".join(list(map(str, tup))))
            if a > N:
                flag = True
                break
            A.append(a)
        if flag:
            break
        p += 1
    return A


count = 0
A = get_A_product(digits, N)
for a in A:
    if all(str(a).count(c) > 0 for c in '753'):
        count += 1
print(count)


Measured memory_bytes: 4364
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=10005,INF=1<<28;

bool dp[MAX][3][3];

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    vector<string> S(3);
    vector<int> T(3);
    for(int i=0;i<3;i++){
        cin>>S[i];
        T[i]=S[i].size();
    }
    
    for(int x=0;x<3;x++){
        for(int y=0;y<3;y++){
            if(x==y) continue;
            for(int i=0;i<MAX;i++) dp[i][x][y]=1;
            
            for(int i=-T[y]+1;i<T[x];i++){
                for(int j=0;j<T[x];j++){
                    if(j-i<0||j-i>=T[y]) continue;
                    
                    if(S[x][j]!='?'&&S[y][j-i]!='?'&&S[x][j]!=S[y][j-i]) dp[5000+i][x][y]=0;
                }
            }
        }
    }
    
    int ans=INF;
    
    for(int j=0;j<=8000;j++){
        for(int k=0;k<=8000;k++){
            bool ok=true;
            
            if(!dp[5000+4000-j][1][0]) ok=false;
            if(0<=5000+j-k&&5000+j-k<MAX&&!dp[5000+j-k][2][1]) ok=false;
            if(!dp[5000+4000-k][2][0]) ok=false;
            if(!dp[5000+j-4000][0][1]) ok=false;
            if(0<=5000+k-j&&5000+k-j<MAX&&!dp[5000+k-j][1][2]) ok=false;
            if(!dp[5000+k-4000][0][2]) ok=false;
            
            if(ok){
                ans=min(ans,max({4000+T[0],j+T[1],k+T[2]})-min({4000,j,k}));
            }
        }
    }
    
    cout<<ans<<endl;
    
}


Measured memory_bytes: 512
import math

n, d = map(int, raw_input().split(" "))

x = []
for i in range(0, n):
    x.append(map(int, raw_input().split(" ")))

ans = 0
for i in range(0, n):
    for j in range(i + 1, n):
        dist2 = 0
        for a in range(0, len(x[i])):
            tmp = x[i][a] - x[j][a]
            dist2 += tmp * tmp

        root = int(math.sqrt(dist2))
        if root * root == dist2:
            ans += 1

print(ans)


Measured memory_bytes: 2692
#include<stdio.h>
int main()
{
	int i,j,H,W;
	while(1)
	{
		scanf("%d%d",&H,&W);
		if(H==0||W==0) break;
		for(i=0;i<H;i++)
		{
			for(j=0;j<W;j++)
			{
				printf("#");
			}
			printf("\n");
		}
	printf("\n");
	}
	return 0;
}

Measured memory_bytes: 572
#include<stdio.h>
int main(){
  int a,i,b,count=0,count2=0;


  while(1)
    {
      count=0;
      
      
      scanf("%d%d",&a,&b);
	    
    if(a==0 && b==0){ break; }
      
    if(count2++ > 0)
      {
	  printf("\n");
      }
    
    for(i=a;i<=b;i++)
      {
	
	if(i%4==0 && i%100!=0)
	  {
	    printf("%d\n",i);
	    count++;
	  }
	else if(i%400==0)
	  {
	    printf("%d\n",i);
	    count++;
	  }

      }
    
    if(count==0)
      {
	printf("NA\n");

      }
      
    
    
    }

  return 0;
}

Measured memory_bytes: 0
import java.util.*;
import java.lang.Math;

public class Main{
	public static void main(String ards[]){
    	Scanner sc = new Scanner(System.in);
    	String S = sc.next();
      	String ans ="None";
		if(S.indexOf("a")==-1){
        	ans = "a";
        }else if(S.indexOf("b")==-1){
        	ans = "b";
        }else if(S.indexOf("c")==-1){
        	ans = "c";
        }else if(S.indexOf("d")==-1){
        	ans = "d";
        }else if(S.indexOf("e")==-1){
        	ans = "e";
        }else if(S.indexOf("f")==-1){
        	ans = "f";
        }else if(S.indexOf("g")==-1){
        	ans = "g";
        }else if(S.indexOf("h")==-1){
        	ans = "h";
        }else if(S.indexOf("i")==-1){
        	ans = "i";
        }else if(S.indexOf("j")==-1){
        	ans = "j";
        }else if(S.indexOf("k")==-1){
        	ans = "k";
        }else if(S.indexOf("l")==-1){
        	ans = "l";
        }else if(S.indexOf("m")==-1){
        	ans = "m";
        }else if(S.indexOf("n")==-1){
        	ans = "n";
        }else if(S.indexOf("o")==-1){
        	ans = "o";
        }else if(S.indexOf("p")==-1){
        	ans = "p";
        }else if(S.indexOf("q")==-1){
        	ans = "q";
        }else if(S.indexOf("r")==-1){
        	ans = "r";
        }else if(S.indexOf("s")==-1){
        	ans = "s";
        }else if(S.indexOf("t")==-1){
        	ans = "t";
        }else if(S.indexOf("u")==-1){
        	ans = "u";
        }else if(S.indexOf("v")==-1){
        	ans = "v";
        }else if(S.indexOf("w")==-1){
        	ans = "w";
        }else if(S.indexOf("x")==-1){
        	ans = "x";
        }else if(S.indexOf("y")==-1){
        	ans = "y";
        }else if(S.indexOf("z")==-1){
        	ans = "z";
        }
      	System.out.println(ans);
    }
}

Measured memory_bytes: 24020
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n;
    cin>>n;
    int b,f,r,v;
    int house[4][3][10]={{{}}};
    for(int i=0;i<n;i++)
    {
        cin>>b>>f>>r>>v;
        house[b-1][f-1][r-1]+=v;
    }
    for(int s=0;s<4;s++)
    {
        for(int t=0;t<3;t++)
        {
            for(int u=0;u<10;u++)
            {
                cout<<" "<<house[s][t][u];
            }
            cout<<endl;
        }
        if(s<3)cout<<"####################"<<endl;
        else continue;
    }
    return 0;
}


Measured memory_bytes: 3088
#include <cstdlib>
#include <iostream>
#include <string>
#include <time.h>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <vector>
#include <functional>
#include <numeric>
#include <cassert>
#include <algorithm>
#include <functional>
//#include "bits/stdc++.h"
using namespace std;
//using namespace std::vector;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)

#define huge 1000000007
typedef long long int ll;
ll gcd(ll a, ll b);
ll bur(ll N, ll X);
bool IsPrime(int num);

int main(void) {

	ll N = 0;
	ll A = 0;
	ll B = 0;
	ll C = 0;
	ll D = 0;
	ll L = 0;
	ll P = 0;
	//ll T = 0;
	//ll M = 0;
	ll h[1000] = {};
	//ll b[100] = {};
	//ll c[100] = {};
	//ll d[100] = {};

	//ll v[3] = {};
	//ll *c, *s, *n;
	string S[50],T[50],U[52];
	ll count = 0;
	ll count2 = 0;
	float sum = 0;
	ll min = 1000000000000;
	ll max = 1;
	ll dist1 = 0;
	ll dist2 = 0;
	ll now = 0;
	int tmax = 0;
	int tmax2 = 0;
	//int flag = 0;
	char temp,head;
	//int is = 0;
	bool flag = false;
	
	//char p;

	ll all = 0;
	ll niku = 0;
	ll state = 2;
	bool down = true;
	

	//cin >> S;
	
	
	
	
	cin >>temp >> head;
	vector<int> tr(3);
	
	
	if(temp == head)
	cout << "H" << endl;
	else
		cout << "D" << endl;

	//x = (ll *)malloc((N+1) * sizeof(ll));
	//c = (ll *)malloc((N) * sizeof(ll));
	//cin >> D >> G;
	//vector<pair<int,int>> tr(M);
	//vector<pair<int,int>> qes(Q);
	//sort(c.begin(), c.end());
	
	//cout << c[2] - c[1] << endl;

	
	/*A = N / 1000;
	N %= 1000;
	B = N / 100;
	N %= 100;
	C = N / 10;
	N %= 10;
	D = N;*/
	


	//cin >> N >> M;

	//vector<pair<int,int>> c(M);
	////vector<pair<int, int>> e(M);
	//vector<ll> d(M);

	//rep(i, 0, M) {
	//	cin >> c[i].first >> c[i].second;
	//	//e[i].first = c[i].first;
	//	//e[i].second = c[i].second;

	//}
	////sort(c.begin(), c.end());

	//

	//rep(i, 0, M) {

	//	
	//	
	//	rep(j, 0, M) {
	//		if (c[i].first == c[j].first && c[j].second < c[i].second) {
	//			d[i]++;
	//			//cout << j << endl;
	//		}
	//	}
	//	cout << std::setfill('0') << std::right << std::setw(6) << c[i].first;
	//	cout << std::setfill('0') << std::right << std::setw(6) << d[i]+1 << endl;
	//}

	return 0;

}

ll bur(ll N,ll X) {
	ll pan = 1;
	ll pat = 1;
	ll burg = 0;



	if (X > burg) {
		if (N == 0)
			return pat;


		burg += pan;
		burg += bur(N - 1, X);
		burg += pat;
		burg += bur(N - 1, X);
		burg += pan;


	}

	return burg;

}

ll gcd(ll a, ll b) {
	
	/* 自然数 a > b を確認・入替 */
	if (a<b) {
		ll tmp = a;
		a = b;
		b = tmp;
	}
	ll x = b;
	ll y = a;
	/* ユークリッドの互除法 */
	ll r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}


	return y/b*x;
}

bool IsPrime(int num)
{
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			// 素数ではない
			return false;
		}
	}

	// 素数である
	return true;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cassert>
#include<iostream>
#include<algorithm>
#define llong long long
using namespace std;

inline int read()
{
	int x=0; bool f=1; char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=0;
	for(; isdigit(c);c=getchar()) x=(x<<3)+(x<<1)+(c^'0');
	if(f) return x;
	return -x;
}

const int N = 2e5;
const int P = 998244353;
int mu[N+3];
int pri[N+3];
bool isp[N+3];
char a[N+3];
char b[N+3];
llong f[N+3],g[N+3];
int n,np;

void EulerSieve()
{
	isp[1] = true; mu[1] = 1;
	for(int i=2; i<=N; i++)
	{
		if(isp[i]==false) {np++; pri[np] = i; mu[i] = -1;}
		for(int j=1; j<=np && i*pri[j]<=N; j++)
		{
			isp[i*pri[j]] = true;
			if(i%pri[j]==0) {mu[i*pri[j]] = 0; break;}
			mu[i*pri[j]] = -mu[i];
		}
	}
}

int main()
{
	EulerSieve();
	scanf("%d",&n); scanf("%s",a); for(int i=0; i<n; i++) a[i] -= 48;
	llong ans = 0ll;
	for(int i=1; i<=n; i++)
	{
		if(((n/i)&1)==1 && n%i==0)
		{
			llong cur = 0ll;
			for(int k=0; k<i; k++) {b[k] = a[k];}
			for(int k=0; k<i; k++) {cur = ((cur<<1)|b[k])%P;}
//			printf("i=%d cur=%lld\n",i,cur);
//			printf("b: "); for(int k=0; k<i; k++) printf("%d",b[k]); puts("");
			bool ok = true;
			for(int j=i,typ=1; j<n; j+=i,typ^=1)
			{
				for(int k=0; k<i; k++) b[j+k] = b[k]^typ;
				bool found = false;
				for(int k=0; k<i; k++)
				{
					if(b[j+k]>a[j+k]) {ok = false; found = true; break;}
					if(b[j+k]<a[j+k]) {ok = true; found = true; break;}
				}
				if(found) break;
			}
//			printf("b: "); for(int k=0; k<n; k++) printf("%d",b[k]); puts("");
			if(ok) {cur++;}
//			printf("cur=%lld\n",cur);
			f[i] = cur;
		}
	}
	for(int i=1; i<=n; i++)
	{
		if(n%i) continue;
		for(int j=1; j*i<=n; j++)
		{
			if(n%(j*i)) continue;
			g[j*i] = (g[j*i]+f[i]*mu[j]+P)%P;
		}
	}
	for(int i=1; i<=n; i++)
	{
//		printf("g[%d]=%lld\n",i,g[i]);
		ans = (ans+g[i]*2ll*i)%P;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 3328
package main

import (
	"fmt"
	"sync"
)

type graph struct {
	path []int
	height int
	// flag bool // pathに存在するもので自分より高いものがあればtrue
}
var graphs []graph
func main() {
	var N,M int
	fmt.Scan(&N,&M)
	graphs = make([]graph,N)
	for i:= 0; i<N; i++ {
		var h int
		fmt.Scan(&h)
		graphs[i].height = h
		graphs[i].path = []int{}
		// graphs[i].flag = false
	}
	for i:= 0; i<M; i++ {
		var a,b int
		fmt.Scan(&a,&b)
		graphs[a-1].path = append(graphs[a-1].path,b-1)
		graphs[b-1].path = append(graphs[b-1].path,a-1)
	}
	count := 0
	var wg sync.WaitGroup
	for i:=0; i<N; i++ {
		wg.Add(1)
		go func(i int) {
			paths := graphs[i].path
			height := graphs[i].height
			bestHeight := true // 一番高いのならtrue
			for _, value := range paths {
				if height <= graphs[value].height {
					bestHeight = false
					break
				}
			}
			if bestHeight {
				// fmt.Println(graphs[i],"ベスト")
				count++
			}
			defer wg.Done()
		}(i)
	}
	wg.Wait()
	fmt.Println(count)
}


Measured memory_bytes: 97456
#include<iostream>
#include<string>
using namespace std;
int main(){
  string str;
  int ab[26]={};
  int i;
  while(getline(cin,str)){
    for(i=0;i<str.size();i++){
      if(str[i]>='a'&&str[i]<='z') ab[str[i]-'a']++;
      else if(str[i]>='A'&&str[i]<='Z') ab[str[i]-'A']++;
    }
  //cout << str << endl;
  }
  for(i=0;i<26;i++){
    cout << (char)('a'+i) << " : " << ab[i] << endl;
  }
  return 0;
}


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

using namespace std;

void solve() {
  int n, k;
  cin >> n >> k;
  vector<int> a(200001);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    ++a[x];
  }
  sort(a.begin(), a.end(), greater<>());
  long long ans = 0;
  for (int i = k; i < n; i++) {
    ans += a[i];
  }
  cout << ans << endl;
}

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

  solve();
  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<iomanip>

using namespace std;
int main(void) {
	int n;
	int v[20];
	int c[20];
	
	int i,j;
	int x = 0, y = 0;
	int z = 0;
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> v[i];
	}
	for (i = 0; i < n; i++) {
		cin >> c[i];
	}
	for (i = 0; i < n; i++) {
		x = v[i];
		y = c[i];
		
		for (j = 0; j < n; j++) {
			if (i != j) {
				if ((x - y) < ((x+v[j]) - (y+c[j]))) {
					x += v[j];
					y += c[j];
					
				}
				if (z < (x - y))
					z = x - y;
			}
		}
	}
	cout << z;
	
	return 0;
}

Measured memory_bytes: 256
object Main extends App {
  var n = scala.io.StdIn.readInt()
  var s = scala.io.StdIn.readLine()
  var k = scala.io.StdIn.readInt()

  val word = s.charAt(k - 1)
  val answer = s.map { c =>
    if (c == word) {
      c
    } else {
      "*"
    }
  }.mkString
  print(answer)
}

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

using namespace std;

typedef long long ll;

int main(){
	int n, m, k;
	cin >> n >> m >> k;
	char matrix[n][m];
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			cin >> matrix[i][j];
		}
	}
	int sol = 0;
	for(int i = 0; i < (1<<n); i++){
		for(int j = 0; j < (1<<m); j++){
			int cnt = 0;
			for(int row = 0; row < n; row++){
				if(!((i >> row) & 1)) continue;
				for(int col = 0; col < m; col++){
					if(!((j >> col) & 1)) continue;
					if(matrix[row][col] == '#') cnt++;
				}
			}
			if(cnt == k) sol++;
		}

	}
	cout << sol << '\n';
}


Measured memory_bytes: 3544
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,n,m) for(int i=n;i<m;i++)
#define elif else if
#define INF 1000000007
using namespace std;
int gcd(int a,int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int n,m,cnt=0,aa[220000],o;
pair<int,int> p[220000];
string s,ss[110000];
char c;
signed main(){
    cin>>n>>m>>o;
    cout<<o<<" "<<n<<" "<<m;
}

Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <sys/time.h>
#include <random>


#define fs first
#define sc second

using namespace std;

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

template<typename T>
class KMP{
    vector<int> a;
    T s;

public:
    KMP(T s_arg): s(s_arg){
        int n = s_arg.size();
        a = vector<int>(n+1, -1);   // a[j+1]が[0, j]のboarderの最大の長さ
        constructBorderArray();
    }

    void constructBorderArray(){
        int j = -1;
        for(int i = 0; i < s.size(); i++){
            while(j >= 0 && s[i] != s[j]){
                j = a[j];
            }

            j++;
            if(s[i+1] == s[j]) a[i+1] = a[j];
            else a[i+1] = j;
        }
    }

    /**
     *
     * @param x: sとマッチングさせる配列
     * @return : マッチング位置
     */
    vector<int> search(T x, int pos=0){
        int j = 0;
        vector<int> res;
        for(int i = pos; i < x.size(); i++){
            while(j >= 0 && x[i] != s[j]){
                j = a[j];
            }
            j++;
            if(j == s.size()){
                res.push_back(i - j + 1);
                j = a[j];
            }
        }
        return res;
    }

};



int main(){
    string s, t;   cin >> s >> t;

    KMP<string> kmp(t);
    vector<int> res = kmp.search(s);

    for(auto x: res){
        cout << x << endl;
    }


    return 0;
}



Measured memory_bytes: 9408
//Use valgrind once if the submission doesn't go through. It can detect uninitialized variables and see where they could be an issue.
#include <bits/stdc++.h>
using namespace std;

int main(){

	ios_base::sync_with_stdio(false);
    	cin.tie(NULL);

	unsigned long long n;
	cin>>n;
	stack<int> s;
	while(n)
	{
		if(n%26)
		{
			s.push(n%26);
			n/=26;
		}
		else
		{
			s.push(26);
			n/=26;
			n--;
		}
		
	}
	while(!s.empty())
	{
		cout<<(char)(s.top()+'a'-1);
		s.pop();
	}
	cout<<endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007; // 998244353
using ll = long long;
using namespace std;

const int bound = 100010;
const int tkhs = 0;
const int aok = 1;
vector<int> graph[bound];
bool bscht[bound][2];
int dist[bound][2];

void dfs( char mode, int now, int d = 0 ){
	bscht[now][mode] = true;
	dist[now][mode] = d;
	for( auto next : graph[now] ){
		if( bscht[next][mode] ) continue;
		dfs( mode, next, d+1 );
	}
}
int main(){
	int n, u, v; cin >> n >> u >> v; 
	--u; --v;
	for( int i = 0; i < n-1; ++i ){
		int a, b; cin >> a >> b;
		--a; --b;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	dfs(tkhs, u);
	dfs(aok, v);
	int ans = 0;
	for( int i = 0; i < n; ++i){
		if( dist[i][tkhs] < dist[i][aok] ){
			ans = max(ans, dist[i][aok]-1);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 10496
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>
#include <stack>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define sz(x) (ll)(x).size()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;
typedef vector<ll> vl;
typedef vector<P> vp;

const ll INF = 1e15;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  while (true) {
    ll n,m;
    cin >> n >> m;
    if (n == 0 && m == 0) { break; }
    vector<ll> c(m);
    rep(i,m) {
      cin >> c[i];
    }
    vector<ll> x(n);
    rep(i,n) {
      cin >> x[i];
    }

    // dp[i][j] .. min cost using [0,i), select j as prev. j is in [0,255]
    vector<vector<ll>> dp(n+1,vector<ll>(256, INF));
    dp[0][128] = 0;
    rep(i,n) {
      rep(j,256) { // prev value
        if (dp[i][j] == INF) { continue; }
        // cout << "dp[i][j]: " << dp[i][j] << endl;
        rep(k,m) {
          ll now = j + c[k];
          chmax(now, 0ll);
          chmin(now, 255ll);
          ll cost = (x[i]-now)*(x[i]-now); // when select k, cost is (x[i]-now)^2
          chmin(dp[i+1][now], dp[i][j] + cost);
        }
      }
    }

    ll ans = INF;
    rep(i,256) {
      chmin(ans, dp[n][i]);
    }
    cout << ans << endl;
  }
}



Measured memory_bytes: 43928
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public int N;
        public int[] T, V;
        public long MOD = 1000000007;

        public void Run()
        {
            N = Input.ReadInt();
            T = Input.ReadIntArray();
            V = Input.ReadIntArray();
            int[] S = new int[N+1];

            for (int a = 0; a <= N; a++)
            {
                S[a] = 1000000;
            }

            for (int a = 0; a <= N; a++)
            {
                if (a == 0 || a == N) S[a] = 0;
                else
                {
                    S[a] = Math.Min(S[a], S[a-1] + T[a-1]);
                    S[a] = Math.Min(S[a], V[a]);
                    S[a] = Math.Min(S[a], V[a-1]);
                }
            }
            for (int a = N; a >= 0; a--)
            {
                if (a == 0 || a == N) S[a] = 0;
                else
                {
                    S[a] = Math.Min(S[a], S[a + 1] + T[a]);
                    S[a] = Math.Min(S[a], V[a]);
                    S[a] = Math.Min(S[a], V[a - 1]);
                }
            }

            double ret = 0;
            for (int i = 0; i < N; i++)
            {
                ret += area(V[i], T[i], S[i], S[i + 1]);
            }
            Console.Error.WriteLine(string.Join(", ", S));
            Console.WriteLine(ret);
        }

        public double area(int v, int t, int s, int e)
        {
            double mx = Math.Min((s + e + t) / 2.0, v);
            double a = mx - s;
            double c = mx - e;
            double b = t - a - c;

            double ret = 0;
            ret += a * (s + mx) / 2.0;
            ret += b * mx;
            ret += c * (e + mx) / 2.0;
            return ret;
        }
    }

    // libs ----------
    

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

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

int main()
{
    int N;
    vector<int> A;
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        int temp;
        cin >> temp;
        A.push_back(temp);
    }

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

    cout << abs(A[0] - A[N - 1]);

    return 0;
}

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

using namespace std;
using namespace __gnu_cxx;

#define all(v)   v.begin(), v.end()
#define UNIQUE(c) (c).resize(unique(all(c)) - (c).begin())
#define endl "\n"
#define pb push_back
#define F first
#define S second
#define START cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
#define isOdd(n)    (n&1)
#define LLMAX LLONG_MAX
#define LLMIN LLONG_MIN
#define IMN INT_MIN
#define IMX INT_MAX
#define pow(n, m) power((ll)n, (ll)m)
#define numOfDigits(n)  ((n)? (ll)(log10(n))+1 : 1)
#define mem(x, val)    memset(x, val, sizeof(x)) //be careful
#define var auto
#define MOD 1000000007


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


int main()
{
    START
    //freopen("test cases\\in.txt", "r", stdin) ;
    int n, m; cin>>n>>m;
    char arr[n][m];
    for(int i =0; i<n; i++){
        for(int j = 0; j<m; j++)
            cin>>arr[i][j];
    }
    for(int i =0; i<n; i++){
        for(int j = 0; j<m; j++)
            cout<<arr[i][j];
        cout<<endl;
        for(int j = 0; j<m; j++)
            cout<<arr[i][j];
        cout<<endl;
    }

	return 0;
}


Measured memory_bytes: 256
'use strict'
N,K,Q  = map(int, input().split())
point_list = [K-Q] * N

for i in range(Q):
  point_list[int(input())-1] += 1

for i in range(N):
  if point_list[i] > 0:
    print('Yes')
  else:
    print('No')


Measured memory_bytes: 6580
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

#define ll long long

int main() {
    using namespace std;
    ll n, k;
    cin >> n >> k;
    vector<int> A(n), F(n);
    for(int i = 0; i < n; i++) cin >> A[i];
    for(int i = 0; i < n; i++) cin >> F[i];
    sort(A.begin(), A.end());
    sort(F.begin(), F.end());
    reverse(F.begin(), F.end());

    ll result = 0;
    for(int i = 0; i < n; i++)
        result = max(result, (ll)A[i] * F[i]);

    ll a = 0, b = result + 1, c;
    while(a < b) {
        c = (a + b) / 2;

        ll x = 0;
        for(int i = 0; i < n; i++)
            x += max((ll)0, A[i] - c / F[i]);

        if(x <= k)
            b = c;
        else
            a = c + 1;
    }

#if 0
    for(int i = 0; i < n; i++)
        cout << A[i] << " ";
    cout << "\n";
    for(int i = 0; i < n; i++)
        cout << F[i] << " ";
#endif

    cout << a << "\n";
    return 0;
}


Measured memory_bytes: 1792
// J'aime
// Chemise Blanche

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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr << __LINE__ << " > " << #x << " = " << (x) << endl

void MAIN() {
  int k;
  cin >> k;
  string s;
  cin >> s;
  if (s.size() <= k) cout << s << '\n';
  else {
    cout << s.substr(0, k) << "..." << '\n';
  }
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


Measured memory_bytes: 3612
import java.util.Scanner;

public class Main {

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

        if (a.charAt(0) <= 'Z') {
            System.out.println("A");
        } else {
            System.out.println("a");
        }

    }

}


Measured memory_bytes: 35668
#include<stdio.h>

int main(void){

  int N;
  scanf("%d",&N);
  int i;
 
  int V[N];
  int C[N];
  int ans=0;
  
  for(i=0;i<N;i++){
    scanf("%d",&V[i]);
  }
  for(i=0;i<N;i++){
    scanf("%d",&C[i]);
  }
 
  for(i=0;i<N;i++){
    if(V[i]-C[i]>0) ans = ans + V[i]-C[i];
    else{}
  }

  printf("%d\n",ans);

  return 0;
}




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

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


Measured memory_bytes: 3648
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    string s, t; cin >> s >> t;

    vector<vector<int>> dp(s.length() + 1, vector<int>(t.length() + 1, 0));
    vector<vector<int>> prev(dp);
    for (int i = 0; i <= s.length(); i++) {
        for (int j = 0; j <= t.length(); j++) {
            if (i != s.length() && chmax(dp[i + 1][j], dp[i][j])) {
                prev[i + 1][j] = 0;
            }
            if (j != t.length() && chmax(dp[i][j + 1], dp[i][j])) {
                prev[i][j + 1] = 1;
            }
            if (i != s.length() && j != t.length() &&
                s[i] == t[j] && chmax(dp[i + 1][j + 1], dp[i][j] + 1)) {
                prev[i + 1][j + 1] = 2;
            }
        }
    }
    string res = "";
    int i = s.length(), j = t.length();
    while (i > 0 && j > 0) {
        if (prev[i][j] == 2) i--, j--, res += s[i];
        if (prev[i][j] == 1) j--;
        if (prev[i][j] == 0) i--;
    }
    reverse(res.begin(), res.end());
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 70784
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans[ohara], a, b, c, d, tmp, m, h, w, x, y[ohara], sum, k, q;
pair<P, ll> p[ohara];
U_MAP mp;

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

  cin >> n >> m;
  rep(i, m) {
    cin >> p[i].fi.se >> p[i].fi.fi;
    p[i].se = i;
    y[i] = p[i].fi.se;
  }
  sort(p, p + m);
  cnt = 1;
  rep(i, m) {
    ans[p[i].se] = mp[p[i].fi.se] + 1;
    mp[p[i].fi.se]++;
  }
  rep(i, m) {
    s = to_string(y[i]);
    rep(j, 6 - Size(s)) cout << "0";
    cout << s;
    s = to_string(ans[i]);
    rep(j, 6 - Size(s)) cout << "0";
    cout << s << "\n";
  }
  return 0;
}

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

int main() {
  long long N,D,A;
  cin >> N >> D >> A;
  vector<pair<long long,long long>> V(N);
  for(int i=0;i<N;i++){
    long long x,h;
    cin >> x >> h;
    h = (h+A-1)/A;
    V[i] = make_pair(x,h);
  }
  sort(V.begin(),V.end());
  vector<long long> X(N);
  for(int i=0;i<N;i++) X[i] = V[i].first;
  
  vector<long long> L(N);
  for(int i=0;i<N;i++){
    L[i] = (upper_bound(X.begin(),X.end(),X[i]+2*D)-X.begin())-1;
  }
  
  long long ans=0,S=0,p=0;
  for(int i=0;i<N;i++){
    int x = lower_bound(L.begin(),L.end(),i) - L.begin();
    for(;p<x;p++) S -= V[p].second;
    
    if(V[i].second-S>0){
      ans += V[i].second-S;
      V[i].second -= S;
      S += V[i].second;
    }
    else V[i].second = 0;
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
int n,k,m;

int main()
{	cin>>n>>k;
    m=n*(n-1)/2-k;
    if(m<n-1) 
		m=-1;
    cout<<m<<endl;
    if(m!=-1)
	{
        int cnt=n-1;
        while(m>0)
		{
            for(int i=n-cnt+1;i<=min(n,n-cnt+m);++i) 
				cout<<n-cnt<<" "<<i<<endl;
            m-=cnt;
cnt--;
        }
    }
    return 0;
}


Measured memory_bytes: 256
import sys

while 1:
  n = input() + 1
  if n==1: break
  N = range(n)
  M = [0] * n
  y = [0] * n
  for i in N[1:]:
    x = [0] * n
    A = ' ' + raw_input()
    for j in N[1:]:
      if A[j] == '.': x[j] = min(y[j-1],y[j],x[j-1]) + 1
    M[i]=max(x)
    y = x
  print max(M)

Measured memory_bytes: 4344
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using T = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define print(v) cout<<v<<endl;
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
template <typename T> bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1000000007;

struct F{
    ll o1;ll o2;ll o3;ll o4;
};

int main(){
    ll H;
    cin >> H;
    ll W;
    cin >> W;
    vector<vector<ll>> A(H, vector<ll>(W, 0));
    for(ll i=0;i<H;i++)
        for(ll j=0;j<W;j++)cin>>A[i][j];
    vector<F> ans(0);
    ll count=0;
    for(ll i=0;i<H;i++){
        for(ll j=0;j<W-1;j++){
            if(A[i][j]%2){
                count++;
                A[i][j]--;
                A[i][j+1]++;
                ans.emplace_back(F{i,j,i,j+1});
            }
        }
        if(i!=H-1&&A[i][W-1]%2){
            count++;
            A[i][W-1]--;
            A[i+1][W-1]++;
            ans.emplace_back(F{i,W-1,i+1,W-1});
        }
    }
    print(count)
    for(auto p: ans)cout<<p.o1+1<<" "<<p.o2+1<<" "<<p.o3+1<<" "<<p.o4+1<<endl;
    return 0;
}

Measured memory_bytes: 8304
#include <bits/stdc++.h>
#define rep(i,n) for (int i= 0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const long long INF = 1LL << 60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){

    string s,t;cin>>s>>t;
    string x;
    rep(i,s.size()){
        x+=t[i];
    }
    if(s==x)cout<<"Yes"<<endl;

    else cout<<"No"<<endl;

}

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

int main(){
  int N, a;
  cin >> N;
  vector<int> card(N);
  for(int i=0; i<N; i++){
      cin >> card.at(i);
  }
  sort(card.begin(), card.end());
  reverse(card.begin(), card.end());
  int alice=0;
  int bob=0;

  for(int i=0; i<N; i++){
      if(i%2==0){
          alice=alice+card.at(i);
      }
      else{
          bob=bob+card.at(i);
      }
  }
  cout << alice-bob << endl;
}

Measured memory_bytes: 256