akhauriyash/Code-Regression huggingface dataset:
# coding: utf-8
# Your code here!
def solv1():
    n=int(input())
    
    a=[[]for i in range(n)]
    a[0]=[[0]]
    
    for i in range(n-1):
        b=[]
        for pa in a[i]:
    #        print(pa)
            el=[j for j in set(pa)]
    #        print(el)
            el.append(max(pa)+1)
            for l in el:
                b+=[pa+[l]]
    #    print(i,b)
        a[i+1]=b
    ans=[j for j in a[n-1]]
        #print(i)
    ans=sorted(ans)
    for i in ans:
        print(''.join([chr(j+97) for j in i]))

solv1()


Measured memory_bytes: 83420
#include <bits/stdc++.h>
using namespace std;
#define ll long long
vector<vector<ll>> dp(3003,vector<ll>(3003,-1));
int n;
vector<int> v(3003);
ll solve(int i,int j,int t)
{
    if(i>j)
    return 0;
    if(dp[i][j]!=-1)
    return dp[i][j];
    ll ans;
    if(t)
    {
        ans=0;
       ans = max(ans,v[i]+solve(i+1,j,!t));
       ans = max(ans,v[j]+solve(i,j-1,!t));
    }
    else
    {
        ans = LONG_MAX;
        ans = min(ans,solve(i+1,j,!t));
        ans = min(ans,solve(i,j-1,!t));
    }
    return dp[i][j] = ans;
}
int main() {
    int n;
    cin>>n;
    ll tot=0;
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
        tot+=v[i];
    }
    ll X = solve(0,n-1,1);
    ll res = 2*X-tot;
    cout<<res;
}


Measured memory_bytes: 73940
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int, int> pi;
const int mod = 1e9 + 9;
const int MAXN = 100005;

int n;
vector<int> gph[MAXN];

int f(int x, int p){
	int ans = 0;
	for(auto &i : gph[x]){
		if(i == p) continue;
		ans ^= f(i, x) + 1;
	}
	return ans;
}

int main(){
	scanf("%d",&n);
	for(int i=1; i<n; i++){
		int x, y;
		scanf("%d %d",&x,&y);
		gph[x].push_back(y);
		gph[y].push_back(x);
	}
	cout << (f(1, 0) ? "Alice" : "Bob");
}


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

int main()
{
  int n,a[55],b[55],c[55],sum=0;
  cin>>n;
  for(int i=1;i<=n;i++){ 
      cin>>a[i];
  }
  for(int i=1;i<=n;i++){ 
      cin>>b[i];
  }
  for(int i=1;i<=n-1;i++){ 
      cin>>c[i];
  }
   int pr=-1;
   for(int i=1;i<=n;i++){ 
       sum+=b[a[i]];
       if(a[i]-pr==1)sum+=c[pr]; 
       pr=a[i];
      // cout<<sum<<" ";
   } 
   cout<<sum;
   
       
  
  
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int time = a + b;
		if(time >= 24) {
			time = time - 24;
		}
		System.out.println(time);
	}
}

Measured memory_bytes: 21204
import numpy as np
N, M = map(int, input().split())
D = [0]*M
for i in range(M):
    temp = list(map(int, input().split()))
    for j in temp[1:]:
        D[i] +=  2**(j-1)
p = list(map(int, input().split()))
ans = 0
for s in range(2**N):
    temp = True
    for i,d in enumerate(D):
        temp &= bin(s&d).count('1')%2==p[i]
    if temp:
        ans += 1
print(ans)

Measured memory_bytes: 12396
#include <iostream>
#include <stdio.h>
using namespace std;

int main(void) {
	int r, c;
	int num[101][101] = {};
	cin >> r >> c;
	for (int i = 0; i < r; i++) {
		for (int j = 0; j < c; j++) {
			cin >> num[i][j];
			num[i][c] += num[i][j];
			num[r][j] += num[i][j];
			num[r][c] += num[i][j];
		}
	}
	for (int i = 0; i < r + 1; i++) {
		for (int j = 0; j < c + 1; j++) {
			cout << num[i][j];
			if (j == c) cout << endl;
			else cout << " ";
		}
	}
	return 0;
}



Measured memory_bytes: 3132
W,H,N=map(int, input().split())
l=[]
for i in range(N):
  l.append(list(map(int, input().split())))
maxmin=[0,W,0,H]
for i in range(N):
  if l[i][2] == 1 and maxmin[0] < l[i][0]:
    maxmin[0] = l[i][0]
  elif l[i][2] == 2 and maxmin[1] > l[i][0]:
    maxmin[1] = l[i][0]
  elif l[i][2] == 3 and maxmin[2] < l[i][1]:
    maxmin[2] = l[i][1]
  elif l[i][2] == 4 and maxmin[3] > l[i][1]:
    maxmin[3] = l[i][1]
if maxmin[1]-maxmin[0] >= 0 and maxmin[3]-maxmin[2] >= 0:
  print((maxmin[1]-maxmin[0])*(maxmin[3]-maxmin[2]))
else:
  print(0)

Measured memory_bytes: 3064
while 1:
    W, Q = map(int, input().split())
    if W == Q == 0:
        break
    A = [0]*W
    for i in range(Q):
        s, *qs = input().split()
        if s == 's':
            x, w = map(int, qs)
            su = sum(A[:w-1])
            k = -1
            for i in range(W-w+1):
                su += A[i+w-1]
                if su == 0:
                    k = i
                    break
                su -= A[i]
            if k == -1:
                print("impossible")
            else:
                print(k)
                for i in range(w):
                    A[k+i] = x+1
        else:
            x = int(qs[0])
            for i in range(W):
                if A[i] == x+1:
                    A[i] = 0
    print("END")



Measured memory_bytes: 5596
import sys
from math import ceil as C, floor as F, sqrt, gcd as G
from collections import defaultdict as D, Counter as CNT
from functools import reduce as R
import heapq as HQ

