akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}
int mpow(int base, int exp);
void ipgraph(int n, int m);
void dfs(int u, int par);

const int mod = 1e9+7;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

void solve() {
  string s;

}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

    int t = 1;

    while(t--) {
    string s;
 cin>>s;
  cout<<s.substr(0,3);
    }

    return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(int n, int m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
    u--, v--;
		g[u].pb(v);
		g[v].pb(u);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}


Measured memory_bytes: 10688
#include<bits/stdc++.h> 
using namespace std;
using ll = long long;

#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);

int ans=0;


int main() {
    int h,w;
    cin>>h>>w;

    vector<string> matrix;

    for(int i=0;i<h;i++) {
        string s;
        cin>>s;
        matrix.push_back(s);
    }

    queue<pair<int, pair<int,int>>> q;

    int ans=0;
    for(int i=0;i<h;i++) {
        for(int j=0;j<w;j++) {
            if(matrix[i][j]=='.') {
                q.push({i,{j,0}});
            }

            vector<vector<bool>> path(h, vector<bool>(w));

            while(!q.empty()) {
                int x=q.front().first;
                int y=q.front().second.first;
                int l=q.front().second.second;

                q.pop();

                if(path[x][y]==true) continue;
                else path[x][y]=true;

                if(x>0&&matrix[x-1][y]=='.') q.push({x-1, {y,l+1}});
                if(x<h-1&&matrix[x+1][y]=='.') q.push({x+1, {y,l+1}});
                if(y>0&&matrix[x][y-1]=='.') q.push({x, {y-1,l+1}});
                if(y<w-1&&matrix[x][y+1]=='.') q.push({x, {y+1,l+1}});

                ans=max(ans, l);
            }
        }
    }
    cout<<ans<<endl;


    

}




Measured memory_bytes: 3612
// ABC159 A

#include <iostream>

using namespace std;

