akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vd(T) vector<vector<T>>
#define v(T) vector<T>
#define mod (ll)(1e9+7)
#define pp(T) pair<T,T>
#define pb push_back
#define mp make_pair
#define NN 100005
#define IO ios_base::sync_with_stdio(NULL),cin.tie(0),cout.tie(0)
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define DEBUG cout<<"***********DEBUGGING***********"<<endl
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; 
ll power(ll a,ll b){ if(b==0) return 1; ll s=power(a,b/2); s*=s;if(b&1) return s*a; return s;}
ll powermod(ll a,ll b,ll m){ if(b==0) return 1; ll s=power(a,b/2);s*=s; s%=m; if(b&1) return (s*a)%m; return s;}
inline int add(ll a,ll b,ll m=0){
    if(m==0) return a+b;
    return (a%m+b%m)%m;
}

inline int sub(ll a,ll b ,ll m=0){
    if(m==0) return a-b;
    return ((a%m-b%m)%m+m)%m;
}

inline int mul(ll a,ll b,ll m=0){
    if(m==0)return (a*b);
    return ((a%m)*(b%m))%m;
}

inline int div(ll a,ll b,ll m=0){
    if(m==0) return a/b;
    return ((a%m)*(powermod(a,b,m-2)%m))%m;
}

bool isopen(char c){
    return ((c=='(')||(c=='{')||(c=='['));
}

ll longest_balanced_parenthesis(string a,ll n){
    stack<char> s;
    ll start=0;
    ll ans=0,m=0;
    for(ll i=0;i<n;i++){
        if(isopen(a[i])){
            s.push(a[i]);
        }
        else{
            if(isopen(a[i])|| s.empty()){
                m=max(m,ans);
                continue;
            }
            else{
                s.pop();
                ans+=2;
                m=max(ans,m);
            }
        }
    }

    return m;

}

ll setup_k(ll *a,ll k){
  ordered_set x;
  // Now , insert and then check number of integers less than k by just using x.order_of_key(k+1)
}



int main() {

    IO; 
	
  	ll n;
    cin>>n;
    vector<ll> a(n+1);
    a[0]=0;
    for(ll i=0;i<n;i++){
        cin>>a[i+1];
    }
    ll m;
    cin>>m;
    ll ans=0;
    map<ll,ll> M;
    loop(i,1,n+1){
        ans+=a[i];
    }
    for(ll i=0;i<m;i++){
        ll x,y;
        cin>>x>>y;
        cout<<ans-a[x]+y<<endl;
    }
    
    

}

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

