akhauriyash/Code-Regression huggingface dataset:
#ceilevenoddformula
import math
import bisect
import copy
import time
from collections import Counter
from itertools import combinations
#map(int,input().split())
#int(x) for x in input().split()
def gcd(a, b) : 
    if (a == 0) : 
        return b 
      
    if (b == 0) : 
        return a   
    k = 0
      
    while(((a | b) & 1) == 0) : 
        a = a >> 1
        b = b >> 1
        k = k + 1
          
 
    while ((a & 1) == 0) : 
        a = a >> 1
  
    # From here on, 'a' is always odd.  
    while(b != 0) : 
          
        # If b is even, remove all  
        # factor of 2 in b  
        while ((b & 1) == 0) : 
            b = b >> 1
  
        # Now a and b are both odd. Swap if 
        # necessary so a <= b, then set  
        # b = b - a (which is even). 
        if (a > b) : 
          
            # Swap u and v. 
            temp = a 
            a = b 
            b = temp 
  
        b = (b - a) 
      
    # restore common factors of 2  
    return (a << k) 


def primeFactors(n,l): 
    q=set()    
    f=0
    while n % 2 == 0: 
    	if l[2] and f==0:
    		return False
    	l[2]=True
    	n = n / 2     
    	f=1 

    for i in range(3,int(math.sqrt(n))+1,2): 
        f=0
        while n % i== 0:
        	if l[i] and f==0:
        		return False
        	l[i]=True
        	n = n / i 
        	f=1
              
    if n > 2: 
    	if l[n]:
    		return False
    	l[n]=True

    #l=l.union(q)
    return True

n=int(input())
l=[int(x) for x in input().split()]
#l.sort()
d={i:False for i in range(1,max(l)+1)}
ans=1
for i in range(n):
	f=primeFactors(l[i],d)
	if not f:
		ans=0
		break



if ans:
	print('pairwise coprime')
else:
	a=l[0]
	b=l[1]
	gc=gcd(a,b)
	for i in range(2,n):
		gc=gcd(gc,l[i])
		if gc==1:
			break
	if gc==1:
		print('setwise coprime')
	else:
		print('not coprime')











































Measured memory_bytes: 277304
puts (['0 0 0']+$<.to_a[1..-1]).map{|x|
  x.split.map(&:to_i)
}.each_cons(2).all?{|((t1,x1,y1),(t2,x2,y2))|
  (x2-x1).abs + (y2-y1).abs <= t2-t1 && ((x2-x1).abs+(y2-y1).abs) % 2 == (t2-t1) % 2
} ? 'Yes' : 'No'


Measured memory_bytes: 17404
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for(int i = a;i < b; i++)
#define all(a) a.begin(), a.end()
typedef pair<int,int> P;

template< class T >
struct CumulativeSum2D {
  vector< vector< T > > data;

  CumulativeSum2D(int W, int H) : data(W + 1, vector< int >(H + 1, 0)) {}

  void add(int x, int y, T z) {
    ++x, ++y;
    if(x >= data.size() || y >= data[0].size()) return;
    data[x][y] += z;
  }

  void build() {
    for(int i = 1; i < data.size(); i++) {
      for(int j = 1; j < data[i].size(); j++) {
        data[i][j] += data[i][j - 1] + data[i - 1][j] - data[i - 1][j - 1];
      }
    }
  }

  T query(int sx, int sy, int gx, int gy) {
    return (data[gx][gy] - data[sx][gy] - data[gx][sy] + data[sx][sy]);
  }
};

int main(){
    int N, K; cin >> N >> K;
    CumulativeSum2D<int> S0(4 * K, 4 * K), S1(4*K, 4*K);
    rep(i, 0, N){
        int x, y; cin >> x >> y;
        char c; cin >> c;
        x%=2 * K; y%=2*K;
        if(c == 'B') S0.add(x,y,1), S0.add(x + 2 * K, y, 1), S0.add(x, y + 2 * K, 1), S0.add(x + 2 * K, y + 2 * K, 1);
        else S1.add(x,y,1), S1.add(x + 2 * K, y, 1), S1.add(x, y + 2 * K, 1), S1.add(x + 2 * K, y + 2 * K, 1);
    }
    S0.build();
    S1.build();
    int ans = 0;

    rep(i, 0, 2 * K) rep(j, 0, 2 * K){
        ans = max(ans , S0.query(i, j, i + K, j + K) + S0.query(i + K, j + K, i + 2 * K, j + 2 * K) 
        + S1.query(i + K, j, i + 2 * K, j + K) + S1.query(i, j + K, i + K, j + 2 * K ) );
    }
    cout << ans << endl;

}

Measured memory_bytes: 125568
def main():
    n = int(input())
    s = []
    for i in range(n):
        s.append(input())

    res = {'AC':0, 'WA':0, 'TLE':0, 'RE':0}
    for i in s:
        res[i] += 1

    c0 = res['AC']
    c1 = res['WA']
    c2 = res['TLE']
    c3 = res['RE']

    print('AC x {}'.format(c0))
    print('WA x {}'.format(c1))
    print('TLE x {}'.format(c2))
    print('RE x {}'.format(c3))
    

if __name__ == '__main__':
    main()

Measured memory_bytes: 79168
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;

