akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;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 repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((a) ? "YES" : "NO"); }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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 T, class U>ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}
template <class T>ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "{";
	rep(i, v.size()) {
		if (i) os << ",";
		os << v[i];
	}
	os << "}";
	return os;
}
template <class T, class U>istream& operator>>(istream& is, pair<T, U>& p) {
	is >> p.first >>p.second ;
	return is;
}
template <class T>istream& operator>>(istream& is,  vector<T>& v) {
	rep(i, v.size()) {
		is >> v[i];
	}
	return is;
}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	string s,t;
	int q;
	cin >>s>>t>>q;
	Vi hashs(s.size() + 1, 0),hasht(t.size()+1,0);
	rep(i,s.size()){
		if(s[i]=='A'){
			hashs[i+1]++;
		}else{
			hashs[i+1] += 2;
		}
		hashs[i + 1] += hashs[i];
		hashs[i + 1] %= 3;
	}
	rep(i, t.size()) {
		if (t[i] == 'A') {
			hasht[i + 1]++;
		} else {
			hasht[i + 1] += 2;
		}
		hasht[i + 1] += hasht[i];
		hasht[i + 1] %= 3;
	}
	int a, b, c, d;
	int det1, det2;
	rep(i, q) { cin >> a >> b >> c >> d;
		det1 = hashs[b] - hashs[a-1];
		det1 %= 3;
		det1+= 3;
		det1 %= 3;
		det2 = hasht[d] - hasht[c - 1];
		det2 %= 3;
		det2 +=  3;
		det2 %= 3;
		cout << solve(det1 == det2) << endl;
	}
//	cout<<ans<<endl;
}

/*
A
BB
BAA
BBBA
BAABA
AAAABA
ABA

A
BB
AAB
ABBB
ABBAA
ABAAAA
ABA
前後にAB,BAを挿入できる
ABA -> A

BBBA> BB

A==BB,B=AA
ハッシュ関数が計算できれば...
任意にAB,BAを追加、削除できる
任意にAAA,BBBを追加、削除できる
ABA
BBBAAAA = a
BBB
AAA|AB|BBB|AAA|BBB=' 
BBB|AAA|BBB|BBB=
S*T*Q
'*/

Measured memory_bytes: 4316
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
template <typename T> using V = vector<T>;
constexpr int Mod = 998244353;
constexpr int mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
template <typename T> constexpr bool chmax(T &a, const T &b) {
    if(a >= b) return false;
    a = b;
    return true;
}
template <typename T> constexpr bool chmin(T &a, const T &b) {
    if(a <= b) return false;
    a = b;
    return true;
}

/*-------------------------------------------*/

const long double pi = acosl(-1.0L);
constexpr int MX = 1e8 - 1;

int sx, tx, sy, ty;
int n;
V<int> x, y;

long double solve0() {
    bool b = false;
    long double res = (abs(sx - tx) + abs(sy - ty)) * 100;
    rep(i, n) {
        b |= (sx == tx && sx == x[i]);
        b |= (sy == ty && sy == y[i]);
    }
    if(b) {
        res -= 20;
        res += pi * 10;
    }
    return res;
}

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

    cout << fixed << setprecision(15);

    cin >> sx >> sy >> tx >> ty >> n;
    x.resize(n);
    y.resize(n);
    rep(i, n) cin >> x[i] >> y[i];

    if(sx > tx) {
        swap(sx, tx);
        swap(sy, ty);
    }

    if(sy > ty) {
        sy = MX - sy;
        ty = MX - ty;
        rep(i, n) y[i] = MX - y[i];
    }

    struct Point {
        int x, y;
    };
    V<Point> p;
    rep(i, n) if(sx <= x[i] && x[i] <= tx && sy <= y[i] && y[i] <= ty)
        p.push_back({x[i], y[i]});

    sort(ALL(p), [](Point a, Point b) { return a.y < b.y; });
    rep(i, p.size()) p[i].y = i;

    sort(ALL(p), [](Point a, Point b) { return a.x < b.x; });

    int dp[200009];
    fill(ALL(dp), mod);
    for(auto &&po : p)
        *lower_bound(ALL(dp), po.y) = po.y;

    int k = lower_bound(ALL(dp), mod) - dp;

    long double res = 100LL * (abs(sx - tx) + abs(sy - ty));

    res -= 20 * k;
    res += k * 5 * pi;

    if(k == min(tx - sx, ty - sy) + 1) res += 5 * pi;

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 4336
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    private static long n;

    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 12:25-

            int n = sc.nextInt();
            int k = sc.nextInt();

            double prob = 0.0;
            for (int i = 1; i <= n; i++) {
                prob += chance(i, k) / ((double) n);
            }

            out.println(prob);
        }
    }

    private static double chance(int v, int k) {
        double p = 1.0;
        while (v < k) {
            v *= 2;
            p *= 0.5;
        }
        return p;
    }
}


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

# define C continue;
# define R return

# define D double
# define I insert
# define ll long long
# define ld long double

# define ull unsigned long long
# define ui unsigned int

# define pb push_back
# define pf push_front

# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >
# define vld vector < ld >
# define PQ priority_queue

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvs vector < vs >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) v.begin() , v.end() , comp
# define allrevcomp(v) v.rbegin() , v.rend() , comp

# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >

# define vpld vector < pld >
# define vpii vector < pii >
# define vpll vector < pll >
# define vpDD vector < pDD >

# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

# define dist(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b))

# define pp(n) printf("%.10Lf",n);
# define line cout<<"\n";
# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);

