akhauriyash/Code-Regression huggingface dataset:
/*
Dont BLUNDER
*/

// #pragma GCC optimize("O3")
// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimization ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include<climits>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>
#include <chrono>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;


 */
//#define d long double
#define int long long
#define pii pair<int,int>
#define pb push_back
#define endl '\n'
#define pi acos(-1)

#define init(x,a) memset(x,a,sizeof(x))
#define all(c) c.begin(),c.end()
int const mod1 = 998244353;
int const mod = 1000000007;
#define bitcount(x)       __builtin_popcountll(x)
#define l first
#define r second
const int inf = LLONG_MAX;
int toint(const string &s) {stringstream ss; ss << s; int x; ss >> x; return x;}
string tostring ( int number ) {stringstream ss; ss << number; return ss.str();}
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define haha ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
// * Using PBDS *
/*typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
               os; */

struct cmp
{
	bool operator() (pii a, pii b) {
		return (a.l < b.l);
	}
};

int modexp(int x, int n) {
	if (n == 0) {
		return 1;
	}
	else if (n & 1) {
		return (modexp((x * x) % mod, n / 2) % mod * x % mod) % mod;
	}
	else {
		return (modexp((x * x) % mod, n / 2) % mod);
	}
}

int modinv(int n)
{
	return modexp(n, mod - 2);
}

int gcd(int a, int b) {
	if (b == 0) {
		return a;
	}
	return gcd(b, a % b);
}
int arr[1000001];
void go() {
	for (int i = 1; i <= 1000000; i++) {

		for (int j = i * i; j <= 1000000; j += i) {
			arr[j] += 1;
			if (i * i != j) {
				arr[j]++;

			}
		}
	}


}



signed main()
{
	haha
#ifndef ONLINE_JUDGE

	freopen("inp.txt", "r", stdin);

	freopen("out1.txt", "w", stdout);
#endif
	int n;
	cin >> n;
	init(arr, 0);
	int ans = 0;
	go();
	//cout << arr[36] << endl;
	for (int i = 1; i <= n - 1; i++) {
		ans += arr[n - i];
	}
	cout << ans;













}


Measured memory_bytes: 11420
use std::io::*;
use std::str::FromStr;

fn main() {
    let n: usize = read();
    let k: usize = read();
    if (n-1) / 2 + 1 >= k {
        println!("YES");
    } else {
        println!("NO");
    }
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


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

int main(){
    int n, q;
    cin >> n >> q;
    vector<int> v(n);
    for(int i = 0; i < n; i++)  cin >> v[i];
    sort(v.begin(),v.end());
    while(q--){
        int l, r;
        cin >> l >> r;
        cout << upper_bound(v.begin(),v.end(),r)-lower_bound(v.begin(),v.end(),l) << endl;
    }
    return 0;
}


Measured memory_bytes: 3160
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------



int N,M;
vector<int> ev[602020];
int did[602020];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	int ret=0;
	cin>>N>>M;
	FOR(i,N) {
		cin>>x>>y;
		x+=M;
		x--;
		y--;
		if(y<=x) {
			ev[y].push_back(x);
			ev[y+M].push_back(x+M);
		}
	}
	
	multiset<int> ed;
	FOR(i,3*M) {
		while(ed.size() && *ed.begin()<i) ed.erase(ed.begin());
		FORR(e,ev[i]) ed.insert(e);
		if(i) did[i]=did[i-1];
		if(ed.size()) {
			did[i]++;
			ed.erase(ed.begin());
		}
	}
	
	int ma=0;
	FOR(i,2*M) ma=max(ma,did[i+M]-did[i]);
	
	cout<<N-ma<<endl;
	
	
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 29184
program ABC146A
    implicit none
    character(3)::S
    read(5,*)S

    if(S=="SUN")then
        print'(i0)',7
    else if(S=="MON")then
        print'(i0)',6
    else if(S=="TUE")then
        print'(i0)',5
    else if(S=="WED")then
        print'(i0)',4
    else if(S=="THU")then
        print'(i0)',3
    else if(S=="FRI")then
        print'(i0)',2
    else if(S=="SAT")then
        print'(i0)',1
    end if
end program ABC146A

Measured memory_bytes: 768
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<deque>

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e8;

using namespace std;

#define vvint(vec,n,m,l) vector<vector<int>> vec(n,vector<int>(m,l));
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>;
#define pint pair<int,int>;
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")


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

	int n;
	cin >> n;

	for (int i = 1; i < 11; i++)
	{
		if (i * 100 + i * 10 + i - n >= 0)
		{
			cout << i * 100 + i * 10 + i << endl;
			break;
		}
	}
}

Measured memory_bytes: 256
/*Saurav Paul*/
#include<bits/stdc++.h>
#define endl '\n'
#define ll long long int
#define loop(i,a,b)           for(ll i=a;i<=b;++i)
#define boost		          ios_base::sync_with_stdio(0);
#define eb                    emplace_back
#define mp                    make_pair
#define clr(x)                x.clear()
#define MOD                   1e9+7
#define itoc(c)               ((char)(((int)'0')+c))
#define ctoi(c)               ((int)(((int)c)-'0'))
#define all(p)                p.begin(),p.end()
#define iscn(num)             scanf("%d",&num);
#define scn(num)              scanf("%lld",&num);
#define scn2(num,num2)        scanf("%lld%lld",&num,&num2);
using namespace std;

