akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define si(v) int(v.size())
#define len(v) int(v.length())
#define lob(v,n) lower_bound(all(v),n)
#define lobi(v,n) lower_bound(all(v),n) - v.begin()
#define upb(v,n) upper_bound(all(v),n)
#define upbi(v,n) upper_bound(all(v),n) - v.begin()
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vc = vector<char>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vvp = vector<vector<pair<int,int>>>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}




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

    int K;
    cin >> K;
    
    pq1<ll> A;
    reps(i,1,10) A.push((ll)i);
    
    vl B;
    int num = 0;
    
    while (1) {
        while (!A.empty()) {
            ll a = A.top();
            A.pop();
            
            B.pb(a);
            num++;
            if(num >= K) {
                sort(all(B));
                //outve(B);
                cout << B[K-1] << endl;
                return 0;
            }
            ll c = a%10;
            reps(k,(max((ll)0,c-1)),(min(c+2,(ll)10))) A.push(a*10+k);
            
        }
    }
    
    
    
    

    return 0;
}


Measured memory_bytes: 6016
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
using namespace std;
typedef long long ll;//ベルマンとかはllにしよ
//ここ十分にしないとだめ
#define INF 1000000000000

struct Node{
  //ノードの情報
  vector<pair<ll,ll>> edge;//各エッジの接続先のノード番号とコスト
  //ベルマンフォード法用のデータ
  ll mincost=INF;//そのノードへの最小コスト
};

//関係ないループを外す
bool bellmanford(vector<Node>& nodes,ll l1){
  //(l1-1)(普通のbellman)+1(検出)
  for(ll i=0;i<l1;i++){
    for(ll j=0;j<l1;j++){
      Node x=nodes[j];
      if(x.mincost!=INF){
        ll l2=x.edge.size();
        for(ll k=0;k<l2;k++){
          ll a=x.mincost+x.edge[k].second;
          if(nodes[x.edge[k].first].mincost>a){
            nodes[x.edge[k].first].mincost=a;
            if(i==l1-1 and x.edge[k].first==l1-1) return true;
          }
        }
      }
    }
  }
  return false;//負の閉路があればtrue
}

int main(){
  ll n,m;cin >> n >> m;
  vector<Node> Nodes(n);
  //mincost0の更新だけしっかりやる
  Nodes[0].mincost=0;

  for(ll i=0;i<m;i++){
    ll a,b,c;cin >> a >> b >> c;
    Nodes[a-1].edge.push_back(make_pair(b-1,-c));
  }
  //Nodesを更新
  if(bellmanford(Nodes,n)){
    cout << "inf" << endl;
  }else{
    cout << -Nodes[n-1].mincost << endl;
  }

}


Measured memory_bytes: 384
#include <stdio.h>
#include <math.h>

typedef struct {
    double x;
    double y;
} point_t;

// result[0]: px
// result[1]: py
// result[2]: r
void alg ( point_t* data, double* result )
{
    double a = sqrt( pow( data[1].x - data[2].x, 2 ) + pow( data[1].y - data[2].y, 2 ) );
    double b = sqrt( pow( data[0].x - data[2].x, 2 ) + pow( data[0].y - data[2].y, 2 ) );
    double c = sqrt( pow( data[0].x - data[1].x, 2 ) + pow( data[0].y - data[1].y, 2 ) );
    double s = sqrt( ( ( a + b + c ) * ( b + c - a ) * ( a - b + c ) * ( a + b - c ) ) / 16 );
    result[0] = ( pow(a,2) * ( pow(b,2) + pow(c,2) - pow(a,2) ) * data[0].x
                  + pow(b,2) * ( pow(c,2) + pow(a,2) - pow(b,2) ) * data[1].x
                  + pow(c,2) * ( pow(a,2) + pow(b,2) - pow(c,2) ) * data[2].x
                ) / ( 16 * pow(s,2) );
    result[1] = ( pow(a,2) * ( pow(b,2) + pow(c,2) - pow(a,2) ) * data[0].y
                  + pow(b,2) * ( pow(c,2) + pow(a,2) - pow(b,2) ) * data[1].y
                  + pow(c,2) * ( pow(a,2) + pow(b,2) - pow(c,2) ) * data[2].y
                ) / ( 16 * pow(s,2) );
    result[2] = ( a * b * c ) /
                 sqrt( ( a + b + c )
                       * ( b + c - a )
                       * ( a - b + c )
                       * ( a + b - c ) );
}

double round_d ( double input )
{
    if ( input >= 0.0 )
    {
        return floor( input * 1000 + 0.5 ) / 1000;
    }
    else
    {
        return floor( fabs( input ) * 1000 + 0.5 ) / 1000 * -1.0;
    }
}

int main ( void )
{
    int i, linenum = 0;
    double result[3];
    point_t points[3];

    scanf( "%d", &linenum );

    for ( i = 0; i < linenum; i++ )
    {
        if ( scanf( "%lf %lf %lf %lf %lf %lf",
                &points[0].x, &points[0].y,
                &points[1].x, &points[1].y,
                &points[2].x, &points[2].y )
             == EOF )
        {
            fputs( "Syntax Error", stderr );
            return 1;
        }

        alg( points, result );

        printf( "%.3lf %.3lf %.3lf\n",
                round_d(result[0]),
                round_d(result[1]),
                round_d(result[2]) );
    }

    return 0;
}

Measured memory_bytes: 668
#define _USE_MATH_DEFINES
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
#pragma endregion //#include
/////////

