akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double PI = 3.14159265358979;
const double E = 2.718281828459045;
const double root2 = sqrt(2);
typedef pair<int, int> P;
typedef unsigned int ui;
int main() {
	int m, t, p, r;
	while (cin >> m >> t >> p >> r) {
		if (m == 0)break;
		int score[51] = {}; int pena[51] = {}; int wa[51][11];
		for (int i = 0; i < 51; i++) {
			for (int j = 0; j < 11; j++) {
				wa[i][j] = 0;
			}
		}
		int a, b, c, d;
		for (int i = 0; i < r; i++) {
			cin >> a >> b >> c >> d;
			if (d == 0) {
				score[b]++;
				pena[b] += a + 20 * wa[b][c];
			}
			else {
				wa[b][c]++;
			}
		}
		int memo; int used[51] = {};
		for (int i = 1; i <= t; i++) {
			int chk=-1;
			for (int j = 1; j <= t; j++) {
				if (used[j] == 0) {
					if (chk == -1)chk = j;
					else if (score[j] > score[chk] || (score[j] == score[chk] && pena[j] < pena[chk]) || (score[j] == score[chk] && pena[j] == pena[chk] && j > chk)) {
						chk = j;
					}
				}
			}
			if (i == 1) {
				cout << chk;
			}
			else {
				if (score[chk] == score[memo] && pena[chk] == pena[memo]) {
					cout << "=" << chk;
				}
				else cout << "," << chk;

			}
			used[chk] = 1; memo = chk;
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3096
#include <cassert>
#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
bool grid[52][52];
bool used[52][52];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);

    int h,w;
    cin>>h>>w;
    int freeCells = 0;
    for(int i=1; i<=h; i++)
    {
        string s;
        cin>>s;
        for(int j=1; j<=w; j++)
        {
            grid[i][j]=(s[j-1]=='.');
            freeCells+=grid[i][j];
        }
    }
    deque<pair<pair<int,int>,int>> deq;
    deq.push_back({{1,1},0});
    used[1][1]=true;
    int ans = -1;
    while(!deq.empty()){
        pair<pair<int,int>,int> r = deq.front();
        deq.pop_front();
        int x = r.first.first;
        int y = r.first.second;
        int sp = r.second;
        if(x==h && y==w){
            ans=sp+1;
        }
        if(grid[x-1][y] && !used[x-1][y]){
                used[x-1][y]=true;
                deq.push_back({{x-1,y},sp+1});
        }
        if(grid[x+1][y] && !used[x+1][y]){
                 used[x+1][y]=true;
                deq.push_back({{x+1,y},sp+1});
        }
        if(grid[x][y-1] && !used[x][y-1]){
             used[x][y-1]=true;
                deq.push_back({{x,y-1},sp+1});
        }
        if(grid[x][y+1] && !used[x][y+1]){
             used[x][y+1]=true;
                deq.push_back({{x,y+1},sp+1});
        }
    }
    if(ans==-1){
        cout<<-1;
    }else{
        cout<<freeCells-ans;
    }
    return 0;
}


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

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

        String S = sc.next();
        String p = sc.next();

        String S2 = S + S;
        boolean result = false;
        for (int i = 0; i < S2.length() - p.length() + 1; i++) {
            if (S2.substring(i).startsWith(p)) {
                result = true;
                break;
            }
        }
        if (result) {
            out.printf("Yes\n");
        } else {
            out.printf("No\n");
        }
        out.flush();
    }
}


Measured memory_bytes: 26388
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define REP(X, Y, Z) for (ll(X) = (Y); (X) < (Z); (X)++)

using namespace std;
using ll = long long;
using dll = deque<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using usll = unordered_set<ll>;
using umll = unordered_map<ll, ll>;
using sll = stack<int>;
using vll = vector<ll>;
using vvll = vector<vll>;

constexpr ll kMod = 1e9 + 7;

ll gcd(ll a, ll b) {
  if (a < b) {
    return gcd(b, a);
  }
  ll c = a % b;
  while (c != 0) {
    a = b;
    b = c;
    c = a % b;
  }
  return b;
}

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

void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

int main() {
  init();

  ll N;
  cin >> N;
  unordered_set<string> S;
  vll v(5);
  REP(i, 0, N) {
    string s;
    cin >> s;
    if (S.find(s) == S.end()) {
      if (s[0] == 'M' || s[0] == 'A' || s[0] == 'R' || s[0] == 'C' ||
          s[0] == 'H') {
        S.emplace(s);
        if (s[0] == 'M') {
          v[0]++;
        } else if (s[0] == 'A') {
          v[1]++;
        } else if (s[0] == 'R') {
          v[2]++;
        } else if (s[0] == 'C') {
          v[3]++;
        } else {
          v[4]++;
        }
      }
    }
  }

  if (S.size() < 3) {
    cout << "0" << endl;
    return 0;
  }

  ll table[10][3] = {
      {0, 1, 2},
      {0, 1, 3},
      {0, 1, 4},
      {0, 2, 3},
      {0, 2, 4},
      {0, 3, 4},
      {1, 2, 3},
      {1, 2, 4},
      {1, 3, 4},
      {2, 3, 4},
  };

  ll result = 0;
  REP(i, 0, 10) {
    result += v[table[i][0]] * v[table[i][1]] * v[table[i][2]];
  }
  cout << result << endl;

  return 0;
}


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

