akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
#define ch() getchar()
#define pc(x) putchar(x)
template<typename T>inline void read(T&x){
	int f;char c;
	for(f=1,c=ch();c<'0'||c>'9';c=ch())if(c=='-')f=-f;
	for(x=0;c<='9'&&c>='0';c=ch())x=x*10+(c&15);x*=f;
}
template<typename T>inline void write(T x){
	static char q[64];int cnt=0;
	if(!x)pc('0');if(x<0)pc('-'),x=-x;
	while(x)q[cnt++]=x%10+'0',x/=10;
	while(cnt--)pc(q[cnt]);
}
const int us[10]={0,2,5,5,4,5,6,3,7,6},maxn=10005;
int a[9],dp[maxn>>1][maxn];
int main(){
	int n,m;
	read(n),read(m);
	for(int i=0;i<m;++i)
		read(a[i]);
	sort(a,a+m);
	dp[0][0]=true;
	int tmp=(n+1)>>1,mx=0;
	for(int i=1;i<=tmp;++i){
		int l=min(n,i*2),r=min(n,i*7);
		for(int j=l;j<=r;++j){
			for(int k=0;k<m;++k){
				if(j>=us[a[k]]){
					dp[i][j]|=dp[i-1][j-us[a[k]]];
				}
			}
		}
		if(dp[i][n])
			mx=i;
	}
	while(mx){
		for(int i=m-1;i>=0;--i){
			if(n>=us[a[i]]&&dp[mx-1][n-us[a[i]]]){
				pc(a[i]+'0');
				--mx,n-=us[a[i]];
				break;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 193152
#include<bits/stdc++.h>
#define ll long long int
#define trace(x) cerr<<#x<<" : "<<x<<endl;
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

// PMAMP :)
// INL , IIWOIL

int main()
{
    jaldi
    string s,t;
    cin>>s>>t;
    int a,b;
    cin>>a>>b;
    string f;
    cin>>f;
    f==s ? a--:b--;
    cout<<a<<" "<<b;
    return 0;
}

Measured memory_bytes: 256
num = int(input())
arr = list(map(int, input().split()))

def merge(arr, left, middle, right, count):
    L = arr[left:middle]
    L.append(float('inf'))
    R = arr[middle:right]
    R.append(float('inf'))

    iterL, iterR = iter(L), iter(R)
    l,r = next(iterL), next(iterR)

    for index in range(left, right):
        count += 1
        if l <= r:
            arr[index] = l
            l = next(iterL)
        else:
            arr[index] = r
            r = next(iterR)
    return count

def merge_sort(arr, left, right, count):

    if left + 1 < right:
        pivot = (left + right) // 2
        count = merge_sort(arr, left,  pivot, count)
        count = merge_sort(arr, pivot, right, count)

        count = merge(arr, left, pivot, right, count)
    return count

count = merge_sort(arr, 0, num, 0)
print(" ".join(list(map(str, arr))))
print(count)


Measured memory_bytes: 66776
#include <bits/stdc++.h>
using namespace std;
const long long INF=1LL << 60;

int main() {
    int Max=0;
    int Min=1<<29;
    int k;
    for(int i=0;i<5;i++){
        int temp;
        cin >> temp;
        Max=max(Max,temp);
        Min=min(Min,temp);
    }
    cin >>k;
    if(Max-Min>k) cout <<":("<<endl;
    else cout << "Yay!"<<endl;
    return 0;
}

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

using namespace std;



int n;



void str(string s, char mx)
{
    if (s.length()==n)
        {   cout << s << "\n";
            return;
        }

    for (char c = 'a'; c<=mx+1; c++)
    {
        str(s + c, max(mx,c));
    }

}







int main()
{

cin >> n;
str("a",'a');

}




















/*
8 9
1 3
1 2
2 3
3 4
4 5
5 6
4 6
6 7
6 8





*/


Measured memory_bytes: 1536
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <queue>
#include <map>
using namespace std;
typedef long long LL;

LL n,flg = 0;
LL s[500005];
LL stk[2][500005] = {0};

LL chk(LL x){
	LL tp = 0;
	for(LL i = 1;i <= n;i ++){
		if(s[i - 1] >= s[i]){
			while(stk[0][tp] > s[i]) tp --;
			LL now = s[i];
			while(1){
				if(stk[0][tp] != now || stk[1][tp] < x - 1){
					if(stk[0][tp] != now){ stk[0][++ tp] = now; stk[1][tp] = 0; }
					stk[1][tp] ++; break;
				}
				else{ tp --; now --; }
				if(now <= 0) return 0;
			}
		}
	}
	return 1;
}

int main(){
	cin >> n;
	for(LL i = 1;i <= n;i ++) cin >> s[i];
	for(LL i = 1;i < n;i ++) if(s[i] >= s[i + 1]) flg = 1;
	if(!flg){ cout << 1 << '\n'; return 0; }
	
	LL l = 2,r = n,mid,ans;
	while(l <= r){
		mid = (l + r) >> 1;
		if(chk(mid)){
			ans = mid;
			r = mid - 1;
		}
		else l = mid + 1;
	}
	cout << ans << '\n';
//	chk(2);
	return 0;
}

Measured memory_bytes: 6908
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		Main mainObj = new Main();
		mainObj.solve();
	}

	public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		int n = fs.nextInt();
		HashSet<String> kishutsu = new HashSet<>();
		String before = null;
		for(int i = 0; i < n; i++) {
			String word = fs.next();
			if(kishutsu.contains(word)) {
				System.out.println("No");
				return;
			}
			if(before == null || before.charAt(before.length()-1) == word.charAt(0)) {
				before = word;
				kishutsu.add(word);
			}else {
				System.out.println("No");
				return;
			}
		}
		
		System.out.println("Yes");
	}

	

	public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

		public void close() throws IOException {
			reader.close();
		}
	}

}


Measured memory_bytes: 22356
#include <iomanip>
#include <cmath>
#include <sstream>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <vector>
#include <bitset>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include<iostream>
#include<map>
#include<algorithm>

