akhauriyash/Code-Regression huggingface dataset:
///-----Bismillahir Rahmanir Rahim-----///

#include<bits/stdc++.h>
using namespace std;

///---FAST I/O---///
#define Boost() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

///---DATA TYPE---///
typedef long long ll;
typedef long long int lli;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

///---LOOP---///
#define rep0(i,n) for(i=0;i<n;i++)
#define rep1(i,n) for(i=1;i<=n;i++)

///---I/O---///
#define sf scanf
#define pf printf

///---OTHERS---///
#define pb push_back
#define all(c)		c.begin(),c.end()
#define MK make_pair
#define F first
#define S second
#define endl '\n'


///---INITIALIZATION---//
#define mem(a,b) memset(a, b, sizeof(a) )

///---CALCULATE---///
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

///---BIT OPERATION---///
inline bool checkBit(ll n, int i)
{
    return n&(1LL<<i);
}
inline ll setBit(ll n, int i)
{
    return n|(1LL<<i);;
}
inline ll resetBit(ll n, int i)
{
    return n&(~(1LL<<i));
}

///------String/Char Related Functions-----///
string makeintString(int x)
{
    stringstream ss;
    ss << x;
    string str = ss.str();
    ///cout<<str<<endl;
    return str;
}
string makellString(ll x)
{
    stringstream ss;
    ss << x;
    string str = ss.str();
    ///cout<<str<<endl;
    return str;
}
char cpp(char c)
{
    return static_cast<char>(c + 1);
}

///------------Sorting STL----------///
struct func
{
    //this is a sample overloading function for sorting stl
    bool operator()(pii const &a, pii const &b)
    {
        if(a.F==b.F)
            return (a.S<b.S);
        return (a.F<b.F);
    }
};

///---CONSTANT---///
const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007

int main()
{
    Boost();

    int t;
    t=1;
    //cin>>t;
    while(t--)
    {
        string s;
        cin>>s;
        ll n=s.size();
        if(n<2)
        {
            cout<<"-1 -1"<<endl;
        }
        else
        {
            for(int i=0;i<n;i++)
            {
                int idx=i+1;
                if(i<n-1 && s[i]==s[i+1])
                {
                    cout<<idx<<" "<<idx+1<<endl;
                    return 0;
                }
                if(i<n-2 && s[i]==s[i+2])
                {
                    cout<<idx<<" "<<idx+2<<endl;
                    return 0;
                }
            }
            cout<<"-1 -1"<<endl;
        }

    }
    return 0;
}



Measured memory_bytes: 3776
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-2;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;


int main() {
	int a, b, c; cin >> a >> b >> c;
	if (a > b&&a > c)cout << "A" << endl;
	else if (b > a&&b > c)cout << "B" << endl;
	else cout << "C" << endl;
	//stop
	return 0;
}



Measured memory_bytes: 3068
// Example program
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

long long int har(long long int X)
{
    long long int Y = X;
    long long int sum = 0;
    for (int i=0;i<10;i++)
    {
        sum = sum + Y%10;
        Y = (Y-Y%10)/10;
    }
    
    return sum;
}


int main()
{
    long long int N;
    cin >> N;
    long long int D = har(N);
    if (N%D == 0)
    cout << "Yes" << "\n";
    else
    cout << "No" << "\n";
    
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>

using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[])
{
    ll a, b;
    cin >> a >> b;
    cout << max(a + b, max(a - b, a * b)) << endl;
}


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

#define cn count
#define pb push_back
#define in insert
#define fs first
#define sc second
#define sz size
#define len length
#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define forni(i, n) for (ll i = 1; i < (ll) (n); ++i)
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using namespace std;
using ll = long long;
const ll inf = 1e9+7; 
const double PI =  3.141592653589793;

int main(){
	IO;
	ll n,m,p,pen = 0;
	string s;
	cin>>n>>m;
	map<ll,ll>score;
	set<ll>st;
	forn(i,m){
		cin>>p>>s;
		if(st.cn(p)==0){
			if(s=="WA"){
				score[p]++;
			}else {st.in(p); pen+=score[p];}
		}
	}
	cout<<st.sz()<<" "<<pen<<"\n";
	return 0;
}


// _   .-')                .-. .-')                 .-')                                               
//( '.( OO )_              \  ( OO )               ( OO ).                                             
// ,--.   ,--.).-'),-----. ,--. ,--.  .-'),-----. (_)---\_) ,--. ,--.     .-----.  ,-.-')  .-'),-----. 
// |   `.'   |( OO'  .-.  '|  .'   / ( OO'  .-.  '/    _ |  |  | |  |    '  .--./  |  |OO)( OO'  .-.  '
// |         |/   |  | |  ||      /, /   |  | |  |\  :` `.  |  | | .-')  |  |('-.  |  |  \/   |  | |  |
// |  |'.'|  |\_) |  |\|  ||     ' _)\_) |  |\|  | '..`''.) |  |_|( OO )/_) |OO  ) |  |(_/\_) |  |\|  |
// |  |   |  |  \ |  | |  ||  .   \    \ |  | |  |.-._)   \ |  | | `-' /||  |`-'| ,|  |_.'  \ |  | |  |
// |  |   |  |   `'  '-'  '|  |\   \    `'  '-'  '\       /('  '-'(_.-'(_'  '--'\(_|  |      `'  '-'  '
// """    """     """""""" """  """"      """""""  """""""  """"""""      """"""   """         """""""



Measured memory_bytes: 14528
#include <bits/stdc++.h>
using namespace std;
int A,B,C,tot,cnt;
int main() {
    
   cin>>A>>B>>C>>tot;
   for(int i=0;i<=A;i++)
   {
       for(int j=0;j<=B;j++)
       {
           for(int m=0;m<=C;m++)
           {
               if(500*i+100*j+50*m==tot)
               {
                   cnt=cnt+1;
                   
               }
           }
       }
   }
   cout <<cnt;
}

    
    
    
       

