akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdint>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

struct mint {
  int64_t v_;
  static int64_t Prime;
  mint(int64_t x=0) : v_(x) { normalize(); }
  void normalize() { ((v_ %= Prime) += Prime) %= Prime; }
  mint operator+=(mint const& r){ (v_ += r.v_) %= Prime; return *this; }
  mint operator-=(mint const& r){ (v_ += Prime - r.v_) %= Prime; return *this; }
  mint operator*=(mint const& r){ (v_ *= r.v_) %= Prime; return *this; }
  mint operator+(mint const& r) const { mint res(*this); return res += r; }
  mint operator-(mint const& r) const { mint res(*this); return res -= r; }
  mint operator*(mint const& r) const { mint res(*this); return res *= r; }
  mint pow(int x) const {
    int64_t res = 1, v = v_;
    while(x > 0) {
      if(x&1) (res *= v) %= Prime;
      x/=2; (v *= v) %= Prime;
    }
    return mint(res);
  }
  //mint inv() const { return pow(Prime-2); } not usable
};
int64_t mint::Prime;

template<typename T>
struct affine { //(x, y)|-> (ax+by+e, cx+dy+f)
  T a,b,c,d,e,f;
  affine(): a(T(1)),b(T(0)),c(T(0)),d(T(1)),e(T(0)),f(T(0)) {}
  affine(T const& in_a, T const& in_b, T const& in_c, T const& in_d,
         T const& in_e=0, T const& in_f=0): a(in_a), b(in_b), c(in_c), d(in_d),
    e(in_e), f(in_f) {}
  // (x,y) -> A(*this(x,y)) 
  affine operator*=(affine const& A) {
    T na = A.a*a + A.b*c, nb = A.a*b + A.b*d, ne = A.a*e + A.b*f + A.e;
    T nc = A.c*a + A.d*c, nd = A.c*b + A.d*d, nf = A.c*e + A.d*f + A.f;
    a = na; b = nb; e = ne;
    c = nc; d = nd; f = nf;
    return *this;
  }
  affine operator*(affine const& A) const { affine r(*this); return r *= A; }
  affine pow(int64_t x) {
    affine res, v(*this);
    while(x > 0) {
      if(x&1) res *= v;
      x/=2; v *= v;
    }
    return res;
  }
  void apply(T& x, T& y) const {
    T nx = a*x + b*y + e; 
    y = c*x + d*y + f;
    x = nx;
  }
};

int64_t ceil_div(int64_t x, int64_t y) { // x, y > 0
  return (x+y-1)/y;
}

int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  int64_t L, A, B, M; std::cin >> L >> A >> B >> M;
  mint::Prime = M; 
  
  std::vector<int64_t> l(20, 0);
  int64_t b = 0, e = 19;
  for(int64_t d = 1, k = 1; d < 19; ++d, k *= 10) {
    if(A >= k) b = d;
    else {
      l[d] = ceil_div(k-A, B);
      if(l[d] >= L) { e = d; break; }
    }
  }
  l[e] = L;

  mint x, s(A);
  for(int d = b; d < e; ++d) {
    affine<mint> f(mint(10).pow(d), 1, 0, 1, 0, B);
    f.pow(l[d+1] - l[d]).apply(x, s);
  }
  fin(x.v_);
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.math.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int H = Integer.parseInt(sc.next());
    int W = Integer.parseInt(sc.next());
    sc.nextLine();
    int[][] map = new int[H+2][W+2];
    for(int i=1;i<=H;i++){
      String str = sc.nextLine();
      for(int j=1;j<=W;j++){
        map[i][j] = str.charAt(j-1)=='#'?0:1;
      }
    }
    int ans = 0;
    int[] nexts = new int[]{0,1,0,-1,0};
    for(int i=1;i<=H;i++){
      for(int j=1;j<=W;j++){
        if(map[i][j] == 1){
          int[][] costs = new int[H+2][W+2];
          PriorityQueue<Point> pq = new PriorityQueue<Point>((a,b)->{
            return a.c-b.c;
          });
          pq.add(new Point(i,j,1));
          costs[i][j] = 1;
          while(!pq.isEmpty()){
            Point now = pq.poll();
            for(int n=0;n<4;n++){
              int nexth = now.h+nexts[n];
              int nextw = now.w+nexts[n+1];
              if(map[nexth][nextw] == 1){
                if(costs[nexth][nextw] == 0 || costs[nexth][nextw] > now.c+1){
                  costs[nexth][nextw] = now.c+1;
                  pq.add(new Point(nexth, nextw, now.c+1));
                  ans = Math.max(ans, now.c+1);
                }
              }
            }
          }
        }
      }
    }
    System.out.println(ans-1);
  }

  static class Point{
    public int h,w,c;
    Point(int h, int w, int c){
      this.h = h;
      this.w = w;
      this.c = c;
    }
  }

}


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

const double EPS = 1e-10;
const ll INF = 100000000;
const ll MOD = 1000000007;

ll x, y;

int main() {
    cin >> x >> y;
    if (abs(x-y) <= 1) puts("Brown");
    else puts("Alice");
}



