akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
    #include<cstdio>
    #include<math.h>
    #include<string>
    #include<algorithm>
    #include<functional>
    #include<vector>
    #include<set>
    #include<map>
    #include<queue>
    #define INF 999999
    #define EPS 1.0e-6
     
    using namespace std;
     
    typedef long long ll;
    typedef pair<int, int> P;
    typedef pair<P,int> PP;
     
    int n, c;
    vector<P> v[105000];
    vector<P> vv;
    priority_queue<int, vector<int>, greater<int>> q;
     
    int main()
    {
     
    	cin >> n >> c;
    	int si, ti, ci;
    	for (int i = 0; i < n; i++) {
    		cin >> si >> ti >> ci;
    		ci--;
    		v[ci].push_back(P(si, ti));
    	}
    	for (int i = 0; i < c; i++) {
    		if (!v[i].empty()) {
    			sort(v[i].begin(), v[i].end());
    			int s = v[i][0].first, t = v[i][0].second;
    			int ope = 0;
    			for (int j = 1; j < v[i].size(); j++) {
    				int curs = v[i][j].first;
    				int curt = v[i][j].second;
    				if (t == curs) {
    					t = curt; ope = 0;
    				}
    				else {
    					vv.push_back(P(s, t));
    					s = curs; t = curt;
    					ope = 1;
    				}
    			}
    			if (ope == 0)vv.push_back(P(s, t));
    		}
    	}
    	//cout << (int)vv.size() << endl;
     
    	sort(vv.begin(), vv.end());
    	q.push(vv[0].second);
    	for (int i = 1; i < vv.size(); i++) {
    		int si = vv[i].first;	
    		int tc = q.top();
    		if (si > tc) {
    			q.pop();
    			q.push(vv[i].second);
    		}
    		else {
    			q.push(vv[i].second);
    		}
    	}
    	cout << (int)q.size() << endl;
     
     
    	return 0;
    }

Measured memory_bytes: 4984
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>

using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)
#define Yes(condition) if(condition){ cout << "Yes" << '\n'; }else{ cout << "No" << '\n'; }
#define YES(condition) if(condition){ cout << "YES" << '\n'; }else{ cout << "NO" << '\n'; }
#define yes(condition) if(condition){ cout << "yes" << '\n'; }else{ cout << "no" << '\n'; }





