akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define int long long
#define INF 1000000000000000000
using namespace std;

#define ANS(f) if(f) cout << "YES" << endl; else cout << "NO" << endl;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }
void debug(mat m){REP(i, m.size()){ REP(j, m[0].size()){ cout << m[i][j] << ","; } cout << endl; }}



signed main(){

    string S; cin >> S;
    string T = "AKIHABARA";
    bool ans = true;
    int i = 0;
    REP(j, T.size()){
        if(i == S.size() || S[i] != T[j]){
            if(T[j] != 'A'){
                ans = false;
                break;
            }
        }else i++;
    }
    if(i != S.size()) ans = false;
    ANS(ans);

    return 0;
}

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
#define MP make_pair
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }
void ans1(bool x){
  if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){
  if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){
  if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x, ll y, ll z){
  if(x) cout<<y<<endl;else cout<<z<<endl;}   


int main(){
  ll i,j;
  ll n; cin>>n;
  //ll a,b,c,d,e,f; cin>>a>>b;
  //ll a,b,c,d,e,f; cin>>a>>b>>c;
  //ll a,b,c,d,e,f; cin>>a>>b>>c>>d;
  //string s; cin >> s;
  ll result = 0;
  ll buf = 0;
  bool judge = true;
  cout<<n/3<<endl;

  /*
  vector<ll> a(n);
  for(i=0;i<n;i++){
    cin >> a[i];
  }
  
  for(i=0;i<n;i++){

  }
  */

  return 0;
}

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

int main() {
  string input;
  cin >> input;
  int N;
  N = input.length();

  int counta = 0;

  char a[N];
  for(int i=0;i<N;++i){
    a[i] = (char)(input[i]);
    if(a[i]=='o') ++counta;
  }

  int NN = 15-N;

  if(NN==0){
    if(counta>7) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  else{
    for(int i=0;i<NN;++i) ++counta;
    if(counta>7) cout << "YES" << endl;
    else cout << "NO" << endl;
  }





}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();
        long d = sc.nextLong();
        sc.close();

        // e: cとdの最大公約数
        long e = gcd2(c, d);
        // f: cとdの最小公倍数
        long f = (c / e) * (d / e) * e;

        // x: cで割り切れる数の個数
        long x = num(a, b, c);
        // y: dで割り切れる数の個数
        long y = num(a, b, d);
        // z: eで割り切れる数の個数
        long z = num(a, b, f);

        // 答え
        long ans = (b - a + 1) - (x + y - z);
        System.out.println(ans);
    }

    static long gcd(long a, long b) {
        if (a == b) {
            return a;
        } else if (a > b) {
            return gcd(b, a - b);
        } else {
            return gcd(a, b - a);
        }
    }

    // a > b
    static long gcd2(long a, long b) {
        if (a % b == 0) {
            return b;
        }
        return gcd2(b, a % b);
    }

    // a: 下限
    // b: 上限
    // c: 割る数
    static long num(long a, long b, long c) {
        long x = (b - a + 1) / c;
        if (((b - a + 1) % c) > (c - (a % c))) {
            x++;
        }
        return x;
    }
}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
  int n;
  cin>>n;
 // cout<<min(n*a,b)<<endl;
   double ans=0;
  rep(i,0,n){
    
     double x;
    string u;
    cin>>x>>u;
    if(u=="JPY") ans+=x;
    else ans+=x*380000.0;
    
  }
  cout<<fixed<<setprecision(8);
  cout<<ans<<endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define FasterIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

typedef unsigned long long ull;
typedef long long ll;
typedef double db;

#define mem(a,x) memset(a,x,sizeof(a))
#define pb push_back
#define ff first
#define ss second
#define mk make_pair
#define pi pair<int,int>
#define vi vector<int>
#define pL pair<ll,ll>
#define vL vector<ll>
#define vp vector<pi>
#define vpL vector<pL>

const int MX=4000;
const ll mod=998244353;
const int LG=26;


ll a[MX][MX], dp[MX][MX][4];

ll call(int r, int c, int t)
{
    if(r<=0 || c<=0) return -1e18;

    if(r==1 && c==1) return ((t<3)?max(a[r][c], 0LL):0);

    if(~dp[r][c][t]) return dp[r][c][t];

    dp[r][c][t]=0;

    if(t<3) dp[r][c][t]=max(dp[r][c][t], a[r][c]+call(r-1, c, 0));

    dp[r][c][t]=max(dp[r][c][t], call(r-1, c, 0));

    if(t<3) dp[r][c][t]=max(dp[r][c][t], a[r][c]+call(r, c-1, t+1));

    dp[r][c][t]=max(dp[r][c][t], call(r, c-1, t));

    return dp[r][c][t];
}

int main()
{
    FasterIO;

    int r, c, k;

    cin>>r>>c>>k;

    for(int i=1; i<=k; i++)
    {
        int x, y, z; cin>>x>>y>>z;
        a[x][y]+=z;
    }

    mem(dp, -1);

    ll rs=call(r, c, 0);


    cout<<rs<<endl;

    return 0;
}


