akhauriyash/Code-Regression huggingface dataset:
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 1ll<<61;
const long double pi = 3.1415926535897932384626433;
typedef pair<int, int> P;
typedef pair<int, P> PP;
struct edge { int to, cost; };
int a[8005];
int dat[280005], sdat[280005];

int N;
void init(int n_) {
	N = 1;
	while (N < n_)N *= 2;
	for (int i = 0; i < 2 * N - 1; i++) {
		dat[i] = inf;
	}
}

void update(int k, int a) {
	k += N - 1;
	dat[k] = a;
	while (k > 0) {
		k = (k - 1) / 2;
		dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);
	}
}
int query(int a, int b, int k, int l, int r) {
	if (r <= a || b <= l)return inf;
	if (a <= l&&r <= b)return dat[k];
	else {
		int vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
		int vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
		return min(vl, vr);
	}
}

signed main() {
	int n, x; cin >> n >> x;
	rep(i, n)cin >> a[i];
	rep(i, n)a[i + n] = a[i];
	n += n;
	int ans = inf;
	init(n);
	rep(i, n)update(i, a[i]);

	for (int k = 0; k < n/2; k++) {
		int sum = 0;
		for (int i = n / 2; i < n; i++) {
			int s = i - k, t = i;
			sum += query(s, t+1, 0, 0, N);
		}
		ans = min(ans, sum + k*x);
	}
	cout << ans << endl;
}

Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define rfore(i,a,b) for(ll i=(ll)(b);i>=(ll)(a);--i)
#define rrep(i,n) rfore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}

void solve(){
    ll n;cin>>n;
    ll t=1;
    while(t*(t-1)/2<n)t++;
    if(t*(t-1)/2!=n){
        cout<<"No"<<endl;
        return;
    }

    ll idx=1;
    vvl ans(t);
    rep(i,n){
        fore(j,i+1,t-1){
            ans[i].push_back(idx);
            ans[j].push_back(idx);
            idx++;
        }
    }
    cout<<"Yes"<<endl;
    cout<<t<<endl;
    rep(i,t){
        cout<<t-1;
        rep(j,t-1)cout<<" "<<ans[i][j];
        cout<<endl;
    }
}

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


Measured memory_bytes: 3200
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int d = sc.nextInt();
		int[] c = new int[26];
		for (int i = 0; i < 26; i++) {
			c[i] = Integer.parseInt(sc.next());
		}

		int[][] s = new int[d][26];
		for (int i = 0; i < d; i++) {
			for (int j = 0; j < 26; j++) {
				s[i][j] = Integer.parseInt(sc.next());
			}
		}

		int[] ans = new int[d];
		int[] e = new int[26];
		for (int i = 0; i < 26; i++) {
			e[i]++;
		}

		for (int i = 0; i < d; i++) {
			int max = -10000000;
			for (int j = 0; j < 26; j++) {
				int f = 0;
				for (int k = 0; k < 26; k++) {
					if (k!=j) {
						f-= c[k] * e[k];
					}
				}
				if(max<s[i][j]+f) {
					max = s[i][j]+f;
					ans[i] = j;
				}
			}
			e[ans[i]] = 1;
			for (int j = 0; j < 26; j++) {
				if (ans[i] != j)
					e[j]++;
			}
		}

		for (int i = 0; i < d; i++) {
			System.out.println(ans[i] + 1);
		}
	}

}


Measured memory_bytes: 42980
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

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

    int n; cin >> n;
    vector<int> x(n), y(n);
    REP(i, n) cin >> x[i] >> y[i];

    vector<int> town;
    REP(i, n) town.push_back(i);

    int tmp = n;
    int sum = 1;
    while (tmp != 1) {
        sum *= tmp;
        tmp--;
    }

    double dist = 0.0;
    REP(i, sum) {
        REP(j, n - 1)
            dist += hypot(x[town[j]] - x[town[j + 1]], y[town[j]] - y[town[j + 1]]);
        next_permutation(town.begin(), town.end());
    }

    dist /= sum;

    printf("%.10f\n", dist);
    return 0;
}


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

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD (ll)1000000007
#define P pair<ll, ll>


ll n, k;
string s;
int main() {
	cin >> n >> k >> s;
	s[k - 1] = s[k - 1] - 'A' + 'a';
	cout << s << endl;
}

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

using namespace std;
using ll = long long;

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

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

  int ans = n;
  rep(i, n - 1) {
    if (s[i + 1] == s[i]) {
      --ans;
    }
  }

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


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>

using namespace std;
using boost::irange;
typedef long long ll;
const ll mod = 1e9 + 7;

int main() {
    int x, a, b;
    cin >> x >> a >> b;
    if (abs(x - a) > abs(x - b)) {
        cout << "B"s << endl;
    } else {
        cout << "A"s << endl;
    }
    return 0;
}

Measured memory_bytes: 256
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input, "index" : 0, "max" : input.length,
  "hasNext" : function(){return (this.index < this.max);},
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  }
}
Main();
function next(){return obj.next();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var one = nextIntArray();
  var x = one[0];
  var y = one[1];
  myout(x + (y / 2));
}

Measured memory_bytes: 11468
#include <iostream>
using namespace std;
int main()
{
  int n;
  cin >> n;
  bool seven = false;
  while (n)
  {
    if (n%10 == 7)
      seven = true;
    n /= 10;
  }
  if (seven)
    cout << "Yes\n";
  else 
    cout << "No\n";
  return 0;
}

