akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,ac=0,wa=0,tle=0,re=0,i;
    cin >> n;
    string str;
    for(i=0;i<n;i++)
    {
        cin >> str;
        if(str=="AC")
        {
            ac++;
        }
        if(str=="WA")
        {
            wa++;
        }
        if(str=="TLE")
        {
            tle++;
        }
        if(str=="RE")
        {
            re++;
        }
    }
    cout << "AC x " <<ac << endl;
    cout << "WA x " <<wa << endl;
    cout << "TLE x " <<tle << endl;
    cout << "RE x " <<re << endl;
}


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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) ((a+b-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/2

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> void YesNo(T a) {cout<<(a?"Yes":"No")<<endl;}
template<class T> void YESNO(T a) {cout<<(a?"YES":"NO")<<endl;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
void uniq(vector<int> &vec){sort(vec.begin(), vec.end());vec.erase(unique(vec.begin(), vec.end()), vec.end());}
void start(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);}

const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

signed main() {start();COMinit();
    int n,k;
    cin>>n>>k;
    REP(i,1,k+1){
        int b = COM(k-1,i-1);
        int a = COM(n-k+1,i);
//        cout<<a<<endl<<b<<endl;
        cout<<(a*b)%MOD<<endl;
    }
    return 0;
}


Measured memory_bytes: 12288
#include <iostream>
#include <cmath>
#define N 999999
using namespace std;

int arr[N];

void Eratosthenes(){
	for(int i = 0; i < N; i++){
		arr[i] = 1;
	}
	for(int i = 2; i < sqrt(N); i++){
		if(arr[i]){
			for(int j = 0; i * (j + 2) < N; j++){
				arr[i *(j + 2)] = 0;
			}
		}
	}
	return;
}

int main(){
	int i,j=0,n,pn;
	while(cin>>n){
		pn=0;
		Eratosthenes();
		for(i=2 ; i<=n ; i++){
			if(arr[i]==1) pn++;
		}
		cout << pn << endl;
		
	}
	return 0;
}

Measured memory_bytes: 5064
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

const double PI = acos(-1.0);
const double INF = DBL_MAX / 10;

int n, m;
vector<double> angle;
vector<vector<vector<double> > > memo;

double solve(int x, int y, int rest)
{
    if((y - x + n - 1) % n < rest)
        return INF;

    if(memo[x][y][rest] > -0.5)
        return memo[x][y][rest];

    if(rest == 0){
        double d = angle[y] - angle[x];
        if(d < 0.0)
            d += 2 * PI;

        double ret;
        if(d < PI){
            ret = d / 2.0 - sin(d) / 2.0;
        }else{
            ret = d / 2.0 + sin(2 * PI - d) / 2.0;
        }
        return memo[x][y][0] = ret;
    }

    double ret = INF;
    for(int i=(x+1)%n; i!=y; (++i)%=n){
        int a = 0;
        int b = rest - 1;
        while(b >= 0){
            double tmp = solve(x, i, a) + solve(i, y, b);
            ret = min(ret, tmp);
            ++ a;
            -- b;
        }
    }
    return memo[x][y][rest] = ret;
}

int main()
{
    for(;;){
        cin >> n >> m;
        if(n == 0)
            return 0;

        angle.resize(n);
        for(int i=0; i<n; ++i){
            cin >> angle[i];
            angle[i] *= 2 * PI;
        }

        memo.assign(n, vector<vector<double> >(n, vector<double>(m, -1.0)));
        double ret = INF;
        for(int i=0; i<n; ++i)
            ret = min(ret, solve(i, i, m-1));
        ret = PI - ret;

        printf("%0.6f\n", ret);
    }
}

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

int top, S[1000];

void push(int x){
	S[++top] = x;
}


int pop(){
	top--;
	return S[top+1];
}

int main() {
 	int a,b;
	top = 0;
	char s[100];
	
	while( scanf("%s",s) != EOF){
		if( s[0] == '+'){
			a = pop();
			b = pop();
			push(a+b);
		}else if( s[0]=='-'){
			b = pop();
			a = pop();
			push(a - b);
		}else if( s[0] == '*'){
			a = pop();
			b = pop();
			push(a*b);
		}else {
			push(atoi(s));
		}
	}
	
	printf("%d\n",pop());
	
	return 0;
}


Measured memory_bytes: 2088
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>

using namespace std;

void search(vector<set<int> > &v,
	 		vector<bool > &used,
	 		vector<int > &add,
	 		int cur_v,
	 		int cur_val,
	  		vector<int > &ans) {
	if (used[cur_v] == true) {
		return;
	}
	used[cur_v] = true;

	int value = cur_val + add[cur_v]; 
	ans[cur_v] = value;


	for (int next_v : v[cur_v]) {
		search(v,used, add, next_v, value, ans);
	}
}
	

int main() {
	int n, q;
	cin >> n >> q;

	vector<set<int> > v(n);
	vector<bool > used(n, false);
	vector<int > add(n,0);
	vector<int > ans(n + 1,0);


	for (int i = 0; i < n - 1; i++) {
		int a, b;
		cin >> a >> b;
		a--; b--;

		v[a].insert(b);
		v[b].insert(a);
	}

	for (int i = 0; i < q; i++) {
		int p,x;
		cin >> p >> x;
		p--;
		add[p] += x;
	}

	search(v, used, add, 0, 0,ans);
	
	for (int i = 0; i < n; i++) {
		cout << ans[i] << " ";
	}
	
	cout << endl;

	return 0;
}


Measured memory_bytes: 39936
#include "iostream"
#include "string"

using namespace std;

int main() {
	int n;
	cin >> n;
	int index = 0, max = -1, tmp = -1, count = 0;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		if (x <= tmp) {
			if(count == 0) index = i;
			count++;
		}
		if (x > tmp || i == n - 1) {
			if (max < count) max = count;
			count = 0;
		}
		tmp = x;
	}
	cout << max << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG
#endif
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define Clear(a) a = decltype(a)()
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define vec vector
typedef long long ll;
typedef pair<ll,ll> P;
//const ll big=998244353;
const ll big=1000000007LL;
const ll INF=1e18;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
if(x<y)return x;
else return y;
}
ll expm(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||x==0)return x;
    if(y%2==1)return (expm(x,y-1)*x)%big;
    ll t=expm(x,y/2);
    return (t*t)%big;
}
ll exp(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||y==0)return x;
    if(y%2==1)return exp(x,y-1)*x;
    ll t=exp(x,y/2);
    return t*t;
}

