akhauriyash/Code-Regression huggingface dataset:
//Optimise
#include <bits/stdc++.h>
using namespace std;

// #define multitest 1
#ifdef Debug
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__);
template <typename Arg1>
void ZZ(const char *name, Arg1 &&arg1)
{
	std::cerr << name << " = " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void ZZ(const char *names, Arg1 &&arg1, Args &&... args)
{
	const char *comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}
#else
#define db(...)
#endif

using ll = long long;
#define f first
#define s second
#define pb push_back
const long long mod = 1000000007;
auto TimeStart = chrono::steady_clock::now();

const int nax = 2e5 + 10;

void solve()
{
	int n, d;
	cin >> n >> d;
	cout << ceil(double(n) / (2 * d + 1));
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int t = 1;
#ifdef multitest
	cin >> t;
#endif
	while (t--)
		solve();
#ifdef TIME
	cerr << "\n\nTime elapsed: " << chrono::duration<double>(chrono::steady_clock::now() - TimeStart).count() << " seconds.\n";
#endif
	return 0;
}

Measured memory_bytes: 256
n = int(input())
if n == 111 or 119 or 191 or 199 or 911 or 919 or 991 or 999:
    moji = str(n)
    li = list(moji)
    for i in range(len(li)):
        if li[i] == '1':
            li[i] = '9'
        else:
            li[i] = '1'
    moji = "".join(li)
    n = int(moji)
    print(n)
else:
    print('hoge!')

Measured memory_bytes: 3064
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        Integer a[] = new Integer[N];
        for (int i=0; i<N; i++) {
            a[i] = Integer.parseInt(sc.next());
        }
        sc.close();
        Arrays.sort(a, Comparator.reverseOrder());

        player Alice = new player("Alice", 0);
        player Bob = new player("Bob", 0);
        for (int i=0; i<N; i+=2) {
            Alice.addSum(a[i]);
        }
        for (int i=1; i<N; i+=2) {
            Bob.addSum(a[i]);
        }
        System.out.println(Alice.getSum() - Bob.getSum());
    }
}

class player {
    private String name;
    private int sum;

    public player(String name, int sum) {
        this.name = name;
        this.sum = sum;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void addSum(int sum) {
        this.sum += sum;
    }

    public int getSum() {
        return this.sum;
    }
}

Measured memory_bytes: 24916
#include<bits/stdc++.h>
using namespace std;
#define LL long long

int n,m,r[500010],d[500010];
char s[500010];
vector<int> a[500010];

int main()
{
    scanf("%s",s+1);
    n=strlen(s+1)+1;
    memset(r,0,sizeof(r));
    for (int i=1;i<n;i++)
        if (s[i]=='<') a[i].push_back(i+1),r[i+1]++;
        else a[i+1].push_back(i),r[i]++;
    queue<int> q;
    for (int i=1;i<=n;i++)
        if (r[i]==0) d[i]=0,q.push(i);
    while(!q.empty())
    {
        int x=q.front();q.pop();
        for (auto y:a[x])
        {
            r[y]--;
            if (r[y]==0) d[y]=d[x]+1,q.push(y);
        }
    }
    LL ans=0;
    for (int i=1;i<=n;i++)
        ans+=(LL)d[i];
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 32000
fun main(args: Array<String>) {
    val input = readLine()!!.split(' ').map(String::toInt)
    val a = input[0]
    val b = input[1]
    val c = input[2]
    val d = input[3]
    val e = input[4]
    val f = input[5]
    var maxconc = 0.0
    var maxt = a * 100
    var maxs = 0
    for (an in 0..f step 100 * a) {
        for (bn in 0..f step 100 * b) {
            val water = an + bn
            if (water == 0) continue
            for (cn in 0..f step c) {
                for (dn in 0..f step d) {
                    val sugar = cn + dn
                    val total = water + sugar
                    if (f < total || e < sugar * 100.0 / water) break
                    val conc = sugar * 100.0 / total
                    if (maxconc < conc) {
                        maxconc = conc
                        maxt = total
                        maxs = sugar
                    }
                }
            }
        }
    }
    println("$maxt $maxs")
}


Measured memory_bytes: 38732
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		int A,B;
		Scanner sc = new Scanner(System.in);
		A = sc.nextInt();
		B = sc.nextInt();
		if(A == 1) {
			A += 13;
		}
		if(B == 1) {
			B += 13;
		}
		if(A < B) {
			System.out.println("Bob");
		}else if(A > B) {
			System.out.println("Alice");
		}else {
			System.out.println("Draw");
		}
		sc.close();
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define sz(a) ((int)a.size())
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijoMOD(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll div_num(ll n){
  vl div(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      div[i]++;
    }
  }
  if(n!=1)div[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=div[i];
  }
  return num;
}
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}
long long lopow(ll a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a ;
        a = a * a ;
        n >>= 1;
    }
    return res;
}


//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//vc Alp ={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
//cout<<""<<endl;

int main(){
  ll N;cin>>N;
  vl A(N);rep(i,N)cin>>A[i];
  sort(all(A));
  ll ans=0;
  if(N==2)ans =A[N-1];
  else{
    ans +=A[N-1];
    if((N-2)%2==0){
      for(int i=N-2; i>=N-2-(N-2)/2+1; i--){
       ans +=2*A[i];
      }
    }
    else{
      for(int i=N-2; i>=N-2-(N-2)/2 +1; i--){
       ans +=2*A[i];
      }
      ans += A[N-2-(N-2)/2];
    }
    
  }
  cout<<ans<<endl;
}







Measured memory_bytes: 4872
#include <stdio.h>
#include <string.h>
 
