akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 1e9 + 7;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd_calc(T a, T b){ if(b){ return gcd_calc(b, a % b); }else{ return a; }}
template<class T> T gcd(T a, T b){ if(a < b) swap(a, b); return gcd_calc(a, b); }
template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
inline int at(int x, int k){ return (x >> k) & 1; }

int main(){
    string S;
    cin >> S;
    Yes(!(S[0] == S[1] && S[1] == S[2]));
}


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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
ld EPS = 1e-12;
int INF = numeric_limits<int>::max() / 2;
int MOD = 1e9 + 7;
#define rep(i,n) for(int i=0;i<n;i++)
 
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    int n, m;
    cin >> n >> m;
    int upper = m / n;
    for(int i = upper; i > 0; i--){
        int rest = m - i * n;
        if(rest % i == 0){
            cout << i << "\n";
            return 0;
        }
    }
}

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(condition) if(condition){cout << "POSSIBLE" << endl;}else{cout << "IMPOSSIBLE" << endl;}
#define Possible(condition) if(condition){cout << "Possible" << endl;}else{cout << "Impossible" << endl;}
#define possible(condition) if(condition){cout << "possible" << endl;}else{cout << "impossible" << endl;}
#define Size(n) (n).size()

typedef long long ll;


using namespace std;

const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;


long long int n,cnt=0,ans=0,a,b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

      
      cin>>n;
      rep(i,100){
          rep(j,100){
              pos=4*i+7*j;
              if(pos==n){
                  fl=true;
              }
          }
      }
      Yes(fl);
     

       
return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
	int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int e = Math.min(a,b);
    int f = Math.min(c,d);
    System.out.println(e+f);
  }
}

Measured memory_bytes: 22868
#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[i];
    }

    int i,now = 1;
    for (i = 0; i < n; i++)
    {
        now = a[now - 1];
        if(now == 2)break;
    }
    
    if(i != n)cout << i + 1 << endl;
    else cout << -1 << endl;
}

Measured memory_bytes: 640
#!/usr/bin/env python3
import sys
import math

def solve(N: int):
    INF = 10000000000000
    result = INF
    for a in range(1, int( math.sqrt(N) ) + 1):
        if N % a:
            continue
        result = min(result, a + int( N / a ) - 2)
    print(result)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;

class Node {
public:
  int location;
  int p, l, r;
  Node() {}
};

class Point {
public:
  int id, x, y;
  Point() {}
  Point(int id, int x, int y) : id(id), x(x), y(y) {}
  bool operator < (const Point &p) const {
    return id < p.id;
  }

  void print() {
    printf("%d\n",id);
  }
};

static const int MAX = 1000000;
static const int NIL = -1;

int N;
Point P[MAX];

Node T[MAX];
int np;

bool lessX(const Point &p1, const Point &p2) { return p1.x < p2.x; }
bool lessY(const Point &p1, const Point &p2) { return p1.y < p2.y; }

int makeKDTree(int l, int r, int depth) {
  if (!(l < r)) return NIL;
  int mid = (l + r) / 2;
  int t = np++;
  if (depth % 2 == 0) {
    sort(P + l, P + r, lessX);
  } else {
    sort(P + l, P + r, lessY);
  }

  T[t].location = mid;
  T[t].l = makeKDTree(l, mid, depth + 1);
  T[t].r = makeKDTree(mid + 1, r, depth + 1);

  return t;
}

void find(int v, int sx, int tx, int sy, int ty, int depth, vector<Point> &ans) {
  int x = P[T[v].location].x;
  int y = P[T[v].location].y;

  if (sx <= x && x <= tx && sy <= y && y <= ty) {
    ans.push_back(P[T[v].location]);
  }

  if (depth % 2 == 0) {
    if (T[v].l != NIL && sx <= x) {
      find(T[v].l, sx, tx, sy, ty, depth + 1, ans);
    }
    if (T[v].r != NIL && x <= tx) {
      find(T[v].r, sx, tx, sy, ty, depth + 1, ans);
    }
  } else {
    if (T[v].l != NIL && sy <= y) {
      find(T[v].l, sx, tx, sy, ty, depth + 1, ans);
    }
    if (T[v].r != NIL && y <= ty) {
      find(T[v].r, sx, tx, sy, ty, depth + 1, ans);
    }
  }
}

int main() {
  int x, y;
  scanf("%d",&N);
  for (int i = 0; i < N; ++i) {
    scanf("%d %d", &x, &y);
    P[i] = Point(i,x,y);
    T[i].l = T[i].r = T[i].p = NIL;
  }

  
  np = 0;
  int root = makeKDTree(0,N,0);

  int q;

  scanf("%d",&q);
  int sx, tx, sy, ty;
  vector<Point> ans;
  for (int i = 0; i < q; ++i) {
    scanf("%d %d %d %d", &sx, &tx, &sy, &ty);
    ans.clear();
    find(root, sx, tx, sy, ty, 0, ans);
    sort(ans.begin(), ans.end());
    for (int j = 0; j < ans.size(); ++j) {
      ans[j].print();
    }
    printf("\n");
  }

  return 0;
}



Measured memory_bytes: 15852
N, M = map(int, input().split())
P = [None]*M
S = [None]*M
for i in range(M):
    P[i], S[i] = input().split()
    P[i] = int(P[i])

AC = [0]*(N+1)
wa = [0]*(N+1)
WA = 0

for i in range(M):
    if S[i] == "WA":
        if AC[P[i]] == 0:
            wa[P[i]] += 1
    else:
        AC[P[i]] = 1

