akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vdis vector<ll>
#define pii pair<ll,ll>
#define vvdis vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e16
#define md 1000000007
#define adis(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
#define M 500010
 
struct dis{
	ll cnt[26];
};
dis f(dis a,dis b){
	dis c;
	rep(i,0,26)c.cnt[i]=(a.cnt[i]||b.cnt[i]);
	return c;
}
dis g(){
	dis c;rep(i,0,26)c.cnt[i]=0;
	return c;
}
dis tree[4*M+1];
char a[M];
void build(ll node,ll start,ll end){
	if(start==end)tree[node].cnt[a[start]-'a']++;
	else{
		ll mid=(start+end)/2;
		build(2*node,start,mid);
		build(2*node+1,mid+1,end);
		tree[node]=f(tree[2*node],tree[2*node+1]);
	}
}
dis query(ll node,ll start,ll end,ll l,ll r){
	if(end<l or r<start)return g();
	if(l<=start and r>=end)return tree[node];
	ll mid=(start+end)/2;
	dis p1=query(2*node,start,mid,l,r);
	dis p2=query(2*node+1,mid+1,end,l,r);
	return f(p1,p2);
}
void up(ll node,ll start,ll end,ll idx,char val){
	if(start==end){
		a[idx]=val;
		rep(i,0,26)tree[node].cnt[i]=0;
		tree[node].cnt[val-'a']++;
	}
	else{
		ll mid=(start+end)/2;
		if(start<=idx and idx<=mid)up(2*node,start,mid,idx,val);
		else up(2*node+1,mid+1,end,idx,val);
		tree[node]=f(tree[2*node],tree[2*node+1]);
	}
}
 
int main(){
	IOS;
	ll o;cin>>o;
	string s;cin>>s;
	ll n=s.length();
	rep(i,0,n)a[i]=s[i];
	ll q;cin>>q;
	build(1,0,n-1);
	while(q--){
		ll type,l,r;cin>>type>>l;l--;
		if(type==1){char c;cin>>c; up(1,0,n-1,l,c);}
		else {
			cin>>r;r--;
			dis ans=query(1,0,n-1,l,r);
			ll nt=0;rep(i,0,26)if(ans.cnt[i])nt++;
			cout<<nt<<"\n";
		}
	}
	return 0;
}

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

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
    A[i] -= i + 1;
  }
  sort(A.begin(), A.end());
  long long med = A[N / 2];
  long long res = 0;
  for (int i = 0; i < N; ++i) res += abs(A[i] - med);
  cout << res << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
//const double pi=acos(-1.0);
#define mod 1000000007
#define forn(i,k,n) for(ll i=k;i<n;i++)
#define fornr(i,k,k1) for(ll i=k;i>=k1;i--)
#define v(ll) vector<ll>
#define vl(a,n,ll,k) vector<ll> a(n,k)
#define vli(a,n) vector<ll> a(n)
#define init(a,n) vector<ll> a(n);forn(i,0,n)cin>>a[i]
#define vll(a,n,m,ll,k) vector<vector<ll>> a(n,vector<ll>(m,k))
#define mp(a,ll,ll1) map<ll,ll1> a
#define st(a,ll) set<ll> a
#define mpa make_pair
#define pr pair<ll,ll>
#define pb push_back
#define MAX 1000000
#define ed '\n'
#define fileTake ifstream cin("input.txt");ofstream cout("output.txt");
#define sortv(a) sort(a.begin(),a.end())
#define sorta(a,n) sort(a,a+n)
#define yeah "Yes"
#define nil "No"
#define All(x) x.begin(),x.end()
#define remDup(a) a.erase(unique(All(a)),a.end())
#define N 100
 
void swap(ll &x,ll &y) 
{ 
	x=x^y;
	y=x^y;
	x=x^y;
} 

template<typename T>
void print(T a){for(auto i=a.begin();i!=a.end();i++)cout<<*i<<" ";cout<<endl;}
bool isVowel(char c)
{
	if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')return true;
	return false;
}

void sync(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}

