akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
using namespace std;

int main(){
  string S;
  cin >> S;
  int input[4], N;
  N = S.size();
  input[0] = S[0] - '0';
  input[1] = S[1] - '0';
  input[2] = S[2] - '0';
  input[3] = S[3] - '0';
  string op1, op2, op3;
  
  for(int i=0;i<(1<<N-1);i++){
    long int acc = input[0];
    for(int j=0;j<N-1;j++){
      if((1 & (i>>j)) == 0){
        acc += input[j+1];
        if(j==0) op1 = "+";
        else if(j==1) op2 = "+";
        else op3 = "+";
      }else{
        acc -= input[j+1];
        if(j==0) op1 = "-";
        else if(j==1) op2 = "-";
        else op3 = "-";
      }
    }
    if(acc == 7) break;
  }
  cout << input[0] << op1 << input[1] << op2 << input[2] << op3 << input[3] << "=" << 7 << endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		int K = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();

		if (A % K == 0) {
			System.out.print("OK");
		} else if (B % K == 0) {
			System.out.print("OK");
		} else if ((A / K + 1) * K < B) {
			System.out.print("OK");
		} else {
			System.out.print("NG");
		}
		
	return;

	}
}


Measured memory_bytes: 27000
#include <bits/stdc++.h>
using namespace std;
#define ALL(A) (A).begin(),(A).end()
#define ll long long
const ll mod = 1e9+7;
const ll INF = 2*1e18;
const int inf = 1e9+7;
int sz = 2e5+5;
vector<ll> bit(sz+1);

int lowbit(int x){
	return x&-x;
}
void add(int x,int w){
	for(int i=x;i<=sz;i += lowbit(i)){
		bit[i] += w;
	}
}
ll sum(int x){
	ll ret = 0;
	for(int i=x;i>0;i-=lowbit(i)){
		ret += bit[i];
	}
	return ret;
}
int search_small(int index){
	ll x = sum(index);
	ll ok = -1;
	ll ng = index;
	while(abs(ok-ng)>1){
		int mid = (ok+ng)/2;
		if(sum(mid)<x)ok = mid;
		else ng = mid;
	}
	return ok;
}
int search_big(int index){
	ll ok = sz;
	ll ng = index;
	while(abs(ok-ng)>1){
		int mid = (ok+ng)/2;
		if(sum(mid)>sum(index))ok = mid;
		else ng = mid;
	}
	return ok;
}
int main(void){
	int N;
	cin >> N ;
	vector<ll> pos(N+1);
	for(int i=1;i<=N;i++){
		int a;
		cin >> a;
		pos[a] = i;
	}
	ll ans = 0;
	for(int i=1;i<=N;i++){
		int nowpos = pos[i];
		int cases = 0;
		int s1 = search_small(nowpos);
		int b1 = search_big(nowpos);
		b1 = min(b1,N+1);
		//cout << "nowpos = " << nowpos;
		//cout << " s1 = " << s1  << " b1 = " << b1 << endl;
		ans += (ll)i * (nowpos - s1 - 1) * (b1 - nowpos);
		add(nowpos,1);
	}
	cout << ans << endl;
}

Measured memory_bytes: 3328
# -*- coding: utf-8 -*-
data = input();
Indata = [];
fg = 0;
for lop in range(3):
    if data[lop] == 'a' or data[lop] == 'b' or data[lop]== 'c':
        if not(lop == 0):   
            for lop2 in range(lop):
                if Indata[lop2] == data[lop]:
                    fg = 1;
        Indata.append(data[lop]);
    else:
        fg = 1;
    if fg == 1:
        break;

if fg == 1:
    print("No\n");
else:
    print("Yes\n");

Measured memory_bytes: 3064
while True:
    n, m = map(int, raw_input().split())
 
    if n == 0 and m == 0:
        break
 
    a = map(int, raw_input().split())
 
    ans = -1
 
    for i in range(n-1):
        for j in range(i+1, n):
            if a[i] + a[j] <= m:
                ans = max(ans, a[i] + a[j])
 
    print "NONE" if ans == -1 else ans


Measured memory_bytes: 4708
#pragma region includes, macros
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <map>
#include <set>
#include <list>
#include <unordered_set>
#include <unordered_map>
#include <stdlib.h>

using namespace std;
 
typedef int64_t i64;
typedef pair<i64, i64> P;

template<class T>
const T INF = numeric_limits<T>::max();
template<class T>
const T SINF = numeric_limits<T>::max() / 10;
static const i64 MOD = 1000000007;

//int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
//int dx[5] = {-1,0,0,0,1}, dy[5] = {0,-1,0,1,0};
//int dx[8] = {-1,0,1,1,1,0,-1,-1}, dy[8] = {1,1,1,0,-1,-1,-1,0};
//int dx[9] = {-1,0,1,1,1,0,-1,-1,0}, dy[9] = {1,1,1,0,-1,-1,-1,0,0};

struct edge {
	i64 from, to, cost;
	edge(i64 to, i64 cost) : from(-1), to(to), cost(cost) {}
	edge(i64 src, i64 to, i64 cost) : from(src), to(to), cost(cost) {}
};

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
	for(auto &e:t) fill_v(e,v);
}
//

#pragma endregion

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	string s1, s2, s3;
	cin >> s1 >> s2 >> s3;
	cout << s1[0] << s2[1] << s3[2] << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>                                                                                               
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define int long long
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;

signed main(){
    int x,a,b;
    cin >> x >> a >> b;
    cout << (x - a) - ((x - a) / b) * b << '\n';
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        // System.out.println("input a number: ");
        int d = sc.nextInt();
        float[] price = new float[d];
        int maxIndx = 0;
        for (int i = 0; i < d; i++) {
            price[i] = sc.nextFloat();
            if (price[maxIndx] < price[i]) {
                maxIndx = i;
            }
        }

        float sum = 0;

        for (int i = 0; i < price.length; i++) {
            sum += price[i];
        }

        sum -= price[maxIndx] / 2.0;
        if (sum % 1 == 0) {
            System.out.println(Math.round(sum));
        }
        else {
            System.out.println(sum);
        }
    }
}

