akhauriyash/Code-Regression huggingface dataset:
# import bisect
from collections import Counter, deque
# import copy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

def resolve():
    n=int(input())
    V=list(map(int,input().split()))

    E=[]
    O=[]

    for i in range(n):
        if i%2==0:
            E.append(V[i])
        else:
            O.append(V[i])

    e=Counter(E)
    o=Counter(O)

    if e.most_common()[0][0] != o.most_common()[0][0]:
        print(n-e.most_common()[0][1]-o.most_common()[0][1])
    else:
        if len(e.most_common()) ==1:
            if  len(o.most_common())==1:
                print(n//2)
            else:
                print(n-e.most_common()[0][1]-o.most_common()[1][1])
        elif len(o.most_common())==1:
            print(n - e.most_common()[1][1] - o.most_common()[0][1])
        else:
            print(min(n-e.most_common()[1][1]-o.most_common()[0][1], \
                      n-e.most_common()[0][1]-o.most_common()[1][1]))

resolve()

Measured memory_bytes: 83972
/*author: hyperion_1724
  date: 
*/
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	// chrono::steady_clock sc;
 //  	auto start = sc.now();
 //  	ifstream cin;
 //  	cin.open("INPUT.txt");

	long long int N;
	cin>>N;
	long long int A[4][4][4];
	for (long long int i = 0; i < 4; ++i)
	{
		for (long long int j = 0; j < 4; ++j)
		{
			for (long long int k = 0; k < 4; ++k)
			{
				A[i][j][k]=1;
			}
		}
	}
	A[0][2][1]=0;
	A[2][0][1]=0;
	A[0][1][2]=0;
	for (long long int i = 4; i <= N; ++i)
	{
		long long int B[4][4][4];
		for (long long int j = 0; j < 4; ++j)
		{
			for (long long int k = 0; k < 4; ++k)
			{
				for (long long int r = 0; r < 4; ++r)
				{
					B[j][k][r]=0;
					for (long long int l = 0; l < 4; ++l)
					{
						if(!((l==0 && j==2 && k==2 && r==3) || (l==0 && j==3 && k==2 && r==3) || (l==0 && j==2 && k==3 && r==3)))
						{
							B[j][k][r]=(B[j][k][r]+A[l][j][k])%MOD;
						}
					}
				}
			}
		}
		B[0][2][1]=0;
		B[2][0][1]=0;
		B[0][1][2]=0;
		for (long long int j = 0; j < 4; ++j)
		{
			for (long long int k = 0; k < 4; ++k)
			{
				for (long long int l = 0; l < 4; ++l)
				{
					A[j][k][l]=B[j][k][l];
				}
			}
		}
	}
	long long int ans=0;
	for (long long int i = 0; i < 4; ++i)
	{
		for (long long int j = 0; j < 4; ++j)
		{
			for (long long int k = 0; k < 4; ++k)
			{
				ans=(ans+A[i][j][k])%MOD;
			}
		}
	}
	cout<<ans<<endl;
	
	// cin.close();
	// auto end = sc.now();
 //   	auto time_span = static_cast<chrono::duration<double>>(end - start);
 //   	cout<<"Operation took: "<<time_span.count()<<" seconds";

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define debug(a) cout << #a << ": " << a << endl

int main() {
	int a, b, t; cin>>a>>b>>t;
	int now = a, answer = 0;
	while(now <= t){
		answer += b;
		now += a;
	}
	cout<<answer<<endl;	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    string S;
    cin >> S;
    int flip = 0;
    int cnt = 0;
    for (int i = 0; i < S.size(); i++) {
        if (S[i] != '0' + flip) cnt++;
        flip = !flip;
    }
    flip = 1;
    int c2 = 0;
    for (int i = 0; i < S.size(); i++) {
        if (S[i] != '0' + flip) c2++;
        flip = !flip;
    }
    cout << min(cnt, c2) << endl;
}

Measured memory_bytes: 512
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


def str_inp():
    '''
    文字列をリストとして読み込む
    '''
    return list(input()[:-1])


n = inp()
ans = {"AC": 0, "WA": 0, "TLE": 0, "RE": 0}
for _ in range(n):
    s = input()[:-1]
    ans[s] += 1

print("AC x {}".format(ans["AC"]))
print("WA x {}".format(ans["WA"]))
print("TLE x {}".format(ans["TLE"]))
print("RE x {}".format(ans["RE"]))


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

int main() {
  int n = 5, k;
  vector<int> a(n);
  for (auto &e : a) {
    cin >> e;
  }
  cin >> k;
  bool r = true;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      r &= abs(a[i] - a[j]) <= k;
    }
  }
  cout << (r ? "Yay!" : ":(") << endl;
}


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

