akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

// b は 1 ~ 100 なので -1 をマーク済みとする
const int marked = -1;

int main() {
  int card[3][3];

  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> card[i][j];
    }
  }

  int N;
  cin >> N;

  // N は10以下なので愚直に回してcardに印をつける
  for (int i = 0; i < N; i++) {
    int tmp;
    cin >> tmp;

    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < 3; k++) {
        if (card[j][k] == marked) continue;
        if (card[j][k] == tmp) {
          card[j][k] = marked;
          break;
        }
      }
    }
  }

  bool isBingo = false;
  // 横
  for (int i = 0; i < 3; i++) {
    if (card[i][0] == marked && card[i][1] == marked && card[i][2] == marked) {
      isBingo = true;
    }
  }

  // 縦
  for (int i = 0; i < 3; i++) {
    if (card[0][i] == marked && card[1][i] == marked && card[2][i] == marked) {
      isBingo = true;
    }
  }

  // 斜め
  if (card[0][0] == marked && card[1][1] == marked && card[2][2] == marked) {
    isBingo = true;
  }
  if (card[0][2] == marked && card[1][1] == marked && card[2][0] == marked) {
    isBingo = true;
  }

  cout << (isBingo ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int min=0,max=0,N=0;
	long long sum=0;
	scanf("%d",&N);
	scanf("%d",&min);
	max=min; sum+=min;
	for(int i=0; i<N-1; i++){
		int tmp=0;
		scanf("%d",&tmp);
		sum+=tmp;
		if(tmp<min){
			min=tmp;
		}
		if(tmp>max){
			max=tmp;
		}
	}
	printf("%d %d %ld\n",min,max,sum);
	return 0;
}



Measured memory_bytes: 2756
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		int N = reader.nextInt();
		int K = reader.nextInt();
		int[] X = new int[N];
		int ans = 0;
		for (int i=0; i<N; i++) {
			X[i] = reader.nextInt();
			if (X[i] > K/2) {
				ans += (K-X[i])*2;
			} else {
				ans += X[i]*2;
			}
		}

		System.out.println(ans);
		reader.close();

	}
}





Measured memory_bytes: 21844
let op x = match x with
    '+' -> (+)
  | '-' -> (-)
  | '*' -> ( * )
  | '/' -> (/)
  | _ -> (fun x -> fun x -> x);;

let rec read () =
  let f x y z = match y with
    '?' -> ()
    | y -> Printf.printf "%d\n" ((op y) x z);read ()
  in
  Scanf.scanf "%d %c %d\n" f;;

 let () = read ();;

Measured memory_bytes: 2392
#include<bits/stdc++.h>
using namespace std;
int n,x,y,ans=1e8;
int a[50],b[50],c[50],dp[410][410];
int main(){
	cin>>n>>x>>y;
	for(int i=1;i<=n;i++)
		cin>>a[i]>>b[i]>>c[i];
	for(int i=0;i<=400;i++)
		for(int j=0;j<=400;j++)
			dp[i][j]=1e9;
	dp[0][0]=0;
	for(int l=1;l<=n;l++)
		for(int i=400;i>=a[l];i--)
			for(int j=400;j>=b[l];j--)
				dp[i][j]=min(dp[i][j],dp[i-a[l]][j-b[l]]+c[l]);
	for(int i=1;max(x,y)*i<=400;i++)
		ans=min(ans,dp[x*i][y*i]);
	if(ans>1e7)
		cout<<-1;
	else
		cout<<ans;
	return 0;
}

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

const int INF = 1e9;

