akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.util.NoSuchElementException;
import java.util.stream.IntStream;

public class Main {

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

	private void solve() throws IOException {
		try {
			//			solveA();
			solveB();
			// solveC();
			// solveD();
			// solveE();
			// solveF();
		} finally {
			if (in != null) {
				in.close();
			}
			if (out != null) {
				out.flush();
				out.close();
			}
		}

	}

	private void solveA() {
		StringBuilder builder = new StringBuilder();
		IntStream.range(0, 3).forEach(i -> builder.append(next().charAt(0)));
		out.println(builder.toString().toUpperCase());
	}

	private void solveB() {
		BigDecimal v1 = new BigDecimal(next());
		BigDecimal v2 = new BigDecimal(next());

		switch (v1.compareTo(v2)) {
		case -1:
			out.println("LESS");
			break;
		case 0:
			out.println("EQUAL");
			break;
		case 1:
			out.println("GREATER");
			break;
		}

	}

	private void solveC() {
		int numN = nextInt();

		out.println("");
	}

	private void solveD() {
		int numN = nextInt();

		out.println("");
	}

	private void solveE() {
		int numN = nextInt();

		out.println("");
	}

	private void solveF() {
		int numN = nextInt();

		out.println("");
	}

	private final PrintWriter out = new PrintWriter(System.out);
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

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

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

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

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

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
}

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

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n)
    {
        cin >> a[i];
        if (a[i] == 0)
        {
            cout << 0 << endl;
            return 0;
        }
    }
    ll ans = a[0];
    const ll INF = 1e18;
    for (int i = 1; i < n; i++)
    {
        if (a[i] > INF / ans)
        {
            cout << -1 << endl;
            return 0;
        }
        else
        {
            ans *= a[i];
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 4048
a, b, c, d = map(int, input().split())

attack_t = c // b
if c % b != 0:
    attack_t += 1

attack_a = a // d
if a % d != 0:
    attack_a += 1

if attack_a >= attack_t:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vpii = vector<pair<int,int>>;
using vpll = vector<pair<ll,ll>>;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int) n;i++)
#define rep1(i,m,n) for(int i=(int) m;i<(int) n;i++)
#define fix(n) cout << fixed << setprecision((int)n)

void absll(ll &x) {
    if(x>=0) return ;
    else x=-x; return;
}

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 ll INF = 1LL << 60;

int N;

//DPテーブル
vector<ll> dp(100010);

int main() {
    int a,b,sum=0;
    cin >> a >> b;
    rep1(i,1,b-a) sum+=i;
    cout << sum-a << endl; 
}

Measured memory_bytes: 1024
<?php

fscanf(STDIN, '%d %d %d', $A, $B, $K);

// A, Bの約数を全て挙げる
// 共通のものにしぼる
// そのうちK番目のものをとってくる

$aArray = [];
for($i = 1; $i <= $A; $i++){
    if($A % $i === 0){
        $aArray[] = $i;
    }
}

$bArray = [];
for($i = 1; $i <= $B; $i++){
    if($B % $i === 0){
        $bArray[] = $i;
    }
}

$array = array_intersect($aArray, $bArray);
rsort($array);

$ans = $array[$K - 1];

echo $ans.PHP_EOL;

Measured memory_bytes: 4604
import java.io.*;
import java.util.StringTokenizer;

public class Main {
  private static PrintWriter out;