Measured memory_bytes: 764
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
ull B = 100000007;
ll mod = 1000000007;
int INF = 0x3f3f3f3f;

int main() {
    int k, a, b;
    cin >> k >> a >> b;
    bool res = false;
    for(int i = a; i <= b; ++i) {
        if(i % k == 0) {
            res = true;
            break;
        }
    }

    if(res) {
        cout << "OK" << endl;
    }
    else {
        cout << "NG" << endl;
    }

    return 0;
}



Measured memory_bytes: 3552
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, A):
    for a in A:
        if a % 2 == 0:
            if a % 3 != 0 and a % 5 != 0:
                return 'DENIED'
    return 'APPROVED'


def main():
    N = read_int()
    A = read_int_n()
    print(slv(N, A))


if __name__ == '__main__':
    main()


Measured memory_bytes: 6852
s = input()
if s.replace("A","") == "KIHBR":
    befores = list("HBR")
    flg = True
    for i, _s in enumerate(s[1:], 1):
        if _s == "A" and s[i-1] not in befores:
            flg = False
    print("YES" if flg else "NO")
else:
    print("NO")

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

int main(void) {
  string S;
  cin >> S;
  ll N = S.length();

  bool ok = true;
  ok = ok && S[N - 1] == '0';
  ok = ok && S[N - 2] == '1';
  REP(i, 0, N - 1) ok = ok && S[i] == S[N - 2 - i];
  if (!ok) {
    cout << -1 << endl;
    return 0;
  }

  ll prev = 1, current = 2;
  REP(i, 0, N - 1) {
    cout << prev << " " << current << endl;
    if (S[i] == '1') prev = current;
    current++;
  }
}

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

using ll = long long;

