akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
long long my_pow(long long a, long long lv) {
    long long res = 1;
    long long p = a;
    while (lv) {
        if (lv & 1) res = res * p % MOD;
        p = p * p % MOD;
        lv >>= 1;
    }
    return res;
}

long long f(int l, int r) {
    long long res = 1;
    for (int i = l; i <= r; i++) {
        res = res * i % MOD;
    }
    return res;
}

int main() {
    int n, a, b;
    cin >> n >> a >> b ;

    long long all = my_pow(2, n);
    all = (all + MOD - 1) % MOD;
    long long cntA = f(n - a + 1, n) * my_pow(f(1, a), MOD - 2) % MOD;
    long long cntB = f(n - b + 1, n) * my_pow(f(1, b), MOD - 2) % MOD;
    all = (all - cntA + MOD) % MOD;
    all = (all - cntB + MOD) % MOD;
    cout << all << endl;
}


Measured memory_bytes: 3624
/******************************************
* AUTHOR : cf/villazer *
******************************************/
#include <iostream>
#include<iomanip>
using namespace std;
#define N 100005
#define mod 1000000007
#define dd double
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i,a,b) for(int i=a;i<b;i++)
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define F first
#define S second
#define debug(x) cout<<(#x)<<" is "<<(x)<<endl
#define lb(arr,n,x) lower_bound(arr,arr+n,x)-arr
#define ub(arr,n,x) upper_bound(arr,arr+n,x)-arr
#define endl "\n"
#define PI 3.14159265358979323846  /* pi */
#define sqr(x) (x)*(x)
#define all(v)  ((v).begin()),((v).end())
#define degreesToRadians(angleDegrees) (angleDegrees * PI / 180.0) // Converts degrees to radians.
#define radiansToDegrees(angleRadians) (angleRadians * 180.0 / PI) // Converts radians to degrees.

typedef long long ll;
typedef long double ld;
//Calculation of (x^y)%mm
ll mod_exp(ll x,ll y,ll mm)
{
    if(y==0)
        return(1);
    else if(y%2==0)
        return(mod_exp((x*x)%mm,y/2,mm));
    else
        return((x*mod_exp((x*x)%mm,(y-1)/2,mm))%mm);
}


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



ll r;
cin>>r;
ld x = 2*PI*r;
cout<<setprecision(18)<<x<<endl;

return 0;
}

Measured memory_bytes: 3224
def main():
    s = input()
    if len(s) == 2:
        if s[0] == s[1]:
            print(1, 2)
            exit()
    for i in range(len(s) - 2):
        if s[i] == s[i + 1]:
            print(i + 1, i + 2)
            break
        elif s[i] == s[i + 2]:
            print(i + 1, i + 3)
            break
    else:
        print(-1, -1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
#include <cstdio>
#include <algorithm>
#include <cstring>

using namespace std;

typedef long long LL;

const int maxn = 10000 + 1024;

int a[maxn];
int n;

int main() {
    while(~scanf("%d", &n)) {
        for(int i = 0; i < n; i++) scanf("%d", &a[i]);
        sort(a, a + n);
        LL sum = 0;
        for(int i = 0; i < n; i++) {
            if(sum + 1 >= a[i]) sum += a[i];
            else {
                printf("%lld\n", sum + 1);
                break;
            }
            if(i == n - 1) printf("%lld\n", sum + 1);
        }
    }
    return 0;
}

Measured memory_bytes: 1076
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			
			int L = scan.nextInt();//Lは１０００まで
			double tate =0;
			double yoko = 0;
			double takasa = 0;
			
			
			if(L%3==0){
				tate = (double)L/3;
				yoko = (double)L/3;
				takasa = (double)L/3;
				double X = tate*yoko*takasa;
				String str = BigDecimal.valueOf(X).toPlainString();
				System.out.println(str);	
			}else{
				double amari = (double)L%3.0/3.0;
				tate = (double)(L/3)+amari;
				yoko = (double)(L/3)+amari;
				takasa = (double)(L/3)+amari;
				
				double X = tate*yoko*takasa;
				String str = BigDecimal.valueOf(X).toPlainString();
				System.out.println(str);
				
				//System.out.println(amari);
				//System.out.println(L/3.0);
				
				
			}
			
		}
		
		
	}
		

}


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

#define debug(x) cout << #x" = " << x;

#define st first
#define nd second
#define all(x) (x).begin(), (x).end()

using namespace std;
using namespace placeholders;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

template <class T> void mini(T &l, T r){l = min(l, r);}
template <class T> void maxi(T &l, T r){l = max(l, r);}

