akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define FOR(i,a,b)  for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n)    FOR(i,0,n)
#define RER(i,n)    FOR(i,0,(n+1))
#define pb          push_back
#define mp(a,b)     make_pair((a),(b))
#define mset(m,v)   memset(m,v,sizeof(m))
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int> > vpii;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
typedef vector<pair<ll, ll> > vpll;
typedef vector<string> vs;
typedef long double ld;
const double EPS    = 1e-10;
const int INF       = 1e+9;
const double PI     = acos(-1);


auto main() -> int
{
    string buf, s;
    cin >> buf >> s >> buf;

    cout << "A" << (char)toupper(s[0]) << "C" << endl;

    return 0;
}



Measured memory_bytes: 256
import heapq
q = []

for i in xrange(1, 1001):
  for j in xrange(i+1, 1001):
    heapq.heappush(q, (i**2+j**2, (i,j)))
q = sorted(q)

while True:
  h,w = map(int, raw_input().split())
  if h==w==0: break
  for i in xrange(len(q)):
    if q[i][1] == (h, w):
      index = i
  print "%d %d" % (q[index+1][1][0], q[index+1][1][1])

Measured memory_bytes: 109848
//https://atcoder.jp/contests/arc074/tasks/arc074_b
//D - 3N Numbers
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
#define FOR(i,a,b) for(int64_t i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
int main() {
#if LOCAL&0
    std::ifstream in("./input.txt"); //input.txt
    std::cin.rdbuf(in.rdbuf());
#else
    cin.tie(0);
    ios::sync_with_stdio(false);
#endif
    ll N; cin>>N;
    vector<ll> a3n(3*N);
    for(auto&& a:a3n){
        cin>>a;
    }
    //先頭のNをいれる
    priority_queue<ll,vector<ll>,greater<ll>> h_que; //小さいのが先頭に
    vector<ll> h_sum;
    ll sum=0;
    FOR(i,0,N){
        auto v=a3n.at(i);
        sum += v;
        h_que.push(v);
    }
    //次のNを入れながらmaxとる
    h_sum.emplace_back(sum);
    FOR(i,N,2*N){
        auto v=a3n.at(i);
        sum += v;
        h_que.push(v);
        sum -= h_que.top();
        h_que.pop();
        h_sum.emplace_back(sum);
    }

    //次
    priority_queue<ll> f_que;
    vector<ll> f_sum;
    sum=0;
    FOR(i,2*N,3*N){
        auto v=a3n.at(i);
        sum += v;
        f_que.push(v);
    }
    f_sum.emplace_back(sum);
    for(ll i=2*N-1;i>=N;--i){
        auto v=a3n.at(i);
        sum += v;
        f_que.push(v);
        sum -= f_que.top();
        f_que.pop();
        f_sum.emplace_back(sum);
    }
    assert(f_sum.size()==h_sum.size());
    ll ans=INT64_MIN;
    REP(i,h_sum.size()){
        ll tmp = h_sum.at(i)-f_sum.at(f_sum.size()-i-1);
        ans=max(ans,tmp);
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 6516
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;
#define ll long long

const int maxn = 1e5 + 7;


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

	int k, x;
	cin >> k >> x;
	int n = x - k + 1;
	int m = x + k - 1;
	for (int i = n; i < m; i++){
		cout << i << " ";
	}
	cout << m << endl;
	//system("pause");
	return 0;
}

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

#define ll long long
#define ull unsigned long long
#define db long double
#define pb push_back
#define ppb pop_back
#define F first
#define S second
#define mp make_pair
#define all(x) (x).begin(), (x).end()

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;
typedef vector <ll> vll;

const int N = 1e5 + 123, MOD = 1e9 + 7;
int n, a[N], fact[N], f[N];

int binpow(int x, int y) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = (ll)res * x % MOD;
		}
		x = (ll)x * x % MOD;
		y /= 2;
	}
	return res;
}

void add(int & x, int y) {
	x += y;
	if (x >= MOD) {
		x -= MOD;
	}
}

void sub(int & x, int y) {
	x -= y;
	if (x < 0) {
		x += MOD;
	}
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	fact[0] = 1;
	for (int i = 1; i < N; i++) {
		fact[i] = (ll)fact[i - 1] * i % MOD;
	}
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	int l = 0, r = 0;
	for (int i = 0; i < n; i++) {
		f[i] = (ll)fact[n] * binpow(i + 1, MOD - 2) % MOD;
		add(r, f[i]);
	}
	int res = 0;
	for (int i = 1; i <= n; i++) {
		int cont = (ll)(l + r) * a[i] % MOD;
		add(res, cont);
		if (i < n) {
			sub(r, f[n - i]);
			add(l, f[i]);
		}
	}
	cout << res;
}


Measured memory_bytes: 1408
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>
#include <numeric>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;



int main(void)
{
    int n;
    double t, a;
    int pos;
    double ans=1e9;
    cin >> n >> t >> a;
    REP(i,n)
    {
        int tmp;
        cin >> tmp;
        if(ans > abs((double)(a - t + tmp*0.006)))
        {
            ans = abs((double)(a -t + tmp*0.006));
            pos = i+1;
        }
    }
    cout << pos << endl;
}

Measured memory_bytes: 256
import java.util.Scanner; 
public class Main { 
    public static void main(String[] args) { 
        int i=1; 
        Scanner sc = new Scanner(System.in); 
        while(true){ 
            int x = sc.nextInt(); 
            if(x==0){ 
                break; 
            } System.out.printf("Case %d: %d\n",i,x); 
            i++; 
        } 
    } 
} 