  public static void main(String[] args) {
    Main main = new Main();
    Runtime.getRuntime().addShutdownHook(new Thread(() -> out.close()));
    try {
      main.run(args);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

  private void run(String[] arguments) throws Exception {
    MyScanner sc = new MyScanner();
    out = new PrintWriter(new BufferedOutputStream(System.out));

    long target = sc.nextLong();
    long originalValue = 100;
    int ans = 0;

    while (true){
      ans++;
      originalValue = (long)Math.floor(originalValue*1.01);
      if (originalValue>=target){
        break;
      }
    }
    out.println(ans);
    out.close();
  }

  /*          
   * Form: http://codeforces.com/blog/entry/7018
   */
  private class MyScanner {
    BufferedReader br;
    StringTokenizer st;

    MyScanner() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

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

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

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

    String nextLine() {
      String str = "";
      try {
        str = br.readLine();
      } catch (IOException e) {
        e.printStackTrace();
      }
      return str;
    }
  }
}


Measured memory_bytes: 33760
/**************
*	Shell Sort
*************/

#include <iostream>
#include <vector>	//??£?¨?
#include <algorithm>
using namespace std;

void insertionSort(vector<int>* A, int g, int* cnt  ){

	for(unsigned int i=g ; i<(A->size()); i++){
		int v = (*A)[i];
		int j = i-g;
		while(j>=0 && (*A)[j]>v){
			(*A)[j+g] = (*A)[j];
			j = j-g;
			(*cnt)++;
		}
		(*A)[j+g] =v;
	}
	return ;
}
//---------------------------------------------------------
void shellSort(vector<int>* A, vector<int>* G, int* cnt){

	for(unsigned int i=0; i<(G->size()); i++){
		insertionSort(A, (*G)[i], cnt);
	}

	return;
}
//--<<???????????¢??°>>-------------------------------------------------------
int main(){

	//??\???
	int n;
	cin >> n;
	vector<int> A;
	A.resize(n);
	for(unsigned int i=0; i< A.size(); i++){
		cin >> A[i];
	}

	//??????
	vector<int> G;
	G.reserve(100);//????????????????´???°???????????£??????????????¨????????????
	int sum = 1;
	while(sum <= n){
	    G.push_back(sum);
		sum = sum * 3 + 1;
	}
	reverse(G.begin(), G.end());

	int cnt = 0;
	shellSort(&A, &G, &cnt);

	//??????
	cout << G.size() << endl;
	for(unsigned int i=0; i<(G.size()); i++){
		cout << G[i];
		if(i!=(G.size()-1)){
			 cout <<" " ;
		}
	}
	cout << endl;
	cout << cnt << endl;
	for(int i=0; i< n; i++){
		cout << A[i]<< endl;
	}

	return 0;
}
//-----------------------------------------------

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int x, y;

int main() {
	cin >> x >> y;
	
	cout << x + y / 2 << endl;
	
	return 0;
}


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

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int N;
    string s;
    cin >> N >> s;
    vector < int > pref(N + 2), suf(N + 2);
    for(int i = 0; i < N; ++i) {
        pref[i + 1] = pref[i];
        if(s[i] == 'W')
            ++pref[i + 1];
    }
    for(int i = N - 1; i >= 0; --i) {
        suf[i + 1] = suf[i + 2];
        if(s[i] == 'E')
            ++suf[i + 1];
    }
    int ans = 1e9;
    for(int i = 0; i < N; ++i) {
        int ant = pref[i], after = suf[i + 2];
        ans = min(ans, ant + after);
    }
    cout << ans;
}


Measured memory_bytes: 6100
#include <bits/stdc++.h>
#define ll long long
#define PB push_back
#define MP make_pair

#define REP(i,n) for(i=0;i<(n);++i)
#define FOR(i,l,h) for(i=(l);i<=(h);++i)
#define FORD(i,h,l) for(i=(h);i>=(l);--i)

#define max(a,b) a>b?a:b
#define min(a,b) a>b?b:a
using namespace std;
vector<int>gr[100005];
//vector<vector<int> >gr;
int dp[100005];

int dfs(int s){
    if(dp[s]!=-1)return dp[s];
    int ret = 0;
    for(int i=0;i<gr[s].size();i++){
        ret = max(ret,dfs(gr[s][i])+1);
    }
    return dp[s] = ret;

}
int main(){
    ios_base::sync_with_stdio(false);
  	cin.tie(NULL);
    cout.tie(NULL);
    //memset(dp,-1,sizeof(dp));
    int N,M;
    cin>>N>>M;
    //v.assign(N,-1); // initialise size of v;
    //gr.assign(N,vector<int>());

    for(int i=0;i<M;i++){
        int a,b;
       cin>>a>>b;a--;b--;//a-- && b-- isliye kyuki index start from 0
       gr[a].push_back(b);
    }
    for(int i=0;i<N;i++) dp[i] = -1;

    int ret = 0;
    for(int i=0;i<N;i++){
        ret = max(ret,dfs(i));
    }
    cout<<ret;
    return 0;
}


Measured memory_bytes: 8192
package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
)

var sc = bufio.NewScanner(os.Stdin)

func nextString() string {
	if !sc.Scan() {
		panic("failed scan string")
	}
	return sc.Text()
}

func nextInt() int {
	if !sc.Scan() {
		panic("failed scan int")
	}
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	var sum int
	for i := 0; i < n; i++ {
		sum += nextInt()
	}
	fmt.Println(sum - n)
}


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

int main(void) {
  int N, M, X, sum_l = 0, sum_r = 0;
  cin >> N >> M >> X;
  for (int i = 0; i < M; i++) {
    int a;
    cin >> a;
    if (a < X)
      sum_l++;
    else
      sum_r++;
  }
  cout << min(sum_l, sum_r) << endl;
  return 0;
}

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

int main(void){
  char s[10];
  int l,i=0,cnt=0,p;
  scanf("%s",s);
  
  l = strlen(s);
  
  for(i=2;i<l-1;i++){
    if(s[i]=='C'){
      cnt++;
      p=i;
    }
  }
  
  if((!(cnt==1)) || (s[0]!='A')){
    printf("WA\n");
    return 0;
  }
  
  for(i=1;i<l;i++){
    if(i==p){
    }else{
      if(!('a'<=s[i]) && (s[i]<='z')){
        printf("WA\n");
        return 0;
      }
    }
  }
  
  printf("AC\n");
  
  return 0;
}

Measured memory_bytes: 128
class Queue():
    def __init__(self, n):
        self.queue = [None] * n
        self.head = self.tail = 0
        self.n = n

    def is_empty(self):
        return self.head == self.tail

    def is_full(self):
        return self.head == (self.tail + 1) % self.n

    def enqueue(self, x):
        if self.is_full():
            assert "オーバーフロー"
        self.queue[self.tail] = x
        if self.tail + 1 == self.n:
            self.tail = 0
        else:
            self.tail += 1

    def dequeue(self):
        if self.is_empty():
            assert "アンダーフロー"
        x = self.queue[self.head]
        if self.head + 1 == self.n:
            self.head = 0
        else:
            self.head += 1
        return x


n, q = map(int, input().split())
queue = Queue(n+1)
for _ in range(n):
    data = input().split()
    queue.enqueue((data[0], int(data[1])))
timer = 0
while True:
    process = queue.dequeue()
    if process[1] > q:
        queue.enqueue((process[0], process[1] - q))
        timer += q
    else:
        timer += process[1]
        print(process[0] + " " + str(timer))
    if queue.is_empty():
        break



Measured memory_bytes: 13296
# coding: utf-8

n = int(input())
a = [int(i) for i in input().split()]
junban = True
Alice = Bob = 0

while a:
    if junban:
        Alice += max(a)
        a.remove(max(a))
        junban = False
    else:
        Bob += max(a)
        a.remove(max(a))
        junban = True

