akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#define Endl endl
#define mp make_pair
#define rep(N) for(int i=0;i<N;i++)
#define repj(N) for(int j=0;j<N;j++)
#define ll long long 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define For(I,N) for(int I=0;I<N;I++)
#define cinone(N) int N;cin>>N;
#define scanfone(N) int N;cin>>N;
#define cinng(N,M) int N[M];for(int yiuytvnm=0;yiuytvnm<M;yiuytvnm++) cin>>N[yiuytvnm];
#define scanfng(N,M) int N[M];for(int qrwuoiq=0;qrwuoiq<M;qrwuoiq++) scanf("%d",&N[qrwuoiq]);
#define over(A) {cout<<A<<endl;exit(0);}
typedef unsigned long long ull;
const int inf=103974182;
using namespace std;
int n;
int a[200005];

int main()
{
//	freopen("input.txt","r",stdin);
	cin>>n;
	for(int i=0;i<n;i++)
	{
		scanf("%d",a+i);
	}
	if(a[0]!=0) over("-1");
	for(int i=1;i<n;i++)
	{
		if(a[i]>1 && a[i-1]==0) over("-1");
		if(a[i]>i) over("-1");
		if(a[i]>a[i-1]+1) over("-1");
	}
	ll res=0;
	ll now=0;
	for(int i=n-1;i>=0;i--)
	{
		now--;
		now=max(0LL,now);
		if(a[i]==0) continue;
		if(a[i]==now) continue;
		res+=a[i];
		now=a[i];
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 1152
N = int(input())
W = [str(input()) for _ in range(N)]
_list = []
cnt=0
for i in range(N-1):
    if W[i][-1]!=W[i+1][0] or W[i] in _list:
        print('No')
        cnt=1
        break
    else:
        _list.append(W[i])
if cnt==0 and W[N-1] in _list:
    print('No')
    cnt=1
if cnt==0:
    print('Yes')

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

int main(){
  int a, b, ans;
  cin >> a >> b;
  a--;
  ans = (b-1) / a;
  if((b-1) % a != 0) ans++;
  cout << ans << endl;
}

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

#define   ll    long long int

int main( )
{
    int n, m;
    int i, j, k, ara[111], c = 0, s = 0;
    double con, d;
    cin >> n >> m;
    con = (1.0) / (4.0 * m);
    for (i = 1; i <= n; i++) {
        cin >> ara[i];
        s += ara[i];
    }
    for (i = 1; i <= n; i++) {
        d = (ara[i] * 1.0) / (s * 1.0);
        if (d >= con) c++;
    }
    if (c >= m) {
        cout << "Yes\n";
    }
    else {
        cout << "No\n";
    }
    return 0;
}


Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
  input = input.split(" ");
  var a = parseInt(input[0], 10);
  var b = parseInt(input[1], 10);
  var c = b*2+1;
  var d = a / c;
  var e = a % c;
  
  console.log('%d', Math.floor(d) + (e==0? 0: 1));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
#include <algorithm>
#include <cmath>
#include <ctime>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#include <cstring>
#include <tuple>
using namespace std;
typedef long long ll;
int main() {
    int a, b;
    cin >> a >> b;
    cout << a * b << " " << 2 * (a + b) << endl;

    return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,n) for(int i = 0;i < (int)(n);i++)
#define RREP(i,n) for(int i = (int)n-1;i >= 0;i--)
#define FOR(i,s,n) for(int i = s;i < (int)n;i++)
#define RFOR(i,s,n) for(int i = (int)n-1;i >= s;i--)
#define ALL(a) a.begin(),a.end()
#define IN(a, x, b) (a<=x && x<b)
template<class T>inline bool CHMAX(T&a,T b){if(a<b){a = b;return true;}return false;}
template<class T>inline bool CHMIN(T&a,T b){if(a>b){a = b;return true;}return false;}
constexpr long long INF = 1e18;

template <typename T>
struct SegmentTree{
	using F = function<T(T,T)>;
	int n;
	F f;
	T ti;
	vector<T> dat;
	SegmentTree(){};
	SegmentTree(F f,T ti):f(f),ti(ti){}
	void init(int n_){
		n=1;
		while(n<n_) n<<=1;
		dat.assign(n<<1,ti);
	}
	void build(const vector<T> &v){
		int n_=v.size();
		init(n_);
		for(int i=0;i<n_;i++) dat[n+i]=v[i];
		for(int i=n-1;i;i--)
			dat[i]=f(dat[(i<<1)|0],dat[(i<<1)|1]);
	}
	void set_val(int k,T x){
		dat[k+=n]=x;
		while(k>>=1)
			dat[k]=f(dat[(k<<1)|0],dat[(k<<1)|1]);
	}
	T query(int a,int b){
		T vl=ti,vr=ti;
		for(int l=a+n,r=b+n;l<r;l>>=1,r>>=1) {
			if(l&1) vl=f(vl,dat[l++]);
			if(r&1) vr=f(dat[--r],vr);
		}
		return f(vl,vr);
	}
};


signed main(){
	int N,Q;
	cin>>N>>Q;
	auto seg = SegmentTree<int>([](int a,int b){return min(a,b);},(1ll<<31)-1);
	seg.build(vector<int>(N,(1ll<<31)-1));
	while(Q--){
		int t,x,y;
		cin>>t>>x>>y;
		if(t){
			cout<<seg.query(x,y+1)<<endl;
		}else{
			seg.set_val(x,y);
		}
	}
}


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

using namespace std;

#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long int
#define f(i,a,b) for(ll i=a;i<b;i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define en '\n'
int main()
{
IOS;
int t=1;
//cin>>t;
while(t--)
{
ll n,x;
  cin>>n>>x;
  ll a[n];
  f(i,0,n)
    cin>>a[i];
  sort(a,a+n);
  f(i,1,n)
    a[i]+=a[i-1];
  ll p=lower_bound(a,a+n,x)-a;
  if(p>=n)
    cout<<n-1;
  else if(a[p]>x)
    cout<<p;
  else if(a[p]==x)
    cout<<p+1;
}
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <queue>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ul;
typedef pair<int,int> P;
#define X first
#define Y second

const int mod = 998244353;

void go() {
	int n; cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	map<int,int> cnt;
	for(int x : a) cnt[x]++;
	int res = 0;
	for(auto item : cnt) {
		if(item.X <= item.Y) {
			res += item.Y - item.X;
		} else {
			res += item.Y;
		}
	}
	cout << res << endl;
}

int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	// int t; cin >> t; for(;t--;)
	go();
	return 0;
}




Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int n;
int s[100001];
int main(){
    cin>>n;
    rep(i,n) cin>>s[i];
    ll mx=0;
    FOR(c,1,n){
        int l=0,r=n-1;
        ll sum=0;
        rep(k,(n+c-1)/c){
            l+=c;r-=c;
            if(l>n-1||r<c||(r%c==0&&r<=l)) break;
            sum+=s[l]+s[r];
            mx=max(mx,sum);
        }
    }
    cout<<mx<<endl;
    return 0;
}


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

int main() {
  int N,A,B,i=0,j;
  cin >>N;
       
  cin >>A;
   for(A;A%2==0;A/=2){
      i++;
   }
   j=i;
   i=0;
   N--;
 
  for(N;N>0;N--){      
    cin >>A;
    
    for(A;A%2==0;A/=2){
      i++;
    }
    
    if(i<j) j=i;
    i=0;
  }
  
  cout <<j <<endl;
      
}

Measured memory_bytes: 256
object Main extends App {
	val Array(n, q) = scala.io.StdIn.readLine.split(" ").map(_.toInt)
	val s = scala.io.StdIn.readLine.toList.toArray

	val a = new Array[Int](n + 1)
	val b = new Array[Int](q)

	for(i<-0 until n - 1){
		if(s(i) == 'A' && s(i+1) == 'C'){
			a(i+1) = 1
		}
	}

	for(i<-1 to n){
		a(i) = a(i) + a(i-1)
	}

	for(i<-0 until q){
		val Array(l, r) = scala.io.StdIn.readLine.split(" ").map(_.toInt)

		b(i) = a(r-1) - a(l-1)
	}

	for(i<-0 until q){
		println(b(i))
	}

}

Measured memory_bytes: 60300
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define MOD 1000000007
#define PI 3.141592653589793


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

    int x = d * 2 + 1;
    cout << (n+x-1) / x << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
typedef long long ll;
int main(){
    ll n, k; cin >> n >> k;
    vector<ll> a(n),s(n+1);
    rep(i,n) {
        cin >> a[i];
        a[i]--;
    }
    rep(i,n) s[i+1] = (s[i] + a[i]) % k;

    ll ans = 0;
    map<ll, ll> dist;
    queue<ll> que;
    rep(i,n+1){
        ans += dist[s[i]];
        dist[s[i]]++;
        que.push(s[i]);
        if(que.size() == k){
            dist[que.front()]--;
            que.pop();
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 17536
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String s = in.next();
            int nt = 0;
            int ns = 0;
            for (int i = 0; i < s.length(); ++i) {
                char ch = s.charAt(i);
                if (ch == 'S') {
                    ++ns;
                } else {
                    if (ns > 0) {
                        --ns;
                    } else {
                        ++nt;
                    }
                }
            }
            out.println(nt + ns);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

    }
}



Measured memory_bytes: 12372
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int (i) = (a);(i) < (b);i++)
#define REP(i,n) FOR(i,0,n)
typedef long long ll;

int bikkuri(int x){
    if(x == 0)return 1;
    else return x *= bikkuri(x-1);
}

int main(){
    int n;
    cin >> n;
    vector<pair<double,double>> map(n,pair<double,double>());
    vector<vector<double>> path(n,vector<double>(n));
    REP(i,n){
        cin >> map[i].first >> map[i].second;
    }
    REP(i,n){
        REP(j,n){
            path[i][j] = sqrt((map[i].first - map[j].first)*(map[i].first - map[j].first) + (map[i].second - map[j].second)*(map[i].second - map[j].second));
        }
    }
    vector<int> v;
    REP(i,n) v.push_back(i);
    double sum = 0;
    do{
        REP(i,n-1){
            sum += path[v[i]][v[i+1]];
        }

    }while(next_permutation(v.begin(),v.end()));
    double ave = sum/bikkuri(n);
    cout << fixed << setprecision(8) << ave << endl;   
    //cin >> n;
}

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

int main() {
  int N, S = 0;
  cin >> N;
  vector<int> vec(N * 2);

  for (int i = 0; i < N * 2; i++) {
    cin >> vec.at(i);
  }
  
  sort(vec.begin(), vec.end());
  
  for (int i = 0; i < N; i++) {
    S += vec.at(i * 2);
  } 
  
  cout << S << endl;
}

Measured memory_bytes: 256
from itertools import groupby

def main():
    while True:
        h = int(input())
        w = 5
        if h == 0: break

        field = []
        
        for i in range(h):
            field.append(list(map(int,input().split())))

        score = 0
        while True:
            scoreinc = 0
            for i in range(h):
                c = 0
                for key, value in groupby(field[i]):
                    newlist = list(value)
                    if len(newlist) >= 3:
                        scoreinc += newlist[0] * len(newlist)
                        newlist = [0 for i in range(len(newlist))]
                        
                    if c == 0:
                        field[i] = newlist
                    else:
                        field[i] += newlist
                    c += 1


            if scoreinc == 0: break
            score += scoreinc

            for i in range(w):
                ydata = []
                for j in range(h):
                    ydata.append(field[j][i])
                    
                ydata = sorted(ydata, key = return0)
                
                for j in range(h):
                    field[j][i] = ydata[j]

        #print(field)
        print(score)

def return0(num):
    if num == 0: return 0
    else: return 1
main()



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

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

int h[100000];

int main(void) {
  int i,n,k,min;
  scanf("%d%d", &n, &k);
  for (i=0; i<n; i++)
    scanf("%d",h+i);
  qsort(h,n,sizeof(int),compar);
  min=h[n-1]-h[0];
  for (i=0; i<n-k+1; i++)
    if (h[i+k-1]-h[i] < min)
      min = h[i+k-1]-h[i];
  printf("%d\n",min);
  return 0;
}


Measured memory_bytes: 892
#include <stdio.h>
#include <string.h>

int main() {

    char s[200001];
    scanf("%s", s);
    int cnt = 0;
    int l = strlen(s);
    int sposi,eposi;
    int isACheck = 0;
    
    for (int i = 0; i < l; i++) {
        char c=s[i];
        if(c=='A' && isACheck==0){
            sposi= i;
            isACheck=1;
        }
        if(c=='Z'){
            eposi=i;
        }

    }
    printf("%d",eposi-sposi+1);


    return 0;
} 

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int x[n],y[n],z[n];
for(int i=0;i<n;i++){
cin>>x[i];
z[i]=x[i];
}
sort(x,x+n);
for(int i=0;i<n;i++){
if(z[i]==x[n-1])
cout<<x[n-2]<<endl;
else cout<<x[n-1]<<endl;
}
return 0;
}


Measured memory_bytes: 5140
#include <iostream>
    using namespace std;
    int main(void){
        int N, i, cnt=0, a[105];
        cin >> N;
        for(i=0; i<N; i++){
            cin >> a[i];
        }
        for(i=0; i<N; i++){
            if(a[i] == a[i+1]){
                a[i+1] = 100000;
                cnt ++;
            }
        }
        cout << cnt << endl;
    }

Measured memory_bytes: 256
#!/usr/bin/python3
import sys
input = lambda: sys.stdin.readline().strip()
h, w, k = [int(x) for x in input().split()]
s = [input() for _ in range(h)]

def add_pieces(pieces, column, ranges):
    global s
    for j in range(len(ranges)):
        L, R = ranges[j]
        pieces[j] += sum(1 for row in range(L, R) if s[row][column] == '1')

def get_ranges(mask):
    global h
    L = 0
    for i in range(h - 1):
        if mask & (1 << i):
            yield L, i + 1
            L = i + 1
    yield L, h

def cost(mask):
    global h, w, k
    ranges = list(get_ranges(mask))
    pieces = [0 for i in range(len(ranges))]
    ans = bin(mask).count('1')
    for column in range(w):
        add_pieces(pieces, column, ranges)
        if any(piece > k for piece in pieces):
            ans += 1
            pieces = [0 for i in range(len(ranges))]
            add_pieces(pieces, column, ranges)
            if any(piece > k for piece in pieces):
                return float('inf')
    return ans

print(min(cost(mask) for mask in range(1 << (h - 1))))


Measured memory_bytes: 75280
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;

alias Tuple!(int, "c1", int, "c2", int, "c3", int, "c4") Die;


Die normalize_die(int a, int b, int c, int d) {
    auto t1 = Die(a, b, c, d);
    auto t2 = Die(b, c, d, a);
    auto t3 = Die(c, d, a, b);
    auto t4 = Die(d, a, b, c);
    auto t5 = [t1, t2, t3, t4];
    t5.sort();
    return t5[0];
}

void main() {
    auto N = readln.chomp.to!int;
    long[Die] mem;
    auto dice = new Die[](N);

    foreach (i; 0..N) {
        auto s = readln.split.map!(to!int);
        auto d = normalize_die(s[0], s[1], s[2], s[3]);
        if (d in mem) mem[d] += 1;
        else mem[d] = 1;
        dice[i] = d;
    }

    long ans = 0;
    foreach (i; 0..N) {
        auto d1 = [dice[i].c1, dice[i].c2, dice[i].c3, dice[i].c4];
        foreach (j; i+1..N) {
            int c5 = dice[j][0];
            int c6 = dice[j][1];
            int c7 = dice[j][2];
            int c8 = dice[j][3];
            foreach (k; 0..4) {
                int c1 = d1[k];
                int c2 = d1[(k+1)%4];
                int c3 = d1[(k+2)%4];
                int c4 = d1[(k+3)%4];
                auto d = new Die[](4);
                d[0] = normalize_die(c8, c1, c4, c5);
                d[1] = normalize_die(c2, c7, c6, c3);
                d[2] = normalize_die(c8, c7, c2, c1);
                d[3] = normalize_die(c4, c3, c6, c5);
                auto a = new long[](4);
                bool no_such_die = false;
                foreach (l; 0..4) {
                    if (!(d[l] in mem)) {
                        no_such_die = true;
                        break;
                    }
                    a[l] = mem[d[l]];
                    if (d[l] == dice[i]) a[l] -= 1;
                    if (d[l] == dice[j]) a[l] -= 1;
                }

                if (no_such_die)
                    continue;
                //d.each!(writeln);
                //a.writeln;

                foreach (l; 0..4) {
                    foreach (m; l+1..4) {
                        if (d[l] == d[m]) a[m] -= 1;
                    }
                }
                //a.writeln;

                foreach (l; 0..4) {
                    if (d[l].c1 == d[l].c2 && d[l].c2 == d[l].c3 && d[l].c3 == d[l].c4)
                        a[l] *= 4;
                    else if (d[l].c1 == d[l].c3 && d[l].c2 == d[l].c4)
                        a[l] *= 2;
                    a[l] = max(0, a[l]);
                }

                ans += a[0] * a[1] * a[2] * a[3];
            }
        }
    }

    writeln(ans/3);
}


Measured memory_bytes: 1276
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vvi vector<vector<int>> 
#define vi vector<int> 
#define vpii vector<pair<int,int>> 
#define ff first
#define ss second

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    vi div;
    int a,b;
    cin >> a >> b;
    if(a < b)swap(a,b);
    div.push_back(1);
    for(int i = 2; i*i <= a; ++i)
    {
        if(a%i == 0)
        {
            div.push_back(i);
            while(a%i == 0)
            {
                a/=i;
            }
        }
    }
    int ans = 0;
    if(a > 1)
    {
        div.push_back(a);
    }
    for(auto x : div)
    {
        if(b%x == 0){
            ans++;
        }
    }
    cout << ans;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
l=[0]*n
for i in reversed(range(1,n+1)):
    x=0
    if n//i>1:
        for j in range(1,n//i):
            x+=l[(j+1)*i-1]
        if (x%2)==a[i-1]:
            l[i-1]=0
        else:
            l[i-1]=1
    else:
        l[i-1]=a[i-1]
m=l.count(1)
print(m)
for i in range(n):
    if l[i]==1:
        print(i+1)

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

// clang-format off
#define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(NULL)
#define forn(i, x, y) for(int i = x; i < y; i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using ll = long long;
// clang-format on

const long long INF = 1LL << 60;
const int MAX_V = 100001;

int main()
{
  IOS;

  ll N, W;
  cin >> N >> W;
  vector<ll> w(N), v(N);
  forn(i, 0, N) cin >> w[i] >> v[i];

  vector<ll> dp(MAX_V, INF);
  dp[0] = 0;

  for (int i = 0; i < N; i++)
  {
    for (int j = MAX_V - 1; j >= 0; j--)
    {
      if (j >= v[i])
        chmin(dp[j], w[i] + dp[j - v[i]]);
    }
  }

  ll res = 0;
  for (int j = 0; j < MAX_V; j++)
  {
    if (dp[j] <= W)
      res = j;
  }
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 3984
#include<bits/stdc++.h>
using namespace std;
int D[35][35], col[510][510], counter[3][35];
int N, C;
int main() {
	cin >> N >> C;
	for (int i = 1; i <= C; i++) {
		for (int j = 1; j <= C; j++) {
			cin >> D[i][j];
		}
	}
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			cin >> col[i][j];
		}
	}
	for (int i = 1; i <= N; i++){
		for (int j = 1; j <= N; j++) {
			if ((i + j) % 3 == 0) counter[0][col[i][j]]++;
			if ((i + j) % 3 == 1) counter[1][col[i][j]]++;
			if ((i + j) % 3 == 2) counter[2][col[i][j]]++;
		}
	}
	long long score = 1e9;
	for (int i = 1; i <= C; i++) {
		for (int j = 1; j <= C; j++) {
			if (i == j) continue;
			for (int k = 1; k <= C; k++) {
				if (k == i || k == j) continue;
				long long temp = 0;
				for (int s = 1; s <= C; s++) temp += counter[0][s] * D[s][i];
				for (int s = 1; s <= C; s++) temp += counter[1][s] * D[s][j];
				for (int s = 1; s <= C; s++) temp += counter[2][s] * D[s][k];
				if (score > temp) score = temp;
			}
		}
	}
	cout << score << endl;
}

Measured memory_bytes: 1280
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
static const int MAX = 101;
int M[MAX][MAX], P[MAX];

int main()
{
    int n, r, c;
    cin >> n;
    for (int i = 1; i <= n; ++i)
    {
        cin >> r >> c;
        P[i-1] = r;
        P[i] = c;
    }
    for (int i = 0; i <= MAX; ++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] = (1 << 20);
            for (int k = i; k <= j - 1; ++k)
            {
                M[i][j] = min(M[i][j], M[i][k] + M[k+1][j] + P[i-1] * P[k] * P[j]);
            }
        }
    }
    cout << M[1][n] << endl;
    return 0;
}