Measured memory_bytes: 3592
def Binary_Search_Big_Count(A,x,equal=False,sort=False):
    """2分探索によって,xを超える要素の個数を調べる.

    A:リスト
    x:調べる要素
    sort:ソートをする必要があるかどうか(Trueで必要)
    equal:Trueのときはx"を超える"がx"以上"になる
    """

    if sort:
        A.sort()

    if A[-1]<x or ((not equal) and A[-1]==x):
        return 0

    L,R=-1,len(A)-1
    while R-L>1:
        C=L+(R-L)//2
        if A[C]>x or (equal and A[C]==x):
            R=C
        else:
            L=C
    return len(A)-R

def Binary_Search_High_Value(A,x,equal=False,sort=False):
    """Aのxを超える要素の中で最小のものを出力する.

    A:リスト
    x:調べる要素
    sort:ソートをする必要があるかどうか(Trueで必要)
    equal:Trueのときはx"を超える"がx"以上"になる
    ※全ての要素がx以上(超える)場合はNoneが返される.
    """

    if sort:
        A.sort()

    K=Binary_Search_Big_Count(A,x,equal=equal,sort=False)
    if K:
        return A[-K]
    else:
        return None
#================================================
S=input()
T=input()

N=len(S)

if not(set(S)>=set(T)):
    print(-1)
    exit()

D={x:[] for x in set(S)}

for i in range(N):
    D[S[i]].append(i)


X=0
A=-1
for t in T:
    P=Binary_Search_High_Value(D[t],A)

    if P==None:
        X+=1
        A=D[t][0]
    else:
        A=P

print(N*X+A+1)

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

int main() {
    int n;
    cin >> n;
    double sum = 0;
    rep(i,n) {
        int a;
        cin >> a;
        sum += 1.0/a;
    }
    printf("%.10f\n", 1/sum);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#define DIM 100005
using namespace std;
int n, m, i, x, y, nr, nrc, nrb, minim, j, nra;
long long sol;
int viz[DIM], num[DIM], ok[DIM], c[DIM], s[DIM];
vector<int> v[DIM];
void dfs(int nod){
    viz[nod] = 1;
    c[nod] = nr;
    num[nr]++;
    for(int i = 0; i < v[nod].size(); i++){
        int vecin = v[nod][i];
        if(viz[vecin] == 0){
            s[vecin] = 1 - s[nod];
            dfs(vecin);
        }
        else{
            if(s[vecin] != 1 - s[nod]){
                ok[nr] = 0;
            }
        }
    }
}
int main(){
    cin>> n >> m;
    for(i = 1; i <= m; i++){
        cin>> x >> y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    for(i = 1; i <= n; i++){
        if(viz[i] == 0){
            nr++;
            ok[nr] = 1;
            dfs(i);
        }
    }
    for(i = 1; i <= nr; i++){
        viz[i] = 0;
        if(num[i] == 1){
            nra++;
            nrb++;
            nrc++;
        }
        else{
            nrb++;
            nrc++;
            if(ok[i] == 1){
                nrb++;
            }
        }
    }
    for(i = 1; i <= n; i++){
        if(num[ c[i] ] == 1){
            sol += n;
            continue;
        }
        if(viz[ c[i] ] == 1){
            sol += nra;
        }
        else{
            viz[ c[i] ] = 1;
            if(ok[ c[i] ] == 0){
                sol += nrc;
            }
            else{
                sol += nrb;
            }
        }
    }
    cout<< sol <<"\n";
}


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

const int MAX = 10000000;
const int MOD = 1e9 + 7;
int64_t fac[MAX] = {}, inv[MAX] = {}, finv[MAX] = {};

void make_table() {
  fac[0] = 1; fac[1] = 1;
  finv[0] = 1; finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; ++i) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

int64_t com(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


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

  int X, Y;
  cin >> X >> Y;
  if((X+Y)%3 != 0){
    cout << 0 << endl;
    return 0;
  }

  make_table();
  if((2*Y - X) >= 0 && (2*Y - X) % 3 == 0 && (2*X - Y) >= 0 && (2*X - Y) % 3 == 0){
    int a, b;
    a = (2*Y-X)/3;
    b = (2*X-Y)/3;
    int64_t ans;
    ans = com(a+b, b);
    cout << ans << endl;
  }
  else{
    cout << 0 << endl;
  }

  
}

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

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

  int sum = 0;
  for (int i = 0; i < N-1; i++) {
    while (S[i] == S[i+1]) {
      i++;
    }
    sum++;
  }

  if (S[N-2] != S[N-1]) {
    sum++;
  }

  cout << sum << endl;
}


Measured memory_bytes: 512
#pragma GCC optimize("O3")

#include <iostream>
#include <algorithm>
#include <vector>
#include <cassert>
#include <cstring>
#include <numeric>
#include <set>
#include <queue>
#include <deque>
#include <array>
#include <string>
#include <cmath>
#include <random>
#include <ctime>
#include <map>
#include <functional>
#include <bitset>
#include <complex>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>

#define sz(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()
#define pb push_back

using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using ld = long double;

int32_t main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

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

	vector<vi> par(2);

	par[a & 1].pb(a);
	par[b & 1].pb(b);
	par[c & 1].pb(c);

	int ans = 0;

	for (int i = 0; i < 2; i++) {

		if (1 < sz(par[i]) && sz(par[i]) < 3) {

			ans++;
			par[i][0]++;
			par[i][1]++;
		}
	}

	vi kek;
	for (auto v : par) {
		for (auto e : v) {
			kek.pb(e);
		}
	}

	sort(all(kek));
	ans += (kek[2] - kek[0]) / 2;
	ans += (kek[2] - kek[1]) / 2;

	cout << ans;
}


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


