akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            var S = Utility.ReadString();
            var values = S.ParseInt().ToArray();
            var pattern = (long)Math.Pow(2, S.Length - 1);
            long sum = 0;
            for (int i = 0; i < pattern; i++)
            {
                var bit = i;
                long temp = 0;
                long add = 0;
                for (int j = 0; j < values.Length; j++)
                {
                    temp *= 10;
                    temp += values[j];
                    if ((bit & 1) != 0)
                    {
                        add += temp;
                        temp = 0;
                    }
                    bit >>= 1;
                }
                add += temp;
                sum += add;
            }
            Console.WriteLine($"{sum}");
        }
    }

    public static class Utility
    {
        public static string ReadString() => Console.ReadLine();
        public static string[] ReadStringArray() => ReadString().Split(' ');
        public static int ReadInt() => int.Parse(ReadString());
        public static int[] ReadIntArray() => ReadStringArray().ParseInt().ToArray();
        public static IEnumerable<int> ParseInt(this IEnumerable<string> source) => source.Select(v => int.Parse(v));
        public static IEnumerable<int> ParseInt(this IEnumerable<char> source) => source.Select(v => (int)char.GetNumericValue(v));

        public static IEnumerable<int> EnumerateDigits(int value)
        {
            while (value > 0)
            {
                yield return value % 10;
                value /= 10;
            }
        }

    }

    public class Factorial
    {
        public static long Number(long term)
        {
            return term > 1 ? Number(term - 1) * term : 1;
        }

        public static long[] Cache(long term)
        {
            var cache = new long[term + 1];
            cache[0] = 1;
            for (int i = 1; i < cache.Length; i++)
            {
                cache[i] = cache[i - 1] * i;
            }
            return cache;
        }

        public static long[] CacheMod(long term, long mod)
        {
            var cache = new long[term + 1];
            cache[0] = 1;
            for (int i = 1; i < cache.Length; i++)
            {
                cache[i] = cache[i - 1] * i % mod;
            }
            return cache;
        }
    }
}


Measured memory_bytes: 13396
#include <cstdio>
#include <cstring>

using namespace std;

char s[500001];

int main() {
    int n, i;
    long long l = 0, r = 1e9, m = (l + r) / 2;
    
    scanf("%s", s);
    
    n = strlen(s);
    
    while (r - l > 1) {
        long long sum = m, c = 0;
        
        for (i = 0; i < n; i++) {
            sum += (s[n - i - 1] - '0') * 9;
            c += sum % 10;
            sum /= 10;
        }
        
        while (sum > 0) {
            c += sum % 10;
            sum /= 10;
        }
        
        if (c <= m) {
            r = m;
            m = (l + r) / 2;
        } else {
            l = m;
            m = (l + r) / 2;
        }
    }
    
    printf("%lld\n", (r + 8) / 9);
    
    return 0;
}


Measured memory_bytes: 640
#include<stdio.h>

/*手持ちのトランプから山札のトランプを計算する*/
/*S:0, H:1, C:2, D:3*/
int mark2num(char c);
int kari(int a);

int main(){
	
	int i,j;
	int hand;
	char mark;
	int mark_n,num;
	
	int deck[4][13]={0};
	
	scanf("%d",&hand);
	
	for(i=0; i<hand; i++){
		(void)getchar();
		scanf("%c %d",&mark,&num);
		mark_n = mark2num(mark);
		deck[mark_n][num-1] = 1;
	}
	
	for(i=0; i<4; i++){
		for(j=0; j<13; j++){
			if(deck[i][j] != 1){
				switch (i){
					case 0:
						printf("S %d\n",j+1);
						break;
					case 1:
						printf("H %d\n",j+1);
						break;
					case 2:
						printf("C %d\n",j+1);
						break;
					case 3:
						printf("D %d\n",j+1);
						break;
					default:
						printf("エラー\n");
				}
			}
		}
	}
	
	return 0;
}

int mark2num(char c){
	int i=555;
	
	switch (c){
		case 'S':
			i = 0;
			break;
		case 'H':
			i = 1;
			break;
		case 'C':
			i = 2;
			break;
		case 'D':
			i = 3;
			break;
		default:
			printf("エラー\n");
	}
	return i;
}




Measured memory_bytes: 2088
sx, sy, tx, ty = map(int,input().split())
ans = str()
for i in range(ty - sy):
    ans += "U"
for j in range(tx - sx):
    ans += "R"
for k in range(ty - sy):
    ans += "D"
for l in range(tx - sx):
    ans += "L"
ans += "L"
for i in range(ty - sy + 1):
    ans += "U"
for j in range(tx - sx + 1):
    ans += "R"
ans += "D"
ans += "R"
for k in range(ty - sy + 1):
    ans += "D"
for l in range(tx - sx + 1):
    ans += "L"
ans += "U"
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string a,b,c;
	cin>>a>>b;
	c=a+b;
    long long k=0;
    for(int i=0;i<c.size();i++)
        k=k*10+c[i]-'0';
    if(sqrt(k)==float(sqrt(k))) 
	   cout<<"Yes";
    else 
	   cout<<"No";
    cout<<endl;
	return 0;
}


Measured memory_bytes: 256
using System;

public class Program
{
    public static void Main()
    {
        string input = Console.ReadLine();
        string[] split = input.Split(' ');
        int length = Int32.Parse(split[0]);
        int breadth = Int32.Parse(split[1]);
        Console.WriteLine("{0} {1}", (length * breadth), (length + breadth) * 2);
    }
    
}


