akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, k, n) for (int i = k; i < (int)(n); i++)
#define repd(i, n) for (int i = n-1; i >= 0; i--)
#define rrepd(i, k, n) for (int i = n-1; i >= (int)(k); i--)
#define all(x) (x).begin(),(x).end()
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
//V,Pは大文字i,l,bは小文字
using ll = long long;
using Vi = vector<int>;
using VVi = vector<Vi>;
using Vl = vector<ll>;
using VVl = vector<Vl>;
using Vb = vector<bool>;
using VVb = vector<Vb>;
using P = pair<int,int>;
using Pll = pair<ll, ll>;
const ll mod = 1000000007;
const ll inf = 1000000000000;//10の12乗

int main() {
  ll a,b;
  cin >> a >> b;
  ll now=a;
  ll ans=0;
  while(a<=b){
    ans++;
    a+=a;
  }
  cout << ans << endl;
}


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

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

    int sum = 0;
    bool can = false;
    for (int i = 1; i <= a*b; i++) {
        sum += a;
        if (sum % b == c) {
            can = true;
        }
    }

    if (can) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

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


/// File input & output /////
#define fRead(x)        freopen("x.txt","r",stdin)
#define fWrite(x)       freopen ("x.txt","w",stdout)

#define mt              make_tuple
#define ld              long double
#define ll              long long
#define ull             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define INF             2e16
#define PI              acos(-1.0)
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())


#define FASTIO        ios_base::sync_with_stdio(0);cin.tie(nullptr);




///..................Sort by second element in a pair in decending order............. ///
bool SortbySecDesc(const pair<long long,long long > &a, const pair<long long,long long > &b)
{
    return a.second>b.second;
}

///.........................first element of pair in descending order..........................//////
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}



///.............................................................TEMPLATE................................................./////


//long long  Prime[3000000],nPrime;
//long long  mark[10000002];
//
//void seive(long long int n)
//{
//	long long int i,j,limit=sqrt(n*1.0)+2;
//	mark[1]=1;
//	for(i=4; i<=n ;i+=2)
//	mark[i]=1;
//	Prime[nPrime++]=2;
//	for(i=3; i<=n; i+=2)
//	{
//		if(!mark[i])
//		{
//			Prime[nPrime++]=i;
//			if(i<=limit)
//			{
//				for(j=i*i; j<=n ;j+=i*2)
//				{
//					mark[j]=1;
//				}
//			}
//		}
//	}
//}

int main()
{
    FASTIO;

    ll t;

    cin >> t;

    ll ac = 0 ,wa = 0 , tle = 0 , re = 0;



    while(t--)
    {

        string s;


        cin >> s;

        if(s=="AC")
            ac++;
        if(s=="WA")
            wa++;
        if(s=="TLE")
            tle++;
        if(s=="RE")
            re++;
    }

    cout << "AC x " << ac << endl;

    cout << "WA x " << wa << endl;

    cout << "TLE x " << tle << endl;

    cout << "RE x " << re << endl;






    return 0;
}


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