Measured memory_bytes: 3148
#include<iostream>
long n,k,a,i,j,m=1e9+7,v[2<<20];main(){for(std::cin>>n>>k;i++<n;)for(j=0;j++<n;){i-1||std::cin>>v[j];if(v[i]>v[j])(a+=k*(k-1)/2+(i<j?k:0))%=m;}std::cout<<a;}

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

using namespace std;

int main() {

	int n,ww;
	cin >> n >> ww;
	vector<int> v(n + 1);
	vector<int> w(n + 1);
	for (int i = 1; i <= n; i++) {
		cin >> v[i] >> w[i];
	}

	vector<vector<int>> dp(n + 1, vector<int>(ww+1, 0));

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

		for (int j = 1; j <=ww ; j++) {

			if (j - w[i] >= 0) {
				dp[i][j] = max(dp[i - 1][j - w[i]] + v[i], dp[i - 1][j]);
			}
			else {
				dp[i][j] = dp[i - 1][j];
			}
		}
	}

	cout << dp[n][ww] << endl;
	return 0;

}


Measured memory_bytes: 6836
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <random>
#include <chrono>
 
using namespace std;
using namespace __gnu_pbds;
 
#define endl '\n'
 
typedef long long ll;
typedef pair<int, int> pii;
typedef tree<int, null_type,less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
template<typename T>
static T randint(T lo, T hi){
	return uniform_int_distribution<T>(lo, hi)(rng);
}