int main(){
	sync();
	ll n;
	cin>>n;
	string s;
	cin>>s;
	ll r=0,w=0;
	for(char c:s)
	{
		if(c=='R')r++;
		else w++;
	}
	if(r==0||w==0)
	{
		cout<<0<<endl;
		return 0;
	}
	ll ans=0;
	ll count=0;
	for(ll i=r;i<n;i++)
	if(s[i]=='R')count++;
	for(ll i=0;i<r;i++)
	{
		if(s[i]=='W')
		{
			if(count>0)
			{
				ans++;
				count--;
			}
			else ans++;
		}
	}
	cout<<ans+count<<endl;
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>  // ver1.9.4
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define mp make_pair
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define Vout(a) rep(i,0,a.size()-1)cout<<a[i]<<' ';cout<<a[a.size()-1]<<endl;
#define INF 9000000000000000000  //  9.0 * 10^18
#define MOD 1000000007  //  10^9 + 7
using namespace std;

signed main() {
  cout << fixed << setprecision(15);
  int n,m;
  cin >> n;
  map<int,int> d;
  int memo;
  rep(i,0,n) {
    cin >> memo;
    d[memo]++;
  }
  cin >> m;
  map<int,int> t;
  rep(i,0,m) {
    cin >> memo;
    t[memo]++;
  }
  for (auto p : t) {
    auto k = p.first;
    auto v = p.second;
    if(d[k] < v){cNO;return 0;}
  }
  cYES;
  return 0;
}


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

int main() {
  string S;
  cin >> S;
  
  vector<int> cnt(2, 0);
  
  for (int i = 0; i < S.size(); ++i) {
    cnt[S[i] - '0']++;
  }
  
  int ans = min(cnt[0], cnt[1]) * 2;
  
  cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    string s;
    cin >> s;
    if (s[0] == '9' || s[1] == '9') cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ctype.h>
# define pb push_back
#define fst first
#define sec second
#define For(i,a,b) for(int i=a;i<b;i++)
#define ll long long int
#define ull unsigned long long int
#define mod 1000000007
#define fo(i,n) for(ll i=0;i<n;i++)
#define endl "\n"
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define fo1(i,n) for(ll i=1;i<=n;i++)
#define boolsize 1000001
#define pi pair<ll,ll>
#define vi vector<ll>
#define vii vector<pi>
using namespace std;
template<typename T>
void showvector(vector <T> v)
{
    for(T x:v)
        cout<<x<<" ";
    cout<<endl;

}
template<typename T>
void showvector1(vector <T> v)
{
    ll n=v.size();
    fo1(i,n-1)
        cout<<v[i]<<endl;

}
template<typename T>
void showset(set <T> s)
{
    for(T x: s)
        cout<<x<<" ";
    cout<<endl;
}
template<class T>
void showvectorpair(vector<T> v)
{
    for(auto it=v.begin();it!=v.end();it++)
        cout<<it->first<<" "<<it->second<<endl;
    cout<<endl;
}
template<typename T,typename P>
void showmap(map <T,P> m)
{
    for(auto it=m.begin();it!=m.end();it++)
        cout<<it->first<<" "<<it->second<<endl;
    cout<<endl;
}
template<typename T>
bool comp(T a,T b)
{
    return (a>b);
}
template<class T>
bool comppair(T a,T b)
{
    if(a.first==b.first)
        return(a.second>b.second);
    return (a.first>b.first);
}
bool sameparity(ll a,ll b)
{
    return (a%2==b%2);
}
bool difparity(ll a,ll b)
{
    return !(a%2==b%2);
}
bool isprime(ll x)
{   if(x<=1)
     return false;
    for(ll i=2;i<=sqrt(x);i++)
    {
        if(x%i==0)
            return false;
    }
    return true;
}
bool iseven(ll x)
{
    return !(x%2);
}
bool isodd(ll x)
{
    return (x%2);
}
//vector <bool> prime(boolsize,1);
//void seive()
//{
//    ll n=boolsize;
//    prime[0]=prime[1]=0;
//    for(ll i=2;i<=sqrt(boolsize);i++)
//    {
//        if(prime[i]==1)
//        {
//            for(ll j=i*i;j<=n;j+=i)
//            {
//                prime[j]=0;
//            }
//        }
//    }
//}

/// check for test case before submitting
void vfun()
{
    ll n;
    cin>>n;
    ll x=log2(n);
    ll ans=pow(2,x);
    cout<<ans<<endl;

}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0); ///cant use scanf, printf
    cin.tie(0);cout.tie(0); /// no longer auto flush cout before each cin, remove for interactive
    //cout << fixed << setprecision(11); /// no scientific output
    ll test=1;
    //cin>>test;
    while(test--)
    {

        //fun();
        vfun();
//         if(vfun())
//            cout<<"YES\n";
//         else
//            cout<<"NO\n";
    }
}
///before sub
/// check for value of zero and single input in array
///loop vars,1LL in mult, equal, one, bounds, int v ll, endl, finish taking inputs
/// check whether test cases are given or not




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

#define int long long

int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

/*
#define cin ifs
#define cout ofs
ifstream ifs("in.txt");
ofstream ofs("out.txt");
//*/

signed main() {
    int N, A, B;
    cin >> N >> A >> B;
    bool flag = false;
    if (A < B) {
        flag = true;
        swap(A, B);
    }
    deque<int> deq;
    for (int i = 1; i <= A; i++) {
        deq.push_back(i);
    }
    if (N > A * B || N < A + B - 1) {
        cout << -1 << endl;
        return 0;
    }
    int cnt = N;
    while (cnt > A) {
        vector<int> vec;
        for (int i = 0; i < B - 1 && cnt > A; i++) {
            vec.push_back(cnt);
            cnt--;
        }
        for (int i = 0; i < vec.size(); i++) {
            deq.push_front(vec[vec.size() - i - 1]);
        }
    }
    for (auto itr = deq.begin(); itr != deq.end(); ++itr) {
        int ans = *itr;
        if (flag) {
            ans = N - ans + 1;
        }
        cout << ans << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 5424
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int k=sc.nextInt();
    int s=sc.nextInt();
    int x,y,z,cnt=0;
    sc.close();
    for(int i=Math.max(0,s-2*k);i<=Math.min(k,s);i++){
      x=i;
      for(int j=Math.max(0,s-i-k);j<=Math.min(k,s-i);j++){
        y=j;
        for(int l=Math.max(0,s-i-j);l<=Math.min(k,s-i-j);l++){
          z=l;
          if(x+y+z==s){
            cnt++;
          }
        }
      }
    }
    System.out.println(cnt);
  }
}

Measured memory_bytes: 25300
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        double t = Double.parseDouble(sc.next());
        double x = Double.parseDouble(sc.next());

        // 主処理
        double result = t / x;

        // 出力
        System.out.println(result);
        sc.close();
    }
}


Measured memory_bytes: 22228
#include<bits/stdc++.h>
using namespace std;
int n,a[100005];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	for(int i=1;i<=n;i++)
		if(a[i]%2){
			puts("first");
			return 0; 
		}
	puts("second");
	return 0;
}

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

int main(){
  int a,b,c;
  cin >> a>>b>>c;
  if(a <= b*c)
  {
    cout << "Yes" << endl;
  }
  else if(a>b*c)
  {
    cout << "No" << endl;
  }
}

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

const int maxn = 1e5+5, M = 1e9+7;
string s;
int n;
int dp[13][maxn];

int modexp(int a, int b) {
    int res = 1;
    while (b) {
        if (b&1) res = (1LL*res*a) % 13;
        a = (1LL*a*a) % 13;
        b >>= 1;
    }
    return res;
}