print(Alice -Bob)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define ALL(a) (a).begin(),(a).end()
#define EACH(e,v) for(auto& e:v)
#define SORT(v) sort(ALL(v))
#define PERM(v) SORT(v);for(bool c##p=1;c##p;c##p=next_permutation(ALL(v)))
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
template <class T> void chmax(T & a, T const & b) { if (b > a) a = b; }
template <typename T>
string to_string(const T &n){ostringstream stm;stm << n;return stm.str();}
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = 1000'000'007;
 
signed main(){
    string s;
    while(cin>>s){
        if(s[0]=='0')break;
        int ans=0;
        rep(i,s.size()){
            ans+=s[i]-'0';
        }
        cout<<ans<<endl;
    }
 
}


Measured memory_bytes: 3212
import java.util.Scanner;


public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		while(stdIn.hasNext()){
			int result = 0;
			for(int i = Integer.parseInt(stdIn.next());i > 1;i--){
				if(IsPrime(i) == 1) result++;
			}
			System.out.println(result);
		}

	}
	
	static int IsPrime(int n){
	    int i;
	 
	    if(n < 2)
	        return 0;
	    else if(n == 2)
	        return 1;
	 
	    if(n % 2 == 0)
	        return 0;
	 
	    for(i = 3; i * i <= n; i += 2)
	         if(n % i == 0)
	            return 0;
	    return 1;
	}

}

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

using namespace std;

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

  sort(s.begin(), s.end());
  sort(t.begin(), t.end(), greater<char>());

  cout << (s < t ? "Yes" : "No") << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    
    int w,h,x,y,r;
    cin>>w>>h>>x>>y>>r;
    
    if(r<=x && r<=y && x<=w-r && y<=h-r) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
    
}



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

histogram = [0] * (n + 1)
for i in range(2,n+1):
    x = i
    p = 2
    while x > 1:
        while x % p == 0:
            histogram[p] += 1
            x //= p
        p += 1
answer = 1
for a in filter(lambda x:x>0,histogram):
    answer = (answer * (a+1)) % (1e9+7)
print(int(answer))


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


template<Int MOD = 1000000007>
struct Mod{
  Int prev=0;
  vector<Int> fact,inv,finv;
  Mod(){}
  Mod(Int n){init(n);}
  
  Int pow(Int x,Int n){
    Int res=1;
    while(n){
      if(n&1) (res*=x)%=MOD;
      (x*=x)%=MOD;
      n>>=1;
    }
    return res;
  }
  
  Int inverse(Int a){
    return pow(a,MOD-2);
  }
  
  void init(Int n){
    if(prev>=n) return;
    prev=n;
    fact=inv=finv=vector<Int>(n);
    
    fact[0]=1;
    for(Int i=1;i<n;i++)
      fact[i]=(fact[i-1]*i)%MOD;
    
    inv[1]=1;
    for(Int i=2;i<n;i++)
      inv[i]=inv[MOD%i]*(MOD-MOD/i)%MOD;
    
    finv[0]=1;
    for(Int i=1;i<n;i++)
      finv[i]=finv[i-1]*inv[i]%MOD;
  }
  
  Int comb(Int n,Int k){
    Int res=1;
    for(Int i=0;i<k;i++){
      res*=(n-i)%MOD;
      res%=MOD;
      res*=inverse(i+1);
      res%=MOD;
    }
    return res;
  }
  
  //only for prime MOD
  Int C(Int n,Int k){
    if(k<0||k>n) return 0;
    return fact[n]*finv[k]%MOD*finv[n-k]%MOD;
  }
  
  Int P(Int n,Int k){
    if(k<0||k>n) return 0;
    return fact[n]*finv[n-k]%MOD;    
  }

  Int H(Int n,Int k){
    if(n<0||k<0) return 0;
    if(!n&&!k) return 1;
    return C(n+k-1,n);
  }

  Int S(Int n,Int k){
    Int res=0;
    for(Int i=1;i<=k;i++){
      Int tmp=C(k,i)*pow(i,n)%MOD;
      if((k-i)&1) res+=MOD-tmp;
      else res+=tmp;
      res%=MOD;
    }
    res=res*finv[k]%MOD;
    return res;
  }
  
  Int B(Int n,Int k){
    Int res=0;
    for(Int j=1;j<=k;j++){
      res+=S(n,j);
      res%=MOD;
    }
    return res;
  }
  
  vector<vector<Int> > D(Int n,Int m){
    vector<vector<Int> > dp(n+1,vector<Int>(m+1,0));
    dp[0][0]=1;
    for(Int i=0;i<=n;i++){
      for(Int j=1;j<=m;j++){
	if(i-j>=0) dp[i][j]=(dp[i][j-1]+dp[i-j][j])%MOD;
	else dp[i][j]=dp[i][j-1];
      }
    }
    return dp;
  }
  
  Int montmort(Int n){
    Int res=0,rinv=1;
    for(Int k=2;k<=n;k++){
      rinv=rinv*inverse(k)%MOD;
      if(k%2) res+=MOD-rinv;
      else res+=rinv;
      res%=MOD;
    }
    for(Int i=1;i<=n;i++) res=res*i%MOD;
    return res;
  }
  
  // calculate P(t) from given points in [0,N]
  Int LagrangePolynomial(vector<Int> &y,Int t){
    Int n=y.size()-1;
    init(n+1);
    Int num=1;
    for(Int i=0;i<=n;i++)
      num=num*((t-i)%MOD)%MOD;
    Int res=0;
    for(Int i=0;i<=n;i++){
      Int tmp=(y[i]*num%MOD)*inverse((t-i)%MOD)%MOD;
      tmp=tmp*finv[i]%MOD;
      tmp=tmp*finv[n-i]%MOD;
      if((n-i)&1) tmp=MOD-tmp;
      res=(res+tmp)%MOD;
    }
    return res;
  }
};



