akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main() {
int n,k;
cin >> n >> k;
int ans;
for(int i=0;n>0;i++){
	n = n/k;
	ans += 1;
}
cout << ans << endl;
return 0;
}


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

int a[3][3];
int d[3][3];

int main() {
  rep(i,3)rep(j,3) cin >> a[i][j];
  int n;
  cin >> n;
  rep(ni,n) {
    int x;
    cin >> x;
    rep(i,3)rep(j,3) if (a[i][j] == x) d[i][j] = 1;
  }
  bool ans = false;
  rep(i,3) {
    int cnt = 0;
    rep(j,3) cnt += d[i][j];
    if (cnt == 3) ans = true;
  }
  rep(i,3) {
    int cnt = 0;
    rep(j,3) cnt += d[j][i];
    if (cnt == 3) ans = true;
  }
  {
    int cnt = 0;
    rep(j,3) cnt += d[j][j];
    if (cnt == 3) ans = true;
  }
  {
    int cnt = 0;
    rep(j,3) cnt += d[j][2-j];
    if (cnt == 3) ans = true;
  }
  puts(ans?"Yes":"No");
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	Scanner sc = new Scanner(System.in);
	int a,b,c,d,e,f,k,l,m,n,x,y,z;
	int ans;
	String[] S;

	Main(){
		// 整数の入力
		a = sc.nextInt();
		b = sc.nextInt();
		n = 1;

		// 文字列の入力
		while(n<b){
			n += a-1;
			ans++;
		}

		// 出力
		System.out.println(ans);
	}

	public static void main(String[] args){
		new Main();
	}
}

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

// Compares two intervals according to staring times. 
bool comp(pair<int, pair<string, int>> i1, pair<int, pair<string, int>> i2) 
{ 
    if (i1.second.first == i2.second.first)
        return i1.second.second > i2.second.second;
    else
        return i1.second.first < i2.second.first;
} 

int main()
{   
    int N;
    cin >> N;
    pair<int, pair<string, int>> info[N];
    for (int i = 0; i < N; i++)
    {
        string city;
        int val;
        cin >> city >> val;
        info[i] = make_pair(i+1, make_pair(city, val));
    }
    sort(info, info+N, comp);
    for (int i = 0; i < N; i++)
        cout << info[i].first << endl;
   	return 0;
}

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

	int main(){
		
		ios_base::sync_with_stdio(false);
		cin.tie(NULL);
	
		// #ifndef ONLINE_JUDGE
		// freopen("input.txt", "r", stdin);
		// freopen("output.txt", "w", stdout);
		// #endif

		int n;
		cin >> n;
		int a[n][3],dp[n][3];
		for(int i=0;i<n;i++){
			cin >> a[i][0] >> a[i][1] >> a[i][2];
			dp[i][0]=dp[i][1]=dp[i][2]=0;
		}
		dp[0][0]=a[0][0];
		dp[0][1]=a[0][1];
		dp[0][2]=a[0][2];
		for(int i=1;i<n;i++){
			dp[i][0]=a[i][0]+max(dp[i-1][1],dp[i-1][2]);
			dp[i][1]=a[i][1]+max(dp[i-1][0],dp[i-1][2]);
			dp[i][2]=a[i][2]+max(dp[i-1][0],dp[i-1][1]);
		}
		cout << max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));	


	
	
		
	
	}

Measured memory_bytes: 2560
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

int main() {
  int r, g, b;
  cin >> r >> g >> b;
  cout << ((100 * r + 10 * g + b) % 4 == 0 ? "YES" : "NO") << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  ll X,Y;
  cin >> X >> Y;
  if (abs(X - Y) <= 1) {
    cout << "Brown" << endl;
  } else {
    cout << "Alice" << endl;
  }
  return 0;
}

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

signed main(){
  
  for(int i=0;i<5;i++){
    int a;
    cin >> a;
    if( a == 0 ){
      cout << i+1 << endl;
    }
  }
  
  
  
  return 0;
}


Measured memory_bytes: 3584
#include <iostream>
#define N 10001
using namespace std;
typedef long long ll;
bool vis[N];
ll a[N];
ll k,n,l;
inline bool f(){
	register int i,j;
	for(i=1;i<=l;i++)
	if(vis[a[i]]==true)return true;
	return false;
}
main(){
	register int i,j;
	cin>>k>>n;
	for(i=1;i<=n;i++){
		ll x;
		cin>>x;vis[x]=true; 
	}
	ll k1=k;
	while(k1){
		a[++l]=k1%10;
		k1/=10;
	}
	while(f()==true){
		ll p=1;
		a[p]++;
		while(a[p]>=10)a[p]-=10,p++,a[p]++;
		if(p>l)l++;
		k++;
	}
	cout<<k<<endl;
}

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

#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FILL0(x) memset(x,0,sizeof(x))