Measured memory_bytes: 584200
n, k=map(int, input().split())

l=[]
point=k
l.append(k)
while point>1:
    if point%2==0:
        point=point//2
    else:
        point=(point//2) +1
    l.append(point)

m=len(l)

if n>=k:
    ans1=0
    for i in range(m-1):
        count=l[i]-l[i+1]
        prob=0.5**(i+1)
        ans1+=prob*count
    ans=ans1+(n-k+1)
elif n==1:
    countn=0
    nn=n
    while nn<k:
        nn=nn*2
        countn+=1
    ans=0.5**countn
else:
    ans2=0
    for i in range(m-1):
        if n>=l[i]:
            b=i
            break
        else:
            continue
        break
    ans2+=((0.5)**b)*(n-l[b]+1)
    for i in range(b,m-1):
        count=l[i]-l[i+1]
        prob=0.5**(i+1)
        ans2+=prob*count
    ans=ans2



print(ans/n)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _0053
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int num = 3;
            int[] primes = new int[10000]; primes[0] = 2;

            for (int i = 1 ; i < primes.Length ; i++)
            {
                primes[i] = primes[i-1] + num;
                do { num++; } while (!IsPrime(num));
            }

            while (true)
            {
                int n = RInt();
                if (n == 0) break;
                Console.WriteLine(primes[n-1]); 
            }
        }

        /// <summary>
        ///素数判定
        /// </summary>
        public static bool IsPrime(long number)
        {
            long boundary = (long)Math.Floor(Math.Sqrt(number));

            if (number == 1) return false;
            if (number == 2) return true;

            for (long i = 2 ; i <= boundary ; ++i)
            {
                if (number % i == 0) return false;
            }
            return true;
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}



Measured memory_bytes: 15920
import sys
from collections import deque, defaultdict
import copy
import bisect
#input=sys.stdin.readline
#sys.setrecursionlimit(10 ** 9)
import math
import heapq

H, W = list(map(int,input().split()))
A = []
for i in range(H):
	A.append(input())

dist = [[10000000 for i in range(W)] for j in range(H)]

now = deque()
for i in range(H):
	for j in range(W):
		if A[i][j] == "#":
			now.append([i,j])
			dist[i][j] = 0


while len(now) > 0:
	loc = now.popleft()
	if loc[0] < H - 1 and dist[loc[0] + 1][loc[1]] > dist[loc[0]][loc[1]] + 1:
		dist[loc[0] + 1][loc[1]] = dist[loc[0]][loc[1]] + 1
		now.append([loc[0] + 1, loc[1]])
	if loc[0] > 0 and dist[loc[0] - 1][loc[1]] > dist[loc[0]][loc[1]] + 1:
		dist[loc[0] - 1][loc[1]] = dist[loc[0]][loc[1]] + 1
		now.append([loc[0] - 1, loc[1]])
	if loc[1] < W - 1 and dist[loc[0]][loc[1] + 1] > dist[loc[0]][loc[1]] + 1:
		dist[loc[0]][loc[1] + 1] = dist[loc[0]][loc[1]] + 1
		now.append([loc[0], loc[1] + 1])
	if loc[1] > 0 and dist[loc[0]][loc[1] - 1] > dist[loc[0]][loc[1]] + 1:
		dist[loc[0]][loc[1] - 1] = dist[loc[0]][loc[1]] + 1
		now.append([loc[0], loc[1] - 1])

num = 0
for i in range(H):
	for j in range(W):
		num = max(num, dist[i][j])
print(num)

Measured memory_bytes: 160860
def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]

# n
# a, b
# s = input()


N = int(input())
A = [0] + list(map(int, input().split()))
B = [0] + list(map(int, input().split()))

ans = 0
for i in range(1, N+1):
    if B[i] > A[i]:
        ans += A[i]
        B[i] -= A[i]
        ans += min(B[i], A[i+1])
        A[i+1] = max(0, A[i+1] - B[i])
    else:
        ans += min(B[i], A[i]) 
print(ans)


Measured memory_bytes: 82916
S = input()
T = input()

length = len(S)

ans = 0
pre = -1

for t in T:
    x = S.find(t, pre+1, length)
    if x != -1:
        ans += x - pre
        pre = x
    else:
        x = S.find(t, 0, pre+1)
        if x != -1:
            ans += length + x - pre
            pre = x
        else:
            ans = -1
            break

print(ans)


Measured memory_bytes: 3316
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <cstring>

#define fi first
#define se second
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = 1; i < (n); ++i)
#define drep(i,n) for (int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define all(x) (x).begin(), (x).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T> >

using namespace std;
typedef long long ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;

const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

const int mod = 1000000007;

int main() {
    int n;
    cin >> n;
    float xl = n / 1.08;
    float xr = n / 1.08 + 1/1.08;
    if (ceil(xl) < xr) cout << ceil(xl) << endl;
    else cout << ":(" << 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 reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define mrep(i,from,n) for(int i = from; i < n; i++)
#define mreps(i,from,n) for(int i = from; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(all(x), val), x.end())
typedef long long ll;
typedef pair<int, int> P;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
ll MOD = 1000000007;
int INF = 1001001001;

void solve()
{
    int a, b, c; cin >> a >> b >> c;
    cout << c <<" "<< a << " " << b << endl;
    return;
}

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


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
#define itn int
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>=1;i--)
#define all(vec) vec.begin(),vec.end()
#define sortt(vec) sort((vec).begin(),(vec).end())
#define rsort(vec) sort((vec).rbegin(), (vec).rend())
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=2e9;
const ll lnf=9e18;

