akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
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;
}
 
using namespace std;
//ここから

void solve(){
  string s;
  cin>>s;
  int n=s.size();
  rep(i,n){
    if(s[i]==',')cout<<" ";
    else cout<<s[i];
  }
}

int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
  solve();
	return 0;
}


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

int main()
{
  string ans = "", prefix, s, suffix;
  cin >> prefix >> s >> suffix;
  cout << ans + prefix.at(0) + s.at(0) + suffix.at(0) << endl;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;

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


int main(void) {
	int w, h, n;
	int r, l, u, d;

	cin >> w >> h >> n;
	vector<int> x(n), y(n), a(n);

	FOR(i, 0, n - 1) {
		cin >> x[i] >> y[i] >> a[i];
	}
	l = 0;
	d = 0;
	u = h;
	r = w;

	FOR(i, 0, n - 1) {
		switch (a[i]) {
		case 1:
			l = max(l, x[i]);
			break;
		case 2:
			r = min(r, x[i]);
			break;
		case 3:
			d = max(d, y[i]);
			break;
		case 4:
			u = min(u, y[i]);
		}
	}
	
	if ((r - l) >= 0 && (u - d) >= 0) {
		cout << (r - l)*(u - d) << endl;
	}
	else {
		cout << 0 << endl;
	}


	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#define REP(i,n) for(int i=0;i<(int)n;++i)
using namespace std;

int a[2][1005][1005];

int main(){
  int n, k, x, y, d, t, ans = 0;
  char c;
  scanf("%d%d", &n, &k);
  REP(i, n){
    cin >> x >> y >> c;
    t = ((c == 'B' ? 0 : 1) + x/k + y/k)&1;
    a[t][x%k+1][y%k+1]++;
  }
  REP(l, 2) REP(i, k) REP(j, k)
    a[l][i+1][j+1] += a[l][i][j+1] + a[l][i+1][j] - a[l][i][j];
  
  REP(l, 2){
    REP(i, k){
      REP(j, k){
        d = a[l][k][k] - a[l][k][j+1] - a[l][i+1][k] + 2*a[l][i+1][j+1]
          + a[(l+1)%2][k][j+1] + a[(l+1)%2][i+1][k] - 2*a[(l+1)%2][i+1][j+1];
        if(ans < d) ans = d;
      }
    }
  }
  printf("%d\n", ans);
}


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

using namespace std;

int main()
{
    int k,p,z=0,c=0;

    cin >> k;



    for(int i=0;i<k;i++)
    {
        cin >> p;

        z++;

        if(p!=z)
        {
            c++;
        }


    }

    if(c<=2)
    {
        cout << "YES";
    }

    else

        cout << "NO";


    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
struct circle{
    double x;
    double y;
    double r;
};
int main(void){
    struct circle a,b,hoge;
    int n,i,pattern=0;
    double d_x,d_y,d;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%lf%lf%lf%lf%lf%lf"
              ,&a.x,&a.y,&a.r,&b.x,&b.y,&b.r);
        pattern=0;
        if(a.r<b.r){
            hoge=a;
            a=b;
            b=hoge;
            pattern=1;
            //puts("test1");
        }
        d_x=a.x-b.x;
        if(d_x<0)d_x*=-1;
        d_y=a.y-b.y;
        if(d_y<0)d_y*=-1;
        d=d_x*d_x+d_y*d_y;
        d=sqrt(d);
        //printf("%lf",d);
        if(d>a.r+b.r)printf("0\n");
        else if((a.r-d)>b.r){
            if(pattern==0)printf("2\n");
            else printf("-2\n");
        }
        else printf("1\n");
    }
    return 0;
}

Measured memory_bytes: 620
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(auto i=0;i<n;++i)
#define REPR(i,n) for(auto i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(auto i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  int n;
  cin >> n;

  vector<int> v(n), c(n);
  REP(i,n){
    cin >> v[i];
  }
  REP(i,n){
    cin >> c[i];
  }

  int ans1 = 0, ans2 = 0;
  REP(i,n){
    if(v[i] > c[i]){
      ans1 += v[i] - c[i];
    }else{
      ans2 += c[i] - v[i];
    }
  }

  cout << ans1 << endl;
  return 0;
}



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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            Console.WriteLine(Plus(S,0));
            
        }

        static long Plus(string s ,long n)
        {
            long retnum = 0;
            if(s.Length == 1)
            {
                return n + long.Parse(s);
            }

            retnum = n + long.Parse(s);

            for(int i =1; i < s.Length; i++)
            {
                retnum += Plus(s.Substring(i), n+long.Parse(s.Substring(0,i)));
            }

            return retnum;
        }

    }

}


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

int main() {
  int N, M;
  cin >> N >> M ;
  vector<int>A(M);
  vector<int>B(M);
  for (int i=0;i<M;i++){
    cin >> A.at(i)>>B.at(i);
  }
  for (int k=0; k<N;k++){
    vector<int>s(N);
    s.at(k)=0;
    
  	for (int j= 0; j<M;j++){
		if ((k+1)==A.at(j)){
          s.at(k)++;
        }
      	if ((k+1)==B.at(j)){
          s.at(k)++;
        }
    }
    cout<<s.at(k)<<endl;
  }}


  


  

  	
    
    
  
        
      

Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        if((A == 1 && B != 1)||(B != 1 && A > B)) System.out.println("Alice");
        else if((B == 1 && A != 1)|| B > A) System.out.println("Bob");
        else if(A == B) System.out.println("Draw");
	}

}