Measured memory_bytes: 65552
package main

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

func main() {
	sc := NewScanner()

	n := sc.ReadInt()
	m := sc.ReadInt()

	// left
	{
		left := 1
		right := (n - 1) / 2
		for ; m > 0; m-- {
			if left >= right {
				break
			}
			fmt.Printf("%d %d\n", left, right)
			left++
			right--
		}
	}

	// right
	{
		left := n/2 + 1
		right := n
		for ; m > 0; m-- {
			if left >= right {
				break
			}
			fmt.Printf("%d %d\n", left, right)
			left++
			right--
		}
	}
}

// util
// *   math/simple

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

func Min(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}
	min := values[0]
	for _, v := range values {
		if v < min {
			min = v
		}
	}
	return min
}

func Max(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}
	max := values[0]
	for _, v := range values {
		if v > max {
			max = v
		}
	}
	return max
}

func Pow(base int, exponent uint) int {
	answer := 1
	for i := uint(0); i < exponent; i++ {
		answer *= base
	}
	return answer
}

// *   io

type Scanner struct {
	bufScanner *bufio.Scanner
}

func NewScanner() *Scanner {
	bufSc := bufio.NewScanner(os.Stdin)
	bufSc.Split(bufio.ScanWords)
	bufSc.Buffer(nil, 100000000)
	return &Scanner{bufSc}
}

func (sc *Scanner) ReadString() string {
	bufSc := sc.bufScanner
	bufSc.Scan()
	return bufSc.Text()
}

func (sc *Scanner) ReadInt() int {
	bufSc := sc.bufScanner
	bufSc.Scan()
	text := bufSc.Text()

	num, err := strconv.Atoi(text)
	if err != nil {
		panic(err)
	}
	return num
}


Measured memory_bytes: 3312
using System;
using System.Linq;

class Program
{
	static void Main(string[] args)
	{
		var n = int.Parse(Console.ReadLine());
		var input = Console.ReadLine().Split().Select(long.Parse).ToArray();

		Array.Sort(input);
		long sum = input.Sum();
		System.Console.WriteLine(input[0] + " " + input[n - 1] + " " + sum);

	}
}


Measured memory_bytes: 18400
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define MOD ((int)1e6 + 3)
#define INF ((int)1e9)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define ctoi(x) (x - 'a') 
#define CTOI(x) (x - 'A')
#define BIT(x) (1 << (x))
using namespace std;

LL modinv(LL a){
    LL b = MOD, u = 1, v = 0;
    while(b){
        LL t = a / b;
        a -= t * b;swap(a, b);
        u -= t * v;swap(u, v);
    }
    u%=MOD;
    if(u < 0) u += MOD;
    return u;

}
int exp(int a, int b){
    LL res = 1;
    LL sum = a;
    for(int i=0;i<30;++i){
        if(BIT(i)&b){
            res = (res * sum)%MOD;
        }
        sum = (sum * sum) % MOD;
    }
    return res;
}
int main(){
    int N;
    cin >> N;
    PII line[N];
    REP(i, N){
        cin >> line[i].first;
        line[i].second = i&1;
    }
    sort(line, line+N);
    int ans = 0;
    REP(i, N){
        if(line[i].second != (i&1)){
            ++ans;
        }
    }
    cout << (ans >> 1) << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<cmath>
int main(void){double x,h,s;while(1){scanf("%lf %lf",&x,&h);if(x==0&&h==0)break;printf("%.6lf\n",x*x+2*x*sqrt((x/2)*(x/2)+h*h));}return 0;}

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

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

int main(){
    int n;
    cin >> n;
    vs s(n);
    rep(i, n) cin >> s[i];
    map<string, int> mp;
    rep(i, n) mp[s[i]]++;
    cout << mp.size() << endl;
    return 0;
}


Measured memory_bytes: 25088
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	int n,a=0,b=0;
	cin>>n;
	int x[100];
	for(int i=0;i<n;i++)cin>>x[i];
	sort(x,x+n,greater<int>());
	for(int i=0;i<n;i++){
		if(i%2==0)a+=x[i];
		else b+=x[i];
	}
	cout<<a-b<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll int ara[100002],cost[100002];
int main()
{
    int n,k;
    cin>>n>>k;
    for(int i=0;i<n;i++){cin>>ara[i];cost[i]=INT_MAX;}

    if(n==1){cout<<"0"<<endl;return 0;}
    cost[0]=0;

    for(int i=1;i<n;i++)
    {

       for(int j=1;j<=k&&j<n&&i-j>=0;j++)
       {
           cost[i]=min(cost[i],abs(ara[i]-ara[i-j])+cost[i-j]);
       }
    }
    cout<<cost[n-1]<<endl;
}


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

#define zton(i,n) for(int i=0;i<=n;i++)
#define oneton(i,n) for(int i=1;i<=n;i++)
#define fo(i,n) for(int i=0;i<n;i++)
#define fab(i,a,b) for(int i=a;i<b;i++)
#define loop(i,b,a) for(int i=a;i>=b;i--)
#define dsort(arr,n) sort(arr, arr + n, greater<int>())
#define vsortd(a) sort(a.begin(), a.end(), greater<double>())
#define vsort(a) sort(a.begin(), a.end())
#define ll long long int
#define test int tc;cin>>tc;while(tc--)
#define dbg(x) cout<<#x<<'='<<(x)<<endl;
#define dbg2(x,y) cout<<#x<<'='<<(x)<<endl<<#y<<'='<<(y)<<endl;
#define dbg3(x,y,z) cout<<#x<<'='<<(x)<<endl<<#y<<'='<<(y)<<endl<<#z<<"="<<(z)<<endl;
#define dbg4(x,y,z,w) cout<<#x<<'='<<(x)<<endl<<#y<<'='<<(y)<<endl<<#z<<"="<<(z)<<endl<<#w<<"="<<(w);
#define minheap priority_queue <int, vector<int>, greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define ff first
#define ss second
#define mpr make_pair
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define mkv vector<int>
#define allzero(dp) memset(dp,0,sizeof(dp))
#define endl "\n"
#define print(x) cout<<x<<endl;

const int mod=1e9+7;
using namespace std;
bool sortcol( const vector<int>& v1,const vector<int>& v2 ) {return v1[1] < v2[1];}

void fastio()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}