int main()
{
    int N;
    cin >> N;
    vector<ll> A(N+1);
    vector<ll> B(N);
    for (int i = 0; i < N + 1; i++)
    {
        cin >> A.at(i);
    }

    for (int i = 0; i < N ; i++)
    {
        cin >> B.at(i);
    }
    ll count  = 0;
    for(int i = N-1;i>=0; i--){
        if(A.at(i+1) > B.at(i)){
            A.at(i+1) -= B.at(i);
            count += B.at(i);
            B.at(i) = 0;
            continue;
        }else{
            count += A.at(i+1);
            B.at(i) -= A.at(i+1);
            A.at(i+1) = 0;
            if(A.at(i) > B.at(i)){
                A.at(i) -= B.at(i);
                count += B.at(i);
                B.at(i) = 0;
            }else{
                count += A.at(i);
                B.at(i) -= A.at(i);
                A.at(i) = 0;
            }
        }

    }

    cout << count << endl;
    return 0;
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define vi vector<ll>
#define vvi vector<vi>
#define Q queue<ll>
#define DQ deque<ll> 
#define pb push_back
#define pf push_front
#define popf pop_front
#define popb pop_back
#define mp make_pair
#define mt make_tuple
#define f first
#define s second
#define ub upper_bound
#define lb lower_bound
#define loop(x,y,z) for(ll i=x; i<=y; i+=z)
#define rloop(x,y,z) for(ll i=x; i>=y; i-=z)
#define all(x) x.begin(), x.end()
#define sum(x) accumulate(all(x),0LL)
#define minE(x) *min_element(all(x))
#define maxE(x) *max_element(all(x))
#define watch(x) cout<<(#x)<<" is "<<x
#define endl "\n"

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

void display(vi &v,string c){
	for(auto x:v) cout<<x<<c;
}

int main(){
	IOS
	ll n;
	cin>>n;
	vi V(n,0),B(n,0),C(n-1,0);
	loop(0,n-1,1) cin>>V[i];
	loop(0,n-1,1) cin>>B[i];
	loop(0,n-2,1) cin>>C[i];
	ll ans=B[V[0]-1];
	loop(1,n-1,1){
		ans+=B[V[i]-1];
		if(V[i-1]+1==V[i]){
			ans+=C[V[i]-2];
		}
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    if(a==b){
        for(int i=0; i<a; i++){
            cout<<a;
        }
        cout<<endl;
    }
    else {
        int mx=max(a,b);
        int mi=min(a,b);
        for(int i=0; i<mx; i++){
            cout<<mi;
        }
        cout<<endl;
    }
}


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


int main() {

    int H, W, h, w;
    cin >> H >> W >> h >> w;
    cout << (H-h)*(W-w) << endl;
    return 0;
}

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


public class Main {
	static LinkedList<edge>adj[];
	static int ans=0;
	static int[]p;
	static void dfs(int i,int par,int color) {
		int c=1;
		for(edge j:adj[i]) {
			if(j.v!=par) {
				if(c==color)c++;
				p[j.i]=c;
				dfs(j.v,i,c);
				c++;
			}
		}
		ans=Math.max(c-1, ans);
	}
	static class edge{
		int i,v;
		edge(int x,int u){
			v=u;i=x;
		}
	}
	public static void main(String[] args) throws Exception {
		MScanner sc = new MScanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int n=sc.nextInt();
		adj=new LinkedList[n];
		for(int i=0;i<n;i++) {
			adj[i]=new LinkedList<edge>();
		}
		for(int i=0;i<n-1;i++) {
			int x=sc.nextInt()-1;int y=sc.nextInt()-1;
			adj[x].add(new edge(i, y));adj[y].add(new edge(i, x));
		}
		p=new int[n-1];
		dfs(0,-1,0);
		pw.println(ans);
		for(int i:p)pw.println(i);
		pw.flush();
	}

	static class MScanner {
		StringTokenizer st;
		BufferedReader br;

		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int[] takearr(int n) throws IOException {
			int[] in = new int[n];
			for (int i = 0; i < n; i++)
				in[i] = nextInt();
			return in;
		}

		public long[] takearrl(int n) throws IOException {
			long[] in = new long[n];
			for (int i = 0; i < n; i++)
				in[i] = nextLong();
			return in;
		}

		public Integer[] takearrobj(int n) throws IOException {
			Integer[] in = new Integer[n];
			for (int i = 0; i < n; i++)
				in[i] = nextInt();
			return in;
		}

		public Long[] takearrlobj(int n) throws IOException {
			Long[] in = new Long[n];
			for (int i = 0; i < n; i++)
				in[i] = nextLong();
			return in;
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

Measured memory_bytes: 59160
#include <iostream>
#include <stdio.h>
#include <math.h> 
#include <algorithm>
#include <numeric>
#include <functional>
#include <vector>
#include <string>
#include <numeric>

using namespace std;

// DPテーブル
const int MAX_N = 15;
const int MAX_W = 110000;
int dp[MAX_N][MAX_W];


//指定された円の累乗を100000円以下の範囲でvectorに格納する関数
vector<long> get_vec(long en, vector<long> en_unm) {
	long tmp = en;
	while (1) {
		if (tmp >= 100000) {
			break;
		}
		en_unm.push_back(tmp);
		tmp = tmp * en;
	}
	return en_unm;
}

int main() {

	vector<long> vecen; //全体管理用
	vector<long> vecen6; //6en用
	vector<long> vecen9; //9en用
	int en6 = 6;
	int en9 = 9;

	long n = 0;
	cin >> n;

	int n2 = n;

	vecen.push_back(1);
	vecen6 = get_vec(en6, vecen6);
	vecen9 = get_vec(en9, vecen9);

	vecen.insert(vecen.end(), vecen6.begin(), vecen6.end());
	vecen.insert(vecen.end(), vecen9.begin(), vecen9.end());

	//範囲内で取りうるお金の候補の金額を降順にソート
	sort(vecen.begin(), vecen.end(), greater<int>());

	//入力した値nに最も近い値をvecenから探し、その値をnから引きnが0になるまで繰り返す。その数をcnt++する
	//貪欲法ではだめっぽい
	int cnt = 0;
	while (1) {
		for (int i = 0; i < vecen.size(); ++i) {
			if (n >= vecen.at(i)) {
				n = n - vecen.at(i);
				break;
			}
		}
		cnt++;
		if (n == 0) {
			break;
		}
	}

	//cout << cnt << endl;

	int coin_lnup = (int)vecen.size();

	// DP初期条件: dp[i][0] = 0
	for (int i = 0; i < MAX_N; ++i) 
		for (int w = 0; w < MAX_W; ++w) dp[i][w] = 1 << 29; // INF(http://d.hatena.ne.jp/pknight/20100427/1272396732)

	for (int i = 0; i <= coin_lnup; ++i) dp[i][0] = 0;

	// DPループ
	for (int i = 0; i < coin_lnup; ++i) {
		for (int w = 0; w <= n2; ++w) {
			dp[i + 1][w] = min(dp[i + 1][w], dp[i][w]);
			if (w >= vecen[i]) {
				int tmp3 = dp[i + 1][w];
				//cout << "比較する前" << tmp3 << endl;

				dp[i + 1][w] = min(dp[i + 1][w], dp[i + 1][w - vecen[i]] + 1);
				int tmp1 = dp[i + 1][w];
				int tmp2 = dp[i + 1][w - vecen[i]] + 1;

				//cout << tmp1 << "and" << tmp2 << endl;
				//cout << i << "and" << w << endl;
				//cout << i+1 << "and" << w << endl;
				//cout << "**********************" << endl;

			}
		}
	}

	cout << dp[coin_lnup][n2] << endl;


	return 0;
}

Measured memory_bytes: 6656
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++){
    cin >> a[i];
  }
  int q;
  cin >> q;
  a.erase(unique(a.begin(), a.end()), a.end());
  for (int i = 0; i < a.size(); i++){
    cout << a[i];
    if (i < a.size() - 1){
      cout << ' ';
    }
  }
  cout << endl;
}


Measured memory_bytes: 3112
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-9;

	int n, x;
	int[] a;

	void run(){
		for(;;){
			n=sc.nextInt();
			x=sc.nextInt();
			if((n|x)==0){
				break;
			}
			a=new int[n];
			for(int i=0; i<n; i++){
				a[i]=sc.nextInt();
			}
			solve();
		}
	}

	void solve(){
		int max=1000000;
		int p=0;
		int[] prime=new int[max];
		boolean[] isPrime=new boolean[max+1];
		Arrays.fill(isPrime, true);
		isPrime[0]=isPrime[1]=false;
		for(int i=2; i<=max; i++){
			if(isPrime[i]){
				prime[p++]=i;
				for(int j=2*i; j<=max; j+=i){
					isPrime[j]=false;
				}
			}
		}
		boolean[] dp=new boolean[max+1];
		dp[0]=true;
		for(int j=0; j<n; j++){
			for(int i=a[j]; i<=max; i++){
				dp[i]|=dp[i-a[j]];
			}
		}
		int ans=0;
		for(int i=2; i<=x; i++){
			if(dp[i]&&isPrime[i]){
				ans=i;
			}
		}
		if(ans>0){
			println(ans+"");
		}else{
			println("NA");
		}
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		// System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		new Main().run();
	}
}

Measured memory_bytes: 18000
#include <iostream>
#include <cmath>
#include <vector>
#include <cstdlib>
#include <algorithm>

#include <stdio.h>
#include <stdlib.h>

using namespace std;

int main(int argc, char *argv[]){

  int N;
  int A, B;
  cin >> N >> A >> B;

  printf("%d\n", (N*A < B)? N*A : B);

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int i = 0, i_len = n; (i) < (i_len); ++(i))
#define repp(i,n) for(int i = 1, i_len = n; (i) <= (i_len); ++(i))
#define per(i,n) for(int i = n-1; (i) >= 0; --(i))
#define perr(i,n) for(int i = n; (i) > 0; --(i))
#define sz(x) ((int)(x).size())
#define popcnt __builtin_popcount
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).begin(),(v).end(),greater<>()
#define debug(x) cerr << #x << ':' << x << '\n'
#define Pi 3.1415926535
#define MOD 1000000007
using namespace std;
using ll = long long;
using pint = pair<int,int>;
using itn = int;
using vint = vector<int>;
template<class T,class S> inline bool chmax(T& a, S b){if(a<b){a = b; return true;} return false;}
template<class T,class S> inline bool chmin(T& a, S b){if(a>b){a = b; return true;} return false;}
template<class T> T gcd(T a, T b){return b?gcd(b,a%b):a;}
template<class T> T lcm(T a, T b){return a*b/gcd(a,b);}
void yes(){cout << "Yes" << '\n';}
void no(){cout << "No" << '\n';}

int solve(){
    int x; cin >> x;
    if(x >= 30) yes();
    else no();
    return 0;
}

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


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

namespace abc051_c
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int tate = x[3] - x[1];
            int yoko = x[2] - x[0];
            for (int i = 0; i < tate; i++)
            {
                Console.Write("U");
            }
            for (int i = 0; i < yoko; i++)
            {
                Console.Write("R");
            }
            for (int i = 0; i < tate; i++)
            {
                Console.Write("D");
            }
            for (int i = 0; i < yoko; i++)
            {
                Console.Write("L");
            }
            Console.Write("L");
            for (int i = 0; i < tate + 1; i++)
            {
                Console.Write("U");
            }
            for (int i = 0; i < yoko + 1; i++)
            {
                Console.Write("R");
            }
            Console.Write("DR");
            for (int i = 0; i < tate + 1; i++)
            {
                Console.Write("D");
            }
            for (int i = 0; i < yoko + 1; i++)
            {
                Console.Write("L");
            }
            Console.WriteLine("U");
        }
    }
}

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