class Heap:
  def __init__(self, data, reverse=False):
    self.reverse = -1 if reverse else 1
    self.data = [self.reverse * d for d in data]
    HQ.heapify(self.data)
  def push(self, x): return HQ.heappush(self.data, self.reverse * x)
  def pop(self): return self.reverse * HQ.heappop(self.data) 

ALP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
alp = 'abcdefghijklmnopqrstuvwxyz'
def _X(): return sys.stdin.readline().rstrip().split(' ')
def _S(ss): return tuple(ss) if len(ss) > 1 else ss[0]
def S(): return _S(_X())
def Ss(): return list(S())
def _I(ss): return tuple([int(s) for s in ss]) if isinstance(ss, tuple) else int(ss)
def I(): return _I(S())
def _Is(ss): return list(ss) if isinstance(ss, tuple) else [ss]
def Is(): return _Is(I())

word = S()
word += 'es' if word[-1] == 's' else 's'
print(word)


Measured memory_bytes: 67396
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <set>
#include <unordered_set>


using namespace std;


int main()
{
    int H, W;
    vector<vector<char>> grid;
    cin>>H>>W;
    for(int i=0; i<H; i++){
        vector<char> vec_col(W, '.');
        for(int j=0; j<W; j++){
            cin >> vec_col[j];
        }
        grid.push_back(vec_col);
    }
    
    vector<vector<int>> row_wise;
    vector<vector<int>> col_wise;

    for(int r=0; r<H; r++){
        vector<int> row_tmp;
        for(int c=0; c<W; c++){
            if(grid[r][c] == '#'){
                row_tmp.push_back(c);
            }
        }
        row_tmp.push_back(W);
        row_wise.push_back(row_tmp);
    }


    for(int c=0; c<W; c++){
        vector<int> col_tmp;
        for(int r=0; r<H; r++){
            if(grid[r][c] == '#'){
                col_tmp.push_back(r);
            }
        }
        col_tmp.push_back(H);
        col_wise.push_back(col_tmp);
    }


    int ans = 0;
    for(int y=0; y<H; y++){
        for(int x=0; x<W; x++){
            if(grid[y][x]=='#')
                continue;
            vector<int> row = row_wise[y];
            vector<int> col = col_wise[x];
            int idx_row = distance(row.begin(), lower_bound(row.begin(), row.end(), x));
            int num_row = idx_row==0 ? row[idx_row]:row[idx_row]-row[idx_row-1]-1;

            int idx_col = distance(col.begin(), lower_bound(col.begin(), col.end(), y));
            int num_col = idx_col==0 ? col[idx_col]:col[idx_col]-col[idx_col-1]-1;

            int num = num_row+num_col-1;
            ans = max(num, ans);

        }
    }

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

Measured memory_bytes: 35712
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
int main(){
    int n;
    vector<int>vc;
    while(cin>>n){
        if(n==-1)break;
        vc.clear();
        if(n==0){
            cout<<'0'<<endl;
            continue;
        }
        while(1){
            if(n==0) break;
            vc.insert(vc.begin(),n%4);
            n=(n-n%4)/4;
        }
        for(int i=0;i<vc.size();i++){
            cout<<vc[i];
        }
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 3136
input_arr = list(map(int, input().rstrip().split()))
a = input_arr[0]
b = input_arr[1]
c = input_arr[2]
d = input_arr[3]

ans = -10**18
for i in [0, 1]:
    for j in [2, 3]:
        ans = max(ans, input_arr[i]*input_arr[j])

print(ans)

Measured memory_bytes: 61844
import collections
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(len(a)):
    b.append(a[i])
    b.append(a[i]-1)
    b.append(a[i]+1)

c = collections.Counter(b)
most = c.most_common()[0]

print(most[1])

Measured memory_bytes: 30940
import itertools
import numpy as np

n,m,x = map(int, input().split())
A = np.array([[int(x) for x in input().split()] for i in range(n)])
lis, min_ = range(n), 1200001

full = []
#組み合わせの列挙
for r in range(1,n+1):
  comb = list(itertools.combinations(lis,r))
  full.extend(comb)
#print(full)

for i in full:
  #配列の準備
  sum_ = np.zeros(m+1)
  
  #組み合わせの要素合計
  for k in i:
    sum_+=A[k]
    #print(sum_)
    
  #Aが全てx以上もしくは最小コストか否か
  if np.all(sum_[1:]>=x) and min_>sum_[0]:
    min_ = sum_[0]

if min_== 1200001: print('-1')
else: print(int(min_))


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

using namespace std;
typedef long long ll;

int main() {
    ll n;
    cin >> n;
    int ans = 0;
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            int cnt = 0;
            while (n % i == 0) {
                n /= i;
                cnt++;
            }
            for (int j = 1; cnt >= j; cnt -= j, j++)
                ans++;
        }
    }
    if (n > 1) ans++;
    cout << ans << "\n";
}


Measured memory_bytes: 3676
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace panasonic2020_b
{
  class Program
  {
    static void Main(string[] args)
    {
      var H = CIn.ReadInt();
      var W = CIn.ReadInt();

      if (H == 1 || W == 1)
      {
        Console.WriteLine(1);
        return;
      }

      Console.WriteLine(((long)H * W + 1) / 2);
    }
  }

  static class CIn
  {
    private static readonly Queue<string> fieldBuffer = new Queue<string>();

    public static string Read()
    {
      if (fieldBuffer.Count == 0)
      {
        foreach (var field in Console.ReadLine().Split())
        {
          fieldBuffer.Enqueue(field);
        }
      }
      return fieldBuffer.Dequeue();
    }

    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());

    public static string[] ReadStringArray(int n)
    {
      var array = new string[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = Read();
      }
      return array;
    }

    public static int[] ReadIntArray(int n)
    {
      var array = new int[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadInt();
      }
      return array;
    }

    public static long[] ReadLongArray(int n)
    {
      var array = new long[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadLong();
      }
      return array;
    }

    public static double[] ReadDoubleArray(int n)
    {
      var array = new double[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadDouble();
      }
      return array;
    }

    public static char[,] ReadCharMatrix(int h, int w)
    {
      var array = new char[h, w];
      for (var i = 0; i < h; i++)
      {
        var l = Console.ReadLine().ToCharArray();
        for (var j = 0; j < w; j++)
        {
          array[i, j] = l[j];
        }
      }
      return array;
    }
  }
}


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