for i in range(N+1):
    WA += wa[i]*AC[i] 

print(sum(AC[1:]), WA)

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

int main(){
    ll sx,sy,tx,ty;
    cin >> sx >> sy >> tx >> ty;
    ll sum = tx-sx+ty-sy;
    sum *= 2;
    sum += (tx+1) - sx + ty - (sy - 1);
    sum += (tx - (sx-1)) + ty + 1 - sy;
    rep(i,tx-sx){
        cout << 'R';
    }
    rep(i,ty-sy){
        cout << 'U';
    }
    rep(i,tx-sx){
        cout << 'L';
    }
    rep(i,ty-sy){
        cout << 'D';
    }
    cout << 'L';
    rep(i,ty+1-sy){
        cout << 'U';
    }
    rep(i,1+tx-sx){
        cout << 'R';
    }
    cout << 'D';
    cout << 'R';
    rep(i,ty-sy+1){
        cout << 'D';
    }
    rep(i,tx-sx+1){
        cout << 'L';
    }
    cout << 'U';
    cout << endl;
    //cout << sum << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//動画解答例写し
int main() {
  long long n,m,k;
  cin>>n>>m>>k;
  vector<int>a(n),b(m);
  for(int i=0;i<n;i++)cin>>a[i];
  for(int i=0;i<m;i++)cin>>b[i];
  long long t=0;
  for(int i=0;i<m;i++)t+=b[i];
  int j=m;                     
  int kotae=0;
  for(int i=0;i<n+1;i++){
    while(j>0&&t>k){
      --j;
      t-=b[j];
    }
    if(t>k)break;
    kotae=max(kotae,i+j);
    if(i==n)break;
    t+=a[i];
  }
  cout<<kotae<<endl;
  return 0;
}

Measured memory_bytes: 4848
#include <bits/stdc++.h>
using namespace std;
long long n,m,u,v,w,q,k,d[100001],used[100001];
vector< pair<int,long long> >ve[100001];
void dfs(int s) {
	used[s] = 1;
	int sz = ve[s].size();
	for (int i = 0;i<sz;i++) {
		u = ve[s][i].first;
		w = ve[s][i].second;
		if (used[u] == false) {
			d[u] = d[s] + w;
			dfs(u);
		}
	}
}
int main(){
  	cin>>n;
  	for (int i = 1;i<n;i++) {
  		cin>>u>>v>>w;
  		ve[u].push_back(make_pair(v,w));
  		ve[v].push_back(make_pair(u,w));
	}
	cin>>q>>k;
	dfs(k);
	while (q--) {
		cin>>u>>w;
		cout<<d[u] + d[w]<<endl;
	}
    return 0;
}

Measured memory_bytes: 15104
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//long a = Long.parseLong(sc.next());
		String t = sc.next();
//		String buff="";
		//long b = Long.parseLong(sc.next());
		//int c = Integer.parseInt(sc.next());
		//int n = Integer.parseInt(sc.next());
		//long res=n;
		//int l = Integer.parseInt(sc.next());
		//int sum=0;
		String s = sc.next();
		//String t = sc.next();
		String w = sc.next();
		//int a = Integer.parseInt(sc.next());
		//String t = sc.next();

		/*if(b-a==c-b) {//a、e、i、o、u
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}*/
		/*for(int i=0;i<t.length();i++) {
			if(t.substring(i,i+1).equals(",")) {
				buff+=" ";
			}else {
				buff+=t.substring(i, i+1);
			}
		}*/
		System.out.println(t.substring(0,1).toUpperCase()+s.substring(0,1).toUpperCase()+w.substring(0,1).toUpperCase());
	}
}




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

const int mod=10000;
int N,K;
int order[100];

int memo[100][4][4];
int calc(int day=0,int prev=0,int cur=0){
    if(day==N)return 1;
    if(~memo[day][prev][cur])return memo[day][prev][cur];

    int ret=0;
    for(int i=1;i<=3;i++){
        if(order[day]&&order[day]!=i)continue;
        if(prev==cur&&cur==i)continue;
        ret=(ret+calc(day+1,cur,i))%mod;
    }
    return memo[day][prev][cur]=ret;
}

int main(){
    cin>>N>>K;
    for(int i=0;i<K;i++){
        int a,b;
        cin>>a>>b;
        order[--a]=b;
    }

    memset(memo,-1,sizeof(memo));
    cout<<calc()<<endl;
    return 0;
}