int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
 
	// freopen("settling.in", "r", stdin);
	// freopen("settling.out", "w", stdout);

	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	ll ans = max(max(a * c, b * d), max(a * d, b * c));
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define int long long
#define gcd            __gcd
#define setbits(x)     __builtin_popcountll(x)
#define zrobits(x)     __builtin_ctzll(x)
#define mod            1000000007
#define mod2           998244353
#define maxe           *max_element
#define mine           *min_element
#define inf            1e18
#define deci(x,y)      fixed<<setprecision(y)<<x
#define w(t)           int t; cin>>t; while(t--)
#define nitin          ios_base::sync_with_stdio(false); cin.tie(NULL)
#define PI             3.141592653589793238
using namespace std;

int power(int x, int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
int modi(int a, int m)
{
    return power(a, m - 2, m);
}
int32_t main()
{
    nitin;
    string s;
    cin>>s;
    int cnt=0;
    int ans=0;
    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='R')
            cnt++;
        else
        {
            ans=max(ans,cnt);
            cnt=0;
        }
    }
    ans=max(ans,cnt);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3632
#define ONLINE_JUDGE
#include <algorithm>
#include <fstream>
#include <iostream>
#include <vector>
#include <cmath>
#include <iterator>
#include <map>
#include <set>
#ifndef ONLINE_JUDGE
#include <prettyprint/prettyprint.hpp>
#endif

