akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <math.h>

int d, n;

int solve(){
	switch(d){
		case 0:
			if(n == 100) return 101;
			return n;
		case 1:
			if(n == 100) return 10100;
			return n * 100;
		case 2:
			if(n == 100) return 1010000;
			return n * 10000;
	}
}

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

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

	return 0;
}

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

#define rep(i, k, n) for(int i = (k); i < (n); i++)
#define irep(i, k, n) for(int i = (k); i > (n); i--)
using namespace std;
using ll = long long;


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

  vector<int> len(n);
  rep(i, 0, n) cin >> len[i];

  sort(len.rbegin(), len.rend());

  int ans = 0;
  rep(i, 0, n-2){
    rep(j, i+1, n-1){
      int min = len[i] - len[j];
      int l = j;
      int r = n;
      while(r-l > 1){
        int c = (l+r)/2;
        if(len[c] > min) l = c;
        else r = c;
      }
      ans += l - j;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
#define MAX 510000
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

//cout << fixed << setprecision(10);//
//最小公倍数//
ll gcd(ll x, ll y) {
	if (x == 0) return y;
	return gcd(y%x, x);
}
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

//べき//
ll squ(ll n, ll p, ll m){
	if(p==0) return 1;
	if(p%2==0){
		ll t=squ(n, p/2, m);
		return t*t%m;
	}
	return n*squ(n,p-1,m);
	
}


//逆元mod(mを法とするaの逆元)//
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//Cmonp//
ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
ll COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//nが大

ll com(ll n,ll m){
	if(n<=0 || m<=0 || n==m){
		return 1;
	}
	if(n<m){
		return 0;
	}
	ll k=1;
	for(ll i=1;i<=m;i++){
       k*=(n-i+1); 
	   k%=MOD;
	   k*=modinv(i,MOD);
	   k%=MOD;
	}

	return k;
}


//


////////////////////////////////////////////////////////////////////




int main() {
ll n;
cin>>n;
ll ans=0;
ans=(ll)(n/500);
ans*=1000;
n=n%500;
ans+=(ll)(n/5)*5;
cout<<ans<<endl;
return 0;

}



Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<stdlib.h>
#include<stack>
using namespace std;
#define PI 3.14159265358979
typedef  long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#include<set>
    struct tow
    {
        ll h;
        vector<ll> tonari;

    };
int main(void)
{
    int n;
    cin>>n;
    int m;
    cin>>m;
   


    vector<tow> tows(n+3);


    for(int i=1;i<=n;i++)
    {
        cin>>tows[i].h;
    }

    for(int j=1;j<=m;j++)
    {
        ll a,b;
        cin>>a>>b;

        tows[a].tonari.push_back(b);
        tows[b].tonari.push_back(a);
    }
    ll ans =0;
    for (ll k = 1; k <=n; k++)
    {  bool check = true;
        rep(l,tows[k].tonari.size())
        {
          
            if(tows[tows[k].tonari[l]].h>=tows[k].h) check = false;

        }
        if(check) ans ++;
    }
    

    cout<<ans<<endl;


}

Measured memory_bytes: 9420
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<queue>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int> >;
using pii = pair<int, int>;
using ppi = pair<pii, int>;

int f_dir[2][4] = {{-1, 0, 1, 0}, {0, 1, 0, -1}}; //↑→↓←
int e_dir[2][8] = {{-1, -1, -1, 0, 0, 1, 1, 1}, {-1, 0, 1, -1, 1, -1, 0, 1}};
bool is_in_field(int y, int x, int h, int w){
  return (y >= 0 && y < h && x >= 0 && x < w);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int ti = clock();
  // start-----------------------------------------------
  int a, b;
  cin >> a >> b;
  cout << a * b << endl;

  // end-----------------------------------------------
  // cerr << 1.0 * (clock() - ti) / CLOCKS_PER_SEC << endl;
}


Measured memory_bytes: 3648
# coding:utf-8
A,B,K = map(int, input().split())

sub = B - A + 1
if K*2 >= sub:
	for i in range(A, B+1):
		print(i)
else:
	for i in range(A, A+K):
		print(i)
	for i in range(B-K+1, B+1):
		print(i)


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <algorithm>


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

  std::string temp = str;
  std::reverse(temp.begin(), temp.end());
  std::replace(temp.begin(), temp.end(), 'b', '1');
  std::replace(temp.begin(), temp.end(), 'd', '2');
  std::replace(temp.begin(), temp.end(), 'p', '3');
  std::replace(temp.begin(), temp.end(), 'q', '4');
  std::replace(temp.begin(), temp.end(), '1', 'd');
  std::replace(temp.begin(), temp.end(), '2', 'b');
  std::replace(temp.begin(), temp.end(), '3', 'q');
  std::replace(temp.begin(), temp.end(), '4', 'p');

  if (str == temp) {
    std::cout << "Yes" << std::endl;
  }else{
    std::cout << "No" << std::endl;
  }

  return 0;
}



Measured memory_bytes: 512
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
from decimal import Decimal
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())
d = abs(A-B)
if V - W <= 0:
    print("NO")
else:
    if (V-W)*T >= d:
        print("YES")
    else:
        print("NO")


