akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
	static final int MAX = 2_147_483_646; // intMax 
	static final int INF = 1_000_000_000; // 10^9  
	public static void main(String[] args) throws Exception{
		hayami saori = new hayami();
		int n= saori.saori_hayami();
		int count = 0;
		for(int i = 0;i < n;i++){
			int a = saori.saori_hayami();
			int b = saori.saori_hayami();
			if(a == b){
				count ++;
			} else {
				count = 0;
			}
			if(count >= 3){
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
		saori.close();
	}
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

map <int, int> br;

int main(){
    ios_base::sync_with_stdio(false);
	cout.precision(10);
	cout << fixed;

    int n;
    cin >> n;
    for(int i=1; i<=n; i++){
        int x;
        cin >> x;
        br[x]++;
    }
    int m;
    cin >> m;
    for(int i=1; i<=m; i++){
        int x;
        cin >> x;
        br[x]--;
        if(br[x] < 0){
            cout << "NO";
            return 0;
        }
    }
    cout << "YES";
    return 0;
}


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

# define C continue;
# define R return

#define int long long
# define D double
# define I insert
# define ld long double
# define ull unsigned long long
# define ui unsigned int

# define pb push_back
# define pf push_front

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

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

# define all(v) v.begin() , v.end()
# define allcomp(v) v.begin() , v.end() , comp

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

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

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

#define PQ(type) priority_queue<type>
#define PQD(type) priority_queue<type, vector<type>, greater<type>>

#define mii map<int, int>
#define mll map<ll, ll>
#define mci map<char, int>
#define msi map<string, int>
#define mis map<int, string>
#define mib map<int, bool>
#define mcb map<char,bool>

#define umii unordered_map<int, int>
#define umll unordered_map<ll, ll>
#define umci unordered_map<char, int>
#define umsi unordered_map<string, int>
#define umis unordered_map<int, string>

#define init(arr,val) memset(arr,val,sizeof(arr))
#define REP(i,a,b) for(int i=a; i<b; i++)
#define distance(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b))

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

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

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

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

const ld pie = 3.1415926535897932384626 ;
const int mod = 1e9 + 7 ;
#define test int t; cin>>t;
# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);
/// Tip : If a and b are positive integers ; we may say - ceil (a/b) = 1 + floor ( (a-1)/b ) .
void a_b_c()
{
    #ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
    #endif
}
void solve()
{
 int k; cin>>k;
 if(k%7==0) k/=7;
 if(__gcd((int)10,k)!=1)
 {
     cout<<-1;
     R;
 }
 int a=1%k;
 int ans=1;
 while(a!=0)
 {  // cout<<a<<" ";
     a=(10*a+1)%k;
     ans++;
 }
 cout<<ans;
}
int32_t main()
{	fast
    int t=1;
    //freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
    //int t;  cin>>t;
    for(int i=1; i<=t; i++) solve();

}


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

int get_group(int n) {
	if (n == 2)
		return 1;
	else if (n == 4 || n == 6 || n == 9 || n == 11)
		return 2;
	else
		return 3;
}

int main(void) {
	int x, y;
	cin >> x >> y;

	if (get_group(x) == get_group(y))
		cout << "Yes\n";
	else
		cout << "No\n";

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	int N,K,P;
	cin>>N;
	for(int n=0;n<N;n++){
		cin>>K>>P;
if(K<P){
cout<<K<<endl;
}else{
if(K%P==0){
cout<<P<<endl;
}
else {
cout<<K%P<<endl;
}
}	
}
return 0;
}

Measured memory_bytes: 1160
from itertools import tee


def pairwise(iterable):
    x, y = tee(iterable)
    next(y, None)
    return zip(x, y)


n = int(input())
a = tuple(map(int, input().split(" ")))
b = tuple(map(int, input().split(" ")))
c = tuple(map(int, input().split(" ")))

point = sum(b)
for i, j in pairwise(a):
    if j == i + 1:
        point += c[i - 1]

print(point)


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define INF 100000000000
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using P = pair<int, int>;

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

int main()
{
    int h,w;
    cin >> h >> w;
    string s;
    rep(i,h) {
        cin >> s;
        cout << s << endl << s << endl;
    }
    return 0;
}


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

/*
#pragma GCC optimize("-Ofast")
//#pragma GCC optimize("trapv")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx2,tune=native")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-funroll-loops")*/

#define I inline void 
#define S struct 
#define vi vector<int> 
#define vii vector<pair<int,int>>
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std ; 
using ll = long long ; 
using ld = long double ; 

const int N = 1e4 + 7 , mod = 1e9 + 7 ; 
const int inf = N ; 
// How interesting!

int n , d ; 
string k ; 
int dp[N][101][2] ; 

int solve(int i , int md, bool flag){
        if(i == n)
                return !md ; 
        
        if(~dp[i][md][flag])
                return dp[i][md][flag] ;
        int ret = 0 ; 

        for(int j = 0 ;j < 10 ;j ++){
                if(flag && j > k[i] - '0')
                        continue ; 
                ret += solve(i + 1 , (md + j) % d , (flag & (j == k[i] - '0')) ) ; 
                if(ret>=mod)
                        ret-=mod ;
        }

        return dp[i][md][flag] = ret ; 
}

int main(){
        ios_base::sync_with_stdio(0) ;
        cin.tie(0) ; 
        //freopen("in.in" , "r" , stdin) ; 
        memset(dp , -1 , sizeof dp) ; 
        cin >> k >> d ;

        n = (int) k.size() ;

        cout<< (solve(0 , 0 , 1) + mod - 1 ) % mod ; 


        return 0 ; 
}

Measured memory_bytes: 12488
#include<bits/stdc++.h>
using namespace std;
map<string,int> a;
string s[200001];
int n;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		string s;
		cin>>s;
		a[s]++;
	}
	int cnt=0;s[1]=a.begin()->first;
	for(map<string,int>::iterator i=a.begin();i!=a.end();i++)
	{
		if(i->second==a[s[1]])
		{
			s[++cnt]=i->first;
		}
		if(i->second>a[s[1]])
		{
			cnt=1;
			s[cnt]=i->first;
		}
	}
	for(int i=1;i<=cnt;i++)cout<<s[i]<<endl;
	return 0;
}