#define FOR(i, n) for(int i = 0; i < n; ++i)
#define TEST int T; std::cin >> T; while(T--)
#define ALL(v) v.begin(), v.end()

using ll = long long;
using ull = unsigned long long;
using vi = std::vector<int>;
using vll = std::vector<ll>;
using vull = std::vector<ull>;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;

using namespace std;

vector<int> graph[100000];
vector<bool> visited;
const int mod = 1e9 + 7;

void add_self(int& a, int b) {
	a += b;
	if(a >= mod) a -= mod;
}

void mul_self(int& a, int b) {
	a = ((ull)a * b) % mod;
}

pii dfs(int u) {
	pii ans = {1, 1};
	visited[u] = true;
	bool leaf = true;
	for(auto v : graph[u]) {
		if(!visited[v]) {
			leaf = false;
			auto sub = dfs(v);
			mul_self(ans.first, sub.second);
			mul_self(ans.second, (sub.first + sub.second) % mod);
		}
	}
	return ans;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
#ifndef ONLINE_JUDGE
	ifstream fin("in.txt");
	ofstream fout("out.txt");
	auto cinbuf = cin.rdbuf(fin.rdbuf());    // save and redirect
	auto coutbuf = cout.rdbuf(fout.rdbuf()); // save and redirect
#endif	
	int n;
	cin >> n;
	for (int i = 0; i < n - 1; ++i) {
		int u, v;
		cin >> u >> v;
		graph[u - 1].push_back(v - 1);
		graph[v - 1].push_back(u - 1);
	}
	visited.assign(n, false);
	auto ans = dfs(0);
	add_self(ans.first, ans.second);
	cout << ans.first << endl;
#ifndef ONLINE_JUDGE
	cin.rdbuf(cinbuf);    // restore
	cout.rdbuf(coutbuf); // restore
#endif	
}