int main() {
    ll h, w, n;
    cin >> h >> w >> n;
    vector<pair<ll, ll>> v(n);
    REP(i, n){
        ll x, y;
        cin >> y >> x;
        v[i] = {x, y};
    }
    
    sort(v.begin(), v.end());
    
    ll ans = h;
    ll l = 1, u = 1;
    REP(i, n){
        if(v[i].first > l){
            u += v[i].first - l;
            l = v[i].first;
        }
        if(v[i].second > u){
            ans = min(ans, v[i].second - 1);
        }
        else if(v[i].second == u){
            u++;
        }
        // cerr << i << ": " << ans << ' ' << l << ' ' << u << ' ' << v[i].first << ' ' << v[i].second << endl;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3328
using System;
using System.Collections.Generic;
using System.Linq;

namespace Kanazawa
{
    public static class Kaga
    {
        public static void Main()
        {
            var n = Cint();
            var h = CintA();
            
            var lowest = 0;
            var count = 0;
            var counts = new List<int>();
            
            Loop(n, i =>
            {
                if (h[i] <= lowest)
                {
                    ++count;
                }
                else
                {
                    counts.Add(count);
                    count = 0;
                }
                
                lowest = h[i];
            });

            counts.Add(count);
            
            Cout(counts.Max());
        }
        
        #region Input and Output

        private static readonly List<string> Buffer = new List<string>();

        private static string Cin()
        {
            ReadBuffer();

            var str = Buffer.First();
            Buffer.RemoveAt(0);

            return str;
        }

        private static IEnumerable<string> CinA() => Console.ReadLine()?.Split();
        private static int Cint() => int.Parse(Cin());
        private static int[] CintA() => CinA().Select(int.Parse).ToArray();
        private static void Cout(object obj) => Console.WriteLine(obj);

        private static void ReadBuffer()
        {
            if (Buffer.Any()) return;

            var line = Console.ReadLine();
            if (line != null && line.Contains(' '))
            {
                Buffer.AddRange(line.Split());
            }
            else
            {
                Buffer.Add(line);
            }
        }

        #endregion
        #region Loops

        private static void Loop(int count, Action<int> action) => Loop(0, count, action);
        private static void Loop(int init, int count, Action<int> action, int step = 1)
        {
            for (var i = init; i < count + init; i += step)
            {
                action(i);
            }
        }

        #endregion
    }
}


Measured memory_bytes: 28508
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); ++i)
#define FOR(i, a, b) for(ll i=(a); i < (ll)(b); ++i)
template<class T> inline bool chmax(T& a, T b) { if(a < b){ a=b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if(a > b){ a=b; return 1; } return 0;}

int main(){
	int n;
	cin >> n;
	vector<string> s(n);
	REP(i,n) cin >> s[i];
	
	int aandb=0,a=0,b=0, ans=0;
	REP(i,n){
		REP(j,s[i].size()-1){
			if(s[i][j]=='A'&&s[i][j+1]=='B') ans++;
		}
		
		if(s[i].front()=='B' && s[i].back()=='A') aandb++;
		else if(s[i].front()=='B') b++;
		else if(s[i].back()=='A') a++;
		
		
	}
	

	
	if(a > 0 && b > 0){
		ans += aandb+1;
		a--;
		b--;
		ans += min(a,b);
	}else if(a > 0 || b > 0){
		ans += aandb;
	}else{
		ans += max(aandb-1,0);
	}
	
	
	cout << ans << endl;
	
	
	return 0;
}

Measured memory_bytes: 3720
#include<iostream>
#include<vector>
#include<set>
#include<algorithm>
#include<string>
#include<bitset>
using namespace std;
int a[50];
int main()
{
	for(int n;cin>>n && n;)
	{
		//memset(a,0,sizeof(a));
		for(int i=0;i<n && cin>>a[i];++i){}
		cout<<a[0];
		for(int j=1;j<n-1;++j)
		{
			if((a[j+1]-a[j])!=1 && (a[j]-a[j-1])==1)cout<<'-'<<a[j];
			else if((a[j+1]-a[j])!=1 && (a[j]-a[j-1])!=1)cout<<' '<<a[j];
			else if((a[j+1]-a[j])==1 && (a[j]-a[j-1])!=1)cout<<' '<<a[j];
		}
		if(n==1)cout<<endl;
		else cout<<(((a[n-1]-a[n-2])==1)?'-':' ')<<a[n-1]<<endl;
	}
}

Measured memory_bytes: 1160
#include "bits/stdc++.h"
#define rep(i,N) for (int (i) = 0; (i) < (N); (i)++)

int main() {

	std::cin.tie(nullptr); std::ios::sync_with_stdio(false);

	int a, b; std::cin >> a >> b;
	if (a * b % 2 == 0)std::cout << "Even";
	else std::cout << "Odd";
		
	return 0;
}

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

long long a, b;
int main(void) {
  cin >> a >> b;
  long long ret = 0;
  if (b - a < 4) {
    for (long long i = a; i <= b; i++) {
      ret ^= i;
    }
  } else {
    long long st = (a + 1) & ~1;
    long long ed = b & ~1;
    if (a < st) {
      ret = a;
    }
    ret ^= ((ed - st) / 2) % 2;
    for (long long i = ed; i <= b; i++) {
      ret ^= i;
    }
  }
  cout << ret << endl;
}


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

typedef long long ll;


int main() {
    string s,t;
    int c=0;
    cin>>s>>t;
    for ( int i=0; i<s.length(); i++ )
        if ( s[i]!=t[i] )
            c++;
    cout<<c;
}

Measured memory_bytes: 3888
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

x = ni()

for a in range(-200,201):
    for b in range(-200,201):
        if a**5-b**5 == x:
            print(a,b)
            exit()

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

using namespace std;

int main(){
    string s;
    cin >> s;
    
    int g_cnt = 0, p_cnt = 0;
    for(int i = 0; i < s.length(); ++i){
        if(s[i] == 'p')     p_cnt++;
    }
    
    cout << (s.length() / 2) - p_cnt << endl;
}

Measured memory_bytes: 512
#include <cstdio>
#include <map>
#include <algorithm>
int n,m,d,q, x,a,b,w;
long long odl[100002],odp,pref[102][100002];
std::map<int, std::pair<int, int> >ma;
int main()
{
	scanf("%d%d%d", &n, &m, &d);
	for(int i=0; i<n; i++)
		for(int j=0; j<m ;j++)
		{
			scanf("%d", &w);
			ma[w]=std::make_pair(i,j);
		}
	for(int i=1; i<=d; i++)
	{
		x=i;
		while(x+d<=m*n)	
		{
			odl[x]=std::abs(ma[x].first-ma[x+d].first)+std::abs(ma[x].second-ma[x+d].second);
			x+=d;
		}
	}
	if(d<100)
	{
			for(int i=1; i<=d; i++)
			{
				x=i+d;
				while(x<=m*n)	
				{
					pref[i%d][x/d]=pref[i%d][x/d-1]+odl[x-d];
					x+=d;
				}
			}
	}
	scanf("%d", &q);
	while(q--)
	{
		odp=0;
		scanf("%d%d", &a, &b);
		if(d<100)
			odp=pref[a%d][b/d]-pref[a%d][a/d];
		else
		{	
			while(a!=b)
			{
				odp+=odl[a];
				a+=d;
			}
		}	
		printf("%lld\n", odp);
	}
}


Measured memory_bytes: 17536
#include<stdio.h>
int main(void)
{
  int a,b,c,d,bus,train;

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

  if(a<b) train=a;
  else train=b;

  if(c<d) bus=c;
  else bus=d;

  printf("%d",train + bus);

}


Measured memory_bytes: 128
#include<stdio.h>

int GDC(int x, int y){
    while(x>0 && y>0){
        if(x>y){
            x=x%y;
        }else{
            y=y%x;
        }
    }
    if(x==0){
        return y;
    }else{
        return x;
    }
}

int main(){
    int i, j, k;
    int N, A[110000];
    int L[110000];
    int R[110000];
    int tmp, max=0;

    scanf("%d", &N);

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

    L[0] = 0;
    R[N] = 0;

    for(i=0; i<N; i++){
        L[i+1] = GDC(L[i],A[i]);
    }
    for(i=N-1; i>=0; i--){
        R[i] = GDC(R[i+1],A[i]);
    }

    for(i=0; i<N; i++){
        tmp = GDC(L[i], R[i+1]);
        if(max<tmp){
            max=tmp;
        }
    }
    printf("%d", max);

    return 0;
}

Measured memory_bytes: 1408
import sys
sys.setrecursionlimit(10000000)
# input = sys.stdin.readline
from bisect import *
from collections import *
from heapq import *
# import functools
# import itertools
# import math
INF = 500000
mod = 10**9+7

N = int(input())
dic = defaultdict(lambda : 0)
for i in range(1, 10):
    for j in range(1, 10):
        if i == j:
            if i <= N:
                dic[(i, j)] = 1
        for k in range(1, 6):
            l = 10**k
            x = i*l + j
            if N < x:
                break
            if x + l-10 <= N:
                dic[(i, j)] += l//10
            else:
                n = N%10
                if n < j:
                    dic[(i, j)] += N%l//10
                else:
                    dic[(i, j)] += N%l//10+1
ans = 0
for i in range(1, 10):
    for j in range(1, 10):
        ans += dic[(i, j)] * dic[(j, i)]
print(ans)


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

int main()
{
	int k;
	cin >> k;
	string s;
	cin >> s;
	
	if(s.length() <= k)
	{
		cout << s << endl;
		return 0;
	}
	
	if (s.length() >= k)
	{
		for (int i = 0; i < s.length(); i++)
		{
			if (i <= k-1)
			{
				cout << s[i];
			}
		}
		cout << "..." << endl;
		return 0;
	}
	
	return 0;
}


Measured memory_bytes: 3628
class UnionFind:
    def __init__(self, N):
        self.parent = [i for i in range(N)]
        self.rank = [0] * N

    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            return self.parent[x]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.parent[x] = y
        else:
            self.parent[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1


N, M = map(int, input().split())
P = list(map(lambda x: int(x) - 1, input().split()))
UF = UnionFind(N)
for _ in range(M):
    x, y = map(lambda x: int(x) - 1, input().split())
    UF.union(x, y)
ans = 0
for i in range(N):
    if UF.find(P[i]) == UF.find(i):
        ans += 1
print(ans)

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

//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("O3", "Ofast", "unroll-loops", "fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


#define int long long
#define endl '\n'

using namespace std;

signed main(){
    //ios_base::sync_with_stdio(false);
    //cin.tie(0);
    int k, a, b; cin >> k >> a >> b;
    bool f = false;
    for (int i = a; i <= b; i++){
        if (i % k == 0){
            f = true;
            cout << "OK" << endl;
            break;
        }
    }
    if (!f){
        cout << "NG" << endl;
    }

    return 0;
}

Measured memory_bytes: 3640
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
 
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <iterator>
#include <functional>
#include <limits>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <stack>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
typedef int64_t ll;
 
#define endl '\n'
#define int ll
ll mod=1e9+7;
ll mod1=1e9+5;
ll power(ll a,ll b)
{
    if(b==0) return 1;
    else if(b%2==0)
        return power((((a%mod)*(a%mod))%mod),b/2)%mod;
    else return ((a%mod)*(power((((a%mod)*(a%mod))%mod),b/2)%mod))%mod;
}
ll dp[200001][13];
 
int32_t main()
{
    IOS
    
        
        string s;
        cin>>s;
        memset(dp,0,sizeof(dp));
        int n=s.length();
        for(int i=1;i<=n;++i)
        {
            if(i==1)
            {
                if(s[i-1]=='?')
                {
                    for(int j=0;j<=9;++j)
                        dp[i][j]=1;
                }
                else
                {
                    dp[i][s[i-1]-'1'+1]=1;
                }
                continue;
            }
            if(s[i-1]=='?')
            {
                
                for(int j=0;j<13;++j)
                {
                    for(int k=0;k<=9;++k)
                    {
                        int rem=(j*10+k)%13;
                        dp[i][rem]=(dp[i][rem]%mod+dp[i-1][j]%mod)%mod;

                    }
                }
            }
            else
            {
                int x=s[i-1]-'1'+1;
                for(int j=0;j<13;++j)
                    {
                        int rem=(j*10+x)%13;
                        dp[i][rem]=(dp[i][rem]%mod+dp[i-1][j]%mod)%mod;
                    }
            }
        }
        
        cout<<(dp[n][5])%mod;

 
}

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

class Program
{
    public Program() { }


    Scanner cin;

    long[] All;
    long[] Pate;

    void myon()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        string S = cin.next();
        string T = cin.next();

        int start = Math.Max(0, S.Length - T.Length);

        int Ans = S.Length + T.Length;
        for (int i = start; i < S.Length; i++)
        {
            bool flag = true;

            for (int j = i; j < S.Length; j++)
            {
                if(S[j] != T[j - i])
                {
                    flag = false;
                    break;
                }
            }

            if (flag) Ans = Math.Min(Ans, i + T.Length);
        }

        Console.WriteLine(Ans);
    }

    static void Main(string[] args)
    {
        new Program().myon();
    }
}


class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        i = 0;
        return next();
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

}