Measured memory_bytes: 9240
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double PI = acos(-1);
int main(){
    double a,b,x;
    cin>>a>>b>>x;
    if(a*a*b<x*2){
        double xx=2*(a*a*b-x), y=a*a*a;
        double ans=180/PI*atan(xx/y);
        //double ans=atan(xx/y);
        printf("%.10lf\n", ans);
    }else{
        double ans=180*atan(a*b*b/(x*2))/PI;
        printf("%.10lf\n", ans);
    }
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

ret = 0

if n % 2 == 0:
    dp = [[0] * 2 for _ in range(n)]
    dp[0][0] = a[0]
    for i in range(1, n):
        dp[i][0] = dp[i-1][0] if i % 2 == 1 else dp[i-1][0] + a[i]
        dp[i][1] = dp[i - 1][1] if i % 2 == 0 \
            else max(dp[i-2][0], dp[i-2][1]) + a[i]
    ret = max(dp[-1])
else:
    dp = [[0] * 3 for _ in range(n)]
    dp[0][0] = a[0]
    for i in range(1, n):
        dp[i][0] = dp[i-1][0] if i % 2 == 1 else dp[i-1][0] + a[i]
        dp[i][1] = dp[i - 1][1] if i % 2 == 0 \
            else max(dp[i-2][0], dp[i-2][1]) + a[i]
        dp[i][2] = dp[i - 1][1] if i % 2 == 1 \
            else max(dp[i-3][0], dp[i-2][1], dp[i-2][2]) + a[i]
    ret = max(dp[-1][1], dp[-1][2], dp[-2][0])

print(ret)


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

int main() {
  int a,b,c,d,e;
  cin >> a >> b >> c >> d >> e;
  
  int a2 = a%10;
  int b2 = b%10;
  int c2 = c%10;
  int d2 = d%10;
  int e2 = e%10;
  
  int A = a/10;
  int B = b/10;
  int C = c/10;
  int D = d/10;
  int E = e/10;
  
  if(a2!=0) A++;
  if(b2!=0) B++;
  if(c2!=0) C++;
  if(d2!=0) D++;
  if(e2!=0) E++;
  
  int ans1,ans2,ans3,ans4,ans5;
  ans1 = a+(B+C+D+E)*10;
  ans2 = b+(A+C+D+E)*10;
  ans3 = c+(B+A+D+E)*10;
  ans4 = d+(B+C+A+E)*10;
  ans5 = e+(B+C+D+A)*10;
  
  vector<int> vec = {ans1,ans2,ans3,ans4,ans5};
  sort(vec.begin(),vec.end());
  
  cout << vec[0] << endl;
}

Measured memory_bytes: 256
iroha :: Char -> String
iroha irh
    | elem irh "24579" = "hon"
    | elem irh "0168" = "pon"
    | otherwise = "bon"

main = do
    input <- getLine
    -- let onesPlace = last input
    -- let answer = iroha onesPlace
    putStrLn(iroha (last input))


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

int main() {
  string input;
  cin >> input;
  bool N = false;
  bool S = false;
  bool E = false;
  bool W = false;
  for (auto c : input) {
    switch (c) {
    case 'N':
      N = true;
      break;
    case 'S':
      S = true;
      break;
    case 'E':
      E = true;
      break;
    case 'W':
      W = true;
      break;
    }
  }
  if (N ^ S || E ^ W) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args)  {
        Scanner sc = new Scanner(System.in);
        String SA = sc.next();
        String SB = sc.next();
        String SC = sc.next();
        
        int counta= -1;
        int countb= -1;
        int countc= -1;
        int idx = 0;
        boolean judge =true;
        
        while(judge){
            if(idx == 0){
                counta++;
                if(counta == SA.length()){
                    break;
                }
                if(SA.charAt(counta) == 'b'){
                    idx = 1;
                }else if(SA.charAt(counta) == 'c'){
                    idx = 2;
                }
        }else if(idx == 1){
                countb++;
                if(countb == SB.length()){
                    break;
                }
                if(SB.charAt(countb) == 'a'){
                    idx = 0;
                }
                else if(SB.charAt(countb) == 'c'){
                    idx = 2;
                }
            }else{
                countc++;
                if(countc == SC.length()){
                    break;
                }
                if(SC.charAt(countc) == 'a'){
                    idx = 0;
                }else if(SC.charAt(countc) == 'b'){
                    idx = 1;
                }
            }
        }
        
        if(counta == SA.length()) System.out.println("A");
        if(countb == SB.length()) System.out.println("B");
        if(countc == SC.length()) System.out.println("C");
        
    }
}


Measured memory_bytes: 35604
n = int(raw_input())

min_R = int(2e5)
ans = int(-2e5)

for i in range(n):
    R = int(raw_input())
    if i == 0:
        min_R = R
    else:
        ans = max(ans, R-min_R)
    if i == 1:
        ans = R - min_R
    if R < min_R:
        min_R = R

print ans

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;

const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}

    mint operator-() const { return mint(-x); }

    mint &operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }

    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }

    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const {
        return pow(mod - 2);
    }

    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }

    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

int main() {
    int N;
    string S;
    cin >> N >> S;
    map<char, int> mp;
    rep(i, S.size()) mp[S[i]]++;
    mint ans = 1;
    for (auto e: mp) ans *= (e.second + 1);
    ans -= 1;
    cout << ans.x << endl;
}


Measured memory_bytes: 3656
#include<stdio.h>