using namespace std;

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

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

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

    string S, T;
    cin >> S >> T;

    vector<int> v[30];
    FILL0(v);


    rep(i, T.size())
    {
        v[T[i]-'a'].push_back(i);
    }

    rep(i, 30)
    {
        if(v[i].size()>1)
        {
            char c = S[v[i][0]];
            rep(j, v[i].size())
            {
                if(c != S[v[i][j]])
                {
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }

    FILL0(v);

    rep(i, T.size())
    {
        v[S[i]-'a'].push_back(i);
    }

    rep(i, 30)
    {
        if(v[i].size()>1)
        {
            char c = T[v[i][0]];
            rep(j, v[i].size())
            {
                if(c != T[v[i][j]])
                {
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }



    cout << "Yes" << endl;

    return 0;

}


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

int main(int argc, char const *argv[])
{
    int n, m, l, d;
    cin >> n >> m >> l;
    int** A = new int*[n];
    for(int i = 0; i < n; i++){
        A[i] = new int[m];
        for(int j = 0; j < m; j++){
            cin >> d;
            A[i][j] = d;
        }        
    }
    
    int** B = new int*[m];
    for(int i = 0; i < m; i++){
        B[i] = new int[l];
        for(int j = 0; j < l; j++){
            cin >> d;
            B[i][j] = d;
        }        
    }

    long ans;
    for(int i = 0; i < n; i++)    {
        for(int j = 0; j < l; j++) {
            ans=0;
            for(int k = 0; k < m; k++){
                long a = A[i][k];
                long b = B[k][j];
                ans += a*b; 
            }
            cout << ans;
            if (j < l-1) cout << " ";
        }
        cout << endl;
    }

    delete[] A;
    delete[] B;
    A = 0;
    B = 0;

    return 0;
}



Measured memory_bytes: 3172
#include<bits/stdc++.h>
 
///for ordered set///
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/trie_policy.hpp>
///for ordered set///
 
using namespace std;
 
///for ordered set///
//using namespace __gnu_pbds;
//typedef tree< long long int , null_type, less_equal<long long int>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
///for ordered set///
 
///Compiler Optimizer///
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
///Compiler Optimizer///
 
typedef long long           ll;
typedef unsigned long long  ull;
 
#define sf                  scanf
#define pf                  printf
#define pb                  push_back
#define ppb                 pop_back
#define MP                  make_pair
#define PF                  first
#define PS                  second
#define si(n)               scanf("%d",&n)
#define sii(x,y)            scanf("%d %d",&x,&y)
#define siii(x,y,z)         scanf("%d %d %d",&x,&y,&z)
#define sl(n)               scanf("%lld",&n)
#define sll(x,y)            scanf("%lld %lld",&x,&y)
#define slll(x,y,z)         scanf("%lld %lld %lld",&x,&y,&z)
#define FOR(i,x,y)          for(int i=x;i<y;i++)
#define RFOR(i,x,y)         for(int i=x;i>=y;i--)
#define CLR(arr,val)        memset(arr,val,sizeof arr);
#define vout(v)             for(int ind=0;ind<v.size();ind++){ cout<<v[ind]; if(ind<v.size()-1) cout<<' '; else cout<<endl;}
#define TCL(test,t)         for(test=1;test<=t;test++)
#define READ()              freopen("input.txt", "r", stdin)
#define WRITE()             freopen("output.txt", "w", stdout)
#define fastIO()            {ios_base::sync_with_stdio(false); cin.tie(NULL);}
#define MAXN                1000006
#define MAXP                1000006
#define MOD                 1000000007
#define PI                  acos(-1)

double arr[1000006];

int main(){
    #ifdef ELDUIVEL
        clock_t tStart = clock();
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int n,m;
    double sum=0,d;
    cin>>n>>m;
    d=m; d=1/(4.0*m);
    for(int i=0;i<n;i++){
        cin>>arr[i];
        sum+=arr[i];
    }
    for(int i=0;i<n;i++){
        if(arr[i]/sum>=d)m--;
    }
    if(m>0)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    #ifdef ELDUIVEL
        fprintf(stderr, "\n>> Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
    #endif
    return 0;
}


Measured memory_bytes: 256
A,B,C = map(int,input().split())
K = int(input())

ans = 0
while True:
  if B>A:
    break
  else:
    B *= 2
    ans += 1
    
while True:
  if C>B:
    break
  else:
    C *= 2
    ans += 1
    
if ans<=K:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 61752
#include<bits/stdc++.h>
using namespace std;
bool comp(pair<long long int,long long int>a,pair<long long int,long long int>b)
{
    if(a.first==b.first)
    {
        if(a.second<=b.second)
        return true;
        else
        return false;
    }
    if(a.first>b.first)
    return true;
    else return false;
}
bool compa(pair<string,pair<int,int>>a,pair<string,pair<int,int>>b)
{
    if(a.first==b.first)
    {
        if(a.second.first>b.second.first)
        return true;
        else
        return false;
    }
    if(a.first<b.first)
    return true;
    else 
    return false;
}
long long int gcd(long long int bdda,long long int chota)
{
    if(chota==0)
        return bdda;
    return gcd(chota,bdda%chota);
}
void solve()
{
    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    int diff=0,ans=INT_MAX;
    for(int i=0;i<=n-k;i++)
    {
        diff=a[i+k-1]-a[i];
        ans=min(ans,diff);
    }
    cout<<ans;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;    
    t=1;

    //cin>>t;
    while(t--)
    {
        solve();
    }
}


Measured memory_bytes: 3924
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inc(i, l, r) for (int i = l; i <= r; i++)

const int maxn = 2e4 + 5;
const double eps = 1e-8;
int sgn(double x) {
    if (fabs(x) < eps) return 0;
    if (x < 0) return -1;
    return 1;
}
struct Point {
    double x, y;
    Point() {}
    Point(double _x, double _y) {
        x = _x;
        y = _y;
    }
} p[maxn];

int w, h, n, N;
double dy[maxn], res[maxn], ans;
int top;
double pos[maxn];

double calc(double Y) {
    inc(i, 0, N - 1) {
        if (fabs(p[i].x) < eps) {
            if (Y < p[i].y + eps)
                pos[i] = h;
            else
                pos[i] = 0;
        } else
            pos[i] = (p[i].y - Y) / p[i].x * w + Y;
    }
    sort(pos, pos + N);
    return max(0.0, min(pos[n], (double)h) - max(pos[n - 1], 0.0));
}

int main() {
    while (scanf("%d%d%d", &w, &h, &n) && w != 0) {
        ans = 0, N = 2 * n, top = 0;
        inc(i, 0, N - 1) scanf("%lf%lf", &p[i].x, &p[i].y);
        p[N] = Point(w, 0);
        p[N + 1] = Point(w, h);
        inc(i, 0, N + 1) {
            inc(j, i + 1, N + 1) {
                if (sgn(p[i].x - p[j].x) != 0) {
                    double ty =
                        -p[i].x / (p[j].x - p[i].x) * (p[j].y - p[i].y) +
                        p[i].y;
                    if (ty > -eps && ty < h + eps) dy[top++] = ty;
                }
            }
        }
        dy[top++] = 0;
        dy[top++] = h;
        sort(dy, dy + top);
        inc(i, 0, top - 1) {
            res[i] = calc(dy[i]);
        }
        inc(i, 0, top - 2) {
            double mid = calc((dy[i] + dy[i + 1]) / 2);
            // ans += (dy[i + 1] - dy[i]) / 6 * (res[i] + 4 * mid + res[i + 1]);
            ans += (dy[i + 1] - dy[i]) * mid;
        }
        printf("%.12f\n", ans / h / h);
    }
}



Measured memory_bytes: 3460
from collections import Counter

MOD = 10**9 + 7
N = int(input())
count = Counter()
ans = 1
num = []

for i in range(2, N+1):
    
    for n in num:
        while not i % n:
            count[n] += 1
            i //= n
        if i == 1:
            break
    else:
        num.append(i)
        count[i] = 1
        
for n in count.values():
    ans = ans * (n+1) % MOD
print(ans)

Measured memory_bytes: 3316
import java.util.Scanner;

public class Main {

    public static void main(String[] args){

        Scanner input = new Scanner(System.in);
        String[] yoko = new String[5];
        String[] tate = new String[4];

        for(int i = 0 ; i < 5 ; i++){
        	if(i != 4){
        		yoko[i] = input.nextLine();
        		tate[i] = input.nextLine();
        	}else{
        		yoko[i] = input.nextLine();
        	}
        }
        int stx = 0;
        int sty = 0;
        char direction = 'R';
        StringBuilder sb = new StringBuilder();
        while(true){

        	if(direction == 'R'){
        		if(sty != 0 && tate[sty-1].charAt(stx) == '1'){
        			sty--;
        			direction = 'U';
        		}else if(stx != 4 && yoko[sty].charAt(stx) == '1'){
        			stx++;
        		}else if(tate[sty].charAt(stx) == '1'){
        			sty++;
        			direction = 'D';
        		}else{
        			stx--;
        			direction = 'L';
        		}
        	}else if(direction == 'L'){
        		if(sty != 4 && tate[sty].charAt(stx) == '1'){
        			sty++;
        			direction = 'D';
        		}else if(sty != 0 && tate[sty-1].charAt(stx) == '1'){
        			sty--;
        			direction = 'U';
        		}else if(stx != 0 && yoko[sty].charAt(stx-1) == '1'){
        			stx--;
        		}else{
        			stx++;
        			direction = 'R';
        		}
        	}else if(direction == 'U'){
        		if(stx != 0 && yoko[sty].charAt(stx-1) == '1'){
            			stx--;
            			direction = 'L';
        		}else if(sty != 0 && tate[sty-1].charAt(stx) == '1'){
        			sty--;
        		}else if(yoko[sty].charAt(stx) == '1'){
        			stx++;
        			direction = 'R';
        		}else{
        			sty++;
        			direction = 'D';
        		}
        	}else if(direction == 'D'){
        		if(stx != 4 && yoko[sty].charAt(stx) == '1'){
         			stx++;
         			direction = 'R';
        		}else if(sty != 4 && tate[sty].charAt(stx) == '1'){
        			sty++;
        		}else if(stx != 0 && yoko[sty].charAt(stx-1) == '1'){
        			stx--;
        			direction = 'L';
        		}else{
        			sty--;
        			direction = 'U';
        		}
        	}
        	sb.append(direction);
        	if(stx == 0 && sty == 0)break;
        }
        System.out.println(sb.toString());
    }
}

Measured memory_bytes: 15296
def main():
    import string
    uc=string.ascii_uppercase
    a={uc[i]:i for i in range(26)}
    uc=uc+uc
    n=int(input())
    s=input()
    t=""
    for i in s:
        t+=uc[a[i]+n]
    print(t)
main()

Measured memory_bytes: 3772
import  java.io.*;
import  java.math.*;
import  java.util.*;


public class Main {
    public static void main(String[] args) {
    	Scanner cin = new Scanner(System.in);
    	int n = cin.nextInt();
    	long sum = 0;
    	for(int i = 1; i <= n; i++){
    		if(i%3 != 0 && i%5 != 0) sum += 1L*i;
    	}
    	System.out.println(sum);
    }
}

Measured memory_bytes: 35812
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	for(int i=1;i<1000;i++)
	{
		if(i*a>=b&&i*a<=c)
		{
			cout<<"OK";
			return 0;
		}
	}
	cout<<"NG";
}

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

using namespace std;
using ll = long long;

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

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

	int j = 0;

	if (A == B && A != C) { ++j; }
	if (A == C && A != B) { ++j; }
	if (B == C && B != A) { ++j; }

	if (j == 1) { cout << "Yes" << endl; }
	else { cout << "No" << endl; }
}

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

int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(a*b == c*d){
      cout<<a*b<<endl;
  }else if(a*b >c*d){
      cout<<a*b<<endl;
  }else{
      cout<<c*d<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
use std::vec::Vec;
use std::collections::VecDeque;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

const MOD: u64 = 1_000_000_000 + 7;

fn main() {
    let n: usize = read();
    let mut g: Vec<Vec<usize>> = vec![vec![]; n];
    for _ in 0..n-1 {
      let v: Vec<usize> = read_vec();
      g[v[0] - 1].push(v[1] - 1);
      g[v[1] - 1].push(v[0] - 1);
    }
    let mut vist = vec![false; n];
    let ans = dfs(0, &g, &mut vist);

    println!("{:?}", (ans.0 + ans.1) % MOD);

}

fn dfs(now: usize, adj_list: &Vec<Vec<usize>>, visit: &mut Vec<bool>) -> (u64, u64) {
  let mut stack: Vec<usize> =Vec::new();
  visit[now] = true;
  if adj_list[now].iter().fold(true, |acc, &x| acc && visit[x]) {
    return (1, 1);
  }
  let mut res = (1, 1);
  for &next in &adj_list[now] {
    if !visit[next] {
      let (b, w) = dfs(next, adj_list, visit);
      res = (res.0 * w % MOD, res.1 * (b + w) % MOD);
    }
  }
  return res;
}


Measured memory_bytes: 18812
#include<iostream>
using namespace std;
int main(){
	int n,d,x,a[105],ans,s=1;
	cin >> n >> d >> x;
	ans=n;
	for (int i=0;i<n;i++)
	{
		cin >> a[i];
		s=1;
		for(int j;;)
		{
			s+=a[i];
			if (s<=d)ans++;
			else break;
		}
	}
	cout << ans+x << endl;
	system("pause");
	return 0;
}

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

#define MD 10000

int main(){
	
	int dp[110][4][3]={0};
	dp[0][0][1]=1;
	/*
	dp[i][j][k]
	i日目
	jのパスタを
	k日連続使用
	*/
	
	int yo[110]={0};
	int n,k;
	cin>>n>>k;
	for(int i=0;i<k;i++){
		int d;cin>>d;
		cin>>yo[d];
	}
	
	for(int i=1;i<=n;i++){
		for(int j=1;j<=3;j++){
			if(yo[i]!=0 && yo[i]!=j)continue;
			dp[i][j][2]=dp[i-1][j][1];
			for(int j2=0;j2<=3;j2++){
				if(j2==j)continue;
				dp[i][j][1]+=dp[i-1][j2][1];
				dp[i][j][1]+=dp[i-1][j2][2];
				dp[i][j][1]%=MD;
			}
		}
	}
	
	int ans=0;
	for(int i=0;i<=3;i++){
		ans+=dp[n][i][1];
		ans+=dp[n][i][2];
		ans%=MD;
	}
	
	cout<<ans<<endl;
	
	return 0;
}


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

int main() {
  int d, t, s, dis;
  cin >> d >> t >> s;
  dis = d;
  dis -= s * t;
  if (dis <= 0) {
    cout << "Yes" << endl;
  }
  else if (dis >= 0) {
    cout << "No" << endl;
  }
}

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

#define REP( i, n )     for( int (i) = 0; (i) < (n); (i)++ )
#define ALL( a )        (a).begin(), (a).end()

using namespace std;
using ll = long long;
using P = pair<int, int>;

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( a > b ) { a = b; return 1; } return 0; }

const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9 + 7;

int main(){
    string s; cin >> s;
    sort( ALL( s ) );
    s.erase( unique( ALL( s ) ), s.end() );

    if( s.size() < 26 ) s += '*';

    REP( i, s.size() ){
        if( s[i] != 'a' + i ){
            cout << (char)( 'a' + i ) << endl;;
            return 0;
        }
    }

    cout << "None" << endl;
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	long long int n;
	cin>>n;
	long long int i=0;
	long long int c=0;
	while(n--){
		i++;
		long long int x;
		cin>>x;
		if((i&1)&&(x&1)){
			c++;
		}
	}
	cout<<c;
	return 0;
}

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

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
// cout << fixed << setprecision(20);

int A, B;
int r, k;
int l1, u1, l2, u2;
signed main() {
    cin >> A >> B;
    if (A == B){cout << 1 << endl; return 0;}
    bitset<60> bsA(A), bsB(B);
    for (int i = 59; i >= 0; i--) {
        if (bsA[i] != bsB[i]) {r = i; break;}
    }
    u1 = 1LL << r, l1 = A % (1LL << r);
    int ans = u1 - l1;
    k = -1;
    for (int i = r - 1; i >= 0; i--) {
        if (bsB[i]) {k = i; break;}
    }
    u2 = 1LL << (k + 1), l2 = 0;
    if (l1 <= u2)cout << ans + u1 - l2 << endl;
    else cout << ans + u1 - l1 + u2 - l2 << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#define rep(i,n) for (int i=0; i<n;++i)
#define rep_down(i,n) for (int i=n-1; i>=0;--i)
#define ALL(a)  (a).begin(),(a).end()
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;
const int INF = 1000000007;
int H, W, A, B;

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

  cin >> H >> W >> A >> B;

  rep(i, B){
    rep(j, A) cout << 0;
    rep(j, W-A) cout << 1;
    cout << endl;
  }

  rep(i, H-B){
    rep(j, A) cout << 1;
    rep(j, W-A) cout << 0;
    cout << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1408
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#define rep(index,num) for(int index=0;index<num;index++)
#define eps 1e-15
typedef long long ll;
int main(){
	int N;
	scanf("%d",&N);
	if(N%2==0) printf("%d\n",N);
	else printf("%d\n",N*2);
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
 
using namespace std;
 
using int64 = long long;
 
vector< int64 > arr;
 
void rec(string s, int a, int b, int c) {
  if(s.size() > 10) return;
  rec(s + "3", true, b, c);
  rec(s + "5", a, true, c);
  rec(s + "7", a, b, true);
  if(s.size() && a && b && c) arr.push_back(stoll(s));
}
 
int main() {
  int N;
  cin >> N;
  int ret = 0;
  rec("", false, false, false);
  for(auto &p : arr) {
    ret += p <= N;
  }
  cout << ret << endl;
}

Measured memory_bytes: 1400
#ifndef TEMPLATE
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#ifdef LOCAL
#include<debug.h>
#else
#define db(...) 21
#endif
#define mp make_pair
#define sz(a) ((int)(a).size())
#define mem(x,v) memset((x),(v),sizeof((x)));
#define A(x) (x).begin(),(x).end()
#define re(i,n) for(int i=0;i<(int)n;i++)
#define rep(i,k,n) for(int i=k;i<=n;i++)
#define erp(i,k,n) for(int i=n;i>=k;i--)
#define input(v,n) re(i,n)cin>>v[i]
using vi = vector<int>;
using vpi = vector<pair<int,int>>;
using vvi = vector<vi>;
using tp = tuple<int,int,int>;
using pi = pair<int,int>;

const int nax = 1e5+7;
const int mod = 1e9+7; //1e9+2667 :: 0xcf : inf, 0xc0 -inf
const int inf = numeric_limits<int> :: max() - (int)9e6;
#endif
// ===================== MANASH =================== //

int n;

void test() {

      cin >> n;
      vi v(n); re(i,n) cin >> v[i];
      int dp[n]; mem(dp,0);
      dp[0] = 0; dp[1] = abs(v[1]-v[0]);
      for( int i = 2; i < n; i++) {
            int one = dp[i-1] + (abs(v[i]-v[i-1]));
            int two = dp[i-2] + (abs(v[i]-v[i-2]));
            dp[i] = min(one,two);
      }
      cout << dp[n-1];
}

signed main() {

      ios_base :: sync_with_stdio(false);
      cin.tie(NULL);
      #ifdef LOCAL
      freopen("input.txt","r",stdin);
      #endif
      int T = 1;
      //cin >> T;
      for( int tt = 1; tt <= T; tt++) {
            //cout << "Case #" << tt << " ";
            test();
            cout << "\n";
      }
      return 0;

}

Measured memory_bytes: 4788
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args) {

            var line = Console.ReadLine();
            var N = int.Parse(line);

            int T = 0, X = 0, Y = 0;
            foreach (var n in Enumerable.Range(0, N)) {
                line = Console.ReadLine();
                var data = line.Split(' ');

                var t = int.Parse(data[0]);
                var x = int.Parse(data[1]);
                var y = int.Parse(data[2]);

                var deltaT = t - T;
                var subX = Math.Abs(x - X);
                var subY = Math.Abs(y - Y);

                var min = deltaT - subX - subY;

                if(min < 0 || min % 2 == 1) {
                    Console.WriteLine("No");
                    return;
                }

                T = t;
                X = x;
                Y = y;
            }
            Console.WriteLine("Yes");
        }
    }
}


Measured memory_bytes: 15312
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline int read(){
	int Res=0,f=1;char ch=getchar();
	while (ch>'9'||ch<'0') f=(ch=='-'?-f:f),ch=getchar();
	while (ch>='0'&&ch<='9') Res=Res*10+ch-'0',ch=getchar();
	return Res*f;
}
int N,Ans,P,val[100005],F[32768];
bool vis[100005];
int dfs(int S){
	if (!S) return 0;
	if (F[S]) return F[S];
	int Res=1e9;
	for (int i=1;i<=15;i++){
		if (!((S>>i-1)&1)) continue;
		for (int j=1;j<=15;j++){
			if (!((S>>j-1)&1)) continue;
			if (i==j) continue;
			int Ns=S^(1<<i-1)^(1<<j-1)^(1<<(i^j)-1),add=1;
			if ((S>>(i^j)-1)&1) add++;
			Res=min(Res,dfs(Ns)+add);
		}
	}
	return F[S]=Res;
}
int main()
{
	N=read();
	for (int i=1;i<N;i++){
		int x=read(),y=read(),z=read();
		val[x]^=z;val[y]^=z;
	}
	for (int i=0;i<N;i++){if (vis[val[i]]&&val[i]) Ans++;vis[val[i]]^=1;}
	for (int i=1;i<=15;i++) P|=(vis[i]<<i-1);
	printf("%d\n",dfs(P)+Ans);
	return 0;
}

Measured memory_bytes: 768
def main():
    N = int(input())
    s = ""
    d = N
    while d:
        if d % 26 == 0:
            d, r = d // 26 - 1, 26
        else:
            d, r = d // 26, d % 26
        s += chr(r+64).lower()

    print("".join(list(reversed(s))))


if __name__ == '__main__':
    main()

Measured memory_bytes: 9172
import heapq
def main():
  N = int(input())
  A = list(map(int, input().split()))
  A.sort(reverse = True)
  member = [-1*A[0]]
  ans = 0
  for i in range(1, N):
    ans += -1*heapq.heappop(member)
    for _ in range(2):
      heapq.heappush(member, -1*A[i])
  print(ans)
  
  
    
if __name__ == "__main__":
  main()

Measured memory_bytes: 31656
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
   vector<int> a, dis;  
   int k, n;
   cin >> k >> n;

    a.reserve(n);
    dis.reserve(n);

   for(int i = 0; i < n; ++i)
   {
       a.emplace_back();
       cin >> a.back();
       dis.emplace_back();
   } 

    for(int i = 0; i < n - 1; ++i)
    {
        uint32_t diff = abs(a[i] - a[i + 1]);
        dis[i] = min<uint32_t>(diff, k - diff);
    }

    int diff = abs(a[n - 1] - a[0]);
    dis[n - 1] = min<int>(diff, k - diff);

    sort(dis.begin(), dis.end());
    int ans = 0;

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

    cout << ans << "\n";

}

Measured memory_bytes: 1792
#include <stdio.h>

int main(void) {
	int a,b,c,d;
	d=0;
	scanf("%d%d%d",&a,&b,&c);
	while(1){
		if(a>b){break;}
		else {if(c%a==0){
			d=d+1;
			a=a+1;}
			else{a=a+1;}
	}}
	printf("%d\n",d);
	return 0;
}

Measured memory_bytes: 596
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N = sc.nextInt();
		int ans = 0;
		for (int i = 0; i < N; i++) {
			ans += sc.nextInt() - 1;
		}
		System.out.println(ans);
	}



	public static long gcd(long a, long b) {
		long remainder = a % b;
		if (remainder == 0) {
			return b;
		} else {
			return gcd(b, remainder);
		}
	}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 21844
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1e18) + 1;

int main(void)
{
    int n;
    vector<int> a(20);
    int x[20][20];
    int y[20][20];
    vector<bool> o(20);
    int i, j, k;
    int bit;
    int ans = 0;
    int count;
    bool flag;

    cin >> n;

   
    rep(i, 1, n + 1)
    {
        cin >> a.at(i);

        rep(j, 1, a[i] + 1)
        {
            cin >> x[i][j] >> y[i][j];
        }
    }

    rep(bit, 0, 1 << n)
    {
        flag = true;
        rep(i, 1, n + 1)
        {
            rep(j, 1, a[i] + 1)
            {
                if (!(bit & 1 << (i - 1)))
                {
                    continue;
                }

                if ((bit >> (x[i][j] - 1) & 1) ^ y[i][j])
                {
                    flag = false;
                }
            }
        }

        if (flag)
        {
            count = 0;
            rep(i, 0, n)
            {
                if (bit >> i & 1)
                {
                    count++;
                }
            }
            ans = max(ans, count);
        }
    }

    cout << ans << endl;
}

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

const double EPS = 1e-9;
const int LIM = 50;

bool eq(double a, double b) {
    return abs(a-b) < EPS;
}

long long square(long long x) {
    return x * x;
}

long long dist(int x1, int y1, int z1, int x2, int y2, int z2) {
    return square(x1 - x2) + square(y1 - y2) + square(z1 - z2);
}

int inner_product(int x1, int y1, int z1, int x2, int y2, int z2) {
    return x1*x2 + y1*y2 + z1*z2;
}

int main() {
    int N, Q;
    long long x[LIM], y[LIM], z[LIM], r[LIM];
    long long l[LIM];

    cin >> N >> Q;

    for (int j = 0; j < N; ++j) {
        cin >> x[j] >> y[j] >> z[j] >> r[j] >> l[j];
    }

    for (int _ = 0; _ < Q; ++_) {
        long long sx, sy, sz, dx, dy, dz;
        cin >> sx >> sy >> sz >> dx >> dy >> dz;

        long long ans = 0;

        for (int k = 0; k < N; ++k) {
            if (dist(sx, sy, sz, x[k], y[k], z[k]) <= square(r[k]) ||
                    dist(dx, dy, dz, x[k], y[k], z[k]) <= square(r[k])) {
                // cerr << " a" << endl;
                ans += l[k];
                continue;
            }
            long long plane1 = (sx-dx)*(x[k]-sx) + (sy-dy)*(y[k]-sy) + (sz-dz)*(z[k]-sz);
            long long plane2 = (sx-dx)*(x[k]-dx) + (sy-dy)*(y[k]-dy) + (sz-dz)*(z[k]-dz);

            // cerr << " " << (plane1*plane2);

            if (plane1 * plane2 > 0) {
                // cerr << endl;
                continue;
            }

            long long ip = inner_product(x[k]-sx, y[k]-sy, z[k]-sz, dx-sx, dy-sy, dz-sz);

            double dist_f = dist(x[k], y[k], z[k], sx, sy, sz) - ((double)square(ip))/dist(sx, sy, sz, dx, dy, dz);
            
            // cerr << " " << dist_f << " " << square(r[k]) << endl;

            if (dist_f <= square(r[k])) {
                ans += l[k];
            }
        }

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

Measured memory_bytes: 1164
package main

import "fmt"

func main() {
	var A, P, pie int
	fmt.Scan(&A, &P)

	pie = 3*A + P
	if pie%2 == 0 { //even
		fmt.Println(pie / 2)
	} else { //odd
		fmt.Println(pie / 2)
	}

}


Measured memory_bytes: 1768
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
#include <stdlib.h>
#define ll long long
#define MOD_P 1000000007
#define PI 3.141592
using namespace std;

int main()
{
	int a, b;
	cin >> a >> b;

	printf("%d", (a * 3 + b) / 2);

	return 0;
}

Measured memory_bytes: 256
n = input()
a = map(int, raw_input().split())
color = [0 for _ in range(9)]
for item in a:
    i = item / 400
    i = min(i, 8)
    color[i] += 1

ans = 0
for num in color[0:8]:
    if num != 0:
        ans += 1

min_ans = max(ans, 1)
max_ans = ans + color[8]
#max_ans = min(max_ans, 8)

print min_ans, max_ans


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


int main() {
    int N;
    cin >> N;
    vector<double> v(N);
    for(int i = 0; i < N; i++){
        cin >> v.at(i);
    }

    sort(v.begin(),v.end());

    vector<double> st(N);
        st.at(0) = (v.at(0) + v.at(1)) / 2;
    for(int i = 1; i < N-1; i++){
        st.at(i) = (st.at(i-1) + v.at(i+1))/2;
    }
  
  cout << fixed << setprecision(12);

    cout << st.at(N-2) << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
int main()
{
    int h,w,n;
    scanf("%d%d%d",&h,&w,&n);
    int mx=max(h,w);
    printf("%d",n%mx==0?n/mx:n/mx+1);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
 
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
 
#define pb push_back 
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second 
#define debug(x)  do{cerr<<#x<<": "<<x<<"\n";}while(0)
#define debugv(x) do{cerr<<#x<<": ";for(auto&e: (x))cerr<<e<<" ";cerr<<"\n";}while(0)
#define fori(i, n) for (int i = 0; i < (int)(n); ++i)
#define forn(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n); i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
template<typename T> bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
#define RETURN(x) do{cout << x << '\n'; return 0;}while(0)
#define FIRSTWIN do{cout << "Monocarp\n"; return 0;}while(0)
#define SECONDWIN do{cout << "Bicarp\n"; return 0;}while(0)
 
const int MAXN = 2e5+5;
const int MOD = 1e9+7;
const int INF = 1e9+1;

int N;
int A[MAXN]; 
int C[MAXN];

void mul(int& a, int b) {
    a = 1LL*a*b % MOD;
}

int main() {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> N;
    int ans = 1;
    C[0] = 3;
    fori(i,N) {
        int a;
        cin >> a;
        mul(ans,C[a]);
        C[a]--;
        C[a+1]++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <stdio.h>
#include <algorithm>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
#define rn(i,n) for(int i=1;i<=n;i++)
#define ll long long
const ll mod=1e9+7;

int main(){
  ll n;
  cin>>n;
  vector<ll> a(5);

  r(i,5)cin>>a.at(i);
  sort(a.begin(),a.end());

  ll min =a.at(0);
  //cout<<min<<endl;
  ll ans;
  if(n%min==0)ans=n/min+4;
  else ans=n/min+5;

  cout<<ans<<endl;
return 0;

}


Measured memory_bytes: 256
//Author:: Pham Ngoc Minh- Chuyen Thai Binh
#include<bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define ll long long
#define fl float
#define db double
#define ii pair<ll,ll>
#define pii pair<ii,ii>
#define ford(i,a,b) for(int i=a;i<=b;i++)
#define foru(i,a,b) for(int i=a;i>=b;i--)
#define forv(i,a,b) for(int i=a;i<b;i++)
#define oo 10000000000001
#define ooo -1000000000001
#define bost  ios_base::sync_with_stdio(false); cin.tie(0);
int const maxn=1e5+5;
int n,m;
long long w[maxn],v[maxn];
long long f[105][maxn]={0};
int main()
{
    bost
    cin>>n>>m;
    for(int i=1;i<=n;i++)
        cin>>w[i]>>v[i];
    for(int i=1;i<=n;i++){
        for(int j=0;j<=m;j++){
            if(j==0) f[i][j]=0;
            if(j>0){
                if(j<w[i]) f[i][j]=f[i-1][j];
                else f[i][j]=max(f[i-1][j],f[i-1][j-w[i]]+v[i]);
            }
        }
    }
    cout<<f[n][m];
    return 0;
}
// I love Chuyen Thai Binh Verry much ! Now, you alaways in my code of me <3
// Chuyen Thai Binh La Nha :>>


Measured memory_bytes: 79360
// URL: https://atcoder.jp/contests/abc135/tasks/abc135_a

import std.algorithm, std.container, std.math, std.range, std.typecons, std.string;

version(unittest) {} else
void main()
{
  int a, b; io.getV(a, b);
  io.putB((a+b)%2 == 0, (a+b)/2, "IMPOSSIBLE");
}

auto io = IO();

struct IO
{
  import std.algorithm, std.conv, std.format, std.meta, std.range, std.stdio, std.traits;

  dchar[] buf;
  auto sp = (new dchar[](0)).splitter;
  int precision = 10;
  string delimiter = " ";

  void nextLine()
  {
    stdin.readln(buf);
    sp = buf.splitter;
  }

  auto get(T)(ref T v)
  {
    if (sp.empty) nextLine();
    v = sp.front.to!T;
    sp.popFront();
  }

  auto getV(T...)(ref T v)
  {
    foreach (ref w; v) get(w);
  }

  auto getA(T)(size_t n, ref T v)
  if (hasAssignableElements!T)
  {
    v = new T(n);
    foreach (ref w; v) get(w);
  }

  auto getC(T...)(size_t n, ref T v)
  if (allSatisfy!(hasAssignableElements, T))
  {
    foreach (ref w; v)
      w = new typeof(w)(n);
    foreach (i; 0..n)
      foreach (ref w; v) get(w[i]);
  }

  auto getM(T)(size_t r, size_t c, ref T v)
  if (hasAssignableElements!T && hasAssignableElements!(ElementType!T))
  {
    v = new T(r);
    foreach (ref w; v) getA(c, w);
  }

  auto putA(T)(T v)
  {
    static if (isInputRange!T && hasLength!T && !isSomeString!T) {
      foreach (i, w; v) {
	putA(w);
	if (i < v.length - 1) write(delimiter);
      }
    } else if (isFloatingPoint!T) {
      writef(format("%%.%df", precision), v);
    } else {
      write(v);
    }
  }

  auto put(T...)(T v)
  {
    foreach (i, w; v) {
      putA(w);
      if (i < v.length - 1) write(delimiter);
    }
    writeln;
  }

  auto putB(S, T)(bool c, S t, T f)
  {
    if (c)
      put(t);
    else
      put(f);
  }

  auto dbg(T...)(T v)
  {
    stderr.writeln(v);
  }
}


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

void chmin(int *a,int b){
  if(*a > b){
    *a =b;
  }

  return;
}

/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/

int main(void){
  char s[2000];
  scanf("%s",s);

  char t[2000];
  scanf("%s",t);

  //strlen()で文字列の長さを取得できる
  //それを忘れてもforでif(s[i]=='\0')みたいなことをすれば取得できる
  int n=strlen(s);
  int m=strlen(t);

  //どう頑張っても変更する数はmを超えないのでmで初期化
  int ans=m;

  /*
  連続するn個のボールから連続するm個(m<=n)取る方法は
  (n-m+1)通りあるからこういう範囲
  */
  for(int i=0;i<n-m+1;i++){
    //"sのここからここをtに一致させたらどうなるのか"を決める
    
    //異なっている場所がいくつあるか->変えるべき場所がいくつあるか
    int cnt=0;
    for(int j=0;j<m;j++){
      if(s[i+j]!=t[j]){
        cnt++;
      }
    }

    //答えの更新
    chmin(&ans,cnt);

    /*
    chmin自体が「もしcnt<ansならば値を更新する」という意味だから
    わざわざif(){chmin()}という書き方をしなくてもいい
    */
  }

  printf("%d\n",ans);

  return 0;
}

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

int main(){
  stringstream ss;
  int n, m;
  cin >> n >> m;
  vector<vector<pair<int, int>>> city(n + 1);
  vector<string> ans(m);
  for (int i = 0; i < m; i++)
  {
    int cnum, y;
    cin >> cnum >> y;
    pair<int, int> p(y, i);
    city.at(cnum).push_back(p);
  }
  
  for(int i = 1; i < n + 1; i++){
    sort(city.at(i).begin(), city.at(i).end());
    for(int j = 0; j < city.at(i).size(); j++){
      int ci = i, cj = j + 1;
      int idx = city.at(i).at(j).second;
      ss << setw(6) << setfill('0') << ci << setw(6) << setfill('0') << cj;
      string id = ss.str();
      ss.str("");
      ss.clear(stringstream::goodbit);
      ans.at(idx) = id;
      
      
      // cout << city.at(i).at(j).first << " " << city.at(i).at(j).second << endl;
    }
  }
  
  for(int i = 0; i < m; i++){
    cout << ans.at(i) << endl;
  }
  
}

Measured memory_bytes: 11912
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
using ll = long long;
using namespace std;

void solve(){

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

    int n;
    cin >> n;
    int a[100000];
    int ind=0;
    int ans=0;


    for (int i=0;i<n;i++){
        cin >> a[i];
    }
    sort(a,a+n);
    while (ind<n)
    {
        int q=a[ind],cnt=0;
        while (ind<n && a[ind]==q )ind++,cnt++;
        ans+=cnt%2;
    }
    
    cout << ans;


    return 0;
}

Measured memory_bytes: 640
import java.util.*;

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

        String in = sc.next();
        String[] kouho = {"AKIHABARA", "KIHABARA", "AKIHBARA", "AKIHABRA", "AKIHABAR",
    "KIHBARA", "KIHABRA", "KIHABAR", "AKIHBRA", "AKIHBAR", "AKIHABR", "AKIHBR" , "KIHABR", "KIHBAR", "KIHBRA", "KIHBR" };
        String ans = "NO";

        for (String str : kouho) {
            if (in.equals(str)) {
                ans = "YES";
                break;
            }
        }
        
        System.out.println(ans);
    }
}


Measured memory_bytes: 23764
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>



int main()
{
    int n,i,s=0;
    scanf("%d",&n);
    int a[n];
    for(i=0;i<n;i++)
        scanf("%d",&a[i]);

    for(i=1;i<n-1;i++)
        if(a[i-1]<a[i] && a[i]<a[i+1] || a[i-1]>a[i] && a[i]>a[i+1])
        {
            //printf("%d ",a[i]);
            s++;
        }
    printf("%d",s);
}


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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())
#define put(a) ((cout) << (a) << (endl))
#define putf(a, n) ((cout) << (fixed) << (setprecision(n)) << (a) << (endl))
#define deg2rad(x) (((x)*PI) / (180.0))
#define rad2deg(x) (((x) * (180.0)) / PI)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;
template <class T> using vec = vector<T>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class T> static inline T gcd(T a, T b);
template <class T> static inline T lcm(T a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);
template <class T> T mod(T a, T m);

int main(int argc, char* argv[]) {
  std::string S;
  std::cin >> S;

  ll count = 0;
  rep(i, 0, sz(S) / 2) {
    if (S[i] != S[sz(S) - i - 1]) count++;
  }

  put(count);
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

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

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

template <class T> inline T gcd(T a, T b) { return __gcd(a, b); }

template <class T> inline T lcm(T a, T b) { return (a * b) / gcd(a, b); }

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}

template <class T> T mod(T a, T m) { return (a % m + m) % m; }


Measured memory_bytes: 256