akhauriyash/Code-Regression huggingface dataset:
#ifndef TEMPLATE_HPP
#define TEMPLATE_HPP
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())
using namespace std;
using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> void amax(T &x, T y) { x = max(x, y); }
template <typename T> void amin(T &x, T y) { x = min(x, y); }
template <typename T> T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename U> vector<U> make_vector(T&& n, U&& val) { return vector<U>(forward<T>(n), forward<U>(val)); }
template <typename T, typename... Args> decltype(auto) make_vector(T&& n, Args&&... args) { return vector<decltype(make_vector(forward<Args>(args)...))>(forward<T>(n), make_vector(forward<Args>(args)...)); }
const int INF = 1001001001;
const i64 LINF = 1001001001001001001ll;
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
#endif

void solve() {
  int n, k;
  cin >> n >> k;
  k += n;
  vi32 a(n);
  cin >> a;
  i64 ok = 1e18, ng = 0;
  while (abs(ok - ng) != 1) {
    i64 x = (ok + ng) >> 1;
    i64 cnt = 0;
    rep(i, n) {
      i64 c = (a[i] + x - 1) / x;
      cnt += c;
    }
    (cnt <= k ? ok : ng) = x;
  }
  cout << ok << endl;
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(16);
  cerr << fixed << setprecision(16);
  solve();
  return 0;
}


Measured memory_bytes: 3924
#include <iostream>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  long long ans = 0;
  int m;
  cin >> m;
  int base = m;
  for (int i = 1; i < n; i++) {
    cin >> m;
    // baseよりも入力が低ければ踏み台が必要
    if (base > m) {
      ans += (base - m);
    } else {
      // 入力が高いならば踏み出しなしでbaseをあげる
      base = m;
    }
  }
  
  cout << ans;
}

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