Measured memory_bytes: 21844
N=int(input())
evid = []

count=0
while count < N:
    A = int(input())
    temp = []
    in_count = 0
    while in_count < A:
        l=list(map(int, input().split()))
        temp.append( l )
        in_count += 1
    evid.append(temp)
    count += 1

all_pattern = 2**N

max_num = 0
for pattern in range(all_pattern+1):
    break_flag = False
    for ii in range(N):
        person_evid = (pattern>>ii) & 1
        #print(pattern, ii, person_evid)
        for temp_evid in evid[ii]:
            if person_evid == 1 and (pattern>>(temp_evid[0]-1) ) & 1 != temp_evid[1]:
                break_flag = True
            #if person_evid == 0 and (pattern>>(temp_evid[0]-1) ) & 1 == temp_evid[1]:
            #    break_flag = True
            if break_flag:
                #print(pattern, ii, person_evid)
                break

        if break_flag:
            break
    if break_flag:
        continue
    num = 0
    for ii in range(N):
        num += (pattern>>ii) & 1
    if max_num < num:
        max_num = num
print(max_num)


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

using namespace std;
using ll = long long;

/***********debug tools***********/
template<class T> inline ostream& operator<<(ostream& os,vector<T> arr) {os << "["; for(int i = 0; i < (int)arr.size(); i++)os << arr[i] << (i == (int)arr.size() - 1 ? "]" : ",");os << endl;return os;}
template<typename A, typename B> ostream& operator<<(ostream& os, const pair<A,B>& p){os << "{" << p.first << "," << p.second << "}";return os; }
#define prvec(v) cerr<<#v<<": [";for(int __i = 0;__i < (int)(v).size(); __i++)cerr<<((v)[__i])<<(__i+1==(int)(v).size()?"]\n":",");
#define print(x) cerr<<#x<<": "<<(x)<<endl
/*********************************/

const int D = 30;
const int MAX_N = 100000;

int n, l;
vector<int> x;
vector<vector<int>> tor, tol;



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

        int L = i + 1, R = n; //ooooxxx
        while(R - L > 1) {
            int mid = (L + R) / 2;
            (x[mid] - x[i] <= l ? L : R) = mid;
        }
        tor[0][i] = L;
    }
    tor[0][n - 1] = n - 1;

    for(int i = 0; i < D - 1; i++) {
        for(int j = 0; j < n; j++) {
            tor[i + 1][j] = tor[i][tor[i][j]];
        }
    }

}

void ftol() {
    for(int i = 1; i < n; i++) {
        int L = -1, R = i - 1;//xxxxxoooo
        while(R - L > 1) {
            int mid = (L + R) / 2;
            (x[i] - x[mid] <= l ? R : L) = mid;
        }
        tol[0][i] = R;
    }
    tol[0][0] = 0;
    for(int i = 0; i < D - 1; i++) {
        for(int j = 0; j < n; j++) {
            tol[i + 1][j] = tol[i][tol[i][j]];
        }
    }

}


int main()
{
    cin >> n;
    x.resize(n), tor.resize(D, vector<int>(n));
    tol = tor;
    for(int i = 0; i < n; i++)cin >> x[i];
    cin >> l;
    ftor();
    ftol();

    int Q; cin >> Q;
    while(Q--) {
        int a, b;
        cin >> a >> b;
        a--,b--;
        if(a > b) {

            int l = 0, r = 2 * n;//xxxxxxoooo
            while(r - l > 1) {
                int mid = (l + r) / 2;
                int pos = a;
                for(int i = 0; i < D; i++) {
                    if(mid & (1<<i))pos = tol[i][pos];
                }
                (pos <= b ? r : l) = mid;
            }
            cout << r << endl;      
            

        } else {
            int l = 0, r = 2 * n;//xxxxxxoooo
            while(r - l > 1) {
                int mid = (l + r) / 2;
                int pos = a;
                for(int i = 0; i < D; i++) {
                    if(mid & (1<<i))pos = tor[i][pos];
                }
                (pos >= b ? r : l) = mid;
            }
            cout << r << endl;
        }

    }

}


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

using namespace std;

using D = double;

const int N = 301;

int n, x, y, z, a[ N ];
D DP[ N ][ N ][ N ];

D dfs(int i = x, int j = y, int k = z) {
    if( (i + j + k) == 0 ) return 0.0;
    D &ret = DP[ i ][ j ][ k ];
    if( ret != -1.0 ) return ret;
    ret = 0.0;
    D p = (n * 1.0) / (i + j + k);
    if( i ) ret += (dfs(i - 1, j, k) + p) * i * 1.0 / (i + j + k);
    if( j ) ret += (dfs(i + 1, j - 1, k) + p) * j * 1.0 / (i + j + k);
    if( k ) ret += (dfs(i, j + 1, k - 1) + p) * k * 1.0 / (i + j + k);
    return ret;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

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

    x = y = z = 0;
    for(int i = 1; i <= n; i += 1) {
        if( a[ i ] == 1 ) x += 1;
        else if( a[ i ] == 2 ) y += 1;
        else z += 1;
    }
    for(int i = 0; i <= n; i += 1)
        for(int j = 0; j <= n; j += 1)
            for(int k = 0; k <= n; k += 1)
                DP[ i ][ j ][ k ] = -1.0;
    cout << setprecision(10) << fixed << dfs() << '\n';
    return 0;
}


Measured memory_bytes: 213376
#include <bits/stdc++.h>
#include <stdio.h>
#include <iostream>

typedef long long ll;

const int MAXN = 1e5+7;

