akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
/*
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <set>
#include <cmath>
#include <cstring>

#include <stdio.h>
#include <string.h>
#include <sstream>
#include <stdlib.h>
#include <vector>
#include <iomanip>
#include <ctime>
*/
#define nl "\n"
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define p_un(a) ((void)a)
#define p_st(a) string(a)
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define naj ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define NL cout << endl;
#define sqr(x) (sqrt(x) * 1LL)
#define pcnt(i) __builtin_popcount(i)
#define up_b upper_bound
#define low_b lower_bound
#define lcm(a,b) (a * b) / __gcd(a, b)
#define REVERSE(a, n) reverse(a + 1, a + n + 1);
#define SORT(a, n) sort(a + 1, a + n + 1);
#define rsz resize

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ul;
typedef vector <ll> vl;
typedef vector <bool> vb;
typedef vector <char> vc;
typedef vector <int> vi;
typedef vector <string> vs;
typedef pair <ll, ll> pll;
typedef map <ll, ll> mll;
typedef set <ll> sl;
typedef set <char> sc;
typedef map <string, ll> msl;
typedef map <string, bool> msb;
typedef map <char, ll> mcl;
typedef map <string, string> mss;
typedef vector <vl> vvl;

const ll mxn = 1e6 + 1;
const ll mod = 1e9 + 7;
const ll inf = 1e18;
const ld eps = 1e-9;
const ld PI = acos(-1);
const ld E = 2.71828;

#define int int64_t
#define FLN "inverse"

//int dx[]= {1,0,-1,0}; int dy[]= {0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1}; int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2}; int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[]={-1,-1,+0,+1,+1,+0}; int dy[]={-1,+1,+2,+1,-1,-2}; //Hexagonal Direction

inline void joji(bool ok = 0) {naj;if(ok){freopen(FLN".in","r",stdin);freopen(FLN".out","w",stdout);}}

map <int, int> cnt;
              
main () {

	joji();        	
	int h, n;
	cin >> h >> n;
	vl a(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	if(accumulate(all(a), 0) >= h) cout << "Yes";
	else cout << "No";
	return 0;
}





        
                                                             


Measured memory_bytes: 1024
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N, A, B = LI()

    ans = 0
    for i in range(1, N + 1):
        if A <= sum([int(i) for i in str(i)]) <= B:
            ans += i

    print(ans)

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 10060
import itertools
import math
import fractions
import functools
import copy
from collections import deque
from functools import reduce
from sys import stdin
input = stdin.readline



n = int(input())
l = list(map(int, input().split()))

ans = 1
ng = False
for i in range(n):
    if l[i] == 0:
        print(0)
        quit()
    if not ng:
        ans *= l[i]
        if ans > 10**18:
            ng = True

if ng:
    print(-1)
else:
    print(ans)


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

int n;
multiset<int> S, T;
vector<int> v;

int main() {
    cin >> n;
    REP(i,(1<<n)){
        int s;
        cin >> s;
        S.insert(s);
        v.push_back(s);
    }
    T.insert(*--S.end());
    S.erase(--S.end());
    S.insert(IINF);
    vector<int> tmp;
    REP(i,n){
        tmp.clear();
        for(auto itr = --T.end();;--itr){
            int x = *itr;
            auto y = S.lower_bound(x);
            if(y == S.begin()){
                cout << "No" << endl;
                return 0;
            }
            --y;
            tmp.push_back(*y);
            S.erase(y);
            assert(x > *y);
            if(itr == T.begin()) break;
        }
        for(auto x : tmp) T.insert(x);
    }
    SORT(v);
    int k = 0;
    bool ok = true;
    for(auto x : T){
        //assert(v[k] == x);
        k++;
    }
    cout << (ok?"Yes":"No") << endl;
    return 0;
}


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

#define INX(x) (cin >> x)
#define INXV(vec, cnt) for(ll i; i < cnt; i++) INX(vec[i])
#define OUTX(x) (cout << x << endl)
#define OUTXV(vec) for(ll i; i < (ll)vec.size(); i++) OUTX(vec[i])

#define ADD emplace_back
#define MP make_pair

int main()
{
    ll A, V, B, W, T;
    cin >> A >> V >> B >> W >> T;

    if(V <= W)
    {
        OUTX("NO");
        return 0;
    }

    if(log10(abs(A - B)) - log10(V - W) <= log10(T))
    {
        OUTX("YES");
    }
    else
    {
        OUTX("NO");
    }

    return 0;
}


Measured memory_bytes: 3872
# D - Maze Master
from collections import deque


def bfs(start: int):
    queue = deque([start])
    dist = {start: 0}
    while queue:
        x = queue.popleft()
        for nx in (x + 1, x - 1, x + W, x - W):
            if maze[nx] == "." and nx not in dist:
                dist[nx] = dist[x] + 1
                queue.append(nx)
    return max(dist.values())


def main():
    global W, maze
    H, W = map(int, input().split())
    H, W = H + 2, W + 2
    maze = "#" * W
    for _ in range(H - 2):
        maze += "#" + input().rstrip() + "#"
    maze += "#" * W
    ans = max(bfs(i) for i, x in enumerate(maze) if x == ".")
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3316
#include <iostream>
#include <vector>
#include <set>
using namespace std;

int solve2(int o, int n, int s)
{
  int lb, ub;
  int c, a, b, x, y;
  set <int> Y;
  set <int> :: iterator it;

  lb = (s / (100 + o)) / 10000 * 100;
  ub = (1 + (s+200) / (100 + o)) * 100;

  for (c = lb; c <= ub; c+= 100) {
    for (a = 100; a <= c - 100; a += 100) {
      b = c - a;
      int x0, x1;
      x0 = a * (100 + o) / 10000 * 100;
      x1 = b * (100 + o) / 10000 * 100;
      x = x0 + x1;

      if (x == s) {
	int y0, y1;
	y0 = a * (100 + n) / 10000 * 100;
	y1 = b * (100 + n) / 10000 * 100;
	y = y0 + y1;
	Y.insert(y);
      }
    }
  }

  int maxy;

  for (it = Y.begin(); it != Y.end(); it++) {
    maxy = *it;
    //    cout << (*it) << ",";
  }
  //  cout << endl;
  
  return maxy;

}




int solve(int oldrate, int newrate, int oldtot)
{
  return solve2(oldrate, newrate, oldtot * 100)/100;
}



int main(void) 
{
  int o, n, s;
  int m;

  o = n = s = -1;

  while (o != 0 || n != 0 || s != 0) {
    cin >> o >> n >> s;
    if (o == 0 && n == 0 && s ==  0) {
      break;
    }
    m = solve(o, n, s);
    cout << m << endl;
    
  }
  

}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
const int mod = 1e9+7, A = 1e3+5;

int main()
{
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int n, m, x;
	cin >> n >> m >> x;
	int a[x], ptr = 0;
	for (int i = 0; i < x; i++)
		cin >> a[i];
	int ans[n][m];
	for (int i = 0; i < n; i++)
	{
		if (i % 2 == 0)
		{
			for (int j = 0; j < m; j++)
			{
				ans[i][j] = ptr + 1;
				a[ptr]--;
				if (a[ptr] == 0) ptr++;
			}
		}
		else
		{
			for (int j = m - 1; j >= 0; j--)
			{
				ans[i][j] = ptr + 1;
				a[ptr]--;
				if (a[ptr] == 0) ptr++;
			}
		}
	}
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
			cout << ans[i][j] << ' ';
		cout << '\n';
	}
	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0; i<n; i++)