Measured memory_bytes: 256
// C++ implementation of disjoint set 
#include <iostream> 
using namespace std; 
class DisjSet { 
	int *size, *parent, n; 

public: 
	DisjSet(int n) 
	{ 
		size = new int[n+1]; 
		parent = new int[n+1]; 
		this->n = n; 
		makeSet(); 
	} 
	void makeSet() 
	{ 
		for (int i = 1; i <=n; i++) { 
			parent[i] = i; 
			size[i]=1;
		} 
	} 
	int find(int x) 
	{ 
		if (parent[x] != x) { 

			parent[x] = find(parent[x]); 
		} 

		return parent[x]; 
	} 
	void Union(int x, int y) 
	{ 
		int xset = find(x); 
		int yset = find(y); 
		
		if (xset == yset) 
		{
			return; 
		}
			
		if (size[xset] < size[yset]) 
		{ 
			parent[xset] = yset;
		size[yset]=size[yset]+size[xset];
		} 
		else if (size[xset] >= size[yset]) 
		{ 
			parent[yset] = xset; 
		    size[xset]=size[xset]+size[yset];
		} 
	}
	void mini()
	{
	    int sizi = -1;
	    for(int i=1;i<=n;i++)
	    {
	        if(parent[i]==i)
	        {
	            int val= size[i];
	            sizi = max(sizi,val);
	        }
	    }
	    cout<<sizi<<endl;
	}
}; 

int main() 
{ 
    int n,m;
    cin>>n>>m;
    DisjSet obj(n); 
    for(int i=0;i<m;i++)
    {
        int a,b;
        cin>>a>>b;
        obj.Union(a,b);
    }
    obj.mini();

	return 0; 
} 


Measured memory_bytes: 5152
#include "bits/stdc++.h"
using namespace std;
int main(){
	std::ios::sync_with_stdio(false);
	int N;
	cin >> N;
	for(int x = 1; x<=9;x++){
		for(int y = 1; y<=9; y++){
			if(x*y==N){
				cout << "Yes";
				return 0;
			}
		}
	}
	cout << "No";
}

 


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		int i = 2;
		for (; i <= n; i = i * 2) {
		}
		System.out.println(i / 2);
	}
}


Measured memory_bytes: 21844
#include<stdio.h>

#define MAX 110
#define INFINITY 1000000
#define NIL -1
#define WHITE 0
#define GRAY 1
#define BLACK 2

void Prim(void);
int n;
int num[MAX][MAX];
int main(){
  int i,j;

  scanf("%d",&n);
  for(i=0; i<n; i++){
    for(j=0; j<n; j++){
      scanf("%d",&num[i][j]);
      if(num[i][j] == NIL) num[i][j] = INFINITY;
    }
  }
 
  Prim();
  return 0;
}

void Prim(){
  int i,u,v,min,sum = 0;
  int d[MAX],pi[MAX],color[MAX];
  for(u=0; u<n; u++){
    d[u]= INFINITY;
    pi[u] = NIL;
    color[u] = WHITE;
    }
  d[0] = 0;
  
  while(1){
    min = INFINITY;
    u = NIL;
    for(i=0; i<n; i++){
      if(color[i] != BLACK && d[i] < min){
	min = d[i];
	u = i;
      }
    }
    if(min == INFINITY) break;  
    color[u] = BLACK;

    for(v=0; v<n; v++){
      if(color[v] != BLACK && num[u][v] < d[v]){
	if(num[u][v] != INFINITY){
	 pi[v] = u;
	 d[v] = num[u][v];
	 color[v] = GRAY;
	}
      }
    }
    
  }
  for(i=0; i<n; i++){
    if(pi[i] != NIL) sum += num[i][pi[i]];  
  }
  
  printf("%d\n",sum);
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int a[101];
int main(){
    int n;
    cin>>n;
    rep(i,n) cin>>a[i];
    int cnt=0;
    while(1){
        bool flag=true;
        rep(i,n-1)if(a[i]>a[i+1]) swap(a[i],a[i+1]),flag=false,++cnt;
        if(flag) break;
    }
    rep(i,n) cout<<a[i]<<(i==n-1?"":" ");
    cout<<endl;
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 3136
import java.util.*;
 
class Main {
    public static void main(String[] args) {
      
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
      
      if(B%A==0){System.out.println(A+B);}
      else{System.out.println(B-A);}

    }
}

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

#define FOR(s, i, n) for(int i = s; i n; i++)
typedef long long ll;
const int INF = 1e9;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.precision(12);
	
	double a, b, h, m;
	cin>>a>>b>>h>>m;
	double hDeg = h/12.0 + m/60.0/12.0;
	double mDeg = m/60.0;
	hDeg *= 2.0*M_PI;
	mDeg *= 2.0*M_PI;
	double ang = abs(hDeg - mDeg);
	ang = min (ang, 2.0*M_PI - ang);
	
	double ans = sqrt(a*a+b*b - 2.0*a*b*cos(ang));
	cout<<ans<<'\n';
	return 0;
}

Measured memory_bytes: 4272
#include <iostream>

int main() {
  int r;
  std::cin >> r;
  
  if (r < 1200) {
    std::cout << "ABC" << std::endl;
  }
  else if (r < 2800) {
    std::cout << "ARC" << std::endl;
  }
  else {
    std::cout << "AGC" << std::endl;
  }
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int h = sc.nextInt();
        int w = sc.nextInt();
        System.out.println((n+1-h)*(n+1-w));
 
    }
}


