akhauriyash/Code-Regression huggingface dataset:
/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >>n;
    vector<int> arr(n);
    for(int i = 0; i < n; i++)
        cin >>arr[i];
    sort(arr.begin(), arr.end());
    cout <<arr[n/2] - arr[n/2 - 1];
    return 0;
}


Measured memory_bytes: 640
import math
def py():
    print("Yes")
def pn():
    print("No")
def iin():
    x = int(input())
    return x

neko = 0
nya = 0
nuko = 0
n = iin()
a = [1,2,4,8,16,32,64,128]
for i in range(7):
    if n >= a[i]:
        if n < a[i + 1]:
            print(a[i])
            break

Measured memory_bytes: 3064
import java.io.*;
import java.util.*;

/******************************\
 * The solution is at the top *
 *                            *
 *   Created by : azhar556    *
\******************************/

public class Main {
	static long Gcd (long c, long d) {
		return c == 0 ? d : Gcd(d % c , c);
	}
	static long Lcm (long c, long d) {
		return c * d / Gcd(c, d);
	}
    static void solve() {
		long A = nl();
		long B = nl();
		long C = nl();
		long D = nl();
		long LcmCD = Lcm(C, D);
		long tot = B - A + 1;
		
		long divC = A / C;
		if (A % C != 0) divC++;
		if (B - (C * divC) >= 0) tot -= (B - (C * divC)) / C + 1;
		err.println(tot);
		
		long divD = A / D;
		if (A % D != 0) divD++;
		if (B - (D * divD) >= 0) tot -= (B - (D * divD)) / D + 1;
		err.println(tot + " " + LcmCD);
		
		long divCD = A / LcmCD;
		if (A % LcmCD != 0) divCD++;
		if (B - (LcmCD * divCD) >= 0) tot += (B - (LcmCD * divCD)) / LcmCD + 1;
		out.println(tot);
    }    

    public static void main(String[] args) {
        long time = System.currentTimeMillis();
        int t;// = ni();
        t = 1;
        while (t-- > 0) solve(); 
        err.println("Time elapsed : " + (System.currentTimeMillis() - time) / 1000F + " s.");
        err.close(); out.close();
    }

	static int[] radixSort(int[] f){ return radixSort(f, f.length); }
	static int[] radixSort(int[] f, int n)
	{
		int[] to = new int[n];
		{
			int[] b = new int[65537];
			for(int i = 0;i < n;i++)b[1+(f[i]&0xffff)]++;
			for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
			for(int i = 0;i < n;i++)to[b[f[i]&0xffff]++] = f[i];
			int[] d = f; f = to;to = d;
		}
		{
			int[] b = new int[65537];
			for(int i = 0;i < n;i++)b[1+(f[i]>>>16)]++;
			for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
			for(int i = 0;i < n;i++)to[b[f[i]>>>16]++] = f[i];
			int[] d = f; f = to;to = d;
		}
		return f;
	}

    static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    static PrintWriter err = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.err)));
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer token;
    
    static boolean hasMoreTokens () {
        String sample = null;
		try {
			sample = br.readLine();
		}
		catch (IOException e) {
			e.printStackTrace();
		}
		return sample == null ? false : true;
    }

    static String ns() {
        while (token == null || !token.hasMoreTokens()) {
            try {
                token = new StringTokenizer(br.readLine());
            }
            catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return token.nextToken();
    }
    static char nc() {
        return Character.valueOf(ns().charAt(0));
    }
    static int ni() {
        return Integer.parseInt(ns());
    }
    static double nd() {
        return Double.parseDouble(ns());
    }
    static long nl() {
        return Long.parseLong(ns());
    }
}
// Collections Arrays Math
// Vector HashSet TreeSet HashMap TreeMap ArrayDeque 

Measured memory_bytes: 21332
#include<stdio.h>
#include <stdlib.h>
#define N 100000
 

typedef struct{
  int p;
  int k;
  int *child;
}Node;
 
int depth(Node*,int,int);
 
int main(){
  int num,i,j,k,number;
  Node node[N]; 
   
  scanf("%d",&num);
 
  for(i=0; i<num; i++) node[i].p = -1;
   
  for(i=0; i<num; i++){
    scanf("%d",&number);
    scanf("%d",&node[number].k);
    node[number].child = (int *)malloc(sizeof(int) * node[number].k);
    for(j=0; j<node[number].k; j++){
      scanf("%d",&node[number].child[j]);
      node[node[number].child[j]].p = number;
    }
  }
   
   
  for(i=0; i<num; i++){
    printf("node %d: parent = %d, ",i,node[i].p);
    printf("depth = %d, ",depth(node,i,0));
     
    if(node[i].p==-1) printf("root, [");
    else if(node[i].k==0) printf("leaf, [");
    else printf("internal node, [");
     
    for(j=0; j<node[i].k; j++){
      printf("%d",node[i].child[j]);
      if(j+1<node[i].k) printf(", ");
    }
    printf("]\n");
  }

  return 0;
}
 
 
int depth(Node *node,int num,int count){
  if(node[num].p==-1)return count;
  count++;
  count = depth(node,node[num].p,count);
 
  return count;
}