int main(){
    ll k;
    cin >> k;
    queue<ll> q;
    if(k <= 12){
        cout << k << endl;
        return 0;
    }else{
        for(ll i = 1; i <= 9; i++){
            q.push(i);
        }
        ll cnt = 9LL;
        ll ans;
        while(1){
            ll center = q.front(); q.pop();
            ll l = center * 10;
            ll r = center % 10;
            center = l + r; //centerの桁数をあげる
            //cout << center << endl;
            for(int i = -1; i <= 1; i++){
                if(i + r < 0 || i + r >= 10){
                    continue;
                }
                else{
                     q.push(center + i); cnt++;
                   //  cout << center + i << endl;
                     if(cnt == k){
                         ans = center + i;
                         cout << ans << endl;
                         return 0;
                    }
                }
            }
            
        }
    }
}

Measured memory_bytes: 768
# -*- coding: utf-8 -*-
import sys

def main():
  # Xはもっとも近い整数，Nは与えられるP
  N = int(input())
  AC=0
  WA=0
  TLE=0
  RE=0

  for i in range(N):
    S = input()
    if S == "AC":
      AC = AC + 1
    elif S == "WA":
      WA = WA + 1
    elif S == "TLE":
      TLE = TLE + 1
    elif S == "RE":
      RE = RE + 1

  print("AC x " + str(AC))
  print("WA x "+str(WA))
  print("TLE x "+str(TLE))
  print("RE x "+str(RE))

if __name__ == '__main__':
    main()

Measured memory_bytes: 9216
#include<stdio.h>
int main (){


  int H,W,i,j;

  while(1){
    scanf("%d %d",&H,&W);
    if(H==0 && W==0)
      break;
  
  


  for(i=0;i<H;i++){
    for(j=0;j<W;j++){

   if(i==0 || j==0 || i==H-1 || j==W-1 )
   {

    printf("#");
   }

    else printf(".");
  }
    printf("\n");
  }
  printf("\n");
  }
 return 0;
  }

Measured memory_bytes: 572
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
struct edge{long long to,cost;};
const int inf = 1 << 27;
const long long INF = 1LL << 60;
const int COMBMAX = 1001001;
const long long MOD = 1000000007;
const long long dy[] = {-1, 0, 0, 1};
const long long dx[] = {0, -1, 1, 0};
string alp = "abcdefghijklmnopqrstuvwxyz";
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define eachdo(v, e) for (const auto &e : (v))
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (long long)distance((v).begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (long long)distance((v).begin(), upper_bound((v).begin(), (v).end(), e))
long long mpow(long long a, long long n, long long mod = MOD){long long res = 1; while(n > 0){if(n & 1)res = res * a % mod; a = a * a % mod; n >>= 1;} return res;}
void pt(){cout << endl; return;}
template<class Head> void pt(Head&& head){cout << head; pt(); return;}
template<class Head, class... Tail> void pt(Head&& head, Tail&&... tail){cout << head << " "; pt(forward<Tail>(tail)...);}
template<class T> void debug(T v){rep(i, v.size()) cout << v[i] << " " ; cout << endl;}
template<class T> void debug2(T v){rep(i, v.size()){rep(j, v[i].size()) cout << v[i][j] << " " ; cout << endl;}}
template<class T1, class T2> inline bool chmin(T1 &a, T2 b){if(a > b){a = b; return true;} return false;}
template<class T1, class T2> inline bool chmax(T1 &a, T2 b){if(a < b){a = b; return true;} return false;}
template<class T1, class T2> ll gcd(T1 a, T2 b){return a % b ? gcd(b , a % b) : b;}
template<class T1, class T2> void reduce(T1 &a, T2 &b){ll g = gcd(a, b); a /= g; b /= g; return;}
bool valid(ll H, ll W, ll h, ll w){return 0 <= h && h < H && 0 <= w && w < W;}

map<long long, long long> p_fact(long long n){
    map<long long, long long> h;
    long long div = 2;
    while(div * div <= n){
        if (n % div == 0){
            h[div]++;
            n /= div;
            div = 1;
        }
        div++;
    }
    if (n != 1) h[n]++;
    return h;
}

int main(){
    ll N; cin >> N;
    vector<P> vec;
    rep(i, N){
        ll a, b; cin >> a >> b;
        vec.push_back(P(a, 1));
        vec.push_back(P(b, 0));
    }
    sort(all(vec));
    rep(i, 2 * N){
        // pt(vec[i].first, vec[i].second);
    }
    ll curr_min = 1;
    ll curr_max = 0;
    ll lm_min = -1;
    ll lm_max = -1;
    ll rm_min = -1;
    ll rm_max = -1;
    ll lm_n = N / 2;
    ll rm_n = N / 2 + 1;
    rep(i, 2 * N){
        if (vec[i].second){
            curr_max++;
            if(lm_min == -1 && lm_n <= curr_max) lm_min = vec[i].first;
            if(rm_min == -1 && rm_n <= curr_max) rm_min = vec[i].first;
        }else{
            curr_min++;
            if(lm_max == -1 && lm_n < curr_min) lm_max = vec[i].first;
            if(rm_max == -1 && rm_n < curr_min) rm_max = vec[i].first;
        }
    }
    // pt(lm_min, rm_min, lm_max, rm_max);
    if(N % 2 == 0){
        pt((lm_max + rm_max) - (lm_min + rm_min) + 1);
    }else{
        pt(rm_max - rm_min + 1);
    }
}

Measured memory_bytes: 11660
#include <stdio.h>
 
  
void maxH(int *node, int i, int g){
  int large, s;
     
  if(i*2 <= g && node[i*2] > node[i]) large = i*2;
  else large = i;
  if(i*2+1 <= g && node[i*2+1] > node[large])large = i*2+1;
  
  if(large != i){
    s = node[i];
    node[i] = node[large];
    node[large] = s;
    maxH(node, large, g);
  }
}
  
main(){
  int i, g;
  int node[500001];
  
  scanf("%d", &g);
  
  for(i=1;i<=g;i++) scanf("%d", &node[i]);
  
  for(i =g/2;i>0;i--) maxH(node,i,g);
  
  
  for(i=1;i<=g;i++) printf(" %d",node[i]);
  
  printf("\n");
  return 0; 
}

Measured memory_bytes: 2552
#include<bits/stdc++.h>
#define int long long
#define rep(i,a,b) for(int i=a;i<b;i+=1)
#define reps(i,a,b) for(int i=a;i>=b;i-=1)
#define vi vector<int>
#define pb push_back
#define in(x) int x; cin>>x;
#define mi unordered_map<int,int>
#define mem(x) memset(x, 0, sizeof(x))
using namespace std;

int32_t main(void){
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	
	in(n);
	in(w);
	int s = 100000;
	vi v(s+1, INT_MAX);
	v[0] = 0;
	int weight, value;
	rep(i, 0, n)
	{
		cin>>weight>>value;
		reps(j, s-value, 0) v[j+value] = min(v[j+value], v[j] + weight); 
	}
	reps(i, s, 0)
	{
		if(v[i] <= w)
		{
			cout<<i<<endl;
			break;
		}
	}
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
using namespace std;

int main(){
  int N,M,Q;
  cin >> N >> M >> Q;

  int rail[N][N];

  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      rail[i][j] = 0;
    }
  }

  for(int i=0;i<M;i++){
    int L,R;
    cin >> L >> R;
    L = L-1;
    R = R-1;

    rail[L][R]++;
  }

  // 二次元累積和
  int cRail[N][N];
  cRail[0][0] = rail[0][0];
  for(int i=1;i<N;i++){
    cRail[0][i] = cRail[0][i-1] + rail[0][i];
    cRail[i][0] = cRail[i-1][0] + rail[i][0];
  }

  for(int i=1;i<N;i++){
    for(int j=1;j<N;j++){
      cRail[i][j] = cRail[i][j-1] + cRail[i-1][j] - cRail[i-1][j-1] + rail[i][j] ;
    }
  }


  for(int i=0;i<Q;i++){
    int result = 0;

    int p,q;
    cin >> p >> q;
    p = p-1;
    q = q-1;

    result = cRail[q][q];
    if(p > 0){
      result += (cRail[p-1][p-1] - cRail[p-1][q] - cRail[q][p-1]);
    }

    cout << result << endl;
  }
  //cout << result << endl;

  return 0;
}