#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int Q;
	cin>>Q;
	
	while(Q--){
		LL A,B;
		cin>>A>>B;
		LL ter = A*B-1;
		LL ans = 0;
		LL MAX;// = sqrt(1.0*ter);//[1,MAX]
		LL L = 1;
		LL R = MOD;
		while(R-L>1){
			LL mid = (L+R)/2;
			if(mid*mid > ter ){
				R = mid;
			}else{
				L = mid;
			}
		}
		MAX = L;

		if( MAX*(MAX+1)<=ter ){
			ans = MAX*2;
			if( A<=MAX ){
				--ans;
			}
			if( B<=MAX ){
				--ans;
			}
		}else{
			if( A!=MAX && B!=MAX ){
				ans = 1;
			}
			ans += (MAX-1)*2;
			if( A<MAX )--ans;
			if( B<MAX )--ans;
		}
		
		cout << ans << endl;
	}
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()


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

int main(){
    int a, b;
    cin >> a >> b;

    if(a%3==0||b%3==0||(a+b)%3==0)
        cout << "Possible";
    else
        cout << "Impossible";
}

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

#define ll  long long int
 
int main()
{
  #ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("oo.txt","w",stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL);
  ll a,b,c,d;
  cin>>a>>b>>c>>d;
     ll ans=max(a*c , a*d);
     ll ans2=max(b*c,b*d);
     cout<<max(ans,ans2);
  return 0;
}

Measured memory_bytes: 3656
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

a=int(input())
if a==1:
  print(0)
else:
  lis=factorization(a)
  ans=0
  for i in range(len(lis)):
    k=1
    while lis[i][1]>=k:
      lis[i][1] -= k
      k+=1
      ans+=1
  print(ans)

Measured memory_bytes: 9432
#include<bits/stdc++.h>
using namespace std;
/* Author : Ravikumar Navale */
#define fastIo() ios_base :: sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#define pb push_back
#define endl  "\n"
typedef long long int ll;
vector<pair<ll,ll> >v1, v2, v3;
const ll MOD = 1e9 + 7;
const double peek = 1e7 ;

int main()
{
    fastIo();
    string a,b;
    cin >> a >> b;
    int n =a.length();
    int m = b.length();
    
    ll dp[n+1][m+1];
    memset(dp,0,sizeof(dp));
    
    for(ll i= 0 ; i <=n ; i++)
    {
        for(ll j =0 ; j <=m ; j++)
        {
            
            if(i ==0 || j ==0)
                dp[i][j] =0;
            else if(a[i-1]  == b[j-1])
                dp[i][j] = dp[i-1][j-1] +1 ;
            else
                dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
        }
    }
    
    
    int L = dp[n][m];
    char s[L+1];
    s[L] = '\0';
    
    ll i= n;
    ll j= m;
    while(i >0 && j>0)
    {
            if(a[i-1]== b[j-1])
            {
                s[L-1]= a[i-1];
                L--;
                i--;
                j--;
            }
            else if(dp[i-1][j] > dp[i][j-1])
                    i--;
            else 
                j--;
    }
    cout << s ;
    
    
    
    
}

Measured memory_bytes: 70656
import java.util.Scanner;

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

    int a = sin.nextInt();
    int b = sin.nextInt();
    double c = (double)a / (double)b;
    System.out.printf("%d %d %6.5f\n",a/b , a % b , c);
  }
}


Measured memory_bytes: 26564
def calcStep(x)
  if 0 <= x && x < 10
    step = 0

  elsif
    string = x.to_s
    digit = string.length
    multiArray = []
    for i in 0..(digit - 2)
      multiArray << string[0..i].to_i * string[(i + 1)..(digit - 1)].to_i
    end
    step = calcStep(multiArray.max) + 1
  end
  
  return step
end

ansArray = []

num = gets.chomp.to_i

for i in 0..(num - 1)
  ansArray << calcStep(gets.chomp.to_i)
end

ansArray.each{|x|
  p x
}

Measured memory_bytes: 6096
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_1_A&lang=ja

def prime_factors(n):       # 戻り値はiterable type
    i = 2
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            yield i
    if n > 1:
        yield n

N = int(input())

P = list(prime_factors(N))     # 素因数のリスト


print(str(N) + ":", *P)


Measured memory_bytes: 5596
#include <stdio.h>

int selectionSort(int A[], int N) {
    int i, j, t, sw =0, minj;
    for(i=0;i<N-1;i++) {
        minj = i;
        for(j=i;j<N;j++) {
            if(A[j]<A[minj]) minj = j;
        }
        t=A[i]; A[i]=A[minj]; A[minj]=t;
        if(i!=minj) sw++;
    }
    return sw;
}