template<typename T> class CumulativeSum2D{
    public:
        vector<vector<T>> sum;
        
        CumulativeSum2D(int h, int w);
        void add(int x, int y, T v);
        void build();
        T get_rectangle(int sx, int sy, int gx, int gy);

        void build_row();
        void build_column();
        T get(int i, int j);
};

template<typename T> CumulativeSum2D<T>::CumulativeSum2D(int h, int w){
    sum = vector<vector<T>>(h + 2, vector<T>(w + 2, 0));
}

template<typename T> void CumulativeSum2D<T>::add(int x, int y, T v){
    sum[x + 1][y + 1] += v;
}

template<typename T> void CumulativeSum2D<T>::build(){
    for (int i = 1; i < sum.size(); i++){
        for (int j = 1; j < sum[i].size(); j++){
            sum[i][j] += sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1];
        }
    }
}

template<typename T> void CumulativeSum2D<T>::build_row(){
    for (int i = 1; i < sum.size(); i++){
        for (int j = 1; j < sum[i].size(); j++){
            sum[i][j] += sum[i][j - 1];
        }
    }
}

template<typename T> void CumulativeSum2D<T>::build_column(){
    for (int i = 1; i < sum.size(); i++){
        for (int j = 1; j < sum[i].size(); j++){
            sum[i][j] += sum[i - 1][j];
        }
    }
}

template<typename T> T CumulativeSum2D<T>::get_rectangle(int sx, int sy, int gx, int gy){
    return sum[gx + 1][gy + 1] - sum[sx][gy + 1] - sum[gx + 1][sy] + sum[sx][sy];
}

template<typename T> T CumulativeSum2D<T>::get(int i, int j){
    return sum[i + 1][j + 1];
}

const int Max = 100010;

int main(){
    int n, ch;
    cin >> n >> ch;
    CumulativeSum2D<int> cs(ch, Max);
    for (int i = 0; i < n; i++){
        int s, t, c;
        cin >> s >> t >> c;
        cs.add(c, s - 1, 1);
        cs.add(c, t, -1);
    }

    cs.build_row();
    for (int i = 1; i <= ch; i++){
        for (int j = 0; j < Max; j++){
            if (cs.get(i, j) >= 2) cs.add(i, j, -1);
        }
    }

    cs.build_column();
    int ans = 0;
    for (int i = 1; i < Max; i++){
        ans = max(ans, cs.get(ch, i));
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 13184
// int型のオーバーフローに注意

// 文字列の比較は==ではなく.equalsを使おう

// Stringの入力はnext();が丸い

import java.util.Arrays;
import java.util.Scanner;

public class Main {

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

		    long[] a = new long[3];
		    for(int i = 0; i < 3; i++) {
		    	a[i] = sc.nextLong();
		    }
		    
		    if(a[0] % 2 == 0 || a[1] % 2 == 0 || a[2] % 2 == 0 ) {
		    	System.out.println(0);
		    }else {
		    	Arrays.sort(a);
		    	System.out.println(a[0] * a[1]);
		    }
		    sc.close(); }

	public static  int gcd(int a, int b) {
	    if (a < b) {
	        int tmp = a;
	        a = b;
	        b = tmp;
	    }

	    int r = -1;
	    while (r != 0) {
	        r = a % b;
	        a = b;
	        b = r;
	    }

	    return a;
	}
}


Measured memory_bytes: 23888
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define sz(x) (int)x.size()
typedef pair<int,int>pii;
const int mxN=1e5+10,M=1e9+7;
int n,v[mxN],ans;
// LONG LONG CAS
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>n;
    if(n&1){
        cout<<0;
        return 0;
    }
    for(int i=1;i<=n;i++){
        cin>>v[i];
    }
    sort(v+1,v+n+1);
    cout<<v[n/2+1]-v[n/2];

}