int solve(int,int,int,int[]);

main(){

  int n,q;
  int i,j=0;
  int A[20];
  int m[200];
  
  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);

  for(i=0;i<q;i++){
    scanf("%d",&m[i]);
  }
  for(i=0;i<q;i++){
    if(0==solve(j,m[i],n,A)) printf("yes\n");
    else printf("no\n");
  }
  return 0;
}

int solve(int i,int m,int n,int A[]){
  if(m==0) return 0;
  if(i>=n) return 1;
  if(solve(i+1,m,n,A)==0) return 0;
  else if(solve(i+1,m-A[i],n,A)==0) return 0;
  else return 1;
}

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

score=[]
for _ in range(n):
    s=int(input())
    score.append(s)

#すべて10の倍数ならば0である
non10=[]
flg10=0
for i in range(n):
    if score[i]%10!=0:
        non10.append(score[i])
        flg10=1
    
if flg10==0:
    ans=0
else:
    if sum(score)%10==0:
        ans=sum(score)-min(non10)
    else:
        ans=sum(score)
print(ans)
    


Measured memory_bytes: 9076
#include <stdio.h>

int main()
{
        int i,n,x=0;

        scanf("%d",&n);

        for(i=n;i>0;i--){
                if(i<=99999 && i>=10000)x++;
                else if(i<=999 && i>=100)x++;
                else if(i<=9 && i>=1)x++;
        }

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

        return 0;
}



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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;

const int INF = (int)1e+9;
const ll INF_L = (ll)1e+18;
int N, M, Q;
ll L;
vector<vl> W;
vector<vi> G;

void input_init(void) {
	cin >> N >> M >> L;
	W.resize(N, vl(N, INF_L));
	for (int i = 0; i < N; ++i)
		W[i][i] = (ll)0;
	for (int i = 0; i < M; ++i) {
		int a, b;
		ll c;
		cin >> a >> b >> c;
		W[a - 1][b - 1] = W[b - 1][a - 1] = c;
	}
}

void warshall_floyd(void) {
	for (int k = 0; k < N; k++) {
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				W[i][j] = min(W[i][j], W[i][k] + W[k][j]);
			}
		}
	}
}

void make_G(void) {
	G.resize(N, vi(N, INF));
	for (int i = 0; i < N; ++i)
		G[i][i] = 0;
	for (int i = 0; i < N - 1; ++i) {
		for (int j = i + 1; j < N; ++j) {
			if (W[i][j] <= L)
				G[i][j] = G[j][i] = 1;
		}
	}
}

void warshall_floyd_2(void) {
	for (int k = 0; k < N; k++) {
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				G[i][j] = min(G[i][j], G[i][k] + G[k][j]);
			}
		}
	}
}

void solve(void) {
	cin >> Q;
	for (int i = 0; i < Q; ++i) {
		int s, t;
		cin >> s >> t;
		int ans = G[s - 1][t - 1];
		if (ans == INF)
			ans = -1;
		else
			--ans;
		cout << ans << '\n';
	}
}

int main(void) {
	input_init();
	warshall_floyd();
	make_G();
	warshall_floyd_2();

	solve();
	return 0;
}


Measured memory_bytes: 1664
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define scani(x) scanf("%d",&x)
#define scanc(x) scanf("%s",x)
#define printi(x) printf("%d",x)
#define printin(x) printf("%d\n",x)
#define printc(x) printf("%s",x)
#define repd(i,n,m) for(int i = n; i > m; i--)
#define repu(i,n,m) for(int i = n; i < m; i++)
#define allprintu(i,n,m,a) for(int i = n; i < m; i++){if(i != m-1){printf("%d ",a[i]);}else{printf("%d",a[i]);}}
#define allprintd(i,n,m,a) for(int i = n; i > m; i--){if(i != 0){printf("%d ",a[i]);}else{printf("%d\n",a[i]);}}
	
#define MAX_N 20
#define MAX_Q 200

int n,q;
int a[MAX_N],m[MAX_Q];

int max(int a, int b){
	return (a > b) ? a : b;
}
int all_search(int x,int sum, int i){
	if(sum + a[i] == x){
		return 1;
	}else if(i >= n){
		return 0;
	}else{
		return max(all_search(x,sum+a[i],i+1),all_search(x,sum,i+1));
	}
	
}
int search(int x){
	int i = 0;
	int sum = 0;
	return all_search(x,sum,i);
}

int main(void){
	scani(n);
	repu(i,0,n){
		scani(a[i]);
	}
	scani(q);
	repu(i,0,q){
		scani(m[i]);
	}
	repu(i,0,q){
		if(search(m[i])){
			printf("yes\n");
		}else{
			printf("no\n");
		}
	}
	

	return 0;
}


Measured memory_bytes: 2084
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
#include <bitset>
#include <functional>
using namespace std;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define MOD (long long int)(1e9+7)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  if(n <= 1e7){
    ret *= kaijo(n); ret %= MOD;
    ret *= gyaku_kaijo(r); ret %= MOD;
    ret *= gyaku_kaijo(n-r); ret %= MOD;
  }else{
    rep(i,r){
      ret *= n-i; ret %= MOD;
      ret *= mpow(r-i, MOD-2); ret %= MOD;
    }
  }
  return ret;
}