bool sortbysecdesc(const pair<ll,ll> &a,const pair<ll,ll> &b){
    if(a.first>b.first)return true;
    if(a.first==b.first)return a.second<b.second;
    return false;
}

ll power(ll x, ll y){
    ll res = 1;x=x%mod;
    while(y>0){
        if(y&1)res=(res*x)%mod;
        y=y>>1;x=(x*x)%mod;}
    return res;
}



void solve()
{
    int n,k;cin>>n>>k;
    int a[n+1];fo(i,n)cin>>a[i+1];
    for(int i=k+1;i<=n;i++){
        if(a[i-k]>=a[i])print("No")
        else print("Yes")
    }

}

int main()
{
  //  fastio();
   // test
    solve();
}


Measured memory_bytes: 4408
//
// Created on 2020/05/13.
//


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;


int main() {
    int a,b;
    int ans;
    cin>>a>>b;
    if(a>=13) ans = b;
    else if (a>=6) ans = b/2;
    else if(a<6) ans = 0;

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


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

using namespace std;

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

    int a[3];

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

    sort(a, a+3);

    cout << a[1] - a[0] + a[2] - a[1] << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>

int n, m;

int main() {
    scanf("%d%d", &n, &m);
    n = (m << 1) + 1;
    for (int i = 1; i <= m >> 1; ++i) printf("%d %d\n", i, m + 2 - (m & 1) - i);
    for (int i = m + 2 - (m & 1); i <= n - (m + 1 >> 1); ++i) printf("%d %d\n", i, m + 2 - (m & 1) + n - i);
    return 0;
}


Measured memory_bytes: 1732
#include <iostream>

using namespace std;
 
const int coin[4] = {10,50,100,500};
int cost,ans,a[4];
int ans_coin[4];
 
int check(int total){
    int res = 0;
 
    for(int i = 3 ; i >= 0 ; i--){
	res += total / coin[i];
	total %= coin[i];
    }
 
    return res;
}
 
void judge(){
    int ans = 1<<28;
   
    for(int i = 0 ; i <= a[0] ; i++){
	for(int j = 0 ; j <= a[1] ; j++){
	    for(int k = 0 ; k <= a[2] ; k++){
		for(int l = 0 ; l <= a[3] ; l++){
 
		    int sum = coin[0]*i+coin[1]*j+coin[2]*k+coin[3]*l;
		    if(sum < cost) continue;
 
		    int want = sum - cost;
		    int tmp = check(want) - (i + j + k + l);
 
		    if(tmp < ans){
			ans_coin[0] = i; ans_coin[1] = j;
			ans_coin[2] = k; ans_coin[3] = l;
			ans = tmp;
		    }
		}
	    }
	}
    }
}
 
int main(){  
    bool flg = false;
    while(cin >> cost ,cost){
	if(flg) cout << endl;
	for(int i = 0 ; i < 4 ; i++) cin >> a[i];
	judge();
	for(int i = 0 ; i < 4 ; i++){
	    if(ans_coin[i]){
		cout << coin[i] << " " << ans_coin[i] << endl;
	    }
	}
	flg = true;
    }
    return 0;
}

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

int main()
{
    while (true)
    {
        int h, w;
        scanf("%d %d", &h, &w);
        if (h == 0 && w == 0)
            break;

        for (int i = 0; i < h; i++)
        {
            for (int j = 0; j < w; j++)
            {
                if ((i + j) % 2 == 0)
                    printf("#");
                else
                    printf(".");
            }
            printf("\n");
        }
        printf("\n");
    }
}


Measured memory_bytes: 3132
import java.util.Scanner;

public class Main {

    public static final int MOD = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int d = Integer.parseInt(sc.next());
        int[] c = new int[26];
        int[] cd = new int[26];
        for (int i = 0; i < 26; i++) {
            c[i] = Integer.parseInt(sc.next());
        }
        int[][] s = new int[d][26];
        int[] max = new int[d];
        for (int i = 0; i < d; i++) {
            int maxd = 0;
            int maxdd = 0;
            for (int j = 0; j < 26; j++) {
                int temp = Integer.parseInt(sc.next());
                s[i][j] = temp;
                if (maxd < temp) {
                    maxd = temp;
                    maxdd = j + 1;
                }
            }
            max[i] = maxdd;
        }
        StringBuilder sb = new StringBuilder();
        int ans = 0;
        for (int i = 0; i < d; i++) {
//            cd[max[i]] = i + 1;
//            ans += s[i][max[i]] - totalSubC(c, cd, i + 1);
            sb.append(max[i]);
            sb.append("\n");
        }
        System.out.println(sb.toString());
    }

    private static int totalSubC(int[] c, int[] cd, int d) {
        int ans = 0;
        for (int i = 0; i < 26; i++) {
            ans += c[i] * (d - cd[i]);
        }
        return ans;
    }
}