Measured memory_bytes: 640
import java.io.*;

class Main {
    public static void main(String[] args) {
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));// ??\????????????????????????
            String line = br.readLine();
            int a = Integer.parseInt(line);
            
            int triple = a * a * a;
            System.out.println(triple);

            
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Measured memory_bytes: 24188
# include<bits/stdc++.h>
# define LL long long
using namespace std;
LL Pow(LL a,LL b)
{
	LL ans=1;
	for(;b;b>>=1,a=a*a)
	  if(b&1) ans=ans*a;
	return ans;
}
int main()
{
	LL n,P,Ans=1;
	cin>>n>>P;
	if(n==1) return printf("%lld",P),0;
	for(LL i=pow(P,1.0/n)+1;i;--i)
	  {
	  	if(Pow(i,n)<=0) continue;
	  	if(P%Pow(i,n)==0) Ans*=i,P/=Pow(i,n);
	  }
	return printf("%lld\n",Ans),0;
}

Measured memory_bytes: 384
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

a,b = inpl()
res = 0
for i in range(a,b+1):
    tmp = str(i)
    if tmp[0] == tmp[-1] and tmp[1] == tmp[-2]:
        res += 1
print(res) 

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

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(a) (a).begin(), (a).end()

#define INF 1000000000

using namespace std;

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    cout << min(A, B) + min(C, D) << endl;

    return 0;
}


Measured memory_bytes: 256
##a = int(stdin.readline().rstrip())
##b, c = [int(x) for x in stdin.readline().rstrip().split()]
##s = stdin.readline().rstrip()
##a = list(set(b))  重複を削除
##a = list(map(int,[int(x) for x in stdin.readline().rstrip().split()])) a[0, 1, 2, ...]
##a = [[0] * 2 for _ in range(n)]  a[0,0]
##v = [s[i: i+2] for i in range(0, len(s), 2)]
##  s="12345678" を v=["12","34","56","78"] にするイメージ
##s = "".join(list)リストを文字列に変換[""]は区切り文字
##a.sort(key=itemgetter(1))リストをソートできるよ(from operator import itemgetterが必要)
##sort_p = sorted(p) 昇順ソート

# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter
from collections import deque, Counter
import math
import pprint
from functools import reduce
import numpy as np
import random
import bisect
# stdin = open("sample.txt")


MOD = 1000000007
INF = float('inf')
alpha = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]

def keta(kazu): # 入力されたintを桁ごとに分解，リストで出力
    kazu_str = str(kazu)
    kazu_list = [int(kazu_str[i]) for i in range(0, len(kazu_str))]
    return kazu_list

def gcd(*numbers): # 最小公倍数
    return reduce(math.gcd, numbers)

def combination(m,n): # mCn
    
    if n > m:
        return 'すまん'
    return math.factorial(m) // (math.factorial(m-n) * math.factorial(n))

def pow_k(x,n):  # (x**n)の計算の高速化
    if n == 0:
        return 1
    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2
    return K * x