template<typename T> 
map<T, Int> factorize(T x){
  map<T, Int> res;
  for(Int i=2;i*i<=x;i++){
    while(x%i==0){
      x/=i;
      res[i]++;
    }
  }
  if(x!=1) res[x]++;
  return res;
}

//INSERT ABOVE HERE

signed main(){
  Int n,m;
  cin>>n>>m;
  auto x=factorize(m);
  Int ans=1;

  const Int MOD = 1e9+7;
  Mod<MOD> mod(1e6);
  for(auto p:x){
    Int k=p.second;
    ans*=mod.H(k,n);
    ans%=MOD;
  }
  
  cout<<ans<<endl;
  return 0;
}


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

#define int long long
#define rep(i,a,n) for(int i = a; i < n; i++)
#define pb push_back
#define eb emplace_back
#define dump(x) cout << #x << " = " << (x) << endl
#define chk() cout << "now" << endl;
#define ALL(x) (x).begin(),(x).end()
#define SORT(c) sort((c).begin(), (c).end())
#define SORTG(c) sort((c).begin(), (c).end(), greater<int>());
#define fi first
#define se second
#define INF (1e9)

typedef pair<int,int> P;
typedef vector<int> vi;

int N;
vi A;

signed main() {
    cin>>N;
    rep(i,0,N) {
        int a; cin>>a;
        A.pb(a);
    }


    int div=1;
    int sum=0;
    rep(i,0,N) {
        sum+=div*A[i];
        div=div*(-1);
    }
    cout<<sum<<' ';
    rep(i,0,N-1) {
        cout<<2*A[i]-sum<<' ';
        sum=2*A[i]-sum;
    }
    cout<<endl;
    return 0;
}

        


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

#define FOR(i, j, n) for (int i(j); i < n; ++i)
#define FORR(v, c) for (auto &v : c)
#define F first
#define S second
#define SQ(x) (x)*(x)
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define dbg(x) cerr<<#x<<" = " << (x) << endl
#define pnl(x) cout << x << '\n'
#define pns(x) cout << x << ' '
#define read(x) cin >> x
#define read2(x,y) cin >> x >> y
#define read3(x, y, z) cin >> x >> y >> z
#define read4(a, b, c, d) cin >> a >> b >> c >> d
#define readv(v) FORR(c,v) read(c)

struct Arrete { int v, c;};
struct Point {int x, y; double distance(Point other) const {return sqrt(SQ(x-other.x)+SQ(y-other.y));}};

typedef	vector<int>	vi;
typedef pair<int,int>	ii;
typedef vector<string>	vs;
typedef vector<ii>	vii;
typedef vector<Arrete>	vg;
typedef vector<long long>	vl;
typedef	long long ll;

const int	NB_D = 4;
const int	DY[] = {-1, 1, 0, 0};
const int	DX[] = {0, 0, -1, 1};

map<ll, ll> cnt;

int		main(void)
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	
	ll N;
	read(N);

	ll ans(0);
	ll sum(0);

	FOR(i,0,N)
	{
		ll a; read(a);
		sum += a;
		if (cnt.find(sum) != cnt.end())
			ans += cnt[sum];
		cnt[sum]++;
		if (!sum) ans++;
	}
	pnl(ans);
}



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

int main(){
  int N;
  cin >> N;
  vector<double> A(N);
  double s=0;
  for(int i=0;i<N;i++){
    cin >> A.at(i);
    s = s + 1/A.at(i);
  }
  
  cout << fixed << setprecision(8);
  cout << 1/s << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int dp[100001][13];
int main(){
	string st;
	int i,j,k,d,mul=10;
	cin>>st;
	reverse(st.begin(),st.end());
	if(st[0]=='?'){
		for(j=0;j<10;++j)dp[0][j]=1;
	}
	else{
		dp[0][st[0]-48]=1;
	}
	for(i=1;i<st.size();++i){
		if(st[i]=='?'){
			for(k=0;k<10;++k){
				for(j=0;j<13;++j){
					d=(k*mul+j)%13;
					dp[i][d]=(dp[i][d]+dp[i-1][j])%1000000007;
				}
			}
		}
		else{
			k=st[i]-48;
			for(j=0;j<13;++j){
				d=(k*mul+j)%13;
				dp[i][d]=(dp[i][d]+dp[i-1][j])%1000000007;
			}
		}
		mul=mul*10%13;
		
		/*
		cout<<i<<endl;
		for(int r=0;r<=i;++r){
			for(int c=0;c<13;++c)cout<<setw(4)<<dp[r][c];
			cout<<endl;
		}*/
	}
	cout<<dp[st.size()-1][5]; 
	
	return 0;
}


Measured memory_bytes: 5504
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n+1); i++)
const long long INF = 1LL << 60;
int main(){
  int N,X;
  cin>>N>>X;
	vector<int> x(N);
  int ans=1;
  rep(i,N){
      cin>>x[i];
  }
  sort(x.begin(),x.end());
  rep(i,N){
      if(i==0){
        ans=X-x[0];
      }
      else{
          ans=__gcd(ans,x[i]-x[i-1]);
      }
  }
  if(N==1){
    ans=abs(X-x[0]);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
int GCD(int a,int b){return b?GCD(b,a%b):a;}
int LCM(int a,int b){return (a*b)/GCD(a,b);}
int abs(int x){return x>0?x:-x;}
 
//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main()
{
	int h, w;
	int a, b;
	cin >> h >> w >> a >> b;
	cout << h * w -(a * w + b * h) + a * b << endl;
}


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

// chmin, chmax関数
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

// Yes-Noを出力する問題で楽をする
void Ans(bool f){
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
}

//---------------------------

int main(){
    int n;
    cin >> n;
    if(n>999) cout << "ABD" << endl;
    else cout << "ABC" << endl;
    return 0;
}

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

using namespace std;
using namespace atcoder;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef string str;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef dsu uf;
typedef fenwick_tree<ll> fw;

const ll mod=1e9+7;
const ll inf=1e18;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define pb(x) pop_back(x)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define pc(x) __builtin_popcount(x)
#define gll greater<ll>()

void solve(){
 str s;
  cin >> s;
  auto suf=suffix_array(s);
  auto lcp=lcp_array(s,suf);
  
  ll ans=0;
  ll n=s.size();
  rep(i,0,n){
    ans+=n-i;
    if(i<n-1) ans-=lcp[i];
  }
  cout << ans << endl;
}
int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  solve();
}

Measured memory_bytes: 15588
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)