Measured memory_bytes: 41660
#include <iostream>

using namespace std;

int n;
const int MAX = 1e5 + 10;
int dp[MAX];

int main()
{
	cin >> n;
	
	int tower[n]; // 10 30 40 20
	for(int & in : tower)
		cin >> in;
	
	
	dp[0] = 0;
	dp[1] = abs(tower[1] - tower[0]);
	
	for(int i = 2; i < n; ++i)
		dp[i] = min(abs(tower[i] - tower[i - 2]) + dp[i - 2], abs(tower[i] - tower[i - 1]) + dp[i - 1]);
	
	
	cout << dp[n - 1] <<' ';
	return 0;
}
/* // 10 30 40  20
	  0  20 30  30	
 
			    10
	  	 30             40
     40      20     20
 20
*/


Measured memory_bytes: 1024
from bisect import bisect_left, bisect_right
n = int(input())
l = list(map(int, input().split()))
l.sort()

ans = 0
for i in range(n):
    for j in range(i + 1, n):
        if l[i] == l[j]:
            continue

        for k in range(j + 1, n):
            if l[i] == l[k] or l[j] == l[k]:
                continue
            if l[i] + l[j] > l[k]:
                ans += 1

print(ans)


Measured memory_bytes: 67956
n, m = map(int, input().split())
ans = 0
dp = [0 for _ in range(m + 1)]
for _ in range(n):
    w, v = map(int, input().split())
    for i in range(m, w - 1, -1):
        dp[i] = max(dp[i], dp[i - w] + v)
        ans = max(ans, dp[i])
print(ans)

Measured memory_bytes: 45040
#include<bits/stdc++.h>
using namespace std;
void solve(){
        long long int i,j,k,l,n,m,x,y,z,r;
        
        long long int  a;
        long double b;
        cin>>a>>b;
        
        long double ans=(long double)(a*b);
        cout<<(long long int)ans<<endl;
}
int main(){
        
        long long int i,j,k,n,m,x,y,z,q;
        
                solve();
       
        return 0;
}

Measured memory_bytes: 3696
t_a = int(input())
t_b = int(input())
t_c = int(input())
t_d = int(input())
t_e = int(input())

Time = 0

time_list = [t_a, t_b, t_c, t_d, t_e]

i = 1
tmp = 10

for time in time_list:
    if time % 10 == 0:
        a = 3
    elif(time % 10 < tmp):
        tmp = time % 10
        min_key = i

    i=i+1
j=1

try:
    if min_key:
        for t in time_list:
            if j != min_key:
                if t % 10 == 0:
                    Time = Time + t
                else:
                    Time = Time + t + (10 - (t % 10))
            j = j+ 1

        Time = Time + time_list[min_key-1]

        print(Time)



#min_keyがない場合すべて0なのでそのまま足す
except:
    Time = sum(time_list)
    print(Time)


Measured memory_bytes: 3064
#include<stdio.h>
int main(void){
	int i,n,sum=0;
	for(i=0;i<5;i++){
		scanf("%d",&n);
		if(n<40) sum+=40;
		else sum+=n;
//		printf("%d\n",sum);
	}
	printf("%d\n",sum/5);
	return 0;
}

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

#define ll long long
#define ull unsigned long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1<<29)
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int MAX =510000;
ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int H=in();
    int A=in();
    if(H%A>0){
        cout<<H/A+1<<endl;   
    }else{
        cout<<H/A<<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 n = sc.nextInt();
	int[] t = new int[n];
	for (int i = 0; i < n; i++)
	    t[i] = sc.nextInt();
	int m = sc.nextInt();
	int[] p = new int[m];
	int[] x = new int[m];
	for (int i = 0; i < m; i++) {
	    p[i] = sc.nextInt() - 1;
	    x[i] = sc.nextInt();
	}
	for (int i = 0; i < m; i++) {
	    int ans = 0;
	    for (int j = 0; j < n; j++) {
		if (j == p[i])
		    ans += x[i];
		else
		    ans += t[j];
	    }
	    System.out.println(ans);
	}
    }
}


Measured memory_bytes: 10320
#include <stdio.h>
int main(void){
    int i, j, H, W, k;
    for(k=0; k<300; k++){
    scanf("%d %d", &H, &W);
    if(H==0 && W==0){
        break ;
    }
    for(i=0; i<H; i++){
        for(j=0; j<W; j++){
        putchar('#');}
        printf("\n");
        
    }
    printf("\n");

    }
    
    
    return 0;
    
}



Measured memory_bytes: 2608
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
typedef long long ll;
using namespace std;
const double PI = acos(-1);
const int maxn = 105;

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	string A,B, ans;
	cin >> A;
	cin >> B;
	int lenA = A.length();
	int lenB = B.length();
	if(lenA > lenB) ans = "GREATER";
	else if(lenA < lenB) ans = "LESS";
	else{
		for(int i = 0; i < lenA; i++){
			if(A[i] > B[i]){ ans = "GREATER"; break;}
			else if(A[i] < B[i]){ ans = "LESS"; break;}
			else if(A[lenA - 1] == B[lenB - 1]){ ans = "EQUAL";}
		}
	}
	cout << ans << endl;
	return 0 ;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
