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

using namespace std;

const int N=2e5+10;
int parent[N],s[N],ans=-1,n,m;

int find(int x)
{
	while (x!=parent[x])
	{
		x=parent[x];
	}
	return x;
}
void union_vertices(int x,int y)
{
	x=find(x);
	y=find(y);
	if (x==y)   return ;
	if (s[x]<s[y])   swap(x,y);
	parent[y]=x;
	s[x]+=s[y]; 
}

int main()
{
	scanf("%d %d",&n,&m);
	for (int i=1;i<=n;i++)
	{
		parent[i]=i;
		s[i]=1;
	}
	for (int i=1;i<=m;i++)
	{
		int x,y;
		scanf("%d %d",&x,&y);
		union_vertices(x,y);
	}
	for (int i=1;i<=n;i++)
	{
		if (find(i)==i)   ans=max(ans,s[i]);
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 5324
s = gets.chomp
if s[0] == 'A'
  count = 0
  j = 1
  ccount = 0
  s.split('').each do |r|
    count += 1 if r =~ /[A-Z]/
    ccount += 1 if (j >= 3 && j < s.size) && r == 'C'
    j += 1
  end
  if count == 2 && ccount == 1
    puts :AC
    exit
  end
end
puts :WA

Measured memory_bytes: 1788
using System;

namespace aoj4a
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string[] str = (Console.ReadLine()).Split(' ');
                int a = int.Parse(str[0]);
                int b = int.Parse(str[2]);

                switch (str[1])
                {
                    case "+":
                        Console.WriteLine( a + b );
                        break;
                    case "-":
                        Console.WriteLine(a - b);
                        break;
                    case "*":
                        Console.WriteLine(a * b);
                        break;
                    case "/":
                        Console.WriteLine(a / b);
                        break;
                    case "?":
                        return;
                }
            }
                



        }
    }
}

Measured memory_bytes: 9180
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef vector<ll> vel;
typedef vector<str> ves;
#define REP(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define rep(i, b) REP(i, 0, b)
const ll mod = 1000000007;
const double pi = 3.14159265358979;

