akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef  long long int ll;
typedef pair<ll, ll> pll;
#define pb push_back
typedef long double ld;
#define fi first
#define se second
#define mp make_pair
ll inf = 1e18;
ll p = 1e9 + 7;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
ll modInverse(ll n, ll p)
{
    return power(n, p - 2, p);
}
ll arr[3000][3000];
ll dp[3000][3000][4];
ll calc(ll i, ll j, ll val)
{

    ll t2 = 0, t3 = 0;
    if (arr[i][j] > 0 && val > 0)
    {
        ll t1 = arr[i][j];

        if (i - 1 >= 0)
        {
            if (dp[i - 1][j][3] != -1)
                t2 = dp[i - 1][j][3];
            else
                t2 = calc(i - 1, j, 3);
        }
        if (j - 1 >= 0)
        {
            if (dp[i][j - 1][val - 1] != -1)
                t3 = dp[i][j - 1][val - 1];
            else
                t3 = calc(i, j - 1, val - 1);
        }
        dp[i][j][val] = t1 + std::max(t2, t3);
    }
    t2 = 0, t3 = 0;
    if (i - 1 >= 0)
    {
        if (dp[i - 1][j][3] != -1)
            t2 = dp[i - 1][j][3];
        else
            t2 = calc(i - 1, j, 3);
    }
    if (j - 1 >= 0)
    {
        if (dp[i][j - 1][val] != -1)
            t3 = dp[i][j - 1][val];
        else
            t3 = calc(i, j - 1, val);
    }

    dp[i][j][val] = std::max(dp[i][j][val], std::max(t2, t3));

    return dp[i][j][val];



}
int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll i, j, y, x,  z, w, g, c, key, l, r, n, m, t, k, d;
    ll t2, t3, t4, t1;
    string s;
    cin >> r >> c >> k;
    memset(arr, 0, sizeof(arr));
    memset(dp, -1, sizeof(dp));
    for (i = 0; i < k; i++)
    {
        cin >> x >> y >> d;
        arr[x - 1][y - 1] = d;
    }
    ll ans = calc(r - 1, c - 1, 3);
    //cout << dp[1][2][2];
    cout << ans;




    return 0;
}

Measured memory_bytes: 355536
#!/usr/bin/env ruby

dice = gets.split.map(&:to_i)
news = gets.chomp.split("")
news.each do |direction|
    case direction
    when "N"
        dice = [dice[1],dice[5],dice[2],dice[3],dice[0],dice[4]]
    when "E"
        dice = [dice[3],dice[1],dice[0],dice[5],dice[4],dice[2]]
    when "W"
        dice = [dice[2],dice[1],dice[5],dice[0],dice[4],dice[3]]
    when "S"
        dice = [dice[4],dice[0],dice[2],dice[3],dice[5],dice[1]]
    end
end
puts dice[0]


Measured memory_bytes: 6884
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