Measured memory_bytes: 11092
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll MOD=1e9+7;
const int INF=1<<30;

const int mod=1000000007;
struct mint{
  ll x;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const{return mint(-x);}
  mint& operator+=(const mint a){
    if((x+=a.x)>=mod) x-=mod;
    return *this;
  }
  mint& operator-=(const mint a){
    if((x+=mod-a.x)>=mod) x-=mod;
    return *this;
  }
  mint& operator*=(const mint a){
    (x*=a.x)%=mod;
    return *this;
  }
  mint operator+(const mint a) const{
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const{
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const{
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const{
    if(!t) return 1;
    mint a=pow(t>>1);
    a*=a;
    if(t&1) a*=*this;
    return a;
  }

  // for prime mod
  mint inv() const{
    return pow(mod-2);
  }
  mint& operator/=(const mint a){
    return (*this)*=a.inv();
  }
  mint operator/(const mint a) const{
    mint res(*this);
    return res/=a;
  }
};

struct Eratosthenes{
  int n;
  vector<int> f,primes;
  Eratosthenes(int n=1):n(n),f(n+1){
    f[0]=f[1]=-1;
    for(ll i=2;i<=n;++i){
      if(f[i]) continue;
      primes.push_back(i);
      f[i]=i;
      for(ll j=i*i;j<=n;j+=i){
        if(!f[j]) f[j]=i;
      }
    }
  }
  bool isPrime(int x){return f[x]==x;}
  vector<int> factorList(int x){
    vector<int> res;
    while (x!=1){
      res.push_back(f[x]);
      x/=f[x];
    }
    return res;
  }
  vector<i_i> factor(int x){
    if(x<=0) return {};
    vector<int> fl=factorList(x);
    if(fl.size()==0) return {};
    vector<i_i> res(1,i_i(fl[0],0));
    for(int p:fl){
      if(res.back().first==p){
        res.back().second++;
      } else{
        res.emplace_back(p,1);
      }
    }
    return res;
  }
};

int main(){
  int N; cin >> N;
  vector<int> a(N);
  rep(i,N) cin >> a[i];
  Eratosthenes sieve(1e8);
  map<int,int> mp;
  rep(i,N){
    vector<i_i> f=sieve.factor(a[i]);
    for(auto c:f){
      mp[c.first]=max(c.second,mp[c.first]);
    }
  }
  mint lcm=1;
  for(auto c:mp){
    rep(i,c.second){
      lcm*=c.first;
    }
  }
  mint ans=0;
  rep(i,N){
    ans+=lcm/a[i];
  }
  cout << ans.x << endl;
}


Measured memory_bytes: 425448
n,m=map(int,input().split())
d=[0]*m
K=[[] for i in range(n)]
for i in range(m):
  p,y=map(int,input().split())
  K[p-1].append((i,y))
for i in range(n):
  K[i].sort(key=lambda x: x[1])
  c=1
  for a,b in K[i]:
    ken=str(i+1)
    t=str(c)
    d[a]=str('0'*(6-len(ken)))+ken+str('0'*(6-len(t)))+t
    c+=1
for i in d:
  print(i)

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

int main()
{
        long long int A,B,K,i;
        cin>>A>>B>>K;
        
        if(A>=1)
        {
                i = K;
                if(A>=K)
                        cout<<A-K<<" "<<B<<endl;
                else if (B>=K-A)
                        cout<<"0 "<<B-(K-A)<<endl;
                else
                        cout<<"0 0"<<endl;
        }
        else if(B>=1)
        {
                if(B>=K)
                        cout<<"0"<<" "<<B-K<<endl;
                else
                        cout<<"0 0"<<endl;
        }
        else
        {
                cout<<"0 0"<<endl;
        }
        return 0;
}

Measured memory_bytes: 256
/*
*/

#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>

#include <memory.h>
#include <assert.h>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds
#define ends asdgahhfdsfshdshfd
#define prev asdgSHJsfgsdfhdsh

#define eps 1e-8
#define M_PI 3.141592653589793
#define bsize 512

#define ldouble long double
using namespace std;

#define bs 998244353

const int N = 120031;

int n,m,a[N],b[N],s[N];
vector<int> g[N];
int used[N][3];
vector<long long> xs;

long long d[N][2];

long long solver(int id){
	// x+d[i][0]=d[i][1]-x;
	// 2x=d[i][1]-d[i][0]
	long long here=d[id][1]-d[id][0];
	if (here%2)
		return -1;
	return here/2;
}

int shit=0;

int get_cost(int clr,int d,int sum){
	return sum-d;
}

void dfs(int v,int clr,int dist){
	used[v][clr]=1;
	d[v][clr]=dist;
	for (int i=0;i<g[v].size();i++){
		int id=g[v][i];
		int othr=a[id]+b[id]-v;
		int cost=get_cost(clr,dist,s[id]);
		if (used[othr][1^clr]==1){
			if(d[othr][1^clr]==cost)
				continue;
			shit=1;
			return;
		}
		used[othr][1^clr]=1;
		d[othr][1^clr]=cost;
		dfs(othr,1^clr,cost);
	}
}

int main(){
//	freopen("apache.in","r",stdin);
//	freopen("apache.out","w",stdout);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
//	cin.tie(0);

	cin>>n>>m;
	for (int i=1;i<=m;i++){
		cin>>a[i]>>b[i]>>s[i];
		g[a[i]].push_back(i);
		g[b[i]].push_back(i);
	}

	for (int i=1;i<=n;i++){
		used[i][0]=used[i][1]=0;
	}

	dfs(1,0,0);

	if (shit){
		cout<<0<<endl;
		return 0;
	}

	for (int i=1;i<=n;i++){
		if (used[i][0]>0&&used[i][1]>0){
			xs.push_back(solver(i));
		}
	}

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

	if (xs.size()>0){
		if (xs[0]==xs.back()&&xs[0]>0){
			int cand=xs[0];
			int ok=1;
			for (int i=1;i<=n;i++){
				int here1=d[i][0]+cand;
				int here2=d[i][1]-cand;
				//cout<<here1<<" "<<here2<<endl;
				if (here1!=here2||here1<=0||here2<=0)
					ok=0;
			}
			cout<<ok<<endl;
		}
		else
		{
			cout<<0<<endl;
		}
	}
	else
	{
		long long xmin=1;
		long long xmax=1e9;
		for (int i=1;i<=n;i++){
		//	cout<<used[i][0]<<" "<<used[i][1]<<" "<<d[i][0]<<" "<<d[i][1]<<endl;
			if (used[i][0]){
				// x+cost
				xmin=max(xmin,1ll-d[i][0]);
			}
			if (used[i][1]){
				// cost-x
				xmax=min(xmax,d[i][1]-1ll);
			}
		}
		long long ans=xmax-xmin+1;
		ans=max(ans,0ll);
//		cout<<xmin<<" "<<xmax<<endl;
		cout<<ans<<endl;
	}

//	cin.get(); cin.get();
	return 0;
}


Measured memory_bytes: 16760
def run(A, B, C, X, Y):
    '''
    以下のうち一番安い金額を出力する
    - A, Bピザ両方単独で買う
    - ABピザで少ない方全部まで買い、残りは単独で買う
    - ABピザで全部買う
    '''
    max_XY = max(X, Y)
    min_XY = min(X, Y)
    diff = max_XY - min_XY
    if X > Y:
        D = A
    else:
        D = B
    ret = A*X + B*Y
    ret = min(ret, min_XY*C*2 + diff*D)
    ret = min(ret, max_XY*C*2)
    return ret


def main():
    A, B, C, X, Y = map(int, input().split())
    print(run(A, B, C, X, Y))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a, b, c, d;
bool solve(__int128 a, __int128 b, __int128 c, __int128 d) {
    __int128 gcd = __gcd(b, d);
    __int128 res = ((c-a)/gcd+1)*gcd;
    return res < b-a;
}
int main() {
	int t; scanf("%d", &t);
	while (t--) {
        scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
        if (a<b || a%b > c || c+d < b || b > d)puts("No");
        else if (c >= b) puts("Yes");
        else if (solve(a%b, b, c, d%b)) puts("No");
        else puts("Yes");
	}
}


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


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

    int N;
    map<map<char, int>, int64_t> mapS;
    cin >> N;
    for (int i = 0; i < N; i++) {
        string s;
        map<char, int> S;
        cin >> s;
        for (int j = 0; j < 10; j++) {
            if (!S[s[j]]) S[s[j]] = 1;
            else
                S[s[j]]++;
        }
        if (!mapS[S]) mapS[S] = 1;
        else
            mapS[S]++;
    }
    int64_t cnt = 0;
    for (auto x: mapS) {
        cnt += x.second * (x.second - 1) / 2;
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 49152
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<bitset>
#include<set>
#define N (200010)
#define P ()
#define M ()
#define inf (0x7f7f7f7f)
#define rg register int
#define Label puts("NAIVE")
#define spa print(' ')
#define ent print('\n')
#define rand() (((rand())<<(15))^(rand()))
#define file(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
typedef long double ld;
typedef long long LL;
typedef unsigned long long ull;
using namespace std;
namespace fastIO1{
	inline char read(){
		static const int IN_LEN=1000000;
		static char buf[IN_LEN],*s,*t;
		return (s==t?t=(s=buf)+fread(buf,1,IN_LEN,stdin),(s==t?-1:*s++):*s++);
	}
	template<class T>
	inline void read(T &x){
		static bool iosig;
		static char c;
		for(iosig=false,c=read();!isdigit(c);c=read()){
			if(c=='-')iosig=true;
			if(c==-1)return;
		}
		for(x=0;isdigit(c);c=read())x=((x+(x<<2))<<1)+(c^'0');
		if(iosig)x=-x;
	}
	inline char readc(char &c){
		for(c=read();!isalpha(c)&&!isdigit(c);c=read())
		if(c==-1)return 0;
	}
	const int OUT_LEN = 10000000;
	char obuf[OUT_LEN],*ooh=obuf;
	inline void print(char c){
		if(ooh==obuf+OUT_LEN)fwrite(obuf,1,OUT_LEN,stdout),ooh=obuf;
		*ooh++=c;
	}
	template<class T>
	inline void print(T x){
		static int buf[30],cnt;
		if(x==0)print('0');
		else{
			if(x<0)print('-'),x=-x;
			for(cnt=0;x;x/=10)buf[++cnt]=x%10+48;
			while(cnt)print((char)buf[cnt--]);
		}
	}
	inline void flush(){fwrite(obuf,1,ooh-obuf,stdout);}
}
namespace fastIO2{
	template<class T>
	inline void read(T &x){
		static bool iosig;
		static char c;
		for(iosig=false,c=getchar();!isdigit(c);c=getchar()){
			if(c=='-')iosig=true;
			if(c==-1)return;
		}
		for(x=0;isdigit(c);c=getchar())x=((x+(x<<2))<<1)+(c^'0');
		if(iosig)x=-x;
	}
}
using namespace fastIO1;
int H,W,n; vector<int> a[N];
int main(){
	read(H),read(W),read(n);
	for(int i=1;i<=n;i++){
		int x,y; read(x),read(y);
		a[y].push_back(x);
	}
	for(int i=1;i<=W;i++)a[i].push_back(H+1);
	for(int i=1;i<=W;i++)sort(a[i].begin(),a[i].end());
//	for(int i=1;i<=W;i++){
//		printf("%d:",i);
//		for(int j=0;j<a[i].size();j++)
//		cout<<a[i][j]<<" "; puts("");
//	}
	int ans=a[1][0]-1,t=1;
	for(int i=2,j;i<=W;i++){
		bool fl=0; t++; if(t>H)break;
//		cout<<i<<" "<<t<<endl;
		for(j=0;j<a[i].size();j++){
			if(a[i][j]<t)continue;
			if(a[i][j]==t)fl=1; break;
		}
		if(fl){
//			puts("type1");
			for(int k=j+1;k<a[i].size();k++)
			if(a[i][k]!=a[i][k-1]+1){
				t=a[i][k-1]+1;ans=min(ans,a[i][k]-1);
				break;
			}
//			cout<<t<<endl;
		}
		else ans=min(ans,a[i][j]-1);
	}
	printf("%d\n",ans);
}

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

int main() {
    //
    int num;
    string str;
    int cnt = 0;

    cin >> num >> str;

    int l = 0;
    int r = num - 1;

    while (true) {
        while (l < num && str.at(l) != 'W') l++;
        while (r >= 0 && str.at(r) != 'R') r--;

        if (l > r) break;

        l++;
        r--;
        cnt++;
    }

    cout << cnt;
    //
}


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

typedef long long ll;
typedef long double ld;

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

    ll r;
    cin >> r;
    cout << 2*r*acos(-1);
    return 0;
}


Measured memory_bytes: 3772
n = int(input())
A = list(map(int, input().split()))

_a = []
for i in range(len(A)):
  _a.append([i+1, A[i]])
srt_a = sorted(_a, key=lambda x:x[1])

ans = []
for aa in srt_a:
  ans.append(aa[0])
print(*ans)

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

int main() {
	int a[100], n, j, v;

	cin >> n;

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

		cout << a[i];
		if (i == n - 1) cout << endl;
		else cout << " ";
	}

	

	for (int i = 1; i < n; i++) {
		j = i - 1;
		v = a[i];

		while (j >= 0 && a[j] > v) {
			a[j + 1] = a[j];

			a[j] = v;

			j--;
		}


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

			if (i == n - 1) cout << endl;
			else cout << " ";
		}
	}

	return 0;
}

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