Measured memory_bytes: 5688
#include<iostream>
#include <algorithm>
#include <string>
#include<math.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
int main() {
    string s;
    cin >> s;
    int ans = 0;
    if (s[0] == '2') {
        ans++;
    }
    if (s[1] == '2') {
        ans++;
    }
    if (s[2] == '2') {
        ans++;
    }
    if (s[3] == '2') {
        ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import math

n = int(input())

if math.floor(math.floor(n/1.08)*1.08) == n:
    print(math.floor(n/1.08))
elif math.floor((math.floor(n/1.08)+1) *1.08) == n:
    print(math.floor(n/1.08)+1)
else:
    print(':(')


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
int main(void){
    string s;cin>>s;
    int tmp=0,res=0;
    rep(i,s.size()){
        if(s[i]=='S')tmp++;
        else{
            if(tmp>0){
                tmp--;
                res+=2;
            }
        }
    }
    res=s.size()-res;
    cout<<res<<endl;
}

Measured memory_bytes: 3700
#include<stdio.h>
         
int main(void){
    int N, X;
    int D = 0;
    int j = 1;
    if(scanf("%d %d" ,&N, &X) < 1){
        fprintf(stderr, "error: ill-formed fraction.\n");
    }
    int L[N];
    for(int i=0; i<N; i++){
        if(scanf("%d",&L[i]) < 1){
            fprintf(stderr, "error: ill-formed fraction.\n");
        }else{
            D += L[i];
            if(D <= X){
                j++;
            }
        }
    }
    printf("%d\n",j);
    return 0;
}

Measured memory_bytes: 128
N = input()
S = input()
st1 = []
st2 = []
tmp = ''
for x in S:
    if x == '(':
        st1.append(S)
    elif x == ')':
        if len(st1) > 0:
            st1.pop()
        else:
            tmp = '(' + tmp
    tmp += x
ans = tmp
for x in tmp[::-1]:
    if x == ')':
        st2.append(S)
    elif x == '(':
        if len(st2) > 0:
            st2.pop()
        else:
            ans += ')'
print(ans)

Measured memory_bytes: 3064
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#define test ll t; cin>>t; while(t--)
#define FOR(p,n) for(ll i=p;i<(ll)n;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
using namespace std;
signed main()
{
	string x,y;
	cin>>x>>y;
	int n=x.length(),m=y.length();
	int dp[n+1][m+1];
	for(int i=0;i<=n;i++)
		dp[i][0]=0;
	for(int j=0;j<=m;j++)
		dp[0][j]=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			if(x[i-1]==y[j-1])
				dp[i][j]=1+dp[i-1][j-1];
			else
				dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
		}
	}
	string ans;
	int i=x.length(),j=y.length();
	while(i>0 && j>0)
	{
		if(x[i-1]==y[j-1])
		{
			ans+=x[i-1];
			i--,j--;
		}
		else if(dp[i-1][j]>dp[i][j-1])
			i-=1;
		else
			j-=1;
	}
	reverse(ans.begin(),ans.end());
	cout<<ans<<endl;
}












Measured memory_bytes: 70656
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)x.size())
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
typedef long long LL;
typedef pair<int,int> pa;
typedef vector<int> vec;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
const int dx[]={-1,0,0,1};
const int dy[]={0,-1,1,0};
pa q[1000010];
char s[1010],a[1010][1010];
int n,m,ans,d[1010][1010];
void bfs(){
	int he=0,ta=0;
	FOR(i,1,n)
		FOR(j,1,m)
			if (a[i][j]=='#') d[i][j]=0,q[++ta]=mp(i,j); else d[i][j]=-1;
	while (he!=ta){
		pa x=q[++he];
		FOR(D,0,3){
			pa y=mp(x.fi+dx[D],x.se+dy[D]);
			if (y.fi<1 || y.fi>n || y.se<1 || y.se>m) continue;
			if (d[y.fi][y.se]!=-1) continue;
			q[++ta]=y;
			d[y.fi][y.se]=d[x.fi][x.se]+1;
			ans=max(ans,d[y.fi][y.se]);
		}
	}
}
int main(){
	cin>>n>>m;
	FOR(i,1,n){
		scanf("%s",s+1);
		FOR(j,1,m) a[i][j]=s[j];
	}
	bfs();
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 13056
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int maxn =5e5+10;
const int mod=1e9+7;
ll fac[maxn];
ll inv[maxn];

ll power(ll base,ll n)
{
    ll r=1;
    while(n)
    {
        if(n%2) r=r*base%mod;
        base=base*base%mod;
        n/=2;
    }
    return r;
}


void init()
{
    fac[0]=1;
    for(int i=1;i<maxn;i++)
    {
        fac[i]=fac[i-1]*i%mod;
    }
    inv[maxn-1]=power(fac[maxn-1],mod-2);
    for(int i=maxn-2;i>=0;i--)
    {
        inv[i]=inv[i+1]*(i+1)%mod;
    }

}

ll C(ll m,ll n)
{
    return fac[n]*inv[m]%mod*inv[n-m]%mod;
}
ll A(ll m,ll n)
{
    return fac[n]*inv[n-m]%mod;
}






int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m;
    init();
    //cout<<C(2,5)<<'\n';
    cin>>n>>m;
    ll sum=0;
    for(int i=1;i<=n;i++)
    {
        ll temp=C(i,n)*A(n-i,m-i)%mod;
        if(i%2==0)
            temp=-temp;
        sum+=temp;
        sum%=mod;
    }
    ll ans=A(n,m)*(A(n,m)-sum)%mod;
    ans=(ans+mod)%mod;
    cout<<ans<<'\n';



}


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

#define N 400
#define mod 1000000007
#define INF 2000000000

vector<pair<int, int>> adj[N];
int ans[N][N];

struct state{
	int used, fuel, pos;
};

struct compare { 
	bool operator()(state const& a, state const& b) 
	{ 
		return (a.used > b.used ||
				(a.used == b.used && a.fuel < b.fuel)); 
	} 
}; 

