akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define L long long
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define pii pair<pi,int>
#define aa first
#define bb second
#define xx aa.aa
#define yy aa.bb
#define zz bb
#define mp make_pair
#define mpp(a,b,c) mp(mp(a,b),c)
using namespace std;
int n;
pi x[200010];
L p;
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int i,j,k,l;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	  {
	   scanf("%d%d",&x[i].aa,&x[i].bb);
	   if(x[i].aa>x[i].bb)
	     swap(x[i].aa,x[i].bb);
	  }
	sort(x+1,x+n+1);
	for(i=1,j=2e9,k=0;i<=n;i++)
	  j=min(j,x[i].bb),k=max(k,x[i].bb);
	p=(L)(x[n].aa-x[1].aa)*(k-j);
	l=k-x[1].aa;
	x[n+1].aa=2e9;
	for(i=1,j=2e9,k=x[n].aa;i<=n;i++)
	  {
	   j=min(j,x[i].bb);
	   k=max(k,x[i].bb);
	   p=min(p,(L)l*(k-min(j,x[i+1].aa)));
	  }
	printf("%lld\n",p);
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <sstream>

using namespace std;

int main() {
	int argN, argK;
	cin >> argN >> argK;

	vector<int> argL(argN);
	for (int i = 0; i < argN; ++i) {
		cin >> argL.at(i);
	}

	sort(argL.begin(), argL.end(), greater<int>());
	int ret = accumulate(argL.begin(), argL.begin() + argK, 0);

	cout << ret << endl;
}

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

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
ostream &operator<<(ostream &os, pair<ll, ll>&p){
  return os << p.first << " " << p.second;
}  
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  //cout<<fixed<<setprecision(10);
  ll res=0,buf=0;
  bool judge = true;
  ll n;cin>>n;
  vector<vector<ll>>x(n),y(n);
  vector<ll>b(n);
  rep(i,0,n){
    cin>>b[i];
    rep(j,0,b[i]){
      ll p,q;cin>>p>>q;
      x[i].PB(p);
      y[i].PB(q);
    }
  }
  rep(i,0,1<<n){
    bitset<15>k=i;
    judge=true;
    ll ret=0;
    rep(j,0,n){
      if(k[j])ret++;
      else continue;
      rep(o,0,b[j]){
        if(k[x[j][o]-1]^y[j][o])judge=false;
      }
    }
    if(judge)chmax(res,ret);
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
typedef long long ll;
typedef unsigned long long ull;
typedef long double LD;
using namespace std;
const int INF = 2147483647;
const int INF2 = 0x3f3f3f3f;
const ll INF64 = 1e18;
const double INFD = 1e30;
const double EPS = 1e-6;
const double PI = 3.14159265;
const ll MOD = 1e9 + 7;
template <typename T>
inline T read() {
    T X = 0, w = 0;
    char ch = 0;
    while (!isdigit(ch)) {
        w |= ch == '-';
        ch = getchar();
    }
    while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
    return w ? -X : X;
}
const int MAXN = 100005;
int n, m, k;
int dr[4] = {1, 0, -1, 0};
int dc[4] = {0, 1, 0, -1};
int dr2[8] = {1, 1, 1, -1, -1, -1, 0, 0};
int dc2[8] = {1, 0, -1, 1, 0, -1, 1, -1};
int CASE = 1;

int arr[MAXN];
int tot;
char text[MAXN];

int main() {
#ifdef LOCALLL
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    scanf("%d", &n);
    scanf("%s", text);
    if (n < 3) {
        printf("0\n");
        return 0;
    }
    int cnt = 0;
    for (int i = 0; i < n - 2; i++) {
        if (text[i] == 'A' && text[i + 1] == 'B' && text[i + 2] == 'C') {
            cnt++;
        }
    }
    printf("%d", cnt);
    return 0;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10**7)

def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    visited = [False] * N
    cnt = [0] * N
    visited[0] = True
    B = [0]
    def dfs(s):
        tmp = A[s] - 1
        

        if visited[tmp]:
            B[0] = cnt[tmp]
            for i in range(N):
                if i == tmp:
                    continue
                cnt[i] -= cnt[tmp]
            cnt[tmp] = 0
            return
        
        cnt[tmp] = cnt[s] + 1
        visited[tmp] = True
        if cnt[tmp] == K:
            print(tmp + 1)
            exit()
        dfs(tmp)
    dfs(0)
    K -= B[0]
    t = K % (max(cnt)+1)
    for i in range(N):
        if cnt[i] == t:
            print(i+1)
            exit()
        
if __name__ == "__main__":
    main()

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

#define fi first
#define se second
#define pb push_back
#define mod(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,a,b) for(int i = a; i < b; i++)
#define forr(i,a,b) for(int i = a; i >= b; i--)
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;


#define si cout << "Yes\n";
#define no cout << "No\n";

ld get(int l,int r,vector<ld> &ac){
	ld res = ac[r];
	if(l-1 >= 0)res -= ac[l-1];
	return res;
}
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	int N,K; cin >> N >> K;
	vector<ld> ac(N);
	forn(i,0,N){
		ld x; cin >> x;
		ac[i] = x;
		if(i)ac[i] += ac[i-1];
	}
	vector<ld> res;
	forn(i,0,N){
		if(i-K+1 >= 0){
			res.pb(get(i-K+1,i,ac));
		}
	}
	forn(i,1,(int)res.size()){
		if(res[i] > res[i-1]){
			si;
			continue;
		}
		no;
	}
	return 0;
}
/*
__builtin_mul_overflow(x,y,&x)
-fsplit-stack
*/