int main(){
	int n;
	cin >> n;
	int num[n];
	for(int i = 0;i < n;i++){
		cin >> num[i];
	}
	int af_sort[n];
	for(int i = 0;i < n;i++){
		af_sort[i] = num[i];
	}
	int t;
	/*for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			if(af_sort[i]<af_sort[j]){
				t = af_sort[i];
				af_sort[i] = af_sort[j];
				af_sort[j] = t;
			}
		}
	}*/
	sort(af_sort,af_sort + n,greater<int>());
	int check = (af_sort[0] == af_sort[1])?1:0;
	
	if(check == 1){
		for(int i = 0;i < n;i++){
			cout << af_sort[0] << endl;
		}
	}else{
		for(int i = 0;i < n;i++){
			if(num[i] == af_sort[0]){
				t = i;
			}
		}
		for(int i = 0;i < n;i++){
			if(i == t){
				cout << af_sort[1];
			}else{
				cout << af_sort[0];
			}
			cout << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3200
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;

#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int,int>
#define mp make_pair
 
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
 
const int mod=998244353;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
int mul(int a,int b)
{
	return ((a)*1ll*(b))%mod;
}
 
void add(int &a,int b)
{
	a+=b;
	if(a>=mod)a-=mod;
}
 
int sub(int a,int b){
	a-=b;
	if(a<0){
		a+=mod;
	}
	return a;
}
 
int powz(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1){
			res=mul(res,a);
		}
		b/=2;
		a=mul(a,a);
	}
	return res;
}
 
template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
	input>>x.F>>x.S;
	return input;
}
 
template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
	for(auto& i:x)
		input>>i;
	return input;
}
 
template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
	for(auto& i:x)
		output<<i<<' ';
	return output;
}
 
const int N=10000002;

int fc[N],inv[N];

int C(int n,int r){
	if(n<r){
		return 0;
	}
	return mul(mul(fc[n],inv[n-r]),inv[r]);
}

void solve(){
	int n,m;
	cin>>n>>m;
	int tot=3*m;
	int ans=0;
	for(int odd=0;odd<=m;odd++){
		if((tot-odd)&1)continue;
		add(ans,mul(C(n,odd),C(n-1+(tot-odd)/2,n-1)));
	}
	for(int left=2*m+1;left<=3*m;left++){
		ans=sub(ans,mul(n,C(3*m-left+n-2,n-2)));
	}
	cout<<ans;
}

signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int tc=1;
	fc[0]=1;
	for(int i=1;i<N;i++){
		fc[i]=mul(fc[i-1],i);
	}
	inv[N-1]=powz(fc[N-1],mod-2);
	for(int i=N-2;i>=0;i--){
		inv[i]=mul(inv[i+1],i+1);
	}
	//~ cin>>tc;
	for(int _=0;_<tc;_++){
		//~ cout<<"Case #"<<_+1<<": ";
		solve();
		if(_!=tc-1)
		cout<<"\n";
	}
}


Measured memory_bytes: 78336
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <deque>
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
void print(vec v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(vecll v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}


#define INF 1e9+7
#define LLINF 1e18+7
const ll MOD=1e9+7;
const int N=1000000;



main(){
    int n=in();
    vec v;
    rep(i,n){
        v.pb(abs(i-(n-i-1)));
    }
    sort(all(v));
    vec w;
    rep(i,n)w.pb(in());
    sort(all(w));
    if(w==v){
        ll ans=1;
        rep(i,n/2)ans=ans*2%MOD;
        cout<<ans;
    }
    else cout<<0;
}

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

#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define rep_(i, n) for (int i = (int)n - 1; i >= 0; i--)

int N; char aux; bool flag;
vector<int> A;

int main()
{
    cin >> N;

    flag = 0;
    A.resize(N);
    rep(i, N)
    {
        cin >> aux;
        A[i] = aux - '1';
        if (A[i] == 1) flag = 1;
    }

    rep(i, N) if (A[i] == 2) A[i] = !flag;

    rep_(i, 32) if ((N - 1) & (1 << i))
    {
        rep(j, N - (1 << i)) A[j] = A[j] ^ A[j + (1 << i)];
        N -= (1 << i);
    }

    if (flag) cout << A[0] << '\n';
    else cout << A[0] * 2 << '\n';
}

Measured memory_bytes: 7152
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class APalindromicNumber {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int n;
	    in >> n;
	    int f = n / 100;
	    int b = n % 10;
	    ans(f == b, out);
	}
};


