akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define mrep(i,j,n) for(int i = j; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define el cout<<endl
#define cer(x) cerr << x <<endl
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
#define vi vector<int> 
#define vvi vector<vector<int>> 
#define vpii vector<pair<int,int>> 
#define vl vector<ll> 
#define vvl vector<vector<ll>> 
#define vb vector<bool> 
#define vvb vector<vector<bool>>
#define vs vector<string> 
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
ll mod = 1e9 + 7;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a * b / g; }
bool is_prime(ll x) { for (ll i = 2; i * i <= x; i++) { if (x % i == 0)return false; } return true; }

int main()
{
	string s;
	cin >> s;
	bool flag = false;
	rep(i, sz(s))
	{
		if (s[i] == 'C')flag = true;
		if (flag && s[i] == 'F')
		{
			co("Yes");
			return 0;
		}
	}
	co("No");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/math/common_factor.hpp>

#define rep_ui(k,n)      for(ui  i = (k); i < (n); ++i)
#define rep_si(k,n)      for(int i = (k); i < (n); ++i)
#define rep_ul(k,n)      for(ul  i = (k); i < (n); ++i)
#define rep_sl(k,n)      for(ll  i = (k); i < (n); ++i)
#define rep_ui_down(k,n) for(ui  i = (k); i > (n); --i)
#define rep_si_down(k,n) for(int i = (k); i > (n); --i)
#define rep_ul_down(k,n) for(ul  i = (k); i > (n); --i)
#define rep_sl_down(k,n) for(ll  i = (k); i > (n); --i)

#define rep_uj(k,n)      for(ui  j = (k); j < (n); ++j)
#define rep_sj(k,n)      for(int j = (k); j < (n); ++j)
#define rep_uj_down(k,n) for(ui  j = (k); j > (n); --j)
#define rep_sj_down(k,n) for(int j = (k); j > (n); --j)

#define rep(k,n)         rep_ui(k,n)

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

template<class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vc)
{
  boost::for_each(vc, [&os, &vc](T value) {
    os << value;
    if (value != vc.back())
      os << ' ';
    });
  return os;
}

template<class T1, class T2>
inline
std::ostream&
operator<<(std::ostream& os, const std::pair<T1, T2>& p)
{
  return os << p.first << ' ' << p.second;
}

void solve(void)
{
  using std::string;
  using std::vector;
  using std::map;
  using std::pair;
  //string S{}; std::cin >> S;
  //ui  N{}; std::cin >> N;

  ui A{}, P{}; std::cin >> A >> P;
  P += A * 3;

  ull ans = (ull)P / 2;

  std::cout << ans << '\n';

  return;
}

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

  solve();

  return 0;
}


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

