akhauriyash/Code-Regression huggingface dataset:
#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 rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

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; }

int main () {
  string s;
  cin >> s;
  int n = sz(s);
  int ans = 0;
  rep(i,n/2) {
    if (s[i] != s[n-1-i]) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>

using namespace std;

double EPS = 1e-10;

double add(double a, double b) {
	if (abs(a + b) < EPS * (abs(a) + abs(b))) {
		return 0;
	}
	return a + b;
}

struct P {
	double x, y;
	P() {}
	P(double x, double y) : x(x), y(y) {
	}
	P operator + (P p) {
		return P(add(x, p.x), add(y, p.y));
	}
	P operator - (P p) {
		return P(add(x, -p.x), add(y, -p.y));
	}
	P operator * (double d) {
		return P(x * d, y * d);
	}
	double dot(P p) {
		return add(x * p.x, y * p.y);
	}
	double det(P p) {
		return add(x * p.y, -y * p.x);
	}
};

bool cmp_x(const P& p, const P& q) {
	if (p.x != q.x) {
		return p.x < q.x;
	}
	return p.y < q.y;
}

vector<P> convex_hull(P* ps, int n) {
	sort(ps, ps + n, cmp_x);
	int k = 0;
	vector<P> qs(n * 2);

	for (int i = 0; i < n; i++) {
		while (k > 1 && (qs[k-1] - qs[k-2]).det(ps[i] - qs[k-1]) <= 0) {
			k--;
		}
		qs[k++] = ps[i];
	}
	for (int i = n-2, t = k; i >= 0; i--) {
		while (k > t && (qs[k-1] - qs[k-2]).det(ps[i] - qs[k-1]) <= 0) {
			k--;
		}
		qs[k++] = ps[i];
	}
	qs.resize(k-1);
	return qs;
}

P ps[10];

int main() {
	while (cin >> ps[0].x >> ps[0].y >> ps[1].x >> ps[1].y >> ps[2].x >> ps[2].y >> ps[3].x >> ps[3].y) {
		P pp = ps[3];
		vector<P> qs = convex_hull(ps, 4);
		if (qs.size() == 4) {
			cout << "NO" << endl;
		} else {
			bool hantei = true;
			for (int i = 0; i < 3; i++) {
				if (qs[i].x == pp.x && qs[i].y == pp.y) {
					hantei = false;
					break;
				}
			}
			if (hantei) {
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		}
	}
	return 0;
}

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

///******************************** C o n t a i n e r ********************************///

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

///*********************************** C o n s t ***********************************///

const int       N=1e6+3;
const double    PI = acos(-1);
const ll        MOD=1000000007;                 ///1e9+7
ll dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};       ///first 4 for adjacent
ll dy[] = {0, +1, 0, -1, +1, -1, +1, -1};
ll dx8[]= {+1, +1, -1, -1, +2, +2, -2, -2};    ///knights move
ll dy8[]= {+2, -2, +2, -2, +1, -1, +1, -1};

///********************************** M a r c o ***********************************///

#define pb push_back
#define F first
#define S second
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(i=0;i<n;i++)
#define rforn(i,n) for(i=n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) x.size()
#define el <<'\n'
#define sp <<' '
#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}
#define mem(a,b) memset(a, b, sizeof(a))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) (a)*(a)

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

///*********************************** F u n c t i o n ***********************************///

ll powmod(ll a,ll b){ll p=MOD;a%=p;if(!a) return 0;ll pr=1;while(b>0){if(b&1){pr*=a;pr%=p;--b;}a*=a;a%=p;b/=2;}return pr;}
ll modinverse(ll a){return powmod(a,MOD-2);}
bool isPrime(ll n){ if(n<=1)return false;if(n<=3)return true;if(n%2==0 or n%3==0)return false;for(ll i=5;i*i<=n;i+=6){if(n%i==0 or n%(i+2)==0)return false;}return true;}
void seive(bool a[]){ll mx=sqrt(N),ii,jj;for(ii=3;ii<=mx;ii+=2)if(!a[ii])for(jj=ii*ii;jj<=N;jj+=2*ii)a[jj]=true;}
void numofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]++; else a[jj]+=2;}}}
void sumofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]+=ii; else a[jj]+=ii+jj/ii;}}}

///**************************************************** C o d e ****************************************************///
///-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=///


void _case()
{
    ll n,i;
    cin>>n;
    ll a[n+1],ans=1,c=0; a[n]=INT_MAX;
    for(i=1;i<=n;i++) cin>>a[i];
    a[0]=-INT_MAX;
    for(i=1;i<=n;i++){
        if(a[i]<=a[i-1]) c++;
        else {ans=max(ans,c); c=1;}
    }
    ans=max(ans,c);
    cout<<ans-1 el;
}

main()
{
    fastio();
    _case();

}


///Thank you.


///Brainless_Loco Terminates Here!


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

using namespace std;

typedef long long ll;

#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x
#define bit(n) (1<<(n))

#define out(x) cout<<(x)<<endl;
#define err(x) cerr<<(x)<<endl;
#define errr(x,y) cerr<<(x)<<" "<<(y)<<endl;

#define rep(i,n) for (int i=0;i<(n);i++)
#define repp(i,n) for (int i=1;i<=(n);i++)

#define i5 100002