struct unionfind{
    vector<int> par;
    vector<int> size;
    unionfind(const int n):par(n,-1) , size(n,1){}
    int find(const int x){
        if(par[x]==-1)return x;
        return par[x]=find(par[x]);
    }
    void unite(int x,int y){
        x=find(x),y=find(y);
        if(x==y)return;
        if(size[x]>size[y])swap(x,y);
        par[x]=y;
        if(size[x]==size[y])size[y]++;
        return;
    }
};

int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    /*--------------------------------*/

    int n,q;cin >> n >> q;
    unionfind uf(n);
    rep(i,q){
        int t,u,s;cin >> t >> u>> s;
        if(t)cout << (uf.find(u)==uf.find(s)) << endl;
        else uf.unite(u,s);
    }
}

Measured memory_bytes: 4584
// -*- coding:utf-8-unix -*-

use std::cmp::*;
use std::collections::*;
use std::fs::File;
use std::io::prelude::*;
use std::io::*;
use std::vec;

const INF: i64 = 1223372036854775807;
const MEM_SIZE: usize = 202020;
const MOD: usize = 1000000007;
use std::cmp::*;
use std::collections::*;
use std::io::stdin;
use std::io::stdout;
use std::io::Write;
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

#[allow(unused_macros)]
macro_rules! p {
    ([$($x:expr), *]) => {{
        let mut f = true;
        $(
            print!("{}{}", if f {""} else {" "}, $x);
            f = false;
        )*
78786    print!("\n");
    }};
    ($x:expr) => {{
        let mut f = true;
        for a in $x.iter() {
            print!("{}{}", if f {""} else {" "}, a);
            f = false;
        }
        print!("\n");
    }};
}
#[allow(dead_code)]
fn readii() -> (i64, i64) {
    let mut str = String::new();
    let _ = stdin().read_line(&mut str).unwrap();
    let mut iter = str.split_whitespace();
    (
        iter.next().unwrap().parse::<i64>().unwrap(),
        iter.next().unwrap().parse::<i64>().unwrap(),
    )
}
#[allow(dead_code)]
fn readuu() -> (usize, usize) {
    let mut str = String::new();
    let _ = stdin().read_line(&mut str).unwrap();
    let mut iter = str.split_whitespace();
    (
        iter.next().unwrap().parse::<usize>().unwrap(),
        iter.next().unwrap().parse::<usize>().unwrap(),
    )
}

fn solve() {
    let (a, b, c, d) = {
        let s = {
            let mut s = String::new(); // バッファを確保
            std::io::stdin().read_line(&mut s).unwrap(); // 一行読む。失敗を無視
            s.trim_right().to_owned() // 改行コードが末尾にくっついてくるので削る
        };

        let mut ws = s.split_whitespace(); // 空白区切りの単語に分解する
        let n: i64 = ws.next().unwrap().parse().unwrap(); // イテレータから値を取り出して整数に
        let m: i64 = ws.next().unwrap().parse().unwrap();
        let p: i64 = ws.next().unwrap().parse().unwrap();
        let q: i64 = ws.next().unwrap().parse().unwrap();
        (n, m, p, q)
    };
    println!("{:?}", max(max(a * c, b * d), max(a * d, b * c)));

    return;
}
fn main() {
    solve()
}


Measured memory_bytes: 2136
def check(l,r):
    if r-l>=2019:
        return True
    if r%2019<l%2019:
        return True
    else:
        return False
l,r=map(int,input().split())
if check(l,r):
    print(0)
else:
    l%=2019
    r%=2019
    ans=2019
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            ans=min((i*j)%2019,ans)
    print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
 
#define rep(i, s, n) for(int i = s; i < n; ++i)
#define rrep(i, n) for(int i = n - 1; i > -1; --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
const long long INF = 1000000000;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<int, int> P;
 