int main(int argc, char const *argv[])
{
	int n,k,q;
	cin>>n>>k>>q;
	int a[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
	}
	int ans=1000000000;
	for (int i = 0; i < n; ++i)
	{
		vector<int> tmp1,tmp2;
		for (int j = 0; j < n; ++j)
		{
			if (a[i]>a[j])
			{
				if (tmp1.size()>=k)
				{
					sort(tmp1.begin(), tmp1.end());
					int cnt=(int)tmp1.size()-k+1;
					for (int l = 0; l < cnt; ++l)
					{
						tmp2.push_back(tmp1.at(l));
					}
				}
				tmp1={};
			}
			else
			{
				tmp1.push_back(a[j]);
			}
		}
		if (tmp1.size()>=k)
		{
			sort(tmp1.begin(), tmp1.end());
			int cnt=(int)tmp1.size()-k+1;
			for (int l = 0; l < cnt; ++l)
			{
				tmp2.push_back(tmp1.at(l));
			}
		}
		if (tmp2.size()>=q)
		{
			sort(tmp2.begin(), tmp2.end());
			ans=min(ans,tmp2.at(q-1)-tmp2.at(0));
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

string a;
int n, mx, mn = 2e9, cnt;
bool v[105];
int main()
{
	int i, j;
	cin >> a;
	for (i =0; i < a.size(); i++) {
		if (v[i]) continue;
		v[i] = 1;
		mx = i;
		cnt = 0;
		for (j = i + 1; j < a.size(); j++) {
			cnt++;
			if (a[j] == a[i]) {
				mx = max(mx, cnt - 1);
				cnt = 0;
			}
		}
		mx = max(mx, cnt);
		mn = min(mn, mx);
	}
    cout << mn;
    return 0;
}


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

#define rep(x, n) for(int i = x; i < (n); ++i)

using namespace std;
using ll = long long;

int main(void)
{
  string s, t;
  cin >> s >> t;

  int res = t.size();
  for (int start = 0; start <= s.size() - t.size(); ++start)
  {
    int diff = 0;
    for (int i = 0; i < t.size(); ++i)
    {
      if (t[i] != s[start + i])
        ++diff;
    }
    res = min(res, diff);
  }

  cout << res << endl;
}


Measured memory_bytes: 3588
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define first_more_idx(ve, num) upper_bound(all(ve), num)-ve.begin() // idx = first_more_idx(ve,num); if(idx = ve.size()) , then not exist
#define first_lessequal_idx(ve, num) lower_bound(all(ve), num)-ve.begin()
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > // only sort first param
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}
ll power(ll x, ll n){if(n == 0) return 1;return  (n%2)? x*power(x, n-1)%MOD : power(x*x%MOD, n/2);}

ll N ;
ll dp[101][4][4][4];
ll mo = MOD;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin >> N ;
    dp[0][0][0][0] = 1; // now,
    rep(i, N)rep(a1, 4)rep(a2, 4)rep(a3, 4) rep(b, 4){
//        if(b==2 and a1 == 3 and a2 == 1            ) continue;
//        if(b==2 and a1 == 1 and a2 == 3            ) continue;
//        if(b==3 and a1 == 2 and a2 == 1            ) continue;
//        if(b==2             and a2 == 3 and a3 == 1) continue;
//        if(b==2 and a1 == 3             and a3 == 1) continue;

        // AGC ACG GAC A?GC AG?C
        if(b==2 and a1 == 3 and a2 == 1            ) continue;
        if(b==3 and a1 == 1 and a2 == 2            ) continue;
        if(b==3 and a1 == 2 and a2 == 1            ) continue;
        if(b==3             and a2 == 2 and a3 == 1) continue;
        if(b==3 and a1 == 2             and a3 == 1) continue;

        
//        if(           a2 == 1 && a1 == 3 && b == 2) continue;
//        if(           a2 == 3 && a1 == 1 && b == 2) continue;
//        if(           a2 == 1 && a1 == 2 && b == 3) continue;
//        if(a3 == 1 && a2 == 3 &&  /*?*/     b == 2) continue;
//        if(a3 == 1 &&   /*?*/    a1 == 3 && b == 2) continue;
        dp[i+1][b][a1][a2] += dp[i][a1][a2][a3] %= MOD;
    }
    ll ans =0 ;
    rep(i, 4)rep(j,4)rep(k, 4) ans += dp[N][i][j][k];
    cout << ans % MOD << endl;
    
    
    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>
#define maxn 100005
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int inf = 0x3f3f3f3f;
int n,k,h[maxn];
int main(){
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++) scanf("%d",&h[i]);
	sort(h + 1,h + n + 1);
	int ans = inf;
	for(int i = 1;i + k - 1 <= n;i++){
		ans = min(ans,h[i + k - 1] - h[i]);
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 640
module Main where

main :: IO ()
main = do
  s <- getLine
  let w = numOfWs s
  let ws = take w [1..] :: [Int]
  let ws' = posOfWs s :: [Int]
  print $ sum $ zipWith (-) ws' ws
  where
    numOfWs = length . filter (=='W')
    posOfWs = map fst . filter ((=='W') . snd) . zip [1..]

Measured memory_bytes: 13820
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>
#include <numeric>
#include <iomanip>

using namespace std;
vector <int> edges[100000];
int group[100000];
bool dfs(int cur, int cur_mod){
  group[cur] = cur_mod;
  for(int i = 0; i < edges[cur].size(); i++){
    int next = edges[cur][i];
    if(group[next] == cur_mod){
      return false;
    } else if(group[next] < 0){
      if(!dfs(next, (cur_mod + 1) % 2)){
        return false;
      }
    }
  }
  return true;
}

int main(void){
  long long N;
  long long M;
  cin >> N >> M;
  for(int i = 0; i < M; i++){
    int A;
    int B;
    cin >> A >> B;
    edges[A - 1].push_back(B - 1);
    edges[B - 1].push_back(A - 1);
  }

  for(int i = 0; i < N; i++){
    group[i] = -1;
  }

  if(dfs(0, 0)){
    long long group_0_count = 0;
    for(int i = 0; i < N; i++){
      if(group[i] == 0){
        group_0_count ++;
      }
    }
    cout << group_0_count * (N - group_0_count) - M << endl;
  } else {
    cout << (N * (N - 1) - (long long) 2 * M) / (long long) 2;
  }
  return 0;
}


Measured memory_bytes: 6528
def fib(n):
    if n == 0 or n == 1:
        ans[n] = 1
        return 1
    # ?????¢???????¨?????????????????´???§????????°?????????????????????
    if ans[n] != -1:
        return ans[n]

    ans[n] = fib(n-1) + fib(n-2)
    return ans[n]


N = int(input())
ans = [-1 for i in range(N+1)]
a = fib(N)
print(a)

Measured memory_bytes: 7740
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define MOD 1000000007

int main(){
  string s;
  cin>>s;
  for(int i=0;i<(1<<4);i++){
    string tmp="KIHBR";
    int c=0;
    for(int j=0;j<4;j++){
      if((i>>j)&1){
        if(j==0){
          tmp.insert(0,"A");
          c++;
        }else{
          tmp.insert(2+j+c,"A");
          c++;
        }
      }
    }
    //cout<<tmp<<endl;
    if(tmp==s){
      cout<<"YES"<<endl;
      return 0;
    }
  }
  cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
	int h, w, k;
	cin >> h >> w >> k;
	vector<string> s(h);
	rep(snip_i, h) cin >> s.at(snip_i);
	vector<vector<int>> vv(h, vector<int>(w, -1));
	int count = 1, st;
	rep(i, h)rep(j, w){
		if(s.at(i).at(j) == '#'){
			if(count == 1) st = i;
			vv.at(i).at(j) = count;
			count++;
		}
	}
	rep2(i, st, h){
		deque<pair<int, int>> deq;
		rep(j, w){
			if(vv.at(i).at(j) != -1) deq.push_back(make_pair(j, vv.at(i).at(j)));
		}
		if(deq.size() == 0) vv.at(i) = vv.at(i-1);
		else{
			auto p = deq.front(); deq.pop_front();
			rep(j, w){
				if(!deq.empty() && j == deq.front().first){
						p = deq.front(); deq.pop_front();
				}
				vv.at(i).at(j) = p.second;
			}
		}
	}
	for(int i = st-1; i >= 0; i--) vv.at(i) = vv.at(i+1);
	rep(i, h){
		rep(j, w){
			if(j != 0) cout << " ";
			cout << vv.at(i).at(j);
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1280
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ProblemB_RobotArms solver = new ProblemB_RobotArms();
        solver.solve(1, in, out);
        out.close();
    }

    static class ProblemB_RobotArms {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = in.nextInt();
            Segment[] a = new Segment[n];
            for (int i = 0; i < n; i++) {
                int x = in.nextInt();
                int len = in.nextInt();
                a[i] = new Segment(x - len, x + len);
            }

            Arrays.sort(a, (u, v) -> Integer.compare(u.r, v.r));

            int ans = 0;
            int r = Integer.MIN_VALUE;
            for (Segment s : a) {
                if (s.l >= r) {
                    r = s.r;
                    ++ans;
                }
            }
            out.println(ans);
        }

        class Segment {
            int l;
            int r;

            Segment(int l, int r) {
                this.l = l;
                this.r = r;
            }

        }

    }

    static class FastScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public FastScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

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

    }
}



Measured memory_bytes: 45940
#include <bits/stdc++.h>
using namespace std;
#define ft              first
#define sd              second
#define ll          long long
#define pb              push_back
#define mkp           make_pair
#define pll             pair<ll,ll>
#define vll             vector<int>
#define mll             map<ll,ll>
#define pqg             priority_queue<ll>
#define pqs             priority_queue<ll,vll,greater<ll>>
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod          1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define MAXN   10000001
void online_judge()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
#endif
}

void ISO()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
int main() {

    ISO();
    online_judge();
    int t;
    t = 1;
    while (t--)
    {

        int n;
        cin >> n;
        int h[n+1];
        for(int i=1;i<=n;++i)
        {
            cin >> h[i];
        }
        int cost[n+1] = {0};

        cost[2] = abs(h[2] - h[1]);
        cost[1] = 0;
        for(int i=3;i<=n;++i)
        {
            cost[i] = min((cost[i-1]+abs(h[i] - h[i-1])),(cost[i-2] +abs(h[i]-h[i-2])));
        }
        cout << cost[n] <<"\n";

    }

    cerr << "Time elapsed: " << clock() / 1000 << " ms" << endl;
    return 0;
}

Measured memory_bytes: 4396
#include <bits/stdc++.h>
// Hey! 僕の提出を見てくれてありがとう.
// ロボ子さん可愛いぞ！！！！！君もV沼にはまろう↓
// https://www.youtube.com/channel/UCDqI2jOz0weumE8s7paEk6g
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
//sortを降順にする時は greater<型>()
void solve(long long S, long long W){
  cout << (S <= W ? "unsafe" : "safe") << endl;
}

int main(){
    long long S;
	scanf("%lld",&S);
	long long W;
	scanf("%lld",&W);
    solve(S, W);
}


Measured memory_bytes: 3696
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);


    int sx, sy;
    int tx, ty;
    cin >> sx >> sy >> tx >> ty;


    string res;

    int x = tx - sx;
    int y = ty - sy;

    res += string(y, 'U');
    res += string(x, 'R');
    res += string(y, 'D');
    res += string(x, 'L');
    res += 'L';
    res += string(y + 1, 'U');
    res += string(x + 1, 'R');
    res += 'D';
    res += 'R';
    res += string(y + 1, 'D');
    res += string(x + 1, 'L');
    res += 'U';

    // cout << res.length() << endl;
    cout << res << '\n';

    return 0;
}

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