void shortestPath(int src, int l, int n) 
{ 
    priority_queue< state, vector<state>, compare> pq;
    state curr, next;
    curr.used = 0;
    curr.fuel = l;
    curr.pos = src;
    pair<int, int> vis[N];
    pq.push(curr); 
    for(int i = 1 ; i <= n ; i++)
	    vis[i] = make_pair(INF, 0); 


    vis[src] = make_pair(0, l); 

    while (!pq.empty()) 
    {
        curr = pq.top(); 
        pq.pop(); 
        for (auto v : adj[curr.pos]) 
        {
        	next.pos = v.first;
        	if(v.second > l) continue;
        	if(curr.fuel - v.second < 0){
        		next.used = curr.used+1;
        		next.fuel = l-v.second;
        	} else {
        		next.used = curr.used;
        		next.fuel = curr.fuel-v.second;
        	}
            if (vis[next.pos].first > next.used || 
               (vis[next.pos].first == next.used && vis[next.pos].second < next.fuel )) 
            {
            	vis[next.pos].first = next.used;
            	vis[next.pos].second = next.fuel;
                pq.push(next); 
            } 
        } 
    } 

    for (int i = 1; i <= n; ++i) {
    	if(vis[i].first != INF) ans[src][i] = vis[i].first; 
    	else ans[src][i] = -1;
    }
} 

int main(){
    ios::sync_with_stdio(false);
	cin.tie(0);
    if(fopen("input.in", "r")){
        freopen("input.in", "r", stdin);
        freopen("output.out", "w", stdout);
    }
    int n, m, l, a, b, w, q;
    cin >> n >> m >> l;
   	for(int i = 0 ; i < m ; i++){
   		cin >> a >> b >> w;
   		adj[a].push_back(make_pair(b, w));
   		adj[b].push_back(make_pair(a, w));
   	}

   	for(int i = 1; i <= n ; i++)
   		shortestPath(i, l, n);

   	cin >> q;
   	for(int i = 0 ; i < q ; i++){
   		cin >> a >> b;
   		cout << ans[a][b] << endl;
   	}
    return 0;
}

Measured memory_bytes: 2176
n  = int(input())
a = []
for i in range(n):
    x,y = list(map(int,input().split()))
    a.append([x,y])
#print(a)
b = []
for i in range(n):
    for j in range(n-i-1):
        xi,yi = a[i]
        xj,yj = a[j+i+1]
 #       print(xi,yi,yi,yj)
        z = ((xi-xj)**2+(yi-yj)**2)**0.5
        b.append(z)
#print(b)
print(sum(b)/len(b)*(n-1))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define INF (1LL<<31)-1
typedef long long int ll;

ll gcd(ll a, ll b) {
  return b != 0 ? gcd(b, a % b) : a;
}
typedef struct ST{ 
	vector<ll> a;
	int n;
	void init(vector<ll> &b){
		int size= b.size();
		n=1;
		while(n<size) n*=2;
		ll vv;//
		if(b.size()==1) vv = b[0];//
		else vv = b[0]*b[1];//
		a =vector<ll> (2*n-1,vv);
		for(int i=0;i<size;i++)	a[i+n-1] = b[i];
		for(int i=n-2;i>=0;i--) a[i] = gcd(a[i*2+1],a[i*2+2]); //RMQ
	}
	void update(int k,ll val){
		k+=n-1;
		a[k] = val;
		while(k>0){
			k = (k-1)/2;
			a[k] = gcd(a[k*2+1],a[k*2+2]);//RMQ
		}
	}
	// [aa,b)の最小値
	// kは節点番号l,rはその節点が[l,r)に対応
	// get(aa,b,0,0,n)
	ll get(int aa,int b,int k,int l,int r){
		//[aa,b)に完全に[l,r)が含んでいる場合 この節点
		if(aa<=l && r<=b) return a[k];
		
		//[aa,b)と[l,r)が交差しなければ INF
		if(r<=aa || b<=l) return INF;
		ll vl = get(aa,b,k*2+1,l,(l+r)/2);
		ll vr = get(aa,b,k*2+2,(l+r)/2,r);
		return gcd(vl,vr);
	}
	ll find(int aa,int b){
		return get(aa,b,0,0,n);
	}	
}ST;



int main(){
	int n,q;
	cin>>n;
	vector<ll> a(n,INF);
	for(int i=0;i<n;i++)cin>>a[i];
	ST seg;
	seg.init(a);
	ll res = seg.a[0];
	for(int i=0;i<n;i++){
		seg.update(i,a[(i+1)%n]);
		//for(int j=0;j<seg.a.size();j++)cout<<seg.a[j]<<endl;
		//cout<<endl;
		res = max(res,seg.a[0] );
		seg.update(i,a[i]);
	}
	cout<<res<<endl;
	//cout<<seg.n<<endl;
	//for(int i=0;i<seg.a.size();i++)cout<<seg.a[i]<<endl;
	return 0;
}

