akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; ll a, b, c, d;
  cin >> n >> a >> b >> c >> d;
  bool ok = false;
  for(int m=0; m<=n-1; m++) {
    ll mn = -d*m+c*(n-1-m);
    ll mx = -c*m+d*(n-1-m);
    if(mn <= b-a && b-a <= mx) ok = true;
  }
  cout << (ok ? "YES" : "NO") << "\n";
  return 0;
}


Measured memory_bytes: 3656
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric> 
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    string s, t;
    while(cin >> s)
    {
        if(s == ".") break;
        cin >> t;
        if(s == t)
        {
            cout << "IDENTICAL" << endl;
            continue;
        }
        bool flag = true;
        vector<string> v, w;
        int left, right;
        while((left = s.find('"')) != -1)
        {
            right = s.find('"', left + 1);
            v.push_back(s.substr(left, right - left + 1));
            s.replace(left, right - left + 1, "#");
        }
        while((left = t.find('"')) != -1)
        {
            right = t.find('"', left + 1);
            w.push_back(t.substr(left, right - left + 1));
            t.replace(left, right - left + 1, "#");
        }
        int cnt = 0;
        for(int i = 0; i < min(v.size(), w.size()); i++) if(v[i] != w[i]) cnt++;
        if(cnt < 2 && s == t) cout << "CLOSE" << endl;
        else cout << "DIFFERENT" << endl;
    }
	return 0;
}



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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	int count = 0;
	int a[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		count += a[i];
	}
	int count2 = 0;
	int ans = 1e9;
	for (int i = 0; i < n; i++) {
		count2 += a[i];
		count -= a[i];
		ans = min(ans, abs(count - count2));
	}
	cout << ans << '\n';
	return 0;
}


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