using namespace std;

int main() {
	int n; cin >> n;
	string s; cin >> s;
	int c[26];
	for (int i = 0; i < 26; i++) { c[i] = 1; }

	for (int i = 0; i < n; i++) {
		c[s[i] - 'a'] += 1;
	}

	long long int ans = 1;

	for (int i = 0; i < 26; i++) {
		ans = ans*c[i]%1000000007;
	}

	cout << (ans - 1) << endl;

	return 0;
}

Measured memory_bytes: 512
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>


using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair
#define mt make_tuple

// [index][A or B or C][使用した'?'の数]
ll dp[100010][3][4];
// dpの累積
ll cum[3][4];
ll MOD = 1000000007;

int main(void)
{
    cin.sync_with_stdio(false);
    string S;
    cin >> S;

    auto q_num = count(ALL(S), '?');

    auto size = SIZE(S);
    REP(i, size) {
        auto ch = S[i];
        if (i == 0) {
            if (ch == 'A') {
                dp[0][0][0] = 1;
            }
            else if (ch == '?') {
                dp[0][0][1] = 1;
            }
        }
        else {
            if (ch == '?') {
                dp[i][0][1] = 1; // A
                REP(j, 2) {
                    dp[i][1][j + 1] = cum[0][j]; // B
                }
                REP(j, 3) {
                    dp[i][2][j + 1] = cum[1][j]; // C
                }
            }
            else if (ch == 'A') {
                dp[i][0][0] = 1;
            }
            else if (ch == 'B') {
                REP(j, 2) {
                    dp[i][1][j] = cum[0][j];
                }
            }
            else if (ch == 'C') {
                REP(j, 3) {
                    dp[i][2][j] = cum[1][j];
                }
            }
        }
        REP(ch, 3) {
            REP(q_num, 4) {
                cum[ch][q_num] += dp[i][ch][q_num];
                cum[ch][q_num] %= MOD;
            }
        }

        //cout << "cum:" << endl;
        //REP(ch, 3) {
        //    REP(q, 4) {
        //        cout << cum[ch][q] << " ";
        //    }
        //    cout << endl;
        //}
    }

    vector<ll> mod_table(q_num + 1);
    mod_table[0] = 1;
    FOR(i, 1, q_num + 1) {
        mod_table[i] = (mod_table[i - 1] * 3) % MOD;
    }

    ll ans = 0;
    REP(q, 4) {
        auto undecided_q_num = q_num - q;
        ans += (cum[2][q] * mod_table[undecided_q_num]) % MOD;
        ans %= MOD;  // 本番ではこれを忘れてWA
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 10704
n = gets.chomp.to_i#split(/\s/).map{|x| x.to_i}

    gb = Struct.new("Guide", :index, :city, :point)

    gbs = []
    for i in 1..n
        ci, po = gets.chomp.split(/\s/)#.map{|x| x.to_i}
        gbs.push(gb.new(i, ci, po.to_i))
    end

    gbs.sort{|a, b| (a.city <=> b.city).nonzero? || b.point <=> a.point}.each do |a|
        puts a.index
    end

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

#define ll long long
#define INF 99999999
#define INF_LL 1LL << 60
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

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

    REP(i, N, 1000)
    {
        string tmp = to_string(i);
        if( tmp[0] == tmp[1] && tmp[0] == tmp[2] )
        {
            cout << tmp << endl;
            return 0;
        }
    }
}


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

long long int gcm(long long a,long long b){
	long long r,tmp;
	if(a<b){
		tmp=a;
		a=b;
		b=tmp;
	}
	
	r=a%b;
	while(r!=0){
		a=b;
		b=r;
		r=a%b;
	}
	return b;
}

int main(){
	long long A,B;
	cin >> A >> B;
	cout << A/gcm(A,B)*B << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    bool flagn=false, flags=false, flage=false, flagw=false;

    
    int l=s.length();
    
    
    for(int i=0;i<l;i++)
    {   
        if(s[i]=='S')
    { flags=true;}
        
        else if (s[i]=='N')
    { flagn=true;}
    
    else if(s[i]=='W')
    { flagw=true;}
    
    else if(s[i]=='E')
    { flage=true;}
    }
    
    if(flagn==true&&flags==false)
    { cout<<"No";}
    
    else if(flags==true&&flagn==false)
    { cout<<"No";}
    
    else if(flagw==true&&flage==false)
    { cout<<"No";}
    
    else if(flage==true&&flagw==false)
    { cout<<"No";}
    
    else cout<<"Yes";
}
    

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define vll vector<ll>

using namespace std;

const ll N = 3e5+100;
const ll MOD = 1e9+7;

int main()
{

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	string s;
	cin >> s;
	ll n = (ll)s.size();
	if(n & 1) return cout << "No\n",0;
	for(int i = 0;i<n;i++){
		if(i % 2 == 0 && s[i] != 'h') return cout << "No\n",0;
		if(i % 2 && s[i] != 'i') return cout << "No\n",0; 
	}
	cout << "Yes\n";
	
	return 0;
}

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

const ll INF = 1LL << 60;

int main() {
    string S;
    cin >> S;
    if (S.size() == 2) {
        cout << S << endl;
    } else {
        reverse(S.begin(), S.end());
        cout << S << endl;
    }
}

Measured memory_bytes: 256
N,M = list(map(int, input().split()))
ABs = [list(map(int, input().split())) for _ in range(M)]
par = [i for i in range(N+1)]
size = [1 for _ in range(N+1)]

def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x]) #経路圧縮
        return par[x]
def same(x,y):
    return find(x) == find(y)
def unite(x,y):
    x = find(x)
    y = find(y)
    if x == y:
        return 0
    par[x] = y
    size[y] = size[x] + size[y]
    size[x] = 0

for AB in ABs:
    unite(AB[0],AB[1])
print(max(size))

Measured memory_bytes: 54988
#include <stdio.h>
 
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2
 