int main(void){
  char s[1001], order[8], ch[1001];
  int i, j, n, a, b;
 
  scanf("%s\n%d", s, &n);
 
  for(i=0;i<n;i++){
    scanf("%s %d %d", order, &a, &b);
     
    if(!strcmp(order, "reverse")){
      for(j=a;j<=b;j++)
        ch[b-j] = s[j];
      for(j=a;j<=b;j++)
        s[j] = ch[j-a];
    }
 
    if(!strcmp(order, "replace")){
      scanf("%s", ch);
      for(j=0;ch[j]!='\0';j++)
        s[a+j] = ch[j];
    }
 
    if(!strcmp(order, "print")){
      for(j=a;j<=b;j++)
        printf("%c", s[j]);
      printf("\n");
    }
  }
 
  return 0;
}




Measured memory_bytes: 2108
#include <iostream>

int main()
{
    int a,b;
    std::string cul;
    
    while(true)
    {
        std::cin >> a >> cul >> b;
        if(cul == "?")
            break;
        
        if(cul == "+")
            std::cout << a+b << std::endl;
        else if(cul == "-")
            std::cout << a-b << std::endl;
        else if(cul == "*")
            std::cout << a*b << std::endl;
        else
            std::cout << a/b << std::endl;
    }
}


Measured memory_bytes: 3128
m = 1_000_000_007

n = readline.to_i

a = readline.split(' ').map(&:to_i)

cnt = Array.new(n,0)

a.each {|i| cnt[i] += 1 }

ok = true

ans = 1

if n.odd?
    ok = cnt[0] == 1
    (2 .. n).step(2).each do |i|
        ok &= cnt[i] == 2
        ans = ans * 2 % m
    end
else
    (1 .. n).step(2).each do |i|
        ok &= cnt[i] == 2
        ans = ans * 2 % m
    end
end

if ok
    p ans
else
    p 0
end


Measured memory_bytes: 8844
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static final PrintWriter out = new PrintWriter(System.out,false);

	static void solve() throws IOException{
		String[] str = new String[8];
		str[0] = br.readLine();
		while (true) {
			for (int i=1; i<8; i++) {
				str[i] = br.readLine();
			}

			int cnt = 0;
			ArrayList<Integer> list = new ArrayList<Integer>();
			for (int i=0; i<8; i++) {
				if (!str[i].equals("00000000")) {
					cnt++;
					for (int j=0; j<8; j++) {
						if (str[i].charAt(j) == '1') {
							list.add(j);
							break;
						}
					}
				}
			}

			if (cnt == 1) {
				out.println("C");
			} else if (cnt == 4) {
				out.println("B");
			} else if (cnt == 2) {
				if (list.get(0) == list.get(1)) out.println("A");
				else if (list.get(0) > list.get(1)) out.println("G");
				else out.println("E");
			} else {
				if (list.get(0) > list.get(2)) out.println("D");
				else out.println("F");
			}

			String check = br.readLine();
			if (check == null) break;
			else str[0] = br.readLine();
		}
	}

	public static void main(String[] args) throws Exception {
		long start = System.currentTimeMillis();

		solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		br.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}

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

#define M 1000003/* your task*/
#define L 14

char H[M][L]; /* Hash Table */

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;

}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key % (M - 1)); }

int find(char str[]){
  long long key,i,h;
  key = getKey(str);
  for(i=0;;i++){
    h = (h1(key) + i * h2(key)) % M;
    if(strcmp(H[h],str) == 0)return 1;
    else if(strlen(H[h]) == 0){
      return 0;
    }
  }
  return 0;
    /* your task */
}

int insert(char str[]){
  long long key,i,h;
  key = getKey(str);
  for(i=0;;i++){
    h =(h1(key) + i * h2(key)) % M;
    if(strcmp(H[h],str) == 0)return 1;
    else if(strlen(H[h]) == 0){
      strcpy(H[h],str);
      return 0;
    }
  }
  return 0;
    /* your task */
}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
	scanf("%s %s", com, str);
	
	if ( com[0] == 'i' ){
	    insert(str);
	} else {
	    if (find(str)){
		printf("yes\n");
	    } else {
		printf("no\n");
	    }
	}
    }

    return 0;
}



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

int main(){
    int n,m;
    cin >> n >> m;
    int k;
    vector<vector<int>> s(m,vector<int>(m)); 
    //cout <<"OK1"<<endl;
    for(int i=0;i<m;i++){
        cin >> k;
        s.at(i)=vector<int> (k);
        for(int j=0;j<k;j++){
            //cout <<"aaa"<<i<<" "<<j<<" "<<k<<endl;
            cin >>s.at(i).at(j);
        }
    }
    //cout <<"OK"<<endl;
    int p[m];
    for(int i=0;i<m;i++) cin >> p[i];
    int bit[n];

    int ans=0;
    for(int i=0;i<(1<<n);i++){
        int ans1=0;
        bool on[n]={};
        for (int j = 0; j < n; ++j) {
            if (i & (1 << j)){
               on[j]=true; 
            }
        }
        //for(int oo=0;oo<sizeof(on);oo++) cout << on[oo];
        //cout << endl;
        //cout <<i<<endl;
        for(int lamp=0;lamp<m;lamp++){
            int count=0;
            for(int j=0;j<s.at(lamp).size();j++){
                int sw = s.at(lamp).at(j);
                if(on[sw-1]){
                    count++;
                }
            }
            if(count%2==p[lamp]){
                ans1++;
            }

        }
        if(ans1==m){    
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#define INF_LL 1e18
#define INF 1e9

#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()

using namespace std;

using ll = long long;
using PII = pair<int, int>;

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);
	}
};

ll mod = 1e9+7;

ll powm(ll x, ll a){
	ll res = 1;
	REP(i, a){
		res = (res * x) % mod;
	}
	return res;
}

