akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
    using namespace std;
    //#include "testlib.h"
    #define ff first
    #define ss second
    #define all(v) v.begin(),v.end()
    #define int long long
    #define ll long long
    #define M 1000000007
    #define MM 998244353
    #define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
    #define GCD(m,n) __gcd(m,n)
    #define LCM(m,n) m*(n/GCD(m,n))
    #define mii  map<ll ,ll >
    #define msi  map<string,ll >
    #define rep(a,b)    for(ll i=a;i<b;i++)
    #define rep0(n)    for(ll i=0;i<n;i++)
    #define repi(i,a,b) for(ll i=a;i<b;i++)
    #define pb push_back
    #define vi vector<ll>
    #define vs vector<string>
    #define ppb pop_back
    #define endl '\n'
    #define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    #define r0 return 0;
    #define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
    #define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    #define Set(a, s) (a, s, sizeof (a))
    #define FOR repi
    #define vii vector<pii>
    #define pii pair<int,int>
    #define REVERSE(v) reverse(all(v))
    #define trav(a, x) for(auto& a : x)
    #define display(x) trav(a,x) cout<<a<<" ";cout<<endl
    #define debug cerr<<"bhau"<<endl
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        std::cerr << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
    template<typename T, typename U> static inline void amin(T &x, U y) 
    { 
        if (y < x) 
            x = y; 
    }
    template<typename T, typename U> static inline void amax(T &x, U y) 
    { 
        if (x < y) 
            x = y; 
    }
     
    ll max(ll a, ll b) { return (a > b)? a : b;}
    int min(int a, int b) { return (a < b)? a : b;} 


    int solve(){

        int n;cin>>n;
        int a[n];
        int ans=0;
        inputarr(a,n);
        reverse(a,a+n);
        int maxi=a[n-1];
        for(int i=n-2;i>=0;i--){
            maxi=max(a[i],maxi);
            // amax(ans,maxi-a[i]);
            ans+=max(0,maxi-a[i]);
            // trace(a[i],maxi,ans);
        }
        cout<<ans<<endl;


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


Measured memory_bytes: 5176
import collections
N = int(input())
li = [input() for i in range(N)]

li2 = collections.Counter(li)
li3 = li2.most_common()

li4 = []
for i in range(len(li3)):
    if li3[0][1] == li3[i][1]:
        li4.append(li3[i][0])
li4.sort()

for j in range(len(li4)):
    print(li4[j])

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

using namespace std;

int main(void){
int n,q,ans=0;
cin>>n;
vector<int> s(n);
for(int i=0;i<n;i++)cin>> s[i];
cin>>q;
vector<int> t(q);
for(int i=0;i<q;i++)cin>> t[i];
for(int i=0;i<q;i++){
    bool flag=false;
    for(int j=0;j<n;j++){
        if(s[j]==t[i]){++ans;break;}
    }
}
cout<<ans<<endl;
return 0;
}



Measured memory_bytes: 3108
long s,t,a;p;n;
main(f){
	for(gets(&a);~scanf("%d",&a);p*f>0||(s+=1-p*f,p=f),n*f<0||(t+=1+n*f,n=-f),f=-f)p+=a,n+=a;
	printf("%ld",s<t?s:t);
}

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

const int N = 1005, K = 25;
const long long mod = 1000000007ll;

int n, k, a[K];
long long c[N][N], f[N][K];
int main () {
	cin >> n >> k;
	for (int i = 1; i <= k; i++) cin >> a[i];

	for (int i = 0; i <= n; i++) c[i][i] = c[i][0] = 1ll;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j < i; j++) c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % mod;
	}

	for (int i = 1; i <= n; i++) f[i][0] = 0ll;
	f[0][0] = 1ll;

	for (int i = 1; i <= k; i++) {
		for (int j = 0; j <= n; j++) {
			f[j][i] = 0ll;
			for (int j_ = 0; j_ <= min(j, a[i]); j_++) {
				f[j][i] = (f[j][i] + f[j - j_][i - 1] * c[j][j_] % mod * c[n - j_][a[i] - j_]) % mod;
			}
		}
	}
	printf("%lld\n", f[n][k]);
	return 0;
}

Measured memory_bytes: 7680
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1e9+7
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
ll min(ll a,ll b){
  if(a>b){
    return b;
    }
      else{
        return a;
      }
  }
  
  ll max(ll a,ll b){
    if(a>b){
      return a;
    }
    else{
      return b;
    }
  }

ll power(ll a,ll b){
 ll ans=1;
 for(ll i=1;i<=b;i++){
ans*=a;
  }
  return ans;
}

 ll gcd(ll m,ll n){
 	if(n==0){
       return m;
     }
   return gcd(n,m%n);
 }
ll lcm(ll a,ll b){
  ll g=gcd(a,b);
  return a/gcd(a,b)*b;
		

}
int main(){
  
  ll N;
  cin>>N;
  
  vector<ll>v(N);
  
  rep(i,N){
    cin>>v[i];
  }
  
  sort(all(v));
  double max=(v[0]+v[1])*1.0/2;
  
  for(ll i=2;i<N;i++){
    max=(max+v[i])/2;
  }
  
  cout<<max<<endl;
}

  
 
    
    

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
  long long int n,m,h[100005],a[100001],b[100001];
  bool bb[100005];
  cin>>n>>m;
  long long int ans=n;
  for(int i=1;i<n+1;i++){
    cin>>h[i];
    bb[i]=true;
  }
  for(int i=0;i<m;i++){
    cin>>a[i]>>b[i];
    
    if(h[a[i]]==h[b[i]]){
      if(bb[a[i]]==true){bb[a[i]]=false; ans-=1;}
      if(bb[b[i]]==true){bb[b[i]]=false; ans-=1;}
    }
    else if(h[a[i]]>h[b[i]]){
      if(bb[b[i]]==true){bb[b[i]]=false; ans-=1;}
    }
    else if(h[a[i]]<h[b[i]]){
      if(bb[a[i]]==true){bb[a[i]]=false; ans-=1;}
    }
    
  }
  
  cout<<ans<<endl;
  return 0;
  
}