  int n,ans,i,ika;
  
  scanf("%d",&n);
  while(n != 0){
    
    ika = n;
    i = 2;
    if(n == 1)ans = 0;
    else ans = 1;
    
    while(ika > i){
      
      if(n%i == 0){
	ans += i;
	if(i*i != n) ans += n/i;
	ika = n/i;
      }
      
      i++;
    }
    
    if(ans == n) printf("perfect number\n");
    else if(ans < n) printf("deficient number\n");
    else if(ans > n) printf("abundant number\n");
    scanf("%d",&n);
  }
  
  return (0);
}
 

Measured memory_bytes: 3056
import java.util.ArrayList;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;

class MyComparator implements Comparator<Object>{
	
	public int compare (Object obj1,Object obj2) {
		
		int num1 = (int)obj1;
        int num2 = (int)obj2;
		
		if(num1 < num2) {
            return 1;
        } else if(num1 > num2) {
            return -1;
        } else{
            return 0;
        }
	}

}

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		ArrayList<Queue<Integer>> L = new ArrayList<>();
		
		int n = sc.nextInt();
		
			//Queue <Integer> pq = ;
		
			for(int i=0;i<n;i++) {
				L.add(new PriorityQueue<Integer>(new MyComparator()));
			}
		
		int q = sc.nextInt();
		
		for(int i=0;i<q;i++) {
			
			int d = sc.nextInt();
			int t = 0;
			
			switch (d){
			
				case 0:
					t = sc.nextInt();
					int x = sc.nextInt();
				
					L.get(t).add(x);
				
					break;
				
				case 1:
					t = sc.nextInt();
					if(! L.get(t).isEmpty())
						System.out.println(L.get(t).peek());
				
					break;
				
				case 2:
					t = sc.nextInt();
					if(! L.get(t).isEmpty())
						L.get(t).poll();
				
					break;
			}
		}
	}

}