int main()
{
  i64 n, k;
  cin >> n >> k;
  vector<i64> h(n);
  for (i64 i = 0; i < n; i++)
    cin >> h[i];
  sort(h.begin(), h.end(), greater<i64>());
  i64 ans = 0;
  for (i64 i = k; i < n; i++)
    ans += h[i];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
ans = ['A','B','C','D','E','F','G']
def get(x):
    for i in range(8):
        for j in range(8):
            if i < 7 and j < 7:
                if x[i][j]=='1' and x[i+1][j]=='1' and x[i][j+1]=='1' and x[i+1][j+1]=='1':
                    return 0
            if i<5:
                if x[i][j]=='1' and x[i+1][j]=='1' and x[i+2][j]=='1' and x[i+3][j]=='1':
                    return 1
            if j<5:
                if x[i][j]=='1' and x[i][j+1]=='1' and x[i][j+2]=='1' and x[i][j+3]=='1':
                    return 2
            if i<6 and 0<j:
                if x[i][j]=='1' and x[i+1][j]=='1' and x[i+1][j-1]=='1' and x[i+2][j-1]=='1':
                    return 3
            if i<7 and j<6:
                if x[i][j]=='1' and x[i][j+1]=='1' and x[i+1][j+1]=='1' and x[i+1][j+2]=='1':
                    return 4
            if i<6 and j<7:
                if x[i][j]=='1' and x[i+1][j]=='1' and x[i+1][j+1]=='1' and x[i+2][j+1]=='1':
                    return 5
            if i<7 and 0<j<7:
                if x[i][j]=='1' and x[i][j+1]=='1' and x[i+1][j]=='1' and x[i+1][j-1]=='1':
                    return 6
while 1:
    try:
        l = []
        for i in range(8):
            l.append(raw_input())
        print ans[get(l)]
        raw_input()
    except: break

Measured memory_bytes: 6400
n = int(input())
s = "SHCD"
used = [[0] * 13 for i in range(4)]
for i in range(n):
  a, b = input().split()
  used[s.find(a)][int(b) - 1] = 1
for i in range(4):
  for j in range(13):
    if used[i][j] == 0:
      print(s[i], j + 1)



Measured memory_bytes: 5600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double pi = 3.1415926;
const int N = 1000000 + 5;
int a[N];

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

Measured memory_bytes: 3628
#include <iostream>

using namespace std;

int main()
{
int n,t,a,b,c=0;
cin>>n>>t;
int tab[n];
for(int i=0;i<n;i++){
    cin>>tab[i];
}
for(int i=0;i<n-1;i++){
   if(tab[i+1]-tab[i]>=t) c+=t;
   else c+=tab[i+1]-tab[i];
}
cout<<c+t;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M;
  vector<int>s(M);
  vector<int>c(M);
  cin >> N >>M;
  for(int i=0; i<M;i++){
  cin >>s.at(i) >>c.at(i);
  }
  int error =0; //error=１なら数字が書けないとしよう

  for(int i=0; i<M;i++){
    if(s.at(i)==1&&c.at(i)==0 && N!=1){error=1;}
  		for(int j=0; j<i;j++){
    		if(s.at(i)==s.at(j) &&c.at(i)!=c.at(j)){error=1;}   	
    	}
  }
   vector<int>ans(5);
  if(N!=1){ans.at(0)=1;}
  
    if(error==0){
      for(int i=0; i<M;i++){
        ans.at(s.at(i)-1)=c.at(i);
        
      }
    
 	  for(int i=0; i<N;i++){
       cout <<ans.at(i); 
      }
    }
  	else{cout <<-1;}
  cout << endl;
}

 


Measured memory_bytes: 512
#include <stdio.h>
#include <math.h>
int main(){
	int n,m,i,k,max=0,index;
	scanf("%d%d",&n,&m);
	int data[n],shinsa[m],result[n];
	for(i = 0;i < n;i++){
		scanf("%d",&data[i]);
		result[i]=0;
	}
	for(i = 0;i < m;i++){
		scanf("%d",&shinsa[i]);
	}
	for(i = 0;i < m;i++){
		for(k = 0;k < n;k++){
			if(data[k] <= shinsa[i]){
				result[k]++;
				//printf("%d",result[k]);
				break;
			}
		}
	}
	for(i = 0;i < n;i++){
		if(max < result[i]){
			max = result[i];
			index = i;
		}
	}
	printf("%d\n",index+1);
	return 0;
}

Measured memory_bytes: 604
#include <iostream>

using namespace std;

int main(void) {
	int N;
	scanf("%d",&N);
	int H,prev = 0;
	bool enable = true;
	for (int i = 0; enable && i < N; ++i) {
		scanf("%d",&H);
		if (prev > H) {
			enable = false;
		}
		else if (prev < H) {
			prev = H-1;
		}
	}
	if (enable) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
 
  int x;
  int y; 
  scanf("%d%d",&x,&y);
  int a=x,b=0,k;

  
  while(1){
    k=((a*2)+(b*4));
    if(k==y){
      printf("Yes");
      return 0;
    }
    a--;
    b++;
    k=0;
    if(a<0){
      break;
    }}
    printf("No");
 
  return 0;
}

Measured memory_bytes: 1732
#line 2 "../../library/template.hpp"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pl = pair<ll, ll>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0; i < (ll)n; i++)
#define rep3(i, l, r) for(ll i = l; i < (ll)r; i++)
#define per(i, n) for(ll i = (ll)n-1; i >= 0; i--)
#define per3(i, l, r) for(ll i = (ll)r-1; i >= (ll)l; i--)
#define all(v) begin(v), end(v)
template<class T, class U> inline void cmax(T &a, U b) { if (a < b) a = b; }
template<class T, class U> inline void cmin(T &a, U b) { if (a > b) a = b; }
constexpr char el = '\n';
template<class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<class T, class U> istream &operator>>(istream &is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<class T> ostream &operator<<(ostream &os, const vector<T> &v) { rep(i, v.size()) os << v[i] << (i+1 != v.size() ? " " : ""); return os; }
template<class T> istream &operator>>(istream &is, vector<T> &v) { for(T &i : v) is >> i; return is; }
struct IoSetup {
  IoSetup() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(15); }
} io_setup;
#line 2 "d.cpp"

// https://ei1333.github.io/luzhiled/snippets/math/divisor.html
vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  return (ret);
}
 