Measured memory_bytes: 3072
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ProgramingStudying2
{
    class Program
    {
        static void Main(string[] args)
        {
            var nw = Console.ReadLine().Split();
            var n = int.Parse(nw[0]);
            var W = int.Parse(nw[1]);

            var w = new int[n];
            var v = new long[n];

            for(int i = 0; i < n; i++)
            {
                var wv = Console.ReadLine().Split();
                w[i] = int.Parse(wv[0]);
                v[i] = long.Parse(wv[1]);
            }
            const long INF = (long)1e9 + 7;

            //i番目までの荷物から価値j以上となるように取った時の重さの総和の最小値
            var dp = new long[n + 1, 100001];
            for(int i = 0; i <= n; i++)
            {
                for(int j = 0; j <= 100000; j++)
                {
                    dp[i, j] = INF;
                }
            }
            dp[0, 0] = 0;

            for(int i = 1; i <= n;i++)
            {
                for(int j = 0; j <= 100000; j++)
                {
                    if (j - v[i - 1] >= 0)
                    {
                        dp[i, j] = Math.Min(dp[i - 1, j], dp[i - 1, j - v[i - 1]] + w[i - 1]);
                    }
                    else
                    {
                        dp[i, j] = Math.Min(dp[i - 1, j], w[i - 1]); 
                    }
                }
            }

            var ans = 100000;
            while(dp[n,ans] > W)
            {
                ans--;
            }
            Console.WriteLine(ans);
        }
    }
}


    


Measured memory_bytes: 106364
#include <bits/stdc++.h>
#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++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1LL << 60
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const long long MOD=1000000007;