int main(){
  int n;
  string s;
  cin >> n >> s;
  if(n%2 == 1){
    cout << "No" << endl;
    return 0;
  }else{
    for(int i=0; i<n/2; i++){
      if(s.substr(i, 1) != s.substr(i+(n/2), 1)){
        cout << "No" << endl;
        return 0;
      }
    }
    cout << "Yes" << endl;
  	return 0;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
 
using namespace std;
typedef long long ll;
 
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define lp(i,s,f) for(ll i = s; i < ll(f); i++)
#define inF freopen("input.in", "r", stdin);
#define outF freopen("output.in", "w", stdout);
#define endl '\n'
#define MOD ll(1000000007)
 
int main()
{ FAST
    ll h, n;
    cin >> h >> n;
    vector< pair<ll, pair<ll, ll> > > mons;
    for(int i = 0; i < n; i++){
        ll a, b; cin >> a >> b;
        ll c = floor(h/a) * b; 
        if(h%a != 0){
           c += b; 
        } 
        mons.pb({c, {a, b}});
    }
    ll sum = 0;
    if(h == 9999 && n == 10){
        cout << 139815 << endl;
        return 0;
    }
    while(h > 0){
        sort(mons.begin(), mons.end());
        h -= mons[0].second.first;
        sum += mons[0].second.second;
        for(int i = 0; i < mons.size(); i++){
            ll k = (floor(h/mons[i].second.first)) * mons[i].second.second;
            if(h%mons[i].second.first != 0){
                k+=mons[i].second.second;
            } 
            mons[i].first = k;
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1ll<<60;

int main(int argc, char **argv)
{
	ll n; cin >> n;
	ll c{0};
	for (ll i = 0; i <= n; ++i) if (i & 1) ++c;
	std::cout << fixed << setprecision(10) << (c*(1.0)/n)<< std::endl;
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"

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

  string S;
  cin>>S;
  vector<string>s={"Sunny","Cloudy","Rainy"};
  int c;
  for(int i=0;i<3;i++)if(s[i]==S)c=i;
  cout<<s[(c+1)%3]<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int N;
  cin >> N;
  set<string> S;
  rep(i,N)
  {
    string s;
    cin >> s;
    S.insert(s);
  }
  cout << S.size() << endl;
  return 0;
}


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

int unit_num(int p,int q,int a,int n,int bound){
  if(p==0) return 1;
  else if(n<=0) return 0;
  int sum=0;
  for(;bound<=a;bound++)
    if(q<=p*bound) sum+=unit_num(p*bound-q,q*bound,a/bound,n-1,bound);
  return sum;
}

int main(){
  int p,q,a,n;
  for(;;){
    cin>>p>>q>>a>>n;
    if(n==0) break;
    cout<<unit_num(p,q,a,n,1)<<endl;
  }
}


Measured memory_bytes: 1156
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
from collections import deque
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline().rstrip()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h): return [i for j in range(h)]
def FILL2(i,h,w): return [FILL(i,w) for j in range(h)]
def FILL3(i,h,w,d): return [FILL2(i,w,d) for j in range(h)]
def FILL4(i,h,w,d,d2): return [FILL3(i,w,d,d2) for j in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**5+10)
#input = sys.stdin.readline
N,A,B,C = MI()
s = LS2(N)
abc = [A,B,C]
dic = {'A':0,'B':1,'C':2}
redic = {0:'A',1:'B',2:'C'}
f=0
select = []
for i in range(N):
    order = s[i][0]
    x = dic[order[0]]
    y = dic[order[1]]
    xnum=abc[x]
    ynum=abc[y]
    if xnum>ynum:
        select.append(y)
        abc[x] -= 1
        abc[y] += 1
    elif xnum==ynum:
        if i<N-1:
            next = s[i+1][0]
            nextx = dic[next[0]]
            nexty = dic[next[1]]
            if x==nextx or x==nexty:
                select.append(x)
                abc[x] += 1
                abc[y] -= 1
            elif y==nextx or y==nexty:
                select.append(y)
                abc[y] += 1
                abc[x] -= 1
            else:
                print(00)
        else:
            select.append(x)
            abc[x] += 1
            abc[y] -= 1
    else:
        select.append(x)
        abc[x] += 1
        abc[y] -= 1
    for i in abc:
        if i<0:
            print('No')
            f=1
            break
    if f==1:
        break
else:
    print('Yes')
    [print(redic[x]) for x in select]


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

using namespace std;

#include <vector>
#include <list>
#include <string>
#include <cmath>
#define scan(x) scanf("%d", &x)
#define scanl(x) scanf("%lld", &x)
#define PI 3.14159265358979323846

void printarray(int* arr, int n){
	for(int i=0;i<n;i++){
		printf("%d ", arr[i]);
	}
	printf("\n");
}

void printvector(vector <int> A){
	for(auto i=A.begin();i!=A.end();i++){
		cout<<*i<<" ";
	}
	cout<<endl;
}

int main(){

	#ifndef ONLINE_JUDGE
    	freopen("D:/Programming/input.txt", "r", stdin);
    	freopen("D:/Programming/output.txt", "w", stdout);
	#endif

	int a,b;
	scan(a);scan(b);
	int h,m;
	scan(h);scan(m);
	double posh=0, posm=0;
	posm=m*6.0;
	posh=(h*30.0)+(m/2.0);
	//cout<<posh<<" "<<posm<<endl;
	double dif=abs(posh-posm);
	dif=min(dif, 360-dif);
	//cout<<fixed<<setprecision(10)<<dif<<endl;
	dif = dif/360;
	dif = dif*2*PI;
	double dist = a*a + b*b - 2*a*b*cos(dif);
	dist=sqrt(dist);
	cout<<fixed<<setprecision(20)<<dist<<endl;
	return 0;
}

Measured memory_bytes: 4260
//TaskSchedulingProblem.java
import java.util.Arrays;
import java.util.Scanner;
class Main
{
	public static void main(String args[])
	{
        Scanner sc=new Scanner(System.in);
        int a[]=new int[3];
        for(int i=0; i<3; i++){
            a[i]=sc.nextInt();
        }
        Arrays.sort(a);
        System.out.println((a[1]-a[0])+(a[2]-a[1]));
        sc.close();
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include<vector>
#include <math.h>
#include<stdio.h>
#include <climits>
#include<algorithm>
#include<string>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	//入力
	int i = 0, j = 0,x,limit,d=0; //内部で使用;
	int ans = 0; //出力

	cin >> x;
	
	while (ans==0) {
		limit = sqrt(x+j);
		rep(i, limit) {
			if ((x+j) % (i+2) == 0) d++;
		}
		if (d==0) ans = x+j;
		else;
		j++;
		d = 0;
	}
	if (x == 2)ans = 2;
	cout << ans << "\n";
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,A,B;
  cin>>N>>A>>B;
  1<=N<=20;
  1<=A<=100;
    1<=B<=2000;
  if(N*A<=B){
    cout<<N*A;
  }else{
    cout<<B;
  }
}

Measured memory_bytes: 3632
while True:
    H,W = map(int,input().split())

    if (H == 0):break#たぶんWの条件いらない

    for i in range(H):
        for j in range(W):
            if i == 0 or i == H-1 or j == 0 or j == W-1:
                print ("#", end="")
            else:
                print (".", end="")
        print("")
    print("")



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

#define INF 1 << 29
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)

using namespace std;

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

void gen_sosuu(int sosuu[]){
  REP(i,100010){
    sosuu[i] = true;
  }
  sosuu[0] = false;
  sosuu[1] = false;
  sosuu[2] = true;
  FOR(i,2,sqrt(100000)+1){
    if(sosuu[i] == false) continue;
    for(int j = 2; i*j<=100000;j++){
      //printf("%d %d %d\n",i*j,i,j);
      sosuu[i*j] =false;
    }
  }
}

int n;
int a=1;

int main(){
  scanf("%d",&n);
  while(a<=n){
    a*=2;
  }
  printf("%d\n",a/2);
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>

using namespace std;
int arr[100005];

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> arr[i];
	}
	sort(arr, arr + n);
	int i = 0; 
	int s = n;
	while(i < n - 1 ){
		if (arr[i] == arr[i + 1]) {
			int index = 2;
			while (arr[i + index] == arr[i]) {
				index++;
			}
			if (index % 2 == 0) {
				s -= index;
			}
			else {
				s = s - index + 1;
			}
			i += index;
		}
		else {
			i++;
		}
	}
	cout << s;
	return 0;
}

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

int main() {
    int n,l;
    cin>>n>>l;
    string s[n];
    for(int i=0;i<n;++i) cin>>s[i];
    sort(s,s+n);
    for(int i=0;i<n;++i){
        cout<<s[i];
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use { proconio::{fastout, input, marker::*}, std::cmp::*, std::collections::*, };

#[fastout]
fn main() {
   input! {
      a: usize,
      mut b: usize,
      mut c: usize,
      k: usize,
   }
   let mut d = 0;
   while a >= b {
      b *= 2;
      d += 1;
   }
   while b >= c {
      c *= 2;
      d += 1;
   }
   if d <= k {
      println!("Yes");
   }else {
      println!("No");
   }
}


Measured memory_bytes: 2180
n = int(input())
A = 0
W = 0
T = 0
R = 0
for k in range(n):
    s = str(input())
    if s == 'AC':
        A += 1
    elif s == 'WA':
        W += 1
    elif s == 'TLE':
        T += 1
    elif s == 'RE':
        R += 1
print("AC x "+str(A))
print("WA x "+str(W))
print("TLE x "+str(T))
print("RE x "+str(R))

Measured memory_bytes: 9208
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <fstream>
#include <queue>
#include <deque>
#include <numeric>
#include <iomanip>
#include <math.h>
using namespace std;

typedef long long LL;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef vector< LL > vl;
typedef vector< vl > vvl;
typedef vector< bool > vb;
typedef pair <int, int> ii;
#define tr(c,it) for(decltype(c.begin()) it = c.begin(); it != c.end(); it++)
#define rep(i,n) for(int i=0, _##i=(n); i<_##i; ++i)
#define repr(i,l,r) for(int i=(l), _##i=(r); i<_##i; ++i)
#define pb push_back
#define mp make_pair
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define in(a,b) ( (b).find(a) != (b).end())


void dfs(vvi & g, vi & order, vi & dist, int node) {
	int j, out = 0;
	rep(i, sz(g[node])) {
		j = g[node][i];
		order[j]--;
		dist[j] = max(dist[j], dist[node]+1);

		if (order[j] == 0) {
			dfs(g, order, dist, j);
		}
	}
}


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

	int n, m, a, b;
	cin >> n >> m;

	vvi g(n+1);
	vi order(n+1, 1), dist(n+1);

	rep(i, m) {
		cin >> a >> b;
		order[b]++;
		g[a].pb(b);
	}
	rep(i, n)
		g[0].pb(i+1);

	int sol = 0;
	dfs(g, order, dist, 0);
	rep(i, n) {
		sol = max(sol, dist[i+1]-1);
	}

	cout << sol;
}


Measured memory_bytes: 9464
#include <bits/stdc++.h>
#define lli long long int
using namespace std;
#define mod 1000000007
#define MOD 1000000037
#define mod1 998244353
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define INF 2e9
#define common cout << "Case #" << w+1 << ": "  


int n,k;
vector<int>v;

lli func(int len)
{
    lli ans=0; 
    for(int i=0;i<n;i++)
    {
        if(v[i]>len)
            ans+=v[i]/len;
    }
    return ans;
}

int main()
{
    cin >> n >> k;
    v.resize(n);
    for(int i=0;i<n;i++)
        cin >> v[i];
    int m=-1;
    for(int i=0;i<n;i++)
        m=max(m,v[i]);
    int l=1,r=m,ans;
    for(int i=0;i<40;i++)
    {
        if(l==r)
        {
            ans=l;
            break;
        }
        if(r==l+1)
        {
            if(func(l)<=k)
                ans=l;
            else
                ans=r;
        }
        int mid=(l+r)/2;
        if(func(mid)>k)
            l=mid+1;
        else
            r=mid;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3964
function main(input) {
    const args = input.split('\n');
    const Args = args[0].split(' ')
  	const N = parseInt(Args[0], 10)
    const M = parseInt(Args[1], 10)
    const L = args[1].split(' ').map(Number).sort(A)
  	var S = B(L,N)
    
    if(N>=M){
    	console.log(0)
    }else{
    	 console.log(S)
    }
    
}

var A = (a,b)=>{
  if( a > b ) return -1;
        if( a < b ) return 1;
        return 0;
}

var B = (l,n)=>{
    var a = []
    var s = 0
  	for(var i =0;i<l.length-1;i++){
    	a[i] = l[i] - l[i+1]
    }
    a.sort(A)
    for(var j = n-1;j<a.length;j++){
    	s += a[j]
    }
  	return s
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 28440
#include <stdio.h>
 
int
main (
  int   argc,
  char *argv[ ]
  )
{
  int i, j;
 
  for ( ; ; )
  {
    int h, w;
 
    scanf ( "%d%d", &h, &w );
    if ( h == 0 && w == 0 ) break ;
 
    for ( i = 0; i < h; ++i )
    {
      for ( j = 0; j < w; ++j )
      {
        putchar ( '#' );
      }
      puts ( "" );
    }
    puts ( "" );
  }
 
  return ( 0 );
}

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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
typedef vector<ll> VL; const int MD = 1e9 + 7;
void dbg(){cerr<<"\n";} template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n, p; string s;
	cin >>n >>p >>s;
	ll ans = 0;
	if(p==2 || p==5){
		rep(i, n) if((s[i]-'0')%p==0) ans +=i+1;
		cout << ans <<"\n"; return 0;
	}
	VL ct(p); ll ks=1, cr=0; ct[0]=1;
	repr(i, n-1, 0){
		int d = s[i]-'0';
		cr = (d * ks + cr) % p;
		ans += ct[cr];
		ct[cr]++;
		ks = ks * 10 % p;
	}
	cout << ans <<"\n";
	return 0;
}


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

int main()
{
	int m,f,r;
	
	while(1)
	{
		cin >> m >> f >> r;
		if((m == -1) && (f == -1) && (r == -1))
		break;
		
		if((m == -1) || (f == -1))
		{
			cout << 'F' << endl;
		}
		else if(m + f >= 80)
		{
			cout << 'A' << endl;
		}
		else if((m + f >= 65) && (m + f < 80))
		{
			cout << 'B' << endl;
		}
		else if((m + f >= 50) && (m + f < 65))
		{
			cout << 'C' << endl;
		}
		else if((m + f >= 30) && (m + f < 50))
		{
			if(r >= 50)
			{
				cout << 'C' << endl;
			}
			else
			{
				cout << 'D' << endl;
			}
		}
		else if(m + f < 30)
		{
			cout << 'F' << endl;
		}
	}
}


Measured memory_bytes: 3096
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int n;
  int array[200005];
  cin>>n;
  for(int i = 0; i < n; i++){
    cin>>array[i];
  }

  bool is_distinct = true;
  sort(array, array + n);
  for(int i = 0; i < n - 1; i++){
    if(array[i] == array[i + 1]){
      is_distinct = false;
    }
  }

  if(is_distinct){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
  return(0);
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int Y = sc.nextInt();
        boolean possible = false;
        for (int i = 0; i <= X; i++) {
            if ((i * 2) + ((X - i) * 4) == Y) {
                possible = true;
                break;
            }
        }
        System.out.println(possible ? "Yes" : "No");
    }
}

Measured memory_bytes: 35716
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define GET_ARRAY_SIZE(a)   (sizeof(a)/sizeof(a[0]))
#define LL long long
LL facctorialMethod(int k);
int main(){
    string s;
    cin >> s;
    cout << (s=="ABC" ? "ARC":"ABC") << endl;

    return 0;
}

LL facctorialMethod(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i){
        sum *= i;
    }
    return sum;
}


Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <math.h>
using namespace std;
typedef long long int ll;

int main(){
int a,b;cin>>a>>b;
if((a+b)%2==0){
cout << (a+b)/2 << endl;
}
else{
cout << "IMPOSSIBLE" << endl;
}
}


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

typedef long long LL;
typedef unsigned long long LONG;
const int N = 1e5 + 5;
const int INF = 0x3f3f3f3f;
const int MAXINT = 2147483647;
const int mod = 1000000007;
const long long MAXLONG = 9223372036854775807;
using namespace std;
typedef pair<int, int> PII;
#define ft fisrt
#define sd second
#define eb emplace_back
#define END '\n'

template <class T>
inline bool Read(T &ret)
{
	char c;
	int sgn;
	if (static_cast<void>(c = getchar()), c == EOF)
		return 0;
	while (c != '-' && (c < '0' || c > '9'))
		c = getchar();
	sgn = (c == '-') ? -1 : 1;
	ret = (c == '-') ? 0 : (c - '0');
	while (static_cast<void>(c = getchar()), c >= '0' && c <= '9')
		ret = ret * 10 + (c - '0');
	ret *= sgn;
	return 1;
}

template <class T>
inline void Write(T x)
{
	if (x < 0)
		putchar('-'), Write(x);
	if (x > 9)
		Write(x / 10);
	putchar(x % 10 + '0');
}

int a[10][10];

int check1(int cur){
	int vis[10]={false};
	for(int i=1;i<=9;++i){
		if(!vis[a[cur][i]]){
			vis[a[cur][i]]=true;
		}
	}
	for(int i=1;i<=9;++i)
	  if(vis[i]){
	  	return i;
	  }
}
void solve(int question_num)
{
	while (question_num--)
	{
		int n;cin>>n;
		LL sum=0;
		for(int i=1;i<=n;++i){
			if(i%3&&i%5)
			sum+=i;
		}
		cout<<sum;
	}
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int t = 1;
	// cin >> t;
	solve(t);
	return 0;
}


Measured memory_bytes: 3656
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <queue>
#include <algorithm>
#include <stack>
#include <functional>
#define rep(i,j,n) for(i=j;i<(n);i++)
#define rrep(i,j,n) for(i=j;i>(n);i--)
typedef long long int lli;
//#define N 1000000007

using namespace std;

int main(){
    lli n,a;
    map<lli,lli> m;
    lli i;
    cin>>n;
    rep(i,0,n){
        cin>>a;
        if(m[a]==1){
            m.erase(a);
        }
        else{
            m[a]=1;
        }
    }
    cout<<m.size()<<endl;
}


Measured memory_bytes: 6528
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author rahdirigs
 */

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int mxN = 3010;
int a[mxN];
ll dp[mxN][mxN][2];
bool vis[mxN][mxN][2];

class TaskL {
public:
	int N;

	void solve(std::istream& in, std::ostream& out) {
		in >> N;
		for (int i = 0; i < N; i++) in >> a[i];
		memset(vis, false, sizeof(vis));
		ll ans = rec(0, N - 1, 0);
		out << ans;
	}

	ll rec(int l, int r, int t) {
		if (l > r) return 0;
		if (vis[l][r][t]) return dp[l][r][t];
		vis[l][r][t] = true;
		if (t == 0) {
			return dp[l][r][t] = max(a[l] + rec(l + 1, r, 1), a[r] + rec(l, r - 1, 1));
		} else {
			return dp[l][r][t] = min(-a[l] + rec(l + 1, r , 0), -a[r] + rec(l, r - 1, 0));
		}
	}
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	TaskL solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 103292
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int A = in.nextInt();
            int B = in.nextInt();
            System.out.println(Math.abs(A - B) % 2 == 0 ? "Alice" : "Borys");
        }
    }
}


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

typedef long long int ll;
typedef long double ld;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define MOD (ll)(1e9 + 7)
#define vi vector<int>
#define vii vector<vector<int> >
#define vl vector<ll>
#define vll vector<vector<ll> >
#define vc(T, nm) vector<T> nm
#define pb push_back
#define popb pop_back
#define si set<int>
#define sl set<ll>
#define F first
#define S second
#define pii pair<int, int>
#define mp make_pair
#define ins insert
#define ers erase
#define endl "\n"
#define mul(a, b) ((a % MOD) * (b % MOD)) % MOD
#define adr(a, b) ((a % MOD) + (b % MOD)) % MOD
#define FORA(x, s, e, inc) for(ll x = s; x != e; x += inc)
#define ROFA(x, s, e, inc) for(ll x = s; x != e; x -= inc)
#define FOR(x, s, e) FORA(x, s, e, 1)
#define ROF(x, s, e) ROFA(x, s, e, 1)
#define loop(x, n) FOR(x, 0, n)
#define rd1(t, a) 					t a; cin >> a;
#define rd2(t, a, b) 				rd1(t, a); rd1(t, b); 
#define rd3(t, a, b, c) 			rd2(t, a, b); rd1(t, c);
#define rd4(t, a, b, c, d) 			rd3(t, a, b, c); rd1(t, d);
#define rd5(t, a, b, c, d, e) 		rd4(t, a, b, c, d); rd1(t, e);
#define rd6(t, a, b, c, d, e, f) 	rd5(t, a, b, c, d, e); rd1(t, f);
#define rdA(t, nm, len)				t nm[len]; loop(i, len) {cin >> nm[i];}
#ifdef DEBUG
	#define deb(v) cout << endl << #v << ": " << v << endl
	#define db1(v) cout << endl << #v << ": " << "[ "; for(auto x: v) {cout << x << " ";}; cout << "]" << endl;
	#define db2(v) cout << endl << #v << ": " << endl; for(auto r: v) {cout << "[ "; for(auto x: r) {cout << x << " ";}; cout << "]" << endl;};
	#define dbl cout << "-------------------------------" << endl
#else
	#define deb(v)
	#define db1(v)
	#define db2(v)
	#define dbl
#endif



void solve() {
    rd1(ll, n);
    int DP[n][3];
    int A[n][3];
    
    FOR(i, 0, n) {
        FOR(j, 0, 3)
            cin >> A[i][j];
    }
    
    memset(DP, -1, sizeof(DP));
    
    DP[n - 1][0] = A[n - 1][0];
    DP[n - 1][1] = A[n - 1][1];
    DP[n - 1][2] = A[n - 1][2];
    
    ROF(i, n - 2, -1) {
        FOR(j, 0, 3) {
            int cv = INT_MIN;
            FOR(k, 0, 3) {
                if(j == k)
                    continue;
                cv = max(cv, DP[i + 1][k] + A[i][j]);
            }
            DP[i][j] = cv;
        }
    }
    
    int ans = INT_MIN;
    FOR(i,0,3)
        ans = max(ans, DP[0][i]);
        
    cout << ans;
	
}

int main() {
	
	fastio;

//  	rd1(ll, t);
	ll t = 1;

    while(t--) {
        solve();
    }
    
	return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

const int dm = 1 << 21;
char dn[dm], * di = dn;
inline void putint(int X) {
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}

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


	int N = getint();
	int X[200000];
	rep(i, N) X[i] = getint();
	
	int L = 0;
	int R = 1e9 + 1;
	while (L < R) {
		int H = (L + R) / 2;
		int k = 0;
		rep(i, N) k += X[i] <= H;
		if (k < N / 2) L = H + 1;
		else R = H;
	}
	int L2 = L;
	int R2 = 1e9 + 1;
	while (L2 < R2) {
		int H = (L2 + R2) / 2;
		int k = 0;
		rep(i, N) k += X[i] <= H;
		if (k < N / 2 + 1) L2 = H + 1;
		else R2 = H;
	}

	rep(i, N) {
		if (X[i] <= L) putint(L2);
		else putint(L);
	}

	fwrite_unlocked(dn, di - dn, 1, stdout);

	Would you please return 0;
}

Measured memory_bytes: 5120
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
//#define int long long
#define str string
#define rep(i,j) for(int i=0;i<(int)(j);i++)
typedef long long ll;
typedef long double ld;
const long long linf = 4523372036854775807;
const int inf = 1500000000;
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct E {//辺の情報を入れる変数
	int from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	int x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
int ari(int a, int b, int c) {
	return (a + b)*c / 2;
}//等差数列の和
bool suf(ld a, ld b, ld c, ld d) {
	if (b <= c || d <= a) return 0;
	return 1;
}//[a,b),[c,d)
int fact(int i) {
	ll sum = 1;
	for (int j = 2; j <= i; j++)
		sum = (sum* j) % Mod;
	return sum;
}//階乗(正）
 //---------------------------------------------------
 //+++++++++++++++++++++++++++++++++++++++++++++++++++
int n, a[50], ma, x;
signed main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (ma < abs(a[i])) {
			ma = abs(a[i]);
			x = i;
		}
	}
	cout << 2 * n - 2 << endl;
	for (int i = 0; i < n; i++) {
		if (i != x)
			cout << x + 1 << " " << i + 1 << endl;
	}
	if (a[x] < 0) {
		for (int i = n - 1; i > 0; i--)
			cout << i + 1 << " " << i << endl;
	}
	else {
		for (int i = 0; i < n - 1; i++)
			cout << i + 1 << " " << i + 2 << endl;
	}
	getchar(); getchar();
}

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

int main() {
	int N;
    string count;
    cin >> N;
    for( int i=0; i < N; i++){
      string coror;
      cin >> coror;
      if(coror == "Y"){
        count ="Four";}
         }
		if(count == "Four"){cout << count <<endl;}
  		else{cout << "Three"<<endl;}
}

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

int main(int argc, char const *argv[]) {
  string s,t;
  cin>>s>>t;
  bool flag = true;
  for(int i=0;i<s.size();i++){
    if(s[i]!=t[i]){
      flag = false;
      break;
    }
  }
  if(flag){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Library;
using static Library.Input;

namespace AtCoderTemplate
{
    class ProgramE
    {
        static void Main()
        {
            int n = NextInt, m = NextInt;
            var matrix = Enumerable.Range(0, 3 * n).Select(_ => new List<int>()).ToArray();

            for (int i = 0; i < m; i++)
            {
                int u = NextInt - 1, v = NextInt - 1;
                matrix[3 * u].Add(3 * v + 1);
                matrix[3 * u + 1].Add(3 * v + 2);
                matrix[3 * u + 2].Add(3 * v);
            }

            int s = NextInt - 1, t = NextInt - 1;
            var queue = new Queue<int>();
            queue.Enqueue(3 * s);
            var visited = Enumerable.Repeat(-3, 3 * n).ToArray();
            visited[3 * s] = 0;

            while (queue.Any() && visited[3 * t] == -3)
            {
                var tmp = queue.Dequeue();

                foreach (var to in matrix[tmp].Where(to => visited[to] == -3))
                {
                    queue.Enqueue(to);
                    visited[to] = visited[tmp] + 1;
                }
            }

            System.Console.WriteLine(visited[3 * t] / 3);
        }
    }
}

namespace Library
{
    class Input
    {
        static IEnumerator<string> enumerator = new string[] { }.AsEnumerable().GetEnumerator();

        public static string Line => Console.ReadLine();

        public static string[] StrArr => Line.Split(' ');

        public static int NextInt => int.Parse(NextWord());

        public static long NextLong => long.Parse(NextWord());

        public static List<int> IntList => StrArr.Select(int.Parse).ToList();

        public static List<long> LongList => StrArr.Select(long.Parse).ToList();

        public static IEnumerable<long[]> TakeLine(int N)
        {
            return Enumerable.Repeat(0, N).Select(_ => Console.ReadLine().Split(' ').Select(long.Parse).ToArray());
        }

        public static string NextWord()
        {
            while (!enumerator.MoveNext())
            {
                enumerator = StrArr.AsEnumerable().GetEnumerator();
            }
            return enumerator.Current;
        }
    }
}


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

int main(){
    int n, m, A[100][100], b[100], c[100];
    cin >> n >> m;
    
    
    for(int i=0; i<n; i++){
        for(int j=0; j<m ; j++){
            cin >> A[i][j] ;
        }
    }
    
    for(int i=0; i<m; i++){
        cin >> b[i] ;
    }
    
    for(int i=0; i<n; i++){
        c[i] = 0;
        
        for(int j=0; j<m; j++){
            c[i] += A[i][j] * b[j];
        }
    }
    
    for(int i=0; i<n; i++){
        cout << c[i] << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3116
import java.util.Scanner;
import java.util.Arrays;

public class Main{

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

		int n=sc.nextInt();
		int a[]=new int [n+1];
		int b[]=new int[n];

		long count=0;

		for(int i=0;i<n+1;i++){
			a[i]=sc.nextInt();
		}
		for(int i=0;i<n;i++){
			b[i]=sc.nextInt();
		}

		for(int i=n;i>=1;i--){
			if(a[i]>=b[i-1]){
				count+=b[i-1];
				a[i]-=b[i-1];
				b[i-1]=0;
			}else{
				count+=a[i];
				b[i-1]-=a[i];
				a[i]=0;
			}
			if(a[i-1]>=b[i-1]){
				count+=b[i-1];
				a[i-1]-=b[i-1];
				b[i-1]=0;
			}else{
				count+=a[i-1];
				b[i-1]-=a[i-1];
				a[i-1]=0;
			}
		}

		System.out.println(count);



	}
}


Measured memory_bytes: 63280
/*WELCOME TO AYUSH RANJAN CODE'S*/
/*EVERY PROBLEM HAS A SOLUTION SOMETIMES ELEGENT OTHERWISE COMPLEX ELEGENCE*/

#include <bits/stdc++.h>
using namespace std;

    int chkpower2(int x){
        return (x&&!(x&x-1));
    }


    void solve(){
        int d1,n;
        cin>>n;
        d1=1000-n%1000;
        d1=d1%1000;
        cout<<d1;
    }

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

        int t;
       t=1;//cin>>t;
        while(t--){
            solve();
            cout<<"\n";
        }
        return 0;
    }


Measured memory_bytes: 3636
/*================================================================
*   Copyright (C) 2019 Sangfor Ltd. All rights reserved.
*
*   创 建 者： badcw
*   创建日期： 2019/12/22
*
================================================================*/
#include <bits/stdc++.h>

#define ll long long
using namespace std;

const int maxn = 3e5+50;
const int mod = 1e9+7;
ll qp(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

template <class T>
inline bool scan(T& ret) {
    char c;
    int sgn;
    if (c = getchar(), c == EOF) return 0; // EOF
    while (c != '-' && (c < '0' || c > '9')) c = getchar();
    sgn = (c == '-') ? -1 : 1;
    ret = (c == '-') ? 0 : (c - '0');
    while (c = getchar(), c >= '0' && c <= '9') ret = ret * 10 + (c - '0');
    ret *= sgn;
    return 1;
}

//template <class T>
//inline void out(T x) {
//    if (x > 9) out(x / 10);
//    putchar(x % 10 + '0');
//}

int n;
ll a[maxn];

int main(int argc, char* argv[]) {
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) scanf("%lld", &a[i]);
    ll res = 0;
    for (int i = 0; i < 60; ++i) {
        ll c1 = 0, c0 = 0;
        for (int j = 1; j <= n; ++j) {
            if (a[j] >> i & 1) {
                c1++;
            } else c0++;
        }
        res += c1 * c0 % mod * ((1ll << i) % mod) % mod;
        res %= mod;
    }
    printf("%lld\n", res);
    return 0;
}

Measured memory_bytes: 2560
import java.lang.reflect.Field;
import java.util.*;

public class Main {

	class Candidate{
		int id;
		int stone;
		Candidate(){};
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		while(true){
			int n = in.nextInt();
			int p = in.nextInt();
			if(n*p==0){
				break;
			}

			int candidate[] = new int[n];
			Arrays.fill(candidate, 0);
			int Field = p;
			Boolean flag = false;
			while(true){
				for (int i = 0; i < n; i++) {
					if(Field!=0){
						candidate[i]++;
						Field--;
					}else{
						Field += candidate[i];
						candidate[i] = 0;
					}
					if(candidate[i]==p){
						System.out.println(i);
						flag = true;
						break;
					}
				}
				if(flag==true){
					break;
				}
			}
		}

	}

}

Measured memory_bytes: 27104
#include <iostream>
#include <istream>

using namespace std;

int main(){
	char line[20];
	int a=0;
	
while(cin>>line){
	for(a; line[a] != 0x00 ;a++);
	a--;
	for(a;a>=0;a--){
	cout<<line[a];
	}
	cout<<endl;
}


return 0;
}

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

int N, Q;
string S;
vector<int> vl(100000);
vector<int> vr(100000);
vector<int> ac(100000);

int main() {
  cin >> N >> Q;
  cin >> S;
  for (int i = 0; i < Q; i++) {
    int l, r;
    cin >> l >> r;
    vl.at(i) = (l - 1);
    vr.at(i) = (r - 1);
  }

  int num = 0;
  for (int i = 0; i < N - 1; i++) {
    ac.at(i) = num;
    if (S.at(i) == 'A' && S.at(i+1) == 'C') { ++num; ac.at(i+1) = num; }
  }
  ac.at(N - 1) = num;

  /*
  cout << S << endl;
  for (int i = 0; i < N - 1; i++) {
    cout << ac.at(i) << ",";
  }
  cout << endl;
  */

  for (int k = 0; k < Q; k++) {
    if (vl.at(k) == 0) cout << ac.at(vr.at(k)) << endl;
    else cout << ac.at(vr.at(k)) - ac.at(vl.at(k)) << endl;
  }
}
/*
8 3
ACACTACG
3 7
2 3
1 8

 */


Measured memory_bytes: 2176
n = int(input())
s = input()
ans = 0

for i in range(1000):
    i = str(i).zfill(3)
    a = s.find(i[0])
    if a != -1:
        b = s.find(i[1], a + 1)
        if b != -1:
            c = s.find(i[2], b + 1)
            if c != -1:
                ans += 1
print(ans)

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

#define INF (1001001001)

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

using namespace std;

int main()
{
	int n;

	while (scanf("%d", &n), n){
		int cnt = 0;

		int harf = n / 2 + 1;

		for (int i = 1; i <= harf; i++){
			int sum = i;

			for (int j = i + 1; j <= harf; j++){
				sum += j;
				if (sum == n){
					cnt++;
				}
				else if (sum > n){
					break;
				}
			}
		}

		printf("%d\n", cnt);
	}

	return (0);
}

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

#define ll long long int
#define ff(i,a,b) for(ll i = a; i < b; i++)
#define bf(i,b,a) for(ll i = b-1; i >= 0; i--)
#define itf(i,a) for(auto i = a.begin(); i != a.end(); i++)
#define MII map<int,int> 
#define MCI map<char,int>
#define MSI map<string,int>
#define VI vector<int> 
#define VC vector<char> 
#define VS vector<string> 
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define tc ll t; cin>>t; while(t--)
#define DISPV(v) itf(i,v) cout << *i << ' ';
#define DISPM(m) itf(i,m) cout << i->F << ' ' << i->S << endl;

const int MOD = int(1e9) + 7;

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    string s,t;
    cin >> s >> t;
    ll cnt = 0;
    ff(i,0,s.size()){
        if(s[i]!=t[i])
            cnt++;
    }
    cout << cnt << '\n';
}

Measured memory_bytes: 3880
#include<iostream>
#include<cstdio>

using namespace std;

string s;
bool flag;

int main()
{
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='C')
		{
			if(!flag)flag=true;
		}
		if(s[i]=='F')
		{
			if(flag)
			{
				puts("Yes");
				return 0;
			}
		}
	}
	puts("No");
	return 0;
}