def fact(n): # nの素因数分解の結果を辞書で出力 fuct(24) → {2: 3, 3: 1}
    arr = {}
    temp = n
    for i in range(2,int(n**0.5)+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr[i] = cnt
    if temp != 1:
        arr[temp] = 1
    if arr == {}:
        arr[n] = 1
    return arr


    
def main():
    n = int(stdin.readline().rstrip())
    a_kari = list(map(int,[int(x) for x in stdin.readline().rstrip().split()]))
    a = sorted(a_kari)
    b_kari = list(map(int,[int(x) for x in stdin.readline().rstrip().split()]))
    b = sorted(b_kari)
    c_kari = list(map(int,[int(x) for x in stdin.readline().rstrip().split()]))
    c = sorted(c_kari)
    board_ab = [0] * n
    board_bc = [0] * n
    ans = 0
    
    for i in range(n):
        ab = bisect.bisect_left(a, b[i])
        bc = n - bisect.bisect_right(c, b[i])
        ans += ab * bc
        # print(ab,bc)
    print(ans)
    
main()

Measured memory_bytes: 48744
#include <algorithm>
#include <iostream> //標準入出力
#include <fstream>  //ファイルでの入出力
#include <vector>
#include <set>
#include <functional>
#include <string>
#include <utility> //pair
#include <cmath>  //sqrt 
#include <iomanip> //setprecision
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define MAX 1000000
#define pair(a) pair<a,a>

vector<ll> counter;
vector<bool> seen;
void dfs(vector<vector<ll>>& graph,vector<ll>& xs,ll& p){
    counter[p] = xs[p];
    seen[p]=true;
    for(auto son: graph[p]){
        if(seen[son]) continue;
        xs[son] += xs[p];
        if(graph[son].size()>0){
            dfs(graph,xs,son);
        }
        else counter[son] = xs[son];
    }
    return;
}

void _main(){
    ll n,q;cin >> n >> q;
    vector<vector<ll>> graph(n);
    vector<ll> xs(n,0);
    counter.resize(n);
    seen.resize(n);
    rep(i,n){
        counter[i]=0;
        seen[i]=false;
    }
    rep(i,n-1){
        ll a,b; cin >> a >> b;
        graph[a-1].push_back(b-1);
        graph[b-1].push_back(a-1);
    }
    rep(i,q){
        ll p,x; cin >> p >> x;
        xs[p-1] += x;
    }
    ll zero = 0;
    dfs(graph,xs,zero);
    rep(i,n){
        cout << counter[i] << ' ';
    }
    cout << endl;
    return;
}
int main() {
    cout << fixed << setprecision(10);
    _main();
    return 0;
}
    

Measured memory_bytes: 29404
#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>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pii;
typedef vector<pii> vii;
typedef vector<ll> vi;
typedef queue<ll> qi;
typedef queue<char> qc;
typedef queue<string> qs;
typedef vector<char> vc;
typedef vector<string> vs;
typedef map<char,ll> mpci;
typedef map<ll,ll> mpii;
typedef map<string,ll> mpsi;
typedef set<ll> sei;
typedef set<char> sec;
typedef set<string> ses;
typedef stack<ll> si;
typedef stack<char> sc;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
typedef vector<pll> vpll;
typedef vector<pdd> vdd;
typedef unsigned int uint;
typedef long double ld;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vii> vvii;
/*=====================================================================*/
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define sz(a) (int)(a.size())
#define len(a) (int)(a.length())
#define all(s) (s).begin(),(s).end()
#define fi first
#define se second
#define be begin
#define en end
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define forn(i,p,n) for(int i=p;i<n;i++)
#define ford(i,p,n) for(int i=n-1;i>=p;i--)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();++i)
#define zero(a) memset(a,0,sizeof(a))
#define number(a,num) memeset(a,num,sizeof(a))

/*=====================================================================*/

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;
}
inline void write(long long x) {
  static long long sta[35];
  long long top = 0;
  do {
    sta[top++] = x % 10, x /= 10;
  } while (x);
  while (top) putchar(sta[--top] + 48);
  puts("");
}
/*======================================================================*/
bool prime(int n)
{
	if(n==0||n==1)
	  return false;
	for(int i=2;i*i<=n;i++)
	  if(n%i==0)
	    return false;
	return true;
}
/*======================================================================*/
const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};
int a[111111];
/*======================================================================*/
int main()
{
  /*
	ios_base::sync_with_stdio(0);
	cin(tie);
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
  */
  /*====================================================================*/
  int n,k,q;
  read(n);
  read(k);
  read(q);
  rep(i,q)
  {
    int p;
    read(p);
    p--;
    a[p]++;
  }
  rep(i,n)
  {
  	if((q-a[i])<k)
  	  cout<<"Yes";
  	else
  	  cout<<"No";
  	cout<<endl;
  }
  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<cstdint>
#include<bits/stdc++.h>
#include<queue>
#include<set>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for(int i = n-1; i >= 0; i--)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define INF bit(60)
#define pb push_back
#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 (b<a) { a=b; return 1; } return 0; }

using namespace std;
using uif=uint_fast64_t;
using ll=long long int;

int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mod;a=1ll*a*a%mod;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


#define FACSIZE 2002

ll invfac[FACSIZE];
ll fac[FACSIZE];

ll mod_pow(ll ,ll );
ll mod_add(ll ,ll );
ll mod_mul(ll ,ll );
ll mod_div(ll ,ll );
void make_fact(ll );
void make_invfact(ll );



int main(void){

  ll n;
  cin>>n;
  ll num=1LL<<n;
  vector<ll> s(num);
  rep(i,num) cin>>s[i];

  sort(begin(s),end(s),greater<ll>());

  //for(auto x:s) cout << x << " ";
  //cout << endl;

  map< ll,ll,greater<ll> > mRest;
  map< ll,ll,greater<ll> > mCur;
  map< ll,ll,greater<ll> > mAdd;
  mCur[s[0]]=1;
  for(ll i=1;i<num;i++) mRest[ s[i] ]++;

  for(ll i=0;i< n ; i++ ){
    mAdd.clear();
    for(auto p:mCur){
      for(int j=0;j<p.second;j++){
        auto itr = mRest.lower_bound(p.first);
        if(itr==end(mRest)){
          cout << "No" << endl;
          return 0;
        }
        if(itr->first == p.first) itr++;
        if(itr==end(mRest)){
          cout << "No" << endl;
          return 0;
        }
        ll key=itr->first;
        //cout << p.first  << "," << key << endl;
        mRest[key]--;
        if(mRest[key]==0) mRest.erase(key);
        mAdd[key]++;
      }
      
    }
    for(auto p:mAdd){
      mCur[p.first]+=p.second;
    }
    //cout << endl;

  }
  cout << "Yes" << endl;

  return 0;

}

ll mod_pow(ll x,ll r){
  if(r==0) return 1;
  else if(r==1) return x%mod;
  else if(r%2==0){
    ll t=mod_pow(x,r/2)%mod;
    return t*t %mod;
  } 
  else{
    ll t=mod_pow(x,r/2)%mod;
    ll k= t*t %mod;
    return k*x%mod;
  } 
}
ll mod_add(ll a,ll b){
  return (a+b)%mod;
}

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

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

void make_fact(ll n){
  fac[0]=1;
  rep(i,n){
    fac[i+1]=mod_mul(fac[i],i+1);
  }  
}

void make_invfact(ll n){
  invfac[n]= mod_pow( fac[n] ,mod-2);
  for(int i=n-1;i>=0;i--){
    invfac[i]=mod_mul(invfac[i+1],i+1);
  }

}

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

int main(){
  int count = 0;
  string s,t;
  cin>>s>>t;
  for (int i=0;i<t.size();++i){
    if (s[i]==t[i]){
      count++;
    }
  }
  cout<<count;
}

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

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

    vector<int> c(26 + 1);
    rep (i, 26)
        cin >> c[i];

    vector<vector<int>> s(d + 1, vector<int>(26 + 1));
    rep (i, d)
        rep (j, 26)
            cin >> s[i][j];

    vector<int> t(d + 1);
    rep (i, d)
        cin >> t[i];

    int ans = 0;
    vector<int> last(26 + 1, 0);
    rep (i, d)
    {
        ans += s[i][t[i]];
        last[t[i]] = i;
        rep (j, 26)
            ans -= c[j] * (i - last[j]);

        cout << ans << endl;
    }

    return 0;
}

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