int main() {
    char X, Y;
    cin >> X >> Y;
    if (X < Y) {
        cout << '<' << endl;
    }
    else if (X > Y) {
        cout << '>' << endl;
    }
    else {
        cout << '=' << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define Re return
#define In inline
#define Rg register
#define St static
#define Op operator
#define bCnt __builtin_popcountll
#define bCtz __builtin_ctzll
#define inc(l, i, r) for(Rg int i=l; i<r; ++i)
#define dec(l, i, r) for(Rg int i=r; i>l; --i)
typedef long long ll;

ll leaf, leafa, leafb, c, que, vis, va[64], vb[64], w[64];

int ans=233;

In void move(int v)
{
    leaf^=1ll<<v;
    if(bCnt(w[bCtz(w[v])]^=1ll<<v)==1)
        leaf|=1ll<<bCtz(w[v]);
    que&=-1ll-(1ll<<v), c|=1ll<<v;
    que|=vb[v]&~c;
}

In void work()
{
    Rg int cnt=1;
    for(;que&leaf;)
    {
        ++cnt;
        move(bCtz(que&leaf));
    }
    if(!que)
        ans=min(ans, cnt);
}

void DFS(int u)
{
    vis|=1ll<<u;
    c|=1ll<<u;
    que&=-1ll-(1ll<<u);
    que|=vb[u]&~c;
    for(ll e=va[u]&vb[u]&~vis; e; e^=e&-e)
        DFS(bCtz(e));
}

int main()
{
//    init();
    St int T;
    for(scanf("%d", &T); T--;)
    {
        St int n;
        scanf("%d", &n);
        inc(1, i, n+1)
            va[i]=0, vb[i]=0;
        ans=233;
        inc(1, i, n)
        {
            St int x, y;
            scanf("%d%d", &x, &y);
            va[x]|=1ll<<y, va[y]|=1ll<<x;
        }
        inc(1, i, n)
        {
            St int x, y;
            scanf("%d%d", &x, &y);
            vb[x]|=1ll<<y, vb[y]|=1ll<<x;
        }
        leafa=leafb=0;
        inc(1, i, n+1)
        {
            if(bCnt(va[i])==1)
                leafa|=1ll<<i;
            if(bCnt(vb[i])==1)
                leafb|=1ll<<i;
        }
        inc(1, i, n+1)
            if(leafa&1ll<<i)
                inc(1, j, n+1)
                    if(i^j)
                    {
                        c=que=0;
                        leaf=leafa;
                        inc(1, k, n+1)
                            w[k]=va[k];
                        move(i);
                        w[j]|=1ll<<i;
                        leaf&=-1-(1ll<<j);
                        work();
                    }
        inc(1, i, n+1)
            if(leafa&1ll<<i)
                inc(1, j, n+1)
                    if(vb[i]&1ll<<j)
                    {
                        vis=c=que=0;
                        leaf=leafa;
                        inc(1, k, n+1)
                            w[k]=va[k];
                        DFS(j);
                        if(c==(1ll<<n+1)-2) ans=0;
                        move(i);
                        work();
                    }
        printf("%d\n", ans==233? -1: ans);
    }
    Re 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl 
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl 
#define no cout<<"no"<<endl
#define vec(a,y,x)  vector<vector<char>> a (y,vector<char>(x))
const vector<int> dx={1,0,-1,0};
const vector<int> dy={0,1,0,-1};

int main(){
  long n;
  cin>>n;
  long a3=n/3;
  long a5=n/5;
  long a15=n/15;
  long sum=n*(n+1)/2;
  sum=sum-3*a3*(a3+1)/2;
  sum-=5*a5*(a5+1)/2;
  sum+=15*a15*(a15+1)/2;
  cout<<sum<<endl;
}

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

typedef long long ll;

const int inf = 100000;

int main() {
    int X, N;
    int d = inf;
    int ans;
    cin >> X >> N;
    if (N == 0) {
        cout << X << endl;
        return 0;
    }
    vector<int>p(N);
    
    for (int i = 0; i < N; i++) {
        cin >> p[i];
    }

    sort(p.begin(), p.end());
    int j = 0;
    for (int i = 0; i <= 101; i++) {
        if (i == p[j]) {
            j++;
        } else {
            int d1 = abs(X-i);
            if (d1 < d) {
                ans = i;
                d = d1;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3636
#include <stdio.h>
int main(void)
{
  char c[7];
  int i;
  for(i=0;i<7;i++)
  scanf("%s", c);
  if(c[2]==c[3] && c[4]==c[5])
  printf("Yes");
  else
  printf("No");

  return 0;
}


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

#define int long long
#define fast_io(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define loop(i,a,b) for(int i=a;i<b;i++)
#define all(x) x.begin(),x.end()
#define us unordered_set
#define um unordered_map
#define ms multiset
#define mm multimap
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define _max max_element
#define _min min_element
#define tc(T) int T; cin>>T; while(T--)
#define q(q) int q; cin>>q; while(q--)
#define pi 3.1415926535897932384626433832
const int pinf=((int)2e18);
const int ninf=((int)-2e18);
const int mod=1000000007;

using namespace std;

int power(int x,int n,int M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)
        return power((x*x)%M,n/2,M);
    else
        return (x*power((x*x)%M,(n-1)/2,M))%M;
}

bool vowel(char c)
{
    return(c=='a' or c=='e' or c=='i' or c=='o' or c=='u' or c=='A' or c=='E' or c=='I' or c=='U' or c=='O');
}

int32_t main()
{
    fast_io();

    //FILE *fptr1=freopen("in.txt","r",stdin);
    //FILE *fptr2=freopen("out.txt","w",stdout);


    int n;
    cin>>n;

    int c=log2(n);
    int x=1LL<<c;

    int p=0;
    int a=0;
    loop(i,0,c)
    {
        a+=(1LL<<p);
        p++;
    }

    cout<<a+x;



    return 0;
}


Measured memory_bytes: 3772
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[]]*num
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

X,Y = II()

if (2*X-Y)%3!=0 or (2*Y-X)%3!=0:
    print(0)
    exit()

x = (2*X-Y)//3
y = (2*Y-X)//3
if x<0 or y<0:
    print(0)
    exit()

#0!~(n-1)!をmodしつつ求める
def fact_all(n,M=mod):
    f = [1]*n
    ans = 1
    for i in range(1,n):
        ans = ans*i
        ans = ans%M
        f[i] = ans
    return f


#a!をmodしつつ求める
def fact(a,M=mod):
    ans = 1
    for i in range(2,a+1):
        ans = ans*i
        ans = ans%M
    return ans


#互いに素なa,bについて、a*x+b*y=1の一つの解[x,y]を出力
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    return [w[0],w[1]]


#aの逆元(mod M)を求める（aとMは互いに素）
def mod_inv(a,M=mod):
    x = extgcd(a,M)[0]
    return (M+x%M)%M


#nCkをmodしつつ返す
def nCk(n,k,M=mod,fact_list=[],inv_list=[]):
    if fact_list and inv_list:
        return (fact_list[n]*inv_list[k]*inv_list[n-k])%M
    else:
        x = fact(n,M)
        y1 = mod_inv(fact(k,M),M)
        y2 = mod_inv(fact(n-k,M),M)
        return (x*y1*y2)%M
    
print(nCk(x+y,x,mod))

Measured memory_bytes: 39152
#include <stdio.h>

int main()
{
	int n, Sn, i;
	scanf ("%d", &n);
	i = n;
	while(i > 0){
		Sn += i%10;
		i = i/10;
	}
	if (n % Sn == 0){
		printf ("Yes\n");
	}
	else{
		printf ("No\n");
	}
	return 0;
}

Measured memory_bytes: 128
n = int(input())
p = list(map(int,input().split()))

count = 0
for i in range (1, n - 1):
    if (p[i]>p[i-1] and p[i+1]>p[i]) or (p[i]<p[i-1] and p[i+1]<p[i]):
        count += 1
print(count)

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

int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}


int main(){
    
    int n;
    int count = 0;
    
    std::cin >> n;
    
    const int N = n;
    int p[N];
    int q[N];
    for(int i =0; i < N; i++){
        std::cin >> p[i];
    }
    
    for(int i =0; i < N; i++){
        q[i] = p[i];
    }
    
    qsort(p, N, sizeof(int), compare_int);
    for(int i = 0; i < N; i++){
        if( p[i] != q[i]){
            count++;
        }
    }
    
    if(count <= 2){
        std::cout << "YES" << "\n";
    } else std::cout << "NO" << "\n";

    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  long long x,ans=0,cnt=1,y;
  cin >> x;
  y=x*2;
  ans=y/11;
  if(x%11>0&&x%11<6){
    ans++;
  }
  if(x%11>6){
    ans++;
  }
  cout << ans;
}

Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>
#include <vector>
#define int long long
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;
typedef pair<int, int> P;

int INF = 1000000007;
int n, q;
int a[100000];
P query[100000];
int xs[100000];
int imos[100001];
int ans[100000];

int getRx(int i) {
	if ((n - i) % 2 == 0) return INF;
	int st = a[i], ed = INF, mid;	//[st, ed), oooxxx
	while (ed - st >= 2) {
		mid = (st + ed) / 2;
		
		int dist = mid - a[i];
		int id = lower_bound(a, a + n, mid + dist) - a;
		if (id - i <= n - id) { st = mid; }
		else { ed = mid; }
	}
	return st;
}

signed main() {
	int i;
	int sumA = 0;
	
	cin >> n >> q;
	rep(i, n) { cin >> a[i]; sumA += a[i]; }
	rep(i, q) {
		int x; cin >> x;
		query[i] = P(x, i);
	}
	sort(query, query + q);
	rep(i, q) xs[i] = query[i].first;
	
	rep(i, n) {
		//a[i]をゲットできるxの範囲(左端)
		int lx;
		int take = n - 1 - i;
		int p = i - take;
		if (p < 0) lx = 0;
		else lx = (a[p] + a[i]) / 2 + 1;
		
		//a[i]をゲットできるxの範囲(右端)
		int rx = getRx(i);
		
		//cout << a[i] << " " << lx << " " << rx << endl;
		
		int idL = lower_bound(xs, xs + q, lx) - xs;
		int idR = upper_bound(xs, xs + q, rx) - xs;
		imos[idL] += a[i];
		imos[idR] -= a[i];
	}
	
	rep(i, q) imos[i + 1] += imos[i];
	rep(i, q) {
		ans[query[i].second] = sumA - imos[i];
	}
	
	rep(i, q) cout << ans[i] << endl;
	return 0;
}

Measured memory_bytes: 6400
#include <iostream>

using namespace std;

int main() {
  int count_total = 0; // 合計
  int count_1 = 0; // 直角三角形
  int count_2 = 0; // 鋭角
  int count_3 = 0; // 鈍角
  while(true) {
    int long_side = 0;
    int short_side1 = 0;
    int short_side2 = 0;
    int a, b, c = 0;
    cin >> a >> b >> c;
    if (!(abs(b-c) < a && a < b + c)) {
      //cout << "-----" << endl;
      cout << count_total << " " << count_1 << " " << count_2 << " " << count_3 << endl;
      return 0;
    }
    count_total++;
    int max_side = a;
    if (b > a && b > c) {
      // bが一番長い
      long_side = b;
      short_side1 = a;
      short_side2 = c;
    } else if (c > a && c > b) {
      // cが一番長い
      long_side = c;
      short_side1 = a;
      short_side2 = b;
    } else {
      // aが一番長い
      long_side = a;
      short_side1 = b;
      short_side2 = c;
    }
    int d1 = long_side * long_side;
    int d2 = short_side1 * short_side1 + short_side2 * short_side2;
    // 鈍角
    if (d1 > d2) {
      count_3++;
    } else if (d1 == d2) {
      // 直角
      count_1++;
    } else {
      // 鋭角
      count_2++;
    }
  }

}



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

double dp[200][200];
double h[200][200];
int main() {
	int n, m;
	while (scanf("%d%d", &n, &m), n) {
		rep(i, n)rep(j, n)scanf("%lf", &h[i][j]);
		memset(dp, 0, sizeof(dp));
		rep(i, n)dp[0][i] = 1.;
		rep(i, m - 1)rep(j, n)rep(k, n)
			dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] * h[j][k]);
		double Max = 0.;
		rep(i, n)Max = max(Max, dp[m - 1][i]);
		printf("%.2lf\n", Max);
	}
}

Measured memory_bytes: 3672
import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int l = sc.nextInt();
        int min = Integer.MAX_VALUE;
        int sum = 0;
        for (int i = 1; i <= n; i++) {
            int t = l + i - 1;
            if (Math.abs(t) < Math.abs(min)) {
                min = t;
            }
            sum += t;
        }
        System.out.println(sum - min);
    }
}


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