Measured memory_bytes: 26752
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N,M,X,cnt = 0;
    cin >> N >> M >> X;
    vector<int> A(M);
    for(int i = 0;i < M;i ++){
        cin >> A[i];
    }
    for(int i = 0;i < M-1;i ++){
        if(A[i]<X && A[i+1] > X) cnt = i + 1; 
    }
    cout << min(cnt,M - cnt) << endl;
    return 0;
}

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

int main(){

    int L, R;
    cin >> L >> R;

    vector<int> list_mod;
    int N_mod = 0;
    for(int i = L; i < R + 1; i++){
        list_mod.push_back(i % 2019);
        N_mod++;
        if(N_mod == 2019){
            break;
        }
    }

    int min_mod=2000000000;
    int mod_tmp;
    for(int i = 0; i < list_mod.size() - 1; i++){
        for(int j = i + 1; j < list_mod.size(); j++){
            mod_tmp = (list_mod.at(i) * list_mod.at(j)) % 2019;
            min_mod = min(min_mod, mod_tmp);
            if(min_mod == 0){
                break;
            }
        }
        if(min_mod == 0){
            break;
        }
    }

    cout << min_mod << endl;

    return 0;

}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
ll ns[200010];
int countt(int h,int e)
{
	int w,l,r;
	int ww;
	ll de=INF;
	l = h;
	r = e;
	while(l+2 <= r)
	{
		w = (l+r)/2;
		if(abs(ns[w]-ns[h]-(ns[e]-ns[w])) < de)
		{
			de = abs(ns[w]-ns[h]-(ns[e]-ns[w]));
			ww = w;
		}
		if(ns[w]-ns[h] < ns[e]-ns[w])
		{
			l = w;
		}
		else
		{
			r = w;
		}
	}
	return ww;
}
int main()
{
	int n,i;
	ll ans=INF;
	ns[0] = 0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		ll t;
		scanf("%lld",&t);
		ns[i] = ns[i-1]+t;
	}
	for(i=2;i<=n-2;i++)
	{
		int wl,wr;
		ll l1,l2,r1,r2;
		wl = countt(0,i);
		wr = countt(i,n);
		l1 = ns[wl]-ns[0];
		l2 = ns[i]-ns[wl];
		r1 = ns[wr]-ns[i];
		r2 = ns[n]-ns[wr];
		if(l1 > l2)
		{
			ll t;
			t = l1;
			l1 = l2;
			l2 = t;
		}
		if(r1 > r2)
		{
			ll t;
			t = r1;
			r1 = r2;
			r2 = t;
		}
		ans = min(ans,max(l2,r2)-min(l1,r1));
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <algorithm>
#include <string>
#include <iostream>
#include <vector>
#include <unordered_map>

using namespace std;

void helper(vector<string>& strings)
{
    long long pairs = 0;

    unordered_map<string, long long> strFreq;

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

    for (string s : strings)
    {
        if (strFreq.find(s) == strFreq.end())
        {
            strFreq[s] = 1;
        }
        else 
        {
            pairs += strFreq[s];
            strFreq[s]++;
        }
    }

    cout << pairs << endl;
}

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

    int N;

    // scanf("%d", &N);
    cin >> N;

    string S;

    vector<string> strings;

    for (int i = 0; i < N; i++)
    {
        cin >> S;
        sort(S.begin(), S.end());
        //cout << endl << S;
        strings.push_back(S);
    }
    
    helper(strings);

    return 0;
}

Measured memory_bytes: 11380
#それゆけにぶたんまん
#python3.8.2のTLEの壁に阻まれました
n = int(input())
l = sorted(list(map(int,input().split())))

ans = 0
for i in range(n):
    for j in range(i+1,n):
        #jより大きい整数kでl[k]<l[i]+l[j]を満たす最大のk
        le = j
        ri = n
        while ri-le>1:
            m = (ri+le)//2
            if l[m]<l[i]+l[j]:
                le = m
            else:
                ri = m
        ans += le-j

print(ans)


Measured memory_bytes: 73452
import java.util.*;
import static java.lang.System.*;

public class Main {

	Scanner sc = new Scanner(in);
	
	void run() {
		char[] alpha = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
		String s = sc.nextLine();
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < s.length(); i++) {
			char c = s.charAt(i);
			for (int j = 0; j < 26; j++) {
				if (c == alpha[j]) {
					sb.append(alpha[(j-3+26)%26]);
				}
			}
		}
		out.println(sb);
	}
	
	public static void main(String[] args) {
		new Main().run();
	}

}

Measured memory_bytes: 17968
import java.util.Scanner;

public class Main {
	static int N;
	static double[] X, R;
	static boolean check(double y) {
		double l=-100000000;
		double r=100000000;
		for(int i=0; i<N; i++) {
			double a=X[i]-Math.sqrt(R[i]*R[i]-y*y);
			l=Math.max(l, a);
			double b=X[i]+Math.sqrt(R[i]*R[i]-y*y);
			r=Math.min(r, b);
		}
		return (l<r);
	}
	
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			N=sc.nextInt();
			double minx=0, maxx=1000000000;
			X=new double[N];
			R=new double[N];
			double a=0, b=0;
			double ra=0, rb=0;
			for(int i=0; i<N; i++) {
				double x=sc.nextDouble();
				double r=sc.nextDouble();
				X[i]=x;
				R[i]=r;
				
				maxx=Math.min(maxx, R[i]);
			}
			for(int i=0; i<100; i++) {
				double mid=(maxx+minx)/2.0;
				if(check(mid)) {
					minx=mid;
				}
				else {
					maxx=mid;
				}
			}
			System.out.println(minx);
			
			
		}
	}
}