Measured memory_bytes: 6068
#include<iostream>
#include<string>
using namespace std;
int main(){
long i,l,a,b;
string s;
while(cin>>s){
if(s=="0")break;
l=s.size();a=b=0;
for(i=1;i<l;i++)if(s[i]=='A')a++;else b++;
if(a>b)cout<<a+1<<" "<<b<<endl;
else cout<<a<<" "<<b+1<<endl;
}
return 0;
}

Measured memory_bytes: 1184
import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main
{
    public static void process()throws IOException
    {
       int n=ni();
       long div[]=new long[n+1];
       Arrays.fill(div,1l);

       boolean prime[]=new boolean[n+1];

       Arrays.fill(prime,true);

       for(int i=2;i<=n;i++){
            if(!prime[i])
                continue;
            div[i]=2l;

            
            for(int j=2*i;j<=n;j+=i){
                int x=j;
                long cnt=0l;
                while(x%i==0){
                    x/=i;
                    cnt++;
                }
               // if(j==8)System.out.println(".. "+cnt);
                div[j]*=(cnt+1l);
                prime[j]=false;
            }
       }
       
       long res=1l;
       for(int i=2;i<=n;i++){
            if(prime[i]){ div[i]=2l;}
            res+=(i*1l)*div[i];
       }
      //System.out.println(Arrays.toString(div));
        pn(res);
    }
 
 
    static FastReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc=new FastReader();
 
        long s = System.currentTimeMillis();
        int t=1;
        //t=ni();
        while(t-->0)
            process();
 
        out.flush();
        System.err.println(System.currentTimeMillis()-s+"ms");
    }
    
    
    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static int ni()throws IOException{return Integer.parseInt(sc.next());}
    static long nl()throws IOException{return Long.parseLong(sc.next());}
    static double nd()throws IOException{return Double.parseDouble(sc.next());}
    static String nln()throws IOException{return sc.nextLine();}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}
    
    static long mod=(long)1e9+7l;
    
/////////////////////////////////////////////////////////////////////////////////////////////////////////
    static class FastReader{ 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader(){ 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next(){ 
            while (st == null || !st.hasMoreElements()){ 
                try{ st = new StringTokenizer(br.readLine()); } catch (IOException  e){ e.printStackTrace(); } 
            } 
            return st.nextToken(); 
        } 
  
        String nextLine(){ 
            String str = ""; 
            try{ str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } 
            return str; 
        } 
    } 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

Measured memory_bytes: 126056
#include<stdio.h>

main(){

int a,b,c,x,y,z;

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

if(a>b){

x=a;

a=b;

b=x;

}

if(b>c){

y=b;

b=c;

c=y;

}

if(a>b){

z=a;

a=b;

b=z;

}

printf("%d %d %d\n",a,b,c);

return 0;

}

Measured memory_bytes: 596
import java.lang.Math

val MOD: Int = 1000000000 + 7
val MODL: Long = MOD.toLong()

fun main(args: Array<String>)
{
    val (n, m) = readLine()!!.split(" ").map{Math.abs(it.toLong() - 2L)}
    println(n*m)
}


Measured memory_bytes: 37664
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define REVERSE(x) reverse((x).begin(), (x).end())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << '\n'

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-10;

constexpr int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
constexpr int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

template<typename T>
bool chmax(T& a, T b){
    if(a < b){
        a = b;
        return true;
    }
    return false;
}

template<typename T>
bool chmin(T& a, T b){
    if(b < a){
        a = b;
        return true;
    }
    return false;
}

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

    int n;
    cin >> n;

    vector<int> a(n);
    unordered_map<int, lint> mp;

    rep(i, n){
        cin >> a[i];
        ++mp[a[i]];
    }

    lint sum = 0;
    for(auto x : mp){
        sum += x.second * (x.second - 1LL) / 2LL;
    }

    rep(i, n){
        lint ans = sum;
        if(mp[a[i]] > 0LL){
            ans -= (mp[a[i]] * (mp[a[i]] - 1LL) / 2LL) - ((mp[a[i]] - 1LL) * (mp[a[i]] - 2LL) / 2LL);
        }
        cout << ans << '\n';
    }

    cout << flush;

    return 0;
}

Measured memory_bytes: 8392
import sys
x,n=map(int,input().split())
p=list(map(int,input().split()))

if n==0:
    print(x)
else:
    q=[abs(p[i]-x) for i in range(n)]
    re=max(q) #xと最も離れているものはどれだけ離れてるか
    i=0
    if re==0:
        print(x-1)
    else:
        while(i < re+1):
            if x-i not in p:
                print(x-i)
                break
            elif x+i not in p:
                print(x+i)
                break
            i += 1
        if i==re+1:
            print(x-i)

Measured memory_bytes: 62012
#include <algorithm>
#include <cstdio>
using namespace std;

int a[200010], n, m, ans;

