akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main(){
    int n; cin >> n;
    int pt1 = 0;
    int pt2 = 0;
    for (int i = 0; i < n; i++){
        string s1, s2;
        cin >> s1 >> s2;
        if (s1 == s2){
            pt1++; 
            pt2++;
        }
        if (s1 > s2) pt1 += 3;
        if (s2 > s1) pt2 += 3;
    }
    cout << pt1 << " " << pt2 << endl;
    return 0;
}


Measured memory_bytes: 3124
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string>
//const long long mod = 1000000007;
const long long mod = 998244353;

int main() {
	int K, X;
	scanf("%d %d", &K, &X);
	for (int i = -1000000; i <= 1000000; i++) {
		if (X - K < i&&i < X + K)printf("%d ", i);
	}
	return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize("O3", "unroll-loops")
#include <bits/stdc++.h>

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	long long n, ans = 1e18;
	cin >> n;
	for (long long i = 1; i * i <= n; i++)
		if (n % i == 0)
			ans = min(ans, n / i + i);
	cout << ans - 2 << '\n';
	return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<utility>
#include<map>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,m,n) for(ll i=m;i<n;i++)
#define REPR(i,n) for(ll i=n-1;i>=0;i--)
#define FORR(i,n,m) for(ll i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 100000000
#define MOD 100000007
#define SIZE 100005

int main(){
  ll x,y;
  cin >> x >> y;
  printf("%lld %lld %lf",(ll)x/y,(ll)x%y,(double)x/y);
  return 0;
}


Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll N,K;
  cin >> N >> K;
  ll ans = 0;
  if (K == 0) {
    ans = N * N;
  }
  else {
    for (ll b = K+1; b <= N; b++) {
      ans += ((N + 1) / b) * (b - K);
      ans += max(N - (((N + 1) / b) * b) + 1 - K,(ll)(0)); 
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
s = input()
t = input()


dp = [[0] * (len(t) + 1) for _ in range(len(s) + 1)]

for i, ei in enumerate(s, 1):
    for j, ej in enumerate(t, 1):
        dp[i][j] = max(dp[i-1][j], dp[i][j-1], (dp[i-1][j-1] + 1) * (ei == ej))

i = len(s)
j = len(t)
ans = []
while i and j:
    if dp[i-1][j] == dp[i][j]:
        i -= 1
    elif dp[i][j-1] == dp[i][j]:
        j -= 1
    else:
        ans.append(s[i-1])
        i -= 1
        j -= 1

ans = "".join(ans[::-1])
print(ans)


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	ll N;
	cin >> N;
	ll F[N][10];
	ll P[N][11];
	REP(i, N)REP(j, 10) cin >> F[i][j];
	REP(i, N)REP(j, 11) cin >> P[i][j];

	ll res = -101010101010;
	REP(mask, 1<<10){
		if(mask==0) continue;
		ll sum = 0;
		vector<ll> hata(10);
		REP(k, 10){
			hata[k] = (mask>>k & 1);
		}
		REP(i, N){
			ll douji = 0;
			REP(k, 10){
				if(hata[k]==1 && F[i][k]==1) douji++;
			}
			sum += P[i][douji];
		}
		res = max(sum, res);
	}
	cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

	Scanner sca = new Scanner(System.in);
	String str = sca.next();
	String ans = "No";
	for(int i = 0; i < str.length()-1; i++) {
		if(str.charAt(i) == 'A' && str.charAt(i+1) == 'B') {
			ans = "Yes";
			break;
		}
		else if(str.charAt(i) == 'B' && str.charAt(i+1) == 'A') {
			ans = "Yes";
			break;
		}
		else {

		}
	}
	//ArrayList<> list = new ArrayList<>();
	System.out.println(ans);

	// 後始末
	sca.close();
	}
}

Measured memory_bytes: 21716
#include<stdio.h>

int main(void){
	int N,i,j,rank;
	int card[4][13];
	char data;

	for(i=0;i<4;i++)for(j=0;j<13;j++)card[i][j]=0;

	scanf("%d",&N);
	for(i=0;i<N;i++){
		scanf("\n%c %d",&data,&rank);
		switch(data){
		case 'S':card[0][rank-1]=99;break;
		case 'H':card[1][rank-1]=99;break;
		case 'C':card[2][rank-1]=99;break;
		case 'D':card[3][rank-1]=99;break;
		}
	}
for(i=0;i<4;i++){
	for(j=0;j<13;j++){
		if(card[i][j]==0){
			switch(i){
			case 0:printf("S %d\n",j+1);break;
			case 1:printf("H %d\n",j+1);break;
			case 2:printf("C %d\n",j+1);break;
			case 3:printf("D %d\n",j+1);break;
			}
		}
	}
}
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
#define PP pair<P,P>
using namespace std;

int main(){
    int n,m;
    ll l;
    cin >> n >> m >> l;
    vector<vector<int> > ki(n);
    vector<vector<ll> > wa(n,vector<ll>(n,1e18));
    rep(i,m){
        int a,b;
        ll c;
        cin >> a >> b >> c;
        a--; b--;
        ki[a].push_back(b);
        ki[b].push_back(a);
        wa[a][b]=c;
        wa[b][a]=c;
    }
    rep(i,n) wa[i][i]=0;
    
    rep(i,n)rep(j,n)rep(k,n) wa[j][k]=min(wa[j][k],wa[j][i]+wa[i][k]);

//cout << wa[0][0] << endl;

    vector<vector<int> > ki2(n);
    vector<vector<ll> > wa2(n,vector<ll>(n,1e18));
    rep(i,n-1){
        for(int j=i+1; j<n; j++){
            //cout << wa[i][j] << endl;
            if(wa[i][j]<=l){
                ki2[i].push_back(j);
                ki2[j].push_back(i);
                wa2[i][j]=1;
                wa2[j][i]=1;
            }
        }
    }

    rep(i,n) wa2[i][i]=0;
    rep(i,n)rep(j,n)rep(k,n) wa2[j][k]=min(wa2[j][k],wa2[j][i]+wa2[i][k]);

    int q; cin >> q;
    rep(i,q){
        int s,t; cin >> s >> t;
        s--; t--;
        if(wa2[s][t]==1e18) wa2[s][t]=0;
        cout << wa2[s][t]-1 << endl;
    }
   return 0;
}


Measured memory_bytes: 3072
//By Bibi
///                 .-~~~~~~~~~-._       _.-~~~~~~~~~-.
///             __.'              ~.   .~              `.__
///           .'//                  \./                  \`.
///        .'//                     |                     \`.
///       .'// .-~"""""""~~~~-._     |     _,-~~~~"""""""~-. \`.
///     .'//.-"                 `-.  |  .-'                 "-.\`.
///   .'//______.============-..   \ | /   ..-============.______\`.
/// .'______________________________\|/______________________________`.
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define dep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;
const int MAXN=1010;
typedef long long ll;
int read(){
	int sum=0,flag=1;
	char c;
	for(;c<'0'||c>'9';c=getchar())if(c=='-') flag=-1;
	for(;c>='0'&&c<='9';c=getchar())sum=(sum<<1)+(sum<<3)+c-'0';
	return sum*flag;
}
int n,T;
int t[MAXN],d[MAXN];
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	n=read();T=read();
	rep(i,1,n) t[i]=read(),d[i]=read();
	int ans=1e9;
	rep(i,1,n){
		if(d[i]<=T) ans=min(ans,t[i]);
 	}
 	ans==1e9? printf("TLE\n"):printf("%d\n",ans );;
	return 0;
}

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

const int N = (int)1e5+5;

ll dp[N][11];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int k;
    cin>>k;
    if(k<=10) {
        cout<<k;
        return 0;
    }
    int sum = 0;
    dp[1][0] = 1;
    for(int d=1;d<=9;d++) {
        dp[1][d] = 1;
        sum++;
    }
    int f = 0, s = 0;
    for(int l=2;l<=10;l++) {
        dp[l][0] = dp[l-1][0] + dp[l-1][1];
        for(int d=1;d<=9;d++) {
            dp[l][d] = dp[l-1][d-1] + dp[l-1][d] + dp[l-1][d+1];
            sum += dp[l][d];
            if(sum>=k && f==0) k -= (sum-dp[l][d]), f = d, s = l;
        }
    }
    string ans = "";
    ans += ('0'+f);
    for(int i=1;i<s;i++) {
        int sum = 0;
        for(int d=max(0,f-1);d<=min(9,f+1);d++) {
            sum += dp[s-i][d];
            if(sum>=k) {
                k -= (sum - dp[s-i][d]);
                f = d;
                break;
            }
        }
        ans += ('0'+f);
    }
    cout<<ans;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main()
{
	char S[3];
	int C = 0;
	char x = 'o';
	scanf("%s",S);
	if(S[0]==x){
		C++;
	}
	if(S[1]==x){
		C++;
	}
	if(S[2]==x){
		C++;
	}
	printf("%d",700 + C * 100);
	
	return 0;
}


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

const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  if (1 <= N && N <= 999)
    cout << "ABC" << endl;
  else
    cout << "ABD" << endl;
  return 0;
}


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

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin>>n;
  map<string,int> ma;
  while(n--){
    string s;
    cin>>s;
    ma[s]++;
  }
  vector<pair<int,string>> vp;
  for(auto ai:ma){
    vp.emplace_back(ai.second,ai.first);
  }
  sort(vp.begin(),vp.end(),[](auto A,auto B){
    if(A.first==B.first){
      return A.second<B.second;
    }
    return A.first>B.first;
  });
  for(auto ai:vp){
    if(ai.first==vp[0].first){
      cout<<ai.second<<'\n';
    }
  }
  return 0;
}