const int nax = 2000+1;
//~ char s[nax][nax];
string s[nax];
int dp[nax][nax];
int h , w;
int main()
{
	
	scanf("%d%d",&h,&w);
	for(int i =0 ; i < h ; i++)
		//~ scanf("%s",s[i]);
		cin >> s[i];
	
	int maxi = 0;
	for (int i = 0 ; i < h ; i++){
		for(int j= 0 ; j < w ; j++){					
			if(s[i][j]=='#')
				continue ;
			int cnt = 0,st= j;
			while(j < w){
				if(s[i][j]=='#')
					break;
				cnt++;
				j++;
			}
			for(st=st ; st < j ; st ++)
				dp[i][st] +=cnt ;
		}
	}

	for (int i = 0 ; i < w ; i++){
		for(int j= 0 ; j < h ; j++){	

			if(s[j][i]=='#')
				continue ;
			int cnt = 0,st= j;
			while(j < h){
				if(s[j][i]=='#')
					break;
				cnt++;
				j++;
			}
			for(st=st ; st < j ; st ++)
				dp[st][i] +=cnt ;
		}
	}

	for(int i = 0 ; i < h ; i++)
		for(int j = 0 ; j < w ; j++)
			maxi = max(maxi, (int)dp[i][j]);

	printf("%d\n",maxi-1);
    return 0;
}


Measured memory_bytes: 19968
#define  _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#pragma comment (linker, "/STACK:526000000")

#include "bits/stdc++.h"
#define int ll

using namespace std;
typedef string::const_iterator State;
#define eps 1e-8L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL
#define MOD 998244353LL
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

unsigned long xor128() {
    static unsigned long x = time(NULL), y = 362436069, z = 521288629, w = 88675123;
    unsigned long t = (x^(x << 11));
    x = y; y = z; z = w;
    return (w = (w^(w >> 19))^(t^(t >> 8)));
}

void init() {
    iostream::sync_with_stdio(false);
    cin.tie(0);
}
int cnt[7][7];
void solve() {
    int h, w;
    int k;
    cin >> h >> w >> k;
    int ans = 0;
    REP(i, h) {
        string s;
        cin >> s;
        REP(q, w) {
            if (s[q] == '#') {
                cnt[i][q] = 1;
            }
        }
    }
    REP(i, (1 << (h + w))) {
        int hoge = 0;
        REP(q, h) {
            REP(j, w) {
                if ((1 << q) & i) {
                    continue;
                }
                if ((1 << (h + j)) & i) {
                    continue;
                }
                hoge += cnt[q][j];
            }
        }
        ans += hoge == k;
    }
    cout << ans << endl;
}


#undef int
int main() {
    init();
    solve();
}

Measured memory_bytes: 3648
import sys
sys.setrecursionlimit(10**5)
N=int(input())
uvw=[list(map(int,input().split())) for i in range(N-1)]
link=[[] for i in range(N+1)]
for u,v,w in uvw:
    link[u].append((v,w))
    link[v].append((u,w))
mark=[0]*(N+1)
color=[0]*(N+1)
def dfs(n,c):
    mark[n]=1
    color[n]=c
    for i,w in link[n]:
        if mark[i]==1:
            continue
        if w%2==0:
            dfs(i,c)
        else:
            dfs(i,1-c)
dfs(uvw[0][0],0)
for i in range(1,N+1):
    print(color[i])

Measured memory_bytes: 130448
#include <algorithm>
#include <iostream>
#include <vector>
#include <list>
#include <unordered_map>
#include <limits>
#include <queue>

using namespace std;

//int min = numeric_limits<int>::max();

void dump(priority_queue<int, std::vector<int>, std::less<int>> &Ar) {
    while (!Ar.empty()) {
        cout << Ar.top() << " ";
        Ar.pop();
    }
    cout << endl;
}

