akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
 
template <class T1, class T2>
ostream& operator << (ostream& out, const pair <T1, T2> p)
{
    out << '(' << p.first << ',' << p.second << ')';
        return out;
}
 
template <class T1, class T2>
istream& operator >> (istream& in, pair<T1, T2> &p)
{
    in >> p.first >> p.second;
        return in;
}
 
template <class T>
istream& operator >> (istream& in, vector<T> &v)
{
    for (T &x : v)
                in >> x;
        return in;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<vector<T> > &v)
{
    for (const vector<T> &x : v)
                out << x << '\n';
        return out;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<T> &v)
{
    for (const T &x : v)
                out << x << ' ';
        return out;
}
 
template <class T>
ostream& operator << (ostream& out,const set<T> &s)
{
    for (const T &x : s)
            out << x << ' ';
        return out;
}
 
 
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll > ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define sz(x) (ll)(x).size()
#define tr1(x) cerr << #x << ": " << x << nl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << nl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<nl
#define tr4(x,y,z,w) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#w<<": "<<w<<nl
#define epsilon 0.00000001L
#define inf 9999999999999999ll// ~ 10^16
#define nl "\n"
#define all(x) x.begin(), x.end()
#define r_all(x) x.rbegin(), x.rend()
#define fast()  ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod 1000000007ll
#define modulo 998244353ll
ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}

int main()
{
    fast();
    vi a(2),b(2);
    cin>>a>>b;
    ll ans=a[0]*b[0];
    for(ll i=0;i<2;i++)
    {
        for(ll j=0;j<2;j++)
        {
            ans=max(a[i]*b[j],ans);
        }
    }
    cout<<ans<<nl;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
  int n;
  cin>>n;
  int ar[n];
  for(int i=0;i<n;i++)cin>>ar[i];
  if(n==1||n==2)
  {
      if(n==1)cout<<"0\n";
      if(n==2)cout<<abs(ar[0]-ar[1])<<"\n";
      return 0;
  }
  int dp[n];
  dp[0]=0;
  dp[1]=abs(ar[0]-ar[1]);
  for(int i=2;i<n;i++)
  {
      dp[i]=min(dp[i-1]+abs(ar[i-1]-ar[i]),dp[i-2]+abs(ar[i-2]-ar[i]));
  }
  cout<<dp[n-1]<<"\n";
    return 0;
}

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

using namespace std;

const int N = 3e5 + 7;

vector <int> e(N), w(N);

int get_e(int l, int r) {
    if (l > r) return 0;
    if (l == 0) return e[r];
    return e[r] - e[l - 1];
}