int main(){
    int N;
    cin >> N;
    vector<int> H(N);
    bool flag = true;
    bool changed = false;
    for (int i = 0; i < N; i++)
    {
        cin >> H[i];
    }
    for (int i = 0; i < N - 1;i++)
    {
        if(H[i] > H[i+1]){
            if (H[i] <= H[i+1] +1)
            {
                H[i + 1]++;
            }
            else{
                flag = false;
            }
        }
    }

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

Measured memory_bytes: 640
#include<stdio.h>
int main(void)
{
	int i,w,j;	
	int a,b,k,aa=0,flg[101][101];
	char c[101][101];
	scanf("%d %d",&a,&b);
	for(i=0;i<101;i++){
		for(w=0;w<101;w++){
			flg[i][w]=0;
		}
	}
	for(i=0;i<a;i++){
		scanf("%s",c[i]);
	}
	for(i=0;i<a;i++){
		for(w=0;w<b;w++){
			if(c[i][w]=='c'){
				c[i][w]='0';
				k=1;
			}
			else if(c[i][w-1]!='.' && w!=0){
				if(c[i][w]=='.'){
					c[i][w]=k+'0';
					if(k>=80){
					flg[i][w]=k;
					}
					k++;
				}
				else{
					k=1;
				}
			}
		}
		k=1;
	}
	for(i=0;i<a;i++){
		for(w=0;w<b;w++){
			if(c[i][w]=='.'){
				printf("-1");
			}
			else if(flg[i][w]!=0){
				printf("%d",flg[i][w]);
			}
			else{
				aa=c[i][w]-'0';
				printf("%d",aa);
				aa=0;
			}
			if(w<b-1){
				printf(" ");
			}
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 1080
N,K = map(int, input().split())
h = list(int(i) for i in input().split())
dp = [float("inf")]*N
dp[0] = 0
for i in range(N):
    for j in range(i+1,min(N,i+K+1)):
        dp[j] = min(dp[j],dp[i]+abs(h[i]-h[j]))
print(dp[-1])

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

lint gcd(lint x, lint y) {
  if(x == 0) { return y; }
  else { return gcd(y%x,x); }
}

lint lcm(lint x, lint y) { return x/gcd(x,y)*y; }

lint C(lint n, lint k) {
  if(n == k) { return 1; }
  else if(n < k) { return 0; }
  else if(k == 0) { return 1; }
  else if(k == 1) { return n; }
  else return C(n-1,k-1) + C(n-1,k);
}

lint P(lint n, lint k) {
  if(k == 1) { return n; }
  return (n*(P(n-1,k-1)%1000000007)%1000000007);
}


int main() {
  int n,x,t; cin >> n >> x >> t;
  
  int ans = n/x;
  if(n%x > 0) { ans++; }
  ans *= t; 
  
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5;
#define fast_IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll w[N],v[N];
ll mem[100005][105];
bool vis[N],vis1[N];
//vector<ll>v[N];
pair<ll,ll>p[N],p1[N];
set<int>s;
map<string,ll>mp;
int n,W;
ll dp(ll w1,int i)
{
    if(i==n||w1<=0) return 0;

    ll &ret=mem[w1][i];

    if(ret!=-1)
        return ret;

    ll p1=0,p2=0;

    if(w1-w[i]>=0)
        p1=dp(w1-w[i],i+1)+v[i];
    p2=dp(w1,i+1);

    mem[w1][i]=max(p1,p2);
    return mem[w1][i];
}

main()
{
    fast_IO
    cin>>n>>W;
    memset(mem,-1,sizeof mem);
    for(int i=0; i<n; i++) cin>>w[i]>>v[i];
    cout<<dp(W,0);




}










Measured memory_bytes: 85700
l =int(input())
mass = list(map(int,input().split()))

ans = 0
old_ans = 0
for i in range(l-1):

   if mass[i]>=mass[i+1]:
      ans = ans+1
   else:
      ans =0

   if old_ans < ans:
      old_ans = ans


#   print(i,"no", ans,old_ans)


print(old_ans)

Measured memory_bytes: 14224
#include<iostream>
#include<vector>
#include<string.h>
using namespace std;

int main(){
    int w,n,va,we;
    int dp[10000];
    char c;
    vector<pair<int,int> >vec;
    int cas=0;
    while(cin>>w>>n,w){
        for(int i=0;i<n;i++){
            cin>>va>>c>>we;
            vec.push_back(make_pair(va, we));
        }
        memset(dp,0,sizeof(dp));
        for(int i=0;i<n;i++){
            int tv=vec[i].first, tw=vec[i].second;
            for(int j=w;j>=0;j--){
                if(tw+j<=w){
                    dp[tw+j]=max(dp[tw+j],dp[j]+tv);
                }
            }
        }
        int aw=0,av=0;
        for(int i=0;i<=w;i++) {
            if(dp[i]>av){
                aw=i;
                av=dp[i];
            }
        }
        cout<<"Case "<<(++cas)<<":"<<endl<<av<<endl<<aw<<endl;
        vec.clear();
    }
}

Measured memory_bytes: 1260
import java.util.Scanner
import scala.collection.Searching._

import scala.annotation.tailrec

class IUnionFind(val size: Int) {

  private case class Node(var parent: Option[Int], var treeSize: Int)

  private val nodes = Array.fill[Node](size)(new Node(None, 1))

  def union(t1: Int, t2: Int): IUnionFind = {
    if (t1 == t2) return this

    val root1 = root(t1)
    val root2 = root(t2)
    if (root1 == root2) return this

    val node1 = nodes(root1)
    val node2 = nodes(root2)

    if (node1.treeSize < node2.treeSize) {
      node1.parent = Some(t2)
      node2.treeSize += node1.treeSize
    } else {
      node2.parent = Some(t1)
      node1.treeSize += node2.treeSize
    }
    this
  }

  def connected(t1: Int, t2: Int): Boolean = t1 == t2 || root(t1) == root(t2)

  @tailrec
  private def root(t: Int): Int = nodes(t).parent match {
    case None => t
    case Some(p) => root(p)
  }
}


object Main {

  def solve(sc: => Scanner): Unit = {
    val N = sc.nextInt
    val speed = Array.fill(20002 * 2)(0.0)
    val maxspeed = Array.fill(20002 * 2)(0.0)
    val t = Array.fill(N)(sc.nextInt)
    val v = Array.fill(N)(sc.nextInt)

    var now = 0
    for (i <- 0 until N) {
      if (i != 0) {
        maxspeed(now) = math.min(v(i), v(i - 1))
      }
      for (j <- 1 until t(i) * 2) {
        maxspeed(now + j) = v(i)
      }
      now += t(i) * 2
    }
    var f = true
    while (f) {
      f = false
      for (i <- 1 to 20000 * 2) {
        if ((speed(i - 1) == speed(i) || speed(i - 1) - 0.5 == speed(i) || speed(i - 1) - 1 == speed(i)) && (speed(i + 1) == speed(i) || speed(i + 1) - 0.5 == speed(i) || speed(i + 1) - 1 == speed(i))) {
          if (speed(i) + 0.5 <= maxspeed(i)) {
            speed(i) += 0.5
            f = true
          }
        }
      }
    }
    println(speed.sum / 2)
  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)

    solve(sc)
  }
}


Measured memory_bytes: 31916
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

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

const long long MOD = 1e9 + 7;
const long long INF = 1e15;
const int INF_INT = 1e9;

template<class TYPE>
struct edge{
    TYPE to,cost; 
    edge(TYPE t,TYPE c){
        to = t;
        cost = c;
    }
};

int main(){
    int N;
    cin >> N;
    bool flag = true;
    for(int i = 0; i < N; i++){
        char c;
        cin >> c;
        if(c == 'Y') flag = false;
    }
    if(flag) cout << "Three" << endl;
    else cout << "Four" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cstring>
#include <functional>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define fs first
#define sc second
#define pb push_back
#define show(x) cout << #x << " " << x << endl
const int ccc=1e6;
bool prime[ccc+1];
int a[2000][2000],px[ccc+1],py[ccc+1];
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;
P memo[ccc+1];
P dfs(int n,int m){
//	show(n);
	if(n==0||n>m) return P(0,0);
	if(memo[n].fs!=-1) return memo[n];
	int x=px[n],y=py[n];
	P ret=P(0,0);
	for(int i=-1;i<=1;i++){
		ret=max(ret,dfs(a[x+i][y-1],m));
	}
	if(prime[n]){
		ret.fs++;
		if(ret.fs==1) ret.sc=n;
	}
	return memo[n]=ret;
}
int main(){
	for(int i=2;i<=ccc;i++) prime[i]=true;
	for(int i=2;i*i<=ccc;i++) if(prime[i]) for(int j=2;j*i<=ccc;j++) prime[i*j]=false;
	int x=1000,y=1000;
	int p=1,d=0,l=1,mx=1;
	rep1(p,ccc){
		a[x][y]=p;
		px[p]=x,py[p]=y;
		x+=dx[d],y+=dy[d];
		l--;
		if(l==0){
			if(d%2) mx++;
			l=mx;
			d=(d+1)%4;
		}
	}
	while(true){
		int m,n;
		cin>>m>>n;
		if(m==0) break;
		rep1(i,m) memo[i]=P(-1,0);
		P ans=dfs(n,m);
		cout<<ans.fs<<" "<<ans.sc<<endl;
	}
}

Measured memory_bytes: 28864
#include<iostream>
using namespace std;
int main() {
	int n;
	cin >> n;
	int a[100];
	for (int i = 0; i < n; i++)
        {
		cin >> a[i];
	}
         cout<<a[n-1];
	for (int i = n-2; i >= 0; i--)
        {
		cout  << " " << a[i];
	}
	cout <<endl;
	return 0;
}

Measured memory_bytes: 3104
#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>
#include <vector>

using namespace std;

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


bool solve(string s){
	stringstream ss;
	// cout<<"before "<<s<<endl;
	bool f=false;
	rep(i,s.size()){
		if(i+1<s.size()&&s[i]=='-'&&(s[i+1]=='T'||s[i+1]=='F')){
			if(s[i+1]=='T') ss<<'F';
			else ss<<'T';
			i++;
			f=true;
		}
		else if(i+4<s.size()&&s[i]=='('&&(s[i+1]=='T'||s[i+1]=='F')&&s[i+2]=='*'&&(s[i+3]=='T'||s[i+3]=='F')&&s[i+4]==')'){
			f=true;
			if(s[i+1]=='F'||s[i+3]=='F') ss<<'F';
			else ss<<'T';
			i+=4;
		}
		else if(i+4<s.size()&&s[i]=='('&&(s[i+1]=='T'||s[i+1]=='F')&&s[i+2]=='+'&&(s[i+3]=='T'||s[i+3]=='F')&&s[i+4]==')'){
			f=true;
			if(s[i+1]=='F'&&s[i+3]=='F') ss<<'F';
			else ss<<'T';
			i+=4;
		}
		else if(i+5<s.size()&&s[i]=='('&&(s[i+1]=='T'||s[i+1]=='F')&&s[i+2]=='-'&&s[i+3]=='>'&&(s[i+4]=='T'||s[i+4]=='F')&&s[i+5]==')'){
			f=true;
			if(s[i+1]=='T'&&s[i+4]=='F') ss<<'F';
			else ss<<'T';
			i+=5;
		}
		else ss<<s[i];
	}
		
	string t;
	ss>>t;
	// cout<<"after "<<t<<endl;
	if(f) return solve(t);
	else{
		if(s[0]==s[2]) return true;
	}
	return false;
	// stringstream ss2;
	// s=t;
	// rep(i,s.size()-4){
		// if(s[i]=='('&&(s[i+1]=='T'||s[i+1]=='F')&&s[i+2]=='*'&&(s[i+3]=='T'||s[i+3]=='F')&&s[i+4]==')'){
			// f=true;
			// if(s[i+1]=='F'||s[i+3]=='F') ss2<<'F';
			// else ss2<<'T';
			// i+=4;
		// }
		// else{
			// ss2<<s[i];
			// if(i==s.size()-5){
				// ss2<<s.substr(i+1);
			// }
		// }
	// }
	// string t2;
	// ss2>>t2;
	// stringstream ss3;
	// if(f) return solve(t2);
	// rep(i,s.size()-5){
		// if(s[i]=='('&&(s[i+1]=='T'||s[i+1]=='F')&&s[i+2]=='-'&&s[i+3]=='>'&&(s[i+4]=='T'||s[i+4]=='F')&&s[i+5]==')'){
			// f=true;
			// if(s[i+1]=='T'&&s[i+4]=='F') ss3<<'F';
			// else ss3<<'T';
			// i+=5;
		// }
		// else{
			// ss3<<s[i];
			// if(i==s.size()-6){
				// ss3<<s.substr(i+1);
			// }
		// }
	// }
	// string t3;
	// ss3>>t3;
	// if(f) return solve(t3);
	// s=t3;
	// if()

}

int main(){
	string s;
	while(cin>>s,s!="#"){
		int c=0;
		rep(i,s.size()){
			if(s[i]=='F') s[i]='Z';
		}
		rep(i,'k'-'a'+1){
			char t=i+'a';
			rep(j,s.size()){
				if(s[j]==t){
					rep(k,s.size()){
						if(s[k]==t) s[k]='G'+c;
					}
					c++;
					break;
				}
			}
		}
		rep(i,s.size()){
			if(s[i]=='Z') s[i]='F';
		}
		// cout<<s<<endl;
		// cout<<(1<<c)<<endl;
		int lim=(1<<c);
		// cout<<t<<endl;
		bool f=true;
		rep(i,lim){
			string tmp=s;
			rep(j,tmp.size()){
				if(tmp[j]>='G'&&tmp[j]<='G'+c){
					if(i&1<<(tmp[j]-'G')){
						// cout<<tmp[j]<<" = T"<<endl;
						tmp[j]='T';
					}
					else{
						// cout<<tmp[j]<<" = F"<<endl;
						tmp[j]='F';
					}
				}
			}
			// cout<<endl;
			// cout<<tmp<<endl;
			if(!solve(tmp)){
				f=false;
				break;
			}
		}
		if(f) cout<<"YES\n";
		else cout<<"NO\n";
		// cout<<s<<endl;
	}
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b;
  cin>>a>>b;
  int sum=a;
  int count =1;
  if(b==1){
    cout<<0<<endl;
    return 0;
  }
  for (int i = 0; i < 20; i++) {
 if(sum<b){
   sum +=a-1;
   count++;
 }
    else{
      break;
    }
}
cout<<count<<endl;
 
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
ll n,k=1e17,a;
int main(void){
    cin>>n;
    for(int i=0;i<5;i++){
        cin>>a;
        k=min(k,a);
    }
    cout<<4+(n+k-1)/k<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());
#define vecmin(A) *min_element(A.begin(),A.end());
#define vecmax(A) *max_element(A.begin(),A.end());
typedef long long ll;

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  string ans = (b*2 == a+c) ? "YES" : "NO";
  cout << ans << endl;
}

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

int main() {
  int n, p; cin >> n;
  vector<tuple<string, int, int>> vec(n+1);
  for (int i = 1; i <= n; i++) {
    string S;
    cin >> S >> p;
    p = -p;
    vec.at(i) = tie(S, p, i);
  }

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

  for (int i = 1; i <= n; i++) {
    int number = get<2>(vec.at(i));
    cout << number << endl;
  }
  
}


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

int main()
{
	long long int N,A[103],i,z=0;
        cin>>N;
	
	for(i=0;i<N;i++)
	{
		cin>>A[i];

		if(A[i]%2==0)
		{
			if(A[i]%3==0 || A[i]%5==0)
				z++;
		}
		else
			z++;
	}

	if(z==N)
		cout<<"APPROVED"<<endl;
        else
		cout<<"DENIED"<<endl;

	return 0;
}




Measured memory_bytes: 256
MOD = 10**9 + 7
def main():
    n, m = map(int, input().split())
    n, m = n-1, m-1
    x = list(map(int, input().split()))
    y = list(map(int, input().split()))
    a, b = 0, 0
    for i in range(n):
        tmp = (x[i+1] - x[i])
        tmp *= (1+i) * (n-i) % MOD
        a += tmp
        a %= MOD
    for i in range(m):
        tmp = (y[i+1] - y[i])
        tmp *= (1+i) * (m-i) % MOD
        b += tmp
        b %= MOD
    print(a*b % MOD)

if __name__ == "__main__":
    main()

Measured memory_bytes: 18624
#include<bits/stdc++.h>
#include<iostream>
#include<fstream>
#define ll long long
using namespace std;

int main(){
    string S;  cin >> S;
    if(S[0]==S[1] && S[2]==S[3] && S[0] != S[2]){
        cout << "Yes" << endl;
        return 0;
    }else if(S[0]==S[2] && S[1]==S[3] && S[0] != S[1]){
        cout << "Yes" << endl;
        return 0;
    }else if(S[0]==S[3] && S[1]==S[2] && S[0] != S[1]){
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
}


Measured memory_bytes: 768
import java.lang.reflect.Array;
import java.util.*;
import java.io.*;
import java.lang.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        String s = sc.next();

        if (s.charAt(2) == s.charAt(3) && s.charAt(4) == s.charAt(5))
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}


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

const ll INF=1e12+1;

int main() {
  int a,b,q;
  cin>>a>>b>>q;
  vector<ll> s(a),t(b),x(q);
  vector<ll> ans(q, INF);
  rep(i, a) cin>>s[i];
  rep(i, b) cin>>t[i];
  rep(i, q) cin>>x[i];

  sort(s.begin(), s.end());
  sort(t.begin(), t.end());
  rep(i, q) {
    int u=lower_bound(s.begin(), s.end(), x[i])-s.begin();
    int v=lower_bound(t.begin(), t.end(), x[i])-t.begin();
    if (s[0]<x[i]&&t[0]<x[i]) ans[i]=min(ans[i], max(x[i]-s[u-1], x[i]-t[v-1]));
    if (s[a-1]>x[i]&&t[b-1]>x[i]) ans[i]=min(ans[i], max(s[u]-x[i], t[v]-x[i]));
    ll temple=INF;
    ll shrine=INF;
    if (s[0]<x[i]) temple=min(temple, x[i]-s[u-1]);
    if (s[a-1]>x[i]) temple=min(temple, s[u]-x[i]);
    if (t[0]<x[i]) shrine=min(shrine, x[i]-t[v-1]);
    if (t[b-1]>x[i]) shrine=min(shrine, t[v]-x[i]);
    ans[i]=min(ans[i], temple*2+shrine);
    ans[i]=min(ans[i], temple+2*shrine);
  }
  rep(i, q) cout<<ans[i]<<endl;
  return 0;
}

Measured memory_bytes: 4480
#define	_USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cctype>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <set>
#include <complex>
#include <utility>
#include <numeric>
#include <bitset>
using namespace std;
const int INF=1<<30;


typedef pair<int,int> P;

int main(){
	
	int n,k;
	cin>>n>>k;
	char d[10];
	for(int i=0;i<k;i++)
		cin>>d[i];
	bool f=false;
	while(!f){
		string s;
		s=to_string(n);
		for(int i=0;i<s.size();i++){
			for(int j=0;j<k;j++){
				if(s[i]==d[j]){
					f=true;
					break;
				}
			}
		}
		if(!f){
			cout<<n<<endl;
			f=true;
		}
		else{
			f=false;
			n++;
		}
	}
	

}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline


def main():
    N = int(input())
    S = input().strip()
    ma = 0
    for i in range(1, len(S)-1):
        ma = max(ma, len(set(S[:i]) & set(S[i:])))
    print(ma)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <iostream>
#include <bits/stdc++.h>
#include <time.h>
#include <sys/timeb.h>
#include <cstdio>
#include <sys/time.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define ulong unsigned long long int

template<typename T> bool InRange(T t, T l, T r){ return l <= t && t < r; }

int main(){
	
	int N, M;
	cin >> N >> M;
	vector<int> A(M), B(M);
	vector<ll> C(M);
	for(int i=0;i<M;i++) cin >> A[i] >> B[i] >> C[i];
	for(int i=0;i<M;i++) { A[i]--; B[i]--; }
	
	ll Inf = (ll) 1e18;
	vector<ll> dp(N, -Inf);
	dp[0] = 0;
	for(int i=0;i<N;i++){
		for(int j=0;j<M;j++){
			int a = A[j];
			int b = B[j];
			ll c = C[j];
			if(dp[a] != -Inf){
				dp[b] = max(dp[b], dp[a] + c);
			}
		}
	}
	
	vector<ll> dp2(N);
	for(int i=0;i<N;i++) dp2[i] = dp[i];
	for(int i=0;i<N;i++){
		for(int j=0;j<M;j++){
			int a = A[j];
			int b = B[j];
			ll c = C[j];
			if(dp2[a] != -Inf){
				dp2[b] = max(dp2[b], dp2[a] + c);
			}
		}
	}
	
	cout <<  (dp2[N-1] <= dp[N-1] ? to_string(dp[N-1]) : "inf") << endl;
	
	
	
	
    return 0;
}

Measured memory_bytes: 256
s = input()
n = len(s)

for i in range(n):
    if s[i] != s[n - i - 1]:
        print('No')
        break
else:
    last = (n - 1) // 2
    for i in range(last):
        if s[i] != s[last - i - 1]:
            print('No')
            break
    else:
        start = ((n + 3) // 2) - 1
        for i in range(start, n):
            if s[i] != s[last + start - i - 1]:
                print('No')
                break
        else:
            print('Yes')

Measured memory_bytes: 8920
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef long long LL;
const int modn=1e9+7;
const int maxn=2e5+10;
int a[maxn]={0};
char c[maxn];
int main(){
	int n;
	ll sum=1;
	ll num=0;
	scanf("%d",&n);
	scanf(" %s",c+1);
	for(int i=1;i<=n*2;i++){
		if(c[i]=='W'){
			if(num&1)num++;
			else {
				sum=sum*num%modn;
				num--;
			}
		}
		else {
			if(num&1){
				sum=sum*num%modn;
				num--;
			}
			else num++;
		}
	}
	if(num!=0){
		cout<<'0'<<endl;
		return 0;
	}
	for(ll i=1;i<=n;i++)sum=sum*i%modn;
	cout<<sum<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define ALL(x) (x).begin(),(x).end()
const long long MOD = 1000000007;
const long long INF = 1LL << 60;

int main(){
	int N;
	cin >> N;
	vector<int> B(N - 1);
	vector<int> A(N, 0);
	rep(i, N - 1)cin >> B[i];
	A[0] = B[0];
	A[N - 1] = B[N - 2];
	
	for(int i = 1; i < N - 1; i++){
		A[i] = min(B[i - 1], B[i]);
	}
	
	int ans = 0;
	rep(i, N)ans += A[i];
	cout << ans << endl;
}

Measured memory_bytes: 256
N,K = map(int,input().split())
M = 10**9+7
ans = 0
for i in range(K,N+1):
    if i == K:t = sum(range(N-i+1,N+1))-sum(range(0,i))
    else: t+=N-(i-1)-(i-1)
    # print(t)
    t%=M
    ans +=t+1
    ans%=M
    # print(00,sum(range(N-i+1,N+1)),sum(range(0,i)))


print(ans+1)


Measured memory_bytes: 9192
# 解説を読んで実装

sx, sy, tx, ty = list(map(int, input().split()))

dx, dy = tx - sx, ty - sy

sx = 'R'
sy = 'U'

trans = str.maketrans('UDRL', 'DULR')
def rev(s):
    return s.translate(trans)

first = sx * dx + sy * dy
print(first, end='')
print(rev(first), end='')

second = rev(sy) + sx + first + sy + rev(sx)
print(second, end='')
print(rev(second), end='')




Measured memory_bytes: 3064
#include <algorithm>
#include <complex>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  if (a <= 8 && b <= 8) {
    cout << "Yay!" << endl;
  } else {
    cout << ":(" << endl;
  }
  return 0;
}


Measured memory_bytes: 888
from math import *
N,D = map(int,input().split())
lst = [[int(kk) for kk in input().split()] for aa in range(N)]
tot = 0
c = 0

for a in range(1,N):
    for b in range(a):
        c = 0
        for i in range(D):
            c += (lst[a][i] - lst[b][i])**2
        if sqrt(c) == int(sqrt(c)):
            tot += 1
print(tot)


Measured memory_bytes: 38384
// template version 1.15
using namespace std;
#include <bits/stdc++.h>

// varibable settings
#define int long long
const int INF=1e18;

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define divceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
  #define cerrendl 42
#endif
//}}}

signed main() {
  int n,k;cin>>n>>k;
  vector<int> h(n);
  rep(i, n) {
    cin>>h[i];
  }
  sort(all(h));
  dump(h);

  int res = 0;
  rep(i, n-k){
    res += h[i];
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const long long INF = (long long)1e18+1;
#define DIV 1000000007
//#define TEST
vector<ll> v;

void dfs(int k, ll x)
{
    // 初期値 x: 1 ~ 9
    v.push_back(x);
    if(k>=9) return;
    // 1の位
	int a=x%10;
    // 桁下がりしない数 0でない
    // x:10倍した数: 10, 20, 30,..., 90 + 前後の数
    if(a){
		dfs(k+1, x*10+a-1);
	}
	dfs(k+1, x*10+a);
    // 桁上がりしない数 9でない
	if(a<9){
		dfs(k+1, x*10+a+1);
	}
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    long idx=0;
    ll K;
    cin >> K;
    for(int i=1; i<=9; i++) dfs(0, i);
    //手に入れた　v には順序の不整合や重複があるので除く
	sort(v.begin(), v.end());
    // std::unique
    // 隣り合った重複要素を除いた要素を、範囲の先頭に集める
    // この関数によってコンテナから直接要素が削除され、コンテナの要素数が減るようなことはない
    // 戻り値：重複を除いた範囲の、末尾の次を指すイテレータ
	v.erase(unique(v.begin(), v.end()), v.end());
	cout<<v[K-1]<<endl;

#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 2420
n,k = map(int,input().split())
p = tuple(map(int,input().split()))

class Seg_min():
    def __init__(self,x):
        #####単位元######
        self.ide_ele_min = 10**10
        self.func = min

        self.n = len(x)

        #num_max:n以上の最小の2のべき乗
        self.num_max =2**(self.n-1).bit_length()
        self.x = [self.ide_ele_min]*2*self.num_max

        for i,num in enumerate(x, self.num_max):
            self.x[i] = num
        for i in range(self.num_max-1,0,-1):
            self.x[i] = self.func(self.x[i<<1],self.x[(i<<1) + 1])

    def update(self,i,x):
        i += self.num_max
        self.x[i] = x
        while(x>0):
            i = i//2
            self.x[i] = self.func(self.x[i<<1],self.x[(i<<1) + 1])

    def query(self,i,j):
        res = self.ide_ele_min
        if i>=j:
            return res
        i += self.num_max
        j += self.num_max -1
        while(i<=j):
            if(i==j):
                res = self.func(res,self.x[i])
                break
            if(i&1):
                res = self.func(res,self.x[i])
                i += 1
            if(not j&1):
                res = self.func(res,self.x[j])
                j -= 1
            i = i>>1
            j = j>>1
        return res

class Seg_max():
    def __init__(self,x):
        #####単位元######
        self.ide_ele_min = 10**10 * -1
        self.func = max

        self.n = len(x)

        #num_max:n以上の最小の2のべき乗
        self.num_max =2**(self.n-1).bit_length()
        self.x = [self.ide_ele_min]*2*self.num_max

        for i,num in enumerate(x, self.num_max):
            self.x[i] = num
        for i in range(self.num_max-1,0,-1):
            self.x[i] = self.func(self.x[i<<1],self.x[(i<<1) + 1])

    def update(self,i,x):
        i += self.num_max
        self.x[i] = x
        while(x>0):
            i = i//2
            self.x[i] = self.func(self.x[i<<1],self.x[(i<<1) + 1])

    def query(self,i,j):
        res = self.ide_ele_min
        if i>=j:
            return res
        i += self.num_max
        j += self.num_max -1
        while(i<=j):
            if(i==j):
                res = self.func(res,self.x[i])
                break
            if(i&1):
                res = self.func(res,self.x[i])
                i += 1
            if(not j&1):
                res = self.func(res,self.x[j])
                j -= 1
            i = i>>1
            j = j>>1
        return res

seg_min = Seg_min(p)
seg_max = Seg_max(p)

natural = 0
ans = 0

head = 0
for i in range(1,n):
    if(p[i]<p[i-1]):
        head = i

    if(i-head >= k-1):
        natural = 1
        continue

    if(i==k-1):
        ans +=1
    if(i<k):
        continue
    ans += 1

    left = seg_min.query(i-k,i)
    right = seg_max.query(i-k+1,i+1)
    if(left==p[i-k])&(right==p[i]):
        ans -= 1

print(ans+natural)

Measured memory_bytes: 113740
S = list(input())
N = len(S)
S.append('R')
ans = [0]*N

#cnt for RL
cnt = [0,0]
l = 'R'
for i in range(N):
  if S[i] == l:
    cnt[0] += 1
  elif S[i] == S[i+1]:
    cnt[1] += 1
  else:
    cnt[1] += 1
    r1 = cnt[0]//2
    r2 = cnt[1]//2
    ans[i-cnt[1]] = cnt[0] - r1 + r2
    ans[i-cnt[1]+1] = cnt[1] - r2 + r1
    cnt=[0,0]
print(' '.join(str(n) for n in ans))

Measured memory_bytes: 87068
#include <iostream>
#include <cmath>

struct coordinate{
    double x;
    double y;
};

void koch(int depth, coordinate start, coordinate end);

int main() {
    int depth;
    coordinate start, end;
    start.x = 0.0;
    start.y = 0.0;
    end.x = 100.0;
    end.y = 0.0;

    std::cin >> depth;

    std::cout.precision(8);

    std::cout << std::fixed << start.x << " " << start.y << std::endl;
    koch(depth, start, end);
    std::cout << std::fixed << end.x << " " << end.y << std::endl;

    return 0;
}

void koch(int depth, coordinate start, coordinate end) {
    if (depth == 0) {
        return;
    }

    coordinate s, u, t;
    s.x = (2 * start.x + end.x) / 3;
    s.y = (2 * start.y + end.y) / 3;
    t.x = (start.x + 2 * end.x) / 3;
    t.y = (start.y + 2 * end.y) / 3;
    u.x = (t.x - s.x) / 2 - (t.y - s.y) * sqrt(3) / 2 + s.x;
    u.y = (t.x - s.x) * sqrt(3) / 2 + (t.y - s.y) / 2 + s.y;

    std::cout.precision(8);

    koch(depth - 1, start, s);

    std::cout << std::fixed << s.x << " " << s.y << std::endl;

    koch(depth - 1, s, u);

    std::cout << std::fixed << u.x << " " << u.y << std::endl;

    koch(depth - 1, u, t);

    std::cout << std::fixed << t.x << " " << t.y << std::endl;

    koch(depth - 1, t, end);
}


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

using namespace std;
typedef int64_t ll;
typedef uint64_t ull;
typedef long double ld;

int main() {
#ifdef cute
	freopen("in", "r", stdin);
#endif
	ios::sync_with_stdio(false);
	cin.tie(NULL);

	
	ll n;
	cin >> n;
	string s;
	cin >> s;

	for(char &c: s) {
		c += n;
		while(c > 'Z') c -= 26;
		cout << c;
	}


#ifdef cute
	cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << " ms.\n";
#endif
}

/* stuff you should look for
	* array bounds
	* special cases (n=1?), set tle
	* do sth instead of nothing and stay organized
	* check for variables with close names

g++ .cpp -o .exe -O2 -std=c++11 -D cute
*/



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

int main(){
  int n; cin>>n;
  vector<int> x(n),y(n);
  REP(i,n) cin>>x[i]>>y[i];
  
  // 初期順列
  vector<int> order(n);
  for (int i = 0; i < n; ++i) order[i] = i;

  // 探索
  long double sum=0;
  int cnt=0;
  do{
    /* 順序 order についての距離を加算 */
    REP(i,n-1){
      sum+=sqrtl(pow(x[order[i+1]]-x[order[i]],2)+pow(y[order[i+1]]-y[order[i]],2));
    }
    cnt++;
  } while (next_permutation(order.begin(), order.end()));
  
  cout << fixed << setprecision(10) << sum/(long double)(cnt) << endl;
}

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

int main(){
    int n,l,r;
    while(cin >>n >>l >>r,n){
        vector<int> a(n);
        rep(i,n) cin >>a[i];

        auto is_uruu = [&](int x){
            rep(i,n)if(x%a[i]==0) return !(i%2);
            return !(n%2);
        };

        int ans = 0;
        for(int i=l; i<=r; ++i) ans += is_uruu(i);
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 3100
package main

import (
	"fmt"
	"math"
)

func main() {
	var s string
	fmt.Scan(&s)

	c0, c1 := 0, 0
	for pos, r := range s  {
		if pos % 2 == 0 {
			if r == '0' {
				c1++
			} else {
				c0++
			}
		} else {
			if r == '0' {
				c0++
			} else {
				c1++
			}
		}
	}

	fmt.Println(int(math.Min(float64(c0), float64(c1))))
}

Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
// #include <bit>
// #include <bitset>
// #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;

int main()
{
	ll n;
	cin >> n;
	ll a[n];
	ll b[n];
	ll c[n];

	rep(i, n)
	{
		cin >> a[i];
	}
	rep(i, n)
	{
		cin >> b[i];
	}
	rep(i, n)
	{
		cin >> c[i];
	}
	sort(a, a + n);
	sort(b, b + n);
	sort(c, c + n);

	ll ans = 0;
	rep(i, n)
	{
		ll middle = b[i];
		ll a_index = lower_bound(a, a + n, middle) - a;
		ll b_index = upper_bound(c, c + n, middle) - c;

		ans += a_index * (n - b_index);
	}

	cout << ans << endl;
}

//g++ -std=c++17 -g main.cpp -o mai	n

Measured memory_bytes: 5496
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
//#include<set>
#include<algorithm>
//#include<math.h>
//#include<iostream>
//#include<time.h>
using namespace std;

#define LL long long
int qread()
{
	char c; int s=0,t=1; while ((c=getchar())<'0' || c>'9') (c=='-') && (t=-1);
	do s=s*10+c-'0'; while ((c=getchar())>='0' && c<='9'); return s*t;
}

//Pay attention to read!

int a,b,c; LL K;
int main()
{
	scanf("%d%d%d%lld",&a,&b,&c,&K);
	if (K&1) printf("%d\n",b-a);
	else printf("%d\n",a-b);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
    unsigned long long int n,weight,i,j;
    static unsigned long long int w[103],v[103],t[100002][103];
    cin>>n>>weight;
    for(i=0;i<n;i++)
        cin>>w[i]>>v[i];
    for(i=0;i<=weight;i++)
        t[i][0]=0;
    for(i=0;i<=weight;i++)
        t[0][i]=0;
    for(i=1;i<=weight;i++)
    {
        for(j=1;j<=n;j++)
        {
            t[i][j]=t[i][j-1];
            if(i>=w[j-1])
            {
                t[i][j]=max(t[i][j-1],t[i-w[j-1]][j-1]+v[j-1]);
            }
        }
    }
    cout<<t[weight][n]<<endl;
    return 0;
}


Measured memory_bytes: 84100
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

void solve(){
    ll N,M,K;
    cin >> N >> M >> K;
    ll A[200010], B[200010];
    rep(i,0,N) cin >> A[i];
    rep(i,0,M) cin >> B[i];
    ll sum = 0;
    ll ans = 0;
    ll bsum[200010] = {};
    rep(i,0,M) bsum[i+1] = bsum[i] + B[i];
    ll lv = 0, rv = M+1;
    while(rv - lv > 1){
        ll mid = (rv + lv) / 2;
        if(bsum[mid] > K){
            rv = mid;
        }else{
            lv = mid;
        }
    }
    ans = max(ans, lv);

    rep(i,0,N){
        sum += A[i];
        if(sum > K) break;
        ll diff = K - sum;
        ll lv = 0, rv = M+1;
        while(rv - lv > 1){
            ll mid = (rv + lv) / 2;
            if(bsum[mid] > diff){
                rv = mid;
            }else{
                lv = mid;
            }
        }
        ans = max(ans, i+1+lv);

    }
    print(ans);

}

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

Measured memory_bytes: 8328
// By Mohit Gupta
#include <bits/stdc++.h>
using namespace std;
#define printint(v) copy(begin(v), end(v), ostream_iterator<int>(cout," "))
#define printintv(s,e) copy(s,e, ostream_iterator<int>(cout," "))
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define clz(a) __builtin_clz(a) // count leading zeroes
#define ctz(a) __builtin_ctz(a) // count trailing zeroes
#define popc(a) __builtin_popcount(a) // count set bits (for ints only diff for ll)
//https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html for other in built
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef pair<int,int> p32; 
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
typedef map<int,int> m32;
#pragma GCC optimize ("-O2")
const int LIM = 5e5+5, MOD = 1e9+7;
int t,n,m,k,x,y;
 
 
int main()
{
	IOS;
	string a,b;
	cin>>n;
	cin>>a>>b;
	forn(i,n){
		cout<<a[i]<<b[i];
	}
	cout<<ln;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
mod = 10**9 + 7

num = [0] * (k+1)
for i in range(k, 0, -1):
    x = pow(k//i, n, mod) - sum(num[::i])
    num[i] = x

print(sum(i*j%mod for i, j in enumerate(num))% mod)


Measured memory_bytes: 12056
k = 0
A,B,C = map(int,input().split( ))
K = int(input())
while  (B <= A) and (k < K):
    B *= 2
    k += 1
while (C <= B) and (k < K):
    C *= 2
    k += 1
if A < B < C:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9180
#include <map>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define N 200006
using namespace std;
struct arr{int x,y;}e[N];
int n,mi,ma,mima,mami;long long ans;
bool cmp(arr x,arr y)
{
	if(x.x==y.x)return x.y<y.y;
	return x.x<y.x;
}
int main()
{
	scanf("%d",&n);
	mi=mami=1000000000;
	for(int i=1;i<=n;i++){
		scanf("%d%d",&e[i].x,&e[i].y);
		if(e[i].x>e[i].y)swap(e[i].x,e[i].y);
		mi=min(mi,e[i].x);ma=max(ma,e[i].y);
		mima=max(mima,e[i].x);mami=min(mami,e[i].y);
	}
	sort(e+1,e+n+1,cmp);ans=1LL*(mima-mi)*(ma-mami);
	mami=1000000000;
	for(int i=1;i<=n;i++){
		if(e[i].x>mami){
			ans=min(ans,1LL*(ma-mi)*(mima-mami));
			break;
		}
		ans=min(ans,1LL*(ma-mi)*(mima-e[i].x));
		mima=max(mima,e[i].y);mami=min(mami,e[i].y);
	}
	printf("%lld\n",ans);
}

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

int main() {

    int N ;

    cin >> N ;

    vector<int> A(N);

    vector<int> B(N);

    for(int i = 0 ; i < N ; i++){

        B[i] =i+1 ;
    }

    for(int i = 0 ; i < N ; i++){

        while(true){

                if(B[i] % 2 == 0){

                 A[i]++;
                 B[i] /= 2 ; 
                }
                else break;    
             
             }

        }

    sort(A.begin() , A.end());
    reverse(A.begin() , A.end());



    int ans = 1;

    for(int i =0 ; i < A[0] ; i++){

        ans *=2;
    }

    cout << ans << endl ;
}


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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String str;
		int tmp;
		int ans = 2000000000;
		for(int i = 0; i < S.length() - 2; i++) {
			str = S.substring(i, i+3);
			tmp = Math.abs(753 - Integer.parseInt(str));
			if(tmp < ans) {
				ans = tmp;
			}
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 22996
h,w=gets.chomp.split(" ").map(&:to_i)
coin=Array.new(h).map{Array.new(w)}
ans=[]
sum=0
for i in 0..(h-1) do
  arr=gets.chomp.split(" ").map(&:to_i)
  for j in 0..(w-1) do
    coin[i][j]=arr[j]
  end
end
for i in 0..h-1
  case i%2
  when 0 then
    for j in 0..w-1 do
      if coin[i][j]%2==1 then
        coin[i][j]-=1
         if j==(w-1) then
           if i!=(h-1) then
             coin[i+1][j]+=1
             ans.push("#{i+1} #{j+1} #{i+2} #{j+1}")
             sum+=1
           end
         else
           coin[i][j+1]+=1
           ans.push("#{i+1} #{j+1} #{i+1} #{j+2}")
           sum+=1
         end
       end
    end
  when 1 then
    for j in 0..w-1 do
      if coin[i][w-1-j]%2==1 then
        coin[i][w-1-j]-=1
         if j==(w-1) then
           if i!=(h-1) then
             coin[i+1][w-1-j]+=1
             ans.push("#{i+1} #{w-j} #{i+2} #{w-j}")
             sum+=1
           end
         else
           coin[i][w-2-j]+=1
           ans.push("#{i+1} #{w-j} #{i+1} #{w-1-j}")
           sum+=1
         end
       end
    end
  end
end
puts sum
puts ans

Measured memory_bytes: 17660
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define MOD (int)(1e9 + 7)

int main()
{
    int n;
    cin >> n;
    vector<double> probs;
    double w;
    for (int q = 0; q < n; q++)
    {
        cin >> w;
        probs.push_back(w);
    }
    double dp[n][n+1];
    dp[0][0]=1-probs[0];
    dp[0][1]=probs[0];
    for (int q = 2; q < n; q++)
    {
        dp[0][q]=0;
    }
    for (int q = 1; q < n; q++)
    {
        for (int e = 0; e < n+1; e++)
        {
            if (e==0)
            {
                dp[q][e]=(1-probs[q])*dp[q-1][e];
            }
            else
            {
                dp[q][e]=probs[q]*dp[q-1][e-1]+(1-probs[q])*dp[q-1][e];
            }
        }
    }
    double total = 0;
    for (int q = (n+1)/2; q < n+1; q++)
    {
        total += dp[n-1][q];
    }
    cout.precision(15);
    cout << total;
    return 0;
}


Measured memory_bytes: 70656
s=gets.to_i
for i in 1..s
    gets.chomp
    num=[]
    8.times do
        num<<gets.chomp.split(//).map(&:to_i)
    end
    x=gets.to_i-1
    y=gets.to_i-1
    
    check=[x,y]
    until check.empty?
        y=check.pop
        x=check.pop
        
        (-3).upto(3) do |t|
            if (x+t)<8 && 0<=(x+t) && num[y][x+t]==1
                check<<(x+t).to_i
                check<<y.to_i
                num[y][x+t]=0
            end
            if (y+t)<8 && 0<=(y+t) && num[y+t][x]==1
                check<<x.to_i
                check<<(y+t).to_i
                num[y+t][x]=0
            end
        end
    end
    puts "Data #{i}:"
    8.times{ |t| puts num[t].join}
end

Measured memory_bytes: 6124
#include <iostream>
#include <cstring>
#include <string>
#include <sstream>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <functional>

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

using namespace std;

char buf[1024];

int main() {
  int k, x;

  fgets(buf, sizeof(buf), stdin);
  sscanf(buf, "%d %d", &k, &x);

  for (int i = x -k + 1; i < x + k; i ++) {
    if (i < x + k - 1) {
      cout << i << ' ';
    } else {
      cout << i << endl;
    }
  }
}



Measured memory_bytes: 384
m=list(map(int, input().split()))
rei=list(map(int, input().split())) 
den=list(map(int, input().split())) 
cou = [0] * m[2]
ans = []
for i in range(m[2]):
	cou[i]=list(map(int, input().split()))
	ans.append(rei[cou[i][0]-1]+den[cou[i][1]-1]-cou[i][2])

ans.append(min(rei)+min(den))
print(min(ans))

Measured memory_bytes: 42432
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#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 all(x) (x).begin(), (x).end()
#define F first
#define S second
typedef vector<long long> V;
typedef vector<V> VV;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<28;
void solve(int a){cout<<( a?"Yes":"No")<<endl;}
int main(){
    int a,b;
    int ans=-1;
    cin >>a>>b;
    int y=0;
    for(double i=0.0;i<=10000.0;i++){
        if (int(double(i) * 0.08) == a and int(double(i) * 0.10) == b){
            ans=i;
            cout << ans << endl;
            return 0;
        }
    }
        cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
	long sum = 0;
	long num = 0;
	long avr;
	int n = 0;
	int a, b;

	while(scanf("%d,%d", &a, &b) != EOF) {
		sum += a * b;
		num += b;
		n++;
	}

	if((double)(num % n) / n < 0.5)
		avr = num / n;
	else
		avr = num / n + 1;

	printf("%ld\n%ld\n", sum, avr);
	return 0;
}

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


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

    vector<int> T(N, 0);
    for (int i = 1; i < N; i++) {
        T[i] += T[i - 1];
        if (S[i - 1] == 'A' && S[i] == 'C') T[i]++;
    }

    int l, r;
    rep(_, Q) {
        cin >> l >> r;
        cout << T[r - 1] - T[l - 1] << '\n';
    }

    return 0;
}

Measured memory_bytes: 3784
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int t;
    double sum = 0;
    cin >> t;
    double a;
    
    for(int i=0; i<t; ++i){
        cin >> a;
        sum += 1/a;
    }
    
    cout << 1/sum << "\n";
  
    return 0;
}

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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int

int main(){
int n,k;
cin>>n>>k;
int d[k];
map<int,int>m;
rep(i,k){
cin>>d[i];
int A[k][d[i]];
rep(j,d[i]){
  cin>>A[i][j];
  m[A[i][j]]++;
}}
int count=0;
for(int i=1;i<=n;i++){
if(m[i]==0){
  count++;

}

}

cout<<count<<endl;

  return 0;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,x,n) for(int i=x;i<n;i++)
#define pb push_back
#define int long long
#define MAX 2000006
#define NIL -1
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


signed main(){
  int n;
  cin>>n;
  map<string,bool> mp;
  rep(i,n){
    string s,t;
    cin>>s>>t;
    if(s=="insert"){
      mp[string(t)]=true;
    }
    else{
      if(mp[string(t)])cout<<"yes"<<endl;
      else cout<<"no"<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 52500
let scan_string () = Scanf.scanf " %s" (fun x -> x)
let print_int n = Printf.printf "%d\n" n

let calc s =
  if s = "SUN" then 7
  else if s = "MON" then 6
  else if s = "TUE" then 5
  else if s = "WED" then 4
  else if s = "THU" then 3
  else if s = "FRI" then 2
  else 1

let () =
  let s = scan_string() in
  print_int (calc s)

Measured memory_bytes: 2432
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
#define MOD 1000000007LL

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N;
  cin >> N;
  vll A(N);
  ll ans = 0;
  for(int i = 0; i < N; i++){
    cin >> A.at(i);
  }
  for(int i = 0; i < N-1; i++){
    ans += A.at(i)/2;
    A.at(i) %= 2;
    if(A.at(i) == 1 && A.at(i+1) != 0){
      ans++;
      A.at(i)--; A.at(i+1)--;
    }
  }
  ans += A.at(N-1) / 2;
  cout << ans << "\n";
}

Measured memory_bytes: 1024
import itertools

def getint(): return int(input())
def getints(): return list(map(int, input().split()))

n=getint()
a=getints()
b=getints()

res = 0

for i in range(n):
    kill = min(a[i],b[i])
    res += kill
    can = b[i]-kill
    nxt_kill = min(a[i+1], can)
    res += nxt_kill
    a[i+1] -= nxt_kill

print(res)


Measured memory_bytes: 19284