namespace ABC_085A
{
    class Program
    {
        static void Main(string[] args)
        {
            string s;

            s = Console.ReadLine();

            char[] cs = s.ToCharArray();

            cs[3] = '8';

            Console.WriteLine(cs);

            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
#include <stdio.h>

int main(){
  
  long N,K;
  scanf("%ld%ld",&N,&K);
  
  long ans,i = N / K,j = (N + K / 2) / K;
  
  if(K % 2 == 1){
    ans = i * i * i;
  }else{
    ans = i * i * i + j * j * j;
  }
  
  printf("%ld",ans);
    
  return 0;
}
  

Measured memory_bytes: 128
#include <iostream> 
#include <vector>
#include <cmath>
#include <string>
#include <sstream>
#include <algorithm>
#include <queue>
#include <stack>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include <map>
#include <iomanip>
#include <cctype>
#include <climits>

using namespace std;

using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>;

using ll = long long int;

#define mp(a,b) make_pair(a,b)

const int MOD = 1000 * 1000 * 1000 + 7;

double EPS = 0.0000001;

bool res() {
	ll a, b, c;
	cin >> a >> b >> c;
	if (!cin) return false;

	ll res = c - a - b;
	if (abs(((double)res) / 2 - sqrt(a * b)) > EPS) {
		if (((double)res) / 2 > sqrt(a * b)) cout << "Yes\n";
		else cout << "No\n";
	}
	else {
		if(res * res > 4 *a*b)cout << "Yes\n";
		else cout << "No\n";
	}

	return true;
}

int main() {
	while (res()) {}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int[] a = {sc.nextInt(),sc.nextInt(),sc.nextInt()};
		int k = sc.nextInt(), t = 0;
		Arrays.sort(a);
		while (k-->0) a[a.length-1]*=2;
		for (int b : a) t+=b;
		System.out.println(t);
		sc.close();			
	}

	public static void main(String args[]) {
		solve();
	}

}

Measured memory_bytes: 35604
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
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; }
//Get the highest value and key from a map.
template<typename KeyType, typename ValueType>
std::pair<KeyType,ValueType> get_max( const std::map<KeyType,ValueType>& x ) {
  using pairtype=std::pair<KeyType,ValueType>;
  return *std::max_element(x.begin(), x.end(), [] (const pairtype & p1, const pairtype & p2) {
        return p1.second < p2.second;
  });
}
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;

int main() {
  int n;
  cin >> n;
  vector<int> dn(n);
  rep(i, n) cin >> dn[i];

  int cnt = 0;
  sort(dn.begin(), dn.end());
  for (int i = 1; i <= 1e5; i++) {
    auto iter_upper = upper_bound(dn.begin(), dn.end(), i);
    if (iter_upper == dn.end()) break;
    if (iter_upper - dn.begin() == dn.end() - iter_upper) ++cnt;
  }

  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long


using namespace std;


vector<ll>v[300005];
ll Counter[300005];
int vis[300005];
ll a,b,n,q,x,y;

void DFS(ll s)
{
    vis[s]=1;

    for(auto x: v[s])
    {
        if(!vis[x])
        {
            Counter[x]+=Counter[s];
            DFS(x);
        }
    }
}

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

    n,q;cin >> n >> q;
    for(int i=0;i<n-1;i++)
    {
        cin>>x>>y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    while(q--)
    {
        cin >> a >> b;
        Counter[a]+=b;
    }
    DFS(1);
    for(int i=1;i<=n;i++)cout << Counter[i] << " ";


    return 0;



}


Measured memory_bytes: 25088
N=int(input())
A=list(map(int, input().split()))

minus=0
minabs=10**10
SUM=0
iszero=False
for a in A:
    if a<0:
        minus+=1
    if a==0:
        iszero=True
    minabs=min(minabs, abs(a))
    SUM+=abs(a)

if iszero or minus%2==0:
    print(SUM)
else:
    print(SUM-2*minabs)



Measured memory_bytes: 14412
import math

def gcd(n, m):
    while m != 0:
        n, m = m, n % m
    return n

a, b = map(int, input().split())
g = gcd(a, b)
g_2 = int(math.sqrt(g))
cnt = 1

for i in range(2, g_2+1):
    if g % i == 0:
        while g % i == 0:
            g //= i
        cnt += 1
if g > 1:
    cnt += 1

print(cnt)


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

int main(){
    ll N, x, ans = 0;
    cin >> N >> x;
    vector<ll> a(N);
    for(int i = 0; i < N; i++) cin >> a[i];

    sort(a.begin(), a.end());
    ll i = 0;
    while(1){
        if(x - a[i] > 0){
            x -= a[i];
            ans++;
        }else if (x - a[i] == 0){
            x = 0;
            ans++;
        }else if(x - a[i] < 0){
            x = 0;
            break;
        }
        i++;
        if(i == N) break;
    }
    if(x > 0) ans--;
    cout << ans << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define boost ios_base::sync_with_stdio(false)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repp(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define mp make_pair
#define ff first
#define mod 1000000007
#define ss second
using namespace std;
#define test int t; cin>>t; while(t--)
signed main()
{
    int h,w;
    cin>>h>>w;
    char arr[h+1][w+1];
    int dp[h+1][w+1];
    repp(i,1,h)
    {
        repp(j,1,w)cin>>arr[i][j];
    }
    repp(i,1,w)
    {
        if(int(arr[1][i])==35)
        {   dp[1][i]=0;
            repp(j,i+1,w)dp[1][j]=0;
            break;
        }
        else
        dp[1][i]=1;
    }
    repp(i,1,h)
    {
        if(int(arr[i][1])==35)
        {
            repp(j,i,h)dp[j][1]=0;
            break;
        }
        else
        dp[i][1]=1;
    }
    repp(i,2,h)
    {
        repp(j,2,w)
        {
            if(int(arr[i][j])==35)dp[i][j]=0;
            else
            dp[i][j]=((dp[i-1][j])%mod+(dp[i][j-1])%mod)%mod;
        }
    }
    cout<<(dp[h][w])%mod<<endl;
    
}

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

using namespace std;
#define rep(i,n) for (int i =0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;

const int INF = 1001001001;

int main() {
    int N;
    ll K;
    cin >>N>>K;
    vector<int>A(N);
    vector<int>B(N,0);
    int count =0;
    int placea,counta;
    int place=0;
    int tri=0;
    int tri2=0;

    rep(i,N)cin >>A[i];

    B[0]++;
    while (tri==0){
        place=A[place]-1;
        B[place]++;
        count++;
        if(B[place]==2)tri++;
        if(count==K){
            cout<<place+1;
            return 0;
        }
    }


    placea=place;
    counta=count;
    place=0;


    while(tri2==0){
        if(place==placea)break;
        place=A[place]-1;
        
        count--;
    }


    int num=(K-counta)%count;
    rep(i,num){
         place=A[place]-1;
     }
    cout <<place+1;
    return 0;

    }

Measured memory_bytes: 4844
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define COUT(a) cout << (a);
#define ENDL cout << "\n";

int main() {
    int n,m,k,tmp;
    scanf("%d %d\n",&n,&m);
    int ans[m];
    REP(i,m) ans[i] = 0;
    REP(i,n) {
        scanf("%d",&k);
        REP(j,k) {
            scanf("%d",&tmp);
            ans[tmp-1]++;
        }
    }
    int count=0;
    REP(i,m) if(ans[i]==n) count++;
    COUT(count)
}





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

int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;
    int count=0;
    for (int i=0; i<N-2; i++){
        if(S.at(i)=='A'&&S.at(i+1)=='B'&&S.at(i+2)=='C') count++;
    }
    cout << count << endl;
    }


  


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
using namespace __gnu_pbds;
using namespace std;
 
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long ll;
typedef long double ld;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,d;
	cin >> n >> d;
	vector <vector<ll>> arr(n,vector<ll>(d));
	for (int z=0;z<n;z++){
		for (int x=0;x<d;x++){
			cin >> arr[z][x];
		}
	}
	ll count = 0;
	for (int z=0;z<n;z++){
		for (int x=z+1;x<n;x++){
			ll sum = 0;
			for (int q=0;q<d;q++){
				sum += (arr[z][q] - arr[x][q])*(arr[z][q] - arr[x][q]);
			}
			if (ll(sqrt(sum))*ll(sqrt(sum)) == sum){
				count++;
			}
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 256
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

alias sread = () => readln.chomp();
ulong bignum = 1_000_000_007;
alias Pair = Tuple!(long, "begin", long, "end");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void main()
{
    long n, a, b;
    scan(n, a, b);
    (min(a * n, b)).writeln();
}

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

#define all(x) (x).begin(),(x).end()

#define MOD 1000000007

using namespace std;

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

	printf( "%.10lf", (n/2 + n%2) / (double)n );

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define pp(...) "\033[94m [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define dg1(x) debug() << pp(x)
#define dg2(x,y) debug() << pp(x) pp(y)
#define dg3(x,y,z) debug() << pp(x) pp(y) pp(z)
#define dg4(w,x,y,z) debug() << pp(w) pp(x) pp(y) pp(z)
#define msg(x) debug() << x
#define int long long
const int xx = 2e5;
const int mod = 1e9 + 7;
signed main(){
  ios::sync_with_stdio(false);cin.tie(0);

  int n;
  cin >> n;
  string s;
  cin >> s;

  if(n%2){
    cout <<"No" << '\n';
    return 0;
  }
  string x = "";
  for(int i=0;i<n/2;i++){
    x += s[i];
  }
  x = x + x;
  if(x == s){
    cout <<"Yes" << '\n';
  }
  else cout <<"No" << '\n';

}

Measured memory_bytes: 256
from collections import defaultdict


def main():
    input()
    array = sorted(int(x) for x in input().split())
    maximum = 1000003

    counter = defaultdict(int)
    for x in array:
        counter[x] += 1
    maximum = array[-1] + 1
    candidates = [True] * maximum
    for key, value in counter.items():
        if value > 1:  # duplicate
            candidates[key] = False
        for i in range(key * 2, maximum, key):
            candidates[i] = False

    ans = sum(candidates[x] for x in array)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 38076
#include <iostream>
#include <string> 
#include <math.h>
#include <algorithm>
using namespace std;

int main(void) {
	int	now, in, ans;
	cin >> now >> in;
	ans = now + in;
	if (ans >= 24)ans -= 24;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
line = list(map(int, input().split()))
p_array = list(map(int, input().split()))

n,m = line[0],line[1]

sum_array = sum(p_array)
# j_sum = int(sum_array / (4 * m))
j_sum = sum_array / (4 * m)

tmp = []

for i in p_array:
    if i < j_sum:
        continue
    tmp.append(i)

if len(tmp) >= m:
    print('Yes')
else:
    print('No')

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

#define rep(i, m, n) for(int(i) = (int)(m); i < (int)(n); ++i)
#define rep2(i, m, n) for(int(i) = (int)(n)-1; i >= (int)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
//constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;

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

//グラフ関連
struct Edge {
    ll to, cap, rev;
    Edge(ll _to, ll _cap, ll _rev) {
        to = _to;
        cap = _cap;
        rev = _rev;
    }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph &G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
    G[from].push_back(Edge(to, cap, (ll)G[to].size()));
    if(revFlag)
        G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve() {
    ll n;
    cin >> n;
    vec<ll> x(n);
    REP(i, n) {
        cin >> x[i];
    }

    Array con(n, 0);
    Array r(n, 0);
    r[0] = x[0];
    rep(i, 1, n) {
        if(r[i - 1] >= (con[i - 1] + 1)) {
            con[i] = con[i - 1] + 1;
        } else {
            con[i] = con[i - 1];
            r[i]++;
        }
        r[i] += r[i - 1] + x[i] - x[i - 1] - 1;
    }

    ll ans = 1;
    ll l = n;
    REP2(r, n) {
        chmin(l, r - con[r]);

        //cout << l << " " << r << en;
        (ans *= r - l + 1) %= MOD;
    }
    cout << ans << en;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /*
    ll t;
    cin >> t;
    while(t--)*/
    solve();

    return 0;
}


Measured memory_bytes: 5572
#include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main(){
	while(1){
		int n,c=0;
		cin>>n;
		if(n==0) break;
		vi k(n);
		rep(i,0,n){
			cin>>k[i];
			if(k[i]>0) c++;
		}
		sort(all(k));
		if(k[n-1]>=2) o(c+1);
		else o("NA");
	}
}

Measured memory_bytes: 1252
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep2(i, m, n) for (int i = m; i < n; ++i)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
// vvi data(n, vi(m));
using vll = vector<long long>;
using vvll = vector<vll>;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

int main() {
  int x, y, z;
  cin >> x >> y >> z;
  cout << x * y / 2 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
    
    typedef struct point_ {
        long long x; 
        long long y; 
        long long h;
    } Point;

    
    int main(){
        int n;
        cin >> n;
        long long xt,yt,ht;
        vector<Point> v;
        int t = 0;
        for(int i = 0; i < n ; i++){
            cin >> xt >> yt >> ht;
            Point *p1 = new Point;
            p1->x = xt;
            p1->y = yt;
            p1->h = ht;
            v.push_back(*p1);
            if(ht != 0){
                t = v.size() - 1;  
            } 
        }
        bool flg;
        long long ha;
        long long h2;
        for(int i = 0 ; i <= 100 ; i++){
            for(int j = 0 ; j <= 100 ; j++){
                flg = true;
                Point p3 = v[t];
                ha =  abs(i -p3.x) + abs(j - p3.y) + p3.h;
                ha = max(ha, 0ll);
                for(int k = 0 ; k < v.size(); k++){
                    Point p4 = v[k];
                    h2 = max(ha - abs(i - p4.x) - abs(j - p4.y) , 0ll ); 
                    if(h2 != p4.h) {
                        flg = false;
                    }
                }
                if(flg){
                    cout << i << " " << j << " " << ha << endl;
                    return 0;
                }
            }
        }
        
        return 0;
    }

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b,c;
 while(scanf("%d%d",&a,&b)!=EOF)
    {
       c=a%b;
        while(c!=0)
        {
            a=b;
            b=c;
            c=a%b;
        }
        printf("%d\n",b);
    }
    return 0;
}



Measured memory_bytes: 2076
#include<bits/stdc++.h>
using namespace std;
int dp[100005][4];
int solve(vector<vector<int>>& arr, int index, int prev) {
	// cout<<"Solve "<<index<<" "<<prev<<endl;
	int n = arr.size();


	if (index == n) {
		return 0;
	}
	if (prev != -1 && dp[index][prev] != -1) {
		return dp[index][prev];
	}
	int ans = INT_MIN;
	vector<int> happiness = arr[index];
	int a = happiness[0];
	int b = happiness[1];
	int c = happiness[2];
	if (prev == -1) {
		ans = max(a + solve(arr, index + 1, 1), max(b + solve(arr, index + 1, 2), c + solve(arr, index + 1, 3)));
	} else {
		for (int i = 1; i <= 3; i++) {
			if (i == prev) {
				continue;
			} else {
				ans = max(ans, happiness[i - 1] + solve(arr, index + 1, i));
			}
		}
	}
	if (prev != -1) {
		return dp[index][prev] = ans;
	}
	return ans;
}

int main() {
	int n, a, b, c;
	cin>> n;
	vector<vector<int>> arr;
	for (int i = 0; i < n; i++) {
		dp[i][0] = -1;
		dp[i][1] = -1;
		dp[i][2] = -1; 
		dp[i][3] = -1;
		cin>>a>>b>>c;
		vector<int> curVec;
		curVec.push_back(a);
		curVec.push_back(b);
		curVec.push_back(c);
		arr.push_back(curVec);
	}
	cout<<solve(arr, 0, -1)<<endl;
}

Measured memory_bytes: 22740
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen(".in.txt", "r", stdin);
	freopen(".out.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, k, ans = 0; cin >> n >> k;
	vector<bool> ok(n);
	for(int i = 0; i < k; i++)
	{
		int d; cin >> d;
		for(int j = 0; j < d; j++)
		{
			int a; cin >> a;
			a--;
			ok[a] = 1;
		}
	}
	for(int i = 0; i < n; i++) if(!ok[i]) ans++;
	cout << ans;

	return 0;
}

Measured memory_bytes: 3656
# from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import scipy as scp

# strlist = "abcdefghijklmnopqrstuvwxyz"
s = input()

ans = "No"
if s[2] == s[3]:
    if s[4] == s[5]:
        ans = "Yes"

print(ans)
# print("{:.10f}".format(ans))
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する



Measured memory_bytes: 2940
from sys import stdin
#from collections import deque
#from math import sqrt, floor, ceil, log, log2, log10, pi, gcd
def ii(): return int(stdin.readline())
def fi(): return float(stdin.readline())
def mi(): return map(int, stdin.readline().split())
def fmi(): return map(float, stdin.readline().split())
def li(): return [x for x in mi()]
def si(): return stdin.readline()
z=['Yes', 'No']
n=ii()
f=n%2
a=si()
if not f:
    x=n//2
    for i in range(x):
        if a[i]!=a[i+x]:
            f=1
            break
print(z[f])

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

using namespace std;

int main()
{
    int N, tc = 1;
    while (cin >> N, N) {
        vector<double> X1(N), Y1(N), X2(N), Y2(N);
        vector<double> xs, ys;
        for (int i = 0; i < N; i++) {
            double x, y, r;
            cin >> x >> y >> r;
            X1[i] = x - r; Y1[i] = y - r;
            X2[i] = x + r; Y2[i] = y + r;
            xs.push_back(X1[i]); xs.push_back(X2[i]);
            ys.push_back(Y1[i]); ys.push_back(Y2[i]);
        }

        sort(xs.begin(), xs.end());
        xs.erase(unique(xs.begin(), xs.end()), xs.end());

        sort(ys.begin(), ys.end());
        ys.erase(unique(ys.begin(), ys.end()), ys.end());
        
        double res = 0;
        for (int i = 0; i < (int)xs.size()-1; i++) {
            for (int j = 0; j < (int)ys.size()-1; j++) {
                int cnt = 0;
                for (int k = 0; k < N; k++) {
                    if (X1[k] <= xs[i] && xs[i+1] <= X2[k] &&
                        Y1[k] <= ys[j] && ys[j+1] <= Y2[k]) {
                        cnt++;
                    }
                }
                if (cnt > 0) {
                    res += (xs[i+1] - xs[i]) * (ys[j+1] - ys[j]);
                }
            }
        } 
        printf("%d %.2f\n", tc++, res);
    }        
    return 0;
}

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


using namespace std;



const int MAXN = 100 * 1000 + 23, MXLN = 17 + 3;











int n, mx, dp[MAXN], cnt[MAXN][MXLN];
vector<int> g[MAXN];


void dfs(int v = 0, int p = -1) {
	for (auto u : g[v]) if (u != p) {
		dfs(u, v);
		dp[v] |= dp[u];
		for (int i = 0; i < MXLN; i++) cnt[v][i] += ((dp[u] >> i) & 1);
	}
//	/*
	int b = 0, f = 1;
	for (int i = 0; i < MXLN; i++) {
		if (cnt[v][i] > 1) {
			b = i + 1;
			f = 1;
		} else {
			if (cnt[v][i]) b += f;
			else f = 0;
		}
	}
//	*/
//	for (int i = 0; i < MXLN; i++) if (cnt[v][i] > 1) b = i;
	dp[v] &= (((1 << MXLN) - 1) ^ ((1 << b) - 1));
	dp[v] |= (1 << b);
	mx = max(mx, b);
}




int main() {
	cin >> n;
	for (int i = 1; i < n; i++) {
		int u, v;
		cin >> u >> v;
		g[--u].push_back(--v), g[v].push_back(u);
	}
	dfs();
	cout << mx;
	return 0;
}

Measured memory_bytes: 19584
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char x[3];
  cin >> x;
 
  if (x[0]==x[1] && x[1]==x[2]) {
    cout << "Yes" << endl;
  }
  else if(x[1]==x[2] && x[2]==x[3]){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<climits>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<iomanip>
#include<deque>
using namespace std;

#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define rep2(i,j,n) for(int i=(j);i<=(n);i++)
#define all(i) i.begin(),i.end()

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<int, int> pi;
typedef long long i64;

int main() {
	int n;
	cin >> n;
	vi a(n);
	int cou = 0;
	rep(i, 0, n) {
		cin >> a[i];
		if (a[i] % 2 == 1) {
			cou++;
		}
	}
	if (cou % 2 == 1) {
		cout << "NO\n";
	}
	else {
		cout << "YES\n";
	}
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int N = 25;

#define endl "\n"

int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	int n, a[N], b[N], c[N];
	cin >> n;
	a[0] = -1;
	for (int i = 1; i <= n; i++) cin >> a[i];
	for (int i = 1; i <= n; i++) cin >> b[i];
	for (int i = 1; i < n; i++) cin >> c[i];

	int sum = 0;
	for (int i = 1; i <= n; i++) {
		sum += b[a[i]];
		if (a[i - 1] == a[i] - 1) sum += c[a[i-1]];
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdlib.h>
#include <assert.h>
#include <iostream>
#include <algorithm>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <complex>
#include <iomanip>
#include <bitset>
#include <random>
#include <vector>
#include<string>

using namespace std;

int main() {
	int n, i, h[222222], ans;
	char s[222222];
  cin>>n>>s;
	if (s[0] == '.')
		h[0] = 1;
	else
		h[0] = 0;
	for (i = 1; i < n; i++) {
		if (s[i] == '.')
			h[i] = h[i - 1] + 1;
		else
			h[i] = h[i - 1];
	}
	int p;
	ans =h[n - 1];
	for (i = 0; i < n; i++) {
		p = i+1 - h[i] * 2 + h[n - 1];
		if (p < ans)
			ans = p;
	}
	cout << ans << endl;
}


Measured memory_bytes: 1280
#include <stdio.h>

int max(int a, int b) {
    return a > b ? a : b;
}
int min(int a, int b) {
    return a > b ? b : a;
}

int main(void) {
    int N, i, a, b, c, high, mid, low;

    scanf("%d", &N);

    for(i = 0; i < N; i++) {
        scanf("%d%d%d", &a, &b, &c);

        high = max(a, max(b, c));
        low = min(a, min(b, c));
        mid = high == a ? max(b, c) : high == b ? max(a, c) : max(a, b);

        if((low * low) + mid * mid == high * high) {
            printf("YES\n");
        } else {
            printf("NO\n");
        }
    }
    return 0;
}

Measured memory_bytes: 0
using System;
using System.Linq;
using System.Collections.Generic;

namespace D
{
    class Program
    {
        static void Main(string[] args)
        {
            var xy = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var f = Modular.Factorial(1);

            if (xy.Sum() % 3 != 0)
            {
                Console.WriteLine(0);
            }
            else
            {
                var n = (2 * xy[0] - xy[1]) / 3;
                var m = (-xy[0] + 2 * xy[1]) / 3;
                if (n < 0 || m < 0)
                {
                    Console.WriteLine(0);
                }
                else
                {
                    var ans = Modular.nCr(n + m, n);
                    Console.WriteLine((int)ans);
                }
            }
        }
    }


    class Modular
    {
        private const int MOD = 1000000000 + 7;
        private long value;
        public Modular(long value) { this.value = value; }

        public static implicit operator Modular(long a)
        {
            var m = a % MOD;
            return new Modular((m < 0) ? m + MOD : m);
        }
        public static explicit operator int(Modular a)
        {
            return (int)a.value;
        }

        public static Modular operator +(Modular a, Modular b)
        {
            return a.value + b.value;
        }

        public static Modular operator -(Modular a, Modular b)
        {
            return a.value - b.value;
        }
        public static Modular operator *(Modular a, Modular b)
        {
            return a.value * b.value;
        }
        private static Modular Pow(Modular a, int n)
        {
            switch (n)
            {
                case 0:
                    return 1;
                case 1:
                    return a;
                default:
                    var p = Pow(a, n / 2);
                    return p * p * Pow(a, n % 2);
            }
        }
        public static Modular operator /(Modular a, Modular b)
        {
            return a * Pow(b, MOD - 2);
        }

        private static readonly List<int> facs = new List<int> { 1 };
        public static Modular Factorial(int n)
        {
            for (int i = facs.Count(); i <= n; i++)
            {
                facs.Add((int)(Math.BigMul(facs.Last(), i) % MOD));
            }
            return facs[n];
        }

        public static Modular nCr(int n, int r)
        {
            return n < r ? 0
                : (n == r) ? 1
                : Factorial(n) / (Factorial(r) * Factorial(n - r));
        }

        public static Modular nPr(int n, int r)
        {
            return Factorial(n) / Factorial(n - r);
        }

    }

}


Measured memory_bytes: 18400
while true
    n,x = gets.split.map(&:to_i)
    sum = 0
    if n==0 && x==0 then break end

    for i in 1...n
        for j in (i+1)...(x-i)
            k = x-i-j
            if j < k && k <= n then sum += 1 end
        end
    end
    puts sum
end

Measured memory_bytes: 8684
import math
def c():
    N, M = map(int, input().split())
    f = math.factorial
    if abs(N-M) > 1:
        print(0)
    elif N > M or M > N:
        print( f(N)*f(M) % (10**9 + 7) )
    elif N == M:
        print( (f(N)*f(M))*2 % (10**9 + 7))

c()


Measured memory_bytes: 5192
// warm heart, wagging tail,and a smile just for you!
//
//                            ▒█████▒▒
//                             ██████████▒
//                             ▒████████████▒
//                            ██████████████████
//                           ████████████████████▒
//                          ▒██████████████████████▒
//                          ▒███████████████████████
//                      ▒████▒▒▒▒▒▒█████████████████▒
//                    ███▒▒▒▒▒▒██████████████████████▒▒▒
//                  ▒██▒▒███████████████████████▒▒▒▒▒██████
//                 ▒█████████████████████████▒▒▒▒▒▒█████████▒
//                 ▒█████████████████████▒▒▒▒▒▒██████████████
//                  ▒████         ████▒▒▒▒▒████         ████▒
//              ▒█████▒    ████    ▒▒▒▒███████    ████    ██████▒
//            ▒██▒▒▒▒▒    ██████    █████████    ██████    ██▒▒▒██▒
//           █████████   ████████   █████████   ████████   ▒▒▒▒█████
//          ▒█████████    ██████    ████████▒    ██████    █████████
//          ▒██████████    ████    █████▒▒▒▒▒▒    ████    ██████████
//           ████████████        ▒▒▒▒▒▒▒████████        ███████████▒
//       ▒██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒███████████████████████████████████▒
//     ███▒▒▒▒▒▒▒▒▒▒▒▒█████████████████████████████████████████▒▒████████▒
//   ▒▒▒▒▒▒▒▒▒██████████████                         ███████▒▒▒▒███████████
//   █████████████████████████                     ███████▒▒▒██████████████▒
//   █████████████████████████████             ███████▒▒▒██████████████████▒
//   ██████████████████████████████████████████████████████████████████████
//    ██████████████████████████████████████████████████████████████████▒
//      ▒█████████████████▒▒▒▒▒▒▒██████████████████████████████████▒▒▒
//
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#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(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int n;
  cin >> n;

  vector<P> a(n);
  REP(i,n) cin >> a[i].fs >> a[i].sc;
  
  auto comp = [](P a, P b){return a.fs+a.sc < b.fs+b.sc;};
  sort(a.begin(),a.end(),comp);

  mat dp(n+1,vec(n+1,INF));
  dp[0][0] = 0;
  REP(i,n){
    REP(j,n+1){
      dp[i+1][j] = min(dp[i+1][j],dp[i][j]); //取らない
      if(dp[i][j] <= a[i].fs) dp[i+1][j+1] = min(dp[i+1][j+1],dp[i][j]+a[i].sc); //取る
    }
  }

  RREP(i,n+1){
    if(dp[n][i] != INF){
      cout << i << endl;
      return 0;
    }
  }

  return 0;
}

Measured memory_bytes: 198016
/*
*  author: mkbaloch
*  time:   2019-12-31 14:33:16
*/

#include<bits/stdc++.h>
#define vi vector<int>
#define ll long long
#define pi pair<int, int>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define rep(i, a, b) for(int i=a; i<=b; i++)
#define repn(i, n) for(int i=0; i<(int)n; i++)

using namespace std;

static bool is_prime(ll i){
 ll sq = ceil(sqrt(i));
 for(ll j = 2; j<sq; j++) if(i % j == 0) return false;
 return true;
}

int main()
{
 ll n;
 cin >> n;
 for(int i = n; ; i++){
  if(is_prime(i)){
   cout << i << endl;
   break;
  }
 }
 return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define MAX 9999999
#define N 105
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
 
int n,d[3][N],point[3][N],r[N];
 
void cal(int x){
  for(int i=0;i<n;i++){
    int cnt=0;
    for(int j=0;j<n;j++){
      if(d[x][i]<d[x][j]){
	cnt++;
      }
    }
    point[x][i]=r[cnt];
  }
}
int a[N],sum[N];
 
int check(int x){
  for(int i=1;i<=100;i++){
    d[x][0]++;
    for(int j=0;j<n;j++){
      int cnt=0;
      for(int k=0;k<n;k++){
	if(d[x][j]<d[x][k]){
	  cnt++;
	}
      }
      a[j]=r[cnt];
    }
    memset(sum,0,sizeof(sum));
    for(int j=0;j<n;j++)
      for(int k=0;k<3;k++){
	if(k==x)sum[j]+=a[j];
	else sum[j]+=point[k][j];
      }
    int cnt=0;
    for(int j=0;j<n;j++)
      if(sum[0]<sum[j])cnt++;
    if(cnt+1<=8)return i;
  }
  return INF;
}
 
int main(){
  cin>>n;
  rep(i,n) cin>>r[i];
  rep(i,n) cin>>d[0][i]>>d[1][i]>>d[2][i];
  
  rep(i,3)cal(i);
     
  int ans=INF;
  rep(i,3)ans=min(ans,check(i));
  if(ans!=INF)cout<<ans<<endl;
  else cout<<"Saiko"<<endl;
  return 0;
}

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

pair<string,int>a[200001];
bool cmp(pair<string,int> a,pair<string,int> b)
{
	if(a.second==b.second)
		return a.first<b.first;
	return a.second<b.second;
}
map<string,int>mp;
string s;
signed main()
{
	int n,cnt=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		cin>>s;
		if(!mp[s])
			mp[s]=++cnt;
		a[mp[s]].first=s;
		a[mp[s]].second++;
	}
	sort(a+1,a+cnt+1,cmp);
	for(int i=1;i<=cnt;i++)
		if(a[i].second==a[cnt].second)
			cout<<a[i].first<<endl;
	return 0;
}


Measured memory_bytes: 28288
n = int(input())
dic = {}
for _ in range(n):
    s = input()
    if s not in dic:
        dic[s] = 1
    else:
        dic[s] += 1

m = 0
for i in dic:
    m = max(dic[i],m)
    
lis = []
for i in dic:
    if dic[i] == m:
        lis.append(i)
        
lis.sort()
for i in lis:
    print(i)
    


Measured memory_bytes: 32096
#include<cstdio>
char s[100001];
int main(){
    scanf("%s",s);
    int n[2]={};
    for(int i=0;s[i]!='\0';i++)n[s[i]-'0']++;
    printf("%d\n",(n[0]<n[1])?(2*n[0]):(2*n[1]));
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
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 = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int 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
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}

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

ll n;

int main(){
	cin >> n;
	ll num;
	rep(i,n){
		ll a;
		cin >> a;
		if(i == 0)num = a;
		else num = gcd(num,a);
	}
	cout << num << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;

int main(){
    string a, b;
    cin >> a >> b;
    string c {a + b};
    int d {stoi(c)};
    for (auto i: irange(0, 317)){
        if (d == pow(i, 2)){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


int main() {
    string s; cin >> s;
    const string ABC = "ABC";
    const string ARC = "ARC";
    cout << (s == ABC ? ARC : ABC) << endl;

    return 0;
}

Measured memory_bytes: 3656
import java.util.*

fun main(argv : Array<String>){
    
    val scan = Scanner(System.`in`)
    
    //
    val A = scan.nextInt()
    val B = scan.nextInt()
    val C = scan.nextInt()
    val D = scan.nextInt()

    //
    when{
        C>B -> println(0)
        A>D -> println(0)
        else -> {
            var a = intArrayOf(A,B,C,D)
            Arrays.sort(a)
            println(a[2]-a[1])
        }
    }
}



Measured memory_bytes: 31136
#include <iostream>

using namespace std;

int main(int argc, char *argv[]) {
  int x = 0;
  for (int i = 1;i<=10000; i++) {
    cin >> x;
    if (x == 0)
      break;
    cout << "Case " << i << ": " << x << endl;
  }
  return 0;
}

Measured memory_bytes: 3088
n=int(input())
A=list(map(int,input().split()))
M=list(map(int,input().split()))
L=list(map(int,input().split())) ; ans=0
for i in range(n):
    ans+=M[A[i]-1]
    if i!=n-1:
        if A[i]+1==A[i+1]:
            ans+=L[A[i]-1]
print(ans)
    

Measured memory_bytes: 3060
#include <bits/stdc++.h>  
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define forn(i,a,b)        for( i = a ; i < b  ; i++ )
#define debug(x)           cout << #x << " " << x << " -- "
#define I__O               ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll                 long long  
#define p(x)               cout << x << "\n" ; 
#define MOD                100000007
#define pi                 pair<int,int>
#define vi                 vector <int>
#define pb                 push_back
#define vp                 vector <pair<ll,ll>>
#define endl               cout << "\n"
#define mi                 map <int,int> 
#define f1                 first 
#define s1                 second    
#define in                 insert
#define all(x)             x.begin(),x.end() 
/*
    time : 6:26:43 PM
    date : 3/12/2020
*/    
using namespace std ; 
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set ; 
const int N = 2e5;  
const double pie = 3.14159265358979323846 ;
double dist(double Ax,double X,double Ay, double Y){
  double best = (Ax-Ay)*(Ax-Ay) + (X-Y)*(X-Y) ;
  best = sqrt(best) ;
  return best ;
} 
int tests(){
  ll h,w ;
  cin >> h >> w ;
  if(h == 1 )
    return cout << 1 << '\n',0 ;

  if(w == 1 )
    return cout << 1 << '\n',0 ;

  cout << ((w+1)/2)*((h+1)/2) + ((w/2)*(h/2));   
}
int main(){
    I__O ;  
    int cases = 1 ; 
    // cin >> cases ; 
    while(cases--)
      tests(); 
    return 0 ; 
}


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

auto main () -> int
{
    double v;
    while (std::cin >> v)
    {
        auto t = v / 9.8;
        auto y = 4.9 * t * t;
        auto n = (y + 5) / 5;
        auto ans = std::ceil (n);
        std::cout << ans << std::endl;
    }
}

Measured memory_bytes: 3204
n, m, q = map(int, input().split())
abcd = [tuple(map(int, input().split()))for _ in range(q)]
ls = []


def dfs(x, s):
    if len(s) == n:
        ls.append(s)
        return 0
    else:
        for y in range(x, m):
            dfs(y, s+str(y))


dfs(0, "")
ans = 0
for x in ls:
    x = tuple(map(lambda x: int(x)+1, list(x)))
    cnt = 0
    for a, b, c, d in abcd:
        a -= 1
        b -= 1
        if x[b]-x[a] == c:
            cnt += d
    if ans < cnt:
        ans = cnt
print(ans)

Measured memory_bytes: 15324
n, m = map(int, input().split())
aa = {int(input()) for _ in range(m)}
dp = [0 for _ in range(n + 1)]
dp[0] = 1

if 1 not in aa:
    dp[1] = 1

for i in range(2, n + 1):
    if dp[i - 1] > 0 and (i - 1) not in aa:
        dp[i] += dp[i - 1]
    if dp[i - 2] > 0 and (i - 2) not in aa:
        dp[i] += dp[i - 2]

print(dp[-1] % 1000000007)


Measured memory_bytes: 462744
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

n=k()
ans=0
for i in range(2,1000010):
	power=0
	j=1
	if(n%i==0):
		while(n%i==0):
			power+=1
			n=(n//i)
		while(power>=j):
			power-=j
			j+=1
			ans+=1
if(n>1):
	ans+=1
print(ans)


Measured memory_bytes: 10408
#include<iostream>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<cctype>
using namespace std;
int n;
int main()
{
	int a,b,c;
	scanf("%d%d%d%d",&a,&b,&c,&n);
	int ans(0);
	for(register int i(0);(i<=a)&&((i*500)<=n);i++){for(register int j=(0);(j<=b)&&((i*500+j*100)<=n);j++){for(register int k=(0);(k<=c)&&((i*500+j*100+k*50)<=n);k++){ans+=(!((i*500+j*100+k*50)-n));}}}
	printf("%d",ans);
	putchar(10);
	return 0;
}

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

long long v[100004], x[100004];
long long ri[100004], lef[100004];

int main() {
	long long n, c;
	cin >> n >> c;
	for (int i = 1; i <= n; i++) {
		cin >> x[i] >> v[i];
	}
	x[0] = v[0] = 0;
	x[n + 1] = c;
	v[n + 1] = 0;
	long long ans = 0;
	ri[0] = lef[0] = 0;
	long long now = 0;
	for (int i = 1; i <= n; i++) {
		now = now + v[i] - (x[i] - x[i - 1]);
		if (now>ri[i - 1]) {
			ri[i] = now;
		}
		else {
			ri[i] = ri[i - 1];
		}
	}
	now = 0;
	lef[0] = 0;
	for (int i = 1; i <= n; i++) {
		now = now + v[n - i + 1] - (x[n + 2 - i] - x[n + 1 - i]);
		if (now>lef[i - 1]) {
			lef[i] = now;
		}
		else {
			lef[i] = lef[i - 1];
		}
	}
	for (int i = 0; i< n; i++) {
		long long p;
		p = ri[i] + lef[n - i] - x[i];
		ans = max(ans, p);
	}
	for (int i = 0; i<n; i++) {
		ans = max(ans, lef[i] + ri[n - i] - c + x[n + 1 - i]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 3328