int main(){
	int n[3];
	rep(i, 3) cin >> n[i];
	sort(n, n+3);
	cout << n[0] + n[1] << endl;

	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
int n;
vector<ll> a;
vector<ll> b;
vector<ll> c;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    for(int i=0;i<n;i++){
        ll temp;
        cin>>temp;
        a.push_back(temp);
    }
    for(int i=0;i<n;i++){
        ll temp;
        cin>>temp;
        b.push_back(temp);
    }
    for(int i=0;i<n;i++){
        ll temp;
        cin>>temp;
        c.push_back(temp);
    }
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    sort(c.begin(),c.end());
    vector<ll> adown;
    vector<ll> cup;
    for(int i=0;i<n;i++){
        adown.push_back(lower_bound(ALL(a),b[i])-a.begin());
        cup.push_back(n-(upper_bound(ALL(c),b[i])-c.begin()));
    }
    ll ans=0;
    for(int i=0;i<n;i++){
        ans+=adown[i]*cup[i];
    }
    cout << ans << "\n";
}

Measured memory_bytes: 4980
#include <bits/stdc++.h>
#include <iostream>
#include<math.h>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int main()
{
    int N;
    cin >> N;
    map<string, int>d;
    for (int i=0; i<N; i++) {
        int n;
        cin >> n;
        if (n < 400) {
            d["hai"] = 1;
        } else if (n < 800) {
            d["cha"] = 1;
        } else if (n < 1200) {
            d["midori"] = 1;
        } else if (n < 1600) {
            d["mizu"] = 1;
        } else if (n < 2000) {
            d["ao"] = 1;
        } else if (n < 2400) {
            d["ki"] = 1;
        } else if (n < 2800) {
            d["daidai"] = 1;
        } else if (n < 3200) {
            d["aka"] = 1;
        } else {
            if (d.count("ziyu") > 0) {
                d["ziyu"] = d["ziyu"] + 1;
            } else {
                d["ziyu"] = 1;
            }
        }
    }

    int64_t min_count = 0;
    int64_t max_count = 0;
    bool min_used = false;
    for (auto a : d) {
        if (a.first == "ziyu") {
            if (d.size() == 1 && !min_used) {
                min_count += 1;
                min_used = true;
            }
            max_count += a.second;
        } else {
            min_count += 1;
            max_count += 1;
        }
    }

    cout << min_count << " " << max_count << endl;
    return 0;
}

Measured memory_bytes: 3612
#include <stdio.h>



int main(void){

    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    int temp;
    temp=b;
    b=a;
    a=temp;
    temp=c;
    c=a;
    a=temp;
    printf("%d %d %d",a,b,c);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define INF 9223372036854775807LL
#define inf 1000000007
#define SYOU(x) setprecision(x+1)
#define lol long long
#define mp make_pair
#define fi first
#define se second
using namespace std;
lol abs(lol x,lol y){return(x>y?x-y:y-x);}
lol max(lol x,lol y){if(x>y)return x;return y;}
lol min(lol x,lol y){if(x<y)return x;return y;}
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >>s;
    lol ans=0;
    for(lol bit=0;bit<(1<<(s.size()-1));bit++){
      lol p=0;
      lol sum=0;
      for(int i=0;i<s.size()-1;i++){
	p*=10;
	p+=s[i]-'0';
	if((bit&(1<<i))!=0) sum+=p,p=0;
      }
      p*=10;
      p+=s[s.size()-1]-'0';
      sum+=p;
      ans+=sum;
    }
    cout <<ans<<'\n';
    return (0);
}


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

#define int long long

signed main() {
	int n;
	cin >> n;
	int a[n], sum = 0;
	for(int i =0 ; i < n; i++){
		cin >> a[i];
	}
	sort(a, a + n);
	sum = a[n-1];
	for(int i = 0; i < n-2; i++){
		sum += a[n-2-i/2];
	}
	cout << sum << '\n';
}


Measured memory_bytes: 5176
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    int n, m;
    cin >> n >> m;
    vector<vector<int>> g(n);
    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);
    }
    int q;
    cin >> q;
    vector<int> v(q);
    vector<int> d(q);
    vector<int> c(q);
    for(int i = 0; i < q; i++)
    {
        cin >> v[i] >> d[i] >> c[i];
        v[i]--;
    }
    vector<int> color(n);
    vector<int> infl(n, -1);
    function<void(int, int, int)> dfs = [&](int pos, int paint, int dis)
    {
        infl[pos] = dis;
        if(dis == 0) return;
        for(int next : g[pos])
        {
            if(next == pos) continue;
            if(color[next] == 0) color[next] = paint;
            if(infl[next] < dis-1) dfs(next, paint, dis-1);
        }
    };

    for(int i = q-1; i >= 0; i--)
    {
        int start = v[i];
        if(color[start] == 0) color[start] = c[i];
        if(infl[start] < d[i]) dfs(start, c[i], d[i]);
    }
    for(int i = 0; i < n; i++)
    {
        cout << color[i] << endl;
    }
}



Measured memory_bytes: 8440
import java.util.*;

public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int L = sc.nextInt();
    String[] S = new String[N];
    
    for(int i = 0; i < N; i++) {
        String token = sc.next();
        S[i] = token;
    }
    Arrays.sort(S);
    System.out.println(String.join("",S));
  }
}