#include<deque>
#include<cassert>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(int (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
const double PI = 3.1415926535897932384626433832795;
const int mod = 1000000007;
const int INF = 1001001001;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  vector<int> jj(n), ii(n);
  rep(i, n) jj[i] = (i + 1) - a[i];
  rep(i, n) ii[i] = a[i] + (i + 1);
  map<int, int> mp;
  ll ans = 0;
  rep(i, n) {
    ans += mp[jj[i]];
    mp[ii[i]]++;
  }
  cout << ans << endl;

}

Measured memory_bytes: 22580
H,W = map(int, input().split())

convert = [list(map(int, input().split())) for _ in range(10)]


for k in range(10):
    for i in range(10):
        for j in range(10):
            convert[i][j] = min(convert[i][j], convert[i][k] + convert[k][j])


ans = 0
A = [list(map(int, input().split())) for _ in range(H)]
for i in range(H):
    for j in range(W):
        if A[i][j] not in [-1,1]:
            ans += convert[A[i][j]][1]

print(ans)

Measured memory_bytes: 3444
fun main() {
    val k = readLine()!!.toLong()
    if (k % 2L == 0L || k % 5L == 0L) {
        println(-1)
    } else {
        var curr = 0L
        for (answer in 1..100000000) {
            curr *= 10L
            curr += 7L
            curr %= k
            if (curr == 0L) {
                println(answer)
                break
            }
        }
    }
}

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

int main() {

    int n;

    cin >> n;

    vector<int> white(n, 0);
    vector<int> black(n, 0);

    for(int i = 0; i < n; ++i) {
        char ch;
        cin >> ch;

        if(ch == '.')
            white[i]++;
        else
            black[i]++;
        
        if(i) {
            white[i] += white[i - 1];
            black[i] += black[i - 1];
        }
    }


    if(white[n - 1] == n || black[n - 1] == n) {
        cout << 0 << endl;
        return 0;
    }

    int ans = 999999999;

    for(int i = 0; i <= n; ++i) {

        int leftBlack;
        int leftWhite;
        if(i) {
            leftBlack = black[i - 1];
            leftWhite = white[i - 1];
        }
        else {
            leftBlack = leftWhite = 0;
        }

        int rightWhite;
        if(i < n) 
            rightWhite = white[n - 1] - leftWhite;
        else
            rightWhite = 0;

        ans = min(ans, leftBlack + rightWhite);

    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4696
s=input()
n=len(s)
k=int(input())
ans=[]
for i in range(n):
    if i==n-1:
        ans.append(chr(((ord(s[i])-97+k)%26)+97))
    else:

        if s[i]=="a":
            ans.append("a")
        else:
            if 26-(ord(s[i])-97)<=k:
                ans.append("a")
                k-=(26-(ord(s[i])-97))
            else:
                ans.append(s[i])
print("".join(ans))


Measured memory_bytes: 4212
import java.util.*;
import java.io.*;
import static java.lang.System.in;

public class Main {
    static int n,k;
    static long mod = 1000000000+7;
    static long[] fac,inv;
    static int[] id,size;
    //static long mod = 1000000000+7;
    //static HashSet<Integer>[] graph;
    //static ArrayList<Integer>[] rec = new ArrayList[3];
    public static void main(String[] args)throws IOException {
        //BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        //String[] buf = reader.readLine().split(" ");
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        PrintWriter out = new PrintWriter(System.out);
        HashSet<String> res = new HashSet<>();
        if(n%2==0){
            for(int i=1;i<=n;i++){
                for(int j=1;j<n;j++){
                    if(i==j||i+j==n+1) continue;
                    res.add(getKey(i,j));
                }
            }
        }else{
            for(int i=1;i<n;i++) res.add(getKey(i,n));
            for(int i=1;i<n;i++){
                for(int j=1;j<n;j++){
                    if(i==j||i+j==n) continue;
                    res.add(getKey(i,j));
                }
            }
        }
        out.println(res.size());
        for(String w:res) out.println(w);
        out.flush();
    }
    static String getKey(int i, int j){
        if(i>j){
            int c = i;
            i = j; j = c;
        }
        return Integer.toString(i)+" "+Integer.toString(j);
    }
}

Measured memory_bytes: 24276
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>

using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep1(i,n) for(ll i=1;i<(ll)n;i++)
#define repf(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define repr(i,a,b) for(ll i=(ll)a-1;i>=(ll)b;i--)
#define Fi first
#define Se second
typedef pair<ll, ll> pll;
const ll MAX = 1000000000000000000;
const char END = '\n';


ll trains(ll x, ll N, vector<ll> C, vector<ll> S, vector<ll> F) {
	ll sub = 0, time;

	if (x == N - 1)
		return 0;

	repf(i, x, N - 1) {
		time = S[i];
		while (1) {
			if (sub <= time) {
				sub = time + C[i];
				break;
			}
			else
				time += F[i];
		}
	}
	return sub;
}


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

	ll N;
	cin >> N;
	vector<ll> C(N-1), S(N-1), F(N-1), Ans(N, 0);
	rep(i, N-1)
		cin >> C[i] >> S[i] >> F[i];

	rep(i, N)
		Ans[i] = trains(i, N, C, S, F);

	rep(i, N)
		cout << Ans[i] << END;

	return 0;
}


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

using namespace std;

int main(){
    int n;
    cin>>n;
    vector<int> vc(n);
    for(int i = 0 ; i < n ; i++ ) cin>>vc[i];
    
    int ans = 0,q,a;
    cin>>q;
    
    sort(vc.begin(),vc.end());
    while(q>0){
        cin >> a;
        if(binary_search(vc.begin(),vc.end(),a)) ans+=1;
        q-=1;
    }
    
  cout<<ans<<endl;
}


Measured memory_bytes: 3128
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = (n-1); i >= 0; i--)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const ll INF = 1LL<<60;
const int IINF = 1000000000;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int A, B, K; cin >> A >> B >> K;

    rep(i,K){
        if(i%2 == 0){
            if (A % 2 == 1){
                A--;
            }
            B += A/2;
            A /= 2;
        }
        else{
            if (B % 2 == 1){
                B--;
            }
            A += B/2;
            B /= 2;
        }
    }

    cout << A << " " << B << endl;
}


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