int main(){
  itn d,t,s; cin >> d >> t >> s;
  if(d<=s*t) cout << "Yes" << endl;
  else cout << "No" << endl;
  
}

Measured memory_bytes: 3628
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
A = list(map(int, input().split()))

s = sum(A)/2

t = 0
d = 10**10
for i in range(N):
    t += A[i]
    d = min(d, abs(s - t))

print(int(d*2))

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m, c;
    cin >> n >> m >> c;
    vector<int> bs(m);
    vector<vector<int>> ass(n, vector<int>(m));
    for (int& b: bs) {
        cin >> b;
    }
    for (auto& as : ass) {
        for (auto& a : as) {
            cin >> a;
        }
    }
    int count = 0;
    for (auto& as : ass) {
        int sum = c;
        for (int i = 0; i < m; ++i) {
            sum += as[i] * bs[i];
        }
        count += sum > 0;
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)
using namespace std;
 /*temp*/


int a[5];

bool judge() {
    if(0 > a[2] - a[4]) return false;
    if(0 > a[3] - a[4]) return false;
    if(a[0] < a[2] + a[4]) return false;
    if(a[1] < a[3] + a[4]) return false;
    return true;
}

main(){
    REP(i, 5)
        cin >> a[i];
    if(judge()) cout << "Yes\n";
    else cout << "No\n";
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define int long long int
using namespace std;
template<typename T,typename U> using P=pair<T,U>;
template<typename T> using V=vector<T>;
template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}

template<typename T>auto&operator<<(ostream&s,const vector<T>&v){s<<"[";bool a=1;for(auto e:v){s<<(a?"":" ")<<e;a=0;}s<<"]";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const pair<T,U>&p){s<<"("<<p.first<<","<<p.second<<")";return s;}
template<typename T>auto&operator<<(ostream&s,const set<T>&st){s<<"{";bool a=1;for(auto e:st){s<<(a?"":" ")<<e;a=0;}s<<"}";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const map<T,U>&m){s<<"{";bool a=1;for(auto e:m){s<<(a?"":" ")<<e.first<<":"<<e.second;a=0;}s<<"}";return s;}
#define DUMP(x)  cerr<<#x<<" = "<<(x)<<endl;

struct edge { int to, cost; };

const int INF = 1e18;
const int MOD = 1e9+7;

signed main()
{
   int n, C, K; cin >> n >> C >> K;
   V<int> T(n);
   for (int i = 0; i < n; i++) {
      cin >> T[i];
   }

   sort(T.begin(), T.end());
   int dep = -1, cnt = 0, ans = 0;
   for (int i = 0; i < n; i++) {
      if (dep != -1 && T[i] <= dep && cnt < C) {
         cnt++;
      } else {
         dep = T[i] + K;
         cnt = 1;
         ans++;
      }
   }
   cout << ans << endl;

   return 0;
}


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

using namespace std;

typedef long long ll;

int main(){
        int N;
        cin>>N;
        ll res=1;
        for(int i=1;i<=N;i++){
                res*=i;
                res=res%1000000007;
        }
        cout<<res%1000000007<<endl;
        return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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


        while(true){
            int a = sc.nextInt();
            op = sc.next();
            int b = sc.nextInt();

            if(op.equals("+")){
                System.out.println(a+b);
            }
            else if(op.equals("-")){
                System.out.println(a-b);
            }
            else if(op.equals("*")){
                System.out.println(a*b);
            }
            else if(op.equals("/")){
                System.out.println(a/b);
            }
            else{
                break;
            }
        }


    }
}


Measured memory_bytes: 26464
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		long d=sc.nextLong();
		long a=sc.nextLong();
		long[][] xh=new long[n][2];
		for(int i=0; i<n; i++){
			xh[i][0]=sc.nextLong();
			xh[i][1]=sc.nextLong();
		}
		Arrays.sort(xh,(x,y)->Long.compare(x[0],y[0]));
		long[] im=new long[n+1];
		int state=1;
		long ans=0;
		for(int i=0; i<n; i++){
			long dis=xh[i][0]+2*d;
			while(state<n && dis>=xh[state][0]){
				state++;
			}
			ans+=Math.max(0,(xh[i][1]-im[i]+a-1)/a);
			im[i+1]+=im[i]+Math.max(0,(xh[i][1]-im[i]+a-1)/a*a);
			im[state]-=Math.max(0,(xh[i][1]-im[i]+a-1)/a*a);
		}
		System.out.println(ans);
	}
}


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

#define MOD 1000000007
#define pb push_back
#define mp make_pair

template<typename T>
void print(vector<T> &v)
{
    for_each(v.begin(), v.end(), [](auto i){cout << i << ' ';});
    cout << '\n';
}