Measured memory_bytes: 9984
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
      	int b = sc.nextInt();
      	int c = sc.nextInt();
		boolean result = true;
      
      if (a == b && a == c) {
        result = false; // すべて同じ
      } else if (a == b && a != c) {
        result = true; // cだけ違う
      } else if (a != b && b == c) {
        result = true; // aだけ違う
      } else if (a != b && b != c && a != c) {
        result = false; // abcすべて違う
      } else if (a == c && a != b) {
        result = true; // bだけ違う
      }
		System.out.println(result? "Yes": "No");
	}
}

Measured memory_bytes: 23636
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <algorithm>
#include <string>
#include <iostream>
#include <complex>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <stack>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <random>
#include <set>
#include <vector>
#include <unordered_map>
#include <bitset>
#include <unordered_set>
#include <array>
#include <forward_list>
#include <chrono>
#include <iomanip>
#include <utility>
#include <cassert>

#pragma GCC optimize("Ofast")
#pragma target("sse", "sse1")

#define mp make_pair
#define pb push_back

using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

mt19937 gen(34);

string s;

int main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#else
	//freopen("memory.in", "r", stdin);
	//freopen("memory.out", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> s;
	if (s == "Sunny")
		cout << "Cloudy";
	if (s == "Cloudy")
		cout << "Rainy";
	if (s == "Rainy")
		cout << "Sunny";

	return 0;
}

Measured memory_bytes: 256
s, t = [input() for _ in range(2)]

dp = [[0 for _ in range(len(t) + 1)] for _ in range(len(s) + 1)]
for i, si in enumerate(s):
    for j, tj in enumerate(t):
        if si == tj:
            dp[i + 1][j + 1] = 1 + dp[i][j]
        else:
            dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j])