Measured memory_bytes: 21972
import java.io.IOException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws IOException{

		Scanner sc = new Scanner(System.in);

		int w = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();

		int x = w + a;
		int y = w + b;

		if(a<b){
			if(b<=x){
				System.out.println("0");
			}else {
				System.out.println((b-x));
			}
		}else if(a>b){
			if(a<=y){
				System.out.println("0");
			}else {
				System.out.println((a-y));
			}
		}else {
			System.out.println("0");
		}
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ll N,M;
    cin >> N >> M;
    priority_queue<ll> price;
    rep(i,N){
        ll A;
        cin >> A;
        price.push(A);
    }
    rep(i,M){
        ll X = price.top();
        price.pop();
        price.push(X / 2);
    }
    ll sum_price = 0;
    rep(i,N){
        sum_price += price.top();
        price.pop();
    }
    cout << sum_price << endl;
}


Measured memory_bytes: 1400
#include <stdio.h>
#include <string.h>
#include <math.h>
  
int main(void){
  
    double a, b, c, d;
    double length;
     
    scanf("%lf %lf %lf %lf", &a, &b, &c, &d);
     
     
     
    length = sqrt((a-c)*(a-c)+(b-d)*(b-d));
     
    printf("%f\n", length);
     
    return 0;
  
}

Measured memory_bytes: 652
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define endl "\n"

const int N=2e5+5;

int32_t main()
{
	IOS;
	int n;
	cin>>n;
	int ans=1e9;
	for(int i=1;i<n;i++)
	{
		int k=i;
		int cr=0;
		while(k)
		{
			cr+=k%10;
			k/=10;
		}
		k=n-i;
		while(k)
		{
			cr+=k%10;
			k/=10;
		}
		ans=min(ans,cr);
	}
	cout<<ans;
	
 	return 0;	
}

Measured memory_bytes: 256
#pragma GCC optimize "-O3"
#pragma GCC target ("avx")
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v),greater<int>())
#define SPEED ios::sync_with_stdio(false);cin.tie(0);cout<<fixed<<setprecision(12)
signed gcd(int a, int b){return b?gcd(b,a%b):a;}
signed lcm(int a, int b){return a*b/gcd(a,b);}
//priority_queue<int, vi, greater<int> > que;//昇順

using namespace std;

const int mod=1e9+7;

signed main(){
    SPEED;
    int n,m;
    cin >> n >> m;
    cout << (n-1)*(m-1) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef int sign;
typedef long long ll;
#define For(i,a,b) for(register sign i=(sign)a;i<=(sign)b;++i)
#define Fordown(i,a,b) for(register sign i=(sign)a;i>=(sign)b;--i)
const int N=100+5;
bool cmax(sign &a,sign b){return (a<b)?a=b,1:0;}
bool cmin(sign &a,sign b){return (a>b)?a=b,1:0;}
template<typename T>T read()
{
  T ans=0,f=1;
  char ch=getchar();
  while(!isdigit(ch)&&ch!='-')ch=getchar();
  if(ch=='-')f=-1,ch=getchar();
  while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch-'0'),ch=getchar();
  return ans*f;
}
template<typename T>void write(T x,char y)
{
  if(x==0)
  {
      putchar('0');
      return;
  }
  if(x<0)
  {
      putchar('-');
      x=-x;
  }
  static char wr[20];
  int top=0;
  for(;x;x/=10)wr[++top]=x%10+'0';
  while(top)putchar(wr[top--]);
  putchar(y);
}
int a,b,c;
void input()
{
	a=read<int>(),b=read<int>(),c=read<int>();
}
void dfs(int A,int B,int C,int num)
{
	//cerr<<A<<' '<<B<<' '<<C<<endl;
	if((A&1)||(B&1)||(C&1))
	{
		write(num,'\n');
		return;
	}
	if(A==B&&B==C)
	{
		puts("-1");return;
	}
	dfs((B+C)/2,(A+C)/2,(A+B)/2,num+1);
}
void work()
{
	dfs(a,b,c,0);
}
int main()
{
	input();
	work();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;
string s;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>s;
    int a=0,b=0,n=s.length();
    rep(i,0,n){
        if(s[i]=='0') a++;
        else b++;
    }
    cout << n-abs(a-b)<<"\n";
}

Measured memory_bytes: 512
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int N = in.i();
        int[] A = in.ii(N);
        int i = 0;
        long ans = 1000;
        while (i < N) {
            int min = A[i];
            while (i < N && A[i] < min) {
                min = A[i++];
            }
            long cnt = ans / min;
            int max = 0;
            while (i < N && max < A[i]) {
                max = A[i++];
            }
            ans += (max - min) * cnt;
        }
        out.println(ans);
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    void back() {
        head--;
    }

    boolean minus() {
        boolean minus;
        while (true) {
            char c = next();
            if (!isDelimiter(c)) {
                if (!(minus = c == '-')) back();
                return minus;
            }
        }
    }

    void skip() {
        while (isDelimiter(next()));
        back();
    }

    char[] s(int N) {
        char[] cbuf = new char[N];
        read(cbuf, 0, N);
        return cbuf;
    }

    public int read(char[] cbuf, int off, int len) {
        skip();
        int i;
        for (i = 0; i < cbuf.length; i++) {
            char c = next();
            if (isDelimiter(c)) {
                break;
            }
            cbuf[i] = c;
        }
        return i;
    }

    boolean isDelimiter(char c) {
        return c == ' ' || c == '\n' || c == '\r';
    }

    int i() {
        boolean minus = minus();
        int n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        boolean minus = minus();
        long n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }
}