int main(void) {
    int A[100], N, i, sw;

    scanf("%d",&N);
    for(i=0;i<N;i++) scanf("%d",&A[i]);

    sw = selectionSort(A,N);

    for(i=0;i<N;i++) {
        if(i>0) printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
    printf("%d\n",sw);

    return 0;
}


Measured memory_bytes: 2096
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans;llfor;///////////////////////////////////////////////////////////
int main(){
 char s[1000];
 sc(s);
 ll cnt=0;ans=0;
 rep(i,0,strlen(s)){
  if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T')cnt++;
  else{
   //pr(s[i]);
   ans=max(ans,cnt);
   cnt=0;
  }
 }
 pr(max(ans,cnt)); 
return 0;}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;

const lint mod = 1000003;

lint powmod(long x, long n){
  lint ret = 1;
  while(n > 0){
    if(n&1) ret *= x, ret %= mod, n -= 1;
    else x *= x, x %= mod, n >>= 1;
  }
  return ret;
}

vector<lint> fact;
vector<lint> revfact;

void setfact(int n){
  fact.resize(n+1); revfact.resize(n+1);
  fact[0] = 1;
  rep(i, n) fact[i+1] = fact[i] * (i+1) % mod;
  
  revfact[n-1] = powmod(fact[n-1], mod-2);
  for(int i=n-2; i>=0; i--) revfact[i] = revfact[i+1] * (i+1) % mod;
}

int main(){
    setfact(mod);
    int q;
    scanf("%d", &q);
    rep(i, q){
        int x, d, n;
        scanf("%d%d%d", &x, &d, &n);
        if(!d){
            printf("%lld\n", powmod(x, n));
            continue;
        }
        int y = x * powmod(d, mod-2) % mod;
        if(!y || y+n-1 >= mod){
            printf("0\n");
            continue;
        }
        printf("%lld\n", powmod(d, n) * fact[y+n-1] % mod * revfact[y-1] % mod);
    }
}

Measured memory_bytes: 16512
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
   ll k;
   while(cin>>k)
   {
       ll ans =0;
       ll n =7;
       bool flag = false;
       for(ll i=1;i<=k;i++)
       {
           n=n%k;
           if(n==0)
           {
               flag=true;
               ans = i;
               break;
           }
           n=n*10+7;
       }
       if(flag)cout<<ans<<endl;
       else
        cout<<-1<<endl;
   }
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, m, ac = 0, wa = 0, p;
    string s;
    cin >> n >> m;

    vector<int> WA(n, 0);
    map<int, string> mp;

    for(int i = 0; i < m; i++){
        cin >> p >> s;
        if(s == "WA" && mp[p] != "AC"){
            mp[p] = s;
            WA.at(p-1)++;
        }
        else if(s == "AC" && mp[p] != "AC"){
            mp[p] = s;
            ac++;
            wa += WA.at(p-1); 
        }
    }

    cout << ac << " " << wa << endl; 
}

Measured memory_bytes: 11520
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>

#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

#include <stdexcept>

using namespace std;

//conversion
//------------------------------------------
inline int toint(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class t> inline string tostring(t x) { ostringstream sout; sout << x; return sout.str(); }

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (l" << __line__ << ")" << " " << __file__ << endl

// type alias
using ll = long long;
using ull = unsigned long long;

inline ll floor(ll a, ull b)
{
	ll llb = b;
	if (a >= 0)
	{
		return a / llb;
	}
	else
	{
		return - ( (-a + llb - 1) / llb);
	}
}

inline ll ceil(ll a, ull b)
{
	ll llb = b;
	if (a >= 0)
	{
		return (a + llb - 1) / llb;
	}
	else
	{
		return - (-a / llb);
	}
}

inline bool isPower2(ull a)
{
	if (a == 0)
	{
		return false;
	}
	return !(a & (a - 1));
}

inline ll getMaxEffectiveBit(ull a)
{
	ll index = -1;
	for (; a != 0; a >>= 1)
	{
		++index;
	}
	return index;
}

inline ll getSpecifiedBit(ull a, unsigned bit)
{
	return (a & (1LL << bit)) >> bit;
}

// computational complexity: o(log(max(a, b))) 
inline ull getGcd(ull a, ull b)
{
	if (b == 0)
	{
		return a;
	}
	return getGcd(b, a % b);
}

template<class Integer>
inline Integer getPower(Integer base, ull exponential)
{
	Integer result = 1;
	while (exponential >= 1)
	{
		if (exponential & 1)
		{
			result = result * base;
		}
		base = base * base;
		exponential >>= 1;
	}

	return result;
}

ll val(ll a, ll c, ll d)
{
	ll m = c / getGcd(c, d) * d;
	return a - a / c - a / d + a / m;
}

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

	ll N;
	cin >> N;
	
	vector<pair<ll, ll>> ABs;
	ll a, b;
	for (ll i = 0; i < N; ++i)
	{
		cin >> a >> b;
		ABs.emplace_back(a, b);
	}

	sort(ABs.begin(), ABs.end(), [](const auto& a, const auto& b) {
		if (a.second < b.second)
		{
			return true;
		}
		else if (a.second > b.second)
		{
			return false;
		}
		else if (a.first < b.first)
		{
			return true;
		}
		else {
			return false;
		}
	} );

	ll accum = 0;
	bool canExecute = true;
	for (ll i = 0; i < N; ++i)
	{
		accum += ABs[i].first;
		if (accum > ABs[i].second)
		{
			canExecute = false;
			break;
		}
	}

	cout << (canExecute ? "Yes" : "No") << endl;

	return 0;
}