#ifndef ONLINE_JUDGE
#  define LOG(x) (cerr <<">>>>>>"<< #x << " = " << (x) << endl)
#else
#  define LOG(x) ((void)0)
#endif

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

for(int i=-1;i<=m;i++)cout<<"#";cout<<endl;
while(n--){cin>>s;cout<<"#"<<s<<"#"<<endl;}
for(int i=-1;i<=m;i++)cout<<"#";cout<<endl;


}



Measured memory_bytes: 3588
import java.util.*;
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        
        if(a < b && b < c){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        
        
    }
}


Measured memory_bytes: 26384
input = gets.strip.split(" ")

stack = []
input.each do |v|
  if v =~ /\d/
    stack << v.to_i
  elsif v =~ /\D/
    y = stack.pop
    x = stack.pop
    if v =~ /\+/
      stack << x + y
    elsif v =~ /\-/
      stack << x - y
    elsif v =~ /\*/
      stack << x * y
    end
  end
end

p stack[0]

Measured memory_bytes: 8696
#include <iostream>
#include <numeric>
#include <cmath>
#include <algorithm>
#include <vector>

using namespace std;

#define sp ' '
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define forn(YY, yy) for(long long int yy = 0; yy < YY; ++yy)
#define prn(XX) cout << XX << endl
#define prs(XX) cout << XX << " "

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;

const int MOD = 1e9 + 7;
const int INF = 2e9 + 13;
const int mINF = -2e9 - 13;
const double PI = 3.14159265358979;
const double EPS = 1e-9;

const long long MAXN = 1e5 + 3; //daysayi
ll dn[MAXN][3]; //enson A ise 0, B ise 1, C ise 2
ll N;

ll a[MAXN], b[MAXN], c[MAXN];

int main(int argc, char **argv){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    
    cin >> N;
    for(int i = 0; i < N; ++i)
        cin >> a[i] >> b[i] >> c[i];

    dn[0][0] = a[0];
    dn[0][1] = b[0];
    dn[0][2] = c[0];

    for(int i = 1; i < N; ++i){
        dn[i][0] = max(dn[i-1][1], dn[i-1][2]) + a[i];
        dn[i][1] = max(dn[i-1][0], dn[i-1][2]) + b[i];
        dn[i][2] = max(dn[i-1][0], dn[i-1][1]) + c[i];
    }

    cout << max(dn[N-1][0], max(dn[N-1][1], dn[N-1][2])) << endl;

    return 0;
}

//cikisir



Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define FORI(i,v) for (auto i = v.begin(); i != v.end(); i++)
#define ALL(v) v.begin(), v.end()
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)
#define YES(b) cout << ((b) ? "YES" : "NO") << endl
#define Yes(b) cout << ((b) ? "Yes" : "No") << endl
 
const int MAX = 1e6+10;
const ll INF = 1e18;
 
const int DX[4] = {-1, 0, 1, 0};
const int DY[4] = {0, -1, 0, 1};
 
int H, W, K;
int X1, Y1, X2, Y2;
vector<vector<bool>> C;
 
ll solve() {
    vvi dist(H, vi(W, INF));
    queue<ii> que;
    que.push(ii(X1, Y1));
    dist[X1][Y1] = 0;
 
    while(!que.empty()) {
        ll x, y;
        tie(x, y) = que.front(); que.pop();
 
        REP (d, 4) {
            FOR (k, 1, K+1) {
                int nx = x + DX[d] * k, ny = y + DY[d] * k;
                if (nx < 0 || H <= nx || ny < 0 || W <= ny || !C[nx][ny] || dist[nx][ny] <= dist[x][y]) break;
                if (dist[nx][ny] == INF) {
                    dist[nx][ny] = dist[x][y] + 1;
                    que.push(ii(nx, ny));
                }
            }
        }
    }
 
    if (dist[X2][Y2] == INF) return -1;
    return dist[X2][Y2]; 
}
 
int main() {
    cout << fixed << setprecision(15);
    cin >> H >> W >> K >> X1 >> Y1 >> X2 >> Y2;
    X1--; Y1--; X2--; Y2--;
    REP (h, H) {
        string s;
        cin >> s;
        C.push_back(vector<bool>(W));
        REP (w, W) if (s[w] == '.') C[h][w] = true;
    }
    cout << solve() << endl;
}

Measured memory_bytes: 19116
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}
int dx[4]={0,1,-1,0};
int dy[4]={1,0,0,-1};
long double eps = 1e-6;
long double pi = acos(-1);