int main() {
	int N;
	cin >> N;
	vector<int> A(N+1);
	vector<int> B(N);

	long counter = 0;

	for (int i = 0; i < N + 1; i++) {
		cin >> A[i];
	}
	for (int i = 0; i< N; i++) {
		cin >> B[i];
	}
	for (int i = 0; i < N; i++) {
		if (A[i] >= B[i]) {
			counter += B[i];
			A[i] -= B[i];
			B[i] = 0;
		}
		else
		{
			counter += A[i];
			B[i] -= A[i];
			A[i] = 0;
		}

		if (A[i+1] >= B[i]) {
			counter += B[i];
			A[i+1] -= B[i];
			B[i] = 0;
		}
		else
		{
			counter += A[i+1];
			B[i] -= A[i+1];
			A[i + 1] = 0;
		}
			
		
	}


	cout << counter << endl;
}


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

struct UnionFind{
  vector<long long> par;
 
  UnionFind(int n){
    par.assign(n,-1);
  }
 
  void unite(long long x, long long y){
    x=root(x);y=root(y);
    if(x==y) return;
 
    if(par[x]>par[y]){
      swap(x,y);
    }
    par[x]+=par[y];
    par[y]=x;
  }
 
  long long root(long long x){
    if(par[x]<0){
      return x;
    }else{
      return par[x]=root(par[x]);
    }
  }

  int size(long long x) {
    return -par[root(x)];
  }

  bool same(long long x, long long y){
    return root(x)==root(y);
  }
};