Measured memory_bytes: 23252
/*
  AUTHOR:SOURABH
  CREATED:03:04:20
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ordered_set tree<pll , null_type, less< pll >, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define W while
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x) for(i=x;i>=0;i--)
#define fit(it,s) for(it=s.begin();it!=s.end();it++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define mod 998244353
#define MAX 100005
#define M 32

using namespace std;
using namespace __gnu_pbds;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);

    ll t,n,k,mi,r;
    t=1;
    //cin>>t;
    W(t--)
    {
        cin>>n>>k;
        if(k>=2*n)
        cout<<n;
        else
        {
            r=n%k;
            cout<<min(r,k-r);
        }
    }
    return 0;
}
















Measured memory_bytes: 256
module Main where

import Control.Applicative
import Control.Monad
import Data.List
import Data.Ratio
import Text.Printf

main :: IO ()
main = do
    [a, b, c, d, e, f] <- fmap read . words <$> getLine :: IO [Int]
    let water = do
            i <- [0 .. f `div` (100 * a)]
            j <- [0 .. f `div` (100 * b)]
            let g = 100 * a * i + 100 * b * j
            guard (0 < g && g <= f)
            return g
    let sugar = do
            i <- [0 .. f `div` c]
            j <- [0 .. f `div` d]
            let g = c * i + d * j
            guard (g <= f)
            return g
    let f1 [w, s] = (w + s <= f) && (s <= (w `div` 100) * e)
    let g1 [w1, s1] [w2, s2] = (s1 % w1) `compare` (s2 % w2)
    let [aw, as] = maximumBy g1 . filter f1 $ sequence [water, sugar]
    printf "%d %d\n" (aw + as) as

Measured memory_bytes: 157052
#include<bits/stdc++.h>
#define For(i, a, b)  for(int i = a, _b = b; i <= _b; ++i)
#define Ford(i, a, b) for(int i = a, _b = b; i >= _b; --i)
#define FileName      "test"
#define ll            long long
#define ld            long double
#define ull           unsigned long long
#define Print(x)      cerr << #x << "is " << x << '\n';
#define pb            push_back
#define X             first
#define Y             second
//#define Karma

using namespace std;

template<typename T> inline void Cin(T &x)
{
    char c;
    T sign = 1;
    x = 0;
    for (c = getchar(); c < '0' || c > '9'; c = getchar())
        if (c == '-') sign = -1;
    for (; c >= '0' && c <= '9'; c = getchar())
        x = x * 10 + c - '0';
    x *= sign;
}
template <typename T> inline void Out(T x) {if(x > 9) Out(x / 10); putchar(x % 10 + '0');}
template <typename T> inline void Cout(T x, char c) {if(x < 0) putchar('-'); x = abs(x); Out(x); putchar(c);}
template <typename T, typename... Args> inline void Cin(T& a, Args&... args) {Cin(a);Cin(args...);}
template <typename T, typename... Args> inline void Cout(T a, char c, Args... args) {Cout(a, c);Cout(args...);}

typedef pair<int, int> pii;
typedef pair<ll, int> plli;
const int N = 107;
const int M = 1e5 + 7;

int f[M], n, k, a[N];

int DP(int k)
{
    if(f[k] != -1) return f[k];
    int& res = f[k];
    res = 0;
    For(i, 1, n)
    {
        if(k < a[i]) break;
        if(!DP(k - a[i])) res = 1;
    }
    return res;
}

void Enter()
{
     Cin(n, k);
     For(i, 1, n) Cin(a[i]);
}

void Solve()
{
     memset(&f, -1, sizeof f);
     cout << (DP(k)? "First": "Second");
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
#ifdef Karma
    freopen(FileName".inp", "r", stdin);
    freopen(FileName".out", "w", stdout);
#endif // Karma

    Enter();
    Solve();

    return 0;
}


Measured memory_bytes: 5376
#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<bitset>

#define Vsort(a) sort(a.begin(), a.end())
#define Vreverse(a) reverse(a.begin(), a.end())
#define Srep(n) for(int i = 0; i < (n); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define Lrep(i,a,n) for(int i = (a); i < (n); i++)
#define Brep(n) for(int bit = 0; bit < (1<<n); bit++)
#define rep2nd(n,m) Srep(n) Lrep(j,0,m)
#define vi vector<int>
#define vi64 vector<int64_t>
#define vvi vector<vector<int>>
#define vvi64 vector<vector<int64_t>>

using namespace std;

int main(){
    int n;
    bool ans = false;
    cin >> n;
    vi judge(n);
    Srep(n){
        int a,b;
        cin >> a >> b;
        if(a == b) judge[i] = 1;
        else judge[i] = 0;
    }
    Lrep(i,2,n) if((judge[i-2] == 1)&&(judge[i-1] == 1)&&(judge[i] == 1)) ans = true;
    ans ? cout << "Yes" << endl : cout << "No" << endl;
}

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

using namespace std;

int main(){
  int n;
  cin >> n;
  for(int k=1;2*n>=k*(k-1);k++){
    if(2*n==k*(k-1)){
      vector<int> v[k];
      int cur=1;
      while(cur<k){
        v[0].push_back(cur);
        v[cur].push_back(cur);
        cur++;
      }
      for(int i=1;i<k;i++){
        for(int j=i+1;j<k;j++){
          v[i].push_back(cur);
          v[j].push_back(cur);
          cur++;
        }
      }
      cout << "Yes" << endl;
      cout << k << endl;
      for(int i=0;i<k;i++){
        cout << k-1 << ' ';
        for(int j=0;j<k-1;j++){
          cout << v[i][j] << (j==k-2?'\n': ' ');
        }
      }
      return 0;
    }
  }
  cout << "No" << endl;
}



Measured memory_bytes: 4480
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

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

//マクロ
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

int g[15][15];
int main()
{
  int n;
  cin >> n;
  rep(i, n) rep(j, n) g[i][j] = -1;
  rep(i, n)
  {
    int m;
    cin >> m;
    rep(j, m)
    {
      int a, x;
      cin >> a >> x;
      a--;
      g[i][a] = x;
    }
  }
  int ans = 0;
  // 二乗
  rep(i, 1 << n)
  {
    vector<int> d(n);
    rep(j, n) if (i >> j & 1)
    {
      d[j] = 1;
    }
    bool ok = true;
    rep(j, n)
    {
      if (d[j])
      {
        rep(k, n)
        {
          if (g[j][k] == -1)
            continue;
          if (g[j][k] != d[k])
            ok = false;
        }
      }
    }
    if (ok)
      ans = max(ans, __builtin_popcount(i));
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Main m = new Main();
		m.run();
	}

	Scanner sc = new Scanner(System.in);

	void run() {
		for(;;){
			int n = sc.nextInt();
			if(n == 0){
				break;
			}
			
			String f[] = new String[n];
			boolean u = true;
			boolean l = false;
			boolean r = false;
			int count = 0;
			for(int i  =0 ; i < n ;i++){
				String str = sc.next();
				if(str.equals("lu")){
					l=true;
				}
				if(str.equals("ld")){
					l=false;
				}
				if(str.equals("ru")){
					r=true;
				}
				if(str.equals("rd")){
					r=false;
				}
				if(u && l && r){
					count++;
					u = false;
				}
				if(!u && !l && !r){
					count++;
					u=true;
				}
					
			}
			System.out.println(count);
		}
		
	}
}



Measured memory_bytes: 37664
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountl
long long modInverse(long long a, long long m)
{
    long long m0 = m;
    long long y = 0, x = 1;
    if (m == 1)
      return 0;
    while (a > 1)
    {
        long long q = a / m;
        long long t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
       x += m0;
    return x;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n,a,b,k,ans=0;
cin>>n>>a>>b>>k;
ll mo=998244353;
ll fac[1000000];
ll p=1;
fac[0]=p;
if((a+b)*n<k){
    cout<<0;
return 0;}
for(int i=1;i<1000000;++i)
{
    p*=i;
    p%=mo;
    fac[i]=p;
}
for(int i=0;a*i<=k;++i)
{
    if(i>n)
        break;
    ll d=fac[n]*((modInverse(fac[i],mo)*modInverse(fac[n-i],mo))%mo);
    d%=mo;
    //cout<<d<<" ";
    if((k-a*i)%b==0&&(k-a*i)/b<=n)
    {
        ll r;
        r=fac[n]*((modInverse(fac[(k-a*i)/b],mo)*modInverse(fac[n-(k-a*i)/b],mo))%mo);
        r%=mo;
        d%=mo;
        ans+=(d*r)%mo;
        ans%=mo;
        //cout<<r<<" "<<(k-a*i)/b<<" "<<modInverse(fac[(k-a*i)/b],mo)<<" ";
    }
   // cout<<ans<<"\n";
}
cout<<ans;
}

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP0(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define RREP0(i, n) for (int i = (n)-1; i >= 0; --i)
#define REP1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define RREP1(i, n) for (int i = (n); i >= 1; --i)
#define pow10(n) int(1e##n + n)

typedef long long LL;
typedef pair<int, int> P;

const int INTINF = int(1e9) + 1;
const LL LLINF = LL(1e18) + 1;
long double eps = 1.0E-14;

string S;
int N;
const LL mod = LL(1e9) + 7;

void solve()
{
    cin >> N >> S;
    map<char, int> mp;
    for (auto c : S)
    {
        mp[c]++;
    }

    LL ans = 1;

    for (auto p : mp)
    {
        LL cnt = p.second;
        // ある文字 c について, どれを選ぶか+どれも選ばないか
        ans *= (cnt + 1);
        ans %= mod;
    }
    std::cout << ans - 1 << endl;
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(20);
    solve();
    return 0;
}


Measured memory_bytes: 512
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    N, H = MI()
    A = [0] * N
    B = [0] * N
    amax = 0
    for i in range(N):
        a, b = MI()
        A[i] = a
        B[i] = b
        amax = max(amax, a)

    B = sorted(B, reverse=True)
    ans = 0
    for i, b in enumerate(B):
        if b > amax and H > 0:
            ans += 1
            H -= b
        else:
            break

    if H > 0:
        ans += ceil(H / amax)

    print(ans)

if __name__ == '__main__':
    solve()


Measured memory_bytes: 17932
use std::io::{BufRead, Write};
use std::io;
use std::cmp;

fn solve<R: BufRead, W: Write>(mut input: R, mut output: W) {
    let mut s = String::new();
    input.read_line(&mut s).unwrap();
    let (a, b, c, d): (usize, usize, usize, usize) = {
        let mut split = s.split_whitespace();
        let a = split.next().unwrap().parse().unwrap();
        let b = split.next().unwrap().parse().unwrap();
        let c = split.next().unwrap().parse().unwrap();
        let d = split.next().unwrap().parse().unwrap();
        (a, b, c, d)
    };
    let diff = cmp::min(b, d).saturating_sub(cmp::max(a, c));
    writeln!(output, "{}", diff).unwrap();
}

fn main() {
    let stdin = io::stdin();
    let stdout = io::stdout();
    solve(stdin.lock(), stdout.lock());
}

#[cfg(test)]
mod tests {
    fn test(input: &str, output: &str) {
        let mut v: Vec<u8> = Vec::new();
        ::solve(input.as_bytes(), &mut v);
        assert_eq!(String::from_utf8(v).unwrap(), output);
    }

    #[test]
    fn case1() {
        test("0 75 25 100\n", "50\n");
    }
    #[test]
    fn case2() {
        test("0 33 66 99\n", "0\n");
    }
    #[test]
    fn case3() {
        test("10 90 20 80\n", "60\n");
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define REP(i, n) for (long long i = 0; i < (long long)n; i++)
//#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Vl = vector<ll>;
using vi = vector<int>;
using Graph = vector<vi>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(15); //"for float-base
  // problem"
  int N, M, X;
  cin >> N >> M >> X;
  Graph A(N);
  REP(i, N) {
    REP(j, M + 1) {
      int t;
      cin >> t;
      A.at(i).push_back(t);
    }
  }
  ll Ans = 1e15;
  for (int bit = 0; bit < (1 << N); ++bit) {
    vi skill(M);
    int sum = 0;
    bool flag = true;
    REP(i, N) {
      if (bit & (1 << i)) {
        sum += A.at(i).at(0);
        for (int k = 1; k < M + 1; k++) {
          skill.at(k - 1) += A.at(i).at(k);
        }
      }
    }
    for (auto a : skill) {
      if (a < X) flag = false;
    }
    if (flag && Ans > sum) Ans = sum;
  }
  if (Ans == 1e15)
    cout << -1 << endl;
  else
    cout << Ans << endl;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define ll long long
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#define MAX 100000000
using namespace std;
int main()
{
  ll a,b,c,d;
  cin>>a>>b>>c>>d;
  ll lc=(c*d)/(__gcd(c,d)),res=b-a+1;
  a--;
  res-=(b/c-a/c+b/d-a/d-b/lc+a/lc);
  cout<<res;
	
	
	
	
	
 return 0;
}

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

int main()
{
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;
    int sz1 = s1.size();
    int sz2 = s2.size();
    if(s1[sz1-1] == s2[0] && s2[sz2-1] == s3[0]) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
//============================================================================
// Name        : ITP_1_3_C.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

int main() {
	int x,y,temp;
	do {
		cin >> x >> y;
		if (x == 0 && y == 0) {
			break;
		}
		if (x>y) {
			temp=x;
			x=y;
			y=temp;
		}
		cout << x << " "  << y << endl;
	} while(1);
	return 0;
}

Measured memory_bytes: 3012
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp():
    '''
    一つの整数
    '''
    return int(input())
def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))

n, k = inpl()
a = inpl()
now = 1
visited = []
visited_set = set()
FLAG=True
for _ in range(k):
    if now in visited_set:
        FLAG=False
        break
    visited_set.add(now)
    visited.append(now)
    now = a[now - 1]
if FLAG:
    print(now)
    exit()
loop_begin = visited.index(now)
k -= loop_begin
loop_len = len(visited) - loop_begin
print(visited[k%loop_len+loop_begin])

Measured memory_bytes: 119988
import math

n, q = map(int, input().split())

# make a list whose length is 2^i - 1.
n = 2 ** math.ceil(math.log(n, 2))
max_v = 2147483647

A = [max_v for i in range(2 * n - 1)]


def update(i, x):
    i += n - 1
    A[i] = x

    while i > 0:
        i = (i - 1) // 2
        A[i] = min(A[i * 2 + 1], A[i * 2 + 2])

def find(a, b, k, l, r):
    if r <= a or b <= l:
        return max_v
    if a <= l and r <= b:
        return A[k]
    else:
        vl = find(a, b, k * 2 + 1, l, (l + r) // 2)
        vr = find(a, b, k * 2 + 2, (l + r) // 2, r)
        return min(vl, vr)


for i in range(q):
    com, x, y = map(int, input().split())
    if com == 0:
        update(x, y)
    else:
        ans = find(x, y + 1, 0, 0, n)
        print(ans)

Measured memory_bytes: 11200
sx, sy, tx, ty = map(int, input().split())

dx = (tx - sx)
dy = (ty - sy)
l1 = 'U' * dy + 'R' * dx
l2 = 'D' * dy + 'L' * dx
l3 = 'D' + 'R' * (dx + 1) + 'U' * (dy + 1) + 'L'
l4 = 'U' + 'L' * (dx + 1) + 'D' * (dy + 1) + 'R'

print(l1 + l2 + l3 + l4)


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

int main() {
    int X, Y;
    cin >> X >> Y;

    int ans = 0;
    if (X == 3)
    {
        ans += 100000;
    }
    else if (X == 2)
    {
        ans += 200000;
    }
    else if (X == 1)
    {
        ans += 300000;
    }
    
    if (Y == 3)
    {
        ans += 100000;
    }
    else if (Y == 2)
    {
        ans += 200000;
    }
    else if (Y == 1)
    {
        ans += 300000;
    }

    if (X == 1 && Y == 1)
    {
        ans += 400000;
    }

    cout << ans << endl;
        
    
}


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

void solve() {
    ll N, K;
    cin >> N >> K;
    int r = 1;
    while (N / K != 0) {
        r++;
        N /= K;
    }
    cout << r << endl;
}

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


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
	    int n = scan.nextInt();
	    int d[]= new int[n];
	    for(int i=0;i<n;i++) {
	    	d[i]=scan.nextInt();
	    }
	    scan.close();

	    Arrays.sort(d);

	    int ans = d[n/2] - d[n/2-1];

	    System.out.println(ans);

	}

}

Measured memory_bytes: 50992
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <stack>
#include <climits>
#include <deque>
#include <bitset>
#include <cassert>
#include <ctime>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
const int dy[]={-1,0,1,0},dx[]={0,1,0,-1};
// adjust problem by problem
const double EPS=1e-8;
const double PI=acos(-1.0);
#ifdef __GNUC__
int popcount(int n){return __builtin_popcount(n);}
int popcount(ll n){return __builtin_popcountll(n);}
#endif
#ifndef __GNUC__
template<class T> int popcount(T n){int cnt=0;while(n){if(n%2)cnt++;n/=2;}return cnt;}
#endif
template<class T>int SIZE(T a){return a.size();}
template<class T>string IntToString(T num){string res;stringstream ss;ss<<num;return ss.str();}
template<class T>T StringToInt(string str){T res=0;for(int i=0;i<SIZE(str);i++)res=(res*10+str[i]-'0');return res;}
template<class T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<class T>T lcm(T a,T b){return a/gcd(a,b)*b;}
bool EQ(double a,double b){return abs(a-b)<EPS;}
void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}
vector<string> split(string str,char del){
  vector<string> res;
  for(int i=0,s=0;i<SIZE(str);i++){
    if(str[i]==del){if(i-s!=0)res.push_back(str.substr(s,i-s));s=i+1;}
    else if(i==SIZE(str)-1){res.push_back(str.substr(s));}
  }
  return res;
}

int H,W;
int sx,sy,gx,gy;

const int mod=100000007;
const int MAX_FACT=10000;

ll fact[MAX_FACT];

ll pow_mod(ll a,ll n){
  ll cur=1;
  ll mul=a;
  while(n){
    if(n%2)cur=(cur*mul)%mod;
    mul=(mul*mul)%mod;
    n/=2;
  }
  return cur;
}

ll div_mod(int a){
  return pow_mod(a,mod-2);
}
// factを前計算
void calcFact(){
  fact[0]=1;
  for(int i=1;i<MAX_FACT;i++)
    fact[i]=(fact[i-1]*i)%mod;
}
// aCbのmodを計算
// 計算量はO(log(fact[a])+log(fact[a-b]))程度
ll comb(ll a,ll b){
  if(a<0||b<0)return 0;
  else if(b==0)return 1;
  ll res=fact[a];
  res=(res*div_mod(fact[b]))%mod;
  res=(res*div_mod(fact[a-b]))%mod;
  return res;
}

int main(){
  calcFact();
  cin>>H>>W>>sy>>sx>>gy>>gx;
  vector<pii> cand;
  ll res=0;
  cand.push_back(pii(gy,gx));
  // left
  cand.push_back(pii(gy,-(W-gx)));
  // right
  cand.push_back(pii(gy,W+gx));
  // up
  cand.push_back(pii(-(H-gy),gx));
  // down
  cand.push_back(pii(H+gy,gx));
  // left up
  cand.push_back(pii(-(H-gy),-(W-gx)));
  // right up
  cand.push_back(pii(-(H-gy),W+gx));
  // left down
  cand.push_back(pii(H+gy,-(W-gx)));
  // right down
  cand.push_back(pii(H+gy,W+gx));
  int minDist=1<<30;
  for(int i=0;i<9;i++)
    minDist=min(minDist,abs(sy-cand[i].first)
                +abs(sx-cand[i].second));
  for(int i=0;i<9;i++){
    int a=abs(sy-cand[i].first);
    int b=abs(sx-cand[i].second);
    if(minDist==(a+b))
      res=(res+comb(a+b,a))%mod;
  }
  cout<<res<<endl;
  
  return 0;
}

Measured memory_bytes: 1276
#include <iostream>
#include <vector>
#include <cstring>
#include <queue>

using namespace std;

int n;
int g[101][101] = {};
int sp[101] = {};


void bfs(){

  queue<int> q;
  q.push(1);

  while( !q.empty() ){
    int v = q.front(); q.pop();
    for(int i=1; i<=n; i++){
      if(g[v][i] == 1 && sp[i] == -1){
	q.push(i);
	sp[i] = sp[v]+1;
      }
    }
  }
}


int main(){

  memset(g,0,sizeof(g));
  memset(sp,-1,sizeof(sp));
  cin >> n;
  sp[1] = 0;

  for(int i=1; i<=n; i++){
    int u,v,k;
    cin >> u >> k;
    for(int j=0; j<k; j++){
      cin >> v;
      g[u][v] = 1;
    }
  }

  bfs();

  for(int i=1; i<=n; i++)
    cout << i << " " << sp[i] << endl;

}

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

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef double ld;
typedef pair<ll, int> pll;

set<int> s;

bool ok(int n)
{
    while (n) {
        if (s.count(n % 10)) {
            return false;
        }
        n /= 10;
    }
    return true;
}

int main()
{

    //ifstream cin("input.txt");
    //freopen("input.txt", "r", stdin);

    //ios_base::sync_with_stdio(false);
    //cin.tie(0);

    int n;
    cin >> n;
    int k;
    cin >> k;

    while (k--) {
        int d;
        cin >> d;
        s.insert(d);
    }

    while (!ok(n)) {
        ++n;
    }
    cout << n << "\n";

}


Measured memory_bytes: 256
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define ll int
#define bits_count __builtin_popcountll
#define endl '\n'
#define double long double
#define ld double
#define FOR(i,a,n) for (ll i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (ll i=(n);i>=(a);--i)
#define FI(i,n) for (ll i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define MINUS(a) memset((a),-1,sizeof((a)))
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
#define sz(x) (ll)x.size()
#define pr pair<int,int>
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }

// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

void solve(){

    string s; cin>>s;
    bool flag = false;
    for(int i=0;i<sz(s);i++) if(s[i] == '7') flag = true;
    if(flag) cout<<"Yes\n";
    else cout<<"No\n"; 
}

signed main(){

   FastRead; 


    int t = 1; 
    // cin>>t;
    FOR(i,1,t){
        // cout<<"Case #"<<i<<": ";
        solve();
    }
}





Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
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; }
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    vi time(5);
    ll minVal = 10, minIdx = 4;
    rep(i, 5){
        cin >> time[i];
        if(time[i]%10 != 0 && minVal > time[i]%10){
            minVal = time[i]%10;
            minIdx = i;
        }
    }

    ll ans = 0;
    rep(i, 5){
        if(i != minIdx) time[i] = (ll)(ceil(time[i]/10.0)*10);
        ans += time[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    sc.close();
    for (int i = 1; i <= 9; i++) {
      if (n % i == 0 && n / i <= 9) {
        System.out.println("Yes");
        return;
      }
    }
    System.out.println("No");
  }
}

Measured memory_bytes: 21844
#include<iostream>
#include<fstream>
#include<math.h>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include <chrono>
#include<math.h>

#define FIO ios_base::sync_with_stdio(0);  cin.tie(0);
#define PI 3.14159265358979323846
#define mod 998244353
#define ll long long
#define vll vector<long long>  
#define all(c) c.begin(), c.end()
// Used to traverse in any STL container with iterators
#define tr(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
// Find whether element is present in given container or not
#define present(container, element) (container.find(element) != container.end())
// Finds whether element in present container is present in vector or not
#define cpresent(container, element) (find(all(container),element) != container.end())

using namespace std;
using namespace std::chrono; 

const ll INF = 1e13;

// void dfs(int v, vector<vector<int> >& adj, vector<bool> visited){
//     visited[v] = true;
//     for(int u: adj[v]){
//         if(!visited[u])
//             dfs(u, adj, visited);
//     }
// }

int main(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
    #endif
    FIO

    int n, m;
    string str1, str2;
    cin>>str1;
    cin>>str2;
    n = str1.length();
    m = str2.length();

    ll dp[n+1][m+1];
    int dir[n+1][m+1];

    for(int i=0;i<=n;i++){
        for(int j=0;j<=m;j++){
            if(i==0 || j==0){
                dp[i][j] = 0;
                dir[i][j] = 0;
            }
            else{
                if(str1[i-1] == str2[j-1]){
                    dp[i][j] = 1 + dp[i-1][j-1];
                    dir[i][j] = -2;
                }
                else{
                    if(dp[i-1][j] >= dp[i][j-1] ){
                        dp[i][j] = dp[i-1][j];
                        dir[i][j] = -1;
                    }
                    else {
                        dp[i][j] = dp[i][j-1];
                        dir[i][j] = 1;
                    }
                }
            }
        }
    }
    string s;
    int flag = 0;
    int i=n, j=m;
    while(i>=0){
        while(j>=0){
            if(dir[i][j] == 0){
                flag = 1;
                break;
            }
            if(dir[i][j] == -2){
                s.push_back(str1[i-1]);
                i--;
                j--;
            }
            else if(dir[i][j] == -1){
                i--;
            }
            else j--;
        }
        if(flag)break;
    }
    for(int i=s.size()-1;i>=0;i--){
        cout<<s[i];
    }
    cout<<endl;
 


    return 0;
}

Measured memory_bytes: 108520
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s, n) for(int i = s; i < (int)(n); i++)
#define co(x) cout<<x<<endl
#define SQvec(i,j) vector<vector<int>> data(i, vector<int>(j))
#define mod 1000000000+7
typedef long long int lint;

int main() {
  int N,M,max,min,cnt = 0;
  cin >> N >> M;
  vector<int> a(M),b(M);
  rep(i,0,M){
    cin >> a[i] >> b[i];
  }
  
  max = *max_element(a.begin(),a.end());
  min = *min_element(b.begin(),b.end());
  
  while(max >= min){
    rep(i,0,a.size()){
      if(a[i] < min){
        a[i] = 1;
        b[i] = N;
      }
    }
    cnt++;
    max = *max_element(a.begin(),a.end());
    min = *min_element(b.begin(),b.end());
  }
  co(cnt + 1);
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
<url:https://arc068.contest.atcoder.jp/tasks/arc068_b>
問題文============================================================
 すぬけくんはカードゲームで遊ぶことにしました。
 N 枚からなるカードの山があり、上から i 枚目のカードには整数 Ai が書かれています。
 
 すぬけくんはこのカードの山に対し 0 回以上、以下の操作を行い、
 残ったカードに書かれた値が互いに異なるようにしたいです。
 最大で何枚のカードを残すことが可能か求めなさい。
 なお、N は奇数であり、少なくとも 1 枚のカードを残すことが可能であることが保証されます。
 
 操作：カードの山から任意の 3 枚のカードを抜き出す。
 抜き出したカードのうち書かれた値が最大であるようなカード 1 枚と
 最小であるようなカード 1 枚の合計 2 枚を選んで食べる。その後残った 1 枚をカードの山に戻す。
=================================================================

解説=============================================================

================================================================
*/
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    ll N; cin >> N;
    vector<ll> A(N);
    for(auto& in:A) cin >> in;
    const int MAX_N = 1e5+1;
    vector<ll> C(MAX_N,0);
    for(auto &v:A) C[v]++;
    sort(C.begin(),C.end(),greater<ll>());
    for(int i = 0; i < (int)C.size();i++){
        if(C[i] >= 3){
            if(C[i]%2 == 1) C[i] = 1;
            else C[i] = 2;
        }
    }
    sort(C.begin(),C.end(),greater<ll>());
    for(int i = 0; i < (int)C.size();i++){
        if(C[i] == 2){
            C[i] = 1; C[i+1]--;
        }
    }
    cout << accumulate(C.begin(),C.end(),0LL) << endl;
	return 0;
}


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

