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

int gcd(int a, int b)
{
    if (a % b == 0){
        return (b);
    }

    return (gcd(b, a % b));
}

int main(void)
{
    int a, b, x;

    while (scanf("%d %d", &a, &b) != EOF){
        x = gcd(a, b);
        printf("%d %d\n", x, a / x * b);
    }

    return (0);

}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define int long long
#define INT_MAX INT64_MAX
#define INT_MIN INT64_MIN
#define CLK clock_t clk = clock();//Start of main
#define OCLK cerr << "Time (in ms): " << (double)(clock() - clk) * 1000.0 / CLOCKS_PER_SEC << '\n';//End of main
#define MOD 1000000007
/* DEFINE cout */
#define pln cout << "===============================\n"
#define on cout<<"\n"
#define os cout<<" "
#define o2(a,b) cout<<a<<" "<<b
#define o(a) cout << a
#define bitcount __builtin_popcount
/* DEFINE cout */
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);//fastio
using namespace std;
struct hash_pair { // use pair as key in unordered_map<pair<int,int>,int,hash_pair>;
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);
        return hash1 ^ hash2;
    }
};
bool prime[10000001];
int P=MOD-2;
int factorial[10000001]={0};
int powerFunction(int x,int y){
    int res = 1;
    int p = MOD;
    x = x % p;
    while (y > 0){
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
void sieveFunction(int maxLimit){
    memset(prime, true, sizeof(prime));
    prime[0] = prime[1]=false;
    for(int i=2; maxLimit >= i ; i++){
        if(prime[i]){
            for(int j=2*i ; maxLimit >= j ; j+=i)
                prime[j]=false;
        }
    }
}
void factorialFunction(int maxLimit){
    factorial[0]=1;
    for(int i=1 ; i <= maxLimit ; i++)
        factorial[i]=(factorial[i-1]*i)%MOD;
    return;
}
int gcd(int a, int b){
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
signed main(){
    int a, b;
    cin >> a >> b;
    int gc = gcd(a, b);
    int lc = a*b;
    lc /= gc;
    cout << lc << endl;
}



Measured memory_bytes: 256
module ccc;import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;


void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!long).array;

    if (A.map!(a => a >= 0).all) {
        A.sort();
        long ans = A.sum - 2 * A.front;
        ans.writeln;
        long tmp = A.front;
        foreach (i; 1..N-1) {
            writeln(tmp, " ", A[i]);
            tmp -= A[i];
        }
        writeln(A.back, " ", tmp);
    } else if (A.map!(a => a <= 0).all) {
        A.sort!"a > b";
        long ans = A.map!(a => abs(a)).sum + 2 * A.front;
        ans.writeln;
        long tmp = A.front;
        foreach (i; 1..N) {
            writeln(tmp, " ", A[i]);
            tmp -= A[i];
        }
    } else {
        A.sort();
        long ans = A.map!(a => abs(a)).sum;
        ans.writeln;
        auto plus = A.filter!(a => a >= 0).array;
        auto minus = A.filter!(a => a < 0).array;
        long tmp = minus.front;
        foreach (i; 0..plus.length.to!int-1) {
            writeln(tmp, " ", plus[i]);
            tmp -= plus[i];
        }
        writeln(plus.back, " ", tmp);
        tmp = plus.back - tmp;
        foreach (i; 1..minus.length) {
            writeln(tmp, " ", minus[i]);
            tmp -= minus[i];
        }
    }
}

Measured memory_bytes: 5996
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll n, t, a, b, c;
  in2(n, t);
  c = 999999999999;
  rep(i, n){
    in2(a, b);
    if(b <= t)
      c = min(c, a);
  }
  if(c < 999999)
    out(c);
  else
    out("TLE");
  memi;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

struct UnionFind {
  vector<int> d;
  UnionFind(int n) : d(n, -1) {}
  int root(int x) {
    if(d[x] < 0) return x;
    return d[x] = root(d[x]);
  }
  bool unite(int x, int y) {
    x = root(x);
    y = root(y);
    if(x == y) return false;
    if(d[x] > d[y]) swap(x, y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return root(x) == root(y); }
  int size(int x) { return -d[root(x)]; }
};

struct edge {
  ll from, to, cost;
  bool operator<(const edge& o) const { return cost < o.cost; }
};

ll kruskal(ll n, vector<edge>& edges) {  // n:頂点の数, edges：辺のリスト
  sort(all(edges));
  UnionFind uf(n);
  ll res = 0;
  rep(i, edges.size()) {
    edge& e = edges[i];
    if(uf.same(e.from, e.to)) continue;
    res += e.cost;
    uf.unite(e.from, e.to);
  }
  return res;
}

int main() {
  ll n;
  cin >> n;
  vector<tuple<ll, ll, ll>> t(n);
  rep(i, n) {
    ll x, y;
    cin >> x >> y;
    t[i] = make_tuple(x, y, i);
  }
  vector<edge> edges;
  rep(_, 2) {
    sort(all(t));
    rep(i, n - 1) {
      ll a, b, p, c, d, q;
      tie(a, b, p) = t[i];
      tie(c, d, q) = t[i + 1];
      edge e;
      e.from = p;
      e.to = q;
      e.cost = abs(c - a);
      edges.push_back(e);
      e.cost = abs(d - b);
      edges.push_back(e);
    }
    rep(i, n) {
      ll a, b, p;
      tie(a, b, p) = t[i];
      t[i] = make_tuple(b, a, p);
    }
  }
  cout << kruskal(n, edges) << endl;
}

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

class Main
{
    static class Len
    {	
	int a[]; //= new int[2000010];
	int b[]; //= new int[2000010];
	
	Len(int n)
	{
	    a = new int[n+1];
	    b = new int[n+1];
	}
	

    }

    public static void main(String args[])
    {
	int n;
	int i, j, k;

	String line = new String();
	BufferedReader bin = new BufferedReader(new InputStreamReader(System.in));
	PrintStream out = new PrintStream(System.out);

	//Read ----------------
	//Read n
	try{
	    line=line=bin.readLine();
	}	
	catch(IOException e){
	    System.out.println("Error");
	}

	n=Integer.parseInt(line);
	Len len = new Len(n);
	j=0;
	//Read A[]
	try{
	    line=bin.readLine();
	    //System.out.println(line);
	    StringTokenizer str = new StringTokenizer(line);   
	    for(i=0; i<n; i++)
		{
		    len.a[i]=Integer.parseInt(str.nextToken());
		    if(j<len.a[i])j=len.a[i];
		}
	}
	catch(IOException e){
	    System.out.println("Error");
	}

	bin=null;

	//Read end------------


	//sort
	countingSort(len, j, n);

	//print
	StringBuffer s = new StringBuffer(100);
	for(i=1; i<=n; i++)
	    {
		s.append(len.b[i]);
		if(i!=n)s.append(" ");
	    }
	System.out.println(s);
	//	out.print(len.b[i]+" ");
	//out.println(len.b[n]);

	/*
	for(i=1; i<n; i++)System.out.print(len.b[i]+" ");
	System.out.println(len.b[n]);*/

    }

    static void countingSort(Len len, int max, int n)
    {
	int i, j, k;
	int[] c = new int[max+1];

	//for(i=0; i<=max; i++)c[i]=0;
	for(i=0; i<n; i++)c[len.a[i]]++;

	for(i=0; i<=max; i++)
	    {
		if(i!=0)c[i]+=c[i-1];
	    }

	for(i=n-1; i>=0; i--)
	    {
		len.b[c[len.a[i]]]=len.a[i];
		c[len.a[i]]--;
	    }
    }
}

Measured memory_bytes: 102000
#include <iostream>
#include <cstdio>
#include <vector>
#include <array>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <random>
#include <bitset>
#include <cassert>
#include <tuple>
#include <list>
#include <iterator>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <complex>

using namespace std;

typedef long long ll;
typedef long double ld;

template<class htpe, class cmp>
using heap = priority_queue<htpe, vector<htpe>, cmp>;

template<class htpe>
using min_heap = heap<htpe, greater<htpe> >;

template<class htpe>
using max_heap = heap<htpe, less<htpe> >;

#define mp make_pair
#define pb push_back
#define mt make_tuple
#define ff first
#define ss second

#define forn(i, n) for (int i = 0; i < ((int)(n)); ++i)
#define forrn(i, s, n) for (int i = (int)(s); i < ((int)(n)); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

#define PYMOD(a, m) ((((a) % (m)) + (m)) % (m))

const int INF = 1791791791;
const ll INFLL = 1791791791791791791ll;

const int maxn = 100179;
vector<pair<int, int> > graph[maxn];
int dp[maxn];


bool dfs(int v, int dpval) {
    dp[v] = dpval;
    for (auto p : graph[v]) {
        if (dp[p.ff] == -INF) {
            if (!dfs(p.ff, dpval + p.ss))
                return false;
        } else {
            if (dp[p.ff] != dpval + p.ss)
                return false;
        }
    }
    return true;
}

int main() {
    // Code here:

    int n, m;
    cin >> n >> m;

    forn(i, m) {
        int l, r, d;
        cin >> l >> r >> d;
        l--; r--;
        graph[l].pb(mp(r, d));
        graph[r].pb(mp(l, -d));
    }

    fill(dp, dp + n, -INF);

    forn(i, n) {
        if (dp[i] == -INF)
            if (!dfs(i, 0)) {
                cout << "No" << endl;
                return 0;
            }
    }

    cout << "Yes" << endl;
    return 0;
}


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



/*??°??¢?????¨?????????????????¨?????????????????????????´????????????????????????°??????????????????????????§????????????????????????????????????????????¨???
?????¢??????????????????????????¢??°???
???c????°´?????????????§??????????????????????????????????????????°???????????????\???????§??????????????????°???????????????
???????????????????????????????????????????????????????????????????????????????????????????????????????????£?????????????????°????????????*/
int menseki_hidari(char *c,int mojityou){
   int i,menseki=0;
   double sum=0.0,takasa=0.0;
   for(i=0;i<mojityou;i++){
     if(c[i]=='\\'){
       sum=sum+takasa+0.5;
       takasa++;
     }
     else if(c[i]=='_') sum+=takasa;
     else{
       sum=sum+takasa-0.5;
       takasa--;
     }
   }
  menseki=(int)sum;
  return menseki;
}



int menseki_migi(char *c,int mojityou){
   int i,menseki=0;
   double sum=0.0,takasa=0.0;
   for(i=0;i<mojityou;i++){
     if(c[i]=='/'){
       sum=sum+takasa+0.5;
       takasa++;
     }
     else if(c[i]=='_') sum+=takasa;
     else{
       sum=sum+takasa-0.5;
       takasa--;
     }
   }
  menseki=(int)sum;
  return menseki;
}






int main(){
  char c[20000];
  int takasa=0,mojityou=0,kosuu=0,mensekigun[20000],migimensekigun[20000];
  int migikosuu=0,i=0,j;
  while(scanf("%c",&c[i]) != EOF){
    if(takasa!=0){
      mojityou++;
      i++;
      if(c[i-1]=='/'){
        takasa++;
        if(takasa==0){
          mensekigun[kosuu]=menseki_hidari(c,mojityou);
          kosuu+=1;
          mojityou=0;
          i=0;
        }
      }
      else if(c[i-1]=='\\') takasa--;
    }
    else{
      if(c[i]=='\\'){
        takasa--;
        i+=1;
        mojityou++;
      }
    }
  }
  char s[20000];
  j=mojityou-1;
  mojityou=0;
  i=0;
  takasa=0;
  while(j>=0){
    s[i]=c[j];
    j--;
    if(takasa!=0){
      mojityou++;
      i++;
      if(s[i-1]=='\\'){
        takasa++;
        if(takasa==0){
          migimensekigun[migikosuu]=menseki_migi(s,mojityou);
          migikosuu+=1;
          mojityou=0;
          i=0;
        }
      }
      if(s[i-1]=='/') takasa--;
    }
    else{
      if(s[i]=='/'){
        takasa--;
        i+=1;
        mojityou++;
      }
    }
  }
  int sum=0;
  for(i=0;i<kosuu;i++) sum+=mensekigun[i];
  for(i=0;i<migikosuu;i++) sum+=migimensekigun[i];
  printf("%d\n",sum);
  if(sum==0){
    printf("0\n");
    return 0;
  }
  printf("%d ",kosuu+migikosuu);
  if(migikosuu==0){
    for(i=0;i<kosuu-1;i++) printf("%d ",mensekigun[i]);
    printf("%d\n",mensekigun[kosuu-1]);
  }
  else{
    for(i=0;i<kosuu;i++) printf("%d ",mensekigun[i]);
    for(i=migikosuu-1;i>0;i--) printf("%d ",migimensekigun[i]);
    printf("%d\n",migimensekigun[0]);
  }
  return 0;
}

Measured memory_bytes: 584
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Solve{
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        int X = int.Parse(Console.ReadLine());
        int sum = 0;
        int i;
        for(i=0;;i++){
            if(sum >= X){
                break;
            }
            sum += i;
        }
        sb.Append((i-1)+"\n");
    }
}

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

int main() {
  int N, D = 0;
  cin >> N;
  for (int n = N; n != 0; n /= 10) {
    D += n % 10;
  }

  if (N % D == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define NL '\n'
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define sz(x) x.size()
#define all(x) (x).begin(), (x).end()
#define mem(a, b) memset(a, b, sizeof(a))
#define rep(ii,aa,bb) for(ll (ii)=ll(aa);(ii)<(ll)(bb);++(ii))
#define _fastIO() ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0)

//#define LOCAL
vector<string>vec_spltr(string s){s+=',';vector<string>res;while(!s.empty())
res.push_back(s.substr(0, s.find(','))),s=s.substr(s.find(',')+1);return res;}
void dbg_out(vector<string>__attribute__((unused))args,__attribute__((unused))int idx,
__attribute__((unused))int LINE_NUM){cerr<<endl;}template<typename Head,typename... Tail>
void dbg_out ( vector <string> args, int idx, int LINE_NUM, Head H, Tail... T)
{if(idx>0)cerr<<", ";else cerr << "Line(" << LINE_NUM << ") ";stringstream ss;ss<<H;
cerr<<args[idx]<<" = "<<ss.str();dbg_out(args,idx+1,LINE_NUM, T...);}
#ifdef LOCAL
#define debug(...) dbg_out(vec_spltr(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 6660999
#endif

void absinthe() {
    int n, mx = 1; cin >> n;
    vector<int>a(n+1), p(n+2), s(n+2);
    rep(i, 1, n+1) cin >> a[i];
    p[0] = 0, s[n+1] = 0;
    for(int i = 1; i <= n; i++) p[i] = __gcd(p[i-1], a[i]);
    for(int i = n; i > 0; i--) s[i] = __gcd(s[i+1], a[i]);
    for(int i = 1; i <= n; i++) mx = max(mx,__gcd(p[i-1], s[i+1]));
    cout << mx << NL;
}
 
int main(){
  _fastIO();
  int tx = 1; 
  //cin >> tx;
  while(tx--) absinthe();
} 

Measured memory_bytes: 1408
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static void Main()
    {
        Scanner cin = new Scanner();
        int N = cin.Int();
        long T = cin.Long();
        var t = cin.ArrayLong(N);

        long ans = 0;
        for(int i = 1; i <= N - 1; i++)
        {
            if (t[i] - t[i - 1] >= T) ans += T;
            else ans += t[i] - t[i - 1];
        }
        ans += T;

        Console.WriteLine(ans);
        Console.ReadLine();
    }
}

class Scanner //標準入力
{
    string[] s;
    int i;

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

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

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

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

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

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

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


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


Measured memory_bytes: 28700
#include <bits/stdc++.h>
using namespace std;
 
#define int long long 
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define bp __builtin_popcountll
#define f(i,l,n) for(int i=l;i<n;i++)
#define E "\n"
#define MOD  (int)(1e9+7)
#define float long double
 
const int N = 10000005;
int n;
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);srand(time(NULL));
 
int32_t main()
{


    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
 string s;
 cin >> s;
 f(i,0,s.size()) if(s[i]=='?') s[i]='D';
 cout<<s;
 return 0;
}

Measured memory_bytes: 3752
#include<iostream>
#include<map>
#include<algorithm>
#define M 20000
#define N 20001
using namespace std;
struct data{
	int t,s,d;
	bool operator<(const data &c)const{
		return t < c.t;
	}
};
int main(){
	while(true){
		int n,m;
		int ans=0;
		bool infected[N]={false,};
		data datas[M];
		scanf("%d%d", &n, &m);
		if(n==0&&m==0)
			break;
		for(int i=0;i<m;++i){
			scanf("%d%d%d", &datas[i].t, &datas[i].s, &datas[i].d);
		}
		sort(datas,datas+m);
		infected[1]=true;
		for(int i=0;i<m;++i){
			if( infected[datas[i].s] ){
				infected[datas[i].d]=true;
			}
		}
		for(int i=1;i<=n;++i){
			if( infected[i] )++ans;
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1136
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

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


    cout << N*(N+1)/2 << endl;
    
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int W = Integer.parseInt(sc.next());
		long[] weight = new long [110];
		long[] value = new long[110];
		long[][] dp = new long[110][100100];

		for (int i = 0; i < n; i++) {
			weight[i] = Long.parseLong(sc.next());
			value[i] = Long.parseLong(sc.next());
		}
		sc.close();

		for (int i = 0; i < n; i++) {
	        for (int sum_w = 0; sum_w <= W; sum_w++) {
	            // i 番目の品物を選ぶ場合
	            if (sum_w - weight[i] >= 0) {
	                dp[i+1][sum_w]=Math.max(dp[i+1][sum_w], dp[i][(int) (sum_w - weight[i])] + value[i]);
	            }
	            // i 番目の品物を選ばない場合
	            dp[i+1][sum_w] = Math.max(dp[i+1][sum_w], dp[i][sum_w]);
	        }
	    }
		System.out.println(dp[n][W]);
	}

}


Measured memory_bytes: 128084
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeMap;

public class Main {

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

		Map<Integer, Integer> countMap = ArrayUtils.getCountMap(a);
		List<Integer> list = new ArrayList<>();
		Set<Integer> set = countMap.keySet();
		int ans = 0;
		for (int x : set) {
			int cnt = countMap.get(x);
			if (cnt % 2 != 0) {
				ans++;
			}
		}
		System.out.println(ans);
	}

	static class ArrayUtils {
		public static Map<Integer, Integer> getCountMap(int[] array) {
			Map<Integer, Integer> map = new TreeMap<>();
			for (int x : array)
				map.merge(x, 1, Integer::sum);
			return map;
		}

	}
}



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

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

const long long MOD = 1000000007;

vector<set<int>> g(2*1e5);
vector<int> ans(2*1e5,1e6);
vector<bool> ck(2*1e5,true);
int n,m,a,b;

void bfs(){
  queue<int> que;
  que.push(0);
  while(que.size()){
    int a=que.front();que.pop();
    for(int b:g.at(a)){
      if(ck.at(b)){
        que.push(b);
        ck.at(b)=false;
        ans.at(b)=a;
      }
    }
  }
  return;
}

int main(){
  cin >> n >> m;
  rep(i,m){
    cin >> a >> b;
    a--;b--;
    g.at(a).insert(b);
    g.at(b).insert(a);
  }
  bfs();
  cout << "Yes" << endl;
  rep(i,n-1) cout << ans.at(i+1)+1 << endl;
}


Measured memory_bytes: 32460
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int x,y,s;
int a[15][15]={0};
int main()
{
    while(scanf("%d,%d,%d",&x,&y,&s)!=EOF)
    {
        swap(x,y);
        a[x][y]++;
        if(x>0)a[x-1][y]++;
        if(y>0)a[x][y-1]++;
        a[x+1][y]++;
        a[x][y+1]++;
        if(s>1)
        {
            if(x>0&&y>0)a[x-1][y-1]++;
            if(x>0)a[x-1][y+1]++;
            if(y>0)a[x+1][y-1]++;
            a[x+1][y+1]++;
        }
        if(s>2)
        {
            if(x>1)a[x-2][y]++;
            if(y>1)a[x][y-2]++;
            a[x+2][y]++;
            a[x][y+2]++;
        }
    }
    int ans=0,mx=0;
    for(int i=0;i<10;i++)
        for(int j=0;j<10;j++)
        {
            if(a[i][j]==0)ans++;
            if(a[i][j]>mx)mx=a[i][j];
        }
    cout<<ans<<endl<<mx<<endl;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL << 60;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main(){
    ll N, K;
    cin >> N >> K;
    vector<ll> h(110000);
    for (int i = 0; i < N; i++) cin >> h[i];
    vector<ll> dp(110000);
    for (int i = 0; i < 110000; i++) dp[i] = INF;
    dp[0] = 0;

    for (int i = 0; i < N; i++){
      for (int j = 1; j <= K; j++){
        chmin(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
      }
    }
    cout << dp[N-1] << endl;
    return 0;
}

Measured memory_bytes: 5112
/*input
4 2 8
*/
/**
    Author: Kristopher Paul
    Date Created: 07-07-2019
    Contest Name:
                _/    _/   _/_/_/_/   _/   _/_/_/_/
               _/  _/     _/    _/   _/   _/
              _/_/       _/_/_/_/   _/   _/_/_/_/
             _/  _/     _/  _/     _/         _/
            _/    _/   _/    _/   _/   _/_/_/_/
**/
#include<bits/stdc++.h>
#define ll long long
#define int ll
#define pb push_back
#define INF 0x3f3f3f3f //0x3f3f3f3f = 63
#define MOD 1000000007
#define mp make_pair
const double PI=3.141592653589793238462643383279502884197169399375105820974944;
#define REP(i,n) for (int i = 0; i < n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)
#define remax(a,b) a = max(a,b)
#define remin(a,b) a = min(a,b)
#define umap unordered_map
#define pii pair<int,int>
#define F first
#define S second
#define mii map<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define itr :: iterator it
#define all(v) v.begin(),v.end()
#define WL(t) while(t--)
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define out(x) cout << #x << " is " << x << endl
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;

int ModExp(int x,int y,int m){
    int res = 1;
    x = x % m;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % m;

        y = y>>1;
        x = (x*x) % m;
    }
    return res;
}

void solve(){
    int n,a,b;
    cin >> n >> a >> b;
    cout << min(a*n,b) << endl;
}

signed main(){
    FastIO;
    int t = 1;
//    cin >> t;
    WL(t){
        solve();
    }
}


Measured memory_bytes: 256
S = input()
K = int(input())

S_list = list(map(int, list(S)))
i = 0
while True:
  if S_list[i] == 1:
    i += 1
    if K == i:
      print(S_list[i-1])
      break
  else:
    if K == 1:
      print(S_list[i])
      break
    else:
      print(S_list[i])
      break
  

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

#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

using namespace std;

typedef long long LL;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "[ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "]";

    return os;
}

bool binary_search(const int key, const int* array, int start, int end){
    if (start > end) return false;

    int i = (end + start) / 2;

    if (array[i] == key) return true;
    else if(array[i] > key) return binary_search(key, array, start, i - 1);
    else return binary_search(key, array, i + 1, end);
}

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

    int n; cin >> n;
    int S[n];
    REP(i, n) {
        cin >> S[i];
    }

    int q; cin >> q;
    int T[q];
    REP(i, q) {
        cin >> T[i];
    }

    int cnt = 0;

    REP(i, q) {
        if (binary_search(T[i], S, 0, n-1)) ++cnt;
    }

    cout << cnt << endl;

}