int main() {
	scanf("%d %d", &n, &m);
	for (int i = 0; i < n; i++) {
		int x;
		scanf("%d", &x);
		a[x - 1]++;
	}
	sort(a, a + 200001);
	int k = 0, l = 0;
	while (a[k++] == 0);
	for (int i = k - 1; i < 200001; i++) {
		if (a[i]) l++;
	}
	for (int i = k - 1; i < k + l - m - 1; i++) {
		ans += a[i];
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 896
n = int(input())
a1 = list(map(int,input().split()))
b1 = list(map(int,input().split()))
a = []
b = []
for i in (reversed(a1)):
    a.append(i)
for i in (reversed(b1)):
    b.append(i)

answer = 0
for i in range(n):
    if a[i] == b[i]:
        answer += a[i]
    elif a[i] < b[i]:
        answer += a[i]
        if a[i+1]-(b[i]-a[i]) >= 0:
            answer += (b[i]-a[i])
            a[i+1] = a[i+1]-(b[i]-a[i])
        elif a[i+1]-(b[i]-a[i]) < 0:
            answer += a[i+1]
            a[i+1] = 0
    elif a[i] > b[i]:
        answer += b[i]
        
print(answer)

Measured memory_bytes: 18752
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  vector<pair<long long, long long>> v;
  for (long long x = -300; x <= 300; x++) {
    v.emplace_back(x, x * x * x * x * x);
  }
  long long x;
  cin >> x;
  for (auto& p : v) for (auto& q : v) {
    if (p.second - q.second == x) {
      cout << p.first << " " << q.first << endl;
      return 0;
    }
  }
  return 0;
}

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

map<string, int > hindo;

int main()
{
  string str;
  while (cin >> str) {
    hindo[str]++;
  }
  int mx = 0, mx_l = 0;
  for (map<string, int>::iterator it = hindo.begin(); it != hindo.end(); it++) {
    mx = max(it->second, mx);
    mx_l = max(mx_l, (int)it->first.size());
  }
  for (map<string, int>::iterator it = hindo.begin(); it != hindo.end(); it++) {
    if (mx == it->second) {
      cout << it->first << " ";
    }
  }
  for (map<string, int>::iterator it = hindo.begin(); it != hindo.end(); it++) {
    if (mx_l == it->first.size()) {
      cout << it->first << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
    int main(){
        int A, B, C;
            cin >> A >> B >> C;
                if(A*A + B*B == C*C){
                    cout << (A*B)/2 <<endl;
                }else if(A*A + C*C == B*B){
                    cout << (A*C)/2 << endl;
                }else if(B*B + C*C == A*A){
                    cout << (B*C)/2 << endl;
                }else{}
    return 0;}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func max(nums ...int) int {
	m := nums[0]
	n := len(nums)
	for i := 1; i < n; i++ {
		if m < nums[i] {
			m = nums[i]
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	n := len(nums)
	for i := 1; i < n; i++ {
		if m > nums[i] {
			m = nums[i]
		}
	}
	return m
}

func max2(a, b int) int {
	if a > b {
		return a
	}
	//
	return b
}

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	//
	li := make([]int, m)
	ri := make([]int, m)
	for i := 0; i < m; i++ {
		fmt.Scan(&li[i], &ri[i])
	}
	//
	limax := max(li...)
	rimin := min(ri...)
	//
	fmt.Println(max2(rimin-limax+1, 0))
}


Measured memory_bytes: 5504
#include <stdio.h>

int n;
int ans[] = {3, 1, 2};

void output(int a)
{
	printf("%d\n", ans[a % 3]);
}

int main(void)
{
	int k;
	int a, b;
	int i;
	
	scanf("%d", &n);
	scanf("%d", &k);
	
	for (i = 0; i < k; i++){
		scanf("%d %d", &a, &b);
		if (n - b + 1 >= a){
			if (b <= a){
				output(b);
			}
			else {
				output(a);
			}
		}
		else {
			if (b >= a){
				output(n - b + 1);
			}
			else {
				output(n - a + 1);
			}
		}
	}
	
	return (0);
}

Measured memory_bytes: 596
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>

#define INF_LL 9000000000000000000
#define INF 2000000000

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

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;

class Union_find{
private:
	vector<int> par;
	vector<int> rank;
	int n;

public:
	Union_find(int a){
		n = a;
		for(int i = 0;i < n;i++){
			par.push_back(i);
			rank.push_back(0);
		}
	}

	int find(int x){
		if(par[x] == x){
			return x;
		}else{
			return par[x] = find(par[x]);
		}
	}

	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;

		if(rank[x] < rank[y]){
			par[x] = y;
		}else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}

	bool same(int x, int y){
		return find(x) == find(y);
	}
};

int n, k;
int d[10];

bool is(int a){
	for(int i = a;i >= 1;i = i/10){
		int digit = i % 10;
		if(d[digit])
			return false;
	}
	return true;
}

int main(void){
	fill(d, d+10, 0);
	cin >> n >> k;
	REP(i, k){
		int a;
		cin >> a; 
		d[a] = 1;
	}
	bool flag = true;
	int res = n-1;
	for(int i = n;!is(i);i++){
		res = i;
	}
	cout << ++res << endl;
	return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N; cin >> N;
    ll ans = 0;
    if (N % 2 == 0){
        N /= 2;
        // 5で割れる回数をダイレクトにカウントしに行く
        while (true){
            if (N == 0){break;}
            N /= 5;
            ans += N;
        }
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2000000000;//10^9
ll MOD  = 1000000007;
int w[110];
int v[110];
ll dp[110][100010];

int main() {
    int N,W;
    cin >> N >> W;
    for(int i = 0; i < N; i++){
        cin >> w[i] >> v[i];
    }
    for(int i = 0; i <= N; i++){
        for(int j = 0; j < 100010; j++){
            dp[i][j] = INFL;
        }
    }
    for(int i = 0; i < 110; i++){
        dp[i][0] = 0;
    }
    
    
    for(int i = 1; i <= N; i++){
        for(int j = 0; j < 100010; j++){
            dp[i][j] = dp[i-1][j];
            if(j-v[i-1] >= 0){
                dp[i][j] = min(dp[i][j], dp[i-1][j-v[i-1]] + w[i-1]);
            }
        }
    }
    
    ll ans = 0;
    for(int j = 0; j < 100010; j++){
        if(dp[N][j] <= W){
            ans = j;
        }
    }
    cout << ans << endl;
    
}

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

int main()
{
    int N;
    cin >> N;
    int sum = 0;
    for (int i = 1; i < N + 1; i++) {
        if (i % 15 == 0) {
            sum -= 200;
        }
        sum += 800;
    }
    cout << sum;
}

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

typedef long long ll;

const int ms = 200200;

struct node {
	node() {
		to[0] = to[1] = -1;
		end = false;
	}

	int to[2];
	bool end;
};

int c = 1;
node trie[ms];

void go(std::string &str) {
	int on = 0;
	//std::cout << str << '\n';
	for(auto a : str) {
		if(trie[on].to[a - '0'] == -1) {
			//std::cout << "created " << c << "\n";
			trie[on].to[a - '0'] = c++;
		}
		on = trie[on].to[a - '0'];
	}
	//std::cout << "ended on " << on << "\n";
	trie[on].end = true;
}

ll nimber(int on, ll nim) {
	if(trie[on].end) {
		return 0;
	}
	ll ans = 0;
	for(int i = 0; i < 2; i++) {
		if(trie[on].to[i] == -1) {
			ll x = nim & -nim;
			//std::cout << "adding " << x << " on " << on << "\n";
			ans ^= x;
		} else {
			ans ^= nimber(trie[on].to[i], nim - 1);
		}
	}
	return ans;
}

int main() {
	int n;
	ll l;
	std::cin >> n >> l;
	while(n--) {
		std::string str;
		std::cin >> str;
		go(str);
	}
	if(nimber(0, l) == 0) {
		std::cout << "Bob\n";
	} else {
		std::cout << "Alice\n";
	}
}

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

using namespace std;

using ll = long long;
using ld = long double;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	int n, m;
	cin >> n >> m;

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

	map<int, int> mp;
	vector<int> sum(n + 1);
	for (int i = 0; i < n; i++) {
		sum[i + 1] = (sum[i] + a[i]) % m;
	}

	ll ans = 0;
	for (int i = 0; i < sum.size(); i++) {
		ans += mp[sum[i]];
		mp[sum[i]]++;
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3968
import java.util.*;

public class Main {
    static long mod = 1000000007;

    static class Restaurant {
        int id;
        String city;
        int point;
        public Restaurant(int id, String city, int point) {
            this.id = id;
            this.city = city;
            this.point = point;
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Restaurant[] lis = new Restaurant[n];

        for (int i = 0; i < n; ++i) {
            String city = sc.next();
            int point = sc.nextInt();
            lis[i] = new Restaurant(i + 1, city, point);
        }

        Arrays.sort(lis, new Comparator<Restaurant>() {
            public int compare(Restaurant a, Restaurant b) {
                if (a.city.equals(b.city)) {
                    return b.point - a.point;
                } else {
                    return a.city.compareTo(b.city);
                }
            }
        });

        for (int i = 0; i < n; ++i) {
            System.out.println(lis[i].id);
        }
    }
}


Measured memory_bytes: 21332
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    ll t = 0;
    for (int i = 0; i < k; i++) {
        t *= 10;
        t += 7;
        t %= k;
        if (t == 0) {
            cout << i + 1 << endl;
            exit(0);
        }
    }

    cout << -1 << endl;

    return 0;
}

Measured memory_bytes: 3536
import copy

n = int(input())

l = ['a']
ans = []


def f(n, s, l):
    if n == 1:
        for c in l:
            ans.append(s+c)
        return

    n -= 1
    for c in l:
        if (s+c).count(l[-1]) == 0:
            f(n, s+c, l)
        else:
            ll = copy.deepcopy(l)
            ll.append(chr(ord(ll[-1])+1))
            f(n, s+c, ll)


f(n, "", l)
for ss in ans:
    print(ss)


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001

int h, w;
vector<string> s(50);
vector<PP> v(26);
vector<char> vc;

bool ok() {
  char tmp[h][w];
  rep(i, h)rep(j, w) tmp[i][j] = '.';

  rep(i, vc.size()) {
    repl(j, v[vc[i] - 'A'].se.fi, v[vc[i] - 'A'].se.se + 1) {
      repl(k, v[vc[i] - 'A'].fi.fi, v[vc[i] - 'A'].fi.se + 1) {
        tmp[j][k] = vc[i];
      }
    }
  }

  rep(i, h)rep(j, w) if (s[i][j] != tmp[i][j]) return false;
  return true;
}

int main(){
  cin.sync_with_stdio(false);
  int t;
  cin >> t;
  rep(ii, t) {
    cin >> h >> w;
    rep(i, h) cin >> s[i];

    vc.clear();
    rep(i, 26) v[i] = PP(P(INF, 0), P(INF, 0));
    rep(i, h)rep(j, w) {
      if (s[i][j] != '.') {
        minch(v[s[i][j] - 'A'].fi.fi, j), maxch(v[s[i][j] - 'A'].fi.se, j);
        minch(v[s[i][j] - 'A'].se.fi, i), maxch(v[s[i][j] - 'A'].se.se, i);
        vc.pb(s[i][j]);
      }
    }

    sort(all(vc));
    uni(vc);
    bool ans = false;
    do {
      if (ok()) {
        ans = true;
        break;
      }
    } while(next_permutation(all(vc)));

    cout << ((ans) ? "SAFE" : "SUSPICIOUS") << endl;
  }

  return 0;
}

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

using namespace std;

const int N = 302;

int n, nn, ans, cnt[N * 2];
char a[N * 2][N * 2];
bool chk[N * 4][N][N];

void enter() {
    cin >> n;
    nn = n * 2;
    for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= n; ++j) {
            cin >> a[i][j];
            a[i + n][j + n] = a[i + n][j] = a[i][j + n] = a[i][j];
        }
}

bool get(bool (&f)[N][N], int l, int r) {
    return l <= r ? f[l % n][r % n] : true;
}

void solve() {
    for (int i = 2; i <= n + 1; ++i) cnt[i - 2] = i - 1;
    for (int i = n + 2, j = 1; i <= n * 2; ++i, ++j) cnt[i - 2] = n - j;
    for (int i = 1; i < nn; ++i) {
        // update
        for (int j = 1; j <= nn; ++j) {
            int s = i + j;
            int li = i - min(i, nn - j + 1);
            for (int pi = i; pi > li; --pi) {
                bool tmp = get(chk[s], pi + 1, i - 1) & (a[i][j] == a[pi][s - pi]);
                chk[s][pi % n][i % n] = tmp;
            }
        }

        // count
        if (i < n) continue;
        int ii = i - n + 1;
        for (int j = 1; j <= n; ++j) {
            bool flag = true;
            for (int k = 0; k < n; ++k) {
                int ti = ii;
                flag &= chk[ii + j + k][ti % n][(ti + cnt[k] - 1) % n];
            }
            for (int k = n; k < n * 2 - 1; ++k) {
                int ti = ii + k - n + 1;
                flag &= chk[ii + j + k][ti % n][(ti + cnt[k] - 1) % n];
            }
            ans += flag;
        }
    }
}

int main() {
    ios::sync_with_stdio(false);
    enter();
    solve();
    cout << ans << "\n";
    return 0;
}

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

static const int N = 100;

int main(){
	int n, p[N+1], m[N+1][N+1];
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> p[i-1] >> p[i];
	}

	for(int i = 1; i <= n; i++)
		m[i][i] = 0;
	for(int l = 2; l <= n; l++){
		for(int i = 1; i <= n-l+1; i++){
			int j = i + l - 1;
			m[i][j] = (1 << 21);
			for(int k = i; k <= j-1; k++){
				m[i][j] = min(m[i][j], m[i][k] + m[k+1][j] + p[i-1] * p[k] * p[j]);
			}
		}
	}
	cout << m[1][n] << endl;

	return 0;
}


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

#define  SZ(items) (int)items.size()
#define  CLR(a)  memset(a,0,sizeof(a))
#define  SET(a)  memset(a,-1,sizeof(a))


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

template <class T> inline T gcd(T a, T b) { while (b) { a = a%b; swap(a, b); } return a; }

using namespace std;

int total[100005];
int zero[100005];

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

	string s;
	cin >> s;

	vector<pair<int, int>> items;
	items.push_back({ 0,0 });

	char c = s[0];
	int last = 0;

	int i = 0;

	for (i = 0; i < (int)s.size(); i++)
	{
		if (c != s[i])
		{
			items.push_back({ i - last,c - '0' });
			last = i;
		}

		c = s[i];
	}

	items.push_back({ i - last,c - '0' });
	last = i;

	

	for (i = 1; i < (int)items.size(); i++)
	{
		total[i] = items[i].first;
		total[i] += total[i - 1];

		if (items[i].second == 0)
			zero[i] = 1;

		zero[i] += zero[i - 1];
	}

	i = 1;
	int j = 1;
	int mx = 0;

	while (j < (int)items.size())
	{
		mx = max(mx, total[j] - total[i - 1]);

		j++;

		while (zero[j]-zero[i-1]>k)
		{
			i++;
		}
	}

	cout << mx << endl;

	return 0;
}

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

#define int long long
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; }

vector<int> a;
map<int, int> mp;

vector<int> vec;

int get(){
	int ans = INT_MAX;
	for(int i = 0;i < vec.size();i++){
		for(int j = i+1;j < vec.size();j++){
			int mi = min(vec[i], vec[j]);
			int ma = max(vec[i], vec[j]);
			chmin(ans, min(ma-mi, 24-ma + mi));
		}
	}
	return ans;
}

int dfs(int i){
	if(i > 12){
		return get();
	}

	if(i == 0){
		if(mp[i] > 1) return 0;
		vec.push_back(0);
		return dfs(i+1);
	}

	if(mp[i] > 2){
		return 0; 
	}

	if(mp[i] == 0){
		return dfs(i+1);
	}

	if(mp[i] == 2){
		vec.push_back(i);
		vec.push_back(24-i);
		int ans = dfs(i+1);
		vec.pop_back();
		vec.pop_back();
		return ans;
	}

	vec.push_back(i);
	int ans = dfs(i+1);
	vec.back() = 24-i;
	chmax(ans, dfs(i+1)); 
	vec.pop_back();
	return ans; 
}

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

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

	cout << dfs(0) << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[101], b[101], c[101];

int main() {
  int n, x, y, z, t;
  cin >> n;
  cin >> x;
  for (int i = 0; i < x; i++) {
    cin >> t;
    a[t]++;
  }
  cin >> y;
  for (int i = 0; i < y; i++) {
    cin >> t;
    b[t]++;
  }
  cin >> z;
  for (int i = 0; i < z; i++) {
    cin >> t;
    c[t]++;
  }
  int ans = 0;
  for (int i = 0; i < 101; i++) {
    if ((!a[i] && c[i]) || b[i] && c[i]) ans++;
  }
  cout << ans << "\n";
}


Measured memory_bytes: 3100
#include <stdio.h>
#define MAX 100
#define INF 1000000
#define NIL -1
  
int n;
int d[MAX],w[MAX][MAX],pi[MAX];
  
void prime() {
 
  int u,v,i,j,color[MAX],mincos;
  
  for(u=0;u<n;u++){
    d[u]=INF;
    pi[u]=NIL;
    color[u]=0;
  }
  
  d[0]=0;
  
  for(i=0;i<n;i++) {
    
    mincos = INF;
    for (j=0;j<n;j++){
      if(color[j]==1)
	continue;
      
      if(d[j]<=mincos){
	u=j;
	mincos=d[j];
      }
    }
    
    for(v=0;v<n;v++){
      if(w[u][v]==-1){
	 continue;
      }
      if(color[v]==1){
	continue;
      }
      
      if(w[u][v] < d[v]){
	pi[v]=u;
	d[v]=w[u][v];
      }
    }
    color[u]=1;
  }
}

main() {
  int i,j,sum=0;
  scanf("%d",&n);
  
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&w[i][j]);
    }
  }
  
  prime();
  for(i=0;i<n;i++)
    sum+=d[i];
  
  printf("%d\n",sum);
  
  return 0;
}