template <typename T>
bool chmax(T &a, const T& b) {
    if (a < b) {
      a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmin(T &a, const T& b) {
    if (a > b) {
      a = b;
      return true;
    }
    return false;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string s;
    cin >> s;
    vl cnt(26,0);
    rep(i,s.size()){
        cnt[s[i]-'a']++;
    }
    ll ans=(s.size())*(s.size()-1)/2+1;
    rep(i,26){
        ans-=(cnt[i])*(cnt[i]-1)/2;
    }
    cout << ans << endl;
}

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

#include<algorithm>
#include <iostream>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<string>
using namespace std;
int main() {


	int n;
	cin>>n;

	int cnt=0;
	int ans=0;


	int h[n];
	for(int i=0;i<n;i++){
		cin>>h[i];


	}

	for(int i=1;i<n;i++){
		if(h[i]<=h[i-1]){
			cnt+=1;
		}else{
			if(ans<=cnt){
				ans=cnt;
			}

			cnt=0;
		}
		if(ans<=cnt){
						ans=cnt;
					}



	}



	cout<<ans<<endl;


	return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <cmath>
#include <string>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <array>

using namespace std;
#define all(x) (x).begin(), (x).end()
#define asc(v) sort(all(v))
#define desc(v) sort(all(v), greater<int>())

int main() {
	
	int N;
	vector<int> V, C, D;
	int t;
	
	cin >> N;
	for(int i=0; i<N; i++){
		cin >> t;
		V.push_back(t);
	}
	for(int i=0; i<N; i++){
		cin >> t;
		C.push_back(t);
		D.push_back(V[i] - t);
	}
	
	int ans = 0;
	desc(D);
	for(int i=0; i<N; i++){
		if(D[i] <= 0) break;
		ans += D[i];
	}
	
	// 出力
	printf("%d\n", ans);
	
	return 0;
	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pi 3.14159
using namespace std;
int main()
{
	long long int i,n;
	double ans;
	cin>>n;
	int v[n];
	for(i=0;i<n;i++)
		cin>>v[i];
	sort(v,v+n);
	ans=(double)(v[0]+v[1])/2;
	for(i=2;i<n;i++)
	{
		ans=(double)(ans+v[i])/2;
	}
	 cout << fixed << setprecision(5) << ans <<endl;
}

Measured memory_bytes: 3796
import sys,collections as cl,bisect as bs,math
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(float,input().split())
def onem(): #Nとかの取得
	return int(input())
def s(x): #圧縮
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""

a,b = m()

b = int(b*1000)

	


print(int((int(a)*b)//(1000)))



Measured memory_bytes: 9336
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)

## a, bを無向辺として，隣接リストを作成
n, m = list(map(int, input().split()))
a = ["" for i in range(n)]

N = 10**9 + 7

for i in range(n):
    a[i] = str(input())

dp = [[0]*m for i in range(n)]

flag = 0
for i in range(n):
    if a[i][0] == "#" or flag == 1:
        dp[i][0] = 0
        flag = 1
    else:
        dp[i][0] = 1

flag = 0
for j in range(m):
    if a[0][j] == "#" or flag == 1:
        dp[0][j] = 0
        flag = 1
    else:
        dp[0][j] = 1

for i in range(1,n):
    for j in range(1,m):
        if a[i][j] == "#":
            dp[i][j] = 0
        else:
            dp[i][j] = (dp[i][j-1] + dp[i-1][j]) % N

print(dp[n-1][m-1] % N)


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

using namespace std;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))

#define SI(n) scanf("%d",&n)
#define PI(n) printf("%d\n",n)
#define SL(n) scanf("%lld",&n)
#define PL(n) printf("%lld\n",n)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)

#define TRACE

#ifdef TRACE
#define TR(...) __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 TR(...)
#endif

//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);
typedef long long int 	LL;
typedef long double 	LD;
typedef pair<int,int>   II;
typedef vector<int>     VI;
const int MOD = 1e9 + 7;
const int N = 100011;
char a[111][111];

int main() {
    int n, m;
    cin>>n>>m;
    for(int i = 0;i <= n+1; ++i) a[i][0] = '#';
    for(int i = 0;i <= n+1; ++i) a[i][m + 1] = '#';
    for(int i = 0;i <= m+1; ++i) a[0][i] = '#';
    for(int i = 0;i <= m+1; ++i) a[n + 1][i] = '#';
    for(int i = 1;i <= n; ++i)
        for(int j = 1;j <= m; ++j)
            cin>>a[i][j];
    
    for(int i = 0;i <= n + 1; ++i) {
        for(int j = 0;j <= m + 1; ++j)
            cout<<a[i][j];
        cout<<"\n";
    }
    return 0;
}

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

auto keta(ll n) {
    ll res;
    for(ll i = 0; i < 100; i++) {
        n = n / 10;

        if(n == 0) {
            res = i + 1;
            break;
        }
    }
    return res;
}

int main() {
    long double b;
    cin >> b;
    cout << b * 3.141 * 2 << endl;
}


Measured memory_bytes: 3792
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<cstdlib>
using namespace std;
int read(){
	int x=0,f=1; char ch=getchar();
	while (ch<'0' || ch>'9') {if (ch=='-') f=-1; ch=getchar();}
	while (ch>='0' && ch<='9') {x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}
int main(){
	int a=read(),b=read();
	int sum=0;
	if (a>b) sum+=a,a--;
	else sum+=b,b--;
	if (a>b) sum+=a,a--;
	else sum+=b,b--;
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main (){

  string s,r;
  cin >> s>>r;
  int count=0;
  if(s[0]==r[0]) count++;
  if(s[1]==r[1]) count++;
  if(s[2]==r[2]) count++;
  cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
const ll mod = 1e9 + 7;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  rep(i, n) {
    if (a[i] % 2 == 0) {
      if (a[i] % 3 == 0 || a[i] % 5 == 0)
        ;
      else {
        cout << "DENIED" << endl;
        return 0;
      }
    }
  }
  cout << "APPROVED" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;
using P = pair<int64,int64>;

vector<vector<int>> sum(const int& sep, const int& w, const vector<string>& s) {
    int h = __builtin_popcount(sep) + 1;
    vector<vector<int>> res(h, vector<int>(w,0));
    for (int i=0; i<w; i++) {
        int g = 0;
        for (int j=0; j<s.size(); j++) {
            res[g][i] += (s[j][i] == '1');
            if (sep>>j & 1) g++;
        }
    }
    return res;
}

int main() {
    int64 h,w,k;
    cin >> h >> w >> k;
    vector<string> s(h);
    for (int64 i=0; i<h; i++) cin >> s[i];

    int64 ans = LONG_MAX;

    for (int64 i=0; i<(1<<(h-1)); i++) {
        int group = __builtin_popcount(i) + 1;
        vector<vector<int>> ssum = sum(i, w, s);
//        debug(ssum);

        int64 cnt = group - 1;
        vector<int> count(group);
        for (int j=0; j<w; j++) {
            for (int g=0; g<group; g++) {
                if (ssum[g][j] > k) {
                    cnt = INT_MAX;
                    goto loop_exit;
                }
                if (count[g] + ssum[g][j] > k) {
                    cnt++;
                    for (int g=0; g<group; g++) count[g] = 0;
                    break;
                }
            }

            for (int g=0; g<group; g++) count[g] += ssum[g][j];
        }
        loop_exit:
        ans = min(ans, cnt);
    }

    cout << ans << endl;
}

Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int n = in.nextInt();
		int m = in.nextInt();
		boolean[] a = new boolean[n];
		for (int i = 0; i < m; i++) {
			int t = in.nextInt();
			a[t - 1] = true;
		}
		System.out.println(solve(a));
		in.close();
	}

	private static int solve(boolean[] a) {
		int[] r = new int[a.length];
		if (a[0])
			r[0] = 0;
		else
			r[0] = 1;
		if (a.length > 1)
			if (a[1])
				r[1] = 0;
			else
				r[1] = 1 + r[0];
		for (int i = 2; i < a.length; i++) {
			if (a[i])
				r[i] = 0;
			else
				r[i] = r[i - 2] + r[i - 1];
			r[i] %= 1000000007;
		}
		return r[a.length - 1];
	}
}

Measured memory_bytes: 50704
#include<bits/stdc++.h>
#include<random>
#include <chrono>
#define lowbit(i) (i&(-i))
using namespace std;

namespace _ {
	bool rEOF = 1;//为0表示文件结尾
	inline char nc() {
		static char buf[100000], *p1 = buf, *p2 = buf;
		return p1 == p2 && rEOF && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? (rEOF = 0, EOF) : *p1++;
	}
	template<class _T>
	inline bool read(_T &num) {
		char c = nc(), f = 1; num = 0;
		while (c<'0' || c>'9')c == '-' && (f = -1), c = nc();
		while (c >= '0'&&c <= '9')num = num * 10 + c - '0', c = nc();
		return (bool)(num *= f);
	}
	inline bool need(char &c) { return c >= 'A'&&c <= 'z' || c >= '0'&&c <= '9' || c >= 'A'&&c <= 'Z'; }//读入的字符范围
	inline bool read_str(char *a) {
		while ((*a = nc()) && need(*a) && rEOF)++a;
		*a = '\0'; return rEOF;
	}
}using namespace _;

void file(bool opt)
{
	if (opt&&fopen("in.txt", "r"))
	{
		freopen("in.txt", "r", stdin);
		//freopen("out.txt", "w", stdout);
	}
}

long long n, k;
long long sum = 0;
long long a[505 + 5];
long long l[505], r[505];
vector<long long>que;


bool check(long long g)
{
	vector<pair<long long, long long>>q2;
	for (int i = 1; i <= n; i++)
	{
		long long x = a[i] % g;
		q2.push_back({ x,g - x });
	}
	sort(q2.begin(), q2.end());
	for (int i = 1; i <= n; i++)
		l[i] = l[i - 1] + q2[i-1].first;
	for (int i = n; i >= 1; i--)
		r[i] = r[i + 1] + q2[i-1].second;
	for (int i = 0; i <= n; i++)
		if (l[i] == r[i + 1] && l[i] <= k)
			return 1;
	return 0;
}

int main()
{
	cin >> n >> k;
	for (int i = 1; i <= n; i++)cin >> a[i], sum += a[i];
	sort(a + 1, a + 1 + n);
	for (long long i = 1; i*i <= sum; i++)
	{
		if (sum%i == 0)
		{
			que.push_back(i);
			if (i != sum / i)que.push_back(sum / i);
		}
	}
	sort(que.begin(), que.end(), [](long long a, long long b) {return a > b; });
	for (int i = 0; i < que.size(); i++)
	{
		if (check(que[i]))
		{
			printf("%lld\n", que[i]);
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 256
n = int(input())
ans = [0] * n

for x in range(1,int(n**0.5)):
    for y in range(1,int(n**0.5)):
        for z in range(1,int(n**0.5)):
            a = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if a <= n:
                ans[a-1] += 1
[print(x) for x in ans]

Measured memory_bytes: 9580
#include <bits/stdc++.h>
using namespace std;
#define endl '\n' 
#define IO ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define lowbit(x) ((x)&(-x))
typedef long long LL;
typedef double db;
typedef pair<int,int> PII;
const int N = 1e5 + 10;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const db EXP = 1e-9;
int main() {
	IO;
	int x;
	cin >> x;
	x %= 10;
	if(x == 3) cout << "bon";
	else if(x == 0 || x == 1 || x == 6 || x == 8) cout << "pon";
	else cout << "hon";
	cout << endl;

	return 0;
}

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

using namespace std;

int h[100005], dp[100005];

int main()
{
    int n;
    cin >> n;
    for(int i = 1;i <= n; ++i)
        cin >> h[i];
    dp[0] = 999999;
    dp[1] = 0;
    for(int i = 2;i <=n; ++i)
            dp[i] = min(dp[i-2] + abs(h[i-2]-h[i]), dp[i - 1] + abs(h[i-1] - h[i]));
    cout << dp[n];
    return 0;
}


Measured memory_bytes: 4412
#include <stdio.h>

int main(void)
{
  int h, n;
  scanf("%d %d", &h, &n);
  int a[n], i, sum;
  i = 0;
  sum = 0;
  while (i < n)
  {
    scanf("%d", &a[i]);
    sum += a[i];
    i++;
  }
  if (sum >= h)
  {
    printf("Yes");
  }
  else
  {
    printf("No");
  }
  return 0;
}


Measured memory_bytes: 512
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);

        int n = input.nextInt();
        int[] array = new int[n];
        int i = 0;
        while (input.hasNext()) {
            array[i] = input.nextInt();
            i++;
        }

        StringBuilder sb = new StringBuilder();
        int[] result = new int[n];
        for (int j = 0; j < n; j++) {
            result[0] += j % 2 == 0 ? 1 * array[j] : -1 * array[j];
        }
        sb.append(result[0] + " ");
        for (int k = 1; k < n; k++) {
            result[k] = 2 * array[k - 1] - result[k - 1];
            sb.append(result[k] + " ");
        }
        System.out.println(sb.toString().trim());
    }

}



Measured memory_bytes: 62960
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
using namespace std;
#define DEBUG(x) cout<<#x<<"="<<x<<endl
#define DEBUG2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl
typedef long long ll;
class Solver{
public:
    static const int MAXN=60;
    int K,N;
    ll x[MAXN],y[MAXN];
    void solve(){
        cin>>N>>K;
        for(int u=0;u<N;u++)cin>>x[u]>>y[u];
        ll ans=-1;
        for(int u1=0;u1<N;u1++){
            for(int v1=0;v1<N;v1++){
                for(int u2=0;u2<N;u2++){
                    for(int v2=0;v2<N;v2++){
                        int x1=x[u1],y1=y[v1],
                        x2=x[u2],y2=y[v2];
                        int lx=min(x1,x2),rx=max(x1,x2),
                        uy=min(y1,y2),dy=max(y1,y2);
                        int cnt=0;
                        for(int u=0;u<N;u++){
                            if(lx<=x[u]&&x[u]<=rx&&uy<=y[u]&&dy>=y[u]){
                                cnt++;
                            }
                        }
                        if(cnt>=K){
                            if(ans==-1)ans=(ll)(rx-lx)*(dy-uy);
                            else ans=min(ans,(ll)(rx-lx)*(dy-uy));
                        }
                    }
                }
            }
        }
        cout<<ans;
    }
};
int main()
{
    // freopen("in.txt","r",stdin);
    (new Solver())->solve();
}

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

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)

using namespace std;

string s;
int len;
vector<string> answer;
bool already[26];
char plain[30];

void rec(int cur){
  if( cur >= len ) {
    string temp = "";
    rep(i,len) temp += string(1,plain[i]);
    answer.push_back(temp);
    return;
  }
  for(char next='a';next<='z';next++){
    bool temp_b = already[next-'a'];
    char c = next;
    plain[cur] = next;
    if( next != 'a' && !already[next-'a'] ) {
      already[next-'a'] = true;
      c = (char)(next-1);
    }
    bool success = true;
    if( c != s[cur] ) success = false;
    if( success ) rec(cur+1);
    already[next-'a'] = temp_b;
  }
}

int main(){
  while( cin >> s, s != "#" ){
    len = s.size();
    rep(i,len) plain[i] = '?';
    answer.clear();
    memset(already,false,sizeof(already));
    rec(0);
    cout << answer.size() << endl;
    if( answer.size() <= 10 ) rep(i,answer.size()) cout << answer[i] << endl;
    else { rep(i,5) cout << answer[i] << endl; for(int i=(int)answer.size()-5;i<answer.size();i++) cout << answer[i] << endl; }
  }
  return 0;
}

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

int main(){
  int N , K;
  cin >> N >> K;
  int cnt = 1;
  
  for(int i = 0; i < N; i++){
    if(cnt* 2 >= cnt + K){
      cnt += K;
    }
    else{
      cnt *= 2;
    }
    
  }
  
  cout << cnt << endl;
}

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

long long A, B;

// [0, last]で第pos bitが立っている回数
// pos == 0 のときは last / 2 + (last % 2) - 0
// pos == 1 のときは last / 4 * 2 + (last % 4 - (2-1))
// pos == 2 のときは last / 8 * 4 + (last % 8 - (4 - 1))
long long bit_cnt(long long last, int pos){
    return last / (1LL << (pos + 1)) * (1LL << pos) + max(0LL, (last % (1LL << (pos + 1)) - ((1LL << pos) - 1)));
}


int main(){
    cin >> A >> B;
    long long ans = 0;
    if(A == 0){}
    for(int i = 0; i < 40; i++){
        //cout << bit_cnt(A - 1, i) << ", " << bit_cnt(B, i) << endl;
        //cout << bit_cnt(B, i) - bit_cnt(A - 1, i) << endl;
        ans += ((bit_cnt(B, i) - bit_cnt(A - 1, i)) % 2) * (1LL << i);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
  cin >>n;
  vector<int> b(n),a(n);
  for(int i=0;i<n;i++)cin>>b[i];
  for(int j=0;j<n;j++){
  for(int i=b.size()-1;i>=0;i--){
    if(i+1==b[i]){
      a[j]=b[i];
      b.erase(b.begin()+i);
      break;
  	}
  }
  }
    if(a[n-1]!=1)cout<<-1<<endl;
    else {for(int i=n-1;i>=0;i--)cout << a[i]<<endl;}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int M=53;
const int P=1e9+7;

void Add(long long &x,long long y){(x+=y)%=P;} 

int n,k;
long long dp[M][M][M*M];

void Solve(){
	dp[0][0][0]=1;
	for(int i=1;i<=n;i++)
		for(int j=0;j<=i;j++)
			for(int q=0;q<=k;q+=2){
				long long &d=dp[i][j][q];
				if(q>=2*j+2)Add(d,dp[i-1][j+1][q-2*j-2]*(j+1)*(j+1));
				if(q>=2*j)Add(d,dp[i-1][j][q-2*j]*(2*j+1));
				if(j and q>=2*j-2)Add(d,dp[i-1][j-1][q-2*j+2]);
			}
	printf("%lld\n",dp[n][0][k]);
}

int main(){
	scanf("%d%d",&n,&k);
	Solve();
	return 0;
}

Measured memory_bytes: 57600
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <cmath>   
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
#define all(x) (x).begin(),(x).end()
#define rep(i,m,n) for(int i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(int i = m;i >= n;--i)
#define INF INT_MAX/2
using namespace std;
using ll = long long;
using R = double;
using Data = pair<ll, vector<int>>;
const ll MOD = 1e9 + 7;
const ll inf = 1LL << 50;
struct edge { ll from; ll to; ll cost; };



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

	int sumw[202020];
	int sumb[202020];
	sumw[0] = (s[0] == '.');
	rep(i, 1, n) {
		sumw[i] = sumw[i - 1] + (s[i] == '.');
	}
	sumb[0] = (s[0] == '#');
	rep(i, 1, n) {
		sumb[i] = sumb[i - 1] + (s[i] == '#');
	}

	int ans = min(sumw[n - 1], sumb[n - 1]);
	rep(i, 0, n) {
		ans = min(ans,sumb[i] + (sumw[n-1]-sumw[i]));
	}
	cout << ans << endl;

	return 0;
}

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

#define INF 0x7fffffff
#define ll  long long

int main() {
  int n,k;
  cin >> n >> k;
  vector<ll> dp(n+2 , 0x7fffffffffffffffll);
  vector<ll> h(n+2);

  for(int i=0;i<n;i++) {
    cin >> h[i+1]; 
  }
  dp[1] = 0;
  for(int i=1;i<n;i++) {
    for(int j=1;j<=k;j++){
      if (i+j > n) break;
      ll t = h[i] - h[i+j];
      if (t<0) t*=-1;
      dp[i+j] = min(dp[i+j], dp[i]+t);
    }

  }

  cout << dp[n] << endl;
}


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

int main() 
{
    int a,b;
    float t;
    cin >> a >> b >> t;
    float curr=0;
    int bis=0;
    do
    {
        bis+=b;
        curr+=a;
    } while (curr<=t+0.5);
    cout << bis-b;
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
using namespace std;





int main() {
	//cout << fixed << setprecision(10);
	
	
	long long int n, m, a, b, c, d;
	string str;
	cin >> a >> b >> c;
	cout << min(c, b / a);
}

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

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

#define maxN 100011
#define mod 1000000007

int n, i;
ll x[maxN], dead, pos;
ll ans = 1;

bool check(ll pos) {
    ll maxi = (x[pos] + 2) / 2;
    return pos - dead <= maxi;
}

bool check2(ll pos) {
    ll maxi = (x[pos] + 1) / 2;
    return pos - dead <= maxi;
}

int main()
{
    //freopen("test.in","r",stdin);

    scanf("%d", &n);
    for (i = 1; i <= n; i++) scanf("%lld", &x[i]);

    dead = 0; pos = 1;
    for (i = 1; i <= n; i++) {
        while (pos <= n && check2(pos))
            pos++;

        if (check(pos)) pos++;

        ans = (ans * (pos - dead - 1)) % mod;
        dead++;
    }

    printf("%lld", ans);


    return 0;
}


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

int cnt[26] = {0};
string s;

int main() {
  cin >> s;
  for(int i = 0; i < s.size(); ++i) ++cnt[s[i] - 'a'];
  for(int i = 0; i < 26; ++i) {
    if(cnt[i] == 0) {
      cout << (char)('a' + i) << endl;
      return 0;
    }
  }
  cout << "None" << endl;
  return 0;
}

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

using namespace std;

typedef long long ll;

const int N = 2e5+5;


int n , k;
int ar[N];
int cnt[N];

int main(){
    int dif = 0;
    scanf("%d%d" , &n , &k);
    for(int i = 1; i <= n; i++){
        scanf("%d" , &ar[i]);
        if(cnt[ar[i]] == 0)
            dif ++;
        cnt[ar[i]]++;

    }
    if(dif <= k){
        puts("0");
        return 0;
    }
    vector < int > all;
    for(int i = 1; i <= n; i++){
        if(cnt[ar[i]]){
            all.push_back(cnt[ar[i]]);
            cnt[ar[i]] = 0;
        }
    }
    sort(all.begin() , all.end());
    int ans = 0;
    for(auto v : all){
        ans += v;
        dif--;
        if(dif <= k)
            break;
    }
    printf("%d\n" , ans);
}


Measured memory_bytes: 5896
dx = [1, 0, -1, -1, 0, 1]
dy = [0, -1, -1, 0, 1, 1]
while True:
	t, n = map(int, raw_input().split())
	if t == n == 0: break
	blocks = set(tuple(map(int, raw_input().split())) for i in xrange(n))
	que = [(0,) + tuple(map(int, raw_input().split()))]
	visited = set()
	count = 0
	while que:
		step, x, y = que.pop(0)
		if (x, y) in visited: continue
		visited.add((x, y))
		count += 1
		if step == t: continue
		for u, v in zip(dx, dy):
			nx = x + u
			ny = y + v
			if (nx, ny) not in blocks:
				que.append((step + 1, nx, ny))
	print count

Measured memory_bytes: 4756
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>

using namespace std;

int main(void){
	
	int n,m=0;
	map<int,int> a;
	vector<int> ans;

	for(int i=0;i<=100;i++){
		a.insert(map<int,int>::value_type(i,0));
	}

	while(cin>>n){
		a[n]++;
	}
	
	for(int i=0;i<=100;i++){
		m=max(a[i],m);
	}
	
	for(int i=0;i<=100;i++){
		if(m==a[i]){
			ans.push_back(i);
		}
	}
	
	sort(ans.begin(),ans.end());
	
	for(int i=0;i<ans.size();i++){
		cout<<ans[i]<<endl;
	}
}

Measured memory_bytes: 0
#include <iostream>
    using namespace std;
     
    int main() {
int t,y ;
cin >> t >> y ;
int a[t+1][y+1];
for(int i=0 ; i<t+1 ; i++){
	a[i][y]=0;
}
for (int j=0 ; j<y+1 ;j++){
	a[t][j]=0;
}
for(int i=0 ; i<t ; i++ ){
	for(int j=0 ; j<y ; j++){
		cin >> a[i][j];
	}
}
for (int i=0 ; i<t ; i++){
	for (int j=0 ; j<y ; j++){
		a[i][y]=a[i][y]+a[i][j];
	}
}
for (int j=0 ; j<y+1 ; j++){
	for (int i=0 ; i<t ;i++){
		a[t][j]=a[t][j]+a[i][j];
	}
}
for (int i=0 ; i<t ; i++){
	for (int j=0 ; j<y ; j++){
		cout<< a[i][j] << " ";
	}
	cout <<a[i][y]<< endl;
}
for (int j=0 ; j<y ; j++){
		cout<< a[t][j] << " ";
	}
	cout <<a[t][y]<< endl;
    return 0;
    }

Measured memory_bytes: 1196
### subroutines

def max_growth(k, i)
  return $gcache[k][i] if ! $gcache[k][i].nil?
  return ($gcache[k][i] = 1.0) if k == 1

  max_g = -1

  for j in (0...$n)
    g = $table[i][j] * max_growth(k - 1, j)
    max_g = g if max_g < g
  end

  $gcache[k][i] = max_g
end

### main

while true
  $n, m = gets.strip.split(' ').map{|s| s.to_i}
  break if $n == 0 && m == 0

  $table = []
  $n.times.each do
    fs = gets.strip.split(' ').map{|s| s.to_f}
    $table << fs
  end
  #p $table

  $gcache = (m + 1).times.map{[]}

  max_g = -1

  for i in (0...$n)
    g = max_growth(m, i)
    max_g = g if max_g < g
  end

  printf("%.2f\n", max_g)
end

Measured memory_bytes: 6328
#include<stdio.h>
int main(){
	int i,j;
	int A,B,K;

	scanf("%d %d %d",&A,&B,&K);

	if(B-A+1 > 2*K){
		for(i=0;i<K;i++){
			printf("%d\n",A+i);
		}
		for(i=0;i<K;i++){
			printf("%d\n",B-K+1+i);
		}
	}else{
		for(i=0;i<B-A+1;i++){
			printf("%d\n",A+i);
		}
	}


	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <cmath>
#include <tuple>
#include <map>
#include <unordered_map>
using namespace std;
typedef long long ll;

int main(int argc, char *argv[])
{
	ll n, k;
	ll left, right;
	cin >> n >> k;

	left = n % k;
	right = left + k;

	cout << min(right - k, k - left) << endl;
	
	return 0;
}


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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a,b;
    while(cin>>a>>b)
    {
        if(b==1)
        {
            cout<<0<<endl;
        }
        else if(a>=b)
        {
            cout<<1<<endl;
        }
        else
        {
            int ans=1;
            int ase=a;
            while(ase<b)
            {
                ase--;
                ase +=a;
                ans++;
                //ase--;
            }
            cout<<ans<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int NINF = -1000000000;
int main(){
  int N;
  cin >> N;
  vector<int> F(N, 0);
  for (int i = 0; i < N; i++){
    for (int j = 0; j < 10; j++){
      int f;
      cin >> f;
      F[i] |= (f << j);
    }
  }
  vector<vector<int>> P(N, vector<int>(11));
  for (int i = 0; i < N; i++){
    for (int j = 0; j <= 10; j++){
      cin >> P[i][j];
    }
  }
  int x = NINF;
  for (int i = 1; i < (1 << 10); i++){
    int g = 0;
    for (int j = 0; j < N; j++){
      g += P[j][__builtin_popcount(i & F[j])];
    }
    x = max(x, g);
  }
  cout << x << endl;
}

Measured memory_bytes: 256
n = gets.to_i
l = gets.split.map(&:to_i).sort
count = 0
(0...n-2).each do |a|
  (a+1...n-1).each do |b|
    t = l[a] + l[b]
    pos = l[b+1..-1].bsearch_index {|x| x >= t}
    count += pos ? pos : n-b-1
  end
end
  
puts count

Measured memory_bytes: 1912
s = input()
for i in range(2**3):
    plusminus = ["+"]*3
    for j in range(3):
        if (i >> j) & 1:
            plusminus[j] = "-"
    key = s[0] + plusminus[0] + s[1] + plusminus[1] + s[2] + plusminus[2] + s[3]
    if eval(key) == 7:
        print(key+"=7")
        break

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

int N;
int p;
int Ans[4];
int A,B;

int main() {

	ios::sync_with_stdio(0);
	register int i;
	cin>>N>>A>>B;
	
	for(i=1;i<=N;++i) {
		cin>>p;
		if(p>B) ++Ans[3];
		else if(p>A) ++Ans[2];
		else ++Ans[1];
	} cout<<min(Ans[1],min(Ans[2],Ans[3]))<<endl;
	
	return 0;
}

Measured memory_bytes: 256
/*Read the problem carefully before starting to work on it*/
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;

#define pb push_back
#define eb emplace_back
#define mp(x,y) make_pair(x,y)
#define mod 1000000007

double PI = 3.1415926535897932384626;

//template<typename T> T power(T x,T y,ll m=mod){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}

//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ost;

//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
//#define rnd(x, y) uniform_int_distribution<ll>(x, y)(rng)

//struct custom_hash {
//    static uint64_t splitmix64(uint64_t x) {
//        // http://xorshift.di.unimi.it/splitmix64.c
//        x += 0x9e3779b97f4a7c15;
//        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
//        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
//        return x ^ (x >> 31);
//    }
//    size_t operator()(uint64_t x) const {
//        static const uint64_t FIXED_RANDOM =
//            chrono::steady_clock::now().time_since_epoch().count();
//        return splitmix64(x + FIXED_RANDOM);
//    }
//};

#define fi first
#define se second

ll s;

ll dp[2005];

ll f(ll val)
{
	if (val < 0)
		return 0;
	if (val == 0)
		return dp[val] = 1;
	if (dp[val] != -1)
		return dp[val];
	ll s = 0;
	for (ll dig = 3; dig <= val; dig++)
	{
		s += f(val - dig);
		s %= mod;
	}
	return dp[val] = s % mod;
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	for (ll i = 0; i < 2005; i++)
		dp[i] = -1;
	cin >> s;
	cout << f(s) << endl;
	return 0;
}


//252908XL

/*
comments:-

*/


Measured memory_bytes: 3668
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <math.h>
#include <algorithm>
using namespace std;

typedef long long ll;

int main()
{
    ll H, N;
    cin >> H >> N;
    //vector<pair<double, double>> vec(N);
    vector<ll> dp(20001,1e9);
    dp[0] = 0;
    for (int i = 0; i < N;i++){
        ll a, b;
        cin >> a >> b;
        ll t = 0;
        while(t + a < 20001){
            dp[t + a] = min(dp[t + a], dp[t] + b);
            t++;
        }
    }
    ll ans = 1e9;
    for (int i = 20000;i >= H;i--){
        ans = min(dp[i], ans);
    }

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

Measured memory_bytes: 512
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;

const int maxn = 2e5+100;

long long res,bs=26;
char ans[maxn];
int main()
{
	ios::sync_with_stdio(false);
	cin>>res;
	int cnt=0;
	while(res)
	{
		long long ip = res%bs;
		res/=bs;
		if(ip==0) ip=26,res--;
		char op = 'a'+ip-1;
		ans[++cnt]=op;
		//cout<<ip<<endl;
	}
	for(int i=cnt;i>=1;i--) cout<<ans[i];
	cout<<endl;
	return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>  // Including tree_order_statistics_node_update

using namespace __gnu_pbds;
using namespace std;

#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(), (c).end()
#define tr(c, i) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define present(c, x) ((c).find(x) != (c).end())
#define cpresent(c, x) (find(all(c), x) != (c).end())
#define minei(x) min_element(x.begin(), x.end()) - (x).begin()
#define maxei(x) max_element(x.begin(), x.end()) - (x).begin()
#define LSOne(S) (S & (-S))

#define uns(v) sort((v).begin(), (v).end()), v.erase(unique(v.begin(), v.end()), v.end())
#define acusum(x) accumulate(x.begin(), x.end(), 0)
#define acumul(x) accumulate(x.begin(), x.end(), 1, multiplies<int>());
#define bits(x) __builtin_popcount(x)
#define oo INT_MAX
#define inf 1000000000
#define MAXN 1000007
#define MOD 1000000007

const double pi = acos(-1.0);
const double eps = 1e-11;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

int main() {
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll x;
    cin >> x;
    for (ll A = 0; A <= 200; A++) {
        for (ll B = -200; B <= 200; B++) {
            if (powl(A, 5) - powl(B, 5) == x) {
                cout << A << " " << B << endl;
                return 0;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 3720
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <array>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, a, n) for (int i = a; i < (n); i++)
#define all(in) in.begin(), in.end()
const int INF = 1e9;
const int MOD = 1e9 + 7;
int main() {
    int H, W;
    cin >> H >> W;
    string S[H][W];
    pair<int, int> ans;
    rep(i, H) rep(k, W) {
        cin >> S[i][k];
        if (S[i][k] == "snuke") {
            ans.first = i + 1, ans.second = k + 1;
        }
    }
    int count = 1;
    for (char i = 'A'; i <= 'Z'; i++) {
        if (count == ans.second) {
            cout << i << ans.first << endl;
            return 0;
        }
        count++;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
   int i,n;
   long a[200000],ans,mx;

   scanf("%d",&n);
   for (i=0;i<n;i++) scanf("%ld",&a[i]);
   mx=a[0];ans=0;
   for (i=1;i<n;i++)
      if (a[i]<mx) ans+=mx-a[i];
      else         mx=a[i];
   printf("%ld\n",ans);
   return 0;
}

Measured memory_bytes: 3296
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << '\n';
#else
	#define DBG(X)
#endif

using std::cin;
using std::cout;
using std::vector;
using std::string;
using std::pair;
using std::swap;
using std::sort;
using std::lower_bound;
using std::unique;

using int64 = long long int;
using pii   = pair<int, int>;
using pii64 = pair<int64, int64>;

const int NIL = -1;
const int INF = (int)2e9;
const int64 INF64 = (int64)2e18;

void init_IO() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
}

template<typename T>
std::ostream& operator<<(std::ostream& os, const vector<T>& vec) {
	os << '[';
	int fst = 1;

	for(auto& elem: vec) {
		if(fst == 0) {
			os << ' ';
		}

		os << elem;
		fst = 0;
	}

	os << ']';
	return os;
}

void solve() {
	int64 x;
	cin >> x;

	int64 answ = 2 * (x / 11);
	x %= 11;

	if(x > 0) {
		++answ;
	}

	if(x > 6) {
		++answ;
	}

	cout << answ << '\n';
}

int main() {
	init_IO();
	solve();

	return 0;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main {
	
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int A = sc.nextInt();
    	int B = sc.nextInt();
    	String S = sc.next();
    	String ans = "Yes";
    	for (int i = 0; i < S.length(); i++) {
    		if ((i == A && S.charAt(i) != '-') || (i != A && S.charAt(i) == '-')) {
    				ans = "No";
    		}
    	}
    	System.out.println(ans);
    }
}

Measured memory_bytes: 22612
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
#include <queue>
#include <stack>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define drep(i, n) for(int i = n - 1; i >= 0; i--)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
  int n;
  cin >> n;
  ll sum = 0;
  vector<ll> v(n);
  rep (i, n) {
    ll a;
    cin >> a;
    if (i != 0) v[i] = v[i - 1] + a;
    else v[i] = a;
  }

  ll ans = LINF;
  rep (i, n - 1) {
    // P(abs(v[n - 1] - v[i]));
    ans = min(ans, abs(v[n - 1] - v[i] * 2));
  }
  P(ans);

  return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <ctime>
#include <cassert>
#include <unordered_map>
#include <fstream>
#include <random>
#include <cstring>
#include <complex>
#include <bitset>
 
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define sz(a) (int)(a).size()
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
 
const int MAXN = 2000;
int board[MAXN][MAXN];

void print(const vector<int> &s) {
    for (int i = 0; i < sz(s); ++i) {
        cout << s[i] << " ";
    }
    cout << endl;
}

int main() {
    // ifstream cin("input.txt");
    // ofstream cout("output.txt");
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
 
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);    
    
    int p = 37;
    int n = p * p + p + 1;
    int k = p + 1;
    cout << n << " " << k << endl;

    for (int i = 0; i < p; ++i) {
        for (int j = 0; j < p; ++j) {
            board[i][j] = i * p + j + 1;
        }
    }

    for (int i = 0; i < p; ++i) {
        for (int j = 0; j < p; ++j) {
            vector<int> s = {p * p + i + 1};
            for (int l = 0; l < p; ++l) {
                s.push_back(board[l][(j + l * i) % p]);
            }
            print(s);
        }
    }

    for (int j = 0; j < p; ++j) {
        vector<int> s = {p * p + p + 1};
        for (int l = 0; l < p; ++l) {
            s.push_back(board[j][l]);
        }
        print(s);
    }

    vector<int> s;
    for (int i = 1; i <= p + 1; ++i) {
        s.push_back(p * p + i);
    }
    print(s);

}

Measured memory_bytes: 640
using System;

class Program
{
    public static void Main(){
        var n=int.Parse(Console.ReadLine());
        var a=new int[n];
        for(var i=0; i<n; i++){
            a[i]=int.Parse(Console.ReadLine());
        }

        var cnt=0;
        for(var i=0; i<n; i++){
            var ai=a[i];
            if(ai!=2 && ai%2==0){
                continue;
            }
            var flag=true;
            for(var j=3; j*j<=ai; j+=2){
                if(ai%j==0){
                    flag=false;
                    break;
                }
            }
            if(flag){
                cnt++;
            }
        }

        Console.WriteLine(cnt);
    }
}

Measured memory_bytes: 9184
// ITP1_1_C.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>

using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;
    cout << a * b << " " << 2 * a + 2 * b << endl;
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します



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

using namespace std;

vector<vector<int>> g;

int dp[100010];

int rec(int i) {
    if (dp[i] != -1) return dp[i];

    int res = 0;
    for (int j : g[i]) {
        res = max(res, rec(j) + 1);
    }
    return dp[i] = res;
}

int main() {
    int n, m;
    cin >> n >> m;
    g.assign(n, vector<int>());
    for (int i = 0; i < m; ++i) {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        g[x].emplace_back(y);
    }

    for (int i = 0; i < n; ++i) {
        dp[i] = -1;
    }

    int len = 0;
    for (int i = 0; i < n; ++i) {
        len = max(len, rec(i));
    }

    cout << len << endl;

    return 0;
}

Measured memory_bytes: 8192
N = int(input())
T, A = map(int, input().split())
l = list(map(int, input().split()))
m = []
for i in l:
    ave_t = T - i * 0.006
    dif_t = abs(A - ave_t)
    m.append(dif_t)
print(l.index(l[m.index(min(m))]) + 1)


Measured memory_bytes: 3060
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = 0
for i, a in enumerate(A):
    ans += B[a-1]
for i in range(N-1):
    if A[i+1] - A[i] == 1:
        ans += C[A[i]-1]
print(ans)


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

#define ll long long
#define vec vector<ll>
#define sortv(a); sort(a.begin(), a.end());
#define rev(a); reverse(a.begin(), a.end());
#define FOR(i,a,b) for (ll i = (ll)(a); i < (b); i++)
#define ROF(i,a,b) for (ll i = (ll)(b)-1; i >= (a); i--)

ll MOD = 1000000007;
ll INF = 1LL << 60;

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	int k,n;cin>>k>>n;
	vec a(2*n);
	FOR(i,0,n) {
		cin>>a[i];
	}
	FOR(i,n,2*n) {
		a[i]=k+a[i-n];
	}
	// FOR(i,0,2*n) {
	// 	cout<<a[i]<<" ";
	// }

	ll out = 0; ll temp, prev;
	FOR(i,0,n-1) {
		out+=a[i+1]-a[i];
		prev = out;
	}
	for(int i = 1;i+n-1<2*n; i++) {
		temp = prev - (a[i]-a[i-1]) + (a[i+n-1]-a[i+n-2]);
		prev = temp;
		out=min(out,temp);
		// cout<<out<<" "<<i<<'\n';
	}

	cout<<out;
}

Measured memory_bytes: 3328
<?php
$input =  explode(" ", trim(fgets(STDIN)));

$a = $input[0];
$b = $input[1];

if($a < (2 *$b) || $a == (2 *$b)) {
    echo 0;
} else {
    echo $a - (2 * $b) . "\n";
}
?>

Measured memory_bytes: 4856
#include <bits/stdc++.h>
#define scan1(a) scanf("%d",&a);
#define scan2(a,b) scanf("%d %d",&a,&b);
#define loop(i,j) for(int i=0;i<j;i++)
typedef long long ll;
using namespace std;

int main()
{
  ll N,K;
  scan2(N,K);
  vector<ll> v(N);
  loop(i,N) scan1(v[i]);
  sort(v.begin(),v.end());
  ll mi=LLONG_MAX;
  loop(i,N-K+1){
    mi=min(mi,abs(v[i]-v[i+K-1]));
  }
  printf("%d\n",mi);
  return 0;
}


Measured memory_bytes: 1024
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        s : String,
    }

    let mut ans = 0;
    let mut cur: i32 = 0;

    for c in s.chars() {
        cur = if c == 'R' { cur + 1 } else { 0 };
        ans = std::cmp::max(ans, cur);
    }

    println!("{}", ans);
}


Measured memory_bytes: 2168
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int x[110], y[110], h[110];
    rep(i, N) {
        cin >> x[i] >> y[i] >> h[i];
    }
    REP(X, 0, 100) {
        REP(Y, 0, 100) {
            REP(H, max(1, h[0] - 200), h[0] + 200){
                bool ok = true;
                rep(i, N) {
                    if (max(0, H - abs(X - x[i]) - abs(Y - y[i])) != h[i]) ok = false;
                    if (!ok) break;
                }
                if (ok) {
                    cout << X << " " << Y << " " << H << endl;
                    return 0;
                }
            } 
        }
    }

    return 0;
}


Measured memory_bytes: 256