akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
const int inf = 1e5;
//typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll mo = 998244353;
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
map<ll,ll> ma;
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
int main(){
  int n; ll k;  cin >> n >> k;
  vector<pii> v(n);
  rep(i,0,n){
    cin >> v[i].fi >> v[i].se;
  }
  sort(all(v));
  ll sum = 0;
  rep(i,0,n){
    sum += v[i].se;
    if(sum>=k){
      cout << v[i].fi << endl;
      return 0;
    }
  }

  return 0;
}


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

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
   
    
    int t;
    t=1;

    while(t--){
 		string data;
 		cin>>data;

 		int l=data.length();

 		int rain=0;
 		int temp=0;
 		for(int i=0;i<l;i++){
 			if(data[i]=='R'){
 				temp++;
 			}
 			else
 			{
 				rain=max(rain,temp);
 				temp=0;
 			}
 		}
 		rain=max(rain,temp);
 		cout<<rain<<endl;

    }
}

Measured memory_bytes: 3648
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<math.h>

using namespace std;

#define INF 1000000007
#define LINF 1000000000000000007

typedef long long i64;
typedef pair<i64,i64> P;


string s;
int cnt[101010];

int main(){
	cin >> s;
	
	for(int i = 0; i < s.size();){
		int st = i;
		while(s[i] != 'L')
			i++;
		cnt[i-1] += (i-st)/2 + (i-st)%2;
		cnt[i] += (i-st)/2;
		st = i;
		while(i < s.size() && s[i] != 'R')
			i++;
		cnt[st] += (i-st)/2 + (i-st)%2;
		cnt[st-1] += (i-st)/2;
	}
	for(int i = 0; i < s.size(); i++){
		cout << cnt[i];
		if(i != s.size()-1) cout << " ";
	}
	cout << endl;
	
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
    int x;
    cin >> x;
    bool flag=false;
    for(int i=1;i<=x;i++){
        if((100*i)<=x && x<=(105*i)){
            flag=true;
        }
    }
    if(flag) cout << 1 <<endl;
    else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 256
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use itertools::Itertools;
use proconio::*;
use text_io::*;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    let d: usize = read!();
    let t: usize = read!();
    let s: usize = read!();

    let m = t * s;

    println!("{}", if m >= d { "Yes" } else { "No" });
}


Measured memory_bytes: 2136
#include<bits/stdc++.h>
using namespace std;
int main(){
	int N,A,B,C;cin>>N>>A>>B>>C;
	int L[N];
	for(int i=0;i<N;i++){
		cin>>L[i];
	}int a,b,c;int sum;int mn=100000;
    int x,y;
	for(int i=0;i<(1<<2*N);i++){
		a=0;b=0;c=0;sum=0;
		for(int j=0;j<N;j++){
            x=(1<<2*j);y=2*x;
			if((i&x)&&(i&y)){
                if(a!=0){
                    sum+=10;
                }a+=L[j];
			}else if(!(i&x)&&(i&y)){
                if(b!=0){
                    sum+=10;
                }b+=L[j];
			}else if((i&x)&&!(i&y)){
                if(c!=0){
                    sum+=10;
                }c+=L[j];
			}
		}sum=sum+abs(a-A)+abs(b-B)+abs(c-C);
        if(a!=0&&b!=0&&c!=0){
		    mn=min(mn,sum);
        }
	}cout<<mn<<endl;
}

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

#include <atcoder/all>

// #LIB#

using namespace std;
using namespace atcoder;
using ll = long long;
#define double long double
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repr(i, a, b) for (auto i = (a); i < (b); ++i)
#define itr(x, c) for (auto&& x : (c))
#define updatemax(t, v) ((t) = std::max((t), (v)))
#define updatemin(t, v) ((t) = std::min((t), (v)))
#ifdef ONLINE_JUDGE
#define endl _endl
const char _endl = (cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout.precision(16), '\n');
#endif

int main() {
  ll n, k;
  cin >> n >> k;
  vector<vector<ll>> a(n, vector<ll>(n));
  rep(i, n) rep(j, n) cin >> a[i][j];
  mcf_graph<ll, ll> g(2 * n + 2);
  ll s = 2 * n, t = 2 * n + 1;
  const ll M = 10'000'000'000;
  g.add_edge(s, t, n * k, M);
  rep(i, n) {
    g.add_edge(s, i, k, 0);
    g.add_edge(n + i, t, k, 0);
  }
  rep(i, n) rep(j, n) g.add_edge(i, n + j, 1, M - a[i][j]);
  cout << n * k * M - g.flow(s, t, n * k).second << endl;
  vector<string> ans(n, string(n, '.'));
  itr(e, g.edges()) {
    if (e.flow > 0 && e.from != s && e.to != t) ans[e.from][e.to - n] = 'X';
  }
  itr(s, ans) cout << s << endl;
}