int main() {
    int n;
    cin >> n;
    
    vector<int> a(n);
    for  (int i = 0; i < n; i++) {
        cin >> a.at(i);
    }
    reverse(a.begin(), a.end());
    for (int j = 0; j < n; j++) {
        if (j == n-1) {
            cout << a.at(j);
        } else {
            cout << a.at(j) << ' ';
        }
    }
    cout << endl;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false);
	int n;
	int a[] = { 5,7,5,7,7 };
	while (cin >> n, n)
	{
		vs v(n);
		REP(i, n) cin >> v[i];
		REP(i, n)
		{
			int p = 0, tmp = 0;
			bool f = true;
			FOR(j, i, n)
			{
				if (p == 5) break;
				tmp += v[j].size();
				if (tmp == a[p])
				{
					tmp = 0; p++;
				}
				else if (tmp > a[p])
				{
					f = false;
					break;
				}
			}
			if (f)
			{
				cout << i + 1 << endl;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3096
#create date: 2020-06-13 21:01

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    a, v = na()
    b, w = na()
    t = ni()
    l = abs(b - a)
    if v <= w:
        print("NO")
    else:
        if l / (v-w) <= t:
            print("YES")
        else:
            print("NO")



if __name__ == "__main__":
    main()

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define long long long 

int main() {
    IOS;

    long int k,x;
    cin>>k>>x;

    long int lower = x - k + 1;
    long int upper = x + k - 1;

    for(long int i = max(-1000000LL,lower); i < x; i++)
        cout<<i<<" ";
    
    cout<<x<<" ";

    for(long int i = x+1; i <= upper && i <= 1000000LL; i++)
        cout<<i<<" ";

    return 0;
}


Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<iomanip>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define dme cout<<-1<<endl;return 0
//ios::sync_with_stdio(false);
//<< setprecision(5)
const int mod=1000000007;
const long double big=1e18+10;
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
int main(void){
	ios::sync_with_stdio(false);
	llint n,m,i,j;
	cin>>n>>m;
	vector<vector<int>>ten(n);
	for(i=0;i<m;i++){
		int a,b;cin>>a>>b;a--;b--;
		ten[a].pub(b);
		ten[b].pub(a);
	}
	vector<int>nibu(n);//二部グラフ? 1or 2
	queue<int>que;
	nibu[0]=1;que.push(0);
	int ok=0;//にぶでない
	while(!que.empty()){
		int ter=que.front();
		int ki=nibu[ter];
		que.pop();
		for(auto it:ten[ter]){
			if(nibu[it]==0){nibu[it]=3-ki;que.push(it);}
			else if(nibu[it]==3-ki){continue;}
			else{ok=1;break;}
		}
		if(ok==1){break;}
	}
	if(ok==1){cout<<(n*(n-1)/2)-m<<endl;return 0;}
	llint iti=0;
	for(auto it:nibu){if(it==1){iti++;}}
	cout<<(iti*(n-iti))-m<<endl;
	return 0;
}


Measured memory_bytes: 6272
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
int main()
{
	lint a,b,out=0;int t,u;
	cin>>a>>b;
	if(a==b){
		cout<<1<<endl;return 0;
	}
	for(int i=61;i>=0;i--){
		if(a>=(1LL<<i)){
			a-=(1LL<<i);b-=(1LL<<i);
		}
		if(b>=(1LL<<i)){
			t=i;break;
		}
	}
	b-=(1LL<<t);
	for(u=0;;u++){
		if((1LL<<u)>b) break;
	}
	lint mi=a,ma=(1LL<<u);
	out+=(1LL<<t)-mi;
	if(ma>mi) out+=(1LL<<t);
	else out+=ma+(1LL<<t)-mi;
	cout<<out<<endl;
}


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

int main(){
    int n;
    cin >> n;
    if(n<105)cout << 0 << endl;
    else if(n<135)cout <<1 << endl;
    else if(n<165)cout<< 2 << endl;
    else if(n<189)cout << 3 << endl;
    else if(n<195)cout << 4 << endl;
    else cout <<5 << endl;

}


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

int main() {
    int a,b;
    int ans = 0;
    cin >> a >> b;
    if(b == 1){
        cout << 0;

    }else {
        ans++;
        b -= a;
        while (b >= 1) {
            ans++;
            b -= a - 1;
        }
        cout << ans;
    }
    return 0;
}

Measured memory_bytes: 3588
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main(){
    long long int ans=0;
    int N;
    int nowt=1;
    cin>>N;
    for(int i=0;i<N;i++){
        int a;
        cin>>a;
        if(nowt==a){
            nowt++;
        }
        else{
            ans++;
        }
    }
    if(nowt==1)cout<<-1<<endl;
    else cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n,k;
    cin>>n>>k;
    int h[n];
    ll sum=0;
    for(int i=0;i<n;i++)
    {
        cin>>h[i];
    }
    sort(h,h+n);
    ll ans=0;
    for(int i=0;i<n-k;i++)
    {
        ans+=h[i];
    }
    cout<<ans;
    return 0;
}









Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  signed long long H, W;
  cin >> H >> W;
  if(H==1 || W==1) {
    cout << '1' << endl;
  }
  else if(W%2==0) {
    cout << H*W/2 << endl;
  }
  else if(H%2==0) {
    cout << H*W/2 << endl;
  }
  else {
    cout << H*(W-1)/2+(H+1)/2 << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision

using namespace std;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define rrep1(i,n) for(int i = (n); i >= 1; --i)
#define REP(i,n,m) for(int i = (n); i < (m); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(vec) for(auto v : vec) cerr << v << " "; cerr << endl;
#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << v << " "; cerr << endl; } 
#define debugP(vec) for(auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl;
#define debug2DP(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl; } 

typedef long long ll;

constexpr ll INF = 1000000000; //10^10
//const ll MOD = 998244353;
constexpr ll MOD = 1000000007;

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


int main() {
	int a,b,c,d,e,f; cin >> a >> b >> c >> d >> e >> f;

	vector<ll> suma(31), sumb(31);
	suma[0] = 0;
	sumb[0] = 0;
	rep(i, 30) {
		suma[i+1] = suma[i] + 100*a;
		sumb[i+1] = sumb[i] + 100*b;
	}

	vector<ll> water(961);
	rep(i, 31) rep(j, 31) {
		water[i*31 + j] = suma[i] + sumb[j];
	}

	vector<ll> sumc(1501), sumd(1501);
	sumc[0] = 0;
	sumd[0] = 0;
	rep(i, 1500) {
		sumc[i + 1] = sumc[i] + c;
		sumd[i + 1] = sumd[i] + d;
	}

	vector<ll> sugar(2253001);
	rep(i, 1501) rep(j, 1501) {
		sugar[i * 1501 + j] = sumc[i] + sumd[j];
	}

	sort(all(water));
	sort(all(sugar));

	auto bs = [&sugar, e, f](int l, int r, int w) {
		while (l+1 < r) {
			int mid = (l + r) / 2, s = sugar[mid];
			bool ok = s <= (w / 100)*e && s + w <= f;

			if (ok) l = mid;
			else r = mid;
		}
		
		return l;
	};
  
	ll anss = -1, answ = -1;
	double per = 0;
	for (int w : water) {
		int ix = bs(-1, 2253001, w);
		if (ix >= 0 && chmax(per, 100.0*sugar[ix]/(w+sugar[ix]))) {
			anss = sugar[ix];
			answ = w;
		}
		
	}
	cout << answ + anss << " " << anss << endl;
}

Measured memory_bytes: 17920
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  n,k=LI()
  l=LI()

  mn=inf
  for i in range(n-k+1):
    a=l[i]
    b=l[i+k-1]

    if a<0 and b>0:
      mn=min([mn,abs(a)+abs(b)*2,abs(a)*2+abs(b)])
    else:
      mn=min(mn,max(abs(a),abs(b)))

  return mn

print(main())


Measured memory_bytes: 17136
#include <cstring>
#include <algorithm>
#include <cstdio>

using namespace std;
const int MAXN = 110;

int n, s[MAXN];
char str[MAXN];

void input() {
	scanf( "%s", str ), n = strlen(str);
	for( int i = 0; i < n; ++i ) s[i] = str[i] - 'a';
}

bool exist( int c ) {
	for( int i = 0; i < n; ++i )
		if( s[i] == c ) return true;
	return false;
}
int a[MAXN];
bool all( int m, int c ) {
	for( int i = 0; i < m; ++i )
		if( a[i] != c ) return false;
	return true;
}
int solve_single( int c ) {
	int m = n;
	for( int i = 0; i < n; ++i ) a[i] = s[i];
	for( int ans = 0; ; ++ans ) {
		if( all(m,c) ) return ans;
		--m;
		for( int i = 0; i < m; ++i )
			if( a[i] == c || a[i+1] == c ) a[i] = c;
	}
	return -1;
}
void solve() {
	int ans = 1e9;
	for( int i = 0; i < 26; ++i )
		if( exist(i) ) ans = min( ans, solve_single(i) );
	printf( "%d\n", ans );
}

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


Measured memory_bytes: 128
def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]

N, M = map(int, input().split())
X = list(map(int, input().split()))

X.sort()
hoge = [0]*(M-1)
for i in range(1, M):
    hoge[i-1] = X[i] - X[i-1]

hoge = list(reversed(sorted(hoge)))

ans = sum(hoge)
if N >= M:
    ans = 0
else:
    for i in range(N-1):
        ans -= hoge[i]
print(ans)


Measured memory_bytes: 13960
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<numeric>
#include<algorithm>
#include<tuple>
#include<cmath>
#include <iomanip>

typedef unsigned long long ull;
typedef long long ll;

ll DENOM = 1000000000LL + 7LL;

using namespace std;

ll n, m, k;
ll h, w;


int main(){
    ll x;
    cin >> x;
    ll mx = 110000;
    vector<ll> is_prime(mx+1, true);
    for (ll i=2; i<mx; ++i){
        if(! is_prime[i]) continue;
        for(ll j=2; j*i <= mx; ++j){
            is_prime[i*j] = false;
        }
    }
    for(ll i=x; i<mx; ++i){
        if(is_prime[i]){
            cout << i << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 3512
#include<stdio.h>

int BinarySearch(int a[], int key, int start,int end) {
	int Start = start, End = end;
	int med;
	while (Start != End) {
		med = (Start + End) / 2;
		if (a[med] == key)return med;
		else if (a[med] < key)Start = med+1;
		else End = med;
	}
	if (a[Start] == key) return Start;
	return -1;
}

int main() {
	int n, q;
	int S[100000], T[50000];
	int cnt = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &S[i]);
	}
	scanf("%d", &q);
	for (int i = 0; i < q; i++) {
		scanf("%d", &T[i]);
	}
	for (int j = 0; j < q; j++) {
		if (BinarySearch(S, T[j],0,n) != -1) {
			cnt++;
		}
	}
	printf("%d\n", cnt);


	return 0;
}


Measured memory_bytes: 3268
using System;
using System.Collections.Generic;
namespace 私が灰コーダーです{
    class Inonoa{
        static void Main(){
            string[] a_b = Console.ReadLine().Split();
            int a = int.Parse(a_b[0]);
            int b = int.Parse(a_b[1]);
            if(a>12){
                Console.WriteLine(b);
            }else if(a>5){
                Console.WriteLine(b/2);
            }else{
                Console.WriteLine(0);
            }
        }
    }
}

Measured memory_bytes: 11220
#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;
  string OP;
  cin>>A>>OP>>B;
  int ans=0;
  if(OP=="+")ans=A+B;
  if(OP=="-")ans=A-B;
  cout<<ans<<endl;
}

Measured memory_bytes: 256
from heapq import *
N, M = map(int, input().split())
def f(x):
    return int(x)*(- 1)
A = list(map(f, input().split()))
heapify(A)
for i in range(M):
    a =  (- heappop(A))//2
    heappush(A, - a)
print(- sum(A))

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

namespace ABC075_b
{
    class Program
    {
        static void Main(string[] args)
        {
            var HW = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var H = HW[0];
            var W = HW[1];
            var s = new char[H][];
            var t = new char[H][];
            for (int i = 0; i < H; i++)
            {
                s[i] = Console.ReadLine().ToCharArray();
            }

            for (int i = 0; i < H; i++)
            {
                t[i] = new char[W];
                for (int j = 0; j < W; j++)
                {
                    if (s[i][j] == '#')
                    {
                        t[i][j] = '#';
                        continue;
                    }
                    var cnt = 0;
                    if (i > 0 && s[i - 1][j] == '#') cnt++;
                    if (i < H - 1 && s[i + 1][j] == '#') cnt++;
                    if (j > 0 && s[i][j - 1] == '#') cnt++;
                    if (j < W - 1 && s[i][j + 1] == '#') cnt++;
                    if (i > 0 && j > 0 && s[i - 1][j - 1] == '#') cnt++;
                    if (i < H - 1 && j > 0 && s[i + 1][j - 1] == '#') cnt++;
                    if (i > 0 && j < W - 1 && s[i - 1][j + 1] == '#') cnt++;
                    if (i < H - 1 && j < W - 1 && s[i + 1][j + 1] == '#') cnt++;

                    t[i][j] = cnt.ToString()[0];
                }
            }
            for (int i = 0; i < H; i++)
            {
                Console.WriteLine(t[i]);
            }
        }
    }
}


Measured memory_bytes: 11348
n,k=map(int,input().split())

num = [0]*k
#1以上n以下の数において，kで割った余りがxになるような数が何個あるか
for i in range(1,n+1):
    num[i%k] += 1

res = 0
for a in range(k):
    b = (k-a)%k
    c = (k-a)%k
    if (b+c)%k!=0: pass
    else: res += num[a] * num[b] * num[c]
print(res)

Measured memory_bytes: 40560
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int value = stdIn.nextInt();
        int change;

        if(value % 1000 == 0) {
            change = 0;
        }else {
            change = 1000 - (value % 1000);
        }

        System.out.println(change);
        stdIn.close();
    }

}

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

int main()
{
	string X;
	cin >> X;
	int ans =888;//ansに大きな数を入れる//

	for (int i = 0; i <= X.size()-3; i++) {//Xの長さよりも３回少なくループする。iは０から始まり１ずつふえる//

		int MIN = min(ans, abs(753 - stoi(X.substr(i, 3))));
		//ansとXから抜き出したiから三番目までの数を比べ、小さいほうをint MINに代入する。//
		//初回は大きな数と比べるため必ず抜き出した数がint MINに代入される//
		ans = abs(MIN);
		//int MINを絶対値にしてansに代入し、ループする//
	}
	//上のfor文で最も小さいansを出力する//
	cout << ans << endl;
	return 0;
}

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

int main()
{
	int D, T, S;
	scanf("%d", &D);
	scanf("%d", &T);
	scanf("%d", &S);

	if (S * T  >= D)
		printf("Yes\n");
	else
		printf("No\n");
	return (0);
}


Measured memory_bytes: 1664
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <algorithm>
#include <queue>
#include <cmath>
#include <iomanip>
#include <cstdlib>
// #include <fstream>

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

long long int dp[110][100010] = {0};

int main()
{
    std::ios_base::sync_with_stdio(0);
    std::cin.tie(0);
    int N, W; std::cin >> N >> W;
    std::vector<long long int> w(110), v(110);
    for(int i=0; i<N; i++) std::cin >> w[i] >> v[i];
    
    for(int i=0; i<N; i++)
    {
        for(int sum_w=0; sum_w<=W; ++sum_w)
        {
            if(sum_w-w[i]>=0)
                chmax(dp[i+1][sum_w], dp[i][sum_w-w[i]]+v[i]);
            
            chmax(dp[i+1][sum_w], dp[i][sum_w]);
        }
    }
    std::cout << dp[N][W] << std::endl;
    return 0;
}


Measured memory_bytes: 79488
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define PP std::pair<int,int>

int main(){
    while(true){
        int count=0;
        if(count>10)return 0;
        int N,M;
        bool D[21][21];
        for(int i=0;i<=20;i++){
            for(int j=0;j<=20;j++){
                D[i][j]=false;
            }
        }
        std::cin>>N;
        if(N==0)break;
        std::vector<PP> juwel;
        for(int i=0;i<N;i++){
            int x,y;
            std::cin>>x>>y;
            D[x][y]=true;
        }
        std::cin>>M;
        std::vector<int> dir[4];
        int rx=10,ry=10;
        for(int i=0;i<M;i++){
            char d;
            int dis;
            std::cin>>d>>dis;
            if(d=='N'){
                for(int j=1;j<=dis;j++){
                    ry++;
                    if(D[rx][ry]){
                        D[rx][ry]=false;
                        count++;
                    }
                }
            }
            if(d=='E'){
                for(int j=1;j<=dis;j++){
                    rx++;
                    if(D[rx][ry]){
                        D[rx][ry]=false;
                        count++;
                    }
                }
            }if(d=='S'){
                for(int j=1;j<=dis;j++){
                    ry--;
                    if(D[rx][ry]){
                        D[rx][ry]=false;
                        count++;
                    }
                }
            }if(d=='W'){
                for(int j=1;j<=dis;j++){
                    rx--;
                    if(D[rx][ry]){
                        D[rx][ry]=false;
                        count++;
                    }
                }
            }
        }
        std::cout<<(count==N?"Yes":"No")<<std::endl;
    }
    return 0;
}


Measured memory_bytes: 3016
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; ++i) cin >> a[i];
  auto b = a;
  sort(b.begin(), b.end());
  assert(a == b);
  int q;
  cin >> q;
  while(q--) {
    int k;
    cin >> k;
    auto it = lower_bound(a.begin(), a.end(), k);
    auto it2 = upper_bound(a.begin(), a.end(), k);
    cout << distance(a.begin(), it) << " " << distance(a.begin(), it2) << endl;
  }
  return 0;
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
const long long MAXn = 2e5 + 10, INF = 1e18;