using namespace std;

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

    ll N;
    cin >> N;
    vector<ll> A(N);
    ll check = 0;
    Rep (i, N) {
        cin >> A[i];
        if (A[i] % 2 == 1) check++;
    }

    if (check % 2 == 0) cout << "YES\n";
    else cout << "NO\n";


}

Measured memory_bytes: 1024
def gcd(a,b)
	gcd(b,a) if b > a
	return b if (r = a%b) == 0
	gcd(b,r)
end
def lcm(a,b)
	a * b / gcd(a,b)
end

while line = gets
	a, b = line.split.map(&:to_i)
	puts "#{gcd(a,b)} #{lcm(a,b)}"
end 

Measured memory_bytes: 8660
#include<iostream>
#include<stack>
#include<queue>
#include<map>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define sc(x) scanf("%d",&x);

ll factorial(int x, int mod){
    if (x == 1) return 1;
    return x * factorial(x - 1, mod) % mod;
}

int main(){
    int mod = 1e9 + 7;
    int n; sc(n)
    cout << factorial(n, mod) << endl;
    return 0;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
#define int long long int 
#define mod 998244353
#define faster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
//#include<bits/stdc++.h>
bool sortbydesc(int a,int b){
	return a>b;
}
bool sortbydesc1(pair<int,int> a,pair<int,int> b){
	return a.first>b.first;
}
struct triple{
	int n1;

	int n2;
	int n3; 
};

class Graph 
{ 
	int V; 
	list<int> *adj; 
public: 
	Graph(int V); 
	void addEdge(int v, int w);
	void DFSUtil(int v, bool *visited,std::vector<int> &v1); 
}; 

Graph::Graph(int V) 
{ 
	this->V = V; 
	adj = new list<int>[V]; 
} 

void Graph::addEdge(int v, int w) 
{ 
	adj[v].push_back(w);}

void Graph::DFSUtil(int v, bool *visited,vector<int>&v1) 
{ 
	
	visited[v] = true;
	v1.push_back(v); 
	// cout << v << " "; 

	
	list<int>::iterator i; 
	for(i = adj[v].begin(); i != adj[v].end(); ++i) 
		if(!visited[*i]) 
			DFSUtil(*i, visited,v1); 
} 
// ll dp(ll n,ll k,ll *h,ll *a){
// 	if(n>=k){
// 		return 0;
// 	}
// 	else if(n==k-1){
// 		return a[k-1];
// 	}
// 	else if(n==k-2||n==k-3){
// 		return a[k-2];
// 	}
// 	else if(h[n]==-1){
// 		//return max(a[n]+)

// 	}
// }
bool  print1(int a[], int n, int ind) 
{ int k=1;
    // print from ind-th index to (n+i)th index. 
    for (int i = ind; i < n + ind; i++) {
    	if(a[i%n]==k){
    		k++;
    	}
    	else{
    		return 0;
    	}
       // cout << a[(i % n)] << " "; 
    }
    return 1;
}
bool  print2(int *a, int n, int ind) 
{ 
	int k=1;
    // print from ind-th index to (n+i)th index. 
    for (int i = ind; i<n+ ind; i++) {
    	if(a[i%n]==k){
    		k++;
    	}

    	else{
    		return 0;
    	}
        //cout << a[(i % n)] << " "; 
    }
    return 1;
}
int divCount(int n) 
{ 
    // sieve method for prime calculation 
    bool hash[n + 1]; 
    memset(hash, true, sizeof(hash)); 
    for (int p = 2; p * p < n; p++) 
        if (hash[p] == true) 
            for (int i = p * 2; i < n; i += p) 
                hash[i] = false; 
  
    // Traversing through all prime numbers 
    int total = 1; 
    for (int p = 2; p <= n; p++) { 
        if (hash[p]) { 
  
            // calculate number of divisor 
            // with formula total div =  
            // (p1+1) * (p2+1) *.....* (pn+1) 
            // where n = (a1^p1)*(a2^p2)....  
            // *(an^pn) ai being prime divisor 
            // for n and pi are their respective  
            // power in factorization 
            int count = 0; 
            if (n % p == 0) { 
                while (n % p == 0) { 
                    n = n / p; 
                    count++; 
                } 
                total = total * (count + 1); 
            } 
        } 
    } 
    return total; 
} 




int32_t main(){
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	int dp[n];
	for(int i=0;i<n;i++){
		dp[i]=0;
	}
	dp[0]=0;
	dp[1]=abs(a[1]-a[0]);
	dp[2]=min(dp[1]+abs(a[2]-a[1]),abs(a[2]-a[0]));
	for(int i=3;i<n;i++){
		dp[i]=min(dp[i-2]+abs(a[i-2]-a[i]),dp[i-1]+abs(a[i-1]-a[i]));
	}
	cout<<dp[n-1]<<endl;

	
	return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[5];
        for (int i=0; i<5; i++) {
            a[i] = sc.nextInt();
            if (a[i] == 0) {
                System.out.println(i+1);
            }
        }

    }
}