Measured memory_bytes: 636
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ls( s) (s&(-s))
#define ll long long
#define inf 0x3f3f3f3f
#define fast    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll N = 100030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =    1e9+7;
ll n,k;
vector<ll> v(N);
long po(long a,long b){return b?po(a*a%mod,b/2)*(b%2?a:1)%mod:1;}
int main()
{  fast
cin>>n>>k;


ll ans=0;
for(ll i=k;i>=1;i--)
{
	v[i]=po(k/i,n);
	ll sum=v[i];
	for(ll j=i+i;j<=k;j+=i)
	{
		v[i]-=v[j];
	}
	ans+=i*v[i]%mod;
}
cout<<ans%mod;
}


Measured memory_bytes: 3896
// Problem : B - 81
// Contest : AtCoder - AtCoder Beginner Contest 144
// URL : https://atcoder.jp/contests/abc144/tasks/abc144_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define int long long
#define db double
#define mod 1000000007
#define pb push_back
#define pp pair<int,int>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repe(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=b;i>=a;i--)
#define maxn 200005
#define ss second
#define ff first
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
int inv(int a, int b){
 return 1<a ? b - inv(b%a,a)*b/a : 1;
}
void solve()
{
	int n;
	cin>> n;
	rep(i,1,10)
	{
		if(n%i==0 and n/i <= 9)
		{
			cout << "Yes" <<"\n";
			return;
		}
	}	
	cout << "No" <<"\n";
	
}
signed main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin >> t;
    while(t--)
    solve();
    return 0;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