class Bridge {
public:
	vector<vector<int>> G;
	vector<int> ord, low;
	vector<pair<int, int>> bridges;
	int k;

	Bridge(int N):k(0) {
		G.resize(N); ord.resize(N, -1); low.resize(N, -1);
	}
	void clear() { G.clear();ord.clear();low.clear(); }
	void add_edge(int s, int t) {
		G[s].emplace_back(t); 
		G[t].emplace_back(s);
	}

	bool is_bridge(int u, int v)const {
		if (ord[u] > ord[v])swap(u, v);
		return ord[u] < low[v];
	}

	/* Lowlink */
	void dfs(int u,int rev = -1) {
		ord[u] = low[u] = k;
		k++;
		for (auto v : G[u]) {
			if (v == rev)continue;
			if (ord[v] < 0) {
				dfs(v, u);
				low[u] = min(low[u], low[v]);
			}
			else {
				low[u] = min(low[u], ord[v]);
			}
			if (is_bridge(u, v)) {
				int s = u, t = v;
				if (s > t) swap(s, t);
				bridges.push_back({ s,t });
			}
		}
	}

	void solve() {
		dfs(0);
		sort(bridges.begin(), bridges.end());
	}
};

int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	int V, E; cin >> V >> E;
	Bridge b(V);
	for (int i = 0; i < E;i++) {
		int s, t; cin >> s >> t;
		s--; t--;
		b.add_edge(s, t);
	}
	b.solve();
	cout << (int)b.bridges.size() << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
	int a,i=1;
	vector<int> h;
	while(cin >>a ){
		h.push_back(a);
		i++;
		if(i==11)
		break;
	}
	sort(h.begin(),h.end());
	reverse(h.begin(),h.end());
	for(int i=0;i<3;i++)
	cout << h[i]<<endl;

}
	

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