string vow = "aeiou";
int month[] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

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

const ld pie = 3.1415926535897932384626 ;
const ll mod = 1e9 + 7 ;

/// Tip : If a and b are positive integers ; we may say - ceil (a/b) = 1 + floor ( (a-1)/b ) .

void solve ( int test_case )
{
    int x , n ;
    cin >> x >> n ;

    vi v ( n ) ;
    for ( int i=0 ; i < n ; i ++ )
        cin >> v[i] ;

    vb vis ( 2000 ) ;

    for ( auto &i : v )
        vis[i] = true ;

    int max_diff = INT_MAX ;
    int ans = x ;

    for ( auto &val : v )
    {
        for ( int i = max ( val - 300 , 0 ) ; i <= val + 300 ; i ++ )
        {
            if ( vis[i] ) C ;

            if ( abs ( i - x ) < max_diff )
                max_diff = abs ( i - x ) , ans = i ;
        }
    }

    cout << ans ; line ;
}

int main()
{fast
    int t = 1;
    // cin >> t;

    for ( int i = 1 ; i <= t ; i ++ )
    {
        solve ( i ) ;
    }

    return 0;
}


Measured memory_bytes: 3664
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n))
#define Vec(a,n) vector<string> (a)((n))
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0))
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0))
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a))
#define RSort(a) reverse(All(Sort(a)))
#define Reverse(a) reverse(All(a))
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define Lower(a,t) lower_bound(All(a),t)
using namespace std;
int max_int = 1000000007;


signed main(){
    int n;
    cin >> n;
    vec(a,n);
    REP(i,n){
        cin >> a[i];
    }
    Sort(a);
    int tmp = a[n-1];
    REP(i,n-1){
        tmp -= a[i];
    }
    (tmp>=0)? cout << "No" << endl: cout << "Yes" << endl;
    
    return 0;
}



Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include<fstream>
#include<iostream>
#include<string>
#include<iomanip>
#include<list>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

int n;
int w[1000];
int v[1000];

int dp[1000][1000];
int rec(int i, int j){
	if (dp[i][j]>0) return dp[i][j];
		int res;
	if (i == n) res = 0;
	else if (j<w[i]){
		res = rec(i + 1, j);
	}
	else{
		res = max(rec(i + 1, j), rec(i + 1, j - w[i]) + v[i]);
	}
	dp[i][j] = res;
	return res;
}

int main(int argc, char **argv){
	int n;
	while (cin >> n && n > 0) {
		pair<int, int> p;
		vector<pair<pair<int, int>, int>> v;
		int ci;
		int m, s;
		for (int i = 0; i < n; i++) {
			cin >> ci;
			p.first = 0;
			p.second = 0;
			for (int j = 0; j < 4; j++) {
				cin >> m >> s;
				p.first += m;
				p.second += s;
			}
			p.first += p.second / 60;
			p.second %= 60;
			v.push_back(make_pair(p, ci));
		}
		sort(v.begin(), v.end());
		cout << v[0].second << endl;
		cout << v[1].second << endl;
		cout << v[v.size() - 2].second << endl;
	}
	return 0;
}

Measured memory_bytes: 1328
#include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int x, y, tmp, c;
	
	while(1){
		cin >> x >> y;
		if(x == 0 && y == 0){
			break;
		}
		c = 0;
		if(x < y){
			tmp = x;
			x = y;
			y = tmp;
		}
		
		while(y > 0){
			tmp = x % y;
			x = y;
			y = tmp;
			c++;
		}
		
		cout << x << " " << c << endl;
	}
	
	return 0;
}

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

int main(){
	int a,b,c;
	cin>>a>>b>>c;
	if(max(a,b)-min(a,b)>max(a,c)-min(a,c)){
		cout<<'B'<<endl;
    }else{
		cout<<'A'<<endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x,long long int y) 
{ 
    long long int res = 1;     // Initialize result 
  // x=x;
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x); 
   
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x);  // Change x to x^2 
    } 
    return res; 
}
long long int power(long long int x,long long int y,long long int m) 
{ 
    long long int res = 1;     // Initialize result 
   x=x%m;
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x)%m; 
   
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x)%m;  // Change x to x^2 
    } 
    return res; 
}
void primeFactors(int n)  
{  
    // Print the number of 2s that divide n  
    while (n % 2 == 0)  
    {  
        cout << 2 << " ";  
        n = n/2;  
    }  
  
    // n must be odd at this point. So we can skip  
    // one element (Note i = i +2)  
    for (int i = 3; i <= sqrt(n); i = i + 2)  
    {  
        // While i divides n, print i and divide n  
        while (n % i == 0)  
        {  
            cout << i << " ";  
            n = n/i;  
        }  
    }  
  
    // This condition is to handle the case when n  
    // is a prime number greater than 2  
    if (n > 2)  
        cout << n << " ";  
}

long long int gcd(long long int a, long long int b){ 
    if (a == 0) 
        return b;  
    return gcd(b % a, a);  
 } 
 long long int lcm(long long int a, long long int b)  
 { 
     long long int temp;
    
    return (a*b)/gcd(a, b);  
 }
 
int main() {
   long long int i,j;
 
   
 //long long int b[1000000];
 //set<long long int >s;
       long long int f=0,p=0,z,o=0;
       double pie=3.141592653589793238;
    long long int n,m,l=0,k,c,min1=10000000000000,max2=-100;
   cin>>m>>n;
   if(n==0)
   cout<<m;
   else
   {
   long long int a[102];
   for(i=0;i<=101;i++)
     a[i]=0;
   for(i=0;i<n;i++)
   {cin>>p;
    a[p]=1;
   }
   //sort(a,a+n);
     p=0;
   for(i=0;i<102;i++)
   {
     if(min1>abs(m-i)&&a[i]==0)
     {
     p=i;
     min1=abs(m-i);}
   }
   cout<<p;
   }
 return 0;
}


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

