akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <math.h>
#include <time.h>
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <iterator>
#include <algorithm>

using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); i++)
#define reprev(i, n) reprrev(i, 0, n)

#define PI M_PI
#define INF 100000000

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<bool>> vvb;


int main()
{
	string S;
	cin >> S;
	sort(S.begin(), S.end());
	string ans = "None";
	string al = "abcdefghijklmnopqrstuvwxyz";
	int ptr = 0, ptr1 = 0;

	while (ptr < al.length())
	{
		if (al[ptr] != S[ptr1])
		{
			ans = al[ptr];
			break;
		}

		while (al[ptr] == S[ptr1])
		{
			ptr1++;
		}

		ptr++;
	}

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





Measured memory_bytes: 512
#include <iostream>
#include <vector>

using namespace std;

bool used[1<<18];

int main(){
    int M, K;
    cin >> M >> K;
    int n = (1<<(M));
    if(M == 1 && K == 1){
        cout << -1 << endl;
        return 0;
    }
    if(K >= n){
        cout << -1 << endl;
    }
    else{
        vector<int> ans1;
        vector<int> ans2;
        for(int i = 0; i < M; i++){
            int m = (1<<i);
            if(m&K) {
                ans1.push_back(m);
                used[m] = true;
            }
        }
        for(int i = 0; i < (1<<(M)); i++){
            if(!used[i]) ans2.push_back(i);
        }
        for(int i = 0; i < ans1.size(); i++){
            cout << ans1[i] <<  ' ';
        }
        for(int i = 0; i < ans2.size(); i++){
            cout << ans2[i] <<  ' ';
        }
        for(int i = 0; i < ans1.size(); i++){
            cout << ans1[ans1.size()-i-1] <<  ' ';
        }
        for(int i = 0; i < ans2.size(); i++){
            cout << ans2[ans2.size()-i-1];
            if(i != ans2.size()-1) cout << ' ';
            else cout << endl;
        }
    }
}

Measured memory_bytes: 2424
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(),(x).end()
int main(){
  int N;
  cin>>N;
  int A[N+1][4];
  rep(i,N) rep(j,3) cin>>A[i][j];
  int dp[N+1][4];
  rep(i,3) dp[0][i]=A[0][i];
  rep(i,N-1){
    dp[i+1][0]=A[i+1][0]+max(dp[i][1],dp[i][2]);
    dp[i+1][1]=A[i+1][1]+max(dp[i][2],dp[i][0]);
    dp[i+1][2]=A[i+1][2]+max(dp[i][0],dp[i][1]);
  }
  cout<<max(dp[N-1][0],max(dp[N-1][1],dp[N-1][2]))<<endl;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100000000000
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
#define PP pair<P,P>
#define T tuple<int,int,int> 
using namespace std;

int main(){
    int n; ll w; cin >> n >> w;
    vector<vector<int> > ob(4);
    ll a,b; cin >> a >> b;
    a--;
    ob[0].push_back(b);
    rep(i,n-1){
        int o; int v; cin >> o >> v;
        ob[o-a-1].push_back(v);
    }
    rep(i,4){
        sort(all(ob[i]));
        reverse(all(ob[i]));
    }

    int ans=0;

    rep(i,ob[0].size()+1){
        rep(j,ob[1].size()+1){
            rep(z,ob[2].size()+1){
                rep(k,ob[3].size()+1){
                    int tmp=0;
                    rep(ii,i) tmp+=ob[0][ii];
                    rep(jj,j) tmp+=ob[1][jj];
                    rep(zz,z) tmp+=ob[2][zz];
                    rep(kk,k) tmp+=ob[3][kk];
                    ll tmpw=(i*(a+1))+(j*(a+2))+(z*(a+3))+(k*(a+4));
                    if(tmpw<=w) ans=max(ans,tmp);
                }
            }
        }
    }

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



Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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 ll = long long;
using ull = unsigned long long;
const int INF = 2100100100;
const int MOD = 1e9 + 7;

ll N, M, K, Q, L;

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

    cin >> N >> L;
    vector<ll> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a.at(i);
    }

    int last = -1;
    for (int i = 0; i < N - 1; i++) {
        if (a[i] + a[i + 1] >= L) {
            last = i;
        }
    }
    if (last == -1) {
        cout << "Impossible" << endl;
        return 0;
    }
    vector<int> ans;

    for (int i = 0; i < last; i++) {
        ans.push_back(i);
    }
    for (int i = N - 2; i > last; i--) {
        ans.push_back(i);
    }
    ans.push_back(last);

    cout << "Possible" << endl;
    for (int i = 0; i < (int)ans.size(); i++) {
        cout << ans[i] + 1 << endl;
    }

    return 0;
}


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

int N;
int sum;

int main() {
    cin >> N;
    int pay;
    int max = 100;
    for (int i = 0; i < N; i++) {
        cin >> pay;
        if (pay > max) {
            max = pay;
        }
        sum += pay;
    }
    cout << sum - max / 2 << endl;
}


Measured memory_bytes: 256
from collections import Counter

n, m = map(int, input().split())
xss = [[int(x) for x in input().split()] for _ in range(n)]

needles = [0 for _ in range(n)]

ans = n
canceled = set()
while len(canceled)+1 < m:
    cnt = Counter(xs[needle] for needle, xs in zip(needles, xss))
    most = cnt.most_common(1)[0]
    ans = min(ans, most[1])
    canceled.add(most[0])
    for i, xs in enumerate(xss):
        while xs[needles[i]] in canceled:
            needles[i] += 1

print(ans)


Measured memory_bytes: 4588
#include<bits/stdc++.h>
using namespace std;
int n,m;
long long ret;
int powe[10];
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>m;
	powe[0]=1;
	powe[1]=2;
	powe[2]=4;
	powe[3]=8;
	powe[4]=16;
	powe[5]=32;
	for(int i=1;i<=m;i++)
		ret+=1900;
	for(int i=1;i<=n-m;i++)
		ret+=100;
	cout<<ret*powe[m]<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main implements Runnable {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        // Run with 32MB stack
        Thread thread = new Thread(null, new Main(), "", 32 * 1024 * 1024);
        thread.start();
    }

    @Override
    public void run() {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    static void solve(Scanner scanner) {
        int N = Integer.parseInt(scanner.next());
        if (N == 3 || N == 5 || N == 7) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }

}



Measured memory_bytes: 21716
#include <cmath>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <iomanip>
#include <map>
#include <stack>
#include <queue>

using namespace std;

typedef long long ll;



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    ll ans=0;
    for(ll i=1;i<pow(n,0.5);i++) {
        if(n%i==0 && n*1.0/i-1 > i) {
            ans+=(n/i)-1;
        }
    }
    
    
    cout<<ans<<endl;
}

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

