akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <bitset>
#include <set>
#include <list>
#include <deque>
#include <map>
#include <queue>
#define mod 998244353
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
using namespace std;
typedef long long ll;
const double PI=3.14159265358979;
const double eps=1e-15;
const ll INF=2000000000000000000;
const int maxn=10000010;
const int maxm=20;

int a,b,c,d,e,f;
int answ,anss;
double ansd;
bool vis[5001][5001];

struct node{
    int w,s;
    double den;
}tmp,nxt;

queue<node> q;

void bfs(){
    memset(vis,0,sizeof(vis));
    while(!q.empty())   q.pop();
    answ=anss=0;ansd=0.0;
    q.push((node){answ,anss,ansd});
    vis[0][0]=true;    
    while(!q.empty()){
        tmp=q.front();q.pop();
        if(tmp.w*e>=tmp.s && tmp.den>=ansd){
            answ=tmp.w;
            anss=tmp.s;
            ansd=tmp.den;
        }
        if(100*(tmp.w+a)+tmp.s<=f && !vis[tmp.w+a][tmp.s]){
            nxt.w=tmp.w+a;
            nxt.s=tmp.s;
            nxt.den=1.0*nxt.s/(100.0*nxt.w+1.0*nxt.s);
            vis[nxt.w][nxt.s]=true;
            q.push(nxt);
        }
        if(100*(tmp.w+b)+tmp.s<=f && !vis[tmp.w+b][tmp.s]){
            nxt.w=tmp.w+b;
            nxt.s=tmp.s;
            nxt.den=1.0*nxt.s/(100.0*nxt.w+1.0*nxt.s);
            vis[nxt.w][nxt.s]=true;
            q.push(nxt);
        }
        if(100*tmp.w+tmp.s+c<=f && !vis[tmp.w][tmp.s+c]){
            nxt.w=tmp.w;
            nxt.s=tmp.s+c;
            nxt.den=1.0*nxt.s/(100.0*nxt.w+1.0*nxt.s);
            vis[nxt.w][nxt.s]=true;
            q.push(nxt);
        }
        if(100*tmp.w+tmp.s+d<=f && !vis[tmp.w][tmp.s+d]){
            nxt.w=tmp.w;
            nxt.s=tmp.s+d;
            nxt.den=1.0*nxt.s/(100.0*nxt.w+1.0*nxt.s);
            vis[nxt.w][nxt.s]=true;
            q.push(nxt);
        }
    }
}

int main(){  
    while(~scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f)){
        bfs();
        printf("%d %d\n",100*answ+anss,anss);
    }
    return 0;  
}  

Measured memory_bytes: 24704
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

    public String next() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      return tokenizer.nextToken("\n");
    }

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

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

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

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    int x = sc.nextInt();
    int i = 2;
    List<Integer> primes = new ArrayList<>();
    while (true) {
      boolean isPrime = true;
      for (int p : primes) {
        if (i % p == 0) {
          isPrime = false;
          break;
        }
      }
      if (isPrime) {
        if (i >= x) {
          System.out.println(i);
          return;
        }
        primes.add(i);
      }
      i++;
    }
  }
}

Measured memory_bytes: 23124
from bisect import *

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

N = read()
S = input()

accWfromL = [0] * (N+1)
accEfromR = [0] * (N+1)

for i in range(N):
    accWfromL[i+1] = accWfromL[i] + (S[i] == 'W')
for i in range(N-1, -1, -1):
    accEfromR[i] = accEfromR[i+1] + (S[i] == 'E')

print(min(accWfromL[i] + accEfromR[i+1] for i in range(N)))



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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/02/27  Problem: ABC 113 A / Link: http://abc113.contest.atcoder.jp/tasks/abc113_a  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL ans = 0LL;

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

	int a, b; cin >> a >> b;
	ans = a + b / 2;
	
	
	cout << ans << "\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;
using P = pair<int,int>;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};