ans = ""
x, y = len(s), len(t)
while x > 0 and y > 0:
    if dp[x][y] == dp[x - 1][y]:
        x -= 1
    elif dp[x][y] == dp[x][y - 1]:
        y -= 1
    else:
        x -= 1
        y -= 1
        ans += s[x]

print(ans[::-1])

Measured memory_bytes: 119900
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <sys/time.h>
#include <random>


#define fs first
#define sc second

using namespace std;

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

ll dp[310][310][310];
ll h[310];
ll INF = LONG_LONG_MAX / 500;
int main(){
    int N, K;
    cin >> N >> K;
    h[0] = 0;
    for(int i = 0; i < N; i++){
        cin >> h[i+1];
    }
    for(int i = 0; i < 310; i++){
        for(int j = 0; j < 310; j++){
            for(int k = 0; k < 310; k++) {
                dp[i][j][k] = INF;
            }
        }
    }
    for(int j = 0; j < 310; j++){
        dp[0][j][0] = 0;

    }
    for(int i = 0; i < N; i++){
        for(int j = 0; j <= K; j++){
            for(int k = 0; k <= i; k++){
                // 値を変更する
                dp[i+1][j+1][k] = min(dp[i+1][j+1][k], dp[i][j][k]);
                // 値を変更しない
                dp[i+1][j][i+1] = min(dp[i+1][j][i+1], dp[i][j][k] + max(0LL, h[i+1] - h[k]));
            }
        }
    }

    ll res = INF;
    for(int j = 0; j <= K; j++){
        for(int k = 0; k <= N; k++){
            res = min(dp[N][j][k], res);
        }
    }

    cout << res << endl;



    return 0;
}




Measured memory_bytes: 232960
#include<bits/stdc++.h>
using namespace std;
int dp[110000][3];
int main(){
  int n;
  cin>>n;
  int a[n],b[n],c[n];

  for(int i=0; i<n; i++) cin>>a[i]>>b[i]>>c[i];
  for(int i=0; i<n; i++){
    for(int j=0; j<3; j++){
      if(i==0){
        if(j==0) dp[i][j]=a[i];
        else if(j==1) dp[i][j]=b[i];
        else if(j==2) dp[i][j]=c[i];
      }
      else{
        for(int k=0; k<3; k++){
          if(j==k) continue;
          if(j==0) dp[i][j]=max(dp[i][j],dp[i-1][k]+a[i]);
          else if(j==1) dp[i][j]=max(dp[i][j],dp[i-1][k]+b[i]);
          else if(j==2) dp[i][j]=max(dp[i][j],dp[i-1][k]+c[i]);
        }
      }
    }
  }

  int ret=0;
  ret = max(dp[n-1][0],dp[n-1][1]);
  ret = max(ret, dp[n-1][2]);
  cout<<ret;

}


Measured memory_bytes: 2560
x, y = list(map(int, input().split()))
if x < y:
    if x < 0 and y > 0:
        res = abs(abs(x) - y) + 1
    else:
        res = y - x
else:
    res = abs(abs(x) - abs(y)) + 1 + int((x < 0 and y < 0) or (x > 0 and y > 0))
print(res)


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


int main(){
    int n,x;
    cin>>n>>x;
    int count=1;
    int d[n]={0};
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        d[i]+=a;
        if(d[i]<=x)
        count++;
        d[i+1]=d[i];
    }
    cout<<count;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
 
using namespace std;
int main()
{
	
	for (int i = 1;;i++)
	{
		int x;
		cin>>x;
		if (x == 0)
			break;
		else
			cout<<"Case "<<i<< ": "<<x<<endl;
	}
    return 0;
}

Measured memory_bytes: 3012
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

N = input()
b = map(int, raw_input().split())
ans = []
for _ in range(N):
    pos = -1
    for i in range(len(b)):
        if b[i] == i + 1:
            pos = i
    if pos < 0:
        print -1
        exit()
    ans += [b[pos]]
    b = b[:pos] + b[pos + 1:]
for p in ans[::-1]:
    print p

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

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> vt(N);
    rep(i, N) cin >> vt.at(i);
    sort(vt.begin(), vt.end());
    reverse(vt.begin(), vt.end());
    if(N <= K) {
        cout << 0 << endl;
        return 0;
    }
    ll count = 0;
    for(int i = K; i < N; ++i) {
        count += vt.at(i);
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<utility>
#include<vector>
#include<set>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;
typedef pair<int,int> pii;

int main(){
	int n,m,p,k;
	while(cin>>n,n){
		vector<vector<int> > vec;
		vector<int> data;
		rep(i,n){
			data.clear();
			cin>>m;
			rep(j,m){cin>>p;data.push_back(--p);}
			vec.push_back(data);
		}
		data.clear();
		cin>>k;
		int who[n];
		rep(i,n)who[i]=0;
		rep(i,k){
			cin>>m;
			rep(j,vec.size()){
				rep(l,vec[j].size()){
					if(vec[j][l]==m-1){
						who[j]++;
						break;
					}
				}
			}
		}
		int ans,check=0;
		rep(i,n){
			if(who[i]==k){
				ans=i+1;
				check++;
			}
		}
		if(check==1)cout<<ans<<endl;
		else cout<<-1<<endl;
	}
	return 0;
}

Measured memory_bytes: 1268
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	ll n,t; cin>>n>>t;
	ll ans=0;
	ll memo; cin>>memo;
	rep(i,0,n-1){
		ll a; cin>>a;
		ll cnt=a-memo;
		if(cnt>t) cnt=t;
		ans+=cnt;
		memo=a;
	}
	cout<<ans+t;
	
	return 0;
}

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