Measured memory_bytes: 172604
#include <stdio.h>
#include <iostream>

using namespace std;
int main(void)
{
    int n,k;
    int a[100000];
    cin >> n >> k;
    for(int i=1;i<=n;i++){
        cin >> a[i];
    }
    if(n-k == 0){
        cout << 1;
        return 0;
    }
    int res = (n-k)/(k-1) + 1;
    if((n-k)%(k-1) != 0)res++;
    cout << res;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 20;
int d, n, tot, a[maxn], c[maxn];
ll p[maxn], ans;
ll get(ll x, int i)
{
	while(i--) x /= 10;
	return x % 10;
}
void calc()
{
	if(c[tot] < 0) return;
	/*
	for(int i = 0; i <= tot; ++i) cout << c[i] << ' ';
	cout << endl;
	*/
	ll ret = 1;
	for(int i = 0; i <= tot / 2; ++i)
	{
		if(i == 0) ret = ret * (9 - abs(c[i]));
		else ret = ret * (9 - abs(c[i]) + 1);
	}
	ans += ret;
}
void dfs(int l, int r, ll d)
{
	if(l >= r)
	{
		if(!d) 
		{
			if(l == r) c[l] = 0;
			calc();
		}
		return;
	}
	int x = get(d, l);
	c[l] = x; c[r] = -x;
	dfs(l + 1, r - 1, d - p[l] * x + p[r] * x);
	if(x > 0)
	{
		c[l] = x - 10; c[r] = 10 - x;
		dfs(l + 1, r - 1, d + p[l] * (10 - x) - p[r] * (10 - x));
	}
	else if(x < 0)
	{
		c[l] = 10 + x; c[r] = -10 - x;
		dfs(l + 1, r - 1, d - p[l] * (10 + x) + p[r] * (10 + x));
	}
}
int main()
{
	scanf("%d", &d);
	int x = d;
	while(x)
	{
		a[n++] = x % 10;
		x /= 10;
	}
	p[0] = 1;
	for(int i = 1; i < maxn; ++i) p[i] = p[i - 1] * 10;
	for(int i = n - 1; i <= 2 * n; ++i)
	{
		tot = i;
		dfs(0, i, d);
	}
	cout << ans << endl;
	return 0;
}
/*
99
*/

Measured memory_bytes: 3764
#include <math.h>
#include <ctype.h>
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, n) for (int i = a; i < n; i++)
#define REP(i, n) for(int i = 0; i < n; i++)
struct omt{omt(){ios::sync_with_stdio(false);cin.tie(0);}}star;