void f(int testCase)
{
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    long long ans = b*d;
    ans = max(ans, a*c);
    ans = max(ans, a*d);
    ans = max(ans, b*c);
    cout << ans << '\n';
}

int main()
{
    std::ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    //cin >> t;

    for(int i = 1; i<=t; i++)
        f(i);
    return 0;
}

Measured memory_bytes: 3664
#include<vector>
#include<iostream>
#include<algorithm>
#include<numeric>
#include<tuple>
#include<queue>
using tp = std::tuple<int,int,int>;
class unionfind {
    std::vector<int> par, rank, size_;
public:
    unionfind(int n) :par(n), rank(n), size_(n, 1) {
        std::iota(par.begin(),par.end(), 0);
    }
    int find(int x) {
        if (par[x] == x)return x;
        return par[x] = find(par[x]);
    }
    void unite(int x, int y) {
        x = find(x), y = find(y);
        if (x == y)return;
        if (rank[x] < rank[y])std::swap(x, y);
        par[y] = x;
        size_[x] += size_[y];
        if (rank[x] == rank[y])rank[x]++;
    }
    bool same(int x, int y) {
        return find(x) == find(y);
    }
    int size(int x) {
        return size_[find(x)];
    }
};

int main(){
    int N;
    std::cin >> N;
    std::vector<tp>xst,yst;
    for(int idx = 0; idx < N; ++idx){
        int x,y; std::cin >> x >> y;
        xst.emplace_back(x,y,idx);
        yst.emplace_back(y,x,idx);
    }
    std::sort(xst.begin(), xst.end());
    std::sort(yst.begin(), yst.end());
    std::priority_queue<tp,std::vector<tp>,std::greater<>>que;
    for(int i = 0; i + 1 < xst.size(); ++i){
        int ax,ay,ai,bx,by,bi;
        std::tie(ax,ay,ai) = xst[i];
        std::tie(bx,by,bi) = xst[i + 1];
        que.emplace(std::abs(ax - bx),std::min(ai,bi),std::max(ai,bi));
    }
    for(int i = 0; i + 1 < yst.size(); ++i){
        int ax,ay,ai,bx,by,bi;
        std::tie(ay,ax,ai) = yst[i];
        std::tie(by,bx,bi) = yst[i + 1];
        que.emplace(std::abs(ay - by),std::min(ai,bi),std::max(ai,bi));
    }
    int edge = 0;
    long long sum = 0;
    auto uf = unionfind(N);
    while(edge < N - 1){
        int cost,i,j;
        std::tie(cost,i,j) = que.top();
        que.pop();
        if(not uf.same(i,j)){
            uf.unite(i, j);
            ++edge;
            sum += cost;
        }
    }
    std::cout << sum << std::endl;
}


Measured memory_bytes: 7340
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
using namespace std;
using ll = long long;
using vi = vector<int>;
using ii = pair<int, int>;
using vvi = vector<vi>;
using vii = vector<ii>;
using gt = greater<int>;
using minq = priority_queue<int, vector<int>, gt>;
using P = pair<ll,ll>;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++ 
// ACGT
// no -> ?102, ?021, ?012, 0?12, 01?2
int dp[105][4][4][4];
int mod = 1e9+7;

int main() {
  int n; cin >> n;
  dp[0][3][3][3] = 1;
  rep(i,n) {
    rep(d1,4) rep(d2,4) rep(d3,4) {
      rep(a, 4) {
        if (d2 == 1 && d3 == 0 && a==2) continue;
        if (d2 == 0 && d3 == 2 && a==1) continue;
        if (d2 == 0 && d3 == 1 && a==2) continue;
        if (d1 == 0 && d3 == 1 && a==2) continue;
        if (d1 == 0 && d2 == 1 && a==2) continue;
        (dp[i+1][d2][d3][a] += dp[i][d1][d2][d3]) %= mod;
      }
    }
  }
  int ans = 0;
  rep(d1,4)
  rep(d2,4)
  rep(d3,4) {
    (ans += dp[n][d1][d2][d3]) %= mod;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3624
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $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")
    };
}

macro_rules! chmax {
    ($x:expr, $e:expr) => {
        if $x < $e {
            $x = $e;
        }
    };
}
macro_rules! chmin {
    ($x:expr, $e:expr) => {
        if $x > $e {
            $x = $e;
        }
    };
}

const INF: i64 = 1 << 60;

fn main() {
    input!{
        N: usize,
        S: chars,
        T: chars,
    }
    let mut ans = Vec::new();
    for i in 0..N {
        ans.push(S[i]);
        ans.push(T[i]);
    }
    let ans: String = ans.into_iter().collect();
    println!("{}", ans);
}


Measured memory_bytes: 4352
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        String N = sc.next();
		String ans = "ABC";

		if (N.equals("ABC")) {
			ans = "ARC";
		}

		System.out.println(ans);

        sc.close();
    }    
}


Measured memory_bytes: 26916
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <tuple>
#include <functional>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <map>
#include <random>
#include <cstdlib>
#define INT_MAX 2147483647
#define INT_MIN -2147483646
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;