#define ull unsigned long long
using namespace std;
int n,a[200005];
ull ans=0;
int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d",a+i);
	int i=0,j=0,xorm=a[0],sum=a[0];
	while(i<n)
	{
		while(j<n&&xorm==sum)
		j++,sum+=a[j],xorm^=a[j];
//		cout<<'\t'<<i<<' '<<j<<' '<<sum<<' '<<xorm<<endl;
		ans+=j-i;
		sum-=a[i];
		xorm^=a[i];
		i++;
	}
	cout<<ans<<endl;
	return 0;
} 

Measured memory_bytes: 1152
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def main():
    n = int(input())
    arr = list(map(int, input().split()))
    left = [0] * n
    right = [0] * n
    left[0] = arr[0]
    right[-1] = arr[-1]
    for i in range(1, n):
        left[i] = gcd(left[i - 1], arr[i])
        right[n - i - 1] = gcd(right[n - i], arr[n - i - 1])
    m = max(left[-2], right[1])
    for i in range(1, n - 1):
        m = max(m, gcd(left[i - 1], right[i + 1]))
    print(m)
    return 0

main()

Measured memory_bytes: 14080
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <vector>
#include <bitset>
#include <cmath>
#include <utility>
#define Maxn 100005
#define Maxm 1000005
#define lowbit(x) x&(-x)
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define PI acos(-1.0)
#define LL long long 
#define Inf (1LL<<62)
#define inf 0x3f3f3f3f
#define input freopen("input.txt","r",stdin)
#define output freopen("output.txt","w",stdout)
using namespace std;
const int mod=1e9+7;
int head[Maxn<<1],k;
struct Edge
{
    int e;
    int next;
}edge[Maxm];
void add(int s,int e)
{
    edge[k].e=e;
    edge[k].next=head[s];
    head[s]=k++;
}
bool vis[Maxn<<1];
bool judge(int n)
{
    for(int i=head[1];i!=-1;i=edge[i].next)
    {
        int v=edge[i].e;
        vis[v]=true;
    }
    for(int i=head[n];i!=-1;i=edge[i].next)
    {
        int v=edge[i].e;
        if(vis[v])
            return true;
    }
    return false;
}
int main()
{
    int n,m,u,v;
    //input;output;
    while(~scanf("%d%d",&n,&m))
    {
        k=0;
        memset(head,-1,sizeof(head));
        memset(vis,false,sizeof(vis));
        while(m--)
        {
            scanf("%d%d",&u,&v);
            add(u,v);
            add(v,u);
        }
        printf("%s\n",judge(n)?"POSSIBLE":"IMPOSSIBLE");
    }
    return 0;
}