using namespace std;
int main()
{

    ll t,n,b;
    cin>>n;
    ll sum = 0;
     t = n;
    while(t)
    {
        sum+=t%10;
        t/=10;
    }
    if(n%sum==0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
const long long mod = 1000000007LL;

int main() {
  ll n;
  cin >> n;
  vector<pair<ll,ll>> v(n);
  rep(i,n) cin >> v[i].second >> v[i].first;
  ll sum = 0;
  sort(v.begin(),v.end());
  rep(i,n) {
    sum += v[i].second;
    if(sum>v[i].first) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;
int main(){
      int A,B,C;
      cin >> A >> B >> C;
      if(A == B)cout << C << endl;
      if(B == C)cout << A << endl;
      if(A == C)cout << B << endl;
        return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	static final int MOD = 1000000007;
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		HashMap<Integer, Integer> map = new HashMap<>();
		for (int i = 2; i <= n; i++) {
			int x = i;
			for (int j = 2; j <= i; j++) {
				while (x % j == 0) {
					int count = 0;
					if (map.containsKey(j)) {
						count = map.get(j);
					}
					map.put(j, count + 1);
					x /= j;
				}
			}
		}
		long total = 1;
		for (int x : map.values()) {
			total *= x + 1;
			total %= MOD;
		}
		System.out.println(total);
	}
}


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

//int _; 

int n,ans=0,a[3];
string s;
 
int main()
{
	//for(scanf("%d",&_);_;_--)
	long long n,k;
	long long ans=0;
	cin >> n >> k;
	for(long long i=k;i <= n+1;i++)
	{
		ans += (n-i+1)*i+1;
	}
	
	cout << ans%(long long)(10e8+7) << endl;
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof (x))
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define fi first
#define se second
#define kill _z_kill
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define outval(x) cerr<<#x" = "<<x<<endl
#define outv(x) cerr<<#x" = "<<x<<"  "
#define outtag(x) cerr<<"--------------"#x"---------------"<<endl
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
	For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
#define User_Time ((double)clock()/CLOCKS_PER_SEC)
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned uint;
typedef long double LD;
typedef vector <int> vi;
typedef pair <int,int> pii;
LL read(){
	LL x=0,f=0;
	char ch=getchar();
	while (!isdigit(ch))
		f=ch=='-',ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}
const int mod=1e9+7;
int Pow(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=(LL)x*x%mod)
		if (y&1)
			ans=(LL)ans*x%mod;
	return ans;
}
void Add(int &x,int y){
	if ((x+=y)>=mod)
		x-=mod;
}
void Del(int &x,int y){
	if ((x-=y)<0)
		x+=mod;
}
int Add(int x){
	return x>=mod?x-mod:x;
}
int Del(int x){
	return x<0?x+mod:x;
}
void ckmax(int &x,int y){
	if (x<y)
		x=y;
}
void ckmin(int &x,int y){
	if (x>y)
		x=y;
}
const int N=1000005*4;
int n;
char s[N];
int pre[N],suf[N];
int gao(int dan4){
	int mi=0,val=0;
	For(i,1,n){
		if (s[i]=='0')
			val--;
		else if (s[i]=='1')
			val++;
		else {
			if (val+1+suf[i]-pre[i]<=dan4)
				val++;
			else
				val--;
		}
		mi=min(mi,val);
	}
	return dan4-mi;
}
int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	For(i,1,n)
		pre[i]=pre[i-1]+(s[i]=='1'?1:-1);
	suf[n]=pre[n];
	Fod(i,n-1,0)
		suf[i]=max(suf[i+1],pre[i]);
//	outarr(pre,0,n);
//	outarr(suf,0,n);
	cout<<min(gao(suf[0]),gao(suf[0]+1))<<endl;
	return 0;
}


Measured memory_bytes: 12572
import Data.Map ((!))
import qualified Data.Map as M
import Control.Monad

main = readLn >>= print.solve

solve :: Int -> Int
solve = M.foldr (+%) 0.(ans!!)
  where
  ans = M.empty : M.empty : M.empty
        : M.fromList (zip (correctStrs 3) (repeat 1))
        : map f (drop 3 ans)
  f pMap = foldr g M.empty (correctStrs 4)
    where g head4 = M.insertWith (+%) (init head4) (pMap!tail head4)
  correctStrs n = filter correct $ replicateM n "ACGT"
  correct ('A':'G':'C': _ ) = False
  correct [ _ ,'A','G','C'] = False
  correct ('A':'C':'G': _ ) = False
  correct [ _ ,'A','C','G'] = False
  correct ('G':'A':'C': _ ) = False
  correct [ _ ,'G','A','C'] = False
  correct ['A', _ ,'G','C'] = False
  correct ['A','G', _ ,'C'] = False
  correct _ = True

infixl 6 +%
a +% b = (a+b)`mod`1000000007


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

		int main(){
			double attack,health;

			cin>>health>>attack;

			if(attack>health or health == attack){
				cout<<1;
			}else if(attack == 1){
				cout<<health;
			}else if(attack<health){
				double r = health/attack;
				int aprox = ceil(r);
				cout<<aprox;
			}
			return 0;
		}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define hhh cerr<<"hhh"<<endl
#define see(x) cerr<<(#x)<<'='<<(x)<<endl
using namespace std;
typedef long long ll;
typedef pair<int,int> pr;
inline int read() {int x=0,f=1;char c=getchar();while(c!='-'&&(c<'0'||c>'9'))c=getchar();if(c=='-')f=-1,c=getchar();while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return f*x;}

const int maxn = 3e5+7;
const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main() {
    int x=read();
    printf("%lld\n", 360/gcd(x,360));
}

Measured memory_bytes: 3680
#include <iostream>

using namespace std;

int main() {
  int m, d;
  cin >> m >> d;

  int ans = 0;
  for(int i = 1; i <= m; i++) {
    for(int j = 22; j <= d; j++) {
      if((j/10) * (j%10) == i && j/10 >= 2 && j%10 >= 2) {
        ans++;
        // cout << i << " " << j << endl;
      }
    }
  }

  cout << ans << endl;
}


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

int main() {
    int n;
    cin >> n;
    vector<pair<int, int>> nums(n);
    for (int i = 0; i < n; i++) {
        cin >> nums[i].first;
        nums[i].second = i;
    }
    sort(nums.begin(), nums.end());
    int mx = 1;
    int index = 0;
    while (index < n) {
        int cnt = 1;
        while (index + 1 < n && nums[index+1].second - nums[index].second > 0) {
            cnt++;
            index++;
        }
        index++;
        mx = max(mx, cnt);
    }
    cout << n - mx << "\n";
    return 0;
}


Measured memory_bytes: 1920
#ITP1_9_D

def pri(s,f,l):
	for i in range(f,l+1):
		print(s[i],end="")
	print()

def rev(s,f,l):
	while f < l:
		tmp=s[f]
		s[f]=s[l]
		s[l]=tmp
		f+=1
		l-=1

def rep(s,f,l,p):
	for i in range(l-f+1):
		s[f+i]=p[i]

s=list(input())

for i in range(int(input())):
	x=input().split()
	x[1]=int(x[1])
	x[2]=int(x[2])
	if "print" == x[0]:
		pri(s, x[1], x[2])
	elif "reverse" == x[0]:
		rev(s, x[1], x[2])
	elif "replace" == x[0]:
		rep(s, x[1], x[2], list(x[3]))



Measured memory_bytes: 5752
n = int(input())
a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))
a = [a1,a2]
ans = -1
a[1].reverse()
for i in range(1,n):
  a[0][i] = a[0][i]+a[0][i-1]
  a[1][i] = a[1][i]+a[1][i-1]
