akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <string>
#include <bitset>
#include <deque>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define print(x) cout<<(x)<<endl
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define INF10 1001001001 
#define INF5 100000
#define EPS 1e-10


int atable[100010];
int btable[100010];

int main() {
	int N; cin >> N;
	vector<int>a, b;
	REP(i, N) {
		int ipt; cin >> ipt;
		if (i % 2 == 0) {
			a.push_back(ipt);
			atable[ipt]++;
		}
		else {
			b.push_back(ipt);
			btable[ipt]++;
		}
	}
	vector<P>alist, blist;
	REP(i, 100001) {
		if (atable[i] != 0) {
			alist.push_back(make_pair(atable[i], i));
		}
		if (btable[i] != 0) {
			blist.push_back(make_pair(btable[i], i));
		}
	}

	sort(alist.rbegin(), alist.rend());
	sort(blist.rbegin(), blist.rend());
	if (alist[0].first == N / 2 && blist[0].first == N / 2) {
		if (alist[0].second != blist[0].second) {
			print(0);
		}
		else print(N / 2);
	}
	else if (alist[0].first == N / 2) {
		if (blist[0].second != alist[0].second) {
			print(N / 2 - blist[0].first);
		}
		else {
			print(N / 2 - blist[1].first);
		}
	}
	else if (blist[0].first == N / 2) {
		if (alist[0].second != blist[0].second) {
			print(N / 2 - alist[0].first);
		}
		else {
			print(N / 2 - alist[1].first);
		}
	}
	else {
		if (alist[0].second == blist[0].second) {
			if (alist[0].first > blist[0].first) {
				print(N - alist[0].first - blist[1].first);
			}
			else if (alist[0].first < blist[0].first) {
				print(N - alist[1].first - blist[0].first);
			}
			else {
				if (alist[1].first > blist[1].first) {
					print(N - alist[1].first - blist[0].first);
				}
				else print(N - alist[0].first - blist[1].first);
			}
		}
		else {
			print(N - alist[0].first - blist[0].first);
		}
	}



	return 0;
}


Measured memory_bytes: 2468
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
#ifndef STOP_DEBUG
#define debug(...)\
    do { cerr << boolalpha << "[" << #__VA_ARGS__ << "]:";\
    debug_cerr(__VA_ARGS__); cerr << noboolalpha; } while (0)
#else
#define debug(...)
#endif
void debug_cerr(){ cerr << '\n'; }
template<class Head, class... Tail>
void debug_cerr(Head head, Tail... tail){
  cerr << ' ' << head;
  debug_cerr(tail...);
}
void chmax(lint &a, lint b) { if (a < b) a = b; }
void chmin(lint &a, lint b) { if (a > b) a = b; }
struct IoSetup{
    IoSetup(){
      ios::sync_with_stdio(false);
      cin.tie(nullptr);
      cout << fixed << setprecision(20);
      cerr << fixed << setprecision(20);
    }
} iosetup;

int main() {
  lint n;
  cin >> n;
  vector<int> vec(n);
  lint ans = -1;
  for (int i = 0; i < n; ++i) {
    cin >> vec[i];
  }
  lint count = 1;
  for (int i = 0; i < n; ++i) {
    if (vec[i] == count) {
      count++;
      ans++;
    }
  }
  if (ans == -1) cout << -1 << '\n';
  else cout << n - ans-1  << '\n';
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define int ll
#define ll long long
signed main(){
  string s;
  int r=0;
  cin>>s;
  for(int i=0;i<1<<(s.size()-1);++i){
    int b=i,c=s[0]-'0';
    for(int j=0;j<s.size()-1;++j,b>>=1){
      if(b&1)r+=c,c=0;
      else c*=10;
      c+=s[j+1]-'0';
    }
    r+=c;
  }
  cout<<r;
}

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

int main(){
	int week,i;
	int debt = 100000;

	cin >> week;

	for(i=0;i<week;i++){
		debt=debt*105/100;
		if(debt%1000){
			debt = debt - (debt%1000) + 1000;
		}
	}
	
	cout << debt << endl;
}

Measured memory_bytes: 1160
import sys,math,collections,itertools
input = sys.stdin.readline

H,W = list(map(int,input().split()))
s = [input().rstrip() for _ in range(H)]
maperW = [[0]*W for _ in range(H)]
maperH = [[0]*W for _ in range(H)]


#--W方向を調べる--#
for ih in range(H):
    for iw in range(W):
        if s[ih][iw]=='#':
            maperW[ih][iw]=0
        elif s[ih][iw]=='.' and iw == 0:
            maperW[ih][iw]=1
        else:
            maperW[ih][iw]=1+maperW[ih][iw-1]
    for iw in range(W-2,-1,-1):
        if maperW[ih][iw+1] == 0 or maperW[ih][iw]==0:
            continue
        else:
            maperW[ih][iw] = maperW[ih][iw+1]
#--H方向を調べる--#
for iw in range(W):
    for ih in range(H):
        if s[ih][iw]=='#':
            maperH[ih][iw]=0
        elif s[ih][iw]=='.' and ih == 0:
            maperH[ih][iw]=1
        else:
            maperH[ih][iw]=1+maperH[ih-1][iw]
    for ih in range(H-2,-1,-1):
        if maperH[ih+1][iw] == 0 or maperH[ih][iw]==0:
            continue
        else:
            maperH[ih][iw] = maperH[ih+1][iw]
ans = 0
for iw in range(W):
    for ih in range(H):
        ans = max(ans,maperW[ih][iw]+maperH[ih][iw]-1)
print(ans)


Measured memory_bytes: 141880
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <random>
#include <queue>

using namespace std;


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

	int ans  = 1;
	int u_h = 1e9;

	int h;
	cin >> u_h;
	for (int ni = 1; ni < N; ni++){
		cin >> h;
		if (h >= u_h){
			ans++;
			u_h = h;
		}
	}


	printf("%d", ans);

	return 0;
}