Measured memory_bytes: 35660
#include <stdio.h>
#define N 100000
#define NIL -1

struct Node{
  int parent;
  int left;
  int right;
};
struct Node T[25];
int C[25];
int H[25];

void getDepth(int, int);
int getHeight(int);

int main()
{
  int n, i, j, k, x, y, id, left, right, root;


  scanf("%d",&n);
  for( i=0 ; i<n ; i++ ){
    T[i].parent = NIL;
  }
  for( i=0 ; i<n ; i++ ){
    scanf("%d %d %d",&id,&left,&right);
    T[id].left = left;
    T[id].right = right;   
    if(left!=NIL)
      T[left].parent = id;
    if(right!=NIL)
      T[right].parent = id;
  }

  for( i=0 ; i<n ; i++ )
    if(T[i].parent==NIL) root = i;

  getDepth(root,0);
  getHeight(root);

  for( i=0 ; i<n ; i++ ){
    printf("node %d: parent = %d, sibling = ",i,T[i].parent);
    
    j=i;
    while(1){
      if(T[i].parent==NIL) {
	printf("%d",T[i].parent);
	break;
      }
      if(T[T[i].parent].left==j) {
	printf("%d",T[T[i].parent].right);
	break;
      }
      if(T[T[i].parent].right==j){
	printf("%d",T[T[i].parent].left);
	break;
      }
      j++;
    }
    

    
    printf(", degree = ");
    if(T[i].left==NIL && T[i].right==NIL) printf("0");
    else if(T[i].left==NIL && T[i].right!=NIL)printf("1");
    else if(T[i].left!=NIL && T[i].right==NIL)printf("1");
    else printf("2");

    printf(", depth = %d,",C[i]);

    printf(" height = %d,",H[i]);
    
    if(T[i].parent==NIL)
      printf(" root\n");
    else if(T[i].left==NIL && T[i].right==NIL)
      printf(" leaf\n");
    else
      printf(" internal node\n");
  }

  return 0;
}
void getDepth(int r, int d)
{
  if(r==NIL) return;
  C[r] = d;


    getDepth(T[r].right,d+1);

    getDepth(T[r].left,d+1);
}

int getHeight(int r)
{
  int x=0, y=0;

  if(T[r].right!=NIL)
    x = getHeight(T[r].right)+1;
  if(T[r].left!=NIL)
    y = getHeight(T[r].left)+1;
  if(x>y) H[r] = x;
  else H[r] = y;
  return H[r];
}

Measured memory_bytes: 616
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define repeat(i, n) for (int i = 0; (i) < (n); ++(i))
#define repeat_from(i, m, n) for (int i = (m); (i) < (n); ++(i))
using namespace std;
template <class T>
void setmax(T &a, T const &b) {
    if (a < b) a = b;
}

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

template <typename T, typename X>
auto vectors(T a, X x) { return vector<T>(x, a); }

template <typename T, typename X, typename Y, typename... Zs>
auto vectors(T a, X x, Y y, Zs... zs) {
    auto cont = vectors(a, y, zs...);
    return vector<decltype(cont)>(x, cont);
}

// N = m * a + a = a * (m + 1)
// (0 <= a < m)

void divisor(long long n, vector<long long> &ret) {
    for (long long i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end());
    return;
}

int main() {
    long long N;
    cin >> N;
    vector<long long> div_N_1;
    divisor(N - 1, div_N_1);

    vector<long long> div_N;
    divisor(N, div_N);

    long long res = div_N_1.size() - 1;
    for (int i = 1; i < div_N.size(); ++i) {
        long long tmp = N;
        while (tmp % div_N[i] == 0) tmp /= div_N[i];
        if (tmp % div_N[i] == 1) ++res;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3700
n=int(input())
a=list(map(int,input().split()))
q=int(input())
num1=sum(a)
num=[0]*(10**5+1)
for i in range(len(a)):
    num[a[i]-1]+=1
for i in range(q):
    b,c=map(int,input().split())
    num1+=num[b-1]*(c-b)
    print(num1)
    num[c-1]+=num[b-1]
    num[b-1]=0


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

using namespace std;
#define inf             0x3f3f3f3f
#define INF             2e18
#define eps             1e-9

#define FastRead        ios_base::sync_with_stdio(0);cin.tie(0)
#define fRead           freopen("input.txt","r",stdin)
#define fWrite          freopen("output.txt","w",stdout)

#define LL              long long
#define ull            unsigned long long
#define PI              acos(-1.0)
#define pb              push_back
#define mk              make_pair
#define pii             pair<int,int>
#define pLL             pair<LL,LL>
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define SQR(a)          ((a)*(a))
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(min(a,b),min(c,d))
#define max4(a,b,c,d)   max(max(a,b),max(c,d))
#define max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
#define min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))
#define vi              vector <int>
#define vL              vector <LL>
#define LB(a,x)         (lower_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which does not compare less than val.
#define UB(a,x)         (upper_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which compares greater than val.
#define prec(n)         fixed << setprecision(n)

#define MEM(a,x)        memset(a,x,sizeof(a))
#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#define Unique(a)       sort(all(a)),a.erase(unique(all(a)),a.end())

#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define IT(it,x)	    for(it=x.begin();it!=x.end();it++)
vector<int>v;
int main()
{
   int n;
   cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
    cin>>a[i];
  sort(a,a+n);
  cout<<a[n/2]-a[n/2-1];

}


Measured memory_bytes: 4028
#include<bits/stdc++.h>
using namespace std;
int n, m, a[200100], b[200100];
int main() {
	scanf("%d", &n);
	for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
	scanf("%d", &m);
	for(int i = 1; i <= m; i++) scanf("%d", &b[i]);
	sort(a + 1, a + n + 1);
	sort(b + 1, b + m + 1);
	int i = 1;
	for(int j = 1; j <= m; j++) {
		while(a[i] < b[j] && i <= n) i++;
		if(a[i] != b[j]) {
			printf("NO\n");
			return 0;
		}
		i++;
	}
	printf("YES\n");
}

Measured memory_bytes: 1792
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;

class Main{
    static long getCom(long i){
        return i * (i-1) / 2;
    }

    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] input = br.readLine().split(" ");
        HashMap<Long, Long> data = new HashMap<Long, Long>();

        long sum = 0;
        for(int i = 0; i < n; i++){
            long x = Long.parseLong(input[i]);
            sum += x;
            if(data.containsKey(sum)){
                data.put(sum, data.get(sum) + 1);
            }else{
                data.put(sum, 1l);
            }
        }
        
        long ans = 0;
        for(long x : data.keySet()){
            long hindo = data.get(x);
            ans += getCom(hindo);
        }

        if(data.containsKey(0l))
            ans += data.get(0l);

        System.out.println(ans);
    }
}