using namespace std;

int main() {

	int x1,x2,y1,y2;
	cin >> x1 >> y1 >> x2 >> y2;

	int dx = abs(x2 - x1);
	int dy = abs(y2 - y1);

	if (x2 - x1 >= 0 && y2 - y1 >= 0) {
		cout << x2 - dy << " " << y2 + dx << " " << x1 - dy << " " << y1 + dx << endl;
	}
	if (x2 - x1 >= 0 && y2 - y1 < 0) {
		cout << x2 + dy << " " << y2 + dx << " " << x1 + dy << " " << y1 + dx << endl;
	}
	if (x2 - x1 < 0 && y2 - y1 >= 0) {
		cout << x2 - dy << " " << y2 - dx << " " << x1 - dy << " " << y1 - dx << endl;
	}
	if (x2 - x1 < 0 && y2 - y1 < 0) {
		cout << x2 + dy << " " << y2 - dx << " " << x1 + dy << " " << y1 - dx << endl;
	}


}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] a=new int[n];
        for(int i=0;i<n;i++) a[i]=sc.nextInt()-1;
        sc.close();
        int now=0;
        int step=0;
        while(true){
            if(now==1){
                System.out.println(step);
                break;
            }
            else if(step>n){
                System.out.println(-1);
                break;
            }
            else{
                now=a[now];
            }
            step++;
        }
    }
    
}

Measured memory_bytes: 52200
#include<bits/stdc++.h>
using namespace std;
const int m=1e9+7;
vector<int> v;
int p[7]={1,10,100,1000,10000,100000,1000000};
int a[100001][13],r;
int main()
{
	string s;
	cin>>s;
	for (int i=0;i<s.size();i++)
	{
		if (s[i]=='?') v.push_back(s.size()-i-1);
		else 
		{
			r=(r+(s[i]-'0')*p[(s.size()-i-1)%6])%13;
		}
	}
	r=(18-r)%13;
	a[0][0]=1;
	for (int i=0;i<v.size();i++)
	{
		for (int j=0;j<13;j++)
		    for (int k=0;k<10;k++)
		    {
		    	a[i+1][(j+k*p[v[i]%6])%13]+=a[i][j];
		    	a[i+1][(j+k*p[v[i]%6])%13]%=m;
		    }
	}
	cout<<a[v.size()][r]<<endl;
	return 0;
}



Measured memory_bytes: 6008
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.*;
import java.util.*;
import java.util.Map.Entry;

public class Main {

	public static void main(String[] args) throws IOException {
		FastReader in = new FastReader(System.in);
		PrintWriter out = new PrintWriter(System.out);

		int n = in.nextInt();
		int t = in.nextInt();
		Pair[] a = new Pair[n];
		for (int i = 0; i < n; i++) {
			int x = in.nextInt();
			int y = in.nextInt();
			a[i] = new Pair();
			a[i].a = x;
			a[i].b = y;
		}
		Arrays.sort(a);
		boolean flag = false;
		for (int i = 0; i < a.length; i++) {
			if (a[i].b <= t) {
				out.println(a[i].a);
				flag = true;
				break;
			}
		}
		if (!flag) {
			out.println("TLE");
		}
		out.flush();
		out.close();

	}

	static class Pair implements Comparable<Pair> {
		int a;
		int b;

		public Pair() {
			// TODO Auto-generated constructor stub
			this.a = a;
			this.b = b;
		}

		@Override
		public int compareTo(Pair o) {
			// TODO Auto-generated method stub
			return this.a - o.a;
		}

	}

	static class FastReader {
		StringTokenizer st;
		BufferedReader br;

		public FastReader(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public FastReader(FileReader fileReader) {
			br = new BufferedReader(fileReader);
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

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

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

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

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}

}

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

int main()
{
    string Sa, Sb, Sc;
    cin >> Sa >> Sb >> Sc;

    char player = 'a';
    while (true)
    {
        char next;
        switch (player)
        {
        case 'a':
            if (Sa.empty())
            {
                cout << "A" << endl;
                return 0;
            }
            next = Sa[0];
            Sa.erase(Sa.begin());
            break;
        case 'b':
            if (Sb.empty())
            {
                cout << "B" << endl;
                return 0;
            }
            next = Sb[0];
            Sb.erase(Sb.begin());
            break;
        case 'c':
            if (Sc.empty())
            {
                cout << "C" << endl;
                return 0;
            }
            next = Sc[0];
            Sc.erase(Sc.begin());
            break;
        default:
            break;
        }
        player = next;
    }
}

Measured memory_bytes: 256
N = input()
a = list(map(int, input().split()))
dict = {}
count = 0

for i in a:
    if i in dict:
        dict[i] += 1
    else:
        dict[i] = 1

for i in dict.keys():
    if dict[i] < i:
        count += dict[i]
    else:
        count += dict[i] - i

print(count)


Measured memory_bytes: 17780
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
//#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
int Madd(int x,int y) {return (x+y)%M;}
int Msub(int x,int y) {return (x-y+M)%M;}
int Mmul(int x,int y) {return (x*y)%M;}


signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);

  bitset<64> bit(0);