template <class TH> void _dbg(const char *sdbg, TH h){cerr << sdbg << "=" << h << "\n";}
template <class TH, class ...TA> void _dbg(const char *sdbg, TH h, TA... a){
	while (*sdbg != ',') cerr << *sdbg++; cerr << "=" << h << ","; _dbg(sdbg + 1, a...);
}
template <class T> ostream &operator <<(ostream &os, vector<T> V){
	os << "["; for (auto vv: V) os << vv << ","; return os << "]";
}
template <class L, class R> ostream &operator <<(ostream &os, pair<L, R> P){
	return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef SFIC
	#define eput(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
	#define eput(...) 218
#endif

const int MAXN = 1E5 + 10;

int n, A, B;
int a[MAXN];

bool check(int m){
	ll t = (ll)B * m;
	ll tot = 0;
	for (int i = 0; i < n; ++i)
		tot += (max(0ll, a[i] - t) + A - 1) / A;
	return tot <= m;
}

int main(){
	scanf("%d%d%d", &n, &A, &B);
	A -= B;
	for (int i = 0; i < n; ++i)
		scanf("%d", a + i);
	int low = 0, high = 1E9, mid;
	while (low < high){
		mid = low + (high - low >> 1);
		if (!check(mid))
			low = mid + 1;
		else
			high = mid;
	}
	printf("%d\n", low);
	return 0;
}


Measured memory_bytes: 640
#include <bits//stdc++.h>
using namespace std;
#define int long long
signed main(){
	int w,a,b;
	cin>>w>>a>>b;
	if(b>a+w){
		cout<<max(0ll,b-(a+w))<<endl;
	}
	else{
		cout<<max(0ll,a-(b+w))<<endl;
	}
}


Measured memory_bytes: 256
def main():
    N = int(input())
    d = {"AC":0, "WA":0, "TLE":0, "RE":0}
    for i in range(N):
        d[input()] +=1
    for key, value in d.items():
        print(f"{key} x {value}")
        

if __name__ == "__main__":
    main()

Measured memory_bytes: 9096
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e9 + 7;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second

ll n, m;
ll ans;

int main(){
	cin >> n >> m;
	ll lb = 0, ub = (ll)1e12 + 1;
	while (ub - lb > 1){
		ll mid = (ub + lb) / 2;
		if (m - 2 * ub < 0){
			ub = mid;
			continue;
		}
		ll num[] = { min(n + ub, (m - 2 * ub) / 2), min(n + lb, (m - 2 * lb) / 2) };
		if (num[0]>num[1]){
			lb = mid;
		}
		else{
			ub = mid;
		}
	}
	cout << max(min(n + lb, (m - 2 * lb) / 2), min(n + ub, (m - 2 * ub) / 2)) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
vector<pair<int,int> > v;
cin>>n>>m;
for(int i=0;i<m;i++){
int a,b;
cin>>a>>b;
a--;b--;
v.push_back(make_pair(a,b));
}
sort(v.begin(),v.end());
int ans=0;
for(int i=0;i<m;i++){
int l=v[i].first,r=v[i].second;
while(i<m-1){
if(v[i+1].second<=l||r<=v[i+1].first){
break;
}else{
l=max(l,v[i+1].first);
r=min(r,v[i+1].second);
}
i++;
}
ans++;
}
cout<<ans<<endl;
return 0;
}


Measured memory_bytes: 1400
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        mut a: i32,
        b: i32,
        mut c: i32,
        d: i32,
    }

    loop {
        c -= b;
        if c <= 0 {
            println!("Yes");
            break;
        }
        a -= d;
        if a <= 0 {
            println!("No");
            break;
        }
    }
}


Measured memory_bytes: 2168
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define fi first
#define se second
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr int INF = 2147483647;
constexpr long long INFF = 9223372036854775807;

int H,W;
int A[500][500];


signed main() {
    cin.tie(0);
	ios::sync_with_stdio(false);
    cin >> H >> W;
    int sum = 0;
    REP(i,H) REP(j,W){cin >> A[i][j];sum += A[i][j];}
    vector<pair<int,int>> BF,AF;

    REP(i,H) REP(j,W){
        if(i == H -1 && j == W-1) continue;
        if(A[i][j] % 2 == 1){
            if(j != W-1){
                --A[i][j];
                BF.pb({i,j});
                ++A[i][j+1];
                AF.pb({i,j+1});
            }
            else{
                --A[i][j];
                BF.pb({i,j});
                ++A[i+1][j];
                AF.pb({i+1,j});
            }
        }
    }

    cout << AF.size() << endl;
    REP(i,AF.size()){
        cout << BF[i].fi + 1 << ' ' << BF[i].se + 1 << ' ' << AF[i].fi + 1 << ' ' << AF[i].se + 1 << endl;
    }
}

Measured memory_bytes: 5228
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

int n;
vector<int> p,ans;
vector<bool> visited,inCycle;
vector<vector<int>> G;

void dfs(int s,int par){
    if (ans[s]!=-1) return;
    vector<int> list;
    rep(i,G[s].size()){
        int t=G[s][i];
        if (inCycle[t] || t==par) continue;
        dfs(t,s);
        list.push_back(ans[t]);
    }
    sort(list.begin(),list.end());
    int k=-1;
    rep(i,list.size()){
        if (list[i]==k+1) k+=1;
        else if (list[i]>k+1) {
            ans[s]=k+1;
            return;
        }
    }
    ans[s]=k+1;
}