int main() {
  ll n;
  cin >> n;
  vl a(n);
  cin >> a;

  vl cnt(1e6+1);
  for (auto&& i : a) {
    cnt[i]++;
  }
 
  ll ans = n;
  for (auto&& i : a) {
    auto v = divisor(i);
    for (auto&& j : v) {
      if (cnt[j] >= 2 or (cnt[j] == 1 and i != j)) {
        ans--;
        break;
      }
    }
  }
  cout << ans << el;
}


Measured memory_bytes: 12680
N = int(input())
n = list(str(N))
sumN = sum(map(int,n))
lenN = len(n)
lengN = 10 ** (lenN - 1)

if sumN == 1:
    print(10)
elif lenN == 1:
    print(n[0])
else:
    A = N // lengN
    B = sum(map(int,list(str(N % lengN))))
    print(A + B)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

int main(){
	ll n;
    cin >> n;
    vll a(5);
    REP(i, 5) cin >> a[i];
    VSORT(a);
    ll ans = 5 + (n - 1) / a[0];
    cout << ans << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    map<int, int> mp;
    vector<int> a(n), b(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        b[i] = a[i];
    }
    sort(b.begin(), b.end());
    for (int i = 0; i < n; ++i) {
        mp[b[i]] = i % 2;
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        if (mp[a[i]] != i % 2) {
            ++ans;
        }
    }
    cout << ans / 2;
    return 0;
}

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

public class Main {
    static final Scanner sc  = new Scanner(System.in);
    static final int     MOD = (int) 1E9 + 7;

    public static void main(String[] args) {
        int n = nint();
        System.out.println(n * n);
    }
    private static int nint() {
        return sc.nextInt();
    }

    private static int[] nints(int n) {
        return nints(n, 0, 0);
    }

    private static int[] nints(int n, int padL, int padR) {
        int[] a = new int[padL + n + padR];
        for (int i = 0; i < n; i++)
            a[padL + i] = nint();
        return a;
    }

    private static long nlong() {
        return sc.nextLong();
    }

    private static long[] nlongs(int n) {
        return nlongs(n, 0, 0);
    }

    private static long[] nlongs(int n, int padL, int padR) {
        long[] a = new long[padL + n + padR];
        for (int i = 0; i < n; i++)
            a[padL + i] = nlong();
        return a;
    }

    private static double ndouble() {
        return sc.nextDouble();
    }

    private static double[] ndoubles(int n) {
        return ndoubles(n, 0, 0);
    }

    private static double[] ndoubles(int n, int padL, int padR) {
        double[] d = new double[n + padL + padR];
        for (int i = 0; i < n; i++) {
            d[padL + i] = ndouble();
        }
        return d;
    }

    private static String nstr() {
        return sc.next();
    }

    private static char[] nchars() {
        return sc.next().toCharArray();
    }

    private static char[] nchars(int padL, int padR) {
        char[] temp = sc.next().toCharArray();
        char[] ret = new char[temp.length + padL + padR];
        System.arraycopy(temp, 0, ret, padL, temp.length);
        return ret;
    }

    private static char[][] nchars2(int h, int w) {
        return nchars2(h, w, 0, 0);
    }

    private static char[][] nchars2(int h, int w, int padLU, int padRD) {
        char[][] a2 = new char[h + padLU + padRD][w + padLU + padRD];
        for (int i = 0; i < h; i++)
            System.arraycopy(nchars(), 0, a2[padLU + i], padLU, w);
        return a2;
    }

    private static long min(long... ls) {
        return Arrays.stream(ls).min().getAsLong();
    }

    private static int min(int... is) {
        return Arrays.stream(is).min().getAsInt();
    }

    private static long max(long... ls) {
        return Arrays.stream(ls).max().getAsLong();
    }

    private static int max(int... is) {
        return Arrays.stream(is).max().getAsInt();
    }

    private static long abs(long a, long b) {
        return Math.abs(a - b);
    }
}


Measured memory_bytes: 23892
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var a = cin.ArrayInt(5);
            var k = cin.nextInt();
            
            if(Math.Abs(a[0] - a[4]) > k)
            {
                Console.WriteLine(":(");
                return;
            }
            

            Console.WriteLine("Yay!");
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N+ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }   

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


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

using namespace std;
typedef long long int ll;

int N;
ll a[200005];