Measured memory_bytes: 32616
#include <iostream>
#include <array>
#include <string>
using namespace std;

typedef array<int, 6> dice;

bool f(dice &d0, dice &d1)
{
	static const array<dice, 6> tbl = {
		0,1,2,3,4,5, 1,5,2,3,0,4, 2,1,5,0,4,3,
		3,1,0,5,4,2, 4,0,2,3,5,1, 5,1,3,2,4,0};

	for (dice t : tbl) {
		if (d0[t[0]] != d1[0])
			continue;
		for (int i = 0, j; i < 4; i++) {
			for (j = 0; j < 6 && d0[t[j]] == d1[j]; j++)
				;
			if (j == 6)
				return true;
			int tmp = t[1]; t[1] = t[2]; t[2] = t[4]; t[4] = t[3]; t[3] = tmp;
		}
	}
	return false;
}

int main()
{
	dice d[2];

	for (auto &x: d) {
		for (int &y: x) {
			cin >> y;
		}
	}

	cout << (f(d[0], d[1]) ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

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

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

    int n, m, x;
    cin >> n >> m >> x;
    vector<int> a(m);
    REP(i, m) cin >> a[i];

    int cnt = 0;
    for(int i = 0; a[i] < x; i++) cnt++;
    cout << min(cnt, m-cnt) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int , int> P;
typedef pair<ll, ll> PL;
const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;
 
bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}
 
ll n;
 
ll a[100010],b[100010],sa[100010],samem[100010];
ll suma,sumsa;
 
int main(){
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        suma += a[i];
    }
    for(int i = 0; i < n; i++){
        cin >> b[i];
        sa[i] = b[i]-a[i];
        sumsa += sa[i];
    }
    sort(sa,sa+n);
  
    int ans = 0;
    if(sumsa > 0){
        cout << -1 << endl;
        return 0;
    }
 
    for(int i = 0; i < n; i++)  samem[i] = sa[i];
 
    int pos = 0;
    for(int i = n-1; i >= 0; i--){
        if(sa[i] > 0){
            for(; pos < n; pos++){
                if(sa[i] > abs(sa[pos])){
                    sa[i] += sa[pos];
                    sa[pos] = 0;
                }
                else{
                    sa[pos] += sa[i];
                    sa[i] = 0;
                }
                if(sa[i] == 0) break;
            }
        }
    }
 
    for(int i = 0; i < n; i++){
        if(sa[i] != samem[i])   ++ans;
        //cout << sa[i] << ' ' << samem[i] << endl;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3328
#include <stdio.h>

int main(void) {
    int n;
    scanf("%d", &n);

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

    float total = 0;
    for (int i = 0; i < n; i++) {
        total = total + (1.0 / a[i]);
    }

    printf("%f\n", 1.0 / total);

    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int N;
  cin>>N;
  if(N%2==1)
    cout<<0<<endl;
  else{
    int ans=0;
    for(N/=10;N>0;N/=5)
      ans+=N;
    cout<<ans<<endl;
  }
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;

#ifndef __MACRO_H__
#define __MACRO_H__

#define all(collection)  (collection).begin(), (collection).end()		// begin to end
#define rep(i, begin, end) for (ll i = begin; i < end; i++)				// repeat
#define repr(i, begin, end) for (ll i = begin; end < i; i--)			// repeat reverse

#endif

namespace DPE
{
	ll N;
	ll W;

	void Run(void)
	{
		cin >> N >> W;
		N++;
		vector<ll> w(N);
		vector<ll> v(N);
		rep(i, 1, N)
			cin >> w[i] >> v[i];

		const ll v_max = 1000 * N + 1;
		vector<vector<ll>> dp(N, vector<ll>(v_max, W+1));
		dp[0][0] = 0;
		rep(i, 1, N)
		{
			rep(j, 0, v_max)
			{
				if (j == 0)
					dp[i][j] = 0;
				else
					dp[i][j] = (0 <= j - v[i]) ? min(dp[i - 1][j - v[i]] + w[i], dp[i - 1][j]) : dp[i - 1][j];
			}
		}

		repr(j, v_max - 1, -1)
		{
			if (dp.back()[j] <= W)
			{
				cout << j << endl;
				return;
			}
		}

	}
};

int main(void)
{
	DPE::Run();
	return 0;
}


Measured memory_bytes: 81024
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long int ll;
typedef vector<pair<ll,ll> > Q;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
const int inf=1e9+7;

int n,k;
int main(){
  cin>>n>>k;
  int v[n];
  rep(i,n) cin>>v[i];
  int ans=(-1)*inf;

  for(int s=0;s<=k;s++){

    for(int ss=0;ss<=s;ss++){
      bool flag[n];
      rep(i,n) flag[i]=false;
      priority_queue<int,vector<int>,greater<int> > jue;

      for(int i=0;i<ss;i++){
        if(i<n){
          if(!flag[i]){
            jue.push(v[i]);
            flag[i]=true;
          }
        }
      }

      for(int i=0;i<s-ss;i++){
        if(i<n){
          if(!flag[n-1-i]){
            jue.push(v[n-1-i]);
            flag[n-1-i]=true;
          }
        }
      }

      for(int i=0;i<k-s;i++){
        if(!jue.empty()){
          if(jue.top()<0) jue.pop();
        }
      }

      int tmp=0;
      while(!jue.empty()){
        tmp+=jue.top();
        jue.pop();
      }
      ans=max(tmp,ans);
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
require 'set'

k = gets.to_i

answer = 1
rest = 7
mem = Set.new

loop do
  if rest >= k && rest % k == 0
    puts answer
    exit
  end
  rest = rest % k * 10 + 7
  unless mem.add?(rest)
    puts -1
    exit
  end
  answer += 1
end


Measured memory_bytes: 51368
#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;
  string S, T;
  cin >> N >> S >> T;
  rep(i, N) cout << S[i] << T[i];

  return 0;
}

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

typedef   long long  int ll;
typedef  long double ld;
typedef std::vector<ll> vi;
typedef std::vector<std::vector<ll> > vv;

#define MOD 1000000007
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fo(i,a,b) for(i=a;i<b;i++)
#define mp make_pair
#define pb(x) push_back(x)
#define fi first
#define se second
#define print(vec,a,b) for(ll i=a;i<b;i++) cout<<vec[i]<<" ";cout<<"\n";
#define all(a) a.begin(),a.end()
#define input(vec,a,b) for(ll i = a;i<b;i++) cin>>vec[i];
#define ms(a,val) memset(a,val,sizeof(a))
using namespace std;

const int N = 1e5 + 5;


void solve(){
            ll i,j,n,x,m;
            cin>>n>>x>>m;
            vi vis(m,0);
            ll temp = x;
            ll sum = 0;
            ll count = 1;
            vi sise(m,0),val(m,0);
            while(count<=n&&vis[temp]==false)
            {
                vis[temp] = 1;
                sise[temp] = count;
                count++;

                val[temp] = sum;
                sum+=temp;
                temp = ((temp%m)*(temp%m))%m;



            }
            if(count>n)
             cout<<sum<<endl;
            else{
                ll ans = val[temp];
                n-=(sise[temp] - 1);
                ll cycle = sum - val[temp];
                ll len = count - sise[temp];
                ans+=((n/len)*cycle);
                count =(n/len)*len;
                while(count<n)
                {
                    ans+=temp;
                    temp =((temp%m)*(temp%m))%m;
                    count++;
                }
                cout<<ans<<endl;

            }







}

int main()
{

      ll t=1,i;
      //cin>>t;

            while(t--)
      {

          solve();
      }
    return 0;
}


Measured memory_bytes: 5644
N=int(input())
F=False

S=[]
for _ in range(N):
    s=int(input())
    S.append(s)
    F|=(s%10!=0)

if not F:
    print(0)
else:
    if sum(S)%10:
        print(sum(S))
    else:
        x=float("inf")
        for s in S:
            if s%10!=0 and x>s:
                x=s
        print(sum(S)-x)


Measured memory_bytes: 62164
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define fi first
#define se second
using namespace std;

int inf = 2147483647;
int64_t inf64 = 9223372036854775807;
int MOD = 1e+7;

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

  int64_t n, a, b;
  cin >> n >> a >> b;

  int64_t mini = a * n + (b - a);
  int64_t maxi = b * n - (b - a);

  cout << max(0LL, (maxi-mini+1LL)) << endl;
  //cout << mini << " " << maxi << endl;
  return 0;
}

Measured memory_bytes: 256
#pragma comment(linker, "/STACK:640000000")
#include <bits/stdc++.h>

#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define ll long long
#define bit __builtin_popcountll
#define sqr(x) (x) * (x)
#define forit(it,S) for(__typeof((S).begin()) it = (S).begin(); it != (S).end(); it++)

using namespace std;

typedef pair<int, int> pii;

const double eps = 1e-9;
const double pi = acos(-1.0);

const ll INF = 1LL << 55;

ll dp[55][55];
ll pos[55];
ll npos[55];
bool can[55][55];

int a[55], b[55];

ll get(int x, int y) {
	ll &res = dp[x][y];
	if (res != -1) return res;
	if (x < y) return res = INF;
	if (x == y) return res = 0;
	res = INF;
	for (int i = 1; i <= x; i++) {
		if (get(x % i, y) < INF) {
			res = (1LL << i) + get(x % i, y);
			break;
		}
    }
    return res;
}

void print(ll x) {
	for (int i = 0; i < 52; i++) {
		if (x & (1LL << i)) {
			cout << i << " ";
		}
	}
	cout << endl;
}

int main() {
	#ifdef LOCAL
	freopen("a.in", "r", stdin);
	freopen("a.out", "w", stdout);
	#endif

	memset(dp, -1, sizeof(dp));

	for (int i = 0; i <= 50; i++) {
		for (int j = 0; j <= 50; j++) {
			get(i, j);
		}
	}

	int n; cin >> n;

	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = 0; i < n; i++) cin >> b[i];

	ll mask = 0;
	for (int i = 0; i < n; i++) {
		mask |= get(a[i], b[i]);
	}
	if (mask >= INF) {
		cout << -1 << endl;
		return 0;
	}

	for (int i = 0; i < n; i++) {
		pos[i] = 1LL << a[i];
	}

	ll ans = 0;
	ll prev = 51;
	while(true) {
		bool good = true;
		for (int i = 0; i < n; i++) {
			if ((pos[i] & (1LL << b[i])) == 0) {
				good = false;
				break;
			}
		}
		if (good) break;
		for (int bi = 1; bi < prev; bi++) {
			bool good = true;
			for (int i = 0; i < n; i++) {
				bool gg = false;
				for (int j = 0; j <= 50; j++) if (pos[i] & (1LL << j)) {
					ll mask = get(j, b[i]);
					if (mask < (1LL << (bi + 1))) {
						gg = true;
						break;
					}
				}
				if (!gg) {
					good = false;
					break;
				}
			}
			if (!good) continue;
			//cout << "bi" << bi << endl;
			for (int i = 0; i < n; i++) {
				ll nmask = 0;
				for (int j = 0; j <= 50; j++) if (pos[i] & (1LL << j)) {
					//cout << j << endl;
					nmask |= 1LL << (j % bi);
				}
				pos[i] |= nmask;
			}
			ans |= 1LL << bi;
			prev = bi;
			break;
		}
	}

	cout << ans << endl;

	return 0;
}

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

const double PI=3.14159265358979323846;

int main()
{
	int a, b, h, m;
	cin >> a >> b >> h >> m;
	double arad, brad;
	arad = 2 * PI / 12 * h + 2 * PI / (12 * 60) * m;
	brad = 2 * PI / 60 * m;
	double rad = abs(arad - brad);
	double ans = sqrt(pow(b-a*cos(rad),2)+pow(a*sin(rad),2));
	printf("%.15lf\n", ans);
	return 0;
}

Measured memory_bytes: 4068
// C.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
    int n, m;

    cin >> n >> m;

    vector<vector<pair<int,int>>> v(n+1);

    vector<pair<int,int>>ans(m + 1);

    for (int i = 1; i <= m; i++) {
        int p, y;

        cin >> p >> y;

        v[p].push_back(make_pair(y, i));
    }

    for (int i = 1; i <= n; i++) {
        sort(v[i].begin(), v[i].end());
    }
    //for (int i = 1; i <= n; i++) {
    //    for (int j = 0; j < v[i].size(); j++) {
    //        cout << v[i][j].first << " " << v[i][j].second << endl;
    //    }
    //}
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j < v[i].size(); j++) {
            ans[v[i][j].second] = make_pair(i, j + 1);
        }
    }

    for (int i = 1; i <= m; i++) {
        printf("%06d", ans[i].first);
        printf("%06d\n", ans[i].second);

    }

    return 0;

}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Measured memory_bytes: 9436
N, K = list(map(int, input().split()))
p = list(map(int, input().split()))