int main(void){
  fast_io
  cout<<fixed<<setprecision(15);
  int hoge[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;cin>>k;
  cout<<hoge[k-1]<<endl;

}

Measured memory_bytes: 892
// 2018/01/05 Tazoe

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

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

		if(n==0)
			break;

		int len[40];			// 単語の長さ
		for(int i=0; i<n; i++){
			string w;
			cin >> w;

			len[i] = w.size();
		}

		for(int i=0; i<n; i++){
			bool flg = false;		// 見つかったフラグ
			int sta = 0;			// 区切り
			int sum = 0;			// 文字数の合計

			for(int j=i; j<n; j++){
				sum += len[j];

				// 区切りなら
				if(sum==5 || sum==12 || sum==17 || sum==24 || sum==31){
					sta++;
				}

				if(sta==5){			// 見つかった
					flg = true;
					break;
				}
				else if(sum>=31){		// 見つからなかった
					break;
				}
			}

			if(flg){			// 見つかったら
				cout << i+1 << endl;
				break;
			}
		}
	}

	return 0;
}



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

public class Main {
    public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt(); //整数の数
    int[] x = new int[n];
    for (int i=0; i<n; i++) { //整数を読み込む
        x[i] = sc.nextInt();
    }
    int count = bubbleSort(x);
    out(x,count);
    }
    /**
     * バブルソート
     */
    public static int bubbleSort(int[] x) {
        int count = 0;
        for(int i=x.length-1; i>0; i--) {
            for (int j=0; j<i; j++) {
                if(x[j]>x[j+1]){
                    int a = x[j];
                    x[j] = x[j+1];
                    x[j+1] = a;
                    count++;
                }
            }
        }
        return count;
    }
    /**
     * 出力
     */
    public static void out(int[] x, int count) {
        for (int i=0; i<x.length-1; i++) {
            System.out.print(x[i]+" ");
        }
        System.out.print(x[x.length-1]);
        System.out.println();
        System.out.println(count);
    }
}



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

using namespace std;


int main() {
    int n;
    cin>>n;
    int ar[n];
    for(int i=0;i<n;i++)
    cin>>ar[i];
    int b[n];
    b[0]=0;
    int y;
    for(int i=1;i<n;i++)
    {
        int x=ar[i]-ar[i-1];
        if(x<0)
        x=x*(-1);
        if(i>1)
        {
            y=ar[i]-ar[i-2];
            if(y<0)
            y=y*(-1);
        }
        if(i==1)
        b[i]=x;
        else
        {
            x=x+b[i-1];
            y=y+b[i-2];
            b[i]=min(x,y);
        }

    }
    cout<<b[n-1]<<endl;
    return 0;
}



Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		try (Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			int[] t = new int[n];
			int sum = 0;
			for(int i = 0 ; i < n ; i++) {
				t[i] = sc.nextInt();
				sum += t[i];
			}
			int m = sc.nextInt();
			int[] p = new int[m];
			int[] x = new int[m];
			for(int i = 0 ; i < m ; i++) {
				p[i] = sc.nextInt();
				x[i] = sc.nextInt();
			}
			for(int i = 0 ; i < m ; i++) {
				System.out.println(sum - (t[p[i] - 1] - x[i]));
			}
		}

	}

}


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

#define mp make_pair

const int N = 3e3 + 10;

int sz, tz, d[N][N], x, y;
string s, t, ans;
pair<int, int>p[N][N];
int main ()
{
	cin >>s >>t;
	sz = s.size();
	tz = t.size();
	for (int i = 0; i < sz; i++)
	{
		for (int j = 0; j < tz; j++)
		{
			if (s[i] == t[j])
			{
				if (i == 0 && j == 0)
				{
					d[i][j] = 1;
					p[i][j] = mp(-1, -1);
				} else if (i == 0)
				{
					d[i][j] = 1; 
					p[i][j] = mp(-1, -1);
				} else if (j == 0)
				{
					d[i][j] = 1;
					p[i][j] = mp(-1, -1);
				} else
				{
					d[i][j] = d[i - 1][j - 1] + 1;
					p[i][j] = mp(i - 1, j - 1);
				}
			} else
			{
				if (i == 0 && j == 0)
				{
					d[i][j] = 0;
					p[i][j] = mp(-1, -1);
				} else if (i == 0)
				{
					d[i][j] = d[i][j - 1];
					p[i][j] = mp(i, j - 1);
				} else if (j == 0)
				{
					d[i][j] = d[i - 1][j];
					p[i][j] = mp(i - 1, j);
				} else
				{
					if (d[i - 1][j] > d[i][j - 1])
					{
						d[i][j] = d[i - 1][j];
						p[i][j] = mp(i - 1, j);
					} else
					{
						d[i][j] = d[i][j - 1];
						p[i][j] = mp(i, j - 1);
					}
				}
			}
		}
	}
	x = sz - 1;
	y = tz - 1;
	while (x + y != -2)
	{
		if (s[x] == t[y])
		{
			ans = ans + s[x];
		}
		int xx = x;
		int yy = y;
		x = p[xx][yy].first;
		y = p[xx][yy].second;
	}
	reverse(ans.begin(), ans.end());
	cout <<ans;
	return 0;
}


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