Measured memory_bytes: 256
def input
  line = STDIN.gets and line.split.map &:to_i
end

Problem = Struct.new(:target, :num) do
  def self.read
    t, num = input
    return nil if !t || t == 0
    new t, num
  end
  
  def solve
    chars = num.to_s
    max = -1
    lesser = -1
    max_digits = nil
    
    (1 << (chars.size - 1)).times do |n|
      digits = splits_at(chars, n)
      sum = digits.inject(:+)
      if sum <= target && max <= sum
        max, lesser = sum, max
        max_digits = digits
      end
    end
    
    if max < 0
      puts :error
    elsif max == lesser
      puts :rejected
    else
      puts [max, *max_digits].join(' ')
    end
  end
  
  def splits_at(str, n)
    i = 0
    chunks = []
    (str.size - 1).times do |j|
      n, m = n.divmod(2)
      next if m == 0
      chunks << str[i..j].to_i
      i = j + 1
    end
    chunks << str[i..-1].to_i
  end
end

while problem = Problem.read
  problem.solve
end

Measured memory_bytes: 6116
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <queue>
#include <stack>

using namespace std;

typedef int itn;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef map<int, int> M;
typedef pair<int, int> P;
typedef stack<int> S;
typedef queue<int> Q;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string a, b;
    cin >> a >> b;
    int n = stoi(a+b);
    for (int i = 1; (i*i)<=100100; ++i)
    {
        if ((i*i)==n)
        {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    
    return 0;
}


Measured memory_bytes: 256
def gcd(a, b):
    if a < b:
        t = a
        a = b
        b = t
    if b == 0:
        return a
    return gcd(b, a % b)

n=int(input())
a = list(map(int, input().split()))

j = 0
for i in range(n):
    if a[i] == j + 1:
        j += 1

if j == 0:
    print(-1)
else:
    print(n - j)

Measured memory_bytes: 77516
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

int data[3][105];
int dp[3][105];

int main()
{
	int N;
	scanf("%d",&N);
	for(int i=1 ; i<=2 ; i++)
	{
		for(int j=1 ; j<=N ; j++)scanf("%d",&data[i][j]);
	}
	for(int i=1 ; i<=2 ; i++)
	{
		for(int j=1 ; j<=N ; j++)
		{
			dp[i][j] = max(dp[i-1][j],dp[i][j-1]) + data[i][j];
		}
	}
	printf("%d\n",dp[2][N]);

	return 0;
}

Measured memory_bytes: 256
a, b, c = map(int, input().split(" "))
count = 0
while min(a, b, c) < max(a, b, c):
    if max(a, b, c) - min(a, b, c) > 1:
        count += 1
        if a == min(a, b, c):
            a += 2
        elif b == min(a, b, c):
            b += 2
        elif c == min(a, b, c):
            c += 2
    else:
        num = 0
        for i in [a, b, c]:
            if i == max(a, b, c):
                num += 1
        if num == 1:
            count += 1
        else:
            count += 2
        break
print(count)


Measured memory_bytes: 3064
import Data.List

substrings :: [a] -> [[a]]
substrings = ([]:) . concatMap (tail . inits) . tails

acgt :: [Char] -> Bool
acgt [] = True
acgt (x:xs)
  | x `elem` "ACGT" = acgt xs
  | otherwise = False

main = do
  s <- getLine
  print.maximum.map length $ filter acgt $ substrings s


Measured memory_bytes: 3776
N,M = map(int,input().split())
abc = []
for _ in range(M):
    abc.append(list(map(int,input().split())))

cost = [-(10**10)*N]*N
cost[0] = 0

for i in range(N):
    update = False
    for a,b,c in abc:
        a,b = a-1,b-1
        if cost[a] != -(10**10)*N:
            if cost[b] < cost[a] + c:
                cost[b] = cost[a] + c
                update = True
    if i == 0:
        Max = cost[N-1]
    elif i < N-1:
        Max = max(Max,cost[N-1])


if update == True and Max < cost[N-1]:
    print('inf')
else:
    print(Max)


Measured memory_bytes: 3572
#include<iostream>
using namespace std;
int main(void)
{
	int n;
	cin>>n;
	if(n==1 || n==2 || n==3 || n==5 || n==6 || n==9 || n==10 || n==13 || n==17) cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 256
def main():
  n = int(input())
  a_li , b_li = [] , []
  for _ in range(n):
    x , y = map(int,input().split())
    a_li.append(x + y)
    b_li.append(x - y)
  print(max(max(a_li) - min(a_li), max(b_li) - min(b_li)))
 
if __name__ == "__main__":
  main()

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long

const int MOD =  1000000007;
const int IINF = INT_MAX;
const ll INF = 1LL << 60;


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

    if(n % k == 0) cout << 0 << endl;
    else cout << 1 << endl;
    return 0;
}


Measured memory_bytes: 3624
import sys
read = sys.stdin.buffer.read
input = sys.stdin.readline
input = sys.stdin.buffer.readline


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode('utf-8')

#2311
#import numpy as np

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())



def main():
	n,m=MI()
	li=[]
	for _ in range(m):
		a,b=MI()
		a-=1
		b-=1
		li.append([a,b])
	#print(li)

	ans=0

	for i in range(m):
		UF=UnionFind(n)
		for j in range(m):
			if i==j:
				continue
			UF.union(li[j][0],li[j][1])
		ans+=(UF.group_count()==1)
	print(m-ans)