int get_w(int l, int r) {
    if (l > r) return 0;
    if (l == 0) return w[r];
    return w[r] - w[l - 1];
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector <int> a(n);
    for (int i = 0; i < n; i++) {
        char c;
        cin >> c;
        a[i] = (c == 'E' ? 1 : 2);
    }
    e[0] = (a[0] == 1);
    for (int i = 1; i < n; i++) {
        e[i] = e[i - 1] + (a[i] == 1);
    }
    w[0] = (a[0] == 2);
    for (int i = 1; i < n; i++) {
        w[i] = w[i - 1] + (a[i] == 2);
    }
    int ans = n;
    for (int i = 0; i < n; i++) {
        ans = min(ans, get_w(0, i - 1) + get_e(i + 1, n - 1));
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
typedef long long ll;
vector<int>v;
int main()
{
    ll n;
    cin>>n;
    int k=-2;
    int actualq;
    int kk;
    if(n==0)
    {
        cout<<0<<endl;
        return 0;
    }
    while(n!=0)
    {
        int x=n%k;
        if(x<0)
        {
            actualq=n-x;
            actualq/=k;
            actualq++;

            actualq*=k;
            kk=n-actualq;

            v.pb(kk);
            n=(actualq/k);
        }
        else
        {
            v.pb(x);
            n/=k;
        }
    }
    //cout<<v[0]<<endl;
    reverse(v.begin(),v.end());
    for(int i=0;i<v.size();i++)
    {
        cout<<v[i];
    }
    cout<<endl;
}


Measured memory_bytes: 256
def root(x, par)
  if(par[x] == x)
    return x
  else
    return par[x] = root(par[x], par)
  end
end

def unite(x, y, par)
  x = root(x, par)
  y = root(y, par)
  if (x==y) 
    return par;
  end
  par[x] = y
  return par
end

def same(x, y, par)
  root(x, par) == root(y, par)
end

N, M = gets.split.map(&:to_i)
ps = gets.split.map(&:to_i).map{|i| i-1}
par = [*0..N-1]
M.times { 
  x = gets.split.map{|s| s.to_i-1}
  x0_root = root(x[0], par)
  x1_root = root(x[1], par)
  if x0_root == x[0] 
    par[x[0]] = x1_root
  elsif x1_root == x[1]
    par[x[1]] = x0_root
  else
    par = unite(x[0], x[1], par)
  end
}
count = 0
N.times{|i|
  if same(i, ps[i], par) 
    count += 1
  end
}
puts count



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

int main() {
	// your code goes here
	string s,t;
	cin>>s>>t;
	int m=s.length();
	int n=t.length();
	int res=1500;
	for(int i=0;i<m-n+1;i++)
	{
	 	int c=0;
		for(int j=0;j<n;j++)
		{
			if((i+j)>=m)
			{
				c=0;
				break;
			}
			else if(s[i+j]!=t[j])
			c++;
		}
		res=min(c,res);
	}
	cout<<res;
	return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
struct name{
    int a,b;
}me[100005];
int comp(struct name a,struct name b){
    return a.b>b.b;
}
int main() {
    int n,h;
    int a,b;
    scanf("%d%d",&n,&h);
    long long max_a=0;
    for(int i=1;i<=n;i++)
    {
        scanf("%d%d",&a,&b);
        max_a=max((long long)a,max_a);
        me[i].a=a;
        me[i].b=b;
    }
    sort(me+1,me+1+n,comp);
    int s=0;
    for(int i=1;i<=n;i++)
    {
        if(me[i].b>max_a)
        {
            s++;
            h=h-me[i].b;
            if(h<=0)
                break;
        }
        else
            break;
    }
    if(h>0)
        s+=(long long)ceil(h*1.0/max_a);
    cout<<s<<endl;
    // insert code here...
    //std::cout << "Hello, World!\n";
    return 0;
}


Measured memory_bytes: 1024
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
using namespace std;
const int INF= 1e9+5;
typedef long long ll;

int main(){
  int a,b;
  cin>>a>>b;
  if(a+b>=10){
    cout<<"error"<<endl;
    return 0;
  }
  cout<<a+b<<endl;
  return 0;
}

Measured memory_bytes: 256
//https://atcoder.jp/contests/abc141/tasks/abc141_a
#include<bits/stdc++.h>
using namespace std;
int main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(0);
     string s ;
     cin >> s ;
     if(s[0] == 'S') cout << "Cloudy" << endl ;
     else if(s[0] == 'C') cout << "Rainy" << endl ;
     else cout << "Sunny" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
int n,d,ans=0;
int x[11][11];
double dis;
int Dis;
int main(){
	cin>>n>>d;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=d;j++)
			cin>>x[i][j];
	for(int i=1;i<n;i++)
		for(int j=i+1;j<=n;j++){
			dis=0;
			for(int k=1;k<=d;k++)
				dis+=((x[i][k]-x[j][k])*(x[i][k]-x[j][k]));
			dis=sqrt(dis);
			Dis=dis;
			if(Dis==dis)
				ans++;
		}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include <set>
#define ll long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
using namespace std;
const ll mod=1e9+7;
const ll N=5e5+5;
ll n,m;
ll fac[N],infac[N];
ll powm(ll a,ll b,ll mod)//快速幂
{
    ll ans=1;
    while(b)
    {
        if(b&1)
        {
            ans=ans*a%mod;
        }
        b=b>>1;
        a=a*a%mod;
    }
    return ans;
}
void init()//初始化
{
    fac[0]=infac[0]=1;
    for(int i=1; i<=m; i++)
    {
        fac[i]=fac[i-1]*i%mod;
        infac[i]=powm(fac[i],mod-2,mod);
    }
}
int main()
{
    IO;
    cin>>n>>m;
    init();
    ll res=0;
    for(int i=0;i<=n;i++)
    {
        if(i&1)
        {
            res=(res-fac[n]*infac[i]%mod*infac[n-i]%mod*fac[m-i]%mod*infac[m-n]%mod+mod)%mod;
        }
        else
        {
            res=(res+fac[n]*infac[i]%mod*infac[n-i]%mod*fac[m-i]%mod*infac[m-n]%mod)%mod;
        }
    }
    for(int i=m-n+1;i<=m;i++) res=res*i%mod;
    cout<<(res+mod)%mod<<endl;
    return 0;
}


Measured memory_bytes: 11404
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ii pair<int,int>
#define F first
#define S second
#define pb push_back
#define pf push_front
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a) for(int i = a; i >= 0; i--)
#define fori(i,m) for(auto i = m.begin(); i != m.end(); i++) 
#define sz(s) int(s.size())
#define cls(a,car) memset(a,car,sizeof (a))
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ii> vii;
const int N = 3 * 1e5 + 5;
const ll mod = 1e9 + 7;
const int INF = INT_MAX;
const ll INFCAD  = ll(INT_MAX) * 2 + 1;
const double E = 1e-9;
int main(){
    //freopen("in","r",stdin);
    //freopen("out","w",stdout);
    fast;
    int n;
    cin >> n;
    while(n){
        if((n % 10) == 7){
            cout << "Yes\n";
            return 0;
        }
        n /= 10;
    }
    cout << "No\n";
    return 0;
}   

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,s,n) for(int i = s; i < n; i++)
int main(){
  int k;
  cin >> k;
  rep(i,k)cout << "ACL";
  cout <<endl;
  return 0;
}

Measured memory_bytes: 3608
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	int[] p;
	int[][] m; 
	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		p = new int[n+1];
		m = new int[n+1][n+1];
		for(int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
			p[i+1] = sc.nextInt();
		}
		mutrixChainMultiplication(n);
		System.out.println(m[1][n]);
		sc.close();
	}
	
	private void mutrixChainMultiplication(int n) {
		for(int i = 1; i <= n; i++) {
			m[i][i] = 0;
		}
		for(int l = 2; l <= n; l++) {
			for(int i = 1; i <= n - l + 1; i++) {
				int j = i + l - 1;
				m[i][j] = Integer.MAX_VALUE;
				for(int k = i; k <= j - 1; k++) {
					m[i][j] = Math.min(m[i][j], m[i][k] + m[k+1][j] + p[i-1] * p[k] * p[j]);
				}
			}
		}
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().run();
	}
}