int main() {
  int n;
  string s;
  cin >> n >> s;
  vector<int> left(26, 0), right(26, 0);
  int i, j;
  for (i = 0; i < n; i++) {
    right[s.at(i) - 'a']++;
  }

  int result = 0;
  for (i = 0; i < n; i++) {
    right[s.at(i) - 'a']--;
    left[s.at(i) - 'a']++;
    int sum = 0;
    for (j = 0; j < 26; j++) {
      if (left[j] > 0 && right[j] > 0) {
        sum++;
      }
    }
    result = max(result, sum);
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)

n, q = map(int, input().split())
g = [[] for _ in range(n)]
for i in range(n-1):
  a, b = map(int, input().split())
  a, b = a-1, b-1
  g[a].append(b)
  #g[b].append(a)

ans = [0]*n  
for j in range(q):
  p, x = map(int, input().split())
  ans[p-1] += x
  
from collections import deque
s = deque()
s.append(0)

while s:
  v = s.pop()
  for v_ in g[v]:
    ans[v_] += ans[v]
    s.append(v_)

print(' '.join(map(str, ans)))

Measured memory_bytes: 122060
n, k = list(map(int, input().split(" ")))

ans = [0] * n

for i in range(k):
    d = int(input()) 
    a = list(map(int, input().split(" ")))

    #print(d,a)
    for x in a:
        ans[x-1] = 1



print(ans.count(0))



Measured memory_bytes: 9180
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <utility>
#include <algorithm>
#include <functional>
#include <deque>
#define INF 1e9

using namespace std;

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

int main() {
    ll N, M;
    cin >> N >> M;
    ll n, m;
    n = max(N, M); m = min(N, M);
    
    ll ans = 0;
    if (m >= 2) {
        ans = (n - 2) * (m - 2);
    } else if (n >= 2) {
        ans = n - 2;
    } else {
        ans = 1;
    }
    
    cout << ans << endl;
    return 0;
}


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

#define mp make_pair
#define pb push_back

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> l4;

bool vis[300] = {0};
char str[1001];
int main()
{
  char *s = str;
  scanf("%s", s);
  while (*s)
    {
      vis[*s] = true;
      ++s;
    }
  puts((vis['N']^vis['S'])||(vis['E']^vis['W'])?"No":"Yes");
}


Measured memory_bytes: 256
S = input()

MOD = 10 ** 9 + 7

dp = [0] * 13
dp[0] = 1
msb = 1
for i in range(len(S) - 1, -1, -1):
    new_dp = [0] * 13
    if S[i] == '?':
        for j in range(10):
            for k in range(13):
                new_dp[(j * msb + k) % 13] += dp[k]
                new_dp[(j * msb + k) % 13] %= MOD
    else:
        j = int(S[i])
        for k in range(13):
            new_dp[(j * msb + k) % 13] += dp[k]
            new_dp[(j * msb + k) % 13] %= MOD
    dp = new_dp[:]
    msb *= 10
    msb %= 13
print(dp[5])


Measured memory_bytes: 43372
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"


int main() {
	int N, M; cin >> N >> M;
	int now = M;
	int amax = M;
	bool flag = true;
	for (int i = 0; i < N; ++i) {
		int a, b; cin >> a >> b;
		now += (a - b);
		amax = max(amax, now);
		if (now == -1)flag = false;
	}
	if (flag) {
		cout << amax << endl;
	}
	else {
		cout << 0 << endl;
	}
	return 0;
}

Measured memory_bytes: 3104
import java.util.*;
import java.math.*;
import java.awt.geom.*;
import java.io.*;
    
    
public class Main {
	static int INF = 2 << 27;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();
			if(n == 0) break;
			int[] a = new int[n];
			for(int i = 0; i < n; i++) {
				a[i] = sc.nextInt();
			}
			int min = Integer.MAX_VALUE;
			for(int i = 0; i < 1 << n; i++) {
				int A = 0;
				int B = 0;
				for(int j = 0; j < n; j++) {
					if((i & 1 << j) != 0) {
						A += a[j];
					}
					else {
						B += a[j];
					}
				}
				min = Math.min(min, Math.abs(A - B));
			}
			System.out.println(min);
			
		}
	}
}

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

 
int main() {
    int n,a,b;
    cin>>n>>a>>b;

    int ans=0;
    for(int i=1;i<=n;i++){
        int sum=0;
        int j=i;
        while(j){
            sum+=j%10;
            j=j/10;
        }
        if(sum<=b&&sum>=a)ans+=i;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

long long f(long long x){
    if(x <= 0) return 0;
    if(x%2 == 1){
        if(x%4 == 1) return 1;
        else return 0;
    }
    return (x ^ f(x-1));
}
int main(){
    long long a, b;
    cin >> a >> b;
    cout << (f(b) ^ f(a-1));
}


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

using namespace std;

enum Label {
  LABEL1,
  LABEL2,
  LABEL3,
  LABEL4,
  LABEL5,
  LABEL6,
};

enum Direction {
  E,
  N,
  S,
  W,
};

class Dice {
public:
  Dice(int label[6])
      : top_(LABEL1), bottom_(LABEL6), front_(LABEL2), back_(LABEL5),
        right_(LABEL3), left_(LABEL4) {
    for (int i = 0; i < 6; ++i) {
      label_[i] = label[i];
    }
  }

  void north() {
    Label tmp = top_;
    top_ = front_;
    front_ = bottom_;
    bottom_ = back_;
    back_ = tmp;
  }

  void south() {
    Label tmp = top_;
    top_ = back_;
    back_ = bottom_;
    bottom_ = front_;
    front_ = tmp;
  }

  void east() {
    Label tmp = top_;
    top_ = left_;
    left_ = bottom_;
    bottom_ = right_;
    right_ = tmp;
  }

  void west() {
    Label tmp = top_;
    top_ = right_;
    right_ = bottom_;
    bottom_ = left_;
    left_ = tmp;
  }

  void roll(char ch) {
    Direction direction;
    switch (ch) {
    case 'E':
      east();
      break;
    case 'N':
      north();
      break;
    case 'S':
      south();
      break;
    case 'W':
      west();
      break;
    default:
      break;
    }
  }

  int getTop() { return label_[top_]; }

private:
  int label_[6];
  Label top_;
  Label bottom_;
  Label front_;
  Label back_;
  Label right_;
  Label left_;
};

int main() {
  int label[6];
  for (int i = 0; i < 6; ++i) {
    cin >> label[i];
  }
  Dice dice(label);

  string command;
  cin >> command;
  for (int i = 0; i < command.size(); ++i) {
    dice.roll(command[i]);
  }
  cout << dice.getTop() << endl;

  return 0;
}



Measured memory_bytes: 3212
#include <stdio.h>
#include <vector>
#include <iostream>

using namespace std;
char po[20];

int main(){
	scanf("%s",po);
	for(int i=0;i<=3;i++){
		printf("%c",po[i]);
			}
			printf(" ");	
for(int i=4;i<=11;i++){
		printf("%c",po[i]);
			}	
			printf("\n");
	return 0;
}

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

int main(){
	string a,s,d,f;
	s="Sunny";
	d="Cloudy";
	f="Rainy";
	cin>>a;
	if(a==s){
		cout<<d<<endl;
	}
	else if(a==d){
		cout<<f<<endl;
	}
	else if(a==f){
		cout<<s<<endl;
	}
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using llint = long long int;
using namespace std;

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

  vector<pair<string, int>> city;
  set<string> st;
  rep(i, n) {
    string s;
    cin >> s;
    int p;
    cin >> p;
    city.push_back(make_pair(s, p));
    st.insert(s);
  }

  vector<string> name;
  for(auto s: st)
    name.push_back(s);
  sort(name.begin(), name.end());

  for(auto n: name) {
    vector<pair<int, int>> scores;
    for(size_t i=0; i<city.size(); ++i) {
      if(n == city.at(i).first) {
        scores.push_back(make_pair(city.at(i).second, i + 1));
      }
    }

    sort(scores.begin(), scores.end());
    for(int i=scores.size()-1; i>=0; --i) {
      // cout << scores.at(i).first << " "  << scores.at(i).second << endl;
      cout << scores.at(i).second << endl;
    }
    scores.clear();
  }
}


Measured memory_bytes: 3624
import java.util.*;
public class Main {
	static String S;
	static int p;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int nowtime = 0;
		boolean ans = false;
		int i = 0;
		for(; i < 10000; i++) {
			nowtime += a;
			while(60 * i + c > nowtime + b ) {
				nowtime += b;
				nowtime += a;
			}
			
			if(60 * i + c <= nowtime && 60 * i + c >= nowtime - a) {
				ans = true;
				break;
			}
			
			nowtime += b;
		}
		if(ans) {
			System.out.println(60 * i + c);
		}
		else {
			System.out.println("-1");
		}
	}

}

Measured memory_bytes: 18048
#pragma GCC optimize(2)
//#pragma comment(linker, "/STACK:102400000,102400000")

#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define rep(i, beg, end) for (int i = (beg); i < (end); i++)
#define rrep(i, beg, end) for (int i = (beg); i >= (end); i--)
#define sp(i) setprecision(i) << fixed
typedef long long ll;
typedef pair<ll, ll> P;
typedef unsigned long long ull;
const int mod = 1e9 + 7;
const int N = 1010;
ull p_hash(ull x, ull y) { return (x + y) * (x + y + 1) / 2 + y; } //NxN->N
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

int p[N];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    ll n;
    cin >> n;
    ll m = n;
    int ans = 0;
    rep(i, 2, m / i + 1)
    {
        if (n % i == 0)
        {
            int j = i;
            while (n % j == 0)
            {
                ans++;
                n /= j;
                j *= i;
            }
            while (n % i == 0)
            {
                n /= i;
            }
        }
    }

    if (n > 1)
        ans++;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3652
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())
    h = list(map(int, input().split()))
    ans = 0
    for i in range(n):
        tmp = h[: i + 1]
        if h[i] == max(tmp):
            ans += 1
    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