Measured memory_bytes: 3680
#include <iostream>
using namespace std;
int main()
{
    int n,k;
    cin >> n >> k;
    for (int i=1;i<=n;i++)
    {
        int x;
        cin >> x;
    }
    if ((n-1)%(k-1)==0) cout << (n-1)/(k-1);
    else cout << (n-1)/(k-1)+1;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ASelectionOfParticipants solver = new ASelectionOfParticipants();
        solver.solve(1, in, out);
        out.close();
    }

    static class ASelectionOfParticipants {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            while (n != 0) {
                int[] a = new int[n];
                for (int i = 0; i < n; i++) {
                    a[i] = in.nextInt();
                }
                Arrays.sort(a);
                int abs = Integer.MAX_VALUE;
                for (int i = 1; i < n; i++) {
                    abs = Math.min(abs, a[i] - a[i - 1]);
                }
                out.println(abs);
                n = in.nextInt();
            }
        }

    }
}




Measured memory_bytes: 46856
# -*- coding: utf-8 -*-
import sys

N, *AB = map(int, sys.stdin.buffer.read().split())

A = sorted(AB[::2])
B = sorted(AB[1::2])

center = N//2

if N%2==1:
  print(B[center]-A[center]+1)
else:
  print((B[center]+B[center-1])-(A[center]+A[center-1])+1)

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

