akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;
using namespace std;


int main(int argc, char* argv[])
{
    int n; ll x,d;
    scanf("%d%lld%lld", &n, &x, &d);
    if(d==0) {
        printf("%d\n", (x==0? 1: n+1)); return 0;
    }
    if(d<0) {
        x=-x;
        d=-d;
    }

    map<ll,vector<pair<ll,ll> > > z;
    int i;
    for(i=0; i<=n; i++) {
        ll tmp0=i*x%d;
        if(x<0) {
            ll y=i*(-x)%d;
            tmp0=(d-y)%d;
        }
        ll base=(i*x-tmp0)/d;
        //printf("%lld %lld\n", tmp0,base);
        z[tmp0].push_back(make_pair(base+(ll)(i-1)*i/2, base+(ll)(n+n-i-1)*i/2+1));
    }

    ll ans=0;
    auto it=z.begin();
    for(; it!=z.end(); ++it) {
        vector<pair<ll,ll> >& v=it->second;
        sort(v.begin(), v.end());

        vector<pair<ll,ll> > v2;
        int siz=(int)v.size();
        for(i=0; i<siz; i++) {
            ll l=v[i].first, r=v[i].second;
            if(!v2.empty()) {
                ll r0=v2.back().second;
                if(l<=r0) {
                    v2.back().second=MAX(r0,r);
                    continue;
                }
            }
            v2.push_back(v[i]);
        }

        siz=(int)v2.size();
        for(i=0; i<siz; i++) {
            ans+=v2[i].second-v2[i].first;
        }
    }
    printf("%lld\n", ans);

    return 0;
}



Measured memory_bytes: 22144
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 2100000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << endl;
}
const int mod = 1e9 + 7;

template <std::uint_fast64_t Modulus> class modint {
  using u64 = std::uint_fast64_t;

public:
  u64 a;

  constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  constexpr u64 &value() noexcept { return a; }
  constexpr const u64 &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
	return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
	return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
	return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
	return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
	a += rhs.a;
	if (a >= Modulus) {
	  a -= Modulus;
	}
	return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
	if (a < rhs.a) {
	  a += Modulus;
	}
	a -= rhs.a;
	return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
	a = a * rhs.a % Modulus;
	return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
	u64 exp = Modulus - 2;
	while (exp) {
	  if (exp % 2) {
		*this *= rhs;
	  }
	  rhs *= rhs;
	  exp /= 2;
	}
	return *this;
  }
};

using mint = modint<mod>;

vvl G;
vector<vector<mint>> dp(101010,vector<mint>(2));

void dfs(ll u, ll p){
	dp[u][0] = 1;
	dp[u][1] = 1;
	for(auto v : G[u]){
		if(v==p) continue;
		dfs(v,u);
		dp[u][0] *= dp[v][0]+dp[v][1];
		dp[u][1] *= dp[v][0];
	}
}