void solve(){
    cin >> n;
    p.resize(n,0);
    G.resize(n,{});
    visited.resize(n,false);
    ans.resize(n,-1);
    inCycle.resize(n,false);
    rep(i,n){
        cin >> p[i];
        p[i]-=1;
        G[p[i]].push_back(i);
    }
    deque<int> cycle;
    int s=0;
    while(!visited[s]){
        //cout << s << endl;
        visited[s]=true;
        cycle.push_back(s);
        s=p[s];
    }
    rep(i,cycle.size()){
        if (cycle[0]==s) break;
        cycle.pop_front();
    }
    rep(i,cycle.size()){
        inCycle[cycle[i]]=true;
        //cout << cycle[i] << " ";
    }
    rep(i,cycle.size()){
        dfs(cycle[i],-1);
    }
    //cout << "" << endl;
    //rep(i,n){
        //cout << ans[i] << " ";
    //}
    //cout << "" << endl;
    vector<int> num(cycle.size(),-1);
    num[0]=ans[cycle[0]];
    Rep(i,1,cycle.size()){
        if (num[i-1]==ans[cycle[i]]) num[i]=ans[cycle[i]]+1;
        else num[i]=ans[cycle[i]];
        //cout << num[i] << endl;
    }
    //rep(i,cycle.size()){
    //    cout << num[i] << " ";
    //}
    //cout << "" << endl;
    if (num[0]!=num.back()) {
        cout << "POSSIBLE" << endl;
        return;
    }

    num.resize(cycle.size(),-1);
    num[0]=ans[cycle[0]]+1;
    Rep(i,1,cycle.size()){
        if (num[i-1]==ans[cycle[i]]) num[i]=ans[cycle[i]]+1;
        else num[i]=ans[cycle[i]];
    }
    //rep(i,cycle.size()){
    //    cout << num[i] << " ";
    //}
    if (num[0]-1==num.back()) {
        cout << "POSSIBLE" << endl;
        return;
    }

    cout << "IMPOSSIBLE" << endl;
}

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

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

class Program
{
	//素因数分解を行う関数
	//所謂「試し割り法」を使う。配列（素因数とその指数）のリストを返す。
	//タイプはulongとする
	static List<ulong[]> TrialDivision(ulong n)
	{
		List<ulong[]> primeFactors = new List<ulong[]>();

		//入力値の平方根
		ulong root = (ulong)Math.Sqrt(n);

		//カウンター（当該素因数で割った回数）、割る数、割られる数
		ulong cnt = 0;
		ulong div = 2;
		ulong tmp = n;

		//平方根を超えるまでループ
		while(div <= root){
			//素因数に持つ場合、割ることができる回数だけ割り続ける
			//(cntの値は、当該素数で何回割れるかを示す（p^aのaに該当）)
			if(tmp % div == 0){
				cnt ++;
				tmp /= div;
			}
			//割り切れない場合
			else{
				//cnt > 0の場合、素因数divで可能な限り割った以後である
				//（cnt = 0の場合、divは素因数ではない）
				if(cnt != 0){
					//素因数と、割った回数とを追加
					ulong[] set = new ulong[2]{div, cnt};
					primeFactors.Add(set);
					//割った回数を初期化
					cnt = 0;
				}
				//次へ
				div += 1;
			}
		}

		//割った結果残ったのが1でない場合、当該素数も素因数である
		if(tmp != 1){
			ulong[] set = new ulong[2]{tmp, 1};
			primeFactors.Add(set);
		}

		//出力
		return primeFactors;
	}

	//Main
	static void Main(string[] args)
	{
		//読み込む
		int N = int.Parse(Console.ReadLine());

		//mod
		ulong mod = 1000000007;

		//素因数分解の結果（素因数と指数のセット）を格納するディクショナリ
		Dictionary<ulong,ulong> primeDict = new Dictionary<ulong,ulong>();

		//N!を構成する因数について、順番に素因数分解を行う
		for(int i=1; i<N+1; i++){
			List<ulong[]> primeFactors = TrialDivision((ulong)i);

			//各素因数の指数を、全体の素因数分解のディクショナリに追加
			foreach(ulong[] set in primeFactors){
				//既に素因数がキーとして含まれている場合
				if(primeDict.ContainsKey(set[0])){
					//加算
					primeDict[set[0]] += set[1];
				}
				//含まれていない場合
				else{
					//新たに追加
					primeDict.Add(set[0],set[1]);
				}
			}
		}

		ulong ans = 1;
		//各素因数の指数を掛け合わせていく（組み合わせの数）
		foreach(KeyValuePair<ulong,ulong> set in primeDict){
			ans *= (set.Value+1);
			ans %= mod;
			//Console.WriteLine("prime:{0},exp:{1}", set.Key, set.Value);
		}

		Console.WriteLine(ans);

	}
}



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

int main()
{
    int N,K;
    cin >> N >> K;
    vector<int> l;
    int ans = 0;

    for(int i=0; i<N; i++)
    {
        int temp;
        cin >> temp;
        l.push_back(temp);
    }
    sort(l.begin(), l.end(), greater<int>());

    for(int i=0; i<K; i++) ans += l[i];
    cout << ans << endl;
    return 0;
}

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

int main(){
  int n;cin >> n;
  int sum=0;
  vector<int> s(n);
  vector<int> a={};
  for(int i=0;i<n;i++){
    cin >> s[i];
    if(s[i]%10==0){
      sum += s[i];
    }else{
      a.push_back(s[i]);
      sum += s[i];
    }
  }
  sort(a.begin(),a.end());
  if(a.size()==0 && sum%10==0){
    cout << 0 << endl;
  }else if(a.size()!=0 && sum%10==0){
    cout << sum-a[0] << endl;
  }else if(sum%10!=0){
    cout << sum << endl;
  }
}

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

using namespace std;