Measured memory_bytes: 169052
#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef vector< pii > vii;

#define ll          long long
#define ff          first
#define ss          second
#define pb          push_back
#define mkp         make_pair
#define sz          size()

#define forf(a,b,c)    for(int i=a;i<=b;i+=c)
#define forr(a,b,c)    for(int i=a;i>=b;i-=c)
#define all(a)      a.begin(),a.end()
#define mem(a,b)    memset(a,b,sizeof(a))
#define pi          2*acos(0.0)
#define End         return 0;

#define scan1(a)    scanf("%d",&a)
#define scan2(a,b)  scanf("%d %d",&a,&b)
#define scan3(a,b,c)  scanf("%d %d %d",&a,&b,&c)
#define scanl(a)    scanf("%lld",&a)
#define scanll(a,b) scanf("%lld %lld",&a,&b)
#define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)

#define print1(a)    printf("%d",a)
#define print2(a,b)  printf("%d %d",a,b)
#define print3(a,b,c)  printf("%d %d %d",a,b,c)
#define printl(a)    printf("%lld",a)
#define printll(a,b) printf("%lld %lld",a,b)
#define printlll(a,b,c) printf("%lld %lld %lld",a,b,c)

#define MAXN        100000007
#define INF 0x3f3f3f3f
//int dx[]={+1,-1,+0,+0};///Four Directions
//int dy[]={+0,+0,+1,-1};///Four directions
//int dx [] = {+1,-1,+0,+0,-1,-1,+1,+1};///Eight Directions
//int dy [] = {+0,+0,+1,-1,+1,-1,-1,+1};///Eight Directions