Measured memory_bytes: 3912
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

s = STR()
strt = 0
end = len(s) - 1
for i in range(len(s)):
    if s[i] == 'A':
        strt = i
        break
for i in reversed(range(len(s))):
    if s[i] == 'Z':
        end = i
        break
print(end - strt + 1)

Measured memory_bytes: 5704
import numpy as np
N = int(raw_input())
line = np.array(map(int,raw_input().split()))

line2 = np.sort(line)
t = (float(line2[N / 2 -1]) + float(line2[N / 2])) / 2

for i in range(N):
    if line[i] < t:
        print line2[N / 2]
    else:
        print line2[N / 2 - 1]

Measured memory_bytes: 27516
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
using ll = long long;

int main(){
        ll n,a,b,sum=0,ans=0;
        cin >> n;
        vector<ll> x(n);
        for(ll i=0;i<n;i++){
                cin >> a >> b;
                x[i] = a+b;
                sum+=b;
        }
        sort(x.begin(),x.end());
        for(ll i=n-1;i>=0;i-=2) ans+=x[i];
        cout << ans-sum << endl;
        return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,x;
  cin>>n>>x;
  vector<int>l(n);
  int a=0;
  int b=0;
  for(int i=0;i<n;i++){
  cin>>l.at(i);
  a+=l.at(i);
  b++;
  if(a>x){
  cout<<b;
  return 0;
  }
  }
  if(a<=x){
    cout<<b+1;
  }
  else{
  cout<<b;
  }
 }

Measured memory_bytes: 3628
N = int(input())
u = ["".join(sorted(list(input()))) for i in range(N)]
d = {}
for i in range(N):
  if u[i] in d:
    d[u[i]] += 1
  else:
    d[u[i]] = 1
