akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    int N, M;
    cin >> N >> M;
    priority_queue<double> q;
    rep(i, N){ll a; cin >> a; q.push((double)a);}
    // priority queに突っ込んで最大のものを取り出し，1/2倍して再度入れる
    rep(i, M){double v = q.top(); q.pop(); q.push(v / 2);}
    ll ans = 0;
    while(!q.empty()){double v = q.top(); q.pop(); ans += (ll)v;}
    cout << ans << endl;
}

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


Measured memory_bytes: 1400
from collections import deque

n,q=map(int,input().split())
Queue=deque()
for _ in range(n):
  Queue.append(input())
#print(Queue)
ans=0
while len(Queue)>0:
  x=Queue.popleft()
  #print('---')
  #print(x)
  name,time=x.split()
  t=int(time)
  if t>q:
    ans+=q
    Queue.append(name+' '+str(t-q))
  else:
    ans+=t
    print(name,ans)



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

int main() {
  static constexpr int a[] = {
                              1, 1, 1, 2, 1, 2, 1, 5,
                              2, 2, 1, 5, 1, 2, 1, 14,
                              1, 5, 1, 5, 2, 2, 1, 15,
                              2, 2, 5, 4, 1, 4, 1, 51};
  int k;
  cin >> k;
  cout << a[k - 1] << "\n";
  return 0;
}


Measured memory_bytes: 888
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		
		// 計算
		int result = 0;
		if(n%1000 != 0) result = 1000 - n%1000;
		
		
		// 出力
		System.out.println(result);
	}
	
	public static class Scanner {
		private BufferedReader br; private StringTokenizer tok;
		public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}
		private void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}
		private boolean hasNext() { return tok != null && tok.hasMoreTokens();}
		public String next() throws IOException { getLine(); return tok.nextToken();}
		public int nextInt() throws IOException { return Integer.parseInt(next());}
		public long nextLong() throws IOException { return Long.parseLong(next());}
		public double nextDouble() throws IOException { return Double.parseDouble(next());}
	}
}



Measured memory_bytes: 25356
#include <iostream>
#include <algorithm>
#include <list>
#include <string>
#include <math.h>

using namespace std;


int value[50];
int n;
int k;

long long dopick(int pickup) {
	long long maxvalue = 0;

	long long valuebox[100];



	for (int left = 0; left <= pickup; left++) {
		int right = pickup - left;
		long long wkvalue = 0;

		for (int i = 0; i < left; i++) {
			valuebox[i] = value[i];
		}

		for (int i = 0; i < right; i++) {
			valuebox[left + i] = value[n - 1 - i];
		}

		sort(valuebox, valuebox + pickup);

		int cancel = min(k - pickup, pickup);
		long long wkans = 0;
		for (int i = 0; i < cancel; i++) {
			if (valuebox[i] < 0) {
				wkans -= valuebox[i];
			}
			else {
				break;
			}
		}

		for (int i = 0; i < pickup; i++) {
			wkans += valuebox[i];
		}

		if (wkans > maxvalue)maxvalue = wkans;

	}
	return maxvalue;

}





int main() {

	cin >> n >> k;

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

	long long ans = 0;
	//取れる最大回数は５０回まで。nが５０までだから。
	for (int pickup = 0; pickup <= min(n,min(k,50)); pickup++) {
		long long wkans;
		//pickup回取り出し。　(k-pickup)回まで戻し。
		wkans = dopick(pickup);

		if (wkans > ans)ans = wkans;

	}

	cout << ans << endl;

	system("pause");





	return 0;




}

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

template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

const int INF = 1e8;
typedef long long ll;
ll n;

int f(ll a, ll b){
    string s, t;
    s = to_string(a), t = to_string(b);
    return max(s.length(), t.length());
}

int main(){
    cin >> n;

    int ans = INF;
    
    for(ll i = 1; i*i <= n; i++){
        if(n % i == 0){
            ans = min(ans, f(i, n/i));
        }
    }

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

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};

