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

#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ones(x) (ll) __builtin_popcount(x)
#define fs first
#define sc second
#define pb push_back
#define po pop_back
#define mp make_pair	
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ller ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define PI 3.1415926535
using namespace std;
typedef long long ll;
typedef long double ld;	
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
	 
const ll MAX = 10000000;
const ll inf = 1e18;


int main() {
	fastio;
	ld a,b,ans;
	cin>>a>>b;
	ans = a*b;
	ll res = (long long) ans;
	cout<<res<<endl;
	return 0;
	}

Measured memory_bytes: 3748
#include<iostream>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b;
	c=b-a+1;
	if (a>0||(b<0&&((c&1)==0))) cout<<"Positive"<<endl;
	else if (a<0&&b>0||a==0||b==0) cout<<"Zero"<<endl;
	else cout<<"Negative"<<endl;
	return 0;
}

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

int main() {
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  int ans = 0;
  while (k > 0 && a > 0) {
    ans++;
    a--;
    k--;
  }
  k -= b;
  while (k > 0 && c > 0) {
    ans--;
    b--;
    k--;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3620
n,m = map(int,input().split())
h = list(map(int,input().split()))
l = [1]*n
for i in range(m):
    a,b = map(int,input().split())
    if h[a-1] > h[b-1]:
        l[b-1] = 0
    elif h[b-1] > h[a-1]:
        l[a-1] = 0
    else:
        l[a-1] = l[b-1] = 0
        
print(sum(l))


Measured memory_bytes: 20108
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
#define SIZE 20
////////////////// mapで持っておくと前40文字だけ見る！なんてことは必要ない(らしい)ので書いてみること！！！！！！！！！！！！！！！

int N;
int A[200000];
bool Can(int mid){
    //midという文字数で可能かどうか判定
    int mae[SIZE]={};
    bool flag=true;//判定をboolで保持
    for(int i=1;i<N;i++){
        bool need=false;//繰り上げの必要性
        if(A[i]==A[i-1] && A[i]<SIZE){
            mae[A[i]]++;
            need=true;
        }else if(A[i]<A[i-1] && A[i]<SIZE){
            mae[A[i]]++;
            need=true;
            for(int j=A[i]+1;j<SIZE;j++){
                mae[j]=0;
            }
        }
        //繰り上げ処理
        if(need){
            for(int j=A[i];j>0;j--){
                if(mae[j]==mid){
                    mae[j]=0;
                    mae[j-1]++;
                }
            }
        }
        if(mae[0]>0){
            flag=false;
            break;
        }
    }
    return flag;
}

int main(){
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>A[i];
    }
    bool OneCahracter=true;
    for(int i=1;i<N;i++){
        if(A[i]<=A[i-1]){
            OneCahracter=false;
            break;
        }
    }
    if(!OneCahracter){//2文字以上必要
        int low=1;//不可能
        int high=N;//可能
        while(low+1<high){
            int mid=(low+high)/2;
            if(Can(mid)){
                high=mid;
            }else{
                low=mid;
            }
        }
        cout<<high<<endl;
    }else{//1文字で十分
        cout<<1<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>

using namespace std;

int main() {
	int X, Y, Z,number,L;
	cin >> X >> Y >> Z;
	number = 0; L = 0;

	do {
		L = L + Y + Z;
		number = number + 1;
	} while (L <= X - Y - 2*Z);
		cout << number;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define HEIGHT_MAX 10
#define WIDTH_MAX 1000
#define BUF_SIZE (WIDTH_MAX+50)

// size: specify sizeof(str)
int get_str(char *str, int size) {
    if(!fgets(str, size, stdin)) return -1;
    return 0;
}

int get_int3(int *a1, int *a2, int *a3) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %d %d", a1, a2, a3);
#else
#error
#endif
  return 0;
}

#define min(a,b) ((a) > (b) ? (b) : (a))

int main(void) {
    int height, width, ulimit;
    int i, j;
    static char map[HEIGHT_MAX][WIDTH_MAX];

    get_int3(&height, &width, &ulimit);
    
    for(i = 0; i < height; i++) {
        char buf[BUF_SIZE];
        get_str(buf, BUF_SIZE);
        for(j = 0; j < width; j++) {
            map[i][j] = (buf[j] - '0');
        }
    }
    int pat, bit;
    int ans = (WIDTH_MAX+HEIGHT_MAX);
    for(pat = 0; pat <(1<<height); pat+=2) {
        int res = __builtin_popcount(pat);
        if(res >= ans) continue;
        int sum[11] = {0};
        int group[11] = {0};
        int idx = 1;
        int wid;
        int moved = 0;
        // create groups
        for(bit = 0; bit <= height; bit++) {
            if(pat & (1<<bit)) group[idx++] = bit;
        }
        group[idx++] = height;
        // pat = 0: [0, 5]
        for(wid = 0; wid < width;) {
            int flag = 1;
            int new[11] = {0};
            for(i = 0; i < idx-1; i++) {
                for(bit = group[i]; bit < group[i+1]; bit++) {
                    new[i] += map[bit][wid];
                }
                // must split
                if(sum[i] + new[i] > ulimit) { flag = 0; break; }
            }
            if(!flag) {
                if(!moved) { break; }
                res++;
                moved = 0;
                // reset
                for(i = 0; i < idx-1; i++) sum[i] = 0;
            } else {
                moved = 1;
                wid++;
                for(i = 0; i < idx-1; i++) sum[i] += new[i];
            }
        }
#ifdef DEBUG
        printf("[pat: %d] possible?: %d ans: %d\n", pat, moved, res);
#endif
        if(!moved) continue;
        ans = min(ans, res);
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 128
grid = []
for i in range(3):
    grid.append(list(map(int, input().split())))
b = grid[0]
a = (0, grid[1][1]-b[1], grid[2][2]-b[2])

for i in range(3):
    for j in range(3):
        if a[i]+b[j] != grid[i][j]:
            print('No')
            exit(0)

print('Yes')


Measured memory_bytes: 3060
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef map<int, int> mii;
typedef map<char,int> mci;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vii;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define F first
#define S second
#define in insert
const int INF = 1e9 + 7;

int main(){
    int n, m;  cin>>n>>m;
    cout<<n+m/2;
}

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

#define chmin(x, y) x = min(x, y)

// 入力
int n;
vector<long long> a;
// dp[left][right] := 区間 [left,right) におけるコストの最小値
vector<vector<long long>> dp(405, vector<long long>(405, -1));
// スライムの大きさの累積和
long long S[405];

// メモ化再帰
long long memo_rec(int left, int right){
    if(dp[left][right] != -1)   return dp[left][right];
    if(right - left == 1)   return dp[left][right] = a[left];
    if(right - left < 1)    return 0;

    long long res = numeric_limits<long long>::max();
    for(int pos = left + 1; pos < right; ++pos){
        long long tmp = 0;
        if(pos - left > 1)  tmp += memo_rec(left, pos) + S[pos] - S[left];
        else    tmp += memo_rec(left, pos);
        if(right - pos > 1) tmp += memo_rec(pos, right) + S[right] - S[pos];
        else    tmp += memo_rec(pos, right);
        chmin(res, tmp);
    }
    return dp[left][right] = res;
}

int main(){
    cin >> n;
    a.resize(n);
    for(int i = 0; i < n; ++i){
        cin >> a[i];
        S[i+1] = S[i] + a[i];
    }
    cout << memo_rec(0, n) << endl;
}

Measured memory_bytes: 1536
import java.util.*;

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

        int N = S.length();
        int Aend = (N-1)/2;
        int Bstart = (N+3)/2;
	
        if(S.substring(0,(N-1)/2). equals (S.substring((N+3)/2-1,N))){
        System.out.println("Yes");
        }else{
        System.out.println("No");
        }
	}
}

Measured memory_bytes: 22996
use proconio::input;
use proconio::marker::{Chars, Usize1};
use std::iter::Iterator;
use std::collections::*;
use std::cmp::*;
use itertools::Itertools;

#[allow(unused_macros)]
macro_rules! max {
    ($x:expr) => {
      $x
    };
    ($x:expr, $($xs:tt)+) => {
      max($x,max!($($xs)+))
    };
  }
  
  #[allow(unused_macros)]
  macro_rules! min {
    ($x:expr) => {
      $x
    };
    ($x:expr, $($xs:tt)+) => {
      min($x,min!($($xs)+))
    };
  }

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    input! {
    n: u64,
    a: u64,
    b: u64,
    c: u64,
    d: u64,
    e: u64,
    }

    let min = min!(a, b, c, d, e);

    let ans = (n as f64 / min as f64).ceil() as u64 + 4;

     println!("{}", ans);
}


Measured memory_bytes: 2680
/**
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡖⠁⠀⠀⠀⠀⠀⠀⠈⢲⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⣼⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣧⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣸⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣇⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣿⣿⡇⠀⢀⣀⣤⣤⣤⣤⣀⡀⠀⢸⣿⣿⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣔⢿⡿⠟⠛⠛⠻⢿⡿⣢⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣀⣤⣶⣾⣿⣿⣿⣷⣤⣀⡀⢀⣀⣤⣾⣿⣿⣿⣷⣶⣤⡀⠀⠀⠀⠀
⠀⠀⢠⣾⣿⡿⠿⠿⠿⣿⣿⣿⣿⡿⠏⠻⢿⣿⣿⣿⣿⠿⠿⠿⢿⣿⣷⡀⠀⠀
⠀⢠⡿⠋⠁⠀⠀⢸⣿⡇⠉⠻⣿⠇⠀⠀⠸⣿⡿⠋⢰⣿⡇⠀⠀⠈⠙⢿⡄⠀
⠀⡿⠁⠀⠀⠀⠀⠘⣿⣷⡀⠀⠰⣿⣶⣶⣿⡎⠀⢀⣾⣿⠇⠀⠀⠀⠀⠈⢿⠀
⠀⡇⠀⠀⠀⠀⠀⠀⠹⣿⣷⣄⠀⣿⣿⣿⣿⠀⣠⣾⣿⠏⠀⠀⠀⠀⠀⠀⢸⠀
⠀⠁⠀⠀⠀⠀⠀⠀⠀⠈⠻⢿⢇⣿⣿⣿⣿⡸⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠈⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣿⣿⣿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠐⢤⣀⣀⢀⣀⣠⣴⣿⣿⠿⠋⠙⠿⣿⣿⣦⣄⣀⠀⠀⣀⡠⠂⠀⠀⠀
⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠛⠉⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠛⠋⠁⠀⠀
 *    author:  Daredevil666
 *    institution: IIT Patna
**/
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define nl cout<<"\n";
#define ll long long int
#define REP(i,a,n) for(i=a;i<=n;i++)
#define F(i,a,b) for(i=a;i<b;i++)
#define RF(i,b,a) for(i=b;i>=a;i--)
#define IOS  ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
const ll M=1e9+7;
const ll MAXN=1000200;
ll i,j,mask,test;
ll mod(ll x){
   return ((x%M + M)%M);
}
ll add(ll a,ll b){
  return mod(mod(a)+mod(b));
}
ll mul(ll a,ll b){
  return mod(mod(a)*mod(b));
}
int main()
{
IOS
/*#ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
#endif // ONLINE_JUDGE*/
string s;
cin>>s;
ll n=s.length()-1;
if(s[n]!='s')
{
   s+='s';
}
else
    s+="es";
cout<<s;
return 0;
}


Measured memory_bytes: 3648
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <stdio.h>
#include <string.h>
using ll = long long;

//LLONG_MAX
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()

using namespace std;

//---------- 1000000007 ----------
const int MOD = 1000000007;
int add(int a, int b)
{
	return (a + b) % MOD;
}
int sub(int a, int b)
{
	return (a + MOD - b) % MOD;
}
int mul(int a, int b)
{
	return (a * b) % MOD;
}
int pow(int x, int n)
{
	if (n == 0) return 1;
	ll res = pow((x * x) % MOD, n / 2);
	if (n & 1) res = (res * x) % MOD;
	return res;
}
int divide(int a, int b)
{
	return mul(a, pow(b, MOD - 2));
}

int X, Y;

int fact(int n)
{
	int a = 1;
	for (int i = 1; i <= n; i++) a = mul(i, a);
	return a;
}

signed main()
{
	cin >> X >> Y;
	if ((X + Y) % 3 != 0)
	{
		cout << 0 << endl;
		return 0;
	}

	int n = (2 * Y - X) / 3;
	int m = (2 * X - Y) / 3;

	if (n < 0 || m < 0)
	{
		cout << 0 << endl;
		return 0;
	}

	int k = n + m;
	int a = fact(k);
	int b = fact(n);
	int c = fact(k - n);

	int ans = divide(a, b);
	ans = divide(ans, c);

	cout << ans << endl;
}


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

using namespace std;
using ll = long long;

int main() {
  int x;
  cin >> x;
  if (30 <= x) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3588
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<stdlib.h>
#include<string.h>
#include<queue>
#define LL long long
using namespace std;
inline int read( )
{
  int sum=0;char c=getchar( );bool f=0;
  while(c<'0'||c>'9') {if(c=='-') f=1;c=getchar( );}
  while(c>='0'&&c<='9') {sum=sum*10+c-'0';c=getchar( );}
  if(f) return -sum;
  return sum;
}
const int N=(1<<15)+3;
const int mod=1000000007;
int n,m,f[N],num[N],e[16];
inline void up(int &x,int y) {x=x+y>=mod?x+y-mod:x+y;}
int main( )
{
  int i,j,x,y;
  n=read( );m=read( );
  for(i=1;i<=m;i++)
    x=read( ),y=read( ),e[x-1]|=(1<<(y-1));
  int S=(1<<n)-1,B,k,u;LL r;
  num[0]=0;f[0]=1;
  for(i=1;i<=S;i++) 
    num[i]=num[i>>1]+(i&1);
  for(i=0;i<S;i++)
    if(x=f[i])
      for(B=S^i,k=B;k;k=(k-1)&B)
	if((k&3)!=3)
	  {
	    r=x;u=B^k;
	    for(j=0;j<n;j++)
	      if((u>>j)&1) r=r*((1<<num[e[j]&k])-1)%mod;
	      else if((i>>j)&1) r=r*(1<<num[e[j]&k])%mod;
	    up(f[i|k],r);
	  }
  printf("%d",f[S]);
  return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>

int main()
{
	long long H;
	scanf("%lld", &H);
	
	long long ans = 1;
	for (ans = 1; H > 1; H /= 2) {
		ans = ans * 2 + 1;
	}
	
	printf("%lld\n", ans);
	fflush(stdout);
	return 0;
}

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

int n;

int main(){
    ios_base::sync_with_stdio(false); //Fast I/O
    cin.tie(NULL);

    cin >> n;

    vector<int> A(n),B;

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

    for(int i=n-1;i>=0;i-=2)
        B.push_back(A[i]);
    for(int i=n%2;i<n;i+=2)
        B.push_back(A[i]);

    for(int i=0;i<(int)B.size();i++){
        cout << B[i] << " ";
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 3956
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
#define N 1000002
#define mod 1000000007
#define pb push_back
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

int main() {	
	// IOS
	ll T;
	// cin>>T;
	T = 1;
	// ll i = 1;
	
	while(T--){
		// cout<<"Case #"<<i<<": ";
		ll n;
		cin>>n;
		if(n%1000){
		ll q= n/1000;
		cout<<(q+1)*1000 - n<<'\n';
		}
		else
		cout<<"0\n";
	}
	return 0;
	
}

Measured memory_bytes: 3600
s = list(input())
K = int(input())

d = set()
header, i = sorted(list(set(s))), 0
while len(d) <= K and i < len(header):
    indexes = [j for j, x in enumerate(s) if x == header[i]]
    for j in indexes:
        for k in range(j+1, min(j+K, len(s))+1):
            d.add(''.join(s[j:k]))
    i += 1
d = sorted(list(d))
print(d[K-1])

Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <functional>

using namespace std;

int main()
{
    int N;
    cin>>N;
    long long M;
    cin>>M;
    vector<vector<int>> E(N);
    for (int i=0; i<N-1; i++)
    {
        int x, y;
        cin>>x>>y;
        E[x-1].push_back(y-1);
        E[y-1].push_back(x-1);
    }

    function<void(int, int)> f1 = [&](int c, int p)
    {
        vector<int> T;
        for (int e: E[c])
            if (e != p)
            {
                f1(e, c);
                T.push_back(e);
            }
        E[c] = T;
    };
    f1(0, -1);

    vector<long long> T(N);
    vector<long long> T2(N);    //  T[p] / (T[i] + 1)
    vector<long long> F(N), B(N);

    function<void(int)> f2 = [&](int c)
    {
        T[c] = 1;
        for (int e: E[c])
        {
            f2(e);
            T[c] *= (T[e] + 1);
            T[c] %= M;
        }

        int n = (int)E[c].size();
        F[0] = 1;
        for (int i=0; i<n; i++)
            F[i+1] = F[i] * (T[E[c][i]] + 1) % M;
        B[n] = 1;
        for (int i=n; i>0; i--)
            B[i-1] = B[i] * (T[E[c][i-1]] + 1) % M;
        for (int i=0; i<n; i++)
            T2[E[c][i]] = F[i] * B[i+1] % M;
    };
    f2(0);

    vector<long long> ans(N);
    vector<long long> ans2(N);  //  ans[p] / (T[i] + 1)

    function<void(int, int)> f3 = [&](int c, int p)
    {
        ans[c] = T[c] * (ans2[c] + 1) % M;

        for (int e: E[c])
        {
            ans2[e] = T2[e] * (ans2[c] + 1) % M;
            f3(e, c);
        }
    };
    f3(0, -1);

    for (long long a: ans)
        cout<<a<<endl;
}


Measured memory_bytes: 19200
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
const int INF = 1e7;
#define rep(i, n) for (lint i = 0; i < (n); ++i)
#define repi(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(), (x).end()
#define pb push_back
int main()
{
    lint n;
    cin >> n;
    vector<lint> sum(n+1, 0);
    map<lint, lint> m;
    m[0]++;
    rep(i, n)
    {
        lint v;
        cin >> v;
        sum[i + 1] = sum[i] + v;
        m[sum[i + 1]]++;
    }
    lint ans = 0;
    for (auto itr = m.begin(); itr != m.end(); ++itr)
    {
        ans += itr->second * (itr->second - 1) / 2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 14336
#include <bits/stdc++.h>
#define boost_io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define num(a) a-'0'
#define rep(i,a,b) for(int i=a;i<b;i++)
#define maxs(a,b) if(b>a)a=b
#define mins(a,b) if(b<a)a=b
#define debug(x) cerr<<#x<<":"<<x<<" "
#define all(a) (a).begin(), (a).end()
#define vi vector<int>
#define vl vector<long long int>
#define v vector
#define p pair
#define pb push_back
#define mk make_pair
#define f first
#define s second
#define ln "\n"
typedef long long int ll;
typedef long double ld;
typedef double d;
using namespace std;
ll modF=1e9+7;
ll INF=1e11;

void solve(){
	int n,d;
	cin>>n>>d;
	int counter=0;
	rep(i,0,n){
		ld x,y;
		cin>>x>>y;
		ld dist=x*x+y*y;
		dist=sqrt(dist);
		if(dist<=d){
			counter++;
		}
	}
	cout<<counter<<ln;
}	

int main(){
	boost_io;
	cout<<setprecision(10);
	solve();
	return 0;
}


Measured memory_bytes: 3860
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define rep2(i, j, n) for (int i = j; i < (int)(n); i++)
int main() {
	int N, M, X;
	cin >> N >> M >> X;
	vector<bool>A(N);
	rep(i, N) {
		A.at(i) = false;
	}
	int abc;
	rep(i, M) {
		cin >> abc;
		A.at(abc) = true;
	}
	int answer1 = 0, answer2 = 0;
	for (int i = X; i > 0; i--){
		if (A.at(i)) {
			answer1++;
		}
	}
	rep2(i, X, N) {
		if (A.at(i)) {
			answer2++;
		}
	}
	cout << min(answer1, answer2) << endl;
}

Measured memory_bytes: 256
/* h-ex5_4
   Ohshima */

#include <stdio.h>

int main(void){
  //10文字以下なので最大の要素数は\0を含めて11
  //ptr: strの各要素へのポインタ
  char str[11], *ptr;
  //len: ACGT部分文字列が続く場合にその長さを保持しておくための変数
  //max_len: 上のような長さlenのうち最大値を保持しておくための変数, 最終的にはこれを出力
  int len = 0, max_len = 0;
  scanf("%s", str);
  ptr = str;
  //ACGT部分文字列があるかどうかを調べる, 条件式は*ptr != '\0'と同義
  while(*ptr){
    //調べている文字がACGTに該当するなら長さlenを1だけ増やす
    if(*ptr == 'A' || *ptr == 'C' || *ptr == 'G' || *ptr == 'T'){
      len++;
    }else{
      //途中でACGT以外の文字が現れた場合は、その時点でのACGT部分文字列の長さが最大かどうかを調べ、その後lenをリセット
      if(len > max_len){
        max_len = len;
      }
      len = 0;
    }
    ptr++;
  }
  //ACGT部分文字列が続いている途中でループが終了した場合も考慮
  if(len > max_len){
    max_len = len;
  }
  printf("%d\n", max_len);
  return 0;
}


Measured memory_bytes: 1728
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;



public class Main {

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

       int[][] s = new int[h][w];
       List<Integer> list = new ArrayList<Integer>();
       for (int i = 0 ; i < n ; i++) {
           for (int j = 0; j < a[i] ; j++) {
               list.add(i + 1);
           }
       }
       int index = 0;
       for (int i = 0 ; i < h ; i++) {
           for (int j = 0 ; j < w ; j++) {
               if (i % 2 == 1) {
                   s[i][j] = list.get(index);
                   index++;
               } else {
                   s[i][w - 1 - j] = list.get(index);
                   index++;
               }

           }
       }

       for (int i = 0 ; i < h ; i++) {
           for (int j = 0 ; j < w ; j++) {
               System.out.print(s[i][j] + " ");
           }
           System.out.print("\n");
       }

    }

}

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

bool something;
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int n; cin >> n;
	for (int i = 1; i < 10; ++i)
	{
		if (i * 9 >= n)
		{
			for (int j = 1; j <= i; ++j)
			{
				if (i * j == n)
				{
					something = true;
					break;
				}
			}
		}
	}
	if (something)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
}

Measured memory_bytes: 3632
N = int(input())
stations = [list(map(int, input().split())) for _ in range(N-1)]

import numpy as np
for i in range(N-1):
    elapsed_time = 0
    for k in range(i, N-1):
        c, s, f = stations[k]
        # 出発前での時間を求める
        if elapsed_time <= s:
            wait_time = s - elapsed_time
        else:
            x = elapsed_time - s
            next_train = f * np.ceil(x/f)
            wait_time = next_train - x
        elapsed_time += wait_time + c
    print(int(elapsed_time))
print(0)


Measured memory_bytes: 27244
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

int N, K;
int kotae = 0;
int E[100001], ne[100001], H[100001];
int D;
int dfs(int A) {
	int d = 1;
	D++;
	for (int v = H[A]; v; v = ne[v]) {
		d = max(d, dfs(E[v]) + 1);
	}
	D--;
	if (d >= K && D > 1) {
		kotae++;
		return 0;
	}
	else return d;
}

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	N = getint();
	K = getint();

	if (getint() != 1) kotae++;
	rep1(i, N - 1) {
		int a = getint();
		E[i] = i + 1;
		ne[i] = H[a];
		H[a] = i;
	}

	dfs(1);
	printf("%d", kotae);

	Would you please return 0;
}

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

typedef long long ll;
const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const double eps = 1e-9;

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

int main()
{
    int n, tmp, ans = -1;
    cin >> n;
    map<int, int> a;
    for (int i = 0; i < n; i++) {
        cin >> tmp;
        a[tmp]++;
    }

    for (int i = 1; i <= 1e5-1; i++) {
        chmax(ans, a[i-1] + a[i] + a[i+1]);
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 4992
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<climits>
#define int long long
using namespace std;
inline int read(){
	int f=1,ans=0;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){ans=ans*10+c-'0';c=getchar();}
	return f*ans;
}int x,y;
int dis(int x,int y){return y-x;}
signed main(){
	int minn=LLONG_MAX;
	x=read(),y=read();
	if(x<=y) minn=min(minn,dis(x,y));
	if(x<=(-y)) minn=min(minn,1+dis(x,-y));
	if((-x)<=y) minn=min(minn,1+dis(-x,y));
	if(((-x)<=(-y))) minn=min(minn,1+dis(-x,-y)+1);
	printf("%d\n",minn); 
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>

int main()
{
    int a, b; std::scanf("%d %d", &a, &b);
    int n = -1;

    for (int i=0; i<=b*15; i++)
    {
        if (a == (int)(i*0.08) && b == (int)(i*0.1))
        {
            n = i;
            break;
        }
    }

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

    return 0;
}

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

//constexpr ll mod = 1000000007;
//constexpr ll INF = mod * mod;
//constexpr double pi = 3.14159265358979;

int main() {
    int n;
    scanf("%d",&n);
    vector<int> v(n);
    rep(i,n) scanf("%d",&v[i]);
    vector<int> dp(100010,0);
    dp[2] = abs(v[1] - v[0]);
    for(int i = 3; i <= n; i++) {
        dp[i] = min(dp[i-2] + abs(v[i-3] - v[i-1]), dp[i-1] + abs(v[i-2] - v[i-1]));
    }
    printf("%d\n",dp[n]);
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include<string.h>
#define ll long long 
#include<vector>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const int mod=1e9+7; 
int main(){
	IOS;
	int n;
	cin>>n;
	vector<ll> u(n);
	for(int i=0;i<n;i++){
		cin>>u[i];
	}
	vector<ll> pref(n);
	pref[0]=u[0];
	for(int i=1;i<n;i++)
	pref[i]=(pref[i-1]+u[i])%mod;
	ll ans=0;
	for(int i=1;i<n;i++){
		ans=(ans+(u[i]*pref[i-1])%mod)%mod;
	}
	cout<<ans;
}

Measured memory_bytes: 6356
#include<iostream>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int x=0;
	int temp=1;
	int m=n;
	while(m>0)
	{
		m/=10;
		x++;
		temp*=10;
	}
	temp/=10;
		int c=n;
		int sum=0;
		int d;
	for(int i=0;i<x;i++)
	{
	    
		d=n/temp;
		temp/=10;
		d%=10;
		sum+=d;
	
	}

	if(n%sum==0)
	{
		cout<<"Yes"<<endl;
		
	}
	else
	cout<<"No"<<endl;
	



	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 10000000000000009
//#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ORREP(i,n) for(int i=(n);i>=1;--i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl
typedef pair<int,int> Pp;


signed main(){
    int N,T,A,H[1040],Ans=0;
    cin >> N >> T >> A;
    REP(i,N){cin >> H[i];}
    REP(i,N){
        if(abs(1000*T-H[Ans]*6-1000*A)>abs(1000*T-H[i]*6-1000*A)){
            Ans=i;
        }
    }
    cout << Ans+1 << endl;
    return 0;
}   


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#define INF 1500000000
using namespace std;

struct edge{ int to,cost; };
typedef pair<int,int> P;

int main(){
	int V,E,r;
	cin >> V >> E >> r;
	vector<edge> graph[V];
	priority_queue<P,vector<P>,greater<P> > que;
	int d[V];
	for(int i = 0;i < V;i++) d[i] = INF;
	for(int i = 0;i < E;i++){
		int a,b,c;
		cin >> a >> b >> c;
		graph[a].push_back({b,c});
	}
	d[r] = 0;
	que.push(make_pair(0,r));
	while(!que.empty()){
		P p = que.top();que.pop();
		int v = p.second;
		if(d[v] < p.first) continue;
		for(int i = 0;i < graph[v].size();i++){
			edge e = graph[v][i];
			if(d[e.to] > d[v] + e.cost){
				d[e.to] = d[v] + e.cost;
				que.push(make_pair(d[e.to],e.to));
			}
		}
	}
	for(int i = 0;i < V;i++) {
		if(d[i] == INF) cout << "INF" << endl;
		else cout << d[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 12960
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 1999999999999999999
#define ALL(n) n.begin(),n.end()


ll m, n, s[114514],ans = 0;
vector<ll> ss;
int main() {
	cin >> m >> n;
	if (m >= n)cout << 0 << endl;
	else {
		REP(i, n) cin >> s[i];
		sort(s, s + n);
		REP(i, n - 1) {
			ss.push_back(abs(s[i] - s[i + 1]));
			ans += abs(s[i] - s[i + 1]);
		}
		sort(ALL(ss),greater<ll>());
		REP(i, m - 1)ans -= ss[i];
		cout << ans << endl;

	}


}

Measured memory_bytes: 2168
#include<iostream>
#include<vector>
#include<string>
#include<math.h>
#include<algorithm>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;
int main() {
	string s;
	cin >> s;
	if (s[s.size() - 1] == '3') {
		cout << "bon" << endl;
	}
	else if(s[s.size() - 1] == '0'|| s[s.size() - 1] == '1'|| s[s.size() - 1] == '6'|| s[s.size() - 1] == '8'){
		cout << "pon" << endl;
	}
	else {
		cout << "hon" << endl;
	}
	return 0;
}



Measured memory_bytes: 3588
/*  
    |\_/|
    |* *|
    \_+_/
*/
#include<bits/stdc++.h>

#define endl '\n'

using namespace std;

int main(){

  cin.tie(0);     // cout と cin の同期を切る
  ios::sync_with_stdio(false);  /* cの stdioストリーム (printfとか)と*/

  string str;

  cin>>str;

  string temp=str;
  
  reverse(str.begin(),str.end());

  if(str==temp){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  
  return 0;

}




Measured memory_bytes: 256
n, m = gets.chomp.split.map(&:to_i)
# puts "a#{n}a"
# puts "a#{m}a"
a = Array.new(n) { Array.new }
# puts a.inspect
n.times do |i|
  a[i] = gets.chomp.split.map(&:to_i)
  a[i] = a[i].slice(1..a[i].size)
end
# puts a.inspect
answer = 0
for i in 1 .. m do
  like_count = 0
  for j in 0..n-1 do
    if a[j].include?(i)
      like_count += 1
    end
  end
  if like_count == n
    answer += 1
  end
end
puts answer


Measured memory_bytes: 1788
#include<stdio.h>

int main(){
   int a;
   int b;
   int d;
   int r;
   double f;
   
   scanf("%d %d", &a, &b);
   
   d = a / b;
   r = a % b;
   f = (double)a / (double)b;
   
   printf("%d %d %f", d,r,f);
   return 0;
}

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

long long INF = 1e18;

int main(){
        int n,k;
        cin >> n >> k;
        int s[n + 100];
        
        for (int i = 1; i <= n;i++){
                s[i] = 0;
        }
        for (int i = 0; i < k; i++){
                int d;
                        cin >> d;
                        int w;
                        for (int j = 0; j < d; j++){
                                cin >> w;
                                s[w]++;
                        }
                }
                int cnt = 0;
                for (int i = 1; i <= n; i++){
                        if(s[i] == 0){
                                cnt++;
                        }
                }
                cout << cnt << endl;

                return 0;
}


Measured memory_bytes: 3624
S = input()
first_half = int(S[:2])
second_half = int(S[2:])
if 0 < first_half and first_half <= 12 and 0 < second_half and second_half <= 12:
    print("AMBIGUOUS")
elif 0 < first_half and first_half <= 12:
    print("MMYY")
elif 0 < second_half and second_half <= 12:
    print("YYMM")
else:
    print("NA")

Measured memory_bytes: 3060
#include <iostream> // cin,cout
#include <stdio.h> // printf,scanf (standard input/output)
#include <cstdlib>
#include <cmath>    // abs() for float, and fabs()
#include <string>
#include <algorithm> // min,max
using namespace std;

int X[7] = {1, 2, 3, 5, 8, 13, 21};

int O (int x) {
    if (x<0) return 1;
    else return X[x];
}

int main(){
    int H, W, K;
    cin >> H >> W >> K;
    
    long long a[W] = {};
    long long b[W] = {};
    a[0] = 1;
    
    if (W >= 2) {
        for (int i=1;i<=H;i++) {
            //for (int j=0;j<W;j++) cout << a[j] << endl;
            
            b[0] = a[0]*O(W-2) + a[1]*O(W-3);
            for (int j=1;j<W-1;j++) b[j] = a[j-1]*O(j-2)*O(W-j-2) + a[j]*O(j-1)*O(W-j-2) + a[j+1]*O(j-1)*O(W-j-3);
            b[W-1] = a[W-2]*O(W-3) + a[W-1]*O(W-2);
            
            for (int j=0;j<W;j++) a[j] = b[j]%1000000007;
            //cout << a[K-1] << endl;
        }
        //for (int i=0;i<W;i++) cout << b[i] << endl;
        cout << b[K-1]%1000000007 << endl;
    }
    else cout << 1 << endl;
    
    return 0;
}

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

using namespace std;

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

    int n = 20;
    vector<vector<int>> ret;
    for (int i = 2; i < n; i++) {
        ret.push_back({i, i + 1, 0});
        ret.push_back({i, i + 1, 1 << n - 1 - i});
    }

    for (int i = 2; i <= n; i++) {
        int x = 1 << n - i;
        while (l >= x) {
            ret.push_back({1, i, l - x});
            l -= x;
        }
    }

    cout << n << " " << ret.size() << endl;
    for (auto edge:ret) cout << edge[0] << " " << edge[1] << " " << edge[2] << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pi 3.14159265359
#define int long long
#define pii pair<int,int>
const int mod=1e9+7;

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



int32_t  main()
{ 
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
 
 
 int a[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
 int x;
 cin>>x;
 cout<<a[x-1]<<"\n";


   
 


}



Measured memory_bytes: 256
import java.io.*;
import java.lang.*;
import java.util.*;
public class Main{
    public static int gcd(int a,int b){
        if(a%b==0) return b;
        return gcd(b,a%b);
    }
    public static void main(String[] args) throws IOException{
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int N=Integer.parseInt(br.readLine());
        long sum=0;
        for(int i=1;i<=N;i++){
            for(int j=1;j<=N;j++){
                for(int k=1;k<=N;k++){
                    int m=gcd(i,gcd(j,k));
                    sum+=m;
                }
            }
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 32792
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	int N;
	int minimum = INF32;
	int maximum = -INF32;
	cin >> N;

	for (int i = 0; i < N; i++)
	{
		int tmp;
		cin >> tmp;
		minimum = min(minimum, tmp);
		maximum = max(maximum, tmp);
	}

	cout << maximum - minimum << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

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

template <int MOD_> struct modnum {
	static constexpr int MOD = MOD_;
	static_assert(MOD_ > 0, "MOD must be positive");

private:
	using ll = long long;

	int v;

	static int minv(int a, int m) {
		a %= m;
		assert(a);
		return a == 1 ? 1 : int(m - ll(minv(m, a)) * ll(m) / a);
	}

public:

	modnum() : v(0) {}
	modnum(ll v_) : v(int(v_ % MOD)) { if (v < 0) v += MOD; }
	explicit operator int() const { return v; }
	friend std::ostream& operator << (std::ostream& out, const modnum& n) { return out << int(n); }
	friend std::istream& operator >> (std::istream& in, modnum& n) { ll v_; in >> v_; n = modnum(v_); return in; }

	friend bool operator == (const modnum& a, const modnum& b) { return a.v == b.v; }
	friend bool operator != (const modnum& a, const modnum& b) { return a.v != b.v; }

	modnum inv() const {
		modnum res;
		res.v = minv(v, MOD);
		return res;
	}
	friend modnum inv(const modnum& m) { return m.inv(); }
	modnum neg() const {
		modnum res;
		res.v = v ? MOD-v : 0;
		return res;
	}
	friend modnum neg(const modnum& m) { return m.neg(); }

	modnum operator- () const {
		return neg();
	}
	modnum operator+ () const {
		return modnum(*this);
	}

	modnum& operator ++ () {
		v ++;
		if (v == MOD) v = 0;
		return *this;
	}
	modnum& operator -- () {
		if (v == 0) v = MOD;
		v --;
		return *this;
	}
	modnum& operator += (const modnum& o) {
		v += o.v;
		if (v >= MOD) v -= MOD;
		return *this;
	}
	modnum& operator -= (const modnum& o) {
		v -= o.v;
		if (v < 0) v += MOD;
		return *this;
	}
	modnum& operator *= (const modnum& o) {
		v = int(ll(v) * ll(o.v) % MOD);
		return *this;
	}
	modnum& operator /= (const modnum& o) {
		return *this *= o.inv();
	}

	friend modnum operator ++ (modnum& a, int) { modnum r = a; ++a; return r; }
	friend modnum operator -- (modnum& a, int) { modnum r = a; --a; return r; }
	friend modnum operator + (const modnum& a, const modnum& b) { return modnum(a) += b; }
	friend modnum operator - (const modnum& a, const modnum& b) { return modnum(a) -= b; }
	friend modnum operator * (const modnum& a, const modnum& b) { return modnum(a) *= b; }
	friend modnum operator / (const modnum& a, const modnum& b) { return modnum(a) /= b; }
};

template <typename T> T pow(T a, long long b) {
	assert(b >= 0);
	T r = 1; while (b) { if (b & 1) r *= a; b >>= 1; a *= a; } return r;
}

using num = modnum<998244353>;

int main() {
	ios::sync_with_stdio(0), cin.tie(0);
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	vector<vector<num> > dp1(c+1, vector<num>(d+1));
	vector<vector<num> > dp2(c+1, vector<num>(d+1));
	dp1[a][b] = 1;
	for(int i = a; i <= c; i++){
		for(int j = b; j <= d; j++){
			if(i < c){
				dp2[i+1][j] += (dp1[i][j] + dp2[i][j]) * j;
			}
			if(j < d){
				dp1[i][j+1] += dp2[i][j] + dp1[i][j] * i;
			}
		}
	}
	num total = dp1[c][d] + dp2[c][d];
	cout << total << '\n';
}


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

int main() {
	// your code goes here
	int S;
	cin >> S;

	int h=S/3600;
	int m=(S-3600*h)/60;
	int s=S-3600*h-60*m;

	cout<<h<<":"<<m<<":"<<s<<endl;
}

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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 105

int t , n;
int x[MAXX];
int y[MAXX];

int main()
{
    _FastIO;
    cin >> n;
    bool f = false;
    for(int i = 0; i < n; i++){
        cin >> x[i] >> y[i];
    }
    for(int i = 0; i < n - 2; i++){
            bool ft = true;
        for(int j = i; j < i + 3; j++){
            if(x[j] != y[j])
                ft = false;
        }
        if(!f)
            f = ft;
    }
    if(f){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3648
// template {{{

#include <bits/stdc++.h>
using namespace std;

#define loop(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) loop(i, 0, n)
#define rloop(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); i--)
#define rrep(i, n) rloop(i, 0, n)
#define eb emplace_back
#define ef emplace_front
#define pb pop_back
#define pf pop_front
#define all(c) std::begin(c), std::end(c)
#define mp std::make_pair
#define mt std::make_tuple
#define fi first
#define se second
#define popcnt __builtin_popcountll

using uint = unsigned;
using ll = long long;
using ull = unsigned long long;
using ld = long double;

template<typename T>
using max_pq = priority_queue<T, vector<T>, less<T>>;

template<typename T>
using min_pq = priority_queue<T, vector<T>, greater<T>>;

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

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

template<typename T>
inline T sq(T x){ return x * x; }

template<typename T, typename U>
inline bool chmax(T &x, U y){ if (x >= y) return false; x = y; return true; }

template<typename T, typename U>
inline bool chmin(T &x, U y){ if (x <= y) return false; x = y; return true; }

template<typename T>
inline void sort(T &c){ std::sort(std::begin(c), std::end(c)); }

template<typename T>
inline void reverse(T &c){ std::reverse(std::begin(c), std::end(c)); }

template<typename T>
inline void unique(T &c){ std::sort(std::begin(c), std::end(c)); c.erase(std::unique(all(c)), std::end(c)); }

// }}}

using pr = pair<int, int>;

int h, w, s, t;
int a[32][32];
pr dp[33][33][33][33];
int sum[33][33];

int rsum(int bx, int ex, int by, int ey)
{
	return sum[ex][ey] - sum[ex][by] - sum[bx][ey] + sum[bx][by];
}

pr calc(int bx, int ex, int by, int ey)
{
	pr &res = dp[bx][ex][by][ey];
	if (~res.fi) return res;
	res = pr(1, rsum(bx, ex, by, ey) - t);
	loop(i, bx + 1, ex){
		pr vl(-INF, -INF), vr(-INF, -INF);
		if (rsum(bx, i, by, ey) >= t){
			vl = calc(bx, i, by, ey);
		}
		if (rsum(i, ex, by, ey) >= t){
			vr = calc(i, ex, by, ey);
		}
		chmax(res, pr(vl.fi + vr.fi, min(vl.se, vr.se)));
	}
	loop(i, by + 1, ey){
		pr vl(-INF, -INF), vr(-INF, -INF);
		if (rsum(bx, ex, by, i) >= t){
			vl = calc(bx, ex, by, i);
		}
		if (rsum(bx, ex, i, ey) >= t){
			vr = calc(bx, ex, i, ey);
		}
		chmax(res, pr(vl.fi + vr.fi, min(vl.se, vr.se)));
	}
	return res;
}

int main()
{
	while (cin >> h >> w >> s, h){
		t = -s;
		rep(i, h) rep(j, w){
			cin >> a[i][j];
			t += a[i][j];
			sum[i + 1][j + 1] = a[i][j] + sum[i + 1][j] + sum[i][j + 1] - sum[i][j];
		}
		fill_n(***dp, sq(sq(33)), pr(-1, -1));
		pr res = calc(0, h, 0, w);
		cout << res.fi << " " << res.se << endl;
	}
}

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

int main()
{
	string abc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

	int n;
	string s;
	cin >> n;
	cin >> s;
	int ss = s.size();
	for (int i = 0; i < ss; ++i) {
		int j = 0;
		for (; j < 26; ++j) {
			if (abc[j] == s[i]) {
				break;
			}
		}
		j += n;
		if (26 <= j) {
			j -= 26;
		}
		s[i] = abc[j];
	}

	cout << s << endl;

	return 0;
}

Measured memory_bytes: 256
import java.lang.*;
import java.util.*;
import java.io.*;

public class Main
{
	public static void main (String[] arg)throws IOException
	{
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		String line;
		String[] ln;
		line=input.readLine();
		ln=line.split(" ");
		int[] b =new int[5];
		for (int i=0; i < 5;i++){
			b[i]=Integer.valueOf(ln[i]);
		}
		Arrays.sort(b);
		for(int i=0;i<4;i++){
			System.out.print(b[4-i] + " ");
		}	
		System.out.println(b[0]);
			
	}
}	
		

Measured memory_bytes: 16900
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
const int maxn = 3000050;
using namespace std;
typedef long long ll;
int main(){
ll A, V;
cin >> A >> V;
ll B,W;
cin >> B >> W;
ll T;
cin >> T;
ll D=abs(A-B);
ll D2=(V-W)*T;
puts(D<=D2?"YES":"NO");
}

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)
#define PI 3.14159265358979

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

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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 a,b;
void solve(){
	cin >> a >> b;
	cout << (a^b) << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
#include <tuple>
#include <random>

using namespace std;
typedef long long int ll;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()

#define inf 10000000000

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

    string s, t;
    cin >> s >> t;
    map<char, char> dict, dict2;
    rep(i, s.length()){
        if(dict[s[i]] || dict2[t[i]]){
            if(dict[s[i]] != t[i] || dict2[t[i]] != s[i]){
                cout << "No" << endl;
                return 0;
            }
        }else{
            dict[s[i]] = t[i];
            dict2[t[i]] = s[i];
        }
    }

    cout << "Yes" << endl;
}


Measured memory_bytes: 916
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 29);
const ll LINF = 1e18;
const double PI = acos(-1);

template<typename T>vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value != 0>::type
fill_v(U& u, const V... v) { u = U(v...); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value == 0>::type
fill_v(U& u, const V... v) { for (auto& e : u) fill_v<T>(e, v...); }
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; }

typedef pair<int, int> P;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M;
	cin >> N >> M;
	vector<P> VP;
	REP(i, N) {
		int a;
		cin >> a;
		VP.push_back(P(a, 1));
	}
	REP(i, M) {
		int b, c;
		cin >> b >> c;
		VP.push_back(P(c, b));
	}
	int rest = N;
	so(VP); rev(VP);
	ll ans = 0;
	int ind = 0;
	while (rest > 0) {
		ans += (ll)VP[ind].first * (ll)(min(rest, VP[ind].second));
		rest -= VP[ind].second;
		ind++;
	}
	cout << ans << endl;
	return 0;
}


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

  int x,y,z;
  scanf("%d %d", &x, &y );

  while(1){
    
    if ( x == 0 ){
      z = y;
      break;
    } else if ( y == 0 ){
      z = x;
      break;
    }

    if ( x > y ){
      x = x % y;
    } else {
      y = y % x;
    }

  }

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

  return 0;

}

Measured memory_bytes: 592
#include<stdio.h>
int main(void){
  int A=0,B=0,C=0,D=0;
  int s1=0,s2=0;
  scanf("%d%d%d%d",&A,&B,&C,&D);
  s1=A*B;
  s2=C*D;
  if (s1==s2){
    printf("%d\n",s1);
}
  if (s1>s2){
    printf("%d\n",s1);
}
  else if(s1<s2) {
    printf("%d\n",s2);
}


  return 0;
}


Measured memory_bytes: 128