ans = sum((i * (i - 1)) // 2 for i in d.values())
print(ans)

Measured memory_bytes: 67024
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
typedef  long long ll;
using namespace std;

int main(void) {
	string x;

	while (true)
	{
		cin >> x;
		if (x == "0") break;

		ll ans = 0;

		for (int i = 0; i < x.length(); i++)
		{
			ans += x[i] - '0';
		}
		
		cout << ans << endl;
	}

	return 0;
}


Measured memory_bytes: 3172
/*bismillah ->                                                                                                         << Suirkhanov Meyirlan >>
  GL HF


                                                                                                                      42

    bless my code =)
                                                                                                            NEVER FOLLOW YOUR RULES :D HAHAHAHA
*/


///scanf ("%d%d", &x, &y);
///printf("%d", &a)

#include <bits/stdc++.h>

#define fast ios_base::sync_with_stdio();   cin.tie(0);   cout.tie(0);
#define randoperation srand(time(0));
#define pii pair < int , int >
#define pll pair < ll, ll >
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define fast ios_base::sync_with_stdio();   cin.tie(0);   cout.tie(0);
#define randoperation srand(time(0));

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const ll N = 1e5 + 7;
const ld pi = 3.14159265359;
const int INF = 1e9 + 7;
const double eps = 1e-9;

const int xi[4] = {-1, 0, +1, 0};
const int yj[4] = {0, +1, 0, -1};
const int xxi[4] = {+1, 0, -1, 0};
const int yyj[4] = {0, -1, 0, +1};

ll n, k;

int main(){

  //freopen("bridge.in", "r", stdin);
  //freopen("bridge.out", "w", stdout);

  fast
  randoperation;

  ///           ||
  ///start here \/

  cin >> n;

  if(n < 1200){
    cout << "ABC";
  }

  else if(n < 2800){
    cout << "ARC";
  }

  else{
    cout << "AGC";
  }
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define ll long long
int main ()
{
	int n;
	cin>>n;
    ll a[n];
	for(int i=0;i<n;i++) cin>>a[i];
	int zero =0;
	for(int i=0;i<n;i++)if(a[i]==0) zero ++;

   if(zero >0){
		cout<<"0"<<endl;
		return 0;
	}
	ll prod =1;
	for(int i=0;i<n;i++){
	if(a[i ] <=1000000000000000000/ prod ){
		prod *=a[i];
	}else{
 		cout<<"-1"<<endl;
		return 0;
	 }
	}
 cout<<prod<<endl;
}


Measured memory_bytes: 4416
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define fop(i,m,n) for (int i=(m);i<(n);i++)
#define FOP(i,m,n) for (int i=(m)-1;i>=(n);--i)
#define test(x) cout << #x << ' ' << x << endl;
#define eb emplace_back
#define pb push_back
#define mp make_pair 
#define pii pair<int,int> 
#define X first
#define Y second
#define MAXN 100000
int MOD = 1e9 + 7;
vector <int> nums[MAXN];
lli dp[MAXN][2]; // 0 黑 1 白

void dfs(int n, int pa) {
	dp[n][0] = dp[n][1] = 1;
	for (int i : nums[n]) {
		if (i == pa) continue;
		dfs(i, n);
		dp[n][0] = dp[n][0] * dp[i][1] % MOD;
		dp[n][1] = dp[n][1] * (dp[i][0] + dp[i][1]) % MOD; 
	}
}

int main () {
	int n, x, y;
	cin >> n;
	fop (i,0,n-1) {
		cin >> x >> y;
		nums[x-1].pb(y-1);
		nums[y-1].pb(x-1);
	}
	dfs(0, -1);
	cout << (dp[0][0] + dp[0][1]) % MOD << endl;
}

Measured memory_bytes: 12800
# -*- coding: utf-8 -*-
n,a,b = map(int, input().split())

if (b-a)%2==0:
    print((b-a)//2)
else:
    r1 = a-1 + 1 + (b-a)//2
    r2 = n-b + 1 + (b-a)//2
    print(min(r1,r2))

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long int lli;

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

	lli L[87];
	L[0] = 2;
	L[1] = 1;
	for (int i = 2;i <= 86;i++) L[i] = L[i - 1] + L[i - 2];
	cout << L[N];
}

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

int main() {
    ll N, K;
    cin >> N >> K;
    ll ans = K;
    rep(i, 0, N-1) ans *= (K-1);
    cout << ans << endl;
}

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

s = 1

a = list(map(int,input().split()))
a.append(None)

ans = 0

for i in range(N):

    i += 1
    if a[i-1] == a[i]:
        s += 1

    else:
        ans += s//2
        s = 1

print (ans)


Measured memory_bytes: 38256
#include<stdio.h>

typedef struct{
  int p;
  int d;
}Person;

int main(){
  
  int n,i;
  Person max;
  
  while(1){
    max.p=0;
    max.d=0;
    
    scanf("%d",&n);
    if(n==0) break;
    for(i=0;i<n;i++){
      int p,d1,d2;
      scanf("%d %d %d",&p,&d1,&d2);
      if(d1+d2 >= max.d){
	max.p = p;
	max.d = d1+d2;
      }
    }

    printf("%d %d\n",max.p,max.d);
  }

  
  return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n;
	int d[101][3];
	int f;
	int tmp;
	while(cin>>n,n){
		f=1;
		for(int i=1;i<=n;i++)cin>>d[i][0]>>d[i][1]>>d[i][2];
		for(int i=1;i<=n;i++)for(int j=1;j<n;j++)if(d[j][1]>d[j+1][1])for(int k=0;k<3;k++)swap(d[j][k],d[j+1][k]);
		
		for(int i=1;i<=n;i++){
			for(int j=1;j<=2;j++){
				tmp=0;
				//cout<<d[i][j]<<" ";
				for(int k=1;k<=n;k++){
					if(d[i][j]<d[k][1])k+=200;
					else if(d[k][1]<=d[i][j] && d[i][j]<d[k][2])tmp+=d[k][0];
				}
				if(tmp>150)f=0;
				//cout<<tmp<<endl;
			}
		}
		
		if(f)cout<<"OK"<<endl;
		else cout<<"NG"<<endl;
	}
	
	
	return 0;
}


Measured memory_bytes: 1152
#include <stdio.h>

int main() {

  int n;
  int i = 0;
  char c;
  int array[100];

  scanf("%d", &n);

  while(i < 100) {
    scanf("%d%c", &array[i], &c);
    i++;
    if(c == '\n' || i == n)
      break;
  }

  for(i = 0; i < n/2; i++) {
    int temp = array[i];
    array[i] = array[n-i-1];
    array[n-i-1] = temp;
  }

  for(i = 0; i < n-1; i++)
    printf("%d ", array[i]);
  printf("%d\n", array[i]);

  return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
const ll INF = 1e14;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

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

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll N,M;
    cin >> N >> M;
    vvc<ll> A(N+1);
    rep(i,M){
        ll a, b;
        cin >> a >> b;
        A[a].eb(b);
    }

    array<ll, 100005> dp={0};
    repe(i,1,N+1){
        chmax(dp[i], dp[i - 1]);
        for (auto b : A[i]) chmax(dp[b], dp[i] + 1);
    }
    cout << dp[N] << endl;
}

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

#define ll long long
#define ull unsigned long long 
#define endl "\n"
#define pii pair<int, int>
#define all(a) a.begin(),a.end()

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    ll sa=0, sb=0;
    for(int i=0; i<n; ++i)
        cin >> a[i], sa+=a[i];

    for(int i=0; i<n; ++i)
        cin >> b[i], sb+=b[i];
    
    if(sa<sb){
        cout << -1;
        return 0;
    }

    ll rs=0, ans=0;
    vector<int> gs;
    for(int i=0; i<n; ++i){
        if(a[i]<b[i])
            rs+=b[i]-a[i], ans++;
        
        if(a[i] > b[i])
            gs.push_back(a[i]-b[i]);
    }
    sort(all(gs), greater<int> ());

    for(auto x: gs){
        if(rs > 0){
            ans++;
            rs -= x;
        }
        else
            break;
    }
    cout << ans;
}

Measured memory_bytes: 4396
fun main(args: Array<String>) {
    val s = readLine()!!
    val res = s.toCharArray()[0] != s.toCharArray()[1] || s.toCharArray()[0] != s.toCharArray()[2] || s.toCharArray()[1] != s.toCharArray()[2]

    if (res) println("Yes")
    else println("No")
}


Measured memory_bytes: 31736
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n, x, t;
        n = sc.nextInt();
        x = sc.nextInt();
        t = sc.nextInt();
        long ans = 0, tako = 0;
        while (n > tako) {
            ans += t;
            tako += x;
        }
        System.out.println(ans);
        sc.close();
    }
}