int n, m[N][N];
int color[N], d[N], f[N], tt;
 
void visit(int);
void dfs();
 
int main()
{
  int u, v, k, i, j;
 
  scanf("%d", &n);
  for(i=0; i<n; i++) {
    for(j=0; j<n; j++) {
      m[i][j] = 0;
    }
  }
 
  for(i=0; i<n; i++) {
    scanf("%d %d", &u, &k);
    u--;
    for(j=0; j<k; j++) {
      scanf("%d", &v);
      v--;
      m[u][v]= 1;
    }
  }
 
  dfs();
  return 0;
}
 
void visit(int u)
{
  int v;
 
  color[u] = GRAY;
  d[u] = ++tt;
 
  for(v=0; v<n; v++) {
    if(m[u][v] == 0)
      continue;
    if(color[v] == WHITE)
      visit(v);
  }
  color[u] = BLACK;
  f[u] = ++tt;
}
 
void dfs()
{
  int u;
 
  for(u=0; u<n; u++)
    color[u] = WHITE;
  tt = 0;
 
  for(u=0; u<n; u++) {
    if(color[u] == WHITE)
      visit(u);
  }
 
  for(u=0; u<n; u++) {
    printf("%d %d %d\n", u+1, d[u], f[u]);
  }
}

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

using ll = long long;
using vi = vector<int>;
using vll = vector<long long>;

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

constexpr long long mod = 1000000007;

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

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

    int n;
    cin >> n;
    vll a(n);
    rep(i, n) cin >> a[i];

    map<ll, ll> mp;
    rep(i, n) {
        if (mp.count(a[i])) {
            mp[a[i]]++;
        } else {
            mp[a[i]] = 1LL;
        }
    }

    ll cnt = 0;
    for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
        if(itr->second%2){
            cnt++;
        }
    }

    cout << cnt << endl;
}

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

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


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

    ll a;
    ll ans = 0;
    rep(i, N){
        cin >> a;
        while(a % 2 == 0){
            a /= 2;
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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; }

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  ll N, M;
  cin >> N >> M;

  ll ans = 0; 

  ll base = (N-M) * 100 + M * 1900;

  ans = 1;
  for(int i = 0; i < M; i++){
    ans *= 2;
  }
  ans = base * ans;
  cout << ans << endl;



  return 0;
}


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

//#define MOD (int)(1e5 + 7)
#define MOD (100007)

static inline void done(const char *s)
{
	puts(s);
	exit(0);
}

#define yes() done("Yes");
#define no() done("No");
#define invalid() done("-1");

static int comp(const void *a, const void *b)
{
	int *pa = (int *)a;
	int *pb = (int *)b;
	return *pa < *pb;
}

static inline int *readNint(int n)
{
	int *a = calloc(sizeof(int), n);
	for (int i = 0; i < n; i++)
		scanf("%d", &a[i]);
	return a;
}

static inline long *readNlong(int n)
{
	long *a = calloc(sizeof(long), n);
	for (int i = 0; i < n; i++)
		scanf("%ld", &a[i]);
	return a;
}

int main(int argc, char **argv)
{
	uint64_t N, A, B;
	scanf("%ld%ld%ld", &N, &A, &B);
	uint64_t C = A + B;
	uint64_t T = N / C;
	if (A == 0) {
		printf("0\n");
		return 0;
	}
	uint64_t ans = T * A;
	uint64_t r = N % C;
	fprintf(stderr, "%ld %ld\n", ans, r);
	if (r > A)
		r = A;
	if (r > 0)
		ans += r;
	printf("%ld\n", ans);
	return 0;
}


Measured memory_bytes: 128
a, b, c, d = map(int, input().split())
import numpy as np
cmin = (a - 1) // c + 1
cmax = b // c
dmin = (a - 1) // d + 1
dmax = b // d
lcmcd = np.lcm(c, d)
cdmin = (a - 1) // lcmcd + 1
cdmax = b // lcmcd
csum = cmax - cmin + 1
dsum = dmax - dmin + 1
cdsum = cdmax - cdmin + 1
print((b - a + 1) - (csum + dsum - cdsum))

Measured memory_bytes: 27028
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

int H,W,sh,sw,gh,gw,h,w,nh,nw;
string x;
vector<pair<int,int>> walk={{1,0},{-1,0},{0,1},{0,-1}};
vector<pair<int,int>> warp={{1,1},{-1,1},{-1,-1},{1,-1},{2,0},{2,1},{2,2},{1,2},
                    {0,2},{-1,2},{-2,2},{-2,1},{-2,0},{-2,-1},{-2,-2},{-1,-2},
                    {0,-2},{1,-2},{2,-2},{2,-1}};
//push,top,pop
int dfs(vector<string> &maze){
    vector<vector<int>> visited(H,vector<int>(W,-1));
    visited[sh][sw]=0;
    stack<pair<int,int>> s;
    s.push(make_pair(sh,sw));
    int warpcnt=0,pointer=0;
    vector<pair<int,int>> record={{sh,sw}};
    while(!s.empty()){
        while(!s.empty()){
            auto p=s.top();s.pop();
            h=p.first;w=p.second;
            for(auto np:walk){
                nh=h+np.first;nw=w+np.second;
                if(nh<0||nh>H-1||nw<0||nw>W-1)continue;
                if(maze[nh][nw]=='#')continue;
                if(visited[nh][nw]!=-1)continue;
                if(nh==gh&&nw==gw){return warpcnt;}
                visited[nh][nw]=warpcnt;
                s.push(make_pair(nh,nw));
                record.pb(make_pair(nh,nw));
            }
        }
        warpcnt++;
        int sz=record.size();
        for(int i=pointer;i<sz;i++){
            auto p=record[i];
            h=p.first;w=p.second;
            for(auto np:warp){
                nh=h+np.first;nw=w+np.second;
                if(nh<0||nh>H-1||nw<0||nw>W-1)continue;
                if(maze[nh][nw]=='#')continue;
                if(visited[nh][nw]<=warpcnt){
                    if(visited[nh][nw]!=-1)continue;
                }
                if(nh==gh&&nw==gw){return warpcnt;}
                visited[nh][nw]=warpcnt;
                s.push(make_pair(nh,nw));
                record.pb(make_pair(nh,nw));
            }
        }
        pointer=sz;
    }
    return -1;
}
//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    cin>>H>>W>>sh>>sw>>gh>>gw;
    sh--;sw--;gh--;gw--;
    vector<string> maze(H);
    for(int i=0;i<H;i++)cin>>maze[i];
    int ans=dfs(maze);
    cout<<ans<<endl;
}