Measured memory_bytes: 7040
#include<bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;

int main()
{
  int N, M, P;
  cin >> N >> M >> P;
  vector< int > d(M);
  for(int i = 0; i < M; i++) {
    cin >> d[i];
    d[i] = (d[i] - P + N) % N;
  }
  sort(d.begin(), d.end());
  int ret = min(N - d[0], d[M - 1]);
  for(int i = 0; i < M; i++) {
    if(i > 0) ret = min(ret, d[i - 1] * 2 + N - d[i]);
    if(i + 1 < M) ret = min(ret, (N - d[i + 1]) * 2 + d[i]);
  }
  cout << ret * 100 << endl;
}

Measured memory_bytes: 1252
#include <bits/stdc++.h>
using namespace std;
 
#define faster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define mp make_pair
#define mod 1000000007
#define qmod 998244353
#define endl "\n"
#define pb push_back
#define ff first
#define ss second
 
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
 
const int MOD = 1e9 + 7;
const int INF = 1e9 + 5;
const ll LINF = LLONG_MAX;

int main(){
	
	ll n,m,c;
	cin>>n>>m>>c;
	ll b[m],a[m];
	for(ll i=0;i<m;i++){
		cin>>b[i];
	}
	ll count=0;
	while(n--){
		ll sum=0;
		for(ll i=0;i<m;i++){
			cin>>a[i];
		}
		for(ll i=0;i<m;i++){
			sum += a[i]*b[i];
		}
		sum = sum+c;
		if(sum>0){
			count++;
		}
	}
	cout<<count<<endl;


}

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

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


Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
#define pb push_back
#define ll long long
#define pii pair<int, int>
#define pll pair<long long, long long>
#define ull unsigned long long
#define mp make_pair
#define F first
#define S second
ll  mod = 1000000007;