#define REP(i,x,n) for (int i=x; i<n; i++)
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;

int main(){
  ll n, k;
  cin >> n >> k;
  
  vi a(n);
  vi s;
  rep(i,n) cin >> a.at(i);
  
  int r, l;
  {
    int v = 1;
    vi ord(n+1, -1);
    while (ord.at(v) == -1){
      ord.at(v) = s.size();
      s.push_back(v);
      v = a.at(v-1);
    }
   r = s.size() - ord.at(v);
   l = ord.at(v);
  }

  if (k < l) cout << s.at(k) << endl;
  else {
    k = (k - l) % r;
    cout << s.at(l+k) << endl;
  }
  return 0;
}


Measured memory_bytes: 5804
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const ll INF=mod*mod;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
ll min(ll a,ll b){
  if(a>b){
    return b;
    }
      else{
        return a;
      }
  }
  
  ll max(ll a,ll b){
    if(a>b){
      return a;
    }
    else{
      return b;
    }
  }

ll power(ll a,ll b){
 ll ans=1;
 for(ll i=1;i<=b;i++){
ans*=a;
  }
  return ans;
}

 ll gcd(ll m,ll n){
 	if(n==0){
       return m;
     }
   return gcd(n,m%n);
 }
ll lcm(ll a,ll b){
  ll g=gcd(a,b);
  return a/gcd(a,b)*b;
		

}
int main(){
  
  ll A,B;
  cin>>A>>B;
  
  
  ll num=gcd(A,B);
  ll ans=1;
  for(ll i=2;i*i<=num;i++){
    bool flag2=false;
   while(num%i==0){
     
num/=i;
     flag2=true;
     
  }
    
    if(flag2){
ans++;
    }
  }
  if(num==1){
cout<<ans<<endl;//素数が残らなかった場合
  }
else{
  
  cout<<ans+1<<endl;//素数が残った場合
}

  

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
#define pb push_back
#define mp make_pair
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
typedef long long ll;
 
const int inf = int(1e9);
const int mod = 1e9 + 7;
const int N = 1e6 + 555;
const long double PI = acos(-1.0);

void solve()
{	
	ll d, n;
	cin >> d >> n;
	if(d == 0) cout << n + n / 100;
	else if(d == 1){
		cout << 100 * n + ((100 * n) % 10000 == 0) * 100;
	}
	else if(d == 2){
		cout << 10000 * n + ((10000 * n) % 1000000 == 0) * 10000;
	}
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define MOD 1000000007

using namespace std;

int main(){
    int N; cin >> N;
    ll A[N+1],B[N];
    for (int i = 0; i < N+1; i++)
    {
        cin >> A[i];
    }
    for (int i = 0; i < N; i++)
    {
        cin >> B[i];
    }
    ll ans = 0;
    for (int i = 0; i < N; i++)
    {
        ans += min(A[i],B[i]) + min(A[i+1], B[i]-min(A[i],B[i]));
        A[i+1] -= min(A[i+1], B[i]-min(A[i],B[i]));
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f;
const double pi=3.1415926535897932384626;
inline ll read(){
	ll x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	return x*f;
}
ll a,b,c,d;
int main(){
	a=read(),b=read(),c=read(),d=read();
	ll ans;
	ans=a*c;
	ans=max(ans,a*d);
	ans=max(ans,b*c);
	ans=max(ans,b*d);
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 3764
from math import factorial
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

n,a,b = nm()
mod = 10**9+7

MAX = 10**6


def modpow(a,n,mod):
  res = 1
  while n>0:
    if n&1:
      res = res * a % mod
    a = a * a % mod
    n>>=1
  return res
    

ans = modpow(2,n,mod) - 1

def modcom(n,a,mod):
  X=1
  Y=1
  for i in range(a):
    X*=(n-i)
    X%=mod
  for i in range(a):
    Y*=(a-i)
    Y%=mod
  return X * modpow(Y,mod-2,mod)%mod


ans -= modcom(n,a,mod)
ans -= modcom(n,b,mod)

print(ans % mod)

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

class WeightedUnionFind{
public:
  int V;
  vector<int> par, rnk, diff, sz;
  WeightedUnionFind():V(-1){}
  WeightedUnionFind(int V):V(V),par(V),rnk(V,0),diff(V,0),sz(V,1){for(int i=0;i<V;i++)par[i]=i;}
  
  int find(int x){
    assert(x < V);
    if(par[x] == x) return x;
    int p = find(par[x]);
    diff[x] = diff[x] + diff[ par[x] ];
    return par[x] = p;
  }

  //頂点xは頂点yよりもz大きい
  void relate(int x,int y,int z){
    int sx = x, sy = y;
    x = find(x), y = find(y);
    if(x == y) assert(getDiff(sx,sy) == z);
    if(x == y)return;
    
    if(rnk[x] < rnk[y]) {
      par[x] = y;
      sz[y] += sz[x];
      diff[x] = z + (-diff[sx] + diff[sy]);
    }
    else{
      par[y] = x;
      sz[x] += sz[y];
      diff[y] = -z + (diff[sx] - diff[sy]);
      if(rnk[x]==rnk[y])rnk[x]++;
    }
  }

  int getDiff(int u,int v){
    assert(same(u,v));
    return diff[u] - diff[v];
  }
  
  bool same(int x,int y){return find(x)==find(y);}
  int size(int x){return sz[find(x)];}
  
};

signed main(){
  int n;
  cin>>n;
  WeightedUnionFind wuf(n);
  
  int q;
  cin>>q;
  while(q--){
    int cmd, x, y, z;
    cin>>cmd >> y >> x;
    if(cmd == 0){
      cin>>z;
      wuf.relate(x,y,z);
    }
    if(cmd == 1){
      if(!wuf.same(x, y)) cout<<"?"<<endl;
      else cout<<wuf.getDiff(x, y)<<endl;
    }
  }
  return 0;
}



Measured memory_bytes: 4392
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll maxn = 1e5+5;
 
ll n;
ll pre[maxn];
ll c[maxn<<1], s[maxn];
 
ll lowbit(ll x) {return x&(-x);}
 
ll query(ll x){
    ll res = 0;
    for(ll i = x; i ; i -= lowbit(i)){
        res += c[i];
    }
    return res;
}
 
void add(ll x){
    for(ll i = x; i <= 2*n; i += lowbit(i)){
        c[i] += 1;
    }
}
 
bool check(ll x){
    memset(c, 0, sizeof(c));
    s[0] = 0;
    for(ll i = 1; i <= n; i++) {
        s[i] = pre[i]>=x?1:-1;
        s[i] += s[i-1];
    }  
    ll sum = 0;
    for(ll i = 0; i <= n; i++){
        sum += query(s[i]+n);
        add(s[i]+n);
    }
    int num = n*(n+1)/2, ss;
    if (num%2) ss = (num)/2;
    else ss = num/2;
    if (sum >= n*(n+1)/4) return true;
    return false;
}
 
int main () {
    cin >> n;
     
    ll l = 1, r = 1;
    for(ll i = 1; i <= n; i++) {
        scanf("%lld", &pre[i]);
        if (pre[i] > r) r = pre[i]; 
    }
     
     
    ll ans;
    while(l <= r){
        ll mid = (l+r)>>1;
        if (check(mid)) ans = mid, l = mid+1;
        else r = mid-1;
    }
     
    printf("%lld\n", ans); 
     
    return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
 
int main() {
  ios::sync_with_stdio(0); 
  cin.tie(0); 
  
  int n; cin >> n;
  vector<int> arr(n + 1);
  for (int i = 1; i <= n; ++i) cin >> arr[i];

  int depth = 0;
  vector<bool> visited(n + 1, false);
  queue<int> q({1});

  while (!q.empty()) {
    int x = q.front(); q.pop();

    if (x == 2) {
      cout << depth << "\n";
      return 0;
    }

    if (!visited[x]) {
      visited[x] = true;
      q.push(arr[x]);
      depth++;
    }
  }

  cout << -1 << "\n";
}


Measured memory_bytes: 3704
#include <bits/stdc++.h>
using namespace std;
bool cmp(char a,char b)
{
	return a>b;
}
int main()
{
	string s,t;
	cin>>s;
	cin>>t;
	sort(s.begin(),s.end());
	sort(t.begin(),t.end(),cmp);
	if(s<t)
	   cout<<"Yes";
	else
	   cout<<"No";
	   return 0;
}

Measured memory_bytes: 256
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val a, b = sc.nextLong()
  val x = List.fill(n)(sc.nextLong())
  val ans = x.sliding(2).map{ case List(x1, x2) =>
    ((x2 - x1) * a).min(b)
  }.sum
  println(ans)
}


Measured memory_bytes: 70404
N,K = gets.split(' ').map(&:to_i)
As = gets.split(' ').map(&:to_i)

pool = Array.new
cnt=0
if N>K
  cnt=K
else
  cnt = N
end
#puts cnt
max=0
candi=0
#out = 全体で何個取るか
#in = 左から何個取るか
for out in 0..cnt

  for inner in 0..(out)
    pool = Array.new
    #pool.push(As[in])
    if inner>0
     for i in 0..(inner-1)
      pool.push(As[i])
     end
    end
    if inner != out
     for i in 0..(out-inner-1)
      pool.push(As[N-1-i])
     end
    end
    pool.sort!
#=begin
    #puts pool
    #puts "aaa"
    throw = K - out
    if throw>pool.length
      throw = pool.length
    end
    candi = 0
    for i in 0..pool.length-1
      candi += pool[i]
    end
    for i in 0..throw-1
      if pool[i]<0
        candi -= pool[i]
      else
        break
      end
    end
    if candi > max
      max = candi
    end

  end
#=end

end
puts max


Measured memory_bytes: 2044
#include<iostream>
using namespace std;
int main(){
    int n;
    int sum=0,max=0,x;
    cin>>n;
    for (int i=0;i<n;i++){
        cin>>x;
        sum+=x;
        if (x>max) max=x;
    }
    sum-=max/2;
    cout<<sum;
}

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

int main() {
    int H_1, M_1, H_2, M_2, K;
    cin >> H_1 >> M_1 >> H_2 >> M_2 >> K;

    int ans;
    int study_times;
    ans = (M_2 + H_2 * 60) - (M_1 + H_1 * 60) - K;
    cout << ans << endl;
}

Measured memory_bytes: 3612
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    // Your code here!
    int n, m;
    cin >> n >> m;
    vector<vector<int>> a(n,vector<int>(m));
    vector<int> b(m);
    for (int i = 0; i < n; i++)
        for (int j = 0; j < m; j++)
            cin >> a.at(i).at(j);
    
    for (int i = 0; i < m; i++)
        cin >> b.at(i);
    
    vector<int> c(n,0);
    for (int i = 0; i < n; i++) 
        for (int j = 0; j < m; j++)
            c.at(i)+=a.at(i).at(j)*b.at(j);
    
    for (int elem : c)
        cout << elem << endl;
}


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

int main(){
   int n,m,X,Y; cin>>n>>m>>X>>Y;
   vector<int> x(n);
   vector<int> y(m);
   rep(i,n) cin>>x[i];
   rep(i,m) cin>>y[i];
   sort(x.begin(),x.end());
   sort(y.begin(),y.end());
   int maxx=x[n-1]+1;
   int miny=y[0];
   if(maxx<=miny){
      if(X<maxx && miny<=Y){
         cout<<"No War"<<endl;
      }
      else cout<<"War"<<endl;
   }
   else cout<<"War"<<endl;
   return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
penalty = [0 for x in range(n+1)]
solved = [-1 for x in range(n+1)]
ans = 0
ans_penalty = 0
for i in range(m):
    p, s = map(str, input().split())
    p = int(p)
    if s == "WA":
        if solved[p] == -1:
            penalty[p] += 1
    else:
        if solved[p] == -1:
            ans += 1
            ans_penalty += penalty[p]
            solved[p] = 0
print(ans, ans_penalty)


Measured memory_bytes: 4656
def main():
    N, K, C = map(int, input().split())
    S = input()

    L = [-1] * K  # 0-ind

    i = 0
    cur = 0
    while i < N:
        if S[i] == 'o':
            L[cur] = i
            cur += 1
            if cur == K: break
            i += C
        i += 1

    R = [-1] * K  # 0-ind

    i = N - 1
    cur = K - 1
    while i >= 0:
        if S[i] == 'o':
            R[cur] = i
            cur -= 1
            if cur == -1: break
            i -= C
        i -= 1

    ans = (l + 1 for l, r in zip(L, R) if l == r)  # 1-ind
    print(*ans, sep='\n')


if __name__ == '__main__':
    main()


Measured memory_bytes: 34672
def main():
  n, m = map(int, input().split())
  works =[[] for _ in range(n + 1)]
  while True:
    s, t, e = map(int, input().split())
    if s == 0:
      break
    works[s].append((t - 1, e))
  
  l = int(input())
  for _ in range(l):
    blst = tuple(map(int, input().split()))
    print(*[sum([blst[t] * e for t, e in works[i]]) for i in range(1, n + 1)])
main()


Measured memory_bytes: 13508
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    a,b,n=map(int, readline().rstrip().split())

    x=min(n,b-1)
    ans=(a*x)//b-a*(x//b)
    print(ans)
    #arr=list(map(int, readline().rstrip().split()))
    #n=int(readline())
    #ss=readline().rstrip()
    #yn(1)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

Measured memory_bytes: 16176
def resolve():
    import copy
    s = list(input())
    n = len(s)-1
    c = 0
    for i in range(2**n):
        tmp = copy.deepcopy(s)
        d = 0
        for j in range(n):
            if (i // 2**j) % 2 == 1:
                tmp.insert(j+d+1, '+')
                d += 1
        tmp = ''.join(tmp).split('+')
        c += sum(map(int, tmp))
    print(c)
resolve()

Measured memory_bytes: 3572
N = int(input())
A = list(map(int, input().split()))
A.sort()
A.append(10**12)
MAX = A[N-1]
ans = N
for i in range(N):
    if abs(A[i] - MAX/2) < abs(A[ans] - MAX/2):
        ans = i
print(MAX,A[ans])

Measured memory_bytes: 20036
str_l = input().split()
n = int(str_l[0])
m = int(str_l[1])
data = []
for i in range(0, n):
    str_l = input().split()
    a = int(str_l[0])
    b = int(str_l[1])
    data.append([a, b])
data.sort(key = lambda x: x[0])
sum = 0
cost = 0
for i in range(0, n):
    if sum + data[i][1] <= m:
        sum = sum + data[i][1]
        cost = cost + data[i][0] * data[i][1]
    else:
        cost = cost + (m - sum) * data[i][0]
        break
print(cost)


Measured memory_bytes: 21156
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }



int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(25);

  vector<int> c(4, 0);
  rep(i, 6) {
    int v;
    cin >> v;
    v--;
    c[v]++;
  }
  sort(c.begin(), c.end());
  vector<int> ans = {1, 1, 2, 2};
  cout << (c == ans ? "YES" : "NO") << '\n';


  

  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
// std::cout << std::setprecision(2) << 3.141; // "3.1"
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;

static const int giga = pow(10,9);
// double pi = 3.141592653589793238463;

int main(void){
  int a,p;
  cin >> a >> p;
  cout << (3*a + p)/2 << endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int H,A[250],i,pk,lk,rk;
   
  scanf("%d",&H);
  for(i=1;i<=H;i++){
    scanf("%d",&A[i]);
  }

  for(i=1;i<=H;i++){
    printf("node %d: key = %d, ",i,A[i]);
    if(i != 1){
      pk = A[i/2];
      printf("parent key = %d, ",pk);
    }
    if(i*2 <= H){
      lk = A[2*i];
      printf("left key = %d, ",lk);
    }
    if(2*i+1 <= H){
      rk = A[2*i+1];
      printf("right key = %d, ",rk);
    }
    printf("\n");
  }
  return 0;
}      



Measured memory_bytes: 2100
# coding: utf-8
from math import gcd
K = int(input())
ans = 0
for i in range(1, K+1):
    for j in range(1, K+1):
        a1 = gcd(i, j)
        for k in range(1, K+1):
            ans += gcd(a1, k)
print(ans)
# print(gcd(1, gcd(2, 200)))

Measured memory_bytes: 67744
def multiple9(N):
    sN = str(N)
    sum = 0
    for i in range(len(sN)):
        sum += int(sN[i])
    if sum % 9 == 0:
        return 'Yes'
    else:
        return 'No'

if __name__ == "__main__":
    N = int(input())
    print(multiple9(N))

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


int main()
{
	int A, B,C;
	cin >> A >> B >>C;
	int answer = 0;
	int n=1;
	bool can=false;
	do{
		answer = (A*n) % B;
		n++;
		
		if (C == answer){
			can = true;
			break;
		}

	} while (B > n);
	

		if (can) {
			cout << "YES" << endl;

		}
		else {
			cout << "NO" << endl;

		}


	return 0;

}

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

inline int rd() {
  int x = 0;
  char c = getchar();
  while(!isdigit(c)) c = getchar();
  while (isdigit(c)) {
    x = x * 10 + (c ^ 48);
    c = getchar();
  }
  return x;
}

string s;

int main() {
  cin >> s;
  int len = s.size();
  cout << s;
  if (s[len - 1] == 's') puts("es");
  else puts("s");
  return 0;
}


Measured memory_bytes: 3632
#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
int main(){
    LL x,x_500aft,h;
    cin >> x;
    x_500aft = x%500;
    h += (x/500) * 1000;
    h += (x_500aft/5) * 5;
    cout << h << endl;


    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
int main(){
	long long n,num,cnt=0;
	cin >> n;
	for(long long i=0;i<n;i++){
		cin >> num;
		while(num%2==0){
			cnt++;
			num/=2;
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <climits>
#include <cmath>

using namespace std;




int main(int argc, char *argv[])
{
	int d;
	string ans;

	cin >> d;


	//calc
	if (d == 25){
		ans = "Christmas";
	}
	else if (d == 24){
		ans = "Christmas Eve";
	}
	else if (d == 23){
		ans = "Christmas Eve Eve";
	}
	else{
		ans = "Christmas Eve Eve Eve";
	}


	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n); for(int i = 0;i < (int)(n);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
int main(){
    int a,b,c,x;
    cin >> a >> b >> c >> x;
    int n = x/50+1;
    int cnt = 0;
    rep(i,a+1){
        rep(j,b+1){
            rep(k,c+1){
                if(500*i+100*j+50*k == x)cnt++;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
    int main()
    {
        int a,b;
        // 整数の入力
        scanf("%d %d",&a,&b);
      
      if(a*b%2 == 1){
        // 出力
        printf("Odd");
      }else 
        printf("Even");
        return 0;
    }

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	cout<<(a^b^c)<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }

ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll mod(ll val, ll m) {
    ll res = val % m;
    if (res < 0) res += m;
    return res;
}


const int MAX = 510000;
const int MOD = 998244353;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll N, M, K;
    cin >> N >> M >> K;
    ll p = 998244353;
    ll ans = modpow(M, N, p);
    ll sub = 0;
    COMinit();
    REP(k, K + 1, N) {
        //ll A = (N - k) / 2;

        //ll sub1 = modpow(M, A, p);
        ll sub1 = M;
        sub1 *= modpow(M - 1, N - k - 1, p);
        sub1 %= p;
        sub1 = sub1 * COM(N - 1, k);
        sub1 %= p;
        sub += sub1;
        sub %= p;
    }
    ans = mod(ans - sub, p);

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 15608
S = input()

#01010..
ans = 10 ** 5
count = 0
for i in range(len(S)):
    if S[i] != "0" and i % 2 == 0:
        count += 1
    elif S[i] != "1" and i % 2 == 1:
        count += 1
ans = min(ans, count)

#10101...
count = 0
for i in range(len(S)):
    if S[i] != "1" and i % 2 == 0:
        count += 1
    elif S[i] != "0" and i % 2 == 1:
        count += 1
ans = min(ans, count)
print(ans)

Measured memory_bytes: 3188
N,X=map(int,input().split())
*A,=map(int,input().split())

ans=0
if A[0]>X:
    ans+=A[0]-X
    A[0]=X

i=1
while i<N:
    if A[i]+A[i-1]>X:
        ans+=A[i]+A[i-1]-X
        A[i]=X-A[i-1]
    i+=1
        
print(ans)

Measured memory_bytes: 14060
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef unsigned long long ull;
typedef long double ld; 
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

vector<int> fact;
vector<int> ifact;
vector<int> inv;
vector<int> pow2;
const int MOD = (1e9 + 7);
int add(int a, int b)
{
	a+=b;
	while(a>=MOD) a-=MOD;
	return a;
}
int mult(int a, int b)
{
	return (a*1LL*b)%MOD;
}
int modpow(int a, int b)
{
	int r=1;
	while(b)
	{
		if(b&1) r=mult(r,a);
		a=mult(a,a);
		b>>=1;
	}
	return r;
}
int choose(int a, int b)
{
	if(a<b) return 0;
	if(b==0) return 1;
	if(a==b) return 1;
	return mult(fact[a],mult(ifact[b],ifact[a-b]));
}
int inverse(int a)
{
	return modpow(a,MOD-2);
}
void init(int _n)
{
	fact.clear(); ifact.clear(); inv.clear(); pow2.clear();
	fact.resize(_n+1);
	ifact.resize(_n+1);
	inv.resize(_n+1);
	pow2.resize(_n+1);
	pow2[0]=1;
	ifact[0]=1;
	fact[0]=1;
	for(int i=1;i<=_n;i++)
	{
		pow2[i]=add(pow2[i-1],pow2[i-1]);
		fact[i]=mult(fact[i-1],i);
		//ifact[i]=mult(ifact[i-1],inv[i]);
	}
	ifact[_n] = inverse(fact[_n]);
	for(int i=_n-1;i>=1;i--)
	{
		ifact[i] = mult(ifact[i + 1], i + 1);
	}
	for(int i=1;i<=_n;i++)
	{
		inv[i] = mult(fact[i-1],ifact[i]);
	}
}
	
int a[111111];
int S[111111];
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	init(333333);
	int n; cin>>n;
	for(int i=0;i<n;i++) cin>>a[i];
	int ans=0;
	S[1]=inv[1];
	for(int i=2;i<=n;i++) S[i]=add(S[i-1],inv[i]);
	for(int i=0;i<n;i++)
	{
		ans=add(ans,mult(fact[n],mult(a[i],S[i+1])));
		ans=add(ans,mult(fact[n],mult(a[i],S[n-i])));
		ans=add(ans,mult(fact[n],mult(a[i],MOD-1)));
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 6272
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
  int n,a,b,sum=0,cntB=0;
  string s;
  cin >> n >> a >> b >> s;
  for(int i=0; i<n; i++) {
    if(s[i]=='a') {
      if(sum<a+b) {
        cout << "Yes" << endl;
        sum++;
      }
      else {
        cout << "No" << endl;
      }
    }
    else if(s[i]=='b') {
      if(sum<a+b&&cntB<b) {
        cout << "Yes" << endl;
        sum++,cntB++;
      }
      else {
        cout << "No" << endl;
      }
    }
    else {
      cout << "No" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
const ll mod=1e9+7;
ll powmd(ll a, ll b){
    if(b==0) return 1;
    ll g=powmd(a,b/2);
    g*=g; g%=mod;
    if(b&1) g*=a;
    return g%mod;
}
void solve(){
    ll n,k;
    cin>>n>>k;
    ll dp[k+1];
    dp[k]=1;
    ll ans=k;
    for(int i=k-1;i>=1;i--){
        ll gh=powmd(k/i,n);
        for(int j=2*i;j<=k;j+=i){
            gh-=dp[j];
            gh+=mod;
            gh%=mod;
        }
        dp[i]=gh;
        ans=(ans+((dp[i]*i)%mod))%mod;
    }
    cout<<ans<<'\n';
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    solve();
    return 0;
}


Measured memory_bytes: 4372
k,n=map(int,input().split())
a=list(map(int, input().split()))
max_dis = 0
for i in range(n):
  if i == n-1:
    dis = (k+a[0]) - a[i]
  else:
    dis = a[i+1] - a[i]
  max_dis = max(max_dis,dis)
print(k-max_dis)

Measured memory_bytes: 26444
#include<iostream>
using namespace std;
int main()
{
    int x,h=0;
    cin>>x;
    while(x>5){
        if(x>=500){
            h+=1000*(x/500);
            x=x%500;
        }
        else{
            h+=5*(x/5);
            x=x%5;
        }
    }
    cout<<h<<endl;

    return 0;
}




Measured memory_bytes: 256
#!/usr/bin/env python3

n = int(input())
reds = []
for i in range(n):
    a, b = map(int, input().split())
    reds.append((a, b))
blues = []
for i in range(n):
    c, d = map(int, input().split())
    blues.append((c, d))

reds = sorted(reds, key=lambda x: -x[1])
blues = sorted(blues, key=lambda x: x[0])

res = 0
for i, b in enumerate(blues):
    for j, r in enumerate(reds):
        if r[0] < b[0] and r[1] < b[1]:
            res += 1
            reds.pop(j)
            break

print(res)



Measured memory_bytes: 3064
using System;

class Program
{
    static void Main()
    {
        var X = long.Parse(Console.ReadLine());

        var m = 100L;
        var result = 0;
        while (m < X)
        {
            m += (long)(m * 0.01);
            result++;
        }
        Console.WriteLine(result);
    }
}


Measured memory_bytes: 27496
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	int cnt=0;
	string s;
	cin>>s;
	for(int i=0;i<3;i++){
		if(s.substr(i,1)=="a"){
			cnt+=1;
		}else if(s.substr(i,1)=="b"){
			cnt+=10;
		}else if(s.substr(i,1)=="c"){
			cnt+=100;
		}
	}
	if(cnt==111){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}

	return 0;
}


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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  if(A+B > C+D){
     cout << "Left" << endl;
  }  
  else if(A+B == C+D){
     cout << "Balanced" << endl;
  }
  else if(A+B < C+D){
     cout << "Right" << endl;
  }
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define int long long
#define INF 1000000000000000
using namespace std;

typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);



signed main(){

    int N; cin >> N;
    vector<int> p(N); readindex(p);

    int ans = 0;
    if(p[N - 1] == N - 1){
        swap(p[N - 1], p[N - 2]);
        ans++;
    }
    REP(i, N - 1){
        if(p[i] == i){
            swap(p[i], p[i + 1]);
            ans++;
        }
    }
    cout << ans;
    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

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

using namespace std ;
#define ll long long int
#define pb push_back
#define mod 1000000007
#define db long double
#define INF INT_MAX-1


ll d,t,s;



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

   #ifdef patil
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif

   cin>>d>>t>>s;

   

   if(s*t >= d)cout<<"Yes";
   else cout<<"No";

return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>

using ll = long long;

#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
int const nmax = 500;
char v[1 + nmax][1 + nmax];

int main() {
  int n, m;
  std::cin >> n >> m;
  for(int i = 1;i <= n; i++)
    for(int j = 1;j <= m; j++)
      std::cin >> v[i][j];
  for(int i = 1; i <= n; i++)  {
    for(int j = 1;j <= m; j++)
      if((i % 2 == 1 || j == 1 || v[i][j] == '#') && j < m)
        std::cout << '#';
      else
        std::cout << '.';
    std::cout << '\n';
  }
  std::cout << '\n';
  for(int i = 1;i <= n; i++) {
    for(int j = 1; j <= m; j++)
      if(1 < j && (i % 2 == 0 || j == m || v[i][j] == '#'))
        std::cout << '#';
      else
        std::cout << '.';
    std::cout << '\n';
  }
  return 0;
}


Measured memory_bytes: 3876
#include<stdio.h>
#include<iostream>
#include<cstring>
#include<algorithm> 
#include<cmath>
#include<vector>
#include<queue>
#define inf 0x3f3f3f3f 
#define ll long long
#define lowbit(x) (x)&-(x)
using namespace std;
int n,t,a[10005];
int main(){	
	int s,t,d;
	scanf("%d%d%d",&d,&t,&s);
	if(s*t>=d) puts("Yes");
	else puts("No");
	return 0;
}

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

string solve() {
    ll A1, A2, A3;
    cin >> A1 >> A2 >> A3;
    if ( A1 + A2 + A3 >= 22) return "bust";
    else return "win";
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
X, K, D = map(int, input().split())

X = abs(X)

if K * D < X:
	print(X - K * D)
else:
	x = X % D
	n = K - (X - x) // D
	if n % 2 == 1:
		print(D - x)
	else:
		print(x)



Measured memory_bytes: 9168
t = input()
t = str(t)
t = list(t)
t = [int(s) for s in t]
n = len(t)
c_a = 0
c_b = 0
for i in range(n):
    if i%2==0:
        if t[i] != 0:
            c_a += 1
    else:
        if t[i] != 1:
            c_a += 1

for i in range(n):
    if i%2==0:
        if t[i] != 1:
            c_b += 1
    else:
        if t[i] != 0:
            c_b += 1
    
if c_a >= c_b:
    print(c_b)
else:
    print(c_a)

Measured memory_bytes: 4652
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<=int(b);++i)
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
int INF=numeric_limits<int>::max();
// for(int j=0;j<N;++j) {

int main(void) {
  int N,M,Q;cin>>N>>M>>Q;
  vector<vector<int>> m;

  int A,B,C,D;
  rep(i,0,Q-1) {
    cin>>A>>B>>C>>D;

    vector<int> v;
    v.push_back(A);
    v.push_back(B);
    v.push_back(C);
    v.push_back(D);
    m.push_back(v);
  }

  ll ans = 0;

  rep(a,1,M) {
  rep(b,a,M) {
  rep(c,b,M) {
  rep(d,c,M) {
  rep(e,d,M) {
  rep(f,e,M) {
  rep(g,f,M) {
  rep(h,g,M) {
  rep(i,h,M) {
  rep(j,i,M) {
    vector<int> A_;
    A_.push_back(a);
    A_.push_back(b);
    A_.push_back(c);
    A_.push_back(d);
    A_.push_back(e);
    A_.push_back(f);
    A_.push_back(g);
    A_.push_back(h);
    A_.push_back(i);
    A_.push_back(j);
    // cout << a << " ";
    // cout << b << " ";
    // cout << c << " ";
    // cout << d << " ";
    // cout << e << " ";
    // cout << f << " ";
    // cout << g << " ";
    // cout << h << " ";
    // cout << i << " ";
    // cout << j << " ";
    // cout << endl;
    ll tmp = 0;
    rep(i,0,Q-1) {
      int a = m[i][0];
      int b = m[i][1];
      int c = m[i][2];
      int d = m[i][3];
      a--;
      b--;
      if(c==A_[b]-A_[a]) {
        tmp+=d;
      }
      ans=max(tmp,ans);
    }
  } } } } } } } } } }

  pr(ans);

  return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
typedef long long ll;
const ll inf = 1e9;
int main(){
    int n, q;
    cin >> n >> q;
    vector<vector<ll> > v(n);
    rep(i,q){
        ll com, t; cin >> com >> t;
        ll x;
        if(com == 0){
            cin >> x;
            v[t].push_back(x);
        }else if(com == 1){
            if(v[t].size() > 0)rep(j,v[t].size())cout << v[t][j] << ((j != v[t].size() - 1)?" ":"\n");
            else cout << endl;
        }else v[t].clear();
    }
    return 0;
} 


Measured memory_bytes: 8836
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
	"strings"
)

func exec(r io.Reader) string {
	sc := bufio.NewScanner(r)
	sc.Scan()
	in := strings.Split(sc.Text(), " ")
	h, _ := strconv.Atoi(in[0])
	w, _ := strconv.Atoi(in[1])
	hw := make([][]string, h)
	for i := 0; i < h; i++ {
		sc.Scan()
		in = strings.Split(sc.Text(), "")
		hw[i] = in
	}
	for i := range hw {
		for j := range hw[i] {
			if hw[i][j] == "." {
				c := 0
				for y := -1; y < 2; y++ {
					for x := -1; x < 2; x++ {
						if x == 0 && y == 0 {
							continue
						}
						yy, xx := i+y, j+x
						if xx >= 0 && yy >= 0 && xx < w && yy < h {
							if hw[yy][xx] == "#" {
								c++
							}
						}
					}
				}
				hw[i][j] = fmt.Sprintf("%d", c)
			}
		}
	}
	result := func(hw [][]string) string {
		str := ""
		for _, line := range hw {
			str += fmt.Sprintf("%s\n", strings.Join(line, ""))
		}
		return str[0 : len(str)-1]
	}(hw)
	return result
}

func main() {
	fmt.Println(exec(os.Stdin))
}

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

int main(){
  int n;
  cin>>n;
  bool le,ri,c;
  string s;
  cout << 0<<endl;
  cin>>s;
  if(s=="Vacant")return 0;
  map<string,bool> mp;
  mp["Female"]=0;
  mp["Male"]=1;
  ri=mp[s];
  cout<<n-1<<endl;
  cin>>s;
  if(s=="Vacant")return 0;
  le=mp[s];
  int mi=0,ma=n-1,mid=(ma+mi)/2;
  while(1){
    cout<<mid<<endl;
    cin>>s;
    if(s=="Vacant")break;
    c=mp[s];
    if(((ma-mid)%2)^(le==c)){
        le=c;
        ma=mid;
    }else{
        ri=c;
        mi=mid;
    }
    mid=(ma+mi)/2;
  }
  return 0;
}


Measured memory_bytes: 852
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int sx = sc.nextInt();
		int sy = sc.nextInt();
		int tx = sc.nextInt();
		int ty = sc.nextInt();
		char[] vChars = new char[ty - sy];
		char[] hChars = new char[tx - sx];
		Arrays.fill(hChars, 'L');
		String left = new String(hChars);
		Arrays.fill(hChars, 'R');
		String right = new String(hChars);
		Arrays.fill(vChars, 'D');
		String down = new String(vChars);
		Arrays.fill(vChars, 'U');
		String up = new String(vChars);
		
		StringBuilder sb = new StringBuilder();
		sb.append(up).append(right);
		sb.append('U').append(left).append('L').append(down).append('D').append('R');
		sb.append(right).append(up);
		sb.append('R').append(down).append('D').append(left).append('L').append('U');
		System.out.println(sb);
	}
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


void solve(){
    int N;
    cin >> N;
    vector<int> A(N);
    REP(i,N) cin >> A[i];
    ll ans = 0;
    int cur = 1;
    REP(i,N){
        if(i == 0){
            ans += A[i] - 1;
            continue;
        }
        if(cur + 1 == A[i]) cur++;
        else if(cur + 1 < A[i]){
            ans += (A[i] - 1) / (cur + 1);
        }
    }
    cout << ans << endl;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    // int T; cin >> T; REP(t,T) solve();
}

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

using namespace std;

int main() {

	long long x;
	cin >> x;
	
	long long i = 1;
	long long a;
	a = 100;

	while (1) {
		a = (long long)(a * (double)1.01);
		if (a >= x) {
			cout << i << endl;
			return 0;
		}
		i++;
	}

	return 0;

}

Measured memory_bytes: 3632
#include<stdio.h>
#define NUM 44
int fib(int);
int F[NUM];

int main(){
  int i,n,f;
  for(i=0;i<NUM;i++){
    F[i]=0;
  }
  scanf("%d",&n);
  f=fib(n);
  printf("%d\n",f);
}

int fib(int n){
  if(n==0||n==1){
    F[n]=1;
    return 1;
  }
  if(F[n]!=0)return F[n];
  else{
   F[n]=fib(n-1)+fib(n-2);
   return F[n];
  }
}



Measured memory_bytes: 2104
open Str

let read_list f =
  split (regexp " +") (read_line ()) |> List.map f

let rate x =
  let y = x / 400 in
  if y > 8 then 8 else y

let part ar =
  let rec loop i c =
    if i = 8 then c
    else
      loop (i+1) ((if ar.(i) > 0 then 1 else 0) + c) in
  (loop 0 0, ar.(8))
  
let () =
  let n = read_int () in
  let xs = read_list int_of_string in
  let tbl = Array.make 9 0 in
  List.iter (fun x -> let r = rate x in tbl.(r) <- (tbl.(r) + 1)) xs;
  match part tbl with
    0, y -> print_endline @@ "1 " ^ (string_of_int y)
  | x, y -> print_endline @@ (string_of_int x) ^ " " ^ (string_of_int (x+y))


Measured memory_bytes: 384
import std.stdio, std.string, std.conv, std.algorithm, std.array;

int swapCount(int[] arr, int target) {
  int min = 0, max = arr.length.to!(int) - 1;
  int counter = 0;
  while (true) {
    int mean = (min + max) / 2;
    if (arr[mean] > target) max = mean - 1;
    else if (arr[mean] == target) {counter++; break;}
    else if (min > max) break;
    else min = mean + 1;
    counter++;
  }
  return counter;
}

int read_num() {return readln.chomp.to!int;}

void main() {
  for(int times; readf("%d\n", &times), times != 0;) {
    int[] arr;
    foreach(t; 0..times) arr ~= read_num;    
    swapCount(arr, read_num).writeln;
  }
}

Measured memory_bytes: 1076