akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;

#define loop(i,N) for(ll (i)=0; (i)<(N);++(i))
#define OMAZINAI cin.tie(0); ios::sync_with_stdio(false);
#define INF (1LL<<61)
typedef long long int ll;
int a, b, c, d;
ll sum[600][600], d_sum[600][600], d_sum2[600][600];

int main() {
	OMAZINAI;
	ll N, M, Q;
	cin >> N >> M >> Q;
	/*auto show = [N](ll s[600][600]) {
		cout << "------" << endl;
		loop(i, N+1) {
			loop(n, N+1)
				cout << s[i][n] << ", ";
			cout << endl;
		}
		cout << "------" << endl;
	};*/
	loop(i, M) {
		cin >> a >> b;
		++d_sum[a][b];
	}
	//show(d_sum);
	loop(i, N+1) {
		ll tmp = 0;
		loop(n, N+1) {
			tmp += d_sum[i][n];
			d_sum2[i][n] = tmp;
		}
	}
	//show(d_sum2);
	loop(n, N+1) {
		ll tmp = 0;
		loop(i, N+1) {
			tmp += d_sum2[i][n];
			sum[i][n] = tmp;
		}
	}
	//show(sum);
	while (Q--) {
		cin >> a >> b;
		cout << sum[b][b] - sum[b][a - 1] - sum[a - 1][b] + sum[a - 1][a - 1] << endl;
	}

	return 0;
}

Measured memory_bytes: 9088
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
		}
		int ct = 0;
		for (int i = 0; i < N; i++) {
			for (int j = N - 1; j > 0; j--) {
				if (A[j] < A[j - 1]) {
					int k = A[j];
					A[j] = A[j - 1];
					A[j - 1] = k;
					ct++;
				}
			}
		}
		for (int i = 0; i < N; i++) {
			System.out.print(A[i]);
			if (i < N - 1) {
				System.out.print(" ");
			}
		}
		System.out.println();
		System.out.println(ct);
	}
}



Measured memory_bytes: 26360
def resolve():
    import sys
    from collections import deque
    def input(): return sys.stdin.readline().rstrip()
    n, Q = [int(i) for i in input().split()]
    A = [deque() for _ in range(n)]
    for _ in range(Q):
        q = [int(i) for i in input().split()]
        if q[0] == 0:
            A[q[1]].append(q[2])
        elif q[0] == 1:
            print(*A[q[1]])
        else:
            if len(A[q[2]]) == 0:
                A[q[2]] = A[q[1]]
            else:
                if len(A[q[2]]) == 1:
                    A[q[1]].appendleft(A[q[2]][0])
                    A[q[2]] = A[q[1]]
                else:
                    A[q[2]].extend(A[q[1]])
            A[q[1]] = deque()


resolve()



Measured memory_bytes: 30688
#include <bits/stdc++.h>
using namespace std;
 
 
int main() {
    string S;
    cin >> S;
    char tuki=S.at(6);
    if(S.at(5)=='0'&&(tuki=='1'||tuki=='2'||tuki=='3'||tuki=='4')) cout << "Heisei" << endl;
    else cout << "TBD" << endl;
}

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

int main() {
    int N; cin >> N;
    string S, T; cin >> S >> T;

    string ans;
    rep(i, N){
        ans.push_back(S[i]);
        ans.push_back(T[i]);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
 
    #define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
    #define mod 1000000007
    #define qmod 998244353
    #define M 1000001
    #define endl "\n"
    #define all(a) (a).begin(),(a).end()
    #define rep(i,a,b) for(int i=a;i<b;++i)
    #define repr(i,a,b) for(int i=a;i>=b;--i)
    #define F first
    #define S second
    #define pb push_back
    #define mp make_pair
 
    typedef long long ll;
    typedef pair<int,int> pii;
    typedef vector<int> vi;
    typedef vector<string> vs;
    typedef vector<pii> vii;
    typedef vector<vi> vvi;

    int main(){
                    
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin); 
    freopen("output.txt","w",stdout);   
    #endif 
 
        fast;
        int t=1;
        // cin>>t; 
        while(t--){
            int n,m;
            cin>>n>>m;
            vvi adj(n+1);
            rep(i,0,m){
                int u,v;
                cin>>u>>v;
                u--;v--;
                adj[u].pb(v);
                adj[v].pb(u);
            }
            int s=0;
            int parent[n+1]={};
            bool vis[n+1]={};
            queue<int> q;
            q.push(s);vis[s]=true;
            while(!q.empty()){
                int x=q.front();
                q.pop();
                for(auto i:adj[x]){
                    if(!vis[i]){
                        q.push(i);
                        vis[i]=true;
                        parent[i]=x;
                    }
                }
            }
            bool ok=true;
            rep(i,1,n) ok=ok && vis[i];
            if(ok){
                cout<<"Yes\n";
                rep(i,1,n) cout<<parent[i]+1<<endl;
            }
            else cout<<"No\n";
        } 
        return 0;   
    }       

    // First, solve the problem. Then, write the code. 


Measured memory_bytes: 10424
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout <<(#x)<<" is "<<(x)<<endl
#define debug cout <<"hi"<<endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MOD=1e9+7;
const int INF32=1<<30;
const ll INF64=1LL<<60;

void solve(){
  int n,x,t; cin >>n >>x >>t;
  cout <<(n+x-1)/x*t;
}

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  solve();
return 0;}

Measured memory_bytes: 3648
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <math.h>
#include <assert.h>
#include <set>
#include <map>
#include <bitset>
#include <ctime>
#include <time.h>
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <stack>
#include <ctype.h>
#include <numeric>
#include <sstream>
#include <unistd.h>
#include <unordered_map>
#include <unordered_set>
#include <limits>
#include <random>
#include <chrono>
#include <iomanip>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
#define endl '\n'
#define debug(name) DEBUG(#name, (name))
template<typename T>
void DEBUG(string label, T value) {
    cerr << "[" << label << " = " << value << "]\n";
}

void solve(){
    int n, m, k;
    cin >> n >> m >> k;
    vector<string> grid(n);
    for(int i = 0; i < n; ++i){
        cin >> grid[i];
    }
    int ans = 0;
    for(int i = 0; i < (1 << n); ++i){
        for(int j = 0; j < (1 << m); ++j){
            int count = 0;
            for(int x = 0; x < n; ++x){
                for(int y = 0; y < m; ++y){
                    if((i & (1 << x)) != 0 && (j & (1 << y)) != 0 && grid[x][y] == '#'){
                        ++count;
                    }
                }
            }
            ans += (count == k);
        }
    }

    cout << ans << endl;
}

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

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


Measured memory_bytes: 3640
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

//----------------------- Print Function ----------------------//

inline void print() {
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest) {
    cout << first << ' ';
    print(rest...);
}

template <typename T>
void print(const vector<T> &v) {
    for (auto e : v) cout << e << ' ';
    cout << endl;
}

//------------------------- Libraries -------------------------//

//--------------------------- Solve ---------------------------//

void solve() {
    long long a, b, x; cin >> a >> b >> x;
    long long ans;
    if (a == 0) ans = b/x+1;
    else ans = b/x - (a-1)/x;

    cout << ans << '\n';
}

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

    solve();

    return 0;
}