int f(int mod, int i) {
    if (dp[mod][i] >= 0) return dp[mod][i];
    if (i == n) return dp[mod][i] = mod == 5 ? 1 : 0;
    if (s[i] != '?') {
        int d = s[i]-'0';
        int m = (1LL*d*modexp(10,i)) % 13;
        return dp[mod][i] = f((mod+m)%13,i+1);
    }
    else {
        dp[mod][i] = 0;
        for (int d = 0; d < 10; d++) {
            int m = (1LL*d*modexp(10,i)) % 13;
            dp[mod][i] = (dp[mod][i] + f((mod+m)%13,i+1)) % M;        
        }
        //cout << mod << ' ' << i << ": " << dp[mod][i] << '\n';
        return dp[mod][i];
    }
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin >> s;
    n = s.size();
    reverse(s.begin(),s.end());
    memset(dp,-1,sizeof dp);
    int ans = f(0,0);
    cout << ans << '\n';
}



Measured memory_bytes: 13392
/*
 * main.cpp
 *
 *  Created on: 2020/04/12
 *      Author: SkAaO
 */

#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>

using namespace std;

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

	int X;
	bool is_X = false;

	for(int i = 0; i <= N; i++){
		if(((float)i * 1.08 >= N) && ((float)i * 1.08 < N + 1)){
			X = i;
			is_X = true;
		}
	}

	if(is_X){
		cout << X << endl;
	}else{
		cout << ":(" << endl;
	}

	return 0;

}




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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF = 1e9;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

int main()
{
    ios::sync_with_stdio(false);
    int X; cin >> X;
    int sum = 0;
    for (int t = 1;; t++) {
        sum += t;
        if (X <= sum) {
            cout << t << endl;
            return 0;
        }
    }
}


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

constexpr int INF=1e9;

int main()
{
	for(int d,n;cin>>d>>n && d|n;){
		vector<int> as(n),es(n),rs(n);
		for(int i=0;i<n;i++) cin>>as[i]>>es[i]>>rs[i];
		
		int m=*max_element(begin(rs),end(rs));
		vector<vector<int>> dp(d+1,vector<int>(m+1,INF));
		dp[d][0]=0;
		for(int i=d;i>=0;i--)
			for(int j=0;j<=m;j++)
				for(int k=0;k<n;k++)
					if(rs[k]<=j){
						int u=max(i-as[k],0),v=min(j+es[k],m);
						dp[u][v]=min(dp[u][v],dp[i][j]+1);
					}
		int res=*min_element(begin(dp[0]),end(dp[0]));
		if(res<INF) cout<<res<<endl;
		else        cout<<"NA"<<endl;
	}
}

Measured memory_bytes: 1260
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long takahashi = 1, aoki = 1;

		for(int i=0; i<n; i++){
			int t = sc.nextInt();
			int a = sc.nextInt(); 
			long tmp1 = takahashi/t, tmp2 = aoki/a;
			tmp1 += (takahashi%t==0)?0:1;
			tmp2 += (aoki%a==0)?0:1;
			long tmp = Math.max(tmp1, tmp2);

			takahashi = t*tmp;
			aoki = a*tmp;
		}

		System.out.println((takahashi+aoki));
	}
}

Measured memory_bytes: 12948
//
//  main.cpp
//  AGC_040_A
//
//  Created by Joe Mori on 2020/05/26.
//  Copyright © 2020 Joe Mori. All rights reserved.
//

#include <iostream>
#include<bits/stdc++.h>

int main(int argc, const char * argv[]) {
    std::string str;
    std::cin>>str;
    long long int sum=0;
    std::vector <int>vec(str.length()+1);
    vec.at(0)=0;
    for(int i=0;i<str.length();i++){
        if(str.at(i)=='<'){
            vec.at(i+1)=vec.at(i)+1;
        }
        //std::cout<<vec.at(i)<<std::endl;
    }
  //  std::cout<<"おわり"<<std::endl;
//    std::cout<<vec.at(str.length())<<std::endl;
    for(long long int i=str.size()-1;i>=0;i--){
        if(str.at(i)=='>'){
            vec.at(i)=std::max(vec.at(i+1)+1,vec.at(i));
        }
      //  std::cout<<vec.at(i)<<std::endl;
    }
    //std::cout<<vec.at(0)<<std::endl;
    for(int i=0;i<vec.size();i++){
        sum+=vec.at(i);
       // std::cout<<vec.at(i)<<std::endl;
    }
    std::cout<<sum<<std::endl;
   /* if(dai>shou){
        for(int i=0;i<=str.length();i++){
            str_min=std::min(str_min,vec.at(i));
            sum+=vec.at(i);
        }
        std::cout<<sum-str_min*(str.length()+1)<<std::endl;
    }else{
        for(int i=0;i<=str.length();i++){
            str_min=std::min(str_min,vec.at(i));
            sum+=vec.at(i);
        }
        std::cout<<sum-str_min*(str.length()+1)<<std::endl;
    }*/
   // for(int i=0;i<=str.length();i++)
//        std::cout<<vec.at(i)<<std::endl;
//    std::cout<<sum<<std::endl;
    return 0;
}


Measured memory_bytes: 2820
#include"bits/stdc++.h"

using namespace std;