int main()
{
	string str;
	int pal = 0;

	while (cin >> str)
	{
		bool flag = false;
		int len = str.size();

		if(len == 1)	flag = true;
		else{
			for(int i=0; i<len/2; i++)
			{
				if(str[i] == str[len-i-1])
					flag = true;
				else{
					flag = false;
					break;
				}
			}
		}

		if(flag)	pal++;
	}

	cout << pal << endl;

	return 0;
}

Measured memory_bytes: 1180
en=[chr(i) for i in range(65,91)]+list(' .,-\'?')
de={
' ':'101','\'':'000000',',':'000011','-':'10010001','.':'010001','?':'000001',
'A':'100101','B':'10011010','C':'0101','D':'0001','E':'110','F':'01001',
'G':'10011011','H':'010000','I':'0111','J':'10011000','K':'0110','L':'00100',
'M':'10011001','N':'10011110','O':'00101','P':'111','Q':'10011111','R':'1000',
'S':'00110','T':'00111','U':'10011100','V':'10011101','W':'000010','X':'10010010',
'Y':'10010011','Z':'10010000'
}
while 1:
    try:s=list(input())
    except:break
    a=b=''
    for x in s:a+=de[x]
    a+='0'*(-len(a)%5)
    for i in range(len(a)//5):
        b+=en[int(a[i*5:i*5+5],2)]
    print(b)

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

int x,y,z;
long long sum;

int main() {
	cin >> x;
	for (int a = 1; a <= x; a++) {
		for (int b = 1; b <= x; b++) {
			for (int c = 1; c <= x; c++) {
				for (int d = min(a,min(b,c)); d >= 1; d--) {
					if (a%d == 0 && b%d == 0 && c%d == 0) {
						sum+=d;
						break;
					}
				}
			}		
		}		
	}
	cout << sum  << "\n";
}

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

class Town{
	int id, num;

	public Town(int id, int num ) {
		super();
		this.id = id;
		this.num = num;
	}
	
}

public class Main {
	static int mod = (int) 1e9 + 7;
	static int DX[] = { -1, 0, 1, 0 }, DY[] = { 0, -1, 0, 1 };

	public static void main(String[] args) {
		FastScanner fs = new FastScanner(System.in);
		int n = fs.nextInt(), k = fs.nextInt();
		int x[] = fs.nextIntArray(n);
		long ans = Long.MAX_VALUE/2;
		for(int i=0;i<n;i++) {
			long tmp = Math.abs(x[i]);
			long res = Long.MAX_VALUE/2;
			if(i-k>=-1) res = tmp + (x[i] - x[i-k+1]);
			if(i+k<=n) res = Math.min(res, tmp + (x[i+k-1] - x[i]));
			ans = Math.min(ans, res);
		}
		System.out.println(ans);
		
	}
}

//高速なScanner
class FastScanner {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

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

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

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

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

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

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

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

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

Measured memory_bytes: 37816
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
using P=pair<long long,long long>;
typedef unsigned long long ull;
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 ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

  
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);  
  
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  ll sum=0;
  rep(i,n){
    while(a[i]%2==0){
      a[i]/=2;
      sum++;
    }
  }
  cout << sum << endl;
}


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

#define MAX_NR (1 << 28)

#define MAX_N 200000
#define MAX_BIT 28

using namespace std;

typedef long long lint;

int n;

int ap[MAX_N + 1];

int a[MAX_N + 1];
int b[MAX_N + 1];

int rez;

int cautBinST(int nr)
{
    int i = 0;
    int pas = 1 << 25;
    while(pas != 0)
    {
        if(i + pas <= n && ap[i + pas] < nr)
            i += pas;

        pas >>= 1;
    }

    return i + 1;
}

int cautBinDR(int nr)
{
    int i = 0;
    int pas = 1 << 25;
    while(pas != 0)
    {
        if(i + pas <= n && ap[i + pas] <= nr)
            i += pas;

        pas >>= 1;
    }

    return i;
}

int getSum(int st, int dr)
{
  //  cout << st << " -> " << dr << " ";

    int pdr = cautBinDR(dr);
    int pst = cautBinST(st);

    if(pst > pdr)
        return 0;

    return (pdr - pst + 1);
}

int main()
{
    cin >> n;

    int i, j;
    for(i = 1; i <= n; i ++)
        cin >> a[i];

    for(i = 1; i <= n; i ++)
        cin >> b[i];

    for(j = 0; j <= 28; j ++)
    {
        int r = (1 << (j + 1)) - 1;

        for(i = 1; i <= n; i ++)
            ap[i] = b[i] & r;

        sort(ap + 1, ap + n + 1);

        lint cat = 0;
        for(i = 1; i <= n; i ++)
        {
            int ant = (a[i] & r);
            int cate = getSum((1 << j) - ant, (1 << (j + 1)) - 1 - ant);
            cate += getSum((1 << j) + (1 << (j + 1)) - ant, (1 << (j + 2)) - 1 - ant);
            cat += cate;
        }

        if(cat & 1LL)
            rez += (1 << j);
    }

    cout << rez << "\n";

    return 0;
}


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

using namespace std;

int minCyc(const int s, const int i, set<int> &st)
{
    if (st.count(s) > 0)
        return i;
    st.insert(s);
    if (s % 2 == 0)
        return minCyc(s / 2, i + 1, st);
    else
        return minCyc(3 * s + 1, i + 1, st);
}