int A, B, C;

int main() {
    cin >> A >> B >>C;

    int bucket[10] = {0};
    bucket[A] += 1;
    bucket[B] += 1;
    bucket[C] += 1;

    string ans = "No";
    for (int i = 0; i < 10; ++i) {
        if (bucket[i] == 2) ans = "Yes";
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 888
//For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;

    int ar[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            int k;
            cin>>k;
            cout<<ar[k-1]<<endl;
        }
        return 0;
    }


Measured memory_bytes: 256
n, k = gets.chomp.split.map(&:to_i)
a = gets.chomp.split.map(&:to_i)
f = gets.chomp.split.map(&:to_i)

a.sort!
f.sort!.reverse!

def s(p, a, f, n, k)
  sum = 0
  n.times do |i|
    u = (a[i] - (p.to_f/f[i])).ceil
    sum += u if u > 0
  end
  return false if sum > k
  true
end

p (0..10**12).bsearch {|p| s(p, a, f, n, k) }


Measured memory_bytes: 34172
#include<bits/stdc++.h>
using namespace std;
long long a,b,c;
int main(){
	cin>>a>>b>>c;
	if(c<=a+b){
		cout<<"No";
		return 0;
	}
	if(4ll*a*b<(c-a-b)*(c-a-b)){
		cout<<"Yes";
		return 0;
	}
	cout<<"No";
	return 0;
	return 0;
}


Measured memory_bytes: 256
l,r = map(int,input().split())
if l - r >= 2019:
     print(0)
else:
     s = l % 2019

     if s + r - l >= 2019:
          print(0)
     else:
          ans=1000000000000
          for i in range(s,s + r - l):
               for j in range(i+1,s + r - l + 1):
                    ans =min(ans,(i*j)%2019)
                    
          print(ans)


Measured memory_bytes: 40812
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <unordered_map>
#include <map>
#include <cmath>
#include <bitset>
#include <queue>
#include <set>
#include <numeric>
#include <unordered_set>
#include <iomanip>
#include <string>

using namespace std;

typedef long long ll;
typedef long double ld;

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

	ll n;
	cin>>n;
	ll c=1,r=0;
	while (n){
		n>>=1;
		r+=c;
		c<<=1;
	}
	cout<<r;
}

Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n=sc.nextInt();
    Set<Long> set=new HashSet<>();
    for(int i=0;i<n;i++) {
    	long buff=sc.nextLong();
    	if(!set.add(buff)) {
    		set.remove(buff);
    	}
    }
    System.out.println(set.size());
  }
}