Measured memory_bytes: 35524
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    m,n = LI()
    print(pow(m,n,mod))
    return

#Solve
if __name__ == "__main__":
    solve()



Measured memory_bytes: 6060
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define debug(x) cerr<<#x<<": "<<x<<endl;
#define MOD 1000000007ULL;
#define rep(i,n) for(int i=0;i<n;i++)


int main() {
  	int A,B;
	cin>>A>>B;
  
  	cout<<(A-1)*(B-1)<<endl;
  	
  
  
}

Measured memory_bytes: 3584
import java.util.*;

import java.io.*;

public class Main {
	static PrintWriter out;
	static StringBuilder sb;
	static long mod = 1000000007;
	static int inf = (int) 1e15;
	static ArrayList<Integer>[] adL, adH;
	static int n, q;

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		out = new PrintWriter(System.out);
		int n = sc.nextInt();
		int k = sc.nextInt();
		long[] f = new long[1000000];
		f[0] = 1;
		long ans = 0;
		for (int i = 1; i < 1000000; i++)
			f[i] = i * f[i - 1] % mod;
		for(int i=0;i<=Math.min(n-1, k);i++) {
			long tem=f[n]*modPow(f[i], mod-2)%mod;
			tem*=modPow(f[n-i], mod-2);
			tem%=mod;
			long t=f[n-1]*modPow(f[i], mod-2)%mod;
			t*=modPow(f[n-i-1], mod-2);
			t%=mod;
			ans+=t*tem%mod;
			ans%=mod;
	//		System.out.println(f[n]+" "+f[n-1]+" "+modPow(i, mod-2));
		//	System.out.println(i+" "+t+" "+tem);
		}
		System.out.println(ans);
		out.flush();
	}

	static long modPow(long a, long e)

	{
		long res = 1;
		while (e > 0) {
			if ((e & 1) == 1)
				res = (res * a) % mod;
			a = (a * a) % mod;
			e >>= 1;
		}
		return res;
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

Measured memory_bytes: 30036
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define fix(n) cout<<fixed<<setprecision(n)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
using namespace std;
typedef long long ll;
const ll mod=1000000007;
double pi=3.1415926535;

int main(){
  string s,t="hi";
  cin>>s;
  int a=0;
  rep(i,0,5){
    if(s==t){
      a++;
      co("Yes");
      break;
    }
    t+="hi";
  }
  if(a==0) co("No");
  
  return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

odd = []
even = []

for i in range(n):
    if i%2 == 0:
        even.append(i)
    else:
        odd.append(i)

if n%2 == 0:
    odd.reverse()
    order = odd + even
else:
    even.reverse()
    order = even + odd

b = []
for i in order:
    b.append(a[i])
print(*b, sep=' ')

Measured memory_bytes: 28264
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;

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

string s,t;
cin >> s >> t;

// dp[i+1][j+1]:= s[i]までとt[j]までの最長共通部分列の長さ
vvi dp(s.size()+1,vi(t.size()+1,0));

for(int i = 0; i < s.size(); ++i) {
    for(int j = 0; j < t.size(); ++j) {
        if(s[i] == t[j]) dp[i+1][j+1] = dp[i][j]+1;
        else dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]);
    }
}

// 復元
string ans = "";
int i = s.size(); int j = t.size();
while(i > 0 && j > 0) {
    if(dp[i][j-1] == dp[i][j]) --j;
    else if(dp[i-1][j] == dp[i][j]) --i;
    else {
        ans = s[i-1] + ans;
        --i;--j;
    }
}
cout << ans << endl;
return 0;
}