if __name__ == "__main__":
	main()

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

using namespace std;

int main()
{
	int n;
	string s;
	cin >> n >> s;
	if (n & 1)
	{
		cout << "No" << endl;
		return 0;
	}

	for (int i = 0, mid = n / 2; mid < n; i++, mid++)
	{
		if (s[i] != s[mid])
		{
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

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

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

    int d[50];
    for (int i = 0; i < N; ++i) cin >> d[i];
    
    int sum = 0;
    for (int i = 0; i < N - 1; i++) {
        for (int j = i + 1; j < N; j++) {
            sum += d[i] * d[j];
        }
    }

    std::cout << sum << endl;
    return 0;
}

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

int main() {
	string S, T; cin >> S >> T;
	string s[2];
	rep(i, S.size())s[i & 1] += S[i];
	rep(i, 2) {
		int d = 0;
		rep(j, s[i].size()) {
			d = (int)T.find(s[i][j], d) + 1;
			if (!d)goto g;
		}
		puts("Yes"); return 0;
	g:;
	}
	puts("No");
}

Measured memory_bytes: 3208
n,m = map(int,input().split())
h = [i for i in map(int,input().split())]
graph = [[] for j in range(n)]
for i in range(m):
  a,b = map(int,input().split())
  a-=1
  b-=1
  graph[a].append(b)
  graph[b].append(a)
  
res = 0
for i in range(n):
  flag = 1
  for j in graph[i]:
    if h[i] <= h[j]:
      flag = 0
      break
  if flag: res += 1
    
print(res)

Measured memory_bytes: 29504
#include<bits/stdc++.h>
#define MAXN 305
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n;
string str[MAXN];
int main()
{
	scanf("%d",&n);
	int ans=0;
	for(int i=0;i<n;i++)
		cin>>str[i];
	for(int i=0;i<n;i++)
	{
		bool f=true;
		for(int j=0;j<n;j++)
			for(int k=0;k<j;k++)
				if(str[j][k]!=str[k][j]) {f=false; break;}
		if(f) ans+=n;
		for(int j=0;j<n;j++)
		{
			char ch=str[j][0];
			for(int k=1;k<n;k++)
				str[j][k-1]=str[j][k];
			str[j][n-1]=ch;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>

int main(){
  int N;
  scanf("%d",&N);
  int count = 0;
  for(int i = 0;i < 4;i++){
    if(N % 10 == 2)count++;
    N = N / 10;
  }
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,f[2009];
bitset <4000009> dp;
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>a;
	for(b=1; b<=a; b++) cin>>f[b];
	dp[0]=1;
	for(b=1; b<=a; b++){
		c+=f[b];
		dp|=(dp<<f[b]);
	}
	d=0;
	for(b=4000000; b>=c/2+c%2; b--){
		if(dp[b]!=0){
			d=b;
		}
	}
	cout<<d;
	return 0;
}

Measured memory_bytes: 1920
#include<iostream>
using namespace std;
typedef long long ll;
const int N=200010;
ll n,s[N],sum[N],k;

int main()
{
	cin>>n>>k;
	ll mx=-1,l;
	for(int i=1;i<=n;i++)
	{
		cin>>s[i];
		sum[i]=sum[i-1]+s[i];
	}
	for(int i=k;i<=n;i++)
	{
		if(sum[i]-sum[i-k]>mx) mx=sum[i]-sum[i-k],l=i; 
	}
	double ans=0;
	for(int i=l-k+1;i<=l;i++)
		ans+=(1+s[i])*0.5;
	printf("%.10lf",ans);
	return 0;
 }


Measured memory_bytes: 3456
import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String[] ary = s.split("");
    int a = 0;
    s = ary[0];
    for( a = 1;a<4;a++){
      if(s.equals(ary[a])){
        break;
      }
    }
    switch(a){  
    case 1:if(!ary[2].equals(s)&&ary[2].equals(ary[3])){
        System.out.println("Yes");
      }else{
        System.out.println("No");     
      }break;
    case 2:if(!ary[1].equals(s)&&ary[1].equals(ary[3])){
        System.out.println("Yes");
      }else{
        System.out.println("No");     
      }break;
    case 3:if(!ary[1].equals(s)&&ary[2].equals(ary[1])){
        System.out.println("Yes");
      }else{
        System.out.println("No");     
      }break;
      default:System.out.println("No");   
    }
  } 
}

Measured memory_bytes: 24276
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	int M, N;
	cin >> M >> N;
	bool ok = true;
	vector<vector<pii>> ran(M, vector<pii>(N, pii(0, 100)));
	for (int i = 0; i < M; i++) {
		int K;
		cin >> K;
		for (int j = 0; j < K; j++) {
			int s, t;
			string cond;
			cin >> s >> cond >> t; --s;
			if (cond == "<=") {
				ran[i][s].second = min(ran[i][s].second, t);
			}
			else {
				ran[i][s].first = max(ran[i][s].first, t);
			}
		}
	}
	vector<vector<int>> d(M, vector<int>(M, 1e9));
	for (int i = 0; i < M; i++) {
		for (int j = 0; j < M; j++) {
			bool flag = false;
			for (int k = 0; k < N; k++) {
				if (ran[i][k].second < ran[j][k].first) {
					flag = true;
				}
			}
			if (flag) {
				d[i][j] = -1;
			}
		}
	}
	for (int k = 0; k < M; k++) {
		for (int i = 0; i < M; i++) {
			for (int j = 0; j < M; j++) {
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
	for (int i = 0; i < M; i++) {
		if (d[i][i] < 0) {
			ok = false;
		}
	}
	puts(ok ? "Yes" : "No");
	return 0;
}



Measured memory_bytes: 3368
#include <iostream>
#include <cmath>

using namespace std;

typedef long long ll;

ll N,T;
ll a[100000];
ll ma[100000];

int main(){
    cin >> N >> T;
    for(int i=0;i<N;i++) cin >> a[i];
    ll m = a[0];
    ll mam = -1;
    for(int i=0;i<N;i++){
        m = min(m,a[i]);
        ma[i] = abs(m - a[i]);
        mam = max(ma[i],mam);
    }
    ll c = 0;
    for(int i=0;i<N;i++){
        if(mam == ma[i]) c++;
    }
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>

#define NUMBER 10000

int main(void)
{
  while(1){
  int matrix[2][NUMBER]={0};
  int i;
  int number;
  int a=0,b=0;

  scanf("%d",&number);
  if( number==0 )break;
  for( i=0; i<number; i++ ){
    scanf("%d",&matrix[0][i]); scanf("%d",&matrix[1][i]);
  }

  for( i=0; i<number; i++ ){
    if( matrix[0][i]>matrix[1][i] )
      a+=matrix[0][i]+matrix[1][i];
    else if( matrix[0][i]<matrix[1][i] )
      b+=matrix[0][i]+matrix[1][i];
    else {
      a+=matrix[0][i];
      b+=matrix[1][i];
    }
  }
  printf("%d %d\n",a,b);
  }
  return 0;
}

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    string S;
    cin >> S;
    bool e = true;
    REP(i, S.length())
    {
        if (i % 2 == 0 && S[i] == 'L')
            e = false;
        else if (i % 2 == 1 && S[i] == 'R')
            e = false;
    }
    if (e)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	var a, b string
	fmt.Scanf("%s %s", &a, &b)
	if a[0] < b[0] {
		bint, _ := strconv.Atoi(b)
		fmt.Println(strings.Repeat(a, bint))
	} else {
		aint, _ := strconv.Atoi(a)
		fmt.Println(strings.Repeat(b, aint))
	}
}


Measured memory_bytes: 640
A = [list(map(int,input().split())) for _ in range(3)]
N = int(input())
B = []
for _ in range(N):
    B.append(int(input()))

C = [[0 for i in range(3)] for j in range(3)]

for k in range(N):
    for i in range(3):
        for j in range(3):
            if A[i][j] == B[k]:
                A[i][j] = 101

flag = 0
for i in range(3):
    for j in range(3):
        if A[0][0]*A[0][1]*A[0][2] == 101**3 \
        or A[1][0]*A[1][1]*A[1][2] == 101**3 \
        or A[2][0]*A[2][1]*A[2][2] == 101**3 \
        or A[0][0]*A[1][0]*A[2][0] == 101**3 \
        or A[0][1]*A[1][1]*A[2][1] == 101**3 \
        or A[0][2]*A[1][2]*A[2][2] == 101**3 \
        or A[0][0]*A[1][1]*A[2][2] == 101**3 \
        or A[2][0]*A[1][1]*A[0][2] == 101**3:
            flag = 1
            break

if flag == 1:
    print("Yes")
else:
    print("No")


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

int main(){
  int D,N;
  cin>>D>>N;
  if(N!=100){
    int ans=N;
    for(int i=0; i<3; ++i){
      if(i<D){
        ans *= 100;
      }
    }
    cout<<ans<<endl;
  }
  else{
    int ans=101;
    for(int i=0; i<3; ++i){
      if(i<D){
        ans *= 100;
      }
    }
    cout<<ans<<endl;
  }
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.ArrayList;

public class Main {
	Scanner sc = new Scanner(System.in);
	public void run(){
		int n = sc.nextInt();
		int m = sc.nextInt();
		int t = sc.nextInt();
		calc(n, m, t);
	}
	public void calc(int n, int m, int t){
		int[] memo = new int[10000];
		
		int before = 0;
		for(int i = 0; i < n; i++){
			int a = sc.nextInt();
			int start = a - m;
			int end = a + m;
			if(start < before) start = before;
			
			for(int j = start; j < end; j++){
				if(j < t) memo[j] = -1;
			}
		}
		
		int sum = t;
		for(int i = 0; i < t; i++){
			sum += memo[i];
		}
		
		System.out.println(sum);
	}
	
	public static void main(String[] args){
		new Main().run();
	}
	
}

Measured memory_bytes: 27208
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

const int N = 100001;

int cnt[N];
bool canHaveRed[N];

int main()
{
	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= n; ++i) {
		cnt[i] = 1;
	}
	canHaveRed[1] = true;
	for (int i = 0; i < m; ++i) {
		int x, y;
		scanf("%d%d", &x, &y);
		--cnt[x];
		++cnt[y];
		if (canHaveRed[x]) {
			canHaveRed[y] = true;
			if (cnt[x] == 0) {
				canHaveRed[x] = false;
			}
		}
	}
	int ans = 0;
	for (int i = 1; i <= n; ++i) {
		ans += canHaveRed[i];
	}
	cout << ans << endl;
	return 0;
}



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

int main(){

    int h,n;
    cin >> h >> n;
    vector<int> a(n),b(n);
    int ma=0;
    rep(i,n){
        cin >> a[i] >> b[i];
        ma=max(a[i],ma);
    }

    vector<int> dp(h+1+ma,1e+9);
    dp[0]=0;
    rep(i,dp.size()){
        rep(j,n){
            if(i-a[j]>=0){
                dp[i]=min(dp[i],dp[i-a[j]]+b[j]);
            }
        }
    }

    int ans=1e+9;

    for(int i=h;i<=h+ma;i++){
        ans=min(ans,dp[i]);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define call(var) cout<<#var<<"="<<var<<endl;
#define dup(x,y) (((x)+(y)-1)/(y))
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
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;
const int INTMAX = 2147483647;
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(){
    string s;cin >> s;
    int n = s.size();
    vector<vl> dp(n+10,vl(13,0));
    dp[0][0] = 1;
    for(int i=0;i<n;++i){
        if(s[i]!='?'){
            int num = (s[i]-'0');
            for(int j=0;j<13;++j){
                dp[i+1][(num+j*10)%13] = dp[i][j];
            }
        }
        else{
            for(int j=0;j<10;++j){
                for(int k=0;k<13;++k){
                    dp[i+1][(j+k*10)%13] = (dp[i+1][(j+k*10)%13] + dp[i][k]) % MOD;
                }
            }
        }
    }
    /*rep(i,n+1){
        rep(j,13) cout << dp[i][j] << " ";
        cout << endl;
    }*/
    cout << dp[n][5] << endl;
}

Measured memory_bytes: 13696
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <numeric>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>

using namespace std;

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

typedef long long ll;
typedef unsigned long long ull;

int N;

int dfs(int d, int s, int flag, bool zero) {
  if (d == 9)
    return (flag == 0b111) && s <= N;

  int res = 0;

  if (zero) res += dfs(d + 1, s * 10 + 0, flag, true);

  res += dfs(d + 1, s * 10 + 3, flag | 0b001, false);
  res += dfs(d + 1, s * 10 + 5, flag | 0b010, false);
  res += dfs(d + 1, s * 10 + 7, flag | 0b100, false);
  return res;
}

int main(void) {
  cin >> N;
  cout << dfs(0, 0, 0, true) << endl;
  return 0;
}


Measured memory_bytes: 256
main :: IO ()
main = do
  n <- (read :: String -> Int) <$> getLine
  strs <- getLine
  print $ solve strs
  
solve :: String -> Int
solve strs = maximum $ scanl incdec 0 strs
  where
    incdec :: Int -> Char -> Int
    incdec i 'D' = i - 1
    incdec i 'I' = i + 1
    incdec i _ = i


Measured memory_bytes: 508
from collections import deque

n=int(input())
G=[[]for _ in range(n)]
L=[]
ans=[0]*n
for i in range(n-1):
   a,b=map(int,input().split())
   G[a-1].append(b-1)
   L.append(b-1)

que=deque([0])
while que:
   s=que.pop()
   color=1
   for ni in G[s]:
      if ans[s]==color:
         color+=1
      ans[ni]=color
      color+=1
      que.append(ni)
print(max(ans))
for i in L:
   print(ans[i])
   


Measured memory_bytes: 68256
<?php
fscanf(STDIN, "%d %d %d %d", $a, $b, $c, $k);

$tot = 0;

if ($k > $a) {
  $tot += 1 * $a;
} else {
  echo $k;exit;
}

$tot += 0 * ($k - $a);

$tot += -1 * ($k - $a - $b);

echo $tot;


Measured memory_bytes: 15920
s = input()
l = len(s)
s += "D"*10
cnt = 0
ans = 0
i = 0
while i < l:
    if s[i] == "A": cnt += 1
    elif s[i:i+2] == "BC":
        ans += cnt
        i += 1
    else: cnt = 0
    i += 1
print(ans)

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

int main()
{
    char s[3];
    while(cin >> s)
    {
        int len = strlen(s);
        if(len == 2)
        cout << s;
        else if(len == 3)
        {
            while(len--)
            {
                cout << s[len];
            }
        }
    }
    return 0;
}


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

using namespace std;

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

    int v[n], c[n];
    for(int i = 0; i < n; i++){
        cin >> v[i];
    }
    for(int i = 0; i < n; i++){
        cin >> c[i];
    }

    int sum = 0;
    for (int i = 0; i < n; i++) {
        if (v[i] > c[i]) { sum += v[i] - c[i]; }
    }
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

i64 k;

i64 s(i64 x) {
  i64 y = 0;
  for (; x > 0; x /= 10) y += x % 10;
  return y;
}

int main() {
  cin >> k;
  vector<i64> res;
  for (i64 d = 1; d <= 1e15; d *= 10) {
    double f = 1e40;
    i64 o = max(i64(1), d / 10000);
    for (i64 x = 10 * d - 1; x >= d; x -= o) {
      double g = double(x) / s(x);
      if (g <= f) {
        f = g;
        res.push_back(x);
      }
    }
  }
  sort(begin(res), end(res));
  for (i64 i = 0; i < k; ++i) cout << res[i] << '\n';
  return 0;
}


Measured memory_bytes: 384
public class Main {
	public static void main(String[] args) {
		var sc = new java.util.Scanner(System.in);
		var n = sc.nextInt();
		var x = sc.nextInt();
		var t = sc.nextInt();
		var cost = 0;

		for(var mk=0;mk<n;) {
			mk+=x;
			cost+=t;
		}
		System.out.println(cost);

	}
}


Measured memory_bytes: 35592
N = int(input())
dp = [0] * (1 << N)
dp[0] = 1
MOD = 10 ** 9 + 7
now = {0}
for _ in range(N):
    mat = [1<<i for i, v in enumerate(input().split()) if v == '1']
    nxt = set()
    for k in now:
        p = dp[k] % MOD
        for m in mat:
            if k & m: # 1101 & 0100 3番目の人はすでにペアになっているためはじく
                continue
            dp[k | m] += p # 1001 | 0010 = 1101
            nxt.add(k | m)
    now = nxt
print(dp[-1] % MOD) #dp[11...11]が答えになる

Measured memory_bytes: 187160
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        //int N = sc.nextInt();
        //int K = sc.nextInt();
        long N = sc.nextLong();

        long res=0;

        for(int i=1; i<N; i++){
            res = res+ (N-1)/i;
        }
        
        System.out.println(res);
        }
    }

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

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    int A,B,C;
    int soma;
    cin >> A >> B >> C;
    soma = A+B+C;
    if (A <= B && A <= C)
    {
        if(B <= C)
        {
            soma = A+B;
        } 
        else
        {
            soma = A+C;
        }
        
    }
    else if (B <= A && B <= C)
    {
        if(A <= C)
        {
            soma = B+A;
        }
        else
        {
            soma = B+C;
        }
        
    }
    else if (C <= A && C <= B)
    {
        if(A <= B)
        {
            soma = C+A;
        }
        else
        {
            soma = C+B;
        }
        
    }
    cout << soma << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>


int main(){
  int multi;
  std::cin >> multi;
  
  if(multi > 81){
   std::cout << "No" << std::endl;
    return 0;
  }
  for(int i=1; i<10; i++){
  int mod = multi /i;
  int rest = multi % i;
  if ( rest == 0 && mod <= 9){
    std::cout << "Yes" << std::endl;
    return 0;
  }
  }
  std::cout << "No"<< std::endl;
}

Measured memory_bytes: 256
input_line =input()
input_line = input_line.rstrip().split(" ")

a = int(input_line[0])
b = int(input_line[1])
c = int(input_line[2])
x = int(input_line[3])
y = int(input_line[4])

list1=[]
for i in range(max(x,y)+1):
    if x-i<=0 and y-i<=0:
        cost = 2*c*i
        list1.append(cost)
        i +=1
        
    elif x-i<=0:
        cost = b*(y-i)+2*c*i
        list1.append(cost)
        i +=1
        
    elif y-i<=0:
        cost = a*(x-i)+2*c*i
        list1.append(cost)
        i +=1
    
    else:
        cost = a*(x-i)+b*(y-i)+2*c*i
        list1.append(cost)
        i +=1
    

print(min(list1))

Measured memory_bytes: 7164
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

int main()
{
  int n;
  cin >> n;
  vector<int> b(n);
  REP(i, n - 1)
  {
    cin >> b[i];
  }
  int ans = b[0] + b[n - 2];
  REP(i, n - 2)
  {
    ans += min(b[i], b[i + 1]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb          push_back
#define m_p			make_pair
#define rep(i,a,b)	for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i =a, i>=b;i--)
#define sz(x)       (int)x.size()
#define F			first
#define S			second
#define debug(x)	for(int i=0;i<x;i++) cout<<"##########"<<endl
#define M			1000000007
#define ll			long long int
#define lMax		LLONG_MAX
#define pii 		pair<int ,int >
#define	all(a)		a.begin(), a.end()
#define vi 			vector<int> 
#define vii 		vector<pii>

// queue<int> , prefix_sum(a,a+n) , reverse(a,a+n) , priority_queue <int> max heap , priority_queue <int, vector<int>, greater<int> > min heap;
// == > != precedence gretaer then & , << precedence greater than <= == => , 
//int chk, cnt, fl, pos, in, src, tar, val, res. dummy;  fill (myvector.begin(),myvector.begin()+4,5), freq;

const int nmax=305;

void solve()
{
	ll n;
	cin>>n;
	
	ll arr[n+1];
	ll pre[n+1]={0};
	rep(i,1,n+1) cin>>arr[i],pre[i]=pre[i-1]+arr[i];
	
	pair<ll,ll> dp[n+1][n+1];
//	rep(i,0,n+1) cout<<pre[i]<<" ";
//	cout<<endl;
	for(int size=1;size<=n;size++)
	{
		for(int i=1;i+size-1<=n;i++)
		{
			if(size==1) dp[i][i]=m_p(arr[i],0);
			else 
			{
				ll j=i+size-1;
				ll x=max(arr[i]+dp[i+1][j].S,arr[j]+dp[i][j-1].S);
				dp[i][j]=m_p(x,pre[j]-pre[i-1]-x);
			}
		}
	}
//	rep(i,1,n+1)
//	{
//		rep(j,1,n+1)
//		{
//			cout<<dp[i][j].F<<" ";
//		}
//		cout<<endl;
//	}
	cout<<2*dp[1][n].F-pre[n]<<endl;
}


signed main()
{
		ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
		int t=1;
		while(t--)
		{
			solve();
		}
}

Measured memory_bytes: 141056
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <random>
#include <iterator>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(v) reverse((v).begin(),(v).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for (int i = 0; i < (n); ++i)

struct MyStruct {
	int a, b;
};

bool comp(const MyStruct& s, const MyStruct& t) {
	if (s.a != t.a)
		return s.a > t.a; //降順
	return s.b > t.b;
}

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

	vector<MyStruct> v(m);
	REP(i, m) {
		cin >> v[i].a >> v[i].b;
	}

	sort(v.begin(), v.end(), comp);

	int ans = 1;
	int tmp = v[0].a + 1;;
	REP(i, m) {
		if (tmp >= v[i].a && tmp<=v[i].b) {

		}
		else {
			tmp = v[i].a + 1;
			ans++;
		}
	}

	ANS(ans);
	

	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pull = pair<ull, ll>;
using pis = pair<int, string>;
#define all(x) (x).begin(), (x).end()
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD 1000000007

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  //cout << fixed << setprecision(15)
  int n;
  cin >> n;
  cout << abs(1-n) << endl;
  
}


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

public class Main {
	int n, m, k;
	double[][] dp;

	public void solve() {
		while (true) {
			n = nextInt();
			m = nextInt();
			k = nextInt();

			if (n + m + k == 0)
				break;

			dp = new double[n + 2][n * m + 1];
			dp[0][0] = 1;
			for (int i = 0; i < n; i++) {
				for (int j = 0; j <= n * m; j++) {
					for(int l = 1;l <= m;l++){
						if(j + l > n * m)
							continue;
						dp[i + 1][j + l] += dp[i][j] / m;
					}
				}
			}
			for(int i = 0;i <= n * m;i++){
				int j = Math.max(1, i - k);
				dp[n + 1][j] += dp[n][i];
			}
			double ans = 0.0;
			for(int i = 0;i < n * m + 1;i++){
				ans += i * dp[n + 1][i];
			}
			out.println(ans);
		}
	}

	public static void main(String[] args) {
		out.flush();
		new Main().solve();
		out.close();
	}

	/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (p < buflen)
			return true;
		p = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (buflen <= 0)
			return false;
		return true;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}

	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}

	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}

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

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 26076
#include<stdio.h>
int main (void)
{
	int a,b;
	scanf("%d %d",&a,&b);
	if(a < b)
	{
		printf("a < b\n",a,b);
	}
	if(a > b)
	{
		printf("a > b\n",a,b);
	}
	if(a == b)
	{
		printf("a == b\n");
	}
	return 0;
}



Measured memory_bytes: 1932
#include <iostream>
#include <fstream>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <iterator>
#include <ext/pb_ds/assoc_container.hpp>

#define x first
#define y second
#define mp make_pair
#define up_b upper_bound
#define low_b lower_bound
#define sz(x) (int)x.size()
#define bit __builtin_popcount
#define all(x) x.begin(),x.end()

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

const ll INF=1e18+123;
const ld EPS=1e-9;
const int inf=1e9+123;
const int MOD=1e9+7;
const int N=2e5+123;
const int dx[]={0,0,1,-1};
const int dy[]={1,-1,0,0};

int a[N];

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        if(a[i]>=i){
            cout<<-1;
            return 0;
        }
    }
    ll ans=0;
    int cur=0;
    for(int i=n;i;i--){
        cur--;
        if(cur==a[i]){
            continue;
        }
        else{
            if(cur<a[i])ans+=a[i];
            else{
                cout<<-1;
                return 0;
            }
            cur=a[i];
        }
    }
    cout<<ans;
    return 0;
}


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

int main()
{
    int a, b;

    cin >> a >> b;

    if ((a * b) % 2 == 0)
    {
        cout << "Even" << endl;
    }
    else
    {
        cout << "Odd" << endl;
    }
    
}

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

int main(){
	int n,m,c;
	cin >> n >> m >> c;
	int sum=0;
	int cnt=0;
	int a[m]={0};
	int b[m]={0};
	for(int i=0; i<m; ++i){
		cin >> b[i];
	}
	for(int i=0; i<n; ++i){
		sum = 0;
		for(int j=0; j<m; ++j){
			cin >> a[j];
			sum += a[j]*b[j];
		}
		if(sum+c > 0){
			cnt++;
		}
	}

	cout << cnt << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int a = scanner.nextInt();
        int b = scanner.nextInt();

        long count = 0;

        for (int i=1;i<=n;i++){
            long instance = 0;
            for (int j=0;j<Integer.toString(i).length();j++){
                instance += Integer.parseInt(Character.toString(Integer.toString(i).charAt(j)));
            }
            if (a<=instance&&instance<=b){
                count+=i;
            }
        }
        System.out.println(count);
    }

}

Measured memory_bytes: 28372
n, o = map(int, input().split())
x = sorted(list(map(int, input().split())) + [o])
difs = [x[i+1]-x[i] for i in range(n)]

ans = difs[0]
for i in range(n-1):
    a, b = difs[i+1], ans
    while a%b:
        a, b = b, a%b
    ans = b
print(ans)

Measured memory_bytes: 14224
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define rep(i,a,b) for(int (i)=int(a);(i)<int(b);(i)++)
#define rrep(i,a,b) for(int (i)=int(a);(i)>=int(b);(i)--)

#define put(a) cout << (a) << endl

#define INF 1000000001
#define MOD 1000000007
#define INF64 1000000000000000001

#define F first
#define S second

#define Pii  pair<int,int>
#define Pll  pair<long long,long long>
#define Piii pair<int,pair<int,int>>
#define Plll pair<long long,pair<long long,long long>>

#define Vll(a,b,c)    vector<vector<long long>> (a)((b),vector<long long>((c))
#define Vlll(a,b,c,d) vector<vector<vector<long long>>> (a)((b),vector<vector<long long>>((c),vector<long long>((d)))

#define MAX_N 200009
int N,M,L,D;
int ans;
int A[MAX_N];
double dis;
int max1,max2;
int max1i,max2i;

void solve(void) {
  rep(i,0,N) {
    if (max1<A[i]) {
      max1 = A[i];
      max1i = i;
    }
  }
  rep(i,0,N) {
    if (max2<A[i]) {
      if (i!=max1i) {
        max2 = A[i];
        max2i = i;
      }
    }
  }

  rep(i,0,N) {
    if (i==max1i) {
      cout << max2 << endl;
    } else {
      cout << max1 << endl;
    }
  }


}

int main (void)
{
  cin >> N;

  rep(i,0,N) {
    cin >> A[i];
  }
  solve();
  return 0;
}


Measured memory_bytes: 2432
import java.util.Scanner;
import java.util.Arrays;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int K = sc.nextInt();
        int N = sc.nextInt();

        int[] A = new int[N];
        for(int i=0;i <N;i++){
            A[i]=sc.nextInt();
        }
        Arrays.sort(A);

        int[] B = new int[N];
        for(int i=0;i<N-1;i++){
            B[i]=A[i+1]-A[i];
        }

        B[N-1] = A[0]+K-A[N-1];
        int max = B[0];

        for(int i=0;i<B.length;i++){
            if(max<B[i]){
                max = B[i];
            }
        }
        int result = K-max;
        System.out.print(result);
    }
}