Measured memory_bytes: 6532
#include<bits/stdc++.h>
#define ri register int
#define fi first
#define se second
using namespace std;
inline int read(){
	#define gc getchar
	bool f=1;
	int ans=0;
	char ch=gc();
	while(!isdigit(ch))f^=ch==gc(),ch=gc();
	while(isdigit(ch))ans=((ans<<2)+ans<<1)+(ch^48),ch=gc();
	return f?ans:-ans;
	#undef gc
}
//test
const int mod=998244353;
typedef long long ll;
inline int add(int a,int b){return (a+=b)<mod?a:a-mod;}
inline int dec(int a,int b){return (a-=b)<0?a+mod:a;}
inline int mul(int a,int b){return (ll)a*b%mod;}
inline void Add(int&a,int b){(a+=b)<mod?a:a-=mod;}
inline void Dec(int&a,int b){(a-=b)<0?a+=mod:a;}
inline void Mul(int&a,int b){a=(ll)a*b%mod;}
inline int ksm(int a,int p){int ret=1;for(;p;p>>=1,Mul(a,a))if(p&1)Mul(ret,a);return ret;}
const int N=1e5+5;
int n,m;
typedef pair<int,int> pii;
pii a[N];
inline bool cmp(pii a,pii b){return a.fi^b.fi?a.fi<b.fi:a.se>b.se;}
int main(){
	n=read(),m=read();
	for(ri i=1;i<=n;++i)a[i].fi=read(),a[i].se=read();
	sort(a+1,a+n+1,cmp);
	ll ans=0;
	int cur=1;
	priority_queue<int>q;
	for(ri i=m;~i;--i){
		while(cur<=n&&i+a[cur].fi<=m)q.push(a[cur].se),++cur;
		if(q.size())ans+=q.top(),q.pop();
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 1660
#include<stdio.h>

int main(){
  int a,b,c,d,e,f,g;
  scanf("%d %d %d %d",&a,&b,&c,&d);
  if(a>=b){
    e=a-b;
  }else{
    e=b-a;
  }
  if(b>=c){
    f=b-c;
  }else{
    f=c-b;
  }
  if(a>=c){
    g=a-c;
  }else{
    g=c-a;
  }
  if(e<=d && f<=d||g<=d){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return(0);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll int64_t
#define rep(i,n) for(int64_t i=0;i<n;++i)
#define P pair<ll,ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
constexpr int64_t INF=(1ll<<60);
constexpr int64_t mod=1000000007;
constexpr double pi=3.14159265358979323846;
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

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

    bool ok=true;
    rep(i,n){
        if(a[i]%2==0){
            if(!(a[i]%3==0 || a[i]%5==0)){
                ok=false;
            }
        }
    }

    if(ok) cout<<"APPROVED"<<endl;
    else cout<<"DENIED"<<endl;
    return 0;
}

Measured memory_bytes: 3580
n = int(input())
h = [int(i) for i in input().split()]

h2 = h[:]
can = True
for i in range(n-2, -1, -1):
    if h2[i] <= h2[i+1]:
        continue
    elif h2[i] > 1:
        h2[i] -= 1
    if not h2[i] <= h2[i+1]:
        can = False
        break

print('Yes') if can else print('No')


Measured memory_bytes: 14396
# include <bits/stdc++.h>
using namespace std;
typedef long long i64;
typedef vector<int> Vi;
typedef pair<int, int> Pii;
# define pb push_back
# define mp make_pair
# define MOD 1000000007
# define INF 1000000000
# define bug puts("H");

const int N = 200000 + 5;

inline int Scan() {
    int x=0;int f=1; char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}

int a[N];

int main ()
{
    int n, x;
    cin >> n;
    int ma1 = 0, ma2 = 0;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        if (a[i] > ma1) ma2 = ma1, ma1 = a[i];
        else if (a[i] > ma2) ma2 = a[i];
    }
    for (int i = 1; i <= n; ++i) {
        if (a[i] == ma1) cout << ma2 << endl;
        else cout << ma1 << endl;
    }
    return 0;
}


Measured memory_bytes: 2432
#include<iostream>
#include<cctype>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<cctype>
#include<cstring>
#include<utility>
#include<cmath>
using namespace std;

int main() {
    int pos1[7] = { 0 }, pos2[7] = { 0 }, num[6], i;
    char command[101];

    for (i = 0; i < 6; i++) {
        scanf("%d", &num[i]);
        pos1[i + 1] = i + 1;
        pos2[i + 1] = i + 1;
    }
    scanf("%s", command);

    for (i = 0; i < strlen(command); i++) {
        if (command[i] == 'N') {
            pos1[1] = pos2[2];
            pos1[2] = pos2[6];
            pos1[6] = pos2[5];
            pos1[5] = pos2[1];
        }
        else if (command[i] == 'S') {
            pos1[1] = pos2[5];
            pos1[2] = pos2[1];
            pos1[6] = pos2[2];
            pos1[5] = pos2[6];
        }
        else if (command[i] == 'E') {
            pos1[1] = pos2[4];
            pos1[3] = pos2[1];
            pos1[6] = pos2[3];
            pos1[4] = pos2[6];
        }
        else if (command[i] == 'W') {
            pos1[1] = pos2[3];
            pos1[3] = pos2[6];
            pos1[6] = pos2[4];
            pos1[4] = pos2[1];
        }
        
        for (int j = 1; j < 7; j++) {
            pos2[j] = pos1[j];
        }
    }

    printf("%d\n", num[pos1[1]-1]);

    return 0;
}

Measured memory_bytes: 3200
import java.util.Arrays;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String up = sc.next();
    String down = sc.next();
    int[] upMap = new int[26];
    int[] downMap = new int[26];
    Arrays.fill(upMap, -1);
    Arrays.fill(downMap, -1);
    for (int i = 0; i < up.length(); i++) {
      if (upMap[up.charAt(i) - 'a'] < 0) {
        upMap[up.charAt(i) - 'a'] = down.charAt(i);
      } else if (upMap[up.charAt(i) - 'a'] != down.charAt(i)) {
        System.out.println("No");
        return;
      }
      if (downMap[down.charAt(i) - 'a'] < 0) {
        downMap[down.charAt(i) - 'a'] = up.charAt(i);
      } else if (downMap[down.charAt(i) - 'a'] != up.charAt(i)) {
        System.out.println("No");
        return;
      }
    }
    System.out.println("Yes");
  }

}