typedef pair<int, int> pii;
typedef long long ll;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cerr << #x << " = " << (x) << endl
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template<class T, class U> void chmin(T& t, const U& u) { if (t > u) t = u; }
template<class T, class U> void chmax(T& t, const U& u) { if (t < u) t = u; }

template<class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os<<"{";
	rep(i, v.size()) {
		if (i) os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

template <unsigned int MOD>
struct ModInt {
	using uint = unsigned int;
	using ull = unsigned long long;
	using M = ModInt;

	uint v;

	ModInt(ll _v = 0) { set_norm(_v % MOD + MOD); }
	M& set_norm(uint _v) { //[0, MOD * 2)->[0, MOD)
		v = (_v < MOD) ? _v : _v - MOD;
		return *this;
	}

	explicit operator bool() const { return v != 0; }
	M operator+(const M& a) const { return M().set_norm(v + a.v); }
	M operator-(const M& a) const { return M().set_norm(v + MOD - a.v); }
	M operator*(const M& a) const { return M().set_norm(ull(v) * a.v % MOD); }
	M operator/(const M& a) const { return *this * a.inv(); }
	M& operator+=(const M& a) { return *this = *this + a; }
	M& operator-=(const M& a) { return *this = *this - a; }
	M& operator*=(const M& a) { return *this = *this * a; }
	M& operator/=(const M& a) { return *this = *this / a; }
	M operator-() const { return M() - *this; }
	M& operator++(int) { return *this = *this + 1; }
	M& operator--(int) { return *this = *this - 1; }

	M pow(ll n) const {
		if (n < 0) return inv().pow(-n);
		M x = *this, res = 1;
		while (n) {
			if (n & 1) res *= x;
			x *= x;
			n >>= 1;
		}
		return res;
	}

	M inv() const {
		ll a = v, b = MOD, p = 1, q = 0, t;
		while (b != 0) {
			t = a / b;
			swap(a -= t * b, b);
			swap(p -= t * q, q);
		}
		return M(p);
	}

	bool operator==(const M& a) const { return v == a.v; }
	bool operator!=(const M& a) const { return v != a.v; }
	friend ostream& operator<<(ostream& os, const M& a) { return os << a.v; }
};

using Mint = ModInt<1000000007>;

const int maxn = 1010;
const int maxk = 22;

Mint dp[maxk][maxn];
Mint comb[maxn][maxn];

int main() {
	int N, K; cin >> N >> K;
	V<int> a(K); rep(i, K) cin >> a[i];

	rep(i, maxn) {
		comb[i][0] = comb[i][i] = Mint(1);
		for (int j = 1; j < i; ++j) {
			comb[i][j] = comb[i-1][j-1] + comb[i-1][j];
		}
	}

	dp[0][N] = Mint(1);

	rep(i, K) {
		for (int j = 0; j <= N; ++j) {
			for (int k = 0; k <= j; ++k) {
				if (k <= a[i]) {
					dp[i+1][j-k] += dp[i][j] * comb[j][k] * comb[N - k][a[i] - k];
				}
			}
		}
	}
	cout << dp[K][0] << endl;

	return 0;
}

Measured memory_bytes: 4352
#include"bits/stdc++.h"
using namespace std;
int f[100001][4];
int n;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=3;j++)
			scanf("%d",&f[i][j]);
	for(int i=2;i<=n;i++)
	{
		for(int j=1;j<=3;j++)
		{
			int maxn=0;
			for(int k=1;k<=3;k++)
			{
				if(j==k)
					continue;
				maxn=max(maxn,f[i-1][k]);
			}
			f[i][j]+=maxn;
		}
	}
	printf("%d",max(f[n][1],max(f[n][2],f[n][3])));
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep2(i,m,n) for (int i = (m); i < (n); ++i)
#define rep(i,n) rep2(i,0,n)
typedef long long int ll;
typedef long double ld;
typedef pair<int, int> P;
template<typename T> struct V : vector<T> { using vector<T>::vector; };
V() -> V<int>;
V(size_t) -> V<int>;
template<typename T> V(size_t, T) -> V<T>;
template<typename T> vector<T> make_vec(size_t n, T a) { return vector<T>(n, a); }
template<typename... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec(ts...))>(n, make_vec(ts...)); }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
const int INF = 1<<30;
const ll LINF = 1LL<<61;