int main() {
	string S;
	string ans;

	for (int i = 0; i < 3; i++) {
		cin >> S;
		transform(S.begin(), S.end(), S.begin(), ::toupper);
		ans += S[0];
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int s=0, m,n;
    
    scanf("%d",&n);
    m=n;
    while(m>0){
        s+=m%10;
        m=m/10;
    }
    if(n%s==0)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int> >;
int N, M;
Graph G;

void solve() {
    vector<int> dist(N, -1);
    vector<int> prev(N, -1);
    queue<int> que;
    que.push(0);
    dist[0] = 0;
    while (!que.empty()) {
        int v = que.front();
        que.pop();
        for (auto nv : G[v]) {
            if (dist[nv] == -1) {
                dist[nv] = dist[v] + 1;
                prev[nv] = v;
                que.push(nv);
            }
        }
    }
    cout << "Yes" << endl;
    for (int i = 1; i < N; ++i) cout << prev[i] + 1 << endl;
}

int main() {
    cin >> N >> M;
    G.assign(N, vector<int>());
    for (int i = 0; i < M; ++i) {
        int a, b;
        cin >> a >> b;
        --a, --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    solve();
}

Measured memory_bytes: 10552
#include<stdio.h>
#include<stdlib.h>
#define N 10000

int main(){

  int n, q, i, j, k=0, cnt=0, cnt2=0, u[N];
  int s[N], t[N];

  scanf("%d",&n);

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

  for(i=0;i<q;i++){
    scanf("%d",&t[i]);
  }
  for(j=0;j<q;j++){
    for(i=0;i<n;i++){
      if(s[i]==t[j]){
	u[cnt]=s[i];
	cnt++;
	break;
      }
    }
  }
  /*  for(i=0;i<cnt;i++){
    for(j=i+1;j<cnt;j++){
      if(u[i]==u[j])cnt2++;
    }
    }*/

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

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

int main(){
  string s;
  cin>>s;
  int cnt=0;
  for(int i=2;i<s.size()-1;i++)
    if(s[i]=='C')cnt++;
  int t=0;
  for(int i=1;i<s.size();i++)
    if('a'<=s[i]&&s[i]<='z')t++;
  if(s[0]=='A'&&cnt==1&&t==s.size()-2)cout<<"AC"<<endl;
  else cout<<"WA"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    string s;
    cin >> s;
    int count = 0;
    for(int i = 1;i < s.size();i++)
    {
        if(s[i] != s[i - 1])
        {
            count++;
        }
    }
    cout << count;

    return 0;
}

Measured memory_bytes: 512
def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

import heapq

N=one_int()
A=many_int()

sort_A = sorted(A,reverse=True)



sukima = [-sort_A[0]]
heapq.heapify(sukima)

sort_A = sort_A[1:]
sums = 0
for a in sort_A:
    sums += heapq.heappop(sukima)
    heapq.heappush(sukima, -a)
    heapq.heappush(sukima, -a)

print(-sums)

Measured memory_bytes: 31552
#include <iostream>
#include <vector>

enum{
    TOP, FRONT, RIGHT, LEFT, REAR, BOTTOM
};

class Dice{
private:
    std::vector<int> faces;

public:
    Dice(){
        for(int i = 0; i < 6; ++i){
            faces.push_back(i + 1);
        }
    }

    Dice(std::vector<int> readVec){
        int sz = readVec.size();
        for(int i = 0; i < sz; ++i){
            faces.push_back(readVec.at(i));
        }
    }

    void roll(int readVal){
        std::vector<int> index{0, 2, 5, 3};
        switch(readVal){
            case 78: // 'N'
                index.at(1) = 1; index.at(3) = 4; 
                break;
            case 87: // 'W'
                index.at(1) = 2; index.at(3) = 3; 
                break;
            case 69: // 'E'
                index.at(1) = 3; index.at(3) = 2; 
                break;
            case 83: // 'S'
                index.at(1) = 4; index.at(3) = 1; 
                break;
            case 82: // 'R' (rotate the dice clockwisely)
                index.at(0) = 1; index.at(2) = 4; 
                break;
        }

        for(int i = 0; i < 3; ++i){
            std::swap(faces.at(index.at(i)), faces.at(index.at(i + 1)));
        }
    }

    int number(int i){
        return faces.at(i);
    }
};

int main(){
    std::vector<int> vec(6);
    for(int i = 0; i < 6; ++i){
        std::cin >> vec.at(i);
    }

    Dice dice(vec);

    int n;
    std::cin >> n;

    for(int i = 0; i < n; ++i){
        int a, b;
        std::cin >> a >> b;
        if(a == dice.number(LEFT)){
            dice.roll('E');
        }
        if(a == dice.number(RIGHT)){
            dice.roll('W');
        }
        while(a != dice.number(TOP)){
            dice.roll('N');
        }
        while(b != dice.number(FRONT)){
            dice.roll('R');
        }

        std::cout << dice.number(RIGHT) << std::endl;
    }

    return 0;
}



Measured memory_bytes: 3148
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		int w = scn.nextInt(), n = scn.nextInt();
		int[] ans = new int[w];
		for(int i = 1;i <= w;i++) {
			ans[i-1] = i;
		}
		int a,b,buf;
		String line = scn.nextLine();
		for(int i = 0;i < n;i++) {
			line = scn.nextLine();
			String[] nyan = line.split(",");
			a = Integer.parseInt(nyan[0])-1;
			b = Integer.parseInt(nyan[1])-1;
			buf = ans[a];
			ans[a] = ans[b];
			ans[b] = buf;
		}
		for(int i = 0;i < w;i++) {
			System.out.println(ans[i]);
		}
		scn.close();
	}
}


Measured memory_bytes: 26004
#include<iostream>
#include<string>
using namespace std;
int main(){
  string w;
  string t;
  cin >> w;
  int i;
  for(i=0;i<w.size();i++) {
    if('A'<=w[i]&&w[i]<='Z') w[i]+='a'-'A';
  }
  int o=0;
  cin >> t;
  while(t!="END_OF_TEXT"){
  
    for(i=0;i<t.size();i++) {
      if('A'<=t[i]&&t[i]<='Z') t[i]+='a'-'A';
    }
    if(w==t) o++;
    cin >> t;
  }
  cout << o << endl;
}



Measured memory_bytes: 3180
#include<bits/stdc++.h>
#define pii pair<int, int>
#define fir first
#define sec second
using namespace std;
const int MAXN = 1e5 + 7;
char s[MAXN];
int dp[MAXN], lazy[MAXN], lst[MAXN], ans[MAXN];
priority_queue<pii, vector<pii>, greater<pii>>pq;
int main()
{
    int n, m; scanf("%d%d", &n, &m);
    scanf(" %s", s);
    for (int i = 0; i <= n; i++) lst[i] = 1e9;
    pq.push({0, n});
    for (int i = n; i >= 0; i--)
    {
        while (pq.size() && pq.top().sec > i) pq.pop();
        if (pq.empty())
        {
            puts("-1");
            return 0;
        }
        if (s[i] == '1') continue;
        dp[i] = pq.top().fir;
        lst[dp[i]] = min(lst[dp[i]], i);
        int val = dp[i] + 1;
        pq.push({val, i - m});
    }
    int now = dp[0], tot = 0;
    while (now >= 0) ans[++tot] = lst[now--];
    for (int i = 2; i <= tot; i++) printf("%d%c", ans[i] - ans[i - 1], i == tot ? '\n' : ' ');
    
    return 0;
}

Measured memory_bytes: 2168
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<string>
#include<cmath>
#define INF 

typedef long long ll;

int main() {
	int n = 0;
	int ans = 0;
	int connect = 0;
	int a[101] = {};
	std::cin >> n;
	for (int i = 1; i < n+1; i++) {
		std::cin >> a[i];
		a[0] = a[1];
		if (a[i] == a[i - 1]) {
			connect++;
		}
		else {
			ans += connect / 2;
			connect = 1;
		}
	}
	ans += connect / 2;
	std::cout << ans << std::endl;
	
}

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

#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

const int inf = 1000000;

int dp[41][401][401];

int main()
{
    int n, ma, mb;
    cin >> n >> ma >> mb;

    int a[n], b[n], c[n];

    rep(i, n) cin >> a[i] >> b[i] >> c[i];

    rep(i, n + 1) rep(j, 401) rep(k, 401) dp[i][j][k] = inf;

    dp[0][0][0] = 0;

    rep(i, n)
    {
        rep(j, 401)
        {
            rep(k, 401)
            {
                if (j - a[i] >= 0 && k - b[i] >= 0)
                    dp[i + 1][j][k] = min(dp[i][j - a[i]][k - b[i]] + c[i], dp[i + 1][j][k]);
                dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k]);
            }
        }
    }
    int ans = 1e7;

    rep(j, 401)
    {
        rep(k, 401)
        {
            if (j * k == 0)
                continue;
            if (j * mb == k * ma)
                ans = min(ans, dp[n][j][k]);
        }
    }

    OP((ans == inf ? -1 : ans));

    return 0;
}