Measured memory_bytes: 3644
S = input()
flag = 0

if len(S)%2 == 1:
    print('No')
    exit()
else:
    for i in range(len(S)//2):
        if S[i*2:i*2+2] != 'hi':
            flag = 1

if flag == 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 2940
def mod_pow(a: int, n: int, mod: int)->int:
    '''a の n 乗を計算します。
    '''
    res = 1
    while n > 0:
        if n & 1:
            res = (res * a) % mod
        a = (a * a) % mod
        n >>= 1
    return res


def xor_partitioning(N: int, A: list)->int:
    MOD = 10**9 + 7

    # dp[i][0] = i マス目まで処理した時に現在こまが置かれているますに 0 が書かれている
    # dp[i][1] = i マス目まで処理した時に現在こまが置かれているマスに X が書かれている。
    dp = [[0, 1] for _ in range(1 << 20)]
    memo = [0] * (1 << 20)

    b = 0
    num_zero = 0

    for a in A:
        b ^= a

        if b == 0:
            num_zero += 1
        else:
            dp[b][1] += dp[b][0] * (num_zero-memo[b])
            dp[b][1] %= MOD

            dp[b][0] += dp[b][1]
            dp[b][0] %= MOD

            memo[b] = num_zero

    if b > 0:
        return dp[b][1]

    return (sum(_dp[0] for _dp in dp) + mod_pow(2, num_zero-1, MOD)) % MOD


if __name__ == "__main__":
    N = int(input())
    A = [int(s) for s in input().split()]

    ans = xor_partitioning(N, A)
    print(ans)


Measured memory_bytes: 143076
#include<bits/stdc++.h>
#define endl "\n"
#define _  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define ll long long
#define int long long
#define MOD 1000000007
#define DEBUG cout<<"Hello1\n";
#define all(v) (v).begin(),(v).end()
#define clr(x) memset(x,0,sizeof(x))
#define deb(...) debug(#__VA_ARGS__, __VA_ARGS__);
const int N = 1e5 + 5;
const ll inf = LLONG_MAX;
using namespace std;

template<typename T> void debug(string s, T x) {cout << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cout << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}
template<class T>
void print_container(T &container) {for (auto &t : container) {cout << t << " ";} cout << endl;}
//Pain is temporary Glory is forever!!
//Think quick,Code Fast!!
int n, w;
pair<int, int> a[105];
int dp[N];

void solve() {
	clr(dp);
	cin >> n >> w;

	for (int i = 0; i < n; i++) {
		cin >> a[i].first >> a[i].second;
	}

	sort(a, a + n);

	for (int i = 0; i < n; i++)
	{
		for (int j = w; j >= a[i].first; j--) {
			dp[j] = max(a[i].second + dp[j - a[i].first], dp[j]);
		}
	}
	cout << dp[w] << endl;
}

int32_t main() {
	_


	solve();
}



Measured memory_bytes: 4404
#include <cstdio>
#include <cstring>
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

#define End exit(0)
#define LL long long
#define mp make_pair
#define SZ(x) ((int) x.size())
#define GO cerr << "GO" << endl
#define DE(x) cout << #x << " = " << x << endl
#define DEBUG(...) fprintf(stderr, __VA_ARGS__)

void proc_status()
{
	freopen("/proc/self/status","r",stdin);
	string s; while(getline(cin, s)) if (s[2] == 'P') { cerr << s << endl; return; }
}

template<typename T> inline T read() 
{
	register T x = 0;
	register char c; register int f(1);
	while (!isdigit(c = getchar())) if (c == '-') f = -1;
	while (x = (x << 1) + (x << 3) + (c ^ 48), isdigit(c = getchar()));
	return x * f;
}

template<typename T> inline bool chkmin(T &a,T b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a,T b) { return a < b ? a = b, 1 : 0; }

const int maxN = 1e5 + 2;

struct Info
{
    int a, b;
    bool operator > (const Info& B) const { 
        return a > B.a;
    }
} info[maxN + 2];

int n, N;
int L[maxN + 2], R[maxN + 2];

void input()
{
    n = read<int>();
    for (int i = 1; i <= n; ++i) 
        L[i] = read<int>(), R[i] = read<int>();
}

int solve()
{
    int p = 1e9, q = 0;
    for (int i = 1; i <= n; ++i) chkmin(p, R[i]);
    for (int i = 1; i <= n; ++i) chkmax(q, L[i]);

    for (int i = 1; i <= n; ++i) info[i].a = max(p - L[i] + 1, 0);
    for (int i = 1; i <= n; ++i) info[i].b = max(R[i] - q + 1, 0);

    sort(info + 1, info + 1 + n, greater<Info>());

    static int suf[maxN + 2];

    suf[n + 1] = 1e9;
    for (int i = n; i >= 1; --i) suf[i] = min(suf[i + 1], info[i].b);

    int ans = 0;
    for (int i = 1; i <= n; ++i) chkmax(ans, max(p - q + 1, 0) + R[i] - L[i] + 1);
    for (int i = 1; i < n; ++i) chkmax(ans, suf[i + 1] + info[i].a);

    return ans;
}

int main() 
{ 
    input();
    printf("%d\n", solve());
    return 0;
}


Measured memory_bytes: 2176
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		if (tokens[0].contains("7")) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

	void calc() {
	}

	void showResult() {
	}
}


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