Measured memory_bytes: 26596
#include <algorithm>
    #include <bits/stdc++.h>
    #include <cctype>
    #include <cmath>
    #include <cstdio>
    #include <iomanip>
    #include <iostream>
    #include <list>

    #include <stack>
    #include <string>
    #include <vector>
    #include <bits/stdc++.h>
    #define INFINI (1000 * 1000 * 1000)

    using namespace std;
    //#define s(T) scanf("%d", &T)
    #define sl(T) scanf("%lld", &T)
    #define fill(a, val) memset(a, val, sizeof(a))
    #define mp make_pair
    #define pb push_back
    #define all(x) x.begin(), x.end()
    #define DREP(x) sort(all(x)); x.erase(unique(all(x)), x.end())
    #define INDEX(a, val) (lower_bound(all(a), val) - a.begin())
    #define mod ll(1e9+7)
    typedef long long ll;


    bool compare_first(pair<ll,ll >a,pair<ll,ll >b)
    {
        return a.first<b.first;
    }

     bool compare_second(pair<int,pair<int , int> > a,pair<int,pair<int , int> > b)
    {
        return a.second.first<b.second.first;
    }


    ll min(ll a,ll b)
    {
        if(a>b)return b;
        return a;
    }


    int main() {
      ios::sync_with_stdio(false);

      ll n;
      cin>>n;
      ll sum=0;
      ll arr[n];
      for(ll index=0;index<n;index++)
      {
           cin>>arr[index];

      }

     int ans=INFINI;
     for(int i=-100;i<101;i++)
     {
         int ans2=0;
         for(int index=0;index<n;index++)
            ans2+=(i-arr[index])*(i-arr[index]);
         ans=min(ans,ans2);
     }

     cout<<ans<<endl;


return 0;
    }


/*

 }
 */


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <algorithm>
#include <math.h>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#define ll long long
#define vi vector<ll>
#define vs vector<string>
#define fr(i, k, n) for (ll i = k; i < n; i++)
#define rep(i, n) fr(i, 0, n)
#define alll(v) v.begin(), v.end()
#define mp(a, b) make_pair(a, b)
#define rdd(a) ll a; cin >> a
#define rrd rdd(a); rep(i, a)
//min({a,b,c,d})などの記法
using namespace std;
template <class X> void pr(X x) { cout << x << endl; }
template <class X> void prr(X x) { for (auto it : x) { cout << it << endl; } }

int func(int x){
    return x*x+30;
}
int main() {
    string s;
    cin >>s;
    rep(i, 4)cout<<s[i];
    cout<<" ";
    rep(i, 8)cout<<s[i+4];
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())


n = ni()
s = ns()

bef = ""
ans = 0
for si in s:
    if si != bef:
        ans += 1

    bef = si

print(ans)

Measured memory_bytes: 3444
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    T = input()
    len_t = len(T)
    S = ""
    for t in T:
        if t == "?":
            S += "D"
        else:
            S += t
    print(S)


if __name__=='__main__':
    main()

Measured memory_bytes: 9436
n,m=map(int,input().split())
ac=[0]*(n+1)
wa=[0]*(n+1)
for _ in range(m):
    i,j=input().split()
    i=int(i)
    if j=="AC":
        ac[i]=1
    elif ac[i]==0 and j=="WA":
        wa[i]+=1
print(sum(ac),sum(wa[i] for i in range(n+1) if ac[i]==1))  

Measured memory_bytes: 4596
n = int(input())
Li0 = 2
Li1 = 1
Lnow = 0
if n == 1:
    print(Li1)
else:
    for i in range(2,n+1):
        Lnow = Li1 + Li0
        Li0 = Li1
        Li1 = Lnow
    print(Lnow)

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    char c; cin>>c;
    cout<<char(c+1)<<endl;
    return 0;
}


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

int main()
{
	int r,g;

	cin >> r >> g ;

	if (r+g<10) {
		cout << r+g << endl;
	}

	else if(r+g>=10){
		cout << "error" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int nums[] = new int[3];
		for (int i = 0; i < 3; ++i) {
			nums[i] = sc.nextInt();
		}
		int a = 0, b = 0;
		for (int i= 0; i < 3; ++i) {
			if (nums[i] == 5) a++;
			if (nums[i] == 7) b++;
		}
		if (a == 2 && b == 1)
			System.out.println("YES");
		else
			System.out.println("NO");
	}
}