a[1].reverse()
for i in range(n):
  ans = max(ans,a[0][i]+a[1][i])
print(ans)

Measured memory_bytes: 38256
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <utility>
using namespace std;

struct LCA {
  int N, logN; // logN-1 == floor(lg(N-1))
  vector<vector<int>> G;
  vector<int> depth;
  // vから根の方向に2^k回登ったときのノード parent[k][v]
  vector<vector<int>> parent;

  LCA(int size) : N(size), G(size), depth(size) {
    logN = 0;
    for(int x = 1; x < N; x *= 2) logN++;
    logN = 21;
    parent.assign(logN, vector<int>(N));
  }

  // どちらが根であってもOK
  void add_edge(int u, int v) {
    G[u].push_back(v);
    G[v].push_back(u);
  }

  void init(int root) {
    stack<pair<int, int>> s;
    s.push(make_pair(root, -1));
    while(!s.empty()) {
      auto cur = s.top(); s.pop();
      if(cur.second < 0) depth[cur.first] = 0;
      else depth[cur.first] = depth[cur.second] + 1;

      parent[0][cur.first] = cur.second;
      for(int next : G[cur.first]) {
        if(next != cur.second) {
          s.push(make_pair(next, cur.first));
        }
      }
    }

    for(int k = 1; k < logN; k++) {
      for(int v = 0; v < N; v++) {
        if(parent[k - 1][v] < 0) parent[k][v] = -1;
        else parent[k][v] = parent[k - 1][parent[k - 1][v]];
      }
    }
  }

  int lca(int u, int v) {
    if(depth[u] > depth[v]) swap(u, v); // vのほうが深くなる
    // uとvの深さが同じになるまでvを根の方向に移動する
    for(int k = 0; k < logN; k++) {
      if(((depth[v] - depth[u]) >> k) & 1) {
        v = parent[k][v];
      }
    }
    if(u == v) return u;
    for(int k = logN - 1; k >= 0; k--) {
      if(parent[k][u] != parent[k][v]) {
        u = parent[k][u];
        v = parent[k][v];
      }
    }
    return parent[0][u];
  }
};

int main() {
  ios::sync_with_stdio(false);
  int N; cin >> N;
  LCA lca(N);
  for(int u = 0; u < N; u++) {
    int k; cin >> k;
    while(k--) {
      int v; cin >> v;
      lca.add_edge(u, v);
    }
  }
  lca.init(0);
  int Q; cin >> Q;
  while(Q--) {
    int u, v; cin >> u >> v;
    cout << lca.lca(u, v) << endl;
  }
}

Measured memory_bytes: 16348
#include <stdio.h>

int main(void)
{
     int choho=0, hishi=0, x, y, z;

     while(0<1){
	  if(scanf("%d,%d,%d", &x, &y, &z)==EOF) break;

	  if(x>0&&y>0&&z>0){
	       
	       if(x==y){
		    if(z<=x+y) hishi++;
	       }
	       
	       x = x * x;
	       y = y * y;
	       z = z * z;
	       
	       if(z==x+y){
		    choho++;
		    if(x==y) hishi++;
	       }
	  }
     }
     printf("%d\n%d\n", choho, hishi);
     
     return 0;
}

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