int main() {
	APalindromicNumber solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
class BIT(object):
    def __init__(self,A,dot,e,inv=None):
        n=len(A)
        self.__n=n
        self.__dot=dot
        self.__e=e
        self.__inv=inv
        self.__node=['$']+A # 1-indexed
        for i in range(1,n+1):
            j=i+(i&-i)
            if(j<=n): self.__node[j]=dot(self.__node[i],self.__node[j])

    def add(self,i,w):
        i+=1
        while(i<=self.__n):
            self.__node[i]=self.__dot(self.__node[i],w)
            i+=i&-i

    def sum(self,i):
        res=self.__e
        while(i>0):
            res=self.__dot(res,self.__node[i])
            i-=i&-i
        return res
def resolve():
    n=int(input())
    H=list(map(lambda x:int(x)-1,input().split()))
    A=list(map(int,input().split()))
    bit=BIT([0]*n,max,0)
    for i in range(n):
        bit.add(H[i],bit.sum(H[i])+A[i])
    print(bit.sum(n))
resolve()

Measured memory_bytes: 121900
//                      YATIN KWATRA

// AC BAKSHI RABBA

#include <bits/stdc++.h>
#define ll                      long long 
#define ld                      long double
#define ull                     unsigned long long 
#define FIO                     ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl                    "\n"
#define fo(i,a,b)               for(int i = a; i<=b ; i++)
#define rfo(i,a,b)              for(int i = a; i>=b ; i--)
#define vii                      vector<int>
#define vll                     vector<ll>
#define pq                      priority_queue
#define uom                      unordered_map                
#define all(v)                  v.begin(),v.end()
#define mp                      make_pair
#define pb                      push_back
#define pob                     pop_back
#define ff                      first
#define ss                      second
#define pii                     pair<int,int> 
#define pll                     pair<long,long>
#define mll                     map<ll,ll>
#define mii                     map<int,int>
#define vvii                    vector<vii>
#define vvll                    vector<vll>
#define mod                     1000000007
#define pi                      3.1415926535897932384626433832795
// #define node                    Node

using namespace std;

void INPUT() {

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


void solve()
{ 

        int n,x;
        cin >> x >> n;
        
        vii v(n);



        uom<int,bool>h;
        
        fo(i,0,n-1)
        {
          cin >> v[i]; 
          h[v[i]] = true;
        } 

        int up,down;

        int j = x;

        while(h.count(j))
        {
          j++;
        }

        up = j;

        j = x-1;
        while(h.count(j)) j--;

        int dis1 = abs(x-up);
        int dis2 = abs(x-j);

        if(dis2<=dis1) cout << j << endl;
        else cout << up << endl;



    
       
}
int main() {
    
    FIO
    INPUT();
    
    int t;
    t = 1;
 //   cin >> t;
    
    while(t--)
    {
       solve();
    }
    return 0;
}


Measured memory_bytes: 3632
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      String C = sc.next();
      String alfa = "abcdefghijklmnopqrstuvwxyz";
      int A = alfa.indexOf(C);
      System.out.println(alfa.substring(A+1,A+2));
    }
}

Measured memory_bytes: 35280
N = int(input())
if N % 2 != 0:
    print(0)
else:
    k = N // 2
    ans = 0
    i = 1
    while True:
        d = k // (5 ** i)
        if d == 0:
            break
        ans += d
        i += 1
    print(ans)

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

int main(){
  int n;
  cin>>n;
  vector<int>x(n);
  for(int i=0;i<n;i++){
  cin>>x[i];
  }
  sort(x.begin(),x.end());
  int ans=0;
  vector<int>y(n);
  for(int j=0;j<n;j++){
  if(x[j]>n){
  ans++;
  }
  else{
  y[x[j]-1]++;
  }
  }
  for(int k=0;k<n;k++){
  if(y[k]>=k+1){
  ans+=y[k]-(k+1);
  }
  else if(y[k]>0){
  ans+=y[k];
  }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <stdio.h>
int hour(int S)
{
    int h = S / 3600;
    return h;
}
int minute(int S)
{
    int m = S % 3600 / 60;
    return m;
}
int second(int S)
{
    int s = S % 60;
    return s;
}
int main(void) //accepted
{
    int S;

    scanf("%d", &S);
    printf("%d:%d:%d\n", hour(S), minute(S), second(S));

    return 0;
}


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

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = "";
            while ((s = Console.ReadLine()) != null)
            {
                var arr = s.Split(' ').Select(double.Parse).ToArray();
                var str = (arr[0] / arr[1]).ToString("F15").Split('.')[1];
                var sum = str.Substring(0, Math.Min(str.Length, (int)arr[2])).Select(c => c - '0').Sum();
                Console.WriteLine(sum);
            }
        }
    }
}

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

int main() {
    int n , x = 0 , y = 0 , z = 0;
    cin >> n;
    vector <int> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if (a[i] % 4 == 0) x++;
		if (a[i] % 4 == 2) z++;
		if (a[i] % 2 == 1) y++;
    }

	if (z) {
        y++;
    }
	if (x + 1 >= y){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define PI 3.1415926535897932
#define MOD 1000000007;
using namespace std;
long long GCD(long long A,long long B){
  if(B==0){
    return A;
  }
  else{
    return GCD(B,A%B);
  }
}
long long LCM(long long A,long long B){
  long long g=GCD(A,B);
  return A/g*B;
}
long long num_order(long long X){
  long long ans=0;
  while(true){
    if(X==0){
      break;
    }
    else{
      X/=10;
      ans++;
    }
  }
  return ans;
}

vector<pair<long long,long long>> prime_factorize(long long N){
  vector<pair<long long,long long>> res;
  
  for(long long i=2;i*i<=N;i++){
    if(N%i!=0){
    continue;
    }
    
    long long ex=0;
    while(N%i==0){
      ex++;
      N/=i;
    }
    
    res.push_back({i,ex});
  }
  
  if(N!=1){
  res.push_back({N,1});
  }
  
  return res;
}


int main() {
  
  int N;
  cin>>N;
  
  vector<pair<int,int>> P(N);
  for(int i=0;i<N;i++){
    cin>>P[i].first>>P[i].second;
  }
  
  vector<pair<int,int>> Q(N);
  for(int i=0;i<N;i++){
    Q[i].first=P[i].second;
    Q[i].second=P[i].first;
  }
  sort(Q.begin(),Q.end());
  
  long long sum=0;
  
  
  for(int i=0;i<N;i++){
    sum+=Q[i].second;
    if(sum>Q[i].first){
      cout<<"No"<<endl;
      return 0;
    }
  }
  
  cout<<"Yes"<<endl;
}

Measured memory_bytes: 6428
N, W = map(int, input().split())

import numpy as np

dp = np.zeros(W + 1, dtype=np.longlong)

for i in range(N):
    w, v = map(int, input().split())
    np.maximum(dp[:-w] + v, dp[w:], out=dp[w:])

print(dp.max())

Measured memory_bytes: 28864
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
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; }
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    string s;
    cin >> s;
    
    if (s[2] == s[3] && s[4] == s[5]) cout << "Yes" << endl;
    else cout << "No" << endl;
    


    //cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		long answer = 0;

		for (int i = 1; i <= Math.sqrt(N) + 1; i++) {
			if (N % i == 0) answer = N / i + i - 2;
		}

		System.out.println(answer);
	}
}