int main(){
    int n;
    cin >> n;
    if(n % 2 == 0){
        cout << (float)1 / 2;
    }else{
        cout << (float)(n + 1) / (2 * n);
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fst ios_base::sync_with_stdio(false); cin.tie(NUint); cout.tie(NUint);
#define chk(x) cout << (#x) << " is " << (x) << endl
#define ll long long
using namespace std;
int main() {
    int n,i;
    cin >> n;
    int h[n],dp[n];
    for(i=0;i<n;++i) cin >> h[i];
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]); 
    for(i=2;i<n;++i) dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
    cout << dp[n-1];
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1e9+7
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
ll min(ll a,ll b){
  if(a>b){
    return b;
    }
      else{
        return a;
      }
  }
  
  ll max(ll a,ll b){
    if(a>b){
      return a;
    }
    else{
      return b;
    }
  }

ll power(ll a,ll b){
 ll ans=1;
 for(ll i=1;i<=b;i++){
ans*=a;
  }
  return ans;
}
int main(){
  ll N,M;
  cin>>N>>M;
    
    vector<pair<ll,ll>>C(N);
  priority_queue<ll>queue;
  
  rep(i,N){
    cin>>C[i].first>>C[i].second;
  }
  
  sort(all(C));
  ll ans=0;
  
  ll x=0;//足したものを再びチェックの対象にしないため
  for(ll i=M-1;i>=0;i--){//i日前
  
   
      while(x<N){
        if(i+C[x].first<=M){//M日に間に合うかどうかを全て確認
        queue.push(C[x].second);
       x++;
        }
        else{
          break;
        }
      }
if(!queue.empty()){//queueの最大値をたす
  ans+=queue.top();
  queue.pop();
}
  }

  
  cout<<ans<<endl;
}


Measured memory_bytes: 2936
//2020-05-18

#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int a,b,h,m;
    cin >> a >> b >> h >> m;
    
    double hAng = floor(h)*30 + m/60.0 * 30;
    double mAng = m/60.0*360;
    
    while (hAng >= 360){
        hAng -= 360;
    }
    
    while (mAng >= 360){
        mAng -= 360;
    }

    double ang = min(abs(hAng-mAng),abs(-hAng+mAng));
    
    ang = ang /180.0*M_PI;

    double hyp = pow(a*a+b*b-2*a*b*cos(ang),0.5);
    
    printf("%.10f",hyp);
    
    return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <algorithm>
#include <deque>


using namespace std;

int main(int argc, char** argv) {
    int n, k;
    cin >> n >> k;
    string str;
    cin >> str;

    int ans{0};
    bool prev_is_1{true};
    int prev_1s{0};
    deque<int> que;

    for (char c : str) {
        if (c == '0') {
            if (prev_is_1) {
                que.push_back(prev_1s);
                prev_1s = 0;
                if (que.size() == k+1) {
                    if (que.front() > ans) ans = que.front();
                    que.pop_front();
                }
            }
            prev_is_1 = false;
        } else {
            prev_is_1 = true;
            ++prev_1s;
        }
        for (auto it = que.begin(); it != que.end(); ++it) {
            ++(*it);
        }
    }
    if (ans == 0 && que.empty()) {
        cout << str.size() << endl;
        return 0;
    }
    if (que.front() > ans) ans = que.front();

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

typedef istringstream ISS;
typedef ostringstream OSS;
typedef vector<string> VS;
typedef int INT;
typedef vector<INT> VI;
typedef vector<VI> VVI;
typedef pair <INT, INT> II;
typedef vector <II> VII;

template<class T> ostream& operator << ( ostream& os, vector<T> v ) {
    for ( typename vector<T>::iterator it_i = v.begin(); it_i != v.end(); ++it_i ) {
        os << *it_i << ", ";
    }
    return os;
}


typedef pair <string, II> NODE;
typedef vector <NODE> NODES;

void solve( int n, NODES nodes ) {
    int ming = INT_MAX;
    VS L;
    VI ID(n);
    for ( int i = 0; i < n; ++ i ) {
        ID[i] = i;
    }
    do {
        int wsum = 0, g = 0;
        for ( int i = 0; i < n; ++ i ) {
            if ( wsum > nodes[ID[i]].second.second ) goto out_1;
            wsum += nodes[ID[i]].second.first;
        }
        for ( int i = 0; i < n; ++ i ) {
            g += ( n - i ) * nodes[ID[i]].second.first;
            if ( g >= ming ) goto out_1;
        }
        if ( g < ming ) {
            ming = g;
            VS T;
            for ( int i = 0; i < n; ++ i ) {
                T.push_back( nodes[ID[i]].first );
            }
            L = T;
        }
    out_1:;
    } while ( next_permutation( ID.begin(), ID.end() ) );

    reverse( L.begin(), L.end() );
    for ( int i = 0; i < n; ++ i ) {
        cout << L[i] << endl;
    }
}

int main() {
    int n;
    while ( cin >> n && n ) {
        NODES nodes( n );
        for ( int i = 0; i < n; ++ i ) {
            cin >> nodes[i].first >> nodes[i].second.first >> nodes[i].second.second;
        }
        solve( n, nodes );
    }
    return 0;
}

Measured memory_bytes: 920
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int x, a; cin >> x >> a;
	cout << (x >= a ? 10 : 0) << endl;
	
	return 0;
}

Measured memory_bytes: 256
#20131107

while true
	n,m = gets.split(" ").map{|e|e.to_i}
	break if n==0 && m==0
	t,h = [],[]
	n.times{t.push gets.to_i}
	m.times{h.push gets.to_i}

	diff = t.inject(:+) - h.inject(:+)
	sign = diff < 0 ? true : false
	flag = false
	t.each{|e1|
		h.each{|e2|
			if (e2-e1)*2 == diff.abs && sign 
				puts "#{e1} #{e2}"
				flag = true
			end
			if (e1-e2)*2 == diff.abs && !sign 
				puts "#{e1} #{e2}"
				flag = true
			end

			break if flag
		}
		break if flag
	}

	puts -1 if !flag
end

Measured memory_bytes: 6112
#include <iostream>
#include <utility>
#include <stdint.h>

using namespace std;

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

  switch(N%10) {
  case 2:
  case 4:
  case 5:
  case 7:
  case 9:
    cout << "hon" << endl;
    break;
  case 0:
  case 1:
  case 6:
  case 8:
    cout << "pon" << endl;
    break;
  default:
    cout << "bon" << endl;
  }

  return 0;
}