int main() {
  int A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;
  if(A+B>=2*C) {
    if(X>=Y) cout << C*Y*2 + (X-Y)*min(A,2*C) << "\n";
    else cout << C*X*2 + (Y-X)*min(B,2*C) << "\n";
  }
  else cout << A*X + B*Y << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int long long int
#define INF 999999999999999999
using namespace std;
int n;
vector<vector<pair<int, int>>> adj;
vector<bool> vis;
stack<int> st;
vector<int> d;
void dfs(int src)
{
  vis[src]=true;
  bool flag=true;
  for(auto i : adj[src])
    if(!vis[i.first])
    dfs(i.first);
  st.push(src);
}
void top_sort()
{
  bool flag=true;
  while(flag)
  {
    flag=true;
    for(int i=0;i<n;i++)
    {
      if(vis[i]==false)
      {
        flag=false;
        dfs(i);
      }
    }
    if(flag)
      break;
  }
}

void calc(int src)
{
  if(d[src]==INF)
    d[src]=0;

  for(auto i : adj[src])
    d[i.first]=min(d[i.first],d[src]+i.second);
}
void solve()
{
  int m;
  cin>>n>>m;
  adj.resize(n);
  vis.assign(n,false);
  for(int i=0,a,b;i<m;i++)
  {
    cin>>a>>b;
    --a;
    --b;
    adj[a].push_back({b,-1});
  }
  top_sort();
  vis.assign(n,false);
  d.assign(n,INF);

  while(!st.empty())
  {
    int t = st.top();
    calc(t);
    st.pop();
  }
  int ans=INT_MAX;
  for(int i=0;i<n;i++)
  {
    ans=min(ans,d[i]);
  }

  cout<<-1*ans<<endl;







}
signed main()

{
  FAST_IO;
  int t = 1;

  // cin>>t;

  while(t--)
  {
    solve();
  }
  
  return 0;
}

Measured memory_bytes: 12408
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 1005;

inline int add(int x,int y)
{
    return (x + y)%MOD;
}

inline int sub(int x,int y)
{
    return (x+MOD-y)%MOD;
}

inline int mul(int x,int y)
{
    return (ll)x*y%MOD;
}

int dp[MAX_N][MAX_N];

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w;
    cin >> h >> w;
    vs s(h);
    rep(i,h){
        cin >> s[i];
    }
    dp[0][0] = 1;
    rep(i,h){
        if(s[i][0] == '#'){
            break;
        }
        dp[i][0] = 1;
    }
    rep(j,w){
        if(s[0][j] == '#'){
            break;
        }
        dp[0][j] = 1;
    }
    srep(i,1,h){
        srep(j,1,w){
            if(s[i][j] == '.'){
                dp[i][j] = add(dp[i][j-1], dp[i-1][j]);
            }
        }
    }
    cout << dp[h-1][w-1] << "\n";
    return 0;
}

Measured memory_bytes: 5248
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

signed main() {
    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;

    vector<int> water;
    vector<int> sugar;
    for (int i = 0; i < 50; i++) {
        for (int j = 0; j < 50; j++) {
            if (100 * (A * i + B * j) <= F) {
                water.push_back(100 * (A * i + B * j));
            }
        }
    }
    for (int i = 0; i < 2000; i++) {
        for (int j = 0; j < 2000; j++) {
            if (C * i + D * j <= F) {
                sugar.push_back(C * i + D * j);
            }
        }
    }
    // sort(vec.begin(), vec.end());
    // vec.erase(unique(vec.begin(), vec.end()), vec.end());
    sort(water.begin(), water.end());
    water.erase(unique(water.begin(), water.end()), water.end());
    sort(sugar.begin(), sugar.end());
    sugar.erase(unique(sugar.begin(), sugar.end()), sugar.end());

    int Mw = 0, Ms = 0;
    for (vector<int>::iterator w = water.begin(); w != water.end(); ++w) {
        for (vector<int>::iterator s = sugar.begin(); s != sugar.end(); ++s) {
            const int tw = *w, ts = *s;
            if (tw + ts <= F && 100 * ts <= E * tw) {
                if (Ms * (tw + ts) <= ts * (Mw + Ms)) {
                    Mw = tw;
                    Ms = ts;
                }
            }
        }
    }
    cout << Mw + Ms << " " << Ms << endl;
    return 0;
}


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