//int mark[10007];vi prime;void seive(){for(int i=2;i<10000;i++){if(mark[i]==0){prime.pb(i);for(int j=i+i;j<=10000;j+=i)mark[j]=1;}}}

//freopen("input.txt", "r", stdin);
int r[4003],g[4003],b[4003];
int mark[30];
int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
   int n;
   cin>>n;
   string s;
   cin>>s;
   ll res=0,RR=0,GG=0,BB=0;
   for(int i=0;i<n;i++){

    if(s[i]=='R') RR++;
    else if(s[i]=='G') GG++;
    else BB++;

    r[i]=RR; g[i]=GG; b[i]=BB;
   }

//   for(int i=0;i<n;i++){
//    cout<<"For: "<<i<<endl;
//    cout<<"r= "<<r[i]<<", g= "<<g[i]<<" b= "<<b[i]<<endl;
//   }

   for(int i=0;i<n;i++){
        mem(mark,0);
        mark[s[i]-'A']=1;
        for(int j=i+1;j<n;j++){

           if(mark[s[j]-'A']==0){
            mark[s[j]-'A']=1;

            if(mark['R'-'A']==0){
                res+=(r[n-1]-r[j]);
                int tem=j+(j-i);
                if(tem<n&&s[tem]=='R')res--;
            }
            else if(mark['G'-'A']==0){
                res+=(g[n-1]-g[j]);
                int tem=j+(j-i);
                if(tem<n&&s[tem]=='G')res--;
            }

            else{
                res+=(b[n-1]-b[j]);
                int tem=j+(j-i);
                if(tem<n&&s[tem]=='B')res--;
            }
            mark[s[j]-'A']=0;
           }

        }

    }

   cout<<res<<endl;
   End;
}


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

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

#define rep(i,n) for (ll i = 0; i < (n); i++)
#define ru(a,b) (((a)+((b)-1)) / (b))   //切り上げ(a/b)
#define dump(x)  cout << #x << " = " << (x) << endl;

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

	vector<int> a(n);	//	家の北端からの距離（１周以内）
	rep(i, n) {
		int aa;
		cin >> aa;
		a[i] = aa % k;
	}

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

	vector<int> diff(n);	//	家の間隔（a[i]とa[i-1]の間）
	rep(i, n) {
		if (i == 0) 
			diff[i] = a[0] + (k - a[n - 1]);
		else
			diff[i] = a[i] - a[i - 1];
	}

	size_t idx = distance(diff.begin(), max_element(diff.begin(), diff.end()));

	cout << k - diff[idx] << endl;

	return 0;
}

Measured memory_bytes: 1920
N = int(input())

def facrapid(N):
	i=2
	ans=dict()
	div_sum=1
	n=N
	while i*i <=N:
		while n%i==0:
			n=n//i
			if i in ans:
				ans[i]+=1
			else:
				ans[i]=1
		i+=1
	if n!=1:
		ans[n]=1
	
	ans_list=list(ans.items())
	for j in ans_list:
		div_sum*=j[1]+1
	
	return(div_sum)



ans_d={10000: 93643, 20000: 201147, 30000: 313875, 40000: 430027, 50000: 548695, 60000: 669362, 70000: 791730, 80000: 915508, 90000: 1040555, 100000: 1166714, 110000: 1293885, 120000: 1421926, 130000: 1550852, 140000: 1680518, 150000: 1810893, 160000: 1941957, 170000: 2073616, 180000: 2205896, 190000: 2338713, 200000: 2472071, 210000: 2605908, 220000: 2740255, 230000: 2875035, 240000: 3010225, 250000: 3145923, 260000: 3281913, 270000: 3418335, 280000: 3555125, 290000: 3692288, 300000: 3829761, 310000: 3967572, 320000: 4105737, 330000: 4244174, 340000: 4382931, 350000: 4522005, 360000: 4661355, 370000: 4800992, 380000: 4940862, 390000: 5081020, 400000: 5221424, 410000: 5362088, 420000: 5502988, 430000: 5644109, 440000: 5785515, 450000: 5927120, 460000: 6068940, 470000: 6210971, 480000: 6353214, 490000: 6495739, 500000: 6638407, 510000: 6781192, 520000: 6924283, 530000: 7067586, 540000: 7210986, 550000: 7354651, 560000: 7498424, 570000: 7642414, 580000: 7786609, 590000: 7930954, 600000: 8075420, 610000: 8220149, 620000: 8364937, 630000: 8509899, 640000: 8655135, 650000: 8800424, 660000: 8945854, 670000: 9091540, 680000: 9237258, 690000: 9383192, 700000: 9529244, 710000: 9675454, 720000: 9821778, 730000: 9968274, 740000: 10114912, 750000: 10261678, 760000: 10408551, 770000: 10555535, 780000: 10702703, 790000: 10849984, 800000: 10997400, 810000: 11144971, 820000: 11292593, 830000: 11440361, 840000: 11588236, 850000: 11736253, 860000: 11884387, 870000: 12032640, 880000: 12181018, 890000: 12329497, 900000: 12478098, 910000: 12626745, 920000: 12775605, 930000: 12924462, 940000: 13073527, 950000: 13222660, 960000: 13371907, 970000: 13521236, 980000: 13670735, 990000: 13820210, 1000000: 13969985}