int main() {

  cin >> N;
  ll sum=0;
  for( int i=0;i<N;i++){
    cin>>a[i];
    sum+=a[i];
  }

  ll sum2 = a[0];
  ll m = (ll)abs(sum-sum2*2);  
  for( int i=1;i<N-1;i++){
    sum2+=a[i];
    m = min(m,(ll)abs(sum-sum2*2));

  }
  cout<<m<<endl;;
        
    

  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(ll i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    int n;
    cin >> n;
    int a = n/100, b = n%100;
    bool YM = false, MY = false;
    if(1 <= b && b <= 12)YM = true;
    if(1 <= a && a <= 12)MY = true;
    if(YM && MY)cout << "AMBIGUOUS";
    else if(YM) cout << "YYMM";
    else if(MY) cout << "MMYY";
    else cout << "NA";
}
    

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

Measured memory_bytes: 600
/*
*/

#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>

#include <memory.h>
#include <assert.h>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds
#define ends asdgahhfdsfshdshfd

#define eps 1e-11
#define M_PI 3.141592653589793
#define BS 12345678891
#define bsize 256

#define ldouble long double

using namespace std;

long long INF = 1e9;
const int N = 500031;

int n,val,cnt;

int main(){
	//freopen("tree.in","r",stdin);
	//freopen("tree.out","w",stdout);
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
	//cin.tie(0);

	cin>>n;
	for (int i=0;i<n;i++)
	{
		cin>>val;
		if (val%2)
			cnt++;
	}
	if (cnt%2)
		cout<<"NO"<<endl;
	else
		cout<<"YES"<<endl;

	cin.get(); cin.get();
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define elif else if
#define INF 1000000007
using namespace std;
int a,b=0,aa[110000],c=INF,cnt=0;
double d;
string s,ss;
signed main()
{
	cin>>a;
	rep(i,a){
		cin>>aa[i];
		b+=aa[i];
	}
	rep(i,a){
		cnt+=aa[i];
		c=min(c,abs((b-cnt)-cnt));
	}
	cout<<c;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();
			if (n == 0)
				break;
			int m = sc.nextInt();
			char[] s = sc.next().toCharArray();
			if (m < 3) {
				System.out.println(0);
				continue;
			}
			int ans = 0;
			int c = 0;
			for (int i = 2; i < m; i++) {
				if (s[i] == 'I' && s[i - 1] == 'O' && s[i - 2] == 'I') {
					c++;
				} else if (s[i] == 'O' && s[i - 1] == 'I' && s[i - 2] == 'O') {
					;
				} else {
					ans += Math.max(0, c - n + 1);
					c = 0;
				}
			}
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 18000
import math
N = int(input())
downer = math.ceil(N/1.08)
upper = math.floor((N+1)/1.08-0.0000000001)
A = [i for i in range(downer,upper+1)]
for i in range(len(A)):
    if math.floor(A[i]*1.08) == N:
      print(A[i])
      exit()
print(':(')

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

int main() {
    string A; cin >> A;

    map<char, int> has;

    for(auto c : A)
        has[c] = 1;
    
    bool ok = true;

    if(has['N'] && !has['S'])
        ok = false;
    if(has['S'] && !has['N'])
        ok = false;
    if(has['E'] && !has['W'])
        ok = false;
    if(has['W'] && !has['E'])
        ok = false;

    if(ok) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(unused_macros)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_variables)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::cmp::{max, min, Ordering};

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// N M
// input! {
//     N: i32,
//     M: i32,
// }

// N
// a1, ..., aN
// input! {
//     N: i32,
//     A: [i32, N],
// }

// H W
// a11 ... a1W
// ...
// aH1 ... aHW
// input! {
//     H: i32,
//     W: i32,
//     A: [[i32, W], H],
// }

// S
// input! {
//     S: chars,
// }

const MOD: u64 = 1000000007;

fn main() {
    input! {
        A: usize,
        B: usize,
        C: usize,
    };

    if A == B && B == C {
        println!("Yes");
    } else {
        println!("No");
    }

}


Measured memory_bytes: 4352
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt(),A=sc.nextInt(),B=sc.nextInt();
		if(Math.abs(n-A)<Math.abs(n-B))
			System.out.print('A');
		else if(Math.abs(n-A)>Math.abs(n-B))
			System.out.print('B');
	}
}


Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <iomanip>
#include <stack>
#include <sstream>
using namespace std;
int main(){
  int nlist[10],n,a;
  stack<int> b,c;
  bool f;
  cin>>n;
  for(;n;n--){
    f=true,b.push(0),c.push(0);
    for(int i=0;i<10;i++)
      cin>>nlist[i];
    for(int j=0;j<10;j++){
      a=nlist[j];
      if(!b.top())b.push(a);
      else{
	if(b.top()>a){
	  if(c.top()>a){f=false;break;}
	  else{c.push(a);}
	}
	else{b.push(a);}
      }
    }
    (f)?cout<<"YES"<<endl:cout<<"NO"<<endl;
    while(1){
      if(!b.empty())b.pop();
      if(!c.empty())c.pop();
      if(b.empty()&&c.empty())break;
    }
  }
  return 0;
}

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

//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;

#define ll long long int
#define ld long double
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define pi 3.14159265358979
#define pa pair<ll,ll>
//#define goodset tree<pa, null_type, less<pa>, rb_tree_tag, tree_order_statistics_node_update>
//#define FRE freopen("acm.in","r",stdin); freopen("acm.out","w",stdout);

const ll mod = 1e9+7 ;
const ll N = 1e3+7;
char maz[N][N];
ll vis[N][N],dis[N][N];

int main()
{
    FAST
    ll tc,i,j,k;
    //cin>>tc;
    tc=1;
    while(tc--)
    {
       ll n,m;
       cin>>n>>m;
       ll str,stc;
       cin>>str>>stc;
       ll enr,enc;
       cin>>enr>>enc;
       enr--;
       enc--;
       for(i=0; i<n; i++)
       {
           for(j=0; j<m; j++)
            cin>>maz[i][j];

       }
       str--;
       stc--;
       deque< pair<ll,ll> >q;
       q.push_back({str,stc});
       vis[str][stc]=1;
       //memset(dis,-1,sizeof(dis));
       for(i=0; i<N; i++)
        for(j=0; j<N; j++)
        dis[i][j]=1e16;
        dis[str][stc]=0;
       while(!q.empty())
       {
          pair<ll,ll> pa1=q.front();
          q.pop_front();
          ll r=pa1.first;
          ll c=pa1.second;
          //cout<<r<<" "<<c<<"\n";
          if(r+1<n)
          {
              if(maz[r+1][c]=='.' && dis[r+1][c]>dis[r][c])
              {
                  dis[r+1][c]=dis[r][c];
                  q.push_front({r+1,c});
              }
          }
          if(r>0)
          {
              if(maz[r-1][c]=='.' && dis[r-1][c]>dis[r][c])
              {
                  dis[r-1][c]=dis[r][c];
                  q.push_front({r-1,c});
              }
          }

          if(c+1<m)
          {
              if(maz[r][c+1]=='.' && dis[r][c+1]>dis[r][c])
              {
                  dis[r][c+1]=dis[r][c];
                  q.push_front({r,c+1});
              }
          }
          if(c>0)
          {
              if(maz[r][c-1]=='.' && dis[r][c-1]>dis[r][c])
              {
                  dis[r][c-1]=dis[r][c];
                  q.push_front({r,c-1});
              }
          }

          for(i=-2; i<=2; i++)
          {
              for(j=-2; j<=2; j++)
              {
                  if(r+i>=0 && r+i<n && c+j<m && c+j>=0)
                  {
                      if(dis[r+i][c+j]>dis[r][c]+1 && maz[r+i][c+j]=='.')
                      {
                          dis[r+i][c+j]=dis[r][c]+1;
                          q.push_back({r+i,c+j});
                      }
                  }

              }
          }

       }
       if(dis[enr][enc]==1e16)
        dis[enr][enc]=-1;
       cout<<dis[enr][enc];

    }
    return 0;
}





Measured memory_bytes: 12736
#include <stdio.h>

typedef struct{
  char c;
  int number;
}Card;

int main(){
  char dm;
  int n,i,j,min,flag;
  Card a[36],b[36],x;
  scanf("%d\n",&n);
  for(i=0;i<n;i++){
    scanf("%c%d%c",&a[i].c,&a[i].number,&dm);
    b[i]=a[i];
  }

  for(i=0;i<n;i++){
    flag=0;
    for(j=n-1;j>i;j--){
      if(a[j].number<a[j-1].number){
        x=a[j];
        a[j]=a[j-1];
        a[j-1]=x;
        flag=1;
      }
    }
    if(flag==0)break;
  }

  for(i=0;i<n;i++){
    min=i;
    for(j=i;j<n;j++){
      if(b[j].number<b[min].number){min=j;}
    }

    if(min!=i){
      x=b[i];
      b[i]=b[min];
      b[min]=x;
    }
  }

  for(i=0;i<n-1;i++) printf("%c%d ",a[i].c,a[i].number);
  printf("%c%d\n",a[n-1].c,a[n-1].number);
  printf("Stable\n");
  for(i=0;i<n-1;i++) {printf("%c%d ",b[i].c,b[i].number);
    if(a[i].c!=b[i].c)flag=2;
  }
  printf("%c%d\n",b[n-1].c,b[n-1].number);
  if(flag==2)printf("Not stable\n");
  else printf("Stable\n");

  return 0;
}


Measured memory_bytes: 2056
#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
#define vsort(vec) sort(vec.begin(), vec.end())
#define vreverse(vec) reverse(vec.begin(), vec.end())
using ll =long long;
const ll INF =1001001001;

//最大公約数
ll gcd(ll a, ll b){
   if (a%b==0){
       return(b);
   }else{
       return(gcd(b,a%b));
   }
}
//最小公倍数
ll lcm(ll a, ll b){
   return a*b/gcd(a,b);
}

//素数判定
ll isprime(ll n){
  bool prime=true;
  for(int i=2;i<n;i++){
    if(n%i==0){
      prime=false; break;
    }
  }
if(prime){cout<<n<<" is prime"<<endl;
         }else{cout<<n<<" is not prime"<<endl;}

}
//階乗　20くらいが限界
ll factorial(ll n){
  ll a=1;ll b=n;
  for(int i=0;i<n;i++){
    a*=b;
    b--;
  }
  return a;
}

//組み合わせ　nCr
ll comb(ll a,ll b){
  ll c;
  c=factorial(a)/(factorial(a-b)*factorial(b));
  return c; 
}




/*10億7。　　　100000007
2*2行列 H*W
vector<vector<int>> vec(H,vector<int>(W));
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
cin>>vec[i][j];
  }
}

文字列→数列
string S;int A=atoi(S.c_str());
数列→文字列
int A;string S=to_string(A);
数字判定　isdigit(a)
pair宣言　pair<int,int> p(5,7);
ソート　sort(vec.begin(),vec.end());
*/

int main(){
cout<<fixed<<setprecision(10);
//cin.tie(0); ios::sync_with_stdio(false);

ll x,t;
  cin>>x>>t;
  if(x>t){
    cout<<x-t<<endl;
  }else{
    cout<<0<<endl;
    
  }
  
        
  
  
  
  
  
}




Measured memory_bytes: 256
n,k = map(int,input().split())
mod = 2*k
imos = [[0]*(mod+1) for i in range(mod+1)]
board = [[0]*mod for _ in range(mod)]
delta = [(0,0),(k,k),(k,-k),(-k,k),(-k,-k)]
m_cnt = 0
for i in range(n):
    x,y,c = input().split()
    x,y = map(int,[x,y])
    d = 1
    if c == 'W':
        x -= k
    x,y = x%mod,y%mod
    if (x//k) ^ (y//k):
        x = (x+k)%mod
        d *= -1
        m_cnt += 1
    if x < k or y < k:
        x += k
        y += k
    imos[x+1][y+1] += d
    imos[x-k+1][y-k+1] += d
    imos[x+1][y-k+1] -= d
    imos[x-k+1][y+1] -= d



for i in range(1,mod):
    for j in range(mod):
        imos[i][j] += imos[i-1][j]
ans = 0
for i in range(mod):
    for j in range(1,mod):
        imos[i][j] += imos[i][j-1]
        for di,dj in delta:
            if 0 <= i+di < mod and 0 <= j+dj < mod:
                board[i+di][j+dj] += imos[i][j]
for i in range(mod):
    for j in range(mod):
        ans = max(ans,board[i][j])
print(ans + m_cnt)


Measured memory_bytes: 118748
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#include <bitset>
#include <complex>
#define ll long long
#define INF 1000000000000000001
#define MOD 1000000007
using namespace std;

int main(){
    int N;
    ll K;
    cin >> N >> K;
    ll A[200000];
    ll sum=0;
    for(int i=0; i<N; i++){
        cin >> A[i];
        sum += A[i]-1;
    }
    
    
    if(sum <=K){
        cout<<1<<endl;
        return 0;
    }
    
    ll ng=1, ok = 100000000000;
    

    while(ng<=ok-2){
        ll pivot = (ng+ok)/2;
        //cout<<pivot<<endl;
        ll t = 0;
        for(int i=0; i<N; i++){
            t+= (A[i]-1)/pivot;
        }
        if(t<=K){
            ok = pivot;
        }else{
            ng = pivot;
        }
    }
    
    cout<<ok<<endl;
    return 0;
}


Measured memory_bytes: 5164
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>


using namespace std;

using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)

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

	vector<int> a(n), b(n);

	rep (i , n) {
		cin >> a[i] >> b[i];
	}

	vector<int> hp(h + 1, 999999999);

	hp[h] = 0;
	
	for (int i = h; i > 0; i--) {
		//cout << "i:" << i << endl;
		if (hp[i] == 999999999) continue;
		//cout << "hp[i]:" << hp[i] << endl;
		
		for (int j = 0; j < n; j++) {
			int next_hp = max(i - a[j], 0);
			int next_mp = hp[i] + b[j];
			//cout << "next_hp:" << next_hp << " next_mp:" << next_mp << endl;
			if (hp[next_hp] > next_mp) {
				hp[next_hp] = next_mp;
			}
		}
	}

	cout << hp[0] << endl;

	return 0;
}