// vector<p> cut(M); vector<vector<ll> > v(4);
// cut[i].second
// cut[i].first;
// REP(i,M){
//     int a,b;cin>>a>>b;
//     cut[i] = make_pair(b,a);//last first の順番
// }
// for(int i=0; i<N;i++){
// }
// sort(cut.begin(),cut.end()), sort(v.rbegin(), v.rend()); //sort
// char '' str ""
int main(void)
{
    str S;cin>>S; char c;
    int a[30];
    std::memset(a, 0, sizeof a);
    for(int i=0; i<S.size();i++){
      if(a[S[i]-'a']==0) a[S[i]-'a']++;
    }
    for(int i=0; i<26;i++){
      if(a[i]==0){
        c = i+'a';
        cout<<c<<endl; return 0;
      }
    }

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


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

using namespace std;

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;

using _loop_int = int;
#define REP(i,n) for(_loop_int i=0; i<(_loop_int)(n); i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a); i<(_loop_int)(b); i++)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1; i>=(_loop_int)(a); i--)

#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl

const ll MOD = 1000000007ll;

int n;
int p[52];
int q[52];

int main(){
    scanf("%d",&n);
    REP(i,n)scanf("%d",p+i);
    REP(i,n)q[i]=p[i];
    sort(q,q+n);
    int cnt = 0;
    REP(i,n)if(p[i] != q[i]){
        cnt++;
    }
    if(cnt <= 2)
        puts("YES");
        else puts("NO");
    return 0;
}


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

using namespace std;

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

int main(int argc, char *argv[])
{
    int N;
    int W;
    cin >> N;
    cin >> W;
    int vs[N + 1];
    int ws[N + 1];
    for (int i = 0; i < N; i++) {
        cin >> vs[i];
        cin >> ws[i];
    }
    // cout << "N=" << N << endl;
    // cout << "W=" << W << endl;

    int dp[N + 1][W + 1];
    //  0???????´????????????°??????
    for (int j = 0; j < N + 1; j++) {
        dp[j][0] = 0;
    }
    for (int i = 0; i < W + 1; i++) {
        dp[0][i] = 0;
    }

    for (int j = 1; j < N + 1; j++) {
        //  ???????????????????????£
        int v = vs[j - 1];
        int w = ws[j - 1];
        for (int i = 1; i < W + 1; i++) {
            if (i - w >= 0) {
                dp[j][i] = max(dp[j - 1][i], dp[j - 1][i - w] + v);
            }
            else {
                dp[j][i] = dp[j - 1][i];
            }
        }
    }

    // //  for debug
    // for (int j = 0; j < N + 1; j++) {
    //     for (int i = 0; i < W + 1; i++) {
    //         cout << dp[j][i];
    //         cout << ", ";
    //     }
    //     cout << endl;
    // }

    int maxVal = *max_element(&dp[N][0], &dp[N][W + 1]);
    cout << maxVal << endl;
    return 0;
}

Measured memory_bytes: 7020
H, W = map(int, input().split())
HW = [0] * H
for i in range(H):
  HW[i] = str(input())
  
#縦  
T = [[0] * W for i in range(H)]  
for i in range(H):#4000000
  now = 0
  for j in range(W):
    if HW[i][j] == "#":
      T[i][j] = 0
      now = 0
    else:
      now += 1
      T[i][j] = now
      
  now = 0    
  for j in range(1, W + 1):
    if T[i][-j] == 0:
      now = 0
    elif now == 0:
      now = T[i][-j]
    else:
      T[i][-j] = now
    #print(i, now)  
  
#print(T)

#横
Y = [[0] * W for i in range(H)]  
for j in range(W):#4000000
  now = 0
  for i in range(H):
    if HW[i][j] == "#":
      Y[i][j] = 0
      now = 0
    else:
      now += 1
      Y[i][j] = now
      
  now = 0    
  for i in range(1, H + 1):
    if Y[-i][j] == 0:
      now = 0
    elif now == 0:
      now = Y[-i][j]
    else:
      Y[-i][j] = now
    #print(i, now)      
#print(Y)

ans = 0
for i in range(H):
  for j in range(W):
    if T[i][j] != 0 and Y[i][j] != 0:
      ans = max(ans, T[i][j] + Y[i][j] - 1)
      
print(ans)      
    


Measured memory_bytes: 142768
arr=list(map(int,input().split()))
cnt=0
if(arr[0]==arr[1] and arr[1]!=arr[2]):
  print("Yes")
elif(arr[1]==arr[2] and arr[1]!=arr[0]):
  print("Yes")
elif(arr[0]==arr[2] and arr[1]!=arr[0]):
  print("Yes")
else:
  print("No")


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod =(1e9)+7;
using P = pair<ll,ll>;


int main(){
    ll n,x;cin >>n>>x;
    ll ans=1;
    map<ll,int>co;
    for (ll p = 2; p*p <=x ; ++p) {
        while(x%p==0){
            x/=p;
            co[p]++;
        }
    }
    if(x!=1)co[x]++;
    for(auto p:co){
        for (int i = 0; i < p.second / n; ++i) {
            ans*=p.first;
        }
    }
    cout <<ans <<endl;
    return 0;
}

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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<int, int> P;


ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

ll X, Y, A, B, C;
llvec p;
llvec q;
llvec r;

/******************************************
** A main function is start from here  ****
*******************************************/
int main(){
  cin >> X >> Y >> A >> B >> C;
  ll tmp;
  rep(i, A){
    cin >> tmp;
    p.push_back(tmp);
  }
  rep(i, B){
    cin >> tmp;
    q.push_back(tmp);
  }
  rep(i, C){
    cin >> tmp;
    r.push_back(tmp);
  }

  sort(ALL(p), [](ll a, ll b){return a < b;});
  sort(ALL(q), [](ll a, ll b){return a < b;});
  sort(ALL(r), [](ll a, ll b){return a < b;});

  rep(i, C){
    auto ipt = lower_bound(ALL(p), r[C-1-i]);
    auto iqt = lower_bound(ALL(q), r[C-1-i]);
    ll ip = p.end() - ipt;
    ll iq = q.end() - iqt;
    if(ip>=X and iq>=Y){
      break;
    }else if(ip>=X and iq<Y){
      //cout << "insert q" << endl;
      q.insert(iqt,r[C-1-i]);
    }else if(iq>=Y and ip<X){
      //cout << "insert p" << endl;
      p.insert(ipt,r[C-1-i]);
    }else{
      if(p[p.size()-X]>q[q.size()-Y]){
        //cout << "insert q" << endl;
        q.insert(iqt,r[C-1-i]);
      }else{
        //cout << "insert p" << endl;
        p.insert(ipt,r[C-1-i]);
      }
    }
  }

  ll ans =0;

  /*
  rep(i, p.size()){
    cout << p[i] << " ";
  }
  cout << endl;
  rep(i, q.size()){
    cout << q[i] << " ";
  }
  cout << endl;
  */
  A = p.size();
  B = q.size();
  rep(i, X){
    ans += p[A-1-i];
  }
  rep(i, Y){
    ans += q[B-1-i];
  }
  cout << ans;
  
  return 0;
}


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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 2e5 + 5;

void solve(){
	ll x, y;
	cin >> x >> y;
	if (x % y == 0) {
		cout << -1 << endl;
	} else {
		cout << x << endl;
	}
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


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


// ローリングハッシュ
// 二分探索で LCP を求める機能つき
struct RollingHash {
    static const int base1 = 1007, base2 = 2009;
    static const int mod1 = 1000000007, mod2 = 1000000009;
    vector<long long> hash1, hash2, power1, power2;

    // construct
    RollingHash(const string &S) {
        int n = (int)S.size();
        hash1.assign(n+1, 0);
        hash2.assign(n+1, 0);
        power1.assign(n+1, 1);
        power2.assign(n+1, 1);
        for (int i = 0; i < n; ++i) {
            hash1[i+1] = (hash1[i] * base1 + S[i]) % mod1;
            hash2[i+1] = (hash2[i] * base2 + S[i]) % mod2;
            power1[i+1] = (power1[i] * base1) % mod1;
            power2[i+1] = (power2[i] * base2) % mod2;
        }
    }
    
    // get hash of S[left:right]
    inline pair<long long, long long> get(int l, int r) const {
        long long res1 = hash1[r] - hash1[l] * power1[r-l] % mod1;
        if (res1 < 0) res1 += mod1;
        long long res2 = hash2[r] - hash2[l] * power2[r-l] % mod2;
        if (res2 < 0) res2 += mod2;
        return {res1, res2};
    }

    // get lcp of S[a:] and T[b:]
    inline int getLCP(int a, int b) const {
        int len = min((int)hash1.size()-a, (int)hash1.size()-b);
        int low = 0, high = len;
        while (high - low > 1) {
            int mid = (low + high) >> 1;
            if (get(a, a+mid) != get(b, b+mid)) high = mid;
            else low = mid;
        }
        return low;
    }
};


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

    // ロリハ
    RollingHash rh(S);

    // 求める
    int res = 0;
    for (int i = 0; i < N; ++i) {
        for (int j = i+1; j < N; ++j) {
            int lcp = rh.getLCP(i, j);
            lcp = min(lcp, j-i);
            res = max(res, lcp);
        }
    }   
        
    cout << res << endl;
}


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

#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) s >> x;
  return s;
}
inline void Yes(bool f){cout<<(f?"Yes":"No")<<endl;}
inline void YES(bool f){cout<<(f?"YES":"NO")<<endl;}

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //cout<<std::fixed<<std::setprecision(10);

    string fi; cin >> fi;
    string se; cin >> se;
    
    YES(fi[0]==se[2]&&fi[1]==se[1]&&fi[2]==se[0]);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define MP make_pair
#define ull unsigned long long int
#define F first
#define S second
#define put insert
#define pb push_back
#define rsortV(arr) sort(arr.begin(),arr.end(),greater<int>())
#define sortV(arr) sort(arr.begin(),arr.end())
#define sortA(arr,n) sort(arr,arr+n)
#define rsortA(arr,n) sort(arr,arr+n,greater<int>())
#define arrInput(arr,n) for(int i=0;i<n;i++) cin>>arr[i];
#define rev(arr) reverse(arr.begin(), arr.end())
#define all(x) (x).begin(), (x).end()
ll MOD = 1e9+7;
int main() {
    fastio
    // int t;
    // cin>>t;
    // while(t--) {
        int k;
        cin>>k;
        string res = "";
        while(k--)
            res += "ACL";
        cout<<res;
    // }
    return 0;
}