int main(){
	int n;
	while(cin >> n){
		int ans = 0;
		for(int i = 0 ; i <= 9 ; i++)
			for(int j = 0 ; j <= 9 ; j++)
				for(int k = 0 ; k <= 9 ; k++)
					for(int l = 0 ; l <= 9 ; l++)
						if(i+j+k+l == n ) ans++;
		cout << ans << endl;
	}
}

Measured memory_bytes: 1160
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i,n) for(int i = 0;i < n;i++)
#define NIL = -1;
#define all(x) x.begin(),x.end()
const ll INF = 1e9;
const ll mod = 1e9 + 7;
 
int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}
 
ll gcd(long long a,long long b) {
    if (a < b) swap(a,b);
    if (b == 0) return a;
    
    return gcd(b,a%b);
}

bool is_prime(long long N){
    if (N == 1) return false;
    for (long long i = 2;i * i <= N;i++){
        if (N % i == 0) return false;
    }
    return true;
}
 
ll lcm(ll a,ll b){
    return ((a * b == 0)) ? 0 : (a / gcd(a,b) * b);
}
 
double DegreeToRadian(double degree){
    return degree * M_PI / 180.0;
}
 
 
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};
 
 
///////////////////////////////////////////////////////////////////////////////////

int main(){
    int n;
    cin >> n;
    int f[100][14];
    int p[100][15];

    for (int i = 0;i < n;i++){
        for (int j = 0;j < 10;j++){
            cin >> f[i][j];
        }
    }
    for (int i = 0;i < n;i++){
        for (int j = 0;j < 11;j++){
            cin >> p[i][j];
        }
    }

    int ans = 1e9 * (-1);
    for (int bit = 1;bit < (1 << 10);bit++){
        int rep = 0;
        for (int i = 0;i < n;i++){
            int cnt = 0;
            for (int j = 0;j < 10;j++){
                if (bit & (1 << j) && f[i][j]){
                    cnt++;
                }
            }
            rep += p[i][cnt];
        }
        if (ans < rep){
            ans = rep;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3588
/*************************************************************************
  >         File: Main.java
  >       Author: Riho.Yoshioka
  >         Mail: riho.yoshioka@yandex.com
  > Created Time: Sun 21 Aug 2016 08:07:38 PM CST
*************************************************************************/
import java.io.*;
import java.util.*;

public class Main {
  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    
    TaskB solver = new TaskB();
    solver.solve(1, in, out);
    out.close();
  }

  static class TaskB {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
      int n = in.nextInt();
      int[] a = new int[n + 1];
      long[][] dp = new long[n + 1][2];
      for (int i = 0; i < n; i++) {
        a[i + 1] = in.nextInt();
      }
      for (int i = 0; i <= n; i++) {
        dp[i][0] = dp[i][1] = -1;
      }
      dp[0][0] = 0;
      for (int i = 1; i <= n; i++) {
        if (dp[i - 1][0] >= 0) {
          dp[i][0] = dp[i - 1][0] + a[i] / 2;
          if (a[i] > 0) dp[i][1] = dp[i - 1][0] + (a[i] - 1) / 2;
        }
        if (dp[i - 1][1] >= 0) {
          if (a[i] > 0) dp[i][0] = Math.max(dp[i][0], dp[i - 1][1] + (a[i] - 1) / 2 + 1);
          if (a[i] > 1) dp[i][1] = Math.max(dp[i][1], dp[i - 1][1] + (a[i] - 2) / 2 + 1);
        }
      }
      long ans = Math.max(dp[n][0], dp[n][1]);
      out.println(ans);
    }
  }

  static class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream), 32768);
      tokenizer = null;
    }

    public String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }
  }
}


