akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#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 rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;

// Most important thing in CP - Have Fun :)


void solve(){
	//write here
    int h,w,m;
    cin>>h>>w>>m;
    unordered_map<int,int>xs;
    unordered_map<int,int>ys;
    map<pair<int,int>,int>pt;
    rep(i,0,m){
        int x,y;
        cin>>x>>y;
        xs[x]++; ys[y]++; 
        pt[{x,y}] = 1;
    }
    int xval = 0, yval = 0;
    int xco,yco;
    vector<int>contx,conty;
    for (auto& it : xs){
        if (xval<it.second){
            xval = it.second;
            contx.clear();
            contx.pb(it.first);
        }
        else if (xval == it.second ){
            contx.pb(it.first);
        }
    }
    for (auto& it:ys){
        if (yval < it.second){
            yval = it.second;
            conty.clear();
            conty.pb(it.first);
        }
        else if (yval == it.second){
            conty.pb(it.first);
        }
    }
    //cout<<xco<<" "<<yco<<endl;
    //rep(i,0,sz(conty))cout<<conty[i]<<" ";
    int ans = xval + yval-1;
    int ok = 0;
    for (int i = 0 ; i<sz(contx) ; i++){
        for (int j = 0 ; j<sz(conty) ; j++){
            if (pt.count({contx[i],conty[j]})==0){
                ans++;
                cout<<ans<<endl;
                return;
            }
        }
    }
    cout<<ans<<endl;
}

int main(){
	cin.tie(NULL);
	ios::sync_with_stdio(false);
	//insert code
		solve();
	return 0;
}

Measured memory_bytes: 53288
#include<iostream>
int main()
{
	for (double weight; std::cin >> weight;)
	{
		std::cout << (
			weight <= 48.00 ? "light fly" :
			weight <= 51.00 ? "fly" :
			weight <= 54.00 ? "bantam" :
			weight <= 57.00 ? "feather" :
			weight <= 60.00 ? "light" :
			weight <= 64.00 ? "light welter" :
			weight <= 69.00 ? "welter" :
			weight <= 75.00 ? "light middle" :
			weight <= 81.00 ? "middle" :
			weight <= 91.00 ? "light heavy" :
			"heavy"
			) << std::endl;;
	}
	return 0;
}


Measured memory_bytes: 3212
// https://atcoder.jp/contests/arc095/tasks/arc095_a
//
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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

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

#[allow(unused_macros)]
macro_rules! dvec {
    ($t:expr ; $len:expr) => {
        vec![$t; $len]
    };

    ($t:expr ; $len:expr, $($rest:expr),*) => {
        vec![dvec!($t; $($rest),*); $len]
    };
}

#[allow(unused_macros)]
macro_rules! ifv {
    ($t:expr, $a:expr, $b: expr) => {
        if $t { $a } else { $b }
    }
}

#[allow(unused_macros)]
macro_rules! fill {
    ($t:expr, $v:expr) => {
        for i in 0..$t.len() {
            $t[i] = $v;
        }
    };
}

#[allow(unused_macros)]
macro_rules! join {
    ($t:expr, $glue:expr) => {
        $t.into_iter().map(|w| w.to_string()).collect::<Vec<_>>().join($glue)
    };
}

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

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

    let mut x = x.into_iter().zip(0..n).collect::<Vec<_>>();
    x.sort();

    let mut ans = vec![0; n];
    for i in 0..n {
        let idx = x[i].1;
        if i < n/2 {
            ans[idx] = x[n/2].0;
        } else {
            ans[idx] = x[n/2-1].0;
        }
    }
    for i in 0..n {
        println!("{}", ans[i]);
    }
}


Measured memory_bytes: 14328
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
//using namespace __gnu_pbds;
#define rep(i,a,b) for(i=(a);i<=(b);i++)
#define ll long long
#define pll pair<ll, ll>
#define pii pair<int,int>
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define maxn 100005
#define inf 1e12
#define boost ios::sync_with_stdio(false);cin.tie(0)
#define fr freopen("source.txt","r",stdin),freopen("output.txt","w",stdout)
#define SET(a,b) memset(a,b,sizeof(a))
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define all(x) x.begin(), x.end()
#define ps(x,y) fixed<<setprecision(y)<<x
//template<typename T>
//using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
template<class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a) {
    return out <<  "(" << a.F << ", " << a.S << ")";
}
 
template<class A> ostream& operator << (ostream& out, const vector<A> &a) {
    out << "[";
    for (auto it = a.begin(); it != a.end(); ++it) {
        if (it != a.begin())
            out << ", ";
        out << *it;
    }
    return out << "]";
}
const int N=105;
int main()
{
    boost;
    ll n,i,j,x,t,y,W;
    cin>>n>>W;
    ll w[n+1],v[n+1],dp[n+1][maxn];
    for(i=1;i<=n;i++) cin>>w[i]>>v[i];
    for(i=0;i<maxn;i++) dp[1][i]=inf;
    dp[1][0]=0;
    dp[1][v[1]]=w[1];
    for(i=2;i<=n;i++){
        for(j=0;j<maxn;j++){
            dp[i][j]=dp[i-1][j];
            if(j>=v[i]){
                dp[i][j]=min(dp[i][j],w[i]+dp[i-1][j-v[i]]);
            }
        }
    }
    ll ans=0;
    for(j=maxn-4;j>=0;j--){
        if(dp[n][j]<=W){
            cout<<j;
            return 0;
        }
    }
}

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