Measured memory_bytes: 21204
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
using namespace std;
int p = 998244353;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(long long i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define V vector
#define Endl endl
#define veb vector<bool>
#define sq(a) (a)*(a)
#define rev(s) reverse(s.begin(),s.end())
const int m = 4010;
#define bs bitset<m>
int kai_size = 400001;
vel kai(kai_size, 1);
vel ink(kai_size, 1);
vel dist;
int RE() {
	vel v(3, 2);
	return v.at(4); 
}
int ru(int a, int r) {
	if (r == 0) { return 1; }
	int ans = ru(a, r / 2);
	ans *= ans; ans %= p;
	if (r % 2 == 1) { ans *= a; }
	return ans % p;
}
int inv(int a) {
	return ru(a, p - 2);
}
void make_kai() {
	rep(i, kai_size) { kai[i + 1] = (kai[i] * (i + 1)) % p; }
	rep(i, kai_size) { ink[i] = inv(kai[i]); }
}
int com(int n, int r) {
	int ans = kai[n] * ink[r];
	ans %= p; ans *= ink[n - r]; ans %= p;
	return ans;
}
int per(int n, int r) {
	int ans = kai[n] * ink[n - r];
	ans %= p;
	return ans;
}
vel rui(m + 10, 1);
vel dis(int mid1, vvel &way) {
	int n = way.size();
	vel dist(n, -1); dist[mid1] = 0;
	queue<int> q;
	q.push(mid1);
	while (!q.empty()) {
		int st = q.front(); q.pop();
		rep(i, way[st].size()) {
			int to = way[st][i];
			if (dist[to] == -1) {
				dist[to] = dist[st] + 1;
				q.push(to);
			}
		}
	}
	return dist;
}
pin most_far(int now, int n, vvel &way) {
	vel dist1 = dis(now, way);
	pin ans = mkp(-1, 0);
	rep(i, n) {
		if (dist1[i] > ans.first) { ans = mkp(dist1[i], i); }
	}
	return ans;
}
int max_true(bs &a,int jou) {
	int ans = jou;
	rep(i, jou) {
		if (a[i]) { ans = i; }
	}
	return ans;
}
bool can_div(bs &a, bs b, int &sza, int szb) {
	for (int i = sza; i >= szb; i--) {
		if (a[i]) {
			a ^= b << (i - szb);
		}
	}
	sza = max_true(a, szb);
	if (sza == szb) { return true; }
	return false;
}
bs gcd(bs a, bs b) {
	int sza = max_true(a,m);
	int szb = max_true(b,m);
	if (sza < szb) { swap(sza, szb); swap(a, b); }
	while (true) {
		if (can_div(a, b, sza, szb)) { return b; }
		if (can_div(b, a, szb, sza)) { return a; }
	}
}
void solve(bs &x, bs &a) {
	int szx = max_true(x,m);
	int sza = max_true(a,m);
	bs to;
	rep(i, m) { to[i] = 0; }
	int ans = 0;
	for (int i = szx; i >= sza; i--) {
		if (x[i]) {
			ans += rui[i - sza];
		}
		if (x[i] != to[i]) {
			to ^= a << (i - sza);
		}
	}
	ans++;
	for (int i = m - 1; i >= 0;i--) {
		if (to[i] and !x[i]) { ans--; break; }
		if (x[i] and !to[i]) { break; }
	}
	cout << ans % p << endl;
}
bs mak(string s) {
	rev(s);
	bs ans;
	rep(i, m) { ans[i] = 0; }
	rep(i, s.size()) {
		ans[i] = (s[i] == '1');
	}
	return ans;
}
signed main() {
	int n; cin >> n;
	string x; cin >> x;
	string s; cin >> s;
	bs gcd0 = mak(s);
	rep(i, n - 1) {
		string ne; cin >> ne;
		bs newb = mak(ne);
		gcd0 = gcd(newb, gcd0);
	}
	bs nw = mak(x);
	rep(i, m + 9) { rui[i + 1] = rui[i] * 2; rui[i + 1] %= p; }
	solve(nw, gcd0);
	return 0;
}


Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,x,t;cin>>n>>x>>t;
  if(n%x==0){
    cout<<(n/x)*t<<endl;
  }
  else{
    cout<<(n/x+1)*t<<endl;
  }
  return 0;
}

Measured memory_bytes: 3600
count = Hash.new
ARGF.each do |line|
  line.each_char do |c|
    c = c.downcase
    count[c] = 0 unless count[c]
    count[c] += 1
  end
end
('a'..'z').each do |s|
  count[s] ? ( puts "#{s} : #{count[s]}" ) : ( puts "#{s} : 0" )
end

Measured memory_bytes: 6092
#include <iostream>
#include <string>
using namespace std;
int main(void) {
  string c; cin >> c;
  if (c == "a" || c == "e" || c == "i" || c == "o" || c == "u") cout << "vowel" << endl;
  else cout << "consonant" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
typedef long long ll;
#define vint vector<int>
#define vstring vector<string>
#define vll vector<ll>
#define vbool vector<bool>
#define INF 100000000


int main(){
  ll n;
  cin >> n;
  map<ll,ll> count;
  rep(i,n){
    ll a;
    cin >> a;
    count[a]++;
  }
  vll ans(0);
  vll ans2(0);
  for(auto p:count){
    auto key = p.first;
    auto value = p.second;
    if(value > 1){
      ans.push_back(key);
    }
    if(value > 3){
      ans2.push_back(key);
    }
  }
  sort(ans.begin(),ans.end());
  sort(ans2.begin(),ans2.end());
  ll ANS = 0;
  if(ans.size() > 1 && ans2.size() > 0){
    ANS = ans[ans.size()-1]*ans[ans.size()-2];
    if(ANS < ans2[ans2.size()-1]*ans2[ans2.size()-1]){
      ANS = ans2[ans2.size()-1]*ans2[ans2.size()-1];
    }  
    cout << ANS << endl;
  }
  else if(ans.size() > 1){
    cout << ans[ans.size()-1]*ans[ans.size()-2] << endl;
  }
  else{
    cout << 0 << endl;
  }
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
int n,len,cnt,a[100010],f[100010];
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i];
    f[1]=a[1];len=1;
    for(int i=2;i<=n;i++)
        if(f[len]>=a[i])f[++len]=a[i];
        else f[upper_bound(f+1,f+len+1,a[i],greater<int>())-f]=a[i];
    cout<<len;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n,T;
    cin >> n >> T;
    int min = 1001;
    int c,t;
    bool hata = false;
    for(int i = 0;i < n;i++) {
        cin >> c >> t;
        if(c < min && t <= T) {
            min = c;
            hata = true;
        }
    }
    if(hata) {
        cout << min << endl;
    }else {
        cout << "TLE" << endl;
    }
}


Measured memory_bytes: 256
/*
2725 ??´??¨?????? 1_4
*/
import java.util.Scanner;

    public class Main{
        public void solve(){
        Scanner sc = new Scanner(System.in);
        int byo,h,m,s;
		byo=sc.nextInt();
		h=byo/3600;
		m=(byo%3600)/60;
		s=(byo%3600%60);
		System.out.println(h+":"+m+":"+s);
        }
    public static void main(String[]args){
    Main obj = new Main();
    obj.solve();
    }
    }