Measured memory_bytes: 888
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

template<class U, class V>
istream& operator >>(istream& in, pair<U, V>& pr) {
    return in >> pr.first >> pr.second;
}

template<class U, class V>
ostream& operator <<(ostream& out, pair<U, V>& p) {
    return out << p.first << " " << p.second;
}

template<class T>
ostream& operator <<(ostream& out, vector<T> vec) {
    for (T& e : vec)
        out << e << " ";
    return out << endl;
}

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int K;
    string S;
    cin >> K >> S;
    if (S.size() <= K) {
        cout << S << endl;
    } else {
        cout << S.substr(0, K) + "..." << endl;
    }
    return 0;
};

Measured memory_bytes: 3656
using System;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();

        for (int d = 0; d <= n; d++)
        {
            int m = d * 108 / 100;
            if (m == n)
            {
                Console.WriteLine(d);
                return;
            }
        }
        Console.WriteLine(":(");
    }

    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = Console.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int inf = 1001001001;
 
template <typename T>
struct UnionFind {
   vector<T> par; 
 
   UnionFind(T N) : par(N) { 
        for(T i = 0; i < N; i++) par[i] = i;
   }
 
   int root(T x) { 
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
   }
 
   void unite(T x, T y) { 
       T rx = root(x); 
       T ry = root(y); 
       if (rx == ry) return; 
       par[rx] = ry; 
   }
 