Measured memory_bytes: 24216
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
void in(){}
template<typename F, typename... R>
bool in(F& f, R&... r){
    if(cin >> f){in(r...);return true;}
    else return false;
}
#define out(x) cout << (x)
#define space() cout << " "
#define indent() cout << '\n'
void print(){}
template<typename F, typename... R>
void print(F f, R... r){out(f), indent(), print(r...);}
#define debughead(x) cerr << "Line " << __LINE__ << ": " << #x << ": "
#define debugout(x) cerr << (x) << " "
#define debugindent() cerr << '\n'
#define debug(x) debughead(x), debugout(x), debugindent()
const int INF = 1e18, MOD = 1e9 + 7;
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}

int n, tmp, res = 0;
string s;
main(){
    INCANT;
    string list[] = {
        "AKIHABARA",
        "KIHABARA", "AKIHBARA", "AKIHABRA", "AKIHABAR",
        "KIHBARA", "KIHABRA", "KIHABAR", "AKIHBRA", "AKIHBAR", "AKIHABR",
        "KIHBRA", "KIHBAR", "KIHABR", "AKIHBR",
        "KIHBR"
    };
    in(s);
    if(find(list, list + 16, s) != list + 16){
        print("YES");
    }else{
        print("NO");
    }
}


Measured memory_bytes: 256
const main = (input) =>  {
  const data = input.split(/\n/);
  const num = data[0]
  const hoge = data[1].split(/\s/).map((a) => parseInt(a, 10)).sort((a, b) => {
    if (a < b ) return 1;
    if (a > b ) return -1;
    return 0;
  })
  var res = 0;
  for (i = 0; i < num; i ++ ) {
    res += (hoge[i*2 + 1]);
  }
  console.log(res)
}

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