vector<vector<int>> G;
ll cnt[200010];

void dfs(int v,int p=-1){
    for(auto nv : G[v]){
        if(nv==p) continue;
        cnt[nv]+=cnt[v];
        dfs(nv,v);
    }
}

int main(){
    int n,q;
    cin>>n>>q;
    G.resize(n);
    rep(i,n-1){
        int a,b;
        cin>>a>>b;
        a--,b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    rep(i,q){
        int p;
        ll x;
        cin>>p>>x;
        p--;
        cnt[p]+=x;
    }

    dfs(0);

    rep(i,n) cout<<cnt[i]<<" ";
    cout<<endl;
}


Measured memory_bytes: 28308
import sys
readline = sys.stdin.readline

# 0-indexでやる

D = int(readline())
C = list(map(int,readline().split())) # 満足度の下がりやすさ
S = [None] * D
sortS = [None] * D
for i in range(D):
  s = list(map(int,readline().split()))
  S[i] = s.copy()
  for j in range(len(s)):
    s[j] = (s[j],j)
  sortS[i] = sorted(s, key = lambda x:x[0], reverse = True)

def make_ans(D,C,limiter = 4, threshold = 2, balance = 0.5, check_limit = False, get_max = True):
  ans = []
  last_submit = [0] * 26
  for i in range(D):
    info = sortS[i]
    
    if check_limit:
    
      # limiter回以上提出がないものがあれば、threshold回を超えたもののうちCの値が高いものを提出
      if i - min(last_submit) >= limiter:
        ind = -1
        for j in range(len(last_submit)):
          if get_max:
            if last_submit[j] == min(last_submit):
              ind = j
              break
          if i - last_submit[j] >= threshold:
            if ind == -1:
              ind = j
            else:
              if C[ind] < C[j]:
                ind = j
        ans += [ind]
        last_submit[ind] = i
        continue
      
    topval = info[0][0]
    for j in range(len(info)):
      val = info[j][0]
      if check_limit:
        if val < topval * (balance):
          continue # 最高値の半分になるのであればやめよう
      index = info[j][1]
      if i - last_submit[index] < 26:
        continue
      ans += [index]
      last_submit[index] = i
      break
    else:
      ans += [info[0][1]]
  return ans

def calc_score(arr):
  point = 0
  last_submit = [0] * 26
  for i in range(len(arr)):
    # i日目
    point += S[i][arr[i]]
    for j in range(len(last_submit)):
      point -= (i - last_submit[j]) * C[j]
  return point
      
ans = make_ans(D,C)
#print(ans)
best = calc_score(ans)
for limiter in range(28,62):
  for threshold in range(26, limiter):
    for balance in (0.2,0.3,0.4,0.5,0.6,0.7,0.8):
      for get_max in (True, False):
        new_ans = make_ans(D,C,limiter,threshold,balance,True,get_max)
        new_score = calc_score(new_ans)
        if new_score > best:
          ans = new_ans
          best = new_score
  
def show(arr):
  for a in arr:
    print(a + 1)
    
show(ans)


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

int main() {
    int n, c, k;
    cin >> n >> c >> k;

    vector<int> t(n);
    for (int i = 0; i < n; i++) cin >> t[i];
    sort(t.begin(), t.end());

    int i = 0, j;
    int total = 0;
    while (i < n) {
        j = i + 1;
        while (j - i < c && t[i] + k >= t[j] && j < n) {
            j++;
        } 
        total++;
        i = j;
    }

    cout << total << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;

int main(){
    string S;
    cin >> S;

    map<char, int> mp;
    REP(i, 4){
        mp[S[i]]++;
    }

    if (mp.size() == 2 and mp[S[0]] == 2){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3576
N = int(input())

S = []


for i in range(N):
	a,b = map(str, input().split())
	c = int(b)
	S.append([i, a, c])

S.sort(key=lambda x:(x[1],-x[2]))

for i in range(N):
	print(S[i][0]+1)


Measured memory_bytes: 3060
def main():
    m=30
    n,k=map(int,input().split())
    ab=[list(map(int,input().split())) for _ in [0]*n]
    test=[k]
    k=(("0"*m)+(bin(k)[2:]))[-m:]
    for i in range(m):
        if k[i]=="1":
            test.append(int(k[:i]+"0"+"1"*(m-i-1),2))
    m=0
    for t in test:
        cnt=0
        for a,b in ab:
            if a|t==t:
                cnt+=b
        m=max(cnt,m)
    print(m)
main()

Measured memory_bytes: 29412
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int S = Integer.parseInt(scan.nextLine());
		int h = S / (60 * 60);
		int m = (S - (h * 60 * 60)) / 60;
		int s = S - (h * 60 * 60) - (m * 60);
		System.out.println(h + ":" + m + ":" + s);
	}

}



Measured memory_bytes: 26200
x, n = map(int,input().split()) 
p = [int(i) for i in input().split()]
p.sort()

cnt_plus=1
cnt_minus=-1
# xがそもそも含まれていない場合
if x not in p:
    print(x)
# xが含まれている場合
else:
    # プラス方向に探索する
    while True:
        # リストに数字がある場合
        try:            
            # 同時に1つズレた場合
            if p[p.index(x)+cnt_plus] == x+cnt_plus:
                cnt_plus += 1
            # リストの数字が跳んだ場合
            else:
                plus_num = abs(x - (x+cnt_plus))
                break
        # リストに数字が無い場合
        except IndexError:
            plus_num = abs(x - (x+cnt_plus))
            break           
    # マイナス方向に探索する
    while True:
        try:
            # 同時に1つズレた場合
            if p[p.index(x)+cnt_minus] == x+cnt_minus:
                cnt_minus -= 1
                # リストの数字が跳んだ場合
            else:
                minus_num = abs(x - (x+cnt_minus))
                break
        # リストに数字が無い場合
        except IndexError:
            minus_num = abs(x - (x+cnt_minus))
            break        
    if plus_num < minus_num:
        print(x+cnt_plus)
    else:
        print(x+cnt_minus)


Measured memory_bytes: 9228
#include<bits/stdc++.h>
using namespace std;
int A,B,H,M;


#include<iostream>
#include<vector>
#include<limits>
using namespace std;
int V,E;
template<typename T>
class Graph{
    public:
    struct edge{int to;T cost;};
    int Vertex_num,Edge_num;
    vector<edge>*g;

    const T INF=10000000000000;

    Graph(int V,int E){//0～V-1
        Vertex_num=V;
        Edge_num=E;
        g=new vector<edge>[V];
    }

    void emplace_back(int from,int to,T cost){
        edge e={to,cost};
        g[from].push_back(e);
        //edges->push_back(e);//for Bellman-Ford
    }

    void input(bool direct,bool weight){
        int from,to;
        T cost;
        for(int i=0;i<Edge_num;i++){
            cin>>from>>to;
            from--,to--;
            if(weight)cin>>cost;
            else cost=1;
            this->emplace_back(from,to,cost);
            if(!direct)this->emplace_back(to,from,cost);
        }
    }

    void check(){
        for(int i=0;i<Vertex_num;i++){
            cout<<"Vertex "<<i<<endl;
            for(auto x:g[i])cout<<x.to<<" "<<x.cost<<endl;
        }
    }
};

template<typename T>
vector<T>dijkstra(Graph<T>graph,int start){
    //#include<queue>
    vector<T>dist(graph.Vertex_num,graph.INF);
    dist[start]=0;
    pair<T,int>c;
    //costで昇順のqueue　costが小さいものから見ていく
    priority_queue< pair<T,int>, vector<pair<T,int>>, std::greater<pair<T,int>> >q;
    q.push(make_pair(0,start));
    while(!q.empty()){
        c=q.top(),q.pop();
        if(dist[c.second]<c.first)continue;//更新済みの頂点
        for(int i=0;i<graph.g[c.second].size();i++){
            typename Graph<T>::edge x=graph.g[c.second][i];
            T new_cost=c.first+x.cost;//現在地までのコスト+頂点x.toへの辺のコスト
            if(new_cost<dist[x.to]){
                //prev[x.to]=c.second;//帰り道
                q.push(make_pair(dist[x.to]=new_cost,x.to));
            }
        }
    }
    return dist;
}

int main(){
    cin>>V>>E;
    Graph<long long>graph(V,E);
    graph.input(false,false);
    vector<long long>dist=dijkstra(graph,0);
    if(find(dist.begin(),dist.end(),10000000000000)!=dist.end()){cout<<"No"<<endl;return 0;}
    cout<<"Yes"<<endl;
    for(int i=1;i<V;i++){
        //cout<<"i:"<<i<<endl;
        for(int v=0;v<graph.g[i].size();v++){
            //cout<<graph.g[i][v].to<<endl;
            if(dist[i]-1==dist[graph.g[i][v].to]){cout<<graph.g[i][v].to+1<<endl;break;}
        }
    }
    return 0;
}

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

struct BIT {
    int size;
    vector<int> node;
    
    BIT(int n) {
        size = n;
        node.resize(n+1);
    }
    
    void add(int i, int x) {
        i++;
        while (i<=size) {
            node[i] += x;
            i += i&(-i);
        }
    }
    
    int acc(int i) {
        int s = 0;
        while (i>0) {
            s += node[i];
            i -= i&(-i);
        }
        return s;
    }
};

int n, q;
 
signed main() {
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> n >> q;
    BIT bit(n+10);
    while (q--) {
        int c, x, y; cin >> c >> x >> y;
        if (c==0) bit.add(x, y);
        else cout << bit.acc(y+1)-bit.acc(x) << endl;
    }
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main() {
  
  vector<char>vec(4);
  for(ll i=0;i<4;i++){
    cin>>vec.at(i);
  }
  for(ll i=0;i<3;i++){
    if(vec.at(i)==vec.at(i+1)){
      cout<<"Bad"<<endl;
      return 0;
    }
  }
  cout<<"Good"<<endl;
  return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <iomanip>
/*cout<<setprecision(5)<<ret<<endl;で、数字部分を計5桁表示かつゼロ埋め無*/
/*cout<<fixed<<setprecision(5)<<ret<<endlで、小数部のみ5桁表示かつゼロ埋め有*/
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
using namespace std;

typedef long long ll;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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; }

/* [Shift+Command+b]（コンパイル）ー＞[Ctrl+Shift+^]（ターミナル起動）ー＞[./a.out] */


//////////////////
//  A
/*int main(void){
    string a;cin>>a;
    sort(a.begin(),a.end());
    if(a[0]==a[1] && a[2]==a[3] && a[0]!=a[2]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}*/
//////////////////
//  B
int main(void){
    int n;cin>>n;
    vector<int> p(n);
    rep(i,n){
        cin>>p[i];
    }
    int cnt=0;
    for(int i=1;i<n-1;i++){
        if((p[i-1]<p[i]&&p[i]<p[i+1])||(p[i-1]>p[i]&&p[i]>p[i+1])){
            cnt++;
        }
    }
    cout<<cnt<<endl;
    return 0;
}
//////////////////
//  C
/*int main(void){

    return 0;
}*/
//////////////////
//  D
/*int main(void){

    return 0;
}*/
//////////////////
//  E
/*int main(void){

    return 0;
}*/
//////////////////
//  F
/*int main(void){

    return 0;
}*/


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

#define int long long

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  string s;
  cin >> s;

  int b = 0, w = 0;
  for ( int i = 0; i < s.size(); i++ ) {
    if ( i == 0 ) {
      if ( s[i] == 'B' ) b++;
      else w++;      
    } else {
      if ( s[i] != s[i-1] ) {
	if ( s[i] == 'B' ) b++;
	else w++;      
      }
    }   
  }

  cout << b+w-1 << endl;
  
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define dum(x) cout<<#x<<'='<<x<<endl
#define ll long long
using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int maxi = max({a, b, c});
  int d = (maxi - a) + (maxi - b) + (maxi - c);
  if (d % 2 == 0) {
    cout << d / 2 << endl;
  } else {
    cout << d / 2 + 2 << endl;
  }
}


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

bool erased[100001];
int similar[100001];  // bool
int psum[100001];


int main() {
    #ifdef DEBUG
        freopen("in.txt", "r", stdin);
    #endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

    for (int i = 2; i <= 100000; i++) {
        if (!erased[i]) {
            // cout << i << ' ';
            if (!erased[(i + 1) / 2]) {
                similar[i] = 1;
            }
            for (int j = i * 2; j <= 100000; j += i) {
                erased[j] = true;
            }
        }
    }

    similar[1] = 0;
    similar[2] = 0;
    for (int i = 1; i <= 100000; i++) {
        psum[i] = psum[i - 1] + similar[i];
    }

    int q; cin >> q;
    while (q--) {
        int l, r; cin >> l >> r;
        // for (int i = l; i <= r; i++) {
        //     cout << similar[i] << ' ' << psum[i] << '\n';
        // }
        cout << psum[r] - psum[l - 1] << '\n';
    }

    return 0;
}


Measured memory_bytes: 4492
/*author - Aryan Mittal*/
#include<bits/stdc++.h>
using namespace std;

#pragma GCC push_options
#pragma GCC optimize ("unroll-loops")

#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define watch2(x,y) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<"\n"

#define pow2(x) ((x)*(x))
#define ll long long
#define ld long double
#define eb emplace_back
#define pb push_back
#define pf push_front

#define mod 1000000007
#define clock (clock() * 1000.0 / CLOCKS_PER_SEC)

#define mp make_pair
#define ff first
#define ss second
#define null NULL

#define all(c) (c).begin(),(c).end()
#define nl "\n"

typedef vector<ll> vl;
typedef vector< vl > vvl;
typedef pair< ll,ll> pll;
typedef map< ll,ll> mll;

const double pi = 3.1415926535897;

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

    ll r;
    cin>>r;

    double ans = 2*pi*r;

    printf("%0.6lf",ans);
    
    
    return 0;
}

Measured memory_bytes: 3768
n, w = gets.split.map(&:to_i)
h = Hash.new{|hash,key| hash[key] = []}

n.times do
    k, v = gets.split.map(&:to_i)
    h[k] << v
end

h = h.map {|k,v| [k, v.sort_by!{|ee| -ee}]}
h.map! do |k,v| 
    (v.size - 1).times {|i| v[i+1] += v[i]}
    v << 0
    [k, v]
end
h += [[0, [0]]] * 3

ans = 0
(h[0][1].size + 1).times do |i|
    (h[1][1].size + 1).times do |j|
        (h[2][1].size + 1).times do |x|
            (h[3][1].size + 1).times do |y|
                w_sum = h[0][0] * i + h[1][0] * j + h[2][0] * x + h[3][0] * y
                v_sum = h[0][1][i-1] + h[1][1][j-1] + h[2][1][x-1] + h[3][1][y-1]
                next if w_sum > w
                ans = v_sum if ans < v_sum
            end
        end
    end
end

p ans

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

const int MAX=7368792;

int m,n,cnt;
vector<int> is_prime(MAX);

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> m >> n,m){
        cnt=0;
        for (int i=0;i<MAX;++i) is_prime[i]=1;
        for (int i=m;;++i){
            if (is_prime[i]){
                ++cnt;
                for (int j=i*2;j<MAX;j+=i) is_prime[j]=0;
            }
            if (cnt>n){
                cout << i << '\n';
                break;
            }
        }

    }
}