int main() {
  int cnt=0, m, n;
  
  cin >> m;
  
  for(int i=0; i<6; i++){
    n = m % 10;
    if(n == 1) cnt++;
    m /= 10;
  }
  
  cout << cnt << endl;
  
  return 0;
}

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

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

#define INF             1e9
#define INFL            8e18
#define XX              first
#define YY              second
#define PB              push_back
#define MP              make_pair

#define NEWLINE         cerr << "\n";
#define HOISE           cerr << "hoise " << __LINE__ << "\n"
#define PAUSE           system("pause")
#define DEBUG(x)        cerr << #x << " = " << x << "\n"
#define READ            freopen("D:\\moidda CPP\\alu.txt", "r", stdin)
#define WRITE           freopen("D:\\moidda CPP\\vorta.txt", "w", stdout)
#define FASTIO          ios_base::sync_with_stdio(false);cin.tie(NULL)
#define MASK(x)         for(int i = 0; i < 8; i++){ if(x&(1<<i)){ cout << i << " "; } } cout << endl;

typedef long long ll;
typedef pair<int, int > pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pff;

const int MAX = 30 + 10;
const int MAX_VALUE = 2e6 + 10;
const int MAXLOG = log2(MAX) + 2;
const int MOD = 10007;
const double PY = acos(-1.0);
const double EPS = 1E-9;

int32_t main()
{
#ifndef ONLINE_JUDGE
//    READ;
//    WRITE;
#endif

    FASTIO;

    double a, b, h, m;
    cin >> a >> b >> h >> m;

    double tim = h*60+m;
    double houra = (360*tim)/(12*60);
    double minta = (360*tim)/(60);
    houra = houra - floor(houra/360.0)*360;
    minta = minta - floor(minta/360.0)*360;
    double theta = min(houra-minta, minta-houra);
    double c = a*a+b*b-2*a*b*cos(theta*PY/180.0);
    c = sqrt(c);
    cout << fixed << setprecision(12) << c;

    return 0;
}



Measured memory_bytes: 4244
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
#define pii pair<int,int>
using namespace std;

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

	ll result = 0LL;
	for(int i=1;i<=n;i++) {
		if(i % 3 != 0 && i % 5 != 0) {
			result += i;
		}
	} 
	cout<<result;
}

Measured memory_bytes: 3636
using System;
using static System.Console;

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            char[] line = ReadLine().ToCharArray();

            if (line[2] == line[3] && line[4] == line[5])
            {
                Write("Yes");
            }
            else
            {
                Write("No");
            }
        }
    }
}

Measured memory_bytes: 13140
#include<stdio.h>

int main()
{
    int A, B, C;

    scanf("%d %d %d", &A, &B, &C);

    if(((A==B)&&(A!=C))||((A==C)&&(A!=B))||((B==C)&&(B!=A)))printf("Yes");
    else printf("No");

    return 0;
}

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

int n;
int a[500500];
int sum[500500];
int sum0[500500];
vector<int> pos[1100000];

ll solve(int s){
	if(pos[s].empty()) return 0;
	ll ret = 1LL, sum_dp = 1LL;
	for(int i = 1; i < pos[s].size(); i++){
		ll k = sum0[pos[s][i]] - sum0[pos[s][i-1]];
		ret = (ret + sum_dp * k) % Mod;
		sum_dp = (sum_dp + ret) % Mod;
//		cout << pos[s][i] << ": " << ret << " " << sum_dp << endl;
	}
	if(sum[n-1] != 0) return ret;
	return sum_dp;
}

int main(){
//	freopen("b.in", "r", stdin);
//	freopen("b.out", "w", stdout);
	ios::sync_with_stdio(false);
	cin >> n;
	rep(i, n) cin >> a[i];
	sum[0] = a[0];
	for(int i = 1; i < n; i++) sum[i] = sum[i-1] ^ a[i];
//	rep(i, n) cout << sum[i] << " "; cout << endl;
	rep(i, n) pos[sum[i]].push_back(i);
	sum0[0] = (sum[0] == 0);
	for(int i = 1; i < n; i++) sum0[i] = sum0[i-1] + (sum[i] == 0);
	if(sum[n-1] != 0){
		cout << solve(sum[n-1]) << endl;
	} else {
		ll ans = 1LL;
		rep(i, sum0[n-2]) ans = (ans * 2) % Mod;
		for(int s = 1; s < 1048576; s++) ans = (ans + solve(s)) % Mod;
		cout << ans << endl;
	}
	return 0;
} 

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

using ll = long long;
#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define INF 1e9
// constexpr ll INF = 1LL << 60;

int main(){
  int N;
  cin >> N;
  vector<int> P(N), isExist(N+1, 0);
  REP(i, N){
    cin >> P[i];
  }
  REP(i, N){
    isExist[P[i]]= isExist[P[i]-1]+1;
  }
  int maxa = 0;
  REP(i, N){
    maxa = max(maxa, isExist[i+1]);
  }
  cout << N - maxa << endl;
  return 0;
}



Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define INF 100000000000000000
#define modulo 1000000007
#define mod 998244353
#define int long long int
using namespace std;