Measured memory_bytes: 3592
import java.util.*;
public class Main{
  public static void main(String[]args){
      Scanner sc = new Scanner(System.in);


      int[] data = new int[3];


      for (int i = 0;i<3 ;i++ ) {
        data[i] = sc.nextInt();
      }
      int k = sc.nextInt();
      Arrays.sort(data);
      for (int i = 0;i<k ;i++ ) {
        data[2] = data[2]*2;
      }

      System.out.println(data[0]+data[1]+data[2]);

      }
    }


Measured memory_bytes: 21844
def check(n):

    if n <= P-1:
        return True
    
    if A[n]+M < A[P-1]:
        return False
    
    votes = (P+N-1-n)*M + sum([A[n]+M-A[i] for i in range(P-1,n)])

    if votes < M*V:
        return False
    else:
        return True

N,M,V,P = map(int,input().split())
A = list(map(int,input().split()))

A.sort(reverse=True)

right = N-1
left = 0

if check(right):
    print(N)
    exit()

while abs(right-left) > 1 and check(left) and not check(right):

    mid = (right+left)//2

    if check(mid):
        left = mid
    else:
        right = mid

print(left+1)

Measured memory_bytes: 14480
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace Main
{
    public static class Program
    {
        public static List<int> list = new List<int>();
 
        static void Main(string[] arg)
        {
            var input = GetIntList(Console.ReadLine());
            var answer = "Yes";
 
            int a = Math.Abs(input[1]-input[0]);
 
            if(Math.Min(input[0],input[1]) > input[2]){
                answer = "No";
            }
            else if(Math.Max(input[0],input[1]) < input[2]){
                answer = "No";
            }
            // else{
            //     int cmod = Math.Max(a,input[2]) % Math.Min(a,input[2]);
            //     answer = 0==cmod?"Yes":"No";
            // }
 
 
            Console.WriteLine(answer);
            Console.ReadLine();
 
        }
        
        #region libraries
        private static int[] GetIntList(string line)
        {
            return line.Split(' ').Select(x => int.Parse(x)).ToArray();
 
        }
        private static double[] GetDoubleList(string line)
        {
            return line.Split(' ').Select(x => double.Parse(x)).ToArray();
 
        }
        private static ulong[] GetUlongList(string line)
        {
            return line.Split(' ').Select(x => ulong.Parse(x)).ToArray();
        }
        private static long[] GetLongList(string line)
        {
            return line.Split(' ').Select(x => long.Parse(x)).ToArray();
        }
        private static int SearchNearest(this IEnumerable<int> list, int target)
        {
            var min = list.Min(c => Math.Abs(c - target));
            return list.First(c => Math.Abs(c - target) == min);
        }
        public static bool IsOdd(int i)
        {
            return i % 2 == 1 ? true : false;
        }
        public static int Gcd(int a,int b)
        {
            if(a < b)
            {
                Gcd(b, a);
            }
            while (b != 0)
            {
                var rm = a % b;
                a = b;
                b = rm;
            }
            return a;
        }
        #endregion
    }
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define F(i,s,e) for(ll i=s;i<e;++i)

int main()
{
    long int n;
    cin >> n;
    long int a[n];
    F(i,0,n) cin >> a[i];

    long int ans=0;
    F(i,0,n-1){
        if(a[i] > a[i+1]){
            ans += a[i]-a[i+1];
            a[i+1] = a[i];
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 5132
// A

#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;

int main(){
  string s;
  cin>>s;
  if (s[6]-'0' >= 5 || s[5] - '0' != 0) cout << "TBD" << endl; 
  else cout << "Heisei" << endl;
  return 0;
}


Measured memory_bytes: 768
d = int(input())
c = list(map(int,input().split()))
s = []
day = [0 for i in range(26)]
for i in range(d):
    s.append(list(map(int,input().split())))
ans = 0
num = 1
for i in range(d):
    t = int(input())-1
    day[t] = num
    for j in range(26):
        if j == t:
            ans += s[i][j]
        else:
            ans -= c[j]*(num-day[j])
    print(ans)
    num += 1

Measured memory_bytes: 9264
//                        DushtuBunny
//                        Rahul Halder    
//    Indian Institute of Engineering Science & Technology,Shibpur


#include <bits/stdc++.h>

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define f first
#define se second
#define LB lower_bound
#define UB upper_bound
#define pb push_back
#define mp make_pair
#define vll vector<ll>
#define vi vector<int>
#define vc vector<char>
#define vpll vector<pair<ll,ll>>
const unsigned int MOD = 1000000007;

using namespace std;

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

    IOS;
    int T;
    // cin>>T;
    T=1;

    while(T--)
    {
        ll n,m;
        cin>>n>>m;

        ll h[n+1];

        for(ll i=1;i<=n;i++)
            cin>>h[i];

        vector<vector<ll>>v(n+1);
        // cout<<m;

        for(ll i=0;i<m;i++)
        {
            ll x,y;
            cin>>x>>y;
            v[x].pb(y);
            v[y].pb(x);
        }

        ll ans=0;
        for(ll i=1;i<=n;i++)
        {
            if(v[i].size()==0){
                ans++;
                continue;
            }

            ll flag=1;
            for(ll j=0;j<v[i].size();j++)
            {
                if(h[i]<=h[v[i][j]])
                {
                    flag=0;
                    break;
                }
            }

            if(flag)
                ans++;
        }

        cout<<ans;
    }
    

    return 0;
}

Measured memory_bytes: 9744
local n, p = io.read("*n", "*n")
local dst = 0
local t = {}
for i = 1, n do
  local w, b = io.read("*n", "*n")
  dst = dst + b
  t[i] = (100 - p) * w + p * b
end
dst = dst * p
table.sort(t)
for i = n, 1, -1 do
  dst = dst - t[i]
  if dst <= 0 then
    print(n + 1 - i)
    break
  end
end


Measured memory_bytes: 2424
n=int(input())
g=[[] for _ in range(n)]
for _ in range(n-1):
    a,b=map(int,input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)
res=[0]*n
res[0]=1
res[n-1]=-1
q=[0,n-1]
while q:
    qq=[]
    for i in q:
        v=res[i]
        for j in g[i]:
            if not res[j]:
                res[j]=v
                qq.append(j)
    q=qq
if sum(res)>0:
    print("Fennec")
else:
    print("Snuke")
                

Measured memory_bytes: 58656
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;



int main()
{
    ll n,i,j,m,t,sum=0,zeroj=-1,tt=0,f,k,s;
    cin>>n>>k;
    f=n%k;
    s=abs(f-k);
    if(f<s)
    cout<<f;
    else
    cout<<s;
    
    return 0;
}





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

int main()
{
    int x1,y1,x2,y2,x3,y3,x4,y4;
    cin>>x1>>y1>>x2>>y2;
    x3 = x2 - y2 + y1;
    y3 = x2 - x1 + y2;
    x4 = x1 - y2 + y1;
    y4 = x2 - x1 + y1;
    cout<<x3<<" "<<y3<<" "<<x4<<" "<<y4;
}



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

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


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);

int main() {
    ll n, k;
    cin >> n >> k;
    vector<bool> have(n, false);
    rep(i, k) {
        ll d;
        cin >> d;
        rep(j, d) {
            ll tmp;
            cin >> tmp;
            tmp--;
            have[tmp] = true;
        }
    }
    ll ans = 0;
    rep(i, n) {
        if(!have[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        ret %= MOD;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count))%MOD;
}

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

ll inv(ll a) {
    return a_n(a, MOD-2);
}



Measured memory_bytes: 3600
require 'complex'
def divisors(n)
    cnt = 0
    for i in 1..(Math.sqrt(n).ceil) do
        if n % i == 0 and n / i - 1 > i then
            cnt += n / i - 1     
        end
    end
    return cnt
end

N = gets.chomp.to_i

puts divisors(N)


Measured memory_bytes: 1788
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		if (a - b == 0) {
			System.out.print(c);
		} else if (c - a == 0) {
			System.out.print(b);
		} else {
			System.out.print(a);
		}
	}
}

Measured memory_bytes: 21588
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define MP make_pair
#define PB push_back
#define ll long long
#define int long long
#define f(i,x,n) for(int i=x;i<n;i++)
#define ld long double
const int mod=1000000007;
const int INF=1e18;
int n,m;
string s[105];
int a[105][105];
int dp[105][105][2];
int dfs(int i,int j,int state)
{
	int &an=dp[i][j][state];
	if(an!=-1)
		return an;
	if(i==n&&j==m+1)
		return an=0;
	if(i>n||j>m)
		return an=mod;
	if(state==0)
	{
		if(a[i][j]==0)
		{
			an=1+min(dfs(i+1,j,1),dfs(i,j+1,1));
		}
		else
		{
			an=min(dfs(i+1,j,0),dfs(i,j+1,0));
		}
	}
	else
	{
		if(a[i][j]==0)
		{
			an=min(dfs(i+1,j,1),dfs(i,j+1,1));
		}
		else
		{
			an=min(dfs(i+1,j,0),dfs(i,j+1,0));
		}
	}
	return an;
}
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	f(i,0,105)
		f(j,0,105)
			f(k,0,2)
				dp[i][j][k]=-1;
	cin>>n>>m;
	f(i,0,n)
		cin>>s[i];
	f(i,1,n+1)
		f(j,1,m+1)
		{
			if(s[i-1][j-1]=='.')
				a[i][j]=1;
		}
	// if(a[1][1]==0)
	// 	cout<<1+dfs(1,1,1)<<'\n';
	// else
		cout<<dfs(1,1,0)<<'\n';
	return 0;
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc.B
{
    public class Question
    {
        public static void Main(string[] args)
        {
            new Question().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            int n = cin.ReadInt;
            int sqn = (int)Math.Sqrt(n);
            Console.WriteLine(sqn * sqn);
        }

        public class ConsoleInput
        {
            private readonly System.IO.TextReader _stream;
            private char _separator = ' ';
            private Queue<string> inputStream;
            public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
            {
                this._separator = separator;
                this._stream = stream;
                inputStream = new Queue<string>();
            }
            public string Read
            {
                get
                {
                    if (inputStream.Count != 0) return inputStream.Dequeue();
                    string[] tmp = _stream.ReadLine().Split(_separator);
                    for (int i = 0; i < tmp.Length; ++i)
                        inputStream.Enqueue(tmp[i]);
                    return inputStream.Dequeue();
                }
            }
            public string ReadLine { get { return _stream.ReadLine(); } }
            public int ReadInt { get { return int.Parse(Read); } }
            public long ReadLong { get { return long.Parse(Read); } }
            public double ReadDouble { get { return double.Parse(Read); } }
            public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
            public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
            public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
        }
    }
}


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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int inf=1<<30;
const long long int infll=1LL<<58;
const double eps=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    int n,m;
    cin >> n >> m;
    vector<int> s(n),t(n),p(m);
    rep(i,0,n) cin >> s[i] >> t[i];
    rep(i,0,m) cin >> p[i];

    p.emplace_back(0);
    p.emplace_back(inf);
    sort(p.begin(),p.end());
    vector<int> sum(m+2);
    sum[0]=p[0];
    sum[1]=p[1]-p[0];
    rep(i,2,m+2) sum[i]=sum[i-2]+p[i]-p[i-1];

    ll ans=0;
    rep(i,0,n){
        auto it1=lower_bound(p.begin(),p.end(),s[i]),it2=lower_bound(p.begin(),p.end(),t[i]);
        int idx1=it1-p.begin(),idx2=it2-p.begin();
        if(s[i]<t[i]){
            ans+=p[idx1]-s[i];
            if(idx1%2==idx2%2) ans+=sum[idx2-2]-sum[idx1]-p[idx2-1]+t[i];
            else ans+=sum[idx2-1]-sum[idx1];
        }else{
            ans+=s[i]-p[idx1-1];
            if(idx1%2==idx2%2) ans+=sum[idx1-2]-sum[idx2]+p[idx2]-t[i];
            else ans+=sum[idx1-2]-sum[idx2-1];
        }
    }
    cout << ans << endl;
}

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    cout << fixed << setprecision(8);
    solve();
    return 0;
}