Measured memory_bytes: 13120
#include <iostream>
using namespace std;
int main(){
    int A;
  	int B;
  	cin >> A;
    cin >> B;
  	int ans;
  	if(A < B){
    ans = 2*B-1;
    }
  else if(A > B){
    ans = 2*A-1;
  }
  else{
    ans = A + B;
  }
  cout << ans <<endl;
}


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

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

int main(){
    int n;
    cin >> n;
    ll a[100005];
    int minus = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if(a[i] < 0)minus++;
    }
    ll sum = 0;
    ll mini = INF;
    for(int i = 0; i < n; i++){
        sum+=abs(a[i]);
        if(minus%2)mini = min(mini, abs(a[i]));
    }
    if(minus%2)sum-=mini*2;
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int n;
/*
int solve(int indx){
    if(indx == n)
        return 0;

    if(indx == n-1)
        return 0;

    if(dp[indx] != -1 )
        return dp[indx];
    if(indx == n-2)
       return dp[indx]= solve(indx+1) + abs(arr[indx] - arr[indx+1]);



   return dp[indx] = min(solve(indx+1)+abs(arr[indx] - arr[indx+1]), solve(indx+2)+abs(arr[indx] - arr[indx+2]));

}

*/





int main() {


    int n , k;
    cin >> n >> k;
    int arr[n];

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

    for(int i=2;i<n;i++){
        int minn = INFINITY;
        for(int j=1;j<k+1 && i-j >=0;j++)
            minn = min(abs(arr[i]- arr[i-j])+dp[i-j] , minn);
        dp[i] = minn;
    }
    cout << dp[n-1];
    return 0;
}


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

int data1[] = {0,20,19,20,19,20,19,20,19,20,19};
int data2[] = {0,20,20,20,20,20,20,20,20,20,20};

int main(){
	int n;
	int y,m,d;
	int millennium = 1;
	int ans = 0;

	for(int i = 1; i <= 1000-1; i++){
		for(int j = 1; j <= 10; j++){
		if(i%3 != 0) millennium += data1[j];
		else millennium += data2[j];
		}
	}

	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> y >> m >> d;
		for(int i = 1; i <= y-1; i++){
			for(int j = 1; j <= 10; j++){
			if(i%3 != 0) d += data1[j];
			else d += data2[j];
			}
		}
		for(int i = 1; i <= m-1; i++){
			if(y%3 != 0) d += data1[i];
			else d += data2[i];
		}
	cout << millennium - d << endl;
	}
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

struct edge{
  ll a,b,w;
  edge(ll x,ll y,ll z):a(x),b(y),w(z){}
};

ll f(ll x){
  ll res=0,crt=1;
  while(crt*2<=x){
    crt*=2; res++;
  }
  return res;
}

void show(edge e){
  cout<<e.a<<" -> "<<e.b<<" : "<<e.w<<endl;
}

ll L;
vector<edge> es;

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

  cin>>L;
  L--;
  ll b=f(L);
  ll N=b+1;

  if(b==0){
    cout<<2<<" "<<2<<endl;
    cout<<1<<" "<<2<<" "<<0<<endl;
    cout<<1<<" "<<2<<" "<<1<<endl;
    return 0;
  }

  rep(i,b){
    es.push_back(edge(i,i+1,(1<<i)));
    es.push_back(edge(i,i+1,0));
    // show(edge(i,i+1,(1<<i)));
    // show(edge(i,i+1,0));
  }

  ll l=(1<<b);
  // dbg(l);
  // dbg(L);
  while(l<=L){
    // l-L
    ll cnt=(L-l+1);
    ll step=min(f(cnt),b-1);
    // dbg(step);
    es.push_back(edge(step,N-1,l));
    // show(edge(step,N-1,l));
    l+=(1<<step);
  }

  cout<<N<<" "<<es.size()<<endl;
  rep(i,es.size()){
    cout<<es[i].a+1<<" "<<es[i].b+1<<" "<<es[i].w<<endl;
  }

  return 0;
}


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

long long N,tt,ta,t,a,j,i,pret,prea;

int main(void){
    cin>>N;
    cin>>tt>>ta;
    for(int i=0;i<N-1;i++){
        cin>>t>>a;
        long long c1=ta/a;
        if(ta%a != 0) c1+=1;
        long long c2=tt/t;
        if(tt%t != 0) c2+=1;
        j=max(c1,c2);
        tt=t*j;
        ta=a*j;
    }
    cout<<ta+tt<<endl;
}


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

using namespace std;

int n, m;
int a[111111], r[111111];
long long an[111111];

int main(){
//	freopen("input.inp", "r", stdin);
	scanf("%d%d",&n,&m);
	for(int i = 1; i <= n; ++i) scanf("%d",&a[i]);
	for(int i = 1; i < n; ++i){
		if (a[i] < a[i + 1]){
			an[1] += a[i + 1] - a[i];
			an[a[i] + 1] -= a[i + 1] - a[i];
			an[a[i + 1] + 1] += a[i + 1] - a[i];
			an[a[i] + 1] += a[i + 1] + 1;
			++r[a[i] + 1];
			an[a[i + 1] + 1] -= a[i + 1] + 1;
			--r[a[i + 1] + 1];
		}
		else{
			an[a[i] + 1] += a[i + 1] + m + 1;
			++r[a[i] + 1];
			++r[1];
			an[1] += a[i + 1] + 1;
			an[a[i + 1] + 1] -= a[i + 1] + 1;
			--r[a[i + 1] + 1];
			an[a[i + 1] + 1] += m - a[i] + a[i + 1];
			an[a[i] + 1] -= m - a[i] + a[i + 1];
		}
	}
	for(int i = 1; i <= m; ++i){
		r[i] += r[i - 1];
		an[i] += an[i - 1]; 
	}
	for(int i = 1; i <= m; ++i){
		an[i] -= 1ll * r[i] * i;
	}
	int q = 1;
	for(int i = 2; i <= m; ++i) if (an[i] < an[q]) q = i;
	printf("%lld",an[q]);
	return 0;
}

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