int32_t main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
   //   freopen("q.gir","r",stdin);
   //   freopen("q.cik","w",stdout);
      int n;
      cin>>n;
      double q=1.08;
      for(double i=0;i<=n;i++){
            int w=(q*i);
            if(w==n){
                  cout<<i;
                  return 0;
            }
      }
      cout<<":(";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
template <typename T> void print(T t) { cout<<t<<endl; }
template<typename T, typename... Args> void print(T t, Args... args) { cout<<t<<" "; print(args...); }

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define int long long
#define double long double

int mod=1e9+7;
int fact[2000006];
int inverse[2000006];
int inv(int x)
{
    int r,y;
    for(r=1,y=mod-2;y>0;x=(x*x)%mod,y/=2)
        if(y%2==1)
            r=r*x%mod;
    return r;
}
int nCr(int n, int m)
{
    if(n<m || n==0)
        return 0;
    return fact[n] *inv(fact[m])%mod *inv(fact[n-m])%mod ;
}
int32_t main() 
{
    IOS
    fact[0]=1;
    for(int i=1;i<=2000004;i++)
    {
        fact[i]=(i*fact[i-1])%mod;
        inverse[i]=inv(i);
    }

    int r1,c1,r2,c2;
    cin>>r1>>c1>>r2>>c2;
    //summation C(r1+i,r1) i from c1 to c2
    //For r1 from r1 to r2
    //Formula for each row - ((c2+1)*C(c2+r1+1,r1)-c1*C(c1+r1,r1))/(r1+1)
    //Credits wolfram alpha

    int lastb=nCr(c2+r1-1+1,r1-1);
    int lastd=nCr(c1+r1-1,r1-1);
    int ans=0;
    for(int i=r1;i<=r2;i++)
    {
        int a=(c2+1);
        // int b=nCr(c2+i+1,i);
        int b=(lastb*(((c2+i+1)*inverse[i])%mod))%mod;
        int c=c1;
        // int d=nCr(c1+i,i);
        int d=(lastd*(((c1+i)*inverse[i])%mod))%mod;
        int e=i+1;
        int get=(a*b)%mod;
        get=(get-(c*d)%mod+mod)%mod;
        get=(get*inverse[e])%mod;
        ans=(ans+get)%mod;
        lastb=b;
        lastd=d;
    }
    print(ans);
}   


Measured memory_bytes: 34872
#include <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
using Int = long long;
const char newl = '\n';

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  string s;
  cin>>s;
  if(s=="AAA"s or s=="BBB"s) cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
  return 0;
}


Measured memory_bytes: 256
n, k = gets.split(" ").map(&:to_i)

lens = (k..n+1).map do |i|
  min = (0..i-1).sum
  max = (n-i+1..n).sum
  max - min + 1
  # (0..n).to_a.combination(i).map(&:sum).uniq.size
end

puts lens.sum % 1000000007


Measured memory_bytes: 16308
n = int(input())
s = input()

tmp = [0, 0]
flag = False
count1 = 0
for i in s:
    if(i == "."): tmp[0] += 1
    else: tmp[1] += 1
    if(flag == True):
        if(i == "."): count1 += 1
    elif(i == "#"): flag = True


b = [0, 0]
count2 = 1e9
for i in s:
    if(i == "."): b[0] += 1
    else: b[1] += 1
    v = b[1] + tmp[0] - b[0]
    if(count2 > v): count2 = v

s = s[::-1]
flag = False
count3 = 0
for i in s:
    if(flag == True):
        if(i == "#"): count3 += 1
    elif(i == "."): flag = True



print(min([count1, count2, count3]))

Measured memory_bytes: 3500
#B - Card Game for Two 〇
N = int(input())
a = list(map(int,input().split()))

a = sorted(a, reverse = True)

score = 0
for i in range(N):
    if i % 2 == 0:
        score += a[i]
    else:
        score -= a[i]
print(score)

Measured memory_bytes: 9192
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

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

    int N, M;
    cin >> N >> M;
    vector<vector<int> > G(N);
    for (int i = 0; i < M; ++i) {
        int a, b;
        cin >> a >> b;
        G.at(a - 1).push_back(b - 1);
        G.at(b - 1).push_back(a - 1);
    }
    for (auto &V : G) {
        cout << V.size() << endl;
    }

    return 0;
}

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

using namespace std;

int n;

void Process()
{

}

void Input()
{
    ios_base::sync_with_stdio(0);   cin.tie(0);

    //freopen("abc.txt", "r", stdin);

    float n, m;

    cin >> n >> m;
    if (m == 1) cout << 0;
        else if (m - n <= 0) cout << 1;
            else cout << ceil((m-n)/(n-1)) + 1;
}

int main()
{
    Input();
    Process();
    return 0;
}


Measured memory_bytes: 256
# INPUT
n = int(input())
a = list(map(int, input().split()))

# PROCESS
a_mul = 1
for a_item in a:
  a_mul = a_mul*a_item

answer = 0
for a_item in a:
  answer = answer + (a_mul-1) % a_item