Measured memory_bytes: 17168
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
	int N, M;
	cin >> N >> M;
	vector<int> a(M);
	vector<int> mbit(M);
	for (auto i = 0; i < M; ++i)
	{
		int b;
		cin >> a[i] >> b;

		auto bit = 0;
		for (auto j = 0; j < b; ++j)
		{
			int c;
			cin >> c;
			--c;
			bit |= (1 << c);
		}
		mbit[i] = bit;
	}

	auto size = 1 << N;
	vector<vector<ll>> dp(M + 1, vector<ll>(size, INT_MAX));
	dp[0][0] = 0;
	for (auto i = 0; i < M; ++i)
	{
		auto bit = mbit[i];
		vector<ll> minA(size, INT_MAX);
		for (auto s = 0; s < size; ++s)
		{
			dp[i + 1][s] = dp[i][s];
			auto t = s & ~bit;
			if ((s & bit) == bit)
			{
				if (minA[t] < INT_MAX)
				{
					dp[i + 1][s] = min(dp[i + 1][s], minA[t] + a[i]);
				}
			}
			else
			{
				minA[t] = min(minA[t], dp[i + 1][s]);
			}
		}
	}

	if (dp[M][size - 1] >= INT_MAX)
	{
		cout << -1 << endl;
	}
	else
	{
		cout << dp[M][size - 1] << endl;
	}

	return 0;
}

Measured memory_bytes: 32384
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000001
using namespace std;

int main(){

	int N,E,limit,tmp,minimum;
	scanf("%d %d",&N,&E);

	int table[15] = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384};

	limit = pow(2,N);

	int cost[N][N];

	for(int i = 0; i < N; i++){
		for(int k = 0; k < N; k++)cost[i][k] = BIG_NUM;
	}

	int from,to,value;

	for(int i = 0; i < E; i++){
		scanf("%d %d %d",&from,&to,&value);
		cost[from][to] = value;
	}

	int** dp = new int*[N];
	for(int i = 0; i < N; i++){
		dp[i] = new int[limit];
		for(int k = 0; k < limit; k++){
			dp[i][k] = BIG_NUM;
		}
	}

	minimum = BIG_NUM;

	tmp = pow(2,0);

	dp[0][tmp] = 0;

	for(int state = 0; state <= limit-1; state++){
		for(int k = 0; k < N; k++){
			if(dp[k][state] == BIG_NUM)continue;
			for(int a = 0; a < N; a++){
				if(state & (1 << a)){
					if(state == limit-1 && a == 0){
						if(cost[k][0] != BIG_NUM)dp[0][limit-1] = min(dp[0][limit-1],dp[k][state]+cost[k][0]);
					}
				}else{
					if(cost[k][a] != BIG_NUM){
						tmp = state + table[a];
						dp[a][tmp] = min(dp[a][tmp],dp[k][state]+cost[k][a]);
					}
				}
			}
		}
	}

	minimum = min(minimum,dp[0][limit-1]);


	if(minimum == BIG_NUM){
		printf("-1\n");
	}else{
		printf("%d\n",minimum);
	}

}

Measured memory_bytes: 4836
class SegmentTree:
    def __init__(self, data, default=0, func=max):
        """initialize the segment tree with data"""
        self._default = default
        self._func = func
        self._len = len(data)
        self._size = _size = 1 << (self._len - 1).bit_length()

        self.data = [default] * (2 * _size)
        self.data[_size:_size + self._len] = data
        for i in reversed(range(_size)):
            self.data[i] = func(self.data[i + i], self.data[i + i + 1])

    def __delitem__(self, idx):
        self[idx] = self._default

    def __getitem__(self, idx):
        return self.data[idx + self._size]

    def __setitem__(self, idx, value):
        idx += self._size
        self.data[idx] = value
        idx >>= 1
        while idx:
            self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
            idx >>= 1

    def __len__(self):
        return self._len

    def query(self, start, stop):
        """func of data[start, stop)"""
        start += self._size
        stop += self._size

        res_left = res_right = self._default
        while start < stop:
            if start & 1:
                res_left = self._func(res_left, self.data[start])
                start += 1
            if stop & 1:
                stop -= 1
                res_right = self._func(self.data[stop], res_right)
            start >>= 1
            stop >>= 1

        return self._func(res_left, res_right)

    def __repr__(self):
        return "SegmentTree({0})".format(self.data)