n=N//10000

if n>0:
	for i in range(n*10000,n*10000+10000):
		ans_d[i+1]=ans_d[i]+facrapid(i)
	print(ans_d[N])
else:
	ans_d[2]=1
	for i in range(3,10000):
		ans_d[i]=ans_d[i-1]+facrapid(i-1)
	print(ans_d[N])



# 2darray [[0] * 4 for i in range(3)]
# import itertools

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

#define debug(...) fprintf(stderr, __VA_ARGS__)

#ifndef AT_HOME
#define getchar() IO::myGetchar()
#define putchar(x) IO::myPutchar(x)
#endif

namespace IO {
	static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;

	inline char myGetchar() {
		static char buf[IN_BUF], *ps = buf, *pt = buf;
		if (ps == pt) {
			ps = buf, pt = buf + fread(buf, 1, IN_BUF, stdin);
		}
		return ps == pt ? EOF : *ps++;
	}

	template<typename T>
	inline bool read(T &x) {
		bool op = 0;
		char ch = getchar();
		x = 0;
		for (; !isdigit(ch) && ch != EOF; ch = getchar()) {
			op ^= (ch == '-');
		}
		if (ch == EOF) {
			return false;
		}
		for (; isdigit(ch); ch = getchar()) {
			x = x * 10 + (ch ^ '0');
		}
		if (op) {
			x = -x;
		}
		return true;
	}

	inline int readStr(char *s) {
		int n = 0;
		char ch = getchar();
		for (; isspace(ch) && ch != EOF; ch = getchar())
			;
		for (; !isspace(ch) && ch != EOF; ch = getchar()) {
			s[n++] = ch;
		}
		s[n] = '\0';
		return n;
	}

	inline void myPutchar(char x) {
		static char pbuf[OUT_BUF], *pp = pbuf;
		struct _flusher {
			~_flusher() {
				fwrite(pbuf, 1, pp - pbuf, stdout);
			}
		};
		static _flusher outputFlusher;
		if (pp == pbuf + OUT_BUF) {
			fwrite(pbuf, 1, OUT_BUF, stdout);
			pp = pbuf;
		}
		*pp++ = x;
	}

	template<typename T>
	inline void print_(T x) {
		if (x == 0) {
			putchar('0');
			return;
		}
		static int num[40];
		if (x < 0) {
			putchar('-');
			x = -x;
		}
		for (*num = 0; x; x /= 10) {
			num[++*num] = x % 10;
		}
		while (*num){
			putchar(num[*num] ^ '0');
			--*num;
		}
	}

	template<typename T>
	inline void print(T x, char ch = '\n') {
		print_(x);
		putchar(ch);
	}

	inline void printStr_(const char *s, int n = -1) {
		if (n == -1) {
			n = strlen(s);
		}
		for (int i = 0; i < n; ++i) {
			putchar(s[i]);
		}
	}

	inline void printStr(const char *s, int n = -1, char ch = '\n') {
		printStr_(s, n);
		putchar(ch);
	}
}
using namespace IO;

const int N = 1005, P = 1000000007;

int n, m, a[N], inv[N], C[N][N], f[N];

int main() {
	read(n), read(m);
	for (int i = 1; i <= m; ++i) {
		read(a[i]);
	}
	inv[1] = 1;
	for (int i = 2; i <= n; ++i) {
		inv[i] = 1ll * (P - P / i) * inv[P % i] % P;
	}
	inv[0] = 1;
	for (int i = 1; i <= n; ++i) {
		inv[i] = 1ll * inv[i] * inv[i - 1] % P;
	}
	for (int i = 0; i <= n; ++i) {
		C[i][0] = C[i][i] = 1;
		for (int j = 1; j < i; ++j) {
			C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % P;
		}
	}
	f[0] = 1;
	for (int i = 1; i <= m; ++i) {
		for (int j = n; j >= 0; --j) {
			int sum = 0;
			for (int k = 0; k <= a[i] && k <= j; ++k) {
				sum = (sum + 1ll * f[j - k] * C[n - k][a[i] - k] % P * inv[k]) % P;
			}
			f[j] = sum;
		}
	}
	int ans = f[n];
	for (int i = 1; i <= n; ++i) {
		ans = 1ll * ans * i % P;
	}
	print(ans);
}


Measured memory_bytes: 7596
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	ll a,b,n,x;
	cin >> a >> b >> n;
	if(n>=b) x=b-1;
	else if(n<b) x=n;
	cout << floor((a*x)/b)-a*floor(x/b) << endl;
	return 0;
}


Measured memory_bytes: 3756
W, H, x, y, r = gets.split.map(&:to_i)
X, Y = [0, 1]
top = [x, y + r]
bottom = [x, y - r]
left = [x - r, y]
right = [x + r, y]
if top[Y] >= 0 && top[Y] <= H && bottom[Y] >= 0 && bottom[Y] <= H && left[X] >= 0 && left[X] <= W && right[X] >= 0 && right[X] <= W then
    puts "Yes"
else
    puts "No"
end