Measured memory_bytes: 79112
min_ k x
    | x - k + 1 < -1000000 = -1000000
    | otherwise = x - k + 1

max_ k x
    | x + k - 1 > 1000000 = 1000000
    | otherwise = x + k - 1

main = do
    s <- (map read . words) <$> getLine :: IO [Int]
    let k = s !! 0
    let x = s !! 1
    sequence $ map print [min_ k x .. max_ k x]

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

if n % 2 == 1:
	print(0)
else:
	m2 = 1
	m5 = 0
	for i in range(1, 101):
		if n // 2 >= 2 ** i:
			m2 += (n // 2) // (2 ** i)
		else:
			break
	for j in range(1, 101):
		if n // 2 >= 5 ** j:
			m5 += (n // 2) // (5 ** j)
		else:
			print(min(m2, m5))
			break

Measured memory_bytes: 3060
/* ITP1_6_D */
#include <stdio.h>

/* ???????????????????¨???? */
int calc_line_vector_product(short matrix[], short vector[], short elem_cnt);

/* ???????????¢??° */
int main(void)
{
	// ?????°
	short n = 0;
	// ?????°
	short m = 0;
	scanf("%hd", &n);
	scanf("%hd", &m);
	scanf("\n");
	
	short ii, jj;
	
	// ???????????????
	short matrix[n][m];
	for( ii = 0; ii < n; ii++ )
	{
		for( jj = 0; jj < m; jj++ )
		{
			matrix[ii][jj] = 0;
			scanf("%hd", &matrix[ii][jj]);
		}
		scanf("\n");
	}
	
	// ?????????????????????
	short vector[m];
	for( ii = 0; ii < m; ii++ )
	{
		scanf("%hd", &vector[ii]);
	}
	
	// ???????¨????
	for( ii = 0; ii < n; ii++)
	{
		printf("%d\n", calc_line_vector_product(matrix[ii], vector, m));
	}
	
	return 0;
}

/* ???????????????????¨???? */
int calc_line_vector_product(short matrix[], short vector[], short elem_cnt)
{
	short ii;
	int result = 0;
	for( ii = 0; ii < elem_cnt; ii++ )
	{
		result += (int)(matrix[ii] * vector[ii]);
	}
	return result;
}

Measured memory_bytes: 616
#include <bits/stdc++.h>
#define FAST_IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)

using namespace std;
typedef long long ll;

int main()
{
    FAST_IO;
    int a, b;
    cin >> a >> b;
    cout << max(a+b, max(2*a-1, 2*b-1)) << endl;

    return 0;
}

Measured memory_bytes: 256
N , M , X , Y = (int(_) for _ in input().split())
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]

x = sorted(x)
y = sorted(y)
a = x[N-1]
b = y[0]
if (a >= b) or (a>=Y) or (b<=X):
    print("War")
else:
    print("No War")


Measured memory_bytes: 3060
#include <iostream>
#include <cstdint>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <algorithm>

void print(const char *s) {
    std::cout << s << std::endl;
}

int main(void)
{
    std::string s;
    std::cin >> s;

    int64_t a = atoi(s.c_str()) / 100;
    int64_t b = atoi(s.c_str()) % 100;

    if (a == 0 || a > 12) {
        if (b == 0 || b > 12) print("NA");
        else print("YYMM");
        return 0;
    } else {
        if (0 < b && b <= 12) print("AMBIGUOUS");
        else print("MMYY");
    }

    return 0;
}

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

int main(){
  int a,b,n;
  cin>>a>>b>>n;
  for(int i=0;i<n;i++){
    int x,y;
    cin>>x>>y;
    if(x<b&&a<y){
      cout<<1<<endl;
      return 0;
    }
  }
  cout<<0<<endl;
  return 0;
}

Measured memory_bytes: 3112
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int x=sc.nextInt();
		if(x<1200)System.out.println("ABC");
		else{System.out.println("ARC");}

	}

}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define FOR(I,X,Y) for(int I=X;I<Y;I++)
#define REP(I,X,Y) for(int I=Y-1;I>=X;I--)
#define INF 1000000007
using namespace std;