void solve() {
  int h, w;
  cin >> h >> w;
  vstr s(h);
  cin >> s;
  using P = tuple<int, int, int>;
  queue<P> q;
  vector<vi32> dp(h, vi32(w, 1e9));
  rep(i, h) rep(j, w) {
    if (s[i][j] == '#') {
      dp[i][j] = 0;
      q.emplace(i, j, 0);
    }
  }
  while (q.size()) {
    int x, y, c;
    tie(x, y, c) = q.front();
    q.pop();
    if (dp[x][y] < c) {
      continue;
    }
    rep(i, 4) {
      int wx = x + dx[i];
      int wy = y + dy[i];
      if (wx < 0 || wx >= h || wy < 0 || wy >= w) continue;
      if (dp[wx][wy] <= c + 1) continue;
      dp[wx][wy] = c + 1;
      q.emplace(wx, wy, c + 1);
    }
  }
  int ans = 0;
  rep(i, h) rep(j, w) {
    amax(ans, dp[i][j]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 17424
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

a, b, c, d, e = map(int, input().split())

if b < d:
    m = (c-a)*60 + (d-b)
else:
    m = (c-a-1)*60 + (60 - (b-d))

print(m-e)

Measured memory_bytes: 9480
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var N = Sarray()[0];
            var K = Sarray()[0];
            var xi = Sarray();
            var sum = 0L;
            foreach(var x in xi)
                sum += Min(Abs(x), Abs(x - K));
            WriteLine(2 * sum);
        }


        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 28128
n = gets.to_i
s = gets.to_s
A= s.split(" ")

def bubbleSort( n , array)
   swap_cnt = 0
   flag = 1
   i = 0
   while flag == 1
	  flag = 0

	  ((i + 1)..(n - 1)).to_a.reverse_each { |j|
   	 if array[j].to_i < array[j - 1].to_i
			# swap
			tmp = array[j - 1]
			array[j - 1] = array[j]
			array[j] = tmp

			swap_cnt += 1
			flag  = 1
		 end
	  }
	  i += 1
   end

   puts array.join(' ')
   puts swap_cnt
end

bubbleSort(n , A)



Measured memory_bytes: 6908
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

int main(){
    ll n;
    cin >> n;
    double  ans = 0.0;
    rep(i, n){
        double a;
        cin >> a;
        ans += 1.0/a;
    }
    cout << 1.0/ans << endl;
}

Measured memory_bytes: 256
T = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a = T[0]*A[0] + T[1]*A[1]
b = T[0]*B[0] + T[1]*B[1]

if(a==b):
    print("infinity")
    exit()

if(a<b):
    A[0], B[0] = B[0], A[0]
    A[1], B[1] = B[1], A[1]


a = T[0]*A[0] # tak
b = T[0]*B[0] # aok

if a>b:
    print(0)
    exit()

left = 1
right = 10**20

while left+1!=right:
    center = (left+right)//2
    tak = a + (center-1) * (A[0]*T[0]+A[1]*T[1])
    aok = b + (center-1) * (B[0]*T[0]+B[1]*T[1])

    if(tak==aok):
        ans = (center-1)*2
        print(ans)
        exit()
    elif aok<tak:
        right = center
    else:
        left = center

ans = (left-1)*2 + 1
print(ans)

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

using namespace std;

int dfs(map<int, vector<int>> &adList, int node, vector<pair<int, int>> &dp)
{
    // cout << node << " " << adList[node].size() << endl;
    if (dp[node].first)
    {
        return dp[node].second;
    }
    if (adList[node].size() == 0)
    {
        return 0;
    }

    int maxL = INT_MIN;
    for (int i = 0; i < adList[node].size(); i++)
    {
        int length = 1 + dfs(adList, adList[node][i], dp);
        // cout << node << " " << adList[node][i] << " " << length << endl;
        maxL = max(maxL, length);
    }

    dp[node] = make_pair(true, maxL);
    return maxL;
}

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

    int n, m;
    cin >> n >> m;

    vector<int> x(m);
    vector<int> y(m);

    map<int, vector<int>> adList;
    vector<pair<int, int>> dp(n + 1);

    for (int i = 0; i < m; i++)
    {
        cin >> x[i] >> y[i];
        adList[x[i]].push_back(y[i]);
    }

    int result = INT_MIN;
    for (int i = 1; i <= n; i++)
    {
        if (!dp[i].first)
        {
            result = max(result, dfs(adList, i, dp));
        }
    }

    cout << result << endl;
    return 0;
}

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

int main()
{
	int caseNum;
	cin >> caseNum;
	while( caseNum-- ){
		int lx, ly, w, h;
		cin >> lx >> ly >> w >> h;
		int rx = lx + w;
		int ry = ly + h;
		int n, cnt = 0;
		
		cin >> n;
		while( n-- ){
			int x, y;
			cin >> x >> y;
			if( lx <= x && x <= rx && ly <= y && y <= ry )
				cnt++;
		}
		cout << cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;

public class Main {

	public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		StringBuilder builder = new StringBuilder();
		String[] line = reader.readLine().split(" ");
		int n = Integer.parseInt(line[0]);
		int q = Integer.parseInt(line[1]);
		List<String[]> queue = new LinkedList<String[]>();
		for (int i = 0; i < n; i++) {
			queue.add(reader.readLine().split(" "));
		}
		String[] work = new String[2];
		int elapse = 0;
		while (queue.size()!=0) {
			work = queue.remove(0);
			int time = Integer.parseInt(work[1]);
			if (time <= q) {
				elapse += time;
				builder.append(work[0]).append(" ").append(elapse).append("\n");
			} else {
				time -= q;
				elapse += q;
				work[1] = String.valueOf(time);
				queue.add(work);
			}
		/*	queue.forEach(a->System.out.println(Arrays.toString(a)));
			System.out.println(Arrays.toString(work) + "  ->  work    " + elapse);
			System.out.println();*/

		}
		System.out.print(builder);
	}
}

Measured memory_bytes: 64588
#include <iostream>
#include <queue>
using namespace std;
int main(void){
    // Your code here!
    int a,tf;
    queue<int> h;
    for(int i=1;i<=28;i++){
        cin>>a;
        h.push(a);
    }
    for(int i=1;i<=30;i++){
        tf=0;
        for(int i2=1;i2<=28;i2++){
            if(h.empty())break;
            a=h.front();
            h.pop();
            if(i==a){
                tf=1;
                break;
            }
            else h.push(a);
        }
        if(tf==0)cout<<i<<endl;
    }
}

Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  string s;
  cin >> n >> s;
  int l,r,ce=0;
  for(int i=0;i<n;i++){
    if(s[i]=='E'){
      ce++;
    }
  }
  int cnt=0,lw,re,ans=n;
  for(int i=0;i<n;i++){
    if(s[i]=='E'){
      lw=i-cnt;
      cnt++;
      re=ce-cnt;
    }
    if(s[i]=='W'){
      lw=i-cnt;
      re=ce-cnt;
    }
    ans=min(ans,lw+re);
  }
  cout << ans << endl;
}

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

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  if (N * A == B)
    cout << B << endl;
  else if (N * A > B)
    cout << B << endl;
  else if (N * A < B)
    cout << N*A << endl;
}

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