template< int mod = 1000000007 >
struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) {
        if((x += p.x) >= mod) x -= mod;
        return *this;
    }
    ModInt &operator-=(const ModInt &p) {
        if((x += mod - p.x) >= mod) x -= mod;
        return *this;
    }
    ModInt &operator*=(const ModInt &p) {
        x = (int) (1LL * x * p.x % mod);
        return *this;
    }
    ModInt &operator/=(const ModInt &p) {
        *this *= p.inverse();
        return *this;
    }

    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }

    ModInt inverse() const {
        int a = x, b = mod, u = 1, v = 0, t;
        while(b > 0) {
            t = a / b;
            swap(a -= t * b, b);
            swap(u -= t * v, v);
        }
        return ModInt(u);
    }

    ModInt pow(int64_t n) const {
        ModInt ret(1), mul(x);
        while(n > 0) {
            if(n & 1) ret *= mul;
            mul *= mul;
            n >>= 1;
        }
        return ret;
    }

    friend ostream &operator<<(ostream &os, const ModInt &p) {
        return os << p.x;
    }

    friend istream &operator>>(istream &is, ModInt &a) {
        int64_t t;
        is >> t;
        a = ModInt< mod >(t);
        return (is);
    }

    static int get_mod() { return mod; }
};

const int MAX = 2010000;
const int mod = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

// const int mod = 998244353;
using mint = ModInt< mod >;


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


    ll k;
    string s;
    COMinit();
    cin>>k>>s;
    int n = s.size();
    mint ans = 0;
    mint beki = 1;
    mint beki2 = mint(25).pow(k);
    for(int i=0;i<=k;i++){
        ans += beki * beki2 * mint(COM(n-1+k-i,k-i));
        beki *= mint(26); 
        beki2 /= mint(25);
    }
    cout << ans << endl;

}

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

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const long long INF = 100100100100;
const long long MOD = 1000000007;
typedef pair<int,int> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

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

int main() {
    int N,M;cin >> N >> M;
    string S;cin >> S;
    //-1の場合を処理
    int ren = 0;
    for(int i = 1;i<N;i++){
        if(S.at(i) == '1') ren++;
        else ren = 0;
        if(ren >= M){
            cout << -1 << endl;
            return 0;
        }
    }
    vector<string> ans;
    //後ろから考える
    for(int i = N;i>=0;i){
        if(i == 0) break;
        //後ろから進むマスが大きいように選ぶ→最終的に進むマスが小さくなる→辞書順で小さくなる
        for(int j = M;j>=1;j--){
            if(i-j < 0) continue;
            if(S.at(i-j) == '0'){
                string now = to_string(j);
                ans.push_back(now);
                i -= j;
                break;
            }
        }
    }
    reverse(ans.begin(),ans.end());
    for(int i = 0;i<ans.size();i++){
        cout << ans.at(i);
        if(i == ans.size()-1) cout << endl;
        else cout << " ";
    }
}


Measured memory_bytes: 6004
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const ll mod = 1e9+7;

struct edge{
    int to;
    ll cost;
};

const int N = 100000;
vector<edge> G[N];

const ll INF = LLONG_MAX/3;

vector<ll> dijk(int start, int n){
    vector<ll> d(n,INF);
    d[start] = 0;

    using P = pair<ll,int>;
    priority_queue<P, vector<P>, greater<P>> pq;
    pq.push({0,start});
    while(!pq.empty()){
        P now = pq.top();
        pq.pop();
        int v = now.se;
        if(now.fi > d[v]) continue;
        for(const auto &e:G[v]){
            if(d[e.to] > d[v]+e.cost){
                d[e.to] = d[v]+e.cost;
                pq.push({d[e.to], e.to});
            }
        }
    }
    return d;
}

vector<ll> pat(int start, int n, const vector<ll> &dd){
    vector<ll> ret(n);
    ret[start] = 1;

    using P = pair<ll,int>;
    priority_queue<P, vector<P>, greater<P>> pq;
    vector<bool> vis(n);
    pq.push({0,start});
    while(!pq.empty()){
        P now = pq.top();
        pq.pop();
        int v = now.se;
        if(vis[v]) continue;

        for(const auto &e:G[v]){
            if(dd[e.to] == dd[v]+e.cost){
                (ret[e.to] += ret[v]) %= mod;
                pq.push({dd[e.to], e.to});
            }
        }
        vis[v] = true;
    }
    return ret;
}

int main(){
    int n,m,s,t;
    cin >>n >>m >>s >>t;
    --s;
    --t;

    vector<int> u(m),v(m);
    vector<ll> d(m);
    rep(i,m){
        cin >>u[i] >>v[i] >>d[i];
        --u[i];
        --v[i];
        G[u[i]].pb({v[i],d[i]});
        G[v[i]].pb({u[i],d[i]});
    }

    vector<ll> ds = dijk(s,n), dt = dijk(t,n);
    ll D = ds[t];

    vector<bool> ok(n);
    rep(i,n) ok[i] = (ds[i]+dt[i] == D);

    vector<ll> ps = pat(s,n,ds), pt = pat(t,n,dt);

    ll ans = (ps[t]*ps[t])%mod;
    rep(i,m){
        int a = u[i], b = v[i];
        if(!ok[a] || !ok[b]) continue;
        if(ds[a]>dt[a] && ds[b]<dt[b]) swap(a,b);

        if(ds[a]<dt[a] && ds[b]>dt[b] && ds[a]+d[i]==ds[b]){
            ll sub = (ps[a]*pt[b])%mod;
            sub = (sub*sub)%mod;
            ans = (ans-sub+mod)%mod;
        }
    }
    rep(i,n)if(ok[i] && ds[i]==dt[i]){
        ll sub = (ps[i]*pt[i])%mod;
        sub = (sub*sub)%mod;
        ans = (ans-sub+mod)%mod;
    }
    cout << ans << endl;
    return 0;
}


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