static const int N = 105;

struct vertex {
	int id;
	int p;
	int d;
	bool operator<(const vertex & another) const {
		return (d != another.d ? d>another.d : id>another.id);
	}
};

int main() {
	vvi mx(N, vi(N, -1));
	int n;
	cin >> n;
	Loop(i, n) {
		Loop(j, n) {
			int a;
			cin >> a;
			mx[i][j] = a;
		}
	}
	//
	vi color(N, 0); //0,1
	priority_queue<vertex> q;
	q.push({ 0,-1,0});
	int ret = 0;
	while(q.size() > 0) {//?
		vertex v = q.top();
		q.pop();
		if (color[v.id] == 1) continue;
		color[v.id] = 1;
		ret += v.d;
		Loop(j, n) {
			if (mx[v.id][j] != -1 && color[j] != 1){
				q.push({ j, v.id,mx[v.id][j] });
			}
		}
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 3200
/*---------------------------------

 @Author:   Dicer
 @DateTime: 2019-05-19 20:12:22
---------------------------------*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
inline ll qpow(ll a,ll b,ll mod){ll res=1;while(b){if(b&1)res = (res*a)%mod;a=(a*a)%mod;b>>=1;}return res;}
const double eps = 1e-8;
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const int MAXN = 2e5 + 7;

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

	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	s[k-1] = s[k-1] - 'A' + 'a';
	cout << s << endl;	
	return 0;
}

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

#define fi                      first
#define se                      second
#define pb                      push_back
#define endl                    '\n'
#define all(x)                  x.begin(),x.end()
#define pii                     pair<int,int>
#define pll                     pair< long long int, long long int> 
#define fast                    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define SZ(x)                   ((int)x.size())

#define FOR(i,a,b)              for(int i = a; i < b; ++i)
#define REV(i,a,b)              for(int i = a; i >= b; --i)
#define FORE(i,a,b)             for(int i = a; i <= b; ++i)

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

void solve();

int32_t main()
{
        fast;
        int t = 1;
        // cin >> t;
        for(int i = 1; i <= t; ++i)
                solve();
        cerr << "Time taken: " << ((clock() * 1000) / CLOCKS_PER_SEC) << "ms\n";
}


void solve() {
        int n,k;
        cin >> n >> k;
        std::vector<ld> p(n+1);
        p[0] = 0;
        FOR(i,1,n+1) {
        	cin >> p[i];
        	p[i] = (p[i] + 1.00)/2.00;
        	p[i] += p[i-1];
        }
        ld ans = 0;
        FOR(i,k,n+1) {
        	ans = max(ans,p[i] - p[i-k]);
        }
        cout << fixed << setprecision(10) << ans << endl;
}

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

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

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int c = in.nextInt();

            for (int i = 0; i < 10000; i++) {
                if (a * i % b == c) {
                    out.println("YES");
                    return;
                }
            }

            out.println("NO");
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

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

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



Measured memory_bytes: 21460
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
#include <random>
#include <time.h>
//#include <boost/multiprecision/cpp_int.hpp>



using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const double EPS = 1e-10;
long long const MOD = 1000000007;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for (int i = 0;i < 60; i++) {
        if (n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

void fastInput() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main(void) {
    int N; cin >> N;
    vector<int> a(N+1);
    int cnt = 0;
    for (int i = 1; i <= N; i++) {
        cin >> a[i];
        if (a[i] != i) {
            cnt++;
        }
    }
    if (cnt == 2 || cnt == 0) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
int32_t main()
{
	int s,w;
	cin>>s>>w;
	if(w>=s)
	{
		cout<<"unsafe"<<endl;
	}
	else
	{
		cout<<"safe"<<endl;
	}
}
	

Measured memory_bytes: 3632
#include <stdio.h>

int main(void)
{
	int a,b,c;

	scanf("%d %d %d",&a,&b,&c);

	if((a<b)&&(b<c))
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}

	return 0;
}

Measured memory_bytes: 580
#include<stdio.h>
#define MAX 100000

int A[MAX],n;

int partition(int p,int r){
	int j,copy;
	int x=A[r];
	int i=p-1;
	
	for(j=p;j<=r-1;j++){
		if(A[j]<=x){
			i=i+1;
			copy=A[i];
			A[i]=A[j];
			A[j]=copy;
		}
	}
	
	copy=A[i+1];
	A[i+1]=A[r];
	A[r]=copy;
	
	return i+1;
}

int main(){
	int i,q;
	scanf("%d", &n);
	
	for(i=0;i<n;i++){
		scanf("%d",&A[i]);
	}
	
	q=partition(0,n-1);
	
	for(i=0;i<n;i++){
		if(i)printf(" ");
		if(i==q)printf("[");
		printf("%d",A[i]);
		if(i==q)printf("]");
	}
	
	printf("\n");
	return 0;
}



Measured memory_bytes: 2132
#include<algorithm>
#include<cstring>
#include<cctype>
#include<cstdio>
#define rep(i,x,y) for(int i=x; i<=y; ++i)

using namespace std;
const int N=2005,INF=1000000000;
int n,h[N],cnt,siz[N],L[N],R[N],ans;
struct edge{int v,n;} e[N<<1];
char s[N];

int getint()
{
	char ch;
	while(!isdigit(ch=getchar()));
	int x=ch-48;
	while(isdigit(ch=getchar())) x=x*10+ch-48;
	return x;
}

void addedge(int u,int v)
{
	e[cnt]=(edge){v,h[u]},h[u]=cnt++;
	e[cnt]=(edge){u,h[v]},h[v]=cnt++;
}

void dfs(int x,int fa)
{
	siz[x]=s[x]=='1',L[x]=R[x]=0;
	int mx=0;
	for(int i=h[x]; i!=-1; i=e[i].n)
		if(e[i].v!=fa)
		{
			dfs(e[i].v,x);
			siz[x]+=siz[e[i].v];
			L[e[i].v]+=siz[e[i].v];
			R[e[i].v]+=siz[e[i].v];
			R[x]+=R[e[i].v];
			if(!mx || L[mx]<L[e[i].v]) mx=e[i].v;
		}
	for(int i=h[x]; i!=-1; i=e[i].n)
		if(e[i].v!=fa && e[i].v!=mx)
			L[x]+=min(R[e[i].v],L[mx]);
	L[x]=max(L[mx]-L[x],R[x]&1);
}

int main()
{
	n=getint(),scanf("%s",s+1);
	memset(h,-1,sizeof(h));
	rep(i,1,n-1) addedge(getint(),getint());
	ans=INF;
	rep(i,1,n)
	{
		dfs(i,0);
		if(!L[i]) ans=min(ans,R[i]>>1);
	}
	printf("%d\n",ans==INF?-1:ans);
	return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
using namespace std;

int main(){
	int n;
	scanf("%d\n", &n);

	int A[n];

	for(int i=0; i<n; i++) scanf("%d", &A[i]);

	for(int i=n-1; i>0; i--) printf("%d ", A[i]);
	printf("%d\n", A[0]);
}


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

int main(void){
    /*宣言部*/
    unsigned int input, answer=0, x, y, flag;    /*input:素数の全体数 answer:素数の総数 x, y:ループ変数 flag:フラグ*/
    long prime[10000], limit;    /*prime:素数 limit:素数調査のループ最大値*/
    
    /*入力部*/
    scanf("%u", &input);    /*全体数を読み取る*/
    for(x=0; input>x; x++){    /*素数をすべて読み取る*/
        scanf("%ld", &prime[x]);
    }
    
    /*計算部*/    /*2から判定対象未満までの数で、割り切れるかどうかで素数か判定する*/
    for(x=0; input>x; x++){
        limit=sqrt((float)prime[x]);
        for(y=2, flag=1; limit>=y; y++){    /*割り切れた時点でその数に対しての調査をやめる*/
            if(0==prime[x]%y){
                flag=0;
                break;
            }
        }
        if(1==flag){
            answer += 1;
        }
    }
    
    /*表示部*/
        printf("%u\n", answer);    /*素数の総数を表示する*/
    
    return 0;
}

Measured memory_bytes: 684
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define int long long
#define FOR(i, m, n) for(int i = m;i < n;i++)
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1000000007;
const long long INF = 1LL << 60;
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    string s; cin >> s;
    bool flag = true;
    rep(i,s.size()){
        if((i % 2 == 0 && s[i] == 'L') || (i % 2 == 1 && s[i] == 'R')){
            flag = false;
        }
    }
    cout << ((flag) ? "Yes":"No") << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<math.h>
using namespace std;

int main() {
	int k, s;
	cin >> k >> s;
	int ans = 0;
	int limit = min(k, s);
	for (int x = 0; x <= limit; x++) {
		for (int y = 0; y <= limit; y++) {
			if (s - (x + y) >= 0 && k >= s - (x + y)) {
				ans++;
			}
			
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
def main():
    a, b, k = map(int, input().split())
    if k >= a and b >= k-a:
        print(0, b-(k-a))
    elif k >= a and b < k-a:
        print(0, 0)
    else:
        print(a-k, b)
        
if __name__ == '__main__':
    main()



Measured memory_bytes: 9032
#include<iostream>
#include<string>
using namespace std;
int main(){
    string x;
    while(true){
        int answer;
        answer=0;
        cin>>x;
        if(x[0]=='0')break;
        for(int i=0;i<x.size();i++){
            answer+=x[i]-'0';
        }
        cout<<answer<<endl;
    }
    return 0;
}

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

using ll = long long;

template<typename T>
T gcd(T a, T b)
{
	if (a < b)	return gcd(b, a);
	T r;
	while ((r = a % b))
	{
		a = b;
		b = r;
	}
	return b;
}

template<typename T>
T lcm(T a, T b)
{
	return a * b / gcd(a, b);
}

template<typename T>
T ext_gcd(T a, T b, T& x, T& y)
{
	x = 1;
	y = 0;
	T x0 = 0, y0 = 1;
	while (b != 0)
	{
		T q = a / b;
		a -= q * b;
		swap(a, b);
		x -= q * x0;
		swap(x, x0);
		y -= q * y0;
		swap(y, y0);
	}
	return a;
}

template<typename T>
T inv_mod(T a, T mod)
{
	T t1, t2;
	ext_gcd(a, mod, t1, t2);
	t1 %= mod;
	if (t1 < 0)		t1 += mod;
	return t1;
}

template<typename T>
T combination_large(T n, T k, T mod)
{
	if (n < k || n < 0 || k < 0)	return 0;
	vector<T> inv(n + 1, 1), fact(n + 1, 1), fact_inv(n + 1, 1);
	for (T i = 2; i <= n; ++i)
	{
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		fact[i] = (fact[i - 1] * i) % mod;
		fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
	}
	return fact[n] * (fact_inv[k] * fact_inv[n - k] % mod) % mod;
}

template<typename T>
T combination(T n, T k, T mod = 1)
{
	vector<vector<T>> table(n + 1, vector<T>(k + 1, 1));
	for (T i = 1; i <= n; ++i)
	{
		table[i][0] = 1;
		for (T j = 1; j <= n; ++j)
		{
			table[i][j] = (table[i - 1][j - 1] + table[i - 1][j]) % mod;
		}
	}
}


int main(int, char**)
{
	long long N;
	scanf("%lld",&N);
	unordered_set<string> s;
	for(int i = 0 ; i < N ; i++){
		string tmp;
		cin >> tmp;
		s.insert(tmp);
	}

	cout << s.size() << endl;

	return 0;
}


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

vector<vector<int>> dp(10010, vector<int>(10010, 999999999));
vector<int> A(10010), B(10010);
int H, N; 

void input(){
    cin >> H >> N;
    for (int i=0; i<N; i++){
        cin >> A.at(i) >> B.at(i);
    }
    return;
}

void DP(){
    dp.at(0).at(0)=0;
    for(int i=0; i<N; i++){
        for (int j=0; j<=H; j++){
            if(A.at(i)>=j){//今考える魔法が与えるダメージが体力j以上のとき（＝一撃で倒せるとき）
                dp.at(i+1).at(j)=min(dp.at(i).at(j), B.at(i));
            } else{
                dp.at(i+1).at(j)=min(dp.at(i).at(j), dp.at(i+1).at(j-A.at(i))+B.at(i));
            }
        }
    }
    return;
}

void output(){
    cout << dp.at(N).at(H) << endl;
    return;
}

int main(){
    input();
    DP();
    output();
    return 0;
}

Measured memory_bytes: 392064
#include<stdio.h>
#include<stdio.h>
#include<iostream>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<bitset>
#include<set>
#include<deque>
#include<queue>
#include<vector>
//#include<unordered_map>
#include<map>
#include<stack>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define Pii pair<ll,int>
#define m_p make_pair
#define l_b lower_bound
#define u_b upper_bound
const int inf = 0x3f3f3f3f;
const ll linf = 0x3f3f3f3f3f3f3f3f;
const int maxn = 1e3 + 11;
const int maxm = 600 + 11;
const int mod = 1e9 + 7;
const double eps = 1e-5;
inline ll rd() { ll x = 0, f = 1; char ch = getchar(); while (ch<'0' || ch>'9') { if (ch == '-')f = -1; ch = getchar(); }while (ch >= '0'&&ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }return x * f; }
inline ll qpow(ll a, ll b, ll p) { ll res = 1; while (b) { if (b & 1) { res *= a; res %= p; }b >>= 1; a = a * a%p; }return res; }
inline ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a%b); }
//iterator
//head
//priority_queue
ll X[maxn],Y[maxn];
ll d[maxn]; 
int len=0;
void Print(ll x,ll y){
	for(int i=1;i<=len;i++){
		if(abs(x)>abs(y)){
			if(x>0) x-=d[i],printf("R");
			else x+=d[i],printf("L");
		}
		else{
			if(y>0) y-=d[i],printf("U");
			else y+=d[i],printf("D");
		}
	}
	puts("");
}
void run(){
	int n=rd();
	int z=0,f=0;
	for(int i=1;i<=n;i++){
		X[i]=rd(),Y[i]=rd();
		if(abs(X[i]+Y[i])%2) z=1;
		else f=1;  
	}
	if(z&&f) {
		puts("-1");
		return;
	}
	
	for(int i=30;i>=0;i--){
		d[++len]=(1ll<<i);
	}
	if(f) d[++len]=1;
	printf("%d\n",len);
	for(int i=1;i<=len;i++){
		if(i==len) printf("%lld\n",d[len]);
		else printf("%lld ",d[i]);
	} 
	for(int i=1;i<=n;i++){
		Print(X[i],Y[i]);
	}
}
int main() {
	run();
}

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

#define MaxN 100005

using namespace std;

int N,v[MaxN],Max=0,L,pos,S=0;

int main()
{
    cin>>N>>L;
    for(int i=1;i<=N;i++)
    {
        cin>>v[i];
        if(i>2)
            S-=v[i-2];
        S+=v[i];
        if(Max<S)
        {
            Max=S;
            pos=i-1;
        }
    }
    if(Max<L)
    {
        cout<<"Impossible";
        return 0;
    }
    cout<<"Possible\n";
    for(int i=1;i<pos;i++)
        cout<<i<<"\n";
    for(int i=N-1;i>=pos;i--)
        cout<<i<<"\n";
    return 0;
}


Measured memory_bytes: 1152
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N = int(input())
adj = [set() for _ in range(N)]
colors = dict()
ed = []
for i in range(N-1):
    a, b = map(lambda x: int(x)-1, input().split())
    adj[a].add(b)
    adj[b].add(a)
    ed.append([a, b])

col = max(len(v) for v in adj)

s = -1
for i, a in enumerate(adj):
    if len(a) == col:
        s = i
        break

Q = [[s, -1, -1]]
while Q:
    cur, prev, NG = Q.pop()
    c = 0
    for nex in adj[cur]:
        if nex == prev:
            continue
        else:
            c += 1
        if c == NG:
            c += 1
        colors[min(cur, nex)*N + max(cur, nex)] = c
        Q.append([nex, cur, c])
print(col)
for a, b in ed:
    print(colors[a*N + b])


Measured memory_bytes: 99744
#include<iostream>
using namespace std;
int a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int main()
{
    int b,c;
    cin>>b>>c;
    if(a[b-1]==a[c-1]) 
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}

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

using namespace std;

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

    int n;
    cin >> n;
    if (n <= 111) {
        cout << 111 << endl;
    } else if (n <= 222) {
        cout << 222 << endl;
    } else if (n <= 333) {
        cout << 333 << endl;
    } else if (n <= 444) {
        cout << 444 << endl;
    } else if (n <= 555) {
        cout << 555 << endl;
    } else if (n <= 666) {
        cout << 666 << endl;
    } else if (n <= 777) {
        cout << 777 << endl;
    } else if (n <= 888) {
        cout << 888 << endl;
    } else if (n <= 999) {
        cout << 999 << endl;
    }
    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 num = sc.nextInt();
        int q = num / 100;
        int r = num % 100;
        for(int i = 0; i < q; i++){
        	if(r >= 5){
            	r -= 5;
            }else if(r >= 4){
            	r -= 4;
            }else if(r >= 3){
            	r -= 3;
            }else if(r >= 2){
            	r -= 2;
            }else if(r >= 1){
            	r -= 1;
            }
        }
        if(r == 0){
        	System.out.println("1");
        }else{
        	System.out.println("0");
        }
	}
}