int main(int argc, char* argv[]) {
    int N, M;
    cin >> N >> M;

    priority_queue<
        int,
        std::vector<int>,
        std::less<int>
    > Ar;

    for (int i=0; i < N; i++) {
        int x;
        cin >> x;
        Ar.push(x);
    }

    for (int i=0; i < M; i++) {
        auto x = Ar.top() / 2;
        Ar.pop();
        Ar.push(x);
    }

    int64_t sum = 0L;
    while (!Ar.empty()) {
        sum += Ar.top();
        Ar.pop();
    }


    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 892
// Vivek Rai
// Blazer_007

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define fastio 		ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll          long long
#define pb          push_back
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define ppi			pair<ll,pii>
#define all(a)      (a).begin(),(a).end()
#define FF           first
#define SS           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define bit(x, y)   (((x)>>(y))&1)
#define bpt(x)      (__builtin_popcount(x))
#define bptl(x)     (__builtin_popcountll(x))
#define loop(i,a,b)  for(int i=a;i<b;i++)
#define rloop(i,a,b) for(int i=a;i>=b;i--)

using namespace std;
using namespace __gnu_pbds;

typedef priority_queue<int> maxHeap;
typedef priority_queue<int, vector<int>, greater<int> > minHeap;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// find_by_order(index) -> value at given index or Kth smallest element in set
// order_of_key(X) -> number of elements strictly less than X
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> OST;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1)
{
    cout << name << " : " << arg1 << endl;
    //use cerr if u want to display at the bottom
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args)
{
    const char *comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
#else
#define trace(...)
#endif

template <typename T>
istream &operator>>(istream &in, vector<T> &arr)
{
    for(int i = 0 ; i < arr.size() ; i++)
        cin >> arr[i];
    return in;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> arr)
{
    for(int i = 0 ; i < arr.size() ; i++)
        cout << arr[i] << " ";
    cout << endl;
    return os;
}

void solution()
{
	ll d, s, t;
    cin >> d >> t >> s;
    ll tt = d/s;
    if (d % s)
        tt++;
    if (tt <= t)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

signed main()
{
    fastio

    ll t = 1;
    // cin >> t;
    loop(i, 1, t + 1)
    {
        //cout<<"Case #"<<i<<": ";
        solution();
    }
}

Measured memory_bytes: 3644
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n=int(input())
    C=[0]*n
    for i in range(n):
        x,y=map(int,input().split())
        C[i]=x+y*1j

    from cmath import phase
    C.sort(phase)
    S=[0]*(n+1)
    for i in range(n):
        S[i+1]=S[i]+C[i]

    ans=-INF
    for j in range(n+1):
        for i in range(j):
            ans=max(ans,abs(S[j]-S[i]))
            ans=max(ans,abs(S[-1]-(S[j]-S[i])))
    print(ans)
resolve()

Measured memory_bytes: 38896
n = int(input())
w = list(map(int, input().split()))

ans = sum(w)
for t in range(0, n - 1):
    s1 = sum(w[0:t + 1])
    s2 = sum(w[t + 1:n])
    ans = min(ans, abs(s2 - s1))
print(ans)


Measured memory_bytes: 8988
import java.util.*
import kotlin.math.acos
import kotlin.math.cos
import kotlin.math.round
import kotlin.math.sin

fun main() {
    val n = readInt()
    val d = List(n) { readIntList() }

    var cnt = 0
    d.forEach { (f, s) ->
        if (f == s) {
            cnt++
        } else {
            cnt = 0
        }
        if (cnt == 3) {
            println("Yes")
            return
        }
    }
    println("No")
}

fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)

Measured memory_bytes: 37960
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#pragma GCC optimize(2)
#define int long long
#define MAXN 2000000
#define INF (1e13 + 7)
#define MANX MAXN

using namespace std;

inline int read()
{
	int x = 0, f = 1; char c = getchar();
	while (c > '9' || c < '0') { if (c == '-') f = -1; c = getchar(); }
	while (c >= '0' && c <= '9') { x = x * 10 + (c ^ 48); c = getchar(); }
	return f * x;
}

int vis[MAXN];

string s;

signed main()
{
	int n = read();
	for (int i = 1; i <= n; i++)
	{
		cin >> s;
		if (s == "AC") vis[1] ++;
		if (s == "WA") vis[2] ++;
		if (s == "TLE") vis[3] ++;
		if (s == "RE") vis[4] ++;
	}
	cout << "AC x " << vis[1] << endl;
	cout << "WA x " << vis[2] << endl;
	cout << "TLE x " << vis[3] << endl;
	cout << "RE x " << vis[4] << endl;
	return 0;
}

Measured memory_bytes: 3636
res = -1
A,B,M = list(map(int,input().split()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
amin = 100000
bmin = 100000
cmin = amin + bmin
for i in a:
  if amin > i:
    amin = i
for i in b:
  if bmin > i:
    bmin = i
res = amin + bmin
for i in range(M):
  xi,yi,ci = list(map(int,input().split()))
  c = a[xi-1] + b[yi-1] - ci
  if cmin > c:
    cmin = c

if res > cmin:
  print(cmin)
else:
  print(res)

Measured memory_bytes: 18688
#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector<vector<int>> mat;
//typedef unsigned int uint;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
//const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	string S;
	cin >> S;
	int n[26] = { 0 };

	rep(i, 0, SZ(S))
	{
		n[S[i] - 'A']++;
	}

	bool ok = true;
	rep(i, 0, 26)
	{
		if (n[i] != 0 && n[i] != 2)
		{
			ok = false;
			break;
		}
	}

	if (ok)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b,c;
    scanf("%d %d",&a,&b);
    if((a==1 && b==2)||(a==2 && b==1))
    {
        printf("3\n");
    }
    else if((a==1 && b==3)||(a==3 && b==1))
    {
        printf("2\n");
    }
    else if((a==2 && b==3)||(a==3 && b==2))
    {
        printf("1\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
using namespace std;
int main(){
	int s,ans=0,x=0;
	cin>>s;
	if(s==1||s==2||s==4)x=s;
	else x=4;
	for(;;){
		ans++;
		if(s==x){
			cout<<ans+3<<endl;
			return 0;
			}
		if(s%2==0){
			s=s/2;
			}
		else{
			s=s*3+1;
			}
		}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint n, k;
    cin >> n >> k;
    vector<lint> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    vector<lint> neg, pos;
    lint zero = 0;
    for (int i = 0; i < n; ++i) {
        if (a[i] < 0)
            neg.push_back(-a[i]);
        else if (a[i] > 0)
            pos.push_back(a[i]);
        else
            zero++;
    }
    sort(neg.begin(), neg.end());
    sort(pos.begin(), pos.end());
    lint ok = inf;
    lint ng = -inf;
    lint np = pos.size(), nn = neg.size();
    auto check = [&](lint mid) { // mid ika ga k ko
        lint cnt= 0;
        if (mid >= 0) {
            cnt += zero * (nn + np) + zero * (zero - 1) / 2;
            // pos pos
            lint t = 0;
            // lint self = 0;
            for (int i = 0; i < np; ++i) {
                t += upper_bound(pos.begin(), pos.end(), (mid) / pos[i]) - begin(pos);
                if (pos[i] * pos[i] <= mid) {
                    t--;
                    // self++;
                }
            }
            // neg neg
            for (int i = 0; i < nn; ++i) {
                t += upper_bound(neg.begin(), neg.end(), (mid) / neg[i]) - begin(neg);
                if (neg[i] * neg[i] <= mid) {
                    t--;
                    // self++;
                }
            }
            cnt += t / 2;
            // pos neg
            cnt += np * nn;
        } else {
            mid = abs(mid);
            // pos neg
            for (int i = 0; i < np; ++i) {
                lint t = lower_bound(neg.begin(), neg.end(), (mid + pos[i] - 1) / pos[i]) - begin(neg);
                cnt += nn - t;
            }
        }
        return cnt >= k;
    };
    while (abs(ok - ng) != 1) {
        lint mid               = (ok + ng) / 2;
        (check(mid) ? ok : ng) = mid;
    }
    cout << ok << "\n";
    return 0;
}

Measured memory_bytes: 3956
n = int(input())
grid = [[0,0,0]] + [list(map(int,input().split())) for i in range(n)]

for i in range(1,n+1):
    dt = grid[i][0] - grid[i-1][0]
    dx = abs(grid[i][1] - grid[i-1][1])
    dy = abs(grid[i][2] - grid[i-1][2])
    #print(dt,dx,dy)
    if dt < dx + dy:
        print('No')
        break
    elif (dt - dx - dy) % 2 == 1:
        print('No')
        break
else:
    print('Yes')



Measured memory_bytes: 61144
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    a, b, k = list(map(int, readline().split()))
    m = min(a, k)
    a -= m
    k -= m
    b -= min(b, k)
    print(a, b)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 38256
#include <stdio.h>

int main(void){
    int k,a,b;
    scanf("%d",&k);
    scanf("%d %d",&a,&b);

    int i;
    for(i=1;i*k<=b;i++){
        if(a<=i*k && i*k<=b){
            printf("OK\n");
            return 0;
        }
    }
    printf("NG\n");
    return 0;
}


Measured memory_bytes: 1660
using System;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            string[] inputP = Console.ReadLine().Split(' ');

            int X = int.Parse(input[0]);
            int N = int.Parse(input[1]);
            int count = 0;

            if (N == 0)
            {
                Console.WriteLine(X);
                return;
            }

            int[] p = new int[N];
            for (int i = 0; i < N; i++)
            {
                p[i] = int.Parse(inputP[i]);
            }

            for (int i = 0; i < 100; i++)
            {
                for (int j = 0; j < N; j++)
                {
                    if (X - i != p[j])
                    {
                        count++;
                    }
                }

                if (count == N)
                {
                    Console.WriteLine(X - i);
                    return;
                }

                count = 0;
                for (int j = 0; j < N; j++)
                {
                    if (X + i != p[j])
                    {
                        count++;
                    }
                }

                if (count == N)
                {
                    Console.WriteLine(X + i);
                    return;
                }

                count = 0;
            }
        }
    }
}

Measured memory_bytes: 27556
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;




int main()
{
    int N,R;
    cin >> N >> R;
    if(N < 10){
        cout << R+100*(10-N) << endl;
    }else{
        cout << R << endl;
    }

    
    
    
    

    return 0;
}


Measured memory_bytes: 256
def checkWays(n,x)
  count = 0
  catch(:stop) do
    n.downto(1) do |n1|
      (n1-1).downto(1) do |n2|
        n3 = x - n1 - n2
        throw :stop if (n3 >= n1)
        break if (n3 >= n2)
        count += 1 if (n3 > 0)
      end
    end
  end
  puts count
end

while ((n,x = gets.split(" ").map(&:to_i)).inject(:+) != 0) do
  max = 3*(n-1)
  unless ((6..max).include?(x))
    puts 0
    next
  end
  checkWays(n,x)
end

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

int main(){
  int n,m,k,l,c[100];
  cin >> n >> m;
  for(int i=0;i<=n;i++)c[i] = 0;
  for(int i = 0;i < m;i++){
    cin >> k >> l;
    c[k]++;
    c[l]++;
  }
  for(int i=1;i<=n;i++){
    cout << c[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN+1];
int head = 0, tail = 0, n = 0;

void enqueue(P x){
  //   printf("%d: tail=%d x.name=%s  x.t=%d \n"
  //   ,__LINE__ ,tail   ,x.name    ,x.t);
 
  Q[tail] = x;
  if((tail+1)==LEN){
    tail = 0;
  } else{
    tail++;
  }
  return;
}

P dequeue(){
  P ret;
  ret = Q[head];
  if( head+1 == LEN ){
    head = 0;
  } else{
    head++;
  }
  return ret;
}


int main(){
  int elaps = 0, c;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for ( i = 0; i < n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  tail = n;
  
  while(n!=0){
    u = dequeue();
    if(u.t > q ){
      u.t -= q;
      enqueue(u);
      elaps += q;
    }else{
      elaps += u.t;
      n--;
      printf("%s %d\n" ,u.name ,elaps);
    }
  }
  
  return 0;
}

Measured memory_bytes: 11184
#include <iostream>
#include <queue>

using namespace std;

int main(){

	int c[3];
	queue <int> ans;
	while(cin>>c[0]){
		if(c[0]==0){
			break;
		}
		for(int i=1;i<3;i++){
			cin>>c[i];
		}
		int sum;
		sum=(c[0]+c[1]);
		int p=0;
		for(int i=1;i<=10;i++){
			if(c[0]!=i && c[1] != i &&c[2] != i){
				if(sum+i<=20){
					p++;
				}
			}
		}
		if(p>3){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
	}

	return 0;

}
/*
Sample Input
1 2 3
5 6 9
8 9 10
Output for the Sample Input
YES
YES
NO
*/

Measured memory_bytes: 1192
#include <iostream>
#include <algorithm>

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

using namespace std;

const int inf = 1e18;


int N;
int s[100000];

int calc(int A,int B) {
  //printf("A = %lld, B = %lld\n",A,B);
  int sum = 0;
  int x = 0;
  //while(x < N) {
  while(true) {
    int y = x + A;
    sum += s[y];
    if (y == N - 1) return sum;
    //printf("a y = %lld\n", y);

    y = y - B;
    sum += s[y];
    x = y;
    //printf("b y = %lld\n", y);
  }
  return -1;
}

int dp[100000];

bool in(int A) {
  return 0 < A && A < N;
}

signed main(void) {
  cin >> N;
  rep(i,N) {
    cin >> s[i]; 
  }

  rep(C, N) {
    if (C == 0) continue;
    dp[C] = (N - 1 - C > 0) ? 0 : -inf;
  }

  int ans = 0;
  for (int k = 1; k < N; k++) {
    for (int C = 1;k * C < N ;C++) {
      int A = N - 1 - k * C;
      int B = A - C;
      if (!in(A) || !in(B)) continue;
      if (B % C == 0 && N - 1 - A - B > 0) continue;

      dp[C] += s[N - 1 - k * C] + s[k * C];
      ans = max(dp[C], ans);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
import java.io.*;
import java.util.*;

class Main{
  public static void main(String args[]){
    Scanner in = new Scanner(System.in);
    int n = in.nextInt();
    int c[] = new int[4];
    for(int i=0;i<n;i++)
      c[in.nextInt()]++;

    double mem[][][] = new double[n+1][n+1][n+1];
    System.out.println(myfun(mem, c[1], c[2], c[3], n));
  }

  public static double myfun(double mem[][][], int c1, int c2, int c3, int n){
    int c = c1+c2+c3;
    if(c==0) return 0.0;
    if(mem[c1][c2][c3] !=0 ) return mem[c1][c2][c3];

    mem[c1][c2][c3] = n/(double)c; //Expected throws to not eat piece

    if(c1!=0) mem[c1][c2][c3] += myfun(mem, c1-1, c2, c3, n) * (c1 / (double)c);
    if(c2!=0) mem[c1][c2][c3] += myfun(mem, c1+1, c2-1, c3, n) * (c2 / (double)c);
    if(c3!=0) mem[c1][c2][c3] += myfun(mem, c1, c2+1, c3-1, n) * (c3 / (double)c);

    return mem[c1][c2][c3];
  }
}

Measured memory_bytes: 306448
// IO library
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>

// container library
#include <deque>
#include <list>
#include <map>
#include <set>
#include <string>
#include <vector>

// namespace
using namespace std;

// typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;

// container
#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); i++)
#define SORT(c) sort((c).begin(), (c).end())
#define GSORT(c) sort((c).begin(), (c).end(), greater<typeof((c).front())>())
#define SZ(x) ((int)(x).size())
#define MEMSET(c, v) memset((c), v, sizeof(c))

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define NREP(i, n) FOR(i, 1, n + 1)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define RREP(i, n) RFOR(i, n, 0)
#define RNREP(i, n) RFOR(i, n, 1)

// constant
// const ll MOD = 1e9 + 7;
// const int INF = 1e9;
// const ll INF = 1e15;
// const int dx[4] = {0, -1, 1, 0};
// const int dy[4] = {-1, 0, 0, 1};
// const int dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
// const int dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1};

// debug
#define test(x) cout << #x << " = " << x << endl

// answer output
#define Yes(c) cout << ((c) ? "Yes" : "No") << endl;
#define YES(c) cout << ((c) ? "YES" : "NO") << endl;
#define possible(c) cout << ((c) ? "possible" : "impossible") << endl;
#define POSSIBLE(c) cout << ((c) ? "POSSIBLE" : "INPOSSIBLE") << endl;


// --------------------------------------------------------


int main() {
  string s;
  cin >> s;
  Yes(s[0] == '9' || s[1] == '9');
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 100000
#define S 200000000

typedef struct {
  char m;
  int v;
}Card;

Card L[N/2+2], R[N/2+2];

int partition(Card A[], int p, int r){
  int i, j, temp1v, temp2v;
  char temp1m, temp2m;
  Card x;

  x.m = A[r].m;
  x.v = A[r].v;
  i = p-1;
  for(j=p; j<r; j++){
    if(A[j].v<=x.v){
      i = i+1;
      temp1v = A[i].v;
      temp1m = A[i].m;
      A[i].v = A[j].v;
      A[i].m = A[j].m;
      A[j].v = temp1v;
      A[j].m = temp1m;
    }
  }
  temp2v = A[i+1].v;
  temp2m = A[i+1].m;
  A[i+1].v = A[r].v;
  A[i+1].m = A[r].m;
  A[r].v = temp2v;
  A[r].m = temp2m;
  return i+1;
}

void quickSort(Card A[], int p, int r){
  int q=0;

  if(p<r){
    q = partition(A, p, r);
    quickSort(A, p, q-1);
    quickSort(A, q+1, r);
  }
}

void merge(Card A[], int l, int m, int r){
  int i, j, k;
  int n1 = m-l, n2 = r-m;

  for(i=0; i<n1; i++){
    L[i] = A[l+i];                                                                  
  }
  for(i=0; i<n2; i++){
    R[i] = A[m+i];                                                                  
  }
  L[n1].v = R[n2].v = S;
  i = j = 0;
  for(k=l; k<r; k++){
    if(L[i].v <= R[j].v){                                                                
      A[k] = L[i++];
    } else {
      A[k] = R[j++];                                                               
    }
  }
}

void mergeSort(Card A[], int l, int r){
    int m;
    if(l+1<r){
      m = (l+r)/2;
      mergeSort(A, l, m);
      mergeSort(A, m, r);
      merge(A, l, m, r);
    }
}

int main(){

  int i, v, n, stable=1;
  char str[10];
  Card A[N], B[N];

  scanf("%d", &n);
  for(i=0; i<n; i++){
    scanf("%s %d", str, &v);
    A[i].m = str[0];
    A[i].v = v;
  }

  for(i=0; i<n; i++){
    B[i].m = A[i].m;
    B[i].v = A[i].v;                            
  }

  mergeSort(A, 0, n);
  quickSort(B, 0, n-1);

  for(i=0; i<n; i++){
    if(A[i].m != B[i].m) stable = 0;
  }

  if(stable == 1) printf("Stable\n");
  else printf("Not stable\n");
  for(i=0; i<n; i++){
    printf("%c %d\n", B[i].m, B[i].v);
  }

  return 0;
}

Measured memory_bytes: 2956
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll a, b, c, k;
  cin >> a >> b >> c >> k;
  cout << (k % 2 ? -a + b : a - b) << endl;
}

Measured memory_bytes: 3592
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <numeric>
#include <random>
#include <algorithm>
#include <functional>
#include <cassert>

using namespace std;
typedef long long ll;

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

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int S,W;
  cin>>S>>W;
  cout<<(S<=W ? "unsafe" : "safe")<<endl;
}


Measured memory_bytes: 3632
// #pragma GCC target("avx2")
#pragma GCC optimize("O3", "unroll-loops")

// #include <bits/extc++.h>
// using namespace __gnu_pbds;

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

#define int long long
#define double long double
// template <typename T>
// using pbds_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using pii = pair<int, int>;
template<typename T>
using prior = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using Prior = priority_queue<T>;

#define X first
#define Y second
#define ALL(x) (x).begin(), (x).end()
#define eb emplace_back
#define pb push_back

#define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define RANDOM() random_device __rd; \
                 mt19937 __gen = mt19937(__rd()); \
                 uniform_int_distribution<int> __dis(0, 1); \
                 auto rnd = bind(__dis, __gen);

const int INF = 1E18;
const int mod = 1E9 + 7;

int32_t main() {
    fastIO();
    
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    
    if (abs(a - c) <= d or (abs(a - b) <= d and abs(b - c) <= d)) cout << "Yes\n";
    else cout << "No\n";
    
    return 0;
}

Measured memory_bytes: 256
h,w,a,b=map(int,input().split())

for i in range(b):
    ans=''
    for j in range(a):
        ans+='0'
    for k in range(w-a):
        ans+='1'
    print(ans)
    
for i in range(h-b):
    ans=''
    for j in range(a):
        ans+='1'
    for k in range(w-a):
        ans+='0'
    print(ans)
    


Measured memory_bytes: 3956
#include <iostream>
using namespace std;
#define MAX 1005

int n, A[MAX];

void ro(int b, int m, int e) {
	int i, j;
	for (i = 0; i < e - m; i++) {
		int temp = A[e - 1];
		for (j = e - 2; j >= b; j--) {
			A[j + 1] = A[j];
		}
		A[b] = temp;
	}
}

int main(void) {
	int i, q, b, m, e;
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> A[i];
	}
	cin >> q;
	while (q--) {
		cin >> b >> m >> e;
		ro(b, m, e);
	}
	for (i = 0; i < n; i++) {
		if (i) cout << " ";
		cout << A[i];
	}
	cout << endl;
}



Measured memory_bytes: 3120
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	Scanner sc = new Scanner(System.in);
	public void run() {
		while(sc.hasNext()){
			int n = sc.nextInt();
			int m = sc.nextInt();
			int p = sc.nextInt();
			if(n == 0 && m == 0 && p == 0)break;
			else calc(n, m, p);
			
		}
	}
	public void calc(int n, int m, int p){
		int[][][] map = new int[n][n][n];
		int col = 1;
		boolean ans = false;
		for(int i = 1; i < p + 1; i++){
			int x = sc.nextInt()-1;
			int y = sc.nextInt()-1;
			if(!ans){
				for(int j = 0; j < n; j++){
					if(map[x][y][j] == 0){
						map[x][y][j] = col;
						ans = check(map, x, y, j, n, m, col);
						if(ans){
							if(col == 1) System.out.println("Black "  + i);
							else System.out.println("White " + i);
						}
						col = col * -1;
						break;
					}
				}
			}
		}
		if(!ans) System.out.println("Draw");
	}
	
	public boolean check(int[][][] map, int x, int y, int z, int n, int m, int col){
		ArrayList<int[]> v = new ArrayList<int[]>();
		v.add(new int[]{1,0,0});
		v.add(new int[]{0,1,0});
		v.add(new int[]{0,0,1});
		v.add(new int[]{1,1,0});
		v.add(new int[]{1,0,1});
		v.add(new int[]{0,1,1});
		v.add(new int[]{1,1,1});
		v.add(new int[]{1,-1,0});
		v.add(new int[]{1,0,-1});
		v.add(new int[]{0,1,-1});
		v.add(new int[]{1,1,-1});
		v.add(new int[]{1,-1,1});
		v.add(new int[]{-1,1,1});
		
		for(int count = 0; count < 13; count++){
			int[] ve = v.get(count);
			int c = 0;
			for(int i = -2 * n; i < 2 * n + 1; i++){
				int nX = ve[0]*i + x;
				int nY = ve[1]*i + y;
				int nZ = ve[2]*i + z;
				if(0 <= nX && nX < n && 0 <= nY && nY < n && 0 <= nZ && nZ < n){
					if(map[nX][nY][nZ] == col) {
						c++;
						if(c == m) return true;
					}
					else c = 0;
				}
			}
		}
		return false;
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 62232
#include <iostream>
#include <cmath>
#include <algorithm>
#define ll long long
using namespace std;
const int MAXN = 2e5+5;
int a[MAXN];
ll f(ll n)
{
    return n == 1 ? 1 : 1+2LL*f(n/2);
}
int main()
{
    ll n;
    cin>>n;
    cout<<f(n)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <cassert>
#include <random>

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

using namespace std;
typedef long long int ll;
const ll INF = 10000000000;
const double PI = acos(-1);
const ll mod = 1000000007;

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

    rep(i, n) {
        cout << ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 3976
#include<iostream>
#include<cstring>
using namespace std;
bool used[55][55];
int n,m;

void check(int x,int y){
	if(x<0 || n<=x || y<0 || m<=y)return;
	if(used[x][y])return;
	used[x][y]=true;
	for(int i=-1;i<=1;i++){
		for(int j=-1;j<=1;j++){
			check(x+i,y+j);
		}
	}
}

int main(){
	int i,j,k;
	int a,b,c;
	while(cin>>m>>n){
		if(!n)break;
		memset(used,false,sizeof(used));
		for(i=0;i<n;i++){
			for(j=0;j<m;j++){
				cin>>a;
				if(a==0)used[i][j]=true;
			}
		}
		a=0;
		for(i=0;i<n;i++){
			for(j=0;j<m;j++){
				if(!used[i][j])check(i,j),a++;
			}
		}
		cout<<a<<endl;
	}
}



Measured memory_bytes: 3188
def solve():
    L, R = map(int, input().split())
    mod = 2019
    table = [[0]*2019 for _ in range(2019)]
    for i in range(2019):
        for j in range(2019):
            table[i][j] = i*j%mod
    ans = 10**7
    if R-L>=2018:
        for i in range(2019):
            for j in range(i+1,2019):
                ans = min(ans,table[i][j])
        return ans
    r = R%mod
    l = L%mod
    if r>=l:
        for i in range(l,r+1):
            for j in range(i+1,r+1):
                ans = min(ans,table[i][j])
        return ans
    for i in range(2019):
        if i<=r or i>=l:
            for j in range(i+1,2019):
                if j<=r or j>=l:
                    ans = min(ans,table[i][j])
    return ans
print(solve())

Measured memory_bytes: 74076
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve(){
	ll a, b, c, d;
	scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
	if(a < b || d < b) {
		puts("No");
		return;
	}
	ll gc = __gcd(b, d);
	ll p1 = (a - b) / gc;
	if(a - p1 * gc >= b) p1++;
	assert(a - p1 * gc < b);
	ll p2 = (a - c) / gc;
	if(a - p2 * gc <= c) p2--;
	assert(a - p2 * gc > c);
	if(p2 >= p1) puts("No");
	else puts("Yes");
	//there should be p such that a - p * gc is between b and c
}
int main(){
	int t;
	scanf("%d", &t);
	while(t--) solve();
	return 0;
}

Measured memory_bytes: 256
a, b, c = map(int,input().split())
at = 0
bt = 0
ct = 0

if a == 5 :
    at += 1
elif a == 7 :
    at += 10

if b == 5 :
    bt += 1
elif b == 7 :
    bt += 10

if c == 5 :
    ct += 1
elif c == 7 :
    ct += 10


if  at + bt + ct == 12 :
    print("YES")

else :
    print("NO")

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

void Print(int a[], int p){
	for(int i=0; i<p; ++i){
		if(i>0) printf(" ");
		printf("%d", a[i]);	
	}	
	printf("\n");
}

int main(){
	int n;
	int a[100];
	
	scanf(" %d", &n);
	for(int i=0; i<n; ++i) scanf(" %d", &a[i]);
	
	for(int i=0; i<n; ++i){
		int v=a[i];
		int j=i-1;
		
		while(j>=0 && a[j]>v){
			a[j+1]=a[j];
			j--;
		}
		a[j+1]=v;
		
		Print(a, n);
	}
		
}


Measured memory_bytes: 3232
#include<iostream>
#include<string>
#include<cctype>
using namespace std;
int main(){
  int n,k;
  string str;
  cin>>n>>k;
  cin>>str;
  
  k--;
  str[k]=tolower(str[k]);//k番目の文字を小文字化
  cout<<str<<endl;
  return(0);
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define fst first
#define snd second
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
#define pb push_back
#define for_tests(t, tt) int t; scanf("%d", &t); for(int tt = 1; tt <= t; tt++)
#ifndef ONLINE_JUDGE
#define debug(args...) fprintf(stderr,args)
#else
#define debug(args...)
#endif //ONLINE_JUDGE
template<typename T> inline T abs(T t) { return t < 0? -t : t; }
const ll modn = 1000000007;
inline ll mod(ll x) { return x % modn; }
#define IOS() ios::sync_with_stdio(0),cin.tie(0)

const int MAXN = 1000056;


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

int s[MAXN];
int n, m, k;
int mrk[MAXN];

int main (){
	scanf("%d", &n);
    ll gc = 0;
	for(int a=0;a<n;a++){
        scanf("%d", s+a);
        mrk[s[a]]++;
        gc = gcd(gc, s[a]);
	}
    if(gc > 1){
        puts("not coprime");
        return 0;
    }
    for(ll v=2;v<MAXN;v++){
        int cnt = 0;
        for(ll m=1;v*m<MAXN;m++){
            cnt += mrk[v*m]; 
        }
        if(cnt > 1){
            puts("setwise coprime");
            return 0;
        }
    }
    puts("pairwise coprime");
}



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

int N;

bool prime[20000005];

signed main(){
  
  cin>>N;
  
  for(int i=0;i<20000005;i++) prime[i] = true;
  
  prime[0] = prime[1] = false;
  
  for(int i=2;i*i<20000005;i++){
    
    if( prime[i] == false ) continue;
    
    for(int j=i+i;j<20000005;j+=i){
      prime[j] = false;
    }
    
  }
  
  int ans = 0;
  
  for(int i=2;i<=N;i++){
    
    if( prime[i] == false ) continue;
    
    if( prime[i+2] == true ) ans++;
    
  }
  
  cout<<ans*2<<endl;
  
  return 0;
}



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

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

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

#define INF 1e16
#define mod 1000000007

int n,m;
bool used[200010];
vector<int> a;

int main(){
  cin>>n>>m;
  rep(i,m){
    int aa;
    cin>>aa;
    aa--;
    a.push_back(aa);
  }
  reverse(all(a));
  vector<int> res;
  rep(i,m){
    if(used[a[i]])continue;
    used[a[i]]=true;
    res.push_back(a[i]);
  }
  rep(i,n)if(!used[i])res.push_back(i);
  rep(i,n)cout<<res[i]+1<<endl;
  return 0;
}



Measured memory_bytes: 4520
import sys

def resolve():
    A, B, K = list(map(int, input().split(" ")))
    out = []
    for i in range(A, A+K):
        if i <= B:
            out.append(i)
    for j in range(B-K+1, B+1):
        if j >= A and not j in out:
            out.append(j)
    
    [print(s) for s in out]

if '__main__' == __name__:
    resolve()

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

using namespace std;

int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= 46297; i++) {
        if ((floor)(i * 1.08) == n) {
            cout << i << endl;
            return 0;
        }
    }
    cout << ":(" << endl;
    return 0;
}

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

int main() {
  long long a, b;
  cin >> a >> b;
  
  if(a % 2 != b % 2) {
    cout << "IMPOSSIBLE" << endl;
  } else {
    cout << (a + b) / 2 << endl;
  }
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7

num = [0] * 60
for i in a:
    temp = bin(i + 2 ** 60)[3:]
    for i in range(len(temp)):
        if temp[i] == "1":
            num[i] += 1
ans = 0
for i in range(60):
    ans += (num[i] * (n - num[i]) * (2 ** (59 - i)))
    ans %= mod
print(ans)

Measured memory_bytes: 122808
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cctype>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)

int n, dp[1002][1002];
string in[1002];

void solve() {
  memset(dp, 0, sizeof dp);
  if(in[0][0]=='.') dp[0][0]=1;
  for(int i=1;i<n;++i) {
    dp[0][i]=in[0][i]=='.'?1:0;
    dp[i][0]=in[i][0]=='.'?1:0;
  }
  int ans = 0;
  for(int i=1;i<n;++i) {
    for(int j=1;j<n;++j) {
      if(in[i][j]=='*') continue;
      dp[i][j]=min(dp[i-1][j-1], min(dp[i-1][j],dp[i][j-1]))+1;
      ans=max(ans,dp[i][j]);
    }
  }
  // rep(i,n) {
  //   rep(j,n) printf("%3d",dp[i][j]); puts("");
  // }
  printf("%d\n",ans);
}

int main() {
  while (cin>>n,n) {
    rep(i,n) cin>>in[i];
    solve();
  }
  return 0;
}

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

int main()
{
  int N;
  string s;
  cin >> N >> s;
  
  int r = 0, b = 0;
  for (int i = 0; i < N; i++)
  {
    if (s.at(i) == 'R') r++;
    else b++;
  }
  
  string ans = "No";
  if (r > b) ans = "Yes";
  
  cout << ans << endl;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let w = read::<usize>();
    let h = read::<usize>();
    let x = read::<usize>();
    let y = read::<usize>();
    let s = (w * h) as f64 / 2.0;
    let ans = if w % 2 == 0 && h % 2 == 0 && x == w / 2 && y == h / 2 {
        1
    } else {
        0
    };
    println!("{:.10} {}", s, ans);
}

Measured memory_bytes: 4352
#include <stdio.h>

int isprime(int n) {
  int i;
  for(i = 2; i * i <= n; i++) {
    if(n % i == 0) return 0;
  }
return 1;
}

int main(){
  int n, i;
  while(1){
    scanf("%d", &n);
    if(n == 0) break;
    for(i=n ; i >= 5 ; i--){
      if(isprime(i) && isprime(i-2)) break;
    }
    printf("%d %d\n", i - 2, i);
  }
  return 0;
}

Measured memory_bytes: 1804