long int x, y, z;
string winner;

void solve();

int main(){
    cin >> x >> y;
    z = 0;
    solve();
    cout << winner << endl;
    return 0;
}

void solve(){
    if(x < y){
        z = x;
        x = y;
        y = z;
    }
    if(x - y > 1){
        winner = "Alice";
    }else{
        winner = "Brown";
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
using namespace std;
// node最大量
#define MAX 100005
#define NIL -1

struct Node {
    int parent;
    int left;
    int right;
};

// 配列で保持する
Node gNode[MAX];
int gDepth[MAX],gHeight[MAX];

// 兄弟を返す
int getSibling(int u){
    // rootの場合
    if(gNode[u].parent == NIL)return NIL;
    // 自身が右の子だった場合
    if(gNode[gNode[u].parent].left != u && gNode[gNode[u].parent].left != NIL){
        return gNode[gNode[u].parent].left;
    }
    // 自身が左の子だった場合
    if(gNode[gNode[u].parent].right != u && gNode[gNode[u].parent].right != NIL){
        return gNode[gNode[u].parent].right;
    }
    // 親が一つしか子を持たない状態
    return NIL;
}

void print(int node){
    cout << "node " << node << ": ";
    cout << "parent = " << gNode[node].parent << ", ";
    cout << "sibling = " << getSibling(node) << ", ";
    
    int deg = 0;
    if(gNode[node].left != NIL) deg++;
    if(gNode[node].right != NIL) deg++;
    cout << "degree = " << deg << ", ";
    cout << "depth = " << gDepth[node] << ", ";
    cout << "height = " << gHeight[node] << ", ";
    
    if(gNode[node].parent == NIL){
        cout << "root\n";
    }else if(gNode[node].left == NIL && gNode[node].right == NIL){
        cout << "leaf\n";
    }else{
        cout << "internal node\n";
    }
}

// 深さを設定する
void setDepth(int u,int d){
    // 親の節点が葉のケース
    if(u == NIL) return;
    gDepth[u] = d;
    // 左右の子にもセットする
    setDepth(gNode[u].left, d + 1);
    setDepth(gNode[u].right, d + 1);
}

// 高さの設定をする
int setHeight(int u){
    int h1,h2;
    h1 = h2 = 0;
    if(gNode[u].left != NIL){
        h1 = setHeight(gNode[u].left) + 1;
    }
    if(gNode[u].right != NIL){
        h2 = setHeight(gNode[u].right) + 1;
    }
    return gHeight[u] = (h1 > h2) ? h1 : h2;
}

int main(){
    int left,right,v,n,root = 0;
    cin >> n;
    // 初期化
    for(int i = 0;i < n;++i){
        gNode[i].parent = gNode[i].left = gNode[i].right = NIL;
    }
    
    for(int i = 0;i < n;++i){
        cin >> v >> left >> right;
        gNode[v].left = left;
        gNode[v].right = right;
        // 親の設定
        if(left != NIL){
            gNode[left].parent = v;
        }
        if(right != NIL){
            gNode[right].parent = v;
        }
    }

    // rootを探す
    for(int i = 0;i < n;++i){
        if(gNode[i].parent == NIL){
            root = i;
        }
    }
    
    // 根からはじめて深さを代入する
    setDepth(root, 0);
    setHeight(root);
    
    for(int i = 0;i < n;++i){
        print(i);
    }
    return 0;
} 


Measured memory_bytes: 3112
const main = function(input){
  var str = input.split("\n")[1];
  var len = str.length;
  var max = 0;

  for(var i=0;i<len;i++){
  	var left = str.slice(0,i);
    var right = str.slice(i,len);
    var count = 0;
    var countedCode=[];
    for(var j=0;j<left.length;j++){
    	var code = left[j].charCodeAt();
        if(countedCode.indexOf(code)>=0)continue;
        countedCode.push(code);
        for(var k=0;k<right.length;k++){
        	var rcode = right[k].charCodeAt();
          	if(code===rcode){
              count++;
          	  break;
            }
        }
      if(max<count) max = count;
    }
  }
  console.log(max);
  
}


main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));

Measured memory_bytes: 7628
import sys
input = sys.stdin.readline

N,M=map(int,input().split())
A=set([int(input()) for i in range(M)])
mod=10**9+7

ANSLIST=[0]*(N+4)
ANSLIST[0]=1

for i in range(N):
    if not(i+1 in A):
        ANSLIST[i+1]=(ANSLIST[i+1]+ANSLIST[i])%mod

    if not(i+2 in A):
        ANSLIST[i+2]=(ANSLIST[i+2]+ANSLIST[i])%mod

    #print(ANSLIST)
    #print()

print(ANSLIST[N])

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

int main() {
  int a,b;
  cin >> a >> b;
  cout << a/b << " " << a%b << " " ;
  double x,y;
  x=a,y=b;
   cout << fixed << setprecision(10);
  cout << x/y << endl;
}


Measured memory_bytes: 3292