Measured memory_bytes: 2816
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**9)
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()


n,q = na()
g = [[] for i in range(n)]
c = [0]*n

for i in range(n-1):
    a,b = na()
    g[a-1].append(b-1)
    g[b-1].append(a-1)
for i in range(q):
    p,x = na()
    c[p-1] += x

def f(b,a,r):
    r += c[a]
    c[a] = r
    for i in g[a]:
        if i != b:
            f(a,i,r)

f(-1,0,0)
print(' '.join([str(s) for s in c]))

Measured memory_bytes: 238672
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
using ll = long long;
const ll mod = 1000000007;
const ll INF = 100000000000000000LL;
signed main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int res = 0;
    rep(i,1000){
        if(a<=i&&i<=b&&c<=i&&i<=d){
            res++;
        }
    }
    cout<<max(res-1,0)<<endl;
}

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

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

int main(){
    string s,t;
    cin>>s>>t;
    vector<string> c;
    int m=0,a=s.size(),b=t.size();
    if(a<b){
        cout<<"UNRESTORABLE";
        return 0;
    }
    for(int i=a-1;i>=0;--i){
        string u=s;
        if(s[i]==t[0]||s[i]=='?'){
            bool f=true;
            for(int j=1;j<b;++j){
                if(s[i+j]!=t[j]&&s[i+j]!='?'){
                    f=false;
                    break;
                }
            }
            if(f){
                for(int j=0;j<b;++j){
                    u[i+j]=t[j];
                }
                for(int j=0;j<a;++j){
                    if(u[j]=='?'){
                        u[j]='a';
                    }
                }
                c.PB(u);
            }
        }   
    }
    int k=c.size();
    if(k==0)cout<<"UNRESTORABLE";
    else{
        sort(all(c));
        cout<<c[0];
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[n],b[n];
	for(int i=0; i<n; i++){
		cin>>a[i];
		b[i]=a[i];
	}
	if(prev_permutation(a, a+n)){
		//prev_permutation(a, a+n);
		for(int i=0; i<n-1; i++)
			cout<<a[i]<<" ";
		cout<<a[n-1]<<endl;
	}
	for(int i=0; i<n-1; i++)
		cout<<b[i]<<" ";
	cout<<b[n-1]<<endl;
	if(next_permutation(b, b+n)){
		//next_permutation(b, b+n);
		for(int i=0; i<n-1; i++)
			cout<<b[i]<<" ";
		cout<<b[n-1]<<endl;
	}
	return 0;
}


Measured memory_bytes: 3104
while 1 == 1:
    a,b,c = input().split()
    a = int(a)
    c = int(c)
    if b == "+":
        print(a+c)
    elif b == "-":
        print(a-c)
    elif b == "*":
        print(a*c)
    elif b == "/":
        print(a//c)
    else:
        break


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

using namespace std;

using ll = long long;
using ull = unsigned long long;
using db = double;
using ii = pair <int, int>;

#define FOR(a, b, c) for(int a = b, _c = c; a <= _c; ++a)
#define FORD(a, b, c) for(int a = b, _c = c; a >= _c; --a)
#define REP(a, b, c) for(int a = b, _ = c; a < _; ++a)
#define ALL(a, b) for(auto &a : b)
#define pb push_back
#define mp make_pair
#define all(a) begin(a), end(a)
#define sz(x) (int)(x.size())
#define fi first
#define se second
#define reset(f, x) memset(f, x, sizeof(f))
#define bit(x, i) (x >> (i - 1) & 1ll)
#define onbit(x, i) (x | (1ll << (i - 1)))
#define offbit(x, i) (x & ~(1ll << (i - 1)))
#define gcd __gcd
#define __builtin_popcount __builtin_popcountll
#define s(i) s[i + 1]

const int N = 405;
int n;
ll a[N], s[N], f[N][N];

ll F(int l, int r) {
  if(l == r) return 0;
  if(f[l][r] != -1) return f[l][r];
  ll ans = 1e18;
  REP(i, l, r) {
    ans = min(ans, F(l, i) + F(i + 1, r) + s[r] - s[l - 1]);
  }
  return f[l][r] = ans;
}

main() {
  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  cin >> n;
  FOR(i, 1, n) cin >> a[i];
  FOR(i, 1, n) s[i] = s[i - 1] + a[i];
  reset(f, -1);
  cout << F(1, n);
}


Measured memory_bytes: 1536
/*** keep hungry and calm CoolGuang!***/
#pragma GCC optimize(3)
#include <bits/stdc++.h>
#define debug(x) cout<<#x<<":"<<x<<endl;
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline")
#pragma GCC option("arch=native","tune=native","no-zero-upper")
#pragma GCC target("avx2")
#include<stdio.h>
#include<algorithm>
#include<queue>
#include<string>
#include<iostream>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pp;
const ll INF=1e17;
const int Maxn=2e7+10;
const int maxn =3e5+10;
const int mod=1e9+9;
const int Mod = 1e9+7;
///const double eps=1e-10;
inline bool read(ll &num)
{char in;bool IsN=false;
    in=getchar();if(in==EOF) return false;while(in!='-'&&(in<'0'||in>'9')) in=getchar();if(in=='-'){ IsN=true;num=0;}else num=in-'0';while(in=getchar(),in>='0'&&in<='9'){num*=10,num+=in-'0';}if(IsN) num=-num;return true;}
ll n,m,p;
ll dp[maxn];
ll a[maxn];
bool dfs(int u,ll w){
    if(u == 4){
        if(a[3]>a[2]&&a[2]>a[1]){
       //     debug(a[3]);
      //      debug(a[2]);
     //       debug(a[1]);
            return 1;
        }
        return 0;
    }
    for(int k=0;k<=w;k++){
        a[u] = a[u]*(1<<k);
        if(dfs(u+1,w-k)) return 1;
        a[u] = a[u]/(1<<k);
    }
    return 0;
}
int main()
{
    read(a[1]);read(a[2]);read(a[3]);
    read(m);
    printf("%s\n",dfs(1,m)?"Yes":"No\n");
    return 0;
}
/**
3 3 2
 0

**/


Measured memory_bytes: 3628
from fractions import Fraction ,gcd
def lcm(a,b):
    return(a*b//gcd(a,b))
A,B,C,D=map(int,input().split())
N=B-A+1
ans=N- (B//C + B//D - (A-1)//C - (A-1)//D) + B//(lcm(C,D)) -(A-1)//(lcm(C,D))
print(ans)


Measured memory_bytes: 66156
#include <bits/stdc++.h>
#define REP(i,n) for (long long i=0;i<(n);i++)
#define FOR(i,a,b) for (long long i=(a);i<(b);i++)
#define RREP(i,n) for(long long i=n;i>=0;i--)
#define RFOR(i,a,b) for(long long i=(a);i>(b);i--)
#define dump1d_arr(array) REP(i,array.size()) cerr << #array << "[" << (i) << "] ==> " << (array[i]) << endl
#define dump2d_arr(array) REP(i,array.size()) REP(j,array[i].size()) cerr << #array << "[" << (i) << "]" << "[" << (j) << "] ==> " << (array[i][j]) << endl
#define dump(x)  cerr << #x << " => " << (x) << endl
#define dumpP(p) cerr << "( " << p.first << " , " << p.second << " )" << ends
#define SORT(c) sort((c).begin(),(c).end())
#define MIN(vec) *min_element(vec.begin(), vec.end())
#define MAX(vec) *max_element(vec.begin(), vec.end())
#define UNIQ(vec) vec.erase(unique(vec.begin(), vec.end()),vec.end()) //ソートの必要あり
#define IN(n,m)  (!(m.find(n) == m.end()))
#define ENUM(m) for (auto itr = m.begin(); itr != m.end(); ++itr)
#define dump_MAP(m) for(auto itr = m.begin(); itr != m.end(); ++itr) { cerr << itr->first << " --> "  << itr->second << endl; }
#define FINDL(vec,x) (lower_bound(vec.begin(),vec.end(),x) - vec.begin())
#define FINDU(vec,x) (upper_bound(vec.begin(),vec.end(),x) - vec.begin())
#define ROUND(N) setprecision(N)
#define ROUND_PRINT(N,val) cout << fixed;cout << setprecision(N) << val << endl
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define INARR(h,w,x,y) (0 <= y && y < h && 0 <= x && x < w)
#define EQ(a,b) (abs(a - b) < 1e-10)
#define TORAD(deg) ((deg)*2*M_PI / 360.0)
using namespace std;
constexpr int dx[4] = {0,1,0,-1};
constexpr int dy[4] = {1,0,-1,0};
constexpr long double pi = M_PI;
constexpr double EPS = 1e-10;
constexpr long MOD = 1000000007;
constexpr short shINF = 32767;
constexpr long loINF = 2147483647;
constexpr long long llINF = 9223372036854775807;
typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<double,double> pr;
typedef vector<bool> VB;
typedef vector<pr> VP;
typedef priority_queue<pr,vector<pr>,greater<pr>> pq;

int n;
void dfs(int step,double ang,pr left,pr right) {
    if (step == n) {
        cout << ROUND(10) << left.first << " " << left.second << endl;
    }
    else {
        double sx = left.first;
        double sy = left.second;
        double gx = right.first;
        double gy = right.second;
        double dst = sqrt((gx - sx)*(gx - sx) + (gy - sy) * (gy - sy))/(sqrt(3));
        dfs(step+1,ang,left,make_pair(sx + (gx-sx)/3.0 ,sy + (gy-sy)/3.0));
        dfs(step+1,ang+60,make_pair(sx + (gx-sx)/3.0 ,sy + (gy-sy)/3.0),make_pair(sx+dst*cos(TORAD(ang+30.0)),sy+dst*sin(TORAD(ang+30.0))));
        dfs(step+1,ang-60,make_pair(sx+dst*cos(TORAD(ang+30.0)),sy+dst*sin(TORAD(ang+30.0))),make_pair(sx + 2.0*(gx-sx)/3.0 ,sy + 2.0*(gy-sy)/3.0));
        dfs(step+1,ang,make_pair(sx + 2.0*(gx-sx)/3.0 ,sy + 2.0*(gy-sy)/3.0),right);
    }
}

int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    dfs(0,0,make_pair(0.0,0.0),make_pair(100.0,0.0));
    cout << 100.0 << " " << 0.0 << endl;
}




Measured memory_bytes: 3668
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = (ll)(x)-1;0 <= i; i--)
#define reps(i,x) for(ll i = 1; i < (ll)(x)+1; i++)
#define rreps(i,x) for(ll i = (ll)(x); 1 <= i; i--)
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const int n_max = 1e5+10;

int main(){
    vvl a(3, vl(3));
    rep(i,3)rep(j,3)cin >> a[i][j];
    ll n; cin >> n;
    vector<ll> b(n);
    rep(i,n) cin >> b[i];
    vvl g(3, vl(3,0));
    rep(k,n){
        rep(i,3)rep(j,3)if(a[i][j] == b[k])g[i][j] = 1;
    }
    bool ok = false;

    rep(i,3){
        bool temp = true;
        rep(j,3)temp &= g[i][j];
        ok |= temp;
        temp = true;
        rep(j,3)temp &= g[j][i];
        ok |= temp;
    }
    bool temp = true;
    rep(i,3)temp &= g[i][i];
    ok |= temp;
    temp = true;
    temp &= (g[2][0] & g[1][1] & g[0][2]);
    ok |= temp;

    cout << (ok ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,ans=0;
    string a;
    cin>>a;
    n=a.length();
    for(int i=1;i<n;i++)
    {
        if(a[i]==a[i-1])
        {
            if(a[i]=='1')
            {
                a[i]='0';
                ans++;
            }
            else
            {
                a[i]='1';
                ans++;
            }
        }
    }
    cout<<ans<<endl;
}


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

template<long long MOD>
class Num {
private:
	long long expow(long long base, long long e) const {
		long long ans = 1;
		for (; e > 0; e/= 2) {
			if (e % 2)
				ans = ans * base % MOD;
			base = base * base % MOD; }
		return ans; }

public:
	long long val;

	Num(long long _val) {
		val = _val % MOD;
		val = val < 0 ? val + MOD : val; }
	Num() : val(0) { }

	inline Num operator + (const Num &arg) const {
		Num res;
		res.val = val + arg.val;
		res.val = res.val >= MOD ? res.val - MOD : res.val;
		return res; }

	inline Num operator - (const Num &arg) const {
		Num res;
		res.val = val - arg.val;
		res.val = res.val < 0 ? res.val + MOD : res.val;
		return res; }

	inline Num operator - () const {
		Num res;
		res.val = MOD - res.val;
		res.val = res.val == MOD ? 0 : res.val;
		return res; }

	inline Num operator ^ (const int &arg) const {
		return Num(expow(val, arg)); }

	inline Num operator * (const Num &arg) const {
		return Num(val * arg.val); }

	inline Num operator / (const Num &arg) const {
		return Num(val * expow(arg.val, MOD - 2)); }

	inline void operator += (const Num &arg) {
		(*this) = (*this) + arg; }

	inline void operator -= (const Num &arg) {
		(*this) = (*this) - arg; }

	inline void operator *= (const Num &arg) {
		(*this) = (*this) * arg; }

	inline void operator /= (const Num &arg) {
		(*this) = (*this) / arg; }

	inline void operator ^= (const long long &arg) {
		val = expow(val, arg); } };

template<long long MOD>
ostream &operator << (ostream &fo, const Num<MOD> &c) {
	fo << c.val;
	return fo; }

template<long long MOD>
istream &operator >> (istream &fi, Num<MOD> &c) {
	fi >> c.val;
	c = Num<MOD>(c.val);
	return fi; }

const int N = 3005, MOD = 1e9 + 7;
const Num<MOD> HALF = Num<MOD>(1) / 2;

int n, q;

vector<vector<Num<MOD>>> dp[2];
vector<int> v;

int main() {
#ifdef HOME
	freopen("agc30d.in", "r", stdin);
	freopen("agc30d.out", "w", stdout);
#endif
	ios::sync_with_stdio(false); 
	cin.tie(0), cout.tie(0);
	Num<MOD> ant;
	int l, r;

	cin >> n >> q;
	v.resize(n);
	for (auto &i: v)
		cin >> i;

	dp[0] = dp[1] = vector<vector<Num<MOD>>>(n, vector<Num<MOD>>(n));
	for (int i = 0; i < n; ++i)
	for (int j = 0; j < n; ++j)
		dp[0][i][j] = Num<MOD> {int(v[i] > v[j])};

	for (int u = 0; u < q; ++u) {
		cin >> l >> r;
		if (--l == --r)
			continue;

		for (int i = 0; i < n; ++i)
			if (i != l && i != r) {
				dp[1][i][l] = (dp[0][i][l] + dp[0][i][r]) * HALF;
				dp[1][l][i] = (dp[0][l][i] + dp[0][r][i]) * HALF;

				dp[1][i][r] = (dp[0][i][l] + dp[0][i][r]) * HALF;
				dp[1][r][i] = (dp[0][l][i] + dp[0][r][i]) * HALF; }

		dp[0][r][l] = dp[0][l][r] = (dp[0][l][r] + dp[0][r][l]) * HALF;

		for (int i = 0; i < n; ++i)
			if (i != l && i != r) {
				dp[0][i][l] = dp[1][i][l];
				dp[0][i][r] = dp[1][i][r];

				dp[0][l][i] = dp[1][l][i];
				dp[0][r][i] = dp[1][r][i]; } }

	for (int i = 0; i < n; ++i)
	for (int j = i + 1; j < n; ++j)
		ant+= dp[0][i][j];

	cout << (ant * (Num<MOD>(2) ^ q)) << endl;

	return 0; }


Measured memory_bytes: 143232
import java.util.*;

public class Main {

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

        Arrays.sort(a);
        int ans = 0;
        for (int i = 0; i < n; i++) {
            if (i + 1 == n && x == a[i]) {
                ans++;
            } else if (i + 1 != n && x >= a[i]) {
                ans++;
                x -= a[i];
            } else {
                break;
            }
        }
        System.out.println(ans);
    }

}


Measured memory_bytes: 22864
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>

#define roop(i, n) for(int i=0;i<n;i++)

using namespace std;
using ll = long long int;
using ull = unsigned long long;

float myPower(int a, int n) { // aのn乗の計算
	float x = 1;
	while (n > 0) { // 全てのbitが捨てられるまで
		if ( n & 1) { // 一番右のbitが１のとき
			x *= a;
		}
		a *= a;
		n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
	}
	return x;
}

ull fun(ull n) {
	if (n < 2) {
		return 1;
	} else {
		return n * fun(n - 2);
	}
}

int main() {
	int n;
	cin >> n;
	vector<ll> a(n);
	vector<int> b(n);
	int oddCount = 0;
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] % 2 != 0) {
			oddCount++;
		}
		while(true) {
			if (a[i] % 2 == 0) {
				a[i] /= 2;
				ans++;
			} else {
				break;
			}
		}
	}
	if (oddCount == n) {
		cout << 0 << endl;
	} else {
		cout << ans << endl;
	}
	return 0;
}

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

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

  int64_t ans = 0;

  for(int i=0; i<=N; i++){
    if(i%3!=0 && i%5!=0) ans += i;
  }

  cout << ans;
  
}