const int INF = 1<<29;

struct state{
    vector<int> arr;
    int cost;
    state(){}
    ~state(){}
    state(vector<int> a, int c){
        arr.resize(a.size());
        for(int i = 0; i < a.size(); i++){
            arr[i] = a[i];
        }
        cost = c;
    }
};

int N;
int c[8][8];
map<vector<int>, int> ord;
int d[50000];

void set_ord(int n){
    vector<int> vec(n);
    for(int i = 0; i < n; i++){
        vec[i] = i;
    }
    int m = 0;
    do{
        ord[vec] = m++;
    }while(next_permutation(vec.begin(), vec.end()));
}

int main(){
    scanf("%d", &N);
    set_ord(N);
    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){ scanf("%d", &c[i][j]); }
    }
    vector<int> init(N);
    for(int i = 0; i < N; i++){ init[i] = i; }
    fill(d, d+50000, INF);
    queue<state> que;
    que.push(state(init, 0));
    d[ord[init]] = 0;
    while(!que.empty()){
        state s = que.front(); que.pop();
        vector<int>& v = s.arr;
        int ind = ord[v];
        if(s.cost > d[ind]) continue;
        for(int i = 0; i < N; i++){
            for(int j = i+1; j < N; j++){
                swap(v[i], v[j]);
                if(d[ind] + c[v[i]][v[j]] < d[ord[v]]){
                    d[ord[v]] = d[ind] + c[v[i]][v[j]];
                    que.push(state(v, d[ord[v]]));
                }
                swap(v[i], v[j]);
            }
        }
    }
    int max_v = 0;
    for(int i = 0; i < 50000; i++){
        if(d[i] == INF) continue;
        max_v = max(max_v, d[i]);
    }
    printf("%d\n", max_v);
    return 0;
}

Measured memory_bytes: 11824
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef int ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vpll> vvpll;
typedef unordered_map<ll, ll> um;
typedef unordered_set<ll> us;

#define fastio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ts ll t; in(t) while (t--) solve();
#define ks ll t; in(t) FOR(i, 1, t+1) out("Case #" << i << ": " << solve());
#define endl '\n'
#define ln cout << endl;
#define in(x) cin >> x;
#define out(x) cout << x << endl;
#define flush cout << flush;
#define reset(a, b) memset(a, b, sizeof(a));
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define FORI(i, a, b, c) for (ll i = a; i < b; i += c)
#define FORD(i, a, b) for (ll i = a; i > b; --i)
#define FOREACH(it, v, r) for (auto it = v.begin() + r; it != v.end(); it++)
#define FORALL(it, v) for (auto it : v)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define vin(v, x) vll v(x); FOR(i, 0, x) in(v[i])
#define all(v) v.begin(), v.end()
#define allr(v, r) v.begin(), v.begin() + r
#define showv(v) FORALL(it, v) cout << it << ' '; ln
#define printv(v) FORALL(it, v) out(it)
#define show2d(v) FORALL(it, v) { FORALL(j, it) cout << j << ' '; ln}
#define showm(v) FORALL(it, v) cout << it.F << ": " << it.S << ' '; ln
#define sortv(v) sort(all(v));
#define revv(v) reverse(all(v));
#define maxv(v) *max_element(all(v))
#define minv(v) *min_element(all(v))
#define gcd __gcd
#define checkbit(n, i) (n >> i) & 1               // check ith bit
#define bitcount __builtin_popcount               // count set bits
#define firstbitindex __builtin_ctz               // count trailing zeros
#define lastbitindex __builtin_clz                // count leading zeros
#define bitparity __builtin_parity                // check set bits are even or odd
#define findv(v, x) (find(all(v), x) != v.end())
#define findsm(u, x) (u.find(x) != u.end())
#define findstr(s, x) (s.find(x) != string::npos)
#define sz(a) a.size()
#define precise(x) cout << fixed << setprecision(x);