T = [0] * (N+1)

for i in range(N):
  T[i+1] = T[i] + (1+p[i])/2

ans = 0
for j in range(K, N+1):
  ans = max(ans, T[j]-T[j-K])

print(ans)

Measured memory_bytes: 24548
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define PRINT(x) cout<<(x)<<endl
#define INF 1000000000000 // 10^12
#define MOD 1000000007 // 10^9+7
#define PB push_back
#define MP make_pair

int n;
string x;

int popcount(int);
int f(int);

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

    int popcount_x = 0;
    REP(i, n) if(x[i] == '1') popcount_x++;
    int pcx0 = popcount_x + 1;
    int pcx1 = popcount_x - 1;

    vector<int> pow2i_mod_pcx0(n);
    pow2i_mod_pcx0[0] = 1;
    REP2(i, 1, n) pow2i_mod_pcx0[i] = pow2i_mod_pcx0[i-1] * 2 % pcx0;

    int x_mod_pcx0 = 0;
    REP(i, n) if (x[i] == '1') x_mod_pcx0 = (x_mod_pcx0 + pow2i_mod_pcx0[n-i-1]) % pcx0;

    if (popcount_x == 0) REP(i, n) PRINT(1);

    else if(popcount_x == 1) REP(i, n) {
        if (x[i] == '1') PRINT(0);
        else PRINT(f((x_mod_pcx0 + pow2i_mod_pcx0[n-i-1]) % pcx0));
    }

    else {
        vector<int> pow2i_mod_pcx1(n);
        pow2i_mod_pcx1[0] = 1;
        REP2(i, 1, n) pow2i_mod_pcx1[i] = pow2i_mod_pcx1[i-1] * 2 % pcx1;

        int x_mod_pcx1 = 0;
        REP(i, n) if (x[i] == '1') x_mod_pcx1 = (x_mod_pcx1 + pow2i_mod_pcx1[n-i-1]) % pcx1;

        REP(i, n) {
            if (x[i] == '1') PRINT(f((x_mod_pcx1 - pow2i_mod_pcx1[n-i-1] + pcx1) % pcx1));
            else PRINT(f((x_mod_pcx0 + pow2i_mod_pcx0[n-i-1]) % pcx0));
        }
    }
    
    return 0;
}