# OUTPUT
print(answer)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using str = string;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vs> vvs;
typedef vector<vc> vvc;
typedef vector<vb> vvb;
using P = pair<ll,ll>;
#define REP(i, n) for (ll i = 0; i < (int)(n); i++)
#define RREP(i, n) for (ll i = (int)(n)-1; i > -1 ; i--)
#define IN(T, x) T x;cin >> x;
#define AIN(T, a, n) vector<T> a(n);REP(i, n){cin >> a[i];}
#define A2IN(T1, a, T2, b, n) vector<T1> a(n);vector<T2> b(n);REP(i, n){cin >> a[i] >> b[i];}
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) SORT(a);reverse(ALL(a))
#define pb push_back
#define mp make_pair
#define PF first
#define PS second
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;}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T &val){fill( (T*)array, (T*)(array+N), val );}
#define OUT(x) cout << x << endl
#define BOUT(b) if(b){OUT("Yes");}else{OUT("No");}
const ll MOD = 100000007;
const ll INF = 10e9;
#define PI 3.14159265369;
ll dx[4] = {1,-1,0,0};
ll dy[4] = {0,0,1,-1};
ll ddx[8] = {1,1,1,-1,-1,-1,0,0};
ll ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main() {
  IN(ll,N);
  IN(str,A);
  IN(str,B);
  REP(i,N){
    cout << A.at(i) << B.at(i);
  }
  OUT("");
}



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

int main(){
  int a, b, q; cin >> a >> b >> q;
  map<long, int> st;
  map<long, int> ms;
  map<long, int> mt;
  vector<long> u;
  long s[a];
  rep(i, a){
    cin >> s[i];
    ms[s[i]] = i;
    st[s[i]] = 0;
    u.push_back(s[i]);
  }
  long t[b];
  rep(i, b){
    cin >> t[i];
    mt[t[i]] = i;
    st[t[i]] = 1;
    u.push_back(t[i]);
  }
  sort(u.begin(), u.end());
  long smin[a];
  rep(i, a){
    if(s[i] < t[0]) smin[i] = abs(s[i] - t[0]);
    if(s[i] > t[b-1]) smin[i] = abs(s[i] - t[b-1]);
    else{
      int low = 0;
      int high = b-1;
      while(high - low > 1){
        int mid = (high + low) / 2;
        if(t[mid] > s[i]) high = mid;
        else low = mid;
      }
      smin[i] = min(abs(s[i]-t[low]), abs(s[i]-t[high]));
    }
  }
  long tmin[b];
  rep(i, b){
    if(t[i] < s[0]) tmin[i] = abs(t[i] - s[0]);
    else if(t[i] > s[a-1]) tmin[i] = abs(t[i] - s[a-1]);
    else{
      int low = 0;
      int high = a-1;
      while(high - low > 1){
        int mid = (high + low) / 2;
        if(s[mid] > t[i]) high = mid;
        else low = mid;
      }
      tmin[i] = min(abs(t[i]-s[low]), abs(t[i]-s[high]));
    }
  }
  rep(i, q){
    long x; cin >> x;
    long ans = u[a+b-1] * 2;
    if(x < u[0]){
      if(st[u[0]] == 0) ans = u[0] - x + smin[0];
      else ans = u[0] - x + tmin[0];
    }
    else if(x > u[a+b-1]){
      if(st[u[a+b-1]] == 0) ans = x - u[a+b-1] + smin[a-1];
      else ans = x - u[a+b-1] + tmin[b-1];
    }
    else{
      int low = 0;
      int high = a+b-1;
      while(high - low > 1){
        int mid = (high + low) / 2;
        if(u[mid] > x) high = mid;
        else low = mid;
      }
      if(st[u[high]] == 0) ans = min(ans, u[high] - x + smin[ms[u[high]]]);
      if(st[u[high]] == 1) ans = min(ans, u[high] - x + tmin[mt[u[high]]]);
      if(st[u[low]] == 0) ans = min(ans, x - u[low] + smin[ms[u[low]]]);
      if(st[u[low]] == 1) ans = min(ans, x - u[low] + tmin[mt[u[low]]]);
    }
    cout << ans << endl;
  }
}

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

public class Main
{
	public static void main(String[] argv)
	{
		try{
			BufferedReader bf =new BufferedReader(new InputStreamReader(System.in));
			String[] ctx=bf.readLine().split(" ");
			int N,D;
			N=Integer.parseInt(ctx[0]);
			D=Integer.parseInt(ctx[1]);
			Solver s =new Solver(N,D);
			s.res();
		}
		catch (IOException e)
		{
			System.exit(0);
		}
	}
}
class Solver
{
	int totalNum,dist;

	public Solver(int N,int D)
	{
		totalNum=N;
		dist=D;
	}
	public void res()
	{
		int gap=2*dist+1;
		if(totalNum%gap==0)
			System.out.printf("%d\n",totalNum/gap);
		else
			System.out.printf("%d\n",1+totalNum/gap);
	}
}


Measured memory_bytes: 23124
#include <iostream>

using namespace std;

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a<b)
    {
        if(b<c)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}



Measured memory_bytes: 3096
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    ll n;
    cin >> n;

    vl d(n);
    rep(i, n) {
        cin >> d[i];
    }
    sort(all(d));

    ll m = n/2;
    out(d[m] - d[m-1]);
    re0;
}

Measured memory_bytes: 1024
n, x = map(int, input().split())

if x == 1:
    print(0)
    exit()

b = [0 for _ in range(n + 1)]
p = [0 for _ in range(n + 1)]

b[0] = 1
p[0] = 1

for i in range(1, n + 1):
    b[i] = b[i - 1] * 2 + 3
    p[i] = p[i - 1] * 2 + 1

def burger(s, t):
    if t == 0:
        return 0
    if s == 0:
        return 1
    if t <= b[s - 1]:
        return burger(s - 1, t - 1)
    elif t == b[s - 1] + 1:
        return p[s - 1]
    elif t == b[s - 1] + 2:
        return p[s - 1] + 1
    else:
        return burger(s - 1, t - b[s - 1] - 2) + p[s - 1] + 1

print(burger(n, x))


Measured memory_bytes: 3064
#include<cmath>
#include<iostream>
#include<vector>