int main(void){
	int N, C;
	ll A[401], B[401];
	ll dp[401][401] = {};
	cin >> N >> C;
	REP(i, N){
		cin >> A[i];
	}
	REP(i, N){
		cin >> B[i];
	}
	dp[0][0] = 1;
	REP(i, N){
		FOR(j, A[i], B[i]+1){
			ll po[401] = {dp[i][0]};
			REP(k, C+1){
				if(k > 0) po[k] = ((po[k-1] * j) + dp[i][k])%mod;
				dp[i+1][k] = (dp[i+1][k] + po[k]) % mod;
			}
		}
	}
	cout << dp[N][C] << endl;
}


Measured memory_bytes: 1536
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "


// CHECK THE LIMITS
typedef long long ll;

const int MOD = 1000000007;
const ll INFLL = 1e18;
const int INF = 1e9;
const int NMAX = 1000001;

int gcd(int a, int b) {
  return b ? gcd(b, a%b) : a;
} 

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int r;
    cin >> r;
    cout << fixed << setprecision(10) <<1.0 * 2 * M_PI * r;
    return 0;
}


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

int main(){
  int h,w,count;
  char a,d='.',b='#';
  cin >> h >> w;
  string s,z,y ;

      for (int i_1 = 0; i_1 < h; i_1 ++ ){
        cin >> s;
        for (int i_2 = 0; i_2 < w; i_2 ++) z += s.at(i_2);
      }//zは横一列にした文字列

  for (int i_3 = 0; i_3 < h*w; i_3 ++){
    count = 0;

    if((i_3 -w)>=0 && z.at(i_3 -w) == b) count ++;
    if((i_3 +w)<h*w && z.at(i_3 +w) == b) count ++;

    if(w ==1){
      if(z.at(i_3)==d)cout<<count;
      else cout << z.at(i_3);
      if ((i_3 +1) % w ==0)cout << endl;
      continue;  
    }

    if((i_3+1)%w == 1){
      if((i_3 -w+1)>=0 && z.at(i_3 -w+1) == b) count ++;
      if(((i_3 +1)%w)<h*w && z.at(i_3 +1) == b) count ++;
      if((i_3 +w+1)<h*w && z.at(i_3 +w+1) == b) count ++;
    }

    else if((i_3+1)%w ==0){
      if((i_3 -w-1)>=0 && z.at(i_3 -w-1) == b )count ++;
      if((i_3 -1)>=0 && z.at(i_3 -1) == b) count ++;
      if((i_3 +w-1)<h*w && z.at(i_3 +w-1) == b) count ++;
    }
    else{
      if((i_3 -w-1)>=0 && z.at(i_3 -w-1) == b )count ++;
      if((i_3 -w+1)>=0 && z.at(i_3 -w+1) == b) count ++;
      if((i_3 -1)>=0 && z.at(i_3 -1) == b) count ++;
      if(((i_3 +1)%w)<h*w && z.at(i_3 +1) == b) count ++;
      if((i_3 +w-1)<h*w && z.at(i_3 +w-1) == b) count ++;
      if((i_3 +w+1)<h*w && z.at(i_3 +w+1) == b) count ++;
    }

    if(z.at(i_3)==d)cout<<count;
    else cout << z.at(i_3);

    if ((i_3 +1) % w ==0)cout << endl;

  }

}


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

int main(){
long long x,y;
  cin>>x>>y;
  bool abc=false;
  for(int i=0;i<=x;i++){
if(4*x-2*i==y){
  abc=true;
  break;
}
  }
  if(abc){
cout<<"Yes"<<endl;
  }
  else{
cout<<"No"<<endl;
  }
}


Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		int count = scanner.nextInt();
		int[] sortList = new int[count];
		for(int i = 0; i < count; i++){
			sortList[i] = scanner.nextInt();
		}
		int changeCount = selectionSort(sortList, count);
		for(int i = 0; i < count; i++){
			if(i != count - 1){
				System.out.print(sortList[i] + " ");
			}else{
				System.out.println(sortList[i]);
			}
		}
		System.out.println(changeCount);
	}

	private static int selectionSort(int[] sortList, int count){
		int swCount = 0;
		int min;
		int temp;
		for(int i = 0; i < count - 1; i++){
			min = i;
			for(int j = i; j < count; j++){
				if(sortList[j] < sortList[min]){
					min = j;
				}
			}
			temp = sortList[i];
			sortList[i] = sortList[min];
			sortList[min] = temp;
			if(min != i){
				swCount++;
			}
		}
		return swCount;
	}
}

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

int main() {
  int H, W;
  cin >> H >> W;
  vector<string> square(H);

  for (int i = 0; i < H; i++) {
    cin >> square.at(i);
  }

  vector<int> y = {-1, -1, -1, 0, 0, 1, 1, 1};
  vector<int> x = {-1, 0, 1, -1, 1, -1, 0, 1};

  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (square.at(i).at(j) == '#') {
        cout << square.at(i).at(j);
        continue;
      }

      int num = 0;
      for (int k = 0; k < 8; k++) {
        if ((i + y[k]) < 0 || H <= (i + y[k])) continue;
        if ((j + x[k]) < 0 || W <= (j + x[k])) continue;
        if (square.at(i + y[k]).at(j + x[k]) == '#') num++;
      }
      cout << num;
    }
    cout << endl;
  }
}


Measured memory_bytes: 256
while True:
	n=input().split()
	n[0]=int(n[0])
	n[1]=int(n[1])
	if n[0]==0 and n[1]==0:
		break

	if n[0]>n[1]:
		c=n[0]
		n[0]=n[1]
		n[1]=c
	print(n[0],n[1])

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