Measured memory_bytes: 27784
#include<stdio.h>
int main(void)
{
    int n;
    int a[10000],b[10000];
    int a_ans=0,b_ans=0;
    int i,j;

    for(;;){
    scanf("%d",&n);
    if(n == 0)break;
    for(i = 0;i < n; i++){
        scanf("%d%d",&a[i],&b[i]);
        if(a[i] > b[i])a_ans += a[i]+b[i];
        else if(a[i] < b[i])b_ans += a[i]+b[i];
        else if(a[i] == b[i]){
            a_ans += a[i];
            b_ans += b[i];
        }
    }
    printf("%d %d\n",a_ans,b_ans);
    a_ans=0;b_ans=0;
    }
return 0;
}

Measured memory_bytes: 676
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod = 1e9 + 7;
const ll INF = 1e9;

int main() {
  ll n, k;
  cin >> n >> k;
  cout << min(n % k, abs(n % k - k)) << endl;
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    int n, k; cin>>n>>k;
    vector<int> h(n);
    for(int i=0; i<n; i++) cin>>h[i];
    
    sort(h.begin(), h.end(), greater<int>());

    ll ans = 0;
    for(int i=0; i<n; i++){
        if(i >= k) ans += h[i];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

N,M = map(int,readline().split())
k = 2**N
dp = [INF]*k 
dp[0] = 0

for i in range(M):
    a,b = map(int,readline().split())
    c = list(map(int,readline().split()))
    d = sum(1<<(ci-1) for ci in c)
    dpnew = dp[:]
    for j in range(k):
        dpnew[j|d] = min(dp[j]+a,dpnew[j|d])
    dp = dpnew

print(dp[2**N-1] if dp[2**N-1] != INF else -1)




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

#define rep(i, N) for (ll i = 0; i < N; i++)
#define rep1(i, N) for (ll i = 1; i <= N; i++)
#define repr(i, N) for (ll i = N-1; i >= 0; i--)
#define repr1(i, N) for (ll i = N; i > 0; i--)

using ll = long long;
using namespace std;

int main(){
    ll L, R, N, ans = LLONG_MAX, tmp;

    cin >> L >> R;

    N = R-L+1;
    
    if(N > 2019){
        ans = 0;
    }else{
        for(ll i=L; i < R; i++){
            for(ll j=i+1; j <= R; j++){
                tmp = (i*j)%2019;
                if(tmp < ans)
                    ans = tmp;
            }
            if(ans == 0) break;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		sc.close();
		int cnt = 0;
		for(int i = 1; i < S.length(); i++) {
			if(S.charAt(i - 1) != S.charAt(i)) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 23636
#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
#pragma GCC target("avx2")  //Enable AVX
#include<bits/stdc++.h>
using namespace std;

#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int,int>
#define mp make_pair
 
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
 
int mod=1e9+7;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
int mul(int a,int b)
{
    return ((a)*1ll*(b))%mod;
}
 
void add(int &a,int b)
{
    a+=b;
    if(a>=mod)a-=mod;
}
 
int sub(int a,int b){
    a-=b;
    if(a<0){
        a+=mod;
    }
    return a;
}
 
int powz(int a,int b)
{
    int res=1;
    while(b)
    {
        if(b&1){
            res=mul(res,a);
        }
        b/=2;
        a=mul(a,a);
    }
    return res;
}
 
template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
    input>>x.F>>x.S;
    return input;
}
 
template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
    for(auto& i:x)
        input>>i;
    return input;
}
 
template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
    for(auto& i:x)
        output<<i<<' ';
    return output;
}
 
const int N=200005;

void solve(){
	int a,b;
	cin>>a>>b;
	int negcnt=0;
	if(b<0){
		negcnt=b-a+1;
	}
	if(0>=a&&0<=b){
		cout<<"Zero";
	}
	else if((negcnt&1)&&b<0){
		cout<<"Negative";
	}
	else{
		cout<<"Positive";
	}
	
}
 
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int tc=1;
    //~cin>>tc;
    for(int _=0;_<tc;_++){
        //~ cout<<"Case #"<<_+1<<": ";
        solve();
        if(_!=tc-1)
        cout<<"\n";
    }
}


Measured memory_bytes: 256
module Main;

import std.stdio;
import std.string;
import std.conv;
import std.array;
import std.range;
import std.algorithm;

alias map!(to!string) stringize;



void main() {
    string input;

    while ((input = readln.chomp).length != 0) {
        int[] tehai = new int[](9);
        int[] yama = new int[](9);
        int[] ans;

        fill(yama, 4);
        foreach (i; 0..13) {
            int index = (input[i] - '0').to!int;
            tehai[index-1]++;
            yama[index-1]--;
        }

        ans = agari(tehai, yama);
        if (ans.length == 0) {
            writeln(0);
        } else {
            writeln(ans.stringize.join(" "));
        }
    }
}

int[] agari(int[] tehai, int[] yama) {
    int[] ans;

    foreach (i; 0..tehai.length) {
        if (yama[i] == 0) continue;

        tehai[i]++;
        foreach (j; 0..tehai.length) {
            if (tehai[j] < 2) continue;

            tehai[j] -= 2;
            if (yaku(tehai, 0)) ans ~= (i + 1).to!int;
            tehai[j] += 2;
        }
        tehai[i]--;
    }

    return ans;
}

bool yaku(int[] haipai, int num_yaku) {
    if (num_yaku >= 4) return true;

    int[] tehai;
    foreach (i; 0..haipai.length) {
        /* 順子が成立するかの判定 */
        if (i >= 2 && haipai[i - 2] > 0 && haipai[i - 1] > 0 && haipai[i] > 0) {
            tehai = haipai.dup;
            tehai[i - 2]--;
            tehai[i - 1]--;
            tehai[i]--;
            return yaku(tehai, ++num_yaku);
        }

        /* 刻子が成立するかの判定 */
        if (haipai[i] >= 3) {
            tehai = haipai.dup;
            tehai[i] -= 3;
            return yaku(tehai, ++num_yaku);
        }
    }

    return false;
}

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;

#define FOR(i, begin, end) for(int i = (begin); i < (end); i++)
#define rep(i, n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define ZP(a, len) cout << setfill('0') << setw(len) << right << a << endl;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};

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

    for (int a = 0; a <= n / 4; ++a) {
        for (int b = 0; b <= n / 7; ++b) {
            if (4 * a + 7 * b == n) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int k = 0;
        int n = sc.nextInt();
        for (int i = 0;i < n;++i){
            int a = sc.nextInt();
            while (a % 2 == 0){
                ++k;
                a /= 2;
            }
        }
        System.out.println(k);
    }


}


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

int main(){
    int a, b, c, tmp;
    cin >> a >> b >> c;
    if (a > b) {
        tmp = a;
        a = b;
        b = tmp;
    }
    if (b > c) {
        tmp = b;
        b = c;
        c = tmp;
    }
    if (a > b) {
        tmp = a;
        a = b;
        b = tmp;
    }
    cout << a << " " << b << " " << c << endl;
    return 0;
}


Measured memory_bytes: 3100
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
////////////////////////////

int main(){fastio
    ll n,k;cin>>n>>k;
    cout<<(n+k-1)/k<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
using namespace std;
typedef double D;
typedef complex<D> P;
const D EPS = 1e-8;

int n,r,q,r2;
P p[30];
int cur;
D min_s[30],SIN[30],COS[30],x,y;

inline P rotate(const P &v, const D &s){
  return P(real(v)*cos(s) - imag(v)*sin(s), real(v)*sin(s) + imag(v)*cos(s) );
}

inline D arg(const P &a,const P &b,const P &c){return real(conj(b-a)*(c-a))/(abs(b-a)*abs(c-a));}

inline D rot_seta(const int &end){
  D seta = acos( 1 - norm(p[end]-p[cur])/r2 );
  P nxt = rotate(p[cur],-seta);
  return arg(p[cur],p[end],nxt);
}

int main(){
  while(scanf("%d%d%d",&n,&r,&q), n){
    r2 = 2*r*r;
    rep(i,n){
      scanf("%lf%lf",&x,&y);
      p[i] = P(x,y);
      if(abs(abs(p[i])-r)<EPS)cur = i;
    }
    
    vector<int> nxt(n,-1);
    bool f = false;

    rep(i,q){
      if(nxt[cur]>=0)f = true;

      if(!f){
	min_s[cur] = 5;
	rep(j,n){
	  if(cur==j)continue;
	  D s = rot_seta(j);
	  if(nxt[cur]<0 || s > min_s[cur]+EPS)nxt[cur] = j, min_s[cur] = s;
	}
	min_s[cur] = acos(min_s[cur]);
	SIN[cur] = sin(min_s[cur]); COS[cur] = cos(min_s[cur]);
      }

      rep(j,n){
	if( (!f || nxt[j]>=0) && j!=cur){
	  x = p[j].real()-p[cur].real(); y = p[j].imag()-p[cur].imag();
	  p[j] = P(x*COS[cur] - y*SIN[cur] + p[cur].real(), x*SIN[cur] + y*COS[cur] + p[cur].imag());
	}
      }
      printf("%.9lf %.9lf\n",p[nxt[cur]].real(), p[nxt[cur]].imag());

      if(!i){
	int tmp = nxt[cur];
	nxt[cur] = -1;
	cur = tmp;
      }else{
	cur = nxt[cur];
      }
    }
  }
}

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

class Dice {
    public:
        int *num;

        Dice(int *n) {
            num = n;
        }

        void move(char c) {
            int n[6];
            for (int i = 0; i < 6; i++) {
                n[i] = num[i];
            }
            if (c == 'N') {
                num[0] = n[1];
                num[1] = n[5];
                num[4] = n[0];
                num[5] = n[4];
            } else if (c == 'S') {
                num[0] = n[4];
                num[1] = n[0];
                num[4] = n[5];
                num[5] = n[1];
            } else if (c == 'W') {
                num[0] = n[2];
                num[2] = n[5];
                num[3] = n[0];
                num[5] = n[3];
            } else {
                num[0] = n[3];
                num[2] = n[0];
                num[3] = n[5];
                num[5] = n[2];
            }
        }
};

int main() {
    int num[6], n, up, front;
    for (int i = 0; i < 6; i++) {
        cin >> num[i];
    }
    cin >> n;
    Dice d(num);

    for (int i = 0; i < n; i++) {
        cin >> up >> front;

        for (int j = 0; j < 4; j++) {
            if (d.num[1] == front) break;
            d.move('S');
        }
        if (d.num[1] != front) {
            d.move('W');
            for (int j = 0; j < 4; j++) {
                if (d.num[1] == front) break;
                d.move('S');
            }
        }
        while (d.num[0] != up) {
            d.move('W');
        }
        cout << d.num[2] << endl;
    }
}

Measured memory_bytes: 1160
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp72 {
    class Program {
        static void Main(string[] args) {
            string w = Console.ReadLine();

            var w_ = w.ToCharArray();
            var w_distinct = w_.Distinct().ToArray();

            foreach(var element in w_distinct) {
                if (w_.Where(x => x == element).Count() % 2 != 0) {
                    Console.WriteLine("No");
                    return;
                }

            }

            Console.WriteLine("Yes");

        }
    }
}

Measured memory_bytes: 13268
n, m = map(int, input().split())

data1 = [0] * (n+1)
data2 = [0] * (n+1)

for _ in range(m):
    a, b = map(int, input().split())
    if a == 1:
        data1[b+1] = 1
    if b == n:
        data2[a+1] = 1


for i in range(n+1):
    if data1[i] == 1 and data2[i] == 1:
        print("POSSIBLE")
        exit()

print("IMPOSSIBLE")

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

int main(){
  string n;
  cin >> n;
    for(int i=0 ; i<3; i++){
      switch(n[i]){
        case '1':
          n[i]='9';
          break;
        case '9':
          n[i]='1';
          break;
        default:
          break;
      }
    }
  cout << n;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
#define dbg          cout<<"Freak"<<endl;
#define dbgg(i)      cout<<i<<endl;
using namespace std;
ll t;
int main()
{
    ll a,b,c,d,e,f,i,j;
    cin>>a;
    ll arr[12];
    for(i=0;i<a;i++)cin>>arr[i];
    sort(arr,arr+a);
    arr[a-1]=arr[a-1]/2;
    b=0;
    for(i=0;i<a;i++)b+=arr[i];
    cout<<b<<endl;

return 0;

}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        ArrayList<Integer> list = new ArrayList<Integer>();
        int n = scanner.nextInt();
        int count = 0;
        while (count < n) {
            int num = scanner.nextInt();
            list.add(num);
            count++;
        }
        int max = -2147483648;
        int min = list.get(0);
        for (int i = 0; i < n - 1; i++) {
            min = Math.min(min, list.get(i));
            max = Math.max(max, list.get(i+1) - min);
        }
        System.out.println(max);
    }
}


Measured memory_bytes: 106420
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;++i)
struct Dice{
  int a[6];
  void D(char c){
    int b;
    if(c=='E')
      b=a[0], a[0]=a[3], a[3]=a[5], a[5]=a[2], a[2]=b;
    else if(c=='W')
      b=a[0], a[0]=a[2], a[2]=a[5], a[5]=a[3], a[3]=b;
    else if(c=='S')
      b=a[0], a[0]=a[4], a[4]=a[5], a[5]=a[1], a[1]=b;
    else if(c=='N')
      b=a[0], a[0]=a[1], a[1]=a[5], a[5]=a[4], a[4]=b;
    else
      b=a[1], a[1]=a[2], a[2]=a[4], a[4]=a[3], a[3]=b;
  }
};
bool f(Dice d,Dice e){
  REP(i,6)
    if(d.a[i]!=e.a[i]) return false;
  return true;
}
int main(){
  int n; cin>>n;
  Dice d[n];
  REP(i,n)
    REP(j,6) cin>>d[i].a[j];
  int cnt=0;
  REP(i,n-1)
    for(int j=i+1;j<n;++j)
      REP(k,4){
        d[j].D('E');
        REP(l,4){
          d[j].D('S');
          REP(m,4){
            d[j].D('X');
            if(f(d[i],d[j])) cnt++;
          }
        }
      }
  if(cnt) cout<<"No\n";
  else cout<<"Yes\n";
  return 0;
}

Measured memory_bytes: 3096
#include <cstdio>
#include <cstdlib>
#include <algorithm>
typedef long long int64;
static const int DIGITS = 24;
 
int D, d[DIGITS] = { 0 };
int d_len;
 
// <mask> represents carrying positions
inline int64 calc(int len, int mask)
{
    int last_carry = 0;
    int diff[DIGITS], min[DIGITS], max[DIGITS];
    for (int i = 0; i < len; ++i) {
        // Build equation N[i] + D[i] + last_carry = N[len - i - 1] + cur_carry * 10
        int cur_carry = !!(mask & (1 << i));
        // diff[i] = N[i] - N[len - i - 1]
        diff[i] = cur_carry * 10 - d[i] - last_carry;
        min[i] = (i == len - 1 ? 1 : 0), max[i] = 9;
        if (cur_carry) min[i] = std::max(min[i], 10 - d[i] - last_carry);
        else max[i] = std::min(max[i], 9 - d[i] - last_carry);
        last_carry = cur_carry;
    }
    int64 ans = 1;
    for (int i = 0; i + i < len; ++i) {
        /*if (i + i + 1 == len) {
            // Central digit
            if (diff[i] != 0) return 0;
            ans *= (10 - (i == 0));
        } else {
            // "Palindromic" (???) digit
            if (diff[i] != -diff[len - i - 1]) return 0;
            ans *= (10 - std::abs(diff[i]) - (i == 0));
        }*/
        //if (len == 3 && mask == 1) printf("%d | %d %d\n", i, diff[i], diff[len - i - 1]);
        if (diff[i] != -diff[len - i - 1]) return 0;
        min[i] = std::max(min[i], min[len - i - 1] + diff[i]);
        max[i] = std::max(max[i], max[len - i - 1] + diff[i]);
        if (min[i] > max[i]) return 0; else ans *= (max[i] - min[i] + 1);
        //if (len == 9 && mask == 31) printf("%d | [%d, %d]\n", i, min[i], max[i]);
    }
    /*if (ans > 0) {
        printf("L=%d | Mask=%d\t| %lld\n", len, mask, ans);
        for (int i = 0; i < len; ++i) printf("%d%c", diff[i], i == len - 1 ? '\n' : ' ');
    }*/
    return ans;
}
 
int main()
{
    scanf("%d", &D);
    for (d_len = 0; d_len < DIGITS; ++d_len) { d[d_len] = D % 10; if ((D /= 10) == 0) break; }
 
    int64 ans = 0;
    // Can be reduced actually.
    for (int i = d_len + 1; i < DIGITS; ++i) {
    //for (int i = d_len + 1; i <= d_len + 1; ++i) {
        for (int mask = 0; mask < (1 << (i - 1)); ++mask) ans += calc(i, mask);
    }
    printf("%lld\n", ans);
 
    return 0;
}


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

int main() {
  string S;
  cin >> S;
  bool tapable = true;
  for (int i = 0; i < S.size(); i++) {
    if (i % 2 == 0) {
      if (S[i] == 'R' || S[i] == 'U' || S[i] == 'D') {
        continue;
      } else {
        tapable = false;
        break;
      }
    } else {
      if (S[i] == 'L' || S[i] == 'U' || S[i] == 'D') {
        continue;
      } else {
        tapable = false;
        break;
      }
    }
  }
  if (tapable)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
const ll INF = 1e18+100;
const ll MOD = 1000000007;
const double EPS = 1e-10;
const bool debug = 0;
//------------------------------//

int main() {
	string s;
	cin >> s;
	
	bool ans = false;
	REP(i, s.size() - 1) if (s[i] == 'A' && s[i + 1] == 'C') ans = true;
	puts(ans ? "Yes" : "No");
	
	return 0;
}


Measured memory_bytes: 764
def solve(A, B, M, a, b, x, y, c):
    best = min(a) + min(b)
    for i in range(M):
        best = min(best, a[x[i]-1] + b[y[i]-1] - c[i])
    return best

A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = [0] * M
y = [0] * M
c = [0] * M
for i in range(M):
    x[i], y[i], c[i] = map(int, input().split())
print(solve(A, B, M, a, b, x, y, c))

Measured memory_bytes: 23340
#include<cstdio>
#include<string>
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<set>
#include<vector>
#define INF 100000000

#define MAX_N 10000
#define MAX_M 100

typedef long long int ll;
using namespace std;



int main(){

	int x,y;
	while(true){
	
		scanf("%d %d", &x, &y);
		if(x == 0 && y == 0)
			break;
		else{
			if(x < y)
				printf("%d %d\n", x, y);
			else
				printf("%d %d\n", y, x);
		
		}
	
	}


	return 0;

}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

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

int main() {

    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    rep(i,N) cin >> A[i];

    N -= K;
    cout << 1 + (N % (K - 1) == 0 ? N / (K - 1) : N / (K - 1) + 1) << endl;
    
    return 0;
}

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

using namespace std;

int main() {
    int N;
    cin >> N;
    long long int A, B, cX, nX;
    cin >> A >> B;
    cin >> nX;
    long long int ans=0;
    for(int n=1; n<N; n++) {
        cX = nX;
        cin >> nX;
        
        if(nX-cX<=B/A) {
            ans += (nX-cX)*A;
        } else {
            ans += B;
        }
    }

    cout << ans << endl;

    return 0;
    
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

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

typedef long long ll;

const string YES = "Yes";
const string NO = "No";

int main() {
    int X;
    cin >> X;
    if (X >= 30) {
        cout << YES << endl;
    } else {
        cout << NO << endl;
    }
    return 0;
}


Measured memory_bytes: 3636
object Main {
  val alphabets = ('A' to 'Z').toList
  def main(args: Array[String]): Unit = {
    val result = solve(io.Source.stdin.getLines().toList)
    println(result)
  }
  def solve(ss: List[String]): String = {
    val rotN = ss.head.toInt
    val chars = ss(1).toList
    chars.map(rot(_, rotN)).mkString
  }
  def rot(c: Char, n: Int): Char = {
    val newIndex = alphabets.indexOf(c) + n
    alphabets(newIndex % alphabets.length)
  }
}



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

using namespace std;

vector<int> a;
stack<int> b, c;

bool dfs(int i)
{
	if (i == 10) return true;

	bool res1 = false, res2 = false;

    if (b.empty() || b.top() < a[i]) {
        b.push(a[i]);
        res1 = dfs(i + 1);
        b.pop();
    }

    if (c.empty() || c.top() < a[i]) {
        c.push(a[i]);
        res2 = dfs(i + 1);
        c.pop();
    }

	return res1 || res2;
}

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

	while (n--) {
		a.clear();
		while (b.size()) b.pop();
		while (c.size()) c.pop();

        for (int i = 0; i < 10; ++i) { int v; cin >> v; a.push_back(v); }

		if (dfs(0)) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}

Measured memory_bytes: 1212
#include <stdio.h>
#include<stdlib.h>
#include <string.h>
#define N 1005

void Lcs(char *X,char *Y)
{
  
  int m,n,i,j;
  int Z[N][N];
  
  m = strlen(X+1);
  n = strlen(Y+1);

  for(i = 0; i <= m; i++){
    Z[i][0] = 0;
  }
  for(j = 0; j <= n; j++){
    Z[0][j] = 0;
  }
  
  for(i = 1; i <= m; i++){
    for(j = 1; j <= n; j++){
      
      if(X[i] == Y[j]){
	Z[i][j] = Z[i-1][j-1] +1;
      }
      else if(Z[i-1][j] >= Z[i][j-1]){
	Z[i][j] = Z[i-1][j];
      }
      else {
	Z[i][j] = Z[i][j-1];
      }
    }
  }
  
  
  printf("%d\n",Z[i-1][j-1]);
}

main(){
  
  int n,i;
  char X[N],Y[N];
  
  
  
  scanf("%d",&n);

  for(i = 0; i < n; i++){
    scanf("%s%s",X+1,Y+1);

     Lcs(X,Y);
  }
  
  
  return 0;
  
  }

Measured memory_bytes: 4544