int main()
{
    int s;

    scanf("%d", &s);

    set<int> st;
    printf("%d\n", minCyc(s, 1, st));

    return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize ("-O3","unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>


#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<'\n';
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
#define int long long
//#define int unsigned long long
#define all(x) (x).begin(), (x).end()
#define double long double

using namespace std;

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;
}

const int MOD = 998244353;
const ll INF = 1e17;
const double pi = acos(-1);
const double EPS = 1e-10;
typedef pair<int, int>P;
const int MAX = 200020;


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

	int A,B,C; cin >> A >> B >> C;
	if (C - B == B - A) {
		print("YES");
	}
	else print("NO");
}


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

typedef long long ll;

const int MAXN = 1e5 + 1;

int n;
vector<int>nxt[MAXN];
ll c[MAXN];
ll val[MAXN];
bool vis[MAXN];
int T;
ll ans;

void dfs(int v) {
	vis[v] = 1;
	for(int w : nxt[v]) {
		if(!vis[w]) dfs(w);
	}
	val[v] = c[T];
	ans += c[T];
	T++;
}

int main() {
	ios_base::sync_with_stdio(0);
	
	
	
	cin >> n;
	
	for(int i = 1; i < n; i++) {
		int a, b;
		cin >> a >> b;
		nxt[a].push_back(b);
		nxt[b].push_back(a);
	}
	
	for(int i = 0; i < n; i++) cin >> c[i];
	
	sort(c, c + n);
	
	dfs(1);
	
	cout << ans - c[n-1] << '\n';
	for(int v = 1; v <= n; v++) cout << val[v] << ' ';
	cout << '\n';
	
	return 0;
}

Measured memory_bytes: 3456
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
#define int long long
signed main() {
	int k,a,b;
	cin >> k >> a >> b;
	int ans=0;
	int ct,r;
	if ((b-a)> 2 & k >= (a+1)){
		ct = (k+1-a) / 2;
		// cout << "ct:" << ct << endl;
		ans = 1 + k +(b-a-2)*ct;
		cout << ans << endl; 
	}else{
		cout << 1+k << endl;
	}

}

Measured memory_bytes: 256
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const Ld pi = M_PI;
const Int MOD = 1000000007;
const Int INF = 1LL << 61;

Int Floor(Int a, Int b) {
    return (a - (a % b)) / b;
}

Int Ceil(Int a, Int b) {
    if (a % b == 0) {
        return a / b;
    } else {
        return Floor(a, b) + 1;
    }
}

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

Int digits(Int n) {
    return (Int)to_string(n).size();
}

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

    Int n;
    cin >> n;
    vector<Int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    Int money = 1000, stock = 0;
    for (int i = 1; i < n; i++) {
        if (a[i - 1] < a[i]) {
            stock = money / a[i - 1];
            money = money % a[i - 1];

            money += stock * a[i];
            stock = 0;
        }
    }

    cout << money << endl;

    return 0;
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

std::string S;

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

    std::cin >> S;

    int n = 10 * (S[0] - '0') + (S[1] - '0'),
        m = 10 * (S[2] - '0') + (S[3] - '0');

    std::string res;

    if(n == 0){
        if(1 <= m && m <= 12){
            res = "YYMM";
        }else{
            res = "NA";
        }
    }else if(m == 0){
        if(1 <= n && n <= 12){
            res = "MMYY";
        }else{
            res = "NA";
        }
    }else if(n <= 12){
        if(m <= 12){
            res = "AMBIGUOUS";
        }else{
            res = "MMYY";
        }
    }else{
        if(m <= 12){
            res = "YYMM";
        }else{
            res = "NA";
        }
    }

    std::cout << res << std::endl;
}


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

const int inf = 1e9 + 7;
const ll inf_ll = 1e18L + 7;

template <typename T>
void mini(T& a, T b) {
  a = min(a, b);
}

template <typename T>
void maxi(T& a, T b) {
  a = max(a, b);
}

// dp(i, k) <-- probability of having exactly k heads in the first i tosses.
int main() {
  int n;
  scanf("%d", &n);
  vector<vector<double>> dp(n + 1, vector<double>(n + 1, 0.0));
  dp[0][0] = 1.0;
  for (int i = 1; i <= n; ++i) {
    double p = 0.0;
    scanf("%lf", &p);
    for (int j = i; j >= 0; --j) {
      dp[i][j] += (j == 0) ? 0 : dp[i - 1][j - 1] * p;
      dp[i][j] += dp[i - 1][j] * (1.0 - p);
    }
  }

  double ans = 0.0;
  for (int i = 0; i <= n; ++i) {
    int t = n - i;
    if (i > t) ans += dp[n][i];
  }
  printf("%.10lf\n", ans);
  return 0;
}