template<class t> void vin(vector<t>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int main() {
    string s;
    while (cin >> s and s != "#") {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        a--, b--, c--, d--;

        char board[10][10];
        fill(board[0], board[10], 'x');

        int ycur=0, xcur=0, tmp=0;
        rep(i, s.size()) {
            if (s[i] == '/') { ycur++, xcur=0, tmp=0; }
            else {
                if (s[i] == 'b') board[ycur][xcur++] = 'b', tmp++;
                else {
                    for (; xcur<(s[i]-'0')+tmp; ++xcur) {
                        board[ycur][xcur] = '.';
                    }
                    tmp += (s[i]-'0');
                }

            }
        }
        //
        // rep(y, 10) {
        //     if (board[y][0] == 'x') break;
        //     rep(x, 10) {
        //         if (board[y][x] == 'x') break;
        //         cout << board[y][x];
        //     }
        //     cout << endl;
        // }

        if (board[a][b] == 'b') {
            board[a][b] = '.';
            board[c][d] = 'b';
        }

        // rep(y, 10) {
        //     if (board[y][0] == 'x') break;
        //     rep(x, 10) {
        //         if (board[y][x] == 'x') break;
        //         cout << board[y][x];
        //     }
        //     cout << endl;
        // }

        string ans = "";

        rep(y, 10) {
            if (y and board[y][0] != 'x') ans += "/";
            else if (y and board[y][0] == 'x') break;
            int num=0;
            rep(x, 10) {
                if (board[y][x] == 'x') continue;
                if (board[y][x] == '.') num++;
                else if (board[y][x] == 'b') {
                    if (num>0) ans += to_string(num);
                    ans += "b";
                    num=0;
                }
            }
            if (num>0) ans += to_string(num);
        }
        cout << ans << endl;
    }
}



Measured memory_bytes: 3280
#include<cstdio>
#include<cstring>
using namespace std;
struct NODE{
	int n;
	NODE * prev,* next;
};
NODE *head;
void init(){
	head=new NODE;
	head->next=head;
	head->prev=head;
}
void Insert(NODE * h,int k){
	NODE * x=new NODE;
	x->n=k;
	x->next=h->next;
	x->next->prev=x;
	h->next=x;
	x->prev=h;
}
void dlt(NODE * t){
	if(t==head)return;
	t->prev->next=t->next;
	t->next->prev=t->prev;
	delete t;
}
void Delete(NODE * h,int k){
	NODE *cur=h->next;
	while(cur!=h&&cur->n!=k)cur=cur->next;
	dlt(cur);
}
void DeleteFirst(NODE * h){
	dlt(h->next);
}
void DeleteLast(NODE *h){
	dlt(h->prev);
}
void pr(NODE *h){
	NODE *cur=h->next;
	while(cur!=h){
		printf("%d",cur->n);
		if(cur->next!=h)putchar(' ');
		else putchar('\n');
		cur=cur->next;
	}
}
int main(){
	int N;
	scanf("%d\n",&N);
	init();
	for(int i=0;i<N;i++){
		char s[30];int k;
		scanf("%s",s);
		if(s[0]=='i'){
			scanf("%d",&k);
			Insert(head,k);
		}else if(s[0]=='d'&&strlen(s)==6){
			scanf("%d",&k);
			Delete(head,k);
		}else if(strlen(s)>6&&s[6]=='F'){
			DeleteFirst(head);
		}else{
			DeleteLast(head);
		}
	}
	pr(head);
}



Measured memory_bytes: 33956
/**
 * Title: D - Sum of Large Numbers
 * Url: https://atcoder.jp/contests/abc163/tasks/abc163_d
 */
#include<bits/stdc++.h>

using namespace std;

#define ll long long

int main() {

    int n, k;
    cin >> n >> k;
    vector<ll> s(n+1);
    s[0]=0;
    for(int i=1; i<=n; i++) {
        s[i] = s[i-1]+i;
    }
    ll ans = 0;
    for(int i=k;i<=n+1; i++) {
        if(i==n+1) {
            ans += 1;
        } else {
            ans += (s[n]-s[n-i])-s[i-1]+1;
        }
        
    }
    cout << ans%1000000007 << endl;
    return 0;
}

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

typedef long long int ll;

vector <ll> input;

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

	ll i,j,t,k,l,m,n,x,y,z;

	cin >> n >> k;

	for(i=0;i<n;i++)
	{
		cin >> l;
		input.push_back(l);
	}

	for(i=0;i+k<n;i++)
	{
		if(input[i+k] > input[i])
			cout << "Yes\n";
		else
			cout << "No\n";
	}



	
	

}

Measured memory_bytes: 5324
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

public class Main {
	// AtCoder Beginner Contest 116
	// https://atcoder.jp/contests/abc116/tasks
	public static void main(String[] args) {
		FastReader sc = new FastReader();
		int s = sc.nextInt();
		int idx = 1;
		Set<Integer> set = new HashSet<>();
		set.add(s);
		
		while (true) {
			idx++;
			if (s % 2 == 0) {
				s /= 2;
			} else {
				s = (3 * s) + 1;
			}
			
			if (set.contains(s)) {
				System.out.println(idx);
				System.exit(0);
			} else {
				set.add(s);
			}
		}
	}
	