int main() {
    long long a, b, c, ans = 0;
    cin >> a >> b >> c;
    
    if (a%2 and b%2 and c%2)
        ans = min({a*b, b*c, c*a});
    
    cout << ans << endl;
}


Measured memory_bytes: 256
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N, x := sc.nextInt(), sc.nextInt()
	A := sc.nextIntSlice(N)
	ans := 0
	for i := 1; i < N; i++ {
		sum := A[i] + A[i-1]
		if sum > x {
			if A[i-1] <= x {
				A[i] -= sum - x
				ans += sum - x
			} else {
				A[i] = 0
				ans += sum - x
			}
		}
	}

	fmt.Fprintln(wtr, ans)
	wtr.Flush()
}


Measured memory_bytes: 3072
#include <stdio.h>
#define SIZE 10

int data[SIZE][SIZE];

void drop(int x, int y, int size);
// void show();

int main(int argc, const char *argv[])
{
	int i, j, cnt = 0, max = 0, x, y, size;

	while(scanf("%d,%d,%d", &x, &y, &size)==3){
		drop(x, y, size);
	}

	for(i=0; i<SIZE; i++){
		for(j=0; j<SIZE; j++){
			if(max < data[i][j]) max = data[i][j];
			if(!data[i][j]) cnt++;
		}
	}
	
	printf("%d\n%d\n", cnt, max);

  return 0;
}

void drop(int x, int y, int size)
{
	int x_drop[3][15] = {{x, x-1, x, x+1, x},
											 {x-1, x, x+1, x-1, x, x+1, x-1, x, x+1},
											 {x, x-1, x, x+1, x-2, x-1, x, x+1, x+2, x-1, x, x+1, x}};
	int y_drop[3][15] = {{y-1, y, y, y, y+1},
											 {y-1, y-1, y-1, y, y, y, y+1, y+1, y+1},
											 {y-2, y-1, y-1, y-1, y, y, y, y, y, y+1, y+1, y+1, y+2}};
	int size_drop[3] = {5, 9, 13};
	int i, x_tmp, y_tmp;

	for(i=0; i<size_drop[size-1]; i++){
		x_tmp = x_drop[size-1][i];
		y_tmp = y_drop[size-1][i];
		
		if(0 <= x_tmp && x_tmp < SIZE && 0 <= y_tmp && y_tmp < SIZE){
			data[x_tmp][y_tmp]++;
		}
	}
}

/*
void show()
{
	int i, j;
	printf("**********\n");
	for(i=0; i<SIZE; i++){
		for(j=0; j<SIZE; j++){
			printf("%d", data[i][j]);
		}
		printf("\n");
	}
}
*/

Measured memory_bytes: 600
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iomanip>
#include<algorithm>
using namespace std;
#define eps 1e-7
#define maxi 100005
long long  h[maxi];
long long hi[maxi];
long long  n,a,b;
long long in=10000000000;
bool C(long long  x){
    long long t=x;
    for(long long i=0;i<n;i++)
        hi[i]=h[i];
    for(long long i=0;i<n;i++){
        hi[i]-=x*b;
        if(hi[i]<=0) continue;
        long long y;
        if(hi[i]%(a-b)==0)
          y=hi[i]/(a-b);
        else
            y=hi[i]/(a-b)+1;
        t-=y;
    }
    if(t>=0) return true;
    return false;
}
void solve(){
    sort(h,h+n);
long long  lb=0,ub=in;
   while(ub-lb>1){
        long long mid=(lb+ub)/2;
        //cout<<mid<<" "<<C(mid)<<" "<<ub<<endl;
        if(C(mid)) ub=mid;
        else  lb=mid;
        //cout<<lb<<" "<<ub<<endl;
    }
    cout<<ub<<endl;
}
int main()
{
           scanf("%d%d%d",&n,&a,&b);
   for(int i=0;i<n;i++)  scanf("%d",&h[i]);
  solve();
   return 0;
}


Measured memory_bytes: 1792
unittest
{
	assert( [ "6 3 4", "3", "1", "3", "2" ].parse.expand.solve == "No\nNo\nYes\nNo\nNo\nNo" );
	assert( [ "6 5 4", "3", "1", "3", "2" ].parse.expand.solve == "Yes\nYes\nYes\nYes\nYes\nYes" );
	assert( [ "10 13 15", "3", "1", "4", "1", "5", "9", "2", "6", "5", "3", "5", "8", "9", "7", "9" ].parse.expand.solve == "No\nNo\nNo\nNo\nYes\nNo\nNo\nNo\nYes\nNo" );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nkq = input.front.split.to!( long[] );
	auto as = new long[ nkq[ 2 ] ];
	foreach( ref a; as )
	{
		input.popFront;
		a = input.front.to!( long );
	}
	as[] -= 1;
	return tuple( nkq[ 0 ], nkq[ 1 ], as );
}