int main()
{
    int d, t, s;
    cin >> d >> t >> s;
    int idou = t * s;
    if(idou < d) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3664
#include<stdio.h>

int combination(int n, int r)
{
    if (r == 0 || r == n)
        return (1);
    else if (r == 1)
        return (n);
    return (combination(n - 1, r - 1) + combination(n - 1, r));
}

int main(void){
    /*偶数と偶数、奇数と奇数のペアの数を調べれば良い*/
    int n,m;
    int ans = 0;
    scanf("%d %d",&n,&m);
    if(n != 1 && n != 0){
        ans = combination(n,2);
        //printf("%d\n",ans);/**/
    }
    //printf("yes\n");/**/
    if(m != 1 && m != 0){
        ans += combination(m,2);
        //printf("%d\n",ans);/**/
    }
    if(n == 1 && m == 1){
        ans = 0;
    }else if(ans == 0){
        ans = 1;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)
#define rrep(i,j,n) for(ll i = (ll)(j); i < (ll)(n); i++)
#define mrep(i,n) for (ll i = (ll)(n); i > 0; i--)
#define be(v) (v).begin(), (v).end()
#define dcout cout << fixed << setprecision(20) 
ll INF = 1LL << 60;
ll mod = 1e9 + 7;

int main() {
	int a,b;
	cin >> a >> b;
	a--; b--;
	cout << a*b << endl;
} 

Measured memory_bytes: 3536
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<algorithm>
using namespace std;
int main()
{
	long long a,b,n;
	cin >> a >> b >> n;
	if(n<b){
		cout << a*n/b-a*(n/b) << endl;
	}
	else{
		cout << a*(b-1)/b-a*((b-1)/b) << endl;
	}
	return 0;
}

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

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int a; cin>>a;
	long long int sum = a * a;
	sum *= 3;
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 3644
import java.util.Scanner;	//Scannerクラス：Java標準入力を取得する


class Main{
	public static void main(String[] args) {
		int x = 1;
		int y = 1;
		try (Scanner sc = new Scanner(System.in)) {
			while(x != 0 || y !=0) {
				x = sc.nextInt();
				y = sc.nextInt();
			if(x == 0 && y == 0)break;
			else if(x > y) {
				System.out.println(String.format("%d %d",y,x));
			}else {
			    System.out.println(String.format("%d% d",x ,y));
			}
			}
		}
	}
}



Measured memory_bytes: 40264
numset = set([])
q = int(input())
for i in range(q):
    query, x = list(map(int, input().split(' ')))
    if query == 0:
        numset.add(x)
        print(len(numset))
    elif query == 1:
        if set([x]).issubset(numset):
            print(1)
        else:
            print(0)
    else:
        if set([x]).issubset(numset):
            numset.remove(x)


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

int main () {
	int n, x, y;
	cin >> n >> x >> y;
	int ans[n];
	for(int i = 1; i < n; i++) ans[i] = 0;
	for(int i = 1; i < n; i++) {
		for(int j = i + 1; j <= n; j++) {
			int temp = abs(j - i);
			temp = min(temp, abs(i - x) + abs(j - y) + 1);
			temp = min(temp, abs(i - y) + abs(j - x) + 1);
			ans[temp] += 1;
		}
	}
	for(int i = 1; i < n; i++) {
		cout << ans[i] << "\n";
	}
	return 0;
}

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

typedef long long ll;

const int maxn = 1010, mod = 1e9 + 7;
int H, W;
char a[maxn][maxn];
ll dp[maxn][maxn];

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

    cin >> H >> W;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> a[i][j];
        }
    }
    dp[0][0] = 1;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (i == 0 && j == 0) {
                continue;
            }
            if (a[i][j] == '#') {
                dp[i][j] = 0;
            } else {
                if (i - 1 >= 0) {
                    dp[i][j] = (dp[i][j] + dp[i - 1][j]) % mod;
                }
                if (j - 1 >= 0) {
                    dp[i][j] = (dp[i][j] + dp[i][j - 1]) % mod;
                }
            }
        }
    }
    cout << dp[H - 1][W - 1];

    return 0;
}

Measured memory_bytes: 12464
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <deque>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <random>
#include <fstream>
#include <time.h>
// #define int long long
#define debug(x) cerr << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1e9+7;
const ll LINF = 1e18;
const double EPS = 1e-9;


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

  int n,k;
  cin>>n>>k;
  cout << n-k+1 << endl;


  return 0;
}



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

typedef long long ll;

int N;
int a[22][22];
ll dp[22][4200000];
bool v[22][4200000];
ll m = 1000000007;

ll solve(int pref, int subset)
{
    if (pref < 0 || subset < 0) return 0LL;
    if (!pref && !subset) return 1LL;
    if (!v[pref][subset])
    {
        v[pref][subset] = 1;
        if (pref != __builtin_popcount(subset)) return 0LL;
        for (int i = 1; i <= N; i++)
        {
            if (a[pref][i] && (subset & (1 << (i-1))))
            {
                dp[pref][subset] += solve(pref - 1, subset ^ (1 << (i-1)));
                if (dp[pref][subset] >= m) dp[pref][subset] -= m;
            }
        }
    }
    return dp[pref][subset];
}

int main()
{
    scanf("%d", &N);
    for (int i = 1; i <= N; i++)
    {
        for (int j = 1; j <= N; j++)
        {
            int tmp;
            scanf("%d", &tmp);
            a[i][j] = tmp;
        }
    }
    printf("%lld\n", solve(N,(1 << N) - 1));
    return 0;
}


Measured memory_bytes: 407808
#include<cstdio>

using namespace std;

int main() {

    int a, b, c;
    int cnt = 0;

    scanf("%d %d %d", &a, &b, &c);

    for(int i = a; i <= b; i++){
        if(c % i == 0) {
            cnt++;
        }
    }

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

    return 0;    
}


