akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define what_is(x)    cerr<<#x<<" is "<<x<<"\n";
#define rep(i,a,n)    for(int i=a; i<=n; ++i)
#define rep1(i,a,n)   for(int i=a; i>=n; --i)
#define pb            push_back
#define mp            make_pair
#define int           long long
#define fr            first
#define sc            second
#define vc            vector
#define sz(v)         (int)v.size()
#define all(x)        (x).begin(),(x).end()
#define rall(x)       (x).rbegin(),(x).rend()
#define M             1000000007
#define MM            998244353
#define PI            3.14159265358979
#define INF           1000000000000000

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

int n,m,ans; string str;

int solve(){
    string str1; cin>>n>>str>>str1;
    n=sz(str);
    rep(i,0,n-1){
        cout<<str[i]<<str1[i];
    }
    return 0;
}

signed main() {
    ios::sync_with_stdio(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}

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

#define gcd(m,n) __gcd(m,n)
#define lcm(m,n) m*(n/gcd(m,n))
#define fast std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pi acos(-1.0)
#define endl '\n'
#define MOD 1000000007
#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define dbg(x) cout << #x << "  " << x << endl;

using namespace std;

ll mod(ll a, ll b) { return (a % b + b) % b; }
ll power(ll base, ll exp) 
{ll res=1;while(exp>0) {if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return res;}

int main()
{
	fast;
	ll A,B,C; cin>>A>>B>>C;
	if(C >= A && C <= B) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;	
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  string s;
  cin >> s;
  vi cnt(26,0);
  rep(i,sz(s)) {
    cnt[s[i]-'a']++;
  }
  rep(i,26) {
    if(cnt[i]&1) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		
		for(int i = m/n; i >=1 ; i--) {
			if(m%i == 0) {
				System.out.println(i);
				break;
			}
		}
	}
}

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

int main(){
  string a, b;
  int count = 0;
  getline(cin, a);
  getline(cin, b);
  for (int i = 0; i < a.length(); i++){
    if ( a[i] != b[i]) count++;
  }
  cout << count;
  return 0;
}


Measured memory_bytes: 3908
def examA():
    N = I()
    A = LI()
    ans = 0
    for i in range(N-1):
        if A[i+1]==A[i]:
            A[i+1] = 101
            ans +=1
    print(ans)
    return

def gcd(x,y):
    if y==0:
        return x
    while(y!=0):
        x, y = y,x%y
    return x
def examB():
    T = I()
    for i in range(T):
        ans = "Yes"
        A, B, C, D = LI()
        if A<B:
            ans = "No"
        elif D<B:
            ans = "No"
        elif C>=B:
            print(ans)
            continue
        elif B-C>gcd(D,B):
            ans = "No"
        if (A % B) > C:
            ans = "No"
        print(ans)
    return

def examC():
    N = I()
    S = SI()
    d1 = defaultdict(int)
    d2 = defaultdict(int)
    loop = 2**N
    for i in range(loop):
        curR = ""; curB = ""
        curR2 = ""; curB2 = ""
        for j in range(N):
            if i&(1<<j)==(1<<j):
                curR +=S[j]
                curR2 +=S[j+N]
            else:
                curB +=S[j]
                curB2 +=S[j+N]
        d1[(curR,curB)] +=1
        d2[(curR2,curB2)] +=1
    ans = 0
    for key,i in d1.items():
        cur = i*d2[(key[1][::-1],key[0][::-1])]
        ans +=cur
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,inf
mod = 10**9 + 7
inf = 10**18

if __name__ == '__main__':
    examB()


Measured memory_bytes: 3828
#include <stdio.h>

int ss(int x)
{
    int n,t=0;
    if(x%3==0)
        t=1;
    do
    {
        if(x%10==3)
        {
            t=1;
            break;
        }
        x/=10;
    }
    while(x);
    return t;
}

int main(int argc, const char * argv[]) {
    int x,n;
    scanf("%d",&n);
    int t;
    for(x=3;x<=n;x++)
    {
        t=ss(x);
        if(t==1)
            printf(" %d",x);
    }
    printf("\n");
    return 0;
}


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


int main() {
  ll x,a,b,flag=0,c,d;
  cin>>x;
  for(int i=0; i<200; i++){
    a=i;
    c=a*a*a*a*a;
    for(int j=i-1; j>-200; j--){
      b=j;
      d=b*b*b*b*b;
      if(c-d==x){
        flag++;
        break;
      }
    }
    if(flag==1) break;
  }
  
 
    
  cout<<a<<" "<<b<<endl;
  
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <tuple>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <limits>
#include <unordered_map>

using namespace std;
using str = string;

#define rep(a,l,r) for(int a=(l);a<(r);a++)
#define get cin>>
#define put cout<<

void run() {

	int a; get a;
	int b; get b;

	if ((a*b)%2==0){
		put "No";
	} else {
		put "Yes";
	}
}
int main() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);run();return 0;}


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

template <typename Arg1>
void pn(Arg1&& arg1)
{ cout<<arg1<<"\n";}
template <typename Arg1, typename... Args>
void pn(Arg1&& arg1, Args&&... args)
{ cout<<arg1<<"\n"; pn(args...); }

template <typename Arg1>
void ps(Arg1&& arg1)
{ cout<<arg1<<" ";}
template <typename Arg1, typename... Args>
void ps(Arg1&& arg1, Args&&... args)
{ cout<<arg1<<" "; ps(args...); }

template <typename Arg1>
void pvs(Arg1&& arg1, ll n)
{ for(ll i=0;i<n;i++)ps(arg1[i]); }
template <typename Arg1>
void pvn(Arg1&& arg1, ll n)
{ for(ll i=0;i<n;i++)pn(arg1[i]); }

ll lcm(ll a,ll b) 
{ return (a*b)/__gcd(a,b); }

ll mulmod(ll a,ll b,ll mod) 
{ ll res=0; a=a%mod; 
    while(b>0)
    { if(b%2==1) res=(res+a)%mod; 
      a=(a*2)%mod; b/=2; }
    return res % mod; } 

ll mulpow(ll x,ll y,ll p) 
{ ll res=1; x=x%p;
    while(y>0) 
    { if (y&1) res=(res*x)%p; 
      y=y>>1; x=(x*x)%p; } 
    return res; } 

ll modInverse(ll n, ll p) 
{ return mulpow(n, p-2, p); } 

ll log(ll n, ll b)
{ ll c=0;
	while(n>(b-1))
	{ c++; n/=b; } return c; }

ll fib(ll n) 
{ double phi=(1+sqrt(5))/2; 
  return round(pow(phi,n)/sqrt(5)); } 

vector<bool> prime;
void sieve(int n)
{ prime.resize(n,true);
	for(int p=2;p*p<=n;p++)
		if(prime[p])
			for(int i=p*p;i<=n;i+=p)
				prime[i]=false; }

#define MOD 1000000007 //10^9+7
#define pi 3.14159265358979323846
#define f0(i,n) for(i=0;i<n;i++)
#define f1(i,n) for(i=1;i<=n;i++)
#define fd(i,n) for(i=n-1;i>=0;i--)
#define fn(i,s,d) for(i=s;i<d;i++)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) a.size()
#define vl vector<ll>
#define vb vector<bool>
#define vd vector<double>
#define vvl vector<vl>
#define vs vector<string>
#define vvs vector<vs>
#define pl pair<ll,ll>
#define pd pair<double,double>
#define vpl vector<pl>
#define vpd vector<pd>
#define vvpl vector<vpl>
#define ff first
#define ss second
#define um unordered_map
#define dsort(v) sort(v); reverse(v);


void solve()
{
	ll i,j;
	string s,t;
	cin>>s>>t;
	ll n=s.length();
	ll ans=0;
	f0(i,n)
	{
		if(s[i]==t[i])
		{

		}
		else
		{
			ans++;
		}
	}
	pn(ans);
}

int main()
{
	#ifdef Deeksha
		freopen("input.txt", "r", stdin);
    	freopen("output.txt", "w", stdout);
    #endif
	std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	solve();/* 
	ll t;
	cin>>t;
	for(ll tt=1;tt<=t;tt++)
	{
		//cout<<"Case #"<<tt<<": ";
		solve();
	}
	//*/
}



Measured memory_bytes: 3800
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        String s = sc.next();
        
        if(x%2==1){
            System.out.println("No");
            return;
        }
        
        String pre = s.substring(0, s.length()/2);
        String aft = s.substring(s.length()/2);
        if(pre.equals(aft)){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;
#define MP make_pair
#define PB push_back
#define PII pair<int,int>
#define ll long long
int N=INT_MAX;
ll INF1=1e9 + 5;
ll INF2=1e18L + 5;
map<int ,int>my;
int h[10005];

int main(){
	int n;
	cin>>n;
	int x,a[n],a2[n-1];
	ll ans=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n;i++){
		cin>>x;
		ans+=x;
	}
	for(int i=0;i<n-1;i++){
		cin>>a2[i];
	}
	for(int i=1;i<n;i++){
		if((a[i]-a[i-1])==1){
			ans+=a2[a[i-1]-1];
		}
	}
	cout<<ans;
}


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

using namespace std;

int main() {
    int n;  cin >> n;
    long long *x = new long long[n];
    long long *a = new long long[n];
    for (int i = 0; i < n; i++) {
        cin >> x[i];
        a[i] = x[i];
    }
    
    sort(x, x+n);

    for (int i = 0; i < n; i++) {
        if (a[i] <= x[n/2-1])
            cout << x[n/2] << endl;
        else 
            cout << x[n/2-1] << endl;
    }
    return 0;
}

Measured memory_bytes: 5376
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
#include <unordered_map>
#include <cstdio>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define int long long
#define P pair<int,int>
#define all(vec) vec.begin(),vec.end()

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n, x, a[210];
int d[210][100010];

signed main() {
	cin >> n >> x;
	for (int i = 0; i < n; i++)cin >> a[i];
	sort(a, a + n);
	for (int i = 1; i <= x; i++)d[0][i] = i;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= x; j++) {
			d[i + 1][j] = (d[i][j%a[i]] + d[i][j] * i) % mod;
		}
	}
	cout << d[n][x] << endl;
}