auto solve( long n, long k, long[] as )
{
	auto ps = new long[ n ];
	foreach( a; as )
	{
		ps[ a ]++;
	}
	
	auto anss = new string[ n ];
	foreach( ref ans, p; lockstep( anss, ps ) )
	{
		ans = ( 0 < k + p - as.length.signed ) ? "Yes" : "No";
	}
	return anss.join( "\n" );
}


Measured memory_bytes: 5372
#include<cstdio>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

ll extgcd(ll a, ll b, ll& x, ll& y) {
  ll d = a;
  if (b != 0) {
    d = extgcd(b, a % b, y, x);
    y -= (a / b) * x;
  } else {
    x = 1; y = 0;
  }
  return d;
}

ll mod_inverse(ll a, ll m) {
  ll x, y;
  extgcd(a, m, x, y);
  return (m + x % m) % m;
}

ll fact[300000];

ll nCk(ll n, ll k, ll p) { // mod is too large
  if (n < 0 || k < 0 || n < k) return 0;
  ll a1 = fact[n], a2 = fact[k], a3 = fact[n-k];
  return a1 * mod_inverse((a2 * a3) % p, p) % p;
}


ll n, m, k;

ll getNumber(ll n, ll m, ll k) {
  ll ans = 0;
  for (ll i = 0; i <= k; i++) {
    ll A = n + m + 2 * k, B = n + i, C = i, D = m + k - i, E = k - i;
    ll temp = nCk(A, B, mod);
    temp = (temp * nCk(A-B, C, mod)) % mod;
    temp = (temp * nCk(A-B-C, D, mod)) % mod;
    temp = (temp * nCk(A-B-C-D, E, mod)) % mod;
    ans = (ans + temp) % mod;
  }
  return ans;
}

int main() {
  scanf("%lld%lld%lld", &n, &m, &k);
  fact[0] = 1;
  for (ll i = 1; i < 300000; i++) {
    fact[i] = (fact[i-1] * i) % mod;
  }
  ll ans = getNumber(n, m, k);
  ans = (ans - getNumber(n+2, m, k-1) + mod) % mod;
  ans = (ans - getNumber(n, m+2, k-1) + mod) % mod;
  ans = (ans + getNumber(n+2, m+2, k-2)) % mod;
  printf("%lld\n", ans);
}



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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
using vld = vector<ld>;
using vvld = vector<vld>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
const long long INF = 1LL << 60;

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

  ll a, b;
  cin >> a >> b;
  cout << a * b << endl;

  return 0;
}


Measured memory_bytes: 3648
/*--------------------------*/
// p.119
// 5.2 線形探索
//
// ALDS1_4_A: Linear Search
//
// 配列Aに含まれる，配列Sの要素の個数を出力するプログラム
//
// 入力例:
//     5 (n)
//     1 2 3 4 5 (A: nコの配列)
//     3 (q)
//     3 4 1 (T: qコの配列)
// 出力例:
//     3
//
/*--------------------------*/

#include<stdio.h>

// 線形探索
int linearSearch(int A[], int n, int key){
    int i = 0;
    A[n] = key; // 配列Aの末尾要素を「番兵」としてkeyにする．
    while(A[i] != key) i++;
    return i != n;
}


int main(){
    int i, n, A[10001], q, key;
    int sum = 0;

    scanf("%d", &n);
    for(i = 0 ; i < n ; i++){
        scanf("%d", &A[i]);
    }

    scanf("%d", &q);
    for(i = 0 ; i < q ; i++){
        scanf("%d", &key);
        if (linearSearch(A, n, key)){
            sum++; // 配列Aにkeyがあれば，sumをインクリメント
        }
    }

    printf("%d\n", sum); // 配列Aに含まれる，配列Sの要素の個数を出力する
    return 0;
}


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

int main() {
  ll n,k,ans=0;
  cin >> n >> k;
  vector<ll> h(n);
  REP(i,n) cin >> h[i];
  sort(h.begin(),h.end(),greater<int>());
  for (int i = k; i < n; i++) ans+=h[i];
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <unordered_map>
#include <cmath>
#include <algorithm>

typedef long long ll;
typedef long double ld;

using namespace std;
int main()
{
  int n;
  cin >> n;
  for (int i = 1; i < 10; ++i)
    for (int j = 1; j < 10; ++j)
      if (i * j == n)
      {
        cout << "Yes";
        return 0;
      }
  cout << "No";
}


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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

int a, b, c;
int main() {
    cin >> a >> b >> c;
    int d = a * 100 + b * 10 + c;
    if (d % 4 == 0)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}


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

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

    string s = to_string(n);

    if (s[1] == s[2]) {
        if (s[0] == s[1] || s[2] == s[3]) {
            cout << "Yes";
        } else {
            cout << "No";
        }
    } else {
        cout << "No";
    }

    return 0;
}


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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> copy(n);
    rep(i, n)
    {
        cin >> a[i];
        copy[i] = a[i];
    }
    sort(copy.begin(), copy.end());
    rep(i, n)
    {
        if (a[i] == copy[n - 1])
            cout << copy[n - 2] << endl;
        else
            cout << copy[n - 1] << endl;
    }
    return 0;
}


Measured memory_bytes: 3200
#include <stdio.h>

int main(void)
{
	int game_no;
	int base;
	int out;
	int point;
	char event[9];
	
	scanf("%d", &game_no);
	
	while (game_no--){
		point = base = out = 0;
		
		while (out - 3){
			scanf("%7s", event);
			if (event[0] == 'H'){
				if (++base > 3){
					point++;
					base = 3;
				}
				if (event[1] == 'O'){
					point += base;
					base = 0;
				}
			}
		  	else out++;
		}
		printf("%d\n", point);
	}
	return (0);
}