int main(){
  int N;
  string S,T;
  cin >> N >> S;
  T = S;
  bool flag = 1;
  while(flag && T.size()){
    flag = 0;
    FOR(i,0,T.size()-1){
      if(T.substr(i,2) == "()"){
        T.erase(i,2);
        flag = 1;
      }
      if(!T.size())break;
    }
  }
  FOR(i,0,T.size()){
    if(T[i] == '(')S = S + ')';
    else S = '(' + S;
  }
  cout << S << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define repn(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, a) for(int i = 0; i < (a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define endl '\n'

ll dp[100005];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int n, w;
	cin >> n >> w;
	rep(i, 100001) dp[i] = 1e18;
	dp[0] = 0;
	int a, b;
	repn(i, 1, n + 1){
		cin >> a >> b;
		for(int j = 1000 * i; j >= b; j--){
			dp[j] = min(dp[j], dp[j - b] + a);	
		}
	}
	ll ans = 0;
	rep(i, 100001) if(dp[i] <= w) ans = i;
	cout << ans << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


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

int main(){
  int N,max_A=-1,max_B=-1;
  cin >> N;
  for(int i=0;i<N;i++){
    int A,B;
    cin >> A >> B;
    if(A>max_A){
      max_A=A;
      max_B=B;
    }
  }
  cout << max_A+max_B << endl;
}

Measured memory_bytes: 3632