  int q;
  cin>>q;
  while(q--){
    int c;
    cin>>c;
    if(c==0){
      int i;
      cin>>i;
      cout<<bit[i]<<endl;
    }if(c==1){
      int i;
      cin>>i;
      bit[i]=1;
    }if(c==2){
      int i;
      cin>>i;
      bit[i]=0;
    }if(c==3){
      int i;
      cin>>i;
      bit[i]=~bit[i];
    }if(c==4){
      cout<<bit.all()<<endl;
    }if(c==5){
      cout<<bit.any()<<endl;
    }if(c==6){
      cout<<bit.none()<<endl;
    }if(c==7){
      cout<<bit.count()<<endl;
    }if(c==8){
      cout<<bit.to_ullong()<<endl;
    }

  }



}


Measured memory_bytes: 3176
using System;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var input = Read();

        if (input == "A") Console.WriteLine("T");
        else if (input == "T") Console.WriteLine("A");
        else if (input == "C") Console.WriteLine("G");
        else  Console.WriteLine("C");
    }

    public static string Read() { return Console.ReadLine(); }
    public static int ReadInt() { return int.Parse(Read()); }
    public static long ReadLong() { return long.Parse(Read()); }
    public static double ReadDouble() { return double.Parse(Read()); }

    public static string[] Reads() { return Console.ReadLine().Split(' '); }
    public static int[] ReadInts() { return Reads().Select(_ => int.Parse(_)).ToArray(); }
    public static long[] ReadLongs() { return Reads().Select(_ => long.Parse(_)).ToArray(); }
    public static double[] ReadDoubles() { return Reads().Select(_ => double.Parse(_)).ToArray(); }
}


Measured memory_bytes: 9044
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;

int main() {
	int T;cin>>T;
	while (T--) {
		string st;cin>>st;
		int num=0;
		for (auto c : st) {
			num+=c-'0';
		}
		int sum=(num-1)/9+st.size();
		if (sum % 2) {
			cout << "Audrey wins.";
		}else {
			cout<<"Fabre wins.";

		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 3124
# from collections import defaultdict

n, m = list(map(int, input().split()))
# s = []
# c = []
# idx = 0


def solve(n, m):
    sc = dict()

    for _ in range(m):
        si, ci = list(map(int, input().split()))
        if si in sc.keys() and sc[si] != ci:
            return -1
        else:
            sc[si] = ci

    # print(sc)

    answer = ""
    for i in range(1, n + 1, 1):
        if i in sc.keys():
            if i == 1 and n > 1 and sc[i] == 0:
                return -1
            answer += str(sc[i])
        else:
            if i == 1 and n > 1:
                answer += "1"
            else:
                answer += "0"

    return answer


print(solve(n, m))

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

using namespace std;

int main() {

	int x1, y1, x2, y2;
	scanf("%d%d%d%d", &x1, &y1, &x2, &y2);

	printf("%d %d %d %d\n", x2-(y2-y1), y2+(x2-x1), x1-(y2-y1), y1+(x2-x1));

	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;  
typedef long long ll;
int main() {
  string s;
  cin >> s;
  ll a,b,c,d;
  a=s.at(0)-'0';
  b=s.at(1)-'0';
  c=s.at(2)-'0';
  d=s.at(3)-'0';
  
  if (a+b+c+d==7) {
    cout <<a<<"+"<<b<<"+"<<c<<"+"<<d;
  }
  else if (a+b+c-d==7) {
    cout << a<<"+"<<b<<"+"<<c<<"-"<<d;
  }
  else if (a+b-c+d==7) {
    cout << a<<"+"<<b<<"-"<<c<<"+"<<d;
  }
  else if (a-b+c+d==7) {
    cout << a<<"-"<<b<<"+"<<c<<"+"<<d;
  }
  else if (a+b-c-d==7) {
    cout << a<<"+"<<b<<"-"<<c<<"-"<<d;
  }
  else if (a-b+c-d==7) {
    cout << a<<"-"<<b<<"+"<<c<<"-"<<d;
  }
  else if (a-b-c+d==7) {
    cout << a<<"-"<<b<<"-"<<c<<"+"<<d;
  }
  else if (a-b-c-d==7) {
    cout << a<<"-"<<b<<"-"<<c<<"-"<<d;
  }
  cout << "=" << 7;
}

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

int main()
{
    int n;
    cin >> n;
    bool flag=true;
    list<int> mylist;
    int t;
    for(int i=0;i<n;++i)
    {
        cin >> t;
        if(flag)
        {
            mylist.push_front(t);
        } else {
            mylist.push_back(t);
        }
        flag=!flag;
    }

    flag=n%2;

    if(flag)
    {
        for(auto it=mylist.begin();it!=mylist.end();++it)
        {
            cout << *it << ' ';

        }
    } else {
        for(auto it=mylist.rbegin();it!=mylist.rend();++it)
        {
            cout << *it << ' ';

        }
    }

	return 0;
}


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

using namespace std;

long double solve1(long double a, long double b, long double x)
{
  long double theta = atan2(2.0 * x, a * b * b);
  
  long double t = (theta * 180.0) / M_PI;
  
  return 90 - t;
}

long double solve2(long double a, long double b, long double x)
{
  long double theta = atan2(a * a * a, 2.0 * (a * a * b - x));
  
  long double t = (theta * 180.0) / M_PI;
  
  return 90 - t;
}

int main()
{
  long double a, b, x;
  cin >> a >> b >> x;
  
  long double t = -1.0;
  if (2.0 * x < a * a * b) {
    t = solve1(a, b, x);
  } else {
    t = solve2(a, b, x);
  }
  
  cout << setprecision(12) << t << endl;
  
  return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split(" "))
A = [int(x) for x in input().split(" ")]
count = 0
s = sum(A)
for i in range(N):
  if A[i] * 4 * M >= s:
    count += 1

if count >= M:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 38424