Measured memory_bytes: 25984
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl;
#define peintD(a) cout << setprecision(10) << ans << endl;
using namespace std;
int max_int = 1000000007;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<int>& a,int n);

int n,m;

signed main(){
    while(cin >> n >> m){
        int x = n+m;
        int tmp=1;
        while(x>=10){
            x /= 10;
            tmp++;
        }
        print(tmp)
    }
    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}
int nibul(auto a,auto b){
    int x = lower_bound(All(a),b) - a.begin();
    //key以上の初めてのitr
    return x;
}
int nibuu(auto a,auto b){
    int x = upper_bound(All(a),b) - a.begin();
    //key以下の最後のitr
    return x-1;
}

void input(vector<int>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}



Measured memory_bytes: 3068
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int INF = 0x3f3f3f3f;
const LL mod = 1e9 + 7;
const int N = 300005;

int a[N], b[N];
vector<int> c, d;
int main() {
    int n, m, g;
    scanf("%d%d%d", &n, &m, &g);
    set<pair<int, int> > se;
    for (int i = 0; i < g; i++) {
        int x, y;
        scanf("%d%d", &x, &y);
        se.insert({x, y});
        a[x]++;
        b[y]++;
    }
    int mx1 = 0, mx2 = 0;
    for (int i = 1; i <= n; i++) mx1 = max(mx1, a[i]);
    for (int i = 1; i <= m; i++) mx2 = max(mx2, b[i]);
    for (int i = 1; i <= n; i++)
        if (mx1 == a[i]) c.push_back(i);
    for (int i = 1; i <= m; i++)
        if (mx2 == b[i]) d.push_back(i);
    for (auto x : c) {
        for (auto y : d) {
            if (se.count({x, y}) == 0) {
                printf("%d\n", mx1 + mx2);
                return 0;
            }
        }
    }
    printf("%d\n", mx1 + mx2 - 1);
    return 0;
}


Measured memory_bytes: 23732
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] line1 = sc.nextLine().split(" ");
        String[] line2 = sc.nextLine().split(" ");
        sc.close();

        int N = Integer.parseInt(line1[0]);
        int K = Integer.parseInt(line1[1]);

        long[] enemies = Arrays.asList(line2).stream().mapToLong(Long::parseLong).toArray();

        Arrays.sort(enemies);

        long res = 0;
        for (int i = N - 1; i >= 0; i--) {
            long hp = enemies[i];
            if (K > 0) {
                K--;
                continue;
            }
            res += hp;
        }

        System.out.println(res);
    }

}

Measured memory_bytes: 79652
import Control.Applicative( (<$>))

main = do
    n_ <- readLn::IO Int
    line1 <- getLine
    line2 <- getLine
    let
	d:ouble = zip line1 line2
	proc1st::(Char,Char) -> Integer
	proc1st (a,b)
	  |  a==b	= 3 * case ouble of
				[]	-> 1
				ouble	-> proc (a,a) ouble
	  | otherwise	= 6 * case ouble of
				[]	-> 1
				o:uble	-> proc (a,b) uble
	proc _ [] = 1
	proc (prev1,prev2) [_]
	  | prev1==prev2    = 2
	  | otherwise	    = 1
	proc (prev1,prev2) ((a,b):tl@((a2,b2):remain))
	  | prev1==prev2    = if a==b
				then 2 * proc (a,a) tl
				else 2 * proc (a2,b2) remain
	  | otherwise	    = if a==b
				then proc (a,a) tl
				else 3 * proc (a2,b2) remain
    print $ proc1st d `rem` 1000000007