Measured memory_bytes: 4404
#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;

int main() {
    int N, K, S;
    scanf("%d %d %d", &N, &K, &S);
    for (int i = 0; i < K; i++)
        printf("%d ", S);
    int rem = (N - K);
    if (!rem) return !printf("\n");
    for (int i = K; i < N; i++) {
        if (S == (int)1e9) printf("1 ");
        else printf("%d ", S + 1);
    }
    puts("");


    return 0;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a = 700;
  char s[4];
  cin >> s;
  for(int i=0;i<3;i++){
    if(s[i]=='o'){
      a = a + 100;
    }
  }
  cout << a << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
ll modfac(ll a){
    ll ans=1;
    while(a>1){
        ans*=a;
        ans%=1000000007;
        a--;
    }
    return ans;
}
ll modinv(ll a,ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}
struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) {}

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool same(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
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;
}
int main(){
    ll n;cin >> n;
    ll cnt=0;
    for(int i=1;i<=n;i++){
        if(i%2==0)continue;
        ll check=0;
        for(int j=1;j<=i;j++){
            if(i%j==0)check++;
        }
        if(check==8)cnt++;
    }
    cout << cnt <<endl;
}


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

int main() {
    int N;
    cin >> N;
    vector<int> X;
    for(int i = 0; i < N; i++) {
        int buff;
        cin >> buff;
        X.push_back(buff);
    }

    vector<int> X2(N);
    copy(X.begin(), X.end(), X2.begin());
    sort(X2.begin(), X2.end());
    for(int i = 0; i < N; i++) {
        if (X[i] < X2[N/2])
            cout << X2[N/2] << endl;
        else
            cout << X2[N/2-1] << endl;
    }

    return 0;
}


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