Measured memory_bytes: 63376
#include <bits/stdc++.h>
using namespace std;
 
int main() {

  int N, M;
  string s;
  vector <string> blue, red;
  vector <int> bluenum, rednum;
  int wordnum = 0;
  vector <int> max;
  int result = 0;
  int kaburi = 0;
  int flag = 0;

  cin >> N;

  for(int i = 0; i < N; i++){
    cin >> s;

    for(int j = 0; j < blue.size(); j++){
      if(blue.at(j) == s){
        bluenum.at(j) ++;
        flag = 1;
        break;
      }
    }

    if(flag == 0){
      bluenum.push_back(1);
      blue.push_back(s);
    }

    flag = 0;
  }

  cin >> M;

  flag = 0;
  for(int i = 0; i < M; i++){
    cin >> s;

    for(int j = 0; j < red.size(); j++){
      if(red.at(j) == s){

        rednum.at(j)++;
        flag = 1;
        break;
      }
    }

    if(flag == 0){

      rednum.push_back(1);
      red.push_back(s);
    }

    flag = 0;
  }


  for(int i = 0; i < blue.size(); i++){

    for(int j = 0; j < red.size(); j++){

      if(blue.at(i) == red.at(j)){

        max.push_back(bluenum.at(i) - rednum.at(j));
        kaburi = 1;
      }
    }
    
    if(kaburi == 0){
      max.push_back(bluenum.at(i));
    }
    kaburi = 0; 
  }


  for(int i = 0; i < max.size(); i++){

    if(result < max.at(i)){
      result = max.at(i);
    }
  }

  cout<< result;
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main{
	public static void main (String[] args) throws java.lang.Exception
	{
		
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		int flag1=1,flag2=1,flag3=1;
		String temp="";
		int N=s.length();
      if(N%2!=0)
      {
		// to check if palindrome;
		for(int i=N-1;i>=0;i--)
		{
			char a=s.charAt(i);
			temp=temp+a;
		}
		if(temp.equals(s))
		{
			flag1=1;
		}
		else
			flag1=0;
		//System.out.print(flag);
		// 2nd condition
		
		int end=(int)((N-1)/2);
		String temp2="";
		temp="";
		for(int i=0;i<end;i++)
		{
			temp2=temp2+s.charAt(i);
		}
		for(int i=end-1;i>=0;i--)
		{
			temp=temp+s.charAt(i);
		}
		if(temp2.equals(temp))
		{
			flag2=1;
		}
		else
			flag2=0;
		//System.out.print(flag);
		//check for 3rd condition
		end=(int)((N+3)/2);
		temp2="";
		temp="";
		for(int i=end-1;i<=N-1;i++)
		{
			temp2=temp2+s.charAt(i);
		}
		for(int i=N-1;i>=end-1;i--)
		{
			temp=temp+s.charAt(i);
		}
		if(temp2.equals(temp))
		{
			flag3=1;
		}
		else
			flag3=0;
		//System.out.print(flag);
		//condition check for strong palindrome
		if(flag1==1 && flag2==1 && flag3==1)
		{
			System.out.println("Yes");
			
		}
		else
		{
			System.out.println("No");
		}
}
}
}

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


int main()
{
string s;cin>>s;
int sum=0;
for(int i=0;i<s.length();i++)
{
    sum+=s[i]-'0';
}
if(sum%9==0){cout<<"Yes"<<endl;}
else{cout<<"No"<<endl;}
}


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

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

using namespace std;

#define IINF INT_MAX
int n,p[110],dp[110][100010];

int main() {
  while( cin >> n, n ) {
    rep(i,n) cin >> p[i];
    int limit = (n * 999) + 1;
    rep(i,n+1) rep(j,limit) dp[i][j] = IINF;
    dp[0][0] = 0;
    int maxi = -IINF, mini = IINF;
    rep(i,n) {
      for(int j=n;j>=0;--j) {
	for(int k=min((i+1)*999+1,limit)-1;k>=0;--k) {
	  if( dp[j][k] == IINF ) continue;
	  int rem = ( 1000 - p[i] % 1000 ) + k;
	  if( p[i] % 1000 == 0 ) rem = k;
	  
	  if( rem >= 500 ) {
	    assert( rem - 500 >= 0 && rem - 500 < limit);
	    dp[j+1][rem-500] = min(dp[j+1][rem-500],
					dp[j][k]+p[i]);
	    if( maxi < j + 1 ) maxi = j + 1, mini = dp[j+1][rem-500];
	    else if( maxi == j + 1 ) mini = min(mini,dp[j+1][rem-500]);
	  } else {
	    assert( 0 <= rem && rem < limit );
	    dp[j][rem] = min(dp[j][rem],dp[j][k]+p[i]);
	  }
	  dp[j][k] = min(dp[j][k],dp[j][k]);
	}
      }
    }
    if( maxi == -IINF ) maxi = mini = 0;
    cout << maxi << " " << mini << endl;
  }
  return 0;
}



Measured memory_bytes: 42544
def abc():
    n, m = map(int, input().split())
    a = []
    b = []
    for i in range(n):
        a.append(list(map(int, input().split())))
    for i in range(m):
        b.append(list(map(int, input().split())))
    for _a in a:
        md = 10 ** 9
        ans = 0
        for i, _b in enumerate(b):
            tmp = abs(_a[0]-_b[0])+abs(_a[1]-_b[1])
            if tmp < md:
                md = tmp
                ans = i + 1
        print(ans)


abc()


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

#define pb push_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define REP(i,n) for(int _n=n, i=0;i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)
#define FORD(i,a,b) for(int i=(a),_b=(b);i>=_b;--i)
#define trav(a, x) for (auto& a : x)
using ull = uint64_t;
using ll = int64_t;
using PII = pair<int, int>;
using VI = vector<int>;
#define INF (1ll<<60)

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B> string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A> string to_string(A v) {
bool first = true; string res = "{";
for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); }
res += "}"; return res; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H); debug_out(T...); }
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)