Measured memory_bytes: 23124
import static java.lang.System.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(in);
        String s = sc.next();
		int max = 0;
		int count = 0;
      
		for(char c: s.toCharArray()){
			if(c=='A' || c=='C' || c=='G' || c=='T') {
				count++;
				max = Math.max(max, count);
			}
			else count = 0;
		}
        out.println(max);
    }
}


Measured memory_bytes: 22740
#include<stdio.h>

int main(){
	
	int a,b,x,y,z;
	scanf("%d",&a);
	b = a%10;
	x = a/10;
	y = x%10;
	z = x/10;
	
	if(b == 7){
		printf("Yes");
	}
	else if(y == 7){
		printf("Yes");
	}
	else if(z == 7){
		printf("Yes");
	}
	else{
		printf("No");
	}
	
	return 0;
}

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

int main()
{
vector<int>cnt(4,0);
int n,k;
cin>>n>>k;
vector<bool>dp(k+1,0);
vector<int>a(n);
for(auto &x:a)cin>>x;
for(int i=0;i<=k;i++)
{
for(auto x:a)
{
if(i>=x&&!dp[i-x]){dp[i]=true;}
}
}
if(dp[k])cout<<"First";
else cout<<"Second";
}

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

const ll mod=1e9+7;

ll dp[1000][5][5][5]{0};
ll n;
bool cc(ll a,ll b,ll c,ll d){
    if(b==0 && c==1 && d==2) return false;
    if(b==0 && d==1 && c==2) return false;
    if(a==0 && c==1 && d==2) return false;
    if(c==0 && b==1 && d==2) return false;
    if(a==0 && b==1 && d==2) return false;
    return true;
}

ll solve(ll i,ll a,ll b,ll c){
    // Base Case
    if(i==n){
        return 1;
    }

    if(dp[i][a][b][c]!=-1){
        return dp[i][a][b][c];
    }

    // Rec Case

    ll ans=0;

    // At ith index , s[i]='A'
    if(cc(a,b,c,0))
        ans+=solve(i+1,b,c,0);
        ans%=mod;
    // At ith index , s[i]='G'
    if(cc(a,b,c,1)){
        ans+=solve(i+1,b,c,1);
        ans%=mod;
    }
    // At ith index , s[i]='C'
    // (i) (c,b)==G (ii)(a,b)==A
    if(cc(a,b,c,2)){
        ans+=solve(i+1,b,c,2);
        ans%=mod;
    }
    // At ith index , s[i]='T'
    if(cc(a,b,c,3))
        ans+=solve(i+1,b,c,3);
        ans%=mod;
    return dp[i][a][b][c]=ans;

}   


int main() {

    
    cin>>n;
    memset(dp,-1,sizeof(dp));
    ll ans=(solve(0,4,4,4))%mod;
    ans%=mod;

    cout<<ans<<endl;

}


Measured memory_bytes: 1280
n=int(input())
dis=[10**15]*n
dis[0]=0
pair=[[]for _ in range(n)]
for i in range(n-1):
	a,b,c=map(int,input().split())
	pair[a-1].append([b-1,c])
	pair[b-1].append([a-1,c])
now=0
stack=set()
cnt=n-1
while cnt!=0:
	for i in range(len(pair[now])):
		if dis[pair[now][i][0]]==10**15:
			dis[pair[now][i][0]]=dis[now]+pair[now][i][1]
			stack.add(pair[now][i][0])
	now=stack.pop()
	cnt-=1
for i in range(n):
	if dis[i]%2==0:
		print(0)
	else:
		print(1)



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

int main()
{
  int a, b;
  cin >> a >> b;
  if(a <= 0 && b >= 0) cout << "Zero" << endl;
  else if(a > 0) cout << "Positive" << endl;
  else
  {
    if((b-a)%2==0) cout << "Negative" << endl;
    else cout << "Positive" << endl;
  }

}