int main(){
    string s,t;
    int ans[26];
    for(int i=0; i<26; i++){
        ans[i] = 0;
    };
    int n;
    while(getline(cin,t)){
        s += t;
    };
    for(int i=0; i<s.size(); i++){
        if('A'<=s[i] && s[i]<='Z'){
            ans[tolower(s[i])-'a'] += 1;
        }else if('a'<=s[i] && s[i]<='z'){
            ans[s[i]-'a'] += 1;
        };
    };
	for(char ch='a'; ch<='z'; ch++){
		cout<<ch<<" : "<<ans[ch - 'a']<<endl;
	};
    return 0;
}


Measured memory_bytes: 3192
#include <iostream>
#include <stack>

using namespace std;

int main() {
    string s;
    cin >> s;
    stack<char> my_stack;
    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == 'B') {
            if (!my_stack.empty()) {
                my_stack.pop();
            }
        }
        else {
            my_stack.push(s[i]);
        }
    }
    stack<int> second_stack;
    while (!my_stack.empty()) {
        char temp = my_stack.top();
        my_stack.pop();
        second_stack.push(temp);
    }
    while (!second_stack.empty()) {
        char cur = second_stack.top();
        second_stack.pop();
        cout << cur;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int n;
    int a[200009],b[200009];
    cin>>n;
    for( int i=1;i<=n;i++) cin>>a[i]>>b[i];
    sort(a+1,a+n+1);
    sort(b+1,b+n+1);
    if(n%2==1) cout<<b[(n+1)/2]-a[(n+1)/2]+1;
    else cout<< b[n/2]+b[n/2+1]-a[n/2]-a[n/2+1]+1;
}


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

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