Measured memory_bytes: 7500
#include<bits/stdc++.h>
#include <unordered_map>
#define int long long int
#define double long double
#define endl "\n"
#define PI 3.141592653589793238462643383279502884
#define sp(x)   setprecision(x)
#define ceil(a,b)   (a+(b-1))/b
#define LCM(a,b)    (a*b)/__gcd(a,b)
#define all(v)  v.begin(),v.end()
#define alls(s,v)  s.begin(),s.end(),v
#define gena(arr,n,nxt)  generate(arr,arr+n, nxt)
#define genv(v,nxt)  generate(v.begin(),v.end(), nxt)
#define base ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define exit return 0;
using namespace std;
const int N=1000000;
bool prime[N];
void sieve()
{
    memset(prime, true, sizeof(prime));
    for (int p=2; p*p<100000000; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<100000; i += p)
                prime[i] = false;
        }
    }
}
int power(int x, int y)
{
    int res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = res * x;
        y = y >> 1;
        x = x*x;
    }
    return res;
}
int nxt()
{
    int x;
    cin >> x;
    return x;
}
int findTileCount(int x, int y, int l, int r)
{
    int lcm = (x * y) / __gcd(x, y);
    int countl = (l - 1) / lcm;
    int countr = r / lcm;
    return countr - countl;
}
int32_t main()
{
    base
    int n=nxt();
    cout<<(n*(n+1))/2;
    exit
}



Measured memory_bytes: 256