	static class FastReader { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next() { 
            while (st == null || !st.hasMoreElements()) { 
                try { 
                    st = new StringTokenizer(br.readLine()); 
                } catch (IOException  e) { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() { 
            String str = ""; 
            try{ 
                str = br.readLine(); 
            } catch (IOException e) { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
}


Measured memory_bytes: 21204
A,B,C,D = gets.strip.split.map(&:to_i)

E=C*D/C.gcd(D)
A-=1
AC=A/C
AD=A/D
AE=A/E
ASM=AD+AC-AE

BC=B/C
BD=B/D
BE=B/E
BSM=BC+BD-BE
puts B-A-(BSM-ASM)

Measured memory_bytes: 1788
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<array>
#include<vector>
#include<functional>
#include<unordered_map>
#include<map>
#include<numeric>
#include<limits>
#include<utility>
#include<queue>
#include<random>
#include<math.h>
using namespace std;

int main() {
	string str;
	cin >> str;
	cout << str.front() << str.size() - 2 << str.back() << endl;
	return 0;
}

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

int main(){
    string s, t;
    cin >> s >> t;
    for(int i=0; i<s.size(); i++){
        if(s[i]!=t[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;

int main(){
  ll h, w;
  cin >> h >> w;
  
  ll ans = ((w + 1) / 2) * ((h + 1) / 2);
  ans += (w / 2) * (h / 2);
  if(h == 1 || w == 1) ans = 1;
  cout << ans << endl;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc117/tasks/abc117_b

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

int main()
{
  /* Magic word */
  // cin.tie(0);
  // ios::sync_with_stdio(false);
  /* ---------- */

  int n;
  cin >> n;

  int sum = 0, m = 0;
  REP(i, n)
  {
    int l;
    cin >> l;
    sum += l;
    m = max(m, l);
  }

  string r = m * 2 < sum ? "Yes" : "No";

  cout << r << '\n';

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define st first
#define nd second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define ll long long
int main()
{
    int a,b,c,d;
    string s;
    cin>>s;
    a=(int)(s[0]-'0');
    b=(int)(s[1]-'0');
    c=(int)(s[2]-'0');
    d=(int)(s[3]-'0');
    vector<int> v;
    v.pb(0);
    v.pb(0);
    v.pb(0);
    int i,j,k;
    for(i=0;i<9;i++)
    {
        int ans=a;
        if(v[0]==0)
        {
            ans-=b;
        }
        else
        {
            ans+=b;
        }
        if(v[1]==0)
        {
            ans-=c;
        }
        else
        {
            ans+=c;
        }
        if(v[2]==0)
        {
            ans-=d;
        }
        else
        {
            ans+=d;
        }
        if(ans==7)
        {
            cout<<a;
            cout<<(v[0]==1?'+':'-');
            cout<<b;
            cout<<(v[1]==1?'+':'-');
            cout<<c;
            cout<<(v[2]==1?'+':'-');
            cout<<d;
            cout<<"=7";
            return 0;
        }
        for(j=2;j>=0;j--)
        {
            if(v[j]==0)
            {
                v[j]=1;
                for(k=j+1;k<3;k++)
                {
                    v[k]=0;
                }
                break;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define debug(x) cerr<<#x<<": "<<x<<endl
#define trav(a,x) for(auto &a:x)
#define all(x) x.begin(),x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;

ll euclid(ll a, ll b, ll &x, ll &y) {
	if (b) { ll d = euclid(b, a % b, y, x);
		return y -= a/b * x, d; }
	return x = 1, y = 0, a;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n, a, b, k;
    cin >> n >> a >> b >> k;
    const ll MOD=998244353;
    vector<ll> fact(n+1);
    fact[0]=1;
    rep(i,0,n) fact[i+1]=((i+1)*fact[i])%MOD;
    vector<ll> factinv(n+1);
    ll x, y;
    rep(i,0,n+1) {
        euclid(fact[i],MOD,x,y);
        if(x<0) x+=MOD;
        factinv[i] = x;
    }
    ll ans=0;
    rep(i,0,n+1) {
        ll left=k-a*i;
        if(left%b!=0) continue;
        ll j = left/b;
        if(j<0 || j>n) continue;
        ll bin1=(factinv[n-i]*((fact[n]*factinv[i])%MOD))%MOD;
        ll bin2=(factinv[n-j]*((fact[n]*factinv[j])%MOD))%MOD;
        ans=(ans+bin1*bin2)%MOD;
    }
    cout<<ans<<"\n";
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
vector<int> a = {105,135,165,189,195};
int main (){
    int N;
    cin>>N;
    int ans=0;
    for(int i=1;i<=N;i++){
        for(int j=0;j<5;j++){
            if(i==a[j])ans++;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll mod = 1000000007;
const ll mod998 = 998244353;
const ll intmax = 2147483647;
const ll llmax = 9223372036854775807;
const char sp = ' ';

int N;
ll c[10][10], res;

int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) {
		int a = i;
		while (a >= 10)a /= 10;
		c[a][i % 10]++;
	}
	for (int i = 1; i <= 9; i++) {
		for (int j = 1; j <= 9; j++) {
			res += c[i][j] * c[j][i];
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 
#define dump(x)  cout << #x << " = " << (x) << endl;
typedef long long lint;
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	cout<<(n-1)*(m-1)<<endl;
}


Measured memory_bytes: 256
using System;

public class Problem_B
{
  public static void Main()
  {
    var inputs = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
    int h = inputs[0], w = inputs[1];
    var grid = new char[h, w];
    for (var i = 0; i < h; i++)
    {
      var s = Console.ReadLine();
      for (var j = 0; j < s.Length; j++) grid[i, j] = s[j];
    }

    int[] dx = { 0, 1, 1, 1, 0, -1, -1, -1 };
    int[] dy = { -1, -1, 0, 1, 1, 1, 0, -1 };
    for (var i = 0; i < h; i++)
    {
      for (var j = 0; j < w; j++)
      {
        var count = 0;
        for (var k = 0; k < dx.Length; k++)
        {
          if (i + dy[k] >= 0 && i + dy[k] < h
              && j + dx[k] >= 0 && j + dx[k] < w
              && grid[i + dy[k], j + dx[k]] == '#')
          {
            count++;
          }
        }
        if (grid[i, j] == '.') grid[i, j] = Convert.ToString(count)[0];
        Console.Write($"{grid[i, j]}");
      }
      Console.Write("\n");
    }
  }
}


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

using namespace std;

int main(){
    string sentence;
    getline(cin,sentence);

    int sentence_len = sentence.length();
    

    for(int i = 0;i < sentence_len;i++){
        if(isupper(sentence[i])) sentence[i] = tolower(sentence[i]);
        else if(islower(sentence[i])) sentence[i] = toupper(sentence[i]);
    }
    cout << sentence << "\n";
    return 0;
}


Measured memory_bytes: 3156
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>

//#include<bits/stdc++.h>


using namespace std;



int main()
{
   
    int n;
    cin >> n;
    vector<vector<pair<int,int>>>p(n);

    for (int i = 0; i < n-1; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        p[a].push_back(make_pair(i, b));
        p[b].push_back(make_pair(i, a));

    }

    int r = 1;
    queue<int>g;
    g.push(0);
    vector<bool>f(n);
    vector<int>ans(n);
    int pr = -1;
    f[0] = 1;
    while (g.size()) {
        int a = g.front(); g.pop();
      

        int x = 1;

        for (int i = 0; i < p[a].size(); i++) {

            int y = p[a][i].second, id = p[a][i].first;
            if (f[y]) pr = ans[id];
          
        }
        
        for (int i = 0; i < p[a].size(); i++) {
            
            int y = p[a][i].second,id=p[a][i].first;
            if (f[y]) continue;
            if (pr == x)x++;
            
            ans[id] = x, x++;
            if (!f[y])g.push(y);
            f[y] = 1;
            //cout <<a<<" "<< x << endl;
        }
        //cout << g.size();

    }
    int w = -1;
    for (int i = 0; i < n; i++)w = max(w, ans[i]);
    cout << w << endl;
    for (int i = 0; i < n - 1; i++)cout << ans[i] << endl;


    
    return 0;

}


Measured memory_bytes: 7040
#include<stdio.h>

int main(){
  int n;
  scanf("%d", &n);
  char s[n+10];
  scanf("%s", s);

  int K[26] = {};

  int i;
  int k;
  for(i = 0; i < n; i++){
    k = s[i] - 97;
    K[k]++;
  }

  long long answer = 1;

  for(i = 0; i < 26; i++){
    answer *= K[i] + 1;
    answer %= 1000000000 + 7;
  }

  printf("%lld\n", answer - 1);

  return 0;
}


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

int main(){
    int n; cin >> n;
    vi cnt(n,0);
    int c = sqrt(n)+1;
    for(int x = 1;x<=c+1;x++){
        for(int y = 1;y<=c+1;y++){
            for(int z = 1;z<=c+1;z++){
                    if(x*x + y*y + z*z + x*y + y*z + z*x <= n)
                        cnt.at(x*x + y*y + z*z + x*y + y*z + z*x - 1)++;
            }
        }
    }
    for(int x : cnt) cout << x << endl;
}

Measured memory_bytes: 3668
/*
 * ID: ITP1_2_A
 * Problem: Small, Large, or Equal
 */

#include <stdio.h>

int main(void)
{
    int a, b;

    scanf("%d %d", &a, &b);

    if (a < b)
        printf("a < b\n");
    else if (a > b)
        printf("a > b\n");
    else
        printf("a == b\n");

    return 0;
}



Measured memory_bytes: 2032
#include<bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef ONLINE_JUDGE
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin >> s;
	int n = s.length();
	if(s[n-1] == 's') {
		//s[n-1] = 'e';
		s = s+"es";
	} else {
		s+='s';
	}
	cout<<s;


	
}


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

int main() {
    ll N, C;
    cin >> N >> C;
    vector<ll> x(N+1), v(N+1);
    x[0] = v[0] = 0;
    for(ll i=1; i<N+1; i++) cin >> x[i] >> v[i];
    
    vector<P> va(N+1), vb(N+1);
    vector<P> mxa(N+1), mxta(N+1);
    mxa[0] = mxta[0] = P(0, 0);
    va[0] = vb[0] = P(0, 0);
    for(ll i=1; i<N+1; i++) {
        va[i] = P(x[i], va[i-1].second+v[i]);
        vb[i] = P(C-x[N-i+1], vb[i-1].second+v[N-i+1]);
        //cout << C-x[N-i+1] << " " << v[N-i+1] << endl;
        if(va[i].second-va[i].first > mxa[i-1].second-mxa[i-1].first) mxa[i] = va[i];
        else mxa[i] = mxa[i-1];
        if(va[i].second-2*va[i].first > mxta[i-1].second-2*mxta[i-1].first) mxta[i] = va[i];
        else mxta[i] = mxta[i-1];
        //cout << va[i].first << " " << va[i].second << endl;
        //cout << vb[i].first << " " << vb[i].second << endl;
    }

    ll res = 0;
    for(ll i=0; i<N+1; i++) {
        ll a=0, b=0;
        if(mxta[N-i].first+vb[i].first < C) a = (mxta[N-i].second-2*mxta[N-i].first) + (vb[i].second-vb[i].first);
        if(mxa[N-i].first+vb[i].first < C) b = (mxa[N-i].second-mxa[N-i].first) + (vb[i].second-2*vb[i].first);
        ll t = max(a, b);
        res = max(res, t);
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n;
    cin>>n;
    int h[n];
    for (int i = 0; i < n; i++) cin>>h[i];
    vector<int> d(n, 0);
    for (int i = 1; i < n; i++) {
      int mi = INT_MAX;
      for (int j = i-1; j >= i-2 && j >= 0; j--) {
        mi = min(mi, d[j] + abs(h[i]-h[j]));
      }
      d[i] = mi;
    }
    cout<<d[n-1]<<endl;
    return 0;
}

Measured memory_bytes: 1024
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
      	Integer a = sc.nextInt();
      	Integer b = sc.nextInt();
      	Integer c = sc.nextInt();
      	Integer d = sc.nextInt();
      	Integer e = sc.nextInt();
      	Integer k = sc.nextInt();
		if((e-a) > k){
        	System.out.println(":(");  
        }else{
          System.out.println("Yay!");
        }
	}
}

Measured memory_bytes: 21332
#include <iostream>
#include <cmath>
#include <vector>
#include <time.h>
#include <map>
#include <set>
#include <deque>
#include <cstdio>
#include <cstdlib>
#include <unordered_map>
#include <bitset>
#include <algorithm>
#include <string>
#include <fstream>
#include <assert.h>
#include <list>
#include <cstring>
#include <numeric>
using namespace std;

const int N = 100;

char c[N][N];

int dfs(int x, int y)
{
	if (c[x + 1][y] == '#')
		return dfs(x + 1, y) + 1;
	if (c[x][y + 1] == '#')
		return dfs(x, y + 1) + 1;
	return 1;
}

int main()
{
	int h, w;
	cin >> h >> w;
	int cnt = 0;
	for (int i = 0; i < h; ++i)
		for (int j = 0; j < w; ++j)
			cin >> c[i][j],
			cnt += (c[i][j] == '#');
	int cnt2 = c[0][0] == '#' ? dfs(0, 0) : 0;
	if (cnt2 == cnt && c[h - 1][w - 1] == '#')
		cout << "Possible";
	else
		cout << "Impossible";
	
	return 0;
}

Measured memory_bytes: 256
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B - Uneven Numbers
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  int n;
  scanf("%d", &n);

  int cnt = 0;
  for (int m = 1; m <= n; m++) {
    int c = 0;
    for (int k = m; k > 0; k /= 10) c++;
    if (c & 1) cnt++;
  }

  printf("%d\n", cnt);
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n, a, b, c := scanInt(), scanInt(), scanInt(), scanInt()

	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = scanString()
	}

	ans := make([]string, n)
	for i := 0; i < n; i++ {
		switch s[i] {
		case "AB":
			if a > b {
				a--
				b++
				ans[i] = "B"
			} else if b > a {
				a++
				b--
				ans[i] = "A"
			} else {
				if i+1 == n || s[i+1] == "AB" || s[i+1] == "AC" {
					a++
					b--
					ans[i] = "A"
				} else {
					a--
					b++
					ans[i] = "B"
				}
			}
		case "BC":
			if b > c {
				b--
				c++
				ans[i] = "C"
			} else if c > b {
				b++
				c--
				ans[i] = "B"
			} else {
				if i+1 == n || s[i+1] == "BC" || s[i+1] == "AB" {
					b++
					c--
					ans[i] = "B"
				} else {
					b--
					c++
					ans[i] = "C"
				}
			}
		case "AC":
			if a > c {
				a--
				c++
				ans[i] = "C"
			} else if c > a {
				a++
				c--
				ans[i] = "A"
			} else {
				if i+1 == n || s[i+1] == "AC" || s[i+1] == "AB" {
					a++
					c--
					ans[i] = "A"
				} else {
					a--
					c++
					ans[i] = "C"
				}
			}
		}
		if a < 0 || b < 0 || c < 0 {
			fmt.Fprintln(wr, "No")
			return
		}
	}

	fmt.Fprintln(wr, "Yes")
	for i := 0; i < n; i++ {
		fmt.Fprintln(wr, ans[i])
	}
}


Measured memory_bytes: 6996
#D - Not Divisible
import collections
N = int(input())
a = list(map(int,input().split()))
a = sorted(a,reverse = False)

#collections.Counterは存在しない値を指定すると0を返す
cnt = collections.Counter(a)
m = max(a)+1
for i in a:
    if cnt[i] >= 2:
        del cnt[i]
    for j in range(i*2,m,i):
        del cnt[j]
print(len(cnt.keys()))

Measured memory_bytes: 37324
#include<stdio.h>

int main()
{
    int n,a,b,c,k;
    int i,flag=0;
    scanf("%d %d %d",&a,&b,&c);
    scanf("%d",&k);
    for(i=0;i<k;i++)
    {
        if(a>=b)b*=2;
        else if(b>=c)c*=2;
    }
    if(a<b&&b<c)printf("Yes");
    else printf("No");
}


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

int main() {
  int a, b, x, y;
  cin >> a >> b;
  x = min(a,b);
  y = max(a,b);
  for (int i = 0; i < y; i++) {
    cout << x;
  }
  cout << "" << endl;
}

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

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

  scanf("%d", &n);
  A = (int *)malloc(n*sizeof(int));  //配列を確保

  for(i=0; i<n; i++) scanf("%d", A+i); //配列Aに値を入力

  for(i=0; i<n; i++){
    v = A[i];  //仮置き
    j = i-1;
    while(j>=0 && A[j]>v){ //iよりも前の要素と比較
      A[j+1] = A[j];       //一つ右にずらす
      j--;
    }
    A[j+1] = v;

    //結果出力
    for(k=0; k<n-1; k++) printf("%d ", A[k]);
    printf("%d\n", A[n-1]);
  }
  return 0;
}

Measured memory_bytes: 600
#include<stdio.h>

int main(void)
{
    char buffer[256];
    int n, m;
    int i, j, k;
    int A[100][100], B[100], C[100];

    fgets(buffer, 256, stdin);
    sscanf(buffer, "%d %d", &n, &m);
    for (i = 0; i < n; i++)
    {
        for (j = 0; j < m; j++)
        {
            scanf("%d", &A[i][j]);
        }
    }
    for (j = 0; j < m; j++)
    {
        scanf("%d", &B[j]);
    }

    for (i = 0; i < n; i++)
    {
        C[i] = 0;
        for (j = 0; j < m; j++)
        {
            C[i] += A[i][j] * B[j];
        }
    }

    for (j = 0; j < n; j++)
    {
        printf("%d\n", C[j]);
    }

    return(0);
}


Measured memory_bytes: 2100
#include <iostream>
#include <vector>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <numeric>
#include <iterator>

using namespace std;

namespace {

}

int main()
{
	int N, M;
	cin >> N >> M;
	vector<pair<int, int>> stud;
	vector<pair<int, int>> check;

	for (int i = 0; i < N; ++i){
		int a, b;
		cin >> a >> b;
		stud.push_back(make_pair(a, b));
	}
	for (int i = 0; i < M; ++i){
		int c, d;
		cin >> c >> d;
		check.push_back(make_pair(c, d));
	}

	for (int i = 0; i < N; ++i){
		int curA = stud[i].first;
		int curB = stud[i].second;

		int minIndex = -1;
		int minDst = -1;
		for (int j = 0; j < M; ++j){
			int curD = abs(check[j].first - curA) + abs(check[j].second - curB);
			if (minDst == -1 || minDst > curD){
				minIndex = j;
				minDst = curD;
			}
		}

		cout << minIndex + 1<< endl;
	}

	return 0;
}

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


string solve(vector<string>&a, vector<string>&b){
    
    int n = a.size();
    int m = b.size();
    
    
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            
            // Implement the conv layer here
            int res = 0;
            for(int k = 0; k < m; k++){
                for(int l = 0; l < m; l++){
                    if(i + k < n && j + l < n && a[i+k][j+l] == b[k][l]){
                        res += 1;
                    }
                }
            }
            if(res == m*m){
                return "Yes";
            }
            
        }
    }
    
    return "No";
    
    
}





int main(){
    
    int n, m;
    cin >> n >> m;
    vector<string>a(n), b(m);
    
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = 0; i < m; i++){
        cin >> b[i];
    }
    
    cout << solve(a, b) << endl;
    
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define NL            "\n"
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
int main()
{
    _SAD()
    int n,m;
    cin>>n>>m;
    cout<<(m+m)-n<<NL;
    return 0;
}


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

#define REP(i, n) for(int i = 0;i < n;i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define ll long long

using namespace std; 

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


    ll ans=1;
    ll ei = 1;
    ll nin = 2;
    ll mm = 1;
    REP(i, 9) mm *= 10;
    mm += 7;
    
    REP(i,n){
        ans = (ans * 10) % mm;
        ei = (ei*8) % mm;
        nin = (nin*9) % mm;
    }

    ans = (ans + ei - nin) % mm;

    if(ans < 0) ans += mm;
    cout << ans;
}

Measured memory_bytes: 3620
import sys
from sys import stdin
input = stdin.readline

n = int(input())

st = set()

for _ in range(n):
    command = input()
    if command[0] == "i":
        st.add(command[7:])
    else:
        if command[5:] in st:
            print("yes")
        else:
            print("no")


Measured memory_bytes: 31664
#include<stdio.h>
long long a[100010],b[100010];
int main()
{
	long long n,i,sum,t,t1,t2,p;
	while(scanf("%lld",&n)!=EOF)
	{
		sum=0;
		for(i=1;i<=n;i++)
		{
			scanf("%lld",&a[i]);
			sum=sum+a[i];
		}
		t1=n*(n+1)/2;
		if(sum%t1!=0)
		{
			printf("NO\n");
			continue;
		}
		t2=sum/t1;
		for(i=2;i<=n;i++)
		b[i]=a[i]-a[i-1];
		b[1]=a[1]-a[n];
		p=0;
		for(i=1;i<=n;i++)
		{
			t=t2-b[i];
			if(t<0)
			break;
			if(t%n!=0)
			break;
			p=p+t/n;
		}
		if(i!=n+1||p!=t2)
		printf("NO\n");
		else
		printf("YES\n");
	}
	return 0;
}

Measured memory_bytes: 1664
def main():
    x = int(input())
    gojo = [int(i**5) for i in range(-1100, 1100)]
    for i, v1 in enumerate(gojo):
        x1 = i - 1100
        for j, v2 in enumerate(gojo):
            x2 = j - 1100
            if v1 - v2 == x:
                print(x1, x2)
                return


if __name__ == '__main__':
    main()


Measured memory_bytes: 65864
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Main m = new Main();
		m.run();
	}

	Scanner sc = new Scanner(System.in);

	void run() {
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		if(a+b > n + 1){
			System.out.println(-1);
			return;
		}
		
		if((long)a*b < n){
			System.out.println(-1);
			return;
		}
		
		
		x(a,b,n);		
		
		
	}

	void x(int a, int b, int n) {

		int z = n;
		int[] res = new int[n];
		for (int ind = 0;ind < n;) {
			int x = (int)Math.min((long)a * (b-1) + 1, z);
			for (int y = x; y <= z; y++) {
				res[ind] = y;
				ind++;
			}
			b--;
			z = x-1;
		}
		for(int i =0  ; i < n-1 ; i ++){
			System.out.print(res[i] + " ");
		}
		System.out.println(res[n-1]);
			
	}

}


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

int main(void) {
  string s, out;
  cin >> s;
  for (int i = 0; i < (int)s.length(); i++) {
    if (s[i] == 'B') {
      if (!out.empty()) out.pop_back();
    } else
      out += s[i];
  }
  cout << out << endl;
  return 0;
}

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

using namespace std;

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

    vector<int> a(N+1), b(N+1), c(N+1);
    for (int i = 1; i <= N; i++) {
        cin >> a[i] >> b[i] >> c[i];
    }

    // i日目に活動j(0:A,1:B,2:C)をしたときのi日目までの幸福度の総和の最大値dp[i][j]
    vector<vector<int>> dp(N+1, vector<int>(3, 0));

    // 初期条件
    dp[1][0] = a[1], dp[1][1] = b[1], dp[1][2] = c[1];
    
    // dp開始
    for (int i = 2; i <= N; i++) {
        dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a[i];
        dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + b[i];
        dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + c[i];
    }

    int answer = max({dp[N][0], dp[N][1], dp[N][2]});

    cout << answer << endl;
	return 0;
}

Measured memory_bytes: 9780
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> istream& operator>>(istream& is,vector<T>& v) { for(T& t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream& os,const vector<T>& v) { for(T t:v){os<<t<<" ";} os<<"\n"; return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
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 = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n,x;
    cin >> n >> x;
    vi a(n);
    cin >> a;
    ll ans = 0;
    rep(i,n-1) {
        int sum = a[i]+a[i+1];
        if(sum <= x) continue;
        ans += sum-x;
        a[i+1] = max(0,a[i+1]-(sum-x));
        a[i] = x-a[i+1];
    }
    cout << ans << endl;
}


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

using namespace std;

int GCD(int a, int b) {
  if (b == 0) return a;
  return GCD(b, a % b);
}

int main() {
  int n, x;
  cin >> n >> x;
  
  vector<int> v;
  while (n--) {
    int a;
    cin >> a;
    v.push_back(abs(a - x));
  }
  
  int g = 0;
  for (int a : v) {
    g = GCD(g, a);
  }
  cout << g << endl;
}


Measured memory_bytes: 892
#include <iostream>
#include <string>
#include <map>

using namespace std;

typedef pair <int,int> ii;
int bi[3][3];
int main(){
	
	cin.tie(0); ios_base::sync_with_stdio(0);
	int tab[3][3];
	map <int, ii> mm;
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
			cin>>tab[i][j];
			mm[tab[i][j]] = ii(i,j);
		}
	}
	int n;
	cin>>n;
	while(n--){
		int b;
		cin>>b;
		if(mm.count(b)>0){
			bi[mm[b].first][mm[b].second] = 1;
		}
	}
	if(bi[1][1]&&((bi[0][0]&&bi[2][2])||(bi[0][2]&&bi[2][0]))){
		cout<<"Yes\n";
		return 0;
	}
	for(int i=0;i<3;i++){
		if(bi[i][0]&&bi[i][1]&&bi[i][2]){
			cout<<"Yes\n";
			return 0;
		}
		if(bi[0][i]&&bi[1][i]&&bi[2][i]){
			cout<<"Yes\n";
		return 0;
		}
		
	}
	cout<<"No\n";
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int a,b,c;
  cin >> a >> b>> c;
  bool flag = false;
  for(int  i = b;i < c+1;i++){
    if(i%a==0) flag = true;
  }
  if(flag)cout << "OK"<<endl;
  else cout << "NG"<< endl;
}


Measured memory_bytes: 3620
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		Long A = sc.nextLong();
		Long B = sc.nextLong();
		Long N = sc.nextLong();

		Long max = (long) 0;

		Long z = (Long)(A*N/B)-A*(Long)(N/B);
		if(z >= max) {
			max = z;
		}

		Long x = B-1;
		if(x <= N) {
			z = (Long)(A*x/B)-A*(Long)(x/B);
			if(z >= max) {
				max = z;
			}
		}

		System.out.println(max);
	}

}



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

#define REP(i,n) for(int i=0;i<(n);++i)
const long long INF = 1LL<<60;
const int  mod=2019;

int main(){
    int N;
    cin >> N;
    vector<pair<int, int>> R(N);
    vector<pair<int, int>> B(N);
    REP(i,N) cin >> R[i].first >> R[i].second;
    REP(i,N) cin >> B[i].first >> B[i].second;
    sort(R.begin(), R.end());
    sort(B.begin(), B.end());

    int ans = 0;
    REP(i,N){
        bool b = false;
        int res;
        int resy = -1;
        REP(j,N){
            if(R[j].first == -1) continue;
            if(R[j].first < B[i].first && R[j].second < B[i].second){
                b = true;
                if(R[j].second > resy){
                    resy = R[j].second;
                    res = j;
                }
            }    
        }
        if(b){
            ans++;
            R[res].first = -1;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 1000000

typedef struct{

  int x,y,z;

}Tree;


Tree A[MAX];

int Depth(int);

main(){

  int i,j,n,num,d,c,k=0;


  scanf("%d",&n);

  for(i = 0; i < n ;i++){

    A[i].x = -1;
    A[i].y = -1;
    A[i].z = -1;
  }


  for(i = 0; i < n ;i++){

    scanf("%d%d",&num,&d);

    for(j = 0; j < d; j++){

      scanf("%d",&c);

      if(j == 0)A[num].y = c;

      else A[k].z = c;

      k = c;
      A[c].x = num;

    }
  }


  for(i = 0; i < n; i++){

    printf("node %d: parent = %d, depth = %d,",i,A[i].x,Depth(i));

    if(Depth(i) == 0) printf(" root, [");

    else if(A[i].y == -1) printf(" leaf, [");

    else printf(" internal node, [");

    j = A[i].y;

    while(j != -1){

      printf("%d",j);

      j = A[j].z;

      if(j != -1){

	printf(", ");
      }
    }

    printf("]\n");
  }

  return 0;
}



int Depth(int num){

  int dep = 0;

  while(A[num].x != -1){

    num = A[num].x;
    dep++;
  }

  return dep;
}
      
	  
	



Measured memory_bytes: 3016
num = int(input())
temp = num
ans = 1
while temp > 10:
    temp %= 10
# print(temp)
if temp in [1, 3, 7, 9]:
    sa = 7
    while True:
        if sa % num == 0:
            print(ans)
            break
        else:
            sa *= 10
            sa += 7
            sa %= num
            ans += 1
else:
    print(-1)

Measured memory_bytes: 9136
#pragma comment(linker, "/STACK:512000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
#ifdef AIM
#include <sys/resource.h>
#endif
using namespace std;

#define all(a) a.begin(), a.end()
typedef long long li;
typedef long double ld;
void solve(__attribute__((unused)) bool);
void precalc();
clock_t start;
#define FILENAME ""

int main() {
#ifdef AIM
  string s = FILENAME;
//    assert(!s.empty());
  freopen("/home/alexandero/ClionProjects/cryptozoology/input.txt", "r", stdin);
  //freopen("/home/alexandero/ClionProjects/cryptozoology/output.txt", "w", stdout);
#else
//    freopen(FILENAME ".in", "r", stdin);
//    freopen(FILENAME ".out", "w", stdout);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    start = clock();
    int t = 1;
#ifndef AIM
  cout.sync_with_stdio(0);
  cin.tie(0);
#endif

#ifdef AIM
  const rlim_t kStackSize = 256 * 1024 * 1024;
  struct rlimit rl;
  int result;

  result = getrlimit(RLIMIT_STACK, &rl);
  if (result == 0)
  {
    if (rl.rlim_cur < kStackSize)
    {
      rl.rlim_cur = kStackSize;
      result = setrlimit(RLIMIT_STACK, &rl);
      if (result != 0)
      {
        fprintf(stderr, "setrlimit returned result = %d\n", result);
      }
    }
  }
#endif

  precalc();
  cout.precision(10);
  cout << fixed;
  //cin >> t;
  int testNum = 1;
  while (t--) {
      //cout << "Case #" << testNum++ << ": ";
      solve(true);
  }
  cout.flush();
#ifdef AIM1
    while (true) {
      solve(false);
  }
#endif

#ifdef AIM
  cout.flush();
  auto end = clock();

  usleep(10000);
  print_stats(end - start);
  usleep(10000);
#endif

    return 0;
}

template<typename T>
T binpow(T q, T w, T mod) {
    if (!w)
        return 1 % mod;
    if (w & 1)
        return q * 1LL * binpow(q, w - 1, mod) % mod;
    return binpow(q * 1LL * q % mod, w / 2, mod);
}

template<typename T>
T gcd(T q, T w) {
    while (w) {
        q %= w;
        swap(q, w);
    }
    return q;
}
template<typename T>
T lcm(T q, T w) {
    return q / gcd(q, w) * w;
}

template <typename T>
void make_unique(vector<T>& a) {
    sort(all(a));
    a.erase(unique(all(a)), a.end());
}

template<typename T>
void relax_min(T& cur, T val) {
    cur = min(cur, val);
}

template<typename T>
void relax_max(T& cur, T val) {
    cur = max(cur, val);
}

void precalc() {
}

//#define int li
//const int mod = 1000000007;

void solve(__attribute__((unused)) bool read) {
  int res = 0;
  for (int i = 0; i < 2; ++i) {
    int h, m;
    cin >> h >> m;
    int mins = h * 60 + m;
    res += (i == 0 ? -1 : 1) * mins;
  }
  int k;
  cin >> k;
  res -= k;
  cout << max(res, 0) << "\n";
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
using namespace std;

int W[200];
// 累積和を保存していく配列
int S[200];
int N = 0;
// 差の初期値は100よりも大きい値にしておく
int gap = 200;

int main(){
  // 入力を格納していくフェーズ
  cin >> N;
  rep(i, N){
    cin >> W[i+1];
  }
  rep(i, N){
    S[i+1] += S[i] + W[i+1];
  }

  // ここからソルバー
  // 累積和から左側と右側の和を求める
  rep(i, N-1){
    int left = S[i+1];
    int right = S[N] - S[i+1];
  // 絶対値の差を計算
    gap = min(gap, abs(left-right));
  }
  cout << gap << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <map>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <random>
#include <set>
#include <deque>
#include <queue>
#include <bitset>
#include <stack>

#define mod 1000000007
#define INF2 9999999999
#define INF (1<<30)
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)

using namespace std;
using ll = __int64_t;

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

void solve(){
  int a, b;
  cin >> a >> b;
  cout << max(max(a+a-1, b+b-1), a+b)<< endl;
}

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

Measured memory_bytes: 256