alias Tuple!(long, "v", long, "cnt") V;
real EPS = 0.0000000000001;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto A = s[1];
    auto B = s[2];
    auto v = readln.split.map!(to!long).array;

    auto dp = new V[][](N+1, N+1); // i個目まで見てj個取ったときの最大値
    foreach (i; 0..N+1) fill(dp[i], V(0, 0));
    dp[0][0] = V(0, 1);
    foreach (i; 0..N) {
        dp[i+1] = dp[i].dup;
        foreach (j; 0..i+1) {
            long next_v = dp[i][j].v + v[i];
            if (next_v > dp[i+1][j+1].v) dp[i+1][j+1] = V(next_v, dp[i][j].cnt);
            else if (next_v == dp[i+1][j+1].v) {
                dp[i+1][j+1].cnt += dp[i][j].cnt;
            }
        }
    }

    long ans_v = 0;
    long ans_bunbo = 1;
    long ans_cnt = 0;
    foreach (j; A..B+1) {
        if (dp[N][j].cnt == 0) continue;
        long g = gcd(dp[N][j].v, j);
        long new_v = dp[N][j].v / g;
        long new_j = j / g;
        if (new_v * ans_bunbo > ans_v * new_j) {
            ans_v = new_v;
            ans_bunbo = new_j;
            ans_cnt = dp[N][j].cnt;
        }
        else if (new_v * ans_bunbo == ans_v * new_j) {
            ans_cnt += dp[N][j].cnt;
        }
    }

    writefln("%.8f", 1.0 * ans_v / ans_bunbo);
    writeln(ans_cnt);
}


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

bitset < 4000003 > arr; int N , sum;

int main(){
	cin >> N; arr[0] = 1;
	for(int x , i = 1 ; i <= N ; ++i){cin >> x; sum += x; arr = arr | (arr << x);}
	for(int i = (sum + 1) / 2 ; i <= sum ; ++i) if(arr[i]){cout << i; break;}
	return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0);cin.tie();cout.tie();
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 9223372036854775807;
const ll mininf = -9223372036854775807;
const ll nax = 0;

int main(){
	IOS
	ll n, ans=0;
	cin >> n;
	for(int i=1;i<=n;i++){
		if(i%3!=0&&i%5!=0){
			ans+=i;
		}
	}
	cout << ans << '\n';
}

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