Measured memory_bytes: 23124
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	while(true) {
    		int H = sc.nextInt();
    		int W = sc.nextInt();
    		if(H == 0 && W == 0) {
    			break;
    		}
    		for(int h = 0; h < H; h ++) {
    			for(int w = 0; w < W; w ++) {
    				System.out.print("#");
    			}
    			System.out.println("");
    		}
    		System.out.println("");
    	}
    }
}


Measured memory_bytes: 34000
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    ab = [list(map(int, input().rstrip('\n').split())) for _ in range(n)]
    ab.sort(key=lambda x: x[1])
    cnt = 0
    for a, b in ab:
        cnt += a
        if b < cnt:
            print("No")
            exit()
    print("Yes")


if __name__ == '__main__':
    slove()


Measured memory_bytes: 83292
#include <bits/stdc++.h>
#include <iostream>
#include<math.h>
using namespace std;
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; }

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

int main()
{
    int64_t N;
    cin >> N;
    vector<pair<int64_t, int64_t>>vec(N);
    for (int64_t i=0; i<N; i++) {
        int64_t n, m;
        cin >> n >> m;
        vec[i] = make_pair(n, m);
    }

    sort(vec.begin(), vec.end(), compare_by_b);
    int64_t sum_time = 0;
    bool work_ok = true;
    for (int64_t i=0; i<N; i++) {
        sum_time += vec[i].first;
        if (sum_time > vec[i].second) {
            work_ok = false;
            break;
        }
    }

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

    return 0;
}

Measured memory_bytes: 6360
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/


// 2^20 = 10^6
ll N;
vector<int> A;