Measured memory_bytes: 3592
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>


using namespace std;


using namespace std;

int main() {
    int A,B;
    cin>>A>>B;

    if(A<B){

        cout<<"0"<<endl;
    }

    if(B<A){

        cout<<"10"<<endl;
    }

    if(A==B){

        cout<<"10"<<endl;
    }
   }


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
int n,q,A[2005],Q[2005];
int solve(int i,int m){
	if(m==0){
		return 1;
	}
	if(i>=n){
		return 0;
	}
	int res=solve(i+1,m)||solve(i+1,m-A[i]);
	return res;
}
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>A[i];
	}
	cin>>q;
	for(int i=0;i<q;i++){
		cin>>Q[i];
		if(solve(0,Q[i])){
			printf("yes\n");
		}else{
			cout<<"no"<<endl;
		}
	}
	return 0;
} 


Measured memory_bytes: 3104
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
// using namespace std;

// using ll=long long;
// template<class T> using V = vector<T>;
// template<class T, class U> using P = pair<T, U>;
// using vll = V<ll>;
// using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    int n;
    std::cin >> n;
    long long d, a;
    std::cin >> d >> a;
    std::vector< std::pair< long long, long long > > xh(n);
    for (int i = 0; i < n; i++) std::cin >> xh[i].first >> xh[i].second;
    sort(ALL(xh));

    long long ans = 0, acce = 0;
    std::queue< std::pair< long long, long long > > que;
    for (int i = 0; i < n; i++) {
        while (!que.empty() && que.front().first < xh[i].first) {
            std::pair< long long, long long > q = que.front(); que.pop();
            acce -= q.second;
        }

        if (xh[i].second <= acce) continue;
        else {
            long long rem = xh[i].second - acce;
            long long exp = (rem + a - 1) / a * a;
            ans += (rem + a - 1) / a;
            que.push(std::make_pair(xh[i].first + 2 * d, exp));
            acce += exp;
        }
    }
    std::cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 4992