Measured memory_bytes: 10544
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define int long long
#define inf 1000000007
#define LINF 100000000000000007LL
#define ll long long
using namespace std;
int ka[214514],inv[214514];
void setkaijo(int n){
	ka[0]=1;
	for(int i=1;i<=n;i++){
		ka[i] = ka[i-1] * i;
		ka[i] %= inf;
	}
}
int modpow(int x,int k){
	// x ^ k mod inf
	int res = 1;
	while(k>0){
		if(k%2)res = (res*x)%inf;
		x = (x*x)%inf;
		k >>=1;
	}
	return res;
}
void setinv(int n){
	for(int i=0;i<=n;i++){
		inv[i] = modpow(ka[i],(ll)inf-2);
	}
}
int comb(int n,int k){
	if( k<0 || n<0 || k>n)return 0;
	if(k==0 || k==n)return 1;
	int res = (ka[n] * inv[k]) % inf;
	res = (res*inv[n-k]) % inf;
	return res;
}
signed main(){
	setkaijo(210000);
	setinv(210000);
	int n,k;
	cin>>n>>k;
	int ans = 0;
	vector<int> a(n);
	for(int i=0;i<n;i++){ cin>>a[i]; }
	sort( a.begin(), a.end() );
	for(int i=0;i<n;i++){
		ans += comb( i, k-1 ) * a[i];
		ans -= comb( n-i-1, k-1 ) * a[i];
		//cout<<a[i]<<" "<<comb(i-1,k-1)<<" "<<comb(n-i-1,k-1)<<endl;
		ans += (ll)inf*inf;
		ans %= inf;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4352
#include <iostream>
using namespace std;
char map[8][8];
void init(){
  for(int i = 0; i < 8; i++){
    for(int j = 0; j < 8; j++){
      map[i][j] = '0';
    }
  }
}
void dfs(int a, int b){
  map[a][b] = '0';
  for(int i = -3; i <= 3; i++){
    if(a + i >= 0 && a + i < 8 && map[a+i][b] == '1') dfs(a+i, b);
    if(b + i >= 0 && b + i < 8 && map[a][b+i] == '1') dfs(a, b+i);
  }
}
void print_map(){
  for(int i = 0; i < 8; i++){
    for(int j = 0; j < 8; j++){
      cout << map[i][j];
    }
    cout << endl;
  }
}
int main(void){
  int n, a, b;
  cin >> n;
  for(int i = 0; i < n; i++){
    init();
    for(int j = 0; j < 8; j++){
      for(int k = 0; k < 8; k++){
        cin >> map[j][k];
      }
    }
    cin >> a >> b;
    cout << "Data " << i + 1 << ":" << endl;
    dfs(b - 1, a - 1);
    print_map();
  }
  return 0;
}

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


using namespace std;


typedef long long ll;

int main()
{
  vector<int>v(3);
  cin>>v[0]>>v[1]>>v[2];
  int k;
  cin>>k;
  sort(v.begin(),v.end());
  cout<<(v[0]+v[1]+(v[2]<<k))<<endl;


  return 0;
}


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

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  string s;
  cin >> s;
  cout << (s.substr(0, 4) == "YAKI" ? "Yes" : "No") << endl;

  return 0;
}

Measured memory_bytes: 256
n=int(input().strip())
a=list(map(int, input().split()))
sumx=a[0]
sumy=sum(a[1:])
ans=abs(sumx-sumy)

for i in range(1,n-1):
    sumx+=a[i]
    sumy-=a[i]
    ans=min(ans,abs(sumx-sumy))
print(ans)

Measured memory_bytes: 24832
def cal(S):
    N = len(S)
    num,cnt = 0,0
    mod = 2019
    rem_dict,rem_set = {},set()
    for i in range(N):
        num = (num + int(S[N-1-i]) * pow(10,i,mod)) % mod
        if num in rem_set:
            rem_dict[num] += 1
        else:
            rem_set.add(num)
            rem_dict[num] = 1

    if 0 in rem_set:
        output = rem_dict[0] * (rem_dict[0] + 1) // 2
    else:
        output = 0
    rem_set.discard(0)
    for rem in rem_set:
        output += rem_dict[rem] * (rem_dict[rem]-1) // 2

    return output

def main():
    S = input()

    print(cal(S))

if __name__ == "__main__":
    main()


Measured memory_bytes: 9448
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */


#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cmath>
#include <numeric>
#include <iterator>
#include <fstream>

#define SIZE 100005
#define MOD 1000000007

using namespace std;

class CPoll {
public:
  static void solve(std::istream &cin, std::ostream &cout) {
    int64_t n;
    cin >> n;
    map<string, int64_t> s_map;
    int64_t max_count = 0;
    for (int i = 0; i < n; ++i) {
      string s;
      cin >> s;
      s_map[s];
      s_map[s]++;
      max_count = max(max_count, s_map[s]);
    }
    for (const auto &item : s_map) {
      if (item.second == max_count)
        cout << item.first << endl;
    }
  }
};


int main() {
    CPoll solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


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

void push(int);
int pop(void);
int stack[100];
int stack_pointer = 0;

int main(){
    int x, a, b;
    char s[100];

    while(scanf("%s", s) != EOF){
        if(s[0] == '+' ){
            a = pop();
            b = pop();
            push(a+b);
        }
        else if(s[0] == '-'){
            a = pop();
            b = pop();
            push(b-a);
        }
        else if(s[0] == '*'){
            a = pop();
            b = pop();
            push(a*b);
            }
        else {
            x = atoi(s);
            push(x);
        }
    }

    printf("%d\n", stack[stack_pointer]);
    return 0;
}

void push(int x){
    stack[++stack_pointer] = x;
 }

int pop(){
    stack_pointer--;
    return stack[stack_pointer + 1];
}

Measured memory_bytes: 548
A=[i+1 for i in range(1000)]
A+=reversed(A)
A.insert(1000,1001)
while(1):
    try:
        n=int(raw_input())
        ans=0
        for i in range(n+1):
            if i<2001 and n-i<2001:
                ans+=A[i]*A[n-i]
        print ans
    except:
        break

Measured memory_bytes: 6524
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 55;
const int maxm = 2505;
LL dp[maxn][maxn][maxm];
int a[maxn];

int main(){
    int N, A, x;
    scanf("%d%d", &N, &A);
    dp[0][0][0] = 1;
    for(int i = 1; i <= N; i++){
        scanf("%d", &x);
        for(int j = 0; j < i; j++){
            for(int k = 0; k < maxm; k++){
                dp[i][j][k] += dp[i - 1][j][k];
                if(j + 1 <= i && k + x < maxm)
                    dp[i][j + 1][k + x] += dp[i - 1][j][k];
            }
        }
    }
    LL ans = 0;
    for(int i = 1; i <= N; i++){
        for(int j = 0; j <= maxm; j++){
            if(1.0 * j / i == A){
                ans += dp[N][i][j];
            }
        }
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 26368
#include <algorithm>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

int main() {
  int A, B;
  while (cin >> A >> B) {
    cout << (A * B % 2 == 1 ? "Yes" : "No") << endl;
  }
  return 0;
}


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

using namespace std;

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

const ll maxn =1e5+5;
const ll mod = 1e9+7;
const ld PI = 4 * atan((ld) 1);

#define pb(x) push_back(x);
#define endl '\n'
#define dokme(x) cout << x ;  return(0);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_init freopen("input.txt", "r+", stdin); freopen("output.txt", "w+", stdout);
#define ms(x , y) memset(x , y , sizeof x);
ll pw(ll a, ll b) {
    return (!b ? 1 : (b & 1 ? a * pw(a * a % mod, b / 2) % mod : pw(a * a % mod, b / 2) % mod));
}

int n;

ld h , a;

int main(){
    migmig
    cin >> h >> a;
    cout << ceil(h / a);


    return(0);
}


//When we hit our lowest point, we are open to the greatest change.
//If I try, I fail. If I don't try, I'm NEVER GOING TO GET IT.
//Sometimes, life is like this dark tunnel. You can't always see the light at the end of the tunnel. But if you just keep moving... you will come to a better place.
//It is important to draw wisdom from diffrent places. If you take it from only one place it becomes rigid and stale.


Measured memory_bytes: 256
def guidebook(n, spli):

    ans = []
    for i in range(n):
        temp = [i+1, spli[i][0], (-1)*int(spli[i][1])]
        ans.append(temp)
    ans.sort(key=lambda x: (x[1], x[2]))
    return ans
def main():
    n = int(input())
    spli = [list(map(str, input().split()))for i in range(n)]
    ans = guidebook(n, spli)
    for i in ans:
        print(i[0])

if __name__ == '__main__':
    main()

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

int main () {
    int n;
    cin >> n;
    int d[n];
    for (int i=0; i<n; i++){
        cin >> d[i];
    }

    int total =0;
    for (int first =0; first<n; first++){
        for (int second = first+1; second <n; second++){
            int hp = d[first]*d[second];
            total = total + hp;
        }
    }

    cout << total;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
const string YES = "Yes";
const string NO = "No";
 
void solve(long double a, long double b, long double c){
    long double eps = 1.0E-14;

    if(sqrt(a) + sqrt(b) + eps < sqrt(c)){
        cout << YES << endl;
        return;
    }
    cout << NO << endl;
 
}
 
// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long a;
    scanf("%lld",&a);
    long long b;
    scanf("%lld",&b);
    long long c;
    scanf("%lld",&c);
    solve(a, b, c);
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <string>
#include <utility>
#include <vector>

using namespace std;


int main(){
  int a,b,h,m;
  cin>>a>>b>>h>>m;
  cout<<setprecision(12)<<sqrt(a*a+b*b-2*a*b*cos(5.5/180*3.14159265359*(h*60+m)));
}




/* きょむ〜 */


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

public class Main {
	public static void main(String[] args) {
		var sc = new Scanner(System.in);
		var r = sc.nextInt();
		var c = sc.nextInt();
		var k = sc.nextInt();
		var list = new ArrayList<Item>();
		for (var i = 0; i < k; i++) {
			list.add(new Main().new Item(sc.nextInt(), sc.nextInt(), sc.nextInt()));
		}
		sc.close();

		var v = new long[r][c];
		for (var i = 0; i < k; i++) {
			var item = list.get(i);
			v[item.getR() - 1][item.getC() - 1] = item.getV();
		}
		for (var i = 0; i < r; i++) {
			var rv = new long[c][5];
			for (var j = 0; j < c; j++) {
				for (var ic = 0; ic < 4; ic++) {
					if (ic == 0) {
						var rv1 = (i > 0 ? v[i - 1][j] : 0);
						var rv2 = (j > 0 ? rv[j - 1][0] : 0);
						var rv3 = (j > 0 ? rv[j - 1][1] : 0);
						if (v[i][j] > 0) {
							rv[j][1] = Math.max(Math.max(rv1 + v[i][j], rv2 + v[i][j]), rv3);
						} else {
							rv[j][0] = Math.max(rv1, rv2);
						}
					} else if (j > 0 && rv[j - 1][ic] > 0) {
						var rv2 = rv[j - 1][ic];
						if (v[i][j] > 0) {
							var rv3 = rv[j - 1][ic + 1];
							rv[j][ic + 1] = Math.max(rv2 + v[i][j], rv3);
						} else {
							rv[j][ic] = rv2;
						}
					}
				}
			}

			for (var j = 0; j < c; j++) {
				v[i][j] = Math.max(Math.max(Math.max(rv[j][0], rv[j][1]), rv[j][2]), rv[j][3]);
			}
		}
		System.out.println(v[r - 1][c - 1]);
	}

	public class Item {
		private int r;
		private int c;
		private int v;

		public Item(int r, int c, int v) {
			this.r = r;
			this.c = c;
			this.v = v;
		}

		public int getR() {
			return r;
		}

		public int getC() {
			return c;
		}

		public int getV() {
			return v;
		}
	}
}


Measured memory_bytes: 169936
#include<iostream>
#include<algorithm>
using lint=int64_t;
using namespace std;

int main()
{
	int N;
	int W[110]={};

	cin >> N;
	for(int i=1;i<=N;i++)
		cin >> W[i];
	
	int sum[2][110]={};
	for(int i=1;i<=N;i++)
		sum[0][i]+=sum[0][i-1]+W[i];
	for(int i=N;i>=0;i--)
		sum[1][i]+=sum[1][i+1]+W[i];
	
	int ans=1e9;
	for(int i=1;i<=N;i++)
		ans=min(ans,abs(sum[0][i]-sum[1][i]+W[i]));

	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <float.h>
#include <limits>
#include <vector> 
#include <string.h>
#include <iomanip>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define ll long long
#define asort(a) sort(a.begin(),a.end());

using namespace::std;

int jo(ll int jxo, ll int jyo){//累乗
	ll int jhogeo = 1;
	rep(jinto,0,jyo) jhogeo=jhogeo*jxo;
	return jhogeo;
}
char tobig(char toxbig){//char大文字化
  return (toxbig-0x20);
}
char tolow(char toxlow){//char小文字化
  return (toxlow+0x20);
}
int ctoi(char cctoi){//char->int
  if('0' <= cctoi && cctoi <= '9') return (cctoi-'0');
  return -1;
}
int gcd(int gcad, int gcbd) {//最大公約数
  if(gcad < gcbd) return gcd(gcbd, gcad);
  int gcrd;
  while ((gcrd=gcad%gcbd)) {
    gcad = gcbd;
    gcbd = gcrd;
  }
  return gcbd;
}
int lcm(int lcam, int lcbm){//最小公倍数
 return (lcam*lcbm)/gcd(lcam,lcbm);
}


int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  rep(i,0,n) cin>>a[i];
  ll int up=a[0];
  ll int down=0;
  
  rep(i,1,n){
    up=lcm(up,a[i]);
  }
  rep(i,0,n){
    down+=(up/a[i]);
  }
  cout<<setprecision(10)<<(double)up/down;
}

// int *p = new int[N];

//  vector<int> 変数名(要素数);
//  sort(変数名.begin(),変数名.end());//昇順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//


Measured memory_bytes: 256
n=int(input())
arr=list(map(int,input().split()))
a=sum(arr)//2
for i in range(1,n,2):
  a-=arr[i]
print(a*2, end=' ')
for i in range(0,n-1):
  print((arr[i]-a)*2, end=' ')
  a=arr[i]-a

Measured memory_bytes: 14092
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define pb push_back
#define mp make_pair
#define F .first
#define S .second 
#define pll pair<ll,ll>
using ll=long long;
using ld=long double;
const ll INF = 1LL<<60;
const ll mod=1e9+7;
const ll mod2= 998244353;
using namespace std;
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }



ll l[20],r[20];
ll dp[220000],sdp[220000];
map<ll,ll> x;
int main(){
    ll n,k,ans=0;
    cin>>n>>k;

    rep(i,0,k){
        cin>>l[i]>>r[i];
    }
    dp[0]=1,sdp[1]=1;
    rep(i,1,n+1){
        rep(j,0,k){
            ll L=max((ll)0,i-r[j]);
            ll R=max((ll)0,i-l[j]+1);
            dp[i]=(dp[i]+sdp[R]-sdp[L])%mod2;
        }
        sdp[i+1]=sdp[i]+dp[i];
    }
    cout<<(mod2+dp[n-1])%mod2;
   
}

Measured memory_bytes: 6748
#include <bits/stdc++.h>
using namespace std;
#define ALL(obj) obj.begin(),obj.end()
#define pb(obj) push_back(obj)
#define REP(i,N) for(ll i=0;i<N;i++)
typedef long long ll;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A,B,C;
    cin>>A>>B>>C;
    cout<<max(C-(A-B),0)<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int v[] = new int[n];
		int c[] = new int [n];
		int max = 0;
		
		for(int i = 0;i < n;i++) {
			v[i] = sc.nextInt();
		}
		for(int i = 0;i < n;i++) {
			c[i] = sc.nextInt();
		}
		
		for(int i = 0;i < n;i++) {
			int tmp = max + v[i] - c[i];
			if(tmp > max) {
				max = tmp;
			}
		}
		System.out.println(max);
	}
}


Measured memory_bytes: 22740
s = list(input())
even = []
odd = []
for i in range(len(s)):
	if i % 2 == 0:
		odd.append(s[i])
	else:
		even.append(s[i])
if "L" in odd:
	print("No")
elif "R" in even:
	print("No")
else:
	print("Yes")

Measured memory_bytes: 3064
// template version 1.12
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

// varibable settings
#define infile "../test/sample-1.in"
#define int long long //{{{
const int INF=1e18;
const int MOD=1e9+7; //}}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define ceil(a,b) ((a)+(b)-1)/(b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

int solve(){
  int n,k,Q;cin>>n>>k>>Q;
  dump(n,k);
  vi a(Q);
  rep(q, Q){
    cin>>a[q];
    a[q]--;
  }
  dump(a);

  vi score(n, k-Q);
  rep(i, Q){
    score[a[i]]++;
  }
  dump(score);

  rep(i, n){
    if (score[i]>0){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
  }

  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


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

using namespace std;

struct charNode
{
	char c;
	charNode* next;
	charNode(char input) {
		c = input;
	}
};

int main() {
	string s;
	cin >> s;
	while (s != "-") {
		charNode* head = NULL;
		charNode* cur;
		charNode* pre;
		for (int i = 0; i < s.length(); i++) {
			if (head == NULL) {
				head = new charNode(s[i]);
				cur = head;
				pre = head;
			}
			else {
				cur = new charNode(s[i]);
				pre->next = cur;
				pre = pre->next;
			}
		}
		cur->next = NULL;
		pre = head;
		cur = head;

		int shuffleTimes;
		cin >> shuffleTimes;
		for (int i = 0; i < shuffleTimes; i++) {
			int count;
			cin >> count;

			for (int i = 0; i < count; i++) {
				pre = cur;
				cur = cur->next;
			}
			charNode *newHead;
			if (pre->next != NULL) {
				newHead = cur;
				while (cur->next != NULL) {
					cur = cur->next;
				}
				cur->next = head;
				head = newHead;
				pre->next = NULL;
				cur = head;
				pre = cur;

			}
			cur = head;
			/*
			while (cur) {
				cout << cur->c;
				cur = cur->next;
			}
			cout << endl;
			cur = head;
			*/
			/*
			else {//		just output the string
				cur = head;
				while (cur) {
					cout << cur->c;
					cur = cur->next;
				}
				cout << endl;
			}
			*/
		}

		while (cur) {
			cout << cur->c;
			cur = cur->next;
		}
		cout << endl;
		head = NULL;
		pre = NULL;
		cur = head;

		cin.sync();
		cin >> s;
	}
	//system("pause");

	return 0;
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
        using namespace std;
        #define tani_nachi_ke  ios_base::sync_with_stdio(false); cin.tie(NULL);
        #define M_PI 3.14159265358979323846
        #define data data_
        #define ff first
        #define ss second
        #define pb push_back
        #define ld long double
        #define int long long
        #define print(t) cout << "Case #" << t << ": ";
        int32_t main()
        {
            tani_nachi_ke  
            
            int n;
            cin >> n;
            int f[n+10] = {0};
            for(int i = 2; i <= n; i++)
            {
                int x;
                cin >> x;
                f[x]++;
            }

            for(int i = 1; i <= n; i++)
                cout << f[i] << '\n';



           return 0;
        }
          

Measured memory_bytes: 5148
//
// Created by Wangzhe on 2019/10/19.
//

//
// Created by Wangzhe on 2019/10/19.
//

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const ll maxn = 2e5 + 10, INF = 0x3f3f3f3f;

const ll INFF = 1e12;

int a[maxn];

int main() {
    int x; cin >>x;
    bool flg = false;
    for (int i = 1; i <= 9; i++) {
        if (x % i == 0 && x / i <= 9) flg = true;
    }
    if (flg) puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn argsort<T: std::cmp::Ord + std::marker::Copy>(v: &Vec<T>) -> Vec<usize> {
    let mut sort_v = Vec::new();
    for i in 0..v.len() {
        sort_v.push((v[i], i));
    }
    sort_v.sort();
    sort_v.iter().map(|x| x.1).collect::<Vec<usize>>()
}

fn main() {
    let n = read::<usize>();
    let mut a: Vec<i64> = read_vec();
    let mut heap_forward = BinaryHeap::new();
    let mut heap_forward_sum = vec![0i64; n * 3];
    for i in 0..n * 3 {
        heap_forward.push(-a[i]);
        heap_forward_sum[i] = a[i];
        if i > 0 {
            heap_forward_sum[i] += heap_forward_sum[i - 1];
        }
        if heap_forward.len() > n {
            heap_forward_sum[i] += heap_forward.pop().unwrap();
        }
    }

    let mut heap_backward = BinaryHeap::new();
    let mut heap_backward_sum = vec![0i64; n * 3];
    for i in 0..n * 3 {
        let idx = 3 * n - i - 1;
        heap_backward.push(a[idx]);
        heap_backward_sum[idx] = a[idx];
        if idx < 3 * n - 1 {
            heap_backward_sum[idx] += heap_backward_sum[idx + 1];
        }
        if heap_backward.len() > n {
            heap_backward_sum[idx] -= heap_backward.pop().unwrap();
        }
    }

    let mut ans = std::i64::MIN;
    for i in n - 1..2 * n {
        ans = max(ans, heap_forward_sum[i] - heap_backward_sum[i + 1]);
    }
    // println!("{:?}", heap_forward_sum);
    // println!("{:?}", heap_backward_sum);
    println!("{}", ans);
}


Measured memory_bytes: 18292
import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static String line;
	public static void main(String[] args) {
		read();
		slove();
	}
	static  boolean read(){
		line = sc.nextLine();
		return true;
	}
	static void slove(){
		String line_ = new StringBuffer(line).reverse().toString();
		System.out.println(line_);
	}
}

Measured memory_bytes: 11000
from math import sqrt
while 1 :
	e = int(raw_input())
	if e == 0:
		break
	z = 0
	m = float("inf")
	while z ** 3 <= e:
		y = int(sqrt(e - z**3))
		m = min(m, e  - y**2 - z**3 + y + z)
		z += 1
	print int(m)

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

int n, m;

int main() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int a;
		cin >> a;
		n -= a;
	}
	if (n < 0) cout << -1 << endl;
	else cout << n << endl;
	return 0;
}

Measured memory_bytes: 3640
#include <stdio.h>
#include <math.h>

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))

int main(void) {
  long long n;
  scanf("%lld", &n);

  int ans = 1 << 30;
  for (long long d = 1; d * d <= n; d++) {
    if (n % d == 0) {
      int p = (int)(log10(d) + 1);
      int q = (int)(log10(n/d) + 1);
      ans = MIN(ans, MAX(p, q));
    } 
  }
  
  printf("%i\n", ans);
  
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
using P = pair<int,int>;
typedef long long ll;
const ll mod = 1e9+7;
#define all(x) (x).begin(),(x).end()

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(10);
    double N,K;
    cin >> N >> K;
    vector<int> P(N);
    REP(i,N)cin >> P[i];
    double sum = 0,maxa = 0;
    REP(i,N-K+1){
        if(i == 0){
            REP(l,K)sum += P[l];
        }else{
            sum = sum - P[i-1] + P[i+K-1];
        }
        maxa = max(maxa,sum);
    }
    cout <<maxa/2+K/2<< "\n";
}

Measured memory_bytes: 1024
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 1000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
llint gcd(llint a, llint b) {
	if (b > a)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
llint Tow(int m,int n) {//2のn乗
	if (n == 0)return 1;
	llint x = Tow(m,n / 2);
	x *= x;
	if (n % 2 == 1)x *= m;
	return x;
}
ll max(ll a, ll b) {
	if (a < b)return b;
	else return a;
}
struct edge { int to, cost; };

ll x(ll a) {
	if (a % 2 == 0) {
		ll s = a / 2;
		if (s % 2 == 0)return a;
		return a + 1;
	}
	else {
		ll s = (a+1)/ 2;
		return s % 2;
	}
}

int main() {
	ll a,b;
	cin >> a >> b;
	ll ans = x(a - 1) ^ x(b);
	cout <<ans<< endl;
	return 0;
}

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

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


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
using namespace std;
int main()
{
    while(1)
    {
        int n;
        cin >> n;
        if(n == 0)
        {
            return 0;
        }
        vector<int> vs;
        long int sum = 0;
        for(int i = 0;i < n;i++)
        {
            int s;
            cin >> s;
            sum += s;
            vs.push_back(s);
        }
        double av = (double)sum / n;
        double a = 0;
        for(vector<int>::iterator itr = vs.begin();itr != vs.end();itr++)
        {
            a += (*itr - av) * (*itr - av);
        }
        a = (double)a / n;
        cout << setprecision(8) << fixed << sqrt(a) << endl;
    }
}

Measured memory_bytes: 1288
n, m = map(int, input().split())
k = []
a = []
for i in range(n) :
    data = list(map(int,input().split()))
    k += [data[0]]
    a += [data[1:]]
countdict = {i+1 : 0 for i in range(m)}
for i in range(n) :
    for j in range(1, m+1) :
        countdict[j] += a[i].count(j)
count = 0
for i in range(1, m + 1) :
    if countdict[i] == n :
        count += 1
print(count)

Measured memory_bytes: 3064
#include <iostream>

 

using namespace std;

 

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if(a <= b && b <= c)
        cout << a << " " << b << " " << c << endl;
    else if(a <= c && c <= b)
        cout << a << " " << c << " " << b << endl;
    else if(a >= c && c >= b)
        cout << b << " " << c << " " << a << endl;
    else if(c <= b && b <= a)
        cout << c << " " << b << " " << a << endl;
    else if(a <= c && c <= b)
        cout << a << " " << c << " " << b << endl;
    else 
        cout << c << " " << a << " " << b << endl;
}
    


Measured memory_bytes: 3116
def factorize(n):
    result = []
    tmp = n
    for k in range(2, int(n ** 0.5) + 1):
        cnt = 0
        while tmp % k == 0:
            cnt += 1
            tmp //= k
        if cnt > 0:
            result.append([k, cnt])
    if tmp != 1:
        result.append([tmp, 1])
    return result

x = int(input())

while True:
    f = factorize(x)
    if len(f) == 1:
        if f[0][1] == 1:
            print(x)
            break
    x += 1

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

int N;
int dp[1011][1011];

void update( int &a, int b ){
  a = max( a, b );
}

int main(){
  while( ~scanf("%d",&N) && N ) {
    vector<int> S1(N),S2(N);
    vector<int> Ts[60*25], Te[60*25];
    char buf[256];
    for(int i=0;i<N;i++){
      int tb1,tb2,te1,te2;
      scanf("%s %d:%d %d:%d %d %d",buf,&tb1,&tb2,&te1,&te2,&S1[i],&S2[i]);
      int ts = tb1 * 60 + tb2, te = te1 * 60 + te2;
      Ts[ts].emplace_back( i );
      Te[te].emplace_back( i );
    }
    vector<int> G(N+1);
    vector<int> nx(N+1);
    int cur = N;
    for(int i=60*24;i>-1;i--){
      for( int id : Ts[i] ) {
        G[--cur] = id;
      }
      for( int id : Te[i] ) {
        nx[id] = cur;
      }
    }

   

    fill( dp[0], dp[N], 0 );
    for(int i=0;i<=N;i++){
      for(int j=0;j<=N;j++){
        int a = G[i], b = G[j];
        if( i == j ) {
          if( i == N ) continue;
          update( dp[i+1][j+1], dp[i][j] );
          update( dp[nx[a]][j+1], dp[i][j] + S1[a] );
          update( dp[i+1][nx[b]], dp[i][j] + S2[b] );
        } else if( i < j ) {
          update( dp[i+1][j], dp[i][j] );
          update( dp[nx[a]][j], dp[i][j] + S1[a] );
        } else {
          update( dp[i][j+1], dp[i][j] );
          update( dp[i][nx[b]], dp[i][j] + S2[b] );
        }
      }
    }
    printf("%d\n",dp[N][N]);
  }  
}

Measured memory_bytes: 7108
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
//#include <stdio.h>
//#include <stack>
//#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
//#include <fstream>
//#include <list>
//#include <iomanip>
#include <stdlib.h>
#include <cctype>

using namespace std;

#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define ssort(z) sort(z.begin(),z.end())
#define rsort(z) sort(z.rbegin(),z.rend())
#define eerase(z) z.erase(unique(z.begin(),z.end()),z.end())
#define ccnt(z,w) count(z.begin(),z.end(),w)


void printVec(std::vector<int> & vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec2(std::vector<Int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

Int gcd(Int a, Int b) {
	return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
	return a / gcd(a, b) *b;
	//a*bは64bit integer overflow
}

bool comp(const string a, const string b) {
	return a.length() < b.length();
}

bool integer(double num) {
	return floor(num) == num;
}

string gen(int num) {
	string str = "";
	for (int i = 0; i < num; i++) str += ".";
	return str;
}
Int fact(int num) {
	if (num == 0) return 1;
	else return num * fact(num - 1);
}


int main() {
	int n,a; cin >> n>>a;
	if (n < a)cout << 0;
	else cout << 10;

	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

ll a,b;
int main() {
	string s;
	cin>>s;
	for(ll i=0;i<s.size();i++){
		ll now=s[i]-'0';
		if(now==0){
			a++;
		}
		else{
			b++;
		}
	}
	cout << min(a,b)*2;
	// your code goes here
	return 0;
}

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

public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int N =scan.nextInt();
		int L =scan.nextInt();
		long T =scan.nextInt();
		int[] X=new int[N];
		int[] W=new int[N];

		long[] x=new long[N];


		for(int i=0;i<N;i++){
			X[i]=scan.nextInt();
			W[i]=scan.nextInt();
			x[i]=X[i]+T*(3-2*W[i]);
			while(true)
			{
				if(x[i]>0)break;
				x[i]+=L;
			}
			x[i]%=L;

		}
		long x0 = x[0];
		Arrays.sort(x);

		long cnt=0;
		if(W[0]==1){
			for(int i=1;i<N;i++){
				if(W[i]==1){continue;}
					cnt+=(2*T-X[i]+X[0]+L)/L;
				}
					cnt%=N;
		}else{
			for(int i=N-1;i>0;i--){
				if(W[i]==2){continue;}
					cnt-=(2*T-X[0]+X[i])/L;
				}
			while(true)
			{
				if(cnt>0)break;
				cnt+=N;
			}
			cnt%=N;
			}

		int ini=0;
		for(int i=0;i<N;i++){
			if(x[i]==x0){
				if(i<N-1&&x[i+1]==x0&&W[0]==1){
					ini = i+1 - (int)cnt;
					break;
				}
				ini = i-(int)cnt;
				break;
			}
		}

		for(int i=0;i<N;i++){
			System.out.println(x[(ini+i+N)%N]);
		}



	}

}


Measured memory_bytes: 71708
program main;
var N,i,x,y:integer;
begin
    readln(N);
    i:=0; x:=1000; y:=1;
    if N mod 1000 = 0 then writeln('0')
    else begin
    while x<N do begin
    y:=y+1; x:=x+1000;
    end;
    writeln(y*1000-N);
end;
end.

Measured memory_bytes: 1380
def kouyaku(a,b):
    aa = max(a,b)
    bb = min(a,b)
    if bb == 0:
        return aa
    else:
        return kouyaku(bb,aa%bb)

N = int(input())
T = []
for i in range(N):
    T.append(int(input()))

T.sort()

ans = T[0]
for time in T:
    kou = kouyaku(ans, time)
    if kou != time:
        ans = ans//kou * time
    
print(ans)

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

int main(){
  int h, w;
  cin >> h >> w;
  for (int i = 0; i < h; i ++) {
    for (int j = 0; j < w; j ++) {
      string t;
      cin >> t;
      if (t == "snuke") {
        cout << (char)('A' + j) << i + 1 << endl;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/dynamic_bitset.hpp>
namespace adaptor = boost::adaptors;
using index_t = std::size_t;

namespace lib
{
	using graph_t = std::vector<std::set<index_t>>;
	template<class T>using weighted_graph_t = std::vector<std::map<index_t, T>>;

	struct max_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::max(lhs, rhs);
		}
	};
	struct min_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::min(lhs, rhs);
		}
	};

	constexpr max_t max;
	constexpr min_t min;

	template<class T>auto order_by(T func)
	{
		return [=](auto&& lhs, auto&& rhs)
		{
			return func(lhs) < func(rhs);
		};
	}

	template<class T>constexpr auto max_v = std::numeric_limits<T>::max();
	template<class T>constexpr auto min_v = std::numeric_limits<T>::min();

	template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;
}

void Main()
{
	int N;
	std::cin >> N;
	std::cout << (1000 - (N % 1000)) % 1000 << std::endl;
}

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

Measured memory_bytes: 3632
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            string s = ReadLine();
            string t = ReadLine();
            var mins = s.OrderBy(a=>a);
            var maxt = t.OrderByDescending(a=>a);
            var ss =(string.Join("",mins));
            var tt = string.Join("",maxt);
            if(ss.CompareTo(tt)==-1){WriteLine("Yes");}else{
                WriteLine("No");
            }
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator =' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        
        public string ReadLine { get { return _stream.ReadLine(); }}
        //ReadLine:Stringとして一行読む
        public int ReadInt { get { return int.Parse(Read); }}
        //ReadInt:int(32bit)として一行読む
        public long ReadLong { get { return long.Parse(Read); }}
        //ReadLong:Long(でかい整数)として一行読む
        public double ReadDouble { get { return double.Parse(Read); }}
        //ReadDouble:Double(Float)として一行読む
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        //ReadStrArray:stringの配列として読む
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}

Measured memory_bytes: 13652
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;

const int MaxN = 200;
const int M = 998244353;

int n;
int prePow[MaxN + 1];

struct point
{
	int x, y;
	point() {}
	point(const int &_x, const int &_y)
		: x(_x), y(_y) {}

	friend inline point operator-(const point &lhs, const point &rhs)
	{
		return point(lhs.x - rhs.x, lhs.y - rhs.y);
	}

	friend inline int operator*(const point &lhs, const point &rhs)
	{
		return lhs.x * rhs.y - lhs.y * rhs.x;
	}
};
point po[MaxN + 1];

int main()
{
	cin >> n;
	for (int i = 1; i <= n; ++i)
		cin >> po[i].x >> po[i].y;

	prePow[0] = 1;
	for (int i = 1; i <= n; ++i)
		prePow[i] = prePow[i - 1] * 2 % M;

	int res = (prePow[n] - n - 1 + M) % M;
	for (int i = 1; i < n; ++i)
		for (int j = i + 1; j <= n; ++j)
		{
			int num = 0;
			for (int k = j + 1; k <= n; ++k)
				num += (po[k] - po[i]) * (po[j] - po[i]) == 0;

			res = (res + M - prePow[num]) % M;
		}

	cout << res << endl;

	return 0;
}

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

int main(){
    int N, T, A, H, ans;
    double mint = (1 << 21);
    cin >> N >> T >> A;
    for(int i = 0; i < N; i++){
        cin >> H;
        if(fabs((double)(T - H * 0.006)  - A) < mint){
            mint = fabs((double)(T - H * 0.006)  - A);
            ans = i + 1;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[51],b[51],c[51],d[51];
int n,m,q;
int ans=0;
int cnt=0;
int t[11];
void count()
{
	for(int i=1;i<=q;i++)
		if(t[b[i]]-t[a[i]]==c[i])
			cnt+=d[i];
	ans=max(cnt,ans);
	cnt=0;	
	return;
}
void ra(int l,int k)
{
	if(k>m)
		return;
	if(k<t[l-1])
		return;
	t[l]=k;
	if(l==n)
	{
		count();
		return;
	}
	for(int i=0;i<=m;i++)
		ra(l+1,i);
	return;
}
int main()
{
	cin>>n>>m>>q;
	for(int i=1;i<=q;i++)
		cin>>a[i]>>b[i]>>c[i]>>d[i];
	for(int i=1;i<=n;i++)
		ra(1,i);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3632
#define _GLIBCXX_DEBUG//実行時、何も出なかったらこれを使う
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<numeric>
#include<climits>
#include<limits>//
#include <stdio.h>//
#include<cmath>
#include<iomanip>

using namespace std;

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

typedef long long ll;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

int dy[] = {1,0,-1,0}; //次に行くところ
int dx[] = {0,1,0,-1}; //s上に同じ

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s;
  cin >> s;
  int n = s.size();
  if (s[n-1] == 's'){
    s.push_back('e');
    s.push_back('s');
  }else
  {
    s.push_back('s');
  }
  
  cout << s << '\n';
  

  return 0;
}

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

using namespace std;

int main(int argc, char* argv[]) {
  string s;
  cin >> s;
  int A, B, C, D;

  A = s[0] - '0';
  B = s[1] - '0';
  C = s[2] - '0';
  D = s[3] - '0';

  int i;
  for (i = 0; i < 16; ++i) {
    int ret = A;
    if (i & 1)
      ret += B;
    else
      ret -= B;
    if ((i >> 1) & 1)
      ret += C;
    else
      ret -= C;
    if ((i >> 2) & 1)
      ret += D;
    else
      ret -= D;
    if (ret == 7)
      break;
  }

  cout << A;
  if (i & 1)
    cout << "+";
  else
    cout << "-";
  cout << B;
  if ((i >> 1) & 1)
    cout << "+";
  else
    cout << "-";
  cout << C;
  if ((i >> 2) & 1)
    cout << "+";
  else
    cout << "-";
  cout << D;

  cout << "=7" << endl;

  return 0;

}

Measured memory_bytes: 256