int main() {
	int h, w;
	cin >> h >> w;
	vector<vector<int>> c(10, vector<int>(10));
	rep(i, 10) rep(j, 10) cin >> c[i][j];
	rep(k, 10) rep(i, 10) rep(j, 10) {
		c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
	}
	int ans = 0;
	rep(i, h) rep(j, w) {
		int a;
		cin >> a;
		if (a < 0) continue;
		ans += c[a][1];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3640
fun main(args: Array<String>){
    val N = readLine()!!.toInt()
    val price :MutableList<Int> = mutableListOf<Int>()

    for(i in 0 .. N-1){
        price.add(readLine()!!.toInt())
    }

    var ex = 0
    var index = 0
    var sum = 0

    for(i in 0 .. N-1){
        if(price[i] >= ex){
            ex = price[i]
            index = i
        }
        sum += price[i]
    }

    sum = sum - ex

    sum = sum + ex/2

    println(sum)


}


Measured memory_bytes: 33780
max_n=10**6
mod=10**9+7

inv=[1,1]
inv_frac=[1,1]
for i in range(2,max_n):
  inv.append((mod-inv[mod%i]*(mod//i))%mod)
  inv_frac.append((inv_frac[-1]*inv[-1])%mod)


n,a,b=map(int,input().split())
s=pow(2,n,mod)
ca=inv_frac[a]
for i in range(a):
  ca=(ca*(n-i))%mod

cb=inv_frac[b]
for i in range(b):
  cb=(cb*(n-i))%mod
print((s-ca-cb-1)%mod)
  

Measured memory_bytes: 212764
#include <bits/stdc++.h>
 
using namespace std;
#define ll long long
const ll INF=1e15;
#define int long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define fastio cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(false)
const double pi = acos(-1.0);
int gcd (int a, int b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}
int lcm (int a, int b) {
    return a / gcd(a, b) * b;
}
 
long long binpows(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)  //impar
            res = res * a;
        a = a * a;
        b >>= 1;  // /2
    }
    return res;
}
const int mod=1e9+7;
int binpow(int a, int b, int m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
//CHECAR SE PRECISA DE LONG LONG
int n;
vector<int> v;
int dp[401][401];
int pre[402];
int resolve(int l, int r){
	if(l==r){
		return 0;
	}
	int &x=dp[l][r];
	if(x!=-1)
		return x;
	x=INF;
	for(int i=l; i<r; i++){
		x=min(x,resolve(l,i)+resolve(i+1,r) + pre[r+1]-pre[l]);
	}
	return x;
}
void solve(){
	memset(dp,-1,sizeof(dp));
	pre[0]=0;
	cin>>n;
	v.resize(n);
	for(auto &i: v)
		cin>>i;
	for(int i=1; i<=n; i++){
		pre[i]=v[i-1];
		pre[i]+=pre[i-1];
	}
	cout<<resolve(0,n-1)<<endl;
}
//revise as variaveis e a ordem nas funções
signed main(){fastio;
    int t=1;
    //cin>>t;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 4952
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    set<int> st;
    REP(i,3) {
        int x; cin >> x;
        st.insert(x);
    }

    ATYN(st.size() == 2)

    return 0;
}

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

using namespace std;

int main() {
    string S;
    cin >> S;
    if (S.compare("Cloudy")==0) {
        cout << "Rainy" << endl;
    } else if (S.compare("Rainy")==0) {
        cout << "Sunny" << endl;
    } else {
        cout << "Cloudy" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
	string S, T, U;
	int A, B;
	cin >> S >> T >> A >> B >> U;

	if (U == S) {
		cout << A - 1 << " " << B << endl;
	}
	else if (U == T) {
		cout << A << " " << B - 1 << endl;
	}
	else if (U != S && U != T) {
		cout << A << " " << B << endl;
	}

	return 0;
}

Measured memory_bytes: 256
s=gets.chomp.chars
t=gets.chomp.chars
h=Hash.new(0)
k=Hash.new(0)
s.each{|x|h[x]+=1}
t.each{|x|k[x]+=1}
s.map!{|x|x=h[x]}
t.map!{|x|x=k[x]}
puts (s==t)? "Yes": "No"


Measured memory_bytes: 35220
/*
Cerberus97
Hanit Banga
*/

#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e2 + 10, K = 49, H = 100;

char s[N][N];

int main() {
	int a, b;
	cin >> a >> b;
	--a; --b;
	for (int i = 1; i <= H; ++i) {
		for (int j = 1; j <= 50; ++j) {
			s[i][j] = '#';
		}
		for (int j = 51; j <= H; ++j) {
			s[i][j] = '.';
		}
		s[i][H + 1] = 0;
	}
	for (int i = 1; i <= H; i += 2) {
		for (int j = 1; j <= K; j += 2) {
			if (a) {
				s[i][j] = '.';
				--a;
			} else {
				break;
			}
		}
		for (int j = K + 3; j <= H; j += 2) {
			if (b) {
				s[i][j] = '#';
				--b;
			} else {
				break;
			}
		}
	}
	cout << H << ' ' << H << endl;
	for (int i = 1; i <= H; ++i) {
		cout << (s[i] + 1) << '\n';
	}
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int a[3000],b[3000];
	int i=0;
	while(1){
		scanf("%d %d", &a[i], &b[i]);
		if(a[i]==0 && b[i]==0)break;
		if(b[i] < a[i]){
			int tmp = a[i];
			a[i] = b[i];
			b[i] = tmp;
		}
		printf("%d %d\n", a[i], b[i]);
		i = i + 1;
	}
	return 0;
}

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

using namespace std;

int main () {
	int n;
	cin >> n;
	long long a[200005];
	for (int i=1;i<=n;i++) cin >> a[i];
	long long sum=0;
	for (int i=1;i<=n;i++) {
		sum+=a[i];
	}
	a[0]=0;
	for (int i=1;i<=n;i++) {
		a[i]+=a[i-1];
	}
	long long ans=2000000007;
	for (int i=1;i<n;i++) {
		ans=min(ans,abs(a[i]-(sum-a[i])));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define reps(i,n) for (int i=1;i<=(n);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rreps(i,n) for (int i=(n);i>0;i--)
#define all(v) (v).begin(),(v).end()
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>
template<class T> inline bool chmin(T &a, T b) {if (a>b) {a = b; return 1;} return 0;};
template<class T> inline bool chmax(T &a, T b) {if (a<b) {a = b; return 1;} return 0;};
typedef long long int ll;
const long long INF = 1LL << 60;

int main(){
  int N, K; cin >> N >> K;
  int A[N]; rep(i,N) cin >> A[i];

  int l=0,r=1000000000;
  while (abs(l-r)>1){
    int x = (l+r)/2;
    ll tmp = 0;
    rep(i,N) tmp += (A[i]-1)/x;
    if (tmp<=K) r = x;
    else l = x;
    // cout << l << " " << r << endl;
  }
  cout << r << endl;
  
  // cout << fixed << setprecision(10);
  
  return 0;
}


Measured memory_bytes: 4380
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define mod 1000000007
typedef long long int ll;
int u(const void *a, const void *b){
    return *(ll*)a-*(ll*)b;
}
int d(const void *a, const void *b){
    return *(ll*)b-*(ll*)a;
}
int z(int a){
  if(a<1)a*=-1;
  return a;
}
int min(int a,int b){
  if(a>b)return b;
  return a;
}
int max(int a,int b){
  if(a>b)return a;
  return b;
}
int gcd(int a,int b){
  if(!b)return a;
  return gcd(b,a%b);
}
int kt(ll a){
  int sum=0;
  while(a){
    a/=10;
    sum++;
  }
  return sum;
}
int ks(ll a){
  int sum=0;
  while(a){
    sum+=a%10;
    a/=10;
  }
  return sum;
}
int main(void){
  char s[102];
  scanf("%s",s);
  int flg=0;
  for(int i=0;i<strlen(s);i+=2)if(s[i]=='L')flg=1;
  for(int i=1;i<strlen(s);i+=2)if(s[i]=='R')flg=1;
  char c[2][4]={"Yes","No"};
  PRS(c[flg]);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;

int comb2(int n) {
    if (n < 2) {
        return 0;
    } else if (n == 2) {
        return 1;
    } else {
        return n * (n - 1) / 2;
    }
}

int main() {
    int n, m;
    cin >> n >> m;
    cout << comb2(n) + comb2(m) << endl;
    return 0;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
string s;
int cnt[2];

int main(void){
	scanf("%d",&n);
	cin >> s;
	for(int i=0;i<n*2;i++){
		if(s[i]=='B'){
			cnt[1]++;
		}else{
			cnt[0]++;
		}
	}
	if(s[0]=='W' || s[n*2-1]=='W'){
		printf("0\n");
		return 0;
	}
	bool flag=false;
	ll ans=1;
	ll cnt=1;
	for(int i=1;i<n*2;i++){
		if(s[i]==s[i-1]){
			flag=!flag;
		}
		if(!flag){
			cnt++;
		}else{
			ans=ans*cnt%MOD;
			cnt--;
		}
	}
	if(cnt!=0){
		printf("0\n");
		return 0;
	}
	for(ll i=1;i<=n;i++){
		ans=ans*i%MOD;
	}
	printf("%lld\n",ans);
	return 0;
}


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;

int main() {
    string S;
    cin >> S;
    int s_cnt = 0;
    int d_cnt = 0;
    rep(i, S.size()) {
        if (S[i] == 'S') {
            s_cnt++;
        } else {
            if (s_cnt > 0) {
                s_cnt--;
                d_cnt++;
            }
        }
    }
    cout << S.size() - 2 * d_cnt << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<string> vs;
ll llmax = LLONG_MAX;
vll d1 = {1, 0, -1, 0}, d2 = {0, 1, 0, -1};
string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alp = "abcdefghijklmnopqrstuvwxyz";
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
void neg() {cout << -1 << endl;}
void sortll(vll &a) {sort(a.begin(), a.end());}
void sortc(string &a) {sort(a.begin(), a.end());}
void sorts(vs &a) {sort(a.begin(), a.end());}

int main() {
  ll a, b, c;
  cin >> a >> b >> c;
  if (a == b) cout << c << endl;
  else if (b == c) cout << a << endl;
  else cout << b << endl;
}

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

int main()
{
    int a, b;
    cin >> a >> b;
    if (a % 2 == 1 and b % 2 == 1)
    {
        cout << "Odd" << endl;
    }
    else
    {
        cout << "Even" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize ("Ofast")
#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;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
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 unsigned long long ull;
typedef long double ld;
typedef pair<long long,long long> ii; 	
typedef complex<long double> com;

const ll mod = 1e9+7;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    string s;
    cin >> s;
    ll n = s.size();
    vector <ll> arr(n);
    for (int z=0;z<n;z++){
        arr[z] = s[z]-'0';
    }

    vector <ll> power(n+1);
    power[0] = 1;
    for (int z=1;z<=n;z++){
        power[z] = power[z-1]*10;
        power[z] %= 2019;
    }

    vector <ll> suf(n);
    suf[n-1] = arr[n-1]; 
    map<ll,ll> mapp;
    mapp[arr[n-1]]++;
    ll ans = 0;
    ll i = 1;
    for (int z=n-2;z>=0;z--){
        suf[z] = (suf[z+1]+arr[z]*power[i])%2019;
        ans += mapp[suf[z]];
        mapp[suf[z]]++;
        i++;
    }
    cout << ans+mapp[0] << endl;
}

Measured memory_bytes: 8300
#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>;

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

int N;
int A[100100];
int B[100100], C[100100];

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

    std::cin >> N;

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

    B[0] = A[0];

    for(int i=1;i<N;++i){
        B[i] = gcd(B[i-1], A[i]);
    }

    C[N-1] = A[N-1];

    for(int i=N-2;i>=0;--i){
        C[i] = gcd(C[i+1], A[i]);
    }

    int mx = 1;

    for(int i=0;i<N;++i){
        int g = -1;

        if(i > 0){
            g = B[i-1];
        }

        if(i + 1 < N){
            if(g == -1){
                g = C[i+1];
            }else{
                g = gcd(g, C[i+1]);
            }
        }

        mx = std::max(mx, g);
    }

    std::cout << mx << std::endl;
}


Measured memory_bytes: 1408
// AtCoder ABC113: C - ID
// 2020.1.29 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef long long ll;

#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif

int in() {   // 非負整数の入力
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

void out(int n) { // 非負整数の表示（出力）
	int i, k; char b[30];

	i = 0; while (n) b[i++] = n % 10 + '0', n /= 10;
	k = 6 - i;
	while (k--) pc('0');
	while (i--) pc(b[i]);

}

#define MAX 100005
typedef struct { int id; ll n; } T;
T t[MAX]; int M;

void Usort(T *a, int n) {
	int i, k;
#define B 8
#define BMSK 255 // (1<<8)-1
	ll t1[1 << B], t2[1 << B];
	
	T *tmp = malloc(n * sizeof(T));	
	for (k = 0; k < 8; ++k) {  // for 64ビット
		memset(t1, 0, sizeof(t1)), memset(t2, 0, sizeof(t2));
		for (i = 0; i < n; ++i)	t1[(a[i].n >> k*B) & BMSK]++;
		for (i = 0; i < BMSK; ++i) t1[i+1] += t1[i];
		i = n; while (i--) tmp[--t1[(a[i].n >> k*B) & BMSK]] = a[i];
		k++;
		for (i = 0; i < n; ++i) t2[(tmp[i].n >> k*B) & BMSK]++;
		for (i = 0; i < BMSK; ++i) t2[i+1] += t2[i];
		i = n; while (i--) a[--t2[(tmp[i].n >> k*B) & BMSK]] = tmp[i];
	}
	free(tmp);
// for (i = 0; i < n; ++i) printf("[%d] %lld\n", i, a[i]);
}

int ap[MAX], ax[MAX];

int main()
{
	int i, N, P, Y, x;
	
	N = in(), M = in();
	for (i = 1; i <= M; ++i) {
		P = in(), Y = in();
		t[i].id = i, t[i].n = ((ll)P << 32) | Y;
		ap[i] = P;
	}
	Usort(t+1, M);
	for (i = 1; i <= M; ++i) {
		if ((t[i].n >> 32) != (t[i-1].n >> 32)) ax[t[i].id] = x = 1;
		else ax[t[i].id] = ++x;
	}
	for (i = 1; i <= M; ++i) {
		out(ap[i]), out(ax[i]), pc('\n');
	}
	return 0;
}


Measured memory_bytes: 3816
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
 
        Scanner sc = new Scanner(System.in);
 
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
 
        int ans = 0;
 
        for(int i = a; i <= b; i++){
            if(c%i == 0)ans++;
        }
 
        System.out.printf("%d\n",ans);
    }
}


Measured memory_bytes: 26320
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define ms(a,b) memset(a,b,sizeof(a))
#define msn(a,n,b) for(int i=0;i<=n;i++)a[i]=b
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define fi first
#define se second
using namespace std;
mt19937 rng_32(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef double db;
const int mod=1e9+7;
const int seed=233;
const double PI=acos(-1.0);
const double eps=1e-7;
const int inf=0x3f3f3f3f;
const int max_n=100005;
ll ceil(ll x,ll y){if(x==0)return 0;if(y<0)x=-x,y=-y;bool sign=x>0;x=abs(x);return sign?(x+y-1)/y:-x/y;}
ll floor(ll x,ll y){if(x==0)return 0;if(y<0)x=-x,y=-y;bool sign=x>0;x=abs(x);return sign?x/y:-(x+y-1)/y;}
char str[max_n];
void rs(string& s){scanf(" %s",str);s=str;}
namespace {
    inline int Add(int x,int y){return (x+=y)>=mod?x-mod:x;}
    inline int Sub(int x,int y){return (x-=y)<0?x+mod:x;}
    inline int Mul(int x,int y) {return 1ll*x*y%mod;}
    inline int Pow(int x,int y=mod-2){int res=1;while(y){if(y&1)res=1ll*res*x%mod;x=1ll*x*x%mod;y>>=1;}return res;}
}
/**********************head************************/
string s,t;
int main(){
    cin>>s>>t;
    t.pop_back();
    if(s==t)printf("Yes\n");
    else printf("No\n");
    return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
    using namespace std;
    typedef long long int ll;
    #define vll vector<long long int> 
    #define pb push_back
    #define f(i,x,n) for (i=x;i<n;i++)
    
    
    void solve(){
        ll n,x,t;
        cin >> n >> x >> t;
        if(x==0 || t==0){
        cout << "0"<<endl;
            return;
        }
        
        ll ans=ceil((double)n/(double)x);
        cout <<(ll)ans*t;
    }
    int main(){
    	ios_base::sync_with_stdio(false); 
         	cin.tie(NULL);
    	int t=1;
    	
    	while(t--)
    	solve();	
    	
    
    }

Measured memory_bytes: 3728
import math
A, B, H, M = map(int, input().split(' '))
deg = abs(30 * H + 0.5 * M - 6 * M)
if deg > 180:
    deg = 360 - deg
deg = math.radians(deg)
print(math.sqrt((B - A * math.cos(deg)) ** 2 + (A * math.sin(deg)) ** 2))

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;
typedef vector<vll> vvll;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define no cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  return gcd(b, a%b);
}

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

  ll t;
  cin>>t;

  REP(i,t){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;

    bool ans;
    if(a<b || d<b)
      ans=false;
    else if(b<=c)
      ans=true;
    else{
    ll w=gcd(b,d);
      if((a-b)/w==(a-c)/w)
        ans=true;
      else if((b-c)>=w+1)
        ans=false;
      else{
        if((a-c)%w==0)
          ans=true;
        else
          ans=false;
      }
    }

    if(ans)
      yes;
    else
      no;
  }

}




Measured memory_bytes: 3540
s=input()
s=s[::-1]
while len(s):
    if s.startswith('maerd'):
        s=s[5:]
    elif s.startswith('remaerd'):
        s=s[7:]
    elif s.startswith('esare'):
        s=s[5:]
    elif s.startswith('resare'):
        s=s[6:]
    else:
        print('NO')
        break
else:
    print('YES')

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

int main(void)
{
	int N;
	int dp[101][4][4][4];	// 0:A 1:C 2:G 3:T
	int mod = 1e9 + 7;

	cin >> N;

	memset(dp, 0, sizeof(dp));


	dp[0][3][3][3] = 1;
	for (int i = 1; i <= N; i++) {
		for (int j = 0; j < 4; j++) {
			for (int k = 0; k < 4; k++) {
				for (int l = 0; l < 4; l++) {
					if (dp[i - 1][j][k][l] == 0) continue;
					for (int m = 0; m < 4; m++) {
						if ((k == 0) && (l == 1) && (m == 2)) continue;
						if ((k == 0) && (l == 2) && (m == 1)) continue;
						if ((k == 1) && (l == 0) && (m == 2)) continue;
						if ((j == 0) && (l == 1) && (m == 2)) continue;
						if ((j == 0) && (k == 1) && (m == 2)) continue;
						dp[i][k][l][m] += dp[i - 1][j][k][l];
						dp[i][k][l][m] %= mod;
					}
				}
			}
		}
	}

	int ans = 0;
	for (int j = 0; j < 4; j++) {
		for (int k = 0; k < 4; k++) {
			for (int l = 0; l < 4; l++) {
				ans += dp[N][j][k][l];
				ans %= mod;
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define loop(n, i) for(int i=0;i<n;i++)
#define loop1(n, i) for(int i=1;i<=n;i++)
#define rloop(n, i) for(int i=n;i;i++)
#define HERE cout << "HERE: " << __LINE__ << endl;
#define INSP(v) cout << v << " at " << __LINE__ << endl;
using namespace std;
using ll = long long;
template <class T>
using V = vector<T>;

int main() {
    int n; cin >> n;
    cout << n * n * n << endl;
    return 0;
}



Measured memory_bytes: 256
def solve(C):
    ans = 0
    for a in sorted(C, reverse=True):
        if C[a] <= 0:
            continue
        ma = 1 << a.bit_length()
        b = ma - a
        if b in C and C[b] > 0:
            if a == b:
                pair = C[a] // 2
            else:
                pair = min(C[a], C[b])
                C[b] -= pair
            ans += pair
    return ans

from collections import defaultdict
N, *A = map(int, open(0).read().split())
C_e = defaultdict(int)
C_o = defaultdict(int)
for a in A:
    if a % 2 == 0:
        C_e[a] += 1
    else:
        C_o[a] += 1
print(solve(C_e) + solve(C_o))

Measured memory_bytes: 31576
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

int main() {
    int K; cin >> K;
    vector<ll> A(K);
    REP(i, 0, K) cin >> A[i];

    if (A.back() > 2) {
        cout << -1 << endl;
        return 0;
    }

    ll l = 2, h = 2;
    for (int i = K - 1; i > 0; i--) {
        if (l < A[i] || h < A[i]) {
            cout << -1 << endl;
            return 0;
        }
        // cout << "# i : " << i << " : " << A[i] << endl;
        l = l / A[i] * A[i];
        h = (h / A[i] + 1) * A[i] - 1;
        // cout << "--> " << l << " " << h << endl;

        ll nl = (l + A[i - 1] - 1) / A[i - 1] * A[i - 1];
        ll nh = h / A[i - 1] * A[i - 1];
        nl = min(nl, nh);
        if (nl == 0 && nh != 0) nl += A[i - 1];

        if (nl > h || nh < l) {
            cout << -1 << endl;
            return 0;
        }
        h = nh; l = nl;

        // cout << "--> " << l << " " << h << endl;
    }
    h = (h / A[0] + 1) * A[0] - 1;
    cout << l << " " << h << endl;
    return 0;
}

Measured memory_bytes: 4048
/*
ID: seekho
PROG: friday
LANG: C++14                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;

//find_by_order gives kth-largest element
//order_of_key gives the number of items in the set that are strictly smaller!!

// OT.find_by_order(k-1)
// 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define db4(x, y, z, w) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << "," << #w << "=" << w << endl
#define ll long long
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define X first
#define Y second
#define sz(x) (int)((x).size())
#define pii pair<int,int>
#define MOD (ll)(998244353)
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
typedef vector<int> vi;
#define inf (ll)(1e18)
#define double long double
#define int long long

// #define N 50005

int ans[101][11];

int32_t main() {

    ios::sync_with_stdio(false);
    cin.tie(0); 
    cout.tie(0);

    int n,a,b;
    cin >> n >> a >> b;

    int l = n-(a+b);

    cout << min(a,b) << " ";

    if(l >= 0) cout << "0\n";
    else cout << -l << '\n';
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <queue>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>

typedef long long int ll;

#define MAX_N 100000

using namespace std;
ll func(ll x,ll n){
    if(x>n){
        return (x-n);
    }else if(x<0){
        return (x+n);
    }else{
        return x;
    }
}
int main(){
    ll n,a_i;
    ll a[MAX_N];
    ll x;
    cin >> n;
    for(ll i=1;i<=n;i++){
        cin >> a_i;
        a[i]=a_i;
        if(i==n){
            a[0]=a_i;
        }
    }
    ll sig;
    ll v1,v2;
    x=0;
    sig=1;
    for(ll num=0;num<=n/2;num++){
        v1=func(1+num,n);
        v2=func(1-1-num,n);
        
        if(num==n/2){
            x+=sig*a[v1];
        }else{
            x+=sig*(a[v1]+a[v2]);
        }
        sig=(-1)*sig;
    }
    cout<<x<<endl;
    sig=1;
    for(int i=2;i<=n;i++){
        x=-x+2*a[i-1];
        cout<<x<<endl;
    }

    return 0;
}

Measured memory_bytes: 2048
# import math
# import numpy as np
# import itertools
# import heapq
# =map(int,input().split())
n=int(input())
ans=0
q=[]
for i in range(n):
    x=input()
    # if x not in q:
        # ans+=1
    q.append(x)
w=set(q)
ans=len(w)
print(ans)



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

int n , a;

int main(){
	scanf("%d" , &n);
	for(int i = 1; i <= n; i++){
		scanf("%d" , &a);
		if(a & 1) continue;
		if(a % 3 && a % 5){ puts("DENIED"); return 0; }
	}
	puts("APPROVED");
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

using namespace std;

const int mod = 1000000007;
int a[100000];

int main() {
    int n, x = 0, y = 0, z = 0, i;
    long long ans = 1;
    
    scanf("%d", &n);
    
    for (i = 0; i < n; i++) scanf("%d", &a[i]);
    
    for (i = 0; i < n; i++) {
        int c = 0;
        
        if (x == a[i]) c++;
        if (y == a[i]) c++;
        if (z == a[i]) c++;
        
        ans = ans * c % mod;
        
        if (x == a[i]) {
            x++;
        } else if (y == a[i]) {
            y++;
        } else {
            z++;
        }
    }
    
    printf("%lld\n", ans);
    
    return 0;
}


Measured memory_bytes: 512
n, m = map(int, input().split())

s = []
for i in range(m):
    s.append(list(map(int, input().split()))[1:])
p = list(map(int, input().split()))

ans = 0
for i in range(1<<n):
    isOn = []
    for j in range(n):
        if i & (1<<j):
            isOn.append(j+1)

    flag = True
    for j in range(m):
        count = 0
        for v in s[j]:
            if v in isOn:
                count += 1
        if count % 2 != p[j]:
            flag = False
    if flag:
        ans += 1

print(ans)


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

int main() {
    int N, T;
    cin >> N >> T;
    int T_time = 0;
    int total_time = 0;

    for(int i=0; i<N; i++) {
        int t;
        cin >> t;
        if(T_time > t) total_time -= T_time - t;
        T_time = t + T;
        total_time += T_time - t;
    }
    cout << total_time << endl;
}

Measured memory_bytes: 3624
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
using namespace std;
#define ll long long
#define rep(i,j,n) for(int i=j;i<n;i++)


int find(vector<ll> L,int x){
	rep(i,0,L.size()){
		if(L[i]>x)return i;
	}
	return L.size()-1;
}
int rfind(vector<ll> L,int x){
	for(int i=L.size()-1;i>=0;i--){
		if(L[i]<x)return i;
	}
	return 0;
}

int main(){
	ll N,ans=0;
	cin>>N;
	vector<ll> d(N);
	rep(i,0,N) cin>>d[i];
	sort(d.begin(),d.end());
	rep(i,0,N){
		rep(j,i+1,N){
			rep(k,j+1,N){
				if(d[k]-d[j]>=d[i])continue;
				if(d[k]+d[j]<=d[i])continue;
				ans++;
			}
		}
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define bp __builtin_popcount
#define debug(x) cerr << #x << " = " << x << endl;

const int MOD = 1e9 + 7;
const int INF = 1e18;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it : t)cout<<it<<" ";}
inline int powerexp(int a, int b, int m = MOD){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 

void solve(){
    deque<int> d;
    int q;
    cin >> q;
    for(int i = 0; i < q; i++){
	  int x;
	  cin >> x;
	  if (x  == 0){
		  int l, r;
		  cin >> l >> r;
		  if (l == 0) d.push_front(r);
		  else d.push_back(r);  
		}
	 if (x == 1){
		  int p;
		  cin >> p;
		  cout << d[p] << endl; 
		}
	 if (x == 2){
		 int r;
		 cin >> r;
		 if (r == 0) d.pop_front();
		 else d.pop_back();
		}	
	}
}

//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}



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

using namespace std;

class RollingHash {
 private:
  const uint64_t mod = (1ULL << 61) - 1;
  std::vector<uint64_t> hashes, pows;

  inline uint64_t add(uint64_t a, uint64_t b) const {
    a += b;
    if (a >= mod) a -= mod;
    return a;
  }

  inline uint64_t sub(uint64_t a, uint64_t b) const {
    if (a < b) a += mod;
    a -= b;
    return a;
  }

  inline uint64_t mul(uint64_t a, uint64_t b) const {
    uint64_t ah = a >> 31, al = a & ((1ULL << 31) - 1), bh = b >> 31,
             bl = b & ((1ULL << 31) - 1), m = ah * bl + al * bh,
             v = (ah * bh << 1) + (m >> 30) + ((m & ((1ULL << 30) - 1)) << 31) +
                 al * bl;
    v = (v & ((1ULL << 61) - 1)) + (v >> 61);
    return v;
  }

 public:
  template <typename T>
  RollingHash(const T &S, uint64_t base = 10007)
      : hashes(S.size() + 1, 0), pows(S.size() + 1, 0) {
    pows[0] = 1;
    for (size_t i = 0; i < S.size(); i++) {
      pows[i + 1] = mul(pows[i], base);
      hashes[i + 1] = add(mul(hashes[i], base), S[i]);
    }
  }

  // S[l, r)
  uint64_t slice(int l, int r) const {
    return sub(hashes[r], mul(hashes[l], pows[r - l]));
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> A(N), B(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> B[i];
  }
  vector<int> S(N), T(N);
  for (int i = 0; i < N; i++) {
    S[i] = A[i] ^ A[(i + 1) % N];
    T[i] = B[i] ^ B[(i + 1) % N];
  }
  for (int i = 0; i < N; i++) {
    S.emplace_back(S[i]);
  }
  RollingHash rhs(S), rht(T);
  for (int i = 0; i < N; i++) {
    if (rhs.slice(i, i + N) == rht.slice(0, N)) {
      cout << i << ' ' << (A[i] ^ B[0]) << '\n';
    }
  }
  return 0;
}


Measured memory_bytes: 16752
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 0xccccccc;
const ll LINF = 922337203685477580LL;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

const int mod = 1000000007;
//const int mod = 998244353;

struct mint {
	int64_t x;
	mint(int64_t x=0):x((x%mod+mod)%mod){}
	mint operator-() const { return mint(-x);}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod-a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
	mint operator+(const mint a) const { return mint(*this) += a;}
	mint operator-(const mint a) const { return mint(*this) -= a;}
	mint operator*(const mint a) const { return mint(*this) *= a;}
	mint pow(int64_t t) const {
		if (!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if (t&1) a *= *this;
		return a;
	}

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

istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

const int N = 1<<21;

//head

int n;
int a[30][30];
mint dp[N];

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	rep(i, n) rep(j, n) cin >> a[i][j];

	rep(i, 1<<n) {
		if(!i) dp[i] = 1;
		else {
			int c = __builtin_popcount(i)-1;
			rep(j, n) if(i>>j&1) if(a[c][j]) {
				int u = i^(1<<j);
				dp[i] += dp[u];
			}
		}
	}

	cout << dp[(1<<n)-1] << endl;
}

Measured memory_bytes: 20048
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true){
			String s = sc.next();
			if(s.compareTo("#")==0) break;
			
			long p, q, r;
			String[] t = s.split("\\.");
			if(t.length==3){
				long y = Integer.valueOf(t[0]);
				long m = Integer.valueOf(t[1]);
				long d = Integer.valueOf(t[2]);
				
				d += (y*365 + y/4 + y/400 - y/100);
				if(y%400==0 || (y%4==0 && y%100!=0)) d-=366;
				else d-=365;
				
				for(int i=1;i<m;i++){
					if(i==4 || i==6 || i==9 || i==11) d+=30;
					else if(i==2){
						if(y%400==0 || (y%4==0 && y%100!=0)) d+=29;
						else d+=28;
					}
					else d+=31;
				}
				
				d-=734858;
				d %= 1872000;
				p = d/144000;
				System.out.print(p + ".");
				d %= 144000;
				p = d/7200;
				System.out.print(p + ".");
				d %= 7200;
				p = d/360;
				System.out.print(p + ".");
				d %= 360;
				p = d/20;
				d %= 20;
				System.out.println(p + "." + d);
				
			}else{
				p = Integer.valueOf(t[4]) + 734858;
				p += Integer.valueOf(t[3]) * 20;
				p += Integer.valueOf(t[2]) * 360;
				p += Integer.valueOf(t[1]) * 7200;
				p += Integer.valueOf(t[0]) * 144000;
				
				q = p/146097;
				q *= 400;
				p %= 146097;
				
				for(int i=1;;i++){
					if(i%400==0 || (i%4==0 && i%100!=0)) r=366;
					else r=365;
					
					if(p<=r){
						q += i;
						break;
					}
					else p -= r;
				}
				
				for(int i=1;;i++){
					if(i==4 || i==6 || i==9 || i==11) r=30;
					else if(i==2){
						if(q%400==0 || (q%4==0 && q%100!=0)) r=29;
						else r=28;
					}
					else r=31;
					
					if(p<=r){
						System.out.println(q + "." + i + "." + p);
						break;
					}
					else p -= r;
				}
				
			}
		}	
	}	
}

Measured memory_bytes: 23208
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include<random>
#include<math.h>
#include<limits.h>
#include<iterator>
#include<queue>
#include<functional>
#define rep(i,a) for(int i=0;i<a;i++)
#define nrep(i,a,b) for(int i=a;i<b;i++)
#define mrep(i,a) for(int i=a;i>=0;i--)
#define ll long long
#define vl vector<ll> 
#define vvl vector<vector<ll> > 
#define vb vector<bool> 
#define vvb vector<vector<bool> > 
#define INF 11234567890123456789
using namespace std;

bool isEven(string s){
	if (s.size() & 1) return false;
	string firstHalf = "";
	string latterHalf = "";
	rep(i, s.size() / 2){
		firstHalf += s[i];
		latterHalf += s[i + s.size() / 2];
	}if (firstHalf == latterHalf) return true;
	return false;
}

int main(){
	ll n; cin >> n;
	vl ans(n);
	ll left = n / 2 - 1, right = n / 2 + 1;
	bool isFirst = (!(n % 2) ? false : true);
	cin >> ans[n / 2];
	rep(i, n-1){
		ll temp; cin >> temp;
		if (isFirst) ans[right++]=temp;
		else ans[left--] = temp;
		isFirst = !isFirst;
	}rep(i, ans.size()) cout << ans[i] << " ";
	cout << endl;
	return 0;
}

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

template<typename T> class FenwickTree {
private:
  int n, mx;
  vector<T> bit;
public:
  FenwickTree(int sz) : n(sz + 1), mx(1), bit(n, 0) {
    while (mx * 2 <= n) mx *= 2;
  }
  FenwickTree(const vector<T> &v) : n((int) v.size() + 1), mx(1), bit(n, 0) {
    for (int i = 0; i < n - 1; i++) add(i, v.at(i));
    while (mx * 2 <= n) mx *= 2;
  }
  void add(int i, T x) {
    i++;
    while (i < n) bit.at(i) += x, i += i & -i;
  }
  void add(int l, int r, T x) {
    add(l, x);
    add(r + 1 , -x);
  }
  T sum(int i) {
    i++;
    T ret = 0;
    while (i > 0) ret += bit.at(i), i -= i & -i;
    return ret;
  }
  T sum(int l, int r) {
    return sum(r) - sum(l - 1);
  }
  int lower_bound(T w) {
    if (w <= 0) return 0;
    int x = 0;
    for (int k = mx; k > 0; k /= 2) {
      if (x + k <= n - 1 && bit.at(x + k) < w) {
        w -= bit.at(x + k);
        x += k;
      }
    }
    return x;
  }
  int upper_bound(T w) {
    if (w < 0) return 0;
    int x = 0;
    for (int k = mx; k > 0; k /= 2) {
      if (x + k <= n - 1 && bit.at(x + k) <= w) {
        w -= bit.at(x + k);
        x += k;
      }
    }
    return x;
  }
};

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

  int N, Q;
  cin >> N >> Q;
  vector<int> C(N);
  for (int i = 0; i < N; i++) cin >> C.at(i);
  vector<vector<pair<int, int>>> V(N);
  for (int i = 0, l, r; cin >> l >> r; i++) {
    V.at(--r).push_back({--l, i});
  }

  FenwickTree<int> FT(N);
  vector<int> ans(Q);
  vector<int> pre(N + 1, -1);
  for (int r = 0; r < N; r++) {
    if (pre.at(C.at(r)) >= 0) FT.add(pre.at(C.at(r)), -1);
    pre.at(C.at(r)) = r;
    FT.add(r, 1);
    for (auto [l, i] : V.at(r)) ans.at(i) = FT.sum(l, r);
  }
  for (auto a : ans) cout << a << "\n";
}

Measured memory_bytes: 33268
import std.stdio, std.range, std.random, std.conv, std.string;
import std.algorithm.comparison, std.algorithm.iteration, std.algorithm.mutation, std.algorithm.searching, std.algorithm.sorting;

void main()
{
    int[] input = readln().strip.split().to!(int[]);
    int N = input[0];
    int T = input[1];

    int minCost = int.max;
    foreach(i; 0..N) {
        input = readln().strip.split.to!(int[]);
        if(input[1] <= T)
        {
            minCost = min(minCost, input[0]);
        }
    }
    if(minCost == int.max)
    {
        writeln("TLE");
        return;
    }
    writeln(minCost);
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#include <cstring>

#define rep(i,n) for(int i=0;i<int(n);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back

using namespace std;
using ll = long long;

const ll mod = 1000000007;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
// bool debug=false;

/*---------------------------------------------------*/

int main() {
  int N, M, a, b;
  cin >> N >> M;
  vector<int> H(N);
  vector<bool> ans(N, true);
  for(int i = 0; i < N; i++) {
    cin >> H[i];
  }
  for(int i = 0; i < M; i++) {
    cin >> a >> b; a--; b--;
    if(H[a] >= H[b]) {
      ans[b] = false;
    } 
    if(H[a] <= H[b]) {
      ans[a] = false;
    }
  }

  int _ans = 0;
  for(int i = 0 ; i < N; i++) {
    _ans += ans[i];
  }
  cout << _ans << endl;
  return 0;
}


Measured memory_bytes: 3768
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
typedef long double lb;
// typedef vector<int,vector<int>> vvec;
typedef long double ld;
typedef pair<int,int> P;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0L)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
// inline ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
// inline ll lcm(ll a, ll b){ if(!a || !b) return 0; return a * b / gcd(a, b); }

//----***定数***----
const int MOD=1e9+7;
#define INF 1e9;
#define EPS 1e-9;

//----***入出力***---
#define print(out) cout<< out  << "\n";
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
#define here  cout<<"Here"<<endl;


//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}initial_;

int N,M,a;
string S;

signed main(){
  cin>>N>>M;
  int total=0;
  vector<int> A(N);
  REP(i,0,N){
    cin>>a;
    total+=a;
    A[i]=a;
  }
  //print(ceil((1.0)*3/(4)))
  sort(ALL(A),greater<>());
  REP(i,0,M){
    if(A[i]<(ceil((1.0)*total/(4*M)))){
      //print(ceil((1.0)*total/(4*M)))
      print("No")
      return 0;
    }
  }
  print("Yes")
}


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

using namespace std;

#define  SZ(items) (int)items.size()
#define  CLR(a)  memset(a,0,sizeof(a))
#define  SET(a)  memset(a,-1,sizeof(a))

template <class T> inline T bigmod(T p, T e, T m)
{
    T ret = 1;
    for (; e > 0; e >>= 1)
    {
        if (e & 1)
            ret = (ret * p) % m;
        p = (p * p) % m;
    }
    return (T)ret;
}

#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1)
{
    cerr << name << " is " << arg1 << std::endl;
}
template < typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args)
{
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " is " << arg1 << " | ";
    __f(comma + 1, args...);
}
#else
#define debug(...)
#endif



void solve()
{
    int n;
    cin>>n;

    long long res=0;

    for(int i=1;i<=n;i++){
        int cnt=0;

        int temp=i;

        while(temp){
            cnt++;
            temp/=10;
        }

        if(cnt%2==1){
            res++;
        }
    }
    cout<<res<<endl;
}


int main()
{
    ios_base::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    cout.tie(nullptr);
    cin.tie(nullptr);

    int t = 1;
    while (t--)
    {
        solve();
    }

    return 0;
}


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

int dfs(int x,int y);
int h,w;
char ta[22][22];
int cheak[22][22]={0};
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int cou=0;

int main(){
  int a,b;
  while(1){
    cin >> w >> h;
    if(w==0 && h==0) break;
    cou=0;
    
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	cin >> ta[i][j];
	cheak[i][j]=0;
	if(ta[i][j] == '@'){
	  a=i,b=j;
	}
      }
    }
    //cout << a << " " << b << endl;
    cout << dfs(a,b) << endl;
    /*for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
      cout << cheak[i][j];
      }
      cout << endl;
      }*/
  }
}

int dfs(int x,int y){
  cheak[x][y]=1;
  cou++;
  for(int i=0;i<4;i++){
    int nx=x+dx[i];
    int ny=y+dy[i];
    if(nx>=0 && nx<h && ny>=0 && ny<w && ta[nx][ny]=='.' && cheak[nx][ny]==0){
      dfs(nx,ny);
    }
  }
  return cou;
}

Measured memory_bytes: 1172