def egcd(a, b):
    if a == 0:
        return (b, 0, 1)
    else:
        g, y, x = egcd(b % a, a)
        return (g, x - (b // a) * y, y)
 
def modinv(a, m):
    g, x, y = egcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m

n, k = map(int, input().split())
p = list(map(lambda x: int(x) - 1, input().split()))

out = 0
mod = 998244353

mult_r = (k-1) * modinv(k, mod)
mult_inv = modinv(mult_r, mod)
mult = 1
inv = 1

seg = SegmentTree([0] * n, func = lambda x,y: x+y)
seg2 = SegmentTree([0] * n, func = lambda x,y: x+y)

for i in range(n):

    if i >= k:
        mult *= mult_r
        mult %= mod

        inv *= mult_inv
        inv %= mod

    expected_above = (seg.query(p[i], n) * mult) % mod
    expected_below = (seg.query(0,p[i]) * mult) % mod

    tot_above = seg2.query(p[i], n)
    #tot_below = seg2.query(0, p[i])

    out += tot_above - modinv(2, mod) * (expected_above)
    out += modinv(2, mod) * (expected_below)
    out %= mod

    seg[p[i]] = inv
    seg2[p[i]] = 1
print(out)
#print((modinv(2, mod) * dout) % mod)



Measured memory_bytes: 117444
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define repr(i,x,n) for(int i=x; i<(n); i++)
#define ALL(x) (x).begin(),(x).end()
#define INF 1e9
typedef long long ll;
using VI = vector<int>;
using VS = vector<string>;
using graph = vector<vector<int>>;
int main()
{
int n;
cin>>n;
VI dis(n);
for (int i = 0; i < n; i++)
{
    cin>>dis.at(i);

}
sort(	ALL(dis));
cout<<dis.at(n-1)-dis.at(0)<<endl;
    return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
using namespace std;
typedef long long ll;
#define ALL(v) (v).begin(), (v).end()
const int mod = 1e9+7;

int main() {
		string S;
		cin >> S;
		for (int i = 1; i < 4; i++) {
				if (S[i-1] == S[i]) {
						cout << "Bad" << endl;
						return 0;
				}
		}

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


Measured memory_bytes: 256
import std.stdio;
import std.algorithm;
import std.array;
import std.conv;
import std.range;

void main() {
    size_t n;
    string s;
    readf("%d\n%s\n", &n, &s);
    auto a = s.split.map!(to!int).array;
    assert(a.length == n);
    sort!"a > b"(a);
    int alice, bob;
    foreach (i, e; a) {
        if (i % 2 == 0) alice += e;
        else bob += e;
    }
    writeln(alice - bob);
}

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

int main()
{
    int a,b;
    cin>>a>>b;
    string s;
    cin>>s;
    if(s[a]!='-')
    {
        cout<<"No"<<endl;
        return 0;
    }
    for(int i=0; i<a+b+1; i++)
    {
        if(i!=a)
        {
            if(s[i]>='0' && s[i]<='9')
            {
                continue;
            }
            else
            {
                cout<<"No"<<endl;
                return 0;
            }
        }

    }

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


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

void swap (int *i, int *j){
	int *tmp = (int*) malloc (sizeof(int));
	*tmp = *i;
	*i = *j;
	*j = *tmp;
	free (tmp);
}

int main(void) {
	int w, n, l[30], h[2], i;
	scanf ("%d %d", &w, &n);
	for (i=0; i<w; i++) l[i] = i+1;
	for (i=0; i<n; i++){
		scanf ("%d,%d", &h[0], &h[1]);
		swap (&l[h[0]-1], &l[h[1]-1]);
	}
	for (i=0; i<w; i++) printf ("%d\n", l[i]);
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
const int maxn=2e5+10;
const int mod=1e9+7;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    n%=1000;
    int ans=1000-n;
    ans%=1000;
    cout<<ans<<'\n';




}


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

int main() {
	vector<string> vec;
	vec = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
	
	string s;
	cin >> s;
	
	for (int i = 0; i < vec.size(); i++) {
		if (s == vec.at(i)) {
			cout << 7 - i << endl;
		}
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second
// 許容する誤差ε
#define EPS (1e-10)
// 2つのスカラーが等しいかどうか
#define EQ(a,b) (abs((a)-(b)) < EPS)
// 2つのベクトルが等しいかどうか
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
//template
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p){
  os << p.first << " " << p.second;return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for (auto it = v.begin();it != v.end();++it){
    if (it != v.begin())os << " ";os << *it;
  }return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void print(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void print(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}
//typedef
typedef complex<double> Point;
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;


vector<int> G[100];
int in[100], out[100], used[100];
void init(){
  rep(i,100)in[i] = used[i] = out[i] = 0;
  rep(i,100)G[i].resize(0);
}

int dfs(int u){
  if(in[u] != out[u])return -1;
  if(used[u])return 0;
  used[u] = 1;
  int res = 0;
  rep(i,G[u].size()){
    min(dfs(G[u][i]), res);
  }
  return res;
}

int solve(){
  int cnt = 0;
  rep(i,26)if(!used[i]){
    if(used[i] or G[i].size() == 0)continue;
    int res = dfs(i);cnt++;
    if(res == -1)cnt = 2;
  }
  return cnt == 1;
}

signed main(){
	while(1){
    int n;
    cin >> n;
    if(n == 0)break;
    init();
    rep(i,n){
      string str;
      cin >> str;
      int s = str[0]-'a', t = str[str.size()-1]-'a';
      G[s].pb(t);out[s]++;in[t]++;
    }
    int res = solve();
    cout << (res ? "OK" : "NG") << endl;
  }
	return 0;
}







Measured memory_bytes: 3100
#-swank
(unless (member :child-sbcl *features*)
  (quit
	:unix-status
	(process-exit-code
	  (run-program *runtime-pathname*
				   `("--control-stack-size" "128MB"
					 "--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options"
					 "--eval" "(push :child-sbcl *features*)"
					 "--script" ,(namestring *load-pathname*))
				   :output t :error t :input t))))


(let ((w (read)) (a (read)) (b (read)))
  (princ (max 0 (- b (+ a w)) (- a (+ b w)))))


Measured memory_bytes: 6584
#include <iostream>
#include <string>
#include <sstream>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <vector>
#include <utility>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <cstdlib>
#include <iterator>
#include <algorithm>
#include <functional>
#include <random>
#include <bits/stdc++.h>

#include <stdio.h>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <math.h>
#include <ctime>
#include <cstring>


typedef long long ll;
using namespace std;

#define FOR(i,N) for(ll i=0;i<N;i++) 
#define RFOR(i,N) for(ll i=N-1;i>=0;--i)
#define COUT(str) cout << str << endl

//入力
int Apos, Zpos;
string s;

int main() {

	cin >> s;

	int Apos = s.find_first_of('A');

	int Zpos = s.find_last_of('Z');

	COUT(Zpos - Apos+1);

	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    int n;
    cin >> n;
    vector<int> p(n);
    rep(i, n) cin >> p[i];
    int ans = 0;
    rep(i, n - 2) {
        if (max({p[i], p[i + 1], p[i + 2]}) != p[i + 1]
            && (min({p[i], p[i + 1], p[i + 2]}) != p[i + 1])) {
            ans ++;
        }
    }
    printf("%d\n", ans);
    }

Measured memory_bytes: 256
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define divup(a,b) ( ( (a) + ( (b) - 1u) ) / (b) ) // a/b の余り切り上げ
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
ll mod = 1000000007;

signed main(){
    ll n;
    cin>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    sort(a.begin(),a.end());
    ll s=0,s1=0,s2=0;
    if(n%2==0){
        rep(i,(n/2)-1){
            s += 2*a[n-1-i];
            s -= 2*a[i];
        }
        s += a[n/2];
        s -= a[(n/2)-1];
    }else{
        rep(i,(n-3)/2) s1 += 2*a[n-1-i];
        rep(i,(n-1)/2) s1 -= 2*a[i];
        s1 += a[(n+1)/2];
        s1 += a[(n-1)/2];
        rep(i,(n-1)/2) s2 += 2*a[n-1-i];
        rep(i,(n-3)/2) s2 -= 2*a[i];
        s2 -= a[(n-1)/2];
        s2 -= a[(n-3)/2];
        s = max(s1,s2);
    }
    cout<<s<<endl;
}


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

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}
struct UnionFind {
    int n, cc, *u;
    UnionFind() : n(0), cc(0), u(NULL) {}
    UnionFind(int n_) : n(n_), cc(n_) {
	u = new int[n_];
	memset(u, -1, sizeof (int) * n);
    }
    UnionFind(const UnionFind &y) : n(y.n), cc(y.cc) {
	u = new int[y.n];
	memcpy(u, y.u, sizeof (int) * n);
    }
    ~UnionFind() {
	delete[] u; u = NULL;
	n = cc = 0;
    }
    friend void swap(UnionFind &x, UnionFind &y) {
	swap(x.n, y.n); swap(x.cc, y.cc); swap(x.u, y.u);
    }
    UnionFind& operator=(UnionFind y) { 
	swap(*this, y);
	return *this;
    }
    int root(int x) {
	int y = x, t;
	while (u[y] >= 0) y = u[y];
	while (x != y) { t = u[x]; u[x] = y; x = t; }
	return y;
    }
    bool link(int x, int y) {
	x = root(x); y = root(y);
	if (x == y) return false;
	if (u[y] < u[x]) swap(x, y);
	u[x] += u[y]; u[y] = x; cc--;
	return true;
    }
    bool same(int x, int y) { return root(x) == root(y); }
    int size(int x) { return -u[root(x)]; }
    int count() { return cc; }
};

int N, M;
int P[100011];

void MAIN() {
    scanf("%d%d", &N, &M);
    REP (i, N) scanf("%d", P+i), P[i]--;

    UnionFind U(N);
    REP (i, M) {
	int x, y;
	scanf("%d%d", &x, &y);
	x--; y--;
	U.link(x, y);
    }

    int ans = 0;
    REP (i, N) if (U.same(i, P[i])) ans++;
    printf("%d\n", ans);
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;

double hensa(double s[],double m,double n){
  double a=0;
  for(int i=0;i<n;i++){
    a += pow(s[i]-m,2);
  }
  return sqrt(a/n);
}


int main(){
  int n;
  while(1){
    cin >> n;
    if(n == 0)
      break;

    double num[n],m=0;
    for(int i=0;i<n;i++){
      cin >> num[i];
      m+= num[i];
    }
    m = m/n;

    cout << fixed << setprecision(5) << hensa(num,m,n) << endl;
  }

  return 0;
}



Measured memory_bytes: 3224
import java.util.*
fun main(args: Array<String>) {
    val abc = (1..3).map { ArrayDeque<Int>().apply { addAll(readLine()!!.map { it - 'a' }) } }
    var turn = 0
    while (abc[turn].isNotEmpty()) {
        turn = abc[turn].poll()
    }
    println('A' + turn)
}


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

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



Measured memory_bytes: 3084
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

LL N;
std::vector<LL>a, b;

int main()
{
	in >> N;
	a.resize(N), b.resize(N);
	rep(i, N) in >> a[i];
	rep(i, N) in >> b[i];
	LL ans = 0;
	rep(i, 30)
	{
		LL power = pow(2LL, i), powerPlus = pow(2LL, i + 1);
		auto aa = a, bb = b;
		rep(j, N)
		{
			aa[j] %= powerPlus;
			bb[j] %= powerPlus;
		}
		std::sort(bb.begin(), bb.end());
		LL one = 0;
		rep(j, N)
		{
			one += std::lower_bound(bb.begin(), bb.end(), 2 * power - aa[j])
				- std::lower_bound(bb.begin(), bb.end(), power - aa[j]);
			one += std::lower_bound(bb.begin(), bb.end(), 4 * power - aa[j])
				- std::lower_bound(bb.begin(), bb.end(), 3 * power - aa[j]);
		}
		if (one % 2 == 1) ans += power;
	}
	out << ans << std::endl;
	return 0;
}

Measured memory_bytes: 8580
#include <limits>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <bitset>
#include <map>
#include <unordered_map>
#include <cstdint>
using namespace std;


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

    size_t n;
    cin >> n;
    int64_t count = 0;
    for(size_t i = 0; i < n; ++i)
    {
        int64_t a;
        cin >> a;
        while(a%2 == 0)
        {
            count += 1;
            a /= 2;
        }
    }
    
    cout << count << '\n'; 

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n,a,b,c;
  cin >> n;
  if(n < 1000 || 9999 < n){
  }else {
    
  a = n / 1000;
  n = n - a * 1000;
  b = n / 100;
  n = n - b * 100;
  c = n / 10;
  n = n - c * 10;
  if ((a == b && b == c) || (b == c && c == n)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long li;

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

    li a, b, m;
    cin >> a >> b >> m;
    vector<li> as(a), bs(b);

    for (int i = 0; i < a; ++i) {
        cin >> as[i];
    }
    for (int i = 0; i < b; ++i) {
        cin >> bs[i];
    }

    li ans = *min_element(as.begin(), as.end()) + *min_element(bs.begin(), bs.end());

    for (int i = 0; i < m; ++i) {
        li x, y, c;
        cin >> x >> y >> c;
        x--; y--;
        ans = min(ans, as[x] + bs[y] - c);
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int n,k,a[200010];
bool used[200010];
int main()
{
	cin>>n>>k;
	if (n==1)
	{
		puts("Yes");
		return 0;
	}
	if (n==2)
	{
		if (k==2)
		{
			printf("Yes\n1\n2\n3\n");
		}
		else
		{
			puts("No");
		}
		return 0;
	}
	if (k==1 || k==n*2-1)
	{
		puts("No");
		return 0;
	}
	puts("Yes");
	a[n]=k;
	a[n-1]=k-1;
	a[n+1]=k+1;
	used[k]=used[k-1]=used[k+1]=true;
	if (k>2)
	{
		a[n+2]=1;
		used[1]=true;
	}
	else
	{
		a[n-2]=2*n-1;
		used[2*n-1]=true;
	}
	for (int i=1,j=1;i<2*n;i++)
	{
		if (a[i])
		{
			continue;
		}
		while (j<2*n && used[j])
		{
			j++;
		}
		a[i]=j;
		used[j]=true;
	}
	for (int i=1;i<2*n;i++)
	{
		printf("%d\n",a[i]);
	}
	return 0;
}


Measured memory_bytes: 2432
#include<stdio.h>
#include<string.h>
#define anD &&
#define oR ||
#define max(a,b) ((a)>=(b))?(a):(b)
#define min(a,b) ((a)<=(b))?(a):(b)
#define rep(i,n) for((i)=0;(i)<(n);(i)++)

void meirei_print(const int a,const int b, char str[]) {
	int i;
	for (i = a; i <= b; i++) {
		printf("%c", str[i]);
	}
	printf("\n");
}

void meirei_reverse(const int a, const int b, char str[]) {
	int i;
	char temp;
	for (i = 0; i <= (b - a) / 2; i++) {
		temp = str[a + i];
		str[a + i] = str[b - i];
		str[b - i] = temp;
	}
}

void meirei_replace(const int a, const int b, char str[], const char p[]) {
	int i;
	rep(i, b - a + 1) {
		str[a + i] = p[i];
	}
}




int main() {
	char str[1001];
	char meirei[10];

	scanf("%s", str);
	int n;
	scanf("%d", &n);
	int i;
	rep(i, n) {
		int a, b;
		char p[1001];
		scanf("%s %d %d", meirei,&a,&b);
		if (strcmp(meirei, "print") == 0) {
			meirei_print(a, b, str);
		}
		if (strcmp(meirei, "reverse")==0) {
			meirei_reverse(a, b, str);
		}
		if (strcmp(meirei, "replace")==0) {
			scanf("%s", p);
			meirei_replace(a, b, str, p);
		}
	}
	return 0;
}

Measured memory_bytes: 572
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    ll n;
    cin >> n;

    ll ans = INF;
    for(ll i = 1; i*i <= n; i++) {
        if(n%i == 0) {
            chmin(ans, i + n/i - 2);
        }
    }
    
    out(ans);
    re0;
}

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

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PPI;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())

ll x,y;

int main(){
	cin.sync_with_stdio(false);
  cin>>x>>y;
  if(abs(x-y)<=1)cout<<"Brown"<<endl;
  else cout<<"Alice"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}

template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=16,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f3f3f3f3f;

ll n;
ll d[MAXn][MAXn];
ll dp[(1<<MAXn)];
ll pre[(1<<MAXn)];
int main(){
  IOS();
	cin >> n;
	REP (i,n) REP (j,n) cin >> d[i][j];

	REP (I,(1<<n)) {
		vector<ll> tmp;
		REP (i,n) if ((1<<i) & I) tmp.eb(i);
		ll tt = 0;
		REP (i,SZ(tmp)) {
			REP (j,i) tt += d[tmp[i]][tmp[j]];
		}
		pre[I] = tt;
	}

	// dp[0] = 0;
	// REP1 (I,(1<<n)-1) {
	// 	vector<ll> tmp;
	// 	REP (i,n) if ((1<<i) & I) tmp.eb(i);
  //
	// 	ll sz = SZ(tmp);
	// 	REP (J,(1<<sz)) {
	// 		ll S = 0;
	// 		REP (i,sz) if ((1<<i) & J) S += (1<<tmp[i]);
	// 		dp[I] = max(dp[I],dp[I-S] + pre[S]);
	// 	}
	// }
  REP (I,(1<<n)) {
    for (ll J=I;J;J = (J-1)&I) {
      dp[I] = max(dp[I],dp[I^J] + pre[J]);
    }
  }

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


Measured memory_bytes: 1280