akhauriyash/Code-Regression huggingface dataset:
main = do
    s <- getLine
    print . (`div` 2) $ solve 0 s (reverse s)

solve k [] [] = k
solve k (a:as) (b:bs) | a == b = solve k as bs
                      | a == 'x' = solve (k+1) as (b:bs)
                      | b == 'x' = solve (k+1) (a:as) bs
                      | otherwise = -2
solve k [] (b:bs) | b == 'x' = solve (k+1) [] bs
                  | otherwise = -2
solve k (a:as) [] | a == 'x' = solve (k+1) as []
                  | otherwise = -2

Measured memory_bytes: 13692
#include<stdio.h>
int main()
{
	int x, y;
	scanf("%d %d", &x, &y);
	int i;
	for (i = 0; i <= x; i++)
	{
		if (2 * i + 4 * (x - i) == y)
		{
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
	return 0;
}

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

int main(){
  long long n;
  cin >> n;
  long long a[n],ans[n]={},sum=0;
  for(int i=0;i<n;i++){
    cin >> a[i];
    if(i%2==0){
      sum+=a[i];
    }else{
      sum-=a[i];
    }
  }
  ans[0]=sum;
  for(int i=1;i<n;i++){
    ans[i]=(a[i-1]-ans[i-1]/2)*2;
  }
  for(int i=0;i<n;i++){
    cout << ((i>0)?" ":"") << ans[i];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 2816
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;


int main() {
    int n, m;
    cin >> n >> m;
    for(int i = m / n; i > 0; i--) {
        if (m % i == 0 && i * n <= m) {
            cout << i << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
 
        long h = stdIn.nextLong();
        int n = stdIn.nextInt();
        //int c = stdIn.nextInt();
        //int x = stdIn.nextInt();
        int a[] = new int[n];
        //String s = stdIn.next();
        //String t = stdIn.next();
        //char c[] = s.toCharArray();
        int sum = 0;
        //c[0] += 1;
        //int sum = 0;
        //boolean flag = true;
        for(int i = 0; i < n; i++){
            sum += stdIn.nextInt();
        }
        
        if(sum >= h){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        
 
        //System.out.println();
        //System.out.print();
 
        stdIn.close();
    }
}

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

int main() {
  int n, x;
  cin >> n >> x;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v.at(i);
    x -= v.at(i);
  }
  sort(v.begin(), v.end());
  int s = 0;
  s = x / v.at(0);
  cout << n + s << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define mod 1000000007
#define MOD 1000000007
#define Nmax 200010
long long inv[Nmax],fact[Nmax],invfact[Nmax];
void PRE(){
    inv[1]=fact[0]=invfact[0]=1;
    for(int i=1;i<Nmax;i++){
        if(i>1)inv[i]=(MOD-(MOD/i)*inv[MOD%i]%MOD)%MOD;
        fact[i]=fact[i-1]*i%MOD;
        invfact[i]=invfact[i-1]*inv[i]%MOD;
    }
}
long long C(int n,int k){
    return fact[n]*invfact[k]%MOD*invfact[n-k]%MOD;
}
#define M 100010
ll f[M],n,k,s[210];
ll cnt[M];
int main(){
    PRE();
  cin>>n>>k;
  for(int i=0;i<n;i++)cin>>s[i]; sort(s,s+n);
  for(int i=0;i<M;i++){
      ll p=0;
      for(int j=0;j<n;j++)if(s[j]<=i)p=j+1;
      cnt[i]=p;
  }
  for(int i=0;i<M;i++)f[i]=0; f[k]=1;
  for(int x=k;x>=s[0];x--){
      for(int i=0;i<n;i++){
	  if(s[i]>x)continue;
	  ll r=x%s[i];
	  ll a=cnt[x]-cnt[r]-1;
	  ll b=cnt[r];
	  f[r]=(f[r]+f[x]*C(a+b,b)%mod*fact[a])%mod;
      }
  }
  ll ans=0;
  for(ll i=1;i<s[0];i++){
      //cout<<i<<" "<<f[i]<<endl;
      ans=(ans+f[i]*i)%mod;
  }
  ll a=cnt[M-1]-cnt[k];
  ll b=cnt[k];
  ans=(ans*C(a+b,b)%mod*fact[a])%mod;
  cout<<ans<<endl;
  //for(int i=0;i<=k;i++)cout<<i<<" "<<f[i]<<endl;
    return 0;
}



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

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

    map<pair<int,int>,int> mp;

    for(int i=1;i<=n;i++){
        int front,back;
        back = i % 10;
        int tmp = i;
        while(tmp>0){
            front = tmp;
            tmp /= 10;
        }
        mp[make_pair(front,back)]++;
    }

    int sum = 0;
    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            sum += mp[make_pair(i,j)] * mp[make_pair(j,i)];
        }
    }

    cout << sum << endl;
}

Measured memory_bytes: 256
N,M=map(int,input().split())
L,R=[],[]
for _ in range(M):
    l,r=map(int,input().split())
    L.append(l)
    R.append(r)
Lm=max(L)
Rm=min(R)
print(Rm-Lm+1 if Rm-Lm>=0 else 0)

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

string to_string(string s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef LOCAL
#define db(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define db(...) 42
#endif

using ll = long long;

int main() {
  string o, e;
  cin >> o >> e;
  int len = o.size() + e.size();
  int oi = 0, ei = 0;
  for (int i = 0; i < len; i++) {
    if (i % 2 == 0) {
      if (oi < o.size()) {
        cout << o[oi++];
      }
    } else {
      if (ei < e.size()) {
        cout << e[ei++];
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>


int main(void) {
    double x[3], y[3], xp, yp, cp[3];
    int i, j;

    while (scanf("%lf%lf%lf%lf%lf%lf%lf%lf",
                 &x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &xp, &yp ) == 8) {
        for (i = 0; i < 3; i++) {
            j = (i + 1) % 3;
            cp[i] = (x[j] - x[i]) * (yp - y[i]) - (y[j] - y[i]) * (xp - x[i]);
        }

        if ((cp[0] > 0 && cp[1] > 0 && cp[2] > 0) ||
            (cp[0] < 0 && cp[1] < 0 && cp[2] < 0)) {
            puts("YES");
        }
        else {
            puts("NO");
        }
    }

    return 0;
}

Measured memory_bytes: 612
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    int H,W;
    cin >> H >> W;
    int A,B;
    cin >> A >> B;
    REP(i, H){
        REP(j, W){
            if(i < B){
                if(j < A){
                    cout << "1";
                }else{
                    cout << "0";
                }
            }
            else{
                if(j < A){
                    cout << "0";
                }else{
                    cout << "1";
                }
            }
        }
        cout << endl;
    }
}

Measured memory_bytes: 1280
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#define N_MAX 101
#define INF (1e9)
#define s second
#define f first
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P > P1;
void dijkstra();
int N,M,L,K,A,H,l,cost[N_MAX][N_MAX],x,y,t,d[N_MAX][N_MAX];
bool reitou[N_MAX];

int main(){
  while(1){
    cin>>N>>M>>L>>K>>A>>H;
    if(!N&&!M&&!L&&!K&&!A&&!H) break;
    for(int i=0;i<N_MAX;i++)
      for(int j=0;j<N_MAX;j++) reitou[j]=false,d[i][j]=cost[i][j]=INF;
    reitou[A]=reitou[H]=true;
    for(int i=0;i<L;i++) cin>>l,reitou[l]=true;
    for(int i=0;i<K;i++) cin>>x>>y>>t,cost[x][y]=cost[y][x]=t;
    dijkstra();
  }
  return 0;
}

void dijkstra(){
  priority_queue<P1,vector<P1 >,greater<P1 > > Q;
  d[0][A]=0;
  Q.push(P1(0,P(0,A)));
  while(!Q.empty()){
    P1 t=Q.top(); Q.pop();
    int c=t.f,time=t.s.f,u=t.s.s;
    if(c>d[time][u]) continue;
    for(int i=0;i<N;i++){
      if(cost[u][i]==INF) continue;
      if(reitou[u]){
	for(int j=time;j>=0;j--){
	  if(d[j][u]>c+time-j){
	    d[j][u]=c+time-j;
	    Q.push(P1(d[j][u],P(j,u)));
	  }
	  if(cost[u][i]<=M-j&&d[j+cost[u][i]][i]>c+cost[u][i]+time-j){
	    d[j+cost[u][i]][i]=c+cost[u][i]+time-j;
	    Q.push(P1(d[j+cost[u][i]][i],P(j+cost[u][i],i)));
	  }
	}
      }else{
	if(cost[u][i]<=M-time&&d[time+cost[u][i]][i]>c+cost[u][i]){
	  d[time+cost[u][i]][i]=c+cost[u][i];
	  Q.push(P1(d[time+cost[u][i]][i],P(time+cost[u][i],i)));
	}
      }
    }
  }
  int mincost=INF;
  for(int i=0;i<=M;i++) mincost=min(mincost,d[i][H]);
  if(mincost!=INF) cout<<mincost<<endl;
  else cout<<"Help!"<<endl;
}

Measured memory_bytes: 1500
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<algorithm>
#include<map>
#include<vector>
#define ll long long
using namespace std;
map<ll,int>mp;
struct DIAN
{
	int bh;
	long long d;
}ak[100010];
bool cmp(const DIAN&xx,const DIAN&yy)
{
	return xx.d>yy.d;
}
vector<int>G[100010];
ll sz[100010];
ll dep[100010];
int n;
void dfs(int x,int fx)
{
	int i;
	dep[x]=dep[fx]+1;
	for(i=0;i<G[x].size();i++)
	{
		if(G[x][i]==fx)continue;
		dfs(G[x][i],x);
	}
}
void dfss(int x,int fx)
{
	int i;
	for(i=0;i<G[x].size();i++)
	{
		if(G[x][i]==fx)continue;
		printf("%d %d\n",x,G[x][i]);
		dfss(G[x][i],x);
	}
}
int main()
{
	int i;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%lld",&ak[i].d);
		ak[i].bh=i;
		mp[ak[i].d]=i;
	}
	ll bli=ak[1].d;
	sort(ak+1,ak+n+1,cmp);
	for(i=1;i<n;i++)
	{
		sz[ak[i].bh]++;
		if(n-2*sz[ak[i].bh]<=0)
		{
			printf("-1\n");
			return 0;
		}
		ll qwq=ak[i].d-1ll*(n-2*sz[ak[i].bh]);
		if(mp.find(qwq)==mp.end())
		{
			printf("-1\n");
			return 0;
		}
		G[ak[i].bh].push_back(mp[qwq]);
		G[mp[qwq]].push_back(ak[i].bh);
		sz[mp[qwq]]+=sz[ak[i].bh];
	}
	dfs(1,0);
	ll alk=0;
	for(i=1;i<=n;i++)
		alk+=(dep[i]-1ll);
	if(alk!=bli)
	{
		printf("-1\n");
		return 0;
	}
	dfss(1,0);
	return 0;
}

Measured memory_bytes: 20864
#include<stdio.h>
int main(void) {
	int a, b;
	scanf("%d %d", &a, &b);
	if (a == 0 || b == 0) {
		printf("IMPOSSIBLE\n");
		return 0;
	}
	int ans = 0;

	ans = a - b;

	if (ans < 0) {
		ans = -1 * ans;
	}
	ans = ans / 2;
	//printf("%d\n", ans);
	int ans1;
	int ans2;
	ans1 = ans + a;
	ans2 = ans + b;
	//printf("%d\n", ans1);
	int hako1, hako2;

	hako1 = a - ans1;
	hako2 = b - ans1;
	if (hako1 < 0) {
		hako1 = -1 * hako1;
	}
	if (hako2 < 0) {
		hako2 = -1 * hako2;
	}
	//printf("%d %d\n", hako1, hako2);

	if (hako1 == hako2) {
		printf("%d\n", ans1);
		return 0;
	}
	ans1 = ans + a;
	ans2 = ans + b;



	hako1 = a - ans2;
	hako2 = b - ans2;
	if (hako1 < 0) {
		hako1 = -1 * hako1;
	}
	if (hako2 < 0) {
		hako2 = -1 * hako2;
	}

	if (hako1 == hako2) {
		printf("%d\n", ans2);
		return 0;
	}
	else {
		printf("IMPOSSIBLE\n");
		return 0;
	}
}


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

int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    ll ans = 0;
    sort(a.rbegin(), a.rend());
    rep(i,n-1){
            ans += a[(i+1)/2];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4760
//{{{By oToToT
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <bitset>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <random>
#include <utility>
#include <stack>
#include <sstream>
#include <functional>
#include <deque>
#include <cassert>
using namespace std;
/* include everything for Kotori~ <3 */

using lld = int64_t;
using llu = uint64_t;
using llf = long double;
using PII = pair<int,int>;
using PIL = pair<int,lld>;
using PLI = pair<lld,int>;
using PLL = pair<lld,lld>;
template<typename T>
using maxHeap = priority_queue<T,vector<T>,less<T>>;
template<typename T>
using minHeap = priority_queue<T,vector<T>,greater<T>>;
/* define some types for Ruby! */

#define FF first
#define SS second
#define SZ(x) (int)((x).size())
#define ALL(x) begin(x), end(x)
#define PB push_back
#define WC(x) while(x--)
/* make code shorter for Di~a~ */

template<typename Iter>
ostream& _out(ostream &s, Iter b, Iter e) {
	s<<"[";
	for ( auto it=b; it!=e; it++ ) s<<(it==b?"":" ")<<*it;
	s<<"]";
	return s;
}
template<typename A, typename B>
ostream& operator <<( ostream &s, const pair<A,B> &p ) { return s<<"("<<p.FF<<","<<p.SS<<")"; }
template<typename T>
ostream& operator <<( ostream &s, const vector<T> &c ) { return _out(s,ALL(c)); }
/* make output easier for Ainyan~n~ */

bool debug = 0;
#define DUMP(x) if(debug) cerr<<__PRETTY_FUNCTION__<<":"<<__LINE__<<" - "<<(#x)<<"="<<(x)<<'\n'
template<typename T>
void DEBUG(const T& x){if(debug) cerr<<x;}
template<typename T, typename... Args>
void DEBUG(const T& head,const Args& ...tail){
	if(debug){cerr<<head; DEBUG(tail...);}
}
/* Let's debug with Nico~Nico~Ni */
//}}}
const int N = 200000 + 5;

inline bool isOK(int,int);
int arr[N];

int main(int argc, char* argv[]){
	if(argc>1 and string(argv[1])=="-D") debug=1;
	if(!debug){ios_base::sync_with_stdio(0);cin.tie(0);}
	int n; cin >> n;
	for(int i=0;i<n;i++) cin >> arr[i];
	int l = 0, r = n;
	while(r-l>1){
		int mid = (l+r)>>1;
		if(isOK(mid-1, n)) r = mid;
		else l = mid;
	}
	cout<<r<<'\n';
	return 0;
}

inline bool isOK(int mx, int n){
	map<int,int> mp;
	for(int i=1;i<n;i++){
		if(arr[i]>arr[i-1]) continue;
		if(mx==0) return false;
		int p = arr[i];
		while(p>=1 and mp[p]==mx){
			p--;
		}
		if(p==0) return false;
		mp[p]++;
		auto it = mp.upper_bound(p);
		while(it!=mp.end()) it=mp.erase(it);
	}
	return true;
}

Measured memory_bytes: 1024
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever for (;;)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector<double> vd;
typedef std::vector<std::string> vs;
typedef std::vector<pii> vpii;
typedef std::vector<vi> vvi;
typedef std::vector<vpii> vvpii;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { rep(i,v.size()) is >> v[i]; return is; }
template<typename A, typename B> std::istream &operator>>(std::istream &is, std::pair<A, B> &p) { is >> p.first; is >> p.second; return is; }
using namespace std;
// clang-format on

bool isPrime(const int &n) {
  if (n == 1) return false;
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}

main {
  int n, x;
  while (cin >> n >> x, n) {
    vi v(n);
    cin >> v;
    vi dp(x + 1);
    dp[0] = true;
    rep(i, v.size()) rep(j, x + 1 - v[i]) dp[j + v[i]] |= dp[j];
    for (int i = x; i > 0; i--) {
      if (dp[i] && isPrime(i)) {
        cout << i << endl;
        goto next;
      }
    }
    cout << "NA" << endl;
  next:;
  }
}

Measured memory_bytes: 16672
class SegmentTree:
    def __init__(self, N_, element, function_=(lambda l, r: l + r)):
        """
        :param N_: セグ木のサイズ
        :param element: 単位元
        :param function: 子の要素に対して行われる計算,デフォルトだと加算
        """
        self.N = 1
        while self.N < N_:
            self.N *= 2

        self.element = element
        self.dat = [element for _ in range(self.N * 2)]
        self.function = function_

    def update(self, k, a):
        """k番目の値(0-indexed)をaに変更"""
        k += self.N - 1
        self.dat[k] = a

        while k > 0:
            k = (k - 1) // 2
            self.dat[k] = self.function(self.dat[2 * k + 1], self.dat[2 * k + 2])

    def query(self, begin, end, k=None, l=None, r=None):
        if k is None: return self.query(begin, end, 0, 0, self.N)

        if r <= begin or end <= l: return self.element
        if begin <= l and r <= end: return self.dat[k]

        vl = self.query(begin, end, k * 2 + 1, l, (l + r) // 2)
        vr = self.query(begin, end, k * 2 + 2, (l + r) // 2, r)
        return self.function(vl, vr)


n, q = map(int, input().split())
n += 1
treeone = SegmentTree(n, 2147483647, (lambda l, r: min(l, r)))

while q > 0:
    q -= 1
    tmp = list(map(int, input().split()))
    if tmp[0] is 0:
        treeone.update(tmp[1], tmp[2])
    else:
        print(treeone.query(tmp[1], tmp[2] + 1))



Measured memory_bytes: 9032
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <utility>
#include <string>
#include <stack>
#include <regex>
#include <numeric>
#include <queue>
 
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
 
using namespace std;
 
typedef long long ll;

int main(int argc, char const *argv[])
{
  string s,t;
  cin >> s >> t;
  REP(i,s.size()){
    std::rotate(s.rbegin(),s.rbegin()+1,s.rend());
    if (s == t) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main (void){
    int i,ans=0;
    int T; 
    int A,B; 

    scanf("%d",&A);
    scanf("%d",&B);
    scanf("%d",&T);

    for(i=1;i<=T;i++){
        if(i%A == 0){
            ans += B;
        }
    }

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

    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define  boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ull unsigned long long
#define d1(x) cout<<#x<<" "<<x<<endl;
#define d2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define d2i(x,y,i) cout<<#x<<i<<" "<<x<<" "<<#y<<i<<" "<<y<<endl;

#define fr(i,l,r) for(ll i=l;i<r;i++)
#define mems(a,x) memset(a,x,sizeof(a))
#define mod 1000000007
#define ff first
#define ss second
#define pb(x) push_back(x)
#define vll vector<ll>
#define pbp(x,y) push_back(make_pair(x,y))
#define  mat vector<vector<ll>>
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void solve(){
string s;
cin>>s;
if(s[2]==s[3] && s[4]==s[5])
   cout<<"Yes";
   else cout<<"No";


}

int main(){
    ll t=1;
  /// cin>>t;
    while(t--){
        solve();
        cout<<endl;
    }
    return 0;
}


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

using namespace std;

int main() {

	long long w, h, x, y;
	cin >> w >> h >> x >> y;

	if (x * 2 != w || y * 2 != h) {
		cout << (double)w * h / 2 << " 0" << endl;
	}
	else {
		cout << (double)w * h / 2 << " 1" << endl;
	}

}


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

using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> V(N);
  for(int i = 0; i < N; i++){
    cin >> V[i];
  }
  int ans = 1;
  sort(V.begin(), V.end(), greater<int>());
  for(int i = 1; i < N; i++){
    if(V[i-1] == V[i]) continue;
    ans++;
  }
  cout << ans;
}


Measured memory_bytes: 256
def main():
    sx, sy, tx, ty = map(int, input().split())
    
    gapx = tx - sx
    gapy = ty - sy
    ans = ""

    #一回目tからsへ
    ans += "U" * gapy
    ans += "R" * gapx
    ans += "D" * gapy
    ans += "L" * gapx

    #二回目
    ans += "L"
    ans += "U" * (gapy + 1)
    ans += "R" * (gapx + 1)
    ans += "D"
    ans += "R"
    ans += "D" * (gapy + 1)
    ans += "L" * (gapx + 1)
    ans += "U"

    print(ans) 


if __name__ == "__main__":
    main()

Measured memory_bytes: 61804
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
  ll n,m;
  cin >> n >> m;
  if(n==1){
    cout << max(m-2,n);
    return 0;
  }
  if(m==1){
    cout << max(n-2,m);
    return 0;
  }
  cout << n*m-(2*n+2*m-4);
}
     

Measured memory_bytes: 3560
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

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

const int INF = 1e9;
const long long LINF = 1e18;

typedef pair<int, int> P;

int main() {
    int H, W;
    cin >> H >> W;

    int cntDot = 0;
    vector<vector<char>> map(H, vector<char>(W));
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> map[i][j];

            if (map[i][j] == '.') {
                cntDot++;
            }
        }
    }

    vector<int> diffI = {0, 0, -1, 1};
    vector<int> diffJ = {1, -1, 0, 0};

    queue<P> q;
    q.push(P(0, 0));
    map[0][0] = 0;

    int reachGoal = false;
    while (!q.empty()) {
        P p = q.front();
        q.pop();

        if ((p.first == H - 1) && (p.second == W - 1)) {
            reachGoal = true;
            break;
        }

        for (int n = 0; n < 4; n++) {
            int newI = p.first + diffI[n];
            int newJ = p.second + diffJ[n];

            if (newI < 0 || H <= newI) {
                continue;
            }
            if (newJ < 0 || W <= newJ) {
                continue;
            }

            if (map[newI][newJ] != '.') {
                continue;
            }

            q.push(P(newI, newJ));
            map[newI][newJ] = map[p.first][p.second] + 1;
        }
    }

    if (!reachGoal) {
        cout << -1 << endl;
        return 0;
    }

    int dist = map[H - 1][W - 1];
    cout << cntDot - (dist + 1) << endl;
    return 0;
}


Measured memory_bytes: 504
#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>
#include <cmath>

int main(){
  long int N;
  std::cin>>N;
  std::vector<int> v(N);
  std::copy_n(std::istream_iterator<int>(std::cin),N,v.begin());
  long int S = 0;
  long int min_ab = std::fabs(v[0]);
  long int minuscount=0;
  for(long int i = 0 ; i < N ; i++ ){
    S += std::fabs(v[i]);
    if(min_ab >= std::fabs(v[i])){
      min_ab = std::fabs(v[i]);
    }
    if(v[i]<0) minuscount++;
  }
  if(minuscount % 2 == 0){
    std::cout<<S<<std::endl;
  }else{
    std::cout<<S-2*min_ab<<std::endl;
  }
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
typedef pair<int, int> P;
const int INT_MIN = -2147483647;

int main(){
  int N, M;
  while(cin>>N>>M && N){
    vector<P> p(N);
    REP(i, N){
      cin>>p[i].first>>p[i].second;
    }
    sort(p.begin(), p.end());
    REP(i, M){
      int x1, y1, x2, y2;
      scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
      vector<P>::iterator it = lower_bound(p.begin(), p.end(), P(x1, INT_MIN));
      vector<P>::iterator end = lower_bound(p.begin(), p.end(), P(x2 + 1, INT_MIN));
      int cnt = 0;
      while(it != end){
        if(it->second >= y1 && it->second <= y2) cnt++;
        it++;
      }
      printf("%d\n", cnt);
    }
  }
  return 0;
}

Measured memory_bytes: 1264
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <complex>
#include <ctime>
#include<bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(ll i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

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

using Graph = vector<vector<ll>>;

#define ketasitei setprecision(15) //15桁表示

const ll MOD = 1000000007;
const double PI = 3.1415926535897932;



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

	ll n;
	cin >> n;
	vector<ll> a(n);
	rep(i, n)
	{
		cin >> a[i];
	}

	vector<vector<ll>> rakusa(n, vector<ll>(n));
	for (int i = 0; i < n; i++)
	{
		for (int j = i; j < n; j++)
		{
			rakusa[i][j] = a[j] - a[i];
		}
	}

	vector<ll> dp(n, 1000);
	dp[0] = 1000;
	for (int i = 0; i < n-1; i++)
	{
		for (int j = i + 1; j < n; j++)
		{
			dp[j] = max((dp[i] / a[i]) * a[j] + dp[i] % a[i], max(dp[i], dp[j]));
		}
	}

	cout << dp[n - 1] << endl;

	return 0;
}

Measured memory_bytes: 3692
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 data[] = new int[N];
		double total = 0;
		int max = 0;
		for(int i = 0; i<N;i++) {
			data[i] = sc.nextInt();
			total += data[i];
		}
		for(int i = 0; i<N;i++) {
			for(int j =i+1 ;j<N;j++) {
				if(data[i]<data[j]) {
					int temp = data[i];
					data[i] = data[j];
					data[j] = temp;
				}
			}
		}
		
		
	
		boolean F= true;
		double s = 4*M;
		double t = total*(1/s);

		for(int i = 0; i<M; i++) {
			if((data[i] < total*(1/s)) ) {
				F = false;
			
				break;
			
		}
		}
		if(F!=true) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}
		
	}
	

}


Measured memory_bytes: 21844
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

N,K=get_i
A=get_i
gcd=A.inject(0){|res,x| res.gcd(x)}
if A.max>=K and (K.gcd(gcd)==gcd or A.index(K)!=nil)
    puts "POSSIBLE"
else
    puts "IMPOSSIBLE"
end

Measured memory_bytes: 9484
#include<stdio.h>
#include<string.h>
  
struct Node{
  int key;
  struct Node *right,*left,*parent;
};
  
struct Node *root,*NIL;
  
void insert(int k){
  struct Node *x=root;
  struct Node *y=NIL;
  struct Node *z;
  
  z=(struct Node *)malloc(sizeof(struct Node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  
  while( x!=NIL){
    y=x;
    if(z->key < x->key){
      x=x->left;
    }else{
      x=x->right;
    }
  }
  z->parent=y;
  if(y==NIL){
    root=z;
  }else{
    if(z->key < y->key){
      y->left=z;
    }else{
      y->right=z;
    }
  }
}
  
void inorder(struct Node *u){
  if(u==NIL)return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
  
void preorder(struct Node *u){
  if(u==NIL)return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}
  
int main(){
  int n,i,x;
  int a=0,b=0;
  char A[10];
  
  scanf("%d",&n);
  
  for(i=0;i<n;i++){
    scanf("%s",A);
      
    if(strcmp(A,"insert")==0)
      {
    scanf("%d",&x);
    insert(x);
      }
  
     if(strcmp(A,"print")==0)
      {
    inorder(root);
    printf("\n");
    preorder(root);
    printf("\n");
      }
  }
  
  return 0;
}

Measured memory_bytes: 24040
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
int n;
#define MAXN 1010
int f[MAXN];
struct edge
{
	int to,nxt;
}e[MAXN << 1];
int edgenum = 0;
int lin[MAXN] = {0};
void add(int a,int b)
{
	++edgenum;e[edgenum].to = b;e[edgenum].nxt = lin[a];lin[a] = edgenum;
	++edgenum;e[edgenum].to = a;e[edgenum].nxt = lin[b];lin[b] = edgenum;
	return;
}
int x[MAXN];
int g[2][MAXN * 5];
int fa[MAXN];
void dp(int k)
{
	for(int i = lin[k];i != 0;i = e[i].nxt)
	{
		if(fa[k] == e[i].to)continue;
		fa[e[i].to] = k;
		dp(e[i].to);
	} 
	memset(g[0],0x3f,sizeof(g[0]));
	int cur = 0;
	g[cur][0] = 0;
	for(int i = lin[k];i != 0;i = e[i].nxt)
	{
		if(fa[k] == e[i].to)continue;
		cur = cur ^ 1;
		memset(g[cur],0x3f,sizeof(g[cur]));
		for(int j = 0;j <= x[k];++j)
		{
			if(j >= f[e[i].to])g[cur][j] = min(g[cur][j],g[cur ^ 1][j - f[e[i].to]] + x[e[i].to]);
			if(j >= x[e[i].to])g[cur][j] = min(g[cur][j],g[cur ^ 1][j - x[e[i].to]] + f[e[i].to]);
		}
	}
	for(int i = 0;i <= x[k];++i)
	{
		f[k] = min(f[k],g[cur][i]);
	}
	return;
}
int main()
{
	scanf("%d",&n);
	int a;
	for(int i = 2;i <= n;++i)
	{
		scanf("%d",&a);
		add(a,i);
	}
	for(int i = 1;i <= n;++i)
	{
		scanf("%d",&x[i]);
	}
	memset(f,0x3f,sizeof(f));
	dp(1);
	if(f[1] < 0x3f3f3f3f)puts("POSSIBLE");
	else puts("IMPOSSIBLE");
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cmath>
using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)
const double pi = acos(-1);
double rad(double d) {
	return pi / 180 * d;
}
int main(){
	double a, b, c, d;
	const double R = 6378.1;
	while(cin >> a >> b >> c >> d && (a != -1 && b != -1 && c != -1 && c != -1)) {
		a = rad(a);
		b = rad(b);
		c = rad(c);
		d = rad(d);
		cout << floor(R * acos(sin(a)*sin(c) + cos(a)*cos(c)*cos(d-b)) + 0.5) << endl;
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MOD 1000000007
#define INF 1000000000

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x = 0) :x((x% mod + mod) % mod) {}
	mint operator-() const { return mint(-x); }
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};

// nCr
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
// usage:
//   combination comb(n+5);
//   ans = comb(n,r);
struct combination {
	vector<mint> fact, ifact;
	combination(int n) :fact(n + 1), ifact(n + 1) {
		assert(n < mod);
		fact[0] = 1;
		for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
		ifact[n] = fact[n].inv();
		for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
	}
	mint operator()(int n, int k) {
		if (k < 0 || k > n) return 0;
		return fact[n] * ifact[k] * ifact[n - k];
	}
};

void solve_abc_d() {
	ll n, m;
	ll a, b;
	//ll x, y;
	ll h, w;
	ll k;
	ll l_ans = 0;

	cin >> h >> w >> a >> b;

	mint ans = 0;

	combination comb(200000);
	vector<mint> x(w - b);
	rep(i, w - b) {
		x[i] = comb(b + i + h - a - 1, h - a - 1);
	}
	rep(i, w - b) {
		ans += x[i] * comb(w - b - i - 1 + a - 1, w - b - i - 1);
	}

	cout << ans.x << "\n";

	return;
}

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed;
	cout << setprecision(15);

	solve_abc_d();

	return 0;
}


Measured memory_bytes: 7012
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  
  bool flag=false;
  rep(k,b){
    if( c%b == (k*a)%b ) flag = true;
  }
  
  if(flag) cout << "YES" << endl;
  else cout << "NO" << endl;

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int a, b, d, r;
	double A, B, f;
	scanf("%d %d", &a, &b);
	d = a / b;
	r = a % b;
	A = a;
	B = b;
	f = A / B;
	printf("%d %d %f\n", d, r, f);
	return 0;
}

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

struct res {
    int i;
    string s;
    int p;
    bool operator<(const res &another) const {
        if (s==another.s){
            return p > another.p; 
        }
        return s < another.s;
    }
};

int main(void) {
    int N;
    cin >> N;
    vector<struct res> A;
    for (int i=0;i<N;i++){
        struct res a;
        a.i = i+1;
        cin >> a.s >> a.p;
        A.push_back(a);
    }
    sort(A.begin(),A.end());

    for(vector<struct res>::iterator itr=A.begin();itr!=A.end();itr++){
        cout << itr->i <<endl;
    }

    return 0;
}


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

typedef long long ll;
const int NMAX = 2e5 + 10;
const int MOD = 1e9 + 7;


int main(int argc, char const *argv[])
{
	int n;
	scanf("%d",&n);
	int dig = n % 10;
	if(dig == 3)
		puts("bon");
	else if(dig == 0 || dig == 1 || dig == 6 || dig == 8)
		puts("pon");
	else 
		puts("hon"); 
	return 0;
}

Measured memory_bytes: 3688
#include<stdio.h>
int main(void){
   int n, e, p, q, i, count, sum[10000];
   scanf("%d", &n);
   while ( n != 0 ) {
      count = 0;
      for ( i = 0; i < n; i++ ) {
         scanf ("%d %d %d", &e, &p, &q);
         sum[e] += p * q;
         if ( sum[e] >= 1000000 ) {
            printf("%d\n", e);
            count++;
            sum[e] = 0;
         }
      }
      if ( count == 0 ) printf("NA\n");
      for ( i = 0; i < 4000; i++ ) sum[i] = 0;
      scanf("%d", &n);
   }
   return 0;
}

Measured memory_bytes: 1700
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int i = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int MOD = 1e9 + 7;

int main() {
    int a, b;
    cin >> a >> b;
    vector<int> tower(1001);
    int dif = b - a;
    for(int i = 1; i <= 999; i++) {
        tower[i] = i + tower[i - 1];
    }
    for(int i = 1; i < 999; i++) {
        if(dif == tower[i + 1] - tower[i]) {
            cout << tower[i] - a << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
#include<map>
#include<cmath>
#include<complex>
using namespace std;

typedef complex<double> P;

#define X real()
#define Y imag()


int main(){
    int mod=1000000007;
    int ax, ay;
    char f[12][12];
    int c[5];
    while (scanf("%d,%d,%d,%d,%d",&c[0],&c[1],&c[2],&c[3],&c[4])!=EOF) {
        vector<int> card(5);
        for (int i=0;i<5;++i) {
            card[i]=c[i];
        }
        sort(card.begin(),card.end());
        if ((card[1]==card[2] && card[2]==card[3]) && (card[0]==card[1] || card[4]==card[3])) printf("four card\n");
        else if ((card[0]==card[1] && card[3]==card[4]) && (card[2]==card[1] || card[2]==card[3])) printf("full house\n");
        else if (card[0]==card[1]-1 && card[1]==card[2]-1 && card[2]==card[3]-1 && card[3]==card[4]-1) printf("straight\n");
        else if (card[0]==1 && card[1]==10 && card[2]==11 && card[3]==12 && card[4]==13) printf("straight\n");
        else if ((card[0]==card[1] && card[1]==card[2]) || (card[1]==card[2] && card[2]==card[3]) || (card[2]==card[3] && card[3]==card[4])) printf("three card\n");
        else if ((card[0]==card[1] && (card[2]==card[3] || card[3]==card[4])) || (card[1]==card[2] && card[3]==card[4])) printf("two pair\n");
        else if (card[0]==card[1] || card[1]==card[2] || card[2]==card[3] || card[3]==card[4]) printf("one pair\n");
        else printf("null\n");
    }
    return 0;
}

Measured memory_bytes: 3168
#include <bits/stdc++.h>
// #include <atcoder/all>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, n) for (ll i = 1; i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
// using namespace atcoder;
void Main()
{
    ll n;
    cin >> n;

    vector<ll> A(n), B(n);
    rep(i, n) cin >> A[i] >> B[i];
    
    typedef pair<ll, ll> P;
    vector<P> p;
    rep(i, n) p.push_back(P{B[i], A[i]});
    sort(all(p));
    reverse(all(p));

    ll cur = p[0].first;
    rep(i, n) {
        ll a = p[i].second;
        ll b = p[i].first;
        cur = min(cur, b) - a;
    }

    yorn(cur >= 0);
}
signed main(){ Main();return 0;}

Measured memory_bytes: 10564
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int sum = a+b;
        if (sum >= 10) 
        {
            System.out.println("error");
        }
        else {
            System.out.println(sum);
        }
    }
}

Measured memory_bytes: 23636
import copy
n = int(input())
l = list(map(int, input().split()))
s = copy.deepcopy(l)
m = 1
print(*s)
for i in range(1,n):
    count = 0
    for j in range(0,m):
        if s[i] < l[j]:
            l.insert(j, l[i])
            l.pop(i+1)
            m+=1
            count += 1
            break
    if count == 0:
        l.insert(m, l[i])
        l.pop(i+1)
        m+=1

    print(*l)


Measured memory_bytes: 6668
#include<stdio.h>

int main() {
	int r, c, i, j;
	int a[101][101] = { 0 };

	scanf("%d %d", &r, &c);

	for (i = 0; i < r; i++) {
		for (j = 0; j < c; j++) {
			scanf("%d", &a[i][j]);

			a[i][c] += a[i][j];
			a[r][j] += a[i][j];
			a[r][c] += a[i][j];
		}
	}

	for (i = 0; i < r + 1; i++) {
		for (j = 0; j < c + 1; j++) {
			if (j == c)printf("%d", a[i][j]);
			else printf("%d ", a[i][j]);
		}
		printf("\n");
	}

	return 0;
}


Measured memory_bytes: 2100
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
    int N, M, ans = 0;
    cin >> N >> M;

    for (int k = 1; k*k <= M; k++) {
        if (M % k == 0) {
            if (k <= M / N) {
                ans = max(ans, k);
            }
            if ( (M / k) <= M / N) {
                ans = max(ans, M/k);
            }
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#define N 100005
using namespace std;

int n, m, s, a[N];
bool v[N];
int main()
{
	int i, t1, t2;
	cin >> n >> m;
	for (i = 1; i <= n; i++) a[i] = 1;
	v[1] = 1;
	while (m--) {
		scanf("%d %d", &t1, &t2);
		if (v[t1]) v[t2] = 1;
		a[t1]--; a[t2]++;
		if (!a[t1]) v[t1] = 0;
	}
	for (i = 1; i <= n; i++) s += v[i];
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 768
package main

import (
	"fmt"
)

func main() {
	var k,a,b int
	fmt.Scan(&k,&a,&b)
	
	for i := a; i <= b; i++ {
		if i % k == 0 {
			fmt.Println("OK")
			return
		}
	}
	fmt.Println("NG")
}

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

const int Nmax=200010;
//#define FOR(i,a,b) for(int i=(a);i<(b);i++)
//#definr REP(i,n) FOR(i,0,n)
//#define dump(x) cout << #x << "=" << (x) << endl;
//#define debug(x) cout << #x << "=" << (x) << "(L" << _LINE_ << ")" << "" << _FILE_ << endl;
//ll a[Nmax];
//int* P = new int[N];

int main() {
	char S[3];
	int a=0;
	for(int i=0;i < 3;i++){
		cin >> S[i];
		if(S[i] == 'a') a++;
		if(S[i] == 'b') a+=10;
		if(S[i] == 'c') a+=100;
	}
	if(a == 111) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

N, M = map(int, raw_input().split())
a = []
for i in xrange(M):
    a.append(map(int, raw_input().split()))

s1=set()
s2=set()
for i in xrange(M):
    if a[i][0]==1:
        s1.add(a[i][1])
    if a[i][1]==N:
        s2.add(a[i][0])
if s1 & s2:
    print 'POSSIBLE'
else:
    print 'IMPOSSIBLE'


Measured memory_bytes: 42096
import numpy as np

CARD_SIZE = 3


def solve(card, called_numbers):
    checked_card = np.vectorize(lambda n: n in called_numbers)(card)

    for l in checked_card:
        if all(l):
            return True

    for l in zip(*checked_card):
        if all(l):
            return True

    if all([checked_card[n][n] for n in range(CARD_SIZE)]):
        return True
    if all([checked_card[n][CARD_SIZE - n - 1] for n in range(CARD_SIZE)]):
        return True

    return False


def resolve():
    card = [[int(row) for row in input().split()] for _ in range(CARD_SIZE)]

    N = int(input())
    called_numbers = {int(input()) for n in range(N)}

    ret = solve(card, called_numbers)

    print("Yes" if ret else "No")


if __name__ == '__main__':
    resolve()

Measured memory_bytes: 27032
#include<stdio.h>
#include <sstream>
#include <iostream>
#include <cstdlib>
 
using namespace std;
 
#define BUF_SIZE 1024
#define ARRAY_SIZE 100
 
int main(){
 
    char buf[BUF_SIZE] = {0};
    int n = atoi(fgets(buf,BUF_SIZE,stdin));
 
    int array[ARRAY_SIZE] = {0};
 
    for(int i = 0; i < n; i++){
        cin >> array[i];
    }
 
    for(int k = 0;k < n; k++){
        if(k != n-1){
            printf("%d ",array[k]);
        }else{
            printf("%d\n",array[k]);
        }
    }
 
    int v = 0;
    int j = 0;
    for(int i = 1; i < n; i++){
        v = array[i];
        j = i-1;
        while(j >= 0 && array[j] > v){
            array[j+1] = array[j];
            j--;
        }
        array[j+1] = v;
        for(int k = 0;k < n; k++){
            if(k != n-1){
                printf("%d ",array[k]);
            }else{
                printf("%d\n",array[k]);
            }
        }
    }
 
}


Measured memory_bytes: 3160
#include <iostream>
#include <cstdio>
#include <vector>
#include <complex>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <stack>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <cassert>

using namespace std;

typedef long long ll;
typedef ll li;
typedef pair<int,int> PI;
#define EPS (1e-10L)
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define F first
#define S second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SZ(a) (int)((a).size())
#define ALL(a) a.begin(),a.end()
#define FOR(it,a) for(__typeof(a.begin())it=a.begin();it!=a.end();++it)
void pkuassert(bool t){t=1/t;};
int dx[]={0,1,0,-1,1,1,-1,-1};
int dy[]={1,0,-1,0,-1,1,1,-1};

int n;
int L[1000];

void solve(){
  rep(i,n) cin >> L[i];
  pair<pair<double,int>,PI> ans;
  ans.F.F=10000000000000LL;
  rep(s,16)rep(a,16)rep(c,16){
    int r=s;
    map<int,int> app;
    rep(i,n){
      r=(a*r+c)&255;    
      int o=(r+L[i])&255;
      app[o]++;
    }
    double p=0;
    FOR(it,app) p-=it->S*log(it->S*1./n)/n;
    if(ans.F.F>p+EPS){
      ans=mp(mp(p,s),mp(a,c));
    }

  }
  cout << ans.F.S << ' ' << ans.S.F << ' ' << ans.S.S << endl;
}

int main(int argc, char *argv[])
{
  while(cin >> n && n) solve();
  return 0;
}

Measured memory_bytes: 1248
//abc088_b.cpp
//Sun Feb 18 19:35:30 2018

#include <iostream>
#include <string>
#include <algorithm>
#include <functional>

using namespace std;

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

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

	sort(a,a+n,greater<int>());

	int flag = 0;
	int alice = 0;
	int bob = 0;

	for (int j=0;j<n;j++){
		if (flag == 0){
			alice = alice + a[j];
			flag = 1;
		}else{
			bob = bob + a[j];
			flag = 0;
		}
	}

	cout << alice-bob << endl;
}

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

int x, y, c = 0, sx = 0, sy = 0, i = 1, j = 1;

bool in(int x, int y) {
	if (c % 4 == 0 && sx <= x && sx + j - 1 >= x && sy <= y && sy + j - 1 >= y)
		return true;
	else if (c % 4 == 1 && sx >= x && sx - j + 1 <= x && sy <= y && sy + j - 1 >= y)
		return true;
	else if (c % 4 == 2 && sx >= x && sx - j + 1 <= x && sy >= y && sy - j + 1 <= y)
		return true;
	else if (c % 4 == 3 && sx <= x && sx + j - 1 >= x && sy >= y && sy - j + 1 <= y)
		return true;
	else
		return false;
}

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

	while (!in(x, y)) {
		int m = i + j - 1;

		if (c % 4 == 0)
			sx += m;
		else if (c % 4 == 1)
			sy += m;
		else if (c % 4 == 2)
			sx -= m;
		else
			sy -= m;

		int w = i;
		i = i + j;
		j = w;

		c++;
	}

	cout << (c % 3) + 1 << endl;

	return 0;
}


Measured memory_bytes: 3108