Measured memory_bytes: 157952
#include <iostream>
#include <bits/stdc++.h>
#define f(i,a,b) for (int i=a; i<b; i++)
#define F(i,a,b) for (int i=a; i<=b; i++)
#define fod(i,a,b) for (int i=a; i>=b; i--)
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define MOD 1000000007

using namespace std;

template<class t> inline t read(t &x){
	x=0;char c=getchar();bool f=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return  x;
}
template<class t> inline void write(t x){
	if(x<0){putchar('-'),write(-x);}
	else{if(x>9)write(x/10);putchar('0'+x%10);}
}

typedef long long ll;
typedef pair<int, int> pii;
typedef map<int,int> mii;

const int maxv=1e3+5;
const int maxn=105;
int A[maxn], B[maxn];
long long dp[100006];
int main()
{
    int n, w, res=0;
    read(n), read(w);
    F(i,1,n) read(A[i]), read(B[i]);
    F(i,1,100005) dp[i]=1e18;
    F(i,1,n) {
        fod(j,100005,B[i])
            dp[j]=min(dp[j-B[i]]+A[i], dp[j]);
    }
    F(i,1,100005) {
        if (dp[i]<=w) res=i;
    }
    cout<<res;

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
    vector<vector<int>> a(3, vector<int>(3));
    vector<vector<int>> c(3, vector<int>(3, 0));
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            cin >> a[i][j];
        }
    }
    int N;
    cin >> N;
    vector<int> b(N);
    for(int i = 0; i < N; i++){
        cin >> b[i];
    }
    for(int i = 0; i < N; i++){
        for(int j = 0; j < 3; j++){
            for(int k = 0; k < 3; k++){
                if(b[i] == a[j][k]) {
                    c[j][k] = 1;
                }
            }
        }
    }
    int flag = 0;
    for(int i = 0; i < 3; i++){
        if(c[i][0] == 1 && c[i][0] == c[i][1] && c[i][1] == c[i][2]) flag = 1;
        if(c[0][i] == 1 && c[0][i] == c[1][i] && c[1][i] == c[2][i]) flag = 1;
    }
    if(c[0][0] == 1 && c[0][0] == c[1][1] && c[1][1] == c[2][2]) flag = 1;
    if(c[0][2] == 1 && c[0][2] == c[1][1] && c[1][1] == c[2][0]) flag = 1;
    if(flag == 0) cout << "No" << endl;
    else if(flag == 1) cout << "Yes" << endl;
}