Measured memory_bytes: 508
//#define FILE_INPUT
#define _CRT_SECURE_NO_WARNINGS
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ldbl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef string str;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vbl;
 
#define majorro cout.precision(20); ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define forn(i, n) for(ll (i) = 0; (i) < (n); ++(i))
#define fornm(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define rfornm(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define fin() for(ll i = 0; i < n; ++i)
#define readvec(vector, n) {ll temp_vec_val;forn(i, n){cin >> temp_vec_val;vector.push_back(temp_vec_val);}}
#define printvec(vector, delimeter) {ll length_of_vector=vector.size();\
                                    forn(elementvec, length_of_vector){cout << vector[elementvec] << delimeter;}}
#define printarr(arr, length, delimeter) {forn(elementarr, length){cout << arr[elementarr] << delimeter;}}
#define sortvec(vector) sort(vector.begin(), vector.end())
 
 
struct custom_hash
{
    static uint64_t splitmix64(uint64_t x)
    {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
 
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
 
unsigned long long bpow(unsigned long long a, ll n, ll mod)
{
    return n ? n & 1 ? (bpow(a, n - 1, mod) * a) % mod : (bpow((a * a) % mod, n >> 1ll, mod)) % mod : 1ll;
}

int get_digit(ll num, int len, int index)
{
    return num / bpow(10, len - index - 1, 1) % 10;
}
 
ll digit_sum(ll num)
{
    ll dig_sum = 0;
    while(num > 0)
    {
        dig_sum += num % 10;
        num /= 10;
    }
    return dig_sum;
}

const ldbl EPS = 0.000001;
const ll MOD = 1000000007;
// const ll MOD = 3037000499;
// const ull MOD = 1000000000000000003;
const ll INF = 1e18;
const double pi = 2 * acos(0.0);
ll n, m, k, p, q, t, sum = 0, cnt = 0;
ll mx = INT64_MIN;
ll mn = INT64_MAX;
bool flag = 0;
vll v;
str s = "", s1, s2;

void bad_solve(){}

void solve() //set.merge() -> c++17
//DELET DEBUG OUTPUT!11!1
//DONT FORGET MODULO SUBSTRACTION
{
    ldbl n;
    cin >> m;
    n = ceil(m / 1.08);
    if((ll)(n*1.08) == m) cout << n;
    else cout << ":(";
}
 
int main()
{
#ifdef FILE_INPUT
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    majorro
 
    solve();
 
    // freopen("test.txt", "w", stdout);
    // bad_solve();
 
//  memset(v, INT_MAX, 1000*2000*sizeof(int));
 
    return 0;
}

Measured memory_bytes: 256
from sys import stdin

#l = list(map(int, stdin.readline().rstrip().split()))
x,y = map(int, stdin.readline().rstrip().split())
#S = [list(map(int, stdin.readline().rstrip().split())) for _ in range(h)]#hの定義を忘れずに

if y>4*x or y<2*x:
    print('No')
if 2*x<=y and y<=4*x:
    if y%2==0:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 9176
import java.util.Scanner;

public class Main {

public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	long a =  sc.nextLong();
	long b =  sc.nextLong();
	long c =  sc.nextLong();
	long k =  sc.nextLong();
	long sum = 0;

	if(a<=k) {
		for(int i=0;i<a;i++) {
			sum += 1;
		}
	}else {
		for(int i=0;i<k;i++) {
			sum += 1;
		}
	}
	for(int i=0;i<k-a-b;i++) {
		sum -= 1;
	}


	System.out.println(sum);
    }
}

Measured memory_bytes: 35748
#include <bits/stdc++.h>
#define int long long
//#define double long double
#define endre getchar();getchar();return 0
#define moder (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1)*x;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)*mod_pow(kai(x - y), moder - 2, moder) % moder*mod_pow(kai(y), moder - 2, moder) % moder;
}
/*--------Library Zone!--------*/

int n, k, a[114514], ki;
signed main() {
	cin >> n >> k;
	rep(i, n) {
		cin >> a[i];
		if (a[i] % 2)ki++;
	}
	if (ki) {
		cout << ((int)(1) << (n - 1)) << endl;
	}
	else {
		if (k)cout << 0 << endl;
		else cout << ((int)(1) << n) << endl;
	}
	endre;
}

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

#define ll long long
#define ar array

int n;
const int mxn=100;
int a[mxn],b[mxn];
int solve(){

	for(int i=0;i+2<n;i++){
		if(a[i]==b[i] && a[i+1]==b[i+1] && a[i+2]==b[i+2])
			return 1;
	}
	return 0;
}
int main(){
cin>>n;
for(int i=0;i<n;i++)
	cin>>a[i]>>b[i];
cout<<((solve()==1)?"Yes":"No");

}


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

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)