   bool same(T x, T y) { 
       T rx = root(x);
       T ry = root(y);
       return rx == ry;
   }
};
 
int main(){

    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    ll e=(c-a),f=(d-b);
    ll g=d+e,h=c-f,i=g-f,j=h-e;
    cout << h << " " << g << " " << j << " " << i << endl;

 
}

Measured memory_bytes: 256
package main

import (
	"errors"
	"fmt"
	"math"
)

func main() {
	var N, M int
	fmt.Scanf("%d", &N)
	fmt.Scanf("%d", &M)

	pq := PriorityQueue{}
	var scan MyType
	for i := 0; i < N; i++ {
		fmt.Scanf("%f", &scan)
		pq.Add(scan)
	}

	for i := 0; i < M; i++ {
		pop, _ := pq.Pop()
		pq.Add(pop/2)
	}

	answer := 0
	for e, error := pq.Pop(); error == nil; e, error = pq.Pop() {
		answer += int(math.Trunc(float64(e)))
	}
	fmt.Println(answer)
}


type MyType float64

type PriorityQueue struct {
	s []MyType
}

func (pq *PriorityQueue) Add(e MyType) {
	pq.s = append(pq.s, e)

	ei := len(pq.s) - 1
	pi := ei / 2
	for ei != 0 {
		if pq.s[ei] > pq.s[pi] {
			tmp := pq.s[pi]
			pq.s[pi] = pq.s[ei]
			pq.s[ei] = tmp

			ei /= 2
			pi /= 2
		} else {
			break
		}
	}
	//fmt.Println(pq.s)
}