int main(){
    int n, d, x;
    cin >> n >> d >> x;
    int p[d][n];
    for(int i = 0; i < d; i++){
        for(int j = 0; j < n; j++){
            cin >> p[i][j];
        }
    }
    for(int i = 0; i < d-1; i++){
        vector<int> dp(x+1, 0);
        for(int j = 0; j < n; j++){
            int wei = p[i][j], val = p[i+1][j];
            if(wei > x) continue;
            dp[wei] = max(dp[wei], val);
            for(int k = wei+1; k <= x; k++){
                if(dp[k-wei] == 0)  continue;
                dp[k] = max(dp[k], dp[k-wei]+val);
            }
        }
        int nx = 0;
        for(int k = 0; k <= x; k++){
            nx = max(nx, dp[k] + x-k);
        }
        x = nx;
    }
    cout << x << endl;
    return 0;
}


Measured memory_bytes: 3196
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#define endl "\n"
using namespace std;

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

    string s;
    cin >> s;

    int len = s.length();

    int i;
    int ans = 0;
    int maxAns = 0;
    for(i = 0; i < len; i ++)
    {
    	if(s[i] == 'I')
    		ans ++;
    	else
    		ans --;
    	if(ans > maxAns)
    		maxAns = ans;
    }
    cout << maxAns << endl;
}

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

#define N 200000

int main(void){
  int n;
  int r[N];
  int i;
  int maxv = -1 * 1000000000;

  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf("%d", &r[i]);
  }

  int minv = r[0];

  for(i = 1; i <= n - 1; i++){
    if(maxv < r[i] - minv){
      maxv = r[i] - minv;
    }
    if(minv > r[i]){
      minv = r[i];
    }
  }

  printf("%d\n", maxv);

}



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

