akhauriyash/Code-Regression huggingface dataset:
import sys
from io import StringIO
import unittest

def resolve():
    x, y = map(int, input().split())

    ans = [x]

    while 1:
        tmp = ans[-1] * 2
        if tmp > y:
            break
        else:
            ans.append(tmp)
            
    print(len(ans))

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """3 20"""
        output = """3"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """25 100"""
        output = """3"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """314159265 358979323846264338"""
        output = """31"""
        self.assertIO(input, output)

if __name__ == "__main__":
    #unittest.main()
    resolve()

Measured memory_bytes: 51184
n = int(input())
so = []

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

for i in range(1,n+1):
    li = prime_factorize(i)
    so += li

so.sort()

from collections import Counter

c = Counter(so)
now = 1

for i,j in c.items():
    now *= (j+1)
    now %= 10**9+7

print(now)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
long long N, A[101010];
int main(){
    cin >> N;
    long long mn = 1e18;
    long long sum = 0;
    long long neg = 0;


    for(int i = 0; i < N; i++){
        cin >> A[i];
        if(A[i] < 0)neg++;
        mn = min(mn, abs(A[i]));
        sum += abs(A[i]);
    }

    if(neg % 2 == 0)cout << sum << endl;
    else cout << sum - 2 * mn << endl;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int i,j,k,n,m,b[200001],l,r,lim,t,p1,p2;
int main(){
	while (scanf("%d%d",&n,&m)!=EOF){
		memset(b,0,sizeof(b));lim=trunc(sqrt(m));t=m/(lim+1);
		for (i=1;i<=n;i++){
			scanf("%d%d",&l,&r);
			k=r-l+1;b[1]++;b[k+1]--;
			for (j=k+1;j<=lim;j++)
			 if ((l/j!=r/j||l%j==0||r%j==0)&&r/j>t) b[j]++,b[j+1]--;
			for (j=1;j<=t;j++){
				p1=l/j;p2=r/j;
				if (l%j) p1++;
				p1=max(p1,k+1);
				if (p1<=p2) b[p1]++,b[p2+1]--;
			}
		}
		for (k=0,i=1;i<=m;i++) k+=b[i],printf("%d\n",k);
	}
	return 0;
}

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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

//↓0-originか1-originでn回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   //0-indexed昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) //1-indexed昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  //0-indexed降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   //1-indexed降順
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii; //2次元配列
typedef vector<ll> vll;
typedef pair<int, int> PII;

template<typename T>
using vec = vector<T>;
template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

const ld PI = acos(-1.0L);
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;
const int mod = 1000000007;
//const int mod = 998244353;


/*FUNCs=================================================*/
vec<vll> dp;


/*MAIN==================================================*/
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    //cout << fixed << setprecision(10);

    int n,weight; cin >> n >> weight;
    vi w(n), v(n); rep(i,n) cin >> w[i] >> v[i];
    dp.resize(n+1, vll(weight+1, 0));
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j <= weight; ++j) {
            if(j-w[i] >= 0) chmax(dp[i+1][j], dp[i][j - w[i]] + v[i]);
            chmax(dp[i+1][j], dp[i][j]);
        }
    }
    cout << dp[n][weight] << '\n';
}

Measured memory_bytes: 80256
#include <stdio.h>
int main(){
    int n,m,i;
    for(i=1;;i++){
        scanf("%d %d\n",&n,&m);
        if(n==0 && m==0)break;
        if(n>m) printf("%d %d\n",m,n);
        else printf("%d %d\n",n,m);
    }
        return 0;
}




Measured memory_bytes: 2040
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define endl '\n'
#define int ll

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;

const int INF = 1e9 + 7;

int dp[102][100005], w[102], v[102];

int32_t main()
{
	IO_OP;
	
	int n, W;
	cin >> n >> W;
	for(int i=1;i<=n;i++)
		cin >> w[i] >> v[i];
	memset(dp, 0x3f, sizeof dp);
	dp[0][0] = 0;
	for(int i=1;i<=n;i++) {
		for(int j=0;j<100005;j++) {
			dp[i][j] = dp[i-1][j];
			if(v[i] <= j) dp[i][j] = min(dp[i][j], w[i] + dp[i-1][j-v[i]]);
		}
	}
	int ans = 0;
	for(int i=1;i<100005;i++)
		if(dp[n][i] <= W)
			ans = i;
	cout << ans << endl;
}



Measured memory_bytes: 80000
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
 
using namespace std;
int m, n;
int p[10011];
int c[511];
int e[511];
int dp[10011][511];
 
int solve(int i,int j){
    if (i <= 0){
        return (0);
    }
    if (j == n){
        return 1e9;
    }
    if(dp[i][j] != -1){
        return dp[i][j];
    }
    int tmp, tmp2;
    tmp = e[j] + solve(i - c[j], j+1);
    tmp2 = solve(i, j+1);
     
    dp[i][j] = min(tmp, tmp2);
    //printf(" %d %d %d\n", i, j, dp[i][j]);
    return dp[i][j];
}
 
int main()
{
    scanf("%d %d", &m, &n);
    for (int i = 0; i < m; i++){
        scanf("%d", &p[i]);
    }
    for (int i = 0; i < n; i++){
        scanf("%d %d", &c[i], &e[i]);
    }
     
    memset(dp, -1, sizeof(dp));
    
    sort(p, p + m);
    reverse(p, p + m);
     
    int set_value = 0;
    int rieki = 0;
    for(int i = 0; i < m;i++){
        set_value += p[i];
        rieki = max(rieki, set_value - solve(i + 1, 0));
    }
     
    printf("%d\n", rieki);
}

Measured memory_bytes: 21088
#include<bits/stdc++.h>
using namespace std;
int a[200005] , f[200005];
int c[200005];
int n;
const int mod = 1e9 + 7;
int main()
{
    scanf("%d",&n) ;
    for(int i = 1;i <= n;i++){
        scanf("%d",&a[i]) ;
        if(a[i] == a[i - 1]) {i--;n--;}
    }
    f[0] = c[a[1]] = 1;
    for(int i = 1;i <= n;i++) {
        f[i] = c[a[i]] ;
        (c[a[i+1]] += f[i]) %= mod;
    }
    printf("%d\n",f[n]);return 0;
}


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

int main(){
  string a,b;
  cin >> a >> b;
  bool ok = (a[0]==b[2]) && (a[1]==b[1]) && (a[2]==b[0]);
  if(ok)cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
//bismillahir rahmanir rahim            //Author:Fayed Anik
 
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
//using namespace __gnu_pbds;
 
/*
template <typename T>  using ordered_set =
    tree<T, null_type, less<T>,   /// greater<T> for sorting decreasingly
    rb_tree_tag, tree_order_statistics_node_update>;
*/

#define         ll                          long  long
#define         lf                          double
#define         pb(x)                       push_back(x)
#define         ull                         unsigned long long
#define         sfl(a)                      scanf("%lld",&a)
#define         sf(a)                       scanf("%d",&a)
#define         pf(a)                       printf("%d\n",a)
#define         pfl(a)                      printf("%lld\n",a)
#define         FOR(x,n)                    for(ll x=1;x<=n;++x)
#define         pii                         pair< ll , ll >
#define         mp(a,b)                     make_pair(a,b)
#define         mod                         1000000007
#define         INF                         2e18
#define         f1                          first
#define         f2                          second
#define         all(v)                      v.begin(),v.end()
#define         PI                          acos(-1)
#define         printminusone               printf("-1\n")
#define         bug                         printf("bug")
#define         FILEIN                      freopen("in.txt","r",stdin)
#define         FILEOUT                     freopen("out.txt","w",stdout)
 
//ll SET(ll mask,ll pos){ return mask = (mask | (1ll<<pos)); }
//ll RESET(ll mask,ll pos){ return mask = mask & ~(1ll<<pos); }
//bool CHECK(ll mask,ll pos) { return (bool) (mask & (1ll<<pos)); }
//priority_queue <ll, vector<ll>, greater<ll> > pq;

pii a[100005];

bool comp(pii u,pii v)
{
    if(u.f1==v.f1){
        return u.f2 < v.f2;
    }
    else{
        return u.f1 < v.f1;
    }
}
int main(){
    ll n,m,tot=0,L,R;
    sfl(n),sfl(m);
    for(ll i=1;i<=m;i++){
        sfl(a[i].f1),sfl(a[i].f2);
    }
    sort(a+1,a+m+1,comp);
    for(ll i=1;i<=m;i++){
        if(i==1){
            R=a[i].f2;
        }
        else if(a[i].f1>=R){
            tot++;
            R=a[i].f2;
        }
        else{
            R=min(R,a[i].f2);
        }
    }
    pfl(tot+1);
    return 0;
}

Measured memory_bytes: 1792
x, y = map(int, input().split())
a = {1, 3, 5, 7, 8, 10, 12}
b = {4, 6, 9 ,11}
c = {2}
if x in a and y in a or x in b and y in b or x in c and y in c:
    print('Yes')
else:
    print('No')

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

int n;
long long t = 1;
long long a[100000];

int main()
{
	cin >> n;

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

		if (a[i] == 0)
			t = 0;
	}

	if (t != 0) {

		for (int i = 0; i < n; i++){

			if (t <= 1000000000000000000 / a[i])
				t *= a[i];
			else {
				t = -1;
				break;
			}
		}
	}

	cout << t << endl;
}


Measured memory_bytes: 4384
H, W = map(int, input().split())

matrix = []
for part in range(H):
    matrix.append(list(input()))

ans_matrix = []
for h in range(H):
    line = []
    for w in range(W):
        line.append(0)
    ans_matrix.append(line)

for h in range(H):
    for w in range(W):

        if matrix[h][w] == "#":

            for dh in range(-1, 1 + 1):
                for dw in range(-1, 1 + 1):
                    # mat は触ろうとしてる場所
                    mat_h = h + dh
                    mat_w = w + dw
                    # 危ないやつは無視
                    if mat_h < 0 or H <= mat_h or mat_w < 0 or W <= mat_w:
                        continue

                    ans_matrix[mat_h][mat_w] += 1

for h in range(H):
    for w in range(W):
        # 爆弾はそのまま表示
        if matrix[h][w] == "#":
            print("#", end="")
        else:
            print(ans_matrix[h][w], end="")
    
    print()

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

#define NIL (Node *)-1

struct Node {
	int key, priority;
	Node *p, *left, *right;
	Node( int k, int pr ) { key = k; priority = pr; p = left = right = NIL; }
};
Node *root = NIL;

Node *rightRotate( Node *t )
{
	Node *s = t->left;
	t->left = s->right;
	s->right = t;
	return s;
}

Node *leftRotate( Node *t )
{
	Node *s = t->right;
	t->right = s->left;
	s->left = t;
	return s;
}

Node *insert( Node *t, int k, int pr, int f )
{
	if( t == NIL ) {
		Node *n = new Node( k, pr );
		if( f ) {
			root = n;
		}
		return n;
	}
	if( k == t->key ) return t;
	if( k < t->key ) {
		t->left = insert( t->left, k, pr, 0 );
		if( t->priority < t->left->priority ) {
			t = rightRotate( t );
			if( f ) root = t;
		}

	}
	else {
		t->right = insert( t->right, k, pr, 0 );
		if( t->priority < t->right->priority ) {
			t = leftRotate( t );
			if( f ) root = t;
		}
	}
	return t;
}

Node *find( int k )
{
	Node *t = root;
	while( t != NIL ) {
		if( t->key == k ) {
			return t;
		}
		if( k < t->key ) {
			t = t->left;
		}
		else {
			t = t->right;
		}
	}
	return NIL;
}

Node *_del( Node *t, int k );
Node *del( Node *t, int k, int f )
{
	if( t == NIL ) return NIL;
	if( k < t->key ) t->left = del( t->left, k, 0 );
	else if( k > t->key ) t->right = del( t->right, k, 0 );
	else {
		Node *n = _del( t, k );
		if( f ) root = n;
		t = n;
	}
	return t;
}

Node *_del( Node *t, int k )
{
	if( t->left == NIL && t->right == NIL ) return NIL;
	if( t->left == NIL ) {
		t = leftRotate( t );
	}
	else if( t->right == NIL ) {
		t = rightRotate( t );
	}
	else {
		if( t->left->priority > t->right->priority ) {
			t = rightRotate( t );
		}
		else {
			t = leftRotate( t );
		}
	}
	return del( t, k, 0 );
}

void printp( Node *u )
{
	if( u == NIL ) return;
	cout << " " << u->key;
	printp( u->left );
	printp( u->right );
}

void printm( Node *u )
{
	if( u == NIL ) return;
	printm( u->left );
	cout << " " << u->key;
	printm( u->right );
}

int main()
{
	int m;
	cin >> m;
	for( int i = 0; i < m; i++ ) {
		string com;
		cin >> com;
		if( com == "insert" ) {
			int k, pr;
			cin >> k >> pr;
			insert( root, k, pr, 1 );
		}
		else if( com == "print" ) {
			printm( root );
			cout << endl;
			printp( root );
			cout << endl;
		}
		else if( com == "find" ) {
			int k;
			cin >> k;
			string ans = "no";
			if( find( k ) != NIL ) ans = "yes";
			cout << ans << endl;
		}
		else {
			int k;
			cin >> k;
			del( root, k, 1 );
		}
	}

}



Measured memory_bytes: 12524
#include <iostream>
#include <vector>
#include <climits>
using namespace std;


template<class T> bool chmin(T& a, T b){
    if(a > b){
        a = b;
        return true;
    }
    return false;
}

int main(void){
    int N, K;
    cin >> N >> K;

    vector<long long> h(N);
    vector<long long> dp(N, LLONG_MAX);

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

    dp[0] = 0;

    for(int i=0;i<N-1;i++){
        for(int j=1;j<K+1 && i+j<N;j++){
           chmin(dp[i+j], dp[i] + abs(h[i]-h[i+j]));
        }
    }

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

    return 0;
}

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

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define FORR(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 >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef priority_queue<int> PQ;
typedef priority_queue<int, V, greater<int>> PQG;

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

int N;
ll x;
VL a;

int main() {
    cin >> N >> x;
    a.resize(N);
    VECCIN(a);
    sort(All(a));
    int ans = 0;
    REP(i, N + 1) {
        if(i == N) {
            if(x)
                ans = i - 1;
            else
                ans = i;
            break;
        }
        x -= a[i];
        if(x <= 0) {
            if(x)
                ans = i;
            else
                ans = i + 1;
            break;
        }
    }
    cout << ans << "\n";
    return 0;
}

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

int count(vector<string> vec,string s){
  int x=0;
  for(int i=0;i<vec.size();i++)
    if(vec[i]==s)
      x+=1;
  return x;
}

int main(){
  int N;
  cin>>N;
  vector<string> vecbu(N);
  for(int i=0;i<N;i++)
    cin>>vecbu[i];
  int M;
  cin>>M;
  vector<string> vecre(M);
  for(int i=0;i<M;i++)
    cin>>vecre[i];
  
  int m=0;
  for(int i=0;i<N;i++){
    m=max(count(vecbu,vecbu[i])-count(vecre,vecbu[i]),m);
  }
  cout<<m<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

string s;

int main(){
	cin>>s;
	int S=s.size();
	while(1){
		S--;
		s=s.substr(0,S);
		if(S%2==0&&s.substr(0,S/2)==s.substr(S/2,S/2)){
			cout<<S<<endl;
			break;
		}
	}
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int x,y,z;
    while(1)
    {
        cin >> x >> y;
        if(x!=0 || y!=0)
        {
            if(x>y)
            {
                cout << y << " " << x << endl;
            }
            else
            {
                cout << x << " " << y << endl;
            }
        }
        else
        {
            break;
        }

    }
    return 0;
}



Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define fastio() ios::sync_with_stdio(0);cin.tie(0);

void solve(){
	int n; cin>>n;
	vi v(n);
	unordered_map<int,int> um;
	rep(i,0,n-1){cin>>v[i];um[v[i]]++;}
	//sort(all(v));
	
	if(um[1] == 1){cout << 1;return;}
	else if(um[1] > 1){cout << 0;return;}
	
	int cnt = 0;
	rep(i,0,n-1){
		int val = v[i];
		bool flag = false;
		if(um[val] > 1) continue;
		for(int j=2;j*j<=val;++j){
			if(val%j == 0){
				if(um.find(j)!=um.end()){
					flag = true; break;
				}
				if(um.find(val/j)!=um.end()){
					flag = true; break;
				}	
			}
		}
		if(!flag) cnt++;
	}
	cout << cnt;
}

int main(){
	fastio()
	
	int T = 1; //cin>>T;
	while(T--) solve();

	return 0;
}


Measured memory_bytes: 12140
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    s = sorted(input())
    t = sorted(input(), reverse=True)
    S = ''.join(map(str,s))
    T = ''.join(map(str,t))
    if S<T:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Measured memory_bytes: 3188
#include <stdio.h>
#define N 100
#define WHITE 0
#define BLACK 1
#define INF 100000

int n,m[N][N];

int min(){
  int color[N],d[N],p[N],i,j,min,u,sum=0;
  for(i=0;i<n;i++){
    d[i]=2001;
    p[i] = -1;
    color[i] = WHITE;
  }
  d[0]=0;
  while(1){
    min = 2001;
    for(i=0;i<n;i++){
      if(min>d[i]&&color[i]!=BLACK){
	u =i;
	min = d[i];
      }
    }
    if(min == 2001) break;
    color[u] = BLACK;
    for(j=0;j<n;j++){
      if(color[j]!=BLACK){
	if(d[j]>m[u][j]&&m[u][j]!=-1){
	  d[j] = m[u][j];
	  p[j] = u;
	}
      }
    }
  }
  for(i=0;i<n;i++){
    if(p[i]!=-1){
      sum+=m[i][p[i]];
    }
  }
  return sum;

}

int main(){
  int i,j;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&m[i][j]);
    }
  }
  printf("%d\n",min());
  return 0;
}

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

using namespace std;

class Solution {
public:
	void solve() {
		long long a, b, n;
		cin >> a >> b >> n;
		auto f = [&](long x) { return (a * x) / b - a * (x / b); };
		cout << f(min(n, b - 1)) << "\n";

		return;
	};
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	Solution solution;
	solution.solve();
	return 0;
}

Measured memory_bytes: 3664
def main():
    m, k = map(int, input().split())

    max_a = pow(2, m)

    if k >= max_a:
        print(-1)
        exit()

    if m == 0:
        print('0 0')
        exit()

    if m == 1:
        if k == 0:
            print('0 0 1 1')
        else:
            print(-1)
        exit()

    l = [0] * (2 * max_a)
    l[0] = k
    l[max_a] = k
    for i in range(k):
        l[i + 1] = i
        l[-i - 1] = i
    for i in range(k + 1, max_a):
        l[i] = i
        l[-i] = i
    print(' '.join(map(str, l)))

main()

Measured memory_bytes: 100332
#include <iostream>

using namespace std;
long long n, nr;
int main()
{
    cin>>n;
    nr=0;
    if(n%2==0)
    {
        for(long long p=5; p<=n; p=p*5)
        {
            nr+=(n/(p*2));
        }
    }

    cout<<nr<<'\n';
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
int main() {
    long X;
    std::cin >> X;
    for (long a = 0; a <= 120; a++)
        for (long b = -120; b < a; b++)
            if ((a * a * a * a * a - b * b * b * b * b) == X) {
                std::cout << a << " " << b << std::endl;
                return 0;
            }
}


Measured memory_bytes: 3584
#define C
typedef long long readtype;

/* Header {{{ */
#ifdef C
#include <stdio.h>
#include <math.h>
#include <string.h>
#define isdigit(a) ((a) >= '0' && (a) <= '9' ? true : false)
template<typename type> type abs(type a) { return a < 0 ? -a : a; }
template<typename type> type min(type a, type b) { return a < b ? a : b; }
template<typename type> type beMin(type &a, type b) { return a = (a < b ? a : b); }
template<typename type> type max(type a, type b) { return a > b ? a : b; }
template<typename type> type beMax(type &a, type b) { return a = (a > b ? a : b); }
template<typename type> void swap(type &a, type &b) { type c; c = a; a = b; b = c; }
#endif

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

typedef long long var;

readtype read() {
  readtype a = 0, c = getchar(), s = 0;
  while (!isdigit(c)) s |= c == '-', c = getchar();
  while (isdigit(c)) a = a * 10 + c - 48, c = getchar();
  return s ? -a : a;
}
/* }}} */

const int N = 501;

int mat[N][N];

int main() {
  /*
#ifndef ONLINE_JUDGE
  freopen("source.in", "r", stdin);
  freopen("source.out", "w", stdout);
#endif
  */
  int H = read(), W = read(), h = read(), w = read();
  for (int i = 1; i <= H; ++i)
    for (int j = 1; j <= W; ++j) 
      mat[i][j] = 1000;
  for (int x = h; x <= H; x += h)
    for (int y = w; y <= W; y += w) 
      mat[x][y] = -(((h * w - 1) * 1000) + 1);
  int res = 0;
  for (int i = 1; i <= H; ++i) {
    for (int j = 1; j <= W; ++j) res += mat[i][j];
  }
  if (res <= 0) {
    puts("No");
    return 0;
  } else {
    puts("Yes");
    for (int i = 1; i <= H; ++i) {
      for (int j = 1; j <= W; ++j) printf("%d ", mat[i][j]);
      puts("");
    }
  }
  return 0;
}


Measured memory_bytes: 2432
#include <cstdio>
#include <algorithm>
#include <iostream>
#define INT long long int
using namespace std;

INT n, x, ans;

INT f(INT n, INT x)
{
    if( n%x == 0 ) return (n-x)+2*x*((n-x)/x);
    else return (n-x)+2*x*((n-x)/x) + f(x+(n%x), n%x)-(n%x);
}

int main()
{
    cin>>n>>x;
    cout<<f(n, x)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl "\n"
const int MAX= 100005 ;
const long long mod = 1.0e9+7;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,i;
    cin>>n;
    ll arr[n],x=0;
    for(i=0;i<n;i++)
    {
        cin>>arr[i];
        x=x^arr[i];
    }
    if(x==0)
    {
        cout<<"Yes"<<endl;
        
    }
    else
            cout<<"No"<<endl;
    return 0;
}


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

int main (){
  int N,x;
  cin >> N >> x;
  
  vector<int> a(N);
  for (int i=0;i<N;i++){
    cin >> a[i];
  }
  
  sort(a.begin(),a.end());
  
  int sum=0;
  
  for(int i=0;i<N;i++){
    sum += a[i];
    if(sum > x){
      cout << i << endl;
      return 0;
    }
  }
  
  if(sum == x){
    cout << N << endl;
  }
  else{
    cout << N-1 << endl;
  }
  
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void){
  long int N, M;
  cin >> N >> M;
  long int p[M+1];
  string S[M+1];

  long int AC_flag[N+1];

  long int i;
  for(i=1; i<=N+1; i++)
    AC_flag[i] = 0;
  
  for(i=1; i<=M; i++)
    cin >> p[i] >> S[i];

 long int WA_count = 0, AC_count = 0;
  for(i=1; i<=M; i++){
    if(AC_flag[ p[i] ] == 0 && S[i]=="WA"){
      WA_count++;
    }
    else if(AC_flag[p[i]] == 0 && S[i]=="AC"){
      AC_flag[p[i]] = 1;
      AC_count++;
    }
  }

  for(i=1; i<=M; i++)
    if(AC_flag[p[i]] == 0)
      WA_count--;
  
  cout << AC_count << " " << WA_count << endl;

  return 0;
}


Measured memory_bytes: 7296
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[9]={1,0,-1,0,1,1,-1,-1,0};
const ll dx[9]={0,-1,0,1,1,-1,1,-1,0};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    ll n,c;cin >> n >> c;
    vvl d(c,vl(c));rep(i,c)rep(j,c)cin >> d[i][j];
    vvl v(3,vl(c,0));
    rep(i,n)rep(j,n){
        ll a;cin >> a;a--;
        v[(i+j)%3][a]++;
    }
    ll res=inf;
    rep(i,c){
        rep(j,c){
            if(i==j)continue;
            rep(k,c){
                if(i==k||j==k)continue;
                ll sum=0;
                rep(x,c){
                    sum+=d[x][i]*v[0][x];
                }
                rep(x,c){
                    sum+=d[x][j]*v[1][x];
                }
                 rep(x,c){
                    sum+=d[x][k]*v[2][x];
                }
                /*cout << sum <<endl;
                cout << i <<" " << j <<" " << k <<endl;*/
                chmin(res,sum);
            }
        }
    }
    cout << res <<endl;
}   

Measured memory_bytes: 3652
parseInt(x) = parse(Int, x)
parseBigInt(x) = parse(BigInt, x)
parseFloat(x) = parse(Float64, x)
parseBigFloat(x) = parse(BigFloat, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    t::String=readline()
    l::Int=length(t)
    ans::Int=0
    for i in 1:l
        if t[i]=='?'
            ans+=1
            if i>1 && t[i-1]=='P'
                ans+=1
            end
        end
        if i<l && t[i:i+1]=="PD"
            ans+=1
        end
        if t[i]=='D'
            ans+=1
        end
    end
    for i in t
        if i=='?'
            print("D")
        else
            print(i)
        end
    end
end
main()

Measured memory_bytes: 164732
import sys
import math
import fractions
import itertools
from collections import deque
import copy
import bisect

MOD = 10 ** 9 + 7
INF = 10 ** 18 + 7
input = lambda: sys.stdin.readline().strip()

A = [list(map(int,input().split())) for _ in range(3)]
N = int(input())
b = [int(input()) for _ in range(N)]

for i in b:
    for l in A:
        for c in range(3):
            if l[c] == i:
                l[c] = -1
for i in A:
    if set(i) == {-1}:
        print('Yes')
        sys.exit()
for i in range(3):
    if A[0][i] == A[1][i] == A[2][i] == -1:
        print("Yes")
        sys.exit()
if A[0][0] == A[1][1] == A[2][2]:
    print("Yes")
    sys.exit()
if A[2][0] == A[1][1] == A[0][2] == -1:
    print("Yes")
    sys.exit()
print("No")

Measured memory_bytes: 5244
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[200010],dp[600][600];

vi vec[120000];
bool pass[120000][2];
int ans[120000][2];

void dfs(int node,int y,int p){
  if(pass[node][y])return;
  pass[node][y] = true;
  ans[node][y] = p;
  rep(i,0,vec[node].sz)dfs(vec[node][i] , y , p + 1);
}

int main(){
  cin >> n;
  rep(i,0,n-1){
    cin >> m >> l;
    m--;l--;
    vec[m].pb(l);
    vec[l].pb(m);
  }
  dfs(0,0,0);
  dfs(n-1,1,0);
  l = 0;
  rep(i,0,n)if(ans[i][0] <= ans[i][1])l++;
  if(2 * l > n)puts("Fennec");
  else puts("Snuke");
  return 0;
}

Measured memory_bytes: 11904
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    vb flag(10000,false);
    vi v(10000,0);
    string s;
    while(getline(cin,s)){
        if(s=="")break;
        string temp;
        rep(i,s.size()){
            if(s[i]==',')break;
            else temp.push_back(s[i]);
        }
        v[(int)stoi(temp)]++;
    }
    while(getline(cin,s)){
        if(s=="")break;
        string temp;
        rep(i,s.size()){
            if(s[i]==',')break;
            else temp.push_back(s[i]);
        }
        if(v[stoi(temp)]){flag[(int)stoi(temp)]=true;
        v[(int)stoi(temp)]++;
        }
    }
    rep(i,1009)if(flag[i])cout<<i<<" "<<v[i]<<endl;
    
}

Measured memory_bytes: 3024
n, m = map(int,input().split())
dp = [1]*(n+1)
a = []
for i in range(m):
    ai = int(input())
    a.append(ai)

for i in a:
    dp[i] = 0

for i in range(2,n+1):
    if dp[i] != 0:
        dp[i] = (dp[i-1] + dp[i-2]) % (10**9+7)

print(dp[n])

Measured memory_bytes: 7848
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  Int n,k,l;
  cin>>n>>k>>l;
  vector<Int> a(n);
  for(Int i=0;i<n;i++) cin>>a[i];
  
  auto calc=[&a,n,k](Int x){
    Int r=0;
    deque<Int> d;
    for(;r<n&&(Int)d.size()<k;r++)
      if(a[r]<=x) d.emplace_back(r);
    
    Int res=0;
    if((Int)d.size()==k) res+=d[0]+1;
    //cout<<r-1<<" "<<a[r-1]<<":"<<res<<endl;
    
    for(;r<n;r++){
      if(a[r]<=x) d.emplace_back(r);
      while((Int)d.size()>k) d.pop_front();
      if((Int)d.size()==k) res+=d[0]+1;
      //cout<<r<<" "<<a[r]<<":"<<res<<endl;
    }
    //cout<<x<<":"<<res<<endl;
    return res;
  };
  Int L=0,R=n+1;
  while(L+1<R){
    Int M=(L+R)>>1;
    if(calc(M)<l) L=M;
    else R=M;
  }
  cout<<R<<endl;
  return 0;
}



Measured memory_bytes: 5660
#include<stdio.h>
#include<algorithm>
using namespace std;

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

int selectionSort(int A[], int N) {
  int i, j, minj, count = 0;
  for (i=0;i<N;i++) {
    minj = i;
    for (j=i;j<N;j++) {
      if (A[j] < A[minj]) {
        minj=j;
      }
    }
    if (minj > i) {
      swap(A[i],A[minj]);
      count++;
    }
  }
  trace(A, N);
  return count;
}

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

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

  count = selectionSort(A, N);
  printf("%d\n", count);

  return 0;
}



Measured memory_bytes: 2756
#include<bits/stdc++.h>
using namespace std;
int arr[100010];
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> arr[i];
    }
    multiset<int> ms;
    int answer = 1;
    for (int i = 1; i <= n; ++i) {
        if (i > 1) {
            if (ms.lower_bound(arr[i]) == ms.begin()) {
                ++answer;
            } else {
                ms.erase(--ms.lower_bound(arr[i]));
            }
        }
        ms.insert(arr[i]);
    }
    cout << answer;
}

Measured memory_bytes: 8684
var
	s,t:String;
	c,i:Longint;
begin
	readln(s);
	for i:=length(s)downto 1 do begin
		if s[i]='B' then inc(c)else if c>0 then dec(c) else t:=s[i]+t;
	end;
	writeln(t);
end.

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

    private static Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) {

        solve();
    }

    private static void solve() {

        double l = scanner.nextInt();


        double base = l / 3;

        double result = Math.pow(base, 3) ;

        System.out.println(result);
    }
}

Measured memory_bytes: 22228
#include<iostream>
using namespace std;
int main() {
    int n; cin >> n;
    string a, b, c; cin >> a >> b >> c;
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        int cnt = 0;
        if (a[i] != b[i]) cnt++;
        if (b[i] != c[i]) cnt++;
        if (c[i] != a[i]) cnt++;
        if (cnt != 0) cnt--;
        ans += cnt;
    }
    cout << ans << endl;
    return 0;
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define F first
#define S second
#define vll vector<ll>
#define fast ios:: sync_with_stdio(false),cin.tie(0);
#define COUT cout<<fixed<<setprecision(12)
#define SET set<ll,greater<ll>>gquiz
#define ITERATOR set<ll,greater<ll>> :: iterator itr
#define V vector<ll>vector
#define sz size()
//#define A vector<pair<ll,ll>>vect
ll N=100000,M=100000;
#define B vect.push_back(make_pair(N,M));
ll MOD=1000000007;
 
bool isprime(ll n){if(n==1 || (n!=2 && n%2==0))return false; if(n==2)return true; 
		for(ll i=3;i<=sqrt(n);i+=2)if(n%i==0)return false; return true; }
ll gcd(ll a,ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
/*
ll ncr(ll n,ll r)
{
	if(n==1 || r==0)
	return 1;
	if(r>n/2)
	r=n-r;
	ll ans=1;
	for(ll i=1;i<=r;i++)
	{
		ans=((ans * n )/i);
		n--;
	}
	return ans;
}
*/
ll pow1(ll n,ll k,ll mm){
    if(k==0)return 1;
    if(k%2==0)return (pow1((n%mm)*(n%mm),k/2,mm))%mm;
    return ((n%mm)*(pow1((n%mm)*(n%mm),k/2,mm)%mm))%mm;
}
ll pow(ll a,ll b,ll m)
{
	ll ans=1;
	while(b>0)
	{
		if(b&1)
			ans=(ans*a)%m;
		b=b/2;
		a=(a*a)%m;
	}
	return ans;
}
 
ll modinv(ll k)
{
	return pow(k,MOD-2,MOD);
}

ll ncr(ll n,ll c)
{
    ll t=1;
    c=min(c,n-c);
    for(ll i=1;i<=c;i++)
    {
     	t=(t*(n-i+1))%MOD;
        t=(t*modinv(i))%MOD;
	}
    return t;
}
int main()
{
	fast;
	ld l;
	cin>>l;
	ld k=l/3.0;
	ld pro=k*k*k;
	COUT<<pro;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {

    int m, f, r, i;

    while(1){

        scanf("%d %d %d", &m, &f, &r);

        if(m == -1 && f == -1 && r == -1){
            break;
        }

        if(m == -1 || f == -1){
            puts("F");
        } else if(m + f >= 80){
            puts("A");
        } else if(80 > m + f && m + f >= 65){
            puts("B");
        } else if(65 > m + f && m + f >= 50 || r >= 50){
            puts("C");
        } else if(50 > m + f && m + f >= 30){
            puts("D");
        } else if(30 > m + f){
            puts("F");
        }
    }

    return 0;
}


Measured memory_bytes: 2092
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
    int n;
    cin >> n;
    vector<int> veven(n), vodd(n);
    const int N = 100001;
    int even[N] = {0};
    int odd[N] = {0};
    for (int i = 0; i < n / 2; ++i) { //n is even
        cin >> veven[i] >> vodd[i];
        even[veven[i]]++;
        odd[vodd[i]]++;
    }
    int maxeven = 0, maxodd = 0;
    int ideven = 0, idodd = 0;
    for (int i = 1; i < N; ++i) {
        if (maxeven < even[i]) {
            maxeven = even[i];
            ideven = i;
        }
    }
    for (int i = 1; i < N; ++i) {
        if (maxodd < odd[i]) {
            maxodd = odd[i];
            idodd = i;
        }
    }
    if (ideven != idodd) {
        cout << n - maxeven - maxodd << endl;
    } else {
        sort(even, even + N, greater<int>());
        sort(odd, odd + N, greater<int>());
        cout << n - max(even[0] + odd[1], even[1] + odd[0]) << endl;
    }
    return 0;
}


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

using namespace std;

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

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}

int f(int n){
    int cnt = (n+1)/2;
    int ret = 0;
    if(cnt%2)ret++;
    if(n%2 == 0){
        ret ^= n;
    }
    return ret;
}

signed main(void) {
    int a,b;
    cin >> a >> b;
    int ans = f(a-1)^f(b);
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <cmath>
#include <iomanip>
#include <string>
#include <utility>
#include <stack>
#include <numeric>
#include <random>
#include <algorithm>
#include <queue>
#include <functional>
#include <iterator>
#include <list>
using namespace std;

#define rep(i, b, e) for(i = b; i < e; ++i)
#define repr(i, b, e) for (i = b; i >= e; --i)
#define ull unsigned long long int
#define ll long long int
#define pint pair<int, int>

#define M_DEBUG 1
#define PI 3.141592653589793

#define E '\n'

#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define INF (1e18)

const ll MAX = 1000000000;
const ll MOD = 1e9 + 7;

ll a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z;

int main(void) {
    cin >> n >> m;
    if (n == m)
        cout << "Yes" << endl;
    else 
        cout << "No" << endl;


    return 0;
}



Measured memory_bytes: 256
while 1:
    w= int(input())
    if w== -1: break
    a= 1150
    if w> 10 and w<= 20:
        a+= (w-10)*125
    elif w> 20 and w<= 30:
        a+= (w-20)*140+ 1250
    elif w> 30:
        a+= (w-30)*160+ 1400+ 1250
    print(4280-a)

Measured memory_bytes: 7508
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
typedef pair<ll, ll> Pair;
template <class T> T input() {T t; cin>>t; return t;}
#define FOR(i,a,b) for (ll i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (ll i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,x) for (ll i = 0; i < x.size(); i++)
#define RREPALL(i,x) for (ll i = x.size()-1; i >= 0; i--)
#define REPITR(itr,x) for (auto itr = (x).begin(); itr != (x).end(); itr++)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x,num) count(ALL(x), num)
#define MEMSET(x,val) memset(x, val, sizeof(x))
#define CHMAX(a,b) a = max(a,b)
#define CHMIN(a,b) a = min(a,b)
#define FIND(x,key) x.find(key) != x.end()
#define IN_RANGE_V2(v,k,x,y) (0<=x+dx[k]&&x+dx[k]<v[y].size()&&0<=y+dy[k]&&y+dy[k]<v.size())
#define debug(x) cerr<<__LINE__<<": "<<(#x)<<" = "<<(x)<<endl;
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
#define PRINT_ARRAY_H(a) REPALL(__i,a) {cout<<a[__i]<<(__i != a.size()-1 ? " " : "");} newline;
#define PRINT_ARRAY_V(a) REPALL(__i,a) {cout<<a[__i]<<endl;}
#define e1 first
#define e2 second
#define newline putchar('\n')
#define cspace ' '
#define sspace " "
const int INF = 1e7;
const ll MOD = 1e9 + 7;
const double pi = 3.141592653589793;
const VI dx = {1, 0, -1, 0};
const VI dy = {0, 1, 0, -1};
//const VI dx = {1, 1, 0, -1, -1, -1, 0, 1};
//const VI dy = {0, 1, 1, 1, 0, -1, -1, -1};

void solve()
{
    ll a, b, c, d, n, m, l, r, k, x, y, z, ans = 0ll;
    string s, t;
    cin>>n;
    VLL L(n);
    REP(i,n) cin>>L[i];
    SORT(L);
    FOR(i,0,n) {
        FOR(j,i+1,n) {
            if (L[i] == L[j]) continue;
            FOR(k,j+1,n) {
                if (L[j] == L[k]) continue;
                if (L[i] + L[j] > L[k]) ans++;
            }
        }
    }
    cout<<ans<<endl;
}

int main()
{
    cout<<fixed<<setprecision(20);
    int __t = 1;
    //cin>>__t;
    REP(i,__t) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3624
def main():
    N,M,X=map(int,input().split())
    arr=[]
    for _ in range(N):
        arr.append(list(map(int,input().split())))
    minn=int(13e9)
    for counter in range(1<<N):
        cost=0
        knowledge=[0]*M
        for i in range(N):
            if counter&(1<<i)!=0:
                cost+=arr[i][0]
                for j in range(1,M+1):
                    knowledge[j-1]+=arr[i][j]
        flag=True
        for j in range(M):
            if knowledge[j]<X:
                flag=False
                break
        if flag:
            minn=min(cost,minn)
    if minn==13000000000:
        print(-1)
    else:
        print(minn)
if __name__=='__main__':
    main()

Measured memory_bytes: 68592
/*input
20 40 6

*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define mod 1000000007
#define PI 3.14159265
// #define endl '\n'
#define debug(x) cout << #x << " = " << x << endl;
#define MAX 250001

template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(ll a, ll b) {a += b; if (a < 0) a += mod; return a;}
inline int sub(ll a, ll b) {a -= b; if (a < 0) a += mod; return a;}
inline int mul(ll a, ll b) {return (a * 1ll * b) % mod;}
inline int pwr(ll x, ll y) {
  int ans = 1 % mod;
  while (y) {
    if (y & 1) ans = mul(ans, x);
    x = mul(x, x);
    y >>= 1;
  }
  return ans;
}
inline int inv(int a) {return pwr(a, mod - 2);}


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

  int n;
  cin >> n;
  int cur = 0;
  int ans = 0;
  int v;
  for (int i = 0; i < n; i++) {
    cin >> v;
    if (v >= cur) {
      ans++;
      cur = max(cur, v);
    }
  }
  cout << ans << endl;

  return 0;
}

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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;

//status unsolved
int main(){
    long long n;
    cin>>n;
    set<long long>tree;
    rep(i,n){
    long long a;
    cin>>a;
    if(tree.find(a)!=tree.end()){
        tree.erase(a);
    }
    else{
    tree.emplace(a);
    }

    }
    cout<<tree.size()<<endl;
    
    return 0;

}
/*


*/


Measured memory_bytes: 4864
S = input()


def main():
    l = len(S)
    for i in range(int((l - 1) / 2)):
        # print(S[i], S[l - i - 1])
        if S[i] != S[l - i - 1]:
            return False
    S2 = S[:int((l - 1) / 2)]
    # print(S2)
    for i in range(int((len(S2) - 1) / 2) + 1):
        # print(S2[i], S2[len(S2) - i - 1], len(S2), len(S2) - i - 1)
        if S2[i] != S2[len(S2) - i - 1]:
            return False
    S3 = S[int((l + 3) / 2) - 1:]
    # print(S3)
    for i in range(int((len(S3) - 1) / 2) + 1):
        # print(S3[i], S3[len(S3) - i - 1])
        if S3[i] != S3[len(S3) - i - 1]:
            return False
    return True


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


Measured memory_bytes: 38384
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;


namespace StartFinish
{

    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                //??\??????0???

                string x = Console.ReadLine();
                if (x[0] == '0')
                {
                    break;
                }

                int sum = 0;
                for (int i = 0; i < x.Length; i++)
                {
                    sum += int.Parse(x[i].ToString());
                }
                Console.WriteLine(sum);

            }
        }
    }
}

Measured memory_bytes: 9256
use strict;

my @args = split(' ',<>);
my $a = @args[0];
my $b = @args[1];
my $c = @args[2];
my $d = @args[3];


my $ab = $a * $b;
my $cd = $c * $d;

if ($ab < $cd) {
  print($cd)
} else {
  print($ab)
}


Measured memory_bytes: 4828
#include <iostream>
#include <cstdio>

//#define PI 3.141592653589

using namespace std;



int main()
{
	/*
    double r;
    cin >> r;
    printf("%f %f\n", r*r*PI, 2 * r*PI);
	*/
	
	int a, b;
	char op;
	
	while (1)
	{
		cin >> a >> op >> b;
		if (op == '?') return 0;
		else if (op == '+') cout << a+b << "\n";
		else if (op == '-') cout << a-b << "\n";
		else if (op == '*') cout << a*b << "\n";
		else if (op == '/') cout << a/b << "\n";
	}
	
	return 0;
}

Measured memory_bytes: 1164