namespace AtCoder.Abc
{
    //https://atcoder.jp/contests/abc141/tasks/abc141_a
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var arr = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            Console.WriteLine((arr[0]*arr[1]).ToString());

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 28292
#include <iostream>
#include <iomanip>
#include <cstring>
#include <algorithm> 
#include <math.h>
#include <queue>
#include <functional>
#include <map>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;

int main(void){
    int n;
    vector<int> a(300005);
    ll cost1[300005], cost2[300005];
    priority_queue<int, vector<int>, greater<int>> que1;
    priority_queue<int> que2;

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

    for (int i = 0; i <= 3 * n; i++){
        cost1[i] = 0; cost2[i] = 0;
    }


    for (int i = 0; i < 2 * n; i++){
        que1.push(a[i]);
        cost1[i] = cost1[i - 1] + a[i];
        if (i < n)continue;
        cost1[i] -= que1.top();
        que1.pop();
    }

    for (int i = 3 * n - 1; i >= n; i--){
        que2.push(a[i]);
        cost2[i] = cost2[i + 1] + a[i];
        if (i >= 2 * n) continue;
        cost2[i] -= que2.top();
        que2.pop();
    }


    ll ans = -100000000000000000;
    for (int i = n - 1; i <= 2 * n - 1; i++){
        ans = max(ans, cost1[i] - cost2[i + 1]);
    }

    cout << ans << endl;

}

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

using namespace std ;

int main() {

    long long int a , b ,c ,ans ;

    cin >> a >> b >> c ;

    ans=(b+c)-a ;

    if(ans<0)
        ans=0 ;

    cout << min(b,c)<<" "<<ans<<endl ;



    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int k;
  cin >> k;

  int even = k / 2;

  if (k % 2 == 0){
    cout << even * even << endl;
  }else {
    cout << even * (even + 1) << endl;
  }
}

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

int main(){
    int N; cin >> N;
    vector<int> A(N);
    for( int &k : A ) cin >> k;

    vector<int> ans(N,0);
    int M = 0;
    for( int i = N; i > 0; i-- ){ //配列のポインタのみ 0-origined
        int sum = 0;
        int count = i;
        while( count <= N ){
            sum += ans[count-1];
            count += i;
        }
        if( sum%2 != A[i-1] ){
            ans[i-1] = 1;
            M++;
        }
    }



    cout << M << endl;
    for( int i = 0; i < N; i++ ){
        if( ans[i] ){
            cout << i+1; //出力のみ　1-origined
            if( i != N-1 ) cout << " ";
        }
    }
    if( M ) cout << endl;
}

Measured memory_bytes: 2432
S = input()
Q = int(input())
pre_rev, suf = '', ''
rev = False
for _ in range(Q):
    query = input().split()
    if query[0] == '1':
        rev ^= 1
    else:
        f, c = query[1:]
        if (f == '1' and not rev) or (f == '2' and rev): pre_rev = pre_rev + c
        else: suf = suf + c
print(pre_rev[::-1] + S + suf if not rev else (S + suf)[::-1] + pre_rev)

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

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }	//最大公約数(Greatest Common Divisor)
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }			//最小公倍数(Least Common Multiple)

long long comb(long long m) {
	return (m * (m - 1)) / 2;
}


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

	bool ans = 0;
	for (int i = a; i <= b; i++) {
		if (i%k == 0) {
			ans = 1;
			break;
		}
	}
	
	if (ans)
		cout << "OK" << endl;
	else
		cout << "NG" << endl;



}

Measured memory_bytes: 3632
#include <iostream>
    #include <string>
    #include <set>  
    #include <algorithm>
    #include <vector>
    #include <cmath>
    #include <queue>
    #include <deque>
    #include <cstring>
    #include <cstdio>
    #include <map>
    #include <numeric>
    #include <cassert>
    #include <iomanip>
    #include <sstream>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define REP(i,N) FOR(i,0,N)