Measured memory_bytes: 0
#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
int main()
{   
	int a,b,c;
	int x,y;

	cin>>a>>b>>c;

	x=a;
    a=b;
	b=x;
		
	y=a;
	a=c;
	c=y;


	cout<<a<<" "<<b<<" "<<c;


	//system ("pause");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b;
  cin>>a>>b;
  int ans=a;
  int i=1;
  while(ans<b)
  {
      ans+=(a-1);
      i++;
  }
  if(b==1)
    cout<<0;
  else
  cout<<i;
}


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

const ll mod = 1e+9 + 7;

ll power(ll a, ll x){
    if(x == 0) return 1;
    if(x % 2) return a * power(a * a % mod, x / 2) % mod;
    else return power(a * a % mod, x / 2);
}

ll comb(ll x, ll y){
    ll temp1 = 1, temp2 = 1;
    rep(i, y){
        temp1 = temp1 * (x - i) % mod;
        temp2 = temp2 * (i + 1) % mod;
    }
    return temp1 * power(temp2, mod - 2) % mod;
}

int main(){
    int n, a, b;
    cin >> n >> a >> b;
    ll ans = (power(2, n) - 1 - comb(n, a) - comb(n, b)) % mod;
    if(ans < 0) ans += mod;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
def divisors_num(x):
    foo = 0
    p = 1
    while p * p <= x:
        if x % p == 0:
            q = x / p
            if p != q:
                foo += 2
            else:
                foo += 1
        p += 1
    return foo

def main():
    n = int(raw_input().strip())
    foo = 0
    for k in xrange(1, n + 1, 2):
        if divisors_num(k) == 8:
            foo += 1
    print foo

if __name__ == '__main__':
    main()


Measured memory_bytes: 2568
#include<bits/stdc++.h>
using namespace std;
inline int read(){
    int s=0;
    char ch=getchar();
    while(ch<'0'||ch >'9'){ch=getchar();}
    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=getchar();
    return s;
}
int main(){
	int n(read());
	long long num[n];
	for (int i(0);i<n;++i){
		num[i]=read();
	}
	int i(0),t(0);
	while (!(num[i]&1)){
		num[i]/=2;
		i++;
		if (i==n-1) {i=0;t++;}
	}
	printf("%d\n",t);
	return 0;
}

Measured memory_bytes: 256
def main():
    from sys import setrecursionlimit, stdin
    from os import environ
    from collections import defaultdict, deque, Counter
    # from math import ceil, floor, gcd
    from itertools import accumulate, combinations, combinations_with_replacement
    setrecursionlimit(10**6)
    dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in environ else lambda *x: 0
    input = lambda: stdin.readline().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    P = 10**9+7

    N,K = LMIIS()
    X = LMIIS()


    #left:X[0] right:X[K-1]
    left = 0
    right = K-1
    syaku = X[right] - X[left]
    if abs(X[left]) > abs(X[right]):
        min_time = syaku + abs(X[right])
    else:
        min_time = syaku + abs(X[left])


    for i in range(N-K+1):
        syaku = X[right] - X[left]
        if abs(X[left]) > abs(X[right]):
            min_time = min(min_time, syaku + abs(X[right]))
        else:
            min_time = min(min_time, syaku + abs(X[left]))
        
        left += 1
        right += 1
    
    print(min_time)



    
main()

Measured memory_bytes: 62576
//雪花飄飄北風嘯嘯
//天地一片蒼茫

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl;

#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

ll MAX(ll a){return a;}
ll MIN(ll a){return a;}
template<typename... Args>
ll MAX(ll a,Args... args){return max(a,MAX(args...));}
template<typename... Args>
ll MIN(ll a,Args... args){return min(a,MIN(args...));}

#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

const int MOD=1000000007;

ll qexp(ll b,ll p,int m){
    ll res=1;
    while (p){
        if (p&1) res=(res*b)%m;
        b=(b*b)%m;
        p>>=1;
    }
    return res;
}

ll inv(ll i){
	return qexp(i,MOD-2,MOD);
}

ll fac[1000005];
ll ifac[1000005];

ll nCk(int i,int j){
	return fac[i]*ifac[j]%MOD*ifac[i-j]%MOD;
}

ll fix(ll i){
	i%=MOD;
	
	if (i<0) i+=MOD;
	
	return i;
}

int n;


int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	fac[0]=1;
	rep(x,1,1000005) fac[x]=fac[x-1]*x%MOD;
	rep(x,0,1000005) ifac[x]=inv(fac[x]);
	
	cin>>n;
	n--;
	
	ll prev=0,curr=0;
	ll ans=0;
	
	rep(x,(n+1)/2,0){
		curr=nCk(n-x-1,x)*fac[n-x]%MOD*fac[x]%MOD;
		
		ans=fix(ans+(curr-prev)*(n-x));
		
		//cout<<curr<<endl;
		prev=curr;
	}
	
	cout<<ans<<endl;
}


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