Measured memory_bytes: 2760
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; i++)
#define rep2(i,a,n) for (int i = a; i < n; i++)
using namespace std;
int main() {
    int N, K; cin >> N >> K;
    long long A[N];
    rep(i, N) cin >> A[i];
    long long ans =  pow(2, 61);
    if (K == 1) {
        printf("0\n");
        return 0;
    }
    for (int bit = 0; bit < (1<<N); bit++) {
        int num = bitset<32>(bit).count();
        if (num != K) continue;
        if (!(bit & (1<<0))) continue;
        long long res = 0;
        long long st_height = A[0];
        for (int a = 1; a < N; a++) {
            if (bit & (1<<a)) {
                if (A[a] > st_height) {
                    st_height = A[a];
                } else {
                    st_height++;
                    res += st_height - A[a];
                }
            } else {
                if (A[a] > st_height) st_height = A[a];
            }
        }
        if (res < ans) ans = res;
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 3704
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);

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

	// <<a,b>, c>
	vector<pair<pair<bool, bool>, bool>> d(n);

	int x; cin >> x;
	rep(i, x) { int a; cin >> a; d[a - 1].first.first = true; }
	int y; cin >> y;
	rep(i, y) { int a; cin >> a; d[a - 1].first.second = true; }
	int z; cin >> z;
	rep(i, z) { int a; cin >> a; d[a - 1].second = true; }

	int ans = 0;
	rep(i, n) {
		if (!d[i].first.first&&d[i].second)ans++;
		else if (d[i].first.second&&d[i].second)ans++;
	}
	Cout(ans);
}


Measured memory_bytes: 3108
'use strict'
const main = arg => {
	const input = arg.trim().split("\n");
	let S = input[0]
	console.log(removeSerial(S).length - 1)
	function removeSerial(S){
		let result = S[0]
		for(let i = 1; i < S.length; i++) {
			if(result[result.length - 1] === S[i]) {
				continue
			} else {
				result += S[i]
			}
		}
		return result
	}
}   
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 38856
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
long long int mod = (long long int)1000000007;
using namespace std;