Measured memory_bytes: 31352
package main
     
import (
	"fmt"
)
 
func main() {
	var n, m, x, inf int
	fmt.Scan(&n, &m, &x)
	square := make([][]int, n)
	for i := 0; i < n; i++ {
		row := make([]int, m+1)
		for j := 0; j <= m; j++ {
			fmt.Scan(&row[j])
		}
		inf += row[0]
		square[i] = row
	}
	inf++
	ans := inf
	max := 1 << n
	for i := 0; i <= max; i++ {
		cost := 0
		sum := make([]int, m)
		for j := 0; j < n; j++ {
			if refbit(i,j) == 1 {
				cost += square[j][0]
				for k := 0; k < m; k++ {
					sum[k] += square[j][k+1]
				}
			}
			bl := false
			for k := 0; k < m; k++ {
				if sum[k] < x {
					bl = true
					break
				}
			}
			if bl == false {
				ans = intMin(ans, cost)
			}
		}
	}
	if ans == inf {
		fmt.Print(-1)
	} else {
		fmt.Print(ans)
	}
}
 
func refbit(i int, b int) int {
	return (i >> b) & 1
}
 
func intMin(a int, b int) int {
	if a < b {
		return a
	}
	return b
}

Measured memory_bytes: 2236
#include <stdio.h>
 