struct Sieve {
  int n;
  vector<int> f, primes;
  Sieve(int n=1):n(n), f(n+1) {
    f[0] = f[1] = -1;
    for (ll i = 2; i <= n; ++i) {
      if (f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i*i; j <= n; j += i) {
        if (!f[j]) f[j] = i;
      }
    }
  }
  bool isPrime(int x) { return f[x] == x;}
  vector<int> factorList(int x) {
    vector<int> res;
    while (x != 1) {
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if (fl.size() == 0) return {};
    vector<P> res(1, P(fl[0], 0));
    for (int p : fl) {
      if (res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }
};

int main() {
  Sieve sieve(1e6);
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];

  map<int,int> mp;
  rep(i,n) {
    auto f = sieve.factor(a[i]);
    for (auto p : f) {
      mp[p.first] = max(mp[p.first], p.second);
    }
  }

  mint lcm = 1;
  for (auto p : mp) {
    rep(i,p.second) {
      lcm *= p.first;
    }
  }

  mint ans;
  rep(i,n) {
    mint b = lcm/a[i];
    ans += b;
  }
  cout << ans.x << endl;
  return 0;
}

Measured memory_bytes: 4984
import java.util.*;
import static java.lang.System.*;

public class Main{
  public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
	  
	  int N = sc.nextInt();
	  int M = sc.nextInt();
	  int min =0, max = 10000000, count = 0;
	  
	  for(int i=0; i<M; i++) {
		  int L = sc.nextInt();
		  int R = sc.nextInt();
		  if(min < L) min = L;
		  if(max > R)max = R;
	  }
	  for(int i=min; i<=max; i++) {
		  if(i <= N) count++;
	  }
	  out.println(count);
  	}
  }	  

Measured memory_bytes: 64412
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readC(T...)(size_t n,ref T t){foreach(ref v;t)v=new typeof(v)(n);foreach(i;0..n){auto r=rdsp;foreach(ref v;t)pick(r,v[i]);}}

void main()
{
  int n; readV(n);
  long[] l, r; readC(n, l, r);

  auto w = new long[](n);
  foreach (i; 0..n) w[i] = r[i]-l[i];

  auto on = 0L, op = 0L, ans = 0L;
  auto hn = heapify!"a<b"(Array!long(l[0]));
  auto hp = heapify!"a>b"(Array!long(l[0]));

  foreach (i; 1..n) {
    on -= w[i];
    op += w[i-1];

    if (l[i] < hn.front+on) {
      ans += (hn.front+on)-l[i];
      hn.insert(l[i]-on);
      hn.insert(l[i]-on);
      hp.insert(hn.front+on-op);
      hn.removeFront();
    } else if (l[i] > hp.front+op) {
      ans += l[i]-(hp.front+op);
      hp.insert(l[i]-op);
      hp.insert(l[i]-op);
      hn.insert(hp.front+op-on);
      hp.removeFront();
    } else {
      hn.insert(l[i]-on);
      hp.insert(l[i]-op);
    }
  }

  writeln(ans);
}


Measured memory_bytes: 6948
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll a7=1000000007;
ll inf=1000000000000000;
typedef pair<ll,ll> l_l;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back


ll min(ll a,ll b){
    if(a<b)return a;
    return b;
}
ll max(ll a,ll b){
    if(a>b)return a;
    return b;
}

int main(){
    ll n;cin>>n;
    ll a[n];
    ll b[n];
    rep(i,0,n-1){
        cin>>a[i];
        
    }
    ll c;
    if(n%2==1){
        c=1;
        b[n/2]=a[0];
        rep(i,1,n-1){
            if(i%2==1){
                b[(n/2)+c]=a[i];
            }else{
                b[(n/2)-c]=a[i];
                c++;
            }
        }
    }else{
        c=1;
        b[n/2]=a[0];
        rep(i,1,n-1){
            if(i%2==1){
                b[(n/2)-c]=a[i];
            }else{
                b[(n/2)+c]=a[i];
                c++;
            }
        }
    }
    cout<<b[0];
    rep(i,1,n-1){
        cout<<' '<<b[i];
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 5248
def main():
    MOD = 1000000007
    
    H, W, K = map(int, input().split())
    table = [[0, 0, 0] for i in range(9)]
    
    for i in range(2**(W-1)):
        n = [i & 2**j for j in range(8)]
        
        for i in range(7):
            if n[i] and n[i+1]:
                break
        else:
            i = 0
            while i < W:
                if not n[i]:
                    table[i+1][1] += 1
                    i += 1
                else:
                    table[i+1][2] += 1
                    table[i+2][0] += 1
                    i += 2
                    
    dp = [[0 for i in range(W+2)] for j in range(H+1)] 
    dp[0][1] = 1
    
    for i in range(1, H+1):
        for j in range(1, W+1):
            a = dp[i-1][j-1] * table[j][0]
            b = dp[i-1][j] * table[j][1]
            c = dp[i-1][j+1] * table[j][2]
            dp[i][j] = (a+b+c) % MOD
        
    print(dp[H][K])
    
if __name__ == '__main__':
    main()    

Measured memory_bytes: 3064
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

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

	cin >> N >> K;
	vector<long long int>a(N);
	vector<long long int>b(N);
	for (int i = 0; i < N; i++) {
		cin >> a[i] >> b[i];
	}
	R = LLONG_MAX / 3;
	L = -1;
	while (R - L > 1) {
		long long int mid = (R + L) / 2;
		long long int sum = 0;
		for (int i = 0; i < N; i++) {
			long long int d = mid - a[i];
			if (d < 0)continue;
			sum++;
			sum += d / b[i];
		}
		if (sum >= K)R = mid;
		else L = mid;
	}
	cout << R << endl;
}

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

int main(){
    int N, A[101];
    scanf("%d", &N);
    for (int i = 0; i < N; i++) {
        scanf("%d", &A[i]);
    }
    
    for (int i = 0; i < N; i++) {
        if (A[i] % 2 == 0) {
            if (A[i] % 3 != 0 && A[i] % 5 != 0) {
                cout << "DENIED" << endl;
                return 0;
            }
        }
    }
    cout << "APPROVED" << endl;
    return 0;
}


Measured memory_bytes: 256
//https://atcoder.jp/contests/dp/tasks/dp_b
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;

#define f(i,a,b) for(int i = a;i<b;i++)
#define rep(i,a,b) for(int i = a;i<=b;i++)
#define fd(i,a,b) for(int i = a;i>b;i--)
#define repd(i,a,b) for(int i = a;i>=b;i--)

#define pii pair<int,int>
#define pll pair<ll,ll>

#define fi first
#define se second
#define pb push_back
#define sz(x) (int) (x).size()
#define all(x) x.begin(),x.end()
using namespace std;
const int mod = 1000000007;
const int maxn = 200000;
int main(){
    int n,k;
    scanf("%d%d",&n,&k);
    vector<int> h(n);
    f(i,0,n) cin>>h[i];
    vector<int> dp(n,INT_MAX);
    dp[0] = 0;
    f(i,1,n)
        rep(j,1,min(i,k))
            dp[i] = min(dp[i], dp[i-j] + abs(h[i]-h[i-j]));
    cout<<dp[n-1]<<endl;
}
//dp[i] = min(dp[i-j] + abs(h[i]-h[j])),j = 1 to min(i,k)


Measured memory_bytes: 4096
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int N = in.i();
        StringBuilder sb = new StringBuilder();
        dfs(0, new char[N], 'a', sb);
        out.println(sb);
    }