Measured memory_bytes: 62320
n = int(input())
s = list(str(input()))
s = [int(c) for c in s]

d = {}
for i, c in enumerate(s):
    if c not in d:
        d[c] = [i]
    else:
        d[c].append(i)
#print(d)

ans = 0
import bisect
for i in range(10):
    for j in range(10):
        for k in range(10):
            if i not in d or j not in d or k not in d:
                continue
            a = min(d[i])
            b = max(d[k])
            p = bisect.bisect_right(d[j], a)
            q = bisect.bisect_left(d[j], b)
            if q-p >= 1:
                ans += 1
                #print(i, j, k)
print(ans)


Measured memory_bytes: 42224
#include <stdio.h>

int main(void)
{
int C[3][3];
int a=0;
for(a=0;a<3;a++){
	scanf("%d %d %d",&C[a][0],&C[a][1],&C[a][2]);
}
if(C[0][0]+C[2][2]==C[2][0]+C[0][2]){
	if(C[0][0]+C[1][2]+C[2][1]==C[0][1]+C[1][0]+C[2][2]){
		if(C[0][0]+C[1][1]+C[2][2]==C[0][0]+C[1][2]+C[2][1]){
			printf("Yes\n");
		}else{
			printf("No\n");
		}
	}else{
		printf("No\n");
	}
}else{
	printf("No\n");
}
	return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<string>
#include<iostream>

using namespace std;
int a[200010];
int N,x;
int main(){
	scanf("%d%d",&N,&x);
	if (x==1 || x==2*N-1) {puts("No");return 0;}
	int a[2*N+2];
	a[N] = x;
	int step = N;
	for (int i=1;(i<=(2*N-1));i++){
		if (i==x) continue;
		if (step==1) break;
		a[--step]=i;
	}
	step = N;
	for (int i=(2*N-1);i>=1;i--){
		if (i==x) continue;
		if (step==2*N-1)break;
		a[++step]=i;
	}
	puts("Yes");
	for (int i = 1; i <=(2*N-1);i++)printf("%d\n",a[i]);
	


	return 0;
}

Measured memory_bytes: 2304
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>

#define rep(i, N) for(int (i) = 0; (i) < (N); (i) ++)
typedef long long ll;
using namespace std;

int main(){
    int N;
    int n_ten = 100;
    int ans = 0;
    cin >> N;
    rep(i, N){
        int s;
        cin >> s;
        if(s % 10){
            n_ten = min(n_ten, s);
        }
        ans += s;
    }

    if(n_ten == 100){
        ans = 0;
    }else if(ans % 10 == 0){
        ans -= n_ten;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
w = [input() for _ in range(n)]

ok = True
for i in range(len(w) - 1):
    if w[i][-1] != w[i + 1][0]:
        ok = False

if len(set(w)) != len(w):
    ok = False

print("Yes" if ok else "No")    


Measured memory_bytes: 3060
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second

ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s[ohara];
bool fl;
struct edge{int to,cost;};
double x[ohara];

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>n;
    rep(i,n)cin>>x[i]>>s[i];
    double yen=0.0,bi=0.0;
    rep(i,n){
        if(s[i]=="JPY")yen+=x[i];
        else bi+=x[i];
    }
    double ans=yen+380000.0*bi;
    printf("%.15f\n",ans);
    return 0;
}


Measured memory_bytes: 9728
using System;
using System.Collections.Generic;

namespace test
{
	class MainClass
	{
		public static void Main(string[] args)
		{
			string[] s = Console.ReadLine().Split(' ');
			int H = int.Parse(s[0]);
			int W = int.Parse(s[1]);
			char[,] c = new char[H + 2, W + 2];

			for (int i = 1; i < H + 1; i++)
			{
				char[] tmp = Console.ReadLine().ToCharArray();
				for (int j = 1; j < W + 1; j++)
				{
					c[i, j] = tmp[j - 1];
				}
				c[i, 0] = '.';
				c[i, W + 1] = '.';
			}
			for (int j = 0; j < W + 2; j++)
			{
				c[0, j] = '.';
				c[H + 1, j] = '.';
			}
			int h = 1;
			int w = 1;
			int[] dh = { 1, 0, -1, 0 };
			int[] dw = { 0, 1, 0, -1 };
			while (h != H || w != W)
			{
				c[h, w] = '.';
				if (c[h + dh[2], w + dw[2]] == '#')
				{
					Console.WriteLine("Impossible");
					break;
				}
				if (c[h + dh[3], w + dw[3]] == '#')
				{
					Console.WriteLine("Impossible");
					break;
				}
				if (c[h + dh[0], w + dw[0]] == '#' && c[h + dh[1], w + dw[1]] == '#')
				{
					Console.WriteLine("Impossible");
					break;
				}
				if (c[h + dh[0], w + dw[0]] == '#')
				{
					h += dh[0];
					w += dw[0];
					continue;
				}
				if (c[h + dh[1], w + dw[1]] == '#')
				{
					h += dh[1];
					w += dw[1];
					continue;
				}
			}
			if (h == H && w == W)
			{
				if (c[h + dh[2], w + dw[2]] == '#')
				{
					Console.WriteLine("Impossible");
				}
				else if (c[h + dh[3], w + dw[3]] == '#')
				{
					Console.WriteLine("Impossible");
				}
				else
					Console.WriteLine("Possible");
			}
		}
	}
}


Measured memory_bytes: 2648
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
typedef vector<vector<int>> Graph;
const int inf = 1e9;
const int mod = 1e9 + 7;

class SCC {
private:
    const int n;
    VV G;
    VV rG;
    V vs;
    vector<bool> used;
    V cmp;
public:
    SCC(int _n) : n(_n), G(_n), rG(_n), used(_n), cmp(_n) {}
    void addEdge(int from, int to) {
        G[from].emplace_back(to);
        rG[to].emplace_back(from);
    }
    void dfs(int v) {
        used[v] = true;
        for (auto&& nxt : G[v]) {
            if (!used[nxt]) dfs(nxt);
        }
        vs.emplace_back(v);
    }
    void rdfs(int v, int k) {
        used[v] = true;
        cmp[v] = k;
        for (auto&& nxt : rG[v]) {
            if (!used[nxt]) rdfs(nxt, k);
        }
        vs.emplace_back(v);
    }
    int scc() {
        rep(v, n) {
            if (!used[v]) dfs(v);
        }
        used.assign(n, false);
        int k = 0;
        for (int i = vs.size() - 1; i >= 0; i--) {
            int v = vs[i];
            if (!used[v]) rdfs(v, k++);
        }
        return k;
    }
    bool same(int a, int b) {
        return cmp[a] == cmp[b];
    }
};


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

    int N, M;
    cin >> N >> M;
    SCC scc(N);
    rep(i, M) {
        int s, t;
        cin >> s >> t;
        scc.addEdge(s, t);
    }

    scc.scc();

    int Q;
    cin >> Q;
    rep(i, Q) {
        int u, v;
        cin >> u >> v;
        cout << scc.same(u, v) << endl;
    }

}

Measured memory_bytes: 4704
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end()) 
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