int main(int argc, const char * argv[]) {
    int N;
    int W[101];
    int i, j;
    int R=0, L=0;
    
    cin >> N;
    for(i=0; i<N; i++){
        cin >> W[i];
    }
    
    i=0;
    j=0;
    L += W[i];
    R += W[N-1-j];
    
    while(i+j < N-2){
        if(L <= R){
            i++;
            L += W[i];
        } else {
            j++;
            R += W[N-1-j];
        }
    }
    
    cout << abs(R-L) << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
using namespace std;


int rnk[500001], par[500001];

int fnd(int a) {
    if (par[a] == a) {
        return a;
    }

    par[a] = fnd(par[a]);
    return par[a];
}

void un(int a, int b) {
    int paa = fnd(a);
    int pab = fnd(b);
    if (paa == pab) {
        return;
    }

    if (rnk[paa] >= rnk[pab]) {
        par[pab] = paa;
        rnk[paa] = (rnk[paa] == rnk[pab] ? rnk[paa] + 1 : rnk[paa]);
    }

    else {
        par[paa] = pab;
    }

}

int main() {
//    cout << setprecision(30);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n, m;
    cin >> n >> m;
    memset(rnk, 0, sizeof rnk);
    for (int i = 1; i <= n; i++) {
        par[i] = i;
    }

    unordered_set<int> just;
    int x, y, z;
    while (m--) {
        cin >> x >> y >> z;
        un(x, y);
    }

    for (int i = 1; i <= n; i++) {
        just.insert(fnd(i));
    }

    cout << just.size();

}


Measured memory_bytes: 6692
// Confessions of a Dangerous Mind

//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

/*
	"We know what we are, but know not what we may be."
*/

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

const long long N = 2e5 + 7;
const int M = 1e6 + 7;
const long long MOD = 1e6 + 7;
const long long INF = 1e18 + 9;
const int SM = 1e3 + 5;
const int logN = 20, BL = 400;
const double EPS = 1e-9;

/*
	"You never know how strong you are until being strong is the only choice you have."
*/

int main(){
//  freopen(".in", "r", stdin);
//  freopen(".out", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

/*
	"With self-discipline most anything is possible."
*/	
	
	string s; cin >> s;
	if(s[2] == s[3] && s[4] == s[5]) cout << "Yes";
	else cout << "No";	

	return 0;
}

/*
	"Reach for it. Push yourself as far as you can."
*/

Measured memory_bytes: 256
def comb(n,m,p=10**9+7):
    if n < m : return 0
    if n < 0 or m < 0:return 0
    m = min(m, n-m)
    top = bot = 1
    for i in range(m):
        top = top*(n-i) % p
        bot = bot*(i+1) % p
    bot = pow(bot, p-2, p)
    return top*bot % p

x,y = map(int, input().split())

j = 2*x-y
if j%3:
    print(0)
    exit()
j //= 3
i = x - 2*j
if i<0 or j<0:
    print(0)
    exit()

ans = comb(i+j,i)
print(ans)

Measured memory_bytes: 38512
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

int main(void){

    int n;

    cin >> n;

    pair<pair<string, int>, int> shop[110];

    for(int i = 0;i < n;i++){
        string name; int point;
        cin >> name >> point;
        shop[i] = make_pair(make_pair(name, -point), i);
    }

    sort(shop, shop+n);

    for(int i = 0;i < n;i++){
        cout << shop[i].second+1 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MN = 30005;
#define pb push_back
#define pii pair<int,int>

int t;
int n,m;
pii A[MN];
int f[MN];
int main()
{
	memset(f,0,sizeof f);
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i) scanf("%d%d",&A[i].first,&A[i].second);
	sort(A+1,A+1+n);
//	sort(A+1,A+1+n,[](pii x,pii y){if(x.first==y.first) return x.second>y.second; return x.first<y.first;});
//	for(int i=1;i<=n;++i) printf("(%d,%d,%d)\n",i,A[i].first,A[i].second);
	for(int i=1;i<=n;++i)
	{
		int a = A[i].first, b = A[i].second;
		for(int j=m-1;j>=0;--j)
		{
			f[j+a] = max(f[j+a],f[j]+b);
		}
	}
	int ans = 0;
	for(int i=0;i<6001;++i) 
	{
		ans = max(ans,f[i]);
//		printf("%d\n",f[i]);
	}
	printf("%d\n",ans);
}

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

const ll MOD = 1000000007;

ll fact(ll num) {
  ll res = 1;

  for (int i = 2; i <= num; i++) {
    res = res * i % MOD;
  }

  return res;
}

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

  ll n, m;
  cin >> n >> m;

  ll diff = abs(n - m);

  ll ans;
  if (diff > 1) {
    ans = 0;
  } else {
    ans = fact(n) % MOD * fact(m) % MOD;
  }

  if(n == m) {
    ans = ans * 2 % MOD;
  }

  cout << ans << endl;

  return 0;
}

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

#define _FOREVER 1

int main(void) {
	int  N,i,len;
	char S[10000+1];

    scanf("%d ",&N);
    scanf("%s",S);
    len=strlen(S);
	for(i=0;i<len;i++) {
		S[i]+=(char)N;
		printf("%c",S[i]>'Z'?S[i]-26:S[i]);
	}

return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define LB(c, x) lower_bound(c.begin(), c.end(), x)
#define UB(c, x) upper_bound(c.begin(), c.end(), x)
#define LI(c, x) distance(c.begin(), LB(c, x))
#define UI(c, x) distance(c.begin(), UB(c, x))

// functions
template <class T> T ceil(T a, T b) {
    return (a + b - 1) / b;
}
template <class T> T round(T a, T b) {
    return (a + b / 2) / b;
}
template <class T> T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T> T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}
template <class T> bool amax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
ll modpow(ll a, ll b, ll m) {
    if (b == 0) {
        return 1;
    } else if (b % 2 == 0) {
        ll h = modpow(a, b / 2, m);
        return h * h % m;
    } else {
        return a * modpow(a, b - 1, m) % m;
    }
}
ll comb(ll a, ll b, ll m) {
    if (b > a - b) {
        return comb(a, a - b, m);
    }
    ll c = 1, d = 1;
    REP(i, b) {
        c *= (a - i);
        d *= (b - i);
        c %= m;
        d %= m;
    }
    return c * modpow(d, m - 2, m) % m;
}

// main
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B;
    cin >> A >> B;
    cout << max({A + B, A - B, A * B}) << endl;
    return 0;
}


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

using namespace std;

int t , b , s;
string x;

int main()
{
	cin >> x;
	for(int i = 0 ; i < x.size() ; i++)
	{
		t = x[i] - '0';
		s += t;
		b *= 10;
		b += t;
	}
	if(b % s == 0)
		cout << "Yes";
	else
		cout << "No";
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var A, B, K int
	fmt.Scanf("%d %d %d", &A, &B, &K)

	m := A
	if B < m {
		m = B
	}

	n := 0
	for i := m; i > 0; i-- {
		if A%i == 0 && B%i == 0 {
			n++
			if n == K {
				fmt.Println(i)
				return
			}
		}
	}
}