Measured memory_bytes: 27888
#include<bits/stdc++.h>
#define title "cell"
#define ll long long
#define ull unsigned ll
#define fix(x) fixed<<setprecision(x)
#define pii pair<ll,ll>
using namespace std;
void Freopen(){
	freopen(title".in","r",stdin);
	freopen(title".out","w",stdout);
}
ll read(){
	ll g=0,f=1;
	char ch=getchar();
	while(ch<'0'||'9'<ch){if(ch=='-')f=-1;ch=getchar();}
	while('0'<=ch&&ch<='9'){g=g*10+ch-'0';ch=getchar();}
	return g*f;
}
const ll N=1505;
char s[N][N];
ll n,su[N][N],minn[2][N][N],maxn[2][N][N],mxto[N][N],ans;
signed main(){
	n=read();
	for(ll i=1;i<=n;i++)scanf("%s",s[i]+1);
	for(ll i=n,now=1,pre=0;i>=1;i--,swap(now,pre)){
		for(ll j=n;j>=1;j--)if(s[i][j]!='#'){
			su[i][j]=su[i][j+1]+su[i+1][j]+s[i][j]-'0';
			mxto[i][j]=max(max(mxto[i][j+1],mxto[i+1][j]),i);
			minn[now][j][i]=maxn[now][j][i]=j;
			for(ll k=i+1;k<=mxto[i+1][j];k++)minn[now][j][k]=minn[pre][j][k];
			for(ll k=max(mxto[i+1][j],i)+1;k<=mxto[i][j+1];k++)minn[now][j][k]=minn[now][j+1][k];
			for(ll k=i;k<=mxto[i][j+1];k++)maxn[now][j][k]=maxn[now][j+1][k];
			for(ll k=max(mxto[i][j+1],i)+1;k<=mxto[i+1][j];k++)maxn[now][j][k]=maxn[pre][j][k];
			ll pos=i+1,lim=min(mxto[i][j+1],mxto[i+1][j]);
			while(pos<=lim){
				if(maxn[pre][j][pos]>=minn[now][j+1][pos]){
					su[i][j]-=su[pos][minn[now][j+1][pos]];
					pos=mxto[pos][minn[now][j+1][pos]];
				}pos++;
			}ans+=(s[i][j]-'0')*(su[i][j]-(s[i][j]-'0'));
		}
	}return cout<<ans,signed();
}