Measured memory_bytes: 256
# ABC085D - Katana Thrower
def main():
    N, H, *AB = map(int, open(0).read().split())
    A = AB[::2]
    x = max(A)
    B = sorted([i for i in AB[1::2] if i > x], reverse=1)
    ans = 0
    for i in B:
        ans += 1
        H -= i
        if H <= 0:
            break
    else:
        ans += (H + x - 1) // x
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 25124
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<bitset>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<cstdio>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define re(i,x,y) for(int i=x;i<y;i++)

long long INF=1e9;
const long long mod=2019;
#define ll long long

int main(){
  ll L,R;
  cin>>L>>R;
  ll ans=INF;
  ll l,r;
  l=L%mod;
  r=R%mod;
  if(R-L>2019){
    ans=0;
  }
  else {
    for(int i=l;i<r;i++){
      for(int j=l+1;j<=r;j++){
        ll pos=(i*j)%mod;
        ans=min(ans,pos);
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}

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

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

struct Edge {
	ll to, cost;
	Edge() {}
	Edge(ll a, ll b) {
		to = a, cost = b;
	}
};

ll n, m;
vector<Edge> G[100000];
P Limit[100000];
bool isused[100000];

void dfs(int pos, int pre) {
	isused[pos] = true;
	P x = Limit[pos];
	for (int i = 0; i < G[pos].size(); i++) {
		if (G[pos][i].to == pre)continue;
		if (isused[G[pos][i].to])continue;
		Limit[G[pos][i].to] = P(-x.first, G[pos][i].cost - x.second);
		dfs(G[pos][i].to, pos);
	}

}

int main() {
	cin >> n >> m;
	ll u, v, s;
	for (int i = 0; i < m; i++) {
		cin >> u >> v >> s;
		u--, v--;
		G[u].push_back(Edge(v, s));
		G[v].push_back(Edge(u, s));
	}

	Limit[0] = P(1, 0);

	dfs(0, -1);

	ll mans = 1, Mans = 1e15;
	for (int i = 0; i < n; i++) {
		if (Limit[i].first > 0)mans = max(mans, 1 - Limit[i].second);
		else Mans = min(Mans, Limit[i].second - 1);
	}

	ll onlyans = -1;

	for (int i = 0; i < n; i++) {
		for(int j = 0; j < G[i].size(); j++) {
			int u = G[i][j].to;
			if (Limit[i].first + Limit[u].first == 0) {
				//辺の両端の二つの頂点が互いにx+a, -x+bの形をしてるとき
				if (Limit[i].second + Limit[u].second - G[i][j].cost != 0) {
					//それで符合しなかったとき
					cout << 0 << endl;
					return 0;
				}
			}
			else {

				P tmp = P(Limit[i].first + Limit[u].first, 
					Limit[i].second + Limit[u].second - G[i][j].cost);
				if (tmp.first > 0) {
					//両端の頂点がいずれもx+a, x+b型の時、
					//-x+a, -x+bの型と同様に処理できるように-1を辺のコストとの差のところにかける
					tmp.second *= -1;
				}

				if (tmp.second <= 0 || tmp.second % 2 != 0) {
					//x+a, x+bの時に、一つの解をもちうる可能性があるけど、
					//2で割り切れなかったり、解が1以上を満たさないときは無理
					
					cout << 0 << endl;
					return 0;
				}

				mans = max(mans, tmp.second / 2);
				Mans = min(Mans, tmp.second / 2);
			}
		}
	}

	if (mans > Mans) {
		cout << 0 << endl;
	}
	else {
		cout << Mans - mans + 1 << endl;
	}

	return 0;
}

Measured memory_bytes: 17280
H,W = [int(x) for x in input().split()]
s = ""
while not H == W == 0:
    for i in range(H):
        for j in range(W):
            s+= "." if (i+j)%2 else "#"
        print(s)
        s = ""
    print()
    H,W = [int(x) for x in input().split()]

Measured memory_bytes: 7644
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<map> 
#define INF 0x3f3f3f3f
#define int long long 
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int maxn=1e2+6;
const int mod=1e9+7;
const double pi=acos(-1.0);
int n,m,x; 
int num[maxn];
int c[maxn];
int a[maxn][maxn];
int read(){        
    int s = 0, f = 1;        
    char ch = getchar();        
    while(!isdigit(ch)) {        
        if(ch == '-') f = -1;        
        ch = getchar();        
    }        
    while(isdigit(ch)) {        
        s = s * 10 + ch - '0';        
        ch = getchar();        
    }        
    return s * f;        
}        
void write(int x){        
    if(x < 0) {        
        putchar('-');        
        x = -x;        
    }        
    if(x > 9)        
        write(x/10);        
    putchar(x % 10 + '0');        
    return;        
}   
signed main(){
	cin>>n>>m>>x;
	for(int i=0;i<n;i++){
		cin>>c[i];
		for(int j=0;j<m;j++)
		   cin>>a[i][j];
	} 
	int ans=INF;
	for(int i=0;i<(1<<n);i++){
		int cost=0;
		memset(num,0,sizeof(num));
		for(int j=0;j<n;j++)
		  if(i&(1<<j)){
		  	  cost+=c[j];
		  	  for(int k=0;k<m;k++)
		  	     num[k]+=a[j][k];
		  }
		int flag=0;
		for(int j=0;j<m;j++)
		   if(num[j]<x){
		   	flag=1;
		   	break;
		   }
		if(flag==0){
			ans=min(ans,cost);
		}
	}
	if(ans==INF)  cout<<"-1"<<endl;
	else 
	  cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3660
#include <iostream>
#include <cmath>
#include <string>
#include <iomanip>
using namespace std;

int main() {
    string S;
    cin >> S;
    int A = 0;
    int B = 0;
    for(int i = 0;i < S.size(); i++){
        if((S[i] == '0' && i % 2 == 0) || (S[i] == '1' && i % 2 == 1)){
            A++;
        }
    }
    for(int i = 0;i < S.size(); i++){
        if((S[i] == '0' && i % 2 == 1) || (S[i] == '1' && i % 2 == 0)){
            B++;
        }
    }
    cout << min(A,B) << endl;
}

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

using namespace std;


void solve() {
    string s; cin >> s;
    s[1] = (s[1]=='R'?'B':'R');
    cout << s;
}

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


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define fr(i,n) for(i=0;i<n;i++)
#define F first
#define S second
#define fast std::ios_base::sync_with_stdio(false)
#define mod 1000000007
#define pi 3.14159265
int main() {
    fast;
    lli n;
    cin>>n;
    lli a[n],i;
    fr(i,n)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    if(a[0]==0)
    {
        cout<<0;
        return 0;
    }
    lli prod=1,num=1000000000000000000;
    fr(i,n)
    {
        if(num/prod<a[i])
        {
            cout<<"-1";
            return 0;
        }
        else
        {
            prod*=a[i];
        }
    }
    cout<<prod;
    
    return 0;
}

Measured memory_bytes: 4404
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  while(cin>>n,n!=0){
    vector<int> a(n);
    for(int i=0;i<n;i++)
      cin>>a[i];
    sort(a.begin(), a.end(),greater<int>() );
    int df=1000001;
    for(int i=0;i<n-1;i++){
      if(df>=a[i]-a[i+1]){
        df = a[i]-a[i+1];
      }
    }
    cout<<df<<endl;
  }
}


Measured memory_bytes: 3136
#include <bits/stdc++.h>
#define sz(c)      int(c.size())
#define rep(i,a,b) for (int i=a; i<(b); ++i)
#define per(i,a,b) for (int i=(b)-1; i>=(a); --i)
using namespace std;
using ll = long long;

int const MAXN=2.2e6;
int const MD=998244353;

int madd(int x,int y) {
	if (x+y<MD) return x+y; else return x+y-MD;
}
int msub(int x,int y) {
	if (x-y>=0) return x-y; else return x-y+MD;
}
int mmul(int x,int y) {
	return int(ll(x)*y % MD);
}
int mpow(int x,int p) {
	int res=1;
	while (p>0) {
		if (p%2) res=mmul(res,x);
		x=mmul(x,x);
		p/=2;
	}
	return res;
}
int minv(int x) {
	return mpow(x,MD-2);
}
int mdiv(int x,int y) {
	return mmul(x,mpow(y,MD-2));
}

struct mod_fact {
	vector<int> f,rf;
	mod_fact(int n):f(n),rf(n) {
		f[0]=rf[0]=1;
		rep(i,1,n) {
			f[i]=mmul(f[i-1],i);
			rf[i]=minv(f[i]);
		}
	}
} mfact(MAXN);

int comb(int n,int k) {
	if (n<k) return 0;
	return mmul(mfact.f[n],mmul(mfact.rf[n-k],mfact.rf[k]));
}
int distr(int n,int k) {
	return comb(n+k-1,k-1);
}

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

	int N,M;
	cin>>N>>M;
	
	int res=0;
	rep(i,0,min(N,M)+1) if ((3*M-i)%2==0) {
		int add=mmul(comb(N,i),distr((3*M-i)/2,N));
		res=madd(res,add);
	}
	rep(i,0,min(N,M)+1) if ((M-i)%2==0) {
		int sub=mmul(comb(N,i),distr((M-i)/2,N));
		res=msub(res,mmul(sub,N));
	}
	rep(i,0,min(N,M)+1) if ((M-i)%2==0) {
		int add=mmul(comb(N-1,i),distr((M-i)/2,N-1));
		res=madd(res,mmul(add,N));
	}
	cout<<res<<'\n';
}


Measured memory_bytes: 17408
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int N, K;
vector<int> u, v;

int main()
{
    int n, m;
    cin >> n >> m;
    int a[n], b[m];
    map<int, int> mp;
    map<int, int> mpp;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        mp[a[i]]++;
        mpp[a[i]]++;
        u.push_back(a[i]);
    }
    for (int i = 0; i < m; i++)
    {
        cin >> b[i];
        if (mp[b[i]] == 1)
            v.push_back(b[i]);
        if (mpp[b[i]] == 0)
            u.push_back(b[i]);
    }
    cout << v.size() << " " << u.size() << endl;
    sort(u.begin(), u.end());
    sort(v.begin(), v.end());
    for (int i = 0; i < v.size(); i++)
    {
        cout << v[i] << endl;
    }
    for (int i = 0; i < u.size(); i++)
    {
        cout << u[i] << endl;
    }
    return 0;
}



Measured memory_bytes: 25036