int main()
{
    int64_t n;
    cin >> n;
    int64_t a[n];
    for (auto &i : a)
    {
        cin >> i;
    }
    int64_t b[20], ans = 0, puni = 0;
    fill(b, b + 20, -1);
    for (int64_t i = 0; i < n; i++)
    {
        for (int64_t j = 0; j < 20; j++)
        {
            if (a[i] & (1 << j))
            {
                puni = max(puni, b[j] + 1);
                b[j] = i;
            }
        }
        ans += i - puni + 1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip> // std::std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()

typedef long long ll;

int main (void) {

  int A, B; std::cin >> A >> B;
  for(int C=1; C<=3; C++) {
    if ( A*B*C % 2 == 1 ) {
      std::cout << "Yes" << std::endl;
      return 0;
    }
  }
  std::cout << "No" << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int money=100000;
  int remain;
  int weeks;
  float temp;
  int i;

  scanf("%d", &weeks);
  for(i=0; i<weeks; i++){
    temp=(float)money*1.05f;
    money=(int)temp;
    remain=money%1000;
    money+=1000-remain;
  }
  printf("%d\n", money);

  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<stack>
#include<queue>
#include<map>

using namespace std;

int main(){
	int a,b,c;
	cin>>a>>b>>c;
	int x,y,z;
	x=a+b;
	y=a+c;
	z=b+c;
	if(x==c||y==b||z==a)
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
//...Bismillahir Rahmanir Rahim...
// Code by    Asad Bin Saber
// 29 06 2020

#include <bits/stdc++.h>

using namespace std;

// typedefs...
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<ll, ll> pll;

// constants...
const double PI = acos(-1);

// defines...
#define MP make_pair
#define PB push_back
#define si(a) scanf("%d", &a)
#define sii(a, b) scanf("%d%d", &a, &b)
#define siii(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define sl(a) scanf("%lld", &a)
#define sll(a, b) scanf("%lld%lld", &a, &b)
#define slll(a, b, c) scanf("%lld%lld%lld", &a, &b, &c)

int gcd(int a, int b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}
ll lcm(ll a, ll b)
{
    return (a*b/gcd(a, b));
}
ll comb(ll a, ll b)
{
    ll x = max(a-b, b), ans=1;

    for(ll K=a, L=1; K>=x+1; K--, L++){
        ans *= K;
        ans /= L;
    }

    return ans;
}


void bruce()
{
    cout << "\nExpected answer:\n";
    cout << "\nAnswer recieved:\n";
}

void task()
{
    //code here...

    int n, avrg, total=0;
    ll ans=0, mid=0;

    cin >> n;
    vi ara(n);
    for(int K=0; K<n; K++){
        cin >> ara[K];
        total += ara[K];
    }

    avrg = total/n;
    if(n*avrg!=total) avrg++;

    for(int K=0; K<n; K++){
        ans += (ll)(ara[K]-avrg)*(ara[K]-avrg);
    }

    if(n*avrg!=total) avrg--;
    for(int K=0; K<n; K++){
        mid += (ll)(ara[K]-avrg)*(ara[K]-avrg);
    }

    cout << min(ans, mid) << "\n";
}

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    task();

    return 0;
}





Measured memory_bytes: 3588
#include <bits/stdc++.h>
#include<iostream>
#include<cmath>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll=long long;
using P=pair<int,int>;
const int INF=1001001001;
//素数でないとき候補の数を１増やす
//xが素数かどうかをチェックする
int main(){
   int x; cin>>x;
   //x以上の素数を発見するまでループする
   while(1){
      bool ok=true;
      //調べている候補の数が素数であるか自分より前の数で全部割り切れないかチェック
      for(int i=2;i<x;i++){
         if(x%i==0){
            //素数でないことが分かったらその時点でループを外れる
            ok=false;
            break;
         }
      }
      if(ok) break;
      //素数でなかったら候補の数に1足してそれが素数かチェック
      x++;
   }
   cout<<x<<endl;
   return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<long>a(n);
  int i,j;
  for(i=0;i<n;i++){
    cin >> a[i];
  }
  sort(a.begin(),a.end());
  long ans = 0;
  long tmp = 0;
  if(n%2==0){
    for(i=0;i<n/2-1;i++){
      ans -= 2*a[i];
    }
    ans -= a[n/2-1];
    ans += a[n/2];
    for(i=n/2+1;i<n;i++){
      ans += 2*a[i];
    }
  }else{
    for(i=0;i<n/2-1;i++){
      ans -= 2*a[i];
    }
    ans -= a[n/2-1];
    ans -= a[n/2];
    for(i=n/2+1;i<n;i++){
      ans += 2*a[i];
    }

    for(i=0;i<n/2;i++){
      tmp -= a[i]*2;
    }
    tmp += a[n/2] + a[n/2+1];
    for(i=n/2+2;i<n;i++){
      tmp += 2*a[i];
    }
    if(tmp>ans)ans = tmp;
  }


  cout << ans << endl;
}


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

#define ll long long
ll ans[11];
ll h,w,n;
const long inf=1e9+7, maxn=1e5*9+1;
	ll node[maxn];


int main()
{
	cin>>h>>w>>n;
	ll zero=(h-2)*(w-2);
	ll cnt=0;
	while(n--)
	{
		ll a, b; cin>>a>>b;
		for(int i=-2;i<=0;i++)
		{
			for(int j=-2;j<=0;j++)
			{
				if(a+i>=1 && a+i<=h-2 && b+j>=1 && b+j<=w-2) 
					node[cnt++]=inf*(a+i) +(b+j);	
			}
		}
	}
	
	sort(node, node+cnt);
	for(ll i=0, tmp=1;i<cnt;i++)
	{
		if(node[i]==node[i+1]) tmp++;
		else
		{
			zero--;
			ans[tmp]++;
			tmp=1;
		}
	}
	cout<<zero<<endl;
	for(int i=1;i<10;i++)
	{
		cout<<ans[i]<<endl;
	}
}

Measured memory_bytes: 7296
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#define MOD 1000000007
unsigned long long int sum=1; 
using namespace std;

unsigned long long int fast_power_with_mod(long long base, long long power) {
    long long result = 1;
    while(power > 0) {

        if(power % 2 == 1) { // Can also use (power & 1) to make code even faster
            result = (result%MOD*base%MOD) % MOD;
        }
        base = (base * base) % MOD;
        power = power / 2; // Can also use power >>= 1; to make code even faster
    }
   	return result%MOD;
}

unsigned long long int fast_power(long long base, long long power) {
    long long result = 1;
    while(power > 0) {

        if(power % 2 == 1) { // Can also use (power & 1) to make code even faster
            result = (result%MOD*base%MOD);
        }
        base = (base * base);
        power = power / 2; // Can also use power >>= 1; to make code even faster
    }
   	return result;
}
/*int find_ind(int a[],int n,int elem)
{
	int ret_ind=0;
	for(int i=1;i<=n;i++)
	{
		if(a[i]==elem)
			ret_ind = i;
	}
	a[ret_ind]=-1;
	return ret_ind;
}*/
int arraySortedOrNot(int arr[], int n) 
{ 
    // Array has one or no element or the 
    // rest are already checked and approved. 
    if (n == 1 || n == 0) 
        return 1; 
  
    // Unsorted pair found (Equal values allowed) 
    if (arr[n - 1] < arr[n - 2]) 
        return 0; 
  
    // Last pair was sorted 
    // Keep on checking 
    return arraySortedOrNot(arr, n - 1); 
}


void implement()
{
	unsigned long long int s,w;
	cin >> s >> w;
	if(w>=s)
	{
		cout << "unsafe" << endl;
	}
	else
	{
		cout << "safe" << endl;
	}



	

}

void multi_test(){
	int t;
	cin >> t;
	for(int i=0;i<t;i++)
	{
		implement();
	}
}

void single_test()
{
	implement();
}

int main()
{
	//multi_test();
	single_test();
	return 0;
}



Measured memory_bytes: 3624
#include<iostream>
using namespace std;
int main()
{
	int n,x;
	cin>>n>>x;
	int l[110];
	int d[110];
	for(int i=1;i<=n;i++)
	{
		cin>>l[i];
	}
	d[1]=0;
	for(int i=2;i<=n+1;i++)
	{
		d[i]=d[i-1]+l[i-1];
	}
	int count=0;
	for(int i=1;i<=n+1;i++)
	{
		if(d[i]<=x)
		{
			count++;
		}
	}
	cout<<count<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

main(){
    int size, duration, actual;
    cin >> size >> duration;
    int total = 0;
    cin >> actual;
    int anterior = 0;
    for(int i=1;i<size;++i){
        cin >> actual;
        if(actual-anterior>duration){
            total+= duration;
        }
        else{
            total+= actual-anterior;
        }
        anterior = actual;
    }
    total+=duration;
    cout << total << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int a,b,c,x;
  scanf("%d%d%d%d",&a,&b,&c,&x);
  int ans = 0;
  int i,j;
  for(i=0;i<=a;i++){
    for(j=0;j<=b;j++){
      int tmp = i * 500 + j * 100;
      if (x - tmp >= 0 && x - tmp <= c * 50){
        ans++;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}


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

#define MOD 1999993

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

struct P{
	int tile[9];
	int step, O;
	struct P *next,*prev;
};
typedef struct P* puzzle;

//{{{ Hash
int mem[2000000];
int h1(int key){
	return key%MOD;
}
int h2(int key){
	return 1+key%(MOD-1);
}
int Hash(int* array, int col, char com){
	int i,key=0,pos;
	for(i=0;i<9;i++)key=key*10 + array[i];

	pos=( h1(key) + col*h2(key) )%MOD;
	if(com=='M'){
		//Memo
		if(mem[pos]==0)mem[pos]=key;
		else return Hash(array,col+1, 'M');

		return 0;
	}else if(com=='F'){
		//Find
		if(mem[pos]==key)return 1;
		else if(mem[pos]==0)return 0;
		else return Hash(array,col+1,'F');
	}
	
}
//}}}
//{{{ Queue
puzzle head;
void Push(struct P in){
	int i,key=0,digit=1;
	puzzle data=(puzzle)malloc(sizeof(struct P));
	for(i=0;i<9;i++){
		data->tile[i]=in.tile[i];
		key+=digit*(in.tile[i]);
		digit*=10;
	}
	Hash(in.tile,0,'M');
	data->step = in.step;
	data->O = in.O;

	Hash(in.tile, 0,'M');

	data->next=head;
	data->prev=(head->prev);
	(head->prev)->next=data;
	(head->prev)=data;

	return;

}

struct P Pop(void){
	if(head->next == head){
		printf("empty!!\n");
		exit(1);
	}
	int i;
	struct P out;
	for(i=0;i<9;i++){
		out.tile[i]=(head->next)->tile[i];
	}
	out.step=(head->next)->step;
	out.O=(head->next)->O;

	puzzle del=head->next;
	head->next=(del)->next;
	head->next->prev = head;
	free(del);
	//(head->next)->prev=head;

	return out;
}
//}}}

int Check(struct P x){
	int i;
	for(i=0;i<9;i++){
		if(x.tile[i]!=(i+1)%9)return 0;
	}

	return 1;
}

void Solve(void){
	int i,j,y,x,nY,nX,tmp;
	struct P u,v;

	while(head->prev != head){
		u=Pop();
		if(Check(u)){
			printf("%d\n",u.step);
			exit(0);
		}
		y=u.O/3;	x=u.O%3;
		for(i=0;i<4;i++){
			nY=y+dy[i],nX=x+dx[i];
			if(nY<0||nX<0||nY>=3||nX>=3)continue;

			v=u;
			v.step++;
			// O のswap
				v.O = 3*nY + nX;
				tmp=v.tile[3*nY + nX];
				v.tile[3*nY + nX]=v.tile[3*y + x];
				v.tile[3*y + x]=tmp;
				
			if(Hash(v.tile,0,'F'))continue;
			
			Push(v);
		}
	}
	return;
}

signed main(){
	for(int i=0;i<4;i++){
	}
	int i;
	head=(puzzle)malloc(sizeof(struct P));

	head->next=head;	head->prev = head;
	head->step=-1;

	struct P in;
	for(i=0;i<9;i++){
		scanf("%d",&(in.tile[i]));
		if(in.tile[i]==0)in.O=i;
	}
	in.step=0;
	Push(in);
	Solve();

	return 0;
}



Measured memory_bytes: 11512
def binary_search_internal(l, r, k, S):
    if l > r:
        return None
    center = (l + r) // 2
    v = S[center]
    if v == k:
        return center
    elif v < k:
        return binary_search_internal(center + 1, r, k, S)
    else:
        return binary_search_internal(l, center - 1, k, S)

def binary_search(k, S):
    return binary_search_internal(0, len(S) - 1, k, S)

n = int(input())
S = list(map(int, input().split()))
q = int(input())
Q = map(int, input().split())

count = 0
for k in Q:
    index = binary_search(k, S)
    if index != None:
        count += 1

print(count)

Measured memory_bytes: 18840
import math

array_size = int(input())
#array = list(map(int,list(input())))
array = str(input())
#num = math.factorial(array_size)/math.factorial(3)
count = 0
for i in range(1000):
    tf = 1
    i = list(map(int,list(str(i))))
    if len(i) < 3:
        i.insert(0,0)
        if len(i) < 3:
            i.insert(0,0)
    index = -1
    for j in i:
        j = str(j)
        index = array.find(j,index+1)
        if index == -1:
            tf = 0
            break
    if tf == 1:
        count+=1
        #print(i)
print(count)

Measured memory_bytes: 41324
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;

int main(){
	ll N, K; cin>>N>>K;
	ll ans = 0;
	for(ll i = K; i<=N+1; ++i){
		ll max = (2*N-i+1)*i/2 % MOD;
		ll min = (i-1)*i/2 % MOD;
		// cout<<max<<' '<<min<<endl;
		ans += (max-min)+1;
		ans %= MOD;
	}
	if(ans<0)ans += MOD;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3584
n=int(input())
a=list(map(int,input().split()))
ans=0
ok=True
while ok==True:
  for i in range(n):
    if a[i]%2==0:
      a[i]//=2
    else:
      ok=False
      break
  if ok==True:
    ans+=1
print(ans)

Measured memory_bytes: 3060
# -*- coding: utf-8 -*-

def input_int_array():
    return map(int, input().split())


class Board:
    def __init__(self, w, h, parent):
        self.w = w
        self.h = h
        self.parent = parent


def answer(n, q):
    min_board = Board(n-2, n-2, None)
    black = (n - 2) * (n - 2)
    for i in range(q):
        a, pos = input_int_array()
        pos -= 1
        board = min_board
        use_min = True
        if a == 1:
            while pos > board.w:
                board = board.parent
                use_min = False
            black -= board.h
            if use_min:
                b = Board(pos - 1, board.h, board)
                min_board = b
        else:
            while pos > board.h:
                board = board.parent
                use_min = False
            black -= board.w
            if use_min:
                b = Board(board.w, pos - 1, board)
                min_board = b
    print(black)


n, q = input_int_array()
answer(n, q)


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())
#define rsort(v) sort(all(v)); reverse(all(v))

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template<typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template<typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template<typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template<typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template<typename T> inline T power(T x, i64 n) { T r = 1; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template<typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }

void solve() {
  int N, Q; cin >> N >> Q;
  vi32 a(N); cin >> a;
  vi64 X(Q); cin >> X;
  each(x, X) {
    i64 ans = 0;
    i64 sum = 0;
    for (int l = 0, r = 0; l < N; ) {
      while (r < N && sum + a[r] <= x) {
        sum += a[r++];
      }
      ans += r - l;
      sum -= a[l++];
      if (l >= r) r = l, sum = 0;
    }
    cout << ans << '\n';
  }
}



Measured memory_bytes: 3228
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fi first
#define se second
vector<ll> finddivisor(ll x){//整数xの約数が入ったvectorを返すよ(xを含む)  
    vector<ll> divisor;
    for(ll i=1; (i*i)<=x ;i++)
    {
        if(x%i==0){
            divisor.push_back(i);
            if(i*i!=x){
                divisor.push_back(x/i);
            }//約数はペアを持つことを利用（6の約数が2と分かれば、6/2も約数と分かる)

        }
    }
    sort(divisor.begin(),divisor.end());
    return divisor;
}
int main(){
    ll n,ans=1;
    cin >> n;
    vector<ll> v(n),a,b;
    for(ll i=0;i < n;i++)
    {
        cin >> v.at(i);
    }
    a=finddivisor(v.at(0));
    b=finddivisor(v.at(1));

    for(int i=0;i < a.size();i++)
    {
        ll cnt=0;
        for(int j=0;j < n;j++)
        {
            if(v.at(j)%a.at(i)!=0){
                cnt++;
            }
            if(cnt>=2){
                break;
            }
        }
        if(cnt<2){
            ans=max(ans,a.at(i));
        }
    }
    for(int i=0;i < b.size();i++)
    {
        ll cnt=0;
        for(int j=0;j < n;j++)
        {
            if(v.at(j)%b.at(i)!=0){
                cnt++;
            }
            if(cnt>=2){
                break;
            }
        }
        if(cnt<2){
            ans=max(ans,b.at(i));
        }
    }
    cout << ans << endl;
}
/*別解 ある１つの項（A1,とかANとか)を除いたとき、残りの全ての項のgcdの最大値を求める（n通りのうちの最大値)

→答えは必ず,除いた項以外のすべての項の、約数である（それはそう）
なので適当に二つ項を持ってきて、その二つの項の約数でA1からANを割ったとき、
あまりが０にならない項が1つ以下存在する（その数を約数に持たない数が1つ存在するor存在しない)ような約数のmaxを求める
（あまりが０にならないということは、その数で割れないということ）
（余りが0にならない項が１つ存在するなら、その項を除けばよいので、1つまでならセーフ）

必要条件から絞るパターン*/

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;

void solve(){
  int n; cin >> n;
  vector<char> v;
  for(int i = 0; i < n; i++){
    char c; cin >> c;
    v.push_back(c);
  }

  for(int i = 0; i < v.size(); i++){
    int j = i + 1;
    while(j < v.size() && v[i] == v[j]){
      v.erase(v.begin() + j);
    }
  }
  cout << v.size() << endl;
  return;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 512
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
		int n = sc.nextInt();
		int i = sc.nextInt();
  
		// 出力
		System.out.println(n + 1 - i);
	}
}


Measured memory_bytes: 21844
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
char s[1002];
int main() 
{ 
    int n;cin >> n;
    scanf("%s", s+1);
    int ans = 0, t = 0;
    for(int i=1;i<=n;i++)
    {
        if(s[i] == 'I') t++;
        else t--;
        ans = max(ans, t); 
    }
    cout << ans << endl;
}


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

int main(){
    int n;
    string s="No";
    cin>>n;
    for(int i=0;7*i<=n;i++){
    	if((n-7*i)%4==0){
    		s="Yes";
    	}
    }
    cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <math.h>

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define repP(i, a, b) for(int i = a; i < b; i++)
#define repM(i, a, b) for(int i = a - 1; i >= b; i--)

using namespace std;

int main()
{
  int a = 0 , b = 0, c = 0, d = 0, e = 0, f = 0, i = 0, j = 0;
  int num = 0, count = 0, ans = 0;
  double d1 = 0, d2 = 0, d3 = 0, d4 = 0, d5 = 0, d6 = 0;
  int a1[999999], a2[999999], a3[999999];
  //char s1[200000], s2[200000], s3[200000];
  string s1, s2, s3;
  
  cin >> a >> s1;
  
  if(s1.size() % 2 != 0){
    cout << "No" << endl;
  }else{
    for(i = 0; i < s1.size() / 2;  i++){
      if(s1[i] != s1[s1.size() / 2 + i]){
        b++;
      }
    }
    if(b >= 1){
      cout << "No" << endl;
    }else{
      cout << "Yes" << endl;
    }
  }
}
  


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int n,m,i=1;
int main(void){
    cin>>n>>m;
    if(m==1){
        cout<<0<<endl;
        return 0;
    }
    while(1){
        if(n*i-i+1>=m)break;
        i++;
    }
    cout<<i<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
const ll MOD = 1000000007;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(2e5 + 5);
const double EPS = 1e-8;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

int main() {
    int n, x;
    cin >> n >> x;
    if(x==1 || x==2*n-1){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
        vector<int> ans;
        if(x<n)x--;
        REP(i,2*n-1) {
            if(i+1==x || i==x)continue;
            ans.push_back(i+1);
        }
        ans.insert(ans.begin()+n-1,x+1);
        ans.insert(ans.begin()+n-1,x);
        for(auto i : ans){
            cout << i << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    string S;
    cin >> S;

    string ans="Yes";
    rep(i,S.size()){
        if(i%2==0 ){
            if(S[i]=='L') ans="No";
        }else{
            if(S[i]=='R') ans="No";
        }

    }
    cout << ans << endl;



}


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

ll gcd(ll a, ll b){
	if (a == 0) return b;
	return gcd(b  %a, a);
}

ll lcm(ll a, ll b){
	return (a*b) / gcd(a, b);
}

ll n;
double p[3004],dp[3004][3004];

double solve()
{
	memset(dp , 0.0 , sizeof(dp));

	dp[0][0] = 1.0;

	for(ll i = 1;i<=n;i++)
	{
		for(ll j=0;j<=i;j++)
		{
			if(j == 0)
			{
				dp[i][j] = (double)dp[i-1][j] * (1.0 - p[i]);
			}
			else
			{
				dp[i][j] = (double)(dp[i-1][j]*(1.0 - p[i])) + (double)(dp[i-1][j-1]*p[i]);
			}

		}
	}

	double ans = (double)0.0;
	for(ll j = (n+1)/2 ; j <=n ; j++)
	{
		ans += (double)dp[n][j];
	}

	return ans;
}

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


	cin >> n;

	for(ll i=1;i<=n;i++)
		cin >> p[i];

	cout << fixed << setprecision(10) <<  solve() << endl;		

}

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

int main(){
	string s;
	cin >> s;
	int a = 0;
	int b = 0;
	rep(i,s.size()) {
		if (s[i] == '0') a++;
		if (s[i] == '1') b++;
	}
	cout << 2*min(a,b) << endl;
    return 0;
}



Measured memory_bytes: 512
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
signed main(){
  ll n,t_size,chx;
  cin >> n;
  ll a[n];
  map<ll,ll> mp;
  t_size = 0;
  for(int i=0;i<n;i++){
    cin >> a[i];
    mp[a[i]]++;
    t_size = max(a[i],t_size);
  }
  if(t_size%2==1) chx = (t_size+1)/2;
  else chx = t_size/2+1;
  for(int i=t_size;i>=chx;i--){
    if(mp[i]<2){
      cout <<"Impossible\n";
      return 0;
    }else{
      mp[i]-=2;
    }
  }
  if(t_size%2==0){
    if(mp[t_size/2]!=1){
      cout <<"Impossible\n";
      return 0;
    }else{
      mp[t_size/2]--;
    }
    chx--;
  }
  if(t_size%2==1) chx = (t_size+1)/2;
  else t_size = t_size/2;
  for(int i = chx;i>=1;i--){
    if(mp[i]>=1){
      cout <<"Impossible\n";
      return 0;
    }
  }
  cout <<"Possible\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
bool red[100005];
int cnt[100005];

int main(){
	int n, m;
	scanf("%d%d", &n, &m);
	red[1] = 1;
	for(int i=1;i<=n;i++) cnt[i] = 1;
	for(int i=0;i<m;i++){
		int x, y;
		scanf("%d%d", &x, &y);
		cnt[x]--;
		cnt[y]++;
		if(red[x]) red[y] = 1;
		if(cnt[x] == 0 && red[x]) red[x] = 0;
	}
	int ans = 0;
	for(int i=1;i<=n;i++) ans += red[i];
	printf("%d\n", ans);
}

Measured memory_bytes: 768
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <stack>
using namespace std;

struct info
{
    int Team;
    int solved;
    int penalty;
    int mis[10];
    info(int x, int y, int z)
    {
        Team = x;
        solved = y;
        penalty = z;
        for (int i = 1; i <= 10; i++)
        {
            mis[i - 1] = 0;
        }
    }
};

bool asc(info const &left, info const &right)
{
    if (left.solved != right.solved)
        return left.solved > right.solved;
    else if (left.penalty != right.penalty)
        return left.penalty < right.penalty;
    else
        return left.Team < right.Team;
}

int main()
{
    while (true)
    {
        int t = 0, p = 0, r = 0;
        cin >> t >> p >> r;
        if (t == 0 && p == 0 && r == 0)
            break;

        vector<info> InfoList;
        for (int i = 1; i <= t; i++)
        {
            info x = info(i, 0, 0);
            InfoList.push_back(x);
        }
        // cout << "Before" << endl;
        // for (int i = 1; i <= t; i++)
        // {
        //     cout << InfoList[i - 1].Team << " " << InfoList[i - 1].solved << " " << InfoList[i - 1].penalty << endl;
        // }

        for (int i = 0; i < r; i++)
        {
            int tID, pID, t;
            string m;
            cin >> tID >> pID >> t >> m;

            if (m == "CORRECT")
            {
                InfoList[tID - 1].solved++;
                InfoList[tID - 1].penalty += InfoList[tID - 1].mis[pID - 1] * 1200 + t;
            }
            if (m == "WRONG")
            {
                InfoList[tID - 1].mis[pID - 1] += 1;
            }
        }

        sort(InfoList.begin(), InfoList.end(), asc);

        // cout << "after" << endl;
        for (int i = 1; i <= t; i++)
        {
            cout << InfoList[i - 1].Team << " " << InfoList[i - 1].solved << " " << InfoList[i - 1].penalty << endl;
        }
    }

    return 0;
}


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

#define mod 1000000007

#define ft first
#define sd second
#define pb push_back
#define all(x) x.begin(),x.end()
#define ll long long int
#define vi vector<int>
#define vli vector<long int>
#define vlli vector<long long int >
#define vii vector<pair<int,int> >
#define pii pair<int,int>
#define plii pair<pair<ll, int>, int>
#define piii pair<pii, int>
#define viii vector<pair<pii, int> >
#define vl vector<ll>
#define vll vector<pair<ll,ll>>
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define mp make_pair
#define ms(x, v) memset(x, v, sizeof x)
#define cnl cout<<"\n";

#define fr(i, a, b) for(i=a; i<=b; i++)
#define frr(i,a,b) for(i=a;i<b;i++)
#define fb(i, a, b) for(i=a; i>=b; i--)
#define fbb(i,a,b) for(i=a;i>b;i--)

#define pr_vec(i,a,b,v) for(i=a;i<b;i++) cout<<v[i]<<" ";
#define in_arr(i,n,v) for(i=0;i<n;i++) cin>>v[i];
int main(){
	ll n,i,j;
	string s;
	cin>>s;
	ll p=0;
	frr(i,0,s.size()){
		if(s[i]=='o') p++;
	}
	ll a=15-s.size();
	if((a+p)>=8) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
    return 0;
}

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

using namespace std;

struct node {
	int value;
	node *prev,*next;
};

node *nil;

void init() {
	nil = (node *)malloc(sizeof(node));
	nil->prev = nil;
	nil->next = nil;
}

void insert(int key) {
	node *x = new node();
	x->value = key;
	x->next = nil->next;
	nil->next->prev = x;
	nil->next = x;
	x->prev = nil;
}

void deletenode(node *t) {
	if (t == nil) {
		return;
	}
	t->prev->next = t->next;
	t->next->prev = t->prev;
	free(t);
}

void deletefirst() {
	deletenode(nil->next);
}

void deletelast() {
	deletenode(nil->prev);
}

node* linesearch(int key) {
	node *cur = nil->next;
	while (cur != nil && cur->value != key) {
		cur = cur->next;
	}
	return cur;
}

void printlist() {
	node *cur = nil->next;
	int isf = 0;
	while (1) {
		if (cur == nil)break;
		if (isf++ > 0) { cout << " "; }
		cout << cur->value;
		cur = cur->next;
	}
	cout << endl;
}

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

	string str;
	int m;

	init();
	for (int i = 0; i < n; i++) {
		cin >> str;
		if (str != "deleteFirst" && str != "deleteLast") {
			cin >> m;
		}
		if (str == "insert") { insert(m); }
		else if (str == "delete") { deletenode(linesearch(m)); }
		else if (str == "deleteFirst") { deletefirst();}
		else if (str == "deleteLast") { deletelast(); }
	}
	printlist();
}


Measured memory_bytes: 34456