template <typename T> T id(T b) {return b;};
template <class It> bool all(It f,It l){return std::all_of(f,l,id<bool>);}
template <class It> bool any(It f,It l){return std::any_of(f,l,id<bool>);}
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}

const int MAX_N = 100000;
int n,m;
vi g[MAX_N];
int d[MAX_N];

int dfs(int u) {
  if (d[u] != 0) return d[u];

  int res = -1;

  for (int v : g[u]) {
    chmax(res, dfs(v));
  }

  return d[u] = res+1;
}

int main()
{
#ifdef FASTIO
  ios_base::sync_with_stdio(false); cin.tie(nullptr);
#endif

  cin >> n >> m;
  forn(i,m) {
    int x,y;
    cin >> x >> y;
    g[x-1].push_back(y-1);
  }

  forn(i,n) {
    dfs(i);
  }

  cout << *max_element(d,d+n) << endl;

  return 0;
}


Measured memory_bytes: 8192
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7



H,W = map(int,input().split())
area = H*W

ans = mod

if area % 3 == 0:
    ans = 0
    print(ans)
    exit()

for i in range(1,H):
    h = H - i
    max_area = max(i*W,(h//2)*W,(h-h//2)*W)
    min_area = min(i*W,(h//2)*W,(h-h//2)*W)
    ans = min(max_area-min_area,ans)

    w = W
    max_area = max(i*W,(w//2)*h,(w-w//2)*h)
    min_area = min(i*W,(w//2)*h,(w-w//2)*h)
    ans = min(max_area-min_area,ans)

H,W = W,H
for i in range(1,H):
    h = H - i
    max_area = max(i*W,(h//2)*W,(h-h//2)*W)
    min_area = min(i*W,(h//2)*W,(h-h//2)*W)
    ans = min(max_area-min_area,ans)

    w = W
    max_area = max(i*W,(w//2)*h,(w-w//2)*h)
    min_area = min(i*W,(w//2)*h,(w-w//2)*h)
    ans = min(max_area-min_area,ans)


print(ans)


Measured memory_bytes: 6348
#include <iostream>
#include <set>
using namespace std;
static const int N = 100;

int n;

set<int> G[100];

int main(int argc, char const *argv[])
{
    int k, u, g;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> k >> u;
        for (int j = 0; j < u; j++) {
            cin >> g;
            G[i].insert(g);
        }
    }

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (!G[i].empty()) {
                cout << ((j==0) ? "" : " ");
                cout << ((G[i].find(j+1) != G[i].end()) ? "1" : "0");
            } else {
                cout << ((j==0) ? "" : " ");
                cout << "0";
            }
        }
        cout << endl;
    }

    return 0;
}



Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
long long ans;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<int> r, g;
    int b = 0;
    for (int i = 0; i < n; ++i) {
        if (s[i] == 'R') {
            r.push_back(i);
        } else if (s[i] == 'G') {
            g.push_back(i);
        } else {
            ++b;
        }
    }
    for (auto _r : r) {
        for (auto _g : g) {
            ans += b;
            if (_r > _g) {
                if (_g*2-_r >= 0 && s[_g*2-_r] == 'B') --ans;
                if (_r*2-_g < n && s[_r*2-_g] == 'B') --ans;
                if ((_r-_g)%2 == 0 && s[_g+(_r-_g)/2] == 'B') --ans;
            } else {
                if (_r*2-_g >= 0 && s[_r*2-_g] == 'B') --ans;
                if (_g*2-_r < n && s[_g*2-_r] == 'B') --ans;
                if ((_g-_r)%2 == 0 && s[_r+(_g-_r)/2] == 'B') --ans;
            }
        }
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 3748
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	
	public static void main(String[] args) {
		try {
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			String input = reader.readLine();

			char ch;
			for (int i = 0; i < input.length(); i++) {
				ch = input.charAt(i);
				if (Character.isUpperCase(ch)) {
					System.out.print(Character.toLowerCase(ch));
				} else if (Character.isLowerCase(ch)){
					System.out.print(Character.toUpperCase(ch));
				} else {
					System.out.print(ch);
				}	
			}
			System.out.println();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 25044
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef vector<int> vei;
typedef vector<string> ves;
typedef vector<vector<int>> ve_vei;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define fs first
#define sc second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
 
int main() {
	//cout.precision(10);
	cin.tie(0);
	ios::sync_with_stdio(false);

    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int x3 = x2 + y1 - y2;
    int y3 = y2 + x2 - x1;
    int x4 = x1 + y1 - y2;
    int y4 = y1 + x2 - x1;
    cout << x3 << " "<< y3 << " " << x4 << " " << y4 << endl;
}

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

using namespace std;

#define SIZE 100010

bool solve(){
  int h;
  int stone[5][12];
  scanf("%d", &h);

  if(!h) return 0;
  
  for(int i=0;i<h;i++){
    for(int j=0;j<5;j++){
      scanf("%d", &stone[j][h-i-1]);
    }
  }
  for(int i=0;i<5;i++)
    stone[i][h] = -1;

  bool flag = true;
  int ans = 0;
  
  while(flag){
    flag = false;

    for(int i=0;i<h;i++){
      int t = stone[2][i];
      if(t == -1) break;
      
      if((stone[1][i] == t && stone[3][i] == t) ||
         (stone[3][i] == t && stone[4][i] == t) ||
         (stone[0][i] == t && stone[1][i] == t)){

        if(stone[0][i] == t && stone[1][i] == t){
          ans += stone[0][i];
          stone[0][i] = -1;
        }

        if(stone[3][i] == t && stone[4][i] == t){
          ans += stone[4][i];
          stone[4][i] = -1;
        }

        if(stone[1][i] == t){
          ans += stone[1][i];
          stone[1][i] = -1;
        }

        if(stone[3][i] == t){
          ans += stone[3][i];
          stone[3][i] = -1;
        }

        ans += t; stone[2][i] = -1;

        flag = true;
      }
    }


    for(int i=0;i<5;i++){
      for(int j=h-1;j>=0;j--){
        if(stone[i][j] == -1){
          for(int k=j;k<h-1;k++) swap(stone[i][k], stone[i][k+1]);
        }
      }
    }
  }

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

  return 1;
}

int main(){
  while(solve());

}



Measured memory_bytes: 3152
#include<bits/stdc++.h>
using namespace std;
int main(){
   int a,b,c;
   cin >> a >> b >> c;
   int an,bn,cn;
   int cnt=0;
   bool flg=true;
   while(flg){
       if(a%2==0 && b%2==0 && c%2==0){
           if(a==b && b==c && c==a){
               cnt=-1;
               flg = false;
           }else{
               an = (b+c)/2;
               bn = (c+a)/2;
               cn = (a+b)/2;
               cnt++;
               a=an;
               b=bn;
               c=cn;
               //cout << "a " << a << " b " << b << " c " << c << endl;
           }
       }else{
           flg = false;
       }
   }
   cout << cnt << endl;
}




Measured memory_bytes: 256
//#define _GRIBCXX_DEBUG
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <string>
#include <utility>
#include <vector>
using namespace std;


// ?????¬???????????¬??????
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<double> vd;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<long, long> pil;


// Effective std
template<typename C, typename T>
constexpr int count(C& c, T t) { return count(ALL(c), t); }

template<typename C, typename F>
constexpr int count_if(C& c, F f) { return count_if(ALL(c), f); }

template<typename C, typename T, typename U>
constexpr void replace(C& c, T t, U u) { replace(ALL(c), t, u); }

template<typename C, typename F, typename U>
constexpr void replace_if(C& c, F f, U u) { (ALL(c), f, u); }

template<typename C>
constexpr void sort(C& c) { sort(ALL(c)); }

template<typename C, typename Pred>
constexpr void sort(C& c, Pred p) { sort(ALL(c), p); }


// ??°?????????????????¬??????
typedef int Weight;

struct Edge {
  int src, dst;
  Weight weight;
  Edge(int src, int dst, Weight weight) :
    src(src), dst(dst), weight(weight) {}
};

bool operator < (const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight :
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;


int main() {
  int a, b;
  while(true) {
    cin >> a >> b;
    if(a==0 && b==0) break;
    int sum = 0;
    REPI(i, 1, a) {
      REPI(j, i+1, a) {
        REPI(k, j+1, a) {
          if((i+j+k)==b) sum++;
        }
      }
    }
    cout << sum << endl;
  }
  return 0;
}

Measured memory_bytes: 3064