Measured memory_bytes: 35584
s = input()
t = input()

dp = [[0]*(len(s)+1) for i in range(len(t)+1)]

for i in range(1, len(t)+1):
    for j in range(1, len(s)+1):
        if s[j-1] == t[i-1]:
            dp[i][j] = max(dp[i-1][j-1] + 1, dp[i][j-1])
        else:
            dp[i][j] = max(dp[i][j-1], dp[i-1][j])

ans = ''
x = len(t)
y = len(s)
while x>0 and y>0:
    if dp[x][y] == dp[x-1][y]:
        x -= 1
    elif dp[x][y] == dp[x][y-1]:
        y -= 1
    else:
        ans += s[y-1]
        x -= 1
        y -= 1
print(ans[::-1])

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

int main() {
    int x;
    cin >> x;
    if(x == 7 || x == 5 || x == 3) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
ans = "Yes"
s = input()
n = len(s)
half = n//2
def iskaibun(v):
    vh = len(v)//2
    for i in range(vh):
        if v[i] != v[-i-1]:
            return True
    return False#kaibun de aru

if iskaibun(s) or iskaibun(s[0:half]) or iskaibun(s[-half:]):
    ans = 'No'
print(ans)

Measured memory_bytes: 3064
// Hail god Yato
 
#include <bits/stdc++.h> 
using namespace std;
 
#define hs ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
const ll mod = 1000000007;
const ll INF = 1e18;
const ll MAX = 100001;
//
//
                void solve(){
                    ll n;
                    cin>>n;
                    map<string, int> store;
                    while(n--){
                        string s;
                        cin>>s;
                        store[s]++;
                    }
                    cout<<"AC x "<<store["AC"]<<"\n";
                    cout<<"WA x "<<store["WA"]<<"\n";
                    cout<<"TLE x "<<store["TLE"]<<"\n";
                    cout<<"RE x "<<store["RE"]<<"\n";
                }
                int main(){ 
                        hs;
                        ll t;
                        t=1;
                        // cin>>t;
                        for (int i=1; i<=t; i++){
                                //cout<<"Case #"<<i<<": ";
                                solve();
                         }
        return 0; 
}         
 
 

Measured memory_bytes: 3668
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    int max = 0;
    rep(i, n){
        cin >> a.at(i);
        if(max < a.at(i)) max = a.at(i);
    }
    int max1 = 0;
    int ans = 0;
    rep(i, n){
        if(a.at(i) != max){
            if(max1 < min(max - a.at(i), a.at(i))){
                max1 = min(max - a.at(i), a.at(i));
                ans = a.at(i);
            }
        }
    }
    cout << max << ' ' << ans << endl;
    return 0;
}

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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);

vector<i_i> edges[1005][1005];
int memo[1005][1005];
bool visited[1005][1005];

int dfs(int i, int j) {
  if (memo[i][j] >= 0) return memo[i][j];
  visited[i][j] = true;

  int ret = 1;
  for (i_i p : edges[i][j]) {
    if (visited[p.first][p.second] && memo[p.first][p.second] < 0) return memo[i][j] = I_INF;
    chmax(ret, dfs(p.first, p.second) + 1);
  }

  return memo[i][j] = ret;
}

int main(int argc, char* argv[]) {
  int n;
  cin >> n;
  rep(i, 0, n) {
    i_i prev{-1, -1};
    rep(j, 0, n - 1) {
      int to;
      cin >> to;
      to--;

      if (prev.first != -1) {
        edges[prev.first][prev.second].pb({min(i, to), max(i, to)});
      }
      prev.first = min(i, to);
      prev.second = max(i, to);
    }
  }

  int ans = 0;
  Fill(memo, int(-1));
  rep(i, 0, n) rep(j, 0, n) {
    if (i >= j) continue;
    chmax(ans, dfs(i, j));
  }

  cout << (ans >= I_INF ? -1 : ans) << endl;
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

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

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

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}


Measured memory_bytes: 44544
#include <iostream>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <cmath>
#include <iomanip>
using namespace std;

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

#define X real()
#define Y imag()
#define fi first
#define se second
typedef complex<double> PT;
typedef pair<int,int> pii;

struct UnionFind {
	vector<int> uf;
	vector<int> rk;
	int sz;

	UnionFind(int n) {
		sz = n;
		uf.resize(n);
		rk.resize(n);
		this->init();
	}

	void init() {
		rep(i,sz) {
			uf[i] = i;
			rk[i] = 0;
		}
	}

	int find(int a) {
		return uf[a] == a ? a : (uf[a] = this->find(uf[a]));
	}