Measured memory_bytes: 256
/*input
8
8 2 7 3 4 5 6 1
*/

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

struct Neighbor {
    ll l1, l2, r1, r2;
};

int main() {
    ll n;
    cin >> n;
    vector<ll> pos(n+1);
    rep(i, n) {
        ll val;
        cin >> val;
        pos[val] = i;
    }
    vector<Neighbor> nb(n);
    rep(i, n) {
        nb[i] = (struct Neighbor){i-2, i-1, i+1, i+2};
    }
    nb[0].l1 = -1;
    nb[n-1].r2 = n;
    ll ans = 0;
    for (int i = 1; i <= n; i++) {
        Neighbor cur = nb[pos[i]];
        ans += i*(cur.l2-cur.l1)*(cur.r1-pos[i]);
        ans += i*(cur.r2-cur.r1)*(pos[i]-cur.l2);
        if (0 <= cur.l1 && cur.l1 < n) {
            nb[cur.l1].r2 = cur.r1;
        }
        if (0 <= cur.l2 && cur.l2 < n) {
            nb[cur.l2].r1 = cur.r1;
            nb[cur.l2].r2 = cur.r2;
        }
        if (0 <= cur.r1 && cur.r1 < n) {
            nb[cur.r1].l1 = cur.l1;
            nb[cur.r1].l2 = cur.l2;
        }
        if (0 <= cur.r2 && cur.r2 < n) {
            nb[cur.r2].l1 = cur.l2;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4096
//#define _GLIBCXX_DEBUG
//#define _CRTDBG_MAP_ALLOC
//#pragma GCC push_options
//#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

typedef int64_t ll;
typedef uint64_t ull;

const ll LINF = 9187201950435737471;
const ll nLINF = -9187201950435737472;
const int INF = 2139062143;
const int nINF = -2139062144;
const ull ULINF = numeric_limits<ull>::max();
const int MAXN = 3e5 + 15;
const ll MOD = 1e9 + 7;
const double EPS = 1e-9;
const int BLOCK = 500;
const double PI = acos(-1);
//auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
auto seed = 194113341;
mt19937 rnd(seed);

bool is_equal(double a, double b) {
    return abs(a - b) <= EPS;
}


#define all(_v) _v.begin(), _v.end()
#define rall(v) v.rbegin(), v.rend()
#define sz(v) (int)(v.size())
#define sqr(_v) ((_v) * (_v))
#define vi vector <int>
#define vii vector <pair <int, int> >
#define eb emplace_back
#define pb push_back
#define mod(x, m) ((x) % m + (x < 0 ? m: 0))


inline void IO() {
#if buyolitsez
    freopen("input.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#else
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#endif
}

template <typename T>
istream& operator >> (istream& in, vector<T>& a) {
    for (auto& i : a)
        in >> i;
    return in;
}

template <typename T>
ostream& operator << (ostream& out, const vector<T>& a) {
    for (auto& i : a) {
        out << i << " ";
    }
    return out;
}

template <typename T, typename D>
istream& operator >> (istream& in, pair<T, D>& a) {
    in >> a.first >> a.second;
    return in;
}

template <typename T, typename D>
ostream& operator << (ostream& out, const pair<T, D>& a) {
    out << a.first << " " << a.second;
    return out;
}

#define int int64_t


inline void solve() {
    int n, k;
    cin >> n >> k;
    int ans = 0, pref = 0, suff = 0, posl = 0, posr = n;
    for (int i = 1; i <= n + 1; ++i) {
        pref += posl;
        suff += posr;
        posl++;
        posr--;
        if (i >= k) {
            int now = suff - pref + 1;
            ans = (ans + now) % MOD;
        }
    }
    cout << ans;
}

signed main() {
    IO();
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

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

typedef long long ll;
typedef pair<ll, ll> P;


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);


int main() {
    ll n, m, ans = INF; cin >> n >> m;
    set<ll> sport; // 開催されるスポーツ
    rep(i, m) sport.insert(i);

    vector<vector<ll>> a(n, vector<ll>(m));

    rep(i, n) {
        rep(j, m) {
            ll tmp; cin >> tmp;
            tmp--;
            a[i][j] = tmp;
        }
    }

    if(m == 1) {
        cout << n << endl;
        return 0;
    }
    // スポーツを一つずつ減らしていく
    rep(i, m-1) {
        ll tmp = 0, s = -1;
        vector<ll> num(m, 0);
        // 各人が参加するスポーツを消える
        rep(j, n) {
            rep(k, m) {
                if(sport.count(a[j][k])) {
                    num[a[j][k]]++;
                    break;
                }
            }
        }
        // 最大のスポーツを見て除外
        rep(j, m) {
            if(tmp < num[j] && sport.count(j)) {
                tmp = num[j];
                s = j;
            }
        }
        if(ans > tmp) ans = tmp;
        sport.erase(s);
    }

    cout << ans << endl;

    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

ll my_gcd(ll a, ll b) {
    if(b == 0) return a;
    return my_gcd(b, a%b);
}

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


Measured memory_bytes: 1024
def main():
    n = int(input())
    s, t = input(), input()

    for i in range(n, -1, -1):
        u = s[-i:]
        v = t[:i]
        if u == v:
            ans = 2 * n - i
            print(ans)
            break
    else:
        print(2 * n)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define mp make_pair
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef long double ld;

const int N = 500006;
const int LOG = 20;
int n, m;
vector<pair<int,int>> Q[N];
vector<int> lst(N, -1);
vector<int> fenw(N);

void upd(int pos, int val) {

    for(; pos <= n; pos += pos & (-pos)) fenw[pos] += val;
}

int q(int pos) {

    int ans = 0;
    for(; pos; pos -= pos & (-pos)) ans += fenw[pos];
    return ans;

}

int ask(int l, int r) {

    return q(r) - q(l - 1);

}
int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> n >> m;

    vector<int> ans(m + 1);
    vector<int> a(n + 1);

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

    for(int i = 1; i <= m; i++) {

        int l, r;
        cin >> l >> r;
        Q[l].pb({r, i});

    }

    for(int i = n; i >= 1; i--) {

        if (lst[a[i]] != -1) {
            upd(lst[a[i]], -1);
        }

        lst[a[i]] = i;
        upd(i, +1);

        for(auto it : Q[i]) {
            ans[it.s]  = ask(i, it.f);
        }   

    }

    for(int i = 1; i <= m; i++) cout << ans[i] << '\n';
        
    return 0; 
}


Measured memory_bytes: 33220
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <vector>
using namespace std;

typedef long long ll;

/*
const ll M = 1000000007;
vector<ll> fac(3001);
vector<ll> ifac(3001);
ll mpow(ll x, ll n){
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}
 
ll comb(ll a, ll b){
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0 || b < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % M;
    return tmp * fac[a] % M;
}
*/


ll lcm(ll a,ll b){
 
  ll r, x, tmp;
  x = a * b;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return x/b;
}

ll gcd(ll a ,ll b){
    if(a==0){return b;}
    else if(b==0){return a;}
    else{
    ll tmp,r;
    if(a<b){
        tmp = a;
        a = b;
        b = tmp;
    }
    
    r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
    }
}




int main(void){
    const ll INF = 1000000007;
    ll ans = 0;
    ll a,b,tmp;
    cin >> a >> b;
    tmp = 1;
    for(ll i=0;i<1000000;i++){
        if(tmp<b){tmp+=(a-1);ans++;}
        else {break;}
    }
    
    
    cout << ans << endl;
    return 0;
}

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

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

    string s;
    cin>>s;

    int maxx=-1;
    for(int i=1;i<=len;++i)
    {
        string ll;
        string rr;
        int cnt=0;
        for(int a=0;a<i;++a)
        {
            ll+=s[a];
        }


        for(int b=i;b<len;++b)
        {
            rr+=s[b];
        }

        for(int k=0;k<26;++k)
        {
            if(ll.find('a'+k)!=-1 && rr.find('a'+k)!=-1)
            cnt++;
        }

        if(cnt>maxx)
            maxx=cnt;
    }

    cout<<maxx<<endl;

    return 0;
}


Measured memory_bytes: 888
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
 
// syakutori-hou
class Program
{
    static void Main()
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        new Program().solve();
        Console.Out.Flush();
    }
    Scanner cin = new Scanner();
 
 
    void solve()
    {
		int N = cin.nextint;
		int Q = cin.nextint;
		
		var A = cin.scanlong;
		var X = cin.scanlong;
		
		
		for(int i = 0; i < Q; i++)
		{
			int high = 0, low = 0; 
			long ans = 0, sum = 0;
			
			while(high < N)
			{
				sum += A[high++];
				
				while(sum > X[i])
				{
					sum -= A[low++];
				}
				ans += high - low;
			}
			Console.WriteLine(ans);
		}
		
		
    }
 
}
 
class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return Console.ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

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

int main() {
  int a = 0;
  int dat = 0;
  int cnt = 0;
  cin >> a;
  dat = a;
  if(a - 100 >= 0)
  {
    cnt++;
    dat -= 100;
  }
    if(dat - 10 >= 0)
  {
    cnt++;
      dat -= 10;
  }
    if(dat > 0)
  {
    cnt++;
  }
  cout << cnt << endl;
}

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

using namespace std;

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

void solve_abc090() {
	ll n, k;
	ll ans = 0;

	cin >> n >> k;

	ll a, b;
	ll diff;
	rep2(b, k + 1, n + 1) {
		// a < b: a = k ~ b - 1
		ans += max(b - k, 0LL) * (n/b);

		ans += max((n % b) - max(k, 1LL) + 1, 0LL);
	}

	cout << ans << "\n";
}

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

	solve_abc090();

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>

using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
const ll MOD = 1000000007;
const int MAX = 100000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
//最大公約数
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
//最小公倍数
int lcm(int x, int y) { return x / gcd(x, y) * y; }


int main(){
    int N; cin >> N;
    int A;
    bool f=true;
    for(int i=0;i<N;i++){
        cin >> A;
        if(A%2==0){
            if(A%5==0 || A%3==0){

            }else{
                f = false;
            }
        }
    }
    if(f) cout << "APPROVED" << endl;
    else  cout << "DENIED" << endl;
    return 0;
}


Measured memory_bytes: 888
/*
Hey there stalker....

█▀▀▄░░░░░░░░░░░▄▀▀█
░█░░░▀▄░▄▄▄▄▄░▄▀░░░█
░░▀▄░░░▀░░░░░▀░░░▄▀
░░░░▌░▄▄░░░▄▄░▐▀▀
░░░▐░░█▄░░░▄█░░▌▄▄▀▀▀▀█
░░░▌▄▄▀▀░▄░▀▀▄▄▐░░░░░░█
▄▀▀▐▀▀░▄▄▄▄▄░▀▀▌▄▄▄░░░█
█░░░▀▄░█░░░█░▄▀░░░░█▀▀▀
░▀▄░░▀░░▀▀▀░░▀░░░▄█▀
░░░█░░░░░░░░░░░▄▀▄░▀▄
░░░█░░░░░░░░░▄▀█░░█░░█
░░░█░░░░░░░░░░░█▄█░░▄▀
░░░█░░░░░░░░░░░████▀
░░░▀▄▄▀▀▄▄▀▀▄▄▄█▀

Like what you see?
*/
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define pii         pair<ll ,ll>
#define vi          vector<ll>
#define present(container, element) (container.find(element) != container.end()) /* For set n maps */
#define cpresent(container, element) (find(all(container),element) != container.end()) /* For vectors */
#define all(a)      (a).begin(),(a).end()
#define invect(data,n,commands) for(int i = 0;i<n;i++){int tmp;cin>>tmp;data.pb(tmp);commands}
#define inset(data,n,commands) for(int i = 0;i<n;i++){int tmp;cin>>tmp;data.I(tmp);commands}
#define F           first
#define S           second
#define I           insert
#define sz(x)       (ll)x.size()
#define rep(i,a,b)    for(ll  i=a;i<b;i++)
#define repr(i,a,b) for(ll  i=a;i>b;i--)
#define trav(a, x) 	for(auto& a : x)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define lcase(a) (char)tolower(a)
#define ll long long int
#define lld long double
#define endl "\n"
#define PI 3.14159265358979323844
#define MOD 1000000007
#define max(a, b) (a < b ? b : a)
#define min(a, b) ((a > b) ? b : a)
#define mod 1e9 + 7
const int N = 1e5 + 5;
/*	For Debugging	*/
#define DEBUG 		cerr<<"\n>>>I'm Here<<<\n"<<endl;
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl;
#define what_is(x)  cerr << #x << " is " << x << endl;

int32_t main()
{
   IOS

    int TESTS=1;
    //cin >> TESTS;
    while (TESTS--)
    {
        ll n,m;
        cin >> n >> m;
        vi v(n);
         int temp=m;
        int sum=0;
        bool flag=true;
        rep(i,0,n)
        {
            cin>> v[i];
            sum+=v[i];
        }
        int count=0;
        //sort(v.rbegin(),v.rend());
        //what_is(sum);
        for(int i=0;i<n;i++)
        {
                if(v[i]>= sum/(4.0*temp))
                {
                    count++;

                }
        }
        if(count>=m)
        {
            cout<< "Yes"<< endl;
        }
        else
        {
            cout<<"No"<< endl;
        }

    }
    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int n;
    cin >> n;
    vector< int > num(n);
    map< string,int > ball;
    for(int i=0;i<n;i++){
        cin >> num[i];
        ball[to_string(num[i])]++;
    }
    ll total = 0;
    for(auto it = ball.begin();it != ball.end();it++){
        ll x = it->second;
        total += (x*(x-1))/2;
    }
    for(int i=0;i<n;i++){
        ll ans = total - ball[to_string(num[i])] + 1;
        cout << ans << endl;
    }
}

Measured memory_bytes: 17920
N = int(input())
C, S, F = [], [], []

for _ in range(N-1):
    c, s, f = map(int, input().split())
    C.append(c)
    S.append(s)
    F.append(f)

for station in range(N):
    now = station
    time = 0

    while now < N-1:
        if time < S[now]:
            time = S[now] + C[now]
        else:
            if time % F[now] == 0:
                time += C[now]
            else:
                wait_time = F[now] - (time % F[now])
                time += wait_time + C[now]

        now += 1

    print(time)

Measured memory_bytes: 9252
#include <bits/stdc++.h>
using namespace std;
#define ALL(obj) obj.begin(),obj.end()
#define pb(obj) push_back(obj)
#define REP(i,N) for(int i=0;i<N;i++)
typedef long long ll;
const ll MOD=1000000007;

int main(){
	cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin>>N;
    vector<int>x(N),y(N);
    REP(i,N){
        cin>>x[i]>>y[i];
    }
    double sum=0;
    for(int i=0;i<N-1;i++){
        for(int j=i+1;j<N;j++){
            sum+=pow(pow((x[i]-x[j]),2)+pow((y[i]-y[j]),2),0.5);
        }
    }
    sum/=N/2.0;
    printf("%.10f\n",sum);
}

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

const int kMod = 1e9 + 7;

int main(int argc, char** argv) {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int64_t n, m;
    cin >> n >> m;
    int64_t X[n], Y[m];
    for (int i = 0; i < n; ++i) cin >> X[i];
    for (int i = 0; i < m; ++i) cin >> Y[i];
    sort(X, X + n);
    sort(Y, Y + m);
    int64_t lx = 0, ly = 0;
    for (int i = 1; i < n; ++i) lx = (lx + (X[i] - X[i - 1]) * i * (n - i)) % kMod;
    for (int i = 1; i < m; ++i) ly = (ly + (Y[i] - Y[i - 1]) * i * (m - i)) % kMod;
    uint64_t ans = (1ULL * lx % kMod * ly % kMod);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define endl       "\n"
#define ll         long long
#define pb         push_back
#define FIO        ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define NUM        1000000007
#define MOD        998244353
#define F          first
#define S          second
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=a-1;i>=b;i--)
#define vi         vector<ll>
#define pii        pair<ll,ll>
#define vpi        vector<pii>
#define mi         map<ll,ll>
#define mpi        map<pii,ll>
#define all(v)     (v).begin(),(v).end()
#define rall(v)    (v).rbegin(),(v).rend()
#define fac(a)     tgamma(a+1)

bool compare(const pair<ll,ll> &a,const pair<ll,ll> &b)
{ 
    return (a.second < b.second);      // compare function for sorting modification
}

vector<ll> primes;
vector<bool> PRIME(1000005,true);       // prime no.s less than 10^6
void sieve(ll n)                        // PRIME[i]=true => i=prime no.
{  PRIME[0]=false;PRIME[1]=false;
    for (ll p=2; p*p<=n; p++) { 
        if (PRIME[p] == true) { 
            for (ll i=p*p; i<=n; i += p){PRIME[i]=false;} 
        } 
    } rep(i,2,n+1){if(PRIME[i]){primes.pb(i);}}
}  

ll nCr[1001][1001];
void combination(ll n)                  // nCr values
{
    rep(i,0,n+1){
        rep(j,0,i+1){
            if(j==0 or j==i)nCr[i][j]=1;
            else nCr[i][j]=(nCr[i-1][j-1]+nCr[i-1][j])%NUM;
        }
    }
}

#define N  1000005

ll a,b,c,d,e,i,j,k,l,m,n,q,p,r,u,v,w,x,y,z,mn,mx;
ll arr[N];
//ll dp[2005][2005];

int main() 
{
    FIO;
    ll t=1;
    //cin >> t;
    while(t--)
    {
        mn=LONG_LONG_MAX;
        mx=LONG_LONG_MIN;
        cin>>n;
        rep(i,0,n){cin>>arr[i];}
        sort(arr,arr+n);
        ll ans=arr[n-1];
        a=n-2;
        i=n-2;
        while(a>0)
        {
            ans+=arr[i];
            a--;
            if(a==0)break;
            ans+=arr[i];
            i--;
            a--;
        }
        cout<<ans;
        
        
        
        
        
        
        
        
        
        
        h:;
        cout<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 5336
# B - Hina Arare

# N
N = int(input())
my_list = list(input().split())

arare_list = ['P', 'W', 'G', 'Y']
my_list_only = set(my_list)
count = 0

for i in range(0, 4):
    if arare_list[i] in my_list_only:
        count += 1

if count == 3:
    answer = 'Three'
if count == 4:
    answer = 'Four'

print(answer)


Measured memory_bytes: 9100
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<string>
#include<map>

using namespace std;

int main(void) {
	int N;
	cin >> N;
	vector<int>A(N);
	vector<int>B(N);
	vector<int>C(N-1);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	for (int i = 0; i < N; i++) {
		cin >> B[i];
	}
	for (int i = 0; i < N-1; i++) {
		cin >> C[i];
	}
	int ans = B[A[0]-1];
	for (int i = 1; i < N; i++) {
		ans += B[A[i]-1];
		if (A[i] == A[i - 1] + 1) {
			ans += C[A[i-1]-1];
		}
	}
	cout << ans << endl;
}

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

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define INF 1e9

int main(int argc, char const *argv[])
{
    ll n;
    cin >> n;
    vector<ll> c(n - 1), s(n - 1), f(n - 1);
    REP(i, n - 1)
    {
        cin >> c[i] >> s[i] >> f[i];
    }
    REP(i, n)
    {
        ll t = 0;
        FOR(j, i, n - 1)
        {
            if (t <= s[j])
                t = s[j];
            else if (t % f[j])
                t = t + f[j] - t % f[j];
            t += c[j];
        }
        cout << t << endl;
    }
    return 0;
}


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

dots = [input() for _ in range(H)]

newdots = []
for dot in dots:
    if dot == '.' * W:
        pass
    else:
        newdots.append(dot)


newdots2 = list(zip(*newdots))
dots = []
for dot in newdots2:
    flag = True
    for d in dot:
        if d == '#':
            flag = False

    if flag is False:
        dots.append(dot)

newdots3 = list(zip(*dots))
for d in newdots3:
    print("".join(d))

Measured memory_bytes: 3188
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class CCountOrder {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n; cin >> n;
      vector<int> p(n), q(n);
      rep(i, n) {
        cin >> p[i];
      }
      rep(i, n) {
        cin >> q[i];
      }
      vector<int> org(n);
      rep(i, n) {
        org[i] = i+1;
      }
      int a = -1, b = -1;
      int idx = 1;
      do {
        if (org == p) a = idx;
        if (org == q) b = idx;
        idx++;
      } while (next_permutation(org.begin(), org.end()));

      cout << abs(b-a) << endl;


    }
};

signed main() {
  CCountOrder solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;
const ll INF=(ll)1e18+10;

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

int main() {
    int N,T; cin>>N>>T;

    vector<pair<int,int>> food(N);

    for (int i = 0; i < N; ++i) {
        cin>>food[i].first>>food[i].second;
    }

    sort(food.begin(),food.end());

    vector<vector<int>> dp(N+1,vector<int>(6010,-1));

    dp[0][0]=0;

    for (int i = 1; i <= N; ++i) {
        for (int j = 0; j < 6010; ++j) {
            dp[i][j]=dp[i-1][j];
            if(food[i-1].first<=j&&j-food[i-1].first<T) {
                //cout<<"called :"<<i<<" "<<j<<endl;
                dp[i][j]=max(dp[i][j],dp[i-1][j-food[i-1].first]+food[i-1].second);
            }
        }
    }

    int ans=-1;
    for (int i = 0; i < 6010; ++i) {
        ans=max(ans,dp[N][i]);
    }

    cout<<ans<<endl;

    return 0;
}

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

char in[120];
pair<pair<string,int>,int> p[110];
int main(){
      int N;
      cin >> N;
      for(int i=0;i<N;i++){
            int t;
            cin >> in >> t;
 //           string tmp=in;
            p[i]=make_pair(make_pair(in,-t),i);
      }
      sort(p,p+N);
      for(int i=0;i<N;i++){
            printf("%d\n",p[i].second+1);
      }
}


Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a = LI()
    a.sort()
    print(a[0]*a[1]//2)  
    return

#B
def B():
    d = defaultdict(int)
    s = II()
    def f(n):
        if n % 2:
            return 3 * n + 1
        return n // 2
    i = 1
    while not d[s]:
        d[s] = 1
        s = f(s)
        i += 1
    print(i)
    return

#C
def C():
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    B()


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

const int INF = ~(1 << 31);

class RangeMinQuery{
private:
	vector< int > value;
	int _size;
public:
	
	void Init(int size){
		int bitcount = 0;//?????°
		int t = size;
		
		while(t != 0){
			t /= 2;
			++bitcount;
		}
		if(size % (1 << (bitcount - 1)) != 0) bitcount++;
		_size = (1 << bitcount) - 1;
		
		value.resize(_size);
		
		for(vector< int >::iterator it = value.begin(); it != value.end(); ++it){
			(*it) = INF;
		}
	}
	
	void Update(int index, int v){
		int n = index + (_size>>1);
		value[n] = v;
		
		while(n > 0){
			n = (n - 1) / 2;
			value[n] = min(value[n * 2 + 1], value[n * 2 + 2]);
		}
	}
	
	int _RunQuery(int s, int t, int k, int l, int r){
		if(s <= l && r <= t){
			return value[k];
		}
		if(r < s || t < l){
			return INF;
		}
		return min(_RunQuery(s, t, 2 * k + 1, l, (l + r) / 2), _RunQuery(s, t, 2 * k + 2, (l + r) / 2 + 1, r));
	}
	
	int RunQuery(int s, int t){
		return _RunQuery(s, t, 0, 0, (_size>>1));
	}
};

int main(){
	int n, q;
	int com, x, y;
	RangeMinQuery rmq;
	
	cin >> n >> q;
	rmq.Init(n);
	
	for(int i = 0; i < q; ++i){
		cin >> com >> x >> y;
		
		if(com == 0)rmq.Update(x, y);
		else cout << rmq.RunQuery(x, y) << endl;
	}
}

Measured memory_bytes: 2060
#include <iostream>
#include <string>
#include <unordered_map>
#include <algorithm>

int main()
{
	std::ios_base::sync_with_stdio(0);
	std::cin.tie(0);
	std::unordered_map<int, int> mapa;
	mapa.insert(std::make_pair(0, 0));
	std::string str;
	std::getline(std::cin, str);
	
	int n = str.length();
	int xoring = 0;
	
	for (int i = 0; i < n; ++i)
	{
		int place = str[i] - 'a';
		xoring ^= (1 << place);
		int min = i + 1;
		
		if (mapa.count(xoring))
		{
			min = std::min(min, mapa[xoring] + 1);
		}
		
		for (int j = 0; j < 26; ++j)
		{
			if (mapa.count(xoring ^ (1 << j)))
			{
				min = std::min(min, mapa[xoring ^ (1 << j)] + 1);
			}
		}
		
		if (mapa.count(xoring))
			mapa[xoring] = std::min(mapa[xoring], min);
		else
			mapa[xoring] = min;
		
		if (i == n - 1)
			std::cout << min;
	}
}

Measured memory_bytes: 8668
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <stack>
#include <functional>
#include <sstream>
#define rep(i,j,n) for(i=j;i<(n);i++)
#define rrep(i,j,n) for(i=j;i>(n);i--)
typedef long long int lli;
#define N 1000000007
#define M 998244353

using namespace std;

void dp(string &t,lli size,string *ans,string *a,string *b,string *c){
    *a=t.substr(0,5);*b=t.substr(0,6);*c=t.substr(0,7);
    if(*a=="esare"){
        size-=5;
        if(size>0){
            t.erase(t.begin(),t.begin()+5);
            dp(t,size,ans,a,b,c);
        }
        else{
            if(size==0){
                *ans="YES";
            }
        }
    }
    else{
        if(*a=="maerd"){
            size-=5;
            if(size>0){
                t.erase(t.begin(),t.begin()+5);
                dp(t,size,ans,a,b,c);
            }
            else{
                if(size==0){
                    *ans="YES";
                }
            }
        }
        else{
            if(*b=="resare"){
                size-=6;
                if(size>0){
                    t.erase(t.begin(),t.begin()+6);
                    dp(t,size,ans,a,b,c);
                }
                else{
                    if(size==0){
                        *ans="YES";
                    }
                }
            }
            else{
                if(*c=="remaerd"){
                    size-=7;
                    if(size>0){
                        t.erase(t.begin(),t.begin()+7);
                        dp(t,size,ans,a,b,c);
                    }
                    else{
                        if(size==0){
                            *ans="YES";
                        }
                    }
                }
            }
        }
    }
}

int main(){
    string s,ans="NO",a,b,c;
    lli i,j;
    cin>>s;
    reverse(s.begin(),s.end());
    i=s.size();
    dp(s,i,&ans,&a,&b,&c);
    cout<<ans<<endl;
}


Measured memory_bytes: 2432
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main()
{
	vector<string> text;
	while ( true )
	{
		string t;
		getline( cin, t );
		if ( t == "END_OF_TEXT" )
			break;
		text.push_back( t );
	}

	int cx = 0;
	int cy = 0;

	string buf;

	while ( true )
	{
		char c;
		cin >> c;
		if ( c == '-' )
			break;
		switch ( c )
		{
		case 'a':
			cx = 0;
			break;
		case 'e':
			cx = (int)text[cy].length();
			break;
		case 'p':
			if ( cy > 0 ) cy--;
			cx = 0;
			break;
		case 'n':
			if ( cy < (int)text.size()-1 ) cy++;
			cx = 0;
			break;
		case 'f':
			if ( cx != (int)text[cy].length() )
				cx++;
			else if ( cy < (int)text.size()-1 )
				cy++,
				cx = 0;
			break;
		case 'b':
			if ( cx > 0 )
				cx--;
			else if ( cy > 0 )
				cy--,
				cx = (int)text[cy].size();
			break;
		case 'd':
			if ( cx < (int)text[cy].size() )
				text[cy].erase( text[cy].begin()+cx );
			else if ( cy < (int)text.size()-1 )
				text[cy] += text[cy+1],
				text.erase( text.begin()+cy+1 );
			break;
		case 'k':
			if ( cx == (int)text[cy].size()  &&
				 cy < (int)text.size() - 1 )
			{
				buf = "\n";
				text[cy] += text[cy+1],
				text.erase( text.begin()+cy+1 );
			}
			else
			{
				buf = text[cy].substr( cx );
				text[cy].erase( text[cy].begin()+cx, text[cy].end() );
			}
			break;
		case 'y':
			if ( buf == "" )
				break;
			else if ( buf == "\n" )
			{
				text.insert( text.begin()+cy+1, text[cy].substr(cx) );
				text[cy] = text[cy].substr(0,cx);
				cx = 0;
				cy++;
			}
			else
			{
				text[cy] = text[cy].substr(0,cx) + buf + text[cy].substr(cx);
				cx += (int)buf.length();
			}
			break;
		}
		
		//for ( int i=0; i<(int)text.size(); i++ )
		//	cout << text[i] << endl;
		//cout << cx << "," << cy << endl;
		//cout << "----" << endl;
	}

	for ( int i=0; i<(int)text.size(); i++ )
		cout << text[i] << endl;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1ll<<60;

int main(int argc, char **argv)
{
	ll R, G, B, N;
	cin >> R >> G >> B >> N;

	ll res{0};
	for (ll r = 0; r <= N/R; ++r)
	{
		for (ll g = 0; g <= N/G; ++g)
		{
			ll b = N - r * R  - g * G;
			if (b < 0) continue;
			if (b % B == 0)
			{
				++res;
			}
				
		}
	}
	std::cout << res << std::endl;
}


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

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

  long long sum;
  sum = 0;
  
  for (int i = 1; i <= N; i++) {
    if(i%3!=0 && i%5!=0){
      sum += i;
    }
  }
  
  cout << sum << endl;
}

Measured memory_bytes: 3576