func (pq *PriorityQueue) Pop() (MyType, error) {
	if len(pq.s) == 0 {
		return 0, errors.New("empty!")
	}

	ret := pq.s[0]
	pq.s[0] = pq.s[len(pq.s)-1]
	pq.s = pq.s[0 : len(pq.s)-1]

	currentDepth := int(math.Log2(float64(len(pq.s))))
	ei := 0
	for int(math.Log2(float64(ei+1))) < currentDepth {
		//fmt.Println("current depth is ", currentDepth, "depth is ", math.Log2(float64(ei+1)), "ei is ", ei)

		var l, r MyType
		if len(pq.s) > ei * 2 {
			l = pq.s[ei*2]
		} else {
			l = 0
		}

		if len(pq.s) > ei * 2 + 1 {
			r = pq.s[ei*2+1]
		} else {
			r = 0
		}

		var target MyType
		var targetIndex int
		if l >= r {
			target = l
			targetIndex = ei * 2
		} else {
			target = r
			targetIndex = ei*2 + 1
		}

		if target > pq.s[ei] {
			tmp := pq.s[ei]
			pq.s[ei] = target
			pq.s[targetIndex] = tmp
			ei = targetIndex
		} else {
			break
		}
	}
	return ret, nil
}

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

using namespace std;

int a[10];

void print(int n)
{
    for(int i=0;i<n;i++)
        printf("%d%c",a[i],i==n-1?'\n':' ');
}

int main()
{
    int n;

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

    if(prev_permutation(a,a+n)) print(n);
    next_permutation(a,a+n);
    print(n);
    if(next_permutation(a,a+n)) print(n);

    return 0;
}



Measured memory_bytes: 3232
#define errOut(s) \
  { std::cerr << __LINE__ << ":" << #s << ":" << (s) << std::endl; }

#include <bits/stdc++.h>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Weverything"
//#include <boost/multi_array.hpp>
//#include <boost/optional.hpp>
//#include <boost/range/adaptors.hpp>
//#include <boost/range/algorithm.hpp>
//#include <boost/range/irange.hpp>
#pragma clang diagnostic pop

using namespace std;

int64_t solve(int64_t h, int64_t w) {
  if (h == 1) {
    return 1;
  }
  if (w == 1) {
    return 1;
  }
  return (w * h + 1) / 2;
}

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  int64_t h;
  std::cin >> h;
  int64_t w;
  std::cin >> w;
  auto const res = solve(h, w);
  std::cout << res << std::endl;
  return 0;
}


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

int main()
{
    int a=0,b=0,c=0,d=0,n;
    string s;
    cin>>n;
    if(1<=n<=100000)
        for(int i=0;i<n;i++)
        {
            cin>>s;

            if(s=="AC")
               a++;
            else
            if(s=="WA")
               b++;
            else
            if(s=="TLE")
               c++;
            else
            if(s=="RE")
               d++;
        }

        cout<<"AC x "<<a<<endl;
        cout<<"WA x "<<b<<endl;
        cout<<"TLE x "<<c<<endl;
        cout<<"RE x "<<d<<endl;








    return 0;
}



Measured memory_bytes: 3608
N = int(input())
A = [int(i) for i in input().split()]
sumA = 0
R = [0]*N
for i in range(0,N,2):
  sumA += A[i]
for i in range(1,N,2):
  sumA -= A[i]
R[0] = sumA
for i in range(1,N):
  R[i] = 2*A[i-1]-R[i-1]
print(" ".join(map(str,R)))

Measured memory_bytes: 19220
#include <bits/stdc++.h>
using namespace std;
using LL = long long; using PII = pair<LL, LL>; using VI = vector<LL>; using VVI = vector<VI>;
using VB = vector<bool>; using VS = vector<string>; using VP = vector<PII>;
#define VV(T)        vector<vector<T>>
#define PB           push_back
#define MP           make_pair
#define SZ(a)        LL((a).size())
#define EACH(x, c)   for (auto x : (c))
#define ALL(c)       (c).begin(), (c).end()
#define REVERSE(c)   reverse(ALL(c))
#define SORT(c)      stable_sort(ALL(c))
#define RSORT(c)     stable_sort((c).rbegin(), (c).rend())
#define FOR(i, a, b) for (LL i = (a); i < (b); ++i)
#define REP(i, n)    FOR(i, 0, n)
#define $(x)         {cout << #x << " = " << (x) << endl;}

inline LL lcm(LL a, LL b) {
	return a * b / __gcd(a, b);
}

inline LL minMult(LL x, LL n) { return n * (x / n + (x % n == 0 ? 0 : 1)); }