Measured memory_bytes: 6872
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rep3(var, min, max) for (ll (var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll (var) = (max) - 1; (var) + 1 > (min); --(var))
#define Mp(a,b) make_pair((a),(b))
#define F first
#define S second
#define CIN(s) int (s);cin>>(s);
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll MOD = 1e9 + 7;
ll INF =1e18;

int main(){
    int a,b;
    cin>>a>>b;
    if(a>=10||b>=10){
        cout<<-1<<endl;
        return 0;
    }
    cout<<a*b<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define endl  "\n"
#define ll long long
#define int long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cin.exceptions(cin.failbit);cout.tie(NULL);
using namespace std;
bool isPrime(int n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;
    for (int i = 5; i * i <= n; i += 6)
    {
        if ((n % i == 0) || (n % (i + 2) == 0))
            return false;
    }
    return true;
}
int n,w;
int a[105],b[105];
int dp[105][100006];
int f(int i,int sum)
{
	if(i==n)
	return 0;
	
	if(dp[i][sum]!=-1)
	return dp[i][sum];
	
	int inc=0,exc=0;
	if(a[i]+sum <= w)
	inc+=b[i]+f(i+1,sum+a[i]);
	
	exc+=f(i+1,sum);
	
	return dp[i][sum]=max(inc,exc);
	
}


int32_t main()
{
	int t=1;
	while(t--)
	{
		memset(dp,-1,sizeof(dp));
		cin >> n >> w;
		for(int i=0;i<n;i++)
		cin >> a[i] >> b[i];
		
		cout << f(0,0);
	}
}




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

int n, m, a, b, w;
vector<int> e[100001];
int p[100001];
bool f = 0;
queue<int> Q;

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

	for (int i = 0; i < m; i++) {
		cin >> a >> b;

		e[a].push_back(b);
		e[b].push_back(a);
	}

	fill(p, p + n + 1, 0);
	Q.push(1);

	while (!Q.empty()) {
		w = Q.front();
		Q.pop();

		for (int i : e[w]) {
			if (p[i] == 0) {
				p[i] = w;
				Q.push(i);
			}
		}
	}

	for (int i = 2; i <= n; i++) {
		if (p[i] == 0) {
			f = 1;
			break;
		}
	}

	if (f)
		cout << "No" << endl;
	else {
		cout << "Yes" << endl;

		for (int i = 2; i <= n; i++)
			cout << p[i] << endl;
	}
}


Measured memory_bytes: 10388
using System;

class Program
{
	static void Main(string[] args)
    {
      string S = Console.ReadLine();
      string T = Console.ReadLine();
      
      int count = 0;
      for(int i = 0; i < 3; i++)
      {
        if (S[i] == T[i])
        {
          count = count + 1;
        }
      }
      Console.WriteLine(count);
    }
}

Measured memory_bytes: 11092
// AGC016A - Shrinking
package main

import "fmt"

func loweralpha() string {
	p := make([]byte, 26)
	for i := range p {
		p[i] = 'a' + byte(i)
	}
	return string(p)
}

func maxInt(a, b int) int {
	if a < b {
		return b
	}
	return a
}
func minInt(a, b int) int {
	if a > b {
		return b
	}
	return a
}
func main() {
	var s string
	fmt.Scan(&s)
	runeS := []rune(s)
	alphabet := []rune(loweralpha())
	ans := 100
	for _, chara := range alphabet {
		temp := 0
		leftMax := 0
		var ri int
		for i, c := range runeS {
			if c == chara {
				leftMax = maxInt(leftMax, temp)
				ri = i
				temp = 0
			} else {
				temp++
			}
		}
		rightMax := len(s) - ri - 1
		ans = minInt(maxInt(rightMax, leftMax), ans)
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a,b) ((a<b)?a:b)
#define _max(a,b) ((a<b)?b:a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a)?1:-1)
#define SORT(v) sort(v.begin(),v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380


int main()
{
	cout << fixed << setprecision(10);

	vector<int> v(5);
	int ans = 0;
	REP(i, 5)
	{
		cin >> v[i];
		if (v[i] == 0)ans = i + 1;
	}
	cout << ans;

	return 0;
}

Measured memory_bytes: 3588
import static java.util.Arrays.*;

import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

	static void tr(Object... os) {
		System.err.println(deepToString(os));
	}

	void solve() {
		int n = sc.nextInt();
		int m = sc.nextInt();
		if (n == 0 && m == 0) return;

		int r = n * m;
		while (r > n) {
			r = ((r - n) * m - 1) / (m - 1);
		}
		System.out.println(r);
	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	Scanner sc = null;
	PrintWriter out = null;
	public void run() throws Exception {
		sc = new Scanner(System.in);
		out = new PrintWriter(System.out);
		for (;sc.hasNext();) {
			solve();
			out.flush();
		}
		out.close();
	}

}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define contains(v, t) (find(v.begin(), v.end(), t) != v.end())
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;

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

const long long INF = 1LL << 60;

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

  vector<ll> h(400001), dp(400001);
  rep(i, n) {
    cin >> h[i];
    dp[i] = INF;
  }
  dp[0] = 0;

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

  cout << dp[n - 1];
}

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

int main() {
  int n,k;
  string s;
  cin >> n >> s >> k;
  --k;
  for ( int i=0; i<n; i++ ) {
    if ( s[i]!=s[k] ) s[i]='*';
  }
  cout << s << '\n';
  return 0;
}

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

#include "bits/stdc++.h"

using namespace std;
#define int long long
#define FOR(i, a, b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i, n)  FOR(i,0,(n))
typedef vector<int> vec;


class ATaskSchedulingProblem {
public:
    void solve(std::istream &in, std::ostream &out) {
      vector<int> a(3);
      REP(i, 3) in >> a[i];

      vec b;
      REP(i, 2) FOR(j, i + 1, 3) {
          b.push_back(abs(a[i] - a[j]));
        }
      sort(b.begin(), b.end());
      out << b[0] + b[1] << endl;
    }
};


signed main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout << fixed;
  ATaskSchedulingProblem solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
ll const MOD = 1e9+7;
ll const INF = 1e18;
using namespace std;

int main(){
    set<int> st;
    REP(i, 3){
        int a;
        cin >> a;
        st.insert(a);
    }
    cout << st.size() << endl;
    return 0;
}

Measured memory_bytes: 256