Measured memory_bytes: 1168
#include <bits/stdc++.h>
using namespace std;
int min(int a, int b, int c)
{
	if(a<=b && a<=c)
		return a;
	else if(b<=a && b<=c)
		return b;
	else
		return c;
}
int max(int a, int b, int c)
{
	if(a>=b && a>=c)
		return a;
	else if(b>=a && b>=c)
		return b;
	else
		return c;
}
int main()
{
	int n;
	cin>>n;
	int a[n];
	int i; 
	for(i=0;i<n;i++)
	{
		cin>>a[i];
	}
	i=0;
	int c = 0;
	while(i<n-2)
	{
		int n1 = a[i], n2 = a[i+1], n3 = a[i+2];
		if((n2<n1 && n2>n3) || (n2>n1 && n2<n3))
			c++;
		i++;
	}
	cout<<c<<endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int X;
    cin>>X;

    switch (X%7)
    {
    case 0/* constant-expression */:
        cout<<"thu"<<endl;
        break;
    
    case 1:
        cout<<"fri"<<endl;
        break;
    case 2:
        cout<<"sat"<<endl;
        break;
    case 3:
        cout<<"sun"<<endl;
        break;
    case 4:
        cout<<"mon"<<endl;
        break;
    case 5:
        cout<<"tue"<<endl;
        break;
    case 6:
        cout<<"wed"<<endl;
        break;
    }
    return  0;
}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
template<class S, class T> inline S max_L(S a,T b){
  return a>=b?a:b;
}
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int main(){
  int T, X, res;
  rd(X);
  rd(T);
  res =max_L(0, X-T);
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190721-1

// --- original code ---
// {
//   int X, T, res;
//   rd(X, T);
//   res = max(0, X-T);
//   wt(res);
// }


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

typedef long long ll;
ll n;

int main() {
    scanf("%lld", &n), n++;
    deque<ll> V;
    function<void(ll)> solve = [&](ll n) {
        if (n == 1) return;
        if (n & 1) solve(n - 1), V.push_front(V.size() + 1);
        else solve(n >> 1), V.push_back(V.size() + 1);
    };
    solve(n);
    for (int i = 1, j = V.size(); i <= j; i++) V.push_back(i);
    printf("%d\n", V.size());
    for (ll x : V) printf("%lld ", x);
    return 0;
}

Measured memory_bytes: 3784
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

void solve() {
    int h,w;
    cin >> h >> w;
    int a,b;
    set<PII> s;
    multiset<int> m;
    REP(i,0,w) s.emplace(i,i);
    REP(i,0,w) m.insert(0);
    s.emplace(1<<30,1<<30);
    m.insert(1<<30);
    REP(i,0,h) {
        cin >> a >> b;
        --a;
        --b;
        auto it = s.lower_bound(MP(a,0));
        int lv = -1;
        while (it != s.end() && it->first <= b) {
            chmax(lv, it->second);
            int diff = it->first - it->second;
            m.erase(m.lower_bound(diff));
            it = s.erase(it);
        }

        if (lv > -1 && b + 1 < w && s.lower_bound(MP(b+1,0))->first != b+1) {
            s.emplace(b+1,lv);
            m.insert(b+1-lv);
        }

        if ((*m.begin()) == 1<<30) cout << -1 << endl;
        else cout << (*m.begin()) + i + 1 << endl;
    }
}

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

Measured memory_bytes: 22332
#if 0

#endif

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

int F[100];

int main() {
  F[0] = 1; F[1] = 1;
  for (int i = 2; i < 45; i++) {
    F[i] = F[i-1] + F[i-2];
  }
  int n; cin >> n;
  cout << F[n] << endl;
}



Measured memory_bytes: 3096
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int h,a,ans;
    cin>>h>>a;
    ans=h/a;
    if(h%a==0){

    }else{ans++;}
    cout<<ans<<endl;
    return 0;


}



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

int dp[2005];
const int mod = 1e9 + 7;
int32_t main() {
 int s;
 cin >> s;

 dp[3] = 1;
 for (int i = 4; i <= s; i++) {
    dp[i] = (dp[i - 1] + dp[i - 3]) % mod;
 }
 cout << dp[s];
 return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
int main()
{
  ll n,d;
  cin>>n>>d;
  ll cnt=0;
  for(int q=1;q<=n;q++)
  {
    ll x,y;
    cin>>x>>y;
    if((x*x+y*y)<=(d*d))
    cnt++;
  }
  cout<<cnt;
  return 0;
}

Measured memory_bytes: 3596
#include <algorithm>
#include <cassert>
#include <iostream>
#include <queue>
#include <utility>
#include <vector>
#include <tuple>

using namespace std;


typedef pair<int, int> Location;
typedef queue<Location> LocationQueue;

#define N 1000
char field[N][N];
int levels[N][N] = {0};
bool visited[N][N] = {false};

inline int solve(int h, int w, LocationQueue &que) {
  /*
  cout << h << " " <<  w << " " << endl;
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      cout << field[i][j];
    }
    cout << endl;
  }
  */
  Location loc;
  Location nloc;
  int i0, j0, i, j, level;
  int max_level = 0;
  const int dx[4] = {-1, 1, 0, 0};
  const int dy[4] = { 0, 0, 1,-1};

  while(que.size()){
    loc = que.front(); que.pop();
    i0 = loc.first; j0 = loc.second;
    level = levels[i0][j0];

    for(int n = 0; n < 4; n++){
        i = i0 + dx[n];
        j = j0 + dy[n];

        if (i >= 0 && i <= h - 1 && j >= 0 && j <= w -1 &&
            !visited[i][j]
            && (field[i][j] == '.'))
        {
          nloc = make_pair(i,j);
          field[i][j] = '#';
          visited[i][j] = true;
          que.push(make_pair(i,j));
          levels[i][j] = level + 1;
          max_level = max(max_level, level+1);
        }
    }
  }

  return max_level;
}

int main(int argc, char const *argv[]) {
  int h, w;
  char c;
  LocationQueue que;

  cin >> h;
  cin >> w;

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin >> c;
      field[i][j] = c;
      if (c == '#') {
        que.push(make_pair(i, j));
        visited[i][j] = true;
      }
    }
  }

  cout << solve(h, w, que);

  return 0;
}


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

int change(ll n){
    if(n%10==0){
        return n;
    }else{
        ll i=n/10;
        return (i+1)*10;
    }
}