Measured memory_bytes: 38384
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        int l, b, p, a;
        Scanner sc = new Scanner(System.in);
        l= sc.nextInt();
        b = sc.nextInt();
        p = 2* (l + b);
        b = l * b;
        System.out.println(b +" "+  p);
        
        
        

    }
    
}



Measured memory_bytes: 26272
#include "bits/stdc++.h"

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define ll1 1ll
#define ONE 1ll
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
	is >> p.first >> p.second;
	return is;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> &p) {
	os << p.first << " " << p.second;
	return os;
}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}
/*
typedef __int128_t Int;
std::ostream &operator<<(std::ostream &dest, __int128_t value) {
std::ostream::sentry s(dest);
  if (s) {
	__uint128_t tmp = value < 0 ? -value : value;
	char buffer[128];
	char *d = std::end(buffer);
	do {
	  --d;
	  *d = "0123456789"[tmp % 10];
	  tmp /= 10;
	} while (tmp != 0);
	if (value < 0) {
	  --d;
	  *d = '-';
	}
	int len = std::end(buffer) - d;
	if (dest.rdbuf()->sputn(d, len) != len) {
	  dest.setstate(std::ios_base::badbit);
	}
  }
  return dest;
}

__int128 parse(string &s) {
  __int128 ret = 0;
  for (int i = 0; i < s.length(); i++)
	if ('0' <= s[i] && s[i] <= '9')
	  ret = 10 * ret + s[i] - '0';
  return ret;
}
*/

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> bool chmax(T &a, const T &b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
template <class T> bool chmin(T &a, const T &b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N; cin >> N;
	vector<int>h(N); rep(i, 0, N) { cin >> h[i]; }
	int ans = 0;
	while (*max_element(all(h)) > 0) {
		dump(h);
		int i = 0;
		while (i < N and h[i] == 0)i++;
		int j = i;
		while (j < N and h[j]>0)j++;
		auto m = *min_element(h.begin() + i, h.begin() + j);
		for (int k = i; k < j; k++)h[k] -= m;
		ans += m;

	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <cassert>
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define MAX 1000
using namespace std;
int ans;
int n,d[MAX],threshold=10,numOfDigits=1;
set<int> list;
int main() {
  cin >> n;
  rep(i,n) cin >> d[i];
  rep(i,n) list.insert(d[i]);
  for(int i = 0;true;i++){
    if(i == threshold){
      list.clear();
      numOfDigits++;
      rep(i,n+1-numOfDigits){
        int element = 0;
        REP(j,i,numOfDigits+i){
          element *= 10;
          element += d[j];
        }
        list.insert(element);
      }
      threshold *= 10;
    }
    if(list.count(i)==0) {
      cout << i << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 1228
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<functional>
using namespace std;
#define ll long long int
#define ld long double
using namespace __gnu_pbds;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,
tree_order_statistics_node_update> in_set;
#define rep(n) for(ll i=0;i<(n);i++)
#define jrep(n) for(ll j=0;j<(n);j++)
#define all(a) (a).begin(), (a).end()
#define dpp(a) cout<<(a).first<<" "<<(a).second<<endl;
#define append push_back
#define mod 1000000007
#define ff first
#define ss second
#define ffast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fast ios::sync_with_stdio(0);
ll pw(ll x,ll y,ll p=mod){ll r=1; x=x%p;while(y>0){ if(y&1)r=(r*x)%p;
y=y>>1;x=(x*x)%p;} return r; } vector<ll> uniq(vector<ll> arr)
{vector<ll>brr;sort(all(arr));brr.append(arr[0]);
for(auto i:arr)if(brr.back()!=i)brr.append(i);return brr;}
 
void solve(){
    ll n,a,b; cin>>n>>a>>b;
    ll tp = a+b;
    ll tb = (n/tp)*a;
    n=n%tp;
    tb+=(min(a,n));
    cout<<tb<<endl;
}
 
int main(){
    ffast
    ll t=1;
    //cin>>t;
    rep(t) solve();
}
 
 
// *p.find_by_order(n) : nth value (0 indexed)
// p.order_of_key(7): index of 7 (0 indexed)


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(j,n) for(int j = 0; j < (n); ++j)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;

int main() {
  int N;
  cin >> N;
  int h[N];
  rep(i,N){
    cin >> h[i];
  }
  int cost[N];
  cost[0] = 0;
  cost[1] = abs(h[1] - h[0]);
  srep(i,2,N) {
    int costa = abs(h[i-2] - h[i]) + cost[i-2];
    int costb = abs(h[i-1] - h[i]) + cost[i-1];
    cost[i] = min(costa, costb);
  }
  cout << cost[N-1] << endl;
  return 0;
}

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

int dp[100];

//最大公約数
int gcd(int x, int y){
  if(x % y == 0) return 1;
  return gcd(y, x % y);
}

//最小公倍数
int lcm(int x, int y){
  return x * y / gcd(x, y);
}

//フィボナッチ数列
//配列dpを-1で初期化する
int fib(int n){
  if(n == 0 || n == 1) return dp[n] = 1;
  if(dp[n] != -1) return dp[n];
  return dp[n] = fib(n - 1) + fib(n - 2);
}

//階乗計算(factorial)
int fact(int n){
  if(n = 1) return 1;
  return n * fact(n - 1);
}

int main(){
  int n, k, s;
  cin >> n >> k >> s;
  rep(i,k) cout << s << " ";
  if(s == MAX_INT){
    rep(i, n-k){
      cout << 1 << " ";
    } 
  }
  else{
    rep(i, n-k) {
      cout << s + 1 << " ";
    }
  }
}















Measured memory_bytes: 1280
import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(f.readLine());
		int n = Integer.parseInt(st.nextToken());
		int m = Integer.parseInt(st.nextToken());
		int k = Integer.parseInt(st.nextToken());
		boolean good = false;
		for(int i = 0; i <= n; i++) {
			for(int j = 0; j <= m; j++) {
				if(i*(m - j) + j*(n - i) == k) {
					good = true;
				}
			}
		} 
		if(good) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 23380
#include <iostream>
#include <string>
#include <queue>
#include <vector>

using namespace std;

int main() {
  int n, q, t = 0, min2;
  cin >> n >> q;
  string s;
  int t2;
  pair<string,int> tmp;
  queue<pair<string,int> > q1;
  for (int i = 0; i < n; i++) {
    cin >> s >> t2;
    q1.push(make_pair(s, t2));
  }
  while (q1.size() > 0) {
    tmp = q1.front();
    min2 = min(tmp.second, q);
    tmp.second -= min2;
    t += min2;
    if (tmp.second <= 0) {
      cout << tmp.first << " " << t << endl;
      q1.pop();
    } else {
      q1.push(tmp);
      q1.pop();
    }
  }
  return 0;
}



Measured memory_bytes: 6248
#pragma GCC optimize ("-O3")
#include <bits/stdc++.h>
#define pb push_back
#define pll pair<ll, ll>
#define mll map<ll, ll>
#define ff first
#define oo 1000000000000000005
#define ss second
#define el "\n"
#define maxS 200005
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    // ll t;cin>>t;while(t--)
    {
        string s, t;
        cin>>s>>t;
        ll l = s.length(),i;
        for(i=0 ; i<l ; i++)
            if(s[i] != t[i])
            {
                cout<<"No\n";
                break;
            }
        if(i == l)
            cout<<"Yes\n";
    }
    
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <bitset>
#include <string>
#include <utility>
#include <iterator>
#include <fstream>
#include <sstream>
#include <numeric>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <cctype>
#include <climits>
#include <ctime>
#include <cassert>
#include <ext/pb_ds/assoc_container.hpp>    // PBDS
#include <ext/pb_ds/tree_policy.hpp>        // PBDS

using namespace std;
using namespace __gnu_pbds;                 // PBDS

/* typedef starts */

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> PBDS_INT;               // PBDS for int
typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> PBDS_LL;    // PBDS for long long

/* typedef ends */

/* macro starts */

#define PI acos(-1)
#define EPS 1e-9
#define fastIO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define sinD(degree) sin((degree * PI) / 180.0)
#define cosD(degree) cos((degree * PI) / 180.0)
#define tanD(degree) tan((degree * PI) / 180.0)
#define cotD(degree) (1.0 / tanD(degree))
#define secD(degree) (1.0 / cosD(degree))
#define cosecD(degree) (1.0 / sinD(degree))
#define asinD(value) (asin(value) * 180.0) / PI
#define acosD(value) (acos(value) * 180.0) / PI
#define atanD(value) (atan(value) * 180.0) / PI
#define forn(i,n) for(int i=0;i<n;i++)
#define min(a,b) a<b ? a:b
#define max(a,b) a>b ? a:b
#define value_at_index(x) find_by_order(x)
#define index_of(x) order_of_key(x)
#define pb push_back
#define set0(add) memset(add,0,sizeof(add))

/* macro ends */

/* function starts */

/// calculates n-th (0-based) Gray Code
template<typename dataType>
dataType nthGrayCode(dataType n)
{
    return (n ^ (n >> 1));
}

/// generates all possible subsets for the given set
template<typename dataType>
void generateAllSubset(vector<dataType> &data)
{
    int i, j, n;
    n = data.size();

    for (i = 0; i < (1 << n); i++) {
        for (j = 0; j < n; j++) {
            if (i & (1 << j)) {
                cout << data[j] << " ";
            }
        }
        cout << "\n";
    }
}

void swap(int a, int b){
	int temp;
	temp=a;
	a=b;
	b=temp;
}

int fact(int n){
	if(n==1)
		return 1;
	else 
	return n*fact(n-1);
}

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



int main()
{
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif

    fastIO;
   int n;
   cin >> n;
   ll ans=0;
   for(int i=1;i<=n;i++){
   		ll imp=floor(double(n)/i);
   		ll med=(imp)*(imp+1)/2;
   		ans+=med*i;
   	}
   
   cout << ans;

    return 0;
   	}


Measured memory_bytes: 3756
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
 
using namespace std;
 
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N;

	cin >> N;

	int coua = 1;

	vector<bool> chea(N);

	for(int i = N - 1; i >= 0; i--) {
		int p;
		cin >> p;
		if(i == -1) {
			break;
		}
		int c = 0;
		for(int j = 0; j < N; j++) {
			if(j == p - 1) {
				chea[j] = true;
				break;
			}
			if(!chea[j]) {
				c++;
			}
		}
		int kai = 1;
		for(int j = 2; j <= i; j++) {
			kai *= j;
		}
		coua += kai * c;
	}


	int coub = 1;

	vector<bool> cheb(N);

	for(int i = N - 1; i >= 0; i--) {
		int p;
		cin >> p;
		if(i == -1) {
			break;
		}
		int c = 0;
		for(int j = 0; j < N; j++) {
			if(j == p - 1) {
				cheb[j] = true;
				break;
			}
			if(!cheb[j]) {
				c++;
			}
		}
		int kai = 1;
		for(int j = 2; j <= i; j++) {
			kai *= j;
		}
		coub += kai * c;
	}
/*
	cout << coua << endl;
	cout << coub << endl;
*/
	cout << abs(coua - coub) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define mp make_pair
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m;
	cin>>n>>m;
	int a[m];
	ll sum = 0;
	for(int i =0; i<m; i++)
	{
		cin>>a[i];
		sum += a[i];
	}
	if(sum>n)
		cout<<-1<<endl;
	else
		cout<<n-sum<<endl;
	return 0;
}

Measured memory_bytes: 3656
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use std::process::exit;
use std::cmp::*;
use itertools::Itertools;

fn main() {
    input! {
    a:isize,
    b:isize,
    c:isize,
    }
    println!("{}",if a<=c&&b>=c{"Yes"}else{"No"})
}

Measured memory_bytes: 2136
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		String str = reader.next();
		int hashad = 0;
		int base = Integer.parseInt(str);
		for (int i = 0; i < str.length(); i++) {
			hashad += Character.getNumericValue(str.charAt(i));
		}
		String ans = "Yes";
		if ( base % hashad != 0) {
			ans = "No";
		}

		System.out.println(ans);
		reader.close();

	}
}

Measured memory_bytes: 21844