int main(){
  long long n,m,x,y,z,ans=0;
  cin >> n >> m;
  UnionFind uf(n);
  for(int i=0;i<m;i++){
    cin >> x >> y >> z;
    x--;y--;
    uf.unite(x,y);
  }
  map<int, int> mp;
  for(int i=0;i<n;i++){
    if(mp[uf.root(i)]==0){
      mp[uf.root(i)]++;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
 
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<ll, ll> pii;
 
#define REP(a,b,c) for(ll (a)=(b);(a)<(c);(a)++)
#define PER(a,b,c) for(ll (a)=(b);(a)>=(c);(a)--)
 
void ii(ll &x){ cin >> x; }
void is(string &x){ cin >> x; }
void oi(ll x){ cout << x << " "; }
void os(string x){ cout << x; }
void oie(ll x){ cout << x << endl; }
void ose(string x){ cout << x << endl; }
void oe(){ cout << endl; }

int main(){
    ll L;
    ii(L);
    cout << std::fixed << std::setprecision(10) << (long double)L*L*L/27.0 <<endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 5000005
using namespace std;
long long a[N],r[N],l[N],n,x;
int main()
{
	scanf("%lld",&n); for (int i=1;i<=n;i++) scanf("%lld",&a[i]);
	l[n+1]=2; r[n+1]=2;
	for (int i=n;i;i--){
		//l[i]=(l[i+1]/a[i])*a[i];
		long long x=l[i+1]/a[i]; if (l[i+1]%a[i]) x++; l[i]=x*a[i];
		r[i]=(r[i+1]/a[i])*a[i]+a[i]-1;
	}
	if (l[1]>r[1]) puts("-1"); else printf("%lld %lld",l[1],r[1]);
	return 0;
}

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

int main() {
    int n;
    
    cin >> n;
    
    int v[n] = {};
    int c[n] = {};
    int d[n] = {};
    int net  = 0;

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

    for(int i = 0; i < n; i++) {
        d[i] = v[i] - c[i];
    }

    for(int i = 0; i < n; i++) {
       if(d[i] > 0 ) {
           net += d[i];
       }
    }
    
    cout << net << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;

int n;

signed main(){
    int t[10010];    
    int ans = 0;
    while(1){
        cin >> n;
        if(n == 0) break;
        rep(i, 0, n) cin >> t[i];
        sort(t, t + n);
        rep(i, 0, n){
            ans += t[i] * (n - 1 - i);
        }
        cout << ans << endl;
        ans = 0;
    }

}

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

#define dbg(a)  cerr << __LINE__ << ": " << #a << " = " << a << '\n'

typedef long long ll;

int main(){
  ios::sync_with_stdio(0), cin.tie(0);
  
  int x;  cin >> x;
  cout << (x^1) << endl;
  return 0;
}

Measured memory_bytes: 3636
s = input()
k = int(input())

list_sub = []
for i in range(len(s)):
  temp = [s[i:i+j] for j in range(1, min(len(s)-i+1, k+1))]
  list_sub += temp

list_sub = list(set(list_sub))
list_sub.sort()

print(list_sub[k-1])

Measured memory_bytes: 5048
import java.util.*;
 
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int x1 = sc.nextInt(), y1 = sc.nextInt(),
            x2 = sc.nextInt(), y2 = sc.nextInt();
        int x = x2 - x1, y = y2 - y1;
        int x3 = x2 - y, y3 = y2 + x,
            x4 = x1 - y, y4 = y1 + x;
        System.out.println(x3 + " " + y3 + " " +
                            x4 + " " + y4);
    }
}

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

int main() {
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	vector<int> sum(n + 1);
	for (int i = 1; i <= n; ++i)
		sum[i] = sum[i - 1] + a[i - 1];
	int mx_sum = 0;
	for (int i = k; i <= n; ++i)
		mx_sum = max(mx_sum, sum[i] - sum[i - k]);
	cout << fixed;
	cout.precision(9);
	cout << (mx_sum + k) / 2. << '\n';
	return 0;
}


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

using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()
#define debug(x) cerr << #x << " : " << x << endl

template<class T> bool set_min(T &a, const T &b) { return a > b  ? a = b, true : false; }
template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }
// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << "\t" << t; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << "<" << v.first << ", " << v.second << ">"; }

const int INF = 1 << 30;
const ll INFL = 1LL << 60;

//union find tree
//test : DSL_1_A: Disjoint Set: Union Find Tree : AC  : 2015/11/27

struct UnionFind{
    int n;
    vector<int> p;
    vector<int> group_size;
    ll inconvenience;
    UnionFind(int n) : n(n), inconvenience((ll)n * (n - 1) / 2) {
        p.resize(n);
        group_size.resize(n);
        rep(i, n) p[i] = i;
        rep(i, n) group_size[i] =1;
    }
    int root(int x){
        if(p[x] == x) return x;
        else return p[x] = root(p[x]);
    }
    void unite(int x,int y){
        x = root(x);
        y = root(y);
        if(x != y) {
            inconvenience -= (ll)group_size[y] * (n - group_size[y]);
            inconvenience -= (ll)group_size[x] * (n - group_size[x]);
            inconvenience += (ll)group_size[y] * group_size[x];
            p[y] = x;
            group_size[x] += group_size[y];
            group_size[y] = 0;
            inconvenience += (ll)group_size[x] * (n - group_size[x]);
        }
    }
    bool query(int x,int y){
        return root(x) == root(y);
    }
};

int main() {
    int N, M; cin >> N >> M;
    vector<int> A(M), B(M);
    rep(i, M) cin >> A[i] >> B[i];

    UnionFind uf(N);

    vector<ll> ans(M);

    for(int i = M - 1; i >= 0; i--) {
        ans[i] = uf.inconvenience;
        uf.unite(A[i] - 1, B[i] - 1);
    }
    cerr << uf.inconvenience << endl;
    rep(i, M) cout << ans[i] << endl;

    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Graph vector<vector<int>>
typedef long long ll;
const int INF = 1000000007;

// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision;
// using Bint = mp::cpp_int;
// using Real = mp::number<mp::cpp_dec_float<1024>>;

int main(){
    int N, M;
    cin >> N >> M;
    if(abs(N - M) > 1) cout << 0 << endl;
    else{
        ll ans = 1;
        for(int i = 1; i <= N; i++){
            ans = (ans * i) % INF;
        }
        for(int i = 1; i <= M; i++){
            ans = (ans * i) % INF;
        }
        if(N == M) ans = (ans * 2) % INF;
        cout << ans << endl;
    }
}

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

int main(void)
{
  int N;
  cin >> N;
  if(N%10 == 3){
    cout << "bon" << endl;
  }
  else if (N % 10 == 0 || N % 10 == 1 || N % 10 == 6 || N % 10 == 8){
    cout << "pon" << endl;
  }
  else{
    cout << "hon" << endl;
  }
  return 0;
}

Measured memory_bytes: 3592
#create date: 2020-06-29 09:33

import sys
stdin = sys.stdin


def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def f(n):
    res = str()
    while n:
        m = (n-1) % 26
        n = (n-1) // 26
        res = chr(ord("a") + m) + res
    return res

def main():
    n = ni()
    print(f(n))

if __name__ == "__main__":
    main()

Measured memory_bytes: 9156
#include <iostream>

using namespace std;
int main(int argc, char *argv[]) {
	int a, b;
	cin >> a >> b;
	
	double k = abs(a - b) / 2.0;
	if (k - (int)k > 0) {
		cout << "IMPOSSIBLE" << endl;
	} else {
		if (a > b) {
			cout << a - (int)k << endl;
		} else {
			cout << b - (int)k << endl;
		}
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int n, t;
  cin >> n >> t;
  vector<int> a(n);
  REP(i,n) cin >> a[i];
  
  int min_a = a[0];
  int max_got = 0;
  int got_cnt = 1;
  FOR(i,1,n){
    if(a[i]-min_a > max_got){
      max_got = a[i]-min_a;
      got_cnt = 1;
    }else if(a[i]-min_a==max_got) got_cnt++;
    
    min_a = min(min_a, a[i]);
  }
  cout << got_cnt << '\n';
  
}

Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <string>
#include <bits/stdc++.h>

using namespace std;

int main()
{
      int n,c=0;cin>>n;int a[n][2];
      for(int i=0;i<n;i++)
      {
       cin>>a[i][0]>>a[i][1];   
      }
      for(int i=0;i<n-2;i++)
      {
          if(a[i][0]==a[i][1]&& a[i+1][0]==a[i+1][1] && a[i+2][0]==a[i+2][1])
          {
              c=1;
              cout<<"Yes";break;
          }
          
      }
      if(c==0)
      cout<<"No";
     
}



 

Measured memory_bytes: 3644
import sys
input = sys.stdin.readline

X, Y, A, B, C = map(int, input().split())
p = sorted(map(int, input().split()), reverse=True)
q = sorted(map(int, input().split()), reverse=True)
r = sorted(map(int, input().split()), reverse=True)

pq = p[:X] + q[:Y]
if len(pq) < X + Y:
    pq += [0] * (X + Y - len(pq))
pq.sort()
for i in range(min(C, len(pq))):
    if pq[i] < r[i]:
        pq[i] = r[i]
print(sum(pq))

Measured memory_bytes: 92516
#include<bits/stdc++.h>
using namespace std;
const int N=105,K=100005;
int a[N],dp[K];
vector<int>q;
int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	for(int i=0;i<a[1];i++)
		dp[i]=0;
	for(int i=a[1];i<=k;i++)
	{
		for(int j=1;j<=n;j++)
			if(i>=a[j]&&!dp[i-a[j]])
				dp[i]=1;
		
	}
	puts(dp[k]?"First":"Second");
	return 0;
}


Measured memory_bytes: 640
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n,m,r=map(int,input().split())
rlst=list(map(int,input().split()))
abc=[list(map(int,input().split())) for i in range(m)]

def warshall_floyd(d):
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

n,w = n,m #n:頂点数　w:辺の数

d = [[float("inf") for i in range(n)] for i in range(n)] 
#d[u][v] : 辺uvのコスト(存在しないときはinf)
for i in range(w):
    x,y,z = abc[i]
    x-=1
    y-=1
    d[x][y] = z
    d[y][x] = z
for i in range(n):
    d[i][i] = 0 #自身のところに行くコストは０
lst=warshall_floyd(d)
# print(lst)
pro=list(permutations(range(r)))
# print(pro)
ans=float('inf')
for i in pro:
    tmp=0
    for j in range(r-1):
        now=i[j]
        nxt=i[j+1]
        tmp+=lst[rlst[now]-1][rlst[nxt]-1]
    ans=min(ans,tmp)
print(ans)

Measured memory_bytes: 78368
#include<iostream>
#include<algorithm>
 
using namespace std;
 
int main() {
	int n, a[100];
	int al = 0;
	cin >> n;
	for (int i = 0;i < n;i++) {
		cin >> a[i];
		al += a[i];
	}
	sort(a, a+n);
	for (int i = n-2;i >= 0;i-=2) {
		al -= 2*a[i];
	}
	cout << al << endl;
	return 0;
}

Measured memory_bytes: 256
a,b=map(int,input().split())
if a%2==0 and b%2==0:
  if (b-a)%4==0:
    print(b)
  else:
    print(b^1)
elif a%2==0:
  if (b-a)%4==1:
    print(1)
  else:
    print(0)
elif b%2==0:
  if (b-a)%4==1:
    print(a^b)
  else:
    print(a^b^1)
else:
  if (b-a)%4==0:
    print(a)
  else:
    print(a^1)

Measured memory_bytes: 9168
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int D, C;
	cin >> D >> C;

	cout << D * C << endl;
	return 0;
}




Measured memory_bytes: 3212
#include <iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<numeric>
#define rt "\n"//改行を最速化させるよ
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define cncn int cnt=0
#define smsm int sum=0
#define str srting
#define v vector
#define please return
#define AC 0//おまじないだよ
#define Rapid cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
int main() {
	long long  a[3][3] = {0}, b = 1, c = 0, x = 0, max = 0, dig = 0, ans = 0;
	long long  n = 0, k = 0, nc = 0;
	long long left = 0, right = 0;
	string s, t, u,now;
	vector<double> z, zz,count,countc;
	vector<string>ss;
	vector<long long int>::iterator position;
	bool q = false;
	vector<vector<bool>>counter(3,vector<bool>(3,false));
	for (int i = 0; i < 9; i++) {
		cin >> b;
		count.push_back(b);
	}
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> b;
		z.push_back(b);
	}
	for (int i = 0; i < 9; i++) {
		for(int j=0;j<n;j++)
		if (z.at(j) == count.at(i)) {
			counter.at(i / 3).at(i % 3) = true;
		}
	}
	if (counter.at(0).at(0) == true && counter.at(0).at(1) == true && counter.at(0).at(2) == true)cout << "Yes" << endl;
	else if (counter.at(1).at(0) == true && counter.at(1).at(1) == true && counter.at(1).at(2) == true)cout << "Yes" << endl;
	else if (counter.at(2).at(0) == true && counter.at(2).at(1) == true && counter.at(2).at(2) == true)cout << "Yes" << endl;
	else if (counter.at(0).at(0) == true && counter.at(1).at(1) == true && counter.at(2).at(2) == true)cout << "Yes" << endl;
	else if (counter.at(2).at(0) == true && counter.at(1).at(1) == true && counter.at(0).at(2) == true)cout << "Yes" << endl;
	else if (counter.at(0).at(0) == true && counter.at(1).at(0) == true && counter.at(2).at(0) == true)cout << "Yes" << endl;
	else if (counter.at(0).at(1) == true && counter.at(1).at(1) == true && counter.at(2).at(1) == true)cout << "Yes" << endl;
	else if (counter.at(0).at(2) == true && counter.at(1).at(2) == true && counter.at(2).at(2) == true)cout << "Yes" << endl;
	else cout << "No" << endl;
	please AC;
}

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

int min(int a, int b, int c, int d) {
    int array[4] = {a, b, c, d, };
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3 - i; j++) {
            if (array[j] > array[j + 1]) {
                int temp = array[j];
                array[j] = array[j + 1];
                array[j + 1] = temp;
            }
        }
    }
    return array[0];
}