int main() {
    string s; cin >> s;
    vector<int> cnt(256, 0);
    for (char &c : s) cnt[c]++;
    if (cnt['E'] == 0 ^ cnt['W'] == 0) {
        puts("No");
        return 0;
    }
    if (cnt['N'] == 0 ^ cnt['S'] == 0) {
        puts("No");
        return 0;
    }
    puts("Yes");
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
#define fors(i,a,b) for(int i=(a);i<=(b);++i)
typedef long long ll;
const int Size=1<<18;
inline char getch(){
    static char buf[Size],*p1=buf,*p2=buf;
    return p1==p2 && (p2=(p1=buf)+fread(buf,1,Size,stdin),p1==p2) ? EOF : *p1++;
}
int read(){
    int s=0,f=1;
    char c=getch();
    while(c>'9' || c<'0'){if(c=='-') f=-1; c=getch();}
    while(c<='9' && c>='0'){s=(s<<1)+(s<<3)+c-'0';c=getch();}
    return s*=f;
}// 本蒟蒻使用的最强读入（用来暴力卡时间）
int main(){//纯模拟
    int a=read(),wh[9],b=read(),e=read();
    fors(c,-100,200){
        wh[1]=a+b+c;
        if(wh[1]<a+e) continue;
        fors(i,-100,200){
            wh[7]=a+e+i;
            if(wh[7]!=wh[1]) continue;
            fors(f,-100,200)
            {
                wh[6]=c+f+i;
                if(wh[6]!=wh[7]) continue;
                fors(d,-100,200){
                    wh[2]=d+e+f;
                    if(wh[2]!=wh[6]) continue;
                    fors(g,-100,200)
                    {
                        wh[4]=g+d+a;
                        wh[8]=c+e+g;
                        if((wh[8]!=wh[4])) continue;
                        fors(h,-100,200){
                            wh[3]=g+h+i;
                            wh[5]=b+e+h;
                            if((wh[3]!=wh[5]) || (wh[3]!=wh[4]) || (wh[3]!=wh[8])) continue;
                                printf("%d %d %d\n",a,b,c);
                                printf("%d %d %d\n",d,e,f);
                                printf("%d %d %d\n",g,h,i);
                                return 0;
                        }
                    }        
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

int main(){
    map<int,int> mp;
    int N,K;cin>>N>>K;
    int A;
    for(int i=0;i<N;i++){
        cin>>A;
        mp[A]++;
    }
    int kind=0;
    vec v;
    for(auto itr=mp.begin();itr!=mp.end();itr++){
        kind++;
        v.push_back(itr->second);
    }
    if(kind<=K){
        cout<<0<<endl;
        return 0;
    }
    else{
        sort(v.begin(),v.end());
        int ans=0,i=0;
        while(kind>K){
            ans+=v[i];
            i++;
            kind--;
        }
        cout<<ans<<endl;
        return 0;
    }
    return 0;
}

Measured memory_bytes: 10748
n = int(input())
taro = 0
hanako = 0
for i in range(n):
    t, h = input().split()
    if t < h:
        hanako += 3
    elif t > h:
        taro += 3
    else:
        taro += 1
        hanako += 1
print(taro, hanako)

Measured memory_bytes: 7664
import java.util.Scanner;
import java.util.Stack;

class Main {

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

    void compute() {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int h = sc.nextInt();
        System.out.println((a + b) * h / 2);
    }
}


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

const int INF=1001001001,MX=1010;
int n,m;
int dp[MX][MX],a[MX],b[MX],c[MX];

int main(){
    cin>>n>>m;
    rep(i,MX)rep(j,MX)dp[i][j]=INF;
    rep(i,MX)dp[i][i]=0;
    rep(i,m){
        cin>>a[i]>>b[i]>>c[i];
        a[i]--; b[i]--;
        dp[a[i]][b[i]]=c[i];
        dp[b[i]][a[i]]=c[i];
    }
    //WF
    rep(k,n)rep(i,n)rep(j,n){
        dp[i][j]=min(dp[i][j],dp[i][k]+dp[k][j]);
    }
    int ans=0;
    rep(i,m){
        bool ok=false;
        rep(j,n)rep(k,n){
            if(dp[j][k]==dp[j][a[i]]+c[i]+dp[b[i]][k])ok=true;
        }
        if(!ok)ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 7624
#include <bits/stdc++.h> 
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(), vec.end()
typedef long long ll;ll MM = 1000000000;ll mod = MM + 7;

int main(){
 ll d; cin>>d;
  if(d==25) cout<<"Christmas"<<endl;
  else if(d==24) cout<<"Christmas Eve"<<endl;
      
  else if(d==23) cout<<"Christmas Eve Eve"<<endl;
  
  else cout<<"Christmas Eve Eve Eve"<<endl;
  
}

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

/**
 * vector<int>ar(3);
 * for(auto&e:ar){
 *     scanf("%d",&e);
 * }
 * sort(ar.begin(),ar.end())
 * int sum=accumulate(ar.begin(),ar.end(),0);
 ***/

int main(){
    double pai=3.141592653589;
    int h,w;
    for(;;){
        scanf("%d %d",&h,&w);
        if(h==0 && w==0) break;
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 1152
#include <cstdio>
#include <vector>

using namespace std;

int ceil(int numerator, int denominator)
{
    int quotient = numerator/denominator;
    int remainder = numerator%denominator;

    return (quotient + (remainder != 0));
}

int main()
{
    int no_of_elements, k;
    scanf("%d %d", &no_of_elements, &k);

    int answer = ceil(no_of_elements - 1, k - 1);

    printf("%d\n", answer);
    return 0;
}


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

template<class T> bool inline chmax(T &a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

int main() {
	int N, W;
	cin >> N >> W;
	vector<int> v(N), w(N);
	rep(i, N) cin >> v[i] >> w[i];
	vector<vector<int>> dp(N + 1, vector<int>(W + 1));
	for (int i = 0; i < N; i++) {
		for (int j = 1; j <= W; j++) {
			if (j - w[i] >= 0) chmax(dp[i + 1][j], dp[i][j - w[i]] + v[i]);
			chmax(dp[i + 1][j], dp[i][j]);
		}
	}
	cout << dp[N][W] << endl;
	return 0;
}


Measured memory_bytes: 6744
#include <bits/stdc++.h>
#define endl '\n'

using namespace std;

void solve(){
    int x, n, ans=INT_MAX, _abs=INT_MAX;
    cin>>x>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a.begin(),a.end());
    for(int i=x;;i--){
        if(!binary_search(a.begin(),a.end(),i)){
            _abs=abs(x-i);
            ans=i;
            break;
        }
    }
    for(int i=x;;i++){
        if(!binary_search(a.begin(),a.end(),i)){
            if(abs(x-i)<_abs){
                _abs=abs(x-i);
                ans=i;
            }
            if(abs(x-i)>_abs)break;
        }
    }
    cout<<ans<<endl;
}

int main()
{
    //freopen("IN.txt","r",stdin);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}

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

#define rep(i,z) for(int i = 0; i<(int)(z); i++)
#define rep1(i,z) for(int i = 1; i<=(int)(z); i++)

using namespace std;

typedef long long ll;
const ll mod=1e9+7;

using pear = pair<int,int>;

int main(){
    int n,k;
    cin >>n >>k;
    int ans = 0;
    rep(i,n){
        int h; cin >>h;
        if(h >= k) ans++;
    }
    cout << ans <<endl;
}


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

using ll = long long;

int main() {
	ll a, b; cin >> a >> b;
	if (a < b) swap(a, b);

	ll l = 0LL, r = 1000000001LL;
	while (r - l > 1LL) {
		ll mid = (l + r) / 2LL;
		ll j = abs(a - mid) - abs(b - mid);
		if (j == 0LL) {
			cout << mid << endl;
			return 0;
		}
		else if (j > 0LL) l = mid;
		else r = mid;
	}

	cout << "IMPOSSIBLE" << endl;
}


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

int main(){
  char a, b, ans;
  cin >> a >> b;
  if(a=='H'){
    if(b=='H') ans = 'H';
    else ans = 'D';
  }else{
    if(b=='H') ans = 'D';
    else ans = 'H';
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
def func(tmp):
  ans = ''
  sub_ans = (tmp-1)/26
  if int(sub_ans) >0:
      ans += func(int(sub_ans))
  if (tmp-1) <= 0:
    ans+='a'
  else:
  	ans += chr(97 + int(tmp-1)%26)
  return ans

  
tmp = int(input())
print(func(tmp))
  
  

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

struct edge{
	int to,cap,rev;
	edge(){}
	edge(int tt,int cc,int rr){
		to=tt;
		cap=cc;
		rev=rr;
	}
};

class dinic{
public:
	const int INF=100000;
	vector<edge> G[2001];
	int level[2001];
	int iter[2001];
	void add_edge(int from,int to,int cap){
		G[from].push_back(edge(to,cap,G[to].size()));
		G[to].push_back(edge(from,0,G[from].size()-1));
	}

	void bfs(int s){
		memset(level,-1,sizeof(level));
		queue<int> que;
		level[s]=0;
		que.push(s);
		while(que.size()){
			int v=que.front();
			que.pop();
			for(int i=0;i<G[v].size();i++){
				edge &e=G[v][i];
				if(e.cap>0 && level[e.to]<0){
					level[e.to]=level[v]+1;
					que.push(e.to);
				}
			}
		}
	}

	int dfs(int v,int t,int f){
		if(v==t)return f;
		for(int &i=iter[v];i<G[v].size();i++){
			edge &e=G[v][i];
			if(e.cap>0 && level[v]<level[e.to]){
				int d=dfs(e.to,t,min(e.cap,f));
				if(d>0){
					e.cap-=d;
					G[e.to][e.rev].cap+=d;
					return d;
				}
			}
		}
		return 0;
	}
	int max_flow(int s,int t){
		int flow=0;
		while(1){
			bfs(s);
			if(level[t]<0)return flow;
			memset(iter,0,sizeof(iter));
			int f;
			while((f=dfs(s,t,INF))>0){
				flow+=f;
			}
		}
	}
};

int n,m;
int s[501],t[501];

int solve_max(){
	int ans=0;
	vector<P> vec;
	for(int i=0;i<n;i++){
		vec.push_back(P(s[i],t[i]));
	}
	sort(vec.begin(),vec.end());
	int f=0;
	priority_queue<int,vector<int>,greater<int> > que;
	for(int i=0;i<400;i++){
		while(f<n && vec[f].first<=i){
			que.push(vec[f].second);
			f++;
		}
		while(que.size()){
			int v=que.top();
			que.pop();
			if(v>=i){
				ans++;
				break;
			}
		}
	}
	return ans;
}

int solve_min(){
	int S=n+800;
	int T=S+1;
	dinic di;
	for(int i=0;i<400;i++){
		di.add_edge(i,400+i,1);
	}
	for(int i=0;i<m;i++){
		di.add_edge(S,800+i,1);
		for(int j=s[i];j<=t[i];j++){
			di.add_edge(800+i,j,1);
		}
	}
	for(int i=0;i<n-m;i++){
		di.add_edge(800+m+i,T,1);
		for(int j=s[m+i];j<=t[m+i];j++){
			di.add_edge(400+j,800+m+i,1);
		}
	}
	return di.max_flow(S,T);
}

int main(void){
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++){
		scanf("%d%d",&s[i],&t[i]);
		s[i]--;
		t[i]--;
	}
	printf("%d\n",solve_max());
	printf("%d\n",solve_min());
	return 0;
}


Measured memory_bytes: 4804
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long n,k;
    cin >> n >> k;
    vector<long long> cost(n);
    for (long long i = 0; i < n; i++){
        cin >> cost.at(i);
    }
    
    vector<long long> ans(n);
    ans.at(0) = 0;
    ans.at(1) = abs(cost.at(1)-cost.at(0));
    for (long long i = 2; i < n; i++){
        long long kari = 1000000000;
        for (long long j = 0; j < k; j++){
            long long kar;
            long long zero = 0;
            kar = ans.at(max(i-j-1,zero))+abs(cost.at(i)-cost.at(max(i-j-1,zero)));
            if (kar < kari){
                kari = kar;
            }
        }
        ans.at(i) = kari;
    }
    printf("%lld\n",ans.at(n-1));
}

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

int main() {

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

  int n;
  cin >> n;

  vector<long long> h(n), dp(n);
  dp[0] = 0;

  for (int i = 0; i < n; ++i) {
    cin >> h[i];
    if (i)  dp[i] = dp[i-1] + abs(h[i] - h[i-1]);
    if (i > 1)  dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]));
  }

  cout << dp[n-1] << '\n';
}


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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pll = pair<ll, ll>;


namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.first,", ",x.second,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

ll N;
vector<pll> arr;
vector<vll> dp;

ll recurse(ll pos, ll lhs) {
	if (pos == N) return 0;
	if (dp[pos][lhs] != -1) return dp[pos][lhs];
	// prll("CALC", arr[pos], arr[pos].first * abs(arr[pos].second - lhs), arr[pos].first * abs(arr[pos].second - (N-1-(pos-lhs))));
	ll best = 0;
	best = max(best, arr[pos].first * abs(arr[pos].second - lhs) + recurse(pos + 1, lhs + 1));
	best = max(best, arr[pos].first * abs(arr[pos].second - (N-1-(pos-lhs))) + recurse(pos + 1, lhs));

	dp[pos][lhs] = best;
	return best;
}
int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> N;
	arr.resize(N); 

	dp = vector<vll> (N + 1, vll (N + 1, -1));
	F0R(i, N) {
		ll x; cin >> x;
		arr[i] = {x, i};
	}

	sort(arr.begin(), arr.end(), [] (const pll lhs, const pll rhs) {
		return lhs.first > rhs.first || (lhs.first == rhs.first && abs(lhs.second - N/2) < abs(rhs.second - N/2));
	});

	print(recurse(0, 0));	
}

Measured memory_bytes: 34884
package main

import (
	"bufio"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var edge map[int]map[int]int
var ans []int

func readInt() int {
	sc.Scan()
	iv, _ := strconv.Atoi(sc.Text())
	return iv
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func dfs(e, c, p int) {
	k := 1
	for to, idx := range edge[e] {
		if to == p {
			continue
		}
		if k == c {
			k++
		}
		ans[idx] = k
		k++
		dfs(to, ans[idx], e)
	}
}

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	n := readInt()
	ans = make([]int, n-1)
	edge = make(map[int]map[int]int)

	for i := 0; i < n-1; i++ {
		a, b := readInt(), readInt()
		if _, ok := edge[a]; !ok {
			edge[a] = make(map[int]int)
		}
		edge[a][b] = i
		if _, ok := edge[b]; !ok {
			edge[b] = make(map[int]int)
		}
		edge[b][a] = i
	}

	dfs(1, -1, -1)
	mx := 0
	for _, v := range ans {
		mx = max(mx, v)
	}

	var wr = bufio.NewWriter(os.Stdout)
	wr.WriteString(strconv.Itoa(mx) + "\n")
	for i, v := range ans {
		wr.WriteString(strconv.Itoa(v))
		if i != len(ans)-1 {
			wr.WriteString("\n")
		}
	}
	wr.Flush()
}


Measured memory_bytes: 44288
#include <bits/stdc++.h>
#define FAST_INPUT ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long

using namespace std;

void solve() {
    string s;
    cin >> s;
    ll sum=0;
    for (char c: s) {
        sum+=c-'0';
    }
    cout << (sum%9==0?"Yes":"No") << endl;
}

int main() {
    FAST_INPUT;

    solve();

    return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  vector<int> vec(N);
  for(int i = 0; i < N; i++){
    cin >> vec.at(i);
  }
  
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  
	int count = 1;
      for(int j = 0; j < N - 1; j++){
        if(vec.at(j) != vec.at(j + 1)){
          count++;
        }
      }
  cout << count << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<int,vector<ll> > P;
typedef pair<P,ll>Q;
 
ll sum[200010];
ll sx[200010];
 
int main(void){
    int n;
    cin>>n;
    vector<ll>a(n);
    sum[0]=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum[i+1]=sum[i]+a[i];
        sx[i+1] = sx[i]^a[i];
    }
    
    ll s1=0;
    ll s2 =0;;
    ll right = 0;
    ll ans = 0;
    for(ll left = 0;left<n;left++){
        while(right < n && (s1 +a[right]) == (s2^a[right])){
            s1+=a[right];
            s2^=a[right];
            right++;
        }
        //cout<<left<<" "<<right<<endl;
        ans+=right-left;
        //if(right!=n)ans++;
        if(right == left) ++right;
        else{
            s1-=a[left];
            s2^=a[left];
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4992
package main

import "fmt"

func calc(N int, am map[int]struct{}) int64 {
	dp := make([]int64, N+1)
	dp[0] = 1
	if _, ok := am[1]; !ok {
		dp[1] = 1
	}

	for i := 2; i <= N; i++ {
		oneBefore, twoBefore := dp[i-1], dp[i-2]
		if oneBefore == 0 && twoBefore == 0 {
			break
		}

		if _, ok := am[i]; ok {
			dp[i] = 0
		} else {
			dp[i] = (oneBefore + twoBefore) % 1000000007
		}
	}

	return dp[N]
}

func main() {
	var N, M int
	fmt.Scanf("%d %d", &N, &M)
	am := map[int]struct{}{}
	for i := 1; i <= M; i++ {
		var a int
		fmt.Scan(&a)
		am[a] = struct{}{}
	}
	fmt.Println(calc(N, am) % 1000000007)
}


Measured memory_bytes: 5504
#include<stdio.h>

int main(){
int i,a,b,d;
int c[3];
scanf("%d",&a);
scanf("%d",&b);
c[0]=a+b;
c[1]=a-b;
c[2]=a*b;

d=c[0];
for(i=0;i<3;i++){
  if(c[i]>=d){
     d=c[i];
}
}

printf("%d",d);

return 0;
}

Measured memory_bytes: 128
import java.io.*;
import java.util.*;
import java.lang.*;
public class Main {
	PrintWriter out;
    StringTokenizer st;
    BufferedReader br;
 	
 	class Pair implements Comparable<Pair>
	{
	    int f;
	    int s;
 
	    Pair(int t, int r) {
	       f = t;
	       s = r;
	    }
	    public int compareTo(Pair p)
	    {
	    	if(this.f!=p.f)
	    		return this.f-p.f;
 
	    	return this.s-p.s;
	    }
 	}
 // 	class Sort implements Comparator<String> 
	// { 
	//     public int compare(String a, String b) 
	//     { 
	//     	return (a+b).compareTo(b+a);
	//     } 
	// }
 
	String ns() {
        while (st == null || !st.hasMoreElements()) {
 
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }
 
    String nextLine() throws Exception {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            throw new Exception(e.toString());
        }
        return str;
    }
 
    int nextInt() {
        return Integer.parseInt(ns());
    }
 
    long nextLong() {
        return Long.parseLong(ns());
    }
 
    double nextDouble() {
        return Double.parseDouble(ns());
    }
	
	int upperBound(long a[],long key)
	{
		int l=0,r=a.length-1;
		int i=-1;
 
		while(l<=r)
		{
			int mid=(l+r)/2;
 
			if(a[mid]<key)
				l=mid+1;
 
			else{
				i=mid;	
				r=mid-1;
			}
			
		}
		return i;
	}
	int lowerBound(Pair[] a , long key)
	{
		int l = 0, r = a.length- 1;
		int i = -1;
 	
		while(l<=r)
		{
			int mid=(l+r)/2;
 
			if(a[mid].f<key)
			{
				i=mid;
				l=mid+1;	
			}
 
			else
				r=mid-1;
			
		}
		return i;
	}
 
	long power(long x,long y)
	{
	    long ans=1;
	    
	    while(y!=0)
	    {
	        if(y%2==1) ans=(ans*x)%mod;
	        x=(x*x)%mod;
	        y/=2;
	    }
	    return ans%mod;
	}
	
 
	int mod= 1000000007;
	long gcd(long x ,long y)
	{
		if(y==0)
			return x;
		return gcd(y,x%y);
	}
 
	// ArrayList a[];
	// int vis[],cnt=0;
	// void dfs(int ver)
	// {
	// 	ArrayList<Integer> l=a[ver];
	// 	if(l.size()==1)
	// 		cnt++;
	// 	for(int v:l)
	// 	{
	// 		if(vis[v]==0){
	// 			vis[v]=vis[ver]+1;
	// 			dfs(v);
	// 		}
	// 	}
	// }
 
 	int countSetBits(long n) 
    { 
        int count = 0; 
        while (n > 0) { 
            n &= (n - 1); 
            count++; 
        } 
        return count; 
    }

	void solve() throws IOException{
		int n = nextInt();
		out.println(n + n * n + n * n * n);
	}
 
 
	
    void run() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        long s = System.currentTimeMillis();
		solve();
		out.flush();
 
		out.close();
	}
 
	public static void main(String args[]) throws IOException {
		new Main().run();
	}
  
}


Measured memory_bytes: 32608
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define endl '\n'
int main()
{
    int a,b;
    cin>>a>>b;
    a>=13?cout<<b<<endl:a>=6 && a<=12?cout<<b/2<<endl:cout<<0<<endl;
    return 0;
}   

Measured memory_bytes: 256
#!/usr/bin/env python3

import sys
import pprint

sys.setrecursionlimit(10 ** 6)

class Logger:
	def __init__(self, debug):
		self.debug = debug
	def print(self, *args):
		if self.debug:
			pprint.pprint(args)


def main():
	log = Logger(0)
	n, m = map(int, sys.stdin.readline().split())
	h = list(map(int, sys.stdin.readline().split()))
	graph = [[] for i in range(n)]
	for i in range(m):
		ai, bi = map(int, sys.stdin.readline().split())
		graph[ai-1].append(bi-1)
		graph[bi-1].append(ai-1)
	log.print(graph)
	cnt = 0
	for i in range(n):
		good = True
		for j in range(len(graph[i])):
			log.print(i, graph[i][j])
			if h[i] <= h[graph[i][j]]:
				good = False
		if good:
			cnt += 1
	print(cnt)

	


main()

Measured memory_bytes: 31052
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<iostream>
#include<map>
#define ll long long
using namespace std;
int n;
ll ans;
struct Node
{
    int a[4];
    Node(){}
    Node(int x,int y,int z,int w)
    {
        a[0]=x,a[1]=y,a[2]=z,a[3]=w;
    }
    bool operator < (const Node &ags) const
    {
        if(a[0]!=ags.a[0])
            return a[0]<ags.a[0];
        if(a[1]!=ags.a[1])
            return a[1]<ags.a[1];
        if(a[2]!=ags.a[2])
            return a[2]<ags.a[2];
        return a[3]<ags.a[3];
    }
    bool operator == (const Node &ags) const
    {
        for(int i=0;i<4;i++)
            if(a[i]!=ags.a[i])
                return false;
        return true;
    }
}t[100010];
map<Node,ll >mp;
void AddNode(int s1,int s2,int s3,int s4)
{
    mp[Node(s1,s2,s3,s4)]++;
}
ll judge(Node x,Node y)
{
    ll res=0;
    if(x==y) //1
        res++;

    int temp=y.a[0];
    for(int i=0;i<3;i++)
        y.a[i]=y.a[i+1];
    y.a[3]=temp;
    if(x==y) //2
        res++;

    temp=y.a[0];
    for(int i=0;i<3;i++)
        y.a[i]=y.a[i+1];
    y.a[3]=temp;
    if(x==y) //3
        res++;

    temp=y.a[0];
    for(int i=0;i<3;i++)
        y.a[i]=y.a[i+1];
    y.a[3]=temp;
    if(x==y) //4
        res++;
    return res;
}
void jisuan(int b1,int b2,int b3,int b4,int b5,int b6,int b7,int b8)
{
    Node x1=Node(b1,b2,b6,b5);
    Node x2=Node(b2,b3,b7,b6);
    Node x3=Node(b3,b4,b8,b7);
    Node x4=Node(b4,b1,b5,b8);
    Node sp1=Node(b4,b3,b2,b1);
    Node sp2=Node(b5,b6,b7,b8);
    ll res1=mp[x1];
    ll res2=mp[x2];
    ll res3=mp[x3];
    ll res4=mp[x4];

    res1=res1-judge(sp1,x1)-judge(sp2,x1);
    res2=res2-judge(sp1,x2)-judge(sp2,x2)-judge(x1,x2);
    res3=res3-judge(sp1,x3)-judge(sp2,x3)-judge(x1,x3)-judge(x2,x3);
    res4=res4-judge(sp1,x4)-judge(sp2,x4)-judge(x1,x4)-judge(x2,x4)-judge(x3,x4);

    ans+=res1*res2*res3*res4;
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<4;j++)
            scanf("%d",&t[i].a[j]);

        AddNode(t[i].a[3],t[i].a[2],t[i].a[1],t[i].a[0]);
        AddNode(t[i].a[2],t[i].a[1],t[i].a[0],t[i].a[3]);
        AddNode(t[i].a[1],t[i].a[0],t[i].a[3],t[i].a[2]);
        AddNode(t[i].a[0],t[i].a[3],t[i].a[2],t[i].a[1]);
    }
    ans=0;
    for(int i=1;i<=n;i++)
        for(int j=i+1;j<=n;j++)
        {
            jisuan(t[i].a[0],t[i].a[1],t[i].a[2],t[i].a[3], t[j].a[3],t[j].a[2],t[j].a[1],t[j].a[0]);
            jisuan(t[i].a[0],t[i].a[1],t[i].a[2],t[i].a[3], t[j].a[2],t[j].a[1],t[j].a[0],t[j].a[3]);
            jisuan(t[i].a[0],t[i].a[1],t[i].a[2],t[i].a[3], t[j].a[1],t[j].a[0],t[j].a[3],t[j].a[2]);
            jisuan(t[i].a[0],t[i].a[1],t[i].a[2],t[i].a[3], t[j].a[0],t[j].a[3],t[j].a[2],t[j].a[1]);
        }
    printf("%lld",ans/3ll);
}


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
    return string(1, val);
}
int char_to_int(char val) {
    return val - '0';
}

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

    if(char_to_int(s[0]) + char_to_int(s[1]) + char_to_int(s[2]) + char_to_int(s[3]) == 7 ) {
        cout << s[0] << '+' << s[1] << '+' << s[2] << '+' << s[3] << "=7" << endl;
    } else if(char_to_int(s[0]) + char_to_int(s[1]) + char_to_int(s[2]) - char_to_int(s[3]) == 7 ) {
        cout << s[0] <<  '+' <<  s[1] <<  '+' <<  s[2] <<  '-' <<  s[3] <<  "=7" << endl;
    } else if(char_to_int(s[0]) + char_to_int(s[1]) - char_to_int(s[2]) + char_to_int(s[3]) == 7 ) {
        cout << s[0] <<  '+' <<  s[1] <<  '-' <<  s[2] <<  '+' <<  s[3] <<  "=7" << endl;
    } else if(char_to_int(s[0]) + char_to_int(s[1]) - char_to_int(s[2]) - char_to_int(s[3]) == 7 ) {
        cout << s[0] <<  '+' <<  s[1] <<  '-' <<  s[2] <<  '-' <<  s[3] <<  "=7" << endl;
    } else if(char_to_int(s[0]) - char_to_int(s[1]) + char_to_int(s[2]) + char_to_int(s[3]) == 7 ) {
        cout << s[0] <<  '-' <<  s[1] <<  '+' <<  s[2] <<  '+' <<  s[3] <<  "=7" << endl;
    } else if(char_to_int(s[0]) - char_to_int(s[1]) + char_to_int(s[2]) - char_to_int(s[3]) == 7 ) {
        cout << s[0] <<  '-' <<  s[1] <<  '+' <<  s[2] <<  '-' <<  s[3] <<  "=7" << endl;
    } else if(char_to_int(s[0]) - char_to_int(s[1]) - char_to_int(s[2]) + char_to_int(s[3]) == 7 ) {
        cout << s[0] <<  '-' <<  s[1] <<  '-' <<  s[2] <<  '+' <<  s[3] <<  "=7" << endl;
    } else if(char_to_int(s[0]) - char_to_int(s[1]) - char_to_int(s[2]) - char_to_int(s[3]) == 7 ) {
        cout << s[0] <<  '-' <<  s[1] <<  '-' <<  s[2] <<  '-' <<  s[3] <<  "=7" << endl;
    }
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String[] s = S.split("");
        String  ans = "No";
        for(int i=0; i<3; i++) {
            for(int j=0; j<3; j++) {
                for(int k=0; k<3; k++) {
                    if(s[i].equals("a") && s[j].equals("b") && s[k].equals("c")) ans = "Yes";
                }
            }
        }
        System.out.println(ans);
    } 
}

Measured memory_bytes: 22740
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main(){
    int N;
    cin>>N;
    vector <int>a(N);
    for(int i=0 ; i<N ; i++){
        cin>>a[i];
    }
	
	int max=0;
	int ans=0;
	sort(a.begin(),a.end());
	vector <int>b(2+a[N-1]);
	for(int i=0 ; i<N ; i++){
		b[1+a[i]]+=1;
		b[1+a[i]-1]+=1;
		b[1+a[i]+1]+=1;
	}
    for(int i=0 ; i<1+a[N-1] ; i++){
    	//cout<<b[i]<<endl;
    	if(b[i]>max){
    		max=b[i];
    		//ans=i-1;
    	}
    }
	cout<<max<<endl;
    return 0;
}


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

using namespace std;

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

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n; cin >> n;
    vector<ll> v(n); cin >> v;
    map<ll, ll> m;
    rep(i, n) m[v[i]]++;
    vector<ll> x;
    each(p, m) {
        rep(i, p.second/2) x.pb(p.first);
    }
    sort(all(x), greater<ll>());
    ll ans = 0;
    if (x.size() >= 2) chmax(ans, x[0]*x[1]);
    cout << ans << endl;
}


Measured memory_bytes: 7296
import Control.Monad
import Data.List
main=print.last.foldl' f[1,0,0,0]=<<getLine
f [x,a,b,c] s=[g 0 x '.' s,g x a 'A' s,g a b 'B' s,g b c 'C' s]
g u v c s
 |s=='?'=(v*3+u)`mod`1000000007
 |s==c=(v+u)`mod`1000000007
 |True=v


Measured memory_bytes: 32508
#include<iostream>
using namespace std;
int main(){
	long long a_qishi,b_jezhi,s_shu,sum=0;
	cin>>a_qishi>>b_jezhi;
	s_shu=a_qishi;
	while(s_shu<=b_jezhi){
		s_shu*=2;
		sum+=1;
	}
	cout<<sum;
}

Measured memory_bytes: 256
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))
A3 = list(map(int,input().split()))
N = int(input())
B = []
for i in range(N):
    b = int(input())
    B.append(b)

for i in B:
    for j in range(3):
        if i == A1[j]:
            A1[j] = 0
        elif i == A2[j]:
            A2[j] = 0
        elif i == A3[j]:
            A3[j] = 0
        
if A1 == [0,0,0] or A2 == [0,0,0] or A3 == [0,0,0]:
    print("Yes")
elif A1[0] == 0 and A2[1] == 0 and A3[2] == 0:
    print("Yes")
elif A1[2] == 0 and A2[1] == 0 and A3[0] == 0:
     print("Yes")
elif A1[0] == 0 and A2[0] == 0 and A3[0] == 0:
    print("Yes")
elif A1[1] == 0 and A2[1] == 0 and A3[1] == 0:
    print("Yes")
elif A1[2] == 0 and A2[2] == 0 and A3[2] == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string.h>
using namespace std;
#define endl '\n'
#define pi pair<int, int>

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	string s, t;
	cin >> s >> t;
	
	cout << (t + s) << endl;

	return 0;
}

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

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

#define MOD 1000000007

ll calc(ll x) {
    ll y = 0;
    for(ll i = x - x % 4;i <= x;i++) y ^= i;
    return y;
}

int main(void) {
    ll A, B;
    cin >> A >> B;
    cout << (calc(B) ^ calc(A - 1)) << endl;
    return 0;
}


Measured memory_bytes: 256