using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(){
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];

    for (int ki = 0; ki < k; ki++){
        vector<int> b(n+1);
        for(int i = 0; i < n; i++){
            int l = max(0, i-a[i]);
            int r = min(i+a[i]+1, n);
            b[l]++; b[r]--;
        }
        for(int i = 0; i < n; i++) b[i+1] += b[i];
        b.pop_back();
        if(a == b) break;
        a = b;
    }
    for(int i = 0; i < n; i++){
        cout << a[i] << " ";
    }
    cout << endl;
}



Measured memory_bytes: 4824
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n)  RFOR(i,0,n)
#define VSORT(v) sort(v.begin(), v.end())
#define DVSORT(v) sort(v.begin(), v.end(),greater<int>())
#define SORT(v, n) sort(v, v+n)
#define DSORT(v,n) sort(v, v+n,greater<int>())
#define vi vector<int>
#define pb push_back
 
template <class T> void chmin(T&a,const T&b) { a = min(a,b); }
template <class T> void chmax(T&a,const T&b) { a = max(a,b); }
 
void print(){cout<<endl;}
template <class Head, class... Tail>
void print(Head&& h,Tail&&... t){ 
	if(sizeof...(t)==0)
		cout<<h;
	else
		cout<<h<<' ';
	print(move(t)...);
}
 
const double EPS =1e-9;
const long INF =2147483647;//32bit 2*1e+9
const long MOD =1e+9+7;
#define PI 3.14159265258979
#define P pair<int,int>
#define PPi pair<P,int>
 
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

int main(void){
	int N,A,cn=0;
	map<int,int> mp;
	cin>>N;
	REP(i,N){
		cin>>A; mp[A]++;
	}

	for(const auto pr:mp) cn++;
	
	if(cn%2) print(cn);
	else print(cn-1);

	return 0;
}




Measured memory_bytes: 4992
#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;

int main() {
  
  int a,b,c,d,x;
  double da,db;
  string s,ss,sss;
  
  int ans = 0;
  string anss = "";
  
  cin >> a >> b;
  
  int ab [] = {0 , 1 , 3 , 1 , 2 , 1 , 2 , 1 , 1 , 2 , 1 , 2 , 1};
  int result3 = std::max({a, b, c});
//--------------------------------------------------------------------------------
  if(b >= a) ans = a;
  else ans = a-1;

  cout << ans << endl;

}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        sc.close();

        Map<Long, Integer> map = bunkai(n);
        int ans = 0;
        for (int v : map.values()) {
        	int sum = 0;
        	for (int i = 1; i < 50; i++) {
				sum += i;
				if (sum > v) {
					break;
				}
				ans++;
			}
        }
        System.out.println(ans);
    }

	static Map<Long, Integer> bunkai(long n) {
		Map<Long, Integer> soinsu = new HashMap<>();
		int end = (int) Math.sqrt(n);
		long d = 2;
		while (n > 1) {
			if (n % d == 0) {
				n /= d;
				if (soinsu.containsKey(d)) {
					soinsu.put(d, soinsu.get(d) + 1);
				} else {
					soinsu.put(d, 1);
				}
				end = (int) Math.sqrt(n);
			} else {
				if (d > end) {
					d = n - 1;
				}
				d++;
			}
		}
		return soinsu;
	}
}


Measured memory_bytes: 35808
n=int(input())
lamp = [int(input()) for i in range(n)]
cnt = 0
select = lamp[0]
while True:
  if cnt>n:
    print(-1)
    break;
  elif select == 2:
    cnt += 1
    print(cnt)
    break;
  else:
    select = lamp[select-1]
    cnt += 1

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

int main() {
	int a, b;
	std::string s;
	std::cin >> a >> b >> s;
	int nSum = 0;
	for (int i = 0;i < a;i++) {
		if (s[i] != '-') {
			nSum += 1;
		}
	}
	if (s[a] == '-') {
		nSum += 1;
	}
	for (int i = a + 1;i < s.size();i++) {
		if (s[i] != '-') {
			nSum += 1;
		}
	}
	if (nSum == a + b + 1) {
		std::cout << "Yes" << std::endl;
	}
	else {
		std::cout << "No" << std::endl;
	}
	return 0;
}
	


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/math/common_factor_rt.hpp>

using namespace std;

using lap_time_t = int64_t;

int main() {
  lap_time_t t;
  std::cin >> t;
  lap_time_t ret = 1;
  while (std::cin >> t) {
    ret = boost::math::lcm(t, ret);
  }
  std::cout << ret << std::endl;
  return 0;
}

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

namespace easy_Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] AB = Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
            Console.WriteLine((AB[0]+AB[1])>=10?"error":(AB[0]+AB[1]).ToString());
        }
            // float[] ABN = Array.ConvertAll(Console.ReadLine().Split(),float.Parse);
            // long[] NK = Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            // long N = NK[0];
            // long K = NK[1];
            // long K = long.Parse(Console.ReadLine());
            // int[] abc = Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
            // string S = Console.ReadLine();
            // int x = int.Parse(Console.ReadLine());
            // int b = int.Parse(Console.ReadLine());
            // int N = int.Parse(Console.ReadLine());
            // float N = float.Parse(Console.ReadLine());
            // string c = Console.ReadLine();
            // string B = Console.ReadLine();
            // string[] s = Console.ReadLine().Split();
            // var s = (new string[] { Console.ReadLine(), Console.ReadLine(), Console.ReadLine() }).Select(float.Parse);
            // float[] a = Array.ConvertAll(Console.ReadLine().Split(),float.Parse);
            // var X = Console.ReadLine();
            // int[,] abcd = new int[NMQ[2],4];
            // int[] A = new int[NMQ[0]];
            // int[] A_num = new int[NMQ[0]];
            // long[] s=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            // var hs=new Dictionary<long,long>();
            // for(int i=0;i<s[0];i++){
            //     long[] q=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            //     if(hs.ContainsKey(q[0])){hs[q[0]]+=q[1];}
            //     else{hs.Add(q[0],q[1]);}
            // }
        
        // //最小公倍数
        // static long Lcm(long a, long b)
        // {
        //     return a/Gcd(a,b)*b;
        // }

        // //最大公約数
        // static long Gcd(long m, long n)
        // {
        //     if(n==0)return m;
        //     return Gcd(n,m%n);
        // }
    }
}