Measured memory_bytes: 512
import itertools

def main():
    N = int(input())
    D = list(map(int, input().split()))

    ans = 0
    for i in range(N):
        for j in range(i+1, N):
            ans += (D[i] * D[j])
    print(ans)
    return 0
if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

string s;
int k;
int dp[110][2][4];

signed main() {
	cin >> s >> k;
	dp[0][0][0] = 1;
	for (int i = 1; i <= (int)s.size(); i++) {
		int x = s[i - 1] - '0';
		if (!x) {
			dp[i][0][0] = dp[i - 1][0][0];
			dp[i][0][1] = dp[i - 1][0][1];
			dp[i][0][2] = dp[i - 1][0][2];
			dp[i][0][3] = dp[i - 1][0][3];
		}
		else {
			dp[i][0][0] = 0;
			dp[i][0][1] = dp[i - 1][0][0];
			dp[i][0][2] = dp[i - 1][0][1];
			dp[i][0][3] = dp[i - 1][0][2];
			dp[i][1][0] += dp[i - 1][0][0];
			dp[i][1][1] += dp[i - 1][0][1] + dp[i - 1][0][0] * (x - 1);
			dp[i][1][2] += dp[i - 1][0][2] + dp[i - 1][0][1] * (x - 1);
			dp[i][1][3] += dp[i - 1][0][3] + dp[i - 1][0][2] * (x - 1);
		}
		dp[i][1][0] += dp[i - 1][1][0];
		dp[i][1][1] += dp[i - 1][1][1] + dp[i - 1][1][0] * 9;
		dp[i][1][2] += dp[i - 1][1][2] + dp[i - 1][1][1] * 9;
		dp[i][1][3] += dp[i - 1][1][3] + dp[i - 1][1][2] * 9;
	}
	cout << dp[(int)s.size()][0][k] + dp[(int)s.size()][1][k] << endl;
}

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


int main(){
  int64_t n,a;
  a = 0;
  cin >> n;
  for (int i=0; i<n+1; i++){
    if(i%3!=0){
      if(i%5!=0){
        a += i;
      }


      }

  }
  cout << a << endl;


}

Measured memory_bytes: 3636
a, b, c = map(int, raw_input().split())
if a == 5 and b == 5 and c == 7:
    print "YES"
elif a == 5 and b == 7 and c == 5:
    print "YES"
elif a == 7 and b == 5 and c == 5:
    print "YES"
else:
    print "NO"

Measured memory_bytes: 2568
import java.io.PrintWriter
import java.util.*
import java.math.*
import java.lang.*

val pw = PrintWriter(System.out)
val MOD: Long = (1e+9 + 7).toLong()

fun main(args: Array<String>) {
    val n = readInt() 
    val a = readListOfLong()
    var x = a[0]
    var y = a.slice(1 until n).sum()
    var tmpX = x
    var tmpY = y
    for(i in 1 until n-1) {
        tmpX += a[i] 
        tmpY -= a[i]
        val abs = Math.abs(x-y)
        val tmpAbs = Math.abs(tmpX - tmpY)
        if(abs > tmpAbs) {
            x = tmpX
            y = tmpY
        }
    }
    println(Math.abs(x-y))
    pw.flush()
}

/****** Declared Functions and Data Structures ******/
// IO
fun read() = readLine()!!
fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readDouble() = read().toDouble()
fun readListOfString() = read().split(" ")
fun readListOfInt() = readListOfString().map { it.toInt() }
fun readListOfLong() = readListOfString().map { it.toLong() }
fun readListOfDouble() = readListOfString().map { it.toDouble() }

fun Double.format(digits: Int) = String.format("%.${digits}f", this)
fun Float.format(digits: Int) = String.format("%.${digits}f", this)

fun print(value: Any) { pw.print(value) }
fun println(value : Any) { pw.println(value) }

fun<T> permutations(src: List<T>): List<List<T>> {
    if(src.size == 1) return listOf(src)
    val perms = mutableListOf<List<T>>()
    val insertElement = src[0]
    permutations(src.drop(1)).forEach { perm ->
        for(i in 0..perm.size) {
            val newPerm = perm.toMutableList()
            newPerm.add(i, insertElement)
            perms.add(newPerm.toList())
        }
    }
    return perms
}

// return nCr, if you want nCr, please access v[n][r]
fun combinations(n: Long): List<List<Long>> {
    val v = (0..n).map { (0..n).map{0L}.toMutableList() }.toMutableList()
    for(i in 0 until v.size) {
        v[i][0] = 1L
        v[i][i] = 1L
    }
    for(i in 0 until v.size) {
        for(j in 1 until i) {
            v[i][j] = (v[i-1][j-1] + v[i-1][j] % MOD)
        }
    }
    return v.map { it.toList() }.toList()
}

// should be a >= b
fun gcd(a: Long, b: Long): Long = 
    if(b == 0L) a else gcd(b, a % b)

// shoud be a >= b
fun lcm(a: Long, b: Long): Long = 
    a / gcd(a, b) * b

fun sumDigits(num_: Long): Long {
    var num = num_
    var rtn: Long = 0
    while(num != 0.toLong()) {
        val tmp = num % 10
        rtn += tmp
        num /= 10
    }
    return rtn
}

fun isDecimal(v: Double): Boolean = ((v - Math.floor(v)) != 0.0)

// Data Structures
class Stack<T>(private var st: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = st.isEmpty()
    fun top(): T = st.last()
    fun push(e: T) { st.add(e) }
    fun pop() { st = st.dropLast(1).toMutableList() }
}