	bool same(int a, int b) {
		return find(a) == find(b);
	}

	void merge(int a, int b) {
		int aa, bb;
		aa = find(a);
		bb = find(b);
		if(aa == bb) return;
		if(rk[aa] > rk[bb]) {
			uf[bb] = aa;
		}
		else {
			if(rk[aa] == rk[bb]) rk[bb]++;
			uf[aa] = bb;
		}
	}
};

int N, M;
vector<PT> P;
vector<pair<double,pii> > E;

int main() {
	cin >> N >> M;
	for(int i = 0; i < N; i++) {
		int x, y;
		cin >> x >> y;
		P.push_back(PT(x,y));
	}
	for(int i = 0; i < M; i++) {
		int p, q;
		cin >> p >> q;
		p--; q--;
		E.push_back(make_pair(abs(P[p] - P[q]),pii(p,q)));
	}
	sort(E.rbegin(), E.rend());
	UnionFind uf(N);
	double res = 0;
	for(int i = 0; i < E.size(); i++) {
		int p, q;
		p = E[i].se.fi;
		q = E[i].se.se;
		if(uf.same(p,q)) {
			res += E[i].fi;
		}
		else {
			uf.merge(p,q);
		}
	}
	cout << setprecision(10) << fixed << res << endl;
}

Measured memory_bytes: 1964
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public int findWay(int[][] mat,int N,int C,int R,int count,int rI,int cI) {
  		if(rI > N-R ) {
			if(cI < N-C) {
				cI++;
				return findWay(mat, N, C, R, count,0, cI);
			}
			else {
				return count;
			}
		}
		rI++;
		count++;
		return findWay(mat, N, C, R, count, rI, cI);
	}
	public static void main(String[] args) throws NumberFormatException, IOException {	
		Main ac = new Main();
		int count = 0;
		int N,H,W;
		int cI,rI;
		cI = 0;
		rI = 0;
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		N = Integer.parseInt(br.readLine());
		H = Integer.parseInt(br.readLine());
      	W = Integer.parseInt(br.readLine());
		int mat[][] = new int[N][N];
		System.out.println(ac.findWay(mat, N, H, W, count, rI, cI));
	}
}


Measured memory_bytes: 21332
from typing import  Any


class FixedQueue:
    class Empty(Exception):
        pass

    class Full(Exception):
        pass

    def __init__(self, capacity: int) -> None:
        self.no = 0
        self.front = 0
        self.rear = 0
        self.capacity = capacity
        self.que = [None] * capacity

    def __len__(self) -> int:
        return  self.no

    def is_empty(self) -> bool:
        return self.no <= 0

    def is_full(self) -> bool:
        return  self.no >= self.capacity

    def enque(self, x: Any) -> None:
        if self.is_full():
            raise FixedQueue.Full
        self.que[self.rear] = x
        self.rear += 1
        self.no += 1
        if self.rear == self.capacity:
            self.rear = 0

    def deque(self) -> Any:
        if self.is_empty():
            raise FixedQueue.Empty
        x = self.que[self.front]
        self.front += 1
        self.no -= 1
        if self.front == self.capacity:
            self.front = 0
        return  x

current_time = 0
n, p = map(int, input().split())
Q = FixedQueue(n + 1)

for i in range(n):
    name, time = input().split()
    time = int(time)
    Q.enque([name, time])

while len(Q) > 0:
    u = Q.deque()
    c = min(p, u[1])
    u[1] -= c
    current_time += c
    if u[1] > 0:
        Q.enque(u)
    else:
        print(str(u[0]) + ' ' + str(current_time))