int main(){
    int N, K, i, num=1;
 
    scanf("%d %d", &N, &K);
 
    for(i=0; i<N; i++){
        if(num < K)
            num *= 2;
        else
            num += K;
    }
 
    printf("%d\n", num);
 
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define MAXN 100005
#define eps 1e-10
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
	res = 0;T f = 1;char c = getchar();
	while(c < '0' || c > '9') {
		if(c == '-') f = -1;
		c = getchar();
	}
	while(c >= '0' && c <= '9') {
		res = res * 10 + c - '0';
		c = getchar();
	}
	res *= f;
}
template<class T>
void out(T x) {
	if(x < 0) {x = -x;putchar('-');}
	if(x >= 10) {
		out(x / 10);
	}
	putchar('0' + x % 10);
}
vector<int> to[MAXN],pre[MAXN];
int N,M,deg[MAXN],p[MAXN],fa[MAXN];
queue<int> Q;
void Solve() {
	read(N);read(M);
	int u,v;
	for(int i = 1 ; i <= N - 1 + M ; ++i) {
		read(u);read(v);
		deg[v]++;
		to[u].pb(v);
		pre[v].pb(u);
	}
	for(int i = 1 ; i <= N ; ++i) {
		if(!deg[i]) Q.push(i);
	}
	while(!Q.empty()) {
		int u = Q.front();Q.pop();
		for(auto v : to[u]) {
			p[v] = max(p[v],p[u] + 1);
			if(!(--deg[v])) Q.push(v);
		}
		for(auto t : pre[u]) {
			if(p[t] + 1 == p[u]) fa[u] = t;
		}
	}
	for(int i = 1 ; i <= N ; ++i) {
		out(fa[i]);enter;
	}
}
int main() {
#ifdef ivorysi
	freopen("f1.in","r",stdin);
#endif
	Solve();
}