int main() {
    int n, k;
    cin >> n >> k;
    int* a = new int [k];
    int* b = new int [k];
    for (int i = 0; i < k; i++) {
        cin >> a[i] >> b[i];
    }
    for (int i = 0; i < k; i++) {
        cout << min(a[i] - 1, b[i] - 1, n - a[i], n - b[i]) % 3 + 1 << endl;
    }
    delete[] a;
    delete[] b;
}

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

int main() {
  int n; cin >> n;
  map<int,int> m;
  rep(i,n) {
    int ai; cin >> ai;
    m[ai]++;
  }
  ll ans = 1, cnt = 0;
  for (auto it = m.rbegin(); it != m.rend(); it++) {
    ll k = (*it).first;
    int v = (*it).second;
    while (v >= 2 && cnt < 2) {
      ans *= k;
      v-=2;
      cnt++;
    }
    if (cnt > 2) break;
  }
  if (cnt < 2) ans = 0;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 8272
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

template<typename T> T in(){
	T res;
	cin >> res;
	return res;
}
template<typename T> vector<T> in(int n){
	vector<T> res(n);
	rep(i,n) cin >> res[i];
	return res;
}

template<typename T> void out(bool a, T F, T S){
	cout << (a ? F : S) << endl;
}

template<typename T> T Add(T a, T b){ return a + b; }
template<typename T> T Sub(T a, T b){ return a - b; }
template<typename T> T Pro(T a, T b){ return a * b; }
template<typename T> T Div(T a, T b){ return a / b; }
template<typename T> T Mod(T a, T b){ return a % b; }

void solve(vector<int> a){
	cout << Div(a[0], 3) << endl;
}

int main(){
	solve(in<int>(1));
}


Measured memory_bytes: 256
import itertools
n,m,q=map(int,input().split())
X=[]
B=[]
for i in range(q):
    X.append(list(map(int,input().split())))
for A in itertools.combinations_with_replacement(range(1,m+1),n):
    ans=0
    for x in X:
        if A[x[1]-1]-A[x[0]-1]==x[2]:
            ans+=x[3]
    B.append(ans)
print(max(B))

Measured memory_bytes: 12576
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;



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

	int N;
	cin >> N;
	vector<int> A(N);
	REP(i, N) cin >> A[i];
	int res = 0;
	while (1) {
		bool flag = false;
		REP(i, N) {
			if (A[i] % 2 == 0) A[i] /= 2;
			else {
				flag = true;
				break;
			}
		}
		if (flag) break;
		else res++;
	}
	cout << res << "\n";

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  int n, m, i, j, x;
  int data[100][100] = {0};
  int ans[100][100] = {0};

  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf("%d", &x);
    scanf("%d", &m);
    for(j = 0; j < m; j++){
      scanf("%d", &data[x-1][j]);
    }
  }
  
  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      if(data[i][j] != 0){
        ans[i][data[i][j]-1] = 1;
      }
    }
  }
  
  for(i = 0; i < n; i++){
    printf("%d", ans[i][0]);
    for(j = 1; j < n; j++){
      printf(" %d", ans[i][j]);
    }
    printf("\n");
  }
}