const ll MAXN = 1e7 + 1, MOD = 998244353, SIZE = 2e7;//, INF = 0x7f7f7f7f7f7f7f7f;
const double EPS = 1e-9, PI = acos(-1);
const int INFi = 0x7f7f7f7f;

//<<------Declare Variables Here----->>//
ll n, x, y, f, c;
vll spf(MAXN, 2);
long long ans, z;

//<<-----Implement Functions Here---->>//
void sieve()
{
	FORI(i, 3, MAXN, 2)
        spf[i] = i;
    FORI(i, 3, 3162, 2)
        if (spf[i] == i)
            FORI(j, i * i, MAXN, i)
                if (spf[j] == j)
                    spf[j] = i;
}

void solve()
{
	in(n)
	ans = 1;
	FOR(i, 2, n + 1)
	{
		x = i, f = 1, c = 1, z = 1;
		while (x > 1)
			y = spf[x], x /= y, y > f ? z *= c, c = 2, f = y : ++c;
		ans += i * z * c;
	}
	out(ans)
}

//<<----------Start of Main---------->>//
int main()
{
	fastio
    //ts
	sieve();
    solve();
    return 0;
}

Measured memory_bytes: 42152
from math import ceil

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

d_t = T[0]
p = 1
ans = 1

for t in T[1:]:
    if p < C and t-d_t <= K:
        p += 1
    else:
        ans += 1
        d_t = t
        p = 1

print(ans)

Measured memory_bytes: 8280
#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N,a,b,c;
vector<int> L;
void input(){
    fast_io();
    cin >> N >> a >> b >> c;
    for (int i = 0; i < N; i++)
    {
        int l; cin >> l;
        L.push_back(l);
    }
}

int solve(){
    // aのために使う棒をきめる。
    int ans = (int)1e9;
    for (int bita = 1; bita < (1<<N); bita++)
    {
        int unuse = ((1<<N)-1)&~bita;
        for (int bitb = unuse; bitb > 0; bitb=(bitb-1)&unuse)
        {
            int unuseC = unuse&~bitb;
            for (int bitc = unuseC; bitc > 0; bitc=(bitc-1)&unuseC)
            {
                int mp = 0;
                mp += 10*(__builtin_popcount(bita)-1);
                mp += 10*(__builtin_popcount(bitb)-1);
                mp += 10*(__builtin_popcount(bitc)-1);
                int la = 0;
                int lb = 0;
                int lc = 0;
                for (int i = 0; i < N; i++)
                {
                    if((bita>>i)&1) la += L[i];
                    if((bitb>>i)&1) lb += L[i];
                    if((bitc>>i)&1) lc += L[i];
                }
                mp += abs(a-la);
                mp += abs(b-lb);
                mp += abs(c-lc);
                DBG(bitset<10>(bita))
                DBG(bitset<10>(bitb))
                DBG(bitset<10>(bitc))
                ans = min(ans,mp);
            }
        }
    }
    cout << ans << endl;

    return 0;
}   

int main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

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

int e;