void solve()
{
    ll i,j,k,n;
    std::cout.precision(10);
    int yes=0;
    cin>>n;
    ll m=1000000000000000000;
    for(i=-1200;i<=1200;i++)
    {
        for(j=-1200;j<=1200;j++)
        {
            if(pow(i,(ll)5)==pow(j,(ll)5)+n)
            {
                cout<<i<<" "<<j;
                return;
            }
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
    int i,j,k;
    int t;
    std::cout.precision(10);
    t=1;
    while(t--)
    {
        solve();
        cout<<"\n";
    }
}

Measured memory_bytes: 3992
#include<bits/stdc++.h>
 using namespace std;
 #define int long long
 #define endl "\n"
 const int mod=1e9+7;
 #define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 #define clr(a,x) memset(a,x,sizeof(a))
 #define T int t;cin>>t; while(t--)
 #define vll vector<int> 
 #define v22 vactor<vector<int>>
#define pb push_back
 #define sz size
 #define str to_string
 #define um unordered_map<int,int>
 #define intt stoll
 #define first first
 #define second second
 #define sv() sort(a.begin(),a.end())
 #define vp vector<pair<int, int>> 
 vll p(1e7 + 1, 1);
 int32_t main()
 {
  string s,t;
  cin>>s>>t;
  int n=s.size(),m=t.size();
  int l[n+1][m+1]={0};
  for(int i=0;i<=n;i++)
  {
    for(int j=0;j<=m;j++)
    {
      if(i==0 || j==0)
      l[i][j]=0;
      else if(s[i-1]==t[j-1])
      l[i][j]=1+l[i-1][j-1];
      else 
      l[i][j]=max(l[i-1][j],l[i][j-1]);
    }
  }
  string q="";
  int i=n,j=m;
  while(i>0 && j>0)
  {
    if(s[i-1]==t[j-1])
    {q+=s[i-1];
    i--;j--;}
      else if (l[i-1][j] > l[i][j-1]) 
         i--; 
      else
         j--; 
  }
  if(q.size()!=0){
  for(i=q.size()-1;i>=0;i--)
  cout<<q[i];
}
else 
cout<<" ";
}

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

// definitions
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define rep(i, l, r) for (long long i = (l); i < (long long)(r); i++)
#define repb(i, r, l) for (long long i = (r); i > (long long)(l); i--)
#define pb push_back
#define mod1 998244353
#define mod 1000000007
#define MAX_CHAR 256

using namespace std;
typedef vector<long long> vl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector< pair<long long, long long> > vp;
typedef vector<tuple<long long , long long , long long> > vtup;
typedef deque <long long> dq;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;


// standard functions
ll gcd(ll x, ll y) {
    if (x < y) return gcd(y, x);
    if (y == 0) return x;
    return gcd(y, x % y);
} 
 


ll modexp(ll x, ll ex, ll modp) {
    ll ans = 1ll;
    while (ex > 0) {
        if (ex & 1ll) ans = (ans * x)%modp;
        ex >>= 1ll;
        x = (x * x)%modp;
    }
    return ans;
} 
 
ll nCrModp(ll n, ll r, ll p) 
{ 
    ll C[r+1]; 
    memset(C, 0, sizeof(C)); 
  
    C[0] = 1; 
    for (ll i = 1; i <= n; i++) 
    { 
        for (ll j = min(i, r); j > 0; j--) 
            C[j] = (C[j] + C[j-1])%p; 
    } 
    return C[r]; 
}
 
bool isPrime(ll n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true;  
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ll i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
} 
 
vl countFreq(ll arr[], ll n) 
{ 
    unordered_map<ll, ll> mp; 
    vector <ll> v;
    
    for (ll i = 0; i < n; i++) 
        mp[arr[i]]++; 
   
    for (auto x : mp) 
        v.pb(x.second);
    
    return v;
}

ll binarySearch(ll arr[], ll l, ll r, ll x) 
{ 
    while (l <= r) 
    { 
        ll m = l + (r - l) / 2; 
        if (arr[m] == x) 
            return m; 
        if (arr[m] < x) 
            l = m + 1; 
        else
            r = m - 1; 
    }
    return -1; 
}

const ll MAXSIEVE=(1e3);
ll spf[MAXSIEVE];
void sieve() 
{ 
    spf[1] = 1; 
    for (ll i=2; i<MAXSIEVE; i++) 
        spf[i] = i; 

    for (ll i=4; i<MAXSIEVE; i+=2) 
        spf[i] = 2; 
  
    for (ll i=3; i*i<MAXSIEVE; i++) 
    { 
        if (spf[i] == i) 
        { 
            for (ll j=i*i; j<MAXSIEVE; j+=i) 
                if (spf[j]==j) 
                    spf[j] = i; 
        } 
    } 
}

// code beigns in main
int main()
{
    
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll t=1;
    // cin >> t;
    
    while(t--)
    {
        ll n,x,y;
        cin >> n >>x >>y;
        
        ll count[n-1];
        clr(count);
        rep(i,1,n+1)
        {
            rep(j,i+1,n+1)
            {
                ll m=min(min(abs(i-j),abs(x-i)+1+abs(y-j)),abs(y-i)+1+abs(j-x));
                count[m]++;
            }
        }
        
        rep(i,1,n-1)
            cout << count[i] << endl;
        cout << 0 << endl;
    }
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi >
#define vvvi vector<vvi >
#define pii pair<int,int>
#define INF (int)1e9
#define MOD (int)1e9+7
typedef long long llong;
using namespace std;

int main(){
	llong a,b,c,d;
	cin>>a>>b>>c>>d;
	
	llong e=(c*d)/__gcd(c,d);
	
	llong cnt=(a-1)/c+(a-1)/d-(a-1)/e;
	llong cntt=b/c+b/d-b/e;
	
	cout<<(b-a+1)-(cntt-cnt)<<endl;
}

Measured memory_bytes: 256
#include <string>
#include <iostream>
#include <stack>
#include <queue> // priority_queue も入ってる
#include <set>   // 要素数は size() で取得 multisetもある
#include <map>
#include <array> // sizeはコンパイル時定数で固定
#include <vector>
#include <numeric>   // accumulate, gcd
#include <algorithm> // count_ifに必要
#include <iomanip>   // cout << setprecision(15) << x で小数の出力精度を指定
#include <tuple>
#include <utility> //pair
#include <cmath>
#include <random>

using namespace std;
// 問題が起こるまでintは使用禁止2020-04-13
using ll = long long;

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

template <class InputIterator, class T>
bool contains_itr(InputIterator iterator, const T &value)
{
    if (find(iterator.begin(), iterator.end(), value) == iterator.end())
        return false;
    else
        return true;
}

template <class T>
bool contains_set(set<T> st, const T &value)
{
    if (st.find(value) == st.end())
    {
        return false;
    }
    else
    {
        return true;
    }
}

template <class InputIterator>
auto sum(InputIterator iterator)
{
    return accumulate(iterator.begin(), iterator.end(), 0);
}

// endは排他的(exclusive)なので注意
vector<ll> range(ll begin, ll end)
{
    vector<ll> result;
    for (ll i = begin; i < end; ++i)
    {
        result.push_back(i);
    }
    return result;
}

random_device seed_gen;
mt19937 engine(seed_gen());
// 0, 1, 2 のどれかが得られる一様分布
// uniform_int_distribution<> dist(0, 2);
// cout << dist(engine) << endl;
// みたいに、先に確率分布を宣言して、そこにengineを与えて使う。

// =========ここまでテンプレ============

int main()
{
    string s;
    cin >> s;
    int n = 0;
    for (auto itr = s.begin(); itr != s.end(); ++itr)
    {
        n += ((int)((*itr) - '0'));
        n %= 9;
    }
    if (n == 0)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3496
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		long x = sc.nextLong();
		long total = 100;
		long result = 0;

		while(total < x) {
			total = (long) (total + total * 0.01);
			result++;
		}

		System.out.println(result);
	}

}


Measured memory_bytes: 35792
import java.util.*;

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

    if(R<1200){
		System.out.println("ABC");	 
    }else if(R>=1200 && R<2800){
		System.out.println("ARC");
    }else{
		System.out.println("AGC");	    
	}
}
}

Measured memory_bytes: 22868
N, M = (int(i) for i in input().split())
if N == 1 and M == 1:
    print(1)
elif N == 1 or M ==1:
    print(max(N, M) - 2)
elif N == 2 or M == 2:
    print(0)
else:
    print((N - 2) * (M - 2))

Measured memory_bytes: 3060
/*
g++ -std=c++11 -o2 -Wall ABC100D.cpp -o ./out/ABC100D.out
./out/ABC100D.out
*/

#include <bits/stdc++.h>
using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define tr(c, i) for (iter(c) != (c).begin(); i != (c).end(); ++i)
#define pb push_back
#define mp make_pair

typedef long long ll;

constexpr int maxn = 1005;
int n,m;
ll a[maxn],b[maxn],c[maxn],d[maxn],w,ans;
int main(){
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++)scanf("%lld%lld%lld",a+i,b+i,c+i);
	for(int i=0;i<8;i++){
		for(int j=0;j<n;j++){
			d[j]=((i&1)?1:-1)*a[j]+((i&2)?1:-1)*b[j]+((i&4)?1:-1)*c[j];
		}
		sort(d,d+n);w=0;
		for(int j=0;j<m;j++){
			w-=d[j];
		}
		ans=max(ans,w);
	}
	printf("%lld",ans);
	return 0;
}