using System;


namespace ConsoleApplication
{
    class Program
    {
        public static void Main(string[] args)
        {
            var parms = System.Console.ReadLine().Split();
            System.Console.WriteLine((int.Parse(parms[1]) * 10 + int.Parse(parms[2])) % 4 == 0 ? "YES" : "NO");
        }
    }
}


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

int main() {
  int x;
  int a, b, c;
  int sum;
 
  cin >> x;
  
  a = x / 500;
  b = x % 500;
  c = b / 5;
  
  sum = a * 1000 + c * 5;
  cout << sum << endl;
}


Measured memory_bytes: 256
#One Clue
# input

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

r = []

if x - k + 1 > -1000000:
    if x + k -1 < 1000000:
        r = range(x - k + 1, x + k)
    else:
        r = range(x - k + 1, 1000001)
else:
    r = range(-1000000, x + k)

s = ""

for c in r:
    s += str(c)
    s += " "

print(s[:-1])


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

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.setf(ios::fixed);
	cout.precision(4);
	
	string s;
	bool flag = false;

	cin >> s;

	for (int i = 0; i < 4; i++) {
		if (i + 1 < 4) {
			if (s[i] == s[i + 1]) flag = true;
		}
	}

	if (flag) {
		cout << "Bad\n";
	} else {
		cout << "Good\n";
	}

	return 0;
}