int main(){
    ll a[5];
    ll ans=0;
    ll k=10;
    for(int i=0;i<5;i++){
        cin>>a[i];
        ans+=change(a[i]);
        if(a[i]%10!=0){
            k=min(a[i]%10,k);
        }
    }
    cout<<ans-(10-k)<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define ll long long
#define ld long double
#define mod ((ll)1e9+7)
#define inf ((ll)1e18+5)
#define maxx ((ll)1e6+5)
#define pb push_back
#define endl "\n"
#define time(i) cout<<"\nTime Elapsed "<<i<<" : " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
#define usefile freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test ll t; cin>>t; while(t--)
ll exp(ll x,ll y,ll p){ ll res=1; while(y) {if(y%2) res=(res*x%p)%p; x=(x*x)%p; y/=2; } return res;}
ll expm(ll x,ll y){ ll res=1; while(y) {if(y%2) res=(res*x%mod)%mod; x=(x*x)%mod; y/=2; } return res;}
/*
bool sv[maxx]={0};    // returns 0 if a num is prime
int sp[maxx]={0};     // gives smallest prime factor of the number
void Sieve() {for(int i= 2; i< maxx; i+= 2) sv[i]=1,sp[i] = 2;sv[2]=0;for(ll i = 3; i < maxx; i += 2){if (!sv[i]){sp[i] = i;for (ll j = i; (j*i) < maxx; j += 2){if (!sv[j*i])sv[j*i] = true, sp[j*i] = i;}}}}
ll fact[1000007]={0}; // returns factorial of that number
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(expm(fact[r],mod-2)))%mod; res=(res*(expm(fact[n-r],mod-2)))%mod; return res;}
*/
using namespace std;
signed main(){
  fast;
 // usefile;
  //test
  {
    int n;
    cin>>n;
    map<string,int> m;
    for (int i = 0; i < n; i++)
    {
        string temp;
        cin>>temp;
        m[temp]++;
    }
    int ma=0;
    for(auto i: m){
        ma=max(ma,i.second);
    }
    vector<string> v;
    for (auto i : m)
    {
        if(i.second==ma)
            v.push_back(i.first);
    }
    sort(v.begin(),v.end());
    for (auto &&i : v)
    {
        cout<<i<<endl;
    }
    
    
  }
  //time("");
  return 0;
}

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

int main()
{
    string a;

    cin >> a;

    int ans = 0;
    if (a == "RRR")
    {
        ans = 3;
    }
    else if (a == "RRS" || a == "SRR")
    {
        ans = 2;
    }
    else if (a == "RSS" || a == "SRS" || a == "SSR" || a == "RSR")
    {
        ans = 1;
    }
    else if (a == "SSS")
    {
        ans = 0;
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 3592
using System;
using System.Collections.Generic;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("11");
            //Yes
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("40");
            //Yes
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("3");
            //No
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int N = int.Parse(InputList[0]);

        bool IsOK = false;
        for (int I = 0; I <= N; I+=4) {
            for (int J = 0; J  <= N; J+=7) {
                if (I + J == N) {
                    IsOK = true;
                }
            }
        }
        Console.WriteLine(IsOK ? "Yes" : "No");
    }
}


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

void func(long,long,long,long*,long*,long*);
int main(){

	int a,
	    b;
	char suuti[3][20],
	     c,
	     *pointer;
	long l[3],
	     x,
	     y,
	     z;

	for(a = 0;a < 3 ;a++ ){

		for(b = 0; b < 19 && (c = getchar()) != ' ' && c != '\n';b++){
			suuti[a][b] = c;
		}suuti[a][b] = 0; 
		
	l[a] = strtol(suuti[a],&pointer,10);

	if(*pointer != '\0'){
		printf("%s",pointer);			
		exit(0);
	}
	}suuti[a][b] = 0;

	func(l[0],l[1],l[2],&x,&y,&z);
	printf("%ld %ld %ld\n",x,y,z);

	return 0;
		

}


void func(long a,long b,long c,long *x,long *y,long *z){ //??????????????????
	int count,
	    count1;
	long l[3] = {a,b,c},
	     temp;
	
	for(count1 = 0;count1 < 2;count1++){	

		for(count = 2;count > count1 ;count--){

			if(l[count-1] > l[count] ){
				temp = l[count];
				l[count] = l[count-1];
				l[count-1] = temp;
			}
		}
	}
	*x = l[0];
	*y = l[1];
	*z = l[2];
}

Measured memory_bytes: 524
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;
const ld PI = 3.14159265358979323846;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//







int main(void) {

    ll N, M; cin >> N >> M;
    string a[N]; rep(i,N) cin >> a[i];
    string b[M]; rep(i,M) cin >> b[i];
    bool is_OK = false;
    rep(s_x,N - M + 1) {
        rep(s_y,N - M + 1) {
            bool flag = true;
            rep(i,M) {
                rep(j,M) {
                    if (a[s_x + i][s_y + j] != b[i][j]) {
                        flag = false;
                    }
                }
            }
            if (flag) {
                is_OK = true;
            }
        }
    }
    if (is_OK) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }

    
    return 0;
}











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

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i ,a, b) for (int i = a ; i <= b ; i++)
#define sz(a) int(a.size())
#define cuti(a) cout << a << endl;
#define cutii(a,b) cout << a << " " << b << endl;
#define cutiii(a,b,c) cout << a << " " << b << " " << c << endl;
#define vec(a) vector<int > a;

template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }

typedef pair<int ,int > pii;
typedef long long LL;
const long long oo = 1e9 + 7;

int n,k;
int ans;