int main(){
    cin >> N;
    A.resize(N);
    rep(i,N){
        cin >> A[i];
    }

    ll l,r;
    l=0;
    r=0;
    int x=0;
    ll ans = 0;
    while(l<N){
        //cerr << "start " <<  l << " " << r << endl;
        while(r<N and (x&A[r])==0){
            x |= A[r];
            r++;
        }
        ans += r-l;
        x ^= A[l];
        l++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR(I,0,N)
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP(I,N) cin>>V[I]
#define INS2(I,N,V1,V2) REP(I,N) cin>>V1[I]>>V2[I];
#define INS3(I,N,V1,V2,V3) REP(I,N) cin>>V1[I]>>V2[I]>>V3[I];
#define OUT(P) cout<<P<<endl
#define OUT2(P1,P2) cout<<P1<<" "<<P2<<endl
#define OUT3(P1,P2,P3) cout<<P1<<" "<<P2<<" "<<P3<<endl
#define OUTS(I,N,V) REP(I,N) cout<<V[i]<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
typedef unsigned long ul;
typedef unsigned int ui;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

long N,A,B;

inline void solve(){
  IN3(N,A,B);
  cout<<(A>B?B:A)<<" "<<(A+B>N?A+B-N:0)<<endl;
}

int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
#include<stdio.h>
#define WHITE 0    //non-visited
#define GRAY 1     //visited
#define BLACK 2    //finished
#define N 101
 
void DFS_Visit(int);
 
int n = 0;
int tt=0;
int color[N],d[N],f[N];
int A[N][N];
 
void DFS(void){
  int i;
  for(i=1 ; i<=n ; i++){
    color[i] = WHITE;
    tt = 0;
  }
   
 
 
  for(i=1 ; i<=n ; i++) if(color[i] == WHITE) DFS_Visit(i);
}
 
void DFS_Visit(int u){
  int i; 
  color[u] = GRAY;
  d[u] = ++tt;
  for(i=1 ; i<=n ; i++) if(color[i] == WHITE && A[u][i]) DFS_Visit(i);
  color[u] = BLACK;
  f[u] = ++tt;
}
 
int main(){
  int i,j,u,k,v;
 
  scanf("%d",&n);
 
 
  for(i=1 ; i<=n ; i++){
    for(j=1 ; j<=n ; j++){
      A[i][j] = 0;
    }
  }
 
  for(i=1 ; i<=n ; i++){
    scanf("%d%d",&u,&k);
    for(j=1 ; j<=k ; j++){
      scanf("%d",&v);
      A[u][v] = 1;
    }
  }
 
  DFS();
 
  for(i=1 ; i<=n ; i++){
    printf("%d ",i);
    printf("%d ",d[i]);
    printf("%d\n",f[i]);
  }
  return 0;
}

Measured memory_bytes: 636
#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;

#define LL unsigned long long int

int main() {
    LL w, h, x, y;

    cin >> w >> h >> x >> y;

    cout << (double)w * h / 2 << " " << ((x == (double)w/2 && y == (double)h/2) ? 1 : 0) << endl;
}

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

#include <iostream>
#include <algorithm>

#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <string>
#include <utility>
#include <array>
#include <complex>
#include <valarray>

#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <chrono>
#include <random>
#include <numeric>


using namespace std;
//#define int long long

typedef long long ll;
typedef unsigned long long ull;
//typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef pair<ll,pll> plpll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const int INF = 1<<30;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

#define addm(X, Y) (X) = ((X) + ((Y) % mod) + mod) % mod
#define inside(y, x, h, w) (0 <= (y) && (y) < (h) && 0 <= (x) && (x) < (w)) ? true : false

char g[55][55];
void dfs(int y, int x, int h, int w, vvi& visited, vvi& tr) {
    visited[y][x] = 1;
    rep(i, 4) {
        int ny = y + dy4[i];
        int nx = x + dx4[i];
        if (!inside(ny, nx, h, w)) continue;
        if (visited[ny][nx] || g[ny][nx]  == 'W' || g[ny][nx] == 'B') continue;
        tr[ny][nx] = 1;
        dfs(ny, nx, h, w, visited, tr);
    }
    return;
}


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while (true) {
        int w, h;
        cin >> w >> h;
        if (w == 0) break;
        vvi visitedw(h, vi(w)); 
        vvi visitedb(h, vi(w));
        vvi trw(h, vi(w));
        vvi trb(h, vi(w));
        rep(i, h)rep(j, w) cin >> g[i][j];
        rep(i, h)rep(j, w) {
            if (g[i][j] == 'W') {
                dfs(i, j, h, w, visitedw, trw);
            }
            else if (g[i][j] == 'B') {
                dfs(i, j, h, w, visitedb, trb);
            }
        }
        int ansb = 0;
        int answ = 0;
        rep(i, h)rep(j, w) {
            if (g[i][j] == 'W' || g[i][j] == 'B') continue;
            if (trw[i][j] == 1) {
                if (trb[i][j] == 1) continue;
                answ++;
            }
            else {
                if (trb[i][j] == 1) ansb++;
            }
        }
        cout << ansb << " " << answ << endl;
    }
}

Measured memory_bytes: 3168
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

static void inputArray(int A[], int num) {
  for (int i = 0; i < num; i++) {
    cin >> A[i];
   }
}

static void printArray(int A[], int num) {
  for (int i = 0; i < num; i++) {
    cout << ((i != 0) ? " " : "") << A[i];
  }
  cout << endl;
}

static const size_t NMAX = 1000;
static const size_t VMAX = 10000;

static vector<int> A(NMAX), B(NMAX);
static vector<int> TABLE(VMAX + 1, 0);
static vector<bool> SORTED(NMAX, false);

static inline void printArray(vector<bool>& A, int num) {
  for (int i = 0; i < num; i++) {
    cout << ((i == 0) ? "" : " ") << A[i];
  } 
  cout << endl;
}

static inline int solve(int A[], int num) {
  B.assign(&A[0], &A[num]);
  sort(B.begin(), B.end());

  for (int i = 0; i < num; i++) {
    TABLE[B[i]] = i;
  }
//  printArray(&TABLE[0], B[num - 1] + 1);

  int ans = 0;
  for (int i = 0; i < num; i++) {
    if (SORTED[i]) {
      continue;
    }
    
    int cursor = i;
    int total = 0;
    int min = VMAX;
    int numInCycle = 0;
    while (true) {
      SORTED[cursor] = true;
      numInCycle++;
      min = std::min(min, A[cursor]);
      total += A[cursor];
      cursor = TABLE[A[cursor]];
      if (SORTED[cursor]) {
        break;     
      }
    }
    ans += std::min(total + (numInCycle - 2) * min, min + total + (numInCycle + 1) * B[0]);
/*
    cout << "total = " << total << ", numInCycle = " << numInCycle << ", min = " << min << ", B[0] = " << B[0] << endl; 
    cout << "ans = " << ans << endl;
    printArray(SORTED, num);
*/
  }

  return ans;
}

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

  inputArray(&A[0], n);

  const int ans = solve(&A[0], n);
  
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 3204
/* atcoder */
#include "bits/stdc++.h"
using namespace std;

/* typedef */
/* long系 */
typedef long long ll;   // long long
typedef long double ld; // long double
/* vector系 */
typedef vector<int> vi;                    // intのvector
typedef vector<double> vd;                 // doubleのvector
typedef vector<ll> vll;                    // llのvector
typedef vector<ld> vld;                    // ldのvector
typedef vector<pair<int, int>> vi_i;       // i_iのvector
typedef vector<pair<double, double>> vd_d; // d_dのvector
typedef vector<pair<ll, ll>> vl_l;         // l_lのvector
typedef vector<pair<ld, ld>> vld_ld;       // ld_ldのvector
typedef vector<string> vs;                 // stringのvector
/* pair系 */
typedef pair<int, int> i_i;       // int同士のpair
typedef pair<double, double> d_d; // double同士のpair
typedef pair<ll, ll> l_l;         // ll同士のpair
typedef pair<ld, ld> ld_ld;       // ld同士のpair

/* define */
#define all(v) v.begin(), v.end() // コンテナ全体
#define PI (acos(-1))             // 円周率pi

/* main */
void Main(void)
{
    double r;
    cin >> r;
    cout << r * r * PI << " " << 2 * PI * r << endl;
}

int main(int argc, char const *argv[])
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();

    return 0;
}



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