int main(){
    long long int n, a, b, anw = 0, tmp;
    cin >> n >> a >> b;
    anw += (n/(a+b)) * a;
    tmp = n%(a+b);
    if(tmp > a) anw += a;
    else anw += tmp;
    cout << anw << endl;
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef map<ll,ll>::iterator itll;
typedef long double ld;
typedef map<ll,ll> mapll;

#define con continue
#define pb push_back
#define fi first
#define se second
#define fr front()
#define INF 1000000000000000000
#define all(vl) vl.begin(),vl.end()
#define m_p make_pair 
#define sz(a) sizeof(a)
#define forn(mp,it) for(it = mp.begin();it!=mp.end();it++)
#define FOR(i,a,n) for(int i=a;i<n;i++) 
#define FORE(i,a,n) FOR(i,a,n+1)
#define Endl endl
#define eNdl endl
#define enDl endl
#define endL endl

int main()
{
	ll n;
	ll k;
	cin>>n>>k;
	vector<ll> vl(n);
	FOR(i,0,n)cin>>vl[i];
	vector<ll> v;
	v.push_back(0);
	FOR(i,0,n)
	{
		v.push_back(vl[i]);
		v[i+1] += v[i];
	}
	ll ma = -1;
	for(int i=0;i+k<=n;i++)
	{
		ll last = v[i+k];
		ll first = v[i];
		ma = max(ma,(last-first+k));
	}
	double ans = double(ma*1.0);
	printf("%.12f",ans/2);
	puts(" ");
	return 0;
}


Measured memory_bytes: 6928
package main

import (
    "fmt"
    "os"
    "bufio"
    "strconv"
    // "sort"
)
var sc = bufio.NewScanner(os.Stdin)


func main() {
    sc.Split(bufio.ScanWords)
    // code goes here
    var best int64
    N := nextInt64()
    best = 9999
    for N >= 100 {
        s := N%1000
        best = Min(best, Abs(s-753))
        N /= 10
    }
    fmt.Println(best)
}



func nextInt() int {
    sc.Scan()
    v, e := strconv.Atoi(sc.Text())
    if e != nil { panic(e) }
    return v
}
func nextInt64() int64 {
    sc.Scan()
    v, e := strconv.ParseInt(sc.Text(), 10, 64)
    if e != nil { panic(e) }
    return v
}
func nextString() string {
    sc.Scan()
    return sc.Text()
}
func nextFloat() float64 {
    sc.Scan()
    v, e := strconv.ParseFloat(sc.Text(), 64)
    if e != nil { panic(e) }
    return v
}
func Max(x, y int) int { if x > y { return x }; return y }
func Min(x, y int64) int64 { if x < y { return x }; return y }
func Abs(x int64) int64 { if x > 0 { return x }; return -x }



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

int main(){
	int a,b,c;
	cin>>a>>b>>c;
	int dt[11];
	for(int i=0;i<11;i++)dt[i]=0;
	dt[a]++;
	dt[b]++;
	dt[c]++;
	if(dt[5]==2 && dt[7]==1)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys
 
n, m = list(map(int, input().split()))
if m > 0:
    aaa = set(map(int, sys.stdin))
else:
    aaa = set()
dp = [0] * (n + 1)
dp[0] = 1
dp[1] = 1 if 1 not in aaa else 0
MOD = 10 ** 9 + 7
 
for i in range(2, n + 1):
    if i in aaa:
        continue
    dp[i] = (dp[i - 2] + dp[i - 1]) % MOD
print(dp[n])


Measured memory_bytes: 11884
fun main(args: Array<String>) {
    fun MutableList<String>.num(index: Int): Int {
        return this[index].substring(1, this[index].length).toInt()
    }

    fun checkStable(i1: Int, i2: Int): Boolean {
        return i1 == i2
    }

    val n = readLine()!!.toInt()
    val c = readLine()!!.split(" ").toMutableList()
    var cStable = true
    val c2 = c.toMutableList()
    var c2Stable = true

    for (i in 0 until n) {
        for (j in n - 1 downTo i + 1) {
            if (c.num(j) < c.num(j - 1)) {
                val temp = c[j - 1]
                c[j - 1] = c[j]
                c[j] = temp
                if (checkStable(c.num(j - 1), c.num(j))) {
                    cStable = false
                }
            }
        }
    }

    for (i in 0 until n) {
        var minj = i
        for (j in i until n) {
            if (c2.num(j) < c2.num(minj)) {
                minj = j
            }
        }
        val temp = c2[minj]
        c2[minj] = c2[i]
        c2[i] = temp
    }

    for (i in 0 until n) {
        if (c[i] != c2[i]) {
            c2Stable = false
        }
    }

    println(c.joinToString(prefix = "", postfix = "", separator = " "))
    println(if (cStable) "Stable" else "Not stable")
    println(c2.joinToString(prefix = "", postfix = "", separator = " "))
    println(if (c2Stable) "Stable" else "Not stable")
}


Measured memory_bytes: 32632
#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; }

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, K;
	cin >> N >> K;
	vi V(N);
	REP(i, N)cin >> V[i];
	ll ans = 0;
	REP(i, K + 1) { //宝石を取り出す回数
		if (i > N)break;
		REP(j, i + 1) { //左から宝石を取り出す回数
			ll sum = 0;
			vector<int> VV;
			REP(k, j) {
				sum += V[k];
				VV.push_back(V[k]);
			}
			REP(k, i - j) {
				sum += V[N - 1 - k];
				VV.push_back(V[N - 1 - k]);
			}
			so(VV); 
			chmax(ans, sum);
			REP(k, K - i) {
				if (k >= SZ(VV))break;
				sum -= VV[k];
				chmax(ans, sum);
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n;
  string s;
  cin>>n>>s;
  s.erase(unique(s.begin(),s.end()),s.end());
  cout<<s.size()<<endl;
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int x;

signed main() {
	cin >> x;
	while (1) {
		bool bl = false;
		for (int i = 2; i <= sqrt(x); i++) {
			if (!(x%i)) {
				bl = true;
				break;
			}
		}
		if (!bl) {
			cout << x << endl;
			return 0;
		}
		x++;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

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

  vector<int> A(3); cin >> A[0] >> A[1] >> A[2];
  sort(A.begin(), A.end(), greater<int>());
  int ans = A[0]*10+A[1]+A[2];
  cout << ans << endl;
}

Measured memory_bytes: 3624
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    h, n = map(int, input().split())
    AB = [list(map(int, input().split())) for _ in range(n)]

    dp = [f_inf] * (h + 1)
    dp[0] = 0
    for a, b in AB:
        for i in range(1, h + 1):
            dp[i] = min(dp[i], dp[max(0, i - a)] + b)

    print(dp[h])


if __name__ == '__main__':
    resolve()


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

using namespace std;
using ll = long long;


int main() {
    ll n;
    cin>>n;
    vector<ll>a,b;
    for(int i=0;i<n;i++){
        ll j;
        cin>>j;
        a.push_back(j);
        b.push_back(j);
    }
    sort(b.begin(),b.end());
    int id;
    for(int i=0;i<b.size();i++){
        if(b[i]>=b.back()/2){
            id=i;
            break;
        }
    }
    if(id==0){
        cout<<b.back()<<' '<<b[id]<<endl;
        return 0;
    }
    if(id==b.size()-1){
        cout<<b.back()<<' '<<b[b.size()-2]<<endl;
        return 0;
    }
    if(b.back()%2==0){
        if(b[id]==b.back()/2){
            cout<<b.back()<<' '<<b.back()/2<<endl;
        }else if(b[id]-b.back()/2<b.back()/2-b[id-1]){
            cout<<b.back()<<' '<<b[id]<<endl;
        }else{
            cout<<b.back()<<' '<<b[id-1]<<endl;
        }
    }else{
        if(b[id]==b.back()/2||b[id]==b.back()/2+1){
            cout<<b.back()<<' '<<b[id]<<endl;
        }else if(b[id]-b.back()/2-1<b.back()/2-b[id-1]){
            cout<<b.back()<<' '<<b[id]<<endl;
        }else{
            cout<<b.back()<<' '<<b[id-1]<<endl;
        }
    }


    return 0;
}


Measured memory_bytes: 2036
using System;
using System.Linq;

class D
{
	static void Main()
	{
		var n = int.Parse(Console.ReadLine());
		var a = Console.ReadLine().Split().Select(int.Parse).ToArray();

		var ms = new long[n + 1];
		var t = 0L;
		for (var i = 1; i <= n; i++)
		{
			t = a[i - 1] - t;
			ms[i] = 2 * t;
		}
		var d = ms[n] / 2;
		Console.WriteLine(string.Join(" ", ms.Select((m, i) => m + (i % 2 == 0 ? d : -d)).Take(n)));
	}
}


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

int main() {
  int n;
  cin>>n;
  vector<int> t(n+1,0);
  vector<int> x(n+1,0);
  vector<int> y(n+1,0);
  for(int i=1;i<=n;i++)
    cin>>t.at(i)>>x.at(i)>>y.at(i);
  
  for(int i=0;i<n;i++){
    int tim=t.at(i+1)-t.at(i);
    int dis=abs(x.at(i+1)-x.at(i))+abs(y.at(i+1)-y.at(i));
    if(tim%2!=dis%2 || dis>tim){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long int A,B,C=0,D=0;
  string S;
  cin >> A;
  cin >> S;
  for(int i=0;i<A;i++){
    if(S[i]=='R')C++;
    else if(S[i]=='B')D++;
  }
  if(C>D)cout << "Yes" << endl;
  else cout << "No" << endl;
}
  
    


Measured memory_bytes: 256
#include<map>
#include<cstdio>
using namespace std;
const long long kkk=1000000007;
map<long long,long long> dp;
long long cd(long long x)
{
	if(dp[x])return dp[x];
	else dp[x]=(cd(x/2)+cd((x-1)/2)+cd((x-2)/2))%kkk;
	return dp[x];
}
int main(){
	long long n;
	dp[0]=1;dp[1]=2;dp[2]=4;
	scanf("%lld",&n);
	long long k=cd(n);
	printf("%lld",k);
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args) { 
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int money = 100;
		for(int i=0;i<n;i++)
			money=(int) Math.ceil(money*1.05);	
		System.out.println(money*1000);
	}
}

Measured memory_bytes: 17168
x,n=map(int,input().split())
p=list(map(int,input().split()))

l=list(range(102))

for i in range(n):
  l.remove(p[i])

#print(l)
ans=0
dif=1000

for i in range(102-n):
  temp=abs(l[i]-x)
  if temp<dif:
    dif=temp
    ans=l[i]
print(ans)

Measured memory_bytes: 9200
class UnionFind:
    def __init__(self, size):
        self.parent = [-1] * size
        self.rank = [0] * size
        self.num = self.parent

    def unite(self, n1, n2):
        rank, parent, num = self.rank, self.parent, self.num
        root, root_2 = self.find(n1), self.find(n2)

        if rank[root] > rank[root_2]:
            pass
        elif rank[root] < rank[root_2]:
            root_2, root = root, root_2
        else:
            rank[root] += 1

        num[root] += num[root_2]
        parent[root_2] = root
        return root

    def find(self, n0):
        if self.parent[n0] < 0:
            return n0
        else:
            ret = self.find(self.parent[n0])
            # self.parent[n0] = ret
            return ret


n, m = map(int, input().split())
ab = [tuple(map(int, input().split())) for _ in range(m)]

ans = n * (n - 1) // 2
t = UnionFind(n + 1)
v = []

for a, b in reversed(ab):
    v.append(ans)
    root_a = t.find(a)
    root_b = t.find(b)
    if root_a == root_b:
        pass
    else:
        ans -= t.num[root_a] * t.num[root_b]
        t.unite(a, b)

for x in reversed(v):
    print(x)


Measured memory_bytes: 23224
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <sstream>
#include <set>
#include <tuple>
#include <algorithm>
#include <memory>
#include <numeric>
#include <queue>
#include <functional>
#include <cmath>
#include <cstring>
#include <map>

using namespace std;

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

ll N;
vector<ll> h;

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

	cin >> N;
	h.resize(N);

	for (ll i = 0; i < N; ++i) cin >> h[i];

	vector<ll> dp(N);
	dp[0] = 0;
	dp[1] = abs(h[0] - h[1]);

	for (ll i = 2; i < N; ++i)
	{
		dp[i] = min(dp[i - 1] + abs(h[i - 1] - h[i]), dp[i - 2] + abs(h[i - 2] - h[i]));
	}

	cout << dp[N - 1] << endl;

	//system("pause");
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

struct card {char suit,value;};

void bubble(struct card a[],int n){
    for(int i=0;i<n;i++){
        for(int j=n-1;j>=i+1;j--){
            if(a[j].value<a[j-1].value){
                card t=a[j];
                a[j]=a[j-1];
                a[j-1]=t;
            }
        }
    }
}

void selection(struct card a[],int n){
    for(int i=0;i<n;i++){
        int minj=i;
        for(int j=i;j<n;j++){
            if(a[j].value<a[minj].value) minj=j;
        }
        card t=a[i];
        a[i]=a[minj];
        a[minj]=t;
    }
}

void print(struct card a[],int n){
    for(int i=0;i<n;i++){
        if(i>0) cout << " ";
        cout << a[i].suit << a[i].value;
    }
    cout << endl;
}

//バブルソートと選択ソートの結果を比較
bool isstable(struct card c1[],struct card c2[],int n){
    for(int i=0;i<n;i++){
        if(c1[i].suit!=c2[i].suit) return false;
    }
    return true;
}

int main(){
    card c1[100],c2[100];
    int n;
    char ch;

    cin >> n;
    for(int i=0;i<n;i++){
        cin >> c1[i].suit >> c1[i].value;
    }

    for(int i=0;i<n;i++) c2[i]=c1[i];

    bubble(c1,n);
    selection(c2,n);

    print(c1,n);
    cout << "Stable" << endl;
    print(c2,n);
    if(isstable(c1,c2,n)){
        cout << "Stable" << endl;
    }else{
        cout << "Not stable" << endl;
    }
    return 0;
 }



Measured memory_bytes: 3088
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

x = int(arr_data[0][0])
a = int(arr_data[1][0])
b = int(arr_data[2][0])


x -= a

cnt = x // b

x -= cnt * b

print(x)

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

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

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "{";
    rep(i, (int)v.size()) {
        if (i)
            os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
    for (auto val : array)
        std::cout << val << ", ";
    std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

    int n, k; std::cin >> n >> k;
    vi h(n); rep(i, n) std::cin >> h[i];
    sort(rng(h));
    int ans = inf;
    rep(i, n) {
        if (i+k-1 < n) chmin(ans, h[i+k-1]-h[i]);
    }
    std::cout << ans << "\n";
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep0(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define mREP(i,a,b) for (int i = a; i > (b); --i)
#define all(x) (x).begin(),(x).end()
const int INF = 1000000007;
typedef long long ll;
using namespace std;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int main(){
  int x;
  cin>>x;
  int ans = 0;
  int tmp  = 0;
  while(tmp < x){
    ans++;
    tmp = (ans * (ans + 1)) / 2;
    
  }
  cout<<ans<<endl;
  return 0;
} 

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

int main() {
  int N;
  cin >> N;
  
  vector<int> H(N);
  for(int i=0;i<N;i++){
    cin >> H.at(i);
  }
  
  int count = 1;
  
  for(int i=1;i<N;i++){
    int x=0;
    for(int j=0;j<i;j++){
      if(H.at(i)<H.at(j)){
        x=1;
        break;
      }
    }
    if(x==0){
      count++;
    }
  }
  
  cout << count << endl;
 
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb(x) push_back(x)
#define f(i,st,n) for(i=st;i<n;i++)
#define qu queue
#define ps(x) push(x)
#define vec vector
#define ft() front()
#define mst(a,b) memset(a,b,sizeof(a))
#define mod 1000000007
#define sfl(x) scanf("%lld",&x)
#define pfl(x) printf("%lld\n",x)
#define pf(x) printf("%lld",x)
#define mpr make_pair
#define fs first
#define se second
 
 
 
 
ll gcd(ll a,ll b){
    if(a==0){
        return b;
    }                     
    return gcd(b%a,a);
}
ll power(ll x,ll y){            
    ll res=1;
    while(y>0){
        if(y%2==1){
            res=(res*x);
        }
        x=(x*x);
        y=y/2;
    }
    return res;
}
 
 
int main(){
 
 /*#ifndef ONLINE_JUDGE
    
   freopen("input.txt", "r", stdin);
   
   freopen("output.txt", "w", stdout);
   #endif*/
   
ll n,i,x,k,a,b;

sfl(a);sfl(b);
ll g=gcd(a,b);
set<ll>st;
st.insert(1);
for(i=2;i*i<=g;i++){
       
  while(g%i==0){

   st.insert(i);
   g/=i;
  }



}
st.insert(g);
cout<<st.size();



 
 
 
  
 
 
 
 
 
 
 
 
 
 
 
 
   return 0;
 }

Measured memory_bytes: 256
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_f(const void *a, const void *b) {
	return *((size_t *)a) < *((size_t *)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
	size_t result = 1;

	for (size_t i = 0; i < r; i++) {
		result *= n - i;
		result /= i + 1;
	}

	return result;
}

static uint64_t gcd(uint64_t m, uint64_t n)
{
	uint64_t temp;

	while (m%n != 0) {
		temp = n;
		n = m % n;
		m = temp;
	}

	return n;
}

static char S[100001], T[100001];

int main(void) {
	char S[4];

	scanf("%s", S);

	if (strlen(S) == 2) {
		puts(S);
	}
	else {
		printf("%c%c%c\n", S[2], S[1], S[0]);
	}

	return 0;
}


Measured memory_bytes: 128
#50 C - Remainder Minimization 2019 AC (hint)
L,R = map(int,input().split())

ans = 2020
# O(2019*2019)
# i は 2019 個以下
for i in range(L,R+1):
    # j は　2019 個以下
    for j in range(i+1,R+1):
        n = i*j
        if n%2019 == 0:
            ans = 0
            break
        n = n%2019
        ans = min(ans,n)
    else:
        continue
    break
print(ans)

Measured memory_bytes: 9132
#include<set>   
#include<map>   
#include<stack>   
#include<cmath>   
#include<cstdio>   
#include<queue>   
#include<vector>   
#include<climits>   
#include<cstring> 
#include<iostream> 
#include<algorithm> 
#define LL long long 
using namespace std;      
int read(){      
    int f=1,x=0;char c=getchar();         
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}        
    while(c>='0'&&c<='9') x=(x<<3)+(x<<1)+(c^48),c=getchar();      
    return x*f;     
}
#define MAXN 11000
#define INF 0x3f3f3f3f
string num[15]={"","1","2","3","4","5","6","7","8","9"};
string f[MAXN+5];//f[i][j]:前i个数costj最大数
int a[15],cost[15]={0,2,5,5,4,5,6,3,7,6},re[15];
int main(){
	int n=read(),m=read(),Min=10,Max=0;
	for(int i=1;i<=m;i++)
		a[i]=read(),re[cost[a[i]]]=max(re[cost[a[i]]],a[i]),Min=min(Min,cost[a[i]]),Max=max(Max,cost[a[i]]);
	/*
	for(int i=2;i<=8;i++)
		if(re[i])
			f[i]=num[re[i]];*/
	for(int i=0;i<=n;i++)
		if(f[i]!=""||i==0)
			for(int k=2;k<=8&&i+k<=n;k++)
				if(re[k]){
					if(f[i+k].length()<f[i].length()+1)
						f[i+k]=f[i]+num[re[k]];
					else if(f[i+k].length()==f[i].length()+1)
						f[i+k]=max(f[i+k],f[i]+num[re[k]]);
				}
	cout<<f[n]<<endl;
	/*
	for(int i=1;i<n/Min;i++){
		for(int j=Min*i;j<=min(n,Max*i);j++)
			f[(i+1)&1][j]="";
		for(int j=Min*i;j<=min(n,Max*i);j++)
			if(f[i&1][j]!="")
				for(int k=2;k<=8&&j+k<=n;k++)
					if(re[k])
						f[(i+1)&1][j+k]=max(f[(i+1)&1][j+k],f[i&1][j]+num[re[k]]);
	}
	for(int i=n/Min;i>=1;i--)
		if(f[i&1][n]!="")
			cout<<f[i&1][n]<<endl,exit(0);*/
    return 0;
}

Measured memory_bytes: 44800
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1240

#include <iostream>
#include <string>
#include <algorithm>
#include <cctype>
using namespace std;

int main() {
  int N;
  cin >> N;
  for (int i=0; i<N; i++) {
    string S, O;
    cin >> O >> S;
    reverse(O.begin(), O.end());
    for (auto i=0; i<O.size(); i++) {
      switch(O[i]) {
      case 'J':
	S = S[S.size()-1] + S.substr(0, S.size()-1);
	break;
      case 'C':
	S = S.substr(1) + S[0];
	break;
      case 'E':
	if (S.size()%2 == 0) {
	  S = S.substr(S.size()/2) + S.substr(0, S.size()/2);
	} else {
	  S = S.substr(S.size()/2+1) + S[S.size()/2] 
	    + S.substr(0, S.size()/2);
	}
	break;
      case 'A':
	reverse(S.begin(), S.end());
	break;
      case 'P':
	for (auto i=0; i<S.size(); i++) {
	  if (isdigit(S[i])) {
	    S[i] = (char)((((int)S[i] - '0')+10 -1)%10 + '0');  
	  }
	}
	break;
      case 'M':
	for (auto i=0; i<S.size(); i++) {
	  if (isdigit(S[i])) {
	    S[i] = (char)((((int)S[i] - '0')+10 +1)%10 + '0');  
	  }
	}
	break;
      default:
	break;
      }
    }
    cout << S << endl;
  }
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
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 fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
#define dame { printf("No\n"); return 0;}
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e17)


signed main(){
    int a,b;
    cin >> a >> b;
    int res = 0;
    if(a < b){
        swap(a,b);
    }
    if(a == b) cout << 2 * a << endl;
    else cout << 2 * a - 1 << endl;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#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++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
#define _GLIBCXX_DEBUG
const int inf=1e9+7;

int main(){
    int n;cin>>n;
    int s=to_string(n).size();
    if(s<3){
        cout<<0<<endl;
        return 0;
    }
    int ans=0;
    rep2(i,3,s+1){
        rep(j,1<<2*i){
            bitset<18> tmp(j);
            bool can=false;
            for(int k=0;k<2*i;k+=2)if(tmp[k]==1&&tmp[k+1]==1)can=true;
            if(can)continue;
            int sum=0;
            int three=0;int five=0;int seven=0;
            for(int k=0;k<2*i;k+=2){
                if(tmp[k]==0&&tmp[k+1]==0){
                    sum=10*sum+3;
                    three++;
                }
                else if(tmp[k]==0&&tmp[k+1]==1){
                    sum=10*sum+5;
                    five++;
                }
                else if(tmp[k]==1&&tmp[k+1]==0){
                    sum=10*sum+7;
                    seven++;
                }
            }
            if(!three||!five||!seven)continue;
            if(sum<=n)ans++;

        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#include <cstring>

#define rep(i,n) for(int i=0;i<int(n);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back

using namespace std;
using ll = long long;

const ll mod = 1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/


int main(){
  string  S;
  cin >> S;
  int a = (S[0] - '0') * 10 + (S[1] - '0');
  int b = (S[2] - '0') * 10 + (S[3] - '0');
  
  if(0 < a && a <= 12 && 0 < b && b <= 12) cout << "AMBIGUOUS" << endl;
  else if((a > 12 || a == 0) && 1 <= b && b <= 12) cout << "YYMM" << endl;
  else if((b > 12 || b == 0) && 1 <= a && a <= 12) cout << "MMYY "<< endl;
  else cout << "NA" << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <list>
#include <ctime>
#include <complex>
#include <bitset>
#include <tuple>
#include <functional>

using namespace std;

#define IOS ios::sync_with_stdio(false);cin.tie(0)
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define MOD 1000000007LL
#define rep(i,a,n) for (int i=a ; i<n ; i++)
#define per(i,a,n) for (int i=n-1 ; i>=a ; i--)
#define LLINF 100000000000000005LL
#define INF (int)1e9+1
#define endl '\n'
#define pb push_back

// debug 도구

template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
    return '"' + s + '"';
}

string to_string(const char* s) {
    return to_string((string)s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
    bool first = true;
    string res = "{";
    for (int i = 0; i < static_cast<int>(v.size()); i++) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}

template <size_t N>
string to_string(bitset<N> v) {
    string res = "";
    for (size_t i = 0; i < N; i++) {
        res += static_cast<char>('0' + v[i]);
    }
    return res;
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto& x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}\n";
    return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:\n", debug_out(__VA_ARGS__)

// debug 도구 end

using llong = long long;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using VPII = vector<pair<int, int>>;
using VLL = vector<long long>;
using PII = pair<int, int>;


int main() {
    string s;
    cin >> s;
    int cnt = 0;
    rep(i, 0, s.length() / 2) {
        if (s[i] != s[s.length() - i - 1]) cnt++;
    }
    cout << cnt;
    return 0;
}

Measured memory_bytes: 3608
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;
typedef long long ll;

int main(){
	int N;
	while(cin>>N,~N){
		ll ans=0;
		for(int i=0;i<N;i++){
			ans++;
			for(ll j=1; ans/j%10==4; j*=10) ans += j*6;
		}
		printf("%lld\n",ans);
	}
	return 0;
}

Measured memory_bytes: 1136
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars};
#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
	input! {
		n: usize,
		m: usize,
	}

	if n == 1 && m == 1 {
		println!("1");
		return;
	}
	if n == 1 {
		println!("{}", m-2);
		return;
	}
	if m == 1 {
		println!("{}", n-2);
		return;
	}
	println!("{}", (n-2)*(m-2));
}



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

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

using namespace std;
using ll = long long;

void solve();

int main(void){
    ll h = 1, n = 1, w = 1;
    int N;
    cin >> N;

    ll Nhn, Nn, hn4, Nh;
    for(h = 1; h <= 3500; h++){
        Nh = N*h;
        for(n = h; n <= 3500; n++){
            Nhn = Nh*n;
            Nn = N*n;
            hn4 = h*n*4;
            if((hn4-Nn-Nh) > 0 && (Nhn % (hn4-Nn-Nh)) == 0){
                w = Nhn / (hn4-Nn-Nh);
                printf("%d %d %d\n", h, n, w);
                return 0;
            }
        }
    }
    return 1;
}

void solve(){}

Measured memory_bytes: 256
import sys

N = 50000
t = [1]*(N)
p = [2]
d = {2:1}
for i in range(3, N, 2):
    if t[i]:
        p.append(i)
        d[i] = 1
        for j in range(3*i, N, 2*i): t[j] = 0

while True:
    n = int(sys.stdin.readline())
    if n == 0: break

    count = 0
    if n % 2:
        if n - 2 in p: count += 1
    else:
        for p1 in p:
            if 2*p1 > n: break
            if n - p1 in d:
                count += 1
    print(count)

Measured memory_bytes: 7496
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    int N, X; cin >> N >> X;
    ll L[110]; rep(i, N) cin >> L[i];
    ll D[110];
    D[0] = 0;
    int ans = 1;
    rep(i, N) {
        D[i + 1] = D[i] + L[i];
        if(D[i + 1] <= X) ans ++;
    }
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int d = sc.nextInt();
    int[][] x = new int[n][d];
    int ans = 0;

    for(int i=0; i<n; ++i)
      for(int j=0; j<d; ++j)
        x[i][j] = sc.nextInt();

    for(int i=0; i<n-1; ++i) {
      for(int j=i+1; j<n; ++j) {
        double kyori = 0;
        for(int k=0; k<d; ++k) {
          int calc = Math.abs(x[i][k] - x[j][k]);
          kyori = kyori + calc*calc;
        }
        kyori = Math.sqrt(kyori);
        if(kyori - (int)kyori == 0.0) ++ans;
      }
    }

    System.out.println(ans);
  }
}

Measured memory_bytes: 21712
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repA(i,a,b) for(int i=a;i<=b;i++)
#define repD(i,b,a) for(int i=b;i>=a;i--)
#define fill(a) memset(a,0,sizeof(a))
#define f first
#define s second
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main()
{
    ll n,k;
    cin>>n>>k;
    ll res=n%k;
    if(res>k/2)
        res=k-res;
    cout<<res<<endl;
}


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

struct object{
    int v,w;
    char t;
    unsigned long d;
    string s;
    
    bool operator < (const object &o) const {
        // 価値
        if(v != o.v){
            return v < o.v;
        }
        else {
            // 重さ
            if(w != o.w){
                return w < o.w;
            }
            else{
                // 型 char
                if(t != o.t){
                    return t < o.t;
                }
                else{
                    // 日時 unsinged long
                    if(d != o.d){
                        return d < o.d;
                    }
                    else{
                        // 名前 string
                        if(s != o.s){
                            return lexicographical_compare(s.begin(),s.end(),o.s.begin(),o.s.end());
                        }
                    }
                }
            }
        }
        return false;
    }
};

int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    object o[n];

    for(int i = 0;i < n;++i){
        cin >> o[i].v >> o[i].w >> o[i].t >> o[i].d >> o[i].s;
    }

    sort(o,o + n);

    for(int i = 0;i < n;++i){
        cout << o[i].v << " " << o[i].w << " " << o[i].t << " " <<  o[i].d << " " << o[i].s << endl;
    }
}




Measured memory_bytes: 11492
/*3 ????????°?????´???

???????????´??°?????????????????????????????????????°??????????????????????????????????????????°?????????????????????????????????

Input
???????????´??°???????????§????????????????????????????????????

Output
?°???????????????????????????????????????´??°??????????????????????????????????????´??°?????????????????????????????\??????????????????*/

#include<iostream>
using namespace std;

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

	if(a < b){
		t = a; a = b; b = t;
	}

	if(b < c){
		t = b; b = c; c = t;
	}

	if (a < b){
		t = a; a = b; b = t;
	}

	cout << c << " " << b << " " << a << endl;
	return 0;
}

Measured memory_bytes: 1168
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1'000'000'007;
const ll inf=1'000'000'000'000'000'00;
const int INF=1'000'000'000;
const double EPS=1e-10;
const double PI=acos(-1);

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    string s;
    cin>>s;
    if(s.back()!='s') s+='s';
    else s+="es";
    cout<<s<<endl;
}

Measured memory_bytes: 3632
#include<stdio.h>

int adj[100][100];

int main(){
  int n,i,j,u,k,v;

  for(i = 0;i < 100;i++){
    for(j = 0;j < 100;j++){
      adj[i][j] = 0;
    }
  }

  scanf("%d",&n);

  for(i = 0;i < n;i++){
    scanf("%d %d",&u,&k);
    for(j = 0;j < k;j++){
      scanf("%d",&v);
      adj[i][v-1] = 1;
    }
  }

  for(i = 0;i < n;i++){
    for(j = 0;;){
      printf("%d",adj[i][j]);
      j++;
      if(j >= n)break;
      printf(" ");
    }
    printf("\n");
  }

  return 0;
}

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

int main() {
	// your code goes here
    int n;
    cin>>n;
    
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    
    int sum=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            sum+=a[i]*a[j];
        }
    }
    
    cout<<sum<<endl;
}


Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

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

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin>>s;
  string a="",b="";
  ll n=0,m=0;
  rep(i,s.length()){
    if(i%2==0){
      a+="0";
      b+="1";
    } else {
      a+="1";
      b+="0";
    }
  }
  // cout<<a<<" "<<b<<endl;
  rep(i,s.length()){
    if(s[i]!=a[i]) n++;
    if(s[i]!=b[i]) m++;
  }
  cout<<MIN(n,m)<<endl;
}

int main(){
  solve();
  return 0;
}


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

#define int long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define pii pair<int,int>
#define que pair<pii,pii>

int N, M, Q;
que q[60];
int mem[20];

int DFS(int n, int v)
{
    if(n == N)
    {
        int ret = 0;
        rep(i, Q)
        {
            que now = q[i];
            pii lr = now.first;
            pii d = now.second;
            if(mem[lr.second] - mem[lr.first] == d.first)ret += d.second;
        }
        return ret;
    }
    int ret = 0;
    for(int i = v; i <= M; i++)
    {
        mem[n] = i;
        ret = max(DFS(n + 1, i), ret);
    }
    return ret;
}

signed main()
{
    cin >> N >> M >> Q;
    rep(i, Q)
    {
        int l, r, d, v;
        cin >> l >> r >> d >> v;
        q[i] = {{l - 1, r - 1}, {d, v}};
    }
    cout << DFS(0, 1) << endl;
    return 0;
}




Measured memory_bytes: 3592