vector<vector<pair<ll, ll>>> tree;

ll dist[100005];
int Q, K;

void dfs(int v, int from, ll d) {
    dist[v] = d;
    for (auto p : tree[v]) {
        if (p.first == from) continue;
        dfs(p.first, v, d + p.second);
    }
}

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    int N;
    cin >> N;
    tree.assign(N + 4, vector<pair<ll, ll>>());
    REP(i, N-1) {
        ll a, b, c; 
        cin >> a >> b >> c;
        tree[a].pb({b, c});
        tree[b].pb({a, c});
    }
    cin >> Q >> K;
    dfs(K, 0, 0);
    int x, y;
    while (Q--) {
        cin >> x >> y;
        cout << dist[x] + dist[y] << '\n';
    }

}

Measured memory_bytes: 14336
a, b, k = list(map(int, input().rstrip().split()))
if a > k:
    a -= k
    k = 0
else:
    # a <= k
    k -= a
    a = 0

if b > k:
    b -= k
else:
    # b <= k
    b = 0


print('{} {}'.format(a, b))



Measured memory_bytes: 9024
#include <iostream>

using namespace std;

int main() {
    int a[100];
    int n ,i;
    cin>>n;
    for(i=0;i<n;i++)
    cin>>a[i];
    for(i=n-1;i>=1;i--)
    cout<<a[i]<<" " ;
    
    cout<<a[0]<<endl;
}



Measured memory_bytes: 3092
#include<stdio.h>

int main()
{
	int a,b;
	char s;
	scanf("%d\n",&a);
	scanf("%c",&s);
	scanf("%d",&b);
	if(s=='+')
	  printf("%d\n",a+b);
	else
	  printf("%d\n",a-b);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <map>
using namespace std;

#define FOR(i,a,b) for(long long int i=(a);i<(b);i++)
#define REP(i,n) for(long long int i=0;i<(n);i++)
#define ALL(s) (s).begin(),(s).end()

#define PI 3.14159265358479

typedef long long ll;
typedef vector<long long int> vi;
typedef vector<long long int>::iterator vit;

int main(){
	map<string, int>table;
	string s, f, l;
	string::iterator it = s.begin();
	size_t n = 0;
	while (cin >> s){
		table[s]++;
		if (table[s] > n){
			n = table[s];
			f = s;
		}
		if (s.size() > l.size()){
			l = s;
		}
	}
	cout << f << " " << l << endl;
}

Measured memory_bytes: 1196
import java.util.Scanner;

public class Main {

    public static int aa = 0;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int sum = 0;
        int max = 0;
        for (int i = 0; i < n; i++) {
            int tmp = sc.nextInt();
            sum += tmp;
            max = Math.max(max, tmp);
        }

        sum -= max / 2;
        System.out.println(sum);
    }
}

Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int max_n=100005;
int n;
int cnt4,cnt1;
bool have;
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        int x;scanf("%d",&x);
        if(x%4==0)cnt4++;
        else if(x%2==0)have=true;
        else cnt1++;
    }
    cnt1+=have;
    if(cnt4+1>=cnt1)printf("Yes\n");
    else printf("No\n");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
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; }
int main(){
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    vector<vector<int>> x(n),y(n);
    rep(i,n) {
        cin >> a[i];
        x[i] = vector<int>(a[i]);
        y[i] = vector<int>(a[i]);
        rep(j, a[i]) {
            cin >> x[i][j];
            cin >> y[i][j];
            x[i][j]--;
        }
    }
    int max_honest=0;
    rep(bits,1<<n){
        bool ok_flag = true;
        rep(i, n) {
            if((bits & (1<<i)) == false) continue;
            rep(j, a[i]) {
                if(y[i][j] != ((bits&(1<<x[i][j]))!=0)) {
                    ok_flag = false;
                    //cout << i << y[i][j] << x[i][j] << " " << bitset<8>(bits)<<endl;
                }
            }
        }
        if(ok_flag) {chmax(max_honest, __builtin_popcount(bits));}
    }
    cout << max_honest << endl;
}

Measured memory_bytes: 256