Measured memory_bytes: 13140
/*
* @author:  liangxianfeng
* @mail: liangxianfeng96@qq.com
*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <ctime>

using namespace std;
#define ll long long
#define rep(i,n) for(int i =0; i < n; ++i)
#define repp(i,n,x) for(int i =x; i < n+x; ++i)
#define CLR(x) memset(x,0,sizeof x)
#define MEM(a,b) memset(a,b,sizeof a)
#define pr(x) cout << #x << " = " << x << " ";
#define prln(x) cout << #x << " = " << x <<  endl;
const int MOD = 1e9+7;
const int maxn = 1e5+100;

int main(){
#ifdef LOCAL
    freopen("C:\\Users\\liangxianfeng\\Desktop\\in.txt","r",stdin);
    //freopen("C:\\Users\\liangxianfeng\\Desktop\\out.txt","w",stdout);
#endif
    int a, b;
    while(cin >> a >> b){
    	int ans = a + b;
    	if(ans >= 24) ans -= 24;
    	cout << ans << endl;
    }
    return 0;
}


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

using namespace std;

int main(int argc, const char *argv[]) {
  string s;
  cin >> s;

  int month = stoi(s.substr(5, 2));
  int dom = stoi(s.substr(8, 2));
  if (month > 4) {
    cout << "TBD" << '\n';
  } else if (month < 4) {
    cout << "Heisei" << '\n';
  } else {
    if (dom > 30) {
      cout << "TBD" << '\n';
    } else {
      cout << "Heisei" << '\n';
    }
  }
  return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {

     static Scanner scanner;

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

         long N=gl();
         long P=gl();
         List<Long> l=insuB(P);

         Map<Long,Integer> m=new HashMap<Long,Integer>();
         for (int i=0; i<l.size();i++) {
        	 long v=l.get(i);
        	 if(m.containsKey(v)) {
        		 m.put(v, m.get(v)+1);
        	 } else {
        		 m.put(v, 1);
        	 }
         }

         long ans=1;
         for(Map.Entry<Long,Integer> e:m.entrySet()) {
        	 long v=e.getKey();
        	 long num=e.getValue();
        	 while(num>=N) {
        		 num-=N;
        		 ans*=v;
        	 }
         }
         System.out.println(ans);
     }

  // 素因数分解
 	public static List<Long> insuB(long n) {
 		List<Long> l=new ArrayList<Long>();
 		long i=2;
 		while(i*i<=n) {
 			if (n%i==0) {
 				l.add(i);
 				n/=i;
 			} else {
 				i++;
 			}
 		}
 		if(n!=1)l.add(n);
 		return l;
 	}
     // 文字列として入力を取得
     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: 35624
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define ull unsigned long long
#define PI acos(-1.0)
#define eps 1e-12
#define fi first
#define se second
#define pb push_back
#define MEM(a,b) memset((a),(b),sizeof(a))
#define mod(x) ((x)%MOD)
#define pii pair<int,int>
#define wz cout<<"-----"<<endl;
const int INF_INT = 2147483647;
const ll INF_LL = 9223372036854775807LL;
const ull INF_ULL = 18446744073709551615Ull;
const ll P = 92540646808111039LL;

const ll maxn = 1e5 + 10, MOD = 1e9 + 7;
const int Move[4][2] = {-1,0,1,0,0,1,0,-1};
const int Move_[8][2] = {-1,-1,-1,0,-1,1,0,-1,0,1,1,-1,1,0,1,1};

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


void init() {

}



int main(){
//    freopen("C:\\Users\\Administrator\\Desktop\\in.txt","r",stdin);
//    freopen("C:\\Users\\Administrator\\Desktop\\out.txt","w",stdout);
//    ios_base::sync_with_stdio(0);
    init();
    int a,b; cin >> a >>b;
    if (a % b == 0) puts("0");
    else puts("1");
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int s = calcS(n);
    if ( n % s == 0 ) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
  
  private static int calcS(int n) {
    int val = 0;
    while (n > 0 ) {
      val += n % 10;
      n /= 10;
    }
    return val;
  }
}

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

int a[105];

int main()
{
	int n;	cin >> n;
	int sum = 0;
	for(int i = 0; i < n; i ++)	
	{
		cin >> a[i];
		sum += a[i];
	}
	double avg = (double)sum / n;
	int x = 0;
	if(avg >= 0)	x = (int)(avg + 0.5);
	else	x = (int)(avg - 0.5);
	long long ans = 0;
	for(int i = 0; i < n; i ++)
	{
		ans += (a[i] - x) * (a[i] - x);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		
		while(true){
			int x=scan.nextInt();
			int y=scan.nextInt();
			if(x==0 && y==0)break;
			if(x > y)System.out.println(y+" "+x);
			else System.out.println(x+" "+y);
		}
	}
}


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

struct dice{
  int u;
  int s;
  int e;
  int w;
  int n;
  int d;
};

dice move(dice, char);
int judge(dice, int,int);


int main(){
  dice dice1;
  cin>>dice1.u>>dice1.s>>dice1.e>>dice1.w>>dice1.n>>dice1.d;
  int q;
  cin>>q;

  for(int i=0; i<q; i++){
    int ui, si;
    cin>>ui>>si;
    dice temp = dice1;
    bool solved = false;
    for(int j=0; j<4; j++){
      if(judge(temp,ui,si)!=-1)break;
      temp = move(temp,'E');
      for(int k=0; k<4; k++){
	temp = move(temp,'N');
	if(judge(temp,ui,si)!=-1){solved = true; break;}
	for(int l=0; l<4; l++){
	  temp = move(temp,'R');
	  if(judge(temp,ui,si)!=-1){solved = true; break;}
	}
	if(solved) break;
      }
      if(solved) break;
    }
    cout<<temp.e<<endl;
  }
  
}

int judge(dice dice1, int u, int s){
  //cout<<dice1.u<<dice1.s<<dice1.e<<dice1.w<<dice1.n<<dice1.d<<endl;
  if(dice1.u==u && dice1.s==s){
    return dice1.e;
  }
  return -1;
}

dice move(dice dice1, char c){
    dice temp = dice1;
    if(c=='E'){     
      dice1.d = temp.e;
      dice1.w = temp.d;
      dice1.u = temp.w;
      dice1.e = temp.u;
    }else if(c=='N'){
      dice1.n = temp.u;
      dice1.u = temp.s;
      dice1.s = temp.d;
      dice1.d = temp.n;
    }else if(c=='S'){
      dice1.n = temp.d;
      dice1.u = temp.n;
      dice1.s = temp.u;
      dice1.d = temp.s;
    }else if(c=='W'){
      dice1.u = temp.e;
      dice1.w = temp.u;
      dice1.d = temp.w;
      dice1.e = temp.d;
    }else if(c=='R'){
      dice1.s = temp.w;
      dice1.w = temp.n;
      dice1.n = temp.e;
      dice1.e = temp.s;
    }
    return dice1;
}




Measured memory_bytes: 3100
#include<stdio.h>

int main(){
    long int shain[4000];
    int million[4000];
    int jun[4000];
    int n;
    int i;
    int b=1;
    int c=0;
    long int bango,tanka,kosu;
    
    scanf("%d",&n);
    
    while(n!=0){
        for(i=0;i<4000;i++){
            shain[i]=0;
            million[i]=0;
            jun[i]=0;
        }
        
        for(i=0;i<n;i++){
            scanf("%d %d %d",&bango,&tanka,&kosu);
            shain[bango-1]+=tanka*kosu;
            if(jun[bango-1]==0){
                jun[bango-1]=b;
                b++;
            }
        }
        
        for(i=0;i<4000;i++){
            if(shain[i]>=1000000){
                million[jun[i]-1]=i+1;
                c++;
            }
        }
        if(c==0){
            printf("NA\n");
        }else{
            for(i=0;i<4000;i++){
                if(million[i]!=0){
                    printf("%d\n",million[i]);
                }
            }
        }
        
        scanf("%d",&n);
        b=1;
        c=0;
    }
    
    return 0;
}

Measured memory_bytes: 672
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
#define MX 100000
int main(){
	bool ac[26];
	char ab[]="abcdefghijklmnopqrstuvwxyz";
	for(int i=0;i<26;i++)
	ac[i]=true;
	string a;
	cin>>a;
	for(int i=0;i<a.length();i++)
	{
		ac[a[i]-97]=false;
	}
	for(int i=0;i<26;i++){
		if(ac[i]==true)
		{
			cout<<ab[i];
			return 0;
		}
	}
	printf("None");
	return 0;
}


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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }


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

    ll a, b;
    cin >> a >> b;
    string s1 = "", s2 = "";
    rep(i, a) {
        s2 += to_string(b);
        
    }
    rep(i, b) {
        s1 += to_string(a);
    }
    if (s1[0] < s2[0]) {
        cout << s1 << endl;
    } else {
        cout << s2 << endl;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int W = scan.nextInt();
    int H = scan.nextInt();
    int x = scan.nextInt();
    int y = scan.nextInt();
    int r = scan.nextInt();
    if(inner(W, H, x, y, r)){
      System.out.println("Yes");
    }
    else{
      System.out.println("No");
    }
  }
  static boolean inner(int w, int h, int x, int y, int r){
    if(x - r < 0){
      return false;
    }
    else if(x + r > w){
      return false;
    }
    else if(y - r < 0){
      return false;
    }
    else if(y + r > h){
      return false;
    }
    return true;
  }
}

Measured memory_bytes: 26344
using System;
using System.Collections.Generic;
//using System.Linq;
class Program
{
  //static List<string> list;
	static void Main(string[] args)
	{
		// 入力フェーズ
        string input = Console.ReadLine();

        // 2^(桁数-1)通りを全探索する
        // １０進数→2進数としてみて1なら+いれる、0なら+いれないとする
        long sum = 0;
        for(int i = 0; i < Math.Pow(2,input.Length-1); i++)
        {
          long ca = Calculation(input, i);
          sum += ca;
          //Console.WriteLine(ca + " " + i);
        }

    // 出力
        Console.WriteLine(sum + "");
    }
		class myClass{ //自作クラス
			public int ID {set; get;}
			public long Point {set; get;}
		}

    static private long Calculation(string input, int bin)
    {
      // ２進数iが 000だとすると、どこにも＋をいれない
      // 101だとすると、? + ? ? + ? （４桁のinput）っていう感じに計算した値を返す
      if(bin==0)
      {
        return long.Parse(input);
      }

      long sum = 0;
      string str = "";
      //for(int i=0; i<input.Length-1; i++)
      int i=0;
      while(bin>0)
      {
        int plus = bin%2;
        bin = bin/2;
        //Console.WriteLine("bin " + bin + " plus " + plus);
        if(plus == 1)
        {
          // inputの後ろからi+1文字分もぎとってsumに加える
          str += long.Parse(input.Substring(input.Length-i-1)) + " + (input:" + input.Substring(0, input.Length-i-1) + ")";
          sum += long.Parse(input.Substring(input.Length-i-1));
          input = input.Substring(0, input.Length-i-1);
          i=0;
        }else
        {
          i++;
        }
      }
      str += input;
      //Console.WriteLine(str);
      sum += long.Parse(input);

      return sum;
    }

}


Measured memory_bytes: 13140