using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,n,m) for(ll i=n; i>(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define cinv(v,n,m) FOR(i,n,m) cin>>v.at(i)
#define coutv(v,n,m) FOR(i,n,m) cout<<v.at(i) <<" "
#define cout(n) cout<<fixed<<setprecision(n)
int main(){
  string a,b;
  cin>>a>>b;
  a=a+b;
  ld res;
  res=std::stoi(a);
  res=sqrt(res);
  if((ll)res/1==res) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


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

int main(){
  int n;
  cin >> n;
  vector<string> s(n);
  rep(i,n){
    cin >> s.at(i);
  }
  int acnt = 0;
  int bcnt = 0;
  int bacnt = 0;
  int abcnt = 0;
  rep(i,n){
    rep(j,s.at(i).size()-1){
      if(s.at(i).at(j) == 'A' && s.at(i).at(j+1) == 'B'){
        abcnt++;
      }
    }
    if(s.at(i).at(0) == 'B' && s.at(i).at(s.at(i).size()-1) == 'A'){
      bacnt++;
    }else if(s.at(i).at(0) == 'B'){
      bcnt++;
    }else if(s.at(i).at(s.at(i).size()-1) == 'A'){
      acnt++;
    }
    //cout << abcnt << "," << acnt << "," << bcnt << endl;
  }
  if(acnt>0&&bcnt>0){
    abcnt += bacnt + 1 +min(acnt-1,bcnt-1);
  }else if(acnt>0 || bcnt>0){
    abcnt += bacnt;
  }else if(bacnt>0){
    abcnt += bacnt-1;
  }
  cout << abcnt << endl;
}

Measured memory_bytes: 768
#include <stdio.h>
#include <string.h>

char S[1010];
int dir[4];

int main() {

	scanf("%s",S);

	int i;

	for (i = 0; i < strlen(S); i++) {
		if (S[i] == 'N') { dir[0]++; }
		else if (S[i] == 'W') { dir[1]++; }
		else if (S[i] == 'S') { dir[2]++; }
		else { dir[3]++; }
	}

	int flag = 1;

	if (dir[0] == 0 && dir[2] > 0) { flag = 0; }
	if (dir[0] > 0 && dir[2] == 0) { flag = 0; }
	if (dir[1] == 0 && dir[3] > 0) { flag = 0; }
	if (dir[1] > 0 && dir[3] == 0) { flag = 0; }

	if (flag == 1) { printf("Yes\n"); }
	else { printf("No\n"); }

	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
vector<pair<int,int> >G[1<<17];
int N;
long d[1<<17];
void f(int u,int p,long de)
{
	d[u]=de;
	for(pair<int,int>&q:G[u])
	{
		if(q.first==p)continue;
		f(q.first,u,de+q.second);
	}
}
main(){
	cin>>N;
	for(int i=1;i<N;i++)
	{
		int a,b,c;
		cin>>a>>b>>c;
		a--,b--;
		G[a].push_back(make_pair(b,c));
		G[b].push_back(make_pair(a,c));
		d[i]=9e18;
	}
	f(0,-1,0);
	for(int i=0;i<N;i++)cout<<d[i]%2<<endl;
}


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

int main() {
    int N;
    cin >> N;
    vector<long long> L(100);
    L[0] = 2; L[1] = 1;
    if(N == 1) {
        cout << L[1] << endl;
        return 0;
    }

    for (int i = 2; i <= N; i++)
    {
        L[i] = L[i - 2] + L[i - 1];
    }

    cout << L[N] << endl;
    return 0; 
}

Measured memory_bytes: 256
# b
require 'pp'
n, m = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
sum = a.inject(:+).to_f
a2 = a.select{|aa|
  aa >= (sum/(4*m))
}






puts (a2.size >= m) ? 'Yes' : 'No'




Measured memory_bytes: 2044
#include<stdio.h>

int main(void){
    int N;
    long sum = 0;
    scanf("%d",&N);
    int A[N];
    for(int i = 0; i < N; i++){
        scanf("%d",&A[i]);
    }
    for(int i = 1; i < N; i++){
        int j = 0;
        while(A[i] < A[i-1]){
            sum++;
            A[i]++;
        }
    }
    printf("%ld\n",sum);
    return 0;
}

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

int main(){
  int H, R; cin >> H >> R;

  if ( H*(-1) == R ) cout << 0 << endl;
  else if ( H*(-1) > R ) cout << -1 << endl;
  else if ( H*(-1) < R ) cout << 1 << endl;

  return 0;
}


Measured memory_bytes: 3124
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};
 
static const double EPS = 1e-8;

class State {
public:
  int panel;
  int cost;
  int machine_pos;
  State(int panel,int cost,int machine_pos){
    this->panel = panel;
    this->cost = cost;
    this->machine_pos = machine_pos;
  }
  bool operator<(const State& s) const {
    return cost < s.cost;
  }
  bool operator>(const State& s) const {
    return cost > s.cost;
  }
};

int dp[16][1<<16];

int main(){
  int num_of_panels;
  while(~scanf("%d",&num_of_panels)){
    if(num_of_panels == 0) break;

    int panels[2] = {};
    for(int set_i = 0; set_i < 2; set_i++){
      string panel;
      cin >> panel;
      for(int pos = 0; pos < num_of_panels; pos++){
        if(panel[pos] == 'B'){
          panels[set_i] |= (1<<pos);
        }
      }
    }
  
    priority_queue<State,vector<State>,greater<State> > que;

    memset(dp,0x3f,sizeof(dp));
    for(int pos = 0; pos < num_of_panels; pos++){
      dp[pos][panels[0]] = 0;
      que.push(State(panels[0],0,pos));      
    }

    while(!que.empty()){
      State s = que.top();
      que.pop();

      if(s.panel == panels[1]) goto found;

      for(int from = 0; from < num_of_panels; from++){
        for(int to = 0; to < num_of_panels; to++){
          if(from == to) continue;

          int from_bit = (s.panel >> from) & 1;
          int to_bit = (s.panel >> to) & 1;
          
          int next_panel = s.panel;
          if(to_bit == 1){
            next_panel = next_panel | (1 << from);
          }
          else {
            next_panel = next_panel & (((1<<num_of_panels) - 1) ^ (1 << from));
          }
          
          if(from_bit == 1){
            next_panel = next_panel | (1 << to);
          }
          else {
            next_panel = next_panel & (((1<<num_of_panels) - 1) ^ (1 << to));
          }
          
          if(dp[to][next_panel] <= s.cost + abs(to - from) + abs(from - s.machine_pos)) continue;
          dp[to][next_panel] = s.cost + abs(to - from) + abs(from - s.machine_pos);
          que.push(State(next_panel,s.cost + abs(to - from) + abs(from - s.machine_pos),to));
        }
      }
    }
  found:;
    int res = INF;
    for(int pos = 0; pos < num_of_panels; pos++){
      res = min(res,dp[pos][panels[1]]);
    }
    printf("%d\n",res);
  }
}

Measured memory_bytes: 15620
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <memory.h>
#include <set>
#include <cmath>
#define fio ios::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int n, cnt;
int main(void) {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		int x; scanf("%d", &x);
		if (x != i) cnt++;
	}
	if (cnt != 2 && cnt != 0) printf("NO\n");
	else printf("YES\n");
}

Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include <cassert>
#include<iostream>
#include<vector>
using namespace std;
typedef long long lint;
typedef vector<int>vi;
typedef pair<int,int>pii;
#define rep(i,n)for(int i=0;i<(int)(n);++i)


const int N=4000;
typedef bitset<N> bs;
const lint MOD=998244353;

bs read(){
  string s;
  cin>>s;
  int l=s.length();
  bs ret;
  rep(i,l)ret[i]=s[l-i-1]=='1';
  return ret;
}

bs div(bs a, bs b){
  int hi=-1;
  rep(i,N){
    if(b[i]){
      hi=i;
    }
  }
  assert(hi>=0);
  for(int i=N-hi-1;i>=0;--i){
    if(a[i+hi]){
      a^=b<<i;
    }
  }
  return a;
}

bs gcd(bs a,bs b){
  while(b.count()!=0){
    a=div(a,b);
    swap(a,b);
  }
  return a;
}

int main(){
  int n;
  cin>>n;
  bs x=read();
  vector<bs> s(n);
  rep(i,n)s[i]=read();
  bs t=s[n-1];
  rep(i,n-1)
    t=gcd(s[i],t);
  lint ans=0;
  lint cur=1;
  int hi=-1;
  rep(i,N){
    if(t[i]){
      hi=i;
    }
  }
  rep(i,N-hi){
    if(x[i+hi])ans=(ans+cur)%MOD;
    cur=cur*2%MOD;
  }
  bs y = x ^ div(x,t);
  bool lt=false;
  for(int i=N-1;i>=0;--i){
    if(x[i]!=y[i]){
      lt=x[i]<y[i];
      break;
    }
  }
  if(lt)ans=(ans+MOD-1)%MOD;
  ans=(ans+1)%MOD;
  cout<<ans<<endl;
}


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

int main() {
  const long mod = 1000000007;
  int n;
  cin >> n;
  vector<long> a(n);
  for (int i = 0; i < n; i++) cin >> a.at(i);
  long s = 0;
  for (int i = 0; i < n; i++) {
    s += a.at(i);
    s %= mod;
  }
  s *= n - 1;
  s %= mod;
  vector<long> b(60);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 60; j++) {
      if (a.at(i) & (1l << j)) b.at(j)++;
    }
  }
  long d = 0;
  for (int i = 0; i < 60; i++) {
    d += b.at(59 - i) * (b.at(59 - i) - 1) / 2;
    d %= mod;
    d *= 2;
    d %= mod;
  }
  s -= d;
  s += mod;
  s %= mod;
  cout << s << endl;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3

ll n;
vector<ll> g[101010];

ll dfs(ll v,ll pre){
  ll res=0;
  for(ll nv : g[v]){
    if(nv==pre)continue;
    ll tmp=dfs(nv,v);
    res^=tmp+1;
  }
  return res;
}

int main(){
	cin>>n;
  rep(i,n-1){
    ll a,b;
    cin>>a>>b;
    a--;b--;
    g[a].push_back(b); g[b].push_back(a);
  }
  if(dfs(0,-1)==0)cout<<"Bob"<<endl;
  else cout<<"Alice"<<endl;
	return 0;
}


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

using namespace std;

int main() {
  std::unordered_set<int> as;
  int a;
  std::cin >> a;
  while (std::cin >> a) {
    if (as.count(a)) {
      as.erase(a);
    } else {
      as.insert(a);
    }
  }
  std::cout << as.size() << std::endl;
  return 0;
}


Measured memory_bytes: 4388
n = gets.to_i
hash = Hash.new(0)
nums = gets.split.map(&:to_i)
nums.each do |num|
  hash[num] += 1
end
sides = [0, 0]
hash.each do |key, value|
  if value >= 4
    2.times { sides << key }
  elsif value >= 2
    sides << key
  end
end
sides.sort! { |a, b| b <=> a }
puts sides[0] * sides[1]


Measured memory_bytes: 14980
#include<stdio.h>

int main(){

  int data[7], n, i, in;


  while(1){
    scanf("%d",&n);

    if(n == 0) break;

    for(i = 0; i < 7; i++){
      data[i] = 0;
    }
    
    for(i = 0; i < n; i++){
    
      scanf("%d",&in);
    
      if(in < 10){
	data[0]++;
      }else if(in < 20){
	data[1]++;
      }else if(in < 30){
	data[2]++;
      }else if(in < 40){
      data[3]++;
      }else if(in < 50){
	data[4]++;
      }else if(in < 60){
	data[5]++;
      }else{
	data[6]++;
      }
    }

    for(i = 0; i < 7; i++){
      printf("%d\n",data[i]);
    }
  }
  
  return 0;
}

Measured memory_bytes: 408
package main

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

func main() {
	sc.Split(bufio.ScanWords)
	n, k, q := nextInt(), nextInt(), nextInt()
	t := make([]int, n)
	for i := 0; i < q; i++ {
		a := nextInt()
		t[a-1]++
	}
	for i := range t {
		p := k - q + t[i]
		if p > 0 {
			puts("Yes")
		} else {
			puts("No")
		}
	}
	wt.Flush()
}

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func nextMega() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


Measured memory_bytes: 4096
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"

using namespace std;
using namespace __gnu_pbds;

#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
int main(void)
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a, b;
    cin>>a>>b;
    if(a > 9 || b > 9) {
    	cout<<-1;
    } else {
    	cout<<a*b;
    }
}

