akhauriyash/Code-Regression huggingface dataset:
//$g++ -std=c++11 Template.cpp 

//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>
#include <bitset>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

priority_queue<int> q_descending;
priority_queue<int, vector<int>, greater<int> > q_ascending;

ll a[100100];
ll cnt[100100];
ll n, k;
ll func(ll x){
  ll ans = 0LL;
  REP(i, n) ans += x ^ a[i]; 
  return ans;
}

ll calc(ll x){
  ll sum = 0LL;
  REP(i, 60){
    if(x & (1LL<<i)) sum += (1LL<<i)*max(cnt[i], n-cnt[i]);
    else sum += (1LL<<i) * cnt[i];
  }
  return sum;
}
//int cnt[40] = {};

/* 解説AC, 上位bitから*/

int
main(void){  
  ios_base::sync_with_stdio(false);

  cin >> n >> k;
  REP(i, n) {
    cin >> a[i];
    ROF(j, 60, 0){
      if(a[i] & (1LL<<j)) cnt[j]++;
    }
  }
  ll ans = max(calc(0), calc(k));
  REP(i, 60){
    int j = 60-1-i;
    if((1LL<<j) & k) ans = max(ans, calc((k^(1LL<<j))|((1LL<<j)-1)));
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
from bisect import bisect_left

N = int(input())
L = list(map(int, input().split()))

L.sort()
result = 0
for i in range(N-2):
  for j in range(i+1, N-1):
    result += bisect_left(L, L[i]+L[j]) - j - 1

print(result)

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

struct Cube {
  public:
  int f[6];
  void roll(int i, int j, int k, int l){
    int t = f[i]; f[i] = f[j]; f[j] = f[k]; f[k] = f[l]; f[l] = t; 
    //f[k] = f[l];忘れてた
  }
  void move(char ch) {
    if ( ch == 'W' ) roll_x();
    if ( ch == 'S' ) 
      for ( int i = 1; i <= 3; i++ ) roll_y();
    if ( ch == 'E' )
      for ( int i = 1; i <= 3; i++ ) roll_x();
    if ( ch == 'N' ) roll_y();
  }
  void roll_x() { roll(0,2,5,3); } 
  void roll_y() { roll(0,1,5,4); }
    
};

int main() {
  Cube c;
  for ( int i = 0; i < 6; i++ ) cin >> c.f[i];
  string com;
  cin >> com; //stringだから文字列ok
  for ( int i = 0; i < com.size(); i++ ) c.move(com[i]);
  cout << c.f[0] << endl;
  return 0;
}


Measured memory_bytes: 3204
n = int(input())

dp = [0 for _ in range(45)]

def fib_dp(n):
    dp[0] = 1
    dp[1] = 1
    for i in range(2, n+1):
        dp[i] = dp[i-1] + dp[i-2]
    return dp[n]
       
print(fib_dp(n))

Measured memory_bytes: 7728
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define cool ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) 
#define ll long long
#define MAX 1000001
#define mod 1000000007
#define pie 3.14159265358979323846
void solve()
{
	int n;
	cin>>n;
	if(n<=111)
	cout<<"111";
	else if(n>111&&n<=222)
	cout<<"222";
	else if(n>222&&n<=333)
	cout<<"333";
	else if(n>333&&n<=444)
	cout<<"444";
	else if(n>444&&n<=555)
	cout<<"555";
	else if(n>555&&n<=666)
	cout<<"666";
	else if(n>666&&n<=777)
	cout<<"777";
	else if(n>777&&n<=888)
	cout<<"888";
	else if(n>888&&n<=999)
	cout<<"999";
}
int main()
{ 
    cool;
    int t;
    //cin>>t;
    t=1;
    while(t--){
    	solve();
	}
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	private static Scanner scan = new Scanner(System.in);

	public static void main(String[] args) {
		String[] firstLine = scan.nextLine().split(" ");
		int k = Integer.valueOf(firstLine[0]);
		int x = Integer.valueOf(firstLine[1]);
		StringBuilder sb = new StringBuilder();

		int index = x - k;
		for (int i = k * 2 - 1; i > 0; i--) {
			sb.append((index += 1) + " ");
		}
		if (!sb.toString().isEmpty()) {
			sb.deleteCharAt(sb.length() - 1);
		}
		System.out.println(sb.toString());
	}
}


Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <stdexcept>
#include <map>
using namespace std;
using ll = long long;

vector<ll> primes();

ll gcd(ll a, ll b){
	return (b > 0)? gcd(b, a % b) : a ;
}

ll mpowi(ll mod, ll a,ll b){
    ll res = 1;
    while(b != 0){
        if(b%2 ==1)res=(res*a)%mod;
        a = (a * a)%mod;
        b /= 2;
    }
    return res;
}

ll mdiv(ll mod, ll a, ll b){
    return (a * mpowi(mod,b,mod-2))%mod;
}

void factorize(map<ll,ll>& res,int a){
    for(int i = 2;i < int(sqrt(a)+1);i++){
        while(a%i == 0){
            res[i]++;
            a /= i;
        }
    }
    if(a > 1)res[a]++;
    
}
int main(){
    ll N;cin>>N;
    vector<ll> v;
    map<ll,ll> lcm;
    for(int i = 0;i < N;i++){
        ll a;cin>>a;
        v.push_back(a);
    }
    for(int i = 0;i < N;i++){
        map<ll,ll> fac;
        factorize(fac,v[i]);
        for(auto& x:fac){
            lcm[x.first] = max(lcm[x.first], x.second);
        }
    }
    // for(auto x:lcm){
    //     cout<<x.first<<x.second<<endl;
    // }
    ll res = 0;
    ll MOD = 1'000'000'007;
    ll mlcm = 1;
    for(auto& x:lcm){
        mlcm = (mlcm * mpowi(MOD, x.first, x.second)) % MOD;
    }
    for(ll i = 0;i < N;i++){
        ll a = v[i];
        ll b = mdiv(MOD,mlcm,a);
        
        res = (res + b) % MOD;
    }
    cout<<res<<endl;

}

Measured memory_bytes: 896
import math,cmath

def f(m):
    c=1j*math.acos(a/2)
    r=cmath.exp(b+c)+p
    s=cmath.exp(b-c)+p
    u=v=2
    for t in A:
        if t in [p,q]:
            continue
        if abs(t-r)-1<1e-6:
            u+=1
        if abs(t-s)-1<1e-6:
            v+=1
    return max(m,u,v)

while 1:
    n=int(raw_input())
    if n==0:
        break
    N=range(n)
    A=[]
    for i in N:
        #x,y=map(float,int(raw_input()))
        x,y=map(float,input())
        A+=[x+1j*y]
    m=1
    for i in N:
        p=A[i]
        for q in A[i+1:]:
            a,b=cmath.polar(q-p)
            b*=1j
            if a<=2:
                m=f(m)
    print m

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

using namespace std;

#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<char> vc;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef long long ll;

const int MOD = 1000000007;

void solve() {
  int N, K;
  cin >> N >> K;
  vi H(N, 0);
  for (int i = 0; i < N; i++) {
    cin >> H[i];
  }
  sort(all(H));
  ll ans = 0;
  for (int i = 0; i < N - K; i++) {
    ans += H[i];
  }
  cout << ans << endl;
}

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

  solve();

  return 0;
}


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