int popcount(int v) {
    int res = 0;
    while (v > 0) {
        if (v & 1) res++;
        v >>= 1;
    }
    return res;
}

int f(int v) {
    int res = 1;
    while (v > 0) {
        v = v % popcount(v);
        res++;
    }
    return res;
}

Measured memory_bytes: 5196
import java.util.*;
public class Main {
	public static void main(String[] args){
      	//データ取り込み
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
      	int M = sc.nextInt();
      	int a[] = new int[3];
      	a[0] = N + M;
      	a[1] = N - M;
      	a[2] = N * M;
      	Arrays.sort(a);
		System.out.println(a[2]);      
    }
}

Measured memory_bytes: 21972
package main

import "fmt"

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

var (
	A, B, C, n int
	l          []int
)

func dfs(cur, a, b, c int) int {
	if cur == n {
		if min(min(a, b), c) == 0 {
			return 1e9
		}
		return abs(a-A) + abs(b-B) + abs(c-C) - 30
	}
	v1 := dfs(cur+1, a, b, c)
	v2 := dfs(cur+1, a+l[cur], b, c) + 10
	v3 := dfs(cur+1, a, b+l[cur], c) + 10
	v4 := dfs(cur+1, a, b, c+l[cur]) + 10
	return min(min(min(v1, v2), v3), v4)
}