Measured memory_bytes: 12928
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <math.h>
#include <map>
#include <set>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define INF 1145141919
typedef long long int ll;
using namespace std;

int main(){

    int n;
    cin >> n;

    int N[3];
    N[0] = n/100;
    N[1] = (n-N[0]*100)/10;
    N[2] = (n-N[0]*100-N[1]*10);

    //cout << N[0] << N[1] << N[2];    

    if(N[0] >= N[1] and N[0] >= N[2]){
        cout << N[0] << N[0] << N[0];
    }else if(N[1] >= N[0] and N[1] >= N[2]){
        cout << N[0]+1 << N[0]+1 << N[0]+1;
    }else{
        cout << N[0]+1 << N[0]+1 << N[0]+1;
    }


    return 0;
}

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

using namespace std;

#define INF (1 << 30)
#define EPS 1e-10
#define MOD 1000000007

using ll = long long;

int main() {
    int n;
    string s;
    cin >> n >> s;
    for (auto &c : s) {
        c = 'A' + (c - 'A' + n) % 26;
    }
    cout << s << endl;

    return 0;
}

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


int main(void)
{
    int n;
    scanf("%d", &n);
    int x;
    scanf("%d", &x);
    int l[n];
    for(int i=0; i < n; i++){
        scanf("%d", &l[i]);
    }

    int cnt = 0;
    int now = 0;
    while(now <= x){
        if(cnt == n+1)
            break;
        else{
            now += l[cnt];
            cnt++;
        }
    }

    printf("%d\n", cnt);

    return 0;
} 