/*
ll a[1001];
ll b[1001];
ll c[1001];
ll d[1001];

int main(){
//    freopen("./input/input.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < n; ++i) {
      cin >> a[i] >> b[i] >> c[i];
    }
    int ad[] = {-1, 1};
    int bd[] = {-1, 1};
    int cd[] = {-1, 1};
    ll ans = -1;
    for (int i = 0; i < 2; ++i) {
      for (int j = 0; j < 2; ++j) {
        for (int k = 0; k < 2; ++k) {
          for (int l = 0; l < n; ++l) {
            d[l] = ad[i]*a[l]+bd[j]*b[l]+cd[k]*c[l];
          }
          sort(d,d+n,greater<ll>());
          ll temp = 0;
          for (int l = 0; l < m; ++l) {
            temp += d[l];
          }
          ans = max(ans, temp);
        }
      }
    }
    cout << ans << "\n";
}
*/


Measured memory_bytes: 256
#include<stdio.h>

#define NIL NULL

struct node
{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};

typedef struct node * Node;

Node root;

Node treeMinimum(Node x)
{
  while(x->left != NIL)
    {
      x = x->left;
    }
  
  return x;
}

Node treeMaximum(Node x)
{
  while(x->right != NIL)
    {
      x = x->right;
    }
  
  return x;
}

Node treeSearch(Node u, int k)
{
  if(u == NIL || k == u->key) return u;
  if(k < u->key) return treeSearch(u->left,k);
  else return treeSearch(u->right,k);
}

Node treeSuccessor(Node x)
{
  Node y;
  
  if(x->right != NIL)
    {
      return treeMinimum(x->right);
    }
  y = x->parent;

  while(y != NIL && x == y->right)
    {
      x = y;
      y = y->parent;
    }
  
  return y;
}

void insert(int k)
{
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL)
    {
      y = x;

      if(z->key < x->key)
	{
	  x = x->left;
	}
      else
	{
	  x = x->right;
	}
    }
  z->parent = y;

  if(y == NIL)
    {
      root = z;
    }
  else if(z->key < y->key)
    {
      y->left = z;
    }
  else
    {
      y->right = z;
    }

  return;
}

void inorder(Node u)
{
  if(u == NIL) return;

  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);

  return;
}
void preorder(Node u)
{
  if(u == NIL) return;

  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);

  return;
}


int main()
{
  int n, i, x;
  char com[20];
  
  scanf("%d", &n);

  for ( i = 0 ; i < n ; i++ )
    {
      scanf("%s", com);
      if ( com[0] == 'f' )
	{
	  scanf("%d", &x);
	  Node t = treeSearch(root, x);
	  if ( t != NIL ) printf("yes\n");
	  else printf("no\n");

	}
      else if ( com[0] == 'i' ) //insert
	{
	  scanf("%d", &x);
	  insert(x);
	}
      else if ( com[0] == 'p' ) //print
	{
	  inorder(root);
	  printf("\n");
	  preorder(root);
	  printf("\n");
	}
    }

  return 0;
}



Measured memory_bytes: 25140
#include<iostream>
using namespace std;
int main() {
	int r, d, x, i;
	cin >> r >> d >> x;
	//xi+1 = r * xi - d
	for (i = 1; i <= 10; i++) {
		x = r * x - d;
		cout << x << '\n';
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

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

        char[] chs = sc.next().toCharArray();
        long n = chs.length;

        Map<Character, Long> countMap = new HashMap<>();

        for(char ch: chs) {
            if(!countMap.containsKey(ch)) {
                countMap.put(ch, 1L);
            } else {
                countMap.computeIfPresent(ch, (c, l) -> l + 1);
            }
        }

        long count = n * (n - 1) / 2 + 1;
        for(char ch: countMap.keySet()) {
            long m = countMap.get(ch);
            count -= m * (m - 1) / 2;
        }

        System.out.println(count);
    }
}