func main() {
	fmt.Scan(&n, &A, &B, &C)
	l = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&l[i])
	}
	ans := dfs(0, 0, 0, 0)
	fmt.Println(ans)
}


Measured memory_bytes: 512
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    h,w = LI()
    a = [[c for c in S()] for _ in range(h)]
    b = []
    for i in range(h):
        if '#' in a[i]:
            b.append(a[i])
    c = [''] * len(b)
    for j in range(w):
        f = False
        for i in range(len(b)):
            if b[i][j] == '#':
                f = True
                break
        if f:
            for i in range(len(b)):
                c[i] += b[i][j]

    return '\n'.join(c)



print(main())


Measured memory_bytes: 6348
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func main() {
	N := nextInt()
	as := make([]int, N)
	for i := 0; i < N; i++ {
		as[i] = nextInt()
	}
	colorSelected := make([]bool, 8)
	var hackerCnt int
	for _, a := range as {
		colorType := a / 400
		if colorType < 8 {
			colorSelected[colorType] = true
		} else {
			hackerCnt++
		}
	}
	var colorCnt int
	for _, isSelect := range colorSelected {
		if isSelect {
			colorCnt++
		}
	}
	minCnt := colorCnt
	if colorCnt == 0 && hackerCnt > 0 {
		minCnt = 1
	}
	maxCnt := colorCnt + hackerCnt
	//if maxCnt > 8 {
	//	maxCnt = 8
	//}
	fmt.Printf("%d %d\n", minCnt, maxCnt)
}

// Input. ----------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}

	return i
}

func nextString() string {
	sc.Scan()
	if err := sc.Err(); err != nil {
		panic(err)
	}

	return sc.Text()
}

// ---------- Input.

// Util. ----------

func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}

func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}

// ---------- Util.


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;
int yaku(int*);
void input(string,int*);
int cmp(const void *a, const void *b);
int main() {
	int a[5],ans;
	string in;
	while (cin >> in) {
		input(in, a);
		ans = yaku(a);
		if (ans == 7) {
			cout << "four card\n";
			continue;
		}
		if (ans == 6) {
			cout << "full house\n";
			continue;
		}
		if (ans == 5) {
			cout << "straight\n";
			continue;

		}
		if (ans == 4) {
			cout << "three card\n";
			continue;
		}
		if (ans == 3) {
			cout << "two pair\n";
			continue;
		}
		if (ans == 2) {
			cout << "one pair\n";
			continue;
		}
		cout << "null\n";
	}
}

void input(string in,int *a) {
	int n = 0, m = 0;
	for (int i = 0; i < in.size(); i++) {
		if (in[i] == ',') {
			a[m++] = n;
			n = 0;
			continue;
		}
		n = n * 10 + in[i] - '0';
	}
	a[4] = n;
	qsort(a, 5, sizeof(int), cmp);
	return;
}

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

int yaku(int *a) {
	bool x = true, y = false;
	for (int i = 1; i < 5; i++) {
		if (a[i - 1] + 1 != a[i]) {
			if (i == 1) {
				if (a[0] == 1) {
					if (a[1] == 10) {
						if (a[2] == 11) {
							if (a[3] == 12) {
								if (a[4] == 13)
									return 5;
							}
						}
					}
				}
			}
			x = false;
			break;
		}
	}
	if (x)
		return 5;
	int n[13] = {}, two = 0, three = 0;
	for (int i = 0; i < 5; i++) {
		if (++n[a[i] - 1] == 4)
			return 7;
		if (n[a[i] - 1] == 3) {
			two--;
			three++;
		}
		if (n[a[i] - 1] == 2)
			two++;
	}
	if (three == 1) {
		if (two == 1)
			return 6;
		return 4;
	}
	if (two == 2)
		return 3;
	if (two == 1)
		return 2;
	return 1;
}


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

#define ll long long
#define INF 99999999
#define rep(i,n) for(int i=0,temp=(int)(n);i<temp;++i) 
#define repi(i,start,end) for(int i=start,temp=(int)(end);i<end;++i)
#define rfor(v,x) for(const auto& x : v) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n)
#define vsort(v) sort(v.begin(), v.end())
#define vfsort(v,lambda) sort(v.begin(),v.end(),lambda)
#define vint vector<int>
#define vvint vector<vector<int>>
#define vin(v) rep(i,v.size()) {cin >> v[i];}

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//(lambda (x y) (< x y)) => [](int x, int y) -> int { return x<y; }