Measured memory_bytes: 128
import java.util.*;
import static java.lang.System.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(in);
int n = Integer.parseInt(sc.next());
int l = Integer.parseInt(sc.next());
String[] s=new String[n];
for(int i=0;i<n;i++){s[i]=sc.next();}
Arrays.sort(s);
for(String i:s){out.print(i);}
out.println();
}}


Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
struct Edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    Edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<int> >;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define mk make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;
typedef unsigned int uint;
#include <bits/stdc++.h>
int main(){
  int h,w;
  std::cin >> h>>w;
  vvector(a,char,h,w,'0');
  reprep(i,j,h,w)std::cin >> a[i][j];
  vvector(ans,int,h,w,0);
  reprep(i,j,h,w){
    int cou=0;
    if(a[i][j]=='#')continue;
    for (int ii = max(0,i-1); ii <=min(h-1,i+1) ; ii++) {
      for (int jj = max(0,j-1); jj <=min(w-1,j+1) ; jj++) {
        if(a[ii][jj]=='#')cou++;
      }
    }
    ans[i][j]=cou;
  }
  rep(i,h){
    rep(j,w){
      if(a[i][j]=='#')std::cout << '#' ;//<< std::endl;
      else std::cout << ans[i][j] ;//<< std::endl;
    }
    std::cout << std::endl;
  }
}

Measured memory_bytes: 256
n, k = map(int, input().split())
mod = 10**9+7

def cmb_table(n, mod):
    fac = [1] * (n+1)   # numerator
    finv = [1] * (n+1)   # denominator
    inv = [1] * (n+1)   # inverse of natural number
    inv[0] = 0
    for i in range(2, n+1):
        fac[i] = fac[i-1] * i % mod
        inv[i] = mod - inv[int(mod%i)] * (mod//i) % mod
        finv[i] = finv[i-1] * inv[i] % mod
    return fac, finv

def cmb(n, r, mod, fac, finv):
    if n < r:
        return 0
    if n < 0 or r < 0:
        return 0
    return int(fac[n] * finv[r] * finv[n-r] % mod)

a, b = cmb_table(n, mod)

for i in range(1, k+1):
    t1 = cmb(n-k+1, i, mod, a, b)
    t2 = cmb(k-1, i-1, mod, a, b)
    print(t1 * t2 % mod)

Measured memory_bytes: 3572
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

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

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

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

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

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

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

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

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

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    c: chars
  }

  puts!("{}\n", (c[0] as u8 + 1) as char);
}


Measured memory_bytes: 4352
#include <iostream>

using namespace std;

int main(){
  int n;
  while(cin >> n,n){
	int cnt2 = 0, cnt5 = 0;
	int tmp;
	while(n){
	  tmp = n;
	  while(1) {
		if(tmp % 2 == 0) {
		  cnt2++;
		  tmp /= 2;
		}
		else break;
	  }
	  tmp = n;
	  while(1){
		if(tmp % 5 == 0) {
		  cnt5++;
		  tmp /= 5;
		}
		else break;
	  }
	  n--;
	}
	cout << ((cnt2 < cnt5)? cnt2 : cnt5) << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int l[9],n,A,B,C;
int dfs(int i,int a,int b,int c)
{
        if(i==n)
        {
                if(a==0||b==0||c==0)
                        return 8001;
                return abs(a-A)+abs(b-B)+abs(c-C);
        }
        int r1=dfs(i+1,a+l[i+1],b,c)+10;
        int r2=dfs(i+1,a,b+l[i+1],c)+10;
        int r3=dfs(i+1,a,b,c+l[i+1])+10;
        int r4=dfs(i+1,a,b,c);
        return min(r1,min(r2,min(r3,r4)));
}
int main()
{
        int i;
        scanf("%d %d %d %d",&n,&A,&B,&C);
        for(i=1;i<=n;i++)
                scanf("%d",&l[i]);
        printf("%d",dfs(0,0,0,0)-30);
        return 0;
}


Measured memory_bytes: 256