int main(void) {
  vector<int> v(3);
  cin >> v[0] >> v[1] >> v[2];
  sort(v.begin(), v.end(), greater<int>());
  cout << v[0] * 10 + v[1] + v[2] << endl;
  return 0;
}

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

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int count = 0;
            for(int i = input[0];i <= input[1]; i++)
            {
                if(i % input[2] == 0 )
                {
                    count++;
                }
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 28252
class Dice
    attr_reader :top, :front, :right, :left, :back, :bottom

    def initialize(top, front, right, left, back, bottom)
        @top, @front, @right, @left, @back, @bottom \
            = top, front, right, left, back, bottom
    end

    def south
        @top, @front, @bottom, @back \
            = @back, @top, @front, @bottom
    end

    def north
        @top, @front, @bottom, @back \
            = @front, @bottom, @back, @top
    end

    def east
        @top, @right, @bottom, @left \
            = @left, @top, @right, @bottom
    end

    def west
        @top, @right, @bottom, @left \
            = @right, @bottom, @left, @top
    end

    def spin
        @front, @right, @back, @left \
            = @right, @back, @left, @front
    end

    def is_equal?(other)
        for i in 0...6
            (i % 2 == 1)? (self.north): (self.east)
            for j in 0...4
                self.spin
                if (self == other)
                    return true
                end
            end
        end

        return false
    end

    def ==(other)
        @top == other.top && @front == other.front \
            && @right == other.right && @left == other.left \
            && @back == other.back && @bottom == other.bottom
    end
end

dice01 = Dice.new(*(gets.chomp.split.map(&:to_i)))
dice02 = Dice.new(*(gets.chomp.split.map(&:to_i)))

puts ((dice01.is_equal?(dice02))? "Yes": "No")

Measured memory_bytes: 6128
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N=INT()

print((N-2)*180)


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int[] h = new int[N];
            for (int i = 0; i < N; i++) {
                h[i] = in.nextInt();
            }

            int count = 0;
            A: for (;;) {
                for (int i = 0; i < N; i++) {
                    if (h[i] > 0) {
                        decrease(N, h, i);
                        count++;
                        continue A;
                    }
                }
                break;
            }

            System.out.println(count);
        }
    }

    private static void decrease(int N, int[] h, int i) {
        for (int j = i; j < N; j++) {
            if (h[j] <= 0) {
                break;
            }
            h[j]--;
        }
    }

    private static int f(int n) {
        return n % 2 == 0 ? (n / 2) : (3 * n + 1);
    }
}


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

const int N = 40000 + 7;

int a[N], b[N];