Measured memory_bytes: 28152
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n+1;i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end())
typedef long long ll;

int main(){
  int n;
  cin >> n;
  vector<pair<int,int>> r(n);
  vector<pair<int,int>> b(n);
  rep(i,n){
    int x,y;
    cin >> x >> y;
    auto tmp = make_pair(y,x);
    r[i] = (tmp);
  }
  sort(r);
  reverse(r);
  rep(i,n){
    int x,y;
    cin >> x >> y;
    auto tmp = make_pair(x,y);
    b[i] = (tmp);
  }
  sort(b);
  vector<bool> seen(n,0);
  int ans = 0;
  rep(i,n){//i番目のb
    int x = b[i].first;//bのx座標
    int y = b[i].second;//bのy座標
    rep(j,n){//j番目のr
      if(r[j].second < x){//bより小さい
        if(seen[j]) continue;//ペアが出来てたらスキップ
        if(r[j].first < y){//bより小さい
          seen[j] = 1;
          ans ++;
          break;
        }
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
'use strict'
function Main(input) {

  const S = input.split("\n")[0];
  const Sr = S.split("").reverse().join("");
  const num = Math.floor(S.length / 2);

  let count = 0;

  for (let i = 0; i < num; i++) {
    if (S[i] !== Sr[i]) {
      count += 1;
    }
  }
  console.log(count);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long ll;
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;}
#define sumMax 100001
#define INF 10000000000000000

int main(){
   string s,t;
   cin >> s;
   cin >> t;
   int n=s.length(),m=t.length();
   ll dp[n+1][m+1];
   rep(i,n+1)rep(k,m+1) dp[i][k] = 0;

   rep(i,n)rep(k,m){
        
      if(s[i]==t[k]) dp[i+1][k+1] = dp[i][k] + 1;
      chmax(dp[i+1][k+1],dp[i+1][k]);
      chmax(dp[i+1][k+1],dp[i][k+1]);    
         
   }

   // 復元
   int i=s.length(),k=t.length();
   string ans = "";
    while(i>0 && k>0){
       if(dp[i][k]==dp[i][k-1])k--;
       else if(dp[i][k]==dp[i-1][k])i--;
       else{
          ans = s[i-1]+ans;
          i--;
          k--;
       }
    }
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 70656
#include <stdio.h>

int main(void)
{
	int x,y;
	for(;;){
		scanf("%d %d",&x,&y);
		if(x==0&&y==0)break;
		if(x>y){
			printf("%d %d\n",y,x);
		}else if(x<y){
			printf("%d %d\n",x,y);
		}else{
			printf("%d %d\n",x,y);
		}
	}
	return 0;
}

Measured memory_bytes: 600
a = list(int(i) for i in input().split())
all = a[0]*a[1]*a[2]
a = sorted(a,reverse = True)
if a[0]%2 == 0 or a[1]%2 == 0 or a[2]%2 == 0:
  print(0)
else:
  red = (a[0]//2)*a[1]*a[2]
  print(all- 2*red)

Measured memory_bytes: 3060
#[allow(unused_macros)]
macro_rules! input_byline {
    ($($r:tt)* ) => {
        let stdin = std::io::stdin();
        let mut q = std::collections::VecDeque::new();
        let mut next = || {
            if q.is_empty() {
                let mut s = String::new();
                stdin.read_line(&mut s);
                for v in s.split_whitespace() {
                    q.push_back(v.to_string());
                }
            }
            q.pop_front().unwrap()
        };
        input_inner!{next, $($r)*}
    };

}

#[allow(unused_macros)]
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

trait Printable {
    fn p(&self);
}

impl<T: std::fmt::Display> Printable for T {
    fn p(&self) {
        println!("{}", self);
    }
}

impl<T: std::fmt::Display> Printable for [T] {
    fn p(&self) {
        for i in 0..self.len() {
            if i != 0 {
                print!(" ");
            }
            print!("{}", self[i]);
        }
        println!("");
    }
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap};

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;

fn main() {
    input! {
        n: usize,
        a: [usize; n],
    }

    if a[0] != 0 {
        println!("-1");
        return;
    }

    let mut cur = 0;
    let mut ans = 0;

    for i in 0..n {
        if cur == a[i] {
            ans += cur;
        } else if cur < a[i] && a[i] - cur == 1 {
            cur = a[i];
            ans += 1;
        } else if cur > a[i] {
            ans += a[i];
            cur = a[i];
        } else {
            println!("-1");
            return;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 6396
#include <iostream>
#include <stdio.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <bitset>
#include <stack>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
#define MOD 1000000007
using namespace std;


int main(void)
{
	int N; cin >> N;
	vector<int> T(N), A(N); rep(i, 0, N)cin >> T[i] >> A[i];
	lli Takahashi = 1, Aoki = 1;
	rep(i, 0, N) {
		lli t = (T[i] + Takahashi - 1) / T[i];
		lli a = (A[i] + Aoki - 1) / A[i];
		Takahashi = T[i] * ((t > a) ? t : a);
		Aoki = A[i] * ((t > a) ? t : a);
	}
	cout << (Takahashi + Aoki) << endl;
	
	return 0;
}

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

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

#define INF 1000000000

using namespace std;

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

    vector<int> A(N);

    for (int i = 0; i < N; ++i)
        cin >> A[i];

    int max_v = (A[0] + K) - A[N - 1];

    for (int i = 0; i < (N - 1); ++i) {
        max_v = max(max_v, A[i+1] - A[i]);
    }

    cout << K - max_v << endl;

    return 0;
}


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

using namespace std;

#define int long long
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    {                                                                          \
        FOREACH(x, v) { cout << x << " "; }                                    \
        cout << "\n";                                                          \
    }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}

typedef long long ll;
typedef unsigned long long ul;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, VL, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18 + 1;
const ll dx[] = {1, -1, 0, 0};
const ll dy[] = {0, 0, 1, -1};

ll K;

signed main() {
    cin >> K;
    if(K == 1) {
        cout << 1 << "\n";
        cout << 1 << "\n";
        return 0;
    }
    ll N = ((K + 3) / 4) * 2;
    cout << N << "\n";
    REP(i, N) {
        REP(j, N) {
            ll num = (i + j) % N;
            if(i % 2) num += N;
            if(num > K - 1) num -= N;
            cout << num + 1 << " ";
        }
        cout << "\n";
    }
}

Measured memory_bytes: 1152
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    string S;
    cin >> S;
    FOR(i, 'a', 'z' + 1) {
        if (S.find(i) == string::npos) {
            cout << char(i) << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}

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

#if DEBUG && !ONLINE_JUDGE
  #include "header.h"
#else
  #define debug(args...)
#endif

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long lli;
typedef long double ld;

#define pb push_back
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x).size()
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b) for(auto i=(a);i<b;i++)

#define INF (int)1e9
#define EPS 1e-9
#define MOD 1000000007
void preprocess(void) {
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(20);
  preprocess();
  int n, a, b; cin>>n>>a>>b;
  if(a == 1 && b == 2) {
    cout<<"Borys"<<endl;
  }
  else if((b - a) % 2 == 1) {
    cout<<"Borys"<<endl;
  }
  else cout<<"Alice"<<endl;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
constexpr long long MOD = 1000000007;
using ll = long long;
int main() {
string s;
cin >> s;
ll n = s.size();
ll ans = 0;
bool isone = false;
ll index = 0;
while(index<n){
    if(index==n-2&&s[index]==s[index+1LL]){
        ans++;
        break;
    }
    if(isone&&s[index-1]==s[index]){
        ans++;
        index += 2;
        isone = false;
    }
    else{
        ans++;
        index++;
        isone = true;
    }
}
cout << ans << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    string s, t;
    cin >> s >> t;
    
    int sc[26], tc[26];
    for (int i = 0; i < 26; i++) {
        sc[i] = tc[i] = 0;
    }
    for (char c : s) {
        sc[c-'a']++;
    }
    for (char c : t) {
        tc[c-'a']++;
    }
    sort(sc, sc+26);
    sort(tc, tc+26);
    
    bool f = true;
    for (int i = 0; i < 26; i++) {
        if (sc[i] != tc[i]) {
            f = false;
            break;
        }
    }
    
    cout << (f ? "Yes" : "No") << endl;
    
    return 0;
}

Measured memory_bytes: 776
#include <stdio.h>
 
int main(void){
  int i,j,n,m,cn;
  char c,s[5]={'S','H','C','D','\0'};
  static int card[4][13];
  scanf("%d\n",&n);
 
  for(i=0;i<n;i++){
    scanf("%c %d\n",&c,&m);
    for(j=0;j<4;j++)
      if(s[j]==c)
        card[j][m-1]=1;
  }
   
  for(i=0;i<4;i++)
    for(j=0;j<13;j++)
      if(card[i][j]==0)
        printf("%c %d\n",s[i],j+1);
 
  return 0;
}
    


Measured memory_bytes: 2044
//
//  main.cpp
//
// https://atcoder.jp/contests/abc129/tasks/abc129_e

#include <algorithm>
#include <array>
#include <assert.h>
#include <functional>
#include <iostream>
#include <limits>
#include <math.h>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;

ll good_mod(ll x, ll a) {
    return ((x % a) + a) % a;
}

int main(int argc, char* argv[]) {
    int base = 1000000007;
    string L;
    cin >> L;
    vector<ll> a(L.size() + 1);    // a[n] = # of (a, b) such that a + b < L[n]
    vector<ll> b(L.size() + 1);    // b[n] = # of (a, b) such that a + b = L[n]
    a[0] = 0;
    b[0] = 1;
    for (int n = 1; n <= L.size(); n++) {
        a[n] = good_mod(a[n-1] * 3, base);
        if (L[n-1] == '1') {
            a[n] = good_mod(a[n] + b[n-1], base);
        }
        if (L[n-1] == '0') {
            b[n] = b[n-1];
        } else {
            b[n] = good_mod(b[n-1] * 2, base);
        }
    }
    cout << good_mod(a[L.size()] + b[L.size()], base) << endl;
}

Measured memory_bytes: 2112
#include<bits/stdc++.h>
//g++ -std=c++11 

using namespace std;
typedef long long ll;

#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define DIV 1000000007 //10^9+7

ll N;

int main(){
	cin >> N;

	ll ans = 0;
	ll tmpans = 0;
	ll cur = -1;
	rep(i, N) {
		ll tmp;
		cin >> tmp;

		if(cur >= tmp) {
			tmpans++;
		} else {
			ans = max(ans, tmpans);
			tmpans = 0;
		}
		cur = tmp;
	}
	ans = max(ans, tmpans);
	cout <<  ans << endl;
}

Measured memory_bytes: 3564
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using static System.Console;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(ReadLine());
        }

        public static long[] Reads()
        {
            return ReadLine().Split().Select(long.Parse).ToArray();
        }


        public static long gcd(long x,long y)
        {
            if (y < x) gcd(y, x);
            while (y != 0)
            {
                var z = x % y;
                x = y;
                y = z;
            }
            return x;
        }
        static void Main(string[] args)
        {
            var sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var s = ReadLine().ToArray();
            var n = s.Length;
            var d = new Dictionary<char, long>();
            d.Add('a', 0);
            d.Add('b', 0);
            d.Add('c', 0);
            for (int i = 0; i < n; i++)
            {
                d[s[i]]++;
            }
            if (Math.Abs(d['a'] - d['b']) <= 1 && Math.Abs(d['b'] - d['c']) <= 1 && Math.Abs(d['c'] - d['a']) <= 1)
                WriteLine("YES");
            else
                WriteLine("NO");



            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 18764
#include <bits/stdc++.h>
using namespace std;
int main(){
    cin.tie(0);
    //ios::sync_with_stdio(false);
    string S;
    cin  >> S;
    int flag = 0;
    char ans = 0;
    for(int i = 97;i < 123;i++){
        for(int j = 0;j < S.size();j++){
            if(S.at(j) == i){
                flag = 1;
                break;
            }
        }
        if(flag == 0){
            ans = i;
            break;
        }
        flag = 0;
    }
    if(ans != 0){
    printf("%c",ans);
    }else{
        cout <<"None"<< endl;
    }
}

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

int main() {
  string S, T;
  cin >> S >> T;

  int most = 0;
  for (int i = 0; i < S.size() - T.size() + 1; i++) {
    int k = i;
    int judge = 0;
    for (int j = 0; j < T.size(); j++, k++) {
      if (T[j] == S[k]) judge++;
    }
    if (judge > most) {
      most = judge;
    }
  }
  cout << T.size() - most;

}

Measured memory_bytes: 3636
#include<stdio.h>
#include<algorithm>

using namespace std;

int main() {
	int n, p[20], tmp[3], count = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &p[i]);
	}
	for (int i = 1; i < n - 1; i++) {
		tmp[0] = p[i - 1];
		tmp[1] = p[i];
		tmp[2] = p[i + 1];
		sort(tmp, tmp + 3);
		if (tmp[1] == p[i])count++;
	}
	printf("%d\n", count);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
 
using namespace std;
 
queue < int > que[200001];
unordered_map< int, bool > v[100000];
bool visited[100000];
int N, M;
unordered_map< int, vector< int > > g[100001];
vector< pair< int, int > > graph[100000];
 
void dfs(queue< int >& q, int idx, const int cc)
{
  if(v[idx][cc]++) return;
  if(!visited[idx]++) q.push(idx);
  for(auto to : g[idx][cc]) dfs(q, to, cc);
}
 
int main()
{
  cin >> N >> M;
  for(int i = 0; i < M; i++) {
    int p, q, c;
    cin >> p >> q >> c;
    --p, --q;
    g[p][c].push_back(q);
    g[q][c].push_back(p);
    graph[p].push_back({q, c});
    graph[q].push_back({p, c});
  }
 
  que[0].push(0);
  visited[0] = true;
  for(int i = 0; !que[i].empty(); i++) {
    while(!que[i].empty()) {
      int p = que[i].front();
      if(p == N - 1) {
        cout << i << endl;
        return (0);
      }
      for(auto to : graph[p]) dfs(que[i + 1], to.first, to.second);
      que[i].pop();
    }
  }
  cout << -1 << endl;
}

Measured memory_bytes: 207104
i,o,_,j,l,_,_ = list(map(int,input().split()))

if i>0 and j>0 and l>0:
    ans = max((i//2)*2 + o + (j//2)*2 + (l//2)*2, ((i-1)//2)*2 + o + ((j-1)//2)*2 + ((l-1)//2)*2 +3)
else:
    ans = (i // 2) * 2 + o + (j // 2) * 2 + (l // 2) * 2
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define MAX(X, Y) (((X) > (Y))? (X) : (Y))
#define MIN(X, Y) (((X) < (Y))? (X) : (Y))
int compare_int(const void *a, const void *b){
  return *(long int*)b - *(long int*)a; // 大きい順
}
int compare_int_small(const void *a, const void *b){
  return *(long int*)a - *(long int*)b; // 小さい順
}
// 公約数
long int gcd(long int a, long int b){
  if(b == 0){
    return a;
  }else{
    return gcd(b, a % b);
  }
}
// 最小公倍数 = a * b / 最大公約数
// 公倍数
long int lcm(long int a, long int b){
  return a * b / gcd(a, b);
}

// 5min
int main(void){
  char s[5];
  scanf("%s", s);

  if(s[0] == s[1] || s[1] == s[2] || s[2] == s[3]){
    printf("Bad\n");
  }else{
    printf("Good\n");
  }

  return 0;
}


Measured memory_bytes: 128
dams_num = int(input())
dams_water = list(map(int, input().split()))

water_sum = sum(dams_water)
x_one = water_sum - 2 * (sum(dams_water[1:dams_num - 1:2]))
mountains_water = [x_one]
pre_x = x_one
for i in range(0, dams_num - 1):
    next_x = 2 * dams_water[i] - pre_x
    mountains_water.append(next_x)
    pre_x = next_x
print(' '.join(map(str, mountains_water)))


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


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    N *= 2;
    int L[N];
    rep(i, N) cin >> L[i];
    sort(L, L + N);
    int ans = 0;
    rep(i, N) {
        ans += min(L[i], L[i+1]);
        i++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;
int main(){
 char b;
  cin >> b;
  if (b=='A')
    cout <<'T'<<endl;
  else if (b=='T')
    cout <<'A'<<endl;
  else if (b=='G')
    cout <<'C'<<endl;
  else if (b=='C')
    cout <<'G'<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using P = pair<int,int>;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}




int main()
{
    int N;
    cin >> N;
    vector<ll> A(N);
    vector<ll> B(N);

    int count = 0;
    rep(i,N){
        cin >> A[i];
        if(A[i] < 0) count++;
        B[i] = fabs(A[i]);
    }
    ll ans = 0;

    if(count%2 == 0){
        rep(i,N){
            ans += B[i];
        }        
    }
    else{
        sort(B.begin(),B.end());
        rep(i,N-1){
            ans += B[i+1];            
        }
        ans -= B[0];
    }

    cout << ans << endl;

    return 0;
}
//Ctrl+Shift+Bでコンパイルと実行を行ってデバッグすること

Measured memory_bytes: 1792
s = input()
t = input()
sn = len(s)
tn = len(t)

alpha = [[] for i in range(26)]

for i in range(sn):
    number = ord(s[i]) - ord('a')
    alpha[number].append(i)

dist = [[-1 for i in range(26)] for j in range(sn)]
    
for i in range(26):
    if(len(alpha[i]) >= 1):
        now=0
        prev=0
        for j in range(len(alpha[i])):
            val = alpha[i][j]
            for k in range(val-prev):
                dist[now][i] = val-now
                now += 1
            prev=now
        val = alpha[i][0]
        for k in range(sn-prev):
            dist[now][i] = val-now+sn
            now += 1
            
#print(alpha)
#print(dist)

prev = sn-1
ans = 0
for i in range(tn):
    d = dist[prev][ord(t[i]) - ord('a')]
    if(d==-1):
        ans = -1
        break
    ans += d
    prev = (prev + d)%sn
    
print(ans)

Measured memory_bytes: 84624
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, s, e) for (int i = s; i < e; i++)
#define endl '\n'
bool notInArray(int a, vector<int> A, int size)
{
    for (int i = 0; i < size; i++)
    {
        if (a == A[i])
            return false;
    }
    return true;
}
int main()
{
    int X, N;
    cin >> X >> N;
    vector<int> P(N);
    int res = 1000;
    int ans = X;
    rep(i, 0, N) cin >> P[i];
    rep(i, 0, 102)
    {
        if (notInArray(i, P, P.size()))
        {
            if (abs(X - i) < res)
            {
                res = abs(X - i);
                ans = i;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3624
def main():
    O = input()
    E = input()
    if len(O) - len(E) == 0:
        ans = ''
        for o, e in zip(O, E):
            ans += o + e
    else:
        ans = O[0]
        for o, e in zip(O[1:], E):
            ans += e + o
    print(ans)


main()


Measured memory_bytes: 2940
N=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
# print(N,V,C)
sum=0
for i in range(N):
 # print(i)
 diff=V[i]-C[i]
 # print(diff)
 if diff > 0:
  sum=sum+diff
 # print(C[i]-V[i])

print(sum)

Measured memory_bytes: 3060
import numpy as np
from itertools import permutations

N = int(input())
P = np.array([input().split() for _ in range(N)], dtype=int)

MAP = P.reshape(N,1,2) - P.reshape(1,N,2)
MAP = (MAP[:,:,0]**2 + MAP[:,:,1]**2)**0.5

total = 0
n_cnt = 0

for rt in permutations(range(N)):
  n_cnt += 1
  total += MAP[rt[:-1], rt[1:]].sum()

print(total / n_cnt)

Measured memory_bytes: 21332
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input!{
        a: usize,
        b: usize,
    };

    let c = a * b;
    if c % 2 == 0{
        println!("Even");
        return;
    }
    println!("Odd");
}


Measured memory_bytes: 4352
s = raw_input()
if len(s) == 2:
    if s[0] == s[1]:
        print '1 2'
    else:
        print '-1 -1'
else:
    for i in xrange(len(s) - 2):
        if s[i] == s[i+1] or s[i] == s[i+2] or s[i+1] == s[i+2]:
            print str(i + 1) + ' ' + str(i + 3)
            break
    else:
        print '-1 -1'

Measured memory_bytes: 2692
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    string s;
    cin>>s;
    int cnt=0;
    int ans=0;
    rep(i,s.length()-1){
        if(s[i]==s[i+1]){
            cnt++;
            ans=max(ans,cnt);
        }
        else{
            ans=max(ans,cnt);
            cnt=0;
        }
    }
    if(ans>=2)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define FASTIO
#define endl "\n"  // Since endl forces a buffer flush which slows down large I/O operations.
#define ff first
#define ss second
#define pb push_back
#define input(c, n) for (int i = 0; i < n; ++i) cin >> c[i];
#define exit_message(s) return 0 * printf(s)
#define show_all(c) for (auto i: c) cout << i << " "; cout << "\n";
#define display(c, a, n) cout << "Displaying array \"" << #c << "\" : \n"; for (int (i) = (a); (i) < (n); ++(i)) cout << (c)[(i)] << " "; cout << "\n";
#define forl(i, a, n) for (int i = (a); (i) < (n); ++(i))
#define dugbe(k) cerr << "-\t> " << #k << " = " << k << "\n";
#define dugbev(arr, idx) cerr << "-\t " << #arr << "[" << idx << "] : " << arr[idx] << "\n";
#define debug(args...) { string _debug_list = #args; replace(_debug_list.begin(), _debug_list.end(), ',', ' '); stringstream _debug_stream(_debug_list); istream_iterator<string> __it(_debug_stream); debug_func(__it, args); }

/*
// What follows is a magical ordered set data structure.
// Supports the following functions:
// find_by_order(int k) - returns k'th smallest element (0-indexed)
// order_of_key(int k) - returns number of elements strictly smaller than k.
using namespace __gnu_pbds;
#define ordered_set tree <ll, null_type, greater_equal <ll>, rb_tree_tag, tree_order_statistics_node_update>
*/

/* TIPS FOR DEBUGGING
 * Check if values are not overflowing (use long long where required)
 * Check if ranges are inclusive or not.
 * Check properly if greedy will work or not before using it.
 * Check EDGE CASES!! Seriously, even in 2B, saving 8 points by being
 * 2 minutes faster will bite you in the ass if you don't make sure
 * it works on edge cases.
 * Keep adding to this list.
*/

using namespace std;
typedef long long ll;
typedef pair<int, int> pr;
typedef pair<ll, ll> prll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pr> vpr;
ifstream in("input.txt");
const ll mod = 7340033;
const long double eps = 1e-7;

void debug_func(istream_iterator<string> _it)
{
	cerr << "\n";
}

template <typename T, typename... Args>
void debug_func(istream_iterator<string> _it, T x, Args... args)
{
	cerr << "[ " << *_it << " : " << x << " ]";
	cerr << " , ";
	debug_func(++_it, args...);
}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

long long true_rand(long long n)
{
	// Returns a random number between 0 and n - 1 inclusive using mt19937.
    uniform_int_distribution<long long> uid(0, n - 1);
    return uid(rng);
}

ll mod_pow(ll a, ll b)
{
	if (b == 0)
		return 1LL;

	ll res = mod_pow(a, b >> 1);
	res = (res * res) % mod;
	if (b & 1LL)
		res = (res * a) % mod;
	
	return res;
}

ll inverse(ll a)
{
	return mod_pow(a, mod - 2);
}

const int N = 5e5 + 5;
const ll INF = 1e9 + 5, LLINF = 1e18 + 5;
const int M = 1e6 + 5;

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

	int h, a;
	cin >> h >> a;
	cout << (h + a - 1) / a << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <map>
#define ll long long
const int MOD = 1e9+7;
using namespace std;

int main(){
	string s;
	cin >> s;
	for (int i = 1; i <= s.length(); i++){
		if (i%2 && s[i-1] == 'L'){
			cout << "No" << endl;
			return 0;
		}
		if (!(i%2) && s[i-1] == 'R'){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
vector<P> graph[100010];
vector<ll> dist;
bool dfs(int x, int d){
    dist[x] = d;
    for(auto p:graph[x]){
        if(dist[p.first] != INF){
            if(dist[p.first] != d + p.second){
                return true;
            }else continue;
        }
        if(dfs(p.first, d + p.second))return true;
    }
    return false;
}
main(){
    int N,M;
    cin >> N >> M;
    rep(i,0,M){
        int l,r,d;
        cin >> l >> r >> d;
        l--,r--;
        graph[l].emplace_back(r,d);
        graph[r].emplace_back(l,-d);
    }
    dist.resize(N, INF);
    rep(i,0,N){
        if(dist[i] != INF)continue;
        if(dfs(i, 0)){
            //cout << i << endl;
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

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

int main(){
  int p,q,r;
  cin>>p>>q>>r;
  int a=0;
  if(p>=q){
    a=p;
  }else{
    a=q;
  }
  if(r>=a) a=r;
  cout<<p+q+r-a<<endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define OUT(x) cout << #x << " = " << x << endl
#define rep(i, n)             for (int (i) = 0; (i) < (int)(n); (i)++)
#define rer(i, l, r)          for (int (i) = (int)(l); (i) <= (int)(r); (i)++)
#define reu(i, l, r)          for (int (i) = (int)(l); (i) < (int)(r); (i)++)
#define all(x)                (x).begin(), (x).end()
#define rall(x)               (x).rbegin(), (x).rend()
template<typename T> void pv(T a, T b) { for (T i = a; i != b; i ++) cout << *i << " "; cout << endl; }
template<typename T, typename U> inline void amin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if (x < y) x = y; }
int in() { int x; scanf("%d", &x); return x; }
long long lin() { long long x; scanf("%lld", &x); return x; }

int n;
int a[101010];
int b[101010];
int m[202020];
int cnt;
int c[202020];
vector<int> g[202020];
bool v[202020];

void dfs(int a) {
        v[a] = true;
        rep(i, g[a].size()) if (!v[g[a][i]]) dfs(g[a][i]);
}


signed main() { 
        cin >> n;
        int s = 0;
        rep(i, n) {
                cin >> a[i];
                s ^= a[i];
        }
        a[n] = s;
        s = 0;
        rep(i, n) {
                cin >> b[i];
                s ^= b[i];
        }
        b[n] = s;
        rer(i, 0, n) { 
                m[++ cnt] = a[i];
                m[++ cnt] = b[i];
        }
        sort(m + 1, m + cnt + 1);
        rer(i, 0, n) {
                a[i] = lower_bound(m + 1, m + cnt + 1, a[i]) - m;
                b[i] = lower_bound(m + 1, m + cnt + 1, b[i]) - m;
        }
        rer(i, 0, n) { 
                c[a[i]] ++;
                c[b[i]] --;
        }
        rer(i, 0, cnt) {
                if (c[i]) {
                        cout << -1 << endl;
                        return 0;
                }
        }
        int res = 0;
        rer(i, 0, n + 1) {
                if (a[i] != b[i]) { 
                        g[a[i]].push_back(b[i]);
                        res ++;
                }
        }
        rer(i, 1, cnt) {
                if (!v[i] && !g[i].empty()) {
                        dfs(i);
                        res ++;
                }
        }
        if (!g[a[n]].empty()) res --;
        if (a[n] != b[n]) res --;
        cout << res << endl;
        return 0;
}               



Measured memory_bytes: 15360
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

int H,W;
ll M;

string S[2020];

ll A[2020][2020],B[2020][2020],D[2020][2020];
ll num[2020][2020];

void add(ll &a,ll b){
  a=(a+b)%M;
}

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

int main(){
  cin>>H>>W>>M;
  rep(i,H) cin>>S[i];

  A[0][0]=0;
  B[0][0]=1;
  D[0][0]=S[0][0]-'0';
  num[0][0]=1;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      for(int k=0;k<2;k++){
        int nx=i+dx[k];
        int ny=j+dy[k];
        if(nx>=H||ny>=W) continue;
        
        add(num[nx][ny],num[i][j]);

        if(S[nx][ny]=='+'){
          add(A[nx][ny],A[i][j]+D[i][j]);
          //add(B[nx][ny],1);
          //B[nx][ny]=1;
          add(B[nx][ny],num[i][j]);
          D[nx][ny]=0;
        }else if(S[nx][ny]=='*'){
          add(A[nx][ny],A[i][j]);
          add(B[nx][ny],D[i][j]);
          D[nx][ny]=0;
        }else{
          int d=S[nx][ny]-'0';
          add(A[nx][ny],A[i][j]);
          add(B[nx][ny],B[i][j]);
          add(D[nx][ny],D[i][j]*10+d*B[i][j]);
        }
      }
    }
  }

  ll ans=0;
  add(ans,A[H-1][W-1]);
  add(ans,D[H-1][W-1]);
  cout<<ans<<endl;

  return 0;
}



Measured memory_bytes: 133156
// Indrajeet Mishra
 
/*#pragma warning(disable:4996)
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")*/
 
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define test(s) if (!(s)) { cout << __LINE__ << " " << #s << endl; exit(-1); }
#define debug(x) do { std::cerr << x; } while (0)
#define endl "\n"
#define pb push_back
#define pf push_front
#define vll vector<ll>
#define dll deque<ll>
#define sll set<ll, greater <ll>>
#define mll map<ll, ll>
#define vii vector<int>
#define dii deque<int>
#define sii set <int, greater <int>>
#define mii map<int, int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mod 1000000007
#define inv2 500000004
#define inv6 166666668
#define N 1000005
#define inf 200000000
#define eps 1e-10
#define PI 3.14159265359
#define all(v) (v).begin(),(v).end()
#define min(a,b) (((a)<(b))?(a):(b))
#define max(a,b) (((a)>(b))?(a):(b))
#define gcd(a,b) __gcd(a,b)
 
ll dp[101][101];
void dp_initialiser(){
    memset(dp,-1,sizeof(dp));
}

int main() {
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    //dp_initialiser();
    ll a=0,b=0,c=0,k=0;cin>>a>>b>>c>>k;
    while(1){
        if(k==0)break;
        if(b>a)break;
        else{
            k--;
            b*=2;
        }
    }
    while(1){
        if(k==0)break;
        if(c>b)break;
        else{
            k--;
            c*=2;
        }
    }
    if(b>a && c>b)cout<<"Yes";
    else cout<<"No";
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
const long long INF = 9999999999999999;

const long long MAX = 30000000;
const long long MOD = 1000000007;

int main(){
  int N;
  cin>>N;
  string s;
  if(N%2 != 0){
    cin>>s;
    cout << "No" << endl;
    return 0;
  }
  else{
    cin>>s;
    int p = s.size();
    p/=2;
    string temp;
    for(int i = 0;i<p;i++){
      temp += s.at(i);
    }
    temp += temp;
    
    if(temp == s){
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
    return 0;
  }
}

Measured memory_bytes: 256