akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define All(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<ll>>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename t, typename u, typename Comp=less<>>
bool chmax(t& xmax, const u& x, Comp comp={}) { if(comp(xmax, x)) { xmax = x; return true; } return false;}
template<typename t, typename u, typename Comp=less<>>
bool chmin(t& xmin, const u& x, Comp comp={}) { if(comp(x, xmin)) { xmin = x; return true;} return false;}
const int INF = 1e8;
const ll infl = 1LL << 60;
ll N;
ll ans;

void rec(int d,ll val, vector<ll> &all){
    all.push_back(val);
    if(d == 10) return;
    for(int j=-1;j<=1;j++){
        int add = (val%10) + j;
        if(add >= 0 && add<= 9) rec(d+1,val*10+add,all);
    }
}

int main(){
    int k;
    cin >> k;
    vector<ll> all;
    for(int v=1;v<10;v++) rec(1,v,all);
    sort(All(all));
    cout << all[k-1] << endl; 
}

Measured memory_bytes: 2420
#include <iostream>

using namespace std;
typedef long long ll;

int main(int argc, char* argv[])
{
    int a,b;
    cin >> a >> b;

    if(a <= 9 && b <= 9)
        cout << a*b << endl;
    else
        cout << -1 << endl;
    

    return EXIT_SUCCESS;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define ces(d) cout<<" "<<endl;

int main() {
 int K;
 int A,B,C;
 cin >>A>>B>>C>>K;
 int sum=0;
 int maxi=max(A,B);
 sum+=min(A,B);
 sum+=min(maxi,C);
 maxi=max(maxi,C);


 while(K-->0){
 	maxi*=2;
 }

 ce(maxi+sum);
}

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

int main() {
  int a; cin >> a;
  cout << a + a*a + a*a*a << endl;
  return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF (INT_MAX / 4)
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define TIMER_S(start) chrono::system_clock::time_point start = chrono::system_clock::now();
#define TIMER_E(end) chrono::system_clock::time_point end = chrono::system_clock::now();
#define TIME(start, end) cout << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count()) << "ms" \
                              << "\n";

int main()
{
    int n, a, b, num = 0, abnum = 0;
    string s;
    cin >> n >> a >> b >> s;
    REP(i, n)
    {
        if (num < a + b)
        {
            if (s.at(i) == 'a')
            {
                num++;
                cout << "Yes"
                     << "\n";
                continue;
            }
            if (s.at(i) == 'b' && abnum < b)
            {
                abnum++;
                num++;
                cout << "Yes"
                     << "\n";
                continue;
            }
        }
        cout << "No"
             << "\n";
    }
    return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <cctype>
#include <queue>
#include <set>
#include <list>
#define PI 3.141592653
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF=1e9+7;

int main(void) {
	int n;
	cin >> n;
	printf("%lf\n", (double)(n - n / 2) / n);
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static long Mod = (long)1e9 + 7;
        static long[] dirw = new long[] { -1, 0, 1, 0 };
        static long[] dirh = new long[] { 0, 1, 0, -1 };
        static string[] Sij;

        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var HW = Sarray();
            var H = HW[0];
            var W = HW[1];
            Sij = new string[H + 2];
            Sij[0] = new string('#', (int)W + 2);
            for (var i = 1; i <= H; ++i)
                Sij[i] = "#" + ReadLine() + "#";
            Sij[H + 1] = Sij[0];
            var max = 0L;
            for (var h = 1L; h <= H; ++h)
            {
                for (var w = 1L; w <= W; ++w)
                {
                    if (Sij[h][(int)w] == '#') continue;
                    var cmp = new bool[H + 2, W + 2];
                    var q = new Queue<Tuple<long, long, long>>();//h,w,dst
                    q.Enqueue(Tuple.Create(h, w, 0L));
                    while (q.Count != 0)
                    {
                        var npos = q.Dequeue();
                        var nowh = npos.Item1;
                        var noww = npos.Item2;
                        var nowdst = npos.Item3;
                        if (cmp[nowh, noww]) continue;
                        cmp[npos.Item1, npos.Item2] = true;
                        if (Sij[nowh][(int)noww] == '#') continue;
                        max = Max(max, nowdst);
                        for (var i = 0; i < 4; ++i)
                        {
                            var nexth = nowh + dirh[i];
                            var nextw = noww+ dirw[i];
                            q.Enqueue(Tuple.Create(nexth, nextw, nowdst + 1));
                        }
                    }
                }
            }
            WriteLine(max);
            //Out.Flush();
        }
    }
}


Measured memory_bytes: 15696
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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

ll MOD = pow(10, 9) + 7;

ll powmod(ll a, ll p, ll MOD) {
	ll ans = 1;
	ll mul = a;
	for (; p > 0; p >>= 1, mul = (mul * mul) % MOD) {
		if ((p & 1) == 1)ans = (ans * mul) % MOD;
	}
	return ans;
}

ll combmod(ll n, ll r, ll MOD){
  if(n < r) return 0LL;
  if (n <= 0 || r < 0) return 0LL;
  vector<ll> ff(n+1), vff(n+1);
  // 1! ~ n!
  ff[0] = 1;
  for(ll i = 1; i < n + 1; i++) {
    ff[i] = ff[i - 1] * i % MOD;
  }
  // n!^(MOD-2) (= n!^(-1))
  ll inv = powmod(ff[n], MOD - 2, MOD);

  // n!^(-1) ~ 1!^(-1)
  vff[n] = inv;
  for(ll i = n - 1; i >= 0; i--) {
    vff[i] = vff[i + 1] * (i + 1) % MOD;
  }

  // n combination r
  ll comb = (((ff[n] * vff[r]) % MOD) * vff[n - r]) % MOD;

  return comb;
}

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}

int main() {

    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    REP(i, N) cin >> A[i];

    sort(A.begin(), A.end());

    vector<ll> com(N, 0);
    com[K-1] = 1;
    com[K] = K;
    REP(i, N){
        if (i <= K) continue;
        com[i] = (com[i-1] * i) % MOD;
        com[i] = (com[i] * modinv(i-K+1, MOD)) % MOD;
        //cout << i << " " << com[i] << endl;
    }

    vector<ll> b(N, 0), s(N, 0);
    ll ans = 0;
    REP(i, N){
        b[i] = com[i];
        s[i] = com[N-1-i];
        //cout << i << " " << A[i] << " " << b[i] << " " << s[i] << endl;
        ll tmp = (b[i] * A[i]) % MOD;
        ll tmp1 = (s[i] * A[i]) % MOD;
        ans = (ans + tmp) % MOD;
        ans = (MOD + ans - tmp1) % MOD;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3328
#include<cstdio>
#include<cstring>
using namespace std;

char s[102];
int a[101];
int main(){
	scanf("%s",s+1);
	int n=strlen(s+1),k;
	scanf("%d",&k);
	for(int i=1,o=1;i<=n;i++){
		if(s[i]!=s[i+1]){
			a[++a[0]]=i-o+1;
			o=i+1;
		}
	}
	long long ans=0;
	if(s[1]==s[n]){
		if(a[0]==1)ans=1ll*n*k/2;
		else{
			for(int i=2;i<a[0];i++)
				ans+=1ll*a[i]/2*k;
			ans+=a[1]/2+a[a[0]]/2;
			ans+=1ll*(a[1]+a[a[0]])/2*(k-1);
		}
	}
	else for(int i=1;i<=a[0];i++)
		ans+=1ll*a[i]/2*k;
	printf("%lld\n",ans);
}


Measured memory_bytes: 1696
#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
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

vvi to;
int n, m;

int f(int v, int id){
    return v + n * id;    
}

void Main(){
    cin >> n >> m;
    to.resize(3 * n);
    rep(i, m){
        int u, v; cin >> u >> v; u--; v--;
        rep(j, 3) to[f(u, j)].pb(f(v, (j+1)%3));
    }
    int s, t; cin >> s >> t; s--; t--;
    
    vi dist(3 * n, -1);
    queue<int> q;
    q.push(s);
    dist[s] = 0;

    while(!q.empty()){
        auto now = q.front(); q.pop();
        for(auto nxt : to[now]){
            if(nxt == t && dist[now] % 3 == 2){
                cout << (dist[now] + 1)/3 << endl;
                return;
            }
            if(dist[nxt] == -1){
                q.push(nxt);
                dist[nxt] = dist[now] + 1;
            }
        }
    }
    
    cout << -1 << endl;
    return;
}

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

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

int main() {
	int n; cin >> n;
	vector<pair<int,int>>a(n), b(n);
	for (int i = 0; i < n; i++) {
		int x, y;
		cin >> x >> y;
		a[i] = { -y,x };
	}
	for (int i = 0; i < n; i++) {
		cin >> b[i].first >> b[i].second;
	}

	sort(a.begin(), a.end());
	for (int i = 0; i < n; i++)a[i].first *= -1;
	sort(b.begin(), b.end());

	int ans = 0;
	vector<bool>b_ok(n, false);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (b_ok[j])continue;
			if (a[i].second < b[j].first && a[i].first < b[j].second) {
				b_ok[j] = true; ans++;
				break;
			}				
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3540
import sys
import os
import math

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    A = il()
    ret = 0
    while all([n % 2 == 0 for n in A]):
        ret += 1
        A = [a // 2 for a in A]
    print(ret)


if __name__ == '__main__':
    main()


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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

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

  CIN(N);
  vector< ll > a(N);
  REP(i, N) {
    cin >> a[i];
  }

  //sort(ALL(a));
  ll ans = 0;
  REP(i, N) {
    REP(j, N) {
      ans = max(ans, abs(a[i] - a[j]));
    }
  }
  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 repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }



int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(25);

  ll n, d;
  cin >> n >> d;
  vector<ll> x(n), y(n);
  rep(i, n) cin >> x[i] >> y[i];

  ll ans = 0;
  rep(i, n) if (x[i] * x[i] + y[i] * y[i] <= d * d) ans++;
  cout << ans << '\n';
  




  
  return 0;
}

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

int main(){
    long long N, A, B;
    cin >> N >> A >> B;
    long long line = N / (A + B);
    long long rem = N - line * (A + B);
    if(rem > A) rem = A;
    cout << line * A + rem  <<endl;
}

Measured memory_bytes: 256
import sys

a = []
for i in range(3):
  array = list(map(int, input().split()))
  a.append(array)

n = input()
n = int(n)

for i in range(n):
  b = int(input())
  for j in range(3):
    for k in range(3):
      if a[j][k] == b:
        a[j][k] = 0
        
      if j == 2 and (a[0][k] == 0 and a[1][k] == 0 and a[2][k] == 0):
        print("Yes")
        sys.exit()
      
    if a[j][0] == 0 and a[j][1] == 0 and a[j][2] == 0:
      print("Yes")
      sys.exit()
    
  if a[0][0] == 0 and a[1][1] == 0 and a[2][2] == 0:
    print("Yes")
    sys.exit()
    
  if a[0][2] == 0 and a[1][1] == 0 and a[2][0] == 0:
    print("Yes")
    sys.exit()
  
print("No")
    

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
using ll = long long;
int main(){
  int n;
  cin >> n;
  string ans = "No";
  for(int i = 0; i <= n/4; i++){
    for(int j = 0; j <= n/7; j++){
      if(4*i+7*j == n){
        ans = "Yes";
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <set>
#include <map>
using namespace std;
typedef long long ll;

int a, b, c, d;
int main(void) {
	
	cin >> a >> b >> c >> d;

	int s[110] = { 0 };
	for (int i = a; i < b; i++)
	{
		s[i]++;
	}
	for (int i = c; i < d; i++)
	{
		s[i]++;
	}
	int cnt = 0;
	for (int x : s) {
		if (x == 2) ++cnt;
	}
	

	cout << cnt << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		int R[]=new int[n];
		for(int i=0;i<n;i++){
			R[i]=s.nextInt();
		}
		//ri ?????????
		int ri=R[0];
		//rj ???????????????
		int max=R[1]-ri;
		for(int i=2;i<R.length;i++){
			if(ri>R[i-1])ri=R[i-1];
			if(max<R[i]-ri)max=R[i]-ri;
		}
		System.out.println(max);
	}
}

Measured memory_bytes: 101684
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	int N;
	cin >> N;
	string S, T, ans;
	cin >> S >> T;
	REP(i, N) {
		ans += S[i];
		ans += T[i];
	}
	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 < (int)(n); i++)
#define ll long long
ll gcd(ll a, ll b) {
return b ? gcd(b, a%b) : a;
}
int main(){
    ll n;
    cin >> n;
    vector<ll> monster(n);
    rep(i,n) cin >> monster[i];
    ll ans = monster[0];
    for(int i=1; i<n; i++){
        ans = gcd(ans,monster[i]);
    }
    cout << ans <<endl;
}

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

int main() {
  long long A, B, C, K;
  cin >> A >> B >> C >> K;
  
  if (A >= K) {
   cout << K << endl;
  } else if (A < K) {
   if (B >= (K - A)) {
    cout << A << endl;
   } else {
    cout << A - (K - A - B) << endl;
   }
  }
  
}


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

int main(){
	int n,m;
	cin>>n>>m;
	int temp;
	temp=m+n;
	if(temp%2==0){
		cout<<temp/2<<endl;
	}
	else
		cout<<"IMPOSSIBLE"<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vl vector<LL>
#define vii vector<vi>
#define vll vector<vl>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;

int main(){
	int n,k;
    cin>>n>>k;
    vi h(n);
    FOR(i,0,n){
        cin>>h[i];
    }
    sort(h.rbegin(),h.rend());
    LL ans=0;
    FOR(i,k,n){
        ans+=h[i];
    }
    cout<<ans<<endl;
    
}


Measured memory_bytes: 1024
#include <stdio.h>
 
int main(){
  int	a;
  
  scanf("%d", &a);
  if	 ( a==  0 					  ){ printf("0"); }
  else if( a==  1 || a== 10 || a==100 ){ printf("1"); }
  else if( a== 11 || a==101 || a==110 ){ printf("2"); }
  else if( a==111 					  ){ printf("3"); }
 
  return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
#include<algorithm>
using namespace std;

int main(){
    int a, xmax=-100, ymin=100;
    int n, m;

    cin >> n >> m >> xmax >> ymin;

    for(int i=0; i<n; ++i){
        cin >> a;
        xmax = max(xmax, a);
    }

    for(int i=0; i<m; ++i){
        cin >> a;
        ymin = min(ymin, a);
    }

    if(xmax < ymin){
        cout << "No War" << endl;
    }else{
        cout << "War" << endl;
    }
}


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

using namespace std;
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

void solve() {
    ll a, b, x;
    cin >> a >> b >> x;
    if (a == 0) {
        cout << 1 + b / x << endl;
    } else {
        cout << (1 + b / x) - (1 + (a - 1) / x) << endl;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

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

        int N = sc.nextInt();
        int[] rates = new int[N];

        for (int i = 0; i < N; i++) {
            rates[i] = sc.nextInt();
        }

        int[] pointFlag = new int[9];
        for (int i = 0; i < 9; i++) {
            pointFlag[i] = 0;
        }

        for(int i = 0; i<N; i++){
            if(rates[i] >= 1 && rates[i] <= 399){
                pointFlag[0] = 1;
            }else if(rates[i] >= 400 && rates[i] <= 799){
                pointFlag[1] = 1;
            }else if(rates[i] >= 800 && rates[i] <= 1199){
                pointFlag[2] = 1;
            }else if(rates[i] >= 1200 && rates[i] <= 1599){
                pointFlag[3] = 1;
            }else if(rates[i] >= 1600 && rates[i] <= 1999){
                pointFlag[4] = 1;
            }else if(rates[i] >= 2000 && rates[i] <= 2399){
                pointFlag[5] = 1;
            }else if(rates[i] >= 2400 && rates[i] <= 2799){
                pointFlag[6] = 1;
            }else if(rates[i] >= 2800 && rates[i] <= 3199){
                pointFlag[7] = 1;
            }else if(rates[i] >= 3200){
                pointFlag[8] += 1;
            }
        }

        int minAns = 0;
        int maxAns = 0;
        for (int i = 0; i < 8; i++) {
            minAns += pointFlag[i];
            maxAns += pointFlag[i];
        }
        if(pointFlag[8] > 0 && minAns==0)minAns = 1;
        maxAns += pointFlag[8];

        System.out.println(minAns+" "+maxAns);
    }
}

Measured memory_bytes: 21844
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long lint;



int main(){
   int x;
   cin >> x;
   
   int i=2;
   vector<int> prime;
   bool isp = true;
   while(true){
      isp = true;
      for(int p: prime){
         if(i%p==0){
            isp = false;
            break;
         }
      }
      
      if(isp){
         prime.push_back(i);
         if(i>=x) break;
      }
      i++;
   }
   
   cout << i << endl;
   return 0;
}

Measured memory_bytes: 384
#include<iostream>

using namespace std;

int main(){
    int a,b,r;
    cin>>a>>b;
    if(a<b) swap(a,b);
    while(b>0){
        r = a%b;
        a = b;
        b = r;
    }
    cout<<a<<endl;
    return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(long long (i)=0;(i)<(n);++(i))
#define ref(i,a,b) for (long long (i)=(a); (i)<=(b); ++(i))
#define endl '\n'
#define pb push_back
#define mp make_pair
const int mx=1e5+5;
char s[mx],t[mx];
vector <int > p[30];
int main(){
	/*freopen(".gir", "r", stdin);
	freopen(".cik", "w", stdout); 
    */ios_base::sync_with_stdio(false);cin.tie(NULL);
	scanf("%s%s",s+1,t+1);
	int ls=strlen(s+1);
	int lt=strlen(t+1);
	for(int i=1;i<=ls;++i){
		p[s[i]-'a'].push_back(i);
	}
	ll las=0,ans=0;
	for(int i=1;i<=lt;++i){
		int a=t[i]-'a',siz=p[a].size();
		if(siz==0){
			printf("-1");return 0;
		}
		if(p[a][siz-1]<=las)las=0,ans+=ls;
		las=*upper_bound(p[a].begin(),p[a].end(),las);
	}
	printf("%lld\n",ans+las);
}
	

Measured memory_bytes: 1148
object Main {
  def main(args: Array[String]): Unit = {
    solve
  }

  def solve(): Unit = {
    val sc = new java.util.Scanner(System.in)
    val n = sc.nextInt()
    val tasks = new Array[Task](n)
    for (i <- 0 until n) {
      tasks(i) = Task(
        sc.nextInt(),
        sc.nextInt()
      )
    }

    val sortedTasks = tasks.sortBy(_.limit)

    var ans = true
    var fromStart = 0
    for (task <- sortedTasks) {
      fromStart += task.cost
      if (fromStart > task.limit) {
        ans = false
      }
    }

    println(if (ans) "Yes" else "No")
  }


  case class Task(cost: Int, limit: Int)

}


Measured memory_bytes: 125144
import java.util.*;

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

		String str = sc.next();
		int len = str.length();
		
		if(str.charAt(len-1)=='3'){
			System.out.println("bon");
			return;
		}
		if(str.charAt(len-1)=='0'){
			System.out.println("pon");
			return;
		}
		if(str.charAt(len-1)=='1'){
			System.out.println("pon");
			return;
		}
		if(str.charAt(len-1)=='6'){
			System.out.println("pon");
			return;
		}
		if(str.charAt(len-1)=='8'){
			System.out.println("pon");
			return;
		}
		
		System.out.println("hon");
		return;

	}
}

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

using namespace std;
using LL = long long;
using P = pair<int,int>;
const int INF=2e9;

int main(){
	int A, B, C, X, Y;
	cin >> A >> B >> C >> X >> Y;
	int M=max(X,Y), res=INF;
	for(int i=0; i<=M*2; i+=2){
		int a=max(0,X-i/2), b=max(0,Y-i/2);
		res=min(res,a*A+b*B+C*i);
	}
	cout << res << endl;

	return 0;
}

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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

int main() {
    string S;
    cin >> S;
    bool fl = false;
    if (S == "hi" or S == "hihi" or S == "hihihi" or S == "hihihihi" or
        S == "hihihihihi") {
        fl = true;
    }
    cout << (fl ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
ss = []
for i in range(n):
    s = input().rstrip()
    ss.append(sorted(s))

ss.sort()

total = 0
c = ss[0]
s = 0
for i in range(1, n):
    if c != ss[i]:
        total += (i-s) * (i-s-1) // 2
        c = ss[i]
        s = i

total += (n-s) * (n-s-1) // 2
print(total)


Measured memory_bytes: 97752
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
int main(){
  int x,t;
  std::cin >> x>>t;
  std::cout << max(0,x-t) << std::endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

        for(int i = 2; i <= a; i++){
            for(int j = 20; j <= b; j++){
                if((j % 10) >= 2 && (j / 10) >= 2){
                    if((j / 10) * (j % 10) == i){
                        count++;
                    }
                }
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 22604
import collections
n=int(input())
xy=[]
for i in range(n):
    xy.append(list(map(int,input().split())))
dif=[]
for i in range(n):
    for k in range(i+1,n):
        dif.append([xy[i][0]-xy[k][0],xy[i][1]-xy[k][1]])
        dif.append([xy[k][0]-xy[i][0],xy[k][1]-xy[i][1]])
for i in range(len(dif)):
    dif[i]=str(dif[i])
c=collections.Counter(dif)
ans=list(c.values())
ans.sort(reverse=True)

if n==1:
    print(1)
else:
    print(n-ans[0])


Measured memory_bytes: 3828
N = int(input())
D = [input() for i in range(N)]
count = 0
OK = 0
for ite in D:
    
    
    a,b = map(int,ite.split())
    
    if a == b:
        count += 1
        if count >=3:
            OK = 1
            
        
        else:
            pass
    
    else:
        count = 0

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


Measured memory_bytes: 9188
/* ****Ragnar7 _Lawliet_**** */
/* First, solve the problem.Then write the code. */
#include<bits/stdc++.h>
#define ll          long long
#define ld 			long double
#define hell        1000000007
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifndef ONLINE_JUDGE
	freopen ("input.txt","r",stdin);
	// freopen ("output.txt","w",stdout);
	#endif
	ll t = 1;
	// cin>>t;
	while(t--)
	{
		string s;
		cin>>s;
		ll ans =0;
		if(s[0]==s[1] and s[1]==s[2] and s[2]=='R')
			cout<<3;
		else if(s[0]==s[1] and s[1]=='R')
			cout<<2;
		else if(s[2]==s[1] and s[1]=='R')
			cout<<2;
		else if(s[0]=='R' or s[1]=='R' or s[2]=='R')
			cout<<1;
		else
			cout<<0;
		
	}

	
	time
	return 0;
}

Measured memory_bytes: 3676
#include <iostream>
#include <algorithm>
#include <climits>
#define ll long long
using namespace std;
ll n, x, ans;
ll a[2005], b[2005];
int main()
{
	cin >> n >> x;
	for(int i=1; i<=n; i++)
	{
		cin >> a[i];
		b[i] = a[i];
	};
	ans = LLONG_MAX;
	for(int k=0; k<n; k++)
	{
		ll tmp = 0;
		for(int i=1; i<=n; i++)
		{
			int be = (i-k <= 0)? i-k+n: i-k;
			b[i] = min(b[i], a[be]);
			tmp += b[i];
		}
		ans = min(ans, tmp + k*x);
	}
	cout << ans << endl;

	return 0;
}


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

int main()
{
    int n,x;
    cin>>n>>x;

    if(x==1||x==2*n-1)
    {
        cout<<"No";
        return 0;
    }

    cout<<"Yes\n";
    for(int i=1;i<=2*n-1;i++)
    {
        int a=i+(x-n)+2*n-1;
        a=a%(2*n-1);
        if(a==0)
            a=2*n-1;
        cout<<a<<"\n";
    }
    return 0;

}


Measured memory_bytes: 1536
#include <iostream>
#include <vector>
#include <stack>
#include <cmath>
#include <string>
#include <algorithm>

using namespace std;

#define ll long long

int FindGCDWithOneReplace(vector<int> arr, int n)
{
	if (n == 2) return max(arr[0], arr[1]);

	sort(arr.begin(), arr.end());

	for (int v = arr[1]; v >= 1; v--)
	{
		int sum  = 0;

		for (int i = 0; i < n; i++)
		{
			if (arr[i] % v != 0)
				sum++;

			if (sum >= 2)
				break;
		}

		if (sum <= 1) return v;
	}
}

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

	vector<int> arr(n);

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

	cout << FindGCDWithOneReplace(arr, n) << endl;
}





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

using namespace std;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVS vector<vector<string>>
#define VVC vector<vector<char>>
#define fore(i,a) for(auto &i:a)
typedef long long ll;
const int  INF = 2147483647;
const ll INFL = 9223372036854775807;
const ll mod = 1000000007;




int main() {
	int n, m, r;
	cin >> n >> m >> r;
	VI x(r);
	REP(i, r)cin >> x[i];
	sort(ALL(x));
	int d[210][210];
	REP(i, n + 1)REP(j, n + 1)d[i][j] = 10000000;
	REP(i, m) {
		int a, b, c;
		cin >> a >> b >> c;
		d[a][b] = c;
		d[b][a] = c;
	}
	REP(k, n + 1)REP(i, n + 1)REP(j, n + 1) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
	ll res = INF;
	do {
		ll tmp = 0;
		REP(i, r - 1)tmp += d[x[i]][x[i + 1]];
		res = min(tmp, res);
	} while (next_permutation(ALL(x)));

	cout << res << endl;

	return 0;
}

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

int main () {

    int N;
    cin >> N;

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

    int ans = 0;
    for (int i = 0; i < N-1; i++) {
        for (int j = i+1; j < N; j++) {
            ans += d[i]*d[j];
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
typedef long long LL;
int A[200000],here[200000],town[200000];
inline LL IN(void)
{
  LL x=0;int f=1;char c=getchar();
  while((c<'0'||c>'9')&&c!='-')c=getchar();
  if(c=='-')f=-f,c=getchar();
  while(c>='0'&&c<='9')x=x*10+c-48,c=getchar();
  return f*x;
}
int main(void)
{
  int N,i,j,x;LL K;
  N=IN(),K=IN();
  for(i=0;i<N;i++)A[i]=IN(),here[i]=-1;
  for(i=0,j=0;;i=A[i]-1,j++)if(here[i]<0)here[i]=j,town[j]=i;else{x=here[i];break;}
  if(K>=j)K=(K-x)%(x-j)+x;
  return printf("%d\n",town[K]+1),0;
}

Measured memory_bytes: 3860
#include<iostream>
#include<cstring> 
#include<map>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm> 
using namespace std;

# define p(s) std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;

const int limit = 1e5;

int cost[limit];
int h[limit];

int ans(int n){
    if(cost[n]!=-1) return cost[n];

    cost[n] = min(ans(n-2)+abs(h[n-2]-h[n]),ans(n-1)+abs(h[n-1]-h[n]));
    return cost[n];
}

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

    memset(cost,-1,sizeof(cost));
    cost[0]=0;
    cost[1]=abs(h[1]-h[0]);

    p(ans(n-1))
}

Measured memory_bytes: 4096
n,m=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
mod=10**9+7
x.sort()
y.sort()
sx,sy=0,0
for k in range(1,n+1):
  sx+=(2*k-n-1)*x[k-1]
  sx%=mod
for k in range(1,m+1):
  sy+=(2*k-m-1)*y[k-1]
  sy%=mod
print((sx*sy)%mod)

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

int main(){
  int n; cin >>n; int d=0,t=0;
  vector<int>v(n);
  for(int i=0; i<n; i++) cin >>v[i];
  for(int i=0; i<n-1; i++)
  {
    if(v[i+1]<=v[i]) t++;
    else
    {
      if(t>d) d=t;
      t=0;
    }
  }
  if(t>d) d=t;
  cout <<d;
return 0;}

Measured memory_bytes: 640
#include <stdio.h>

int main(){
  
  int s[100000];
  int t[50000];
  int n,q,i,count=0;
  int left,right,mid;

  scanf("%d",&n);

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

  scanf("%d",&q);

  for(i=0;i<q;i++){
    scanf("%d",&t[i]);
  }

  for(i=0;i<q;i++){
    left=0;
    right=n;
    while(left<right){
      mid=(left+right)/2;
      if(t[i]==s[mid]) {
	count++;
	break;
      }
      if(t[i]>s[mid]){
	left=mid+1;
      }
      else if(t[i]<s[mid]){
	right=mid;
      }
    }
  }

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

  return 0;
  
}

Measured memory_bytes: 1184
function myout(text){console.log(text);}//standard output
function Main(input) {
	//input = parseInt(input);
	//input = input.split(" ");
	//input = input.split("\n");
	input = input.split(" ").map((a)=>Number(a));
	//input = input.split("\n").map((a)=>Number(a));
  var x = input[2] - input[0];
  var y = input[3] - input[1];
  var output = "";
  for(var i = 0; i < y; i++){
    output += "U";
  }
  for(var i = 0; i < x+1; i++){
    output += "R";
  }
  for(var i = 0; i < y+1; i++){
    output += "D";
  }
  for(var i = 0; i < x+1; i++){
    output += "L";
  }
  output += "UL";
  for(var i = 0; i < y+1; i++){
    output += "U";
  }
  for(var i = 0; i < x+1; i++){
    output += "R";
  }
  for(var i = 0; i < y+1; i++){
    output += "D";
  }
  for(var i = 0; i < x; i++){
    output += "L";
  }
  myout(output);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());

Measured memory_bytes: 7756
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>
#include <chrono>
#include <random>
#include <bitset>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs
#define tm aklsjdasjdasjdkdjjf
#define lcm hddalkwjeidjjhasda
#define random_shuffle asdasdd

const int MAXN = 105000;

int an, bn, m;
int a[MAXN], b[MAXN];
int mnA, mnB;
int ans;

int main() { 

  cin >> an >> bn >> m;
  for (int i = 0; i < an; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < bn; i++) {
    scanf("%d", &b[i]);
  }

  mnA = a[0];
  for (int i = 0; i < an; i++) {
    mnA = min(mnA, a[i]);
  }
  mnB = b[0];
  for (int i = 0; i < bn; i++) {
    mnB = min(mnB, b[i]);
  }

  ans = mnA + mnB;

  for (int i = 0; i < m; i++) {
    int x, y, c;
    scanf("%d %d %d", &x, &y, &c);
    x--; y--;
    ans = min(ans, a[x] + b[y] - c);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1152
#include<stdio.h>
#include<ctype.h>
int main(){
    int i,c;
    int cnt[128]={0};
    while((c=getchar())!=EOF){
        if(isupper(c)){
            c=tolower(c);
        }
        cnt[c]++;
        i++;
    }
    for(i=0;i<26;i++){
        cnt[i+97]+=cnt[i+65];
        printf("%c : %d\n",i+97,cnt[i+97]);
    }
    return 0;
}

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

#define int int_fast64_t

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

  string s; cin >> s;
  int i = s.length()/2;
  int j = (s.length()-1)/2;
  if (s[i] != s[j]) {
    cout << i << '\n';
    return 0;
  }
  char c = s[i];
  while (i >= 0 && s[i] == c && s[j] == c) {
    --i;
    ++j;
  }
  cout << j << '\n';
}

/*
 * Local variables:
 * compile-command:"g++ -D_GLIBCXX_DEBUG -g3 -ggdb3 -O0 -Wall -Wextra -std=c++14 d.cc -o d && for f in *.in; do echo \"--- $f -------------\"; ./d <$f; done"
 * end:
 */



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

using namespace std;

#define x first
#define y second
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;

const int MOD = 95542721;

const int N = 100000;

int n;
pii p[N+1];

vector<int> pnt;
multiset<int> sL,sR;
multiset<pii> curR;

void eS(int idx){
	sL.erase(sL.find(p[idx].x));
	sR.erase(sR.find(p[idx].y));
}

void iS(int idx){
	sL.insert(p[idx].x);
	sR.insert(p[idx].y);
}

void iF(int idx){
	curR.insert(make_pair(p[idx].y,idx));
}

void eF(int idx){
	curR.erase(curR.find(make_pair(p[idx].y,idx)));
}

int ans(int L){
	if(curR.size() == 0)return -2e9;
	if(sL.size() == 0)return -2e9;
	ll fn = max(0ll,1ll*((*curR.begin()).first) - L + 1);
	fn += max(0ll,1ll*(*sR.begin())-(*--sL.end()) + 1);
	return fn;
}

bool removeOne(int L){
	if(curR.size() == 0)return false;
	int f1 = ans(L);
	int idx = (*curR.begin()).second;
	eF(idx);
	iS(idx);
	int f2 = ans(L);
	eS(idx);
	iF(idx);
	return f2 >= f1;
}
int main(){
	cin >> n;
	for (int i = 0; i < n; ++i){
		scanf("%d%d",&p[i].x,&p[i].y);
		pnt.push_back(p[i].x);
		pnt.push_back(p[i].y);
	}
	sort(pnt.begin(),pnt.end());
	pnt.resize(unique(pnt.begin(),pnt.end())-pnt.begin());
	sort(p,p+n);

	for (int i = 0; i < n; ++i){
		sL.insert(p[i].x);
		sR.insert(p[i].y);
	}
	int idx = 0;
	int sf = 0;
	for (int i = 0; i < pnt.size(); ++i){
		while(idx < n && p[idx].x <= pnt[i]){
			iF(idx);
			eS(idx);
			idx++;
		}
		while(removeOne(pnt[i])){
			int idx = (*curR.begin()).second;
			eF(idx);
			iS(idx);
		}
		int ffs = ans(pnt[i]);
		sf = max(sf,ffs);
	}
	sL.clear();
	sR.clear();
	for(int i = 0 ; i < n ; ++i){
		sL.insert(p[i].x);
		sR.insert(p[i].y);
	}
	for (int i = 0; i < n; ++i){
		sL.erase(sL.find(p[i].x));
		sR.erase(sR.find(p[i].y));
		sf = max(sf,p[i].y-p[i].x+1 + max(0,(*sR.begin())-(*--sL.end()) + 1));
		sL.insert(p[i].x);
		sR.insert(p[i].y);
	}
	cout << sf << endl;
	return 0;
}

Measured memory_bytes: 17012
#include<stdio.h>
int main(void)
{
	int n,i,flg=0;
	scanf("%d",&n);
	
	for(i=n;i<999999999999999;i++){
		if(i%2==0){
			if(i%n==0){
			flg=1;
			}
		}
		if(flg==1){
			break;
		}
	}
	printf("%d\n",i);
}

Measured memory_bytes: 128
#define _GLIBCXX_DEBUG
    #include <bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    typedef pair<int, int> pii;
    typedef vector<int> vi;
    typedef vector<bool> vb;
    typedef vector<string> vs;
    typedef vector<ll> vl;
    typedef vector<vector<int> > vvi;
    #define pb push_back
    #define mp make_pair
    #define f first
    #define s second
    #define in insert
    #define FOR(i,a,b) for (int i = a; i < b; i++)
    #define all(x) (x).begin(), (x).end()
    #define rall(x) (x).rbegin(), (x).rend()
    #define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    const int INF = 1e9 + 5;
    int main(){
        int a, b, x, y;
        cin >> a >> b >> x >> y;
        cout << fixed << setprecision(6) << (double(a)*double(b))/double(2) << " ";
        if(a%2==0 && x == a/2 && b%2==0 && y == b/2){
            cout << 1;
        }
        else cout << 0;
    }


Measured memory_bytes: 256
while true do
  n, m = gets.split.map(&:to_i)
  break if m == 0 && n == 0

  target = []
  3.times do |i|
    nums = gets.split.map(&:to_i)
    nums.shift
    
    nums.each do |num|
      target[num-1] = i
    end
  end


  cnv_target = []
  target.size.times do |i|
    n_odd = 0
    target[0,i].each do |j|
      n_odd += 1 if j.odd?
    end
    cnv = n_odd.even? ? target[i] : 2 - target[i]
    cnv_target << cnv
  end

  count0 = 0
  cnv_target.reverse.each_with_index do |num, i|
    count0 += num * 3**i
  end

  count1 = 3**n - 1 - count0

  count = [count0, count1].min
  puts count > m ? -1 : count
end

Measured memory_bytes: 6116
// Shinchan Loves Coding :)))
#include<bits/stdc++.h>
#include<map>
#include<set>
#include<stack>

using namespace std;

#define night_rider ios::sync_with_stdio(false);cin.tie(NULL);
#define int long long int
#define double long double
#define en "\n"
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define toUpper(x) transform(x.begin(), x.end(), x.begin(),::toupper);
#define toLower(x) transform(x.begin(), x.end(), x.begin(),::tolower);
#define rep(i,x,y) for(int i=x ; i<y ; i++)
#define erep(i,x,y) for(int i=x ; i<=y ; i++)
#define erepr(i,x,y) for(int i=x ; i>=y ; i--)
#define repr(i,x,y) for(int i=x ; i>y ; i--)
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef pair<int,int> pi;
typedef vector<pair<int,int>> pii;
bool secdes(const pair<int,int>&a , const pair<int,int>&b){if(a.se==b.se){return a.fi>b.fi;}else{return a.se>b.se;}}//second descending !
bool sir(const pair<int,int>&a , const pair<int,int>&b){if(a.fi==b.fi){return a.se>b.se;}else{return a.first>b.first;}}//first descending !
bool bysec(const pair<int,int>&a , const pair<int,int>&b){if(a.se==b.se){return a.fi<b.fi;} else{return a.se<b.se;}}//second ascending !

//--------------------------------------------------------------------------------------------------------------------------------------------------------------

const int no=3e6+5;
const int modulo=1e9+7;
const int inf=1e18;
const int N=2001;
int ar[no],br[no],mat[N][N];
int dx[]={-1 , 0 , 1 , 0};
int dy[]={0 , 1 , 0 , -1};
char dc[]={'L', 'D' , 'R' ,'U'};

//--------------------------------------------------------------------------------------------------------------------------------------------------------------
int mul(int x , int y , int mod) {
	return ((x%mod)*(y%mod))%mod;
}

int powwmod(int x, int y , int mod) { int res=1; while (y) { if (y & 1){ y--; res=mul(res,x,mod); res%=mod; } else { y/=2; x=mul(x,x,mod); x%=mod; } } return res%mod; }

int poww(int x , int y) { int res=1; while(y) { if(y%2) { y--; res=res*x; } else { y/=2; x=x*x; } } return res; }

int div(int x , int y , int mod) {
	return x*poww(y,mod-2)%mod ;
}

bool comp(int x, int y) {
	return (x < y);   // MINIMUM
	return (x > y);   // MAXIMUM
}

int gcd(int x, int y) { if(y==0) return x; else return gcd(y,x%y); }

int lcm(int x, int y) { return (x*y)/gcd(x,y);}

//--------------------------------------------------------------------------------------------------------------------------------------------------------------
vi adj[no];
int used[no];

void solve (){
	int n,m,a,b,x,y;
	cin>>n;
	cout<<((powwmod(10,n,modulo)+(-2*powwmod(9,n,modulo)+modulo)+powwmod(8,n,modulo))+modulo)%modulo;
}

inline void runn(){
	#ifndef ONLINE JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
}

signed main()
{
	night_rider
	//runn();
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
}


Measured memory_bytes: 73964
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<string>
#include<queue>
#include<utility>
#include<cmath>
#include<sstream>
#include<istream>

using namespace std;


int main()
{

  int N;
  cin >> N;

  string S;
  cin >> S;

  int a;
  char c;

  for(int i=0; i<S.length(); i++){
    a = (int)S[i];
    a += N;
    if(a>90){
      a = 90 - (26 - (a-90));
    }
    c = (char)a;
    cout << c;
  }

  cout << endl;

  return 0;
}


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

using ll = long long;

bool ab[10000], ac[10000], bc[100000];

bool match(char c1, char c2) { return (c1 == '?' || c2 == '?' || c1 == c2); }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string a, b, c;
    cin >> a >> b >> c;
    for (int i = 0; i < a.size(); i++)
        for (int j = 0; j < b.size(); j++)
            ab[i - j + 5000] |= !match(a[i], b[j]);
    for (int i = 0; i < a.size(); i++)
        for (int j = 0; j < c.size(); j++)
            ac[i - j + 5000] |= !match(a[i], c[j]);
    for (int i = 0; i < b.size(); i++)
        for (int j = 0; j < c.size(); j++)
            bc[i - j + 5000] |= !match(b[i], c[j]);
    int ans = 1 << 30;
    for (int i = -4000; i <= 4000; i++) {
        for (int j = -4000; j <= 4000; j++) {
            if (!ab[i + 5000] && !ac[j + 5000] && !bc[j - i + 5000]) {
                int L = min(0, min(i, j));
                int R = max((int)a.size(),
                            max((int)b.size() + i, (int)c.size() + j));
                ans = min(ans, R - L);
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define lli long long int
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(lli i=0, i##_len=(lli)(n); i<i##_len; i++)
#define repf(i, n) for(lli i=1, i##_len=(lli)(n+1); i<i##_len; i++)
#define per(i, n) for(lli i=((lli)(n))-1; i>=0; i--)
#define perf(i, n) for(lli i=((lli)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<lli>
#define vvi vector<vector<lli>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    lli r;
    cin >> r;
    cout << 3*r*r << endl;
}

Measured memory_bytes: 256
N,M=map(int,input().split())
L=[0]*M
R=[0]*M
count=0
for i in range (0,M):
    L[i],R[i]=map(int,input().split())
    
L_max=max(L)
R_min=min(R)

for i in range(1,N+1):
    if(L_max<=i and i<=R_min):
        count+=1

print(count)

Measured memory_bytes: 10996