Measured memory_bytes: 35660
def check(string):
    if(len(set(string)) <= 2):
        return True
    else:
        return False

if __name__ == '__main__':
    s = input()
    l = len(s)
    if(l == 2 and len(set(s)) == 2):
        print("-1 -1")
    elif(l == 2 and len(set(s)) == 1):
        print("1 2")
    else:
        for j in range(l - 2):
            if(check(s[j:j+3])):
                print(j + 1, ' ', j + 3)
                break
            elif(j == l - 3):
                print("-1 -1")


Measured memory_bytes: 3316
/*
*/

#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>

#include <memory.h>
#include <assert.h>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds
#define ends asdgahhfdsfshdshfd
#define prev asdgSHJsfgsdfhdsh
#define hash asdgasdgasdgdfrywewery

#define eps 1e-9
#define M_PI 3.141592653589793
#define bsize 300

#define ldouble long double
using namespace std;

#define bs 1000000007

const int N = 300031;

int n,k,ttl;
vector<pair<int,int> > edges;

void add_edge(int a,int b){
	edges.push_back(make_pair(a,b));
}

int main(){
//    freopen("apache.in","r",stdin);
//    freopen("apache.out","w",stdout);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0);
 //   cin.tie(0);

    cin>>n>>k;

    ttl=(n-1)*(n-2)/2;
    if (ttl<k){
    	cout<<-1<<endl;
    	return 0;
    }

    for (int i=2;i<=n;i++){
    	add_edge(1,i);
    }

    	for (int i=2;i<=n;i++){
    		for (int j=i+1;j<=n;j++){
    			if(ttl>k){
    			add_edge(i,j);
    			--ttl;}
    		}
    	}

    cout<<edges.size()<<endl;
    for (int i=0;i<edges.size();i++){
    	cout<<edges[i].first<<" "<<edges[i].second<<endl;
    }

//    cin.get(); cin.get();
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define PN cout << endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (n-1); i >= (int)(m); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - (a)) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - (a)) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

/*
ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
*/

/*
vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}
*/

/*
ll ncr[100][100];
ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

ll npr[100][100]={};
ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

ll nHr(int n,int r){ret nCr(n+r-1,r);}
*/

///////////////////////////////////////////////////////////////////////////



int main(){

    ll h,w;
    cin >> h >> w;

    if(h == 1 || w == 1){
	P(1);
       
    }else if(w&1){
	if(h&1){
	    P((h*w+1)/2);
	}else{
	    P((h/2)*w);
	}
    }else{
	P((w/2)* h);
    }
    return  0;
}


Measured memory_bytes: 256