long long dp[MAXn][6], ar[MAXn], n;

int main() {
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> ar[i];
	for (int i = 0; i < n; i++) {
		if (i) {
			for (int j = 0; j < 5; j++) {
				dp[i][j] = INF;
				for (int x = 0; x <= j; x++)
					dp[i][j] = min(dp[i-1][x], dp[i][j]);
			}
		}
		dp[i][0] += (ar[i]);
		if (ar[i] == 0) {
			dp[i][3] += 2;
			dp[i][1] += 2;
		}
		else {
			dp[i][1] += (ar[i] % 2 == 1);
			dp[i][3] += (ar[i] % 2 == 1);		
		}
		dp[i][2] += (ar[i] % 2 == 0);
		dp[i][4] += (ar[i]);
	}
	long long ans = MAXn;
	for (int i = 0; i < 5; i++)
		ans = min(ans, dp[n-1][i]);
	cout << ans;
}


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

int main(){
    int N, K;
    cin >> N >> K;
    map<int, int> m;


    for(int i = 0; i < K;i++){
        int d;
        cin >> d;
        for(int j = 0;j< d;j++){
            int A;
            cin >> A;
            m[A] = 1;
        }
    }

    int ctr = 0;
    for(int i =1; i <= N;i++){
    /*    cout << m[i] << endl;*/
        if(m[i] == 0){
            ctr ++;
        }
    }
    cout << ctr << endl;

    return 0;
}

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;
using ld = long double;
const int MOD = 1e9+7;
const ll INF = 1LL << 60;