typedef long long ll;

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; }
const int INF = 1001001001;
const long long INFL = (1LL<<60);
const double eps = (1e-9);


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

  ll h, n;
  cin >> h >> n;

  vector<vector<ll>> dp(n+5, vector<ll>(h+5, INF));

  for (int i = 1; i <= n; i++) {
    int a, b;
    cin >> a >> b;
    dp[i][0] = 0;
    for (int j = 1; j <= h; j++) {
      ll tmp = INF;
      if (j - a >= 0) {
        tmp = dp[i][j - a] + b;
      } else {
        tmp = (j / a) * b;
        if (j % a != 0) tmp += b;
      }
      dp[i][j] = min(dp[i-1][j], tmp);
    }
  }

  cout << dp[n][h] << endl;

  return 0;
}


Measured memory_bytes: 78976
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int w, a, b;

signed main() {
	cin >> w >> a >> b;
	cout << max(0, abs(a-b)-w) << ln;
}

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

int main(){
    string s, ans;
    int n;
    cin >> n >> s;
    char abc[26] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
    vector<char> a;
    rep(i, 26)a.push_back(abc[i]);
    rep(i, 26)a.push_back(abc[i]);
    rep(i, s.size()){
        rep(j, 26){
            if(s[i] == a[j]){
                ans += a[j+n];
            }
        }
    }
    cout << ans;
}   


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