Measured memory_bytes: 35048
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;
int main() {
	long long int a;
	cin >> a;
	if (a % 10 == 9 || a / 10 == 9) {
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import sys
import os


lst = input().split()
stack = []

for c in lst:
    if c == '+':
        a = stack.pop()
        b = stack.pop()
        stack.append(b + a)
    elif c == '-':
        a = stack.pop()
        b = stack.pop()
        stack.append(b - a)
    elif c == '*':
        a = stack.pop()
        b = stack.pop()
        stack.append(b * a)
    else:
        stack.append(int(c))
print(stack[0])



Measured memory_bytes: 5604
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
#include <numeric>
#include <bitset>
#include <cassert>
#include <functional>

using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)

int main() {
	vector<int> a(3), b(3);
	rep(i, 3) {
		cin >> a[i] >> b[i];
	}
	vector<int> cnt(5, 0);
	rep(i, 3) {
		cnt[a[i]]++;
		cnt[b[i]]++;
	}
	int cnt1 = 0, cnt2 = 0;
	rep(i, 5) {
		if (cnt[i] == 1) {
			cnt1++;
		}
		else if (cnt[i] == 2) {
			cnt2++;
		}
	}
	if (cnt1 == 2 && cnt2 == 2) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;
int main(){
  int N;
  cin >> N;
  string n[N];
  for (int i=0;i<N;i++){
    cin >> n[i];
  }
  int ac=0,wa=0,tle=0,re=0;
  for (int i=0;i<N;i++){
    if (n[i]=="AC"){
      ac++;
    }
    if (n[i]=="WA"){
      wa++;
    }
    if (n[i]=="TLE"){
      tle++;
    }
    if (n[i]=="RE"){
      re++;
    }
  }
  cout <<"AC x "<<ac<<endl;
  cout <<"WA x "<<wa<<endl;
  cout <<"TLE x "<<tle<<endl;
  cout <<"RE x "<<re<<endl;
}


Measured memory_bytes: 6720
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b){return *(char*)a - *(char*)b;} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b){return strcmp(*(const char **)a, *(const char **)b);} /* aaa,aab.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

int main(void) {
  int N;
  scanf("%d", &N);
  int ans = 0;
  rep(i, 0, N / 4 + 1) {
    int rem = N - i * 4;
    if ( rem % 7 == 0 ) ans = 1;
  }
  printf(ans ? "Yes" : "No");
  return 0;
}


Measured memory_bytes: 128
//g++でビルド

#include "bits/stdc++.h"

using namespace std;

int n, k;
bool dp[100010];
vector<int> as;

int main(){
    cin >> n >> k;
    as.resize(n);
    for(int i = 0; i < n; i++){
        cin >> as[i];
    }

    for(int i = 0; i < as[0]; i++){
        dp[i] = false;
    }

    for(int j = as[0]; j <= k; j++){
        bool now = false;
        for(int i = 0; i < n; i++){
            if(j - as[i] >= 0){
                if(dp[j-as[i]]){
                    //now = false;
                }else{
                    now = true;
                    break;
                }
            }
        }
        dp[j] = now;
        //cout << "dp[" << j << "]:" << dp[j] << endl;
    }

    string result = "Second";
    if(dp[k]) result = "First";

    
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

const int MAX_A = 55555;

int n;
bool pf[MAX_A + 1];

void create_prime() {
    rep(i, MAX_A + 1) pf[i] = true;
    pf[0] = pf[1] = false;
    
    for(int i = 2; (i * i) <= MAX_A; i++) {
        if (!pf[i]) {
            continue;
        }
        
        for (int ii = 2; (i * ii) <= MAX_A; ii++) {
            pf[i * ii] = false;
        }
    }
}

bool is_prime(int n) {
    return pf[n];
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin >> n;
    create_prime();
    int cnt = 0;
    
    rep(i, n) {
        while(!pf[++cnt * 5 + 1]);
        printf("%d%s", cnt * 5 + 1, (i == (n - 1)) ? "\n" : " ");
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <cstdlib>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    int N, i, L[201], ans=0;

    cin >> N;

    for(i=1; i<=2*N; i++){
        cin >> L[i];
    }

    sort(L+1, L+2*N+1);

    for(i=1; i<=N; i++){
        ans += min(L[2*i-1], L[2*i]);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ctime>
#include <cstdlib>
#define rep(i, N) for (long i = 0; i < (N); i++)
#define swap(a, b) (a += b, b = a - b, a -= b)
using namespace std;
int main()
{
    int A, B, C;
    cin >> A >> B >> C;
    int D = A - B;
    if (C > D)
    {
        cout << C - D << endl;
    }
    else
    {
        cout << 0 << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string> //文字列
#include <iomanip> //doubleの桁数指定
#include <list> //前後に数値を入れれる配列



#define REP(i,m,n) for(ll i = (ll) (m);i < (ll) (n);i++) //forの短縮
#define rep(i,n) REP(i,0,n) //REPが0の時
#define ll long long int

using namespace std;

double PI = 3.141592653589793; //円周率

//常設関数↓

//最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

//最小公倍数
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}

//degree → radian
ll chg_DegRad(int deg) {
	return deg * PI / 180.0;
}

//radian → degree
ll chg_RadDeg(int rad) {
	return rad * 180.0 / PI;
}

//提出コード↓

ll n;
ll a[101];
string ans = "APPROVED";




int main() {
	
	cin >> n;
	rep(i, n) cin >> a[i];
	rep(i, n) {
		if (a[i] % 2 == 0) {
			if (a[i] % 3 != 0 && a[i] % 5 != 0) {
				ans = "DENIED";
				break;
			}

		}
	}
	cout << ans << endl;



	return 0;
}



Measured memory_bytes: 384
#input
a = list(map(int,input().split())) #input from array of integer like "1 2 3"
n = a[3]
a = a[:3]
range_r = n//a[0]+1
range_g = n//a[1]+1
cnt = 0
for r in range(range_r):
  for g in range((n-r*a[0])//a[1]+1):
    rg = r*a[0]+g*a[1]
    if (n - rg)%a[2]==0:
      cnt += 1

print(cnt)

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

using namespace std;

int n,i;
char s[200005];
stack <char> a;

int main(){
	scanf("%s", s);
	n = strlen(s);
	
	for(i = 0; i < n; i++){
		if(s[i] == 'T'){
			if(a.empty() || a.top() == 'T')
			a.push('T');
			else
			a.pop();
		}
		else
		a.push('S');
	}
	
	printf("%d\n", a.size());
	
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s, t;
	cin >> s >> t;
	int n = s.size();
	sort(s.begin(), s.end());
	sort(t.begin(), t.end());
	vector<int> is1(26), is2(26);
	rep(i, n) is1[s[i] - 'a']++, is2[t[i] - 'a']++;
	sort(is1.begin(), is1.end());
	sort(is2.begin(), is2.end());
	if (is1 == is2) printf("%s\n", "Yes");
	else printf("%s\n", "No");
	return 0;
}


Measured memory_bytes: 916