    static void dfs(int i, char[] s, char mx, StringBuilder sb) {
        if (i == s.length) {
            sb.append(new String(s)).append('\n');
        } else {
            for (char c = 'a'; c <= mx; c++) {
                s[i] = c;
                dfs(i + 1, s, c == mx ? (char)(mx + 1) : mx, sb);
            }
        }
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    void back() {
        head--;
    }

    boolean minus() {
        boolean minus;
        while (true) {
            char c = next();
            if (!isDelimiter(c)) {
                if (!(minus = c == '-')) back();
                return minus;
            }
        }
    }

    void skip() {
        while (isDelimiter(next()));
        back();
    }

    char[] s(int N) {
        char[] cbuf = new char[N];
        read(cbuf, 0, N);
        return cbuf;
    }

    public int read(char[] cbuf, int off, int len) {
        skip();
        int i;
        for (i = 0; i < cbuf.length; i++) {
            char c = next();
            if (isDelimiter(c)) {
                break;
            }
            cbuf[i] = c;
        }
        return i;
    }

    boolean isDelimiter(char c) {
        return c == ' ' || c == '\n' || c == '\r';
    }

    int i() {
        boolean minus = minus();
        int n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        boolean minus = minus();
        long n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }
}


Measured memory_bytes: 46872
#include <stdio.h>
#define min(a,b) (a)>(b)?b:a

int main()
{
    int n, m;
    scanf("%d %d", &n, &m);
    int a[m+1], b[m+1];
    int i;
    for(i=1;i<=m;i++) scanf("%d %d", &a[i], &b[i]);
    
    int a_min[n+1];
    int min;
    for(i=1;i<=m;i++) min = min(a[i], min);
    for(i=0;i<=n;i++) a_min[i] = 111111;
    for(i=1;i<=m;i++) a_min[a[i]] = min(a_min[a[i]], b[i]);
    
    int left, right;
    left = min, right = a_min[min];
    int count = 0;
    for(i=1;i<=n;i++){
        if(a_min[i]!=111111){
            if(right<=i){
                count++;
                left = i, right = a_min[i];
            } else if(left<i&&right>=a_min[i]){
                left = i, right = a_min[i];
            } else if(left<i&&right<a_min[i]){
                left = i;
            }
        }
    }
    count++;
    printf("%d", count);
    
    return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<long long> A(N);
  for(int i=0; i<N; i++) cin >> A.at(i);
  sort(A.begin(),A.end());
  reverse(A.begin(),A.end());
  long long B=0, C=0;
  int flag;
  for(int i=0; i<N-1;i++){
    if(A.at(i)==A.at(i+1)){
      if(B!=0 && flag!=i && C==0){
        C=A.at(i);
        break;
      }
      if(B==0){
        B=A.at(i);
        flag=i+1;
      }
      
    }
  }
  cout << B * C  << endl;
}

Measured memory_bytes: 1024
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;
const int mod= 1e+9+7;

int main(){
    ll N,M; cin>>N>>M;
    vector<ll>a(N);
    double sum=0;
        rep(i,N){
        cin>>a[i];
        sum+=a[i];
    }
    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());