int main()
{
    long long N, K;
    cin >> N >> K;
    vector<int> A(N);
    REP(i, N){
        cin >> A[i];
        --A[i];
    }

    vector<int> num_visit(N, -1);
    num_visit[0] = 0;
    int i = 1, next = A[0];
    while(num_visit[next] == -1){
        // cout << next << " " << A[next] << " " << i << endl;
        num_visit[next] = i;
        next = A[next];
        ++i;
    }

    int loop = i-num_visit[next];
    REP(i, N){
        if(K <= num_visit[next]){
            if(num_visit[i] == K){
                cout << i+1 << endl;
                break;
            }
        }else if(num_visit[i]-num_visit[next] == (K-num_visit[next])%loop){
            cout << i+1 << endl;
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 4844
import java.util.*;
public class Main {
	static Scanner sc = new Scanner(System.in);
	static int n, p;
	static int[] player;
	public static void main(String[] args) {
		while(read()){
			solve();
		}
	}
	
	static boolean read(){
		n = sc.nextInt();
		p = sc.nextInt();
		if( n == 0 && p == 0)return false;
		return true;
	}
	
	static void solve(){
		player = new int[n];
		int user = 0;
		while(true){
			if(p != 0){
				if(p == 1){
					if(isFinished(user))break;
				}
				p--; player[user]++;
			}else{
				p += player[user]; player[user] = 0;
			}
			user++;
			user = user%player.length;
		}
		System.out.println(user);
	}
	
	static boolean isFinished(int x){
		boolean isEnd = true;
		for(int i = 0; i < player.length; i++){
			if(i != x && player[i] != 0)isEnd = false;
		}
		return isEnd;
	}

}

Measured memory_bytes: 12000
import java.util.*;
import java.io.*;
import java.math.*;

public class Main{
    public static void main(String[] args)throws IOException{
	InputStreamReader isr = new InputStreamReader(System.in);
	BufferedReader br=new BufferedReader(isr);
	String ns = br.readLine();
	int n = Integer.parseInt(ns);
	String str1 = br.readLine();
	String str2 = br.readLine();
	//read
      	BigInteger bi1 =new  BigInteger(str1);
	BigInteger bi2=new BigInteger(str2);
	//bigint に変換
	BigInteger sum = bi1.add(bi2);
	String l = sum.toString();
	if(l.length()>80){
	    System.out.printf("overflow");
	}
	else
	    System.out.println(l);

	//1回目
	for(int i=1;i<n;i++){
	    	str1=br.readLine();

	    str2=br.readLine();
	    
	    bi1 = new BigInteger(str1);
	    bi2 = new BigInteger(str2);
	    
	    sum = bi1.add(bi2);
	    l = sum.toString();
	    if(l.length()>80){
		System.out.println("overflow");
	    }
	    else
		System.out.println(l);
	   
	    
	}
    }
    
}
    
	    

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

typedef pair<int,int> P;
typedef pair<string,P> P2;

int main() {
  string t;
  while(getline(cin,t)) {
    string s="";
    stringstream ss;
    ss << t;
    string r;
    while(ss >> r) {
      for(int i=0; i<r.size(); i++) {
	if(isalpha(r[i])) s+=toupper(r[i]);
      }
    }
    vector<string> ans;
    set<string> v;
    for(int i=0; i<s.size(); i++) {
      int x=i,y=i,j;
      for(j=0; j<s.size(); j++) {
	if(x<0 || y>=s.size()) break;
	if(s[x]!=s[y]) break;
	if(j) v.insert(s.substr(x+1,y-x-1));
	x--;y++;
      }
      x++;y--;
      string a=s.substr(x,y-x+1);
      if(a.size()>1 && !v.count(a)) ans.push_back(a);
      x=i;y=i+1;
      for(j=0; j<s.size(); j++) {
	if(x<0 || y>=s.size()) break;
	if(s[x]!=s[y]) break;
	if(j) v.insert(s.substr(x+1,y-x-1));
	x--;y++;
      }
      x++;y--;
      a=s.substr(x,y-x+1);
      if(a.size()>2 && !v.count(a)) ans.push_back(a);
    }
    sort(ans.begin(),ans.end());
    ans.erase(unique(ans.begin(),ans.end()),ans.end());
    vector<string> ans2;
    for(int i=0; i<ans.size(); i++) {
      if(!v.count(ans[i])) ans2.push_back(ans[i]);
    }
    for(int i=0; i<ans2.size(); i++) {
      if(i) cout << " ";
      cout << ans2[i];
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 1252
N = int(input())
def inp():
    return [int(x) for x in input().split(" ")]
a1 = inp()
a2 = inp()

m = 0
for i in range(N + 1):
    s = sum(a1[0:i + 1]) + sum(a2[i:N+1])
    if m < s:
        m = s
        
print(m)

Measured memory_bytes: 3060
class Dice:
    def __init__(self, label):
        self.d = label

    def roll(self, direction):
        if direction == "N":
            self.d[0], self.d[1], self.d[5], self.d[4] = self.d[1], self.d[5], self.d[4], self.d[0]
        elif direction == "S":
            self.d[0], self.d[1], self.d[5], self.d[4] = self.d[4], self.d[0], self.d[1], self.d[5]
        elif direction == "E":
            self.d[0], self.d[2], self.d[5], self.d[3] = self.d[3], self.d[0], self.d[2], self.d[5]
        elif direction == "W":
            self.d[0], self.d[2], self.d[5], self.d[3] = self.d[2], self.d[5], self.d[3], self.d[0]
        else:
            pass

n = int(input())

# ??¨????????¶???????¶??????§????????????
cmd = "N" * 4 + ("W" + "N" * 4) * 3 + "NE" + "N" * 4 + "EE" + "N" * 4 

labels = []

for i in range(n):
    labels.append([int(j) for j in input().split()])

for i in range(n):
    flag = False

    for j in range(i + 1, n):
        label1 = labels[i]
        label2 = labels[j]

        dice1 = Dice(label1)
        dice2 = Dice(label2)

        for op in cmd:
            dice2.roll(op)

            if dice1.d == dice2.d:
                flag = True
                break

        if flag:
            break

    if flag:
        print("No")
        break
else:
    print("Yes")

Measured memory_bytes: 7844
#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s; cin >> s;
	char tmp = '<';
	Int cnt = 0;
	vector<Int> v;
	for(size_t i=0; i<s.size(); ++i){
		if(s[i] == tmp) ++cnt;
		else{
			v.push_back(cnt);
			tmp = s[i];
			cnt = 1;
		}
	}
	v.push_back(cnt);
//	for(size_t i=0; i<v.size(); ++i)
//		cerr << i << " " << v[i] << "\n";
	Int ans = 0;
	for(size_t i=0; i<v.size()/2; ++i){
		Int k = v[2*i], l = v[2*i+1];
		if(k > l) swap(k, l);
		ans += max<Int>(0, k*(k-1)/2) + (l+1)*l/2;
	}
	if(v.size() % 2 == 1)
		ans += v.back()*(v.back()+1)/2;
	cout << ans << "\n";
}

Measured memory_bytes: 3352
a, b = map(int, input().split())

def solve(a, b):
    if (a < 0 and b > 0) or a == 0 or b == 0:
        return 'Zero'
    if a > 0:
        return 'Positive'
    if (b - a) % 2:
        return 'Positive'
    else:
        return 'Negative'

print(solve(a, b))


Measured memory_bytes: 3064
import java.util.*;

/**
 * @Author: Harry
 * @Date: 2019-11-16
 * @Version 1.0
 */
public class Main {

    static int arr[],t,n,arr2[];

//    static int a,b,S;


    static int ans = 0;

    public Main() {
    }

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);


        while(input.hasNext()){
            n = input.nextInt();
            input.nextLine();

            String str = input.nextLine();

            if(n % 2 == 0){
                String t1 = str.substring(0,n / 2);
                String t2 = str.substring(n / 2);

                if(t1.equals(t2)){
                    System.out.println("Yes");
                }
                else{
                    System.out.println("No");
                }
            }
            else{
                System.out.println("No");
            }
        }



    }

















}

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

int main() {
  string S;
  cin >> S;
  int N = S.size();
  for (int i = 0; i < N; i++) {
    if (i % 2) continue;
    cout << S.at(i);
  }
  cout << "\n";
}

Measured memory_bytes: 3692
#include<bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) \
  for (ll i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, ) (__VA_ARGS__)  // NOLINT
#define chmax(x, a)  do { x = max(x, a); } while(0)
#define chmin(x, a)  do { x = min(x, a); } while(0)

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;


int main(void) {
  ll x, ans;
  cin >> x;
  if (x <= 599) ans = 8;
  else if (x <= 799) ans = 7;
  else if (x <= 999) ans = 6;
  else if (x <= 1199) ans = 5;
  else if (x <= 1399) ans = 4;
  else if (x <= 1599) ans = 3;
  else if (x <= 1799) ans = 2;
  else if (x <= 1999) ans = 1;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3592
def main():
    n, m = [int(x) for x in input().split()]
    x = [int(x) for x in input().split()]
    if n >= m:
        return 0
    x.sort()
    dxs = [x2 - x1 for x1, x2 in zip(x, x[1:])]
    dxs.sort()
    return sum(dxs[:m - n])

print(main())


Measured memory_bytes: 13840
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

signed main()
{
	int a, b;
	cin >> a >> b;
	if (a > b)rep(i, a)cout << b;
	else rep(i, b)cout << a;
}

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

int main() {
    int n;
    cin >> n;
    vector<string> w(n);
    for (int i = 0; i < n; i++) {
        cin >> w[i];
    }

    for (int i = 1; i < n; i++) {
        for (int j = 0; j < i; j++) {
            if (w[i] == w[j]) {
                cout << "No" << endl;
                return 0;
            }
        }
        if (*w[i].begin() != *w[i - 1].rbegin()) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 256
# coding: utf-8

def greatest_common_divisor(N, M):
    assert N >= M
    while M != 0:
        N, M = M, N%M
    return N

def prime_divisor(N):
    temp = N
    for n in range(2, int(-(-N**0.5//1))+1):
        if temp % n == 0:
            while temp % n == 0:
                temp //= n
            yield n
    if temp != 1:
        yield temp
        

def main():
    a, b = input().split()
    a, b = int(a), int(b)

    if a > b:
        a, b = b, a

    gcd = greatest_common_divisor(b, a)
    pdiv = [pd for pd in prime_divisor(gcd)]
    print(len(pdiv)+1)

main()

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

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<ll>> a(n, vector<ll>(m));
    vector<ll> b(m);

    rep(i, n) rep(j, m) cin >> a[i][j];
    rep(i, m) cin >> b[i];

    rep(i, n) {
        ll ans = 0;
        rep(j, m) ans += a[i][j] * b[j];

        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 3176
#include <bits/stdc++.h>
template<int mod>
class Combination {
    std::vector<long long> fact, finv, inv;
public:
    Combination(int sz) {
        fact.resize(sz);
        finv.resize(sz);
        inv.resize(sz);
        fact[0] = 1;
        for(int i=1;i<sz;++i) {
            fact[i] = fact[i-1] * i % mod;
        }
        inv[0] = 0;
        inv[1] = 1;
        for(int i=2;i<sz;++i) {
            inv[i] = mod - inv[mod%i] * (mod/i) % mod;
        }
        finv[0] = 1;
        for(int i=1;i<sz;++i) {
            finv[i] = finv[i-1] * inv[i] % mod;
        }
    }
    long long C(long long n, long long k) {
        if(n < k) return 0;
        if(n < 0 || k < 0) return 0;
        return (fact[n] * finv[k] % mod) * finv[n-k] % mod;
    }
    long long P(long long n, long long k) {
        if(n < k) return 0;
        if(n < 0 || k < 0) return 0;
        return fact[n] * finv[n-k] % mod;
    }
    long long H(long long n, long long k) {
        return this->C(n + k - 1, k);
    }
    long long getfact(int i) {
        return fact[i];
    }
    long long getinv(int i) {
        return inv[i];
    }
    long long getfinv(int i) {
        return finv[i];
    }
};
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int main() {
  cin.tie(0);
  cout << fixed << setprecision(10);
  int n; cin >> n;
  bool p; cin >> p;
  vector<int> a(n);
  for(int i=0;i<n;++i) {
    cin >> a[i];
    a[i] %= 2;
  }
  Combination<MOD> comb(55);
  ll ans = 1;
  ll cnt = 0;
  for(int i=0;i<n;++i) {
    if(a[i]) cnt++;
    else ans *= 2;
  }
  ll tmp = 0;
  for(int i=p;i<=cnt;i+=2) {
    tmp += comb.C(cnt, i);
  }
  ans *= tmp;
  cout << ans << endl;
}


Measured memory_bytes: 256