Measured memory_bytes: 70656
/* Your prologue will be the story. */
/* Copyright by HenryLi */
#include<iostream>
#include<algorithm>
#include<queue>
#include<string>
#include<map>
#include<vector>
#include<set>
#include<sstream>
#include<stack>
#include<ctime>
#include<cmath>
#include<cctype>
#include<climits>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<iomanip>
#include<bitset>
#include<complex>
using namespace std;
template <class _T> inline void read(_T &_x) {
	int _t; bool _flag=false;
	while((_t=getchar())!='-'&&(_t<'0'||_t>'9')) ;
	if(_t=='-') _flag=true,_t=getchar(); _x=_t-'0';
	while((_t=getchar())>='0'&&_t<='9') _x=_x*10+_t-'0';
	if(_flag) _x=-_x;
}
typedef long long LL;
int n, d1, d2, c1, c2;
bool check(int a, int b, int c) {
	if (c & 1) return (a >> (c / 2)) % 2 == 0;
	return (a >> (c / 2)) % 2 == (b >> (c / 2)) % 2;
}
int main() {
	//freopen("D.in","r",stdin);
	//freopen("D.out","w",stdout);
	read(n), read(d1), read(d2);
	while (d1 % (1 << (c1 + 1)) == 0) ++c1;
	while (d2 % (1 << (c2 + 1)) == 0) ++c2;
	int tot = 0;
	for (int i = 0; i < 2 * n && tot < n * n; ++i) {
		for (int j = 0; j < 2 * n && tot < n * n; ++j) {
			if (check(i, j, c1) && check(i, j, c2)) {
				cout << i << ' ' << j << endl;
				++tot;
			}
		}
	}
	return 0;
}



Measured memory_bytes: 896
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')
# ----------------------------------------------------------- #

A = []
for i in range(5):
    a = int(input())
    b = (a-1) % 10
    A.append((a, b))

A.sort(key=itemgetter(1))
# print(A)
ans = A[0][0]
for i in range(1, 5):
    tmp = ceil(A[i][0]/10)*10
    ans += tmp
    # print(tmp)

print(ans)

Measured memory_bytes: 63340
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int N, K, Q;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>N>>K>>Q;
    int seq[N+9];
    set<int> nums;
    rep(i,N) cin>>seq[i], nums.insert(seq[i]);
    
    int mn=INF;
    for(auto x:nums){
        vector<int> data1;
        for(int i=0;i<N;i++){
            vector<int> data2;
            while(seq[i]>=x&&i<N){
                data2.push_back(seq[i++]);
            }
            int len = data2.size();
            if(len>=K){
                sort(all(data2));
                data1.insert(data1.end(),data2.begin(),data2.begin()+(len-K+1));
            }
        }
        if(data1.size()>=Q){
            sort(all(data1));
            int n = data1[Q-1];
            if(mn>n-x) mn=n-x;
        }
    }
    cout1(mn);
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define bin(x,b) bitset<b> vb(x); cout << vb << '\n';

#if ( ( _WIN32 || __WIN32__ ) && __cplusplus < 201103L)
    #define lld "%I64d"
#else
    #define lld "%lld"
#endif

typedef long long ll;
typedef pair <int,int> pi;

const long double EPS = 1e-10;
const ll MOD = 1e9 + 7;
const long double PI = 3.1415926535897932384626433832795028841;

ll powmod(ll a,ll b) {ll res=1;a%=MOD;for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res;}


const int maxn = 1e5 + 5;
const int maxm = 1e5 + 5;
const int maxk = 1e5 + 5;

int main(){
	int A,B,C,D; cin >> A>>B>>C>>D;
	if (A+B>C+D){
		cout << "Left\n";
	}else if(A+B<C+D){
		cout << "Right\n";
	}else{
		cout << "Balanced\n";
	}}

Measured memory_bytes: 256
#![allow(unused_mut)]
#![allow(non_snake_case)]
#![allow(unused_macros)]
#![allow(unused_variables)]
#![allow(unused_imports)]
#![allow(dead_code)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

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

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

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

fn main() {
    input!{
        N: usize,
        M: usize,
        AB: [(usize, usize); N],
    }

    let mut AB = AB;
    AB.sort();

    let mut sum = 0;
    let mut rate = M;
    for ab in AB {
        if ab.1 <= rate {
            rate -= ab.1;
            sum += ab.0 * ab.1;
        } else {
            sum += ab.0 * rate;
            break;
        }
    }
    println!("{}", sum);
}



Measured memory_bytes: 6396
#include <iostream>
#include <cstdio>
using namespace std;
   
int main() {
  int a, b, d, r;
  double f;
  cin >> a >> b;
  cout << a / b << " " << a % b << " ";
  printf("%.5f\n", 1.0 * a / b);
  return 0;
}

Measured memory_bytes: 1240
#include<bits/stdc++.h>
#pragma O3
#define int long long
using namespace std;
const int mod=998244353;
int n,a,b,k,ca,cb,ans;
int gt[3000005],rgt[3000005];
int binpow(int x,int mu){
	if(mu==1) return x%mod;
	else{
		int tmp=binpow(x,mu/2);
		if(mu%2==1) return ((tmp*tmp%mod)*x)%mod;
		else return tmp*tmp%mod;
	}
}
signed main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin>>n>>a>>b>>k;
	gt[0]=1;
	for(int i=1;i<3000004;i++){
		gt[i]=(gt[i-1]%mod*(n-i+1)%mod)*(binpow(i,mod-2)%mod)%mod;
	}
	for(int ca=0;ca<=n;ca++){
		cb=(k-ca*a)/b;
		if(cb*b+ca*a!=k||cb<0) continue;
		ans=(gt[ca]*gt[cb]%mod+ans)%mod;
	}
	cout<<ans;
}

Measured memory_bytes: 24704
N = int(input())
li = [0]*(pow(10,6))
max_ = int(N**(1/2))+1

from itertools import combinations_with_replacement

for i in combinations_with_replacement(range(1,max_),3):
    a,b,c = i
    sum_ = a**2+b**2+c**2 + a*b+b*c+c*a
    if sum_>N:
        continue

    if a==b==c:
        li[sum_]+=1
    elif (not a==b) and (not b==c) and (not c==a):
        li[sum_]+= 6
    else:
        li[sum_]+= 3
    