using namespace std;
typedef long long ll;

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

  int a, b, c, d;
  cin >> a >> b >> c >> d;

  int left = a + b, right = c + d;

  if (left > right) cout << "Left" << "\n";
  else if (left < right) cout << "Right" << "\n";
  else cout << "Balanced" << "\n";
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define FOR(i, a, b) for (int i=(a); i<(b); ++i)
#define ROF(i, b, a) for (int i=(b); i>(a); --i)
#define CASET int _T; cin >> _T; FOR(caset, 0, _T)
#define vi vector<int>
#define vb vector<bool>
#define vs vector<string>
#define vvi vector<vi>
#define vvb vector<vb>
#define pii pair<int,int>
#define t3i tuple<int,int,int>
#define mii map<int,int>
#define vpii vector<pii>
#define vt3i vector<t3i>
#define sq(x) (x)*(x)
#define inv(x) powa(x, MOD-2)
 
long long INF = 1LL<<60;
long long MOD = 1e9+7;
 
template <typename A, typename B> istream &operator>>(istream &is, pair<A, B> &pr) {is >> pr.first >> pr.second; return is;}
template <typename A> istream &operator>>(istream &is, vector<A> &v) {for (auto &x : v) is >> x; return is;}
ostream &operator<<(ostream &os, char &c) {os << (char)c; return os;}
ostream &operator<<(ostream &os, const char s[]) {os << (string)s; return os;}
ostream &operator<<(ostream &os, string &s) {for (char &c : s) os << (char)c; return os;}
template <typename A, typename B> ostream &operator<<(ostream &os, pair<A, B> &pr) {os << '(' << pr.first << ", " << pr.second << ')'; return os;}
ostream &operator<<(ostream &os, vb &v) {
    bool first = true;
    os << '[';
    for (const bool &x : v) {
        if (!first) os << ", ";
        first = false;
        os << x;
    }
    os << ']';
    return os;
}
template <class C> ostream &operator<<(ostream &os, C &v) {
    bool first = true;
    os << '[';
    for (auto &x : v) {
        if (!first) os << ", ";
        first = false;
        os << x;
    }
    os << ']';
    return os;
}
int powa(int base, int exp) {
    int res = 1;
    while (exp) {
        if (exp&1) res = res*base % MOD;
        base = base*base % MOD;
        exp >>= 1;
    }
    return res;
}