#define FORD(i,b,a) for(int i=(int)(b)-1;i>=a;--i)
typedef long long LL;
typedef pair<int,int> PII;
const int INF=1e9+7;
#define st first
#define nd second
#define pb push_back
#define eb emplace_back
#define dprintf(...) printf(__VA_ARGS__)
const int maxn=1e5+10;
int N;
int cnt=0;
struct Town
{
	int x;
	int y;
	int id;
}t[maxn],tt[maxn];
int fa[maxn];
int geT(int x)
{
	return fa[x]==x?fa[x]:fa[x]=geT(fa[x]);
}
map<pair<int,int>,bool> mp;
bool less2(Town a,Town b)
{
	return a.x>b.x;
}
bool less3(Town a,Town b)
{
	return a.y>b.y;
}
struct edge
{
	int u,v,cst;
}es[2*maxn];
bool less4(edge a,edge b)
{
	return a.cst<b.cst;
}
int main()
{
	scanf("%d",&N);
	REP(i,N)
	{
		int xx,yy;
		scanf("%d %d",&xx,&yy);
		if(!mp[make_pair(xx,yy)])
		{
			mp[make_pair(xx,yy)]=1;
			t[cnt].x=xx,t[cnt].y=yy,t[cnt].id=cnt;
			tt[cnt].x=xx,tt[cnt].y=yy,tt[cnt].id=cnt;
			cnt++;
		}
	}
	sort(t,t+cnt,less2);
	sort(tt,tt+cnt,less3);
//	cout<<cnt<<endl;
	REP(i,cnt-1)
	{
		es[i*2].u=t[i].id,es[i*2].v=t[i+1].id,es[i*2].cst=abs(t[i].x-t[i+1].x);
		es[i*2+1].u=tt[i].id,es[i*2+1].v=tt[i+1].id,es[i*2+1].cst=abs(tt[i].y-tt[i+1].y);
	}
	sort(es,es+2*(cnt-1),less4);
//	REP(i,2*(cnt-1))
//	{
//		cout<<es[i].u<<" "<<es[i].v<<" "<<es[i].cst<<endl;
//	}
//	system("pause");
	REP(i,cnt)fa[i]=i;
	long long ans=0;
	REP(i,2*(cnt-1))
	{
		int fr=es[i].u,to=es[i].v,c=es[i].cst;
		int ru=geT(fr),rv=geT(to);
		if(ru==rv)continue;
		fa[ru]=rv;
	//	cout<<fr<<" "<<to<<endl;
	//	cout<<ans<<" "<<c<<endl;
	//	system("pause");
		ans+=c; 
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 11520
(defn make-vec
  [n]
  (->>
    (clojure.string/split (str n) #" ")
    (map #(Integer/parseInt %))))

(defn abc-125b
  []
  (let [n (Integer/parseInt (read-line))
        v (make-vec (read-line))
        c (make-vec (read-line))]
    (->>
      (for [i (range 0 n)]
        (if (> (nth v i) (nth c i))
          (- (nth v i) (nth c i))
          0))
      (reduce +))))

(prn (abc-125b))

Measured memory_bytes: 67692
N = int(input()) 
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
A = list(range(1,N+1))
Alist=[]
import itertools
for v in itertools.permutations(A):
        Alist.append(v)
a_num = Alist.index(P)+1
b_num = Alist.index(Q)+1
print(abs(b_num - a_num))

Measured memory_bytes: 7924
#include <bits/stdc++.h>
#include <iostream>
#include <vector>

#define FAST ios_base::sync_with_stdio(false); cin.tie(0)
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
typedef long long int ll;

#define min(x,y)(x<y?x:y)
 
using namespace std;

int main() {
	FAST;

	int A, B;

	cin >> A;
	cin >> B;

	string res;

	res = ":(\n";

	if (A <= 8 && B <= 8) res="Yay!\n";

	cout << res;

    return 0;
}

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

int main(){
    long long N, A, B;
    cin >> N >> A >> B;
    long long C;
    if((N % (A + B))- A >= 0){
        C = A;
    }
    else{
        C = N % (A + B);
    }
    cout << (N / (A + B)) * A + C << endl;
    system("pause");
    return 0;
}

Measured memory_bytes: 504
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> p(N);
  for(int i = 0; i < N; i++){
    cin >> p[i];
  }

  sort(p.rbegin(),p.rend());
  int Max = p[0];
  for(int i = 0; i < N; i++){
    Max = max(Max,p[i]);
  }
  /*cout << p[0] << endl;
  cout << Max << endl;*/
  int sum = 0, ans = 0;
  for(int i = 1; i < N; i++){
    sum = sum + p[i];
  }
  ans = Max / 2 + sum;
  cout <<  ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String strArr[] = br.readLine().split(" ");
            int a = Integer.parseInt(strArr[0]);
            int b = Integer.parseInt(strArr[1]);
            int c = Integer.parseInt(strArr[2]);
            int x = Integer.parseInt(strArr[3]);
            int y = Integer.parseInt(strArr[4]);

            int ans1 = a * x + b * y;

            int ans2 = 0;
            int ans3 = 0;
            if (x > y) {
                ans2 += (c * 2) * y;
                ans3 += (c * 2) * y;
                ans2 += (x - y) * a;
                ans3 += (x - y) * (c * 2);
            } else {
                ans2 += (c * 2) * x;
                ans3 += (c * 2) * x;
                ans2 += (y - x) * b;
                ans3 += (y - x) * (c * 2);
            }

            if (ans1 > ans2) {
                if (ans2 > ans3) {
                    System.out.println(ans3);
                } else {
                    System.out.println(ans2);
                }
            } else {
                if (ans1 > ans3) {
                    System.out.println(ans3);
                } else {
                    System.out.println(ans1);
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}


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

ll n;
vector<ll> v[100001];
ll memo[100001];

struct Node{
    ll par;
    vector<ll> chi;
};
Node node[100001];

void init(ll x){
    rep(i,0,(ll)v[x].size()-1){
        if(v[x][i]!=node[x].par){
            node[v[x][i]].par=x;
            node[x].chi.pb(v[x][i]);
            init(v[x][i]);
        }
    }
}

ll hoge(ll x){
    if(memo[x]!=0){
        return memo[x];
    }
    ll ans1=1;
    ll ans2=1;
    rep(i,0,(ll)node[x].chi.size()-1){
        ans1=(ans1*hoge(node[x].chi[i]))%i_7;
        rep(j,0,(ll)node[node[x].chi[i]].chi.size()-1){
            ans2=(ans2*hoge(node[node[x].chi[i]].chi[j]))%i_7;
        }
    }
    return memo[x]=(ans1+ans2)%i_7;
}

int main(){fastio
    cin>>n;
    ll x,y;
    rep(i,0,n-2){
        cin>>x>>y;
        v[x].pb(y);
        v[y].pb(x);
    }
    node[1].par=1;
    init(1);
    ll ans=hoge(1);
    /*
    rep(i,1,n){
        rep(j,0,(ll)node[i].chi.size()-1){
            cout<<node[i].chi[j]<<' ';
        }
        cout<<endl;
    }
    */
    cout<<ans%i_7<<endl;
    
    return 0;
}


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

using namespace std;

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

int main(){
  int n, m;
  cin >> n >> m;
  if(m & 1){
    cout << -1 << endl;
    return 0;
  }
  vector<pair<int, int>> e;
  vector<vector<int>> a(n);
  REP(i, m){
    int p, q;
    cin >> p >> q;
    --p, --q;
    e.push_back(make_pair(p, q));
    a[p].push_back(i);
    a[q].push_back(i);
  }
  queue<int> q;
  q.push(0);
  vector<bool> visited(n);
  vector<bool> used(m);
  visited[0] = true;
  vector<pair<int, int>> es;
  while(!q.empty()){
    int v = q.front();
    q.pop();
    for(auto ei: a[v]){
      int w = v ^ e[ei].first ^ e[ei].second;
      if(visited[w]) continue;
      visited[w] = true;
      used[ei] = true;
      q.push(w);
      es.push_back(make_pair(v, w));
    }
  }
  vector<int> d(n);
  REP(i, m){
    if(used[i]) continue;
    cout << e[i].first + 1 << " " << e[i].second + 1 << endl;
    d[e[i].first] ^= 1;
  }
  for(auto it = es.rbegin(); it != es.rend(); ++it){
    int par = it->first;
    int chi = it->second;
    if(d[chi]){
      cout << chi + 1 << " " << par + 1 << endl;
    }else{
      cout << par + 1 << " " << chi + 1 << endl;
      d[par] ^= 1;
    }
  }
  return 0;
}


Measured memory_bytes: 8952
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

int main(){
  char s[5], sum = 0;
  int k[26] = {0};
  scanf("%s", s);
  for(int j = 0; j < 4; ++j){
    for(int i = 0; i < 26; ++i){
      if(s[j] == i + 65){
        if(k[i] == 0) sum++;
        k[i]++;
      }
    }
  }
  if(sum == 2) puts("Yes");
  else puts("No");
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cstdio>
#include<cmath>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
int MOD=1000000007;
signed main(){
    int a,b,c;cin>>a>>b>>c;
    int res=min(b/a,c);
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int k;
  cin >> k;
  int T = 0;
  for (int i = 0; i < k; i++){
    int b;
    cin >> b;
    T |= (1 << b);
  }
  vector<int> t;
  for (int i = 0; i < n; i++){
    if ((T >> i) & 1){
      t.push_back(i);
    }
  }
  for (int i = 0; i < (1 << k); i++){
    int b = 0;
    for (int j = 0; j < k; j++){
      if (i & (1 << j)){
        b += (1 << t[j]);
      }
    }
    cout << b << ':';
    for (int j = 0; j < n; j++){
      if (b & (1 << j)){
        cout << ' ' << j;
      }
    }
    cout << endl;
  }
}


Measured memory_bytes: 3168
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int[][] l = new int[3][3];
        for(int i = 0;i < 3;i++)    for(int j = 0;j < 3;j++)    l[i][j] = sc.nextInt();
        if(l[0][0] + l[1][1] == l[1][0] + l[0][1] 
            && l[0][0] + l[2][1] == l[2][0] + l[0][1] 
                && l[1][0] + l[0][2] == l[0][0] + l[1][2]
                    && l[0][0] + l[2][2] == l[2][0] + l[0][2])  System.out.println("Yes");
        else    System.out.println("No");
    }
}

Measured memory_bytes: 23892
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    String S =sc.next();
    if(S.contains("RRR")){System.out.println(3);}
    else if(S.contains("RR")){System.out.println(2);}
    else if(S.contains("R")){System.out.println(1);}
    else{System.out.println(0);}
  }
}

Measured memory_bytes: 35684
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <functional>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

const int MAX = 1e5 + 10;
int N;
pair<LL, PLL> ab[MAX];
LL A[MAX], B[MAX];
LL C[MAX];

int main(void) {
    cin >> N;
    REP(i, N) cin >> A[i];
    REP(i, N) cin >> B[i];
    if (accumulate(A, A + N, 0LL) < accumulate(B, B + N, 0LL)) {
        cout << -1 << endl;
        return 0;
    }
    REP(i, N) {
        ab[i] = MP(A[i] - B[i], MP(A[i], A[i]));
    }
    sort(ab, ab + N);
    int l = 0, r = N - 1;
    while (true) {
        if (ab[l].first < 0) {
            while (true) {
                LL tmp = min(-ab[l].first, ab[r].first);
                ab[l].first += tmp;
                ab[l].second.first += tmp;
                ab[r].first -= tmp;
                ab[r].second.first -= tmp;
                if (ab[l].first < 0) {
                    r--;
                } else {
                    l++;
                    break;
                }
            }
        } else {
            break;
        }
    }
    int cnt = 0;
    REP(i, N) cnt += ab[i].second.first != ab[i].second.second;
    cout << cnt << endl;
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + (ll)b) % mod
#define MUL(a, b) a = (a * (ll)b) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rer(i, a, b) for(int i = a - 1; i >= b; i--)
#define all(a) (a).begin(), (a).end()
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef pair<pi, pi> ppi;
typedef vector<ll> vec;

const int MAX_N = 500010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 30;

void Debug() {cout << '\n'; }

template<class FIRST, class... REST> 
void Debug(FIRST arg, REST... rest) { cout << arg << " "; Debug(rest...); }

template<class T>
ostream& operator<< (ostream& out, const vector<T>& v) {
	out << "[";
	if(!v.empty()) {
		rep(i, 0, (int)v.size() - 1) out << v[i] << ", ";
		out << v.back();
	}
	out << "]";
  return out;
}

template<class S, class T>
ostream& operator<< (ostream& out, const pair<S, T>& v) {
	out << "(" << v.first << ", " << v.second << ")";
	return out;
}

///g++ -g3 -std=c++0x -DLOCAL -Wall -ftrapv -D_GLIBCXX_DEBUG -Wl,-stack,268435456 -o
///g++ -O2 -std=c++0x -DLOCAL -Wall -Wl,-stack,268435456 -o

///////////////////////////////////////////////////////////////////////

int X;

void solve() {
	cin >> X;
	ll res = 0;
	for(int i = 1; i <= 300000; i++) {
		res += i;
		if(res >= X) {
			cout << i << "\n";
			break;
		}
	}
}

int main() {
	ios::sync_with_stdio(false);
    cin.tie(0);	
    cout << fixed;
	cout.precision(20);
#ifdef LOCAL
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}




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

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

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

    return arr

#main
n = int(input())
B=[0]
for i in range(1,11):
    for j in range(i+1):
        B.append(i)

A=factorization(n)

ans=0
for i in A:
    ans+=B[i[1]]

if n==1:
    ans=0

print(ans)

Measured memory_bytes: 9524