Measured memory_bytes: 3612
n = int(input())
D = list(map(int, input().split()))

if n == 1:
    print(D[0])
    exit()

C = [0]*13
C[0] = 1
for i in range(n):
    C[D[i]] += 1

D = []
E = []
for i in range(13):
    if i != 0:
        if C[i] >= 3:
            print(0)
            exit()
        elif C[i] == 2:
            D.append(i)
            D.append(-i)
        elif C[i] == 1:
            E.append(i)
        else:
            continue
    else:
        if C[i] >= 2:
            print(0)
            exit()
        elif C[i] == 1:
            D.append(i)
        else:
            continue

p = len(D)
q = len(E)
#print(E)
import copy
if q == 0:
    ans = 25
    for i in range(p-1):
        for j in range(i+1, p):
            ans = min(ans, min(abs(D[i]-D[j]), 24-abs(D[i]-D[j])))
    print(ans)
else:
    ans = []
    for i in range(2**q):
        D_ = copy.copy(D)
        for j in range(q):
            if (i >> j)&1:
                D_.append(E[j])
            else:
                D_.append(-E[j])
        p = len(D_)
        temp = 25
        #print(D)
        for i in range(p-1):
            for j in range(i+1, p):
                temp = min(temp, min(abs(D_[i]-D_[j]), 24-abs(D_[i]-D_[j])))
        ans.append(temp)
    print(max(ans))


Measured memory_bytes: 3572
from collections import deque
K = int(input())
S = [i for i in range(1,10)]
S = deque(S)
for i in range(1,K+1):
    Lun = S.popleft()
    Lu = Lun%10
    if Lu !=0:
        S.append(10*Lun+Lu-1)
    S.append(Lun*10+Lu)
    if Lu !=9:
        S.append(10*Lun+Lu+1)
print(Lun)

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

#define REP(i,x,y) for(int i=(x);i<(y);i++)
#define RREP(i,x,y) for(int i=(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
#define int long long

using namespace std;

// conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#else
#define eprintf(...) 42
#define dump(x) 42
#define debug(x) 42
#endif

typedef long long ll;

const ll MOD = 1e9 + 7;

long modPow(long a, long x, long p) {
    //calculates a^x mod p in logarithmic time.
    long res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}

long modInverse(long a, long p) {
    //calculates the modular multiplicative of a mod m.
    //(assuming p is prime).
    return modPow(a, p-2, p);
}
ll combination(long n, long k) {
    ll p = MOD;
// calculates C(n,k) mod p (assuming p is prime).

    long numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (int i=0; i<k; i++) {
        numerator = (numerator * (n-i) ) % p;
    }

    long denominator = 1; // k!
    for (int i=1; i<=k; i++) {
        denominator = (denominator * i) % p;
    }

    // numerator / denominator mod p.
    return ( numerator* modInverse(denominator,p) ) % p;
}

void solve(int N, int K) {

    REP(i,1,K+1) {
        ll answer = 0;
        answer = combination(K-1,i-1) * combination(N-K-1,i) % MOD;
        answer = (answer + ((2 * combination(K-1,i-1)) % MOD) * combination(N-K-1,i-1) % MOD) % MOD;
        if (i-2 >= 0) answer = (answer + (combination(K-1,i-1) * combination(N-K-1,i-2)) % MOD) % MOD;
        cout << answer << '\n';
    }

//	stringstream ss;
//    ss << answer;

    return;
}