int main(){
    int n;
    cin >> n;
    set<int> st;
    REP(i, n){
        int tmp;
        cin >> tmp;
        st.insert(tmp);
    }
    int A[st.size()], i = 0;
    for(auto &x : st){
        A[i] = x;
        i++;
    }
    int ans = 0;
    FOR(i, 1, st.size()){
        ans += A[i] - A[i - 1];
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import Control.Applicative
import Control.Monad

main :: IO ()
main = do
    xss <- getLine
    yss <- getLine
    putStrLn $ show (solve xss yss)

solve :: String -> String -> Int
solve xss yss = solve' xss yss 0
      where solve' []     []     n = n
            solve' (x:xs) (y:ys) n = if x == y 
                                     then solve' xs ys (n+1)
                                     else solve' xs ys n

Measured memory_bytes: 380
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cstdlib>
#define RG register
using namespace std;
const int N=103;
int n,a[N],maxx,num[N];
template<typename I> inline void read(I &ot){
    I ch=getchar(), x=0, f=1;
    while(ch<'0' || ch>'9'){if(ch=='-') f=-1; ch=getchar();	}
    while(ch>='0' && ch<='9'){x=x*10+ch-'0'; ch=getchar();	}
    ot=x*f;}
template<typename I, typename... U> inline void read(I &x,U&... y){read(x); read(y...);}
template<typename I>inline I mx(const I&a,const I&b){return a>b ? a : b;}
inline void endd(){printf("Impossible\n"); exit(0);}
int main()
{
    //freopen("Tree Restoring.in","r",stdin);
    read(n);
    for(RG int i=1;i<=n;i++) read(a[i]), maxx=mx(maxx,a[i]), num[a[i]]++;
    if(maxx&1)
    {
        for(RG int i=maxx-maxx/2;i<=maxx;i++) if((num[i]-=2)<0) endd();
        for(RG int i=maxx-maxx/2;i;i--) if(num[i]) endd();
    }
    else {
        num[maxx/2]--;
        for(RG int i=maxx/2+1;i<=maxx;i++) if((num[i]-=2)<0) endd();
        for(RG int i=maxx/2;i;i--) if(num[i]) endd();
    }
    printf("Possible\n");
    return 0;
}

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

#define _GLIBCXX_DEBUG
#define rep(i, V) for (int i = 0; i < V; i++)
#define repr(i, V) for (int i = V-1; i >= 0; i--)
#define repval(i, a, V) for (int i = a; i < V ; i++)
#define all(x) x.begin(), x.end()
#define ld long double
#define eps 0.0000000001
#define mod 1000000007
#define inf 1e9
#define vec vector
#define each(i, mp) for(auto& i:mp)

int nmax = 100001;

int main(){
    vec<bool> f(nmax, false); //素数がfalse
    vec<int> c(nmax,0);
    repval(i, 2, nmax) if(!f[i]) for(int j=i+i; j<nmax; j+=i){
        f[j] = true;
    }
    for(int i=3; i<nmax; i+=2){
        if(!f[i] && !f[(i+1)/2]) c[i]++;
    }
    repval(i, 3, nmax) c[i] += c[i-1];
    int q;
    cin >> q;
    int l, r;
    rep(i, q){
        cin >> l >> r;
        cout << c[r]- c[l-1] << endl;
    }
}

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

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

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

  int D=0;

  for(int i=0; i<n-1; i++){
    D=max(D,d[i]);
    if(D<10){
      cout << "no" << endl;
      return 0;
    }
    D-=10;
  }

  D=0;

  for(int i=n-1; i>0; i--){
    D=max(D,d[i]);
    if(D<10){
      cout << "no" << endl;
      return 0;
    }
    D-=10;
  }

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


Measured memory_bytes: 4264
import bisect

n,m,k=[int(x) for x in input().split()]
a=[int(x) for x in input().split()]
b=[int(x) for x in input().split()]
sum_a=[a[0]]
for i in range(len(a)-1):
    sum_a.append(sum_a[i]+a[i+1])
sum_b=[b[0]]
for i in range(len(b)-1):
    sum_b.append(sum_b[i]+b[i+1])

#現在のインデックス
idx_a=0
idx_b=0

while idx_a<n or idx_b<m:
    read=''
    #aの読める数
    oset_a=sum_a[idx_a-1] if idx_a>0 else 0
    can_cnt_a=bisect.bisect_right(sum_a,k+oset_a)
    #bの読める数
    oset_b=sum_b[idx_b-1] if idx_b>0 else 0
    can_cnt_b=bisect.bisect_right(sum_b,k+oset_b)
    read='a' if can_cnt_a-idx_a>can_cnt_b-idx_b else 'b'
    if idx_a==n:
        read='b'
    if idx_b==m:
        read='a'
    

    #読むほうをPOP
    k-=a[idx_a] if read=='a' else b[idx_b]
    #kを超えた場合ブレーク
    if k<0:
        break
    #カウントアップ
    if read=='a':
        idx_a+=1
    else:
        idx_b+=1
print(idx_a+idx_b)


Measured memory_bytes: 47420
#include<stdio.h>
#define N 45

int Fib(int);

int n,fib[N];

int main()
{
   int i;
  scanf("%d",&n);

  for(i=0;i<N;i++)
  {
    fib[i] = 0;
  }
   for(i=0;i<N;i++)
   {
     fib[i] = Fib(i);
   }

   printf("%d\n",fib[n]);

  return 0;
}

int Fib(int i)
{
  if(i == 0 || i == 1)return 1;
  if(fib[i] != 0)return fib[i];

  return fib[i] = Fib(i-2) + Fib(i-1);
}



Measured memory_bytes: 2056
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n;
ll ans;
ll modpow(ll x,ll n){
	ll res=1;
	while(n>0){
		if(n&1) res=res*x%mod;
		x=x*x%mod;
		n>>=1;
	}
	return res;
}
ll F[2000005],R[2000005];
void make(){
	F[0] = 1;
	for(int i=1;i<2000005;i++) F[i] = F[i-1]*i%mod;
	for(int i=0;i<2000005;i++) R[i] = modpow(F[i],mod-2);
}
ll C(int a,int b){
    if(a<0 || b<0 || a<b) return 0;
	return F[a]*R[b]%mod*R[a-b]%mod;
}
int main(){
	cin>>n; make();
	for(int k=0;k<=n-1;k++){
		ll beg = C(n-1,k);
		beg = beg+mod-C(k-1,n-k-1);
		beg %= mod;
		beg = beg*F[k]%mod*F[n-1-k]%mod;
		ans += beg;
	}
	cout<<ans%mod<<endl;
}

Measured memory_bytes: 31616
#include<bits/stdc++.h>
using namespace std;
int n,m;
const int N=1e5+100;
int dis[N],d[N],f[N][20],root[N*40],lg[N];
struct edgd
{
	int v,c,w,nxt;
}e[N<<2];
int h[N],idx=0;
void add(int u,int v,int c,int w)
{
	e[++idx]={v,c,w,h[u]};
	h[u]=idx;
}
struct node
{
	int l,r,tot,sum;
} t[N*40];
int cnt=0;
void build(int l,int r,int &x)
{
	x=++cnt;
	t[x].sum=t[x].tot=0;
	if(l==r) return ;
	int mid=l+r>>1;
	build(l,mid,t[x].l);
	build(mid+1,r,t[x].r);
}
void update(int l,int r,int c,int w,int &x,int pre)
{
	x=++cnt;
	t[x]=t[pre];
	if(l==r)
	{
		t[x].sum+=w;
		t[x].tot++;
		return ;
	}
	int mid=l+r>>1;
	if(c<=mid)update(l,mid,c,w,t[x].l,t[pre].l);
    else  update(mid+1,r,c,w,t[x].r,t[pre].r);
}
pair<int,int> query(int l,int r,int x,int y,int pos)
{
	if(l==r)return {t[y].sum-t[x].sum,t[y].tot-t[x].tot};
	int mid=l+r>>1;
	if(pos<=mid) return query(l,mid,t[x].l,t[y].l,pos);
	else return query(mid+1,r,t[x].r,t[y].r,pos);
} 
void dfs(int x,int fa)
{
	f[x][0]=fa;
	for(int i=1;1<<i<=d[x];i++) f[x][i]=f[f[x][i-1]][i-1];
	for(int i=h[x];i;i=e[i].nxt)
	{
		int v=e[i].v,c=e[i].c,w=e[i].w;
		if(v==fa) continue;
		update(1,n-1,c,w,root[v],root[x]);
		dis[v]=dis[x]+w;
		d[v]=d[x]+1; 
		dfs(v,x);
	}
}
int LCA(int x,int y)
{
	if(d[x]<d[y]) swap(x,y);
	int del=d[x]-d[y];
	for(int i=0;i<=lg[d[x]];i++) 
	 if(1<<i&del) x=f[x][i];
	if(x==y) return x;
	for(int i=lg[d[x]]-1;i>=0;i--)
	{
		if(f[x][i]!=f[y][i])
		x=f[x][i],y=f[y][i];
	}
	return f[x][0];
}
int main()
{
	cin>>n>>m;
	for(int i=1,x,y,z,w;i<n;i++) 
	{
		cin>>x>>y>>z>>w;
		add(x,y,z,w);add(y,x,z,w);
	}
	for(int i=1;i<=n;i++)  lg[i]=lg[i-1]+(1<<lg[i-1]==i);
	build(1,n,root[1]);
    dfs(1,0);
    //for(int i=1;i<=n;i++) cout<<dis[i]<<endl; 
    while(m--)
    {
    	int x,y,u,v;
    	cin>>x>>y>>u>>v;
    	int lca=LCA(u,v);
    	if(d[u]>d[v])swap(u,v);
    	if(lca==u)
    	{
    		int ans=dis[v]-dis[lca];
    		pair<int,int>t=query(1,n-1,root[u],root[v],x);
    		ans=ans-t.first+t.second*y;
    		cout<<ans<<endl;
    	}
    	else
    	{
    		int ans=dis[v]-dis[lca]+dis[u]-dis[lca];
            pair<int,int>t1=query(1,n-1,root[lca],root[v],x),t2=query(1,n-1,root[lca],root[u],x);
            ans=ans-t1.first+t1.second*y-t2.first+t2.second*y;
            cout<<ans<<endl;
    	}
    }
	return 0; 
}

Measured memory_bytes: 59392
#include <stdio.h>
#include <string.h>

int main() {
	char x[2], y[2];

	scanf("%c %c", &x[0], &y[0]);

	if (x[0] < y[0]) printf("<\n");
	else if (x[0] > y[0]) printf(">\n");
	else printf("=\n");

	return 0;
}

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

void next_A(vector<int>& A, int M){
  if(A.size() >= 1){
    int tmp = A.at(A.size()-1);
    if(tmp < M){
      A.pop_back();
      A.push_back(tmp+1);
    }else if(tmp == M){
      A.pop_back();
      next_A(A, M);
      A.push_back(A.at(A.size()-1));
    }
  }
}

void print_A(vector<int>& A, int N){
  for(int i=0;i<N;i++){
    cout << A.at(i) << " ";
  }
  cout << endl;
}

int64_t factorial(int64_t n){
  if(n > 1){
    return n*factorial(n - 1);
  }else{
    return 1;
  }
}

int64_t nCm(int64_t n, int64_t m){
  return factorial(n)/factorial(n-m)/factorial(m);
}

int main(){
  int N, M, Q;
  cin >> N >> M >> Q;
  vector<int> a(Q);
  vector<int> b(Q);
  vector<int> c(Q);
  vector<int> d(Q);
  for(int i=0;i<Q;i++){
    cin >> a.at(i) >> b.at(i) >> c.at(i) >> d.at(i);
  }

  vector<int> A(N);
  for(int i=0;i<N;i++){
    A.at(i) = 1;
  }
  
  int point = 0;
  int maxpoint = 0;
  int64_t R = nCm(N+M-1, M-1);
  for(int i=0;i<Q;i++){
    if(A.at(b.at(i)-1)-A.at(a.at(i)-1) == c.at(i)){
      maxpoint += d.at(i);
    }
  }
  
  for(int64_t p=0;p<R-1;p++){
    next_A(A, M);
    point = 0;
    for(int i=0;i<Q;i++){
      if(A.at(b.at(i)-1)-A.at(a.at(i)-1) == c.at(i)){
        point += d.at(i);
      }
    }
    maxpoint = max(maxpoint, point);
  }
  cout << maxpoint << endl;
  return 0;
}

Measured memory_bytes: 3604
//Author:xht37
#include <bits/stdc++.h>

#define ui unsigned int
#define ll long long
#define ul unsigned ll
#define ld long double

#define pi pair <int, int>
#define fi first
#define se second
#define mp make_pair

#define ls (p << 1)
#define rs (ls | 1)
#define md ((t[p].l + t[p].r) >> 1)

#define vi vector <int>
#define pb push_back
#define pq priority_queue

#define dbg(x) cerr << #x" = " << x << endl
#define debug(...) fprintf(stderr, __VA_ARGS__)

#define fl(x) freopen(x".in", "r", stdin), freopen(x".out", "w", stdout)

using namespace std;

namespace io {
	const int SI = 1 << 21 | 1;
	char IB[SI], *IS, *IT, OB[SI], *OS = OB, *OT = OS + SI - 1, c, ch[100];
	int f, t;
	#define gc() (IS == IT ? (IT = (IS = IB) + fread(IB, 1, SI, stdin), IS == IT ? EOF : *IS++) : *IS++)
	inline void flush() {
		fwrite(OB, 1, OS - OB, stdout), OS = OB;
	}
	inline void pc(char x) {
		*OS++ = x;
		if (OS == OT) flush();
	}
	template <class I>
	inline void rd(I &x) {
		for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;
		for (x = 0; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + (c & 15), c = gc());
		x *= f;
	}
	template <class I>
	inline void rd(I &x, I &y) {
		rd(x), rd(y);
	}
	template <class I>
	inline void rd(I &x, I &y, I &z) {
		rd(x), rd(y), rd(z);
	}
	template <class I>
	inline void rda(I *a, int n) {
		for (int i = 1; i <= n; i++) rd(a[i]);
	}
	inline void rdc(char &c) {
		for (c = gc(); c < 33 || c > 126; c = gc());
	}
	inline void rds(char *s, int &x) {
		for (c = gc(); c < 33 || c > 126; c = gc());
		for (x = 0; c >= 33 && c <= 126; s[++x] = c, c = gc());
		s[x+1] = '\0';
	}
	template <class I>
	inline void print(I x, char k = '\n') {
		if (!x) pc('0');
		if (x < 0) pc('-'), x = -x;
		while (x) ch[++t] = x % 10 + '0', x /= 10;
		while (t) pc(ch[t--]);
		pc(k);
	}
	template <class I>
	inline void print(I x, I y) {
		print(x, ' '), print(y);
	}
	template <class I>
	inline void print(I x, I y, I z) {
		print(x, ' '), print(y, ' '), print(z);
	}
	inline void printc(char c) {
		pc(c);
	}
	inline void prints(string s) {
		int x = s.length();
		while (t < x) pc(s[t++]);
		pc('\n'), t = 0;
	}
	struct Flush {
		~Flush() {
			flush();
		}
	} flusher;
}
using io::rd;
using io::rda;
using io::rdc;
using io::rds;
using io::print;
using io::printc;
using io::prints;

inline int SG(int n, int k) {
	int x = n / k, y = n % k;
	return y ? SG(n - (y + x) / (x + 1) * (x + 1), k) : x;
}

int main() {
//	fl("1");
	int n, w, k, ans = 0;
	rd(n);
	while (n--) rd(w, k), ans ^= SG(w, k);
	prints(ans ? "Takahashi" : "Aoki");
	return 0;
}

Measured memory_bytes: 2304
#include<cstdio>

int n, k;

int main() {
	scanf("%d%d", &n, &k);
	if(k>(n-1)*(n-2)/2) {
		puts("-1");
		return 0;
	}
	
	printf("%d\n", n*(n-1)/2 - k);
	for(int i=2;i<=n;i++)
		printf("1 %d\n", i);
	for(int i=2;i<=n;i++)
		for(int j=i+1;j<=n;j++)
			if (k>0) k--;
			else printf("%d %d\n", i, j);
	
	return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<iostream>
#include<cctype>
#include<algorithm>
using namespace std;

void trace(int N, int A[]) {
	for (int i = 0; i < N; i++) {
		cout << A[i];
		if (i < N - 1)cout << " ";
	}
	cout << endl;
}

void insertSort(int N, int A[]) {
	for (int i = 1; i < N; i++) {
		int v = A[i];
		int j = i - 1;
		while (j >= 0 && A[j] > v) {
			A[j + 1] = A[j];
			j--;
		}
		A[j + 1] = v;
		trace(N, A);
	}
}

int main() {
	int N,i,j;
	cin >> N;
	int A[100];
	for (i = 0; i < N; i++) {
		cin >> A[i];
	}
	trace(N, A);
	insertSort(N, A);
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define ld PRId64
#define n_max 1000
#define m_max 2000
#define INF llong(1e15)



struct edge{
    int from,to;
    llong cost;
};



bool shortest_path(int v_num,int e_num,int goal,llong d[],edge es[]){
    edge e;
    REP(i,2*v_num){
        REP(j,e_num){
            e=es[j];
            if(d[e.from] + e.cost < d[e.to] ){
                d[e.to] = d[e.from] + e.cost;
                if( i >= v_num -1 and e.to == goal) return true;
            }

        }
    }

    return false;

}


int main(){
    int n,m;
    cin >> n >>m;
    llong d[n_max +5];
    edge es[m_max +5];
    llong a,b,c;
    REP(i,m){
        scanf("%lld%lld%lld",&a,&b,&c);
        es[i].from = a-1;
        es[i].to = b-1;
        es[i].cost = -c;
    }

    REP(i,n) d[i] = INF;
    d[0]=0;

    if(shortest_path(n,m,n-1,d,es)){
        cout << "inf" << endl;
        return 0;
    }

    cout << -d[n-1] << endl;

}





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

using namespace std;
const int IINF = INT_MAX;
using ll = long long;
using P = pair<int,int>;
#define INF 1000000000000
int n;

int main(){
    long long n;
	cin >> n;
	long long ans = INF;
	
	for(long long i = 1; i <= sqrt(n); i++){
		if(n % i != 0) continue;
		
		long long b = n/i;
		ans = min(ans,i+b);
	}
	
	cout << ans - 2 <<endl;
	
    
    return 0;	
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
  int n;
  long ans;
  scanf("%d", &n);
  int i = 1;
  ans = 0;
  while (i <= n)
  {
   if(!(i%3 == 0 || i%5 == 0))
     ans += i;
   i++;
  }
  printf("%ld", ans);
  return (0);
}

Measured memory_bytes: 2156
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main()
{
    int c[3][3];
    rep(i, 0, 3) {
        rep(j, 0, 3) {
            cin >> c[i][j];
        }
    }

    for (int i = 0; i <= c[0][0]; i++) {
        for (int j = 0; j <= c[1][1]; j++) {
            for (int k = 0; k <= c[2][2]; k++) {
                int a[3] = {i, j, k};
                int b[3] = {c[0][0] - i, c[1][1] - j, c[2][2] - k};
                int cnt = 0;
                rep(l, 0, 3) {
                    rep(m, 0, 3) {
                        if (c[l][m] == a[l] + b[m]) {
                            cnt ++;
                        }
                    }
                }
                if (cnt == 9) {
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val array = readLine()!!.split(" ").map { it.toInt() } as MutableList<Int>
    insertionSort(n, array)

}

fun insertionSort(n: Int, array: MutableList<Int>){

    for (i in 1 until n) {
        println(array.joinToString(" "))
        val temp = array[i]
        var j = i - 1
        while (j >= 0 && array[j] > temp) {
            array[j + 1] = array[j]
            j--
        }
        array[j + 1] = temp

    }
    println(array.joinToString(" "))
}


Measured memory_bytes: 36096
#include "bits/stdc++.h"

using namespace std;

void Main() {
    int N;
    cin >> N;
    set<int> mochi;
    for (int i = 0; i < N; ++i) {
        int d;
        cin >> d;
        mochi.insert(d);
    }
    cout << mochi.size() << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3552
import java.io.*;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb;
		String[] strs;
		int  height, width;
		do {
			sb		= new StringBuilder();
			strs	= br.readLine().split("\\s+");
			height	= Integer.parseInt(strs[0]);
			width	= Integer.parseInt(strs[1]);
			
			if (height == 0 && width == 0) {
				break;
			} else {
				System.out.println(getFrame(height, width));
			}
		} while (true);
	}
	
	public static String getFrame(int height, int width) {
		StringBuilder sb = new StringBuilder();
		String str;
		
		for (int i = 0; i < height; i++) {
			for (int j = 0; j < width; j++) {
				if (i == 0 || i == (height - 1) || j == 0 || j == (width - 1)) {
					str = "#";
				} else {
					str = ".";
				}
				sb.append(str);
			}
			sb.append("\n");
		}
		
		return sb.toString();
	}
}

Measured memory_bytes: 25252
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
 
using namespace std;
#define REP(i,b,e) for(int i=(int)b;i<(int)e;i++)
#define rep0(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
#define shosu setprecision(10)
typedef long long ll;
typedef pair<int,pair<int,pair<int,int>>> P;

ll longinf=1ll<<60;
int inf=1<<29;

string s,t;
int main(){
    cin>>s>>t;
    bool ok=false;
    int siz=s.size();
    rep0(i,siz){
        bool ok1=true;
        rep0(j,siz){
            if(s[(i+j)%siz]==t[j]) continue;
            else{
                ok1=false;
                break;
            }
        }
            if(ok1){
                ok=true;
                break;
            }
        }
        if(ok) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws IOException {
		Scanner sn = new Scanner(System.in);
		String S = sn.next();
		String T = sn.next();
		
		char[] s = S.toCharArray();
		char[] t = T.toCharArray();
		
		int cnt = 0;
		for (int i = 0; i < s.length; i++) {
			if (s[i] == t[i]) {
				cnt++;
			}
		}
		
		System.out.println(cnt);
	}
	
}


Measured memory_bytes: 21844
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <cassert>
#include <string.h>
#include <unordered_set>
#include <unordered_map>

using namespace std;

typedef long long int64;
typedef unsigned long long uint64;
#define two(X) (1<<(X))
#define twoL(X) (((int64)(1))<<(X))
#define contain(S,X) (((S)&two(X))!=0)
#define containL(S,X) (((S)&twoL(X))!=0)
const double pi=acos(-1.0);
const double eps=1e-11;
template<class T> inline void ckmin(T &a,T b){if(b<a) a=b;}
template<class T> inline void ckmax(T &a,T b){if(b>a) a=b;}
template<class T> inline T sqr(T x){return x*x;}
typedef pair<int,int> ipair;
#define SIZE(A) ((int)A.size())
#define LENGTH(A) ((int)A.length())
#define MP(A,B) make_pair(A,B)
#define PB(X) push_back(X)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,a) for(int i=0;i<(a);++i)
#define ALL(A) A.begin(),A.end()

bool solve(int c[3])
{
	int g[3];
	REP(i,3) g[i]=c[i];
	int m=c[0]+c[1]+c[2];
	REP(s,3)
	{
		REP(i,3) c[i]=g[i];
		if (c[s]==0) continue;
		--c[s];
		int last=s;
		bool ok=true;
		REP(step,m-1)
		{
			int next=2-last;
			for (;next<3 && c[next]==0;++next);
			if (next>=3) { ok=false; break; }
			last=next;
			--c[last];
		}
		if (ok) return true;
	}
	return false;
}
int main()
{
#ifdef _MSC_VER
	freopen("input.txt","r",stdin);
#endif
	std::ios::sync_with_stdio(false);
	int c[3];
	memset(c,0,sizeof(c));
	int n;
	cin>>n;
	REP(i,n)
	{
		int p;
		cin>>p;
		if (p%4==0) ++c[2];
		else if (p%2==0) ++c[1];
		else ++c[0];
	}
	if (solve(c))
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  Int N, M;
  cin>>N>>M;

  vector<Int> A(N);
  for(Int i=0;i<M;i++){
    Int c, d;
    cin>>c>>d; c--, d--;
    if(c > d) continue;
    for(Int j=c;j<d;j++) A[j] = 1;
  }

  Int ans = 1;
  for(Int i=0;i<N;i++){
    if(A[i]) ans += 3;
    else ans += 1;
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 3204
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,m;
    cin>>n>>m;
    if(n>m)
    {
        for(ll i=0;i<n;++i)
            cout<<m;
    }
    else
    {
        for(ll i=0;i<m;++i)
            cout<<n;
    }
    cout<<endl;
    return 0;
}


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


int main(){
    ll N, A, B, D = 0, I = 0;
    cin >> N >> A >> B;
    string S;
    cin >> S;
    for(int i = 0; i < N; i++){

        if(S[i] == 'a' && D + I  + 1 <= A + B){
            cout << "Yes" << endl;
            D++;
        }else if(S[i] == 'b' && D + I + 1 <= A + B && I + 1 <= B){
            cout << "Yes" << endl;
            I++;
        }else{
            cout << "No" << endl;
        }

    }
}

Measured memory_bytes: 896
#if defined(__GNUC__)
#include <bits/stdc++.h>
#define __int32 __int32_t
// __GNUC__
#else
#include "bits/stdc++.h"
#endif
using namespace std;

#define int long long

#define itn __int32
#define REP(i, n) for(itn (i) = 0; (i) < (n); ++(i))
#define REP2(i, x, n) for(itn (i) = x; (i) < (n); ++(i))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define SORT(x) std::sort(ALL(x))
#define RSORT(x) std::sort(ALL(x), greater<decltype(x)::value_type>())
#define RSORT2(x, T) std::sort(ALL(x), greater<T>())
#define REVERCE(x) std::reverce(ALL(x))
#define ACM(x, y) std::accumulate(ALL(x), y)

#define INT_POW(x, y) [](int a, int b) -> int {int c = a; REP(i, b - 1){c *= a;} return c;}(x, y)
#define INT_POWM(x, y, m) [](int a, int b, int m) -> int {int c = a; REP(i, b - 1){c *= a; c %= m;} return c;}(x, y, m)
#define FCT(x) [](int a) -> int {int r = 1; REP(i, a){r *= i;} return r;}(x)

itn main() {
	std::ios::sync_with_stdio(false);

	itn a, b;

	cin >> a >> b;

	itn res = 0;

	REP2(i, a, b + 1) {
		if (i / 10000 == i % 10 && (i / 1000) % 10 == (i / 10) % 10) {
			++res;
		}
	}

	cout << res;

	return 0;
}


Measured memory_bytes: 256
n,m = map(int, input().split() )
c = []


for i in range(1,int(m**0.5)+1) :

   if m%i==0 :
      c.append(i)
      c.append(m//i)

c.sort()
c.reverse()

for j in range(len(c)) :

   if c[j] <= m//n :
      print(c[j])
      break

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <sstream>
#include <algorithm>
#include <math.h>
#include<string>
#include<vector>
using namespace std;
using ll = long long;
int main(){
    ll n;
    ll m;
    ll b;
    cin >> n >> m;
    ll ans = n;
    for (int i =0 ; i < m; i ++)    {
        cin >> b;
        ans -= b;
    }
    if(ans >= 0)    cout << ans << endl;
    else
    {
        cout << -1 << endl;
    }
    
}

Measured memory_bytes: 3192
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int[] A = new int[N];
        long sum = 0L;
        boolean flag = true;
        for (int i=0;i<N;i++) {
            A[i] = Integer.parseInt(sc.next());
            sum += A[i];
        }

        if (sum%((long)N*(N+1)/2)!=0) flag=false;

        long val = sum/((long)N*(N+1)/2);
        for (int i=0;i<N-1;i++) {
            long tmp = val-(A[i+1]-A[i]);
            if (tmp<0 || tmp%N!=0) flag=false;
        }
        long tmp_last = val-(A[0]-A[N-1]);
        if (tmp_last<0 || tmp_last%N!=0) flag=false;

        if (flag) System.out.println("YES");
        else System.out.println("NO");
    }
}

Measured memory_bytes: 49972
/*
/ ATcoder /
ID : lalit kumar
TASK : A
LANG : c++14
*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
  cin>>n;
  int ans = -1;
  int pos;
  for(int i =1;i<=n;i++)
  {
      int m = 0;
      int j = i;
   while(j%2==0)
   {
    m++;
    j/=2;
   }
  if(m>ans)
  {
    ans = m;
    pos=i;
  }
 }
 cout<<pos<<endl;
}

Measured memory_bytes: 3640
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
int N;

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

  cin >> N;
  rep(i,9) {
    if (N%(i+1) ==0) {
      if (0<N/(i+1)&& N/(i+1)<10) {
        cout << "Yes" << "\n";
        return 0;
      }
    }
  }

  cout << "No" << "\n";
  return 0;
}

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

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

	int len = sizeof(a) / sizeof(int);
	sort(a, a+len);

	cout << a[n-1] - a[0] << endl;
	
	return 0;
}

Measured memory_bytes: 256
A,B,C=map(int,input().split())

maxi=max(A,B,C)
mini=min(A,B,C)
midi=(A+B+C)-maxi-mini
s = (maxi-midi)+(maxi-mini)

if s%2==0:
  print(s//2)
else:
  print(s//2+2)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long int L, R;
    int res=2018;
    scanf("%lld%lld", &L, &R);
    //printf("%lld %lld\n", L, R);
    if((L-1)/2019!=R/2019)
    {
        printf("0\n");
        return 0;
    }
    L=L%2019;
    R=R%2019;
    //printf("%d %d\n", L, R);
    for(int i=L; i<=R; i++)
    {
        for(int j=L; j<=R; j++)
        {
            if(i<j)
                res=min(res, (i*j)%2019);
        }
    }
    printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

		for(int i=0;i<k;i++) {
			if(a>=b) {
				b=b*2;
				continue;
			}
			else if(b>=c) {
				c=c*2;
			}
		}
		if(a<b && b<c) {System.out.println("Yes");}
		else{System.out.println("No");}

	}

}

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

int main(){
  int64_t n;
  cin >> n;
  vector<int64_t> t(n),a(n);
  for(int i = 0; i < n; i++){
    cin >> t.at(i) >> a.at(i);
  }

  int64_t ansa = a.at(0) , anst = t.at(0);
  for(int i = 1; i < n; i++){
    ansa = max((ansa-1)/a.at(i)+1,(anst-1)/t.at(i)+1)*a.at(i);
    anst = max((ansa-1)/a.at(i)+1,(anst-1)/t.at(i)+1)*t.at(i);    
  }
  cout << ansa+anst << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}

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

  ll N ; cin >> N;

  ll M = 0;
  ll A = 0;
  ll R = 0;
  ll C = 0;
  ll H = 0;
  
  rep(i,N){
    string inp; cin >> inp;
    if(inp[0]=='M') M++;
    if(inp[0]=='A') A++;
    if(inp[0]=='R') R++;
    if(inp[0]=='C') C++;
    if(inp[0]=='H') H++;
  }

  cout << M*A*R+M*A*C+M*A*H + M*R*C+M*R*H + M*C*H + A*R*C+A*R*H + A*C*H + R*C*H<< endl;
  
  //cout << fixed << setprecision(16) << ans << endl;
  return 0;
}


Measured memory_bytes: 256