main() {
    ios::sync_with_stdio(0), cin.tie(0);
    
    string s;
    cin >> s;
    int n = s.size();
    vi a(n);
    FOR(i, 0, n) a[i] = s[i]-'0';

    auto f = [&](int x) {
        return min(x, 11-x);
    };

    vvi dp(n, vi(2, INF));
    dp[n-1][0] = f(a[n-1]);
    dp[n-1][1] = f(10-a[n-1]);
    ROF(i, n-2, -1) {
        FOR(flip, 0, 2) {
            int ths = flip ? 9-a[i] : a[i];
            dp[i][flip] = min(f(ths) + dp[i+1][flip], f(ths+1) + dp[i+1][!flip]);
            // string q = s.substr(i);
            // if (flip) {
            //     FOR(i, 0, q.size()-1) q[i] = '0' + (9-(q[i]-'0'));
            //     q.back() = '0' + (10 - (q.back()-'0'));
            // }
            // cout << i << ' ' << flip << ' ' << q << " takes " << dp[i][flip] << '\n';
        }
    }
    cout << dp[0][0];
}

Measured memory_bytes: 63772
#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
    int a,b;
    while(scanf("%d%d",&a,&b)==2){
            if(a>=1&&a<=9&&b>=1&&b<=9)
                printf("%d\n",a*b);
    else{
        printf("-1");
        
    }
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-10;

int main(){
    int N; ll A, B;
    cin >> N >> A >> B;
    ll H[N];
    rep(i, N) cin >> H[i];
    ll l = -1, r = 1e10;
    while(r-l > 1){
        ll n = (l+r)/2;
        ll sum = 0;
        rep(i, N){
            if(n*B > H[i]) continue;
            sum += (H[i]-n*B+A-B-1)/(A-B);
        }
        if(sum <= n) r = n;
        else l = n;
    }
    cout << r << endl;
}

Measured memory_bytes: 1024
#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 1e9

int n,score[111],ave;

void solve(){
  ave = 0;
  cin>>n;

  if(n == 0) exit(0);

  REP(i,n){
    cin>>score[i];
  }

  sort(score,score+n);

  FOR(i,1,n-1){
    ave += score[i];
  }
  ave /= (n-2);

  cout<<ave<<endl;
}


int main(){

  while(1){
    solve();
  }

  return 0;
}


Measured memory_bytes: 3044
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main(void){

    int trial_num,tmp_1,tmp_2;
    vector<int> pv,sv;
    string ans ="No";
    
    cin >> trial_num;
    
    for(int i =0; i<trial_num; i++){
        cin >> tmp_1 >> tmp_2;
        pv.push_back(tmp_1);
        sv.push_back(tmp_2);
    }
    
    for(int i =2; i<trial_num; i++){
        if(pv[i-2]==sv[i-2]&&pv[i-1]==sv[i-1]&&pv[i]==sv[i]){
            ans = "Yes";
            break;
        }
    }

    cout << ans << endl;
    
}

Measured memory_bytes: 3628