signed main() {
    int N, K;
    cin >> N >> K;
    
//    vector<int> A(N);
//    REP(i,0,N) cin >> A[i];
    
    solve(N, K);
    
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <limits.h>
using namespace std;
typedef pair<int, int> P;
typedef long long ll;
#define INF LLONG_MAX/3
#define inf INT_MAX/3
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
int gcd(int a, int b) {
	if (b == 0)return a;
	return gcd(b, a%b);
}
int lcm(int a, int b) {
	return a / gcd(a, b)*b;
}
int modpow(int a, int b) {
	if (b == 0)return 1;
	if (b == 1)return a % MOD;
	if (b % 2)return modpow(a, b - 1)*a%MOD;
	else return modpow(a, b / 2)*modpow(a, b / 2) % MOD;
}
int comb(int a, int b) {
	if (b == 0 || a == b)return 1;
	if (b == 1)return a % MOD;
	return (comb(a - 1, b - 1) + comb(a - 1, b)) % MOD;
}
// Library End !

int h, w, a[514][514];
vector <int> v1;
vector <int> v2;
vector <int> v3;
vector <int> v4;

int main() {
	cin >> h >> w;
	for (int i = 1;i <= h;i++) {
		for (int j = 1;j <= w;j++) {
			cin >> a[i][j];
		}
	}
	for (int i = 1;i <= h;i++) {
		for (int j = 1;j <= w;j++) {
			if (i == h  && j == w)break;
			if (a[i][j] % 2 == 1) {
				if (j != w) {
					a[i][j]--;
					a[i][j + 1]++;
					v1.push_back(i);
					v2.push_back(j);
					v3.push_back(i);
					v4.push_back(j+1);
				}
				else {
					a[i][j]--;
					a[i + 1][j]++;
					v1.push_back(i);
					v2.push_back(j);
					v3.push_back(i+1);
					v4.push_back(j);
				}
			}
		}
	}
	cout << v1.size() << endl;
	for (int i = 0;i < v1.size();i++) {
		cout << v1[i] << " " << v2[i] << " " << v3[i] << " " << v4[i] <<endl;
	}
	return 0;
}

Measured memory_bytes: 5220
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll MAX=500005;
const ll MOD=1000000007;
ll fac[MAX],finv[MAX],inv[MAX];
ll ans;
ll cnt;
void COMinit(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(ll i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(ll i,ll j){
    if(i<j) return 0;
    if(i<0||j<0) return 0;
    return fac[i]*(finv[j]*finv[i-j]%MOD)%MOD;
}
int main(void){
    ll n,m;
    cin>>n>>m;
    COMinit();
    for(int i=0;i<=n;i++){
        cnt=(COM(n,i)*((fac[n-i]*COM(m-i,n-i))%MOD))%MOD;
        if(i%2==0){
            cnt*=1;
        }else{
            cnt*=-1;
        }
        ans=(ans+cnt)%MOD;
    }
    ans=(ans*((fac[n]*COM(m,n))%MOD))%MOD;
    if(ans<0){
        while(ans<0){
            ans+=MOD;
        }
    }
    cout<<ans<<endl;

}



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

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

	string ans = "not coprime";
	int a = __gcd( A[0], A[1] );
	for( int i = 2; i < N; i++ ) {
		a = __gcd( a, A[i] );
	}
	if( a == 1 ) ans = "setwise coprime";
	vector<map<int, int>> mp( N );
	for( int i = 0; i < N; i++ ) {
		int a = A[i];
		for( int j = 2; j * j <= a; j++ ) {
			while( a % j == 0 ) {
				mp[i][j]++;
				a /= j;
			}
		}
		if( a != 1 ) mp[i][a]++;
	}
	int flag = 0;
	set<int> st;
	for( int i = 0; i < N; i++ ) {
		for( auto it = mp[i].begin(); it != mp[i].end();it++ ) {
			if( st.count( it->first ) ) {
				flag = 1;
				break;
			}
			st.insert( it->first );
		}
	}
	if( flag == 0 ) ans = "pairwise coprime";

	cout << ans << endl;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vii;
#define F first
#define S second
#define sz(x) (int)x.size()
#define db(x) cerr << #x << ": " << x << "\n";

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

    double A, B, H, M;
    cin >> A >> B >> H >> M;
    H = H * 30.0 + M / 2;
    M *= 6.0;
    double angle = (H > M ? H-M : M-H);
    angle = angle * M_PI / 180.0;
    cout << fixed << setprecision(20) << sqrt(A*A + B*B - 2*A*B*cos(angle));
}


Measured memory_bytes: 4108
#include <iostream>
#include <string>
#include <stdio.h>
#include <cassert>
#include <vector>
using namespace std;
int main() {
	int A, B, C;
	// string s;
	cin >> A >> B >> C;
	vector<int> vec{ A, B, C };
	// cin >> s;
	vector<int> five;
	vector<int> seven;
 
	for (int i : vec) {
		if (i == 5) {
			five.push_back(1);
		}
		else if (i == 7) {
			seven.push_back(1);
		}
	}
	if (five.size() == 2 && seven.size() == 1) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 3628
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

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

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

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y){
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
// index が条件を満たすかどうか
vector<long long int >meguru;
bool isOK(int index, int key) {
	if (meguru[index] >= key) return true;
	else return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
	int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = (int)meguru.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, key)) right = mid;
		else left = mid;
	}
	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

int main() {
	string s;
	cin >> s;
	int q;
	cin >> q;
	int p = 0;
	string a = "";
	string b = "";
	for (int i = 0; i < q; i++) {
		int t;
		cin >> t;
		if (t == 1) {
			if (p == 0) {
				p = 1;
			}
			else {
				p = 0;
			}
		}
		else {
			int f;
			cin >> f;
			string c;
			cin >> c;
			if (p == 0) {
				if (f == 1) {
					a = a + c;
				}
				else {
					b = b + c;
				}
			}
			else {
				if (f == 1) {
					b = b + c;
				}
				else {
					a = a + c;
				}
			}
		}
/*		cout << s <<" "<<p<<endl;*/
	}
	if (p == 1) {
		reverse(s.begin(), s.end());
		reverse(b.begin(), b.end());
		cout << b << s << a;
	}
	else {
		reverse(a.begin(), a.end());
		cout << a << s << b;
	}
}


Measured memory_bytes: 1456
# @uthor : Kaleab Asfaw
from sys import stdin, stdout
# Fast IO
# from math import gcd

def input():
	a = stdin.readline()
	if a[-1] == "\n": a = a[:-1]
	return a
def print(*argv, end="\n", sep=" "):
	n = len(argv)
	for i in range(n):
		if i == n-1: stdout.write(str(argv[i]))
		else: stdout.write(str(argv[i]) + sep)
	stdout.write(end)
# Others
mod = 10**9+7
def lcm(x, y): return (x * y) / (gcd(x, y))
def fact(x, mod=mod):
	ans = 1
	for i in range(1, x+1): ans = (ans * i) % mod
	return ans
def arr2D(n, m, default=0):
	lst = []
	for i in range(n): temp = [default] * m; lst.append(temp)
	return lst
def sortDictV(x): return {k: v for k, v in sorted(x.items(), key = lambda item : item[1])}

from math import pi
def solve(n):
	return 2 * pi * n

n = int(input())
print(solve(n))

Measured memory_bytes: 62172
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b;
    scanf("%d %d",&a,&b);
    if((a==1 && b>1)){
        printf("Alice");
    }
    else if(b==1 && a>1){
        printf("Bob");
    }
    else if(a>b){
       printf("Alice");
    }
    else if(a==b){
        printf("Draw");
    }
    else{
        printf("Bob");
    }
    return 0;
}