Measured memory_bytes: 14444
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "No" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
int gcd(int a,int b){
    if(a<=0||b<=0){
        return 0;
    }
    if(a<b)swap(a,b);
    int r=a%b;
    while(r){
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}

const int maxN=100400;
bool Prime[maxN+1]={};
void PrimeArray(int n){
    for(int i=0;i<=maxN;i++){
        Prime[i]=true;
    }
    Prime[0]=false;
    Prime[1]=false;
    int root_n = (int)sqrt(n);
    for(int i=2;i<=root_n;i++){
        if(Prime[i]==false)continue;
        for(int j=2*i;j<=n;j+=i){
            Prime[j]=false;
        }
    }
}

signed main(void){
    int A,B;
    cin >> A >> B;
    int G=gcd(A,B);
    int Ans=1;
    vector<int> V;
    int g=G;
    while(g!=1){
        bool c=true;
        for(int i=2;i*i<=g;i++){
            if(g%i==0){
                V.push_back(i);
                g/=i;
                c=false;
                break;
            }
        }
        if(c==true){
            V.push_back(g);
            break;
        }
    }
    //REP(i,V.size()){cout << V[i] << " ";}cout << endl;
    int v=V.size();
    
    if(v==0){
        cout << 1 << endl;
        return 0;
    }
    
    REP(i,v-1){
        if(V[i]!=V[i+1]){
            Ans++;
        }
    }
    Ans++;
    cout << Ans << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    while (cin >> N) {
        int ma = 0, x = 1;
        string s = to_string(N);
        FOR(i, 1, 4) {
            if (s[i] == s[i - 1])x++;
            else x = 1;
            smax(ma, x);
        }
        cout << (ma >= 3 ? "Yes" : "No") << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<math.h>
#include<string.h>
using namespace std;
#define MAX 200005
#define MOD 1000000007
#define NIN -100000000
#define EPS 0.0000000001
int main()
{
    int a,b;
    scanf("%d %d",&a,&b);
    printf("%d",a*b);
    return 0;
}


Measured memory_bytes: 3844
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int n,m;
  cin >> n >> m;
  vector<int> k(n,0);
  vector<int> an(n,0);
  int ans=0;
  rep(i,m){
    int a;
    string s;
    cin >> a >> s;
    if(s=="AC") k[a-1]=1;
    else if(k[a-1]==0) an[a-1]++;
  }
  int answer=0;
  rep(i,n){
    if (k[i]==1){
      answer++;
      ans+=an[i];
    }
  }
  cout << answer << " " << ans << endl;
}
                     


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
struct UnionFind{
  vector<int> data;
  int __size;
  UnionFind(int sz) {
  data.assign(sz, -1);
  __size = sz;
  }
 
  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);//親は負でサイズを保存
    __size--;
    data[x] += data[y];
    data[y] = x;
    return (true);
  }
 
  int find(int k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }

  bool same(int x, int y){
    return find(x) == find(y);
  }
 
  int size(int k) {
    return (-data[find(k)]);
  }

  int union_count() {
    return (__size);
  }
};

int main() {
  int n, q;
  cin >> n >> q;
  UnionFind uf(n);
  while (q--) {
    int t, u, v;
    cin >> t >> u >> v;
    if (t) cout << uf.same(u, v) << endl;
    else uf.unite(u, v);
  }
  return 0; 
}


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

using namespace std;

long long  n, a[200002], sol;

int main()
{
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  long long r = 1, sum = 0;
  for (int i = 1; i <= n; i++) {
    while (r <= n && (sum ^ a[r]) == sum + a[r]) {
      sum = (sum ^ a[r]);
      r++;
    }
    sol += r - i;
    sum = (sum ^ a[i]);
  }
  cout << sol;
  return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<string>
#include<sstream>
#include<iomanip>
#include<utility>
#include<cmath>
#include<set>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<set>
#include<cstring>
#include<iterator>
#include<bitset>
#include<assert.h>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef vector<int> VI;
typedef vector<long long int> VL;
static const int MOD = 1000000007;
static const int INF = 2147483647;
//static const long long INF = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
//static const int INF = 1000010000;
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define NP next_permutation
#define PQ priority_queue
#define UB upper_bound
#define LB lower_bound
#define ALL(x) (x).begin(),(x).end()
#define SZ(a) int((a).size())
#define LEN(a) int((a).length())
#define MAX(a,b,c) max((a),max((b),(c)))
#define MIN(a,b,c) min((a),min((b),(c)))
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REP1(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREP1(i,x) for(int i=((int)(x));i>0;i--)
//#define int ll
//struct edge {int to,cost;};

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

    for(int i=0;i*10000<=y;i++){
        for(int j=0;j*5000+i*10000<=y;j++){
            int cur = j*5000+i*10000;
            if((y-cur)/1000==n-i-j){
                printf("%d %d %d\n",i,j,n-i-j);
                return 0;
            }
        }
    }

    puts("-1 -1 -1");

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
using vs = vector<string>;
using vb = vector<bool>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n;
    cin >> n;
    vl a(n);
    int minus = 0;
    ll sum = 0;
    REP(i, n) {
        cin >> a[i];
        if (a[i] < 0) {
            minus++;
            a[i] = abs(a[i]);
        }
        sum += a[i];
    }
    SORT(a);
    if (minus % 2 == 1) sum -= a[0] * 2;
    cout << sum << endl;
}


Measured memory_bytes: 3980
#include <stdio.h>
int main(void) {
	
    int i,x;
	i=1;
	
	scanf("%d",&x);
	
	//入力値が0ではない間
	while(x != 0){
		printf("Case %d: %d\n",i,x);
		
		i++;
		
		scanf("%d",&x);
	}
    return 0;
}



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

int main()
{

    int n;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; i++)
    {
        cin >> v.at(i);
    }

    double sum = 0;
    for (int i : v)
    {
        sum += (1.0 / i);
    }
    cout << 1.0 / sum << endl;
}