int main()
{
    string s;
    cin >> s;

    if(s[s.size()-1] == 's')
        cout << s + "es" << endl;
    else
        cout << s+ "s" << endl;
}

Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
  int N, L; cin>>N>>L;
  vector<int> len(N);
  int rem = -1;
  for(int i = 0; i < N; i++) cin >> len[i];
  for(int i = 1; i < N; i++) {
    if(len[i-1]+len[i] >= L) {
      rem = i;
      break;
    }
  }
  if(rem < 0) {
    cout << "Impossible" << endl;
    return 0;
  }
  cout << "Possible" << endl;
  for(int i = N-1; i > rem; i--) {
    cout << i << endl;
  }
  //  cout << "------" << endl;                                                         
  for(int i = 1; i < rem; i++) {
    cout << i << endl;
  }
  //  cout << "------" << endl;                                                         
  cout << rem << endl;
  return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <algorithm>
#include <vector>

typedef long long ll;

int main(){
    int n;
    std::vector<ll> v;
    std::cin >> n;
    for(int i = 0; i < n; i++){
        ll t;
        std::cin >> t;
        v.push_back(t - static_cast<ll>(i - 1));
    }
    std::sort(v.begin(), v.end());
    ll b = v.at(n/2);
    ll ans = 0;
    for(ll item : v){
        ans += std::abs(item-b);
    }
    std::cout << ans << std::endl;
}


Measured memory_bytes: 2420
C=->n,r{k=1;r.times{|i|k=k*(n-i)/-~i};k};require'prime';N,M=gets.split.map &:to_i;r=1;M.prime_division.map{|n,k|r=r*C[N+k-1,k]%(10**9+7)};p r

Measured memory_bytes: 2044
#include <iostream>
using namespace std;
int main() {
	int N;
	cin >> N;
	int ans1,ans2;
	int boolian=0;

	ans1 = N / 4;
	
	ans2 = N / 7;
	
	for (int i = 0; i <= ans1; i++) {
		for (int j = 0; j <= ans2; j++) {
			if ((4 * i + 7 * j) == N) {
				boolian = 1;
				break;
			}
		}
		if (boolian == 1) {
			break;
		}
	}

	if (boolian == 1) {
		cout << "Yes" << endl;
	}
	else if (boolian == 0) {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,a,n) for(int i=(a);i<(int)(n);i++)
using namespace std;
typedef long long ll;
struct start { start() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(10);
}; }start;
void in() {}
template <class Head , class... Tail>
void in(Head&& head, Tail&&... tail) {
  cin >> head;
  in(move(tail)...);
}
template <class T>
  void out(T& t) {
  cout << t << '\n';
}
template <class Head , class... Tail>
void out(Head& head , Tail&... tail) {
  cout << head << ' ';
  out(move(tail)...);
}
int main(void) {
  int a,b,x;
  in(a,b,x);
  if(x-a>=0&&a+b>x)out("YES");
  else out("NO");
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string o,e;
	cin>>o>>e;
	int i,a,b;
	a=o.size();
	b=e.size();
	if(a>=b)
	{
	for(i=0;i<a;i++)
	{
		cout<<o[i];
		if(i<b)
		{
		cout<<e[i];
		}
	}
	}
	if(b>a)
	{
	for(i=0;i<b;i++)
	{
		
		if(i<a)
		{
		cout<<o[i];
		
		}
		cout<<e[i];
	}
	}
}

Measured memory_bytes: 3548
from collections import deque

s = deque(input())
q = int(input())
is_reversed = False
for i in range(q):
    query = input().split()
    if query[0] == '1':
        is_reversed = not is_reversed
    elif (query[1] == '2') ^ is_reversed:
        s.append(query[2])
    else:
        s.appendleft(query[2])
if is_reversed:
    s.reverse()
print(''.join(s))


Measured memory_bytes: 8436
# -*- coding: utf-8 -*-
n = int(input())
s = []
for _ in range(n):
    default_list = [0] * 26
    sk = input()
    for i in sk:
        default_list[ord(i) - 97]+=1
    s.append(default_list)
ret = ""
for i,l in enumerate(zip(*s)):
    ret += ""+chr(i+97)*min(l)
print(ret)


Measured memory_bytes: 3060
#pragma GCC optimize("Ofast",3,"inline")
#include<bits/stdc++.h>
using namespace std;
#define fir first
#define sec second
#define m_p make_pair
#define y1 ygftgfgcdtfgxffgx
#define y2 yfdsesgvtyghftfvv
#define x1 xvyr6cf6fgcfgf676
#define x2 xcr6rfc5r66y6r6fr
#define up_bound upper_bound
#define low_bound lower_bound
#define next_per next_permutation
#define pb push_back
#define i_to_s to_string
typedef priority_queue<int> p_queue;
typedef priority_queue<int, vector<int>, greater<int> > min_p_queue;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int mon[20]={31,28,31,30,31,30,31,31,30,31,30,31};
ll gcd(ll x,ll y){return ((y==0)?x:gcd(y,x%y));}
int INF = 1e9 + 7;
ll MOD = 998244353;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	vector<vector<ll>> dp(c+10,vector<ll>(d+10,0));
	
	for(int i = a; i <= c; ++i){
		for(int j = b; j <= d; ++j){
			if(i == a && j == b){
				dp[i][j] = 1;
				continue;
			}
			dp[i][j] = dp[i-1][j]*j + dp[i][j-1]*i - dp[i-1][j-1]*(i-1)*(j-1);
			//dp[i][j] %= MOD;
			dp[i][j] = (MOD + dp[i][j] % MOD) % MOD;
		}
	}
	cout << dp[c][d] << endl;
	return 0;
}