Measured memory_bytes: 10616
import java.util.*;
import java.util.stream.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int mod = (int)1e9 + 7;
        int n = sc.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        int[] c = new int[n-1];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            b[i] = sc.nextInt();
        }
        for (int i = 0; i < n-1; i++) {
            c[i] = sc.nextInt();
        }
        int ans = b[a[0]-1];
        for (int i = 1; i < n; i++) {
            ans += b[a[i]-1];
            if (a[i-1] + 1 == a[i]) {
                ans += c[a[i-1]-1];
            }
        }
        System.out.println(ans);
    }

}


Measured memory_bytes: 21204
import sys
stdin = sys.stdin
mod = 10**9 + 7

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))


n, a, b = na()
sum_min = a * (n-1) + b
sum_max = a + (n-1) * b

if n == 0 and a != b:
    print(0)
else:
    print(max(0, sum_max - sum_min + 1))

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<bitset>
#include<sstream>
#include<list>
#include<climits>

using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define nrep(i,i0,n) for(int i=(i0);i<(int)(n);++i)
typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vii;
typedef long long ll;


int main(){
	int n;scanf("%d",&n);
	vi a(n);
	rep(i,n)cin>>a[i];
	sort(a.begin(),a.end(),greater<int>());
	int ret=0;
	rep(i,n){
		if(i%2==0)ret+=a[i];
		else ret-=a[i];
	}
	cout<<ret<<endl;
	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<math.h>
#include<vector>
#include<algorithm>
#include<string.h>
#include<iomanip>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug" << x << endl;
using namespace std;

int main(){
    int n, m;
    bool open = false;
    map<string, int> door;
    cin >> n;
    while(n--){
        string input;
        cin >> input;
        door[input] = 1;
    }
    cin >> m;
    while(m--){
        string input;
        cin >> input;
        if(door.find(input) == door.end()){
            cout << "Unknown " << input << endl;
        }else{
            if(door[input] == 1 && open == false){
                cout << "Opened by " << input << endl;
                open = true;
            }else if(door[input] == 1 && open == true){
                cout << "Closed by " << input << endl;
                open = false;
            }
        }

    }
}

Measured memory_bytes: 1236
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main() {
	int r,D,x; cin >> r >> D >> x;
	rep(i,10) {
		x = r*x-D;
		cout << x << endl;
	}

}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{long long  int a,b,c;
scanf("%lld%lld%lld",&a,&b,&c);
long long int y=a*b;
long long int x=c-a-b;

if(x<=0)
{
	printf("No");
	return 0;
}
else 
{
	if(x%2==1)
	{
		if((x/2)*(x/2)+x/2>=y)
		printf("Yes");
		else 
		printf("No");
	}
	else 
	{
		
		if((x/2)*(x/2)>y)
		printf("Yes");
		else 
		printf("No");
	}
	return 0;
}
}


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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

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

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { return a * b / GCD(a, b); }

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

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main(){
  cin.tie( 0 ); ios::sync_with_stdio( false );
  int n;
  ll k;
  cin>>n>>k;
  vector<ll> a(n);
  rep(i,n) cin>>a[i];
  
  ll ans=0;
  ll now=0;
  
  for(int i=40; i>=0; i--){
    ll mask=1LL<<i;
    int cnt=0;
    rep(j,n){
      if(a[j]&mask)cnt++;
    }
    if(cnt>=n-cnt){ // 現在の桁について 1の個数 >= 0の個数 だから、反転させる必要はない
      ans+=(ll)cnt*mask;
    }else{
      if(mask+now<=k){
        ans+=(ll)(n-cnt)*mask;
        now+=mask;
      }else{
        ans+=(ll)cnt*mask;
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1024
def makePrime(n):
    i = 3
    while i*i < n:
        for p in P:
            if i%p == 0:
                i += 2
                break
        P.append(i)
        i += 2

X = int(input())
if X == 2:
    print(2)
    exit()
P = [2]
makePrime(X)
flg = 0
while 1:
    flg = 1
    for p in P:
        if X%p == 0:
            flg = 0
            X += 1
            break
    if flg:
        print(X)
        exit()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long 
#define ld long double
#define pb push_back
#define vl vector
#define ff first
#define ss second
using namespace std;
int main()
{
    ll a,b,i,j,n,t;
    cin>>a;
    string s;
    cin>>s;
    if(a>=3200) cout<<s;
    else cout<<"red";
}

Measured memory_bytes: 3576
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
using namespace std;
typedef long long ll;
typedef long long int llint;
typedef pair<ll, ll> pa;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define MAX_T 1001
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define INF (1 << 29) //536870912
const long double PI = acos(-1);
const ll DEP = 1e18;
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int main(){
    int a,b,c; cin >> a >> b >> c;
    if(b-a == c-b){
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 1<<31-1
#define LNF 9223372036854775807
#define PI 3.14159265358979
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
//#define MOD 998244353
#define NUM 100005

void swap(int* a,int* b){int tmp=*a;*a=*b;*b=tmp;}
int abs(int a){if(a<0)return -a;return a;}
int dup(int a,int d){if(a%d==0)return a/d;else return a/d+1;}
int mod(int a,int m){if(a<0)return a%m+m;else return a%m;}
int GCD(int a,int b){int c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
int LCM(int a,int b){return a*b/GCD(a,b);}
int POW(int a,int n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return (int)ans;}
int icmp(const void* a,const void* b){return *(int*)a-*(int*)b;}
int lcmp(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return 1;if(*(LL*)a<*(LL*)b)return -1;return 0;}
int ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;}
int scmp(const void* a,const void* b){return strcmp(*(char**)a,*(char**)b);}
LL fac[NUM],finv[NUM],inv[NUM];
void comi(){int i;fac[0]=fac[1]=1;finv[0]=finv[1]=1;inv[1]=1;FOR(i,2,NUM){fac[i]=fac[i-1]*i%MOD;inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;finv[i]=finv[i-1]*inv[i]%MOD;}}
int com(int n,int k){if(n<k||n<0||k<0)return 0;return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;}

int main(){
  int N,i,b=1,ans=0;
  scanf("%d",&N);
	int a[N];
	FOR(i,0,N)scanf("%d",&a[i]);
	FOR(i,0,N)if(a[i]==b)b++;
	ans=N-b+1;
	if(ans==N)ans=-1;

	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 896
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<unordered_map>
#include<random>
#include<fstream>
#include<iterator>
#include <numeric>
#include <chrono>

using namespace std;

int main() {

	std::ios::sync_with_stdio(false);
	std::cin.tie(0);


	int n;

	cin >> n;

	vector<int>a(n);

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

	int min = *std::min_element(a.begin(), a.end());
	int max = *std::max_element(a.begin(), a.end());

	cout << abs(max - min);
	

}

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

#define EPS (1e-10)
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)
#define all(a) a.begin(), a.end()

using namespace std;
using ll = long long;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvb = vector<vb>;

constexpr int MOD = 1000000007;

bool check(char s1, char s2) {
    if (int(s1 - '0') >= 2) { return false; }
    if (int(s1 - '0') == 1 && int(s2 - '0') >= 3) { return false; }
    if (int(s1 - '0') == 0 && int(s2 - '0') == 0) { return false; }
    return true;
}

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

    string s;
    cin >> s;

    bool yymm = check(s[2], s[3]), mmyy = check(s[0], s[1]);

    if (yymm && mmyy) { cout << "AMBIGUOUS" << endl; }
    if (yymm && !mmyy) { cout << "YYMM" << endl; }
    if (!yymm && mmyy) { cout << "MMYY" << endl; }
    if (!yymm && !mmyy) { cout << "NA" << endl; }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
using namespace std;
typedef pair<int, int> P;

const int MAX_N = 1e5 + 1;

int x[MAX_N], y[MAX_N], w[MAX_N];

bool judge(vector<P> z, int border) {
    if (z[0].first > 0) return false;
    bool is_exist = false;
    for (int i = 0; i < z.size(); i++) {
        if (z[i].second >= border) {
            is_exist = true;
            break;
        }
    }
    if (!is_exist) return false;
    int max_z = 0;
    for (int i = 0; i < z.size(); i++) {
        if (max_z < z[i].first) {
            return false;
        }
        max_z = max(max_z, z[i].second);
    }
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, W, H;
    cin >> N >> W >> H;
    vector<P> X(N), Y(N);
    for (int i = 0; i < N; i++) {
        cin >> x[i] >> y[i] >> w[i];
        X[i] = P(max(0, x[i] - w[i]), min(W, x[i] + w[i]));
        Y[i] = P(max(0, y[i] - w[i]), min(H, y[i] + w[i]));
    }
    sort(X.begin(), X.end());
    sort(Y.begin(), Y.end());
    if (judge(X, W) || judge(Y, H)) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 7072
#include<stdio.h>

int main(void){
    int A,B,K;
    scanf("%d %d %d",&A,&B,&K);
    int count = B-A+1;
    if(B-A+1<=2*K){
        for(int i=A;i<=B;i++){
            printf("%d\n",i);
        }
        return 0;
    }else{
        for(int i=0;i<K;i++){
            printf("%d\n",A+i);
        }
        for(int i=B-K+1;i<=B;i++){
            printf("%d\n",i);
        }
        return 0;
    }
    return 0;
}

Measured memory_bytes: 128
package main

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

func main() {
  input := Input{bufio.NewReaderSize(os.Stdin,1000000)}
  n,m := input.NextInts()
  k := make([][]int,m)
  for i:=0;i<m;i++ { k[i] = input.NextIntArray() }
  p := input.NextIntArray()
  u := 1
  a := 0
  for i:=0;i<n;i++ { u *= 2 }
  Loop:
  for i:=0;i<u;i++ {
    s := strconv.FormatInt(int64(i),2)
    for len(s) < n { s = "0"+s }
    t := make([]int,m)
    for j:=0;j<n;j++ {
      if s[j:j+1] == "0" { continue }
      for x:=0;x<m;x++ {
        for y:=1;y<k[x][0]+1;y++ {
          if k[x][y] == j+1 { t[x]++ }
        }
      }
    }
    for x:=0;x<m;x++ {
      if t[x]%2 != p[x] { continue Loop }
    }
    a++
  }
  fmt.Println(a)
}

type Input struct {
  reader *bufio.Reader
}
func(i *Input) NextLine() string {
  var buffer []byte
  for {
    line,isPrefix,err := i.reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func(i *Input) NextInts() (int,int) {
  s := strings.Split(i.NextLine()," ")
  x,_ := strconv.Atoi(s[0])
  y,_ := strconv.Atoi(s[1])
  return x,y
}
func(i *Input) NextIntArray() []int {
  s := strings.Split(i.NextLine()," ")
  a := make([]int,len(s))
  for i:=0;i<len(s);i++ { a[i],_ = strconv.Atoi(s[i]) }
  return a
}

Measured memory_bytes: 768
#include<stdio.h>

int main(){
  int n,i;
  int tmp1;
  scanf("%d",&n);
  tmp1 = 100000;
  for(i=0;i<n;i++){
      tmp1=tmp1*105/100;
      if(tmp1%1000>0){
        tmp1=tmp1+1000-tmp1%1000;
      }
  }

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

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

#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 ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;

template<typename T> vector<T> compress(vector<T> &C1){
    vector<T> vals;
    int N = (int)C1.size();
    REP(i,N){
        vals.push_back(C1[i]);

        //vals.push_back(C2[i]);
        //vals.push_back(C2[i]+1);
    }

    sort(ALL(vals));
    vals.erase(unique(ALL(vals)), vals.end());

    REP(i,N){
        C1[i] = lower_bound(ALL(vals), C1[i]) - vals.begin();
        //C2[i] = lower_bound(ALL(vals), C2[i]) - vals.begin();
    }

    return vals;
}

int main() {
    int N,K; cin >> N >> K;
    vector<ll> X(N), Y(N);
    REP(i,N){
        cin >> X[i] >> Y[i];
    }
    vector<ll> CX = compress(X);
    vector<ll> CY = compress(Y);

    ll ans = LLONG_MAX;
    vector<vector<int>> G(N+1,vector<int>(N+1,0));
    REP(i,N){
        G[X[i]+1][Y[i]+1] ++;
    }

    REP(i,N){
        REP(j,N+1){
            G[i+1][j] += G[i][j];
        }
    }
    REP(i,N+1){
        REP(j,N){
            G[i][j+1] += G[i][j];
        }
    }

    // REP(i,N+1){
    //     REP(j,N+1){
    //         cout << G[i][j] << " ";
    //     }
    //     cout << endl;
    // }



    REP(x1,N){
        REP(y1,N){
            FOR(x2,x1+1,N+1){
                FOR(y2,y1+1,N+1){
                    //cout << "(" << x1 << ", " << y1 << ") (" << x2 << ", " << y2 << ")";
                    //cout << ": " << G[x2][y2] + G[x1][y1] - G[x1][y2] - G[x2][y1] << endl;
                    if(G[x2][y2] + G[x1][y1] - G[x1][y2] - G[x2][y1] >= K){
                        ll num = (CX[x2-1]-CX[x1]) * (CY[y2-1]-CY[y1]);
                        ans = min(ans,num);
                    }
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
#![allow(unused_imports)]
use itertools::Itertools;
use proconio::{input, marker::*};
use std::cmp::*;
use std::collections::*;
use superslice::*;

fn main() {
    input! {
        mut a: u64,
        mut b: u64,
        mut c: u64,
        k: u64,
    }

    for i in 0..k {
        if b <= a {
            b *= 2;
        } else if c <= b {
            c *= 2;
        }
    }

    if a < b && b < c {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2132
// finish date: 2018/01/24
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define bigmod 1000000007
#define INF 500000000


int main() {
    string S, T;
    cin >> S >> T;
    for (int i = (int) S.length() - (int) T.length(); i >= 0; i--) {
        rep(j, T.length()) {
            if (!(S[i + j] == T[j] || S[i + j] == '?')) break;
            if (j == T.length() - 1) {
                S.replace(i, T.length(), T);
                replace(S.begin(), S.end(), '?', 'a');
                cout << S << endl;
                return 0;
            }
        }
    }
    cout << "UNRESTORABLE" << endl;


    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }



bool nuri[210][210];
int W, H;
int N;
int main() {
  while (cin >> W >> H >> N) {
	int w1 = 0, w2 = W, h1 = 0, h2 = H;
	for (int i = 0; i < N; ++i) {
	  int x, y, a;
	  cin >> x >> y >> a;
	  if (a == 1) chmax(w1, x);
	  if (a == 2) chmin(w2, x);
	  if (a == 3) chmax(h1, y);
	  if (a == 4) chmin(h2, y);
	}
	cout << max(w2 - w1, 0) * max(h2 - h1, 0) << endl;
  }
}





Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (N, M, K) = listOfInt()
    val U = UnionFind(N)
    val D = IntArray(N)
    val G = Array(N) { mutableListOf<Int>() }
    repeat(M) {
        val (a, b) = listOfInt(-1)
        D[a] += 1; D[b] += 1
        U.union(a, b)
    }
    repeat(K) {
        val (c, d) = listOfInt(-1)
        G[c].add(d); G[d].add(c)
    }
    val ans = IntArray(N)
    repeat(N) { n ->
        var f = U.size(n) - 1 - D[n]
        for (u in G[n]) {
            if (U.same(n, u)) f -= 1
        }
        ans[n] = f
    }
    println(ans.joinToString(separator = " "))
}
fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt(delta: Int = 0) = listOfString().map { Integer.parseInt(it) + delta }
class UnionFind(n: Int) {
    var rank: IntArray
    var par:  IntArray
    var size: IntArray
    init {
        this.rank = IntArray(n) { 0 }
        this.par  = IntArray(n) { it }
        this.size = IntArray(n) { 1 }
    }
    fun union(x: Int, y: Int): Boolean {
        var rx = this.root(x)
        var ry = this.root(y)
        if (rx == ry) return false
        if (this.rank[rx] < this.rank[ry]) {
            val w = rx
            rx = ry
            ry = w
        } else if (this.rank[rx] == this.rank[ry]) {
            this.rank[rx] += 1
        }
        this.par[ry] = rx
        this.size[rx] += this.size[ry]
        return true
    }
    fun find(x: Int): Int {
        if (this.par[x] == x) return x
        else {
            this.par[x] = this.find(this.par[x])
            return this.par[x]
        }
    }
    fun same(x: Int, y: Int) = this.root(x) == this.root(y)
    fun size(x: Int): Int = this.size[this.find(x)]
    fun root(x: Int): Int = this.find(x)
    fun unite(x: Int, y: Int) = this.union(x, y)
}


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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int h = ri();
	int n = ri();
	int a[n], b[n];
	for (int i = 0; i < n; i++) a[i] = ri(), b[i] = ri();
	int dp[h + 1];
	for (int i = 0; i <= h; i++) dp[i] = 1000000000;
	dp[0] = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= h; j++) dp[std::min(h, j + a[i])] = std::min(dp[std::min(h, j + a[i])], dp[j] + b[i]);
	}
	printf("%d\n", dp[h]);
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef tree<pair<int,int> ,null_type,less<pair<int,int>>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
typedef long long ll;
const int N = 1e5+10 , OO = 0x3f3f3f3f , mod = 1e9 + 7;

#define PI acos(-1) 
#define clr(arr,val) memset(arr , val , sizeof (arr))
#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n)-1;i >= 0;i--)
#define xloop(i,a,b) for(int i = int(a);i <= int(b);i++)
#define range(vec) for(auto &x : vec) cin >> x;
#define ALL(v) ((v).begin()) , ((v).end())
#define SZ(v)  ((int)((v).size()))
int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction
 
char grid[1005][1005];
int n , m ;
int dp[1005][1005];

int solve(int r , int c){
  if(r >= n || c >= m)
    return 0;
  if(grid[r][c] == '#')
    return 0;
  if(r == n-1 && c == m-1)
    return 1;
  int &ret = dp[r][c];
  if(~ret)
    return ret;
  int down = solve(r + 1 , c);
  int right = solve(r , c + 1);
  ret = (down + right) % mod;
  return ret;
}

int main()
{
  //ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  
  scanf("%d %d", &n,  &m);
  for(int i = 0 ; i < n ; ++i)
    scanf("%s", grid[i]);

  memset(dp , -1, sizeof dp);
  printf("%d\n", solve(0 , 0));



  return 0;
}

Measured memory_bytes: 8788
from collections import Counter
N = int(input())
V = list(map(int, input().split()))

A = V[::2]
B = V[1::2]

cntA = list(Counter(A).items())
cntB = list(Counter(B).items())

cntA.sort(key=lambda a: a[1], reverse=True)
cntB.sort(key=lambda a: a[1], reverse=True)

ans = 10**18
for a, c in cntA[:2]:
    for b, d in cntB[:2]:
        if a != b:
            ans = min(ans, N - c - d)
        elif max(len(cntA), len(cntB)) == 1:
                ans = min(ans, min(len(A), len(B)))

print(ans)


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

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

  long all = 0;
  long comb[n];
  for (int i = 0; i < n; i++) {
    comb[i] = 0;
    if (c[i] > 0) {
      comb[i] = (long)(c[i]) * (long)(c[i]-1) / 2;
      all += comb[i];
    }
  }

  for (int i = 0; i < n; i++) {
    printf("%ld\n", all - c[a[i]-1]+1);
  }
  return 0;
}


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

int main()
{
    int n, k, tmp;
    long long ans = 0;
    vector<long long> h;
    cin >> n >> k;
    for (int i = 0; i < n; i++)
    {
        cin >> tmp;
        h.push_back(tmp);
    }
    sort(h.begin(), h.end());

    if (n <= k)
    {
        cout << 0 << endl;
        return 0;
    }

    h.erase(h.end() - k, h.end());

    for (auto it = h.begin(); it != h.end(); ++it)
    {
        ans += *it;
    }
    cout << ans << endl;
}


Measured memory_bytes: 2420
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <vector>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define ALL(v) v.begin(),v.end()
#define rep(i,n) for(int i=0;i<n;++i)

int main(){
  ll n,m;
  cin >> n >> m;
  ll ans=0;
  if(n>=m/2)ans=m/2;
  else ans=n+(m-2*n)/4;
  cout << ans << endl;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define bao(x,y,z) make_pair(make_pair((x),(y)),(z))
#define num(x) (x).first.first+(x).first.second+(x).second
#define Rep(x) for (int (x)=-1;(x)<=1;(x)+=2)
int n,m;
const int maxn=1005;
pair < pair < int,int >,int > dp[maxn][maxn];
int x[maxn],y[maxn],z[maxn];
int maxv=0;
void solve(int u,int v,int w){
//	cout << "solve:" << u << ' ' << v << ' ' << w << endl;
	dp[0][0]=bao(0,0,0); 
	for (int i=1;i<=n;i++){
		dp[i][0]=bao(0,0,0);
		for (int j=1;j<=m;j++){
			if (u*x[i]+v*y[i]+w*z[i]+num(dp[i-1][j-1])>num(dp[i-1][j]) || i-1<j){
				dp[i][j]=bao(dp[i-1][j-1].first.first+u*x[i],dp[i-1][j-1].first.second+v*y[i]
				,dp[i-1][j-1].second+w*z[i]);
			}else{
				dp[i][j]=dp[i-1][j];
			}
		}
	}
//	for (int i=1;i<=n;i++){
//		for (int j=1;j<=m;j++){
//			cout << num(dp[i][j]) << ' ';
//		}
//		cout << endl;
//	}
	if (dp[n][m].first.first<0 || dp[n][m].first.second<0 || dp[n][m].second<0) return;
	maxv=max(maxv,num(dp[n][m]));
//	cout << "maxv=" << maxv << endl;
}
signed main(){
	ios::sync_with_stdio(false);
	cin >> n >> m;
	for (int i=1;i<=n;i++){
		cin >> x[i] >> y[i] >> z[i];
	}
	Rep(i) Rep(j) Rep(k){
		solve(i,j,k);
	}
	cout << maxv << endl;
	return 0;
}

Measured memory_bytes: 23808
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  string s;
  int a=0;
  int v[1005][2]={};
  while(getline(cin,s)){
    if(s[0]=='\0'){
      a++;
      continue;
    }
    int x=0;
    rep(i,s.size()){
      if(s[i]==',')break;
      x*=10;
      x+=s[i]-'0';
    }
    v[x][a]++;
  }
  rep(i,1005)
    if(v[i][0] && v[i][1])
      cout<<i<<" "<<v[i][0]+v[i][1]<<endl;
}

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

int main() {
    char ch;
    int i, arr[26] = {};

    while(cin >> ch) {
        if(isupper(ch)) {
            ++arr[ch-'A'];
        }
        else if(islower(ch)){
            ++arr[ch-'a'];
        }
    }

    for(i=0; i<26; ++i) {
        cout << (char)('a'+i) << " : " << arr[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 3100
#include <stdio.h>
int main(void){
	char s[101];
	scanf("%s",s);
	int i,len=0,hug=0;
	for(i=0;s[i]!='\0';i++) len++;
	for(i=(len+1)/2;i<len;i++) if(s[i]!=s[len-i-1]) hug++;
	printf("%d",hug);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<map>
 
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define pb push_back
#define pf push_front
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
 
ll gcd(ll x, ll y) {
	ll r;
	while ((r = x % y) != 0) {
		x = y;
		y = r;
	}
	return y;
	}
ll lcm(ll x, ll y) {
	x /= gcd(x, y);
	y /= gcd(x, y);
	return (x*y);
}

int main()
{
	double t,x;
    cin >> t >> x;
    cout << t/x << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
#define pb push_back
#define eb emplace_back
#define vi vector <int>
#define vlli vector <lli>
#define vulli vector <ulli>
#define vchar vector <char>
#define vstr vector <string>
#define vb vector <bool>
#define fst first
#define sec second
#define srt(a) sort(a.begin(),a.end())
#define vpii vector <pair <int,int> >
#define pii pair <int,int> 
#define vplli vector <pair <lli,lli> >
#define vpulli vector <pair <ulli,ulli> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pair <int,int>> >
#define vvb vector <vector <bool> >
#define fr(i,n) for (int i = 0; i < (n); i++)
#define frbig(i,n) for (lli i = 0; i < (n); i++)
#define fra(i,a,n) for (lli i = a; i < (n); i++)
#define run(c,s) for(auto c:s) 
#define read(n) int n; cin >> n;
#define read2(x,y) int x,y; cin >> x >> y;
#define read2ll(x,y) long long int x,y; cin >> x >> y;
#define readll(n) lli n; cin >> n;
#define watch(x) cout << (#x) << " is " << (x) << endl
#define print_array(x) fr(i,x.size()) cout << x[i] << " ";
using namespace std;
const lli MOD = 1e9 + 7;
const lli MOD1 = 998244353;
int a[12][12];
string lol(int l,int n){
    string s="";
    while(n!=0){
        if(l>=(1<<n)){
            s.pb('1');
            l-=(1<<n);
        }
        else{
            s.pb('0');
        }
        n--;
    }
    return s;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n,m,x;
    cin >> n >> m >> x;
    vi c(n),d(m);
    int l=0,ans=1e9;
    fr(i,n){
        cin >> c[i];
        fr(j,m) cin >> a[i][j];
    }
    fr(tt,(1<<(n+1))){
        string k=lol(tt,n);
        int ans1=0;
        fr(i,m) d[i]=0;
        fr(i,n){
            if(k[i]=='1'){
                fr(j,m){
                    d[j]+=a[i][j];
                }
                ans1+=c[i];
            }
        }
        bool nice=true;
        fr(i,m){
            if(d[i]<x){ nice=false;break;}
        }
        if(nice) ans=min(ans,ans1);
    }
    if(ans==1e9) cout << -1;
    else cout << ans;
    return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    int cnt=0;
    for (int i=0; i<N; i++) cin >> A[i];
    sort(A.begin(), A.end());
    for (int i=0; i<N; i++) {
        for (int j=0; j<i; j++) {
            for (int k=0; k<j; k++) {
                if ((A[i] != A[j]) && (A[j] != A[k]) && (A[k] != A[i])) {
                    if (A[k] + A[j] > A[i]) {
                        cnt++;
                    }
                }
            }
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
#include<string>
#include<string.h>
#include<algorithm>

using namespace std;

int main(void){
	
	string yaku[]={"one pair","two pair","three card","full house","four card","straight","null"};
	int tefuda[5],count[14];
	bool flag,straight;

	while(scanf("%d,%d,%d,%d,%d",&tefuda[0],&tefuda[1],&tefuda[2],&tefuda[3],&tefuda[4])!=EOF){
		
		flag=true;
		straight=true;
		
		memset(count,0,sizeof(count));
		//sort
		sort(tefuda,tefuda+5);
		//1-4 pair or fullhouse 
		for(int i=0;i<4;i++){
			for(int j=i+1;j<5;j++){
				if(tefuda[i]==tefuda[j]){
					count[tefuda[i]]++;
					flag=false;
				}	
			}
		}
		

		//straight
		if(flag){
			if(tefuda[0]==1 && tefuda[1]==2){
				for(int i=2;i<5;i++){
					if(tefuda[i]!=i+1){
						straight=false;
					}
				}
			}
			else if(tefuda[0]==1 && tefuda[4]==13){
				for(int i=1;i<4;i++){
					if(tefuda[i]!=i+9){
						straight=false;
					}
				}
			}
			else{
				for(int i=tefuda[0];i<5+tefuda[0];i++){
					if(tefuda[i-tefuda[0]]!=i){
						straight=false;
					}
				}	
			}
			
			if(straight){
				cout<<yaku[5]<<endl;	//straight
				//break;
			}
			else{
				cout<<yaku[6]<<endl;	//null
				//break;
			}
		}
		else{
			sort(count,count+14);
			if(count[13]==6){
				cout<<yaku[4]<<endl;
			}else if(count[12]==1 && count[13]==3){
				cout<<yaku[3]<<endl;
			}else if(count[12]==0 && count[13]==3){
				cout<<yaku[2]<<endl;
			}else if(count[12]==count[13]){
				cout<<yaku[1]<<endl;
			}else if(count[12]<2 && count[13]==1){
				cout<<yaku[0]<<endl;
			}
		}

	}
}

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


int main(){
  
  string s;
  cin>>s;
  
  int k;
  cin>>k;
  
  set<string> myset;
  
  for (int i=0;i<int(s.size());i++){
    for (int j=1;j<=min(5,int(s.size())-i);j++){
      string tmp;
      tmp=s.substr(i,j);
      myset.insert(tmp);
    }
  }
  
  vector<string> vec;
  
  for (auto x:myset){
    vec.push_back(x);
  }
  
  sort(vec.begin(),vec.end());
  
  cout<<vec.at(k-1)<<endl;
         
  

  
  
}

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

using namespace std;

int main() {
  int n, t, l, b;
  while(cin >> n >> t >> l >> b, n+t+l+b) {
    int mas[101] = {};
    for(int i = 0; i < l; i++) {
      int x;
      cin >> x;
      mas[x] = 1;
    }
    for(int i = 0; i < b; i++) {
      int x;
      cin >> x;
      mas[x] = 2;
    }
    double dp[111][111];
    fill(dp[0], dp[101], 0);
    dp[0][0] = 1;
    for(int i = 0; i < t; i++) {
      for(int j = 0; j < n; j++) {
	for(int k = 1; k <= 6; k++) {
	  int pos = j + k;
	  double tmp = dp[i][j]/6;
	  if(pos > n) pos = n - pos + n;
	  if(mas[pos] == 1) dp[i+2][pos] += tmp;
	  else if(mas[pos] == 2) dp[i+1][0] += tmp;
	  else dp[i+1][pos] += tmp;
	}
      }
    }
    double ans = 0;
    for(int i = 0; i <= t; i++) ans += dp[i][n];
    printf("%.10f\n", ans);
  }
  return 0;
}

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

const int64_t MOD = 1e9+7;
void add(int64_t& a, int64_t b){
    a = (a+b) % MOD;
}
void mul(int64_t& a, int64_t b){
    a = a*b % MOD;
}

vector<int64_t> fact, seq_inv, fact_inv;

void create_fact_mod(int num){
    fact[0] = fact[1] = 1;
    for(int i=2; i<=num; i++) fact[i] = fact[i-1] * i % MOD;
}

void create_seq_inv_mod(int num){
    seq_inv[0] = seq_inv[1] = 1;
    for(int i=2; i<=num; i++) seq_inv[i] = (MOD - MOD/i) * seq_inv[MOD%i] % MOD;
}

void create_fact_inv_mod(int num){
    fact_inv[0] = fact_inv[1] = 1;
    for(int i=2; i<=num; i++) fact_inv[i] = fact_inv[i-1] * seq_inv[i] % MOD;
}

void create_mod_tables(int num){
    fact.resize(num+1);
    seq_inv.resize(num+1);
    fact_inv.resize(num+1);
    create_fact_mod(num);
    create_seq_inv_mod(num);
    create_fact_inv_mod(num);
}

int64_t comb_mod(int n, int k){
    return fact[n] * fact_inv[n-k] % MOD * fact_inv[k] % MOD;
}

int64_t perm_mod(int n, int k){
    return fact[n] * fact_inv[n-k] % MOD;
}

int64_t power_mod(int64_t num, int64_t power){
    int64_t prod = 1;
    num %= MOD;
    while(power > 0){
        if(power&1) prod = prod * num % MOD;
        num = num * num % MOD;
        power >>= 1;
    }
    return prod;
}

int64_t extgcd(int64_t a, int64_t b, int64_t& x, int64_t& y){
    int64_t d = a;
    if(b != 0){
        d = extgcd(b, a%b, y, x);
        y -= (a/b) * x;
    }else{
        x = 1; y = 0;
    }
    return d;
}

int64_t inv_mod(int64_t a){
    int64_t x, y;
    extgcd(a, MOD, x, y);
    return (MOD + x%MOD) % MOD;
}

int main(){
    int N, A, B, C, D;
    cin >> N >> A >> B >> C >> D;
    create_mod_tables(N);
    static int64_t dp[1001];
    dp[N] = 1;
    for(int n=A; n<=B; n++) for(int i=0; i<=N; i++) for(int g=C; g<=D && i-g*n>=0; g++){
        int64_t res = perm_mod(i, g*n) * power_mod(fact_inv[n], g) % MOD * fact_inv[g] % MOD;
        add(dp[i-g*n], res * dp[i] % MOD);
    }
    cout << dp[0] << endl;
}


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

int calcGCD(int, int);

int main()
{
	int N;
	scanf("%d", &N);
	std::vector<int> A(N);
	for (auto& e: A) scanf("%d", &e);

	std::vector<int> gcd(N + 1), gcd_rev(N + 1);
	for (int i{}; i < N; i++)
		gcd[i + 1] = calcGCD(gcd[i], A[i]);
	for (int i{N - 1}; i >= 0; i--)
		gcd_rev[i] = calcGCD(gcd_rev[i + 1], A[i]);
	int max{};
	for (int i{}; i <= N; i++)
		max = std::max(max, calcGCD(gcd[i], gcd_rev[i + 1]));
	printf("%d\n", max);

	return 0;
}

int calcGCD(int a, int b)
{
	while (a)
	{
		b %= a;
		std::swap(a, b);
	}
	return b;
}

Measured memory_bytes: 1408
import std.stdio, std.conv, std.string;
import std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

int DEBUG_LEVEL = 0;
void print()(){ writeln(""); }
void print(T, A ...)(T t, lazy A a){ write(t), print(a); }
void print(int level, T, A ...)(T t, lazy A a){ if(level <= DEBUG_LEVEL) print(t, a); }

void main(string[] args){
	if(args.length > 1 && args[1] == "-debug"){
		if(args.length > 2 && args[2].isNumeric) DEBUG_LEVEL = args[2].to!int;
		else DEBUG_LEVEL = 1;
	}
	
	// ----------------------------------------
	
	int h = read.to!int;
	int w = read.to!int;
	int n = read.to!int;
	
	int i0 = read.to!int - 1;
	int j0 = read.to!int - 1;
	
	string s = readln.chomp;
	string t = readln.chomp;
	
	int l, r, u, d; // ここより外にいれば高橋君の勝ちという領域の幅
	
	string ans = "YES";
	
	foreach_reverse(k; 0 .. n){
		if(k < n - 1){
			if(t[k] == 'L') r = max(0, r - 1);
			if(t[k] == 'R') l = max(0, l - 1);
			if(t[k] == 'U') d = max(0, d - 1);
			if(t[k] == 'D') u = max(0, u - 1);
		}
		
		print!1("k:", k, " t[k]:", t[k], " l:", l, " r:", r, " u:", u, " d:", d);
		
		if(s[k] == 'L') l += 1;
		if(s[k] == 'R') r += 1;
		if(s[k] == 'U') u += 1;
		if(s[k] == 'D') d += 1;
	
		if(l + r >= w) ans = "NO";
		if(u + d >= h) ans = "NO";
		
		print!1("k:", k, " s[k]:", s[k], " l:", l, " r:", r, " u:", u, " d:", d);
	}
	
	if(l > j0) ans = "NO";
	if(r > w - 1 - j0) ans = "NO";
	if(u > i0) ans = "NO";
	if(d > h - 1 - i0) ans = "NO";
	
	ans.writeln;
	

}


Measured memory_bytes: 3068
program main
   implicit none
   integer::a(5),k
   integer i
   do i=1,5
      read(*,*)a(i)
   enddo
   read(*,*)k
   if(maxval(a)-minval(a)>k)then
      write(*,"(a2)")":("
   else
       write(*,"(a4)")"Yay!"
   endif
end program main


Measured memory_bytes: 768
N, C = map(int, input().split())
D = []
c = []
for _ in range(C):
    D.append(list(map(int, input().split())))
for _ in range(N):
    c.append(list(map(lambda x : int(x) - 1, input().split())))
colors = [[0] * C for _ in range(3)]
for i in range(N):
    for j in range(N):
        colors[(i+j)%3][c[i][j]] += 1

def calc(choice):
    ans = 0
    for i,v in zip(range(3),choice):
        for ind, cnt in enumerate(colors[i]):
            ans += cnt * D[ind][v]
    return ans
def dfs(lst, depth):
    ret = []
    if depth == 3:
        return calc(lst)
    for v in range(C):
        if v not in lst:
            lst.append(v)
            ret.append(dfs(lst, depth + 1))
            lst.pop()
    return min(ret)
print(dfs([], 0))


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

int main() {
  int k, a,b,counts =0;
  cin >> k >> a >> b;
  for(int i = 0; i < 142; i++){
    if( k*i >= a && k*i <= b){
      counts++;
    }
  }
  if(counts == 0){
    cout << "NG" << endl;
  }
  else{
    cout << "OK" <<endl;
  }
}

Measured memory_bytes: 3580
#include<iostream>
#include<queue>
#include<map>

struct Bug{
	int red, blue, green, days;
	std::string body;
};

int main(){
	std::string s;
	while(std::cin >> s, s != "0"){
		int bug_length = s.length();
		std::queue<Bug> bug_s;
		std::map<std::string, int> bug_m;
		Bug first_bug = {0, 0, 0, 0, s};
		for(int i=0;i<s.length();i++){
			if(s[i] == 'r'){
				first_bug.red++;
			}
			if(s[i] == 'g'){
				first_bug.green++;
			}
			if(s[i] == 'b'){
				first_bug.blue++;
			}
		}
		bug_s.push(first_bug);
		int res = -1;
		while(!bug_s.empty()){
			Bug b = bug_s.front();bug_s.pop();
			if(bug_m[b.body] > 0){
				continue;
			}
			if(b.red == bug_length || b.blue == bug_length || b.green == bug_length){
				res = b.days;
				break;
			}
			Bug temp;
			for(int i=0;i<bug_length-1;i++){
				temp = b;
				if(temp.body[i] != temp.body[i+1]){
					if(temp.body[i]+temp.body[i+1] == 'r'+'b'){
						temp.body[i] = temp.body[i+1] = 'g';
						temp.red--;temp.blue--;temp.green+=2;
					}else if(temp.body[i]+temp.body[i+1] == 'r'+'g'){
						temp.body[i] = temp.body[i+1] = 'b';
						temp.red--;temp.green--;temp.blue+=2;
					}else{
						temp.body[i] = temp.body[i+1] = 'r';
						temp.blue--;temp.green--;temp.red+=2;
					}
					temp.days++;
					bug_s.push(temp);

				}
			}
			bug_m[b.body]++;
		}

		if(res != -1){
			std::cout << res << std::endl;
		}else{
			std::cout << "NA\n";
		}
	}
}

Measured memory_bytes: 3480