Measured memory_bytes: 128
using System;

class Program
{
	static void Main(string[] args)
	{
		Int64 i, j;

		int x = int.Parse(Console.ReadLine());

		for (i = -128; i <= 128; i++)
		{
			for (j = -128; j <= 128; j++)
			{
				if(i*i*i*i*i - j*j*j*j*j == x)
				{
					Console.WriteLine(i + " " + j);
					return;
				}
			}
		}

		return;
	}
}

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

using namespace std;


#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()

#define int long long

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second

template <typename T>
void print(T x)
{
	std::cout << x <<" " ;
}


template <typename T>
void println(T x)
{
	std::cout << x << "\n";
}

signed main(void) {
	int A, B;
	cin >> A >> B;
	if (A != 1 & B != 1)print(1);
	else if (A != 2 & B != 2)print(2);
	else if (A != 3 & B != 3)print(3);
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int a,b,c,k,m,tmp,sum=0,i;
	scanf("%d %d %d\n",&a,&b,&c);
	scanf("%d",&k);
	if(a>b){
		if(a>c){
			m=a;
		}else{
			m=c;
		}
	}else{
		if(b>c){
			m=b;
		}else{
			m=c;
		}
	}
	tmp=m;
	for(i=0;i<k;i++){
		m=m*2;
	}
	sum=a+b+c+m-tmp;
	printf("%d",sum);
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;
long long dp[310][310][310],h[310];
int main(){
	int i,j,l,n,k;
	cin >> n >> k;
	for(i=1;i<=n;i++){
		cin >> h[i];
	}
	h[0] = 0;
	if(k==n){
		cout << 0 << endl;
		return 0;
	}
	for(i=0;i<=n;i++){
		for(j=0;j<=n;j++){
			for(l=0;l<=n;l++){
				dp[i][j][l] = 1000000000000000;
			}
		}
	}
	dp[0][0][0] = 0;
	for(i=1;i<=n;i++){
		for(j=0;j<=k;j++){
			for(l=0;l<=n;l++){
				dp[i][j + 1][l] = min(dp[i][j + 1][l],dp[i - 1][j][l]);
				if(h[i]<=h[l]){
					dp[i][j][i] = min(dp[i][j][i],dp[i - 1][j][l]);
				}else{
					dp[i][j][i] = min(dp[i][j][i],dp[i - 1][j][l] + h[i] - h[l]);
				}
			}
		}
	}
	long long mn = 100000000000000;
	for(i=0;i<=k;i++){
		for(j=0;j<=n;j++){
			mn = min(mn,dp[n][i][j]);
		}
	}
	cout << mn << endl;
}

Measured memory_bytes: 227584
N, K = map(int,input().split())
R, S, P = map(int,input().split())
T = list(input())
d = {"r":P,"s":R,"p":S}
ans = 0
for i, v in enumerate(T):
    if i < K:
        ans += d[v]
    else:
        if v != T[i-K]:
            ans += d[v[0]]
        else:
            T[i] = v + "a"

print(ans)


Measured memory_bytes: 6712
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("Ofast")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>

using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template <typename T>
// using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// #define sfind(i) (*find_by_order(i))
// #define ord(i) order_of_key(i)
typedef long long ll;
typedef pair<int , int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define mod 1000000007
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define repc(i, a, b, c) for (ll i = a; (c > 0 ? i < b : i > b) and c != 0; i += c)
#define vi vector<int>
#define vl vector<ll>
#define _max(vec) (*max_element(all(vec)))
#define _min(vec) (*min_element(all(vec)))
#define fi first
#define si second
#define pb push_back
#define all(name) name.begin(), name.end()
#define ral(name) name.rbegin(), name.rend()
#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod)
#define mod_in(a) power(a, mod - 2)
#define ncr(n, r) (n>=r?((ft[n]*mod_in((ft[r]*ft[(n)-(r)])%mod))%mod):0LL)
#define deb(x) cerr << "[" << #x << " " << x << "]" << endl;
#define endl '\n'  //....????
#define int ll
vector<ll> ft(1, 1LL);
/*======================================================================*/

void solve() {
    int a, b;
    cin >> a >> b;
    cout << a*b;
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 3648
N,Q=map(int,input().split())
S=input()
l=0
r=0

s=[]
s.append(0)

for i in range(1,N):
    if(S[i-1]=='A' and S[i]=='C'):

        s.append(s[i-1]+1)

    else:
        s.append(s[i-1])

for i in range(Q):

    l,r=map(int,input().split())

    print(s[r-1]-s[l-1])


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

using ll = long long;

int main() {
    string S;
    cin >> S;
    int n = S.size(), c = 0;
    if (n % 2) {
        c = 1;
        rep(i, n / 2) {
            if (S[n / 2 - 1 - i] == S[n / 2] && S[n / 2 + 1 + i] == S[n / 2]) c += 2;
            else break;
        }
    } else {
        c = 0;
        rep(i, n / 2) {
            if (S[n / 2 - 1 - i] == S[n / 2] && S[n / 2 + i] == S[n / 2]) c += 2;
            else break;
        }
    }
    cout << (n + c) / 2 << "\n";
}

Measured memory_bytes: 512
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

a, b = map(int, readline().split())

if a > b:
    ans = str(b) * a
else:
    ans = str(a) * b
print(ans)

Measured memory_bytes: 38256