Measured memory_bytes: 1924
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
#define mod 1000000007
#define ALL(a) a.begin(),a.end()
 
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); }
 
int main(){
	int n;
	cin >> n;
	int ans = 0;
	for (int i = 0; i < n; i++){
		int a;
		cin >> a;
		ans += a - 1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#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 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;
const int MAX = 1000000010;
const ll MOD = 1000000007;
const double PI = acos(-1);

bool ok(string s) {
    int n = s.size();
    if (n % 2 == 1) return false;
    for (int i = 0; i < n / 2; i++) {
        if (s[i] != s[n / 2 + i]) return false;
    }

    return true;
}

int solve(string s) {
    int n = s.size();
    int i = 0;
    while (!s.empty()) {
        s.pop_back();
        i++;
        if (ok(s)) return n - i;
    }
}

int main() {
    string s; cin >> s;
    int ans = solve(s);
    cout << ans << endl;
    return 0;
}

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

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

	long long sum = 0;
	int min = 1000;
	for (int i = 1; i <= N; ++i) {
		int aji = L + i - 1;
		sum += aji;
		if (abs(aji) < abs(min)) {
			min = aji;
		}
	}

	cout << sum-min << endl;

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define FOR(i,a,b) for (int i=(a),for_##i##_max=(b);i<=(for_##i##_max);++i)
#define RFOR(i,a,b) for (int i=(a),rfor_##i##_min=(b);i>=(rfor_##i##_min);--i)
#define REP(i,n) for (int i=0,rep_##i##_len=(n);i<(rep_##i##_len);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

namespace { // Basics

template<typename T>
void chmin(T &x, T y) {
  x = std::min(x, y);
}

template<typename T>
void chmax(T &x, T y) {
  x = std::max(x, y);
}

template<typename T>
__attribute__((unused))
const auto minimum = static_cast<T const &(*)(T const &, T const &)>(std::min);

template<typename T>
__attribute__((unused))
const auto maximum = static_cast<T const &(*)(T const &, T const &)>(std::max);

template<typename T>
__attribute__((unused))
T constexpr infty = std::numeric_limits<T>::max / 3;
template<>
__attribute__((unused))
auto constexpr infty<int> = 1'100'100'100;
template<>
__attribute__((unused))
auto constexpr infty<long long int> = 100'500'400'300'200'100LL;

using lli = long long int;
using ld = long double;

} // namespace

using namespace std;

int main() {
  // cout << fixed << setprecision(10);

  lli X, Y, Z; cin >> X >> Y >> Z;
  cout << (X - Z) / (Y + Z) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define mk make_pair
#define all(a) a.begin(), a.end()
#define len(a) (int)a.size()

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef pair <int, int> pii;

int main(){
	ll n, m, k;
	cin >> n >> m >> k;
	
	vector <ll> a(n+1), b(m+1);
	a[0] = b[0] = 0;
	
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		a[i] += a[i-1];
	}
	for(int i = 1; i <= m; i++){
		cin >> b[i];
		b[i] += b[i-1];
	}
	
	int mx = 0;
	int j = m;
	
	for(int i = 0; i <= n; i++){
		if(a[i] > k)
			break;
		
		while(b[j] > k - a[i])
			j--;
		
		mx = max(mx, i + j);
	}
	
	cout << mx << endl;
	return 0;
}


Measured memory_bytes: 6408
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
typedef long long ll;
namespace mp = boost::multiprecision;
using Mint = mp::cpp_int;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); i++)
#define all(v) v.begin(), v.end()
#define uni(v) v.erase(unique(all(v)), v.end())
#define sort_g(v) sort(all(v), greater<int>())
#define dump(x) cerr << #x << ' ' << '=' << ' ' << x << endl

int main() {
    int H, W;
    cin >> H >> W;
    vector<string> pic(H);
    rep(i, H) cin >> pic.at(i);

    rep(i, W + 2) cout << '#';
    cout << endl;
    rep(i, H) {
        cout << '#' << pic.at(i) << '#' << endl;
    }
    rep(i, W + 2) cout << '#';
    cout << endl;
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

using ll = long long;
using ull = unsigned long long;

int p[100000];

int main() {
    int n, k, q, a;
    cin >> n >> k >> q;
    for (int i = 0; i < q; ++i) {
        cin >> a;
        p[--a]++;
    }
    for (int i = 0; i < n; ++i) {
        cout << (p[i] + k - q > 0 ? "Yes" : "No") << endl;
    }

    return 0;
}

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

int main()
{
	int a, b, op, total;	
	while(scanf("%d %c %d", &a, &op, &b))
	{
		if(op == '+')
		{
			total = a+b;
			printf("%d\n", total);
		}
		else if(op == '-')
		{
			total = a-b;
			printf("%d\n", total);
		}
		else if(op == '*')
		{
			total = a*b;
			printf("%d\n", total);
		}
		else if(op == '/')
		{
			total = a/b;
			printf("%d\n", total);
		}
		else
		{
			break;
		}
			
		
		
	}
	return 0;
	
}


Measured memory_bytes: 2680
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

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


  if(s == "Sunny"){
    cout << "Cloudy" << endl;
  }else if(s == "Cloudy"){
    cout << "Rainy" << endl;
  }else{
    cout << "Sunny" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,ans=0;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		int l,r;
		cin>>l>>r;
		ans+=r-l+1;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
  
typedef struct dice{
  int up;
  int front;
  int right;
  int left;
  int back;
  int down;
} dice;
  
int main(void){
  dice sample;
  char c;
  int temp;
   
  scanf("%d%d%d%d%d%d",&sample.up,&sample.front,&sample.right,&sample.left,&sample.back,&sample.down);
  
  while((c=getchar())!=EOF){
    if(c=='N'){
      temp=sample.front;
      sample.front=sample.down;
      sample.down=sample.back;
      sample.back=sample.up;
      sample.up=temp;
    } else if(c=='S') {
      temp=sample.back;
      sample.back=sample.down;
      sample.down=sample.front;
      sample.front=sample.up;
      sample.up=temp;
    } else if(c=='E') {
      temp=sample.left;
      sample.left=sample.down;
      sample.down=sample.right;
      sample.right=sample.up;
      sample.up=temp;
    } else if(c=='W') {
      temp=sample.right;
      sample.right=sample.down;
      sample.down=sample.left;
      sample.left=sample.up;
      sample.up=temp;
    }
  }
  
  printf("%d\n",sample.up);
  
  return 0;
}

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

int main() {
	ll x, y;
    cin >> x >> y;
    if(y == 1) puts("-1");
    else if(x%2 == 0 && y == 2) puts("-1");
    else if(x % y == 0) puts("-1");
    else cout << x * (y - 1) << endl;
}


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

int main(){
    long long int  n, x, y, count=0;
    double resp, d;
    cin>>n>>d;
    while(n--){
        cin>>x>>y;
        resp = sqrt((x*x)+(y*y));
        if(resp<=d)
            count++;
    }
    cout<<count<<endl;


    return 0;
}

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


// ABC125A - Biscuit Generator
// https://atcoder.jp/contests/abc125/tasks/abc125_a
void ABC125A() {


	int A, B,T;
	cin >> A >> B >> T;

	cout << int((T + 0.5) / A) * B;
	return;
}

int main() {
	ABC125A();

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n, x;
struct query {
    ll l, u, b;
} a[100010];
ll sum[100010];
int main() {
    scanf("%lld%lld", &n, &x);
    ll need = 0;
    for(ll i = 1; i <= n; i++) scanf("%lld%lld%lld", &a[i].b, &a[i].l, &a[i].u), need += 1ll * a[i].b * a[i].l;
    if(need == 0) return puts("0"), 0;
    sort(a + 1, a + 1 + n, [&](query a, query b) {
        return 1ll * a.u * (x - a.b) + 1ll * a.l * a.b > 1ll * b.u * (x - b.b) + 1ll * b.l * b.b;
    });
    for(ll i = 1; i <= n; i++) sum[i] = sum[i - 1] + 1ll * a[i].u * (x - a[i].b) + 1ll * a[i].l * a[i].b;
    ll ANS = 1e18;
    for(ll i = 1; i <= n; i++) {
        ll l = 0, r = n, ans;
        while(l <= r) {
            ll mid = l + r >> 1;
            ll now = sum[mid];
            if(mid >= i) now -= 1ll * a[i].u * (x - a[i].b) + 1ll * a[i].l * a[i].b;
            if(now >= need - 1ll * a[i].u * (x - a[i].b) - 1ll * a[i].l * a[i].b) ans = mid, r = mid - 1;
            else l = mid + 1;
        }
        ll now = (ans - (ans >= i)) * x;
        ll rest = need - sum[ans] + (ans >= i ? 1ll * a[i].u * (x - a[i].b) + 1ll * a[i].l * a[i].b : 0);
        if(rest > 0) now += rest > 1ll * a[i].b * a[i].l ? a[i].b + (rest - 1ll * a[i].b * a[i].l + a[i].u - 1) / a[i].u : (rest + a[i].l - 1) / a[i].l;
        ANS = min(ANS, now);
    }
    assert(ANS <= 1e15);
    return cout << ANS << endl, 0;
}

Measured memory_bytes: 3456
N=int(input())
T,A=map(int,input().split())
list=list(map(int,input().split()))
tmp=10**5
for i in range(N):
    if tmp > abs(T-list[i]*0.006-A):
        tmp = abs(T-list[i]*0.006-A)
        index=i+1
print(index)


Measured memory_bytes: 3060
puts 9394,a=?+,0,1,m=9,?<,2,9,u=3,[a,5-u+=1,3,9]+(0..59).map{[a,u,u,u,a,3,u,6,[a,6,6,6]*(59-_1),?<,6,9,m+=1,a,u,m,u]},[a,5-u+=1,3,9]+(0..59).map{[a,u,u,u,a,3,u,6,[a,6,6,6]*(59-_1),?<,6,9,m+=1,a,u,m,u]},(0..59).map{|_|[a,2,2,2]+(1.._).map{[a,40+_-_1,99+_1,5,?<,3,5,5,a,2,5,2]}}

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

int main() {
  int n;
  string s;
  cin >> n >> s;
  vector<int> r, g, b;
  bool bb[4010] = {false};
  for(int i=0; i < n; i++) {
    if(s[i] == 'R'){ r.push_back(i);}
    if(s[i] == 'G'){ g.push_back(i);}
    if(s[i] == 'B'){ b.push_back(i); bb[i] = true;}
  }

  long long total = 0;
  for(int i=0; i < r.size(); i++) for(int j=0; j < g.size(); j++) {
    int p = r[i], q = g[j];
    if(p > q) swap(p, q);
    total += b.size();
    if(p-(q-p) >= 0 && bb[p-(q-p)]) total--;
    if((q-p)%2 == 0 && bb[(q-p)/2+p]) total--;
    if(q+(q-p) < n && bb[q+(q-p)]) total--;
  }

  cout << total << endl;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define int long long
using namespace std;
map<int,int>q;
int n,ans;
signed main()
{
	int x;
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&x);
		ans+=q[i-x];
		q[i+x]++;
	}
	printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 26428
#include<stdio.h>
int main()
{
	int r,g,b;
	
	scanf("%d%d%d",&r,&g,&b);
	b+=r*100+g*10;
	if((b%4)==0){
		puts("YES");
	}else{
		puts("NO");
	}
	return 0;
}

Measured memory_bytes: 128
import math
A,B,N = map(int,input().split())
ret = 0
ans = 0
if B == 0:
  print(0)
  exit()
if B > N:
  base = N
else:
  base = B - 1
ret = math.floor(A*base/B) - A*math.floor(base/B)
print(ret)

Measured memory_bytes: 8968
import collections

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

even_num=[v[i] for i in range(0,n,2)]
odd_num=[v[i] for i in range(1,n,2)]

count_even=collections.Counter(even_num).most_common()
count_odd=collections.Counter(odd_num).most_common()

#count_even.append((0,0))
#count_odd.append((0,0))

if count_even[0][0] != count_odd[0][0]:
    print(n-count_even[0][1]-count_odd[0][1])
elif len(count_even)==1 and len(count_odd)==1:
    print(n//2)
elif len(count_even)==1:
    print(n-count_odd[1][1])
elif len(count_odd)==1:
    print(n-count_even[1][1])
else:
    odd_even=count_odd[0][1]+count_even[1][1]
    even_odd=count_even[0][1]+count_odd[1][1]
    if odd_even>even_odd:
        print(n-odd_even)
    else:
        print(n-even_odd)




Measured memory_bytes: 65516
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<sstream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<climits>
#include<complex>
#define REP(i, j) for(int i = 0; i < j; i++)
#define FOR(i, j, k) for(int i = j; i < k; i++)
using namespace std;
typedef complex<double> P;
typedef vector<P> G;
const double EPS = 1e-8;
const double INF = 1e12;
namespace std {
    bool operator < (const P& a, const P& b) {
        return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
    }
}
double cross(const P& a, const P& b) {
    return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
    return real(conj(a)*b);
}
int ccw(P a, P b, P c) {
    b -= a; c -= a;
    if (cross(b, c) > 0)   return +1;       // counter clockwise
    if (cross(b, c) < 0)   return -1;       // clockwise
    if (dot(b, c) < 0)     return +2;       // c--a--b on line
    if (norm(b) < norm(c)) return -2;       // a--b--c on line
    return 0;
}


G convex_hull(G &ps) {
  int n = ps.size(), k = 0;
  sort(ps.begin(), ps.end());
  G ch(2*n);
  for (int i = 0; i < n; ch[k++] = ps[i++]) // lower-hull
    while (k >= 2 && ccw(ch[k-2], ch[k-1], ps[i]) == -1) --k;
  for (int i = n-2, t = k+1; i >= 0; ch[k++] = ps[i--]) // upper-hull
    while (k >= t && ccw(ch[k-2], ch[k-1], ps[i]) == -1) --k;
  ch.resize(k-1);
  return ch;
}

int main(){
  int N;
  while(cin >>N && N){
    G ps(N);
    REP(i, N){
      double x, y;
      scanf("%lf,%lf", &x, &y);
      ps[i] = P(x, y);
    }
    G res = convex_hull(ps);
    cout <<N - (int)(res.size()) <<endl;
  }
  return 0;
}

Measured memory_bytes: 1292
/*
 * b.cpp
 *
 *  Created on: 2017/08/21
 *      Author: pinebooks
 */

#include <iostream>
#include <string>

using namespace std;

int main(void){
	string s;
	cin >> s;
	for (char c = 'a'; c <= 'z'; c++) {
		bool found = false;
		for (int i=0; i<s.length(); i++){
			if (s[i] == c)
				found = true;
		}
		if (!found){
			cout << c << endl;
			return 0;
		}
	}
	cout << "None" << endl;
	return 0;
}


Measured memory_bytes: 512