int main(){
	ll n; cin >> n;
	G.resize(n);
	rep(i,n-1){
		ll a,b; cin >> a >> b;
		a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	dfs(0,-1);
	mint ans = dp[0][0] + dp[0][1];
	cout << ans.value() << endl;
}

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

int loopCount(const int button, const int count) {
    if (button == 1) {
        return (count - 1) % 5;
    } else if (button == 7 || button == 9) {
        return (count - 1) % 4;
    }
    return (count - 1) % 3;
}

int main() {
    const char keitaiChar[][6] = {".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz",};
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        string input;
        cin >> input;
        int preButton = 0, count = 0;
        for (string::iterator it = input.begin(); it < input.end(); it++) {
            int button = *it - '0';
            if (button == 0) {
                if (preButton != 0) {
                    cout << keitaiChar[preButton - 1][loopCount(preButton, count)];
                    count = 0;
                }
            } else {
                count++;
            }
            preButton = button;
        }
        cout << endl;
    }
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Linq;
public class Hello{
    public static void Main(){
        var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var n = input[0];
        var k = input[1];
        var ans = long.MaxValue;
        var a = new long[n];
        for(var i = 0;i < n;i++){
            a[i] = long.Parse(Console.ReadLine());
        }
        
        Array.Sort(a);
        
        for(var i = 0;i < n - k + 1;i++){
            ans = Math.Min(ans,a[i + k - 1] - a[i]);
        }
        
        Console.WriteLine(ans);
    }
}


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

int main() {
  int N, M;
  cin >> N >> M;
  
  vector<int> city(N);
 
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    
    city.at(a-1)++;
    city.at(b-1)++;
  }
  
  for (int i = 0; i < N; i++) {
    cout << city.at(i) << endl;
  }
}


Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll n;
  cin>>n;
  vector<ll> x(n),y(n),h(n);
  ll check=-1;
  for(ll i=0;i<n;i++){
      cin>>x.at(i)>>y.at(i)>>h.at(i);
      if(h.at(i)>0)check=i;
  }

  for(ll i=0;i<101;i++){
     for(ll j=0;j<101;j++){
        ll H=h.at(check)+abs(x.at(check)-i)+abs(y.at(check)-j);
        bool c=true;
        for(ll k=0;k<n;k++){
            if(h.at(k)>0&&H-h.at(k)!=abs(i-x.at(k))+abs(j-y.at(k))){
                c=false;
                break;
            }
            else if(h.at(k)==0&&H>abs(i-x.at(k))+abs(j-y.at(k))){
                c=false;
                break;
            }
        }
        if(c){
            cout<<i<<" "<<j<<" "<<H<<endl;
            return 0;
        }
     }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll inf=1e9+7;
const ll mod=998244353;
int main(){
    ll m;cin>>m;
    ll sum=0;
    ll sum1=0;
    rep(i,m){
        ll d,c;cin>>d>>c;
        sum+=d*c;
        sum1+=c;
    }
    ll ans=2*((sum-1)/9);
    sum1-=(sum-1)/9;
    ans+=sum1-1;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

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

    string S; cin >>S;
    int cnt = 0;
    rep(i,S.size()) {
      if(S[i] == 'x') cnt++;
    }
    if(cnt >= 8) cout << "NO" << endl;
    else cout << "YES" << endl;
    return 0;
}




Measured memory_bytes: 256
# frozen_string_literal: true

n, m = gets.split.map(&:to_i)
a, b = Array.new(n) { gets.split.map(&:to_i) }.transpose
c, d = Array.new(m) { gets.split.map(&:to_i) }.transpose

n.times do |i|
  min = 4 * 10**8 + 1
  checkpoint = nil

  m.times do |j|
    tmp = (a[i] - c[j]).abs + (b[i] - d[j]).abs

    if min > tmp
      min = tmp
      checkpoint = j + 1
    end
  end

  puts checkpoint
end

Measured memory_bytes: 1788
t = int(input())

import sys
sys.setrecursionlimit(10 ** 6)

def calc(x):
    if x in dp:
        return dp[x]
    
    divs = [5, 3, 2]
    costs = [c, b, a]
    res = d * x
    for div, cost in zip(divs, costs):
        dived = x//div
        res = min(res, calc(dived) + cost + abs(x-dived*div) * d)
        if x > div:
            dived = x//div+1
            res = min(res, calc(dived) + cost + abs(x-dived*div) * d)
    dp[x] = res
    return res

for _ in range(t):
    n, a, b, c, d = list(map(int, input().split()))
    dp = {}
    dp[0] = 0
    dp[1] = d
    print(calc(n))


Measured memory_bytes: 92780
from collections import defaultdict
from itertools import product, groupby
from math import pi
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = 10 ** 10


def count(n):
    ans = 0
    while n % 2 == 0:
        n //= 2
        ans += 1
    return ans


def main():
    N = int(input())
    ans, num = 0, 0
    for i in range(1, N + 1):
        if count(i) >= num:
            num = count(i)
            ans = i

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
# bitDP
INF = 10 ** 10
n, m = gets.split.map(&:to_i)
costs = []
keys = []
m.times do
  costs << gets.to_i
  keys << gets.split.map(&:to_i).inject(0) { |res, num| res | 2 ** (num - 1) }
end
dp = Array.new(2 ** n, INF)
dp[0] = 0
keys.each_with_index do |key, i|
  dp.each_with_index do |cost, opened|
    next if cost == INF
    next_opened = (opened | key)
    dp[next_opened] = cost + costs[i] if dp[next_opened] > cost + costs[i]
  end
end
puts dp.last == INF ? - 1 : dp.last


Measured memory_bytes: 1916
class Daise:
    def __init__(self, info_list):
        self.T = info_list[0]
        self.S = info_list[1]
        self.E = info_list[2]
        self.W = info_list[3]
        self.N = info_list[4]
        self.B = info_list[5]
    
    def change(self, axis):
        if axis == 'S':
            self.T, self.B, self.S, self.N = self.N, self.S, self.T, self.B
        
        elif axis == 'E':
            self.T, self.B, self.E, self.W = self.W, self.E, self.T, self.B
        
        elif axis == 'W':
            self.T, self.B, self.W, self.E = self.E, self.W, self.T, self.B
        
        elif axis == 'N':
            self.T, self.B, self.N, self.S = self.S, self.N, self.T, self.B
        
        elif axis == 'Turn':
            self.S, self.E, self.N, self.W = self.E, self.N, self.W, self.S


if __name__ == '__main__':
    info = list(map(str, input().split()))
    n_input = int(input())

    for _ in range(n_input):
        obj = Daise(info)
        operation = list(map(str, input().split()))
        
        if operation[1] in (obj.T, obj.B):
            obj.change("S")
            
        while obj.S != operation[1]:
            obj.change('Turn')

        while obj.T != operation[0]:
            obj.change('E')

        print(obj.E)


Measured memory_bytes: 5604
#include <bits/stdc++.h>
#define pb push_back
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
const int MOD = 1000000007;
const int oo = 2e9;
const int N = 200000 + 100;
const int LOGN = 18;

ll a , b , c , k;

int main() {
	cin >> a >> b >> c >> k;
	if (k % 2 == 0) {
		printf("%lld\n", a - b);
	} else {
		printf("%lld\n", b - a );
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
using namespace std;
void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
}


int main() {
    init();
int  n,sum=0;
cin>>n;
for(int i=0;i<=n;i++){
    sum=i+sum;
}
cout<<sum;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
string ss;
int main()
{
    cin>>ss;
    if(ss=="SUN")printf("7");
    if(ss=="MON")printf("6");
    if(ss=="TUE")printf("5");
    if(ss=="WED")printf("4");
    if(ss=="THU")printf("3");
    if(ss=="FRI")printf("2");
    if(ss=="SAT")printf("1");
    return 0 ;
}


Measured memory_bytes: 764
#include <iostream>
using namespace std;
typedef long long ll;

const ll MOD = 1000000007;

ll modpow(ll x, ll n){
    ll res = 1, r = x;
    while(n){
        if(n & 1) res = res * r % MOD;
        r = r * r % MOD;
        n >>= 1;
    }
    return res;
}

int main()
{
    ll n, k;
    cin >> n >> k;
    ll d[100005]{0};
    ll ans = 0;
    for(ll i = k; i >= 1; i--){
        d[i] = modpow(k / i, n);
        for(int j = i * 2; j <= k; j += i) d[i] = (d[i] + MOD - d[j]) % MOD;
        ans = (ans + d[i] * i) % MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 4416
from collections import Counter

def get_prime_factors(x):
    out = []
    if x < 1:
        return out
    while not x%2:
        out.append(2)
        x //= 2
    i = 3
    while i*i <= x:
        if not x%i:
            out.append(i)
            x //= i
        else:
            i += 2
    if x != 1:
        out.append(x)
    return out

def main():
    n = int(input())
    ans = 0
    primes = Counter(get_prime_factors(n))
    for k, v in primes.items():
        num = 1
        while v >= num:
            v -= num
            ans += 1
            num += 1
    print(ans)
        

if __name__ == "__main__":
    main()

Measured memory_bytes: 9468
a_hands = list(input())
b_hands = list(input())
c_hands = list(input())
turn = 'a'

while True:
    if turn == 'a':
        if len(a_hands) == 0:
            print('A')
            break
        turn = a_hands.pop(0)
    elif turn == 'b':
        if len(b_hands) == 0:
            print('B')
            break
        turn = b_hands.pop(0)
    elif turn == 'c':
        if len(c_hands) == 0:
            print('C')
            break
        turn = c_hands.pop(0)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(ll I = int((B)-1); I >= int(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;

class comb{
	vector<ll> f,fr;
	ll MOD;
	public:
	//a^(p-1) = 1 (mod p)(p->Prime numbers)
	//a^(p-2) = a^(-1)
	ll calc(ll a,ll b,ll p){//a^(b) mod p   
		if(b==0)return 1;
		ll y = calc(a,b/2,p);y=(y*y)%p;
		if(b & 1) y = (y * a) % p;
		return y;
	}
	void init(ll n,ll mod){//input max_n
		MOD = mod;
		f.resize(n+1);
		fr.resize(n+1);
		f[0]=fr[0]=1;
		for(ll i=1;i<n+1;i++){
			f[i] = (f[i-1] * i) % mod;
			fr[i] = calc(f[i],mod-2,mod);
		}
	}
	ll nCr(ll n,ll r){
		return f[n] * fr[r] % MOD * fr[n-r] % MOD;
	}
};

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	comb co;
	ll N,A,B,C;
	cin >> N >> A >> B >> C;
	ll ans = 0;
	co.init(2*N+2,MOD);

	ll ApB_1 = co.calc(A+B,MOD-2,MOD);
	FOR(i,N,2*N){
		ll a = co.calc(A,N,MOD)*co.calc(ApB_1,N,MOD)%MOD*co.calc(B,i-N,MOD)%MOD*co.calc(ApB_1,i-N,MOD)%MOD*co.nCr(i-1,N-1)%MOD;
		ll b = co.calc(B,N,MOD)*co.calc(ApB_1,N,MOD)%MOD*co.calc(A,i-N,MOD)%MOD*co.calc(ApB_1,i-N,MOD)%MOD*co.nCr(i-1,N-1)%MOD;
		ll j = i*100%MOD*co.calc(100-C,MOD-2,MOD)%MOD;
		ans += (a+b)*j%MOD;
		ans %= MOD;
	}
	//ans = ans*100%MOD*co.calc(100-C,MOD-2,MOD)%MOD;
	cout << ans << endl;
}


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

bool isPalindrome(string str)
{
    // Start from leftmost and rightmost corners of str
    int l = 0;
    int h = str.size() - 1;

    // Keep comparing characters while they are same
    while (h > l)
    {
        if (str[l++] != str[h--])
        {
            return false;
        }
    }
    return true;
}

int main()
{
    string str;
    cin >> str;
    int n = str.size();
    if(!isPalindrome(str)){
        cout << "No" << endl;
        return 0;
    }
    string s = "";
    for(int i=0;i<((n-1)/2);++i){
        s = s + str[i];
    }
    if(!isPalindrome(s)){
        cout << "No" << endl;
        return 0;
    }
    s = "";
    for(int i=((n+3)/2)-1;i<n;++i){
        s = s + str[i];
    }
    if(!isPalindrome(s)){
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string.h>
using namespace std;
int main(){
	string S, T;
	cin >> S >> T;
	if(S.size() < 1 || S.size() > 10){
		cout << "No";
		return 0;
	}
	if(!strncmp(S.c_str(), T.c_str(), S.size()) && T.size() == S.size()+1){
		cout << "Yes";
	} else {
		cout << "No";
	}
	return 0;
	
}

Measured memory_bytes: 3092
import java.util.*;

public class Main {

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

		int n = Integer.parseInt(sc.next());
		ArrayList<Integer> a = new ArrayList<>();

		for (int i = 0; i < n; i++) {
			a.add(Integer.parseInt(sc.next()));
		}
		sc.close();

		long ans1 = 0;
		long sum1 = 0;
		long sign1 = 1;
		for (int i = 0; i < n; i++) {
			sum1 += a.get(i);
			if (sum1 * sign1 <= 0) {
				ans1 += Math.abs(sum1) + 1;
				sum1 = sign1;
			}
			sign1 *= -1;
		}

		long ans2 = 0;
		long sum2 = 0;
		long sign2 = -1;
		for (int i = 0; i < n; i++) {
			sum2 += a.get(i);
			if (sum2 * sign2 <= 0) {
				ans2 += Math.abs(sum2) + 1;
				sum2 = sign2;
			}
			sign2 *= -1;
		}

		System.out.println(Math.min(ans1, ans2));
	}

	public static int[] arrayInt(Scanner sc, int n) {
		int[] array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
		}
		return array;
	}

	public static long[] arrayLong(Scanner sc, int n) {
		long[] array = new long[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextLong();
		}
		return array;
	}

	public static double[] arrayDouble(Scanner sc, int n) {
		double[] array = new double[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextDouble();
		}
		return array;
	}
}


Measured memory_bytes: 49060
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        if(a > b){
            int k = a;
            a = b;
            b = k;
        }
        if(b > c){
            int k = b;
            b = c;
            c = k;
        }
        if(a > b){
            int k = a;
            a = b;
            b = k;
        }

        System.out.printf("%d %d %d\n",a,b,c);
        sc.close();
    }
}


Measured memory_bytes: 26380
#include <stdio.h>
int main(){
  int a,b,j = 0,ans = 0;
  scanf("%d %d",&a,&b);
  int l[a];
  for(int i = 0;i < a;i++){
    scanf("%d",&l[i]);
  }
  for(int i = 0;i < a - 1;j++){
    if(l[j] < l[j + 1]){
      int t = l[j + 1];
      l[j + 1] = l[j];
      l[j] = t;
    }
    if(j + 3 > a){
      j = -1;
      i++;
    }
  }
  for(int i = 0;i < b;i++){
    ans += l[i];
  }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
ll dp[100005][4]={0};
int main(){
  string s;
  cin>>s;
  int n=s.length();
  dp[0][0]=1;
  for(int i=0;i<n;i++){
    if(s[i]=='?'){
      for(int j=0;j<4;j++) dp[i+1][j]+=dp[i][j]*3;
      dp[i+1][1]+=dp[i][0];
      dp[i+1][2]+=dp[i][1];
      dp[i+1][3]+=dp[i][2];
    }
    else{
      for(int j=0;j<4;j++){
        dp[i+1][j]+=dp[i][j];
      }
      if(s[i]=='A') dp[i+1][1]+=dp[i][0];
      if(s[i]=='B') dp[i+1][2]+=dp[i][1];
      if(s[i]=='C') dp[i+1][3]+=dp[i][2];
    }
    for(int j=0;j<4;j++) dp[i+1][j]%=mod;
  }

/*  for(int j=0;j<4;j++){
    for(int i=0;i<=n;i++) cout<<dp[i][j]<<" ";
    cout<<endl;
  } */
  cout<<dp[n][3]<<endl;
}


Measured memory_bytes: 3584
/* author:hellojim */
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
#define forn(i,a,b)for(int i=(a),_b=(b);i<=_b;i++)
#define fore(i,b,a)for(int i=(b),_a=(a);i>=_a;i--)
#define rep(i,n)for(int i=0,_n=n;i<n;i++)
#define ll long long
#define pii pair<int,int>
#define vi vector<int>
#define vpii vector<pii>
#define m_p make_pair
#define re return
#define pb push_back
#define si set<int>
#define ld long double
#define X first
#define Y second
#define st string
#define ull unsigned long long
#define mod 1000000007
#define INF 1000000007
#define x1 XZVJDFADSPFOE
#define y1 GASDIJSLDAEJF
#define x2 DFDAJKVOHKWIW
#define y2 PSFSAODSXVNMQ
#define LLINF 0x3f3f3f3f3f3f3f3fLL
using namespace std;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
ll quickpower(ll n,ll k){
	ll ans=1;
	while(k){
		if(k%2){
			ans*=n;
			ans%=mod;
		}
		n*=n;
		n%=mod;
		k/=2;
	}
	return ans;
}
string int_to_string(int n)
{
	string s="";
	while(n)
	{
		int now=n%10;
		s+=now+'0';
		n/=10;
	}
	reverse(s.begin(),s.end());
	return s;
}
int string_to_int(string s)
{
	int n=0;
	rep(i,s.size())
	{
		n*=10;
		n+=s[i]-'0';
	}
	return n;
}
ll d,t,s;
int main()
{
	ios::sync_with_stdio(0);
	//think twice,code once
	cin>>d>>t>>s;
	if(t*s>=d)cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}



Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <set> 
#include <algorithm>
using namespace std;

int main(){
int ans=0;string s;
int n;
cin>>n;
cin>>s;
for(int i=0;i<s.size()-1;i++){
    set <int> s1,s2;
    int result=0;
    for(int j=0;j<=i;j++){
        s1.insert(s[j]);
    }

    for(int j=i+1;j<=s.size()-1;j++){
        if(s1.find(s[j])!=s1.end() and s2.find(s[j])==s2.end() ) result++;
        s2.insert(s[j]);
    }
   // int result=min(s1.size(),s2.size());
    ans=max(ans,result);
}
cout<<ans<<endl;
return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------


void _main() {
	int A, B, T;
	cin >> A >> B >> T;
	int num = A;
	int answer = 0;
	while (num <= T) {
		answer += B;
		num += A;
	}
	cout << answer << endl;
}

Measured memory_bytes: 256
'use strict'

function Main(input) {
  const a = Number(input.split("\n")[0])
  const s = input.split("\n")[1]

  if(a >= 3200) {
    console.log(s)
  } else {
    console.log("red")
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8").trim())


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

int ans( int a, int b, int c, int n ){
  if( (a%2 == 1) || (b%2 == 1) || (c%2 == 1) ) return n;
  return ans( b/2 + c/2, a/2 + c/2, a/2 + b/2, n + 1 );
}

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  if( a%2 == 0 && a == b && b == c ){
    cout << "-1" << endl;
  }
  else{
    cout << ans( a, b, c, 0 ) << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,N) for(i=0;i<N;i++)
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL;
  typedef pair<ll,char> PLC;
  typedef pair<char,ll> PCL;

int main(void){
  int N;cin >> N;
  int count = 0;
  int i;REP(i,N){
    int x;cin >> x;
    while(x%2==0){
      count++;
      x/=2;
    }
  }
  cout << count << endl;
  return 0;
}


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

int main(){
    long long int n;
    cin >> n;
    char c[100];
    int cou=0;
    while(n>0){
        c[cou]=('a'+(n+25)%26);
        if(n%26==0){n/=26; n-=1;}
        else n/=26;
        cou++;
    }
    for(int i=0;i<cou;i++)cout << c[cou-1-i];
}

Measured memory_bytes: 3632
//#pragma GCC optimize ("-O3","unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>


#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<'\n';
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
#define int long long
#define all(x) (x).begin(), (x).end()
#define double long double

using namespace std;

int MOD = (ll)1000000000 + 7;
const ll INF = 1e17;
const double pi = acos(-1);
const double EPS = 1e-10;
typedef pair<int, int>P;
const int MAX = 200020;

int H, W;
char maze[1010][1010];
vector<P>v, v2;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int X, Y, Z; cin >> X >> Y >> Z;
	int even = 0, odd = 0;
	if (X % 2 == 0)even++; else odd++;
	if (Y % 2 == 0)even++; else odd++;
	if (Z % 2 == 0)even++; else odd++;
	if (even >= 2) {
		print("Tem");
	}
	else print("Hom");
}



Measured memory_bytes: 3236
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());

using ll = long long int;
const ll MOD = 1000000007;

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

ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

ll mod_add(ll a, ll b) {
    return (a + b) % MOD;
}

ll mod_sub(ll a, ll b) {
    return (a + MOD - b) % MOD;
}

ll mod_mul(ll a, ll b){
    return (a * b) % MOD;
}

ll mod_pow(ll base, ll po) {
    if(po == 0)
        return 1;
    else if(po == 1)
        return base;
    ll new_base = mod_pow(base, po / 2);
    return mod_mul(mod_mul(new_base, new_base), po % 2 == 0 ? 1 : base);
}

ll mod_div(ll a, ll b){
    return mod_mul(a, mod_pow(b, MOD - 2));
}

ll comb(ll a, ll b) {
    ll ans = 1;
    ll c = min(b, a - b);
    ll d = max(b, a - b);
    for(int i = 1; i <= c; ++i) {
        ans = ans * (d + i) / i;
    }
    return ans;
}

int main(){
    int n;
    cin >> n;
    vector<string> s(n);
    repi(i, s) {
        cin >> *i;
        sort((*i).begin(), (*i).end());
    }
    sort(s.begin(), s.end());
    map<string, int> m;
    repi(i, s) {
        if(m.find(*i) != m.end()) {
            m[*i] += 1;
        } else {
            m[*i] = 1;
        }
    }
    ll sum = 0;
    repi(i, m) {
        if(i->second == 1) {
            continue;
        }
    //    cout << i->second << endl;
        sum += comb(i->second, 2);
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 13568
#include<stdio.h>
int main(){
int a=0,b=0,c=0,i,d,e;
for(i=0;i<10;i++){
scanf("%d\n",&d);
if(a<d){
e=a;
a=d;
d=e;
}
if(b<d){
e=b;
b=d;
d=e;
}
if(c<d){
e=c;
c=d;
d=e;
}
}
printf("%d\n%d\n%d\n",a,b,c);
return 0;
}



Measured memory_bytes: 2124
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

typedef long long ll;

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; }
const ll INF = 1e9;
const long long INFL = 1LL<<60;

int main() {
  int m;
  cin >> m;
  cout << 48 - m << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    String  S = sc.next();
	String  T = sc.next();
 
	int ans = 0;
      for(int i=0; i<3; i++){
		if(S.charAt(i) == T.charAt(i)){
          ans++;
        }
      }
      System.out.println(ans);
    }
}

Measured memory_bytes: 23252
#define taskname ""

#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>

using namespace std;
#define long long long

const int N = 3e3 + 10;

int n, m, f[N][N], trace[N][N];
char s[N], t[N];

int main()
{
//    freopen(taskname".INP", "r", stdin);
//    freopen(taskname".OUT", "w", stdout);
    cin.tie(nullptr); ios_base::sync_with_stdio(false);

    cin >> s + 1 >> t + 1;
    n = strlen(s + 1), m = strlen(t + 1);

    for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= m; ++j) {
            f[i][j] = f[i - 1][j], trace[i][j] = 0;

            if (f[i][j - 1] > f[i][j]) f[i][j] = f[i][j - 1], trace[i][j] = 1;
            if (s[i] == t[j] && f[i][j] < f[i - 1][j - 1] + 1) {
                f[i][j] = f[i - 1][j - 1] + 1;
                trace[i][j] = 2;
            }
        }

    vector<char> res;
    int i = n, j = m;
    while (i > 0 && j > 0) {
        if (trace[i][j] == 2) {
            res.push_back(s[i]);
            --i, --j;
            continue;
        }
        if (!trace[i][j]) --i;
        else --j;
    }
    reverse(res.begin(), res.end());
    for (char cur : res) cout << cur;

    return 0;
}


Measured memory_bytes: 70912
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

// vectorの重複削除
// std::sort(test.begin(), test.end()); 昇順
// test.erase(std::unique(test.begin(), test.end()), test.end());

using namespace std;
using ll = long long;
using P = pair<int, int>; // vector<P> ba(n); みたいな感じですぐ使える ba[i] = P(a, b); make_pairをしなくてもいい
// typedef vector<int> v;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}
#define rep(i, c) for(int i = 0; i < int(c); i++)
#define ALL(x) (x).begin(), (x).end() //sort(ALL(obj))みたいな
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値
#define pb push_back //
// const int MOD = 1000000007;
// string alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
// printf("%.20f\n", ans); あれ
// const double PI = 3.141592653589793238462643383;



int main() {
  ll a,b; cin>>a>>b;
  ll cnt = 0;
  rep(i, a) {
    ll x,y; cin>>x>>y;
    if (x*x + y*y <= b*b) cnt++;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 3156
def main():
    """
    2<= N <= 50

    a_x += a_y: 2N回まで

    a_1 <= a_2 <= ... <= a_N にする
    """
    N = int(input())
    A = map(int, input().split())
    A = list(A)

    solve(N, A)


def solve(N, A):
    if A == sorted(A):
        print(0)
        return

    p = [i for i, a in enumerate(A) if a >= 0]
    m = [i for i, a in enumerate(A) if a < 0]

    # 調整
    operations = []
    plus = len(p) > 0
    if p and m:
        p_max_a = max(A[i] for i in p)
        m_min_a = min(A[i] for i in m)

        if abs(m_min_a) > abs(p_max_a):
            idx_list = p
            idx = A.index(m_min_a)
        else:
            idx_list = m
            idx = A.index(p_max_a)

        for i in idx_list:
            A[i] += A[idx]
            operations.append((idx+1, i+1))

    if sum(A) >= 0:
        for i in range(1, N):
            operations.append((i, i+1))
            A[i] += A[i-1]
    else:
        for i in range(N-1, 0, -1):
            operations.append((i+1, i))
            A[i-1] += A[i]

    print(len(operations))
    for src, dst in operations:
        print(src, dst)

    debug = False
    if debug:
        print(A)
        assert A == sorted(A)
        assert len(operations) <= N * 2


if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vvi vector<vi>
#define all(a)  (a).begin(),(a).end()

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; }

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

const ll INF = 1LL << 60;

int main(){
  int n; cin >> n;
  vi x(n), y(n), h(n);
  int index;
  rep(i, n){
    cin >> x[i] >> y[i] >> h[i];
    if(h[i] >= 1) index = i;
  }
  rep(px, 101) rep(py, 101){
    int ph = h[index] + abs(x[index] - px) + abs(y[index] - py);
    bool ok = true;
    rep(i, n){
      int tmp = max(ph - abs(x[i] - px) - abs(y[i] - py), 0);
      if(tmp != h[i]) ok = false;
    }
    if(ok){
      printf("%d %d %d\n",px, py, ph);
      return 0;
    }
  }

}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.List;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {

		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int n = in.nextInt();
			long a = in.nextLong(), b = in.nextLong();
			long[] x = in.nextLongArray(n);

			long ans = 0;
			List<Long> dist = new ArrayList<>();
			for (int i = 1; i < n; i++) {
				dist.add(x[i] - x[i-1]);
			}

			for (long l : dist) {
				if (b < l*a) {
					ans += b;
				} else {
					ans += l*a;
				}
			}

			out.println(ans);
		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}


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

using namespace std;

typedef long long ll;
typedef double long dl;
typedef pair < int , int > pii;
typedef pair < pii, pii > p2i;
const int maxn = (int) 3e5 + 1;
const int mod = (int) 1e9 + 7;
const ll inf = (ll)1e18;

#define fi first
#define se second
#define acel ios_base :: sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define next continue
#define getsz(x) (int) log10(x)

int a, b;
int s[200][200];
int main(){
    cin >> a >> b;
    a--, b--;
    cout << "100 100\n";
    for(int i = 1; i <= 100; i++){
        for(int j = 1; j <= 50; j++){
            s[i][j] = 1;
        }
    }
    for(int i = 1; i <= 100; i += 2){
        int p = 1;
        if(i % 2 == 0){
            p++;
        }
        for(int j = p; j < 50; j += 2){
            if(a == 0){
                break;
            }
            a--;
            s[i][j] = 0;
        }
        if(a == 0){
            break;
        }
    }
    for(int i = 2; i <= 100; i += 2){
        int p = 52;
        if(i % 2 == 0){
            p++;
        }
        for(int j = p; j <= 100; j += 2){
            if(b == 0){
                break;
            }
            b--;
            s[i][j] = 1;
        }
        if(b == 0){
            break;
        }
    }
    for(int i = 1; i <= 100; i++){
        for(int j = 1; j <= 100; j++){
            cout << (s[i][j] == 0 ? "." : "#");
        }
        cout << "\n";
    }
}


Measured memory_bytes: 384
X, N = map(int, input().split())
p_list = list(map(int, input().split()))
abs_num = 0


def func(near):
    if near not in p_list:
        print(near)
        quit()


while(True):
    near = X - abs_num
    func(near)
    near = X + abs_num
    func(near)
    abs_num += 1

Measured memory_bytes: 9188
n = int(input())
L = list(map(int, input().split()))
K = -1

def main():
    bool1 = True
    global n,L,K 
    K += 1

    while(bool1 == True):
        for k in range(n):
            if L[k] %2 ==0:
                L[k] = L[k]/2

            else:
                bool1 = False
                break
        if(bool1 == True):
            main()

main()
print(K)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0;i<(n);++i)
#define per(i, n) for(int i=(n)-1;i>=0;--i)
#define repa(i, n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
const ll MOD = (ll)1e9+7;
const ll INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}

const ll MAX = 1e6;

ll modpow(ll x, ll b){
	ll res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

ll modinv(ll x){
	return modpow(x, MOD-2);
}

int main(){

	ll n, s;
	cin >> n >> s;
	if(n==s){
		cout << n + 1 << endl;
		return 0;
	}
	if(n<s){
		cout << -1 << endl;
		return 0;
	}

	function<ll(ll, ll)> func = [&](ll b, ll n){
		if(n<b)return n;
		return func(b, n/b) + n%b;
	};
	
	for(ll i=2;i*i<=n;++i){
		if(func(i, n)==s){
			cout << i << endl;
			return 0;
		}
	}

	ll ans = INFLL;

	for(ll i=1;i*i<=n;++i){
		if((n-s)/i+1==1)continue;
		if(func((n-s)/i+1, n)==s){
			chmin(ans, (n-s)/i+1);
		}
	}
	if(ans==INFLL){
		cout << -1 << endl;
		return 0;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
struct compare
{
    bool operator()(const int& first, const int& second)
    {
        return first>second;
    }
};
void solve()
{
    int n;
    cin>>n;
     int cnt=0; int res=0;
    for(int i=1; i<=n; i++)
    {
        int temp = i; int cnt =0;
        while(temp)
        {
            int a= temp%10;
            temp=temp/10;
            cnt++;
        }
        if(cnt%2==1) res++;

    }
    cout<<res<<endl;

}

int main()
{
    int t;
    t=1;
    while(t--)
    {
        solve();
    }
}



Measured memory_bytes: 256
class Dice:
    
    def __init__(self, lst):
        self.val=[]
        self.val.append(lst[0])
        self.val.append(lst[1])
        self.val.append(lst[2])
        self.val.append(lst[3])
        self.val.append(lst[4])
        self.val.append(lst[5])

    def rotate(self,dir):
        if dir=="N":
            tmp=self.val[0]
            self.val[0]=self.val[1]
            self.val[1]=self.val[5]
            self.val[5]=self.val[4]
            self.val[4]=tmp
        if dir=="E":
            tmp=self.val[0]
            self.val[0]=self.val[3]
            self.val[3]=self.val[5]
            self.val[5]=self.val[2]
            self.val[2]=tmp
        if dir=="S":
            tmp=self.val[0]
            self.val[0]=self.val[4]
            self.val[4]=self.val[5]
            self.val[5]=self.val[1]
            self.val[1]=tmp
        if dir=="W":
            tmp=self.val[0]
            self.val[0]=self.val[2]
            self.val[2]=self.val[5]
            self.val[5]=self.val[3]
            self.val[3]=tmp

def int_to_dir(n):
    if n==0:
        return "N"
    if n==1:
        return "E"
    if n==2:
        return "S"
    if n==3:
        return "W"

import random 

def areSame(D1,D2):
    Determin=False
    for i in range(100):

        D2.rotate(int_to_dir(random.randint(0,4)))

        if D1.val==D2.val:
            Determin=True

    return Determin
    
    
n = int(input())
Instance=[]
for i in range(n):
    x = list(map(int,input().split()))
    Instance.append(Dice(x))
    #print(Instance)
    #print("val:",Instance[i].val)
    #print(Instace[i].val)

Ans=True
for i in range(n-1):
    for j in range(i+1,n):
        D1=Instance[i]
        D2=Instance[j]
        if areSame(D1,D2):
            Ans=False

if Ans:
    print("Yes")
else:
    print("No")






Measured memory_bytes: 8220
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main(){

    long long N,K;
    cin>>N>>K;

    long long ans=0;
    long long mod=1000000007;
    for(long long i=K;i<=N+1;i++){
        ans+=(N*(N+1)/2-(N-i)*(N-i+1)/2-(i-1)*i/2)+1;
        ans%=mod;
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 3604
// 深さ優先探索
package main

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

func genid(a, b int) int {
	if b < a {
		a, b = b, a
	}
	return a*100000 + b
}

func main() {
	defer flush()

	N := readInt()

	ab := make([][2]int, N-1)
	edges := make([][]int, N)
	for i := 0; i < N-1; i++ {
		a := readInt() - 1
		b := readInt() - 1
		ab[i][0], ab[i][1] = a, b
		edges[a] = append(edges[a], b)
		edges[b] = append(edges[b], a)
	}

	colors := make(map[int]int)
	q := make([][3]int, 0)
	q = append(q, [3]int{0, -1, -1})
	for len(q) != 0 {
		currentNode, usedColor, parentNode := q[len(q)-1][0], q[len(q)-1][1], q[len(q)-1][2]
		q = q[:len(q)-1]
		color := 1
		for _, childNode := range edges[currentNode] {
			if childNode == parentNode {
				continue
			}
			if color == usedColor {
				color++
			}
			colors[genid(currentNode, childNode)] = color
			q = append(q, [3]int{childNode, color, currentNode})
			color++
		}
	}

	K := -1
	for i := 0; i < N; i++ {
		t := len(edges[i])
		if t > K {
			K = t
		}
	}
	println(K)

	for i := 0; i < N-1; i++ {
		println(colors[genid(ab[i][0], ab[i][1])])
	}
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}

func readInt() int {
	result, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return result
}

var stdoutWriter = bufio.NewWriter(os.Stdout)

func flush() {
	stdoutWriter.Flush()
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdoutWriter, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdoutWriter, args...)
}


Measured memory_bytes: 17024
#include <algorithm>
#include <iostream>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

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

    int N, M;
    cin >> N >> M;
    vector<tuple<int, int>> V;
    for (int i = 0; i < M; ++i) {
        int a, b;
        cin >> a >> b;
        V.push_back(make_tuple(b, a));
    }
    sort(V.begin(), V.end());
    int x = -1;
    int ans = 0;
    for (int i = 0; i < (int)V.size(); ++i) {
        int a = get<1>(V[i]);
        int b = get<0>(V[i]);
        if (a <= x) {
            continue;
        }
        x = b - 1;
        ++ans;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1400
#include <iostream>
#include <iomanip>
#include <set>

int main() {
  int N, M;
  int h, m;
  std::set<int> s;

  std::cin >> N;

  for (int i = 0; i < N; ++i) {
    std::cin >> h >> m;
    s.insert(h * 60 + m);
  }

  std::cin >> M;

  for (int i = 0; i < M; ++i) {
    std::cin >> h >> m;
    s.insert(h * 60 + m);
  }

  for (auto i = s.begin(); i != s.end(); ++i) {
    int v = *i;

    if (std::next(i) == s.end()) {
      std::cout << v / 60 << ":" << std::setw(2) << std::setfill('0') << v % 60 << std::endl;
    } else {
      std::cout << v / 60 << ":" << std::setw(2) << std::setfill('0') << v % 60 << " ";
    }
  }

  return 0;
}



Measured memory_bytes: 3164