Measured memory_bytes: 256
def choose(n, m, mod):
    x, y = 1, 1
    for i in range(m):
        x = x * (n - i) % mod
        y = y * (i + 1) % mod
    return x * pow(y, mod - 2, mod) % mod

n, a, b = map(int, input().split())
mod = 10 ** 9 + 7

ans = (pow(2, n, mod) - 1 - choose(n, a, mod) - choose(n, b, mod)) % mod
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include<string>
using namespace std;
int main(void){
    // Your code here!
    int a,b,c,x,y,ans;
    cin>>a>>b>>c>>x>>y;
    if(x>y && (c*2)<a){
        ans=c*2*x;
    }else if(x<y && (c*2)<b){
        ans=c*2*y;
    }else if(c*2>a+b){
        ans=x*a+y*b;
    }else if(x>y){
        ans=y*c*2+(x-y)*a;
    }else{
        ans=x*c*2+(y-x)*b;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
ll N;
ll L[4000];

void input() {
    cin >> N;
    for(int i = 1; i <= N; i++) cin >> L[i];
}

void solve() {
    input();
    vector<ll> v(N);
    for(int i = 0; i < N; i++) v[i] = L[i+1];
    sort(v.begin(), v.end());
    ll ans = 0;
    for(ll mid = 0; mid <=N-1; mid++) {
        for(ll low = mid +1; low <=N-1; low++) {
            auto itr = lower_bound(v.begin(), v.end(), v[mid] + v[low]);
            ll ng = distance(itr, v.end());
            ans += (N - 1 - low) - ng;
            
        }
    }
    cout << ans << endl;
    return;
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)

                    
using ll = long long;
using ull = unsigned long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll mod = 1e9+7;
void chmod(ll &M){
  if(M >= mod) M %= mod;
  else if(M < 0){
     M += (abs(M)/mod + 1)*mod;
    M %= mod;
}
}
ll modpow(ll x, ll n){
   if(n==0) return 1;
  ll res=modpow(x, n/2);
 if(n%2==0) return res*res%mod;
else return res*res%mod*x%mod;
}
int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };
long long GCD(long long a, long long b) {
  if (b == 0) return a;
  else return GCD(b, a % b);
}

using namespace std;
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
int main()
{
    int S, W;
    cin >> S >> W;
    if (S <= W)
    cout <<  "unsafe" << endl;
    else cout << "safe" << endl;
}


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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll n;
    cin >> n;
    vector<string> s(n);
    ll ans = 0;
    ll a = 0;
    ll b = 0;
    ll ab = 0;
    for(i = 0;i < n;++i){
        cin >> s.at(i);
        if(s.at(i).at(0) == 'B' && s.at(i).back() == 'A') ++ab;
        else if(s.at(i).at(0) == 'B') ++b;
        else if(s.at(i).back() == 'A') ++a;
        rep(j, s.at(i).size()-1){
            if(s.at(i).substr(j,2) == "AB") ++ans;
        }
    }
    ll tmp = 0;
    if(b >= a + ab){
        tmp = a + ab;
    }else if(a >= b + ab){
        tmp = b + ab;
    }else if(a + b != 0){
        tmp = ab + min(a,b);
    }else{
        tmp = ab-1;
    }
    cout << ans + tmp << endl;
    return 0;
}

Measured memory_bytes: 3704
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

int main(){
  int a,b;
  cin >> a >> b;
  int c = a*b;
  if(c%2==0) cout << "Even" << endl;
  else cout << "Odd" << endl;
  return 0;
}


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


// #include <deque>
// #include <stack>
// #include <set>
// #include <map>
// #include <string>
// #include <unordered_set>
// #include <unordered_map>
// #include <queue>
// #include <tuple>

// #include <cmath>
// #include <numeric>

using namespace std;
typedef long long ll;
typedef long l;
typedef pair<long,long> pll;
typedef pair<int,int> pii;
typedef pair<int,long> pil;
typedef pair<long,int> pli;
const char el = '\n';

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

    int a,b;
    cin>>a>>b;
    cin.ignore();

    for (int p =1; p<= 1009 ; ++p){
        if (p/10 == b && (8*p)/100 == a) {
            cout<<p<<el;
            return 0;
        }
    }
    
    cout<<-1<<el;
    
    // long n, m;
    // cin>>n>>m; cin.ignore();

}



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

int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(a>c) cout<<min(max(0,d-a),max(0,b-a))<<endl;
  else cout<<min(max(0,b-c),max(0,d-c))<<endl;
}

Measured memory_bytes: 256