Measured memory_bytes: 256
def f(x):
  if x <= 0:
    return 0
  res = ((x + 1) // 2) & 1
  for l in range(1, 40):
    k = 1 << l
    if k > x:
      break
    t = x % (k << 1)
    if t < k or (t - k) & 1 == 1:
      pass
    else:
      res += k
  return res
a, b = map(int, input().split())
print(f(b) ^ f(a - 1))

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<time.h>
#include<climits>
#include<string>
#include<queue>

//#define IONAME "cttf"
//#define E_DEBUG
//#define TIMECOMP

const int md=1e9+7;

int n,m;
char w;
long long dp[1100][1100];

void marota(){
    std::cin>>n>>m;
    dp[1][1]=1;
    for (int i=1;i<=n;i++){
        for (int j=1;j<=m;j++){
            std::cin>>w;
            if (w=='.' && (i!=1 || j!=1) ){
                dp[i][j]=(dp[i-1][j]+dp[i][j-1])%md;
            }
        }
    }   
    std::cout<<dp[n][m]%md;
}

int main(){
    #ifdef TIMECOMP
    clock_t tStart = clock();
    #endif
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(0);
    std::cout.tie(0);
    #if defined(IONAME)
    freopen(IONAME".INP","r",stdin);
    freopen(IONAME".OUT","w",stdout);
    #endif
    marota();
    #ifdef TIMECOMP
    printf("Time taken: %.2fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
    #endif
    return 0;
}

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

int main() {
  int a, b, c;

  cin >> a >> b >> c;

  if (a + b == c || b + c == a || c + a == b) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
X = input().rjust(6,"0")

k = 0
shimo2 = int(X[-2] + X[-1])



for i in range(20):
    if 5*(i+1)<shimo2:
        k = i+2
        continue
    else:
        break

if int(X)<=99:
    print("0")
elif k <= int(X[0:4]):
    print("1")
else:
    print("0")

Measured memory_bytes: 38484
package main

import (
	"fmt"
	"math/rand"
)

func main() {
	var D int
	fmt.Scan(&D)
	cs := make([]int, 26)
	for i := 0; i < 26; i++ {
		fmt.Scan(&cs[i])
	}

	ss := make([][26]int, D)
	for i := 0; i < D; i++ {
		for j := 0; j < 26; j++ {
			fmt.Scan(&ss[i][j])
		}
	}

	ts := make([]int, D)
	for d := 0; d < D; d++ {
		sat := int(-1e9)
		t := 0
		for i := 0; i < 26; i++ {
			ts[d] = i + 1
			s := solve(d+1, ts, cs, ss)
			if sat <= s {
				sat = s
				t = ts[d]
			}
		}
		ts[d] = t
	}

	for i := 0; i < 1000; i++ {
		d := rand.Intn(365)
		q := rand.Intn(25) + 1
		sat1 := solve(D, ts, cs, ss)

		t := ts[d]
		ts[d] = q
		sat2 := solve(D, ts, cs, ss)
		if sat1 < sat2 {
			continue
		}

		ts[d] = t
	}

	for i := 0; i < len(ts); i++ {
		fmt.Println(ts[i])
	}
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func solve(D int, ts []int, cs []int, ss [][26]int) int {
	last := [26]int{}
	sat := 0
	for d := 0; d < D; d++ {
		j := ts[d] - 1
		last[j] = d + 1
		for i := 0; i < 26; i++ {
			sat -= (d + 1 - last[i]) * cs[i]
		}
		sat += ss[d][j]
	}

	return sat
}


Measured memory_bytes: 2560
#include <stdio.h>
#include <string.h>
int main (void)
{
char *p; 
char str[200020];
scanf("%s", str);
for (p = strchr(str, '?'); p!=NULL; p = strchr(p, '?')) 
  *p = 'D';
printf("%s\n", str);
return 0;
}

Measured memory_bytes: 1852
#include <bits/stdc++.h>
#define ll long long
#define ls id << 1
#define rs id << 1 | 1
#define mem(array, value, size, type) memset(array, value, ((size) + 5) * sizeof(type))
#define memarray(array, value) memset(array, value, sizeof(array))
#define pb(x) push_back(x)
#define st(x) (1LL << (x))
#define pii pair<int, int>
#define mp(a, b) make_pair((a), (b))
#define Flush fflush(stdout)
using namespace std;
const int N = 500050;
const int inf = 0x3f3f3f3f;
const ll mod = 998244353LL;
clock_t TIME_START, TIME_END;
void program_end()
{
#ifdef ONLINE
    printf("\nTime used: %.6lf(s)\n", ((double)TIME_END - TIME_START) / CLOCKS_PER_SEC);
    system("pause");
#endif
}
int n;
ll D, A;
struct monsters
{
    ll x, h;
    bool operator<(const monsters &X) const
    {
        return x < X.x;
    }
} a[N];
ll mark[N];

void solve()
{
    scanf("%d%lld%lld", &n, &D, &A);
    for (int i = 1; i <= n; ++i)
        scanf("%lld%lld", &a[i].x, &a[i].h);
    sort(a + 1, a + n + 1);
    int las = 1;
    int i = 1;
    ll ans = 0;
    ll delta = 0;
    while (las <= n)
    {
        while ((a[i + 1].x - a[las].x > 2ll * D || i == n) && las <= n)
        {
            ll cnt = max(0ll, a[las].h / A + (a[las].h % A > 0));
            mark[i] += -cnt * A;
            ans += cnt;
            delta += cnt * A;
            a[las].h -= delta;
            delta += mark[las];
            las++;
            while (las <= n)
            {
                a[las].h -= delta;
                delta += mark[las];
                mark[las] = 0;
                if (a[las].h > 0)
                    break;
                las++;
            }
        }
        i = min(i + 1, n);
    }
    cout << ans << '\n';
}

int main()
{
    TIME_START = clock();
    int Test = 1;
    // cin >> Test;
    while (Test--)
        solve();
    TIME_END = clock();
    program_end();
    return 0;
}

Measured memory_bytes: 7936
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <iterator>

using namespace std;

long long int const LL_MAX = 10000000000000000; // 10^16

int main(){
	
	int A, B, C, D, E;
	
	cin >> A >> B >> C >> D >> E;
	
	int ans;
	
	if(A < 0){
		ans = -A * C + D + B * E;
	}else{
		ans = (B - A) * E;
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 3068
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <algorithm>
#include <set>
#include <string>
#include <queue>

using namespace std;

#define rep(i, N) for(int (i) = 0; (i) < (N); (i) ++)
#define INF (int)1e9;
typedef long long ll;

vector<vector<int>> g;

vector<vector<int>> dist;

void dfs(int prev, int node, int start){
    rep(i, g[node].size()){
        int next = g[node][i];
        if(next != prev){
            dist[start][next] = dist[start][node] + 1;
            dfs(node, next, start);
        }
    }
}

int main(){
    int N;
    cin >> N;
    g = vector<vector<int>>(N);
    dist = vector<vector<int>>(2, vector<int>(N));
    rep(i, N - 1){
        int a, b;
        cin >> a >> b;
        a --;
        b --;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    dfs(-1, 0, 0);
    dfs(-1, N - 1, 1);
    int tmp = 0;
    rep(i, N){
        if(dist[0][i] <= dist[1][i]){
            tmp ++;
        }
    }
    string ans = "Fennec";
    if(tmp <= N / 2){
        ans = "Snuke";
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 14328
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
    int n;
    while(cin>>n,n){
        long long need_time[10100]={0},total_time[10100]={0},total=0;
        for(int i=0;i<n;i++){
            cin>>need_time[i];
        }
        sort(need_time,need_time+n);
        for(int i=1;i<n;i++){
            total_time[i]=need_time[i-1]+total_time[i-1];
            total+=total_time[i];
        }
        cout<<total<<endl;
    }
    return 0;
}

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

using namespace std;

int N;
vector<int> K;
bool input() {
    cin >> N;
    if (N == 0) return false;
    K.resize(N);
    for (int i = 0; i < N; i++) {
        cin >> K[i];
    }
    return true;
}

bool possible() {
    for (int i = 0; i < N; i++) {
        if (K[i] >= 2) return true;
    }
    return false;
}

void solve() {
    if (!possible()) {
        cout << "NA" << endl;
        return;
    }
    int ans = 1;
    for (int i = 0; i < N; i++) {
        if (K[i] == 0) continue;
        ans++;
    }
    cout << ans << endl;
}

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

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

using namespace std;

int main(void) {
    int N;
    cin >> N;
    vector< vector<int> > F(N, vector<int>(10));
    for(int i=0; i<N; i++) {
        for(int j=0; j<10; j++) {
            cin >> F[i][j];
        }
    }
    vector< vector<int> > P(N, vector<int>(11));
    for(int i=0; i<N; i++) {
        for(int j=0; j<11; j++) {
            cin >> P[i][j];
        }
    }

    int ans = INT32_MIN;
    for(int bit=1; bit<(1<<10); bit++) {
        int profit = 0;
        for(int i=0; i<N; i++) {
            int cnt = 0;
            for(int j=0; j<10; j++) {
                if(((bit>>j) & 1) && F[i][j]) {
                    ++cnt;
                }
            }
            profit += P[i][cnt];
        }
        ans = max(ans, profit);
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

const ll mod = 1000000007;

int main() {
    int N;
    cin >> N;
    vector<i_i> data(N, {0,0});

    rep(i, N){
        int a;
        cin >> a;
        data[i] = {a, i};
    }
    sort(data.begin(), data.end());
    for(i_i p: data){
        cout << p.second + 1 << " ";
    }
    cout << endl;
    return 0;
}


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

int main(){
  string S;
  cin>>S;
  
  if(S.size()==0){
    cout<<0<<endl;
  }else{
    int sum=0;
    int n=S.size();
    for(int i=0;i<n-1;i++){
      if((S.at(i)=='W'&&S.at(i+1)=='B')||(S.at(i)=='B'&&S.at(i+1)=='W')){
        sum++;
      }
    }
    cout<<sum<<endl;
  }
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
 
vector<int> to[200005];
vector<int> ans;
void dfs(int v, int p=-1) {
  for (int u : to[v]) {
    if (u == p) continue;
    ans[u] += ans[v];
    dfs(u,v);
  }
}
 
int main() {
  int n, q;
  cin >> n >> q;
  rep(i,n-1) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  ans.resize(n);
  rep(i,q) {
    int p, x;
    cin >> p >> x;
    --p;
    ans[p] += x;
  }
  dfs(0);
  rep(i,n) {
    cout << ans[i] << endl;
  }
  return 0;
}

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

#define INF 2147483647
#define LINF 9223372036854775807
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()

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

int cnt[100002];
int n;

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

	cin>>n;
	REP(i,n) {
		int a; cin>>a;
		if(a>0) cnt[a-1]++;
		cnt[a]++,cnt[a+1]++;
	}
	int ma=0;
	REP(i,100002) ma=max(ma,cnt[i]);
	cout<<ma<<endl;

	return 0;
}


Measured memory_bytes: 640
/*+lmake
 * STD = c++14
 * DEFINE += MDEBUG
 */
// failed to generate code

#include <bits/stdc++.h>
using namespace std;

using LL=long long;
#ifdef DEBUG
     #define debug(args...)            {dbg,args; cerr<<endl;}
#else
    #define debug(args...)              // Just strip off all debug tokens
#endif

struct debugger
{
    template<typename T> debugger& operator , (const T& v)
    {    
        cerr<<v<<" ";    
        return *this;    
    }
} dbg;

#define MAXM (1<<18)
LL a[MAXM+10];
using pii=pair<int,int>;
pair<int,int> x[MAXM+10];
pii merge(const pii& a,const pii& b)
{
	int t[4]={a.first,a.second,b.first,b.second};
	sort(t,t+4);
	return make_pair(t[3],t[2]);
}
int main(){	
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	int m=1<<n;
	for(int i=0; i<m; ++i) {
		cin>>a[i];
	}
	for(int i=0; i<m; ++i) {
		x[i].first=a[i];
	}
	for(int i=0; i<n; ++i) {
		for(int j=0; j<m; ++j) {
			if (j>>i&1) {
				x[j]=merge(x[j],x[j^(1<<i)]);
			}
		}
	}
	int ans=0;
	for(int i=1; i<m; ++i) {
		ans=max(ans,x[i].first+x[i].second);
		cout<<ans<<endl;
	}
}


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

int W,H;
char fie[2][55][55];

bool used[50][50][50][50];
int dx[2][4]={
  {0,1,0,-1},
  {0,-1,0,1}
};
int dy[]={1,0,-1,0};

void move(int &x,int &y,int id,int rl){
  int nx = x + dx[rl][id];
  int ny = y + dy[id];
  if( nx < 0 || ny < 0 || nx >= W || ny >= H ) return;
  if( fie[rl][nx][ny] == '#' ) return;
  x = nx; y = ny;
}


struct state{
  int lx,ly,rx,ry;
};

bool solve(int lx,int ly,int rx,int ry){
  queue<state> q;
  q.push( (state){lx,ly,rx,ry} );
  used[lx][ly][rx][ry] = true;
  while( !q.empty() ){
    state p = q.front(); q.pop();
    lx = p.lx; ly = p.ly; rx = p.rx; ry = p.ry;
    if( fie[0][lx][ly] == '%' && fie[1][rx][ry] == '%' ) return true;
    if( fie[0][lx][ly] == '%' || fie[1][rx][ry] == '%' ) continue;
    for(int i=0;i<4;i++){
      int nlx = lx, nly = ly, nrx = rx, nry = ry;
      move(nlx,nly,i,0);
      move(nrx,nry,i,1);
      if( used[nlx][nly][nrx][nry] ) continue;
      q.push( (state){nlx,nly,nrx,nry} );
      used[nlx][nly][nrx][nry] = true;
    }
  }
  return false;
}

int main(){
  while( cin >> W >> H && (W||H) ){
    int lx,ly,rx,ry;
    memset(used,0,sizeof(used));
    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
	cin >> fie[0][j][i];
	if( fie[0][j][i] == 'L' || fie[0][j][i] == 'R' ){
	  lx=j; ly=i;
	}
      }
      for(int j=0;j<W;j++){
	cin >> fie[1][j][i];
	if( fie[1][j][i] == 'L' || fie[1][j][i] == 'R' ){
	  rx=j; ry=i;
	}
      }
    }
    if( solve(lx,ly,rx,ry) ) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

Measured memory_bytes: 8248
X, Y = map(int, input().split())
n = (2 * X - Y) // 3
m = (-X + 2 * Y) // 3
if n < 0 or m < 0 or (2 * X - Y) % 3 != 0 or (-X + 2 * Y) % 3 != 0:
    print(0)
else:
    # (n+m)Cn 通り
    fac = [1, 1]
    finv = [1, 1]
    inv = [1, 1]
    MOD = 10 ** 9 + 7
    for i in range(2, n + m + 1):
        fac.append(fac[i - 1] * i % MOD)
        inv.append(MOD - inv[MOD % i] * (MOD // i) % MOD)
        finv.append(finv[i - 1] * inv[i] % MOD)
    
    print(fac[n+m] * (finv[n] * finv[m] % MOD) % MOD)

Measured memory_bytes: 88024
#include <bits/stdc++.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

int main(){
  ll N, x;cin >> N >> x;
  vector <ll> a(N);
  rep(i, N) cin >> a[i];
  ll ans= 0;
  rep(i, N-1){
    int num = a[i] + a[i+1];
    if (num <= x) continue;
    if (num-x <= a[i+1])a[i + 1] -= num-x;
    else a[i+1] = 0;
    ans += num-x;
  }
  cout << ans << endl;
}

Measured memory_bytes: 4028
#include <bits/stdc++.h>
using namespace std;
int main(){
        int n, k; cin >> n >> k;
        vector<long long int> v;
        for (int x = 0; x < n; ++x){
            long long int q; cin >> q;
            v.push_back(q);
        }
        sort(v.begin(), v.end());
        long long int ans = 0;
        for (int x = 0; x < n-k; ++x){
            ans += v[x];
        }
        cout << ans << endl;
    return 0;
}



Measured memory_bytes: 5368
// B - Exponential
#include <bits/stdc++.h>
using namespace std;

int main(){
	int x; cin>>x;
	int ans = 1;
	for(int i=2; i*i<=x; ++i)
		for(int a=i*i; a<=x; a*=i) ans = max(ans, a);
	cout<< ans <<endl;
}


Measured memory_bytes: 256
t=int(raw_input())
def sec(t):
	s= t%60
	return s
def mi(t):
	m= t//60
	while m>=60:
		m=m-60
	return m
def hr(t):
	h= t//3600
	return h
print "%d:%d:%d" % (hr(t),mi(t),sec(t))

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

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    int ans  = 0;
    if(a==b && b==c) ans = 0;
    else if(a==b && a!=c) ans = a-c;
    else if(a==c && a!=b) ans = a-b;
    else if(b==c && b!=a) ans = b-a;
    else {
        vector<int> d = {a, b, c};
        sort(d.begin(), d.end());
        ans = d.at(2) - d.at(1) + d.at(1) - d.at(0);
    }

    if(ans < 0) ans = ans * -1;

    cout << ans << endl;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define si(n) scanf("%d",&n);
#define PI acos(-1.0)
#define sl(n) scanf("%lld",&n);
#define sf(n) scanf("%lf",&n);
#define ss(n) scanf("%s",n);
#define for0(i,n) for(ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define forc(i,j,n) for(ll i=j;i<n;i++)
#define pb push_back
#define sor(n) sort(n.begin(),n.end())
#define sorcmp(n) sort(n.begin(),n.end(),cmp)
#define rev(n) reverse(n.begin(),n.end())
#define pi(x)  printf("%d",x);
#define pl(x)  printf("%lld",x);
#define pf(x)  printf("%.10lf",x);
#define ps(x)  printf("%s",x);
#define en() printf("\n");
#define random_shuffle(r...)random_shuffle(r,[](int _){return rand()%_;})
#define SQR(a) (a)*(a)
#define sp(x) fixed<<setprecision(x)
#define mod 1000000007
#define endl '\n'
#define pii pair<int,int>
#define pll pair<ll,ll>
#define bug cout<<"Here"<<endl
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}
template <typename T> T POW(T B,T P){ if(P==0) return 1; if(P&1) return B*POW(B,P-1);  else return SQR(POW(B,P/2));}
ll powmod(ll a, ll b){ll ans = 1;while(b){if(b&1) ans = ans*a%mod;a = a*a%mod;b >>= 1;}return ans;}

bitset<10000005>vis;
vector<int>prime;


void sieve()
{
    vis[1]=1;
    vis[0]=1;
    for(int i=3;i*i<=10000000;i+=2)
    {
        if(!vis[i]){

        for(int j=i*i;j<=10000000;j+=i)
        {
            vis[j]=1;

        }
        }
    }
    prime.pb(2);
    for(int i=3;i<=10000000;i+=2)
    {
        if(!vis[i]) prime.pb(i);
    }
}


//primeFactorize


vector<pii> primeFactorize( int n )
{
    vector<pii>List;
    int sqrtN = int( sqrt(n) );
    for( int i = 0; prime[i] <= sqrtN; i++ )
    {
        if( n % prime[i] == 0 )
        {
            int cnt=0;

            while( n % prime[i] == 0 )
            {
                n /= prime[i];
                cnt++;

            }

            List.pb({prime[i],cnt});

        }

    }
    if( n > 1 )
    {

        List.pb({n,1}) ;

    }

    return List;

}




int main()
{
     fastio();
     sieve();
	 int n;
	 cin>>n;
	 int arr[n];
	 for(int i=0;i<n;i++)
     {
         cin>>arr[i];
     }

	vector<pii>v=primeFactorize(arr[n-1]);

	set<int>s;

	for(auto u:v) s.insert(u.first);
	int gcd=arr[n-1];

	int ans=-1;

	for(int i=n-2;i>=0;i--)
    {

        vector<pii>V;
        V=primeFactorize(arr[i]);
        bool flag=false;
        for(auto u:V)
        {
            if(s.find(u.first)!=s.end())
            {
                flag=true;
                break;
            }
        }
        gcd=__gcd(gcd,arr[i]);
        if(flag==true) ans=2;

        for(auto u:V)
            s.insert(u.first);

    }

    if(ans==2)
    {
        if(gcd==1)
        {
            cout<<"setwise coprime"<<endl;

        }
        else cout<<"not coprime"<<endl;

    }
    else cout<<"pairwise coprime"<<endl;





	return 0;
}


Measured memory_bytes: 14576
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define INF 0x3f3f3f3f
const int MAXN = 1e5 + 7;

struct node
{
    int x, y;
}stu[MAXN];

bool cmp(node a, node b)
{
    return a.x < b.x;
}
priority_queue <int> que;

int main()
{
    ios::sync_with_stdio(false);
    int n, m;
    cin>>n>>m;
    ll ans = 0;
    for(int i = 0; i < n; i++)
    {
        cin>>stu[i].x>>stu[i].y;
    }
    sort(stu, stu+n, cmp);
    int pos = 0;
    for(int i = 1; i <= m; i++)
    {
        for(int j = pos; j < n; j++)
        {
            if(stu[j].x == i) que.push(stu[j].y);
            else
            {
                pos = j;
                break;
            }
        }
        if(que.size())
        {
            ans += que.top();
            que.pop();
        }
    }
    cout<<ans<<endl;

    return 0;
}



Measured memory_bytes: 1660
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define tihs if(fopen("inp.txt","r"))freopen("inp.txt", "r", stdin),freopen("out.txt", "w", stdout);
using namespace std;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define M 100010

ll f(ll n,ll k){
	ll cnt=0;
	while(n){
		cnt++,n/=k;
	}
	return cnt;
}
int main(){
	IOS;
	tihs;

	
	ll n,r;cin>>n>>r;
	cout<<f(n,r);
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

int main(){

    int n;
    cin >> n;

    cout << n + (n * (n % 2)) << endl;

    return 0;
}

Measured memory_bytes: 888
#include <stdio.h>
 
#define MAX 1000000000
#define min(x, y) ((x) < (y) ? (x) : (y))
 
#define MAX_STATION 101
 
int croute[MAX_STATION][MAX_STATION];
int troute[MAX_STATION][MAX_STATION];
int cost[MAX_STATION];
int check[MAX_STATION];
int n, m;
 
void dijkstra(int start, int route[MAX_STATION][MAX_STATION]) {
    int i, u;
 
    for (i = 1; i < m + 1; i++) {
    cost[i] = MAX;
    check[i] = 0;
    }
    cost[start] =0;
    while (1) {
    // ???????¢???????????????????,???????????????????°?????????¨????????¢???
    int v = -1;
    for (u = 1; u < m + 1; u++) {
        if (check[u] == 0 && (v == -1 || cost[u] < cost[v]))
        v = u;
    }
    if (v == -1)
        break;
    check[v] = 1;
 
    // v ????????±??????????????§cost?????´??°??§??????????????????
    for (u = 1; u < m + 1; u++) {
        cost[u] = min(cost[u], cost[v] + route[v][u]);
    }
    }
}
 
int main(void) {
    int i, j, k;
    int result;
 
    while (scanf("%d%d", &n, &m), n != 0) {
    for (i = 0; i < MAX_STATION; i++) {
        for (j = 0; j < MAX_STATION; j++) {
        croute[i][j] = i == j ? 0 : MAX;
        troute[i][j] = i == j ? 0 : MAX;
        }
    }
    while (n > 0) {
        int a, b, c, t;
        scanf("%d%d%d%d", &a, &b, &c, &t);
        croute[a][b] = croute[b][a] = c;
        troute[a][b] = troute[b][a] = t;
        n--;
    }
    scanf("%d", &k);
    while (k > 0) {
        int p, q, r;
        scanf("%d%d%d", &p, &q, &r);
        dijkstra(p, r == 0 ? croute : troute);
        result = cost[q];
        printf("%d\n", result);
        k--;
    }
    }
    return 0;
}

Measured memory_bytes: 680
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <tuple>
#include <math.h>
#include <set>
#include <stack>
#include <bitset>
#include <map>
#include <queue>
#include <random>
#include <unordered_set>
#include <unordered_map>
#define DEBUG
#define fi first
#define se second
#define pqueue priority_queue
#define pb(x) push_back(x)
#define endl '\n'
#define all(x) x.begin(), x.end()
#define int long long
#define mk(a, b) make_pair(a, b)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ull> vull;
typedef vector<ll> vll;
// typedef tuple<int, int, int> tiii;
typedef pair<int, int> pii;
typedef vector<pair<int, int> > vpii;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector< vector<int> > vvi;
typedef vector<char> vc;

const int INF = 1e9;
const ll INFLL = 1e16;
const int MOD = 1000000007;
const int MAXN = 3e5;
//const ld eps = 1e-6;
const ld eps2 = 1e-9;
const int MOD2 = 998244353;
const int dosz = 5e5;
const int SZ = (1<<18);
const ld PI = atan2l(0, -1);


void fast_io(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef DEBUG
        // freopen("a.in", "r",stdin);
#else
       // freopen("substrcmp.in", "r", stdin);
       // freopen("substrcmp.out", "w", stdout);
#endif
}


void solve(){
    char c;
    cin >> c;
    cout << (char)(c+1) << endl;
}

signed main() {
    fast_io();
    int q = 1;
    // cout << fixed << setprecision(6);
    // cin >> q;
    // cout << 1 << endl;
    while(q--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
using namespace std;

int main()
{
    int k;
    string s;
    cin >> k >> s;
    string ans = "";
    if (s.size() > k)
    {
        for (int i = 0; i < k; i++) {
            ans += s[i];
        }
        ans += "...";
    }
    else
    {
        ans = s;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <deque>
#include <cmath>
#include <map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include "iomanip"

using namespace std;

int main() {
    string a,b,c;
    cin >> a >> b >> c;
    cout << a[0] << b[0] << c[0];
    return 0;
}



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

/*BigInteger
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/rational.hpp>
namespace xxx = boost::multiprecision;
using Bint = xxx::cpp_int;
using Real = xxx::number<xxx::cpp_dec_float<1024>>;
*/

#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0LL, sizeof(x))
#define mm(x) memset((x), -1LL, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define Bit(n) (1LL << (n))
#define Bitset(a, b) (a) |= (1LL << (b))
#define Bitunset(a, b) (a) &= ~(1LL << (b))
#define Bitcheck(a, b) ((((a) >> (b)) & 1LL) == 1LL)
#define Bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
constexpr int INF = (int)1e18;
constexpr int MOD = (int)1e9 + 7;
constexpr double PI = (double)acos(-1);
constexpr double EPS = (double)1e-10;
constexpr int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
constexpr int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
} Accelerate_Cin;

signed main() {
  string K;
  int D;
  cin >> K >> D;

  static int dp[101010][110][2];
  m0(dp);
  dp[0][0][0] = 1;

  for (int i = 0; i < K.size(); i++) {
    int k = K[i] - '0';

    for (int j = 0; j < D; j++) {
      for (int f = 0; f < 2; f++) {

        if (f == 0) {
          for (int a = 0; a <= k; a++) {
            if (a < k) (dp[i + 1][(j + a) % D][1] += dp[i][j][f]) %= MOD;
            if (a == k) (dp[i + 1][(j + a) % D][0] += dp[i][j][f]) %= MOD;
          }

        } else {
          for (int a = 0; a < 10; a++) {
            (dp[i + 1][(j + a) % D][1] += dp[i][j][f]) %= MOD;
          }
        }
      }
    }
  }

  cout << (dp[K.size()][0][0] + dp[K.size()][0][1] + MOD - 1) % MOD << endl;
  return 0;
}


Measured memory_bytes: 173824
// 5/1
// 過去問攻略

#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <math.h>
using namespace std;

int main() {
    int A[3][3];
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> A[i][j];
        }
    }

    int N;
    cin >> N;
    // int b[N];

    int C[3][3] = {0};
    int b;

    for (int i = 0; i < N; i++) {
        // cin >> b[i];
        cin >> b;
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (A[i][j] == b) {
                    C[i][j] = 1;
                }
            }
        }

    }

    bool ans = false;

    // 横
    for (int i = 0; i < 3; i++) {
        if (C[i][0] + C[i][1] + C[i][2] == 3) ans = true;
    }

    // 縦
    for (int j = 0; j < 3; j++) {
        if (C[0][j] + C[1][j] + C[2][j] == 3) ans = true;
    }

    // 左上から右下
    if (C[0][0] + C[1][1] + C[2][2] == 3) ans = true;

    // 右上から左下
    if (C[0][2] + C[1][1] + C[2][0] == 3) ans = true;

    // cout << (int)ceil((double)N / 2.0) << endl;

    if (ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

int main(){
  long long N;
  cin>>N;
  long long ans;
  long long flag;
  ans=N/11;
  flag=N%11;
  //cout<<ans;
  //cout<<flag;
  if(flag>6){
    cout<<setprecision(20)<<ans*2+2<<endl;
  }
  else if(flag==0){
    cout<<setprecision(20)<<ans*2<<endl;
  }
  else cout<<setprecision(20)<<ans*2+1<<endl;
  return 0;
}


  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;
const ll MOD = 1e9+7; ll LLINF = 1LL << 60; int INF = INT_MAX;

//

int main(){
    int n,k,x,y; cin>>n>>k>>x>>y;
    if(n<k) cout<<x*n<<endl;
    else cout<<x*k + y*(n-k)<<endl;
}

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

int main() {
  int h, w;
  cin >> h >> w;
  string s;
  for (int i = 0;h > i;i++) {
    for (int j = 0;w > j;j++) {
      cin >> s;
      if (s == "snuke")
        cout <<(char)('A' + j)<<i + 1<<endl;
    }
  }
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
 int a[3];
 for(int i=0;i<3;i++){
   a[i]=0;
 }
 scanf("%d %d %d",&a[0],&a[1],&a[2]); 
 printf("%d %d %d",a[2],a[0],a[1]); 
 return 0;
}

Measured memory_bytes: 128
import sys
n=int(input())
if n==1:
    print(0)
    sys.exit()
lst=[list(map(int,input().split())) for _ in range(n-1)]
data=[[] for i in range(n+1)]
for i in range(n-1):
    u,v,w=lst[i]
    data[u].append(i)
    data[v].append(i)
flag=[-1]*(n+1)
u,v,w=lst[0]
flag[u]=0
flag[v]=(flag[u]+w)%2
que=[data[u],data[v]]
while que:
    h=que.pop()
    for k in h:
        u,v,w=lst[k]
        if flag[u]!=-1 and flag[v]!=-1:
            continue
        else:
            if flag[u]!=-1:
                flag[v]=(flag[u]+w)%2
                que.append(data[v])
            else:
                flag[u]=(flag[v]+w)%2
                que.append(data[u])
for i in range(1,n+1):
    print(flag[i])

Measured memory_bytes: 42796
n = int(input())

a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
res = 0
for i in range(n+1):
    if i < n:
        res += b[i]
    ans += min(res, a[i])
    if i < n:
        res = min(max(res - a[i], 0), b[i])

print(ans)

Measured memory_bytes: 18476
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define INF 9223372036854775807
#define pairint pair<int,int>
int euclidean_gcd(int a, int b) {
  if(a < b) return euclidean_gcd(b, a);
  int r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
signed main()
{
int x=0,y=0,z=0,w=0,n=0,m=0,a=0,b=0;
double c=0,d=0;
std::cin >> x>>y>>z;
rep(i,x){
  std::cin >> w;
  c=y-(double)w*0.006;
  if(i==0) d=abs(z-c);
  else if(d>abs(z-c)){
    n=i;
    d=abs(z-c);
  }
}
std::cout << n+1 << '\n';
}


Measured memory_bytes: 256
import java.util.Scanner;
class Main{
    public static void main(String arg[]){
        Scanner scn=new Scanner(System.in);
        int dice=scn.nextInt();
        int win=scn.nextInt();
        int cnt=0;
        double probability=0;
        for(int i=1;i<=dice;i++){
            int score=i;
            while(true){
                if(win>score){
                    score*=2;
                    cnt++;
                }else{
                    probability+=1.0/dice*Math.pow(0.5,(double)cnt);
                    cnt=0;
                    break;
                }
            }
        }
        System.out.println(probability);
    }
}

Measured memory_bytes: 21716
def resolve():
    H, W = list(map(int, input().split()))
    ans = 0
    if (H == 1 or W == 1):
        print(1)
        return
    if H % 2 == 1:
        even = (H // 2) + 1
    else:
        even = (H // 2)

    odd = H - even

    if W % 2 == 1:
        ans += even * (W // 2 + 1)
    else:
        ans += even * (W // 2)

    ans += odd * (W // 2)

    print(ans)

    return
 
resolve()

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

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

typedef long long ll; 
typedef long double ld; 
typedef pair<int,int> p32;   
typedef pair<ll,ll> p64;  
typedef pair<double,double> pd; 
typedef pair<ld,ld> pld; 
typedef vector<int> v32;  
typedef vector<ll> v64;  
typedef vector<pd> vpd;   
typedef vector<p32> vp32;  
typedef vector<p64> vp64;  
typedef vector<v32> vv32;  
typedef vector<v64> vv64;  

#define pb push_back
#define mp make_pair
#define prarr(a,n) cerr<<#a<<" : ";for(ll i=0;i<n;i++) cerr<<a[i]<<" "; cerr<<endl;
#define prmat(mat,row,col) cerr<<#mat<<" :\n";for(ll i=0;i<row;i++) {for(ll j=0;j<col;j++) cerr<<mat[i][j]<<"\t";cerr<<endl;}
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
#define all(a) a.begin(),a.end()
#define sz(x) ((int)x.size())
#define endl '\n'
#define fast_io ios_base::sync_with_stdio(NULL); cin.tie(NULL)
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {ll idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ", "; dbs(str.substr(idx + 1), s...);}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}
template <class T> void prall(T a) { prc(all(a)); }

#include <bits/extc++.h> /** keep-include */
using namespace __gnu_pbds;
template <class T>
using Tree = tree<T, null_type, less<T>, rb_tree_tag,
        tree_order_statistics_node_update>;

const int inf=1000*1000*1000+9; 
const ll infl=1ll*inf*inf; 
int mod=1000*1000*1000+7;  
// ----------------------------------------------------------------------------	-------------- 

void pre(){
}
int exp(ll a, int b){
  ll ret=1; 
  while(b){
    if(b%2==0){
      a=a*a%mod; 
      b>>=1;
    }
    else {
      ret=ret*a%mod;  
      b--; 
    }
  }
  return ret; 
}
void solve(){
  int n,k; cin>>n>>k; 
  vector<int> seq(k+1,0); 
  for(int i=k;i>=1;i--){
    seq[i]=exp(k/i,n); 
    for(int j=i+i;j<=k;j+=i){
      seq[i]-=seq[j]; 
      if(seq[i]<0) seq[i]+=mod; 
    }
  }
  ll ans=0; 
  for(int i=1;i<=k;i++){
    ans+=1ll*i*seq[i]; 
    ans%=mod; 
  }
  cout<<ans<<endl; 
}



int main(){
	// clock_t beg=clock(); 
  fast_io; 
  int testcases=1; 
  pre(); 
  // cin>>testcases; 
  cout << fixed << setprecision(13); 
  int cs=0; 
  while(testcases--){
    cs++; 
    // cout<<"Case #"<<cs<<": "; 
    solve(); 	
  }
	// clock_t end=clock(); 
	// fprintf(stderr, "%lf\n", (double)(end-beg)/(CLOCKS_PER_SEC));
}





Measured memory_bytes: 3712
N,M,X = map(int,input().split())
K = []
for i in range(N):
    a = list(map(int,input().split()))
    K.append(a)

ans = 10**8
for i in range(2**N):
    c = 0
    skill = [0]*M
    for j in range(N):
        if ( (i>>j) & 1 ):
            c += K[j][0]
            for k in range(1,M+1):
                skill[k-1] += K[j][k]
    skill.sort()
    if skill[0] >= X:
        ans = min(c,ans)

if ans == 10**8:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 85368
#include <iostream>
using namespace std;
 
 
int gcd(int x, int y){
  int a, b, c, d;
  a = max(x,y);
  b = min(x,y);
  c = a/b;
  d = a%b;
  if (d==0) return b;
  else return gcd(b, d);
}
 
int main(){
  int k;
  int gg[300]={0};
  int sum = 0;
  cin>>k;
  int i, j;
  for (i=1; i<=k; i++){
    for (j=1; j<=k; j++){
      gg[gcd(i,j)]+=1;
    }
  }
  for (i=1; i<=k; i++){
    for (j=1; j<=k; j++){
      sum+=gg[i]*gcd(i,j);
    }
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int main()
{
    int n, l;
    cin >> n >> l;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    int pos = 0;
    for(int i = 0; i < n-1; i++)
    {
        if(a[i] + a[i+1] >= l) pos = i+1;
    }
    if(pos == 0)
    {
        cout << "Impossible" << endl;
    }
    else
    {
        cout << "Possible" << endl;
        for(int i = 1; i < pos; i++) cout << i << endl;
        for(int i = n-1; i >= pos; i--) cout << i << endl;
    }
}


Measured memory_bytes: 3796
N, K = map(int, input().split())
sunuke = set(i for i in range(1, N+1))
given =set()
for i in range(K):
    di = map(int, input().split())
    gi = set(map(int, input().split()))
    given = given | gi

itazura = N - len(given)
print(itazura)

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

int main()
{
    long long  a,b,c,d;
    long long  c1[4];
    cin>>a>>b>>c>>d;
    c1[1]=a*c;
    c1[2]=a*d;
    c1[3]=b*c;
    c1[0]=b*d;
    sort(c1,c1+4);
    cout<<c1[3]<<endl;
    return 0;
}


Measured memory_bytes: 3196