for i in range(1,N+1):
    print(li[i])

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

using namespace std;

long long int arr1[2000010];
long long int arr2[2000010];

int main()
{
    memset(arr1,0,sizeof(arr1));
    long long int n;
    cin>>n;
    long long int arr[n];
    long long int minno = 0;
    long long int maxno = 0;
    for(long long int i=0;i<n;i++)
    {
        cin>>arr[i];
        if(maxno<arr[i])
        {
            maxno = arr[i];
        }
        else if(minno>arr[i])
        {
            minno = arr[i];
        }
        arr1[arr[i]]++;
    }
    for(long long int i=minno;i<maxno;i++)
    {
        arr1[i+1]+=arr1[i];
    }
    for(long long int i=0; i<n;i++)
    {
        long long int x = arr[i];
        long long int y = arr1[x];
        arr2[y] = x;
        arr1[x]--;
    }

    for(long long int i=1; i<=n; i++)
    {
        if(i!=n)
        printf("%lld ",arr2[i]);
        else
        {
            printf("%lld\n",arr2[i]);
        }
    }
}



Measured memory_bytes: 50008
#include <iostream>

using namespace std;
long long GCD(long long a,long long b){
	long long ma = max(a,b);
	long long mi = min(a,b);
	while(mi!=0){
		long long temp;
		temp = mi;
		mi = ma % mi;
		ma = temp;
	}
	return ma;
}
long long LCM(long long a,long long b){
	return a*b/GCD(a,b);
}

int main(){
	long long a,b;
	while((cin>>a>>b)){
		cout << GCD(a,b) << ' ' << LCM(a,b) << endl;
	}
}

Measured memory_bytes: 0
#include <stdio.h>