int main() {
    LL A, B, C, D;
    cin >> A >> B >> C >> D;

    LL n_c = 0, n_d = 0, n_cd = 0;

    LL lc = minMult(A, C), uc = minMult(B, C);
    LL ld = minMult(A, D), ud = minMult(B, D);
    LL lcd = minMult(A, lcm(C, D)), ucd = minMult(B, lcm(C, D));

    /*$(lc);
    $(uc);
    $(ld);
    $(ud);
    $(lcd);
    $(ucd);*/

    //$((uc - lc) / C);
    n_c = (uc - lc) / C;
    if (B % C == 0) n_c++;
    n_d = (ud - ld) / D;
    if (B % D == 0) n_d++;
    n_cd = (ucd - lcd) / lcm(C, D);
    if (B % lcm(C, D) == 0) n_cd++;

    /*$(n_c);
    $(n_d);
    $(n_cd);*/

    cout << B - A + 1 - (n_c + n_d - n_cd) << endl;
	
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(s: str):
    N = len(s)

    if N == 2:
        if s[0] == s[1]:
            print(1,2)
        else:
            print(-1,-1)
        return 

    for i in range(N-2):
        ss = s[i:i+3]
        if ss[0] == ss[1] or ss[1]==ss[2] or ss[2] == ss[0]:
            print(i+1,i+3)
            return
        
    print(-1,-1)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    solve(s)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
import sys
from math import factorial

def comb(a, b):
  return factorial(a) / (factorial(b) * factorial(a-b))


def f(A, a):
  if len(A) == 1:
    return A[0]
  
  if len(A) == 2:
    b1, b2 = A[0], A[1]
    if min(b1, a-b1) >= min(b2, a-b2):
      return b1
    else:
      return b2
  
  m = len(A) // 2
  b1, b2, b3 = A[m-1], A[m], A[m+1]
  c1, c2, c3 = min(b1, a-b1), min(b2, a-b2), min(b3, a-b3)
  c = max(c1, c2, c3)  
  
  if c2 == c:
    return b2
  elif c1 == c:
    return f(A[:m], a)
  else:
    return f(A[m+1:], a)


def main():
  input = sys.stdin.readline
  N = int(input())
  A = list(map(int, input().split()))
  A = sorted(A)
  ai = A[-1]
  A = A[:-1]
  aj = f(A, ai)
  print(ai, aj)


if __name__ == '__main__':
  main()

Measured memory_bytes: 14264
//A - Payment
//Hiia
#include <stdio.h>
#include <stdlib.h>//rannsuu, zettaichi(absolute)
#include <time.h>
//srand((unsigned int) time(0));
#include <math.h>//koudona keisann
#include <string.h>//hairetsu
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
typedef long long ll;
//#define N 998244353
#define pi 3.1415926535897932384626433832

int gcd(int m,int n){if((0==m)||(0==n))return 0;while(m!=n)if(m>n)m=m-n;else n=n-m;return m;}
int lcm(int m,int n){if((0==m)||(0==n))return 0;return(m*n/gcd(m, n));}
int fact(int x){if(x==1) return(x);else return(x*fact(x-1));}//Kaijou x!
int ruijou(int base,int exponent){int i,answer=1;i=exponent;while(i!=0){answer=answer*base;--i;}return answer;}//ruijou base^exponent

long long int llgcd(long long int m,long long int n){if((0==m)||(0==n))return 0;while(m!=n)if(m>n)m=m-n;else n=n-m;return m;}
long long int lllcm(long long int m,long long int n){if((0==m)||(0==n))return 0;return(m*n/llgcd(m, n));}
long long int llfact(long long int x){if(x==1) return(x);else return(x*llfact(x-1));}//Kaijou
int llruijou(long long int base,long long int exponent){long long int i,answer=1;i=exponent;while(i!=0){answer=answer*base;--i;}return answer;}//ruijou base^exponent

int main()
{
  int n,x[10010],i,tmp;
  scanf("%d", &n);
  tmp=(n/1000)*1000-n;

  if(tmp<0){
    printf("%d\n", tmp+1000);
  }
  else{
    printf("%d\n", tmp);
  }
  return 0;
}


Measured memory_bytes: 1732
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

int main(){
    int c[6];
    int m[] = {1,5,10,50,100,500};
    int money[2000];
    memset(money,0,sizeof(money));
    REP(i,6) cin >> c[i];
    money[0] = 1;
    REP(i,6){
	REP(j,c[i]){
	    RREP(k,1000){
		if(money[k] > 0 && k+m[i] <= 1000){
		    money[k+m[i]] = money[k];
		}
	    }
	}
    }
    if(money[1000] > 0) cout << 1 << endl;
    else cout <<0 << endl;
    return 0;
}

Measured memory_bytes: 1168
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<iomanip>


using namespace std;


int main()

{
	string x, y, z;
	cin >> x >> y >> z;
	x.swap(y);
	x.swap(z);
	cout << x << " " << y << " "<< z;
}

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

int cmpnum(const void * n1, const void * n2)
{
	if (*(long *)n1 > *(long *)n2)
	{
		return 1;
	}
	else if (*(long *)n1 < *(long *)n2)
	{
		return -1;
	}
	else
	{
		return 0;
	}
}

int main(void) {

  long n,c,k;
  scanf("%ld %ld %ld", &n, &c, &k);
  long t[n];
  for (long i = 0; i < n; i++) {
    scanf("%ld", &t[i]);
  }
  qsort(t, n, sizeof(long), cmpnum);
  long dead = t[0]+k;
  long people = 1;
  long bus = 1;
  for (long i = 1; i < n; i++) {
    if (t[i] <= dead && people < c) {
      people++;
    } else {
      dead = t[i]+k;
      people = 1;
      bus++;
    }
  }
  printf("%ld\n", bus);

  return 0;
}

Measured memory_bytes: 1788