Measured memory_bytes: 256
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();

    let x: usize = iter.next().unwrap().parse().unwrap();
    let y: usize = iter.next().unwrap().parse().unwrap();
    let z: usize = iter.next().unwrap().parse().unwrap();

    println!("{} {} {}", z, x, y);
}


Measured memory_bytes: 4352
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;



void main() {
    readln;
    readln.chomp.count("ABC").writeln;
}
















void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
class UnionFind:
    #def   -> foo=UnionFind(n,1)  <- 1-based index, default is 0
    #method -> foo.hoge(huga)
    __slots__ = ["_size", "_first_idx", "_parents"]
    def __init__(self, size: int, first_index: int = 0) -> None:
        self._size = size
        self._first_idx = first_index
        self._parents = [-1] * (size + first_index)
    def find(self, x: int) -> int:
        if self._parents[x] < 0:
            return x
        self._parents[x] = self.find(self._parents[x])
        return self._parents[x]
    def same(self, x: int, y: int) -> bool:
        return self.find(x) == self.find(y)
    def unite(self, x: int, y: int) -> bool:
        x, y = self.find(x), self.find(y)
        if x == y:
            return False
        if self._parents[x] > self._parents[y]:
            x, y = y, x
        self._parents[x] += self._parents[y]
        self._parents[y] = x
        return True
    def size(self, x: int) -> int:
        return -self._parents[self.find(x)]
    def group_count(self) ->int:
        return sum(1 for i in  self._parents if i<0)