int main(){
	while(cin>>e&&e){
		int ans=9999999;
		rep(i,101)rep(j,1001){
			if(e-i*i*i-j*j>=0)ans=min(ans,e-i*i*i-j*j+i+j);
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 864
N, K = map(int, input().split())

if ((N-2) * (N-1))//2 < K:
    print(-1)
else:
    M = N-1
    node = []
    for i in range(N-1):
        node.append([1,i+2])
    count1 = 2
    count2 = 3
    for j in range(((N-2) * (N-1))//2 - K):
        node.append([count1,count2])
        count2 += 1
        if count2 == N+1:
            count1 += 1
            count2 = count1+1
        M += 1
    print(M)
    for i in range(M):
        print("{} {}".format(node[i][0],node[i][1]))

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

int main() {
  int K;
  cin >> K;
  string S;
  cin >> S;
  if (S.size() <= K)
    cout << S << endl;
  else {
    cout << S.substr(0, K) << "..." << endl;
  }
}

Measured memory_bytes: 3656
#include <iostream>

using namespace std;

int main(int argc, char const *argv[]) {
  int x1, y1, x2, y2, x3, y3, x4, y4;
  cin >> x1 >> y1 >> x2 >> y2;
  x4 = -(y2-y1)+x1;
  y4 = x2-x1+y1;
  x3 = (y1-y2)+x2;
  y3 = -(x1-x2)+y2;
  cout << x3 << ' ' << y3 << ' ' << x4 << ' ' << y4 << endl;

  return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
N = int(input())
d = 10000
index = 0
for i in range(1,10) :
    k = i * 100 + i * 10 + i
    if k < N :
        continue
    else :
        de = abs(N - k)
        if d > de :
            d = de
            index = k
print(index)

Measured memory_bytes: 3060
H, W = gets.split(' ').map(&:to_i)

arr = H.times.map do
  gets.split('')
end

mes = 'Yes'

for i in 0..(H - 1)
  for j in 0..(W - 1)
    cond = [
      arr.dig(i, j - 1) == '#',
      arr.dig(i, j + 1) == '#',
      arr.dig(i - 1, j) == '#',
      arr.dig(i + 1, j) == '#',
    ].any?

    if arr[i][j] == '#' && !cond
      mes = 'No'
    end
  end
end

puts mes

Measured memory_bytes: 2172
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var N = int.Parse(Console.ReadLine());

            var answer = "APPROVED";
            foreach (var item in Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToArray())
            {
                if (item % 2 == 0)
                {
                    if (item % 3 != 0 && item % 5 != 0)
                    {
                        answer = "DENIED";
                        break;
                    }
                }
            }

            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using i64 = long long;

const double pi = std::acos(-1);

int sgn(double a) { return a < -1e-8 ? -1 : a > 1e-8 ? 1 : 0; }

struct Point {
    double x, y;

    Point(double x, double y) : x(x), y(y) {}

    double abs() { return std::hypot(x, y); }
    double arg() { return std::atan2(y, x); }
    
    double dot(const Point &p) { return x * p.x + y * p.y; }
    double det(const Point &p) { return x * p.y - y * p.x; }
};

Point operator+(const Point &lhs, const Point &rhs) {
    return { lhs.x + rhs.x, lhs.y + rhs.y };
}

Point operator-(const Point &lhs, const Point &rhs) {
    return { lhs.x - rhs.x, lhs.y - rhs.y };
}

Point operator-(const Point &p) {
    return { -p.x, -p.y };
}

Point operator*(const Point &lhs, const Point &rhs) {
    return { lhs.x * rhs.x - lhs.y * rhs.y, lhs.x * rhs.y + lhs.y * rhs.x };
}

Point operator*(const Point &lhs, double k) {
    return { lhs.x * k, lhs.y * k };
}

Point operator/(const Point &lhs, double k) {
    return { lhs.x / k, lhs.y / k };
}

bool operator<(const Point &lhs, const Point &rhs) {
    auto s = sgn(lhs.x - rhs.x);
    return s ? s < 0 : sgn(lhs.y - rhs.y) < 0;
}

int iSP(const Point &a, const Point &b, const Point &c) {
    auto sd = sgn((b - a).det(c - a));
    return sd ? sd
        : sgn((b - a).dot(c - a)) < 0 ? -2
        : sgn((a - b).dot(c - b)) < 0 ? 2
        : 0;
}

int main() {
    int n;
    std::cin >> n;
    std::vector<std::pair<Point, int>> v;
    for (int i = 0; i < n; i++) {
        double x, y;
        std::cin >> x >> y;
        v.emplace_back(Point(x, y), i);
    }

    std::sort(v.begin(), v.end());

    std::deque<std::pair<Point, int>> ub, lb;
    for (const auto &p : v) {
        while (true) {
            int s = ub.size();
            if (s < 2) break;
            if (sgn((ub[s - 1].first - ub[s - 2].first).det(p.first - ub[s - 2].first)) > 0) break;
            ub.pop_back();
        }
        ub.push_back(p);
    }

    for (const auto &p : v) {
        while (true) {
            int s = lb.size();
            if (s < 2 || sgn((lb[s - 1].first - lb[s - 2].first).det(p.first - lb[s - 2].first)) < 0) break;
            lb.pop_back();
        }
        lb.push_back(p);
    }

    std::deque<std::pair<Point, int>> convexHull(ub.begin(), ub.end());
    convexHull.insert(convexHull.end(), lb.rbegin() + 1, lb.rend() - 1);

    std::vector<double> ret(n);
    for (int i = 0, s = convexHull.size(); i < s; i++) {
        int j = (i + 1) % s, k = (i + s - 1) % s;
        const auto p0 = convexHull[k].first, p1 = convexHull[i].first, p2 = convexHull[j].first;
        auto ang = (p0 - p1).arg() - (p2 - p1).arg();
        if (sgn(ang) < 0) ang += pi * 2;
        auto prob = (pi - ang) / (pi * 2);
        ret[convexHull[i].second] += prob;
    }

    std::cout << std::setprecision(10);

    for (auto p : ret) std::cout << p << std::endl;

    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

int main()
{
	int N;
	std::vector<int> P;

	std::cin >> N;
	P.resize(N);
	for (auto& p : P) {
		std::cin >> p;
		--p;
	}

	int m = 0;
	for (int i = 0; i < P.size(); ++i) {
		if (P[i] != i)
			++m;
	}

	if (m == 0 || m == 2) {
		std::cout << "YES\n";
	} else {
		std::cout << "NO\n";
	}
}


Measured memory_bytes: 256
# -*- coding;utf-8 -*-

def sieve(n):
    p = 0
    primes = []
    is_prime = [True]*(n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, n+1):
        if(is_prime[i]):
            primes.append(i)
            p += 1
            for j in range(i*2,n+1,i):#iごとに増える
                is_prime[j] = False
    return p

if(__name__ == "__main__"):
    while(True):
        try:
            n = int(input())
        except:
            break
        print(sieve(n))
        

Measured memory_bytes: 19020
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cmath>
#include <iomanip>
#include <queue>
#include <map>
#include <set>
#include <random>
#include <sstream>
#include <stack>
#include <deque>

using namespace std;

#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;

int main() {
    // cin >> N >> M;
    int n[3];
    rep(i,3) cin >> n[i];
    sort(n, n+3);
    int K;
    cin >> K;
    rep(i,K) n[2] *= 2;
    cout << n[0] + n[1] + n[2] << endl;
    
    // cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

fn read_n<T: FromStr>(n: usize) -> Vec<T> {
  read_n_logic::<T>(n, vec![])
}

fn read_n_logic<T: FromStr>(n: usize, mut a: Vec<T>) -> Vec<T> {
  match n {
    0 => a,
    _ => {
      a.push(read::<T>());
      read_n_logic(n - 1, a)
    }
  }
}

fn main() {
  let n = read::<usize>();
  let mut a = read_n::<usize>(n + 1);
  let mut b = read_n::<usize>(n);
  let mut answer = 0;

  a.reverse();
  b.reverse();

  for i in 0..b.len() {
    for add in 0..2 {
      if b[i] > a[i + add] {
        answer += a[i + add];
        b[i] -= a[i + add];
        a[i + add] = 0;
      } else {
        answer += b[i];
        a[i + add] -= b[i];
        b[i] = 0;
      }
    }
  }

  println!("{}", answer);
}


Measured memory_bytes: 15740
N , A , B , C , D =map(int,input().split())
x = N // A
y = N // C
if N % A == 0:
    a = x * B
else:
    a = B * (x + 1)

if N % C == 0:
    c = y * D
else:
    c = D * (y + 1)
    
if a < c:
    print(a)
else:
    print(c)


Measured memory_bytes: 5596
#include <iostream>
using namespace std;
int main()
{
    int a, b, c, k, ans = 0;
    cin >> a >> b >> c >> k;
    if(a >= k) {
        ans += k;
        cout << ans << endl;
        return 0;
    }
    ans += a;
    k -= a;
    if(b >= k) {
        cout << ans << endl;
        return 0;
    }
    k -= b;
    ans -= k;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3512
/**                                                     **\
 *    created by:   Divianshu Bansal                     *
 *    e-mail id:    god_coder@icloud.com                 *
*                                                        */

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>


using namespace std;
using namespace __gnu_pbds;


typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>new_data_set;
#define MOD 1000000007
#define int long long
#define BIG 998244353
#define pf push_front
#define print(x) for(auto el: x) cout<<el<<" ";cout<<endl
#define bits(x) __builtin_popcount(x)
#define ff first
#define se second
#define pb push_back
#define pii pair<int,int>
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PSET(x,y) fixed<<setprecision(y)<<x
#define mp make_pair
#define pi 3.141592653589


int power(int x,int y){
    int r=1,z=x;
    while(y){
        if(y & 1)r*=z;
        z*=z;y=y>>1;}
    return r;}
int powerm(int x,int y,int p){
    int r=1;
    while(y){
        if(y & 1)r=(r*x)%p;
        y=y>>1;
        x=(x*x)%p;}
    return r%p;}
int modinv(int x,int m){
    return powerm(x,m-2,m);}
int logarithm(int a,int b){
    int x=0;
    while(a>1){
        x++;
        a/=b;}
    return x;}
int max3(int a,int b,int c){
    return max(a,max(b,c));
}
int min3(int a,int b,int c){
    return min(a,min(b,c));
}
int32_t main(){
    fast;
    int n,k;    cin>>n>>k;
    string s;
    cin>>s;
    int tot=0;
    int i=0;
    while(i<n){
        char x = s[i];
        int val=0;
        while(x==s[i] && i<n){
            ++i;
            ++val;
        }
        tot+=val-1;
    }
    cout<<min(n-1,tot+k+k);
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int n,a[233333],maxx[233333];
int main()
{
	ios_base::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++)maxx[i]=max(maxx[i-1],a[i]);
	int l=0,ans=0;
	for(int i=n;i>=1;i--)
	{
		while(a[l]<n-i+1)l++;
//		cerr<<l<<' '<<i<<endl;
		if(maxx[i-1]<=n-i+1)
		{
			if((a[i]-(n-i))%2==0||(i-l+1)%2==0)ans=1;
			break;
		}
	}
	if(ans)cout<<"First"<<endl;
	else cout<<"Second"<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define mp(a, b) make_pair((a), (b))

using namespace std;

int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, -1, 0, 1 };

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

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

    if (A + B < C) {
        cout << (A + B + 1) + B << endl;
    } else {
        cout << B + C << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define RNG(i,from,to) for(ll i=(from); i<(ll)(to); i++)
#define gcd(i,j) __gcd((i), (j))
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vecll;
template<typename S, typename T> string to_string(pair<S, T> p) { return "("+to_string(p.first)+","+to_string(p.second)+")"; }
template<typename T> void println(T e){ cout << to_string(e) << endl; }
template<typename T> void println(const vector<T>& v){ cout << "[";for(const auto& e : v){ cout << to_string(e) << ","; }cout << "]";cout << endl; }
template<typename T> void println(const vector<vector<T>>& vv){ for(const auto& v : vv){ println(v); } }
template<typename Iter> void println(Iter first, Iter last){ for(auto it=first; it != last; it++){ cout << *it << " "; }; cout << endl; }
template<typename T> T mod_pow(T x, T n, const T &p) { T ret = 1; while(n > 0) { if(n & 1) (ret *= x) %= p; (x *= x) %= p; n >>= 1; } return ret; }
template<typename T> T mod_inv(T x, const T &p) { return mod_pow(x, p-2, p); }
const ll DVSR = 1e9+7;

int main(int argc, char const *argv[])
{
  ll N, res = 0; cin >> N;
  RNG(i, 1, N+1) {
    ll n = N/i;
    res += i*n*(n+1)/2;
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 3632
#include "bits/stdc++.h"
// Custom Header {{{
#define ALL(x)      x.begin(), x.end()
#define rep(i,n)    for (i64 i = 0; i < (n); ++i)
#define reps(i,s,t) for (i64 i = (s); i <= (t); ++i)
using namespace std;
using i64 = long long;
using pii = pair<i64, i64>;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? (a=b,1) : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? (a=b,1) : 0;}
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
// }}}

signed main()
{
    // ios::sync_with_stdio(false); cin.tie(nullptr);

    int N;
    cin >> N;

    int cnt = 0;

    reps(i, 1, N) {
        if (to_string(i).length() & 1) ++cnt;
    }

    cout << cnt << endl;

    return 0;
}



Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2")
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<vector>
#include<set>
#include<unordered_map>
#include<assert.h>
#include<time.h>
#include<stdlib.h>
#include<random>
#include<queue>
using namespace std;
using lld = long long int;
using pll = pair<lld, lld>;
using lf = double;
using pff = pair<lf, lf>;
using pif = pair<int, lf>;
using pii = pair<int, int>;
using pli = pair<lld, int>;
using pil = pair<int, lld>;
using piii = pair<int, pii>;
#define M 1000000007
int n;
pll a[200009];
int main() {
	int i, j, k, l;
	int t = 1, tv = 0;
	//scanf("%d", &t);
	while (t--) {
		scanf("%d", &n);
		for (i = 0; i < n; i++) {
			lld x, y;
			scanf("%lld %lld", &x, &y);
			a[i].first = x + y;
			a[i].second = x - y;
		}
		lld res;
		sort(a, a + n, [](pll p, pll q) {if (p.first - q.first)return p.first < q.first; return p.second < q.second; });
		res = a[n - 1].first - a[0].first;
		sort(a, a + n, [](pll p, pll q) {if (p.second - q.second)return p.second < q.second; return p.first < q.first; });
		res = max(res, a[n - 1].second - a[0].second);
		printf("%lld\n", res);

	}
	return 0;
}

Measured memory_bytes: 4864
a,b=map(int,input().split())
c=0
for i in range(40):
    j=2**i
    x,y=-(-a//(j*2))*j*2,b//(j*2)*j*2
    c+=((y-x)//2+min(j,x-a)+max(0,b-y-j+1))%2*j
print(c)

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

int main()
{
  int n, d;

  cin >> n;
  cin >> d;

  int i = 1;
  while(true){
    if(i * (2*d+1) >= n)
      break;
    i++;
  }
  cout << i << endl;
  return 0;
}


Measured memory_bytes: 3624
#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(16);

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

    const long double PI = acos(-1.0L);
    auto calc = [&](int r, int t, int P) -> pair<long double, long double> {
        long double a = t * 2.0L * PI / P;
        long double x = r * sin(a);
        long double y = r * cos(a);

        return {x, y};
    };

    auto distance = [&](pair<long double, long double>& A, pair<long double, long double>& B) {
        auto x = A.first - B.first;
        auto y = A.second - B.second;

        return hypot(x, y);
    };

    auto A = calc(a, h * 60 + m, 12 * 60);
    auto B = calc(b, m, 60);

    auto res = distance(A, B);

    cout << res << '\n';

    return 0;
}

Measured memory_bytes: 4200
#include <bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
#define PI acos(-1.0)

typedef long long ll;
const int maxn=2e5+5;

int vis1[maxn],vis2[maxn];

int main()
{
    int n,m;
    cin >> n >> m;
    int cnt=0;
    int flag=1;
    for(int i=0;i<m;i++)
    {
        int a,b;
        cin >> a >> b;
        if(a==1)
            vis1[b]=1;
        if(b==1)
            vis1[a]=1;
        if(a==n)
            vis2[b]=1;
        if(b==n)
            vis2[a]=1;
    }
    for(int i=1;i<=n;i++)
        if(vis1[i]&&vis2[i])
        {
            cout << "POSSIBLE" << endl;
            return 0;
        }
    cout << "IMPOSSIBLE" << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int cnt[26];
string s;
int main() {
    cin >> s;
    for (auto&& c : s) cnt[c - 'a']++;
    string ans = "Yes";
    rep(i, 26) if (cnt[i] % 2 != 0) ans = "No";
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
ll n;
int main(){
    map<string,int> msi;
    cin>>n;
    for(int i = 0;i < n; i++){
        string s;
        cin>>s;
        msi[s]++;
    }
    int max=0;
    for(auto u : msi){
        if(max<=u.second) max=u.second;        
    }
    for(auto u : msi){
        if(u.second==max) cout<<u.first<<endl;
    }
    return 0;
}

Measured memory_bytes: 25216
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Math;
using Debug = System.Diagnostics.Debug;
using LayoutKind = System.Runtime.InteropServices.LayoutKind;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;


static class P
{
    static void Main()
    {
        var nx = Console.ReadLine().Split().Select(int.Parse).ToArray();
        long X = nx[1];
        //ちゅーごくじょーよてーり
        //オーダーによってSの終端が決定する
        //まず影響するのは降順のみなことは自明に分かって、
        //で、「次」を選ぶことができる順番は
        //「確率」「期待値」
        //aを取り除いた場合、その後に適用できるのはそれ以前全て。

        List<int> s = Console.ReadLine().Split().Select(int.Parse).OrderByDescending(x => x).ToList();
        ModInt[] dp = new ModInt[X + 1];
        dp[X] = 1;
        long remain = s.Count - 1;
        foreach (var mod in s)
        {
            ModInt[] newDP = new ModInt[X + 1];

            for (int i = 0; i < dp.Length; i++)
            {
                newDP[i % mod] += dp[i];
                newDP[i] += dp[i] * remain;
            }
            remain--;
            dp = newDP;
        }
        ModInt res = 0;
        for (int i = 0; i < dp.Length; i++)
        {
            res += dp[i] * i;
        }
        Console.WriteLine(res);
    }
}

struct ModInt
{
    const int MOD = 1000000007;
    long Data;
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public ModInt(long data) { if ((Data = data % MOD) < 0) Data += MOD; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static implicit operator long(ModInt modInt) => modInt.Data;
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static implicit operator ModInt(long val) => new ModInt(val);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator +(ModInt a, ModInt b)
    {
        long res = a.Data + b.Data;
        return new ModInt() { Data = res >= MOD ? res - MOD : res };
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator +(ModInt a, long b) => new ModInt(a.Data + b);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator -(ModInt a, ModInt b)
    {
        long res = a.Data - b.Data;
        return new ModInt() { Data = res < 0 ? res + MOD : res };
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator -(ModInt a, long b) => new ModInt(a.Data - b);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator /(ModInt a, ModInt b) => a * Power(b, MOD - 2);

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    static ModInt Power(ModInt n, long m)
    {
        ModInt res = 1;
        while (m > 0)
        {
            if ((m & 1) == 1) res *= n;
            n *= n;
            m >>= 1;
        }
        return res;
    }
}


Measured memory_bytes: 32152
import java.util.Scanner;

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

      a = s.nextInt();
      b = s.nextInt();
      c = s.nextInt();

      if(a < b){
        if(b < c){
          System.out.println("Yes");
        }else{
          System.out.println("No");
        }
      }else{
          System.out.println("No");
      }
  }
}

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

using namespace std;

const int md = 998244353;

inline void add(int &a, int b) {
  a += b;
  if (a >= md) a -= md;
}

inline int mul(int a, int b) {
  return (int) ((long long) a * b % md);
}

map <string, int> mp;

int solve(string s) {
  int n = (int) s.length();
  if (n == 0) {
    return 1;
  }
  if (n == 1) {
    return (s == "1" ? 2 : 1);
  }
  if (mp.find(s) != mp.end()) {
    return mp[s];
  }
  int &ans = mp[s];
  ans = mul(solve(s.substr(0, 1)), solve(s.substr(1)));
  for (int len = 1; 2 * len <= n; len++) {
    string w = s.substr(0, len);
    for (int cnt = 2; cnt * len <= n; cnt++) {
      for (int i = len * (cnt - 1); i < len * cnt; i++) {
        if (s[i] == '0') {
          w[i % len] = '0';
        }
      }
      add(ans, mul(solve(w), solve(s.substr(len * cnt))));
    }
  }
  return ans;
}

int main() {
  string s;
  cin >> s;
  cout << solve(s) << endl;
  return 0;
}


Measured memory_bytes: 5632