using namespace std;

bool comp(int a, int b)
{
    return a > b;
}

int main(int argc, char const *argv[])
{
    int N;
    cin >> N;
    vector<int> A, B;
    A.resize(N);
    B.resize(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }

    B = A;
    sort(A.begin(), A.end(), comp);
    int max = A[0];
    int ans;

    for (int n : B)
    {
        if (n < max)
        {
            ans = max;
        }else
        {
            ans = A[1];
        }
        cout << ans << endl;
        
    }

    return 0;
}

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

using namespace std;

template <class T>inline T updmax(T& a, T b) {return a = max(a, b);}
template <class T>inline T updmin(T& a, T b) {return a = min(a, b);}

class Solution {
public:
	void solve() {
		string s;
		cin >> s;
		int n = s.length();
		int ret = 0;
		for(int i=0; i < n/2; i++){
			if(s[i] != s[n-1-i])ret++;
		}
		cout << ret << endl;
		return;
	};
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	Solution solution;
	solution.solve();
	return 0;
}

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

int main(){
	int n,k;
	cin >> n >> k;
	int ans = 1;
	for(int i = 0 ; i < n ; i++ ){
		if( ans + k < ans * 2 ){
			ans += k;
		}
		else
			ans *= 2;
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define endl '\n'
#define all(x) (x).begin(),(x).end()
const int INF=1000000000+5;
const int N=1e6+5;
const ll oo=1e18+5;
const ll mod=1e9+7;

int main(){
	ios::sync_with_stdio(0); cin.tie(0);
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	if((a>0&&d<0)||(b<0&&c>0)){
		cout<<max(a*d,c*b);
	}
	else{
		cout<<max(a*c,b*d);
	}
	return 0;
}


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

int main () {
  int a,b,c,x,y;
  cin >>a >>b >>c >>x >>y;
  
  int ans = INT_MAX;
  if ((a/2 + b/2)<c)
  {
    ans = a*x + b*y;
  }
  else
  {
    for (int i=0; i<=max(x,y)*2; i++) {
      int tmp = i*2*c + a*max((x-i),0) + b*max((y-i),0);
        if (tmp <ans) ans =tmp;
    }
  }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N, A, B = LI()

ans = 0

ans = math.floor(N / (A + B)) * A
ans += min(N - math.floor(N / (A + B)) * (A + B), A)
print(ans)

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

int n;
vector<int> d;

int main() {
    cin >> n;
    d.assign(n, 0);
    for(int i = 0; i < n; i++)
        cin >> d[i];
    sort(d.begin(), d.end());

    cout << d[n/2] - d[n/2-1] << endl;
}

Measured memory_bytes: 640
N,K = list(map(int,input().split()))
s = input()

a = []
b = []

index = 0
length = 0
judge = "0"
for i in range(len(s)):
	if s[i] == judge:
		length += 1
	if s[i] != judge:
		if judge == "0":
			b.append(length)
		if judge == "1":
			a.append(length)
		length = 1
		judge = str((int(judge)+1)%2)
if judge == "0":
	b.append(length)
	a.append(0)
if judge == "1":
	a.append(length)


M = len(a)
if K >= M:
	print(len(s))
	exit()

ans = 0
ans_new = 0
for i in range(K):
	ans += a[i]+b[i]
ans_max = ans
for i in range(M-K):
	if i == 0:
		ans_new = ans-b[0]+b[K]+a[K]
	if i != 0:
		ans_new = ans-a[i-1]-b[i]+b[K+i]+a[K+i]
	ans_max = max(ans_max,ans_new)
	ans = ans_new
print(ans_max)




Measured memory_bytes: 4224
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
void max_self(ll& a,ll b){
  a=max(a,b);
}
int main()
{
    int n,w;
    cin>>n>>w;
    vector<ll> dp(w+1,0);
    for(int i=0;i<n;i++){
        ll weight,value;
        cin>>weight>>value;
        for(int weight_self=w-weight;weight_self>=0;weight_self--){
            max_self(dp[weight_self+weight],dp[weight_self]+value);
        }
    }
    cout<<dp[w];
}


Measured memory_bytes: 4032
#include <bits/stdc++.h>
#include <time.h>
#define int long long int
#define pb push_back
#define mem(a, x) memset(a, x, sizeof a)
#define all(a) a.begin(), a.end()
#define scnarr(a, n) for (int i = 0; i < n; ++i) cin >> a[i]
#define vi vector<int>
#define si set<int>
#define pii pair <int, int>
#define sii set<pii>
#define vii vector<pii>
#define mii map <int, int>
#define faster ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
using namespace chrono;
/*
	----------------------------------------------------------------------
	Things to remember : check for coners n = 1, pass references instead
*/
/* -------------------------------Solution Sarted--------------------------------------*/

//Constants
const int MOD = 1000000007; // 1e9 + 7
const int MAXN = 1000005; // 1e6 +5
const int INF = 100000000000005; // 1e15 +5

void solve(){
	int n, ans = 0;
	cin >> n;

	for(int i = 1; i < n; ++i){
		if(n%i == 0)
			ans += n/i -1;
		else
			ans += n/i;
	}

	cout << ans << endl;

	return;
	
}

signed main()
{
	faster;
#ifndef ONLINE_JUDGE
	freopen("ip.txt", "r", stdin);
	freopen("op.txt", "w", stdout);
#endif
	// int t; cin >> t; while(t--)
		solve();
	return 0;
}


//Author : Ankit Raj
//Problem Link :

/*Snippets*/
/*
sieve - prime factorization using sieve and primes in range
zpower - pow with mod
plate - Initial template
bfs 
dfs
fenwik - BIT
binary_search
segment_tree
*/
	

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
const string str = "QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm1234567890";
int n;
vector<string> ss;

inline int ask(const string& s) {
    cout << "? " << s << endl;
    int x;
    cin >> x;
    return x;
}

string merge(int l, int r) {
    if (l == r) return ss[l];
    int mid = (l + r) >> 1;
    string sl = merge(l, mid), sr = merge(mid + 1, r), s;
    for (int i = 0, j = 0, k = n - sl.size(); i <= (int)sl.size(); i++) {
        if (i == (int)sl.size()) {
            while (j < (int)sr.size()) s += sr[j++];
            break;
        }
        while (j < (int)sr.size() && ask(s + sr[j] + sl.substr(i)) == k - 1)
            s += sr[j++], --k;
        s += sl[i];
    }
    return s;
}

int main() {
    for (char c : str) {
        string s(128, c);
        int t = 128 - ask(s);
        if (t) ss.push_back(s.substr(0, t));
        n += t;
    }
    string ans = merge(0, ss.size() - 1);
    cout << "! " << ans << endl;
    return 0;
}


Measured memory_bytes: 3776
#include <bits/stdc++.h> //全ての標準ライブラリ
#define rep(i,n) for(int i = 0;i < n;i++)
using namespace std;
int main(void){
    char s1, s2, s3;
    int cnt = 0;
    cin >> s1 >> s2 >> s3;
    if(s1 == '1' )cnt ++;
    if(s2 == '1' )cnt ++;
    if(s3 == '1' )cnt ++;
    
    cout << cnt;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
#define ALL(a)  (a).begin(),(a).end()
const ll INF = 1e18+18;
const ll MAX = 200000;
const ll MOD = 1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;


int main(){
  string S, T;
  cin>>S>>T;
  ll SzS, SzT;
  SzS=S.size();
  SzT=T.size();
  ll Ans=INF;
  rep(i, SzS-SzT+1){
    ll Cou=0;
    rep(j, SzT){
      if(T.at(j)!=S.at(i+j))Cou++;
    }
    Ans=min(Ans, Cou);
  }
  cout<<Ans<<endl;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair 
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;

int main(){
	//input
	ll H,W; cin>>H>>W;
	char field[1001][1001];
	rep1(i,H){
		string tmp; cin>>tmp;
		rep1(j,W) field[i][j]=tmp[j-1];
	}

	//solve
	ll dp[1001][1001];
	rep(i,1001)rep(j,1001) dp[i][j]=0;
	rep1(i,H){
		if(field[i][1]=='#') break;
		else dp[i][1]=1;
	}
	rep1(i,W){
		if(field[1][i]=='#') break;
		else dp[1][i]=1;
	}
	FOR(i,2,H+1){
		FOR(j,2,W+1){
			if(field[i][j]=='#') dp[i][j]=0;
			else dp[i][j]=(dp[i][j-1]+dp[i-1][j])%MOD;
		}
	}
  
	//output
	cout<<dp[H][W];
}

Measured memory_bytes: 9088
package main

import "fmt"

func main() {
	var n, a int
	fmt.Scan(&n, &a)
	xs := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&xs[i])
	}

	dp := [60][60][3000]int{}
	dp[0][0][0] = 1

	for i := 0; i < n; i++ {
		for j := 0; j <= n; j++ {
			for k := 0; k < 2500; k++ {
				dp[i+1][j][k] += dp[i][j][k]
				dp[i+1][j+1][k+xs[i]] += dp[i][j][k]
			}
		}
	}

	ans := 0
	for i := 1; i <= n; i++ {
		ans += dp[n][i][i*a]
	}
	fmt.Println(ans)
}


Measured memory_bytes: 65588
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
    using namespace std;

    int main(){
      ll n,m;
      cin >> n >> m;
      ll ans=0;
      ll count=0;
      ll sum=0;
      rep(i,m)sum+=1900;
      rep(i,n-m)sum+=100;
      while(count<m){
       sum*=2;
        count++;
      }
      cout << sum << endl;
      return 0;}

Measured memory_bytes: 256
n, m ,x = map(int, input().split())
money=[]
understanding = []
min_total = 1000000000000000

for i in range(n):
    inp = list(map(int, input().split()))
    money.append(inp[0])
    understanding.append(inp[1:])

for i in range(2 ** n):
    _sum = 0
    a = [0]*m
    for j in range(n):
        if ((i>>j)&1):
            _sum+=money[j]
            for k in range(m):
                a[k]+=understanding[j][k]
        if min(a)>=x and min_total>=_sum:
            min_total = _sum
if min_total !=1000000000000000:
    print(min_total)
else:
    print(-1)




Measured memory_bytes: 9144
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		List<String> ret = new ArrayList<String>();
		while (!in.hasNext("-")) {
			String n = in.next();
			int cnt = Integer.parseInt(in.next());
			int i, h;
			for (i = 0; i < cnt; i++) {
				h = Integer.parseInt(in.next());
				n = n.substring(h, n.length()) + n.substring(0, h);
			}
			ret.add(n);
		}

		for (String text : ret) {
			System.out.println(text);
		}
	}
}

Measured memory_bytes: 17272
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
	string s;
	cin >> s;
	long long int k;
	cin >> k;
	string ans;
	for(int unsigned i=0;i<s.size();i++){
		if(s[i] != 'a' && k >= 'z' - s[i] + 1){
			k -= 'z' - s[i] + 1;
			ans += "a";
		} else {
			ans += s[i];
		}
	}
	if(k > 0){
		long long int la = ans[ans.size()-1] - 'a' + k;
		la%=26;
		ans[ans.size()-1] = (char)(la + 'a');
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n'
#define ll long long
int main(){
    Hello
    int n, ans = 0;
    cin >> n;
    int arr[n + 5];
    for(int i = 0; i < n; i++)
        cin >> arr[i];
    for(int i = 1; i < n - 1; i++){
        if((arr[i] > arr[i - 1] && arr[i] < arr[i + 1]) ||
           (arr[i] < arr[i - 1] && arr[i] > arr[i + 1]))
            ans++;
    }
    cout << ans;
    return 0;
}


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

signed main(){
  int A,B,C;
  cin>>A>>B>>C;
  string ans="No";
  if((A+B)>=C)ans="Yes";
  cout<<ans<<endl;
  return 0;
}

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

#define Online 1
// #define multitest 1
#define Debug 1
void ControlIO();
void TimerStart();
void TimerStop();
#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
typedef long long ll;
typedef long double ld;
#define f first
#define s second
#define pb push_back
const long long mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

ll power(int base, int index)
{
	if (index == 0)
		return 1;
	ll temp = power(base, index / 2);
	temp = (temp * temp) % mod;
	if (index & 1)
		temp = (temp * base) % mod;
	return temp;
}

int n, a, b, c;

int _n = 2e5 + 10;
vector<ll> Fact(_n), Inv(_n);
int kmod = 1000000007;

void pre()
{
	Fact[0] = 1;
	for (int i = 1; i < _n; ++i)
		Fact[i] = (Fact[i - 1] * i) % kmod;
	Inv[_n - 1] = power(Fact[_n - 1], kmod - 2);
	for (int i = _n - 2; i >= 0; --i)
		Inv[i] = (Inv[i + 1] * (1 + i)) % kmod;
	// db(Inv[2]*2%mod);
}

ll com(int m)
{
	// db(m, n);
	ll x = (Fact[m - 1] * Inv[n - 1]) % mod;
	x *= Inv[m - n];
	x %= mod;
	ll temp = (power(a, n) * power(b, m - n)) % mod + (power(a, m - n) * power(b, n)) % mod;
	// db(temp);
	temp %= mod;
	temp *= m;
	// db(temp);
	temp %= mod;
	temp *= x;
	// db(temp);
	return temp % mod;
}

void solve()
{
	pre();
	cin >> n >> a >> b >> c;
	ll ans = 0;
	ll div = power(a+b,mod-2);
	a = (a * div) % mod;
	b = (b * div) % mod;
	for (int i = n; i < 2 * n; ++i)
	{
		ans += com(i);
		ans %= mod;
	}
	ans *= power(100 - c, mod - 2);
	ans %= mod;
	ans *= 100;
	cout << (ans % mod) << '\n';
}

int main()
{
	ControlIO();
	int t = 1;
#ifdef multitest
	cin >> t;
#endif
	TimerStart();
	while (t--)
		solve();
	TimerStop();
	return 0;
}

void ControlIO()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
#ifndef Online
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

auto TimeStart = chrono::steady_clock::now();
auto TimeEnd = chrono::steady_clock::now();

void TimerStart()
{
#ifndef Online
	TimeStart = chrono::steady_clock::now();
#endif
}

void TimerStop()
{
#ifndef Online
	TimeEnd = chrono::steady_clock::now();
	auto ElapsedTime = TimeEnd - TimeStart;
	cout << "\n\nTime elapsed: " << chrono::duration<double>(ElapsedTime).count() << " seconds.\n";
#endif
}

Measured memory_bytes: 3328
using System;
using System.Linq;

public class Hello
{
    public static void Main()
    {
        // Your code here!
        
        int[] a = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int A = a[0];
        int B = a[1];
        if (B % A == 0) Console.WriteLine(A + B);
        else Console.WriteLine(B - A);
    }
}

Measured memory_bytes: 13268
#include<iostream>

using namespace std;

const int MAX_T=100;

int a[MAX_T];

int main(){
	int K,T;
	cin>>K>>T;
	for(int i=0;i<T;i++){
		cin>>a[i];
	}
	int ans=0;
	int prev=-1;
	for(int i=0;i<K;i++){
		int ma=0;
		int id=-1;
		for(int j=0;j<T;j++){
			if((ma<a[j]) && (prev!=j)){
				ma=a[j];
				id=j;
			}
		}
		prev=id;
		if(ma>0)a[id]--;
		if(ma==0)break;
	}
	for(int i=0;i<T;i++){
		if(a[i]>0){
			ans+=a[i];
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <stack>
#include <map>
#include <set>
#include <queue>
#include <functional>
using namespace std;
typedef long long ll;
int main(){
    ll n,c,k;
    cin >> n >> c >> k;
    vector<ll> t(n);
    for(int i = 0;i < n;i++)cin >> t[i];
    sort(t.begin(),t.end());

    ll now = t[0];
    ll ans = 0;
    ll now_cnt = 0;
    for(int i = 0;i < n;i++){
        if(now + k < t[i] || now_cnt == c){
            ans += (now_cnt + c - 1) / c;
            now = t[i];
            now_cnt = 1;
        }
        else now_cnt++;
    }

    cout << ans + (now_cnt + c - 1) / c << endl;
}

Measured memory_bytes: 1024
# https://atcoder.jp/contests/abc140/tasks/abc140_d
# D - Face Produces Unhappiness
import bisect
N, K = list(map(int, input().split()))
S = input().split()[0]

p = 0
lr_index_list = []
rl_index_list = []
for i in range(1, N):
    if S[i] == S[i-1]:
        p += 1
    if S[i-1] + S[i] == 'LR':
        lr_index_list.append(i-1)
    if S[i-1] + S[i] == 'RL':
        rl_index_list.append(i-1)

n_lr = len(lr_index_list)
n_rl = len(rl_index_list)

if n_lr == 0 and n_rl == 0:
    pass
elif n_lr == 1 and n_rl == 0:
    if lr_index_list[0] != 0 and lr_index_list[0] != N - 2:
        # LLLLLRRRRR 系
        p = N - 1
elif n_lr == 0 and n_rl == 1:
    if rl_index_list[0] != 0 and rl_index_list[0] != N - 2:
        # RRRRRLLLLL 系
        p = N - 1
else:
    kouho_n = min(n_lr, n_rl)
    # 少ない方を基準で探す
    if kouho_n == n_lr:
        x_list = lr_index_list
        org_x_list = x_list[:]
        y_list = rl_index_list
        org_y_list = y_list[:]
    else:
        x_list = rl_index_list
        org_x_list = x_list[:]
        y_list = lr_index_list
        org_y_list = y_list[:]
    c = 0
    for x in org_x_list:
        y_index = bisect.bisect_left(y_list, x)
        is_ok = False
        # 1個右隣をチェック
        if y_index != len(y_list):
            if abs(y_list[y_index] - x) >= 2:
                is_ok = True
                y_list.remove(y_list[y_index])
                x_list.remove(x)
        # 1個左隣をチェック
        if is_ok == False and y_index != 0:
            if abs(y_list[y_index-1] - x) >= 2:  # TODO
                is_ok = True
                y_list.remove(y_list[y_index-1])
                x_list.remove(x)
        # 2個右隣があるかどうかをチェック
        if is_ok == False and y_index + 1 < len(y_list):
            is_ok = True
            y_list.remove(y_list[y_index+1])
            x_list.remove(x)
        # 2個左隣があるかどうかをチェック
        if is_ok == False and y_index - 2 >= 0:  # TODO
            is_ok = True
            y_list.remove(y_list[y_index-2])
            x_list.remove(x)
        if is_ok:
            c += 1
        if c >= K:
            break

    p += min(c, K) * 2

    w_list = x_list + y_list
    if 0 in w_list:
        w_list.remove(0)
    if N - 1 in w_list:
        w_list.remove(N-1)

    if K - c >= 1 and w_list:
        p += 1

ans = p
print(ans)


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

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

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

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

    int left  = prev(upper_bound(sa.begin(),sa.end(),sa[n] / 2)) - sa.begin();
    int right = upper_bound(sa.begin(),sa.end(),sa[n] / 2) - sa.begin();
    //cout << left << " " << right << endl;

    long long int ans = 1e18;// INF
    ans = min(ans, sa[n] - 2 * sa[left]);
    ans = min(ans, 2 * sa[right] - sa[n]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6428
#include<stdio.h>
int main(void){
  int N,k=1;
  scanf("%d",&N);
  int H[N];
  for(int n=0;n<N;n++){
  scanf("%d",&H[n]);
  }
  int s=H[0];
  for(int m=1;m<N;m++){
	for(int t=0;t<m;t++){
      if(s<H[t])s=H[t];
    }
    if(H[m]>=s)k=k+1;
  }
  printf("%d\n",k);
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>

namespace
{

}

namespace ABC169
{

  class D
  {
  public:
    D() = default;
    ~D() = default;

    bool IsPrime(long long num)
    {
      if (num < 2) return false;
      if (num == 2) return true;

      for (long long i = 2; i*i <= num; ++i)
      {
        if (num%i == 0)
        {
          return (num/i) == 1;
        }
      }

      return true;
    }

    void Run()
    {
      long long N;
      std::cin >> N;

      std::vector<long long> yakusu = {};
      {
        auto v = N;
        for (long long i = 2; i*i <= v; ++i)
        {
          if (!IsPrime(i)) continue;

          while (v%i == 0)
          {
            yakusu.push_back(i);
            v /= i;
          }
        }
        if (IsPrime(v)) { yakusu.push_back(v); }
      }

      int p_count = 0;
      int use_count = 0;
      int max_count = 0;
      int before_v = 0;
      for (auto v : yakusu)
      {
        if (v != before_v)
        {
          use_count = 0;
          max_count = 0;
        }
        before_v = v;
        use_count++;

        if (use_count > max_count)
        {
          p_count++;
          use_count = 0;
          max_count++;
        }
      }

      std::cout <<  p_count  << std::endl;
    }
  };

}

int main()
{

  ABC169::D prob;
  prob.Run();

  return 0;
}



Measured memory_bytes: 3140
def main():
    a, b, c = map(int, input().split())

    if ( a == 7 and b == 5 and c == 5) or (a == 5 and b == 7 and c == 5) or (a == 5 and b == 5 and c == 7):
        print("YES")
    else:
        print("NO")

if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
def examC():
    N = I()
    cur = [1,1]
    for i in range(N):
        T, A = LI()
        k = max((cur[0]+T-1)//T,(cur[1]+A-1)//A)
        cur[0] = T * k
        cur[1] = A * k
#        print(cur)
    print(sum(cur))



import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define scn(n) scanf("%d",&n)
const int N=1e7+2;
using namespace std;

int main() {
	
    int n;
    cin>>n;
    
    ll ans=0;
    for(int i=1;i<=n;i++)
    {
        ll cnt=n/i; // in how many nos i is a factor
        
        cnt=cnt*(cnt+1);
        cnt/=2;
        
        ans+=(cnt*i);
        
    }
    cout<<ans;
	return 0;
}

Measured memory_bytes: 3608
#include <stdio.h>

int main(void)
{
	int S,h,m,s,a,b;
	
	scanf("%d\n",&S);
	
	h=S/3600;
	a=S%3600;
	m=a/60;
	s=a%60;
	
	if(0<S<86400);
	if(0<m<60);
	if(0<s<60);
	
	printf("%d:%d:%d\n",h,m,s);
	
	return 0;
}

Measured memory_bytes: 596
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<ctime>
#include<set>
#include<map>
#include<vector>
#include<iostream>
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)((x).size()))
#define rep(i,j,k) for(int i=(int)j;i<=(int)k;i++)
#define per(i,j,k) for(int i=(int)j;i>=(int)k;i--)
using namespace std;
typedef long long LL;
typedef double DB;
const DB pi=acos(-1.0);
const int N=110000;
int n,a[N];
int main(){
	LL ans=0;
	scanf("%d",&n);
	rep(i,1,n)scanf("%d",&a[i]);
	int now=1;
	ans=a[1]-1;
	rep(i,2,n){
		if(a[i]==now+1){
			++now;continue;
		}
		if(a[i]<now+1)continue;
		int v=a[i]/(now+1);
		a[i]-=v*(now+1);
		if(a[i]==0)v--;
		ans+=v;
	}
	cout<<ans<<endl;
	return 0;
}





Measured memory_bytes: 640
#include <algorithm>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;

int main() {
  int N;
  cin >> N;
  vector<int> t(N), v(N);
  for (int i = 0; i < N; i++) {
    cin >> t[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> v[i];
  }
  t.push_back(0);
  v.push_back(0);
  double res = 0;
  int cur = 0;
  for (int i = 0; i < N; i++) {
    int ts = 0, nxt = 1000;
    for (int j = i + 1; j <= N; j++) {
      nxt = min(nxt, v[j] + ts);
      ts += t[j];
    }
    nxt = min(nxt, v[i]);
    nxt = min(nxt, cur + t[i]);
    int a = v[i] - cur, b = v[i] - nxt;
    if (a + b < t[i]) {
      res += (cur + v[i]) * a / 2.0;
      res += v[i] * (t[i] - a - b);
      res += (v[i] + nxt) * b / 2.0;
    } else {
      double x = (t[i] + nxt - cur) / 2.0;
      double y = cur + x;
      res += (cur + y) * x / 2.0;
      res += (y + nxt) * (t[i] - x) / 2.0;
    }
    cur = nxt;
  }
  printf("%.10f\n", res);
  return 0;
}


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

int main(){
    string s;
    cin >> s;
    switch(s[s.length()-1]){
    case '2':
    case '4':
    case '5':
    case '7':
    case '9':
        cout << "hon";
        break;
    case '0':
    case '1':
    case '6':
    case '8':
        cout << "pon";
        break;
    default:
        cout << "bon";
    }
    return 0;
}


Measured memory_bytes: 3640
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

int n;
int n_;
P cnt[6];
ll a,b;
vector<P> xy[5];
vector<P> one;
vector<P> two;
vector<ll> Bval;
int dat[1<<22];

void add(int k,int a){
	k+=n_-1;
	dat[k]+=a;
	while(k>0){
		k=(k-1)/2;
		dat[k]=dat[k*2+1]+dat[k*2+2];
	}
}

int query(int a,int b,int k=0,int l=0,int r=n_){
	if(r<=a || b<=l)return 0;
	if(a<=l && r<=b)return dat[k];
	int vl=query(a,b,k*2+1,l,(l+r)/2);
	int vr=query(a,b,k*2+2,(l+r)/2,r);
	return vl+vr;
}

int main(void){
	scanf("%d%lld%lld",&n,&a,&b);
	for(int i=0;i<n;i++){
		ll x,y;
		int t;
		scanf("%d%lld%lld",&t,&x,&y);
		t--;
		xy[t].push_back(P(x,y));
		cnt[t].first++;
	}
	for(int i=0;i<5;i++){
		cnt[i].second=i;
		xy[i].push_back(P(0,0));
	}
	sort(cnt,cnt+5);
	for(int i=0;i<xy[cnt[0].second].size();i++){
		for(int j=0;j<xy[cnt[1].second].size();j++){
			for(int k=0;k<xy[cnt[2].second].size();k++){
				ll xx=xy[cnt[0].second][i].first+xy[cnt[1].second][j].first+xy[cnt[2].second][k].first;
				ll yy=xy[cnt[0].second][i].second+xy[cnt[1].second][j].second+xy[cnt[2].second][k].second;
				one.push_back(P(xx,yy));
				Bval.push_back(yy);
			}
		}
	}
	sort(one.begin(),one.end());
	reverse(one.begin(),one.end());
	sort(Bval.begin(),Bval.end());
	Bval.erase(unique(Bval.begin(),Bval.end()),Bval.end());
	for(int i=0;i<one.size();i++){
		one[i].second=lower_bound(Bval.begin(),Bval.end(),one[i].second)-Bval.begin();
	}
	for(int i=0;i<xy[cnt[3].second].size();i++){
		for(int j=0;j<xy[cnt[4].second].size();j++){
			ll xx=xy[cnt[3].second][i].first+xy[cnt[4].second][j].first;
			ll yy=xy[cnt[3].second][i].second+xy[cnt[4].second][j].second;
			two.push_back(P(xx,yy));
		}
	}
	sort(two.begin(),two.end());
	n_=1;
	while(n_<one.size())n_*=2;
	int l=0,r=0;
	bool flag=false;
	for(int i=0;i<two.size();i++){
		while(l<one.size() && one[l].first+two[i].first>=a){
			add(one[l].second,1);
			l++;
		}
		while(l>r && one[r].first+two[i].first>b){
			add(one[r].second,-1);
			r++;
		}
		int al=lower_bound(Bval.begin(),Bval.end(),a-two[i].second)-Bval.begin();
		int ar=upper_bound(Bval.begin(),Bval.end(),b-two[i].second)-Bval.begin();
		if(query(al,ar)>0)flag=true;
	}
	printf("%s\n",flag?"Yes":"No");
	return 0;
}

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

using namespace std;

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

typedef long long ll;

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

  ll h,w,a,b;
  cin >> h >> w >> a >> b;
  
  rep(i,0,b){
    rep(j,0,w)
     if(j<a) cout << 1;
     else cout << 0;
      cout <<endl;
  }
   rep(i,b,h){
    rep(j,0,w)
     if(j<a) cout << 0;
     else cout << 1;
      cout <<endl;
  }
  
  
  
}


Measured memory_bytes: 1280
/**
 * Princess's Gamble
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

import static java.lang.Integer.parseInt;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;

		while ((line = br.readLine()) != null && !line.isEmpty()) {

			StringTokenizer st = new StringTokenizer(line);
			int n, m, p;
			n = parseInt(st.nextToken());
			m = parseInt(st.nextToken());
			p = parseInt(st.nextToken());
			if ((n | m | p) == 0) break;

			int[] bets = new int[n];
			int total = 0;
			for (int i = 0; i < n; i++) {
				bets[i] += parseInt(br.readLine());
				total += bets[i];
			}

			if (bets[m - 1] == 0) {
				System.out.println("0");
			} else {
				double dividend;
				dividend = total;
				dividend *= 100 - p;
				dividend /= (double) bets[m - 1];
				System.out.println((int) Math.floor(dividend));
			}
		} //end while
	} //end main
}

Measured memory_bytes: 22180
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;

void b_sort(int* a , int n){
	for(int i=n ; i>=0 ; --i){
		for(int j=0; j<i-1 ; ++j){
			if(a[j]<a[j+1]){
				swap(a[j],a[j+1]);
			}
		}
	}
}

int main(){
	int a[5];
	for(int i=0 ; i<5 ; ++i){
		cin >> a[i];
	}
	b_sort(a , 5);
	for(int i=0 ; i<4 ; ++i){
		cout << a[i] << " ";
	}
	cout << a[4] << endl;
	return 0; 
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;

#define rep(i,b) for(i=0;i<b;++i)
#define repp(i,a,b) for(i=a;i<b;++i)

int main() {
    int a,b;
    cin >> a >> b;
    if(a+b == 3) cout << 3 <<endl;
    else if (a+b == 4) cout << 2 <<endl;
    else cout << 1 <<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <cassert>
#include <fstream>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

//const ll mod = 1e9 + 7;
const ll mod = 998244353;

vector<ll> dx = {1, -1, 0, 0};
vector<ll> dy = {0, 0, 1, -1};

vector<string> g;

long long ppow(const long long &v, const long long &n, const long long &mod)
{
    long long ret = 1;
    long long num = n;
    long long now = v;
    
    while (num > 0)
    {
        if (num & 1)
        {
            ret = ret * now % mod;
        }
        now = now * now % mod;
        num = num >> 1;
    }
    
    return ret;
}

int main() {
    
    
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    
    ll n, m, k;
    cin >> n >> m >> k;
    
    vector<ll> fac(n + 1, 1);
    vector<ll> inv(n + 1, 1);
    
    for (int i = 1; i <= n; ++i)
    {
        fac[i] = (fac[i - 1] * i) % mod;
        inv[i] = ppow(fac[i], mod - 2ll, mod);
    }
    
    ll ret = 0;
    for (int i = 0; i <= k; ++i)
    {
        ret += fac[n - 1] * inv[i] % mod * inv[n - 1 - i] % mod * m % mod * ppow(m - 1ll, n - i - 1, mod) % mod;
        ret %= mod;
    }
    
    cout << ret << endl;
    
    return 0;
}

Measured memory_bytes: 6280
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
    int n;
    while(cin>>n)
    {
        long long a[n+5],b[n+5];
//        memset(a,0,sizeof(a));
//        memset(b,0,sizeof(b));
        for(int i=1; i<=n; i++)
        {
            cin>>a[i];
            cin>>b[i];
        }
        long long  ans=0;
        for(int i=n; i>0; i--)
        {
            long long  temp = 0;
            if(a[i]+ans<b[i])
            {
                temp = (b[i]-a[i]-ans)%b[i];
                ans+=temp;
            }
        
            else
            {
                if(((a[i]+ans)%b[i])==0)
                {
                     continue;
                }
                else
                {
                    temp = b[i]-((a[i]+ans)%b[i]);
                    ans = ans + temp;
                }
            }
 
        }
        cout<<ans<<endl;
 
    }
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pll, int> plp;
const ll INF = 1e9+100;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const bool debug = 0;
//--------------------------------//

string s, t;

int main() {
	cin >> s >> t;
	
	int N = s.size(), M = t.size();
	
	string ans = "~";
	
	REP(i, N) {
		if (i + M > N) break;
		
		bool ng = false;
		REP(j, M) {
			if (s[i + j] == '?') continue;
			if (s[i + j] != t[j]) ng = true;
		}
		
		if (!ng) {
			string now = s;
			REP(j, i) if (now[j] == '?') now[j] = 'a';
			REP(j, M) now[i + j] = t[j];
			FOR(j, i + M, N) if (now[j] == '?') now[j] = 'a';
			chmin(ans, now);
		}
		
	}
	
	if (ans == "~") ans = "UNRESTORABLE";
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int a;
 int b;
  cin >> a >> b;
  int y = 0;
  vector<vector<int>> d(b);
  for(int i=0;i < b;i++){
    int z;
     cin >> z;
     int k = 0;
     for(int j=0;j<z;j++){
       int rrr;
       cin >> rrr;
          d.at(i).push_back(rrr-1);}
  }
  vector<int> p(b);
  for(int i=0;i < b;i++){
    cin >> p.at(i);}
  
 for(int bit = 0;bit <(1<<a);++bit){
   int t = 1;
   for(int i=0;i < b;i++){
     int k = 0;
     for(int j=0;j < d.at(i).size();j++){
       if(bit & (1<<d.at(i).at(j))){k++;}
     }
     if(k % 2 != p.at(i)){t = 0;}
   }
   if(t == 1){y++;}
 }
  cout << y << endl;
       

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,a[100010];
bool cmp(int a,int b)
{
    return a>b;
}
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    	cin>>a[i];
    sort(a+1,a+n+1,cmp);
    for(int i=1;i<=n;i++)
	{
        if(a[i+1]<i+1)
		{
            int ans=0;
            for(int j=i+1;;j++)
            {
                if(a[j]!=i)
                    break;
                ans^=1;
            }
				
            ans|=(a[i]-i)&1;
            if(ans)
				cout<<"First"<<endl;
            else 
				cout<<"Second"<<endl;
            return 0;
        }
    }
}

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

public class Main {

	
	public static void main(String[] args) {
		FastScanner in=new FastScanner();
		PrintWriter out=new PrintWriter(System.out);
	//	int t=in.nextInt();
	//	while(t-->0)
		solve(in,out);
		out.close();
	}

    static void solve(FastScanner in,PrintWriter out){
      String s=in.next();
      int count=0,max=0;
      for(int i=0;i<s.length();i++){
          if(s.charAt(i)=='R') count++;
          else { max=Math.max(count,max); count=0; }
      } max=Math.max(count,max);
      out.println(max);
    }    
	



	static void sort(int[] a) {
		ArrayList<Integer> l=new ArrayList<>();
		for (int i:a) l.add(i);
		Collections.sort(l);
		for (int i=0; i<a.length; i++) a[i]=l.get(i);
	}
	
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}

	
}


Measured memory_bytes: 32956
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ans = 0;
        if(a < b) {
            ans = b - a - w;
        } else if(a > b) {
            ans = a - b - w;
        }
        if(ans < 0) {
            ans = 0;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 35576
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, ll> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 2010;
const int MAXM = 35;
const int MAXK = 510;
const int MAXQ = 200010;

struct Point {
    ll x, y;
    char dir;
    Point(ll x = 0, ll y = 0, char dir = 'D') : x(x), y(y), dir(dir) {}
};

int n;
vector<Point> a, b;

ll calc(ll t) {
    b.clear();
    FOR(i,0,n-1) {
        if (a[i].dir == 'D') b.emplace_back(Point(a[i].x, a[i].y - t, 'x'));
        else if (a[i].dir == 'U') b.emplace_back(Point(a[i].x, a[i].y + t, 'x'));
        else if (a[i].dir == 'L') b.emplace_back(Point(a[i].x - t, a[i].y, 'x'));
        else b.emplace_back(Point(a[i].x + t, a[i].y, 'x'));
    }
    ll xMax = b[0].x, xMin = b[0].x, yMax = b[0].y, yMin = b[0].y;
    FOR(i,1,n-1) {
        xMax = max(xMax, b[i].x);
        xMin = min(xMin, b[i].x);
        yMax = max(yMax, b[i].y);
        yMin = min(yMin, b[i].y);
    }
    return (xMax - xMin) * (yMax - yMin);
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n;
    FOR(i,1,n) {
        int x, y; char c;
        cin >> x >> y >> c;
        a.emplace_back(Point(x*2, y*2, c));
    }
    ll res = 1e18;

    ll LL = 0;
    ll RR = 1e9;
    ll ML = (LL + LL + RR) / 3;
    ll MR = (LL + RR + RR) / 3;
    while ((LL != ML) && (ML != MR) && (MR != RR)) {
        if (calc(ML) > calc(MR)) LL = ML;
        else RR = MR;
        ML = (LL + LL + RR) / 3;
        MR = (LL + RR + RR) / 3;
    }

    while (LL != RR) {
        res = min(res, calc(LL));
        LL++;
    }
    res = min(res, calc(LL));

    cout << fixed << setprecision(9) << res / 4.0;
    return 0;
}

Measured memory_bytes: 8688
#include<iostream>
using namespace std;
 
int bubbleSort(int A[],int N){
    int sw=0;
    bool flag=1;
    for(int i=0; flag; i++){
        flag=0;
        for(int j=N-1;j>=i+1;j--){
            if(A[j]<A[j-1]){
                swap(A[j],A[j-1]);
                flag=1;
                sw++;
            }
        }
    }
    return sw;
}
 
int main(){
    int A[100],N,sw;
    cin>>N;
    for(int i=0;i<N;i++)cin>>A[i];
     
    sw=bubbleSort(A,N);
     
    for(int i=0;i<N;i++){
        if(i)cout<<" ";
        cout<<A[i];
    }
    cout << endl;
    cout << sw << endl;
     
    return 0;
}


Measured memory_bytes: 3116
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int num[110];
	int n;
	while(cin>>n) {
		for(int i=1;i<=n;i++) {
			cin>>num[i];
		}
		sort(num+1,num+n+1);
		int a=0,b=0;
		int cnt=1;
		for(int i=n;i>=1;i--) {
			if(cnt%2) a+=num[i];
			else b+=num[i];
			cnt++;
		}
		cout<<a-b<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

long long int dp[55][5555];

int N, A[55];
int P;

int main(void) {
	cin >> N >> P;
	for (int i = 1; i <= N; i++) {
		cin >> A[i];
	}


	dp[0][0] = 1;

	for (int i = 1; i <= N; i++) {
		for (int j = 0; j <= 5000; j++) {
			dp[i][j + A[i]] += dp[i - 1][j];
			dp[i][j] += dp[i - 1][j];
		}
	}

	long long int ans = 0;

	for (int j = 0; j <= 5000; j++) {
		if (j % 2 == P) { ans += dp[N][j]; }
	}

	cout << ans << endl;

	return 0;
}

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

int main(){
    char s[4];
    char s1, s2;
    int c1=0, c2=0;
    for(int i=0; i<4; i++){
        cin >> s[i];
        s1=s[0];
        if(s1!=s[i]){
            s2=s[i];
        }
    }

    for(int i=0; i<4; i++){
        if(s[i]==s1) c1++;
        if(s[i]==s2) c2++;
    }

    if(c1==2&&c2==2){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}


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

int main(){
  int a,b,c,ans=0;
  cin>>a>>b>>c;
  if(b<=c){
    ans+=2*b, c-=b;
    if(a<c){
      ans+=a+1;
    }else if(a==c){
      ans+=a;
    }else{
      ans+=c;
    }
  }else{
    ans+=b+c;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256