int main() {
	int W,a,b;
  	cin >> W >> a >> b;
  	
  	if(b + W < a) {
    	cout << a - (b + W) << endl;
    }else if(a + W < b) {
    	cout << b - (a + W) << endl;
    }else {
    	cout << 0 << endl;
    }
  	
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
#define int long long
using namespace std;

signed main() {
    int N, M;
    cin >> N >> M;
    vector<pair<int, int>> A(N);
    rep(i, N) {
        int a, b;
        cin >> a >> b;
        A[i] = make_pair(a, b);
    }
    
    sort(A.begin(), A.end());
    int sum = 0;
    int bought = 0;
    rep(i, N) {
        int buy = min(M - bought, A[i].second);
        sum += A[i].first * buy;
        bought += buy;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 1792
N,M=map(int,input().split())
Look=[]
for i in range(M):
  S=list(map(int,input().split()))
  Look.append(S[1:])
ans=0

P=list(map(int,input().split()))
for i in range(2**N):
  i=format(i,'b').rjust(N,'0')
  on=[]
  for j in range(N):
    if i[j]=='1':
      on.append(j+1)


  count2=0
    
  for k in range(M):
    count=0
    for l in Look[k]:
      if l in on:
        count+=1
    if count%2==P[k]:
       count2+=1

  if count2==M:
    ans+=1
print(ans)
  

Measured memory_bytes: 74340
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <cmath>
using namespace std;
typedef long long ll;
//typedef pair<ll, ll> P;

#define rep(i, m) for(ll i=0;i<(m);i++)
#define rep1(i, m) for(ll i=1;i<=(m);i++)
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

string S, T;

int main() {
   cin >> S >> T;
   for (int i=S.size()-1;i>=0;i--) {
      int reable = 0;
      rep(j, T.size()) {
         if (i+j >= S.size()) {
            reable = 1; break;
         }
         if (S[i+j] != T[j] && S[i+j] != '?') {
            reable = 1;
            break;
         }
      }
      if (reable == 0) {
         rep(j, T.size()) {
            if (S[i+j] == '?') {
               S[i+j] = T[j];
            }
         }
         rep(k, S.size()) {
            if (S[k] == '?') {
               S[k] = 'a';
            }
         }
         cout << S << endl;
         return 0;
      }
   }
   cout << "UNRESTORABLE" << endl;
}

Measured memory_bytes: 256
def sumitb2019_f():
    t1, t2 = map(int, input().split())
    a1, a2 = map(int, input().split())
    b1, b2 = map(int, input().split())

    p = (a1 - b1) * t1
    q = (a2 - b2) * t2
    if p > 0:
        p *= -1
        q *= -1

    if p + q < 0:
        ans = 0
    elif p + q == 0:
        ans = 'infinity'
    else:
        s, t = divmod(-p, p + q)
        if t == 0: ans = s * 2
        else: ans = s * 2 + 1
    print(ans)

if __name__ == '__main__':
    sumitb2019_f()

Measured memory_bytes: 9212
#include <stdio.h>
#include <string.h>
#pragma warning(disable : 4996)

int main()
{
    int A, B, C, D;
    int i;
    int a[101] = {0};
    int b[101] = {0};
    int c[100] = { 0 };
    int time = 0;

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

    for (i = A; i <= B; i++) {
        a[i] = 1;
    }

    for (i = C; i <= D; i++) {
        b[i] = 1;
    }

    for (i = 0; i <= 100; i++) {
        c[i] = a[i] + b[i];
        if (c[i] == 2)
            time++;
    }

 
    if (time == 0)
        printf("%d", time);
    else
    printf("%d", time-1);

    return 0;
}

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

using namespace std;
typedef long long ll;

bool f[200010];

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  
  int n, m;
  cin >> n >> m;

  vector<int> a(n);
  iota(a.rbegin(), a.rend(), 1);
  
  for (int i = 0; i < m; i++) {
    int e;
    cin >> e;
    a.push_back(e);
  }
  reverse(a.begin(), a.end());
  
  for (int i = 0; i < a.size(); i++) {
    if (f[a[i]]) continue;
    f[a[i]] = true;
    cout << a[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 4396
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <math.h>
#include <climits>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <map> 
#include <set>
#include <string>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
const ll MD = 1000000007;

/* sample input

*/

int main()
{
	int a, b;
	int h, w;
	int w1, w2;
	int b1, b2;
	h = 100;
	w = 100;
	char stage[100][100];
	cin >> a >> b;
	
	// a = white =.
	// b = black =#
	for (int j = 0; j<100; j++) {
		for (int i = 0; i < 50; i++) {
			stage[i][j] = '#';
			//if (b == 1) {
			//	stage[i][j] = '.';
			//}
		}
	}
	for (int j = 0; j<100; j++) {
		for (int i = 50; i < 100; i++) {
			stage[i][j] = '.';
			//if (a == 1) {
			//	stage[i][j] = '#';
			//}
		}
	}

	int acount = 1;
	int bcount = 1;
	
	//if (a == 1) {
	//	bcount++;
	//}
	//if (b == 1) {
	//	acount++;
	//}


	for (int j = 1; j<100; j++) {
		for (int i = 1; i < 49; i++) {
			if (acount == a) {
				break;
			}
			if ((i + j) % 3 == 0) {
				stage[i][j] = '.';
				acount++;
			};
		}
	}

	for (int j = 1; j<100; j++) {
		for (int i = 51; i < 99; i++) {
			if (bcount == b) {
				break;
			}
			if ((i + j) % 3 == 0) {
				stage[i][j] = '#';
				bcount++;
			};
		}
	}


	cout << h << " " << w << endl;
	for (int j = 0; j<100; j++) {
		for (int i = 0; i < 100; i++) {
			cout << stage[i][j];
			if (i == w - 1) {
				cout << endl;
			}
		}
	}
	return 0;
}

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

def main():
    N = int(input())
    A  = [int(i) for i in input().split()]
    ans = 0
    max = A[0]
    for a in A:
        if max > a:
            ans += max-a
        else:
            max = a
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 94104
sx, sy, tx, ty = map(int, input().split())

length = ty - sy
width = tx - sx
u = "U"
l = "L"
r = "R"
d = "D"
ans = ''
ans += r*width + u*length
ans += l*width + d*length
ans += d + r*(width+1) + u*(length+1) + l
ans += u + l*(width+1) + d*(length+1) + r
print(ans)

Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<math.h>

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

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;

ll ans[100010];
map<int, pair<int, int>> mp;

int main() {
	cin.tie(0);
	int H, W, D;
	cin >> H >> W >> D;

	REP(i, H) {
		REP(j, W) {
			int num;
			cin >> num;
			mp[num] = pair<int, int>(i, j);
		}
	}

	ll sum[90001];
	vector<pair<int, int>> pos_prev(D);
	REPS(i, 1, H*W + 1) {
		pair<int, int> pos = mp[i];

		if (i <= D) {
			sum[i] = 0;
			pos_prev[i%D] = pos;
		}
		else {
			sum[i] = sum[i-D] + abs(pos.first - pos_prev[i%D].first) + abs(pos.second - pos_prev[i%D].second);
			pos_prev[i%D] = pos;
		}
	}

	int Q;
	cin >> Q;

	REP(i, Q) {
		int li, ri;
		cin >> li >> ri;
		ans[i] = sum[ri] - sum[li];
	}
	REP(i, Q) {
		cout << ans[i] << endl;
	}
	system("pause");
	return 0;
}

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

using namespace std;
#define _rep(n, a, b) for (ll n = (a); n <= (b); ++n)
#define _rev(n, a, b) for (ll n = (a); n >= (b); --n)
#define _for(n, a, b) for (ll n = (a); n < (b); ++n)
#define _rof(n, a, b) for (ll n = (a); n > (b); --n)
#define oo 0x3f3f3f3f3f3f
#define ll long long
#define db double
#define eps 1e-8
#define bin(x) cout << bitset<10>(x) << endl;
#define what_is(x) cerr << #x << " is " << x << endl
#define met(a, b) memset(a, b, sizeof(a))
#define all(x) x.begin(), x.end()
#define pii pair<ll, ll>
#define pdd pair<db, db>
const ll mod = 1e9 + 9;
const ll maxn = 2e5 + 10;
int inArr[maxn];
signed main(){
    int tar, n;
    cin >> tar >> n;
    int mx = 0;
    _rep(i, 1, n){
        int t;
        cin >> t;
        mx = max(mx, t);
        inArr[t] = 1;
    }
    int l = 0, r = mx + 1;
    for(int i=tar;i>=0;i--){
        if (!inArr[i]){
            l = i;
            break;
        }
    }
    for(int i = tar;i<=mx+1;i++){
        if(!inArr[i]){
            r = i;
            break;
        }
    }
    cout <<  (abs(l - tar) <= abs(r - tar) ? l : r) << endl;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
int countNum[1000];
int main () {
	string s;
	cin >> s;
	for (int i = 0; i < (int)s.size(); ++i)
	{
		countNum[s[i]] += 1; 
	}
	for (int i = 0; i < 1000; ++i)
	{
		if(countNum[i] >= 2){
			cout << "no" << endl;
			return 0;
		}
	}
	cout << "yes" << endl;
	return 0;
}

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

int main() {
    string S;
    cin >> S;
    int S_size = S.size();
    string S_now = S;
    string devide[] = {"dream", "erase", "eraser","dreamer"};
    int Yes_flag = 1;
    while(true){
        if (S_now.size() == 0) break;
        if(!Yes_flag) break;
        int can1 = 0;
        for (int j = 0; j < 4; j++){
            if(S_now.size() < devide[j].size()) {
                Yes_flag = 0;
                break;
            }
            string S_devide = S_now.substr(S_now.size()-devide[j].size());
            if (S_devide == devide[j]) {
                S_now.erase(S_now.size()-devide[j].size());
                can1 = 1;
                break;
            }
        }
        if (can1 == 0) Yes_flag = 0;
    }
    if (Yes_flag) cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

int main() {
    int64_t n;
    cin >> n;
    vector<int64_t> d;
    for (int64_t i = 1; i * i <= n; i++) {
	if (n % i == 0) {
	    d.push_back(i);
	    if (i * i < n) d.push_back(n / i);
	}
    }
    int64_t ans = 0;
    for (int64_t k : d) {
	if (k == 1) continue;
	int64_t cache = n;
	while (cache % k == 0) cache /= k;
	if (cache % k == 1) ans++;
    }
    for (int64_t i = 1; i * i <= n - 1; i++) {
	if ((n - 1) % i == 0) {
	    if (i > 1) ans++;
	    if (i * i < n - 1) ans++;
	}
    }
    cout << ans << endl;
}


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

using namespace std;
using ll=long long;

int main() {
    ll N, res = 0;
    string S;

    cin >> N;
    cin >> S;

    ll r = 0, g = 0, b = 0;
    for (int i = 0; i < N; ++i) {
        if (S[i] == 'R') {
            r++;
        } else if (S[i] == 'G') {
            g++;
        } else if (S[i] == 'B') {
            b++;
        }
    }
    res = r * g * b;

    ll k = 0;
    for (int i = 0; i < N; ++i) {
        for (int j = i + 1; j < N; ++j) {
            if (S[i] == S[j]) {
                continue;
            }

            k = 2 * j - i;
            if (k >= N) {
                break;
            }
            if (S[k] != S[i] && S[k] != S[j]) {
                res--;
            }
        }
    }

    cout << res;
    return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<stack>
#include<string>

using namespace std;
const int INF = 1<<30;
typedef long long int ll;

int main(){
  int x;cin>>x;x*=2;
  int n = (int)sqrt(x);
  while(n*(n-1)>=x)n--;
  while(n*(n+1)<x)n++;
  cout << n << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int c=0,n,m=0;
  cin>>n;
  char a;
  for(int i=0;i<n;i++){
    cin>>a;
    if(a=='I')
      c++;
    else
      c--;
    m=max(m,c);
  }
  cout<<m<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define ENDL '\n'
#define all(a) begin(a), end(a)
#define sz(a) (int)(a.size())
#define deb(a) cout << #a << ": " << a << ENDL
#define fore(i, a, b) for(int i(a), ThkMk(b); i < ThkMk; ++i)
#define _ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

typedef long long lli;
typedef long double ld;
typedef pair<lli, lli> ii;
typedef vector<lli> vi;

int main()
{   _
    lli n, x, mx, ans = 0;
    cin >> n >> mx;
    fore(i, 1, n) {
        cin >> x;
        if(x <= mx) {
            ans += mx - x;
        }
        else mx = x;
    }
    cout << ans << ENDL;
    return 0;
}


Measured memory_bytes: 3648
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;

    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);

    private List<List<Integer>> list = new ArrayList<>();

    private void solve(Scanner sc) {
        int N = sc.nextInt();
        for (int i = 0; i < N; ++i) {
            list.add(new ArrayList<>());
        }
        for (int i = 0; i < N - 1; ++i) {
            int a = sc.nextInt();
            list.get(a - 1).add(i + 1);
        }
        _out.println(calc(0));
    }
    private int calc(int v) {
        List<Integer> child = list.get(v);
        if (child.size() == 0) {
            return 0;
        }

        List<Integer> tmp = new ArrayList<>();
        for (int u : child) {
            tmp.add(calc(u));
        }
        Collections.sort(tmp);
        int res = 0;
        for (int i = 0; i < tmp.size(); ++i) {
            int u = tmp.get(i);
            res = Math.max(res, u + child.size() - i);
        }
        return res;
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();

        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

Measured memory_bytes: 95084
#include <bits/stdc++.h>
#include <queue>
#include <set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<vector<p64> > vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 1e9+7;
#define forn(i,e) for(ll i = 0; i < e; i++)
#define forsn(i,s,e) for(ll i = s; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF LLONG_MAX/2e5

ll mpow(ll a, ll b){
	if(b==0) return 1;
	ll t1 = mpow(a,b/2);
	t1 *= t1;
	t1 %= MOD;
	if(b%2) t1 *= a;
	t1 %= MOD;
	return t1;
}

void solve(ll index){
	ll n;
	cin >> n;
	bool bo = 0;
	ll cur = 0;
	while(n>=(1<<cur)){
		if(n==(1<<cur)) bo = 1;
		cur++;
	}
	if(bo){
		cout << "No" << ln;
	}
	else{
		cout << "Yes" << ln;
		cout << n+1 << " " << 2 << ln; 
		ll cur = 2;
		while(cur+1<=n){
			cout << cur << " " << cur+1 << ln;
			cout << 1 << " " << cur+1 << ln;
			cout << n+cur << " " << n+cur+1 << ln;
			cout << 1 << " " << n+cur << ln;
			cur += 2;
		}
		if(cur==n){
			ll in = 2;
			while(!(cur&in)){
				in *= 2;
			}
			// cout << in << ln;
			cout << cur << " " << n+cur-in << ln;
			cout << in+1 << " " << n+cur << ln;
		}
	}
}

int main()
{
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll t=1;
    // cin >> t;
    forn(i,t) solve(i+1);
    return 0;
}

Measured memory_bytes: 2304
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int[] d = new int[N];
		
		for(int i = 0; i < N; i++) {
			d[i] = stdIn.nextInt();
		}
		Arrays.sort(d);
		
		System.out.println(d[N/2]-d[N/2-1]);

	}

}

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

template<typename T>
istream& operator >> (istream& istr, vector<T>& v){
    for(T& x: v) istr >> x;
    return istr;
}

template<typename T, typename U>
istream& operator >> (istream& istr, pair<T,U>& p){
    istr >> p.first >> p.second;
    return istr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<T>& v){
    if(!v.empty()){
        ostr << v.front();
        for(auto itr = ++v.begin(); itr != v.end(); itr++)
            // ostr << *itr;
            ostr << " " << *itr;
    }
    return ostr;
}

template<typename T, typename U>
ostream& operator << (ostream& ostr, pair<T,U>& p){
    // ostr << p.first << p.second;
    ostr << p.first << ", " << p.second;
    return ostr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<vector<T>>& vv){
    if(!vv.empty()){
        ostr << vv.front();
        for(auto itr = ++vv.begin(); itr != vv.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

template<typename T, typename U>
ostream& operator << (ostream& ostr, vector<pair<T,U>>& vp){
    if(!vp.empty()){
        ostr << vp.front();
        for(auto itr = ++vp.begin(); itr != vp.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

typedef long long ll;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<double> vd;
// vll x(n); x[i]=a;
typedef vector<vll> vvll;
typedef vector<vc> vvc;
typedef vector<vd> vvd;
// vvll x(m,vi(n)); x[i][j]=a;
typedef pair<ll,ll> pll;
typedef pair<double,double> pd;
typedef vector<pll> vpll;
typedef vector<pd> vpd;
// vpll x(n); x[i]={a,b}; x[i].first/second;

#define PI 3.1415926535897932
// cout << fixed << setprecision(10) << PI << endl;
#define EPS 1e-12
#define INF (ll)1e+12
#define REP(i,n) for(ll i=0; i<(n); i++)
#define RREP(i,n) for(ll i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORR(i,a,b) for(ll i=(b)-1; i>=(a); i--)
#define dump(x) cout << #x << " = " << (x) << endl
#define all(x) (x).begin(),(x).end()
// sort(all(x));

ll sum(vll &v) {return accumulate(all(v), 0);}

int main(){
    ll n;
    cin >> n;
    double l = n/3.0;
    cout << fixed << setprecision(10) <<  l*l*l << endl;
    return 0;
}


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

int main(){
    string a, b;
    cin >> a >> b;

    if(a.at(0) == b.at(2) && a.at(1) == b.at(1) && a.at(2) == b.at(0)){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
    return 0;
}

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

using namespace std;

// Repetitions
#define FOR(i,a,n) for(ll i = ((ll) a); i < ((ll) n); ++i)
#define FORR(i, s, g) for(ll i = ((ll)s - 1); i >= ((ll) g); --i)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) FORR(i, n, 0)

// Container Utils
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define SORTALL(v) sort(ALL(v))
#define SZ(a) int((a).size())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())

// For Debug
#define DMP(x)  cerr << #x << " = " << (x) << endl
#define DBG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

// Aliases
#define PB push_back
#define MP make_pair
typedef long long ll;
typedef string str;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

// I/O Asynchronizing
struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;

int main() {
    int n;
    cin >> n;
    cout << 1.0 * ((n + 1) / 2) / n << endl;

    return 0;
}


Measured memory_bytes: 256
import itertools

n,m,R = map(int,input().split())
r = list(map(int,input().split()))
for i in range(R):
    r[i] -= 1
r.sort()

inf = 10**10
d = [[inf for i in range(n)] for j in range(n)]
for i in range(n):
    d[i][i] = 0

for i in range(m):
    a,b,c = map(int,input().split())
    a -= 1
    b -= 1
    d[a][b] = min(d[a][b], c)
    d[b][a] = d[a][b]

def wf(N):
    for i in range(N):#経由地点
        for j in range(N):#開始地点
            for k in range(N):#終端
                d[j][k] = min(d[j][k], d[j][i]+d[i][k])

wf(n)

ans = inf
for a in itertools.permutations(range(R)):
    dist = 0
    for i in range(len(a) - 1):
        dist += d[r[a[i]]][r[a[i + 1]]]
    ans = min(ans, dist)

print(ans)

Measured memory_bytes: 48856
n, m, l = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(n)]
B = [list(map(int, input().split())) for _ in range(m)]
ans = []
for i in range(n):
    new_row = []
    for j in range(l):
        tmp_ans = 0
        for k in range(m):
            tmp_ans += A[i][k] * B[k][j]
        new_row.append(tmp_ans)
    ans.append(new_row)

for i in range(n):
    print(' '.join(str(x) for x in ans[i]))

Measured memory_bytes: 8856
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}

int main(){
  
  int r;
  cin>>r;
  int ans = r*r;
  cout<<ans<<endl;
  return 0; 
}


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

int main(){
    int n;
    cin >> n;
    bool ans = false;

    while(true){
        if(n%4==0 || n%7==0){
            ans = true;
            break;
        }
        else if(n - 7 >= 0) n -= 7;
        else if(n - 4 >= 0) n -= 4;
        else break;

        if(n==0){
             ans = true;
             break;
         }
    }

    if(ans) puts("Yes");
    else puts("No");
}

Measured memory_bytes: 3632
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define Rep(i, a, b) for (int i = 0; i < b; i++)
#define REP(i, a, b) for (int i = 0; i <= b; i++)
#define rev(i, n) for (int i = n - 1; i >= 0; i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int, int>
#define vp vector<pair<int, int>>
#define mp make_pair
#define all(v) (v).begin(), (v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a, 0, sizeof(a))
#define inf (1ll << 60)
#define Yes(f) cout << (f ? "Yes" : "No") << endl //fが真の場合Yesを出力、偽の場合Noを出力
#define yes(f) cout << (f ? "yes" : "no") << endl
#define YES(f) cout << (f ? "YES" : "NO") << endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod = 1e9 + 7;

signed main()
{
    int num;
    cin >> num;
    vi abc(4);
    rep(i, 4)
    {
        abc[i] = num % 10;
        num /= 10;
    }
    reverse(all(abc));
    int a, b, c, d;
    a = abc[0];
    b = abc[1];
    c = abc[2];
    d = abc[3];
    int opt1, opt2, opt3;
    opt1 = opt2 = opt3 = 1;

    rep(i, 2)
    {
        rep(j, 2)
        {
            rep(k, 2)
            {
                if (k == 0)
                    opt1 = 1;
                else
                    opt1 = -1;
                if (j == 0)
                    opt2 = 1;
                else
                    opt2 = -1;
                if (i == 0)
                    opt3 = 1;
                else
                    opt3 = -1;
                if (a + b * opt1 + c * opt2 + d * opt3 == 7)
                {
                    char one, two, three;
                    if (opt1 == -1)
                        one = '-';
                    else
                        one = '+';
                    if (opt2 == -1)
                        two = '-';
                    else
                        two = '+';
                    if (opt3 == -1)
                        three = '-';
                    else
                        three = '+';
                    cout << a << one << b << two << c << three << d << "=7" << endl;
                    return 0;
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int r = sc.nextInt();
        if (n >= 10) {
            System.out.println(r);
        } else {
            System.out.println(r + 100 * (10 - n));

        }
    }

}


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

using namespace std;
#define ll long long int
#define mp make_pair
#define pb push_back
#define fi first
#define si second
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F(a,n) for(int i=0;i<n;i++){cin>>a[i];}
#define F1(a,n) for(int i=1;i<=n;i++){cin>>a[i];}
#define P(a,n) for(int i=0;i<n;i++){cout<<a[i]<<' ';}cout<<endl;
#define P1(a,n) for(int i=1;i<=n;i++){cout<<a[i]<<' ';}cout<<endl;
#define NF(a,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cin>>a[i][j];}}
#define NF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cin>>a[i][j];}}
#define PNF(a,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
#define PNF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
const int nax = 1e4+5;
const int mod = 1e9+7;

string func(){
	ll n;
	cin>>n;
	ll *a = new ll[n];
	F(a,n);
	//P(a,n);
	if(n == 1) {return "Yes";}
	for(int i=n-2; i>=0; i--){
		if(a[i] > a[i+1]){
			if(a[i] - a[i+1] > 1){
				return "No";
			}
			a[i]--;
		}
	}
	return "Yes";
}

int main(){
	fastIO
	cout<<func();
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

template <typename TYPE>
void print_vec(const vector<TYPE>& v){
	for(int i=0; i<v.size(); i++){
		cout << v[i] << " ";
	}
	cout << endl;
}

template <typename TYPE>
void print_vec2(const vector<vector<TYPE>>& v){
	for(int i=0; i<v.size(); i++){
		cout << "i=" << i << ":   " << endl;
		for(int j=0; j<v[i].size(); j++){
			cout << v[i][j] << "   ";
		}
		cout << endl;
	}
}

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

ll Comb(ll n, ll k){
    mint res(1);
    for(int i=0; i<k; i++){
      res *= (n-i);
    }
    for(int i=1; i<=k; i++){
      res /= i;
    }
    return res.x;
}

// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};
 
int main(){
    ll K;
    cin >> K;
    string S;
    cin >> S;

    combination C(K+S.size());
    mint ans;
    for(ll i=0; i<=K; i++){
      // mint tmp = mint(25).pow(i);
      // tmp *= mint(26).pow(K-i);
      // tmp *= mint(Comb(i+S.size()-1, i));
      // ans += tmp;
      
      mint a = 25;
      a = a.pow(i);

      mint b = 26;
      b = b.pow(K-i);

      //mint c = Comb(i+S.size()-1, i);
      mint c = C(i+S.size()-1,i);;
      ans += a * b * c;
    }


    cout << ans.x << endl;
		
}


Measured memory_bytes: 35632
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;
#define ll long long int

int main(){
  int n,M = 0,sum = 0; cin >> n;
  vector < int > p(n);
  for ( int i = 0; i < n; ++i ) {
    cin >> p[i];
    sum += p[i];
    M = max(p[i],M);  
  }
  cout << sum - M / 2 << endl;
  return 0;
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int A,B,C,D;
	cin>>A>>B>>C>>D;
	int AB=0,CD=0;
	if(A<=B)
		AB=A;
	else
		AB=B;
	if(C<=D)
		CD=C;
	else
		CD=D;
	cout<<AB+CD<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include<cmath>
using namespace std;
int main(){
	int a, b, n = 0;
	cin >> a >> b;
	if (a < b)
		for (int i=0.0; i < b; i++)
			n += a*pow(10,i);
	else
		for (int i = 0.0; i < a; i++)
			n += b*pow(10,i);
	cout << n;
}

Measured memory_bytes: 3964
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #var << ": ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

void Main() {
	string X; cin >> X;
	stack<char> st;
	REP(i, X.length()) {
		if (X[i] == 'T' && (st.size() == 0 || st.top() == 'T')) {
			st.push(X[i]);
		} else if (X[i] == 'T' && st.top() == 'S') {
			st.pop();
		} else {
			st.push(X[i]);
		}
	}
	cout << st.size() << endl;
}

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


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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const int64 infll = (1LL << 61) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}


// やめます

int main() {
  string S;
  cin >> S;
  int ret = 0;
  for(int i = 0; i < S.size(); i++) {
    string t;
    for(int j = i; j < S.size(); j++){
      if(string("ACGT").find(S[j]) == string::npos) break;
      t += S[j];
      ret = max(ret, (int)t.size());
    }
  }
  cout << ret << endl;
}





Measured memory_bytes: 256
// 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 mut 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:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: i32,
        b: i32
    }

    let ans = if a < 10 && b < 10 { a * b } else { -1 };
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long int
int compare_long(const void *a, const void *b) {long *A = (long *)a;long *B = (long *)b;if (*A > *B) return 1;if (*A < *B) return -1;return 0;}
int main(void){
	int n;
	scanf("%d",&n);
	ll i,x,a[n],sum=0;
	scanf("%lld",&x);
	for(i=0;i<n;i++)scanf("%lld",&a[i]);
	qsort(a,n, sizeof(ll), compare_long);
	for(i=0;i<n;i++){
		sum += a[i];
		if(sum>x){
			break;
		}
	}
	if(i==n && sum < x ) i--;
	printf("%lld",i);
	return 0;
}

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

int main() {
	
	const ll mod = 1000000007;
	ll n; cin >> n;
	if (n == 1) {
		cout << 0 << endl;
		return 0;
	}
	if (n == 2) {
		cout << 2 << endl;
		return 0;
	}
	ll tmp10 = 1;
	ll tmp9 = 1;
	ll tmp8 = 1;
	ll m = n;
	while (m--) {
		tmp10 *= 10;
		tmp9 *= 9;
		tmp8 *= 8;
		tmp10 %= mod;
		tmp9 %= mod;
		tmp8 %= mod;
	}
	ll ans = tmp10 + tmp8 - tmp9 - tmp9;
	ans %= mod;
	ans += mod;
	ans %= mod;
	cout << ans << endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <sstream>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
    int W,H,x,y,r;
    cin>> W >> H >> x >> y >> r;
    if(( x-r >=0 && x + r <= W) && ( y-r >= 0 && y + r <= H)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3092
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>


using namespace std;

int main()
{  
    string s;
    //int count=0;
        
    cin>>s;
    
    if(s.at(0)==s.at(2))cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
         
    return 0;
    
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

typedef long long LL;
const int Mod = 998244353;
const int MN = 3005;

int A, B, C, D;
int f[MN][MN], g[MN][MN];

int main() {
	scanf("%d%d%d%d", &A, &B, &C, &D);
	for (int i = A; i <= C; ++i)
		for (int j = B; j <= D; ++j) {
			if (i == A && j == B) f[i][j] = 1;
			else if (i == A) f[i][j] = (LL)f[i][j - 1] * i % Mod;
			else if (j == B) f[i][j] = (LL)f[i - 1][j] * j % Mod;
			else {
				f[i][j] = (LL)(f[i - 1][j] + g[i - 1][j]) * j % Mod;
				g[i][j] = (f[i][j - 1] + (LL)g[i][j - 1] * i) % Mod;
			}
		}
	printf("%d\n", (f[C][D] + g[C][D]) % Mod);
	return 0;
}

Measured memory_bytes: 72100
use proconio::input;
use proconio::marker::Chars;

fn main() {
    input! {
        s: Chars,
    };
    let s1 = s[0..4].iter().collect::<String>();
    let s2 = s[4..].iter().collect::<String>();
    println!("{} {}", s1, s2);
}


Measured memory_bytes: 2124
// D - Lucky PIN
#include <bits/stdc++.h>
using namespace std;

int main(){
	int N; string S; cin>>N>>S;
	int ans = 0;
	for(int i=0; i<1000; i++){
		char c1 = i/100 +'0', c2 = (i%100)/10 +'0', c3 = i%10 +'0';
		int p = -1;
		p = S.find(c1,p+1); if(p<0) continue;
		p = S.find(c2,p+1); if(p<0) continue;
		p = S.find(c3,p+1); if(p<0) continue;
		ans++;
	}
	cout<< ans <<endl;
}

Measured memory_bytes: 256
// tested by Hightail - https://github.com/dj3500/hightail
import std.stdio, std.string, std.conv, std.algorithm;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;
import std.datetime, std.bigint;

int n, m;
bool[] a;
bool[] b;

void main() {
    scan(n, m);

    a = new bool[](n + 1);
    b = new bool[](n + 1);

    int u, v;

    foreach (i ; 0 .. m) {
        scan(u, v);
        if (u == 1) a[v] = true;
        if (v == n) b[u] = true;
    }

    foreach (i ; 1 .. n) {
        if (a[i] && b[i]) {
            writeln("POSSIBLE");
            return;
        }
    }

    writeln("IMPOSSIBLE");
}



void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}


void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

Measured memory_bytes: 3580
#include <iostream>
#include<vector>
#include <string>
#include<algorithm>
#define MOD 998244353

using namespace std;
long long dp[303][301][301];

int main() {
    string S;
    long long K;
    cin >> S;
    cin >> K;
    
    vector<int> onev;
    {
    int o = 0;
    for (int i=0; i<S.size(); i++) {
        char c = S[i];
        if (c == '0') {
            onev.push_back(o);
            o = 0;
        }
        else o++;
    }
    onev.push_back(o);
    }

    int one = 0;
    for (int i=0; i<S.size(); i++) {
        char c = S[i];
        if (c == '1') one++;
    }

    reverse(onev.begin(), onev.end());
    //for(int v: onev) cerr << v << " "; cerr << endl;

    int opmax = (int)(K < one ? K : one);
    dp[0][0][opmax] = 1;
    for (int i=0; i < onev.size(); i++) {
        for (int cap=0; cap<=one; cap++) {
            for (int ope = 0; ope <= opmax; ope++) {
                // cap
                for (int d=1; d<=onev[i]; d++) {
                    if (cap-d >= 0 && ope+d <= opmax)
                    dp[i+1][cap][ope] += dp[i][cap-d][ope+d];
                    dp[i+1][cap][ope] %= MOD;
                }
                // release or nothing
                for(int d=0; d<=one; d++) {
                    if (cap+d <= one)
                    dp[i+1][cap][ope] += dp[i][cap+d][ope];
                    dp[i+1][cap][ope] %= MOD;
                }
            }
        } 
    }


    long long ans = 0;
    for (int i=0; i<=opmax; i++) {
        ans += dp[onev.size()][0][i];
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 57608
#include<stdio.h>

int main(){
    int i,N,K;
    int h[100000];
    int cnt = 0;
    scanf("%d %d",&N,&K);
    for(i=0 ; i < N ; i++){
        scanf("%d",&h[i]);
        if(h[i] >= K){
            cnt++;
        }
    }
    printf("%d",cnt);
    return 0;
}

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

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;

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

    string a, b; cin >> a >> b;

    int aDat[26], bDat[26]; F0R(i, 26) {
        aDat[i] = 0;
        bDat[i] = 0;
    }

    F0R(i, a.length()) {
        aDat[a.at(i) - 'a']++;
    }
    F0R(i, b.length()) {
        bDat[b.at(i) - 'a']++;
    }

    vi aSort, bSort;
    F0R(i, 26) {
        aSort.pb(aDat[i]);
        bSort.pb(bDat[i]);
    }

    sort(all(aSort)); sort(all(bSort));

    F0R(i, 26) {
        if (aSort[i] != bSort[i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 916
import java.io.*;
import java.text.DecimalFormat;
import java.util.*;  
public class Main {
	static String s,t;
	static Integer memo[][];
	static PrintWriter pw;
	public static void trace(int i, int j)
	{
		if(i==s.length()||j==t.length())return;
		if(s.charAt(i)==t.charAt(j) && dp(i, j)==1 + dp(i+1, j+1))
		{
			pw.print(s.charAt(i)); trace(i+1, j+1);
		}
		else if(dp(i, j)==dp(i+1, j))
		{
			trace(i+1, j);
		}
		else if(dp(i, j)==dp(i, j+1))
		{
			trace(i, j+1);
		}
		else if(dp(i, j)==dp(i+1, j+1))
		{
			trace(i+1, j+1);
		}
	}
	public static int dp(int i, int j)
	{
		if(i==s.length()||j==t.length())return 0;
		if(memo[i][j]!=null)return memo[i][j];
		return memo[i][j]=s.charAt(i)==t.charAt(j)? Math.max(1 + dp(i+1, j+1), Math.max(dp(i+1, j), Math.max(dp(i, j+1),dp(i+1, j+1)))): Math.max(dp(i+1, j), Math.max(dp(i, j+1),dp(i+1, j+1)));
	}
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		pw = new PrintWriter(System.out);
		s= br.readLine(); t= br.readLine();
		memo = new Integer[s.length()][t.length()];
		dp(0,0);
		trace(0, 0);
		pw.close();
	}
}

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

int main() {
	int r ,d ,a;
	vector <int > x(11);
	cin >>r>> d>>a;
    x[0]=a;
    for (int i=1;i<11;i++){
    	x[i]=x[i-1]*r-d;
    }
    for (int i=1;i<11;i++){
    	cout << x[i]<< endl;
    }
    return 0;
    
	
}

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

int main()
{
   int N,x;
   scanf("%d",&N);
   x=N/1000;
   x++;

   if(N%1000==0)
   {
       printf("0");
   }
   else
    {
        printf("%d",((x*1000)-N));
    }
   return 0;
}

Measured memory_bytes: 1728
#include<bits/stdc++.h>
using namespace std;
long long INF = 1e18;

int main(){
    int n;
    cin>>n;
    int v[n+100],c[n+100];
    for(int i=0; i<n; i++){
        cin>>v[i];
    }
    for(int i=0; i<n; i++){
        cin>>c[i];
    }

    int ans = 0;

    for(int mask=0 ;mask < (1 << n); mask++){
        int x = 0,y = 0;
        for(int i=0 ; i<n; i++ ){
            if(mask & (1 << i)){
                x += v[i];
                y += c[i];
            }
        }
        ans = max(ans,x-y);
    }
    
    

    cout<< ans << endl;

    return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

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

void Main()
{
	int a, b;
  	cin >> a >> b;
 	if((a&1)&&(b&1)) cout << "Odd" << endl;
	else cout << "Even" << endl;
	return;
}

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

Measured memory_bytes: 256