int main(void){
  int a,p;cin >> a >> p;
  int kakera = a*3+p;
  cout << kakera/2 << endl;

  return 0;
}


Measured memory_bytes: 256
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

a, b, c, d = map(int, input().split())

i = (b // c) - (a // c) 
if(a % c == 0):
  i += 1

j = (b // d) - (a // d)
if(a % d == 0):
  j += 1
  
k = (b // lcm(c,d)) - (a // lcm(c,d))
if(a % lcm(c,d) == 0):
  k += 1

print(b - a + 1 - ( i + j - k ))

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

int main(){
    int n,m;
    cin >> n >> m;
    vector <int> in;
    for(int i=0;i<m;i++){
        int tmp;
        cin >> tmp;
        in.push_back(tmp);
    }
    sort(in.begin(),in.end());
    int area = in[m-1] - in[0];
    vector <int> sub;
    for(int i=0;i<m-1;i++){
        sub.push_back(in[i+1]-in[i]);
    }
    sort(sub.begin(),sub.end());
    reverse(sub.begin(),sub.end());
    for(int i=0;i<min(n-1,m-1);i++){
        area -= sub[i];
    }
    cout << area << endl;
    return 0;
}

Measured memory_bytes: 1400
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
#include<unordered_map>
#include<unordered_set>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592
#define PI acos(-1.0);

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;



int main(){
    int k,a,b; cin >> k >> a >> b;
    repr(i,a,b+1){
        if(i % k == 0){
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
}



Measured memory_bytes: 3632
#include <iostream>

using namespace std;

class Dice{
    int s[6];   //?????????????????¢
public:
    Dice(int *);
    void throw_dice(char);
    int get_up() const {return s[0];}
    int get_s(int n) const {return s[n];}
};

Dice::Dice(int *dice_s){
    for (int i=0;i<6;i++) s[i]=dice_s[i];
}

void Dice::throw_dice(char d){
    int temp,temp2;
    switch(d){
        case 'S':
            temp=temp2=s[2-1];
            s[2-1]=s[1-1];
            temp2=s[6-1];
            s[6-1]=temp;
            temp=temp2;
            temp2=s[5-1];
            s[5-1]=temp;
            temp=temp2;
            s[1-1]=temp;
            break;
        case 'E':
            temp=temp2=s[3-1];
            s[3-1]=s[1-1];
            temp2=s[6-1];
            s[6-1]=temp;
            temp=temp2;
            temp2=s[4-1];
            s[4-1]=temp;
            temp=temp2;
            s[1-1]=temp;
            break;
        case 'N':
            temp=temp2=s[5-1];
            s[5-1]=s[1-1];
            temp2=s[6-1];
            s[6-1]=temp;
            temp=temp2;
            temp2=s[2-1];
            s[2-1]=temp;
            temp=temp2;
            s[1-1]=temp;
            break;
        case 'W':
            temp=temp2=s[4-1];
            s[4-1]=s[1-1];
            temp2=s[6-1];
            s[6-1]=temp;
            temp=temp2;
            temp2=s[3-1];
            s[3-1]=temp;
            temp=temp2;
            s[1-1]=temp;
            break;
        default:
            cout<<"Error!";
            break;
    }
}

int main(){
    int s[6];
    int i,j;
    for (i=0;i<6;i++){
        cin>>s[i];
    }
    Dice d(s);
    int *ques1,*ques2;
    int n;
    cin>>n;
    ques1=new int [n];
    if (ques1==NULL){
        cout<<"Error!"<<endl;
        return 0;
    }
    ques2=new int [n];
    if (ques2==NULL){
        cout<<"Error!"<<endl;
        delete [] ques1;
        return 0;
    }
    for (i=0;i<n;i++){
        cin>>ques1[i]>>ques2[i];
    }
    for (i=0;i<n;i++){
        //ques???1?????????
        for (j=0;j<4;j++){
            if (d.get_s(0)==ques1[i]){
                break;
            }
            d.throw_dice('S');
        }
        if (!(j<4)){
            //????????¢?????\?????????
            d.throw_dice('E');
            if (!(d.get_s(0)==ques1[i])){
                //????????\????????????
                d.throw_dice('W');
                d.throw_dice('W');
            }
        }
        //ques1???????????¢?????\?????????
        for (j=0;j<4;j++){
            if (d.get_s(1)==ques2[i]){
                //ques2???????????¢?????\???
                break;
            }
            //?????¨?????????
            d.throw_dice('E');
            d.throw_dice('S');
            d.throw_dice('W');
        }
        cout<<d.get_s(2)<<endl;
    }
    delete [] ques1;
    delete [] ques2;
}

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

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  int ans = 0;
  
  for(int i = 1; i <= N; i++){ // iを整数Nの分まで回す
    int sum = 0; // 合計値の初期設定
    int x = i; // 次のfor分のためのx
    for (int j = 0; j < 5; j++){ // 各桁を合計する
      sum += x % 10; // 余りを合計値に加算する
      x /= 10; // 10で割って次のループに回す
    }
    if (sum >= A && sum <= B){ // sumがA以上かつB以下
      ans += i;
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256