Measured memory_bytes: 256
#include <iostream>
#define llint long long
#define mod 1000000007

using namespace std;

const int FACT_MAX = 4005;
llint fact[FACT_MAX], fact_inv[FACT_MAX];

llint modpow(llint a, llint n)
{
	if(n == 0) return 1;
	if(n % 2){
		return ((a%mod) * (modpow(a, n-1)%mod)) % mod;
	}
	else{
		return modpow((a*a)%mod, n/2) % mod;
	}
}

void make_fact()
{
	llint val = 1;
	fact[0] = 1;
	for(int i = 1; i < FACT_MAX; i++){
		val *= i;
		val %= mod;
		fact[i] = val;
	}
	fact_inv[FACT_MAX-1] = modpow(fact[FACT_MAX-1], mod-2);
	for(int i = FACT_MAX-2; i >= 0; i--){
		fact_inv[i] = fact_inv[i+1] * (i+1) % mod;
	}
}

llint comb(llint n, llint k)
{
	llint ret = 1;
	ret *= fact[n];
	ret *= fact_inv[k], ret %= mod;
	ret *= fact_inv[n-k], ret %= mod;
	return ret;
}

llint a, b;

int main(void)
{
	cin >> a >> b;
	make_fact();
	
	llint ans = 0;
	for(int i = 1; i <= b-1; i++){
		for(int j = 0; j <= i-1; j++){
			if(i+j > a) continue;
			llint tmp = comb(b-1, i) * comb(i-1, j) % mod;
			tmp *= comb(a-(i+j)+2, 2), tmp %= mod;
			ans += tmp, ans %= mod;
		}
	}
	ans += a+1, ans %= mod;
	cout << ans << endl;
	
	return 0;
}

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

   typedef long long ll;
   typedef pair<ll, ll> Pii;
   typedef vector<ll> Vi;
   typedef vector<Vi> VVi;

   const double EPS = (1e-7);
   const ll INF =(1e13);
   const double PI = (acos(-1));
   const ll MOD = ll(1e9) + 7;

   #define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
   #define REPR(i, n) for(ll i = n; i > -1; i--)
   #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
   #define ALL(x) (x).begin(),(x).end()
   #define SORT(x) sort((x).begin(), (x).end())
   #define RSORT(x) sort((x).rbegin(), (x).rend())
   #define REVERSE(x) reverse((x).begin(), (x).end())
   #define SZ(x) ((ll)(x).size())
   #define pb push_back
   #define mp make_pair

   //chmax(a, b): a>bならaをbで更新　更新したときにtrueを返す
   //chmin(a, b): a<bならaをbで更新　更新したときにtrueを返す
   template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
   template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

   #define dump(x) cerr<< #x << "= " << (x) << endl;

   ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
   ll pow(ll a, ll b){if (b == 0) return 1; else if (b % 2 == 0) return pow(a * a, b / 2); else return pow(a * a, b / 2) * a;}
   ll pow(ll a, ll b, ll m){if (b == 0) return 1; else if (a == 0) return 0; else if (b % 2 == 0) return (pow((a * a) % m, b / 2, m) % m); else return (pow((a * a) % m, b / 2, m) * a) % m;}
   ll residue(ll a, ll m){return ((a % m) + m) % m;};

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