int main() {
    ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
    string str; cin >> str;
    if(str[1] == str[0] && str[1] == str[2]) cout << "No" << endl;
    else cout << "Yes" << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;


public class MyProgram
{	
    public static void Main()
	{
	    int N = int.Parse(Console.ReadLine());
	    string ans = "";
	    while(N != 0)
	    {
	        if(N % 2 != 0)
	        {
	            ans = "1" + ans;
	            N = (N-1) / -2;
	        }
	        else
	        {
	            ans = "0" + ans;
	            N /= -2;
	        }
	    }
	    if(ans.Length == 0) Console.WriteLine("0");
	    else Console.WriteLine(ans);
	}
}

Measured memory_bytes: 11092
#include<iostream>
#include<string>
#include<string.h>
#include<fstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<cstdlib>
#include<vector>
#include<set>
#include<deque>
#include<queue>
#include<math.h>
#include<chrono>
#include<list>
#include<random>
#include<bitset>
#include<assert.h>
#include<ctime>
#include<cstdio>
#include <unordered_map>
using namespace std;
ifstream fi("zinput.txt");
ofstream fo("output.txt");
#define fast_input() {ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); }
#define ll long long
#define For(i,n) for (int(i) = 0; (i)< (int)(n); (i)++)
#define For1(i,n) for (int(i) = 1; (i) <= (int)(n); (i)++)
#define Forlr(i,l,r) for (int(i) = (int)(l); (i) <= (int)(r); (i)++)
#define Forrl(i,r,l) for (int(i) = (int)(r); (i) >= (int)(l); (i)--)
#define all(a) a.begin(), a.end() 
#define pb push_back
#define pp pop_back
#define mp make_pair
#define PI 3.14159265
#define putno return cout <<"NO", 0;
#define putyes return cout <<"YES", 0;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef map<int, int> mii;
//const ll MOD = 1e9 + 7;
const int N = 1e5 + 5;
//DSU
/*
int p[ N], r[N];
void init(int n) {
	For(i, n) {
		p[i] = i;
	}
}
int get(int x) {
	if (p[x] != x) {
		p[x] = get(p[x]);
	}
	return p[x];
}
bool uni(int x, int y) {
	x = get(x); y = get(y);
	if (x == y) {
		return false;
	}
	if (r[x] >= r[y]) {
		p[y] = x;
	}
	else {
		p[x] = y;
	}
	if (r[x] == r[y]) {
		r[x]++;
	}
	return true;
}
*/

// So mu
/*
int power(int x, unsigned int y, int p)
{
	int res = 1; // Initialize result

	x = x % p; // Update x if it is more than or
	// equal to p

	while (y > 0)
	{
		// If y is odd, multiply x with result
		if (y & 1)
			res = (res*x) % p;

		// y must be even now
		y = y >> 1; // y = y/2
		x = (x*x) % p;
	}
	return res;
}
*/

// ReadHexa
/*
bitset<16400> b[4101];
void readHexa()
{
	For(i, n)
	{
		string st;
		cin>> st;
		For(j, m/4)
		{
			int x;
			if (st[j] >= 'A' && st[j] <= 'F')
				x = st[j] - 'A' + 10;
			else x = st[j] - '0';
			for (int k = 4; k; --k, x >>= 1)
				b[i][j * 4 + k] = x & 1;
		}
	}
}
*/

// nChoosek
/*
ll nChoosek(ll n, ll k)
{
	if (k > n) return 0;
	if (k * 2 > n) k = n - k;
	if (k == 0) return 1;

	ll result = n;
	for (ll i = 2; i <= k; ++i) {
		result *= (n - i + 1);
		result /= i;
	}
	return result;
}
*/

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

/*
MIKUNO - 15/02/1999
*/
int n, m, k, cnt, rs, q;
int x, y;
//	priority_queue <ll, vector<ll>, greater<ll> > q;
//ll n, m, q, k, pos, t, cnt, rs1, check;
ll maxx = -1e9, minn = 1e9;
int ma = -1e9, mi = 1e9;
const int maxn = 2*N;
const ll MOD = 1e9 + 7;
int a, b;
int main()
{
	fast_input();
	cin >> a >> b;
	if (a > b)
	{
		rs += a + a - 1;
	}
	else
	{
		if (a < b) rs += b + b - 1;
		else
			rs += a + b;
	}
	cout << rs;
}

Measured memory_bytes: 256
s=input()
sy=int(s[:2])
sm=int(s[2:])

if 1<=sy<=12 and 1<=sm<=12:
    print('AMBIGUOUS')
elif 1<=sy<=12:
    print('MMYY')
elif 1<=sm<=12:
    print('YYMM')
else:
    print('NA')

Measured memory_bytes: 3060
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

N, K = map(int, input().split())
H = [ int(input()) for _ in range(N) ]

H.sort()
ans = float('inf')
for i in range(N-K+1):
    ans = min(ans, (H[i+K-1] - H[i]))

print(ans)

Measured memory_bytes: 7508
//３つの整数を読み込み、それらを値が小さい順に並べて出力するプログラム

#include <stdio.h>

#define INPUT_COUNT 3

int main(void)
{
    //変数定義
    int aiInput[INPUT_COUNT];
    int iTmp;
    int iCount;
    int iBubleCount;

    //変数の初期化
    for (iCount = 0; iCount < INPUT_COUNT; iCount++)
    {
        aiInput[iCount] = 0;
    }
    iTmp = 0;

    scanf ("%d %d %d",&aiInput[0],&aiInput[1],&aiInput[2]);
    for (iCount = 0; iCount < INPUT_COUNT; iCount++)
    {
        for (iBubleCount = iCount; iBubleCount < INPUT_COUNT; iBubleCount++)
        {
            if (aiInput[iCount] > aiInput[iBubleCount])
            {
                iTmp = aiInput[iCount];
                aiInput[iCount] = aiInput[iBubleCount];
                aiInput[iBubleCount] = iTmp;
            }
            else
            {
                //何もしない
            }
        }
    }
        for (iCount = 0; iCount < INPUT_COUNT; iCount++)
        {
            if (iCount == INPUT_COUNT - 1)
            {
                printf("%d",aiInput[iCount]);
            }
            else
            {
                printf("%d ",aiInput[iCount]);    
            }
        }
        printf("\n");
    return 0;
}


Measured memory_bytes: 2104
import java.util.AbstractMap;
import java.util.Queue;
import java.util.Scanner;
import java.util.concurrent.ArrayBlockingQueue;

public class Main {

     static Scanner scanner;

     public static void main(String[] args) {
         scanner = new Scanner(System.in);

         int H=gi();
         int W=gi();
         String[] a=new String[H];
         int[][] d= new int[H][W];
         int z=H*W;

         Queue<Pair<Integer,Integer>> q=new ArrayBlockingQueue<Pair<Integer,Integer>>(H*W);
         for (int i=0; i<H;i++) {
        	 a[i]=gs();
        	 for (int j=0; j<W;j++) {
            	 char c=a[i].charAt(j);
            	 if(c=='#') {
            		 q.add(new Pair<Integer, Integer>(i, j));
            		 z--;
            		 d[i][j]=0;
            	 } else {
            		 d[i][j]=Integer.MAX_VALUE;
            	 }

             }
         }

         while(z>0) {
        	 Pair<Integer,Integer> p=q.poll();
        	 int h=p.getKey();
        	 int w=p.getValue();
        	 if (h-1>=0 && d[h-1][w]==Integer.MAX_VALUE) {
        		 d[h-1][w]=d[h][w]+1;
        		 q.add(new Pair<Integer,Integer>(h-1, w));
        		 z--;
        	 }
        	 if (w-1>=0 && d[h][w-1]==Integer.MAX_VALUE) {
        		 d[h][w-1]=d[h][w]+1;
        		 q.add(new Pair<Integer,Integer>(h, w-1));
        		 z--;
        	 }
        	 if (h+1<H && d[h+1][w]==Integer.MAX_VALUE) {
        		 d[h+1][w]=d[h][w]+1;
        		 q.add(new Pair<Integer,Integer>(h+1, w));
        		 z--;
        	 }
        	 if (w+1<W && d[h][w+1]==Integer.MAX_VALUE) {
        		 d[h][w+1]=d[h][w]+1;
        		 q.add(new Pair<Integer,Integer>(h, w+1));
        		 z--;
        	 }
         }


         int ans=0;
         for (int i=0; i<H;i++) {
        	 for (int j=0; j<W;j++) {
            	 ans=Math.max(ans, d[i][j]);

             }
         }
         System.out.println(ans);
     }

     public static class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> implements Comparable<Pair<K, V>> {
    		/** serialVersionUID. */
    	    private static final long serialVersionUID = 6411527075103472113L;

    	    public Pair(final K key, final V value) {
    	        super(key, value);
    	    }

    		@Override
    		public int compareTo(Pair<K, V> o) {

    			Comparable key = (Comparable)this.getKey();
    			Comparable key2 = (Comparable)o.getKey();

    			return key.compareTo(key2);
    		}

    	}
     // 文字列として入力を取得
     public static String gs() {
          return scanner.next();
     }

     // intとして入力を取得
     public static int gi() {
          return Integer.parseInt(scanner.next());
     }

     // longとして入力を取得
     public static long gl() {
          return Long.parseLong(scanner.next());
     }

     // doubleとして入力を取得
     public static double gd() {
          return Double.parseDouble(scanner.next());
     }
}

Measured memory_bytes: 105432
def absolute(N,K):
    return abs(N-K)
    
N,K=map(int,input().split())

N=N%K
valuelist = [N%K]

for i in range (0,3):
    i+=1
    N=absolute(N,K)
    valuelist.append(absolute(N,K))
        
print(min(valuelist))

Measured memory_bytes: 3060
from sys import stdin
from sys import stdin
def input():
    return stdin.readline().strip()

n = int(input())
edge = [[] for _ in range(n)]
weight = [[] for _ in range(n)]
for _ in range(n-1):
    i, j, k = map(int, input().split())
    i -= 1
    j -= 1
    edge[i].append(j)
    edge[j].append(i)
    weight[i].append(k)
    weight[j].append(k)

q, k = map(int, input().split())

k -= 1
# root = k
# DFS
distance = [-1] * n
distance[k] = 0
todo = [k]
while len(todo) > 0:
    i = todo.pop(-1)
    for j in range(len(edge[i])):
        if distance[edge[i][j]] == -1:
            distance[edge[i][j]] = distance[i] + weight[i][j]
            todo.append(edge[i][j])

ans = []
for _ in range(q):
    i, j = map(int, input().split())
    ans.append(distance[i-1] + distance[j-1])

for i in ans:
    print(i)

Measured memory_bytes: 109164
using System;

namespace aizu
{
    class OnlineJudge
    {
        const int Max = 1000000;
        static void Main()
        {
            bool[] check = new bool[Max];
            for(int i=3; i < Max; i += 2) {
                if(!check[i]) {
                    for(int l = 2; i * l < Max; ++l) {
                        check[l * i] = true;
                    }
                }
            }
            string num;
            int cnt;
            while((num = Console.ReadLine()) != null) {
                int val = int.Parse(num);
                cnt = val >= 2 ? 1 : 0;
                for(int i=3; i <= val; i += 2) {
                    if(!check[i]) {
                        ++cnt;
                    }
                }
                Console.WriteLine(cnt);
            }
        }
    }
}

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

using ll = long long;
#define ALL(c) (c).begin(), (c).end()
const int MOD = 1000000007;

class UnionFind {
    vector<int> parent;

    public:
        UnionFind(int size) {
            parent = vector<int>(size, -1);
        }

        int find(int x) {
            if (parent[x] < 0) {
                // parent itself
                return x;
            } else {
                return parent[x] = find(parent[x]);
            }
        }

        bool unite(int x, int y) {
            int rX, rY;
            if ((rX = find(x)) == (rY = find(y))) {
                // already united
                return false;
            }
            if (size(rX) < size(rY)) {
                int tmp = rX;
                rX = rY;
                rY = tmp;
            }
            parent[rX] += parent[rY];
            parent[rY] = rX;
            return true;
        }

        int size(int x) {
            return -parent[find(x)];
        }

        bool isSame(int x, int y) {
            return find(x) == find (y);
        }
};

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

    UnionFind uf = UnionFind(n);
    int x, y, z;
    for (int i = 0; i < m; i++) {
        cin >> x >> y >> z;
        uf.unite(x - 1, y - 1);
    }

    set<int> s;
    for (int i = 0; i < n; i++) {
        //cout << uf.size(i) << "|" << uf.find(i) << endl;
        s.insert(uf.find(i));
    }

    cout << s.size() << endl;
}


Measured memory_bytes: 5376