lanper=[-1]*m
uf=UnionFind(n)
for i in range(n):
    for j in list(map(int,input().split()))[1:]:
        if lanper[j-1]==-1:lanper[j-1]=i
        else:uf.unite(lanper[j-1],i)
print("YES") if uf.size(0)==n else print("NO")


Measured memory_bytes: 62808
/////////////package Educ_DP;

import javax.swing.plaf.basic.BasicInternalFrameTitlePane;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String[] l=s.nextLine().split(" ");
        int num=Integer.parseInt(l[0]);
        int max=Integer.parseInt(l[1]);

        int[] list=new int[num];
        String[] t=s.nextLine().split(" ");
        for (int i=0;i<list.length;i++){
            list[i]=Integer.parseInt(t[i]);
        }
        int[] dp=new int[num];
        Arrays.fill(dp,-1);
        dp[dp.length-1]=0;
        dp[dp.length-2]=dp[dp.length-1]+Math.abs(list[list.length-1]-list[list.length-2]);

        for (int i=dp.length-3;i>=0;i--){
            for (int j=max+i;j>i;j--){
                if (j<list.length){
                    int x=dp[j]+ Math.abs(list[i]-list[j]);
                    if (dp[i]==-1){
                        dp[i]=x;
                    }
                    dp[i]=Math.min(dp[i],x);
                }
            }
        }
       
        System.out.println(dp[0]);
    }
}


Measured memory_bytes: 55136
package main
 
import(
  "fmt"
	"bufio"
	"os"
	"strings"
)
 
var sc = bufio.NewScanner(os.Stdin)

//fmt.Scan(&a)とかの方が楽ではある。
//1行に二つ以上の塊があるパターン
//for r = append(r, s[0])
//的な感じ
func Rr() []string {
  sc.Scan()
  slice := strings.Split(sc.Text(), " ")
  return slice
}
 
func abc053c(x int){
	ans := x / 11
	ans = ans * 2
	if x % 11 > 6{
		fmt.Println(ans+2)
	}else if x % 11 != 0{
		fmt.Println(ans+1)
	}else{
		fmt.Println(ans)
	}
}
 
func main(){
	x := 0
	fmt.Scan(&x)
	abc053c(x)
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define sf scanf
#define pf printf
#define rt return
#define pb push_back
#define MOD 1000000007
#define MAX 1000005
#define fast()    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const double PI = acos(-1.0);
typedef long long ll;
int main()
{
    fast();
    int t, num, x, y, z, c0=0, c01=0, sum=0, ans=0, m0;
    string sr,str;
    //priority_queue<char>Q;
    cin>>m0;
    cin>>sr>>str;

    for(int i=0; i<m0; i++)
    {
        cout<<sr[i]<<str[i];
    }
    cout<<endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include <cstddef>
#include<queue>
using namespace std;

int main()
{
    int N, M;
    long ans = 0, max = 0; 
    cin >> N >> M;
    vector<long> a(N);
    priority_queue<long> A;
    for(int i = 0; i < N; i++)
    {
        cin >> a.at(i);
        A.push(a.at(i));
    }
    for(int i = 0; i < M; i++)
    {
        max = A.top();
        A.pop();
        A.push(max / 2);
    }
    for(int i = 0; i < N; i++)
    {
        ans += A.top();
        A.pop();
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2168
#!usr/bin/env python3
import sys
import math
import string
import collections
import fractions
import random
from operator import itemgetter
import itertools
from collections import deque
import copy
import heapq
import bisect
import scipy.sparse
from scipy.sparse.csgraph import shortest_path

MOD = 10 ** 9 + 7
INF = 10 ** 18
input = lambda: sys.stdin.readline().strip()

sys.setrecursionlimit(10 ** 8)

N, X, Y = map(int, input().split())
L = min(X, Y)
R = max(X, Y)

ans = [0] * (N - 1)

for i in range(1, N):
    for j in range(i + 1, N + 1):
        ans[min(j - i, abs(L - i) + abs(R - j) + 1) - 1] += 1
for i in ans:
    print(i)


Measured memory_bytes: 19464