class Queue<T>(private var que: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = que.isEmpty()
    fun top(): T = que.first()
    fun push(e: T) { que.add(e) }
    fun pop() { que = que.drop(1).toMutableList() }
}


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

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

	long L, R; cin >> L >> R;
	if (L % 2019 + R - L > 2018) {
		cout << 0;
		return 0;
	}
	int ans = 2019;
	L %= 2019;
	R %= 2019;
	for (int i = L; i <= R;i++) {
		for (int j = i + 1; j <= R; j++) {
			ans = min(ans, i * j % 2019);
		}
	}
	cout << ans;
}

Measured memory_bytes: 256
#整数を入力
a,b,h,m = map(int,input().split())
#mathモジュールをインポート
import math
#時針の回転角x_h
x_h = ((h/12)+(m/60/12))*2*math.pi
#短針の回転角x_m
x_m = (m/60)*2*math.pi
#時針と短針のなす小さい方の角x
x = x_h-x_m
if x < 0:
  x *= -1
if x > math.pi:
  x = 2*math.pi-x
#余弦定理より求める長さc
c = math.sqrt(a**2+b**2-2*a*b*math.cos(x))
print('{:.10f}'.format(c))

Measured memory_bytes: 9528
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
/* I REALLY HOPE MY WISH REACH YOU , ATCODER'S ONLINE JUDGE */
#define WOULD
#define YOU
#define PLEASE
#define ACCEPT
#define MY
#define SUBMISSION
/* I REALLY HOPE MY WISH REACH YOU , ATCODER'S ONLINE JUDGE */
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const long long INF = 100100100100;
const long long MOD = 1000000007;
typedef pair<double,int> P;
//NのM乗を求める(繰り返し二乗法)
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}
long long nCr(long long n, long long r) {
    long long A = 1, B = 1;
    //Aが分子Bが1/r!
    for (long long i = n - r + 1; i <= n; i++) {
        A = A * i % MOD;
    }
    for (long long i = 1; i <= r; i++) {
        B = B * i % MOD;
    }
    B = mod_pow(B, MOD - 2);
    B %= MOD;
    //Bは割るのではなく掛ける
    return (A * B) % MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
 
long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

//long long A,B;
bool ok(long long key,long long index){
    if(index > key) return true;
    else if(index <= key) return false;
}
long long binary_search(long long key,long long size){
    //left,right,midはいずれもindex
    long long left = -1,right = size;
    while(right - left > 1){
        long long mid = left + (right-left)/2;
        long long hantei = ok(key,mid);
        if(hantei) right = mid;
        else left = mid;
    }
    if(left == -1)return 0;
    return left;
}

int main() {
    int A,B,C,D,E;cin >> A >> B >> C >> D >> E;
    vector<int> retu{A,B,C,D,E};
    sort(retu.begin(),retu.end());
    int ans = 11451419;
    int time = 0;
    do{
        for(int i = 0;i<5;i++){
            if(retu.at(i)%10 == 0 || i == 4) time += retu.at(i);
            else time += retu.at(i) + 10-(retu.at(i)%10);
        }
        ans = min(ans,time);
        time = 0;
    }
    while(next_permutation(retu.begin(),retu.end()));

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;

int main(){
	int D; cin>>D;
	vector<int> cs(26);
	vector<vector<int>> s(D,vector<int> (26));
	vector<int> last(26,-1);
	rep(i,26)cin>>cs[i];
	rep(i,D)rep(j,26)cin>>s[i][j];
	ll sum = 0;

	vector<int> ans(D);
	rep(d, D){
		int m_type;
		ll m_plus = -INF;
		rep(t, 26){
			int e_ans = s[d][t];
			rep(k, 26){
				if(t == k)continue;
				e_ans -= cs[k] * (d - last[k]);
			}
			if(sum + e_ans > m_plus){
				m_plus = sum + e_ans;
				m_type = t;
			}
		}
		sum = m_plus;
		ans[d] = m_type + 1;
	}
	rep(i,D)cout<<ans[i]<<endl;
	return 0;
}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++) 
#define all(v) begin(v),end(v)
using ll = long long;

int main() {
  string a,b;cin>>a>>b;
  if(a.size()==b.size()){
    rep(i,a.size())cout<<a[i]<<b[i];
    cout<<endl;
  }
  else {
    rep(i,b.size())cout<<a[i]<<b[i];
    cout<<a[a.size()-1]<<endl;
  }
}

Measured memory_bytes: 3616
#include <iostream>
#include <string>

using namespace std;

int main(int argc, char const *argv[])
{
    string S;
    cin >> S;

    string ans;
    if (S == "Sunny")
    {
        ans = "Cloudy";
    }else if(S == "Cloudy")
    {
        ans = "Rainy";
    }else if (S == "Rainy")
    {
        ans = "Sunny";
    }
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int a;
	int b;
	
	scanf("%d", &a);
	scanf("%d", &b);

	if (a < b)
		printf("a < b\n");
	if (a > b)
		printf("a > b\n");
	if (a == b)
		printf("a == b\n");


	return 0;
}

Measured memory_bytes: 1012
#include <bits/stdc++.h>
#define mem(ar,num) memset(ar,num,sizeof(ar))
#define me(ar) memset(ar,0,sizeof(ar))
#define lowbit(x) (x&(-x))
#define Pb push_back
#define  FI first
#define  SE second
#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 IOS ios::sync_with_stdio(false)
#define DEBUG cout<<endl<<"DEBUG"<<endl; 
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int    prime = 999983;
const int    INF = 0x7FFFFFFF;
const LL     INFF =0x7FFFFFFFFFFFFFFF;
const double pi = acos(-1.0);
const double inf = 1e18;
const double eps = 1e-6;
const LL     mod = 998244353;
LL qpow(LL a,LL b){LL s=1;while(b>0){if(b&1)s=s*a%mod;a=a*a%mod;b>>=1;}return s;}
LL gcd(LL a,LL b) {return b?gcd(b,a%b):a;}
int dr[2][4] = {1,-1,0,0,0,0,-1,1};
typedef pair<int,int> P;
const int maxn = 2e5+10;
// int x[maxn],y[maxn];
struct Point{
	int x,y;
	// Point (int x = 0,int y = 0)
};
Point p[maxn];
bool operator <(const Point &a,const Point &b){
	return  a.x < b.x;
}
LL sum[maxn];
int s[maxn],pre[maxn];
int x[maxn],y[maxn];
LL tree[maxn];
void Add(int x,int p){
	for(;x < maxn; x += lowbit(x))
		tree[x] += p;//,x += lowbit(x);
}
LL Sum(int x){
	LL sum = 0;
	for(;x > 0; x -= lowbit(x))
		sum += tree[x];
	return sum;
}
LL pow2[maxn];
int A[maxn],B[maxn];
inline void Add(LL &a,LL b){
	a += b;
	while(a >= mod)
		a -= mod;
	while(a < 0)
		a += mod;
}
int main(void)
{
	pow2[0] = 1;
	for(int i = 1;i < maxn; ++i)
		pow2[i] = pow2[i-1]*2%mod;
	// cout<<pow2[10]<<endl;
	int n;cin>>n;
	for(int i = 1;i <= n;++i)
		cin>>p[i].x>>p[i].y,x[i]= p[i].x,y[i] = p[i].y;
	sort(p+1,p+n+1);
	sort(y+1,y+n+1);
	int N = unique(y+1,y+n+1)-y-1;
	for(int i = 1;i <= n;++i)
		{
			p[i].x = i,p[i].y = lower_bound(y+1,y+N+1,p[i].y)-y;
		}
	LL ans = n*(pow2[n]-1)%mod;
	for(int i = 1;i <= n; ++i){
		A[i] = Sum(p[i].y);
		Add(p[i].y,1);
	}
	me(tree);
	for(int i = n;i >= 1; --i){
		B[i] = Sum(p[i].y);
		Add(p[i].y,1);
	}
	for(int i = 1;i <= n; ++i){
		LL tmp = pow2[i-1]+pow2[n-i]+pow2[p[i].y-1]+pow2[n-p[i].y]-pow2[A[i]]-pow2[i-A[i]-1]-pow2[n-i-B[i]]-pow2[B[i]];
		tmp %= mod;
		Add(ans,-tmp);
		// A[i]    n-i-B[i]
		// i-A[i]-1	B[i]
	}


	cout<<(ans%mod+mod)%mod<<endl;
    
    

   return 0;
}

Measured memory_bytes: 11264
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <limits>
#include <algorithm>
#include <queue>
#include <set>
#include <unordered_map>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <stack>
#include <string>
#include <functional>
using namespace std;

using i64 = long long int;
using ui64 = unsigned long long int;

using P = pair<int, int>;

constexpr int INF = (1 << 30);
constexpr i64 INF64 = (1LL << 60);
constexpr int MOD = 1000000000 + 7;

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

template <typename T, typename U>
static inline std::vector<U> makeNdVector(T n, U val) noexcept {
   static_assert(std::is_integral<T>::value, "[makeNdVector] 1st argument must be an integer type");
   return std::vector<U>(std::forward<T>(n), std::forward<U>(val));
}

template <typename T, typename ...Args>
static inline decltype(auto) makeNdVector(T n, Args... args) noexcept {
   static_assert(std::is_integral<T>::value, "[makeNdVector] 1st argument must be an integer type");
   return std::vector<decltype(makeNdVector(std::forward<Args>(args)...))>(std::forward<T>(n), makeNdVector(std::forward<Args>(args)...));
}

template <typename T>
void print(vector<T> vec)
{
   for (auto &e : vec)
      cout << e << " ";
   cout << endl;
}

template <typename T>
T gcd(T x, T y) {
   if (x == 0 || y == 0) return 0;
   T r;
   while ((r = x % y) != 0) {
      x = y;
      y = r;
   }
   return y;
}

template <typename T>
T lcm(T x, T y) {
   if (x == 0 || y == 0) return 0;
   return (x / gcd(x, y) * y);
}

int next_combination(int sub)
{
   int x = sub & -sub, y = sub + x;
   return (((sub & ~y) / x) >> 1) | y;
}

std::uint64_t combination(int n, int r) {
   if (n < 0 || r < 0) return 0;
   if (n < r) return 0;
   std::uint64_t k = 1;
   for (std::uint64_t d = 1; d <= r; ++d) {
      k *= n--;
      k /= d;
   }
   return k;
}

bool check(string str) {
	for (int i = 0; i < str.length() / 2; ++i) {
		if (str[i] != str[str.length() - 1 - i]) {
			return false;
		}
	}
	return true;
}


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	using P = pair<i64, i64>;

	vector<string> G(12);

	while (cin >> G[0]) {
		for (int i = 1; i < 12; ++i) cin >> G[i];

		map<P, int> used;
		int ans = 0;
		for (int i = 0; i < 12; ++i) {
			for (int j = 0; j < 12; ++j) {
				if (used[P(i, j)]) continue;
				if (G[i][j] == '0') continue;
				ans++;
				stack<P> S;
				S.emplace(i, j);
				while (!S.empty()) {
					int y, x;
					tie(y, x) = S.top();
					S.pop();
					for (int k = 0; k < 4; ++k) {
						int ny = y + dy[k], nx = x + dx[k];
						if (ny < 0 || ny >= 12 || nx < 0 || nx >= 12 || G[ny][nx] == '0') continue;
						if (used[P(ny, nx)]) continue;
						used[P(ny, nx)] = 1;
						S.emplace(ny, nx);
					}
				}
			}
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 3164