int main(){
   string s; cin >> s;
   const string t = "keyence";
   ll n = s.size() - t.size();
   REP(i, s.size() - n){
      if(s.substr(0, i) + s.substr(i + n, t.size() - i) == t){
         cout << "YES" << endl;
         return 0;
      }
   }
   cout << "NO" << endl;
   
}


Measured memory_bytes: 256
(defun read-alist(N &optional (i 1) (l nil))
  (if (< N i) l
    (let ((str (format nil "~A~13D" (read) (- 100 (read)))))
      (read-alist N (1+ i) (cons (cons str i) l)))))

(mapcar #'(lambda(x) (princ (cdr x))(princ #\newline))
	(sort (read-alist (read)) #'string< :key #'car))

Measured memory_bytes: 11624
s = input()
i = 1; a = 1; n = 1
while i < len(s):
    if a == 1 and s[i-1] == s[i]:
        a = 2; i += 2; n += 1
    else:
        if i == len(s)-2 and s[i] == s[i+1]: n -= 1
        a = 1; i += 1; n += 1
print(n)

Measured memory_bytes: 9184
#include <stdio.h>
int main(void)
{
  int x,a,b;
  scanf("%d %d %d",&x,&a,&b);
  a=x>a?x-a:a-x;
  b=x>b?x-b:b-x;
  printf("%s\n", a<b?"A":"B");
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<string>
#include<cstring>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<cassert>
#include<queue>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;

const int MAXN = 100100;
int T[MAXN];

int main() {
	int N, C, K;
	cin >> N >> C >> K;
	for (int i = 0; i < N; i++)
		cin >> T[i];
	sort(T, T+N);
	int ans = 0, cnt = 0, now = T[0];
	for (int i = 0; i < N; i++) {
		if (cnt == C || T[i]-now > K) {
			++ans;
			cnt = 1;
			now = T[i];
			continue;
		} else {
			++cnt;
		}
	}
	if (cnt) ++ans;
	cout << ans << endl;
	return 0;
}


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

bool check(string t,char c){
    for(int i=0;i<t.length();i++){
        if(t[i]!=c) return false;
    }
    return true;
}

int main(){
    string s; cin>>s;
    int ans=1e9;
    for(char c='a';c<='z';c++){
        string t=s;
        for(int i=0;;i++){
            if(t.length()==0) break;
            if(check(t,c)){
                ans=min(ans,i);
                break;
            }
            string nt;
            for(int j=0;j<t.length()-1;j++){
                if(t[j]==c||t[j+1]==c) nt+=c;
                else nt+=t[j];  
            }
            t=nt;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
a, b, c, d = map(int,input().split())
if abs(a-c) <= d or ((abs(c-b) <= d  and abs(b-a) <= d) and (a<=b and b<=c)) or((abs(c-b) <= d  and abs(b-a) <= d) and (a>=b and b>=c)) :
	print('Yes')
else:
	print('No')


Measured memory_bytes: 3060
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
n = int(input())
x = list(map(int, input().split()))

q = sum(x) / n
p = Decimal(str(q)).quantize(Decimal('0'), rounding=ROUND_HALF_UP)

ans = 0
for i in range(n):
  ans += (x[i] - p) ** 2

print(ans)

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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pf printf
#define sc scanf
#define sf(n) scanf("%d",&n)
#define sff(n1,n2) scanf("%d %d",&n1,&n2)
#define sfff(n1,n2,n3) scanf("%d %d %d",&n1,&n2,&n3)
#define sl(n) scanf("%lld",&n)
#define sll(n1,n2) scanf("%lld %lld",&n1,&n2)
#define slll(n1,n2,n3) scanf("%lld %lld %lld",&n1,&n2,&n3)
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,n) for(i=1;i<=n;i++)
#define reps(i,a,n) for(i=a;i<=n;i++)
#define nl puts("");
#define pb push_back
#define MOD 1000000007
#define fi first
#define se second
#define N 100005
#define mem(ara,n) memset(ara,n,sizeof(ara))
#define memb(ara) memset(ara,false,sizeof(ara))
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define sz(x) x.size()
#define pi pair<int,int>
#define pii pair<pair<int,int>,pair<int,int> >
#define line puts("-------");
#define db(x) cout<<#x<<" :: "<<x<<"\n";
#define dbb(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define fr freopen("input.txt","r",stdin);
#define fw freopen("output.txt","w",stdout);
typedef long long int ll;
using namespace std;
int ara[N];
int main()
{
    int i,n,k;
    cin>>n>>k;
    rep0(i,k)
    {
        int m,j,p;
        cin>>m;
        rep0(j,m)
        {
            cin>>p;
            ara[p]++;
        }
    }
    int cnt=0;
    rep(i,n)
        cnt+=ara[i]==0;
    cout<<cnt;
}


Measured memory_bytes: 3636