int main() {
//    freopen("test.txt","r",stdin);
    cin >> n >> k;
    for (int i = 1; i <= n ; i++) {
        int x;
        cin >> x;
        ans += min(2 *abs(k-x),2*x);
    }
    cout << ans;
}


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

int main()
{
	int n;
    cin>>n;
    string s;
    cin>>s;
    int count=0;
    for(int i=0;i<n-2;i++)
    {
        if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')
        {
            count++;
        }
    }
    
    cout<<count<<endl;
	return 0;
}

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

void counting_sort(vector<int> &as, int n, int k)
{
  vector<int> bs = vector<int>(n+1);
  vector<int> cs = vector<int>(k+1, 0);

  for (int i = 1; i <= n; i++)
    cs[as[i]]++;

  for (int i = 1; i <= k; i++)
    cs[i] += cs[i-1];

  for (int i = n; i >= 1; i--) {
    bs[cs[as[i]]] = as[i];
    cs[as[i]]--;
  }

  for (int i = 1; i <= n; i++)
    cout << bs[i] << (i==n?'\n':' ');
}


int main()
{
  int n; cin >> n;
  vector<int> as = vector<int>(n+1);
  int k = 0;
  for (int i = 1; i <= n; i++) {
    cin >> as[i];
    k = max(k, as[i]);
  }
  counting_sort(as, n, k);

  return EXIT_SUCCESS;
}



Measured memory_bytes: 18320
#include<iostream>
#include<algorithm>
#include<string>

using namespace std;
typedef long long ll;

int main() {
	while (1) {
		int H = 0, W = 0;
		bool table[9][9] = {};
		string S;
		int a, b, c, d;
		cin >> S;
		if (S == "#")break;
		cin >> a >> b >> c >> d;
		a--, b--, c--, d--;
		
		//create map
		int x = 0, y = 0;
		for (int i = 0; i < S.size(); i++) {
			if (S[i] == 'b') {
				table[x][y] = true;
				y++;
			}
			else if(S[i] >= '1' && S[i] <= '9'){
				y += S[i] - '0';
			}
			else {
				if (W == 0)W = y;
				x++;
				y = 0;
			}
		}
		H = x + 1;
		//move
		table[a][b] = false;
		table[c][d] = true;

		//create jfen
		int conti = 0;
		string ans;

		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				if (table[i][j]) {
					if (conti != 0)ans += conti + '0';
					conti = 0;
					ans += 'b';
				}
				else {
					conti++;
				}
			}
			if (conti != 0) ans += '0' + conti;
			conti = 0;
			if(i != H - 1)ans += '/';
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 3156
#include <stdio.h>
 
int main(void){
	
	int a,b,c;
	
	scanf("%d %d %d",&a,&b,&c);
	
	if(a * b > c){
	printf("%d\n",c);
	} else {
	printf("%d\n",a * b);
	}
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define N 100010
#define ll long long
#define mod (1000000000+7)
#define Fast ios_base::sync_with_stdio(false); cin.tie(NULL);

using namespace std;

int main()
{
    Fast
    int n; cin>>n;
    int a[n] , T[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    T[0] = 0; T[1] = abs(a[0] - a[1]);
    for(int i=2;i<n;i++)
    {
        int x = a[i]; int y = a[i-1]; int z = a[i-2];
        int a = T[i-1] + abs(x - y);
        int b = T[i-2] + abs(x - z);
        T[i] = min(a , b);
    }
    /*for(int i=0;i<n;i++)
        cout<<T[i]<<" ";
    cout<<endl;*/
    cout<<T[n-1]<<endl;
}


Measured memory_bytes: 4436
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <cmath>
#include <tuple>
#include <bitset>
#include <utility>
#include <climits>
#include <iomanip>

#define push emplace_back
#define each(i, x) for (auto i=0; i < x; i++)
using ull = unsigned long long;
constexpr auto mod = 1000000007;
constexpr auto INF = ULLONG_MAX;

using namespace std;
template <typename T> inline void dump(const T& x) { cout << "[" << x << "]" << endl; }
template <typename T> inline void dump(const vector<T>& x) { for (const auto v : x) { cout << v << " "; } cout << endl; }
template <typename T> inline void sort_asc(vector<T>& x) { std::sort(x.begin(), x.end()); }
template <typename T> inline void sort_desc(vector<T>& x) { std::sort(x.begin(), x.end(), greater<T>()); }
template <typename T> inline T max_value(vector<T>& x) { return *max_element(x.begin(), x.end()); }
template <typename T> inline T min_value(vector<T>& x) { return *min_element(x.begin(), x.end()); }
template <typename T> inline T sum_value(vector<T>& x) { return accumulate(x.begin(), x.end(), 0ULL); }

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

  vector<ull> h;
  each(i, n) {
    ull tmp;
    cin >> tmp;
    h.push(tmp);
  }

  vector<vector<ull>> heights;
  vector<ull> hhh = {};
  each(i, n) {
    if (i == 0) {
      hhh.push(h[i]);
      continue;
    }

    if (h[i] > hhh[hhh.size() - 1]) {
      heights.push_back(hhh);
      hhh = {h[i]};
    } else {
      hhh.push(h[i]);
    }
  }
  heights.push_back(hhh);

  ull maxv = 0;
  each(i, heights.size()) {
    const ull s = heights[i].size();
    maxv = std::max({maxv, s});
  }

  cout << maxv - 1 << endl;

  return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
const ll INF = (1ll << 60);

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


Measured memory_bytes: 3328
#include <iostream>
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#include <algorithm>
#include <bits/stdc++.h>
#define MOD 1000000000
#define ll long long
#define mm(arr) memset(arr, 1, sizeof(arr))
#define scanArray(a,n) for(ll i = 0; i < n; i++){cin >> a[i];}
#define PI 3.141592653589793
using namespace std;
int main(){
    FAST
    double n; cin >> n;
        cout << 2*PI*n << endl;


    return 0;
}


Measured memory_bytes: 3792
s = int(input())
a = []
a.append(s)

def f1(n):
    if n%2 == 0:
        return int(n/2)
    else:
        return int(3*n+1)

while True:
    s = f1(s)
    if s in a:
        print(len(a)+1)
        break
    else:
        a.append(s)


Measured memory_bytes: 2940
#include <stdio.h>
int main(void){
    int n , k , m , r ;
    int a , b ;
    int i , j ;
    int result[10050] ; 
    scanf("%d %d %d %d" , &n , &k , &m , &r) ;
    while(n && k && r){
        for(i = 0 ; i<10050 ; i++){
            result[i] = 0 ;
        }
        if(m == 0){
            b = 1 ;
            for(i = 0 ; i < r ; i++){
                result[i] = (b * 10) / n ;
                b = (b * 10) % n ;
            }
        }
        else{
            b = 1 ;
            for(i = 0 ; i < 10050 ; i++){
                b *= 10 ;
                result[i] = b / n ;
                b = b % n ;
            }
            for(i = 1 ; i < n ; i++){
                    b = 1 ;
                    a = i * n ;
                    for(j = 0 ; j < 10050 ; j ++){
                        b *= 10 ;
                        result[j] += b / a ;
                        b = b % a ;
                    }
            }
            for(i = 10049 ; i >= 0 ; i--){
                if(result[i] > 9){
                    result[i - 1] += result[i] / 10 ;
                    result[i] %= 10 ;
                }
            }
                
        }
        if(m == 1 && n ==2){
            printf("1.") ;
            for(i = 0 ; i < r ; i++){
                printf("0") ;
            }
        }
        else{
            printf("0.") ;
            for(i = 0 ; i < r ; i++){
                printf("%d" , result[i]);
            }
        }
        printf("\n") ;
        scanf("%d %d %d %d" , &n , &k , &m , &r);
    }
    return 0;
}


Measured memory_bytes: 1984
using System;
using System.Collections.Generic;
using System.Linq;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            Console.WriteLine(a[0] * a[1] - a[0] - a[1] + 1);
        }
    }
}



Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long a,b,x;
    cin>>a>>b>>x;
    if(a%x!=0){a=a-a%x+x;}
    if(b%x!=0){b=b-b%x;}
    cout<<(b-a)/x+1<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl

int main() {
  int n, k;
  string s;
  cin >> n >> k >> s;

  vector<int> acc;
  int bt = 1;
  int cnt = 0;
  rep(i, n) {
    if(s[i] != (char)(bt + '0')) {
      acc.push_back(cnt);
      bt ^= 1;
      cnt = 1;
    } else {
      cnt++;
    }
  }
  if(cnt != 0) acc.push_back(cnt);
  if(!bt) acc.push_back(0);

  int m = (int)acc.size();
  int d = 2 * k + 1;
  int ans = 0;

  int left = 0;
  int right = 0;
  int tmp = 0;

  for(int i = 0; i < m; i += 2) {
    int nextleft = i;
    int nextright = min(i + d, m);
    while(nextleft > left) {
      tmp -= acc[left];
      left++;
    }
    while(nextright > right) {
      tmp += acc[right];
      right++;
    }
    ans = max(ans, tmp);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1020
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cassert>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// head

const int N=20100;
int n,a[N],p[N];
int main() {
	scanf("%d",&n);
	rep(i,1,n+1) {
		scanf("%d",a+i),p[a[i]]=i;
	}
	rep(i,1,n+1) printf("%d ",i*30000+p[i]); puts("");
	rep(i,1,n+1) printf("%d ",(n+1-i)*30000+p[i]); puts("");
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,bool> pib;

vector<pib> li[100005];
int n,s,e=1;
int q[100005];
bool col[100005];
bool visit[100005];

int main(){
    cin>>n;
    for(int u,v,w,i=1; i<n; ++i){
        cin>>u>>v>>w;
        li[u].emplace_back(v,w&1);
        li[v].emplace_back(u,w&1);
    }
    q[0]=1;
    visit[1]=1;
    while(s<e){
        int top=q[s++];
        for(pib nxt: li[top]){
            if(visit[nxt.first]) continue;
            visit[nxt.first]=1;
            col[nxt.first]=col[top]^nxt.second;
            q[e++]=nxt.first;
        }
    }
    for(int i=1; i<=n; ++i){
        printf("%d\n",col[i]);
    }
    return 0;
}


Measured memory_bytes: 7040
#include<bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(register int i = (a), i##_end_ = (b); i <= i##_end_ ; ++i)
#define drep(i, a, b) for(register int i = (a), i##_end_ = (b); i >= i##_end_ ; --i)
#define clear(a, b) memset((a), (b), sizeof(a))
typedef long long LL;
int read() {
	int x = 0, flag = 1;
	char ch = getchar();
	while(!isdigit(ch)) {
		if(ch == '-') flag = -1;
		ch = getchar();
	}
	while(isdigit(ch)) {
		x = (x << 3) + (x << 1) + (ch - 0x30);
		ch = getchar();
	}
	return flag * x;
}
 
#define Maxn 109
char a[Maxn], b[Maxn];
int n;
int main() {
#ifdef Qrsikno
	freopen("f.in","r",stdin);
	freopen("f.out","w",stdout);
#endif
	n = read();
	scanf("%s", (a + 1)), scanf("%s", (b + 1));
	int flag = 0;
	rep(i, 1, n)
		if(a[i] != b[i]) flag = 1;
	if(!flag) {
		printf("%d\n", n);
		return 0;
	}
	int LCPS = 0;
	rep(i, 1, n) {
		flag = 0;
		rep(j, i, n)
			if(a[j] != b[j - i + 1]) {
				flag = 1;
				break;
			}
		if(!flag) LCPS = n - i + 1;
	}
	printf("%d\n", n * 2 - LCPS);
	return 0;
}

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

#define llong long long 
#define len(x) ((int)x.size())
#define rep(i,n) for (int i = -1; ++ i < n; )
#define rep1(i,n) for (int i = 0; i ++ < n; )
#define rand __rand
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());  // or mt19937_64
template<class T = int> T rand(T range = numeric_limits<T>::max()) { return (T)(rng() % range); }

#define CONCAT_(x, y) x##y/*{{{*/
#define CONCAT(x, y) CONCAT_(x, y)
#ifdef LOCAL_DEBUG   
int __db_level = 0;
bool __db_same_line = false;
#define clog cerr << string(!__db_same_line ? __db_level * 2 : 0, ' ')
struct debug_block {
    function<void()> fn;
    void print_name() { __db_same_line = true; fn(); clog << endl; __db_same_line = false;  }
    debug_block(function<void()> fn_): fn(fn_) { clog << "{ "; print_name(); ++__db_level; }
    ~debug_block() { --__db_level; clog << "} "; print_name(); }
};
#define DB(args...) debug_block CONCAT(dbbl, __LINE__)([=]{ clog << args; })
#define deb(...)  if (1) { (clog << "[" #__VA_ARGS__ "] = [" << __VA_ARGS__) << "]"; if (!__db_same_line) clog << endl; }
#else
#define clog if (0) cerr
#define DB(...)
#define deb(...)
#endif
template<class T>
ostream& operator,(ostream& out, const T& thing) { return out << ", " << thing; }
template<class U, class V>
ostream& operator<<(ostream& out, const pair<U, V>& p) { return (out << "(" << p.first, p.second) << ")"; }
template<class A, class B>
ostream& operator<<(ostream& out, const tuple<A, B>& t) { return (out << "(" << get<0>(t), get<1>(t)) << ")"; }
template<class A, class B, class C>
ostream& operator<<(ostream& out, const tuple<A, B, C>& t) { return (out << "(" << get<0>(t), get<1>(t), get<2>(t)) << ")"; }
template<class T> ostream& operator<<(ostream& out, const vector<T>& container) { 
    out << "{";
    if (len(container)) out << container[0];
    rep1(i, len(container) - 1) out, container[i];
    return out << "}";
}
template<class x> vector<typename x::value_type> $v(const x& a) { return vector<typename x::value_type>(a.begin(), a.end()); }
#define ptrtype(x) typename iterator_traits<x>::value_type
template<class u> vector<ptrtype(u)> $v(u a, u b) { return vector<ptrtype(u)>(a, b); }/*}}}*/
// ACTUAL SOLUTION BELOW ////////////////////////////////////////////////////////////

bool solve() {
    int a, b, c, k; cin >> a >> b >> c >> k;
    while (b <= a) {
        b *= 2;
        --k;
    }
    
    while (c <= b) {
        c *= 2;
        --k;
    }
    return k >= 0;
}

int main(void) {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    if (solve()) cout << "Yes";
    else cout << "No";

    return 0;
}

// Remember:
// - Multitest? REFRESHING the data!!!
// - Constrains for each set of data may differs. Should NOT USE the same max constant (maxn)
//   for all of them.
// vim: foldmethod=marker


Measured memory_bytes: 3652
#include <cstdio>
#include <map>
using namespace std;

int N, A[200200];
long long R;

void go(int s, int e)
{
	if (e - s < 10){
		for (int i = s; i < e; i++){
			for (int j = i + 1; j < e; j++) if (A[i] + A[j] == j - i) R++;
		}
		return;
	}

	int m = (s + e) / 2;
	go(s, m);
	go(m, e);

	map<int, pair<int, int> > chk;
	for (int i = s; i < m; i++) chk[A[i] + i].first++;
	for (int j = m; j < e; j++) chk[j - A[j]].second++;
	for (auto &p : chk) R += 1ll * p.second.first * p.second.second;
}

int main()
{
	scanf ("%d", &N);
	for (int i = 0; i < N; i++) scanf ("%d", &A[i]);
	go(0, N);

	printf ("%lld\n", R);

	return 0;
}

Measured memory_bytes: 15496
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
typedef pair<ll, ll> Pair;
template <class T> T input() {T t; cin>>t; return t;}
#define FOR(i,a,b) for (ll i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (ll i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,x) for (ll i = 0; i < x.size(); i++)
#define RREPALL(i,x) for (ll i = x.size()-1; i >= 0; i--)
#define REPITR(itr,x) for (auto itr = (x).begin(); itr != (x).end(); itr++)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x,num) count(ALL(x), num)
#define MEMSET(x,val) memset(x, val, sizeof(x))
#define CHMAX(a,b) a = max(a,b)
#define CHMIN(a,b) a = min(a,b)
#define FIND(x,key) x.find(key) != x.end()
#define IN_RANGE_V2(v,k,x,y) (0<=x+dx[k]&&x+dx[k]<v[y].size()&&0<=y+dy[k]&&y+dy[k]<v.size())
#define debug(x) cerr<<__LINE__<<": "<<(#x)<<" = "<<(x)<<endl;
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
#define PRINT_ARRAY_H(a) REPALL(__i,a) {cout<<a[__i]<<(__i != a.size()-1 ? " " : "");} newline;
#define PRINT_ARRAY_V(a) REPALL(__i,a) {cout<<a[__i]<<endl;}
#define e1 first
#define e2 second
#define newline putchar('\n')
#define cspace ' '
#define sspace " "
const int INF = 1e7;
const ll MOD = 1e9 + 7;
const double pi = 3.141592653589793;
const VI dx = {1, 0, -1, 0};
const VI dy = {0, 1, 0, -1};
//const VI dx = {1, 1, 0, -1, -1, -1, 0, 1};
//const VI dy = {0, 1, 1, 1, 0, -1, -1, -1};

void solve()
{
    ll a, b, c, d, n, m, l, r, k, x, y, z, ans = 0ll;
    string s, t;
    cin>>n;
    cout<<8-(n-400)/200<<endl;
}

int main()
{
    cout<<fixed<<setprecision(20);
    int __t = 1;
    //cin>>__t;
    REP(i,__t) {
        solve();
    }
    return 0;
}

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

int main() {
    int N; cin >> N;
    long long x; cin >> x;
    vector<long long> a(N);
    for (int i = 0; i < N; ++i) cin >> a[i];
    sort(a.begin(), a.end());
    int res = 0;
    for (int i = 0; i < N; ++i) {
        if (x >= a[i]) ++res, x -= a[i];
        else break;
    }
    if (res == N && x) --res;//答えが N になる場合というのは、x がちょうどぴったりaiの総和になっている場合のみにかぎられることに注意。
    cout << res << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 9223372036854775807LL
#define inf 1000000007
#define SYOU(x) setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))
#define lol long long
#define mp make_pair
#define fi first
#define se second
using namespace std;
lol a,b,x,y;
lol i[101];
lol sum[1000001];
lol dp(lol n){
    if(n<3) return 0;
    if(n==3) return 1;
    if(sum[n]!=0) return sum[n];
    return sum[n]=(dp(n-1)+dp(n-2)+dp(n-3))%inf;
}
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    lol c,d=0,e=0,f=0,g=1,h=0;
    cin >>a;
    if(a<100){
	cout <<min(a,9LL)<<'\n';
	return 0;
    }
    if(a<10000){
	if(a>=1000) cout <<9+900<<'\n';
	else cout <<9+a-99<<'\n';
	return 0;
    }
    cout <<909+min(a,99999LL)-9999<<'\n';
    return (0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int maxn = 5e5 + 5;
ll n, m, inv[maxn], fac[maxn], ans;
ll qpow(ll a, ll b) {
	ll ans = 1, base = a;
	while (b) {
		if (b & 1) ans = ans * base % MOD;
		b >>= 1, base = base * base % MOD;
	}
	return ans;
}
void init() {
	fac[0] = 1;
	for (int i = 1; i <= m; i++) fac[i] = fac[i - 1] * i % MOD;
	for (int i = 0; i <= m; i++) inv[i] = qpow(fac[i], MOD - 2);
}
ll A(ll a, ll b) {
	return fac[a] * inv[a - b] % MOD;
}
ll C(ll a, ll b) {
	return fac[a] * inv[b] % MOD * inv[a - b] % MOD;
}
int main() {
	cin >> n >> m;
	init();
	ans = qpow(A(m, n),2);
	for (ll s = 1; s <= n; s++) {
		ans -= (s & 1 ? 1 : -1) * C(n, s) * A(m, s) % MOD * qpow(A(m - s, n - s),2);
		ans%=MOD;
	}
	cout<<(ans+MOD)%MOD;
	return 0;
}

Measured memory_bytes: 11436
# -*- coding: utf-8 -*-

H,W,K = map(int, input().split())
x1,y1,x2,y2 = map(int, input().split())

C = [input() for _ in range(H)]
T = [[-1 for _ in range(W)] for _ in range(H)]
T[x1-1][y1-1] = 0

que = {(x1-1,y1-1):0}
step = 1

while len(que)>0:
  que_next = {}
  for q in que.keys():
    x,y = q[0],q[1]
    for i in range(1,K+1):
      if x-i<0:
        break
      if C[x-i][y]=='@' or T[x-i][y]==1:
        break
      if x-i==x2-1 and y==y2-1:
        print(step)
        exit()
      que_next[(x-i,y)] = 0
    for i in range(1,K+1):
      if x+i>H-1:
        break
      if C[x+i][y]=='@' or T[x+i][y]==1:
        break
      if x+i==x2-1 and y==y2-1:
        print(step)
        exit()
      que_next[(x+i,y)] = 0
    for i in range(1,K+1):
      if y-i<0:
        break
      if C[x][y-i]=='@' or T[x][y-i]==1:
        break
      if x==x2-1 and y-i==y2-1:
        print(step)
        exit()
      que_next[(x,y-i)] = 0
    for i in range(1,K+1):
      if y+i>W-1:
        break
      if C[x][y+i]=='@' or T[x][y+i]==1:
        break
      if x==x2-1 and y+i==y2-1:
        print(step)
        exit()
      que_next[(x,y+i)] = 0
  que = que_next
  for q in que.keys():
    T[q[0]][q[1]] = 1
  step += 1

print(-1)


Measured memory_bytes: 39396