using namespace std;

int Step, N;
int NodeInfo[252];
bool Result[252][252];


bool solve() {

	for (int k = 0; k <= N + 1; ++k) {
		for (int i = 0; i <= N + 1; ++i) {
			for (int j = 0; j <= N + 1; ++j) {
				if (Result[i][k] && Result[k][j]) {
					Result[i][j] = true;
				}
			}
		}
	}

	for (int i = 0; i <= N; ++i) {
		if (Result[0][i] && (!Result[i][N + 1])) {
			return false;
		}
	}

	return true;
}

void createMapData() {
	int currentNode;

	for (int i = 0; i <= N; ++i) {
		for (int j = 1; j <= Step; ++j) {
			currentNode = i + j;
			if (currentNode > N) {
				Result[i][N + 1] = true;
				break;
			}

			currentNode = max(0, currentNode += NodeInfo[currentNode]);
			if (currentNode >= N) {
				Result[i][N + 1] = true;
			}
			else {
				Result[i][currentNode] = true;
			}
		}
	}
}

int main() {

	while (cin >> Step, Step) {
		memset(NodeInfo, 0, sizeof(NodeInfo));
		memset(Result, false, sizeof(Result));
		cin >> N;
		for (int i = 1; i <= N; ++i) {
			cin >> NodeInfo[i];
		}

		createMapData();
		if (solve()) {
			cout << "OK" << endl;
		}
		else {
			cout << "NG" << endl;
		}
	}

	return 0;
}



Measured memory_bytes: 3144
import collections
from math import factorial
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n =int(input())
s_lis = []

for i in range(n):
	x = list(input())
	x.sort()
	n = ''.join(x)
	s_lis.append(n)

z = collections.Counter(s_lis)

ans = 0
for i in z.values():
	if i>1:
		ans += combinations_count(i, 2)
print(ans)

Measured memory_bytes: 19808
n, m, c = gets.split.map(&:to_i)
bs = gets.split.map(&:to_i)
muls = n.times.map do
  line = gets.split.map(&:to_i)
  mul = c
  m.times { |i| mul += bs[i] * line[i] }
  mul
end
puts muls.count { |s| s > 0 }

Measured memory_bytes: 1788
#include <stdio.h>

    
   int main(void){
  int r,c,i,j;
  static int s[101][101];

  scanf("%d%d",&r,&c);

  for(i=0;i<=r;i++){
    for(j=0;j<c;j++){
      scanf("%d", &s[i][j]);
      printf("%d ", s[i][j]);
      s[i][c] += s[i][j];
      s[r][j] += s[i][j];
    }
    printf("%d\n",s[i][c]);
  }

  return 0;
}


Measured memory_bytes: 2108
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

void print() {
    cout << endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail) != 0) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
void print(vector<T> &vec) {
    for (auto& a : vec) {
        cout << a;
        if (&a != &vec.back()) cout << ' ';
    }
    cout << endl;
}

template <class T>
void print(vector<vector<T>> &df) {
    for (auto& vec : df) {
        print(vec);
    }
}