int main(void)
{
	int b, c, d, e;
	int z;
	
	d = 0;
	e = 0;
	c = 0;
	while(scanf("%d %d",&b,&c)!=EOF){
		z = 0;
		e = b + c;
		while (e != 0) {
			e = e / 10;
			z++;
		}
		d++;
		printf("%d\n", z);
	}
	
	return (0);
}	

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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define rrepa(i,a,n) for(int i=n;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define cmax(a,b) a=max(a,b)
#define cmin(a,b) a=min(a,b)
#define vc vector

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;

int main(){

    int n;
    cin>>n;
    vi a(n),num(n+1,0);
    int m=0;
    rep(i,n){
        cin>>a[i];
        // a[i]=200000;
        num[a[i]]++;
        cmax(m,num[a[i]]);
        // cerr<<a[i]<<" "<<num[a[i]]<<"\n";
    }
    // cerr<<"max "<<m<<"\n";

    vl nC2(m+1);
    rep(i,m+1){
        nC2[i]=(ll)i*(i-1)/2;
    }
    // cerr<<"nC2["<<200000<<"] "<<nC2[m]<<"\n";

    ll ptn_sum=0;

    rep(i,n+1){
        if(num[i]){
            ptn_sum+=nC2[num[i]];
        }
    }
    // cerr<<"sum "<<ptn_sum<<"\n";

    rep(i,n){
        cout<<ptn_sum-nC2[num[a[i]]]+nC2[num[a[i]]-1]<<"\n";
    }

    return 0;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
typedef long long int ll;
using namespace std;

int main(){
	int a,b,c,d; cin >>a >>b >>c >>d;
	int n=-max(a,c)+min(b,d);
	if(n>0) cout << n << endl;
	else cout <<0 << endl;
}


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

#define P complex<double>

// e·éë·Ã
#define EPS (1e-10)
// 2ÂÌXJ[ªµ¢©Ç¤©
#define EQ(a,b) (abs((a)-(b)) < EPS)

// e·éë·Ã
#define EPS (1e-10)
// 2ÂÌXJ[ªµ¢©Ç¤©
#define EQ(a,b) (abs((a)-(b)) < EPS)

// OÏ (cross product) : a~b = |a||b|sinÆ
double cross(P a, P b) {
  return (a.real() * b.imag() - a.imag() * b.real());
}

// 2¼üÌ½s»è : a//b <=> cross(a, b) = 0
bool is_parallel(P a1, P a2, P b1, P b2) {
  return EQ( cross(a1-a2, b1-b2), 0.0 );
}


int main(){
  int n;
  P a,b,c,d;

  cin >> n;
  for( int loop=0;loop<n;loop++ ){
    cin >> a.real() >> a.imag();
    cin >> b.real() >> b.imag();
    cin >> c.real() >> c.imag();
    cin >> d.real() >> d.imag();

    P x=a-b, y=c-d;
    x = x/abs(x);
    y = y/abs(y);

    if( is_parallel( a,b,c,d ) )
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }

  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m=0,max=0,a,b;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a>>b;
		if(a==b){
			m++;
		}
		else{
			if(m>max){
				max=m;
			}
			m=0;
		}
	}
	if(m>max){
		max=m;
	}
	if(max>=3){
		cout<<"Yes"<<endl;
	}
	else cout<<"No"<<endl;
	return 0;
} 

Measured memory_bytes: 3628
///
// File:  b.cpp
// Author: ymiyamoto
//
// Created on Sun Dec 10 21:23:57 2017
//

#include <cstdint>
#include <iostream>
#include <vector>

using namespace std;

int32_t main()
{
  uint32_t N;
  cin >> N;
  vector<uint32_t> arr;
  for (uint32_t i = 0; i < N; i++) {
    uint32_t n;
    cin >> n;
    arr.push_back(n);
  }

  uint32_t count = 0;
  while (true) {
    bool has_odd = false;
    for (auto a : arr) {
      if (a % 2 == 1) {
        has_odd = true;
      }
    }
    if (has_odd) break;

    for (uint32_t i = 0; i < arr.size(); i++) {
      arr[i] /= 2;
    }
    count++;
  }

  cout << count << endl;
  return 0;
}


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

using namespace std;
#define ll long long
#define sz(x) (ll)(x.size())
#define f first
#define se second
const ll N = 2e5+100;
int main() {
    ios::sync_with_stdio(0);
    ll n, k;
    cin >> n >> k;
    ll a[n];
    for(ll i = 0;i < n;i++){
        cin >> a[i];
    }
    ll dp[n];
    dp[n - 1] = 0;
    for(ll i = n - 2; i >= 0; i--){
        ll mn = INT64_MAX;
        for(ll j = min(n - 1, i + k); j > i; j--){
            mn = min(mn, abs(a[i] - a[j]) + dp[j]);
        }
        dp[i] = mn;
    }   
    cout << dp[0] << "\n";
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define P pair<int, int>
#define F first
#define S second
#define MOD 998244353
int iso_lower(vector<int> V, int x) {
    //ソートされたVの中から、V[i]>=xとなる最小のiを返す.存在しなければVの要素数を返す
    int s = V.size();
    //V.push_back(INF);
    int l = -1;
    int r = s;  //rが常にtrue
    while(r - l > 1) {
        int mid = (l + r) / 2;
        if(V[mid] < x)
            l = mid;
        else
            r = mid;
    }
    return r;
}
signed main(){
    int N,K;cin>>N>>K;
    vector<P>V;
    rep(i,K){
        int l,r;cin>>l>>r;
        V.push_back(make_pair(l,r));
    }
    sort(all(V));
    vector<int>dp(500000,0);
    dp[1]=1;dp[2]=-1;
    for(int i=1;i<=N;i++){
        for(auto X:V){
            int l=X.first,r=X.second;
            dp[i+l]=(dp[i+l]+dp[i])%MOD;
            dp[i+r+1]=(dp[i+r+1]-dp[i]+MOD)%MOD;
            //if(i==1)cout<<dp[i+l]<<':'<<dp[i+r+1]<<endl;
        }
        dp[i+1]=(dp[i+1]+dp[i])%MOD;
        //rep(j,N){
            //cout<<dp[j+1]<<' ';
        //}
        //cout<<endl;
    }
    cout<<dp[N]%MOD<<endl;
    
}


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

#define PI 3.14159265359
#define INF 1000000009
#define LINF 10000000000000000009
#define IMOD 1000000007 
#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)

#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,a,n) for(int i = (int)(n); i >= (int)(a); i--)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<v_char > v2_char;
typedef std::vector<double> v_double;
typedef std::vector<v_double > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<v_int > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<v_ll > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<v_string > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<v_bool > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

int dx[4] = {1, 0, -1, 0};
int dy[5] = {0, 1, 0, -1};
using namespace std; 

int main(void)
{
    long double a, b;
    cin >> a >> b;

    cout << (ll)floor(a*b) << endl;
    return 0;
}
/** atcoder **/


Measured memory_bytes: 3732
#include <cstdio>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <vector>
#include <iostream>
using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

int main(){
	long n;
	long a[1000] = {0};
	cin >>n;

	//color
	long c[9] = {0};
	long out = 0;

	long minmin = 0;

	REP(i,n){
		cin >>a[i];
		if(a[i]<3200){
			c[a[i]/400] = 1;
		}
		else {
			c[8]++;
		}
	}


	
	REP(i,8){
		out += c[i];
	}

	minmin = out;


	if(c[8]>0 && minmin == 0){
		minmin = 1;
	}

	out += c[8];


	
	cout << minmin <<" "<<out <<endl;
	
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main()
{
  int n;
  int c=0;
  cin >> n;
  int a[n];

  for(int i = 0;i < n;i++){
      cin >> a[i];
   if((i % 2) == 0){
       if((a[i] % 2) == 1){
           c++;
       }
         
    }
    else{

    }

  }
    cout << c;
    

} 

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

const ll mod = 1000000007;

using namespace std;
ll dp[100005];// dp[i]:= i人目まで見た時の考えられる総数
int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,ans = 1;
	cin >> N;
	vector<ll> A(N),cnt(3);
	rep(i,N){
		cin >> A[i];
	}
	for(int i=0;i<N;i++){
		int t = 0;
		bool ok = 1;
		for(int j=0;j<3;j++){
			if(cnt[j]==A[i]){
				t++;
				if(ok){
					cnt[j]++;
					ok = 0;
				}
			}
		}
		ans *= t;
		ans %= mod;
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main() {
  int A, B, n, sockets;

  cin>>A>>B;

  n = 0;
  sockets = 1;
  while (sockets < B) {
    sockets += A;
    sockets -= 1;
    n++;
  }

  cout<<n<<"\n";

  return 0;
}

Measured memory_bytes: 256