Measured memory_bytes: 74024
#include<iostream>
    #include<vector>
    #include<math.h>
    #include<bits/stdc++.h>
     
    using namespace std;
     
    int main()
    {
        int n, m, c, count = 0;
        vector<int> bv;
        vector<vector<int>> av;

        cin >> n >> m >> c;

        for(int i = 0; i < m; i++)
        {
            int x;
            cin >> x;
            bv.push_back(x);
        }

        for(int i = 0; i < n; i++)
        {
          av.push_back(vector<int>());
          
          for(int j = 0; j < m; j++)
          {
              int x;
              cin >> x;
              av[i].push_back(x);
          }
        }

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

            for(int j = 0; j < m; j++)
            {
                total = total + av[i][j]*bv[j];
            }

            if(total + c > 0)
                count++;
        }

        cout << count;
    }

Measured memory_bytes: 3640
def myAnswer(N:int,T:int,t:list) -> int:
   total = T*N
   sub = 0
   if(N == 1): return T
   pre = t.pop(0)
   for time in t:
      if(pre + T - time > 0):
         sub += pre+T - time
      pre = time
   return total - sub

def modelAnswer():
   return
def main():
   N,T = map(int,input().split())
   t = list(map(int,input().split()))
   print(myAnswer(N,T,t[:]))
if __name__ == '__main__':
   main()

Measured memory_bytes: 26708
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;


 
 int main(){
 	int N;
 	int S[100000];
 	int q;
 	int T[1000];
 	int count = 0;

 	cin >> N;
 	for(int i = 0; i < N; i++){
 		cin >> S[i];
 	}
 	cin >> q;
 	for(int j = 0; j < q; j++){
 		cin >> T[j];
 	}

 	for(int j = 0; j < q; j++){
 		int i = 0;
 		S[N] = T[j];
 		while( S[i] != T[j] ) i++;
 		if(i != N) count++;
 		else{count = count + 0;}
 	}

 	cout << count << endl;

 	return 0;
 }

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

using namespace std;

using ll = long long;

int ans[505][505];

void solve(int L, int R, int level) {
    if (R - L <= 1) return;

    int mid = (R + L) / 2;
    for (int i = L; i < mid; i++) {
        for (int j = mid; j < R; j++) {
            ans[i][j] = level;
        }
    }

    level++;
    solve(L, mid, level);
    solve(mid, R, level);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int level = 1;
    solve(0, n, level);
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            cout << ans[i][j] << " \n"[j + 1 == n];
        }
    }
    return 0;
}

Measured memory_bytes: 1536
(ns my.core
  (:require [clojure.string :as str]))


;(def w (str (read-string (read-line))))


(def input (read-line))

(def t (Integer/parseInt (first (str/split input #" "))))

(defn twice []
  (let [g (read-line)]
    (println g)
    (println g)))

(defn p [_ t]
  (if (zero? t)
    nil
    (recur (twice) (dec t))))

(p nil t)

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

typedef long long ll;
typedef unsigned long long ull;

#define PrintLn(X) cout << X << endl
#define Loop(n) for(int loop_ = n; loop_; --loop_)
#define Rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define For(i, a, b) for(int i = a; i < (int)(b); ++i)

int N;
char a[100001] = {0};
char s[100001];
bool f(char fst, char snd)
{
	a[0] = fst;
	a[1] = snd;
	For(i, 1, N - 1){
		a[i + 1] = (a[i] == 'W' ^ a[i - 1] == 'W' ^ s[i] == 'o') ? 'S' : 'W';
	}
	if(a[0    ] == 'W' ^ s[0    ] == 'o' ^ a[N - 1] == a[1]) return false;
	if(a[N - 1] == 'W' ^ s[N - 1] == 'o' ^ a[N - 2] == a[0]) return false;
	PrintLn(a); 
	return true;
}
int main(void)
{
	cin >> N;
	cin >> s;
	if(f('S', 'S')) return 0;
	if(f('S', 'W')) return 0;
	if(f('W', 'S')) return 0;
	if(f('W', 'W')) return 0;
	PrintLn("-1");
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std ;
int main(){
	/* #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    */
   int r,d,x;
   int i;
   int y=0;
   cin>>r>>d>>x;
   for(i=1;i<=10;i++){
     y=(r*x);
     y=y-d;
    cout<<y<<endl;
    x=y;
   }

    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n, x, m = LI()
check = [-1] * (m+1)
cnt = [-1] * (m+1)
ans = x
tmp = x
for i in range(min(n-1, m-1)):
    if check[tmp % m] < 0:
        check[tmp % m] = ans
        cnt[tmp % m] = i
        ans += tmp**2 % m
        tmp = tmp**2 % m
    else:
        roop = i - cnt[tmp % m]
        tmp2 = ans - check[tmp % m]
        r, l = (n-1 - i) // roop, (n-1 - i) % roop
        ans += tmp2 * r
        for j in range(l):
            ans += tmp**2 % m
            tmp = tmp**2 % m
        print(ans)
        break
else:
    print(ans)
         

Measured memory_bytes: 69768
def like?(dislikes, numbers)
  (dislikes & numbers).empty?
end

n, k = gets.strip.split(' ').map(&:to_i)
d = gets.strip.split(' ').map(&:to_i)

result = 0
100000.times do |price|
  next if price < n

  result = price
  numbers = price.to_s.split('').map(&:to_i)
  break if like?(d, numbers)
end

p result




Measured memory_bytes: 3836