int main(){
    int n,k; cin >> n >> k;
    ld a = 0;
    vector<int> vec;
    while(1){
        int temp = ceil(ld(k) / pow(2.0, a));
        vec.push_back(temp);
        // print(ld(k) / pow(2.0, a));
        a++;
        if(temp == 1)break;
    }
    reverse(vec.begin(), vec.end());
    // print(vec);
    ld ans = 0;
    for(int i = 1;i <= n;i++){
        auto itr = lower_bound(vec.begin(), vec.end(), i);
        int temp;
        if(itr == vec.end()){itr--; temp = itr - vec.begin();}
        else if(*itr == i)temp = itr - vec.begin();
        else temp = itr - vec.begin() - 1;
        temp = vec.size() - temp - 1;
        if(temp < 0)temp = 0;
        // print(temp);
        ans += (pow(0.5, temp) / ld(n));
    }

    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>

int main(){
  
  int N =0;
  std::string S;
  
  std::cin >> N >> S;
  
  // 一つ目の条件が当てはまるものを数える
  std::int64_t R = 0;
  std::int64_t G = 0;
  std::int64_t B = 0;
  for(char c : S){
    if(c == 'R'){
      R++;
    }
    else if(c == 'G'){
      G++;
    }
    else{
      B++;
    }
  }
  std::int64_t first_sum = R*G*B;
  
  // 二つ目の対象に当てはまらないものを数える
  std::int64_t second_sum = 0;
  
  if( 3 <= N ){
    for(int i = 0; i < N-2; i++){
      for(int j = i+1; j < N-1; j++){
        int k = 2*j-i;
        if( N <= k ){
          continue;
        }
        else if(S.at(i) != S.at(j)){
          if(S.at(i) != S.at(k)){
            if(S.at(j) != S.at(k)){
              second_sum++;
            }
          }
        }
      }
    }
  }
  
  std::cout << first_sum-second_sum << std::endl;
  
  return 0;
}

Measured memory_bytes: 3216
#include<cstdio>

using namespace std;

int main(){
    int n;
    scanf("%d", &n);
    for(int i = 0; i < 10; i++){
        if (n > 111 * i && n <= 111 * (i + 1)) {
            printf("%d\n", 111 * (i + 1));
            return 0;
        }
        
    }
    
}

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

int main() {
    int n;
    cin >> n;
    int64_t a[n], b[n];
    rep(i,n) {
        cin >> a[i] >> b[i];
    }
    int64_t ans = 0;
    for (int i = n-1; i > -1; i--) {
        a[i] += ans;
        ans += (b[i] - (a[i] % b[i])) % b[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
long ans = 0;
void calc(long a, long b, long c, long k){
    if(k==(a+b+c)){
        ans = a - c;
    }else{
        cout << "!!!!!!!!!!!!!!!!!!!!" << endl;
    }
}
int main(){
    long a,b,c,k;
    long selectA=0,selectB=0,selectC=0;
    cin >> a >> b >> c >> k;
    //k枚選ぶ
    if(a>k){
        selectA=k;
        calc(selectA,0,0,k);
    }else{
        if(b>(k-a)){
            selectA=a;
            selectB=(k-a);
            calc(selectA,selectB,0,k);
        }else{
            selectA=a;
            selectB=b;
            selectC=(k-a-b);
            calc(selectA,selectB,selectC,k);
        }
    }
    cout << ans << endl;
    return 0;
}

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

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

    vector<size_t> k(13), l(25);
    k[0] = 1;
    for(size_t i = 0, j; i < N; ++i){
        cin >> j;
        if(l[24 - j])return 0 & puts("0");
        l[j] = l[24 - j] = k[j];
        k[j] = 1;
    }

    vector<size_t> D, C;
    for(size_t i = 0; i < 13; ++i)if(k[i] ^ l[i])D.push_back(i);
    for(size_t i = 0; i < 25; ++i)if(l[i])C.push_back(i % 24);
    auto d = D.size(), c = C.size();

    vector<size_t> a(d + c);
    size_t ans = 0, K = 30;
    for(size_t m = 1; m < c; ++m)for(size_t n = 0; n < m; ++n)K = min(K, min(24 + min(C[m], C[n]) - max(C[m], C[n]), max(C[m], C[n]) - min(C[m], C[n])));
    for(size_t i = 0, j; i < 1 << d; ans = max(j, ans)){
        j = K;
        if(++i && d)(D[__builtin_ctzl(i)] *= -1) += 24;
        for(size_t m = 0; m < d; ++m)for(size_t n = 0; n < c; ++n)j = min(j, min(24 + min(D[m], C[n]) - max(D[m], C[n]), max(D[m], C[n]) - min(D[m], C[n])));
        for(size_t m = 1; m < d; ++m)for(size_t n = 0; n < m; ++n)j = min(j, min(24 + min(D[m], D[n]) - max(D[m], D[n]), max(D[m], D[n]) - min(D[m], D[n])));
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a, b;
	int r;
	int x, y;
	int tmp;
	while (scanf("%d %d", &a, &b) != EOF){
	
		x = a;
		y = b;
		if (a < b){
			tmp = a;
			a = b;
			b = tmp;
		}
		
		r = a % b;
		while (r != 0){
			a = b;
			b = r;
			r = a % b;
		}
		
		printf("%d %d\n", b, x / b * y);
	}
	return (0);
}

Measured memory_bytes: 1684
import java.util.*;

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

        if(Math.abs(a-b)%2 == 0){
            System.out.println("Alice");
        }else{
            System.out.println("Borys");
        }

    }
}


Measured memory_bytes: 21844
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>
#include <complex>


typedef long long ll;
const double Eps = 1e-6;

using namespace std;

int main()
{
	int n;
	scanf("%d", &n);
	while (n--)
	{
		int from, to;
		scanf("%d %d", &from, &to);
		if (to > from)
		{
			for (int i = from; i < to; ++i)
				printf("%d ", i);
			printf("%d\n", to);
		}
		else
		{
			if (from >= 6)
			{
				for (int i = from; i <= 9; ++i)
					printf("%d ", i);

				if (to >= 6 && to < from)
				{
					for (int i = 5; i > 0; --i)
						printf("%d ", i);
					for (int i = 0; i < to; ++i)
						printf("%d ", i);
					printf("%d\n", to);
					continue;
				}
				else
					from = 5;
			}
			for (int i = from; i > to; --i)
				printf("%d ", i);
			printf("%d\n", to);
		}
	}

	return 0;
}

Measured memory_bytes: 0
/* Life is all about calculated risks.
    But man am I bad at math. */

#include <bits/stdc++.h> 
#define ll long long int
#define INF (ll)1e12
#define MOD 1000000007

#define DEBUG(x) cerr<<"> "<< #x << ':' <<x<<endl;

using namespace std;

ll f(ll day, ll act);

ll n;
ll a[100100],b[100100],c[100100];
vector<vector<ll>> dp(100100,vector<ll>(5,-1));

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

    cin>>n;
    for(ll i=1; i<=n; i++)
    {
        cin>>a[i]>>b[i]>>c[i];
    }

    cout<<max( f(n,1), max( f(n,2),f(n,3) ))<<endl;

    return 0;
}

ll f(ll day, ll act)
{
    if(dp[day][act] != -1)
    {
        return dp[day][act];
    }   

    ll act_value;
    if(act == 1)
    {
        act_value = a[day];
    }
    else if(act == 2)
    {
        act_value = b[day];
    }
    else if(act == 3)
    {
        act_value = c[day];
    }

    if(day == 1)
    {
        return dp[day][act] = act_value;
    }

    if(act == 1)
    {
        return dp[day][act] = max( f(day-1,2) + act_value , f(day-1,3) + act_value );
    }
    else if(act == 2)
    {
        return dp[day][act] = max( f(day-1,1) + act_value , f(day-1,3) + act_value );
    }
    else if(act == 3)
    {
        return dp[day][act] = max( f(day-1,1) + act_value , f(day-1,2) + act_value );
    }
}


Measured memory_bytes: 14336