int main() {
    int a,b,c; cin >> a >> b >> c;
    V<int> v({a,b,c});
    sort(ALL(v));
    int ans = abs(v[1] - v[0]) + abs(v[2] - v[1]);
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <ctime>
#define INF 999999999
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=(n);i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;
/*---------------------------------------------------*/

int main(){
  int ans=0;
  int n,a,b;
  int imos[100005]={0};
  cin>>n;
  rep(i,n){
    scanf("%d%d",&a,&b);
    imos[a-1]++;
    imos[b]--;
  }
  REP(i,1,n+1){
    imos[i]+=imos[i-1];
    if(imos[i]>=i)ans=i;
  }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 3564
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let n = get!(usize);
    let mut m = Vec::new();
    let mut mm = Vec::new();
    for _ in 0..n {
        let l = get!(String).split_whitespace().map(|i| i.parse::<i64>().unwrap()).collect::<Vec<_>>();
        m.push(l.clone());
        mm.push(l);
    }

    for k in 0..n {
        for i in 0..n {
            for j in 0..n {
                if m[i][j] > m[i][k] + m[k][j] {
                    m[i][j] = m[i][k] + m[k][j];
                }
            }
        }
    }
    for i in 0..n {
        for j in 0..n {
            if m[i][j] != mm[i][j] {
                println!("-1");
                return;
            }
        }
    }

    let mut r = 0;
    for i in 0..n {
        for j in 0..n {
            let mut f = true;
            for k in 0..n {
                if i == k || j == k { continue; }
                if m[i][j] == m[i][k] + m[k][j] {
                    f = false;
                }
            }
            if f { r += m[i][j]; }
        }
    }
    println!("{}", r/2);
}

Measured memory_bytes: 4268
#include<stdio.h>
int main(){
	int a;
	scanf("%d",&a);
	while(a--){
		int b,c,d;
		scanf("%d%d%d",&b,&c,&d);
		int ret=0;
		while(b<1000){
			ret++;
			d++;
			if(b%3&&c%2==0&&d==20){
				c++;
				d=1;
			}else if(d==21){
				c++;
				d=1;
			}
			if(c>10){
				b++;
				c=1;
			}
		}
		printf("%d\n",ret);
	}
}

Measured memory_bytes: 1024
#include <cstdio>

int main(){
    int n;
    scanf("%d",&n);
    int a[4][3][10] = {};

    for(int i = 0;i < n;i++){
        int b,f,r,v;
        scanf("%d %d %d %d",&b,&f,&r,&v);
        a[b - 1][f - 1][r - 1] += v;
    }
    for(int i = 0;i < 4;i++){
        for(int j = 0;j < 3;j++){
            for(int k = 0;k < 10;k++){
                printf(" %d",a[i][j][k]);
            }
            printf("\n");
        }
        if(i != 3){
            for(int j = 0;j < 20;j++)
            printf("#");
            printf("\n");
        }
    }
    return 0;
}


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

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


Measured memory_bytes: 256
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(){return +cin[cid++];}
function nextstr(){return cin[cid++];}
function nextbig(){return BigInt(cin[cid++]);}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var myOut = main();
if(myOut !== undefined)console.log(String(myOut));

function main(){
  var a = next();
  return a+a*a+a*a*a;
}

Measured memory_bytes: 29676
def buy(my_money, A, count):
    return my_money%A, count + my_money//A

def sell(my_money, A, count):
    return my_money + A*count, 0

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

now = 1000  # 所持金
kabu = 0

for i in range(N-1):
    if A[i] < A[i+1]:
        now, kabu = buy(now, A[i], kabu)
    else:
        now, kabu = sell(now, A[i], kabu)

now, kabu = sell(now, A[N-1], kabu)

print(now)


Measured memory_bytes: 9144
#include <cstdio>
#include <algorithm>
int a[205];
int main() {
	int n;scanf("%d",&n);
	for(int i=0;i<(n<<1);++i) scanf("%d",&a[i]);
	std::sort(a,a+2*n);
	int ans=0;
	for(int i=0;i<(n<<1);i+=2) ans+=a[i];
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
#define ll long long

ll dp[3500][3500];

ll n,s;

ll a[3500];

int main(){
    scanf("%lld%lld",&n,&s);
    for(int i=1;i<=n;i++){
        scanf("%lld",&a[i]);
    }
    ll ans=0;
    for(int i=1;i<=n;i++){
        dp[i][a[i]]=i;
        for(int j=a[i];j<=s;j++){
            dp[i][j]=(dp[i][j]+dp[i-1][j-a[i]])%mod;
        }
        ans=(ans+dp[i][s]*(n-i+1)%mod)%mod;
        for(int j=1;j<=s;j++){
            dp[i][j]=(dp[i][j]+dp[i-1][j])%mod;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 84224
import java.util.*;

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

        long fivehCnt = 0;
        long fiveCnt = 0;

        fivehCnt = S / 500;

        long amari = S % 500;

        fiveCnt = amari / 5;

        System.out.println(1000 * fivehCnt + 5 * fiveCnt);
    }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
# define ll long long int
# define ld  long double
# define pb push_back
# define pp pop_back
# define ff first
# define ss second
#define pll pair<ll, ll>
# define mp make_pair
# define ac accumulate
# define mod 1000000007
#define um unordered_map
# define pii pair<ll,ll>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int  main()
{
	ll a,r,d,b,c;
	cin>>r>>d>>c;
	for(ll i=0;i<10;i++)
	{
		cout<<r*c-d<<"\n";
		c=r*c-d;
	}		
}
	

Measured memory_bytes: 256
#include <bits/stdc++.h>
const long long MOD = 1000000007;
const int INF = INT_MAX / 2;
const long double PI = 3.1415926;
using namespace std;
#define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++) 
#define REP(i, n) FOR(i, (0), n)
#define ALL(r) r.begin(), r.end()
#define ll long long int
typedef vector<ll> vi;
typedef vector<string> vs;
typedef vector<pair<ll, ll>> vp;
typedef vector<tuple<ll, ll, ll>> vt;
//vector<vector<ll>> vv(n, vector<ll>(n));

typedef int Weight;
struct Edge
{
	int from, to; Weight cost;
	bool operator < (const Edge& e) const { return cost < e.cost; }
	bool operator > (const Edge& e) const { return cost > e.cost; }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
void add_edge(Graph &g, int from, int to, Weight cost)
{
	g[from].push_back(Edge{ from, to, cost });
}

ll n, m, r, ans = INF;
ll g[205][205];
vi vr;
void dfs(int vert, ll cost, int dep)
{
	if (dep == (1 << r) - 1) ans = min(ans, cost);
	else
	{
		int tmp = dep;
		REP(i, r)
		{
			if (!(tmp % 2)) dfs(vr[i], cost + g[vert][vr[i]], dep + (1 << i));
			tmp >>= 1;
		}
	}
}

int main()
{
	cin >> n >> m >> r;
	vr.resize(r);
	REP(i, r) {
		cin >> vr[i];
		vr[i]--;
	}
	REP(i, 205) REP(j, 205) g[i][j] = INF;
	REP(i, m)
	{
		ll a, b, c;
		cin >> a >> b >> c;
		a--; b--;
		g[a][b] = g[b][a] = c;
	}
	REP(i, n) g[i][i] = 0;
	REP(k, n) REP(i, n) REP(j, n) g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
	REP(i, r) dfs(vr[i], 0, 1 << i);
	cout << ans << endl;
}

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

using namespace std;

int main(){
	long long n;
	cin>>n;
	vector<long long> hoge(n);
	for(int i=0;i<n;i++){
		cin>>hoge.at(i);
	}
	long long ans=0;
	map<long long,long long> s;

	for(int i=0;i<n;i++){
		long long a=hoge.at(i);
		s[i+a]++;
		if(s.count(i-a)) ans+=s.at(i-a);
	}

	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 17184
/*
  Compete against Yourself.
  Author - Aryan Choudhary (@aryanc403)
*/

#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define fo(i,n)   for(i=0;i<(n);++i)
#define repA(i,j,n)   for(i=(j);i<=(n);++i)
#define repD(i,j,n)   for(i=(j);i>=(n);--i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define endl "\n"

typedef long long int lli;
typedef long double mytype;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef vector<lli> vi;

clock_t time_p=clock();
void aryanc403()
{
#ifdef ARYANC403
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
#endif
}

#ifdef ARYANC403
#include "/home/priank/codes/PastCodes/header.h"
#else
    #define dbg(args...)
#endif

const lli INF = 0xFFFFFFFFFFFFFFFL;

lli seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline lli rnd(lli l=0,lli r=INF)
{return uniform_int_distribution<lli>(l,r)(rng);}

class CMP
{public:
bool operator()(ii a , ii b) //For min priority_queue .
{    return ! ( a.X < b.X || ( a.X==b.X && a.Y <= b.Y ));   }};

void add( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt==m.end())         m.insert({x,cnt});
    else                    jt->Y+=cnt;
}

void del( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt->Y<=cnt)            m.erase(jt);
    else                      jt->Y-=cnt;
}

bool cmp(const ii &a,const ii &b)
{
    return a.X<b.X||(a.X==b.X&&a.Y<b.Y);
}

const lli mod = 1000000007L;
// const lli maxN = 1000000007L;

    lli T,n,i,j,k,in,cnt,l,r,u,v,x,y;
    lli m;
    string s;
    vi a;
    //priority_queue < ii , vector < ii > , CMP > pq;// min priority_queue .

int main(void) {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    // freopen("txt.in", "r", stdin);
    // freopen("txt.out", "w", stdout);
// cout<<std::fixed<<std::setprecision(35);
// cin>>T;while(T--)
{

    cin>>n>>m>>k;
    i=min(n,k);
    n-=i;
    k-=i;
    i=min(m,k);
    m-=i;
    cout<<n<<" "<<m<<endl;

}   aryanc403();
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
  string s,t;
  cin >> s >> t;
  string a = "Yes";
  for(int i = 0;i < s.size();i++){
    if(s[i]!=t[i]) a = "No";
  }
  cout << a << endl;
}

Measured memory_bytes: 3624
N = int(input())
T = list(map(int, input().split()))
M = int(input())

for _ in range(M):
    p, x = map(int, input().split())
    total = 0
    for i in range(N):
        if i == p - 1:
            total += x
        else:
            total += T[i]
    print(total)

Measured memory_bytes: 9124
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int a = 0, b = 0;
	vi v(n);
	REP(i, n)cin >> v[i];
	sort(ALL(v));
	RREP(i, n) {
		
		if ((n-1-i) % 2)b += v[i];
		else a += v[i];
	}
	cout << a - b << endl;
}


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

def init(init_val):
    for i in range(n):
        MI[i+num-1]=init_val[i]
        MA[i+num-1]=init_val[i]    
    for i in range(num-2,-1,-1) :
        MI[i]=min(MI[2*i+1],MI[2*i+2])
        MA[i]=max(MA[2*i+1],MA[2*i+2])
    
def update(k,x):
    k += num-1
    MI[k] = x
    MA[k] = x
    while k+1:
        k = (k-1)//2
        MI[k] = min(MI[k*2+1],MI[k*2+2])
        MA[k] = max(MA[k*2+1],MA[k*2+2])

def rangemin(p,q):
    if q<=p:
        return 1<<100
    p += num-1
    q += num-2
    res= 1<<100
    while q-p>1:
        if p&1 == 0:
            res = min(res,MI[p])
        if q&1 == 1:
            res = min(res,MI[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = min(res,MI[p])
    else:
        res = min(min(res,MI[p]),MI[q])
    return res

def rangemax(p,q):
    if q<=p:
        return -1
    p += num-1
    q += num-2
    res= -1
    while q-p>1:
        if p&1 == 0:
            res = max(res,MA[p])
        if q&1 == 1:
            res = max(res,MA[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = max(res,MA[p])
    else:
        res = max(max(res,MA[p]),MA[q])
    return res

#n:リスト長
num =2**(n-1).bit_length()
MI=[1<<100]*2*num
MA=[-1]*2*num

init(p)
a = 0
l = -1
c = 0
for i in range(1,n):
    if p[i-1] > p[i]:
        a = i
    if i >= k-1 and a <= i-k+1:
        if i-l > 1:
            c += 1
        l= i

ans = 1-max(c-1,0)

for i in range(n):
    if i >=k:
        if rangemin(i-k+1,i) < p[i-k] or rangemax(i-k+1,i) > p[i]:
            ans += 1

print(ans)

Measured memory_bytes: 104444
#include <iostream>
#include <stdio.h>       // printf,scanf
#include <stdlib.h>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>  //sort,binarySearch
#include <functional> 
#include <iomanip>    // setprecision
#include <utility>    // c+11 Array
#include <set>
#include <sstream>
#include <map>
#include <bits/stdc++.h>
#define MOD (1e+9)+7
#define PI 3.141592653589793238462643383279
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define pb(x) push_back(x)
#define debug(x) cout << #x << " = " << x << endl;
#define debret(x) debug(x) ; return 0;

using namespace std;

int main(void){

    string a,b,c;
    char turn = 'a';
    
    cin >> a >> b >> c;

    int card_a = a.size();
    int card_b = b.size();
    int card_c = c.size();

    int a_n = 0;
    int b_n = 0;
    int c_n = 0;

    while(1){
        switch(turn){
        case 'a': turn = a[a_n]; a_n++; break;
        case 'b': turn = b[b_n]; b_n++; break;
        case 'c': turn = c[c_n]; c_n++; break;
        }
        if(a_n == card_a && turn == 'a'){
            cout << 'A' << endl;
            return 0;
        }else if(b_n == card_b  && turn == 'b'){
            cout << 'B' << endl;
            return 0;
        }else if(c_n == card_c  && turn == 'c'){
            cout << 'C' << endl;
            return 0;
        }
    }
    
    return 0;
}


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

n = int(input())
C = [list(map(int,input().split())) for i in range(n)]

from fractions import gcd

for i in range(n):
    a = C[i][0]
    b = C[i][1]
    c = C[i][2]
    d = C[i][3]
    ng = 0

    e = 0  # 最初に補充が発生する直前の本数
    e0 = a - b
    e1 = ((c - a%b) // b) * b + a%b
    e = min(e0, e1)

    if e < 0 or b > d:
        ng = 1
    else:
        g = gcd(b, d)
        # print(c+1, b-1, g)
        if c+1 <= b-1 and (c - e) // g < (b-1 - e) // g:
            ng = 1

    if ng == 1:
        print("No")
    else:
        print("Yes")
        

Measured memory_bytes: 64876
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Arrays;
import java.util.Scanner;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CrestedIbisvsMonster solver = new CrestedIbisvsMonster();
        solver.solve(1, in, out);
        out.close();
    }

    static class CrestedIbisvsMonster {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int h = in.nextInt();
            int n = in.nextInt();
            List<Pair> list = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                int a = Integer.parseInt(in.next());
                int b = Integer.parseInt(in.next());
                list.add(new Pair(a, b));
            }

            int[] dp = new int[h + 100];
            Arrays.fill(dp, (int) Math.pow(10, 8));
            dp[0] = 0;
            for (int i = 0; i < h; i++) {
                for (int j = 0; j < n; j++) {
                    Pair p = list.get(j);
                    int nextHp = i + p.first;
                    if (h < nextHp) {
                        nextHp = h;
                    }
                    dp[nextHp] = Math.min(dp[nextHp], dp[i] + p.second);
                }
            }
            out.println(dp[h]);
        }

    }

    static class Pair {
        public final Integer first;
        public final Integer second;

        Pair(Integer first, Integer second) {
            this.first = first;
            this.second = second;
        }

    }
}



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

using namespace std;
using ll = long long int;

int main(void) {
    constexpr ll MOD = 1e9 + 7;
    constexpr double PI = acos(-1);
    cout << fixed << setprecision(16);
    cin.tie(0); ios::sync_with_stdio(false);

    ll a, b, h, m;
    cin >> a >> b >> h >> m;
    double ht = (1.0*h/12 + 1.0*m/(12*60)) * 2*PI;
    double hx = a * cos(ht), hy = a * sin(ht);
    double mt = 1.0*m/60 * 2*PI;
    double mx = b * cos(mt), my = b * sin(mt);
    cout << sqrt((hx-mx)*(hx-mx) + (hy-my)*(hy-my)) << endl;
}


Measured memory_bytes: 4140
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll = long long;
using vi = vector<int>;
using vv = vector<vi>;
using P  = pair<int,int>;
const int INF = 1001001001;
const int MOD = 1000000007;

int main(){
    int x;
    cin >> x;
    cout << 1-x << endl;
    
    return 0;
}

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

int main()
{
    string s;
    cin >> s;
    int cnt = 0;
    for(int i=0;i<s.size()/2;i++){
        if(s[i] != s[s.size() - i  - 1]){
            cnt++;
        }
    }    
    
        
cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = 999999999;

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

    string N;
    cin >> N;
    cout << "ABC" << N << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
typedef long double ld;
typedef unsigned long long int ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<pair<ll, ll>> vpll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef vector<vll> vvll;
typedef map<int, int> mii;
typedef set<int> si;
//---------------------------------------------------------------------------------------------------

int main(void){
    // Your code here!
    int x; cin >> x;
    if (x == 0) cout << 1 << endl;
    else cout << 0 << endl;
}


Measured memory_bytes: 3596
import math

a, b, h, m = map(int, input().split())

theta_a = math.radians(30 * h + 0.5 * m)
theta_b = math.radians(6 * m)

x_a, y_a = a * math.cos(theta_a), a * math.sin(theta_a)
x_b, y_b = b * math.cos(theta_b), b * math.sin(theta_b)

length = ((x_a - x_b) ** 2 + (y_a - y_b) ** 2) ** (0.5)
print(length)


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


long long int Exp(long long int exp_n,long long int exp_e, long long exp_mod);


int main(){
  int N;
  cin >> N;
  long long int A[N], O=0, M=0;
  cin >> A[0];
  M=A[0];
  for(int i=1;i<N;i++){
    cin >>A[i];
    if(A[i]>M){
      M=A[i];
    }else{
      O=O+M-A[i];
    }
  }
  cout << O;
  
  return 0;
}


long long int Exp(long long int exp_n,long long int exp_e, long long int exp_mod){
  long long int exp_o = 1;
  long long int exp_x=exp_n;
  long long int exp_tmp;
  
  while(0<exp_e){
    exp_tmp = exp_e/2;
    if(exp_e - exp_tmp*2 == 1){
      exp_o = exp_o*exp_x;
      if(exp_o>exp_mod){
        exp_o=exp_o%exp_mod;
      }
    }
    
    exp_x = exp_x*exp_x;
    if(exp_x>exp_mod){
      exp_x=exp_x%exp_mod;
    }
    exp_e = exp_tmp;
  }
  return exp_o;
}


Measured memory_bytes: 5192