    rep(i,M){
        if(a[i]<sum/(4.0*M)){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
import fractions

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

L_gcd = [0]*(n+1)
R_gcd = [0]*(n+1)

for i in range(n):
    L_gcd[i+1] = fractions.gcd(L_gcd[i], A[i])
    R_gcd[n-i-1] = fractions.gcd(R_gcd[n-i], A[n-i-1])

ans = [0]*n

for i in range(n):
    ans[i] = fractions.gcd(L_gcd[i], R_gcd[i+1])

print(max(ans))

Measured memory_bytes: 16080
#include <math.h>
#include <algorithm>
#include <set>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <string>
#include <cstring>
#include <functional>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <chrono>
#include <climits>
using namespace std ;
#define ld long double
#define int long long
#define ii pair<int,int>
#define _ ios_base::sync_with_stdio(false) ;cin.tie(NULL);cout.tie(NULL);
#define dbg(x) cerr << #x << " is " << x << endl;
#define ms(x,a) memset(x,(int)(a),sizeof(x))
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define vi vector<int >
#define pb push_back
#define endl '\n'
#define ff first
#define ss second
const int N = 2e5+7 ;
const int INF = 1e9 ;
const int MOD = INF + 7 ;
string s ;

void solve(){
	int n , m ;
	cin >> n >> m ;
	if(n > 9 || m > 9){
		cout << -1 << endl ;
	}
	else cout << n*m << endl ;

}

int32_t main(){_
	int t = 1 ;
//	cin >> t ;
	while(t--){
		solve() ;
	}

}


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

using namespace std;

int iabs(int x){
    if(x < 0) return -x;
    return x;
}

int main(){
    int N;
    cin >> N;
    int x = 0;
    int y = 0;
    int t = 0;
    for(int i = 0; i < N; ++i){
        int nt, ny, nx;
        cin >> nt >> nx >> ny;
        int dt = nt - t;
        int dx = iabs(nx - x);
        int dy = iabs(ny - y);
        int rest = dt - (dx + dy);
        if(rest < 0 || rest % 2 == 1){
            cout << "No" << endl;
            return 0;
        }
        t = nt; x = nx; y = ny;
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 384
using System;

public class Program
{
    public static void Main()
	{
        var N = int.Parse(Console.ReadLine());
        var A = new int[100];
       
        for (var i = 0; i < N; i++)
        {
            A[i] = int.Parse(Console.ReadLine());
        }
        Array.Sort(A);
        var Aprv = 0;
        var count = 0;
        for (var i = 0; i < A.Length; i++)
        {
            if (Aprv != A[i])
            {
                count++;
                Aprv = A[i];
            }

        }
        Console.WriteLine(count);
    }
}


Measured memory_bytes: 13140
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	tmp = input[0].split(" ");
	var a =parseInt(tmp[0], 10);
	var b =parseInt(tmp[1], 10);
	var c =parseInt(tmp[2], 10);

	var sort = [a,b,c]
		sort.sort(function(a,b){
			if( a < b ) return -1;
			if( a > b ) return 1;
			return 0;
		});
	
	if(sort[0]+sort[1] == sort[2]){
		console.log("Yes");
	} else {
		console.log("No");
	}
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 20980
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	sc.Scan()
	iv, _ := strconv.Atoi(sc.Text())
	return iv
}

func init() {
	sc.Split(bufio.ScanWords)
}

func mins(x ...int) int {
	mv := x[0]
	for _, v := range x[1:] {
		if v < mv {
			mv = v
		}
	}
	return mv
}

func main() {
	n, a, b := scanInt(), scanInt(), scanInt()
	ca, cb, cc := 0, 0, 0
	for i := 0; i < n; i++ {
		p := scanInt()
		if p <= a {
			ca++
		} else if p >= b+1 {
			cc++
		} else {
			cb++
		}
	}
	fmt.Println(mins(ca, cb, cc))
}


Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))


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

    string s;
    cin >> s;

    string ans{s};
    rep (i, s.size())
    {
        if (s[i] == 'A') ans[i] = 'T';
        else if (s[i] == 'T') ans[i] = 'A';
        else if (s[i] == 'G') ans[i] = 'C';
        else ans[i] = 'G';
    }

    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define ALL(v) v.begin(),v.end()

int main(int argc, char const *argv[])
{
    ll n, m;
    cin >> n >> m;
    vector<pair<ll, ll> > p;
    for (ll i = 0; i < n; i++)
    {
        ll a, b;
        cin >> a >> b;
        p.push_back(make_pair(a, b));
    }
    sort(ALL(p));
    priority_queue<ll> q;
    ll k = 0;
    ll ans = 0;
    for (ll i = 1; i <= m; i++)
    {
        while (k < n && p[k].first == i)
        {
            q.push(p[k].second);
            k++;
        }
        if (!q.empty())
        {
            ans += q.top();
            q.pop();
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

template<typename T>
using priority_queue_rev = priority_queue<T, vector<T>, greater<T> >;

static const int INTINF = (2147483647 >> 1); // 10^9 + 5000
static const ll LLINF = (9223372036854775807 >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;

namespace Kunitaka{
    template<
        typename TYPE,
        std::size_t SIZE
    >
    std::size_t array_length(const TYPE (&array)[SIZE])
    {
        return SIZE;
    }

    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; }
}
using namespace Kunitaka;
namespace Printer{
    void br(){
        cout << endl;
    }

    void loop_cnt(int i){
        cout << "i = " << i << endl;
    }

    void loop_cnt(int i, int j){
        cout << "i = " << i << ", " << "j = " << j << endl;
    }

    template<class T>
    void print(T x){
        cout << x << endl;
    }

    template<class T, class S>
    void print(T x, S y){
        cout << x << "," << y << endl;
    }

    template<class T, class S, class U>
    void print(T x, S y, U z){
        cout << x << "," << y << "," << z << endl;
    }

    template<class T, class S>
    void print(pair<T, S> p){
        cout << p.first << ", " << p.second << endl;
    }

    template<
        typename TYPE,
        std::size_t SIZE
    >
    void print(const TYPE (&array)[SIZE]){
        int lim = array_length(array);
        for(int i=0; i<lim; i++){
            if(i) cout << " ";
            cout << array[i];
        }
        cout << endl;
    }

    template<class S>
    void print(vector<S> v){
        for(int i=0; i<v.size(); i++){
            if(i) cout << " ";
            cout<< v[i];
        }
        cout << endl;
    }

    template<class S>
    void print(vector<vector<S> > vv){
        for(int i=0; i<vv.size(); i++){
            for(int j=0; j<vv[i].size(); j++){
                if(j) cout << " ";
                cout << vv[i][j];
            }
            cout << endl;
        }
    }

    void yesno(bool x){
        if(x) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
};
using namespace Printer;

struct packet{
    ll sum, a, b;
    bool operator<(const packet &another) const{
        return sum > another.sum;
    }
};

int main(int argc, const char * argv[]) {
    //提出時、消す----//
    //--------------//


    // input
    cout << fixed << setprecision(10);
    ll N; cin >> N;
    vector<packet> v(N);
    rep(i, N){
        ll a, b; cin >> a >> b;
        v[i] = {a+b, a, b};
    }

    sort(ALL(v));

    ll res_a = 0;
    ll res_b = 0;
    rep(i, N){
        // print(v[i].sum, v[i].a, v[i].b);
        if(i % 2 == 0){
            res_a += v[i].a;
        }
        else{
            res_b += v[i].b;
        }
    }
    
    print(res_a - res_b);

    return 0;
}


Measured memory_bytes: 2560
#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()
{
  string s;
  cin >> s;
  rep(i, s.size()) cout << "x";
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        if(a <= b && b <= c){
            System.out.println(a + " " + b + " " + c);
        }
        else if(a <= c && c <= b){
            System.out.println(a + " " + c + " " + b);
        }
        else if(b <= a && a <= c){
            System.out.println(b + " " + a + " " + c);
        }
        else if(b <= c && c <= a){
            System.out.println(b + " " + c + " " + a);
        }
        else if(c <= a && a <= b){
            System.out.println(c + " " + a + " " + b);
        }
        else{
            System.out.println(c + " " + b + " " + a);
        }
    }
}



Measured memory_bytes: 26184
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int wa = a + b;
        sc.close();
        if (wa % 2 == 0) {
            System.out.println(wa / 2);
            return;
        } else {
            System.out.println("IMPOSSIBLE");
            return;
        }

    }
}


Measured memory_bytes: 22612
#include<stdio.h>
int main()
{
    int a,b,c,N,K;
    char s[101];
    // 整数の入力
    scanf("%d", &N);
    scanf("%s",s);
    scanf("%d", &K);
//    scanf("%d", &c);

    for (int i = 0; i < N; i++) {
        if (s[i] == s[K - 1]) {
            printf("%c", s[i]);
        }
        else
            printf("*");
    }
    printf("\n");
/*
    // スペース区切りの整数の入力
    scanf("%d %d",&b,&c);
    // 文字列の入力
    scanf("%s",s);
    // 出力
    printf("%d %s\n",a+b+c,s);
*/
    return 0;
}
        

Measured memory_bytes: 128
import math

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

ar = a[::-1]
l = [0]
r = []

tmp1 = 0
tmp2 = 0
for i in range(n-1):
    tmp1 = math.gcd(tmp1, a[i])
    l.append(tmp1)
    tmp2 = math.gcd(tmp2, ar[i])
    r.append(tmp2)

r.reverse()
r.append(0)
ans = 1
for i in range(n):
    ans = max(ans, math.gcd(l[i], r[i]))
print(ans)

Measured memory_bytes: 97756
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
 
using ull = unsigned long long int;
using ll = long long int;
using du = double;
using ld = long du;
using vi = vector<int>;
using vll = vector<ll>;
using vld = vector<ld>;
using vdu = vector<du>;
using vs = vector<string>;
using vc = vector<char>;
using si = set<int>;
using sll = set<ll>;
using sdu = set<du>;
using sld = set<ld>;
using pii = pair<int, int>;
using pll = pair<ll,ll>;
using pdu = pair<du,du>;
using pld = pair<ld,ld>;
using pis = pair<int,string>;
 
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define sp(x) setprecision(x)<<fixed
#define loop(i,n) for(int i=0;i<n;i++)
#define ff first
#define ss second
#define pi acos(-1)
#define meme(a,x) memset(a,x,sizeof(a))
#define all(a) a.begin(),a.end()
 
//debugger
 
#ifdef KAIZER
#include "debug.h"
#else
#define debug(x...)
#endif
//debugger
 
//functions
bool check_pow(ll a)
{
    if((a&(a-1))==0) return true;
    else return false;
}
ld my_pow(ld a,int b)
{
    ld ans=1;
    for(int i=0;i<b;i++) ans*=a;
    return ans;
}
ll digits(ll a)
{
    string line=to_string(a);
    return line.size();
}
bool prime_check(ll a)
{
    bool flag=true;
    for(ll i=2;i<=sqrt(a);i++)
    {
        if(a%i==0) {flag=false; break;}
    }
    return flag;
}
bool comp(const pair<int,int> &a , const pair<int,int> &b)
{
    if(a.ff!=b.ff) return a.ff>b.ff;
    else return a.ss<b.ss;
}
bool comp2(const ll &a, const ll &b)
{
     return a>b;
}
 
//functions

int main() {
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    FASTIO;
    vector<vector<int>> a(3,vector<int>(3));
    loop(i,3)
    {
        loop(j,3) cin>>a[i][j];
    }
    int n;
    cin>>n;
    loop(i,n)
    {
        int p;
        cin>>p;
        loop(j,3) loop(k,3) if(a[j][k]==p) {a[j][k]=0;break;}
    }
    int ans=0;
    loop(i,3) if(a[i][0]==0 &&a[i][1]==0&& a[i][2]==0) ans++;
    loop(i,3) if(a[0][i]==0 &&a[1][i]==0&& a[2][i]==0) ans++;
    if(a[0][0]==0&&a[1][1]==0&&a[2][2]==0) ans++;
    if(a[0][2]==0 && a[1][1]==0&&a[2][0]==0) ans++;
    //debug(a);
    if(ans>=1) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 3664
// In the name of Allah.
// We're nothing and you're everything.
// Ya Ali!
 
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int maxn = 2e5, lg = 60;
struct Gauss{
    ll a[lg];
    Gauss(){
        memset(a, 0, sizeof a);
    }
    void add(ll x){
        for(int i = lg - 1; i >= 0; i--)
            if(x >> i & 1)
                if(a[i])
                    x ^= a[i];
                else{
                    a[i] = x;
                    break;
                }
    }
    bool can(ll x){
        for(int i = lg - 1; i >= 0; i--)
            if(x >> i & 1)
                x ^= a[i];
        return x == 0;
    }
};
ll a[maxn];
int main(){
    ios::sync_with_stdio(0), cin.tie(0);
    int t;
    cin >> t;
    while(t--){
        int n;
        cin >> n;
        for(int i = 0; i < n; i++)
            cin >> a[i];
        string s;
        cin >> s;
        reverse(s.begin(), s.end());
        reverse(a, a + n);
        Gauss g;
        bool ok = true;
        for(int i = 0; i < n; i++)
            if(s[i] == '1')
                ok &= g.can(a[i]);
            else
                g.add(a[i]);
        cout << !ok << '\n';
    }
}

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

#define ll long long
#define vec vector<ll>
#define sortv(a); sort(a.begin(), a.end());
#define rev(a); reverse(a.begin(), a.end());
#define FOR(i,a,b) for (ll i = (ll)(a); i < (b); i++)
#define ROF(i,a,b) for (ll i = (ll)(b)-1; i >= (a); i--)

ll MOD = 1000000007;
ll INF = 1LL << 60;

/*****************************************************************************/
ll n,x,y;

void solve() {
	map<int,int> mp;
	FOR(i,0,n-1) {
		FOR(j,i+1,n) {
			ll d = j-i;
			d=min(d,abs(x-i)+abs(y-j)+1);
			d=min(d,abs(y-i)+abs(x-j)+1);
			mp[d]++;
		}
	}
	FOR(k,1,n) { // 1 to n-1
		cout<<mp[k]<<'\n';
	}
}

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin>>n>>x>>y;
	x--;y--;
	solve();
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <regex>
using namespace std;
typedef long long ll;

#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define SIZE(array) (sizeof(array) / sizeof(array[0]))

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

#define MAX_V 100000

#define MOD 1000000007L
#define INF 100000000000

const int VMAX = 100;

bool dist[VMAX][VMAX] = {};

signed main() {
	int V, E;
	cin >> V >> E;

	for (size_t i = 0; i < E ; i++) {
		for (size_t j = 0; j < E ; j++) {
			dist[i][j] = false;
			dist[j][i] = false;
		}
	}

	for (int i = 0; i < E; ++i) {
		int s, t;
		cin >> s >> t;
		dist[s - 1][t - 1] = true;
		dist[t - 1][s - 1] = true;
	}
	std::vector<int> v = {};
	for (size_t i = 0; i < V; i++) {
		v.push_back(i);
	}

	int c = 0;
  do {
		if (v[0] != 0) {
			continue;
		}
		bool ok = true;
		for (size_t i = 1; i < V && ok; i++) {
			ok = dist[v[i - 1]][v[i]];
		}
		c += ok;
  } while (std::next_permutation(v.begin(), v.end()));
	cout << c << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int N;
    int A[200]; 

    cin >> N;
    for (int i = 0; i < N; i++) cin >> A[i];

    int res = 0;

    // 操作が行える限り操作を繰り返す
    bool exist_odd = false;  // A[i] がすべて偶数かどうかを判定するフラグ
    while (true) {
        for (int i = 0; i < N; i++) {
            if (A[i] % 2 != 0) exist_odd = true;  // 奇数があったらブレイク
            A[i] = A[i]/2;
        }
        if(exist_odd) break;
        res++;  // 操作回数をインクリメント
    }
    cout << res << endl;
}

Measured memory_bytes: 256
import sys
from math import sqrt
sys.setrecursionlimit(10**9)
INF=10**18
def input():
    return sys.stdin.readline().rstrip()

def main():
    N=int(input())
    A=list(map(int,input().split()))
    divisor=set()
    for x in range(1,int(sqrt(A[0]))+1):
        if A[0]%x==0:
            divisor.add(x)
            divisor.add(A[0]//x)
    for x in range(1,int(sqrt(A[1]))+1):
        if A[1]%x==0:
            divisor.add(x)
            divisor.add(A[1]//x)
    
    def solve(mid):
        f=False
        for x in A:
            if x%mid:
                if f:
                    return False
                else:
                    f=True
        return True
    
    ans=0
    for d in divisor:
        if solve(d):
            ans=max(ans,d)
    print(ans)
    

if __name__ == '__main__':
    main()


Measured memory_bytes: 63984
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 1000000007    //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)

// debug
#define DEBUG(x) cout << #x << ": " << x << endl
#define DEBUG2(x, y) cout << #x << ": " << x << " " << #y << ": " << y << endl
#define DEBUG_VEC(v)   \
  cout << #v << ":";   \
  REP(i, v.size())     \
  cout << " " << v[i]; \
  cout << endl
#define DEBUG_ARR(v, n) \
  cout << #v << ":";    \
  REP(i, n)             \
  cout << " " << v[i];  \
  cout << endl

signed main()
{
  ll N, K;
  vector< ll > H;

  cin >> N >> K;
  REP(i, N)
  {
    ll ci;
    cin >> ci;
    H.push_back(ci);
  }

  // K回まで必殺技を使える
  // → 必殺技を使うモンスターは体力が最も高いうちのK体に行う
  // → 攻撃回数は、残りのN-K体のモンスターの体力数に等しい
  sort(ALL(H), greater< ll >());

  ll cnt = 0;
  FOR(i, K, N - 1)
  {
    cnt += H[i];
  }
  cout << cnt << endl;
}

Measured memory_bytes: 2420
// 2017/05/12 Tazoe

#include <iostream>
using namespace std;

const int NOT_FOUND = -1;

int linearSearch(int key, int A[], int n)
{
	int i = 0;
	A[n] = key;

	while(A[i]!=key){
		i++;
	}

	if(i==n){
		return NOT_FOUND;
	}

	return i;
}

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

	int S[10001];	// ????????????????????§
	for(int i=0; i<n; i++){
		cin >> S[i];
	}

	int q;
	cin >> q;

	int T[500];
	for(int i=0; i<q; i++){
		cin >> T[i];
	}

	int C = 0;

	for(int i=0; i<q; i++){
		if(linearSearch(T[i], S, n)!=NOT_FOUND){
			C++;
		}
	}

	cout << C << endl;

	return 0;
}

Measured memory_bytes: 3112
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <vector>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include<functional>
#include<bits/stdc++.h>
using  namespace std;
typedef long long ll;
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define pI64d(x) printf("%I64d\n",x)
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
const ll INF=1e15;
const int MOD=1e9+7;
const int N=1e6+7;
const double eps=1e-8;
const double PI=acos(-1.0);
int main()
{
    ll a,b;
    char s[5];
    while(~scanf("%I64d%s%I64d",&a,s,&b))
    {
        if(s[0]=='+') printf("%I64d\n",a+b);
        else printf("%I64d\n",a-b);
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#define MAX 1000000000

int A[MAX];
std::vector<int> g;
int cnt = 0;

void insertionSort(int A[], int n, int g) {
    for (int i = g; i < n; i++) {
        int v = A[i];
        int j = i - g;
        while ( j >= 0 && A[j] > v) {
            A[j+g] = A[j];
            j -= g;
            cnt ++;
        }
        A[j+g] = v;
    }
}

void shellSort(int A[], int n) {
    for (int h = 1; ; ) {
        if ( h > n ) break;
        g.push_back(h);
        h = 3 * h + 1;
    }
    
    for ( int i = g.size()-1; i >= 0; i-- ) {
        insertionSort(A, n, g[i]);
    }
}


int main() {
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++ ) scanf("%d", &A[i]);
    
    shellSort(A, n);
    
    printf("%d\n", g.size());
    for (int i = g.size()-1; i >= 0; i--) {
        printf("%d", g[i]);
        if(i) printf(" ");
    }
    printf("\n");
    printf("%d\n", cnt);
    
    for (int i = 0; i < n; i++) {
        printf("%d\n", A[i]);
    }
    
    
    return 0;
}

Measured memory_bytes: 7072
#include <stdio.h>
#include <stdlib.h>
int main() {
  char tab1[3],tab2[3];
  int count=0;
  scanf("%s",tab1);
  scanf("%s",tab2);
  for (int i = 0; i < 3; i++) {
    if (tab1[i]==tab2[i]) {
      count++;
    }
  }
  printf("%d\n",count );
  return 0;
}

Measured memory_bytes: 128
#include <iostream>

int n;
long long a[100010],b[100010];
int main(){
  std::cin>>n;
  for(int i=0;i<n;++i)
    std::cin>>a[i]>>b[i];
  
  long long ans=0;
  for(int i=n-1;i>=0;--i){
    auto res=a[i]+ans;
    auto B=b[i];
    if(res%B==0)
      continue;
    ans+=(res/B+1)*B-res;
  }
  std::cout<<ans<<std::endl;
  return 0;
}


Measured memory_bytes: 1792
import numpy as np
N, M = (int(i) for i in input().split())  
H = [int(i) for i in input().split()] 

AB = [[int(i) for i in input().split()] for i in range(M)] 

lis = np.zeros(N)

for a, b in AB:
  if H[a-1] > H[b-1]:
    large_idx = a - 1
    small_idx = b - 1
    if lis[large_idx] >= 0:
    	lis[large_idx] = 1
    lis[small_idx] = -1
  elif H[b-1] > H[a-1]:
    large_idx = b - 1
    small_idx = a - 1
    if lis[large_idx] >= 0:
    	lis[large_idx] = 1
    lis[small_idx] = -1
  else:
    lis[a-1] = -1
    lis[b-1] = -1

print(int(sum(lis>=0)))

Measured memory_bytes: 48780
#Beautiful Strings
S = input()
S1 = []
ab = [chr(ord('a') + i) for i in range(26)]
m = 0
n = 0
for i in range(len(S)):
    S1.append(S[i])
S2 = sorted(S)
for i in range(26):
    for j in range(len(S)):
        if S2[j] == ab[i]:
            m = m + 1
    if m % 2 != 0:
        n = n + 1
if n == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <stack>
#include <set>
#include <queue>
#include <algorithm>
#include <deque>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;

#define INF 1e18
#define int long long

template<typename T>
void printVector(vector<T> &v) {
    for(int i = 0; i < v.size(); i++) {
        cout << v[i] << " ";
    }
    cout << endl;
}

int getNumberOfDigits(int n) {
    if(n == 0) return 0;
    return 1 + getNumberOfDigits(n / 10);
}

int getMaxNumberOfDigits(int n, int m) {
    int digitsOfN = getNumberOfDigits(n);
    int digitsOfM = getNumberOfDigits(m);
    return max(digitsOfN, digitsOfM);
}

vector<int> getDivisors(int n) {
    vector<int> devisors;
    for(int i = 1; i * i <= n; i++) {
        if(n % i == 0) {
            devisors.push_back(i);
            if(i * i != n) devisors.push_back(n / i);
        }
    }
    sort(devisors.begin(), devisors.end());
    return devisors;
}

signed main() {
    int n; cin >> n;
    vector<int> devisors = getDivisors(n);

    int ans = INF;
    for(int i = 0; i < devisors.size(); i++) {
        int maxNumberOfDigits = getMaxNumberOfDigits(devisors[i], n / devisors[i]);
        ans = min(ans, maxNumberOfDigits);
    }

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


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-6;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

const int64 mod = 1e9+7;

vector<string> key({".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"});

int main(void){
	int32 n, m;
	cin >> n;
	REP(_, n){
		string s, res = "";
		cin >> s;
		int32 now = -1, in = 0;
		REP(i, s.size()){
			if(now == -1 && s[i] == '0') continue;
			if(s[i] == '0'){
				res += key[now][in];
				now = -1; in = 0;
			}
			else if(now == -1) now = s[i]-'1';
			else{
				in=(in+1)%key[now].size();
			}
		}
		cout << res << endl;
	}
}


Measured memory_bytes: 3012
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_v(size_t a, Ts... ts) {return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); }

template<typename T,typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v){ t = v; }

template<typename T,typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v){ for(auto &e : t) fill_v(e, v); }

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = 1e9 + 7;

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    REP(i, n) cin >> a[i];

    sort(all(a), greater<int>());
    priority_queue<int> que;
    REP(i, n) que.push(a[i]);
    REP(i, m)
    {
        int f = que.top();
        que.pop();
        que.push(f/2);
    }
    LL ans = 0;
    while(!que.empty())
    {
        ans += que.top();
        que.pop();
    }
    cout << ans << endl;
}

Measured memory_bytes: 1276
#include<bits/stdc++.h>
using namespace std;
int main(){
char a,b;
while(cin>>a>>b){
if(a=='H')
    {
        if(b=='H')
            cout<<"H\n";
        else cout<<"D\n";

        }
else {
        if(b=='H')
        cout<<"D\n";
        else cout<<"H\n";


    }
}
}


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

using namespace std;

#define ll long long

int main(void){
    int k, n;
    cin >> k >> n;
    vector<int> a(n);
    for(int i = 0;i < n;++i)    cin >> a[i];

    vector<pair<int, int>> dist(n, pair<int, int>(0, 0));
    for(int i = 0;i < n;++i){
        dist[i].first = min(abs(a[(i+1)%n] - a[i]), k - abs(a[(i+1)%n] - a[i]));
        dist[i].second = i;
    }
    sort(dist.begin(), dist.end(), greater<pair<int, int>>());

    cout << k - dist[0].first << endl;

    return 0;
}

Measured memory_bytes: 2560
def main():
    o = list(input())
    e = list(input())
    s = []

    for i in range(len(o)+len(e)):
        if i % 2 == 0:
            s.append(o[i//2])
        else:
            s.append(e[i//2])
    
    print(''.join(s))

if __name__ == '__main__':
    main()

Measured memory_bytes: 61752