akhauriyash/Code-Regression huggingface dataset:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


class Flow():
    def __init__(self, e, N):
        self.E = e
        self.N = N

    def max_flow(self, s, t):
        r = 0
        e = self.E

        def f(c, cap):
            v = self.v
            v[c] = 1
            if c == t:
                return cap
            for i in range(self.N):
                if v[i] or e[c][i] <= 0:
                    continue
                cp = min(cap, e[c][i])
                k = f(i, cp)
                if k > 0:
                    e[c][i] -= k
                    e[i][c] += k
                    return k
            return 0

        while True:
            self.v = [None] * self.N
            fs = f(s, inf)
            if fs == 0:
                break
            r += fs

        return r


def main():
    n = I()
    a = LI()

    s = n
    t = n + 1
    e = [[0] * (n+2) for _ in range(n+2)]
    for i in range(n):
        c = a[i]
        if c < 0:
            e[s][i] = -c
            ii = i + 1
            for j in range(ii*2, n+1, ii):
                e[i][j-1] = inf
        else:
            e[i][t] = c


    fl = Flow(e, n+2)
    r = fl.max_flow(s,t)

    return sum(map(lambda x: max(0,x), a)) - r

# start = time.time()
print(main())
# pe(time.time() - start)





Measured memory_bytes: 10956
#include <stdio.h>
int main() {
  int w,h,x,y,r;
  scanf("%d %d %d %d %d", &w, &h, &x, &y, &r);
  printf("%s\n", w>=x+r&&0<=x-r&&h>=y+r&&0<=y-r?"Yes":"No");
  return 0;
}

Measured memory_bytes: 584
#include <iostream>
#include <algorithm>

using namespace std;

void solve() {
    int n;
    long long t1, t2, ans, t;
    ans = 0;
    cin >> n >> t;
    cin >> t1;
    t1 = t2 = 0;
    for (int i=1;i<n; ++i) {
        cin >> t1;
        ans += min(t1 - t2, t);
        t2 = t1;
    }
    ans += t;
    cout << ans;

}

int main() {

    solve();
    return 0;
}


Measured memory_bytes: 3092
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

void Delete_space(char *str){
	char *p = str;

	while (*str != '\0'){
		if (!isspace(*str)){
			*p = *str;
			p++;
		}
		str++;
	}
	*p = '\0';
}

int main(){
	int i=0, j=0,k=0;
	char a[128], a2[128];
	char op;
	int x, y, z[128] = { 0 };


	for (k= 0;; k++){
		i = 0;
		op = 0;
		x = 0;
		y = 0;
		for (j = 0; j < 128; j++){
			a[j] = 0;
			a2[j] = 0;
			
		}
		gets(a);

		Delete_space(a);

		for (j = 0; a[i] >= '0'&&a[i]<='9'; i++){
			a2[j] = a[i]; j++;
		}
		a2[j] = '\0'; x = atoi(a2);

		op = a[i]; i++;
		if (strstr(a,"?")!=NULL){
			break;
		}
		for (j = 0; a[i] >= '0'&&a[i] <= '9'; i++){
			a2[j] = a[i]; j++;
		}
		a2[j] = '\0'; y = atoi(a2);


		switch (op){
		case '+': z[k] = x + y; break;
		case '-': z[k] = x - y; break;
		case '*': z[k] = x * y; break;
		case '/': z[k] = x / y; break;
		case '%': z[k] = x % y; break;
		}

	}
	for (j = 0; j <k; j++){
		printf("%d\n", z[j]);
	}


	return 0;
}

Measured memory_bytes: 956
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string a,b,c;
	int n=0,s=0,x;
	cin>>a>>b;
	c=a+b;
    for (int i=0;i<=c.size()-1;i++)	
	{
		n=n*10+(c[i]-'0');
		if (c[i]=='0'&&x) s++;
		else x=0;
	}
    if (int(sqrt(n))==sqrt(n)) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
	return 0;
} 

Measured memory_bytes: 256
N = gets.to_i
longeurs = gets.split(' ').map(&:to_i).sort

ans = 0
for i in 1..N-2 do
  for j in i+1..N-1 do
    l = longeurs[j..-1]
    num = l.bsearch_index{|x| x >= longeurs[i-1] + longeurs[j-1]}
    if num != nil then
      ans += num
    else
      ans += l.length
    end
  end
end
  
print ans

Measured memory_bytes: 14352
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int n, m;
int a[303030];
bool isok[303030];
int cnt;
int b[303030];
int main(){
	cin >> n;
	REP(i, n){
		cin >> a[i];
		b[i] = a[i];
	}
	sort(b, b + n);
	REP(i, n){
		if(a[i] == b[i]){
			isok[i] = true;
		}else{
			cnt++;
		}
	}
	if(cnt == 0){
		cout << 0 << endl;
		return 0;
	}
	cin >> m;
	int x, y;
	REP(i, m){
		cin >> x >> y;
		x--, y--;
		if(isok[x])cnt++;
		isok[x] = false;
		if(isok[y])cnt++;
		isok[y] = false;
		swap(a[x], a[y]);
		if(a[x] == b[x])cnt--, isok[x] = true;
		if(a[y] == b[y])cnt--, isok[y] = true;
		if(cnt == 0){
			cout << i + 1 << endl;
			return 0;
		}
	}
	cout << -1 << endl;
}


Measured memory_bytes: 5820
#include <cstdio>
#include <cstring>

using namespace std;

int N;
char S[105];
int pointer;
bool ans;

int main()
{
  scanf("%d", &N);
  scanf(" %s", S);
  if (N % 2 == 1)
  {
    printf("No\n");
  }
  else
  {
    pointer = N / 2;
    ans = true;
    for (int i = 0; i < pointer && ans; i++)
    {
      if (S[i] != S[pointer + i])
      {
        ans = false;
      }
    }
    printf(ans ? "Yes\n" : "No\n");
  }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define repc2(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define inf 2e9
#define linf 9000000000000000000ll
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int h, w, k;
bool color[6][6];

int main() {
    cin >> h >> w >> k;
    char c;
    rep(y, h) rep(x, w) {
        cin >> c;
        color[y][x] = (c == '.');
    }
    ll ans = 0;
    for (int bit_y = 0; bit_y < (1 << h); bit_y++) {
        for (int bit_x = 0; bit_x < (1 << w); bit_x++) {
            int cnt = 0;
            rep(y, h) rep(x, w) {
                if (!color[y][x] && !((bit_y >> y) & 1) && !((bit_x >> x) & 1)) cnt++;
            }
            if (cnt == k) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
/*********************
*  Author: xuziyuan  * 
*********************/

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))

using namespace std;

const LL MOD=1e9+7;

int n,a[200010],b[200010];
vector <int> ans;

int main()
{
	cin>>n;
	rep(i,n) cin>>a[i];
	for(int i=n-1;i>=0;i--)
	{
		int num=0;
		for(int j=i*2+1;j<n;j+=i+1) num+=b[j];
		b[i]=a[i]^(num%2);
		if(b[i]==1) ans.pb(i+1);
	}
	cout<<ans.size()<<endl;
	rep(i,ans.size()) cout<<ans[i]<<' ';
	cout<<endl;
	return 0;
}

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define M 1000000007
#define N 1000016
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define f first
#define s second
#define inf 9000000000000000000
ll d[100010][3],a[N],b[N],c[N],n;

ll dp(ll ind, ll typ) {

    if(ind>n)
        return 0;

    if(d[ind][typ]!=inf)
        return d[ind][typ];

    if(typ==0)
        return d[ind][typ] = max(b[ind] + dp(ind+1, 1), c[ind] + dp(ind+1, 2));
    if(typ==1)
        return d[ind][typ] = max(a[ind] + dp(ind+1, 0), c[ind] + dp(ind+1, 2));
    if(typ==2)
        return d[ind][typ] = max(b[ind] + dp(ind+1, 1), a[ind] + dp(ind+1, 0));
}
int main()
{
   ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    cin>>n;
    for(ll i=1; i<=n; i++) {
        cin>>a[i]>>b[i]>>c[i];
        d[i][1] = inf;
        d[i][2] = inf;
        d[i][0] = inf;
    }

    ll ans = max(a[1]+dp(2, 0), max(b[1]+dp(2, 1), c[1]+dp(2, 2)));

    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 17152
#include<bits/stdc++.h>
using namespace std;
const int maxn=(1<<18)+233,mod=1000000007;
inline void Add(int &a,int b){a=a+b>=mod?a+b-mod:a+b;}
int H,p[maxn],sum[maxn],ans=0;
inline void addit(int x,int opt){for(;x;x>>=1)opt=1ll*opt*x%mod,Add(sum[x],opt);}
inline void Addit(int x,int opt)
{
	opt=1ll*opt*x%mod;
	if(x>=(1<<(H-1))) return (void)addit(p[x],opt);
	Addit(x<<1,opt);Addit(x<<1|1,opt);
}
inline void getans(int x,int opt){for(;x>1;x>>=1)opt=1ll*opt*x%mod,Add(ans,1ll*opt*(x>>1)%mod*sum[x^1]%mod);}
inline void Getans(int x,int opt)
{
	opt=1ll*opt*x%mod;
	if(x>=(1<<(H-1))) return (void)getans(p[x],opt);
	Getans(x<<1,opt);Getans(x<<1|1,opt);
}
int main()
{
	scanf("%d",&H);
	for(int i=(1<<(H-1));i<(1<<H);i++) scanf("%d",p+i),p[i]+=(1<<(H-1))-1;
	for(int i=1;i<(1<<(H-1));i++) Addit(i<<1,i),Getans(i<<1|1,1),Addit(i<<1,mod-i);
	cout<<ans<<endl;
}

Measured memory_bytes: 5292
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
# def LIST(): return list(map(str, input().split()))
# def LIST(): return list(input())

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
L = [LIST() for i in range(N)]

dp = [[0] * 3 for i in range(N)]
# dp_b = [0] * N
# dp_c = [0] * N
dp[0][0] = L[0][0]
dp[0][1] = L[0][1]
dp[0][2] = L[0][2]
for i in range(1, N):
    # dp_a[i+1] = max(dp_a[i]+, )
    # for abc in range(3):
    dp[i][0] = max(dp[i-1][1]+L[i][0], dp[i-1][2]+L[i][0])
    dp[i][1] = max(dp[i-1][2]+L[i][1], dp[i-1][0]+L[i][1])
    dp[i][2] = max(dp[i-1][0]+L[i][2], dp[i-1][1]+L[i][2])

ans = 0
for i in range(3):
    if ans < dp[N-1][i]:
        ans = dp[N-1][i]
print(ans)



Measured memory_bytes: 92120
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

int32_t main()
{
	//freopen("input.txt", "r", stdin);
	IOS;
	
	int x; cin >> x;
	if(x >= 400 && x <= 599) cout << "8";
	else if(x >= 600 && x <= 799) cout << "7";
	else if(x >= 800 && x <= 999) cout << "6";
	else if(x >= 1000 && x <= 1199) cout << "5";
	else if(x >= 1200 && x <= 1399) cout << "4";
	else if(x >= 1400 && x <= 1599) cout << "3";
	else if(x >= 1600 && x <= 1799) cout << "2";
	else if(x >= 1800 && x <= 1999) cout << "1";
	return 0;
}

Measured memory_bytes: 3636
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
  public static void main(String[] args) {
	  FastReader sc = new FastReader();
	  String a = sc.next();
	  String b = sc.next();
	  String c = sc.next();
	  int posA = 0;
	  int posB = -1;
	  int posC = -1;
	  char turn = 'a';
	  while (posA < a.length() && posB < b.length() && posC < c.length()) {
		  switch (turn) {
		  	  case 'a':
		  		  posA++;
		  		  if (posA == a.length()) {
		  			  System.out.println("A");
		  			  System.exit(0);
		  		  }
		  		  turn = a.charAt(posA);
		  		  break;
		  	  case 'b':
		  		  posB++;
		  		  if (posB == b.length()) {
		  			  System.out.println("B");
		  			  System.exit(0);
		  		  }
		  		  turn = b.charAt(posB);
		  		  break;
		  	  case 'c':
		  		  posC++;
		  		  if (posC == c.length()) {
		  			  System.out.println("C");
		  			  System.exit(0);
		  		  }
		  		  turn = c.charAt(posC);
		  		  break;
		  }
	  }
  }
  
  static class FastReader {
    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }
  
    String next() { 
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException  e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

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

    long nextLong() {
      return Long.parseLong(next());
    }

    double nextDouble() { 
      return Double.parseDouble(next());
    }

    String nextLine() {
      String str = "";
        try{
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
      }
  }
}


Measured memory_bytes: 21204
#include<stdio.h>
#include<string.h>
int main(void){
  int A,B,C,D,K,i;
  scanf("%d %d %d",&A,&B,&K);
  C = B-K+1;
  D = B-A;
  if(B-A<2*K){
    for(i=0;i<=D;i++){
      printf("%d\n",A);
      //printf("あ");
      A++;
    }
  }else{
    for(i=0;i<K;i++){
      printf("%d\n",A);
      //printf("い");
      A++;
    }
    for(i=0;i<K;i++){
      printf("%d\n",C);
      //printf("う");
      C++;
    }    
  }
  return 0;
}

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

int main() {
  int N, dan = 1;
  cin >> N;
  vector<int> mochi(N);
  
  for (int i = 0; i < N; i++) {
    cin >> mochi.at(i);
  }
  
  sort(mochi.begin(), mochi.end());   //並べ替え
  
  for (int i = 1; i < N; i++) {  
    if (mochi.at(i - 1) < mochi.at(i)) {
      dan++;
    }
  }
  
  cout << dan << endl;
}

Measured memory_bytes: 256
#if loc||local
#define _GLIBCXX_DEBUG
#endif

#include<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = 1LL<<60;
constexpr ll MOD = 1e9+7;
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;}
#if loc||local
template<class T>void dump(T&& t){cerr<<t<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}

signed main(){

  int n;
  double d;
  cin>>n>>d;
  int ans = 0;
  auto f = [](auto a,auto b){
    return sqrt(a*a+b*b);
  };
  rep(i,n){
    double a,b;
    cin>>a>>b;
    if(f(a,b)<=d)ans++;
  }
  cout<<(ans)<<endl;

}

Measured memory_bytes: 3708
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	long long N,M; cin>>N>>M;
	
	vector<long long> x(M,0),diff(M-1,0);
	for(int i=0;i<M;i++) cin>>x[i];
	sort(x.begin(),x.end());
	for(int i=0;i<M-1;i++) diff[i]=x[i+1]-x[i];
	sort(diff.begin(),diff.end());

	long long ans=0;
	if(N>=M) cout<<ans<<endl;
	else{
		for(int i=0;i<M-1-N+1;i++){
			ans+=diff[i];
		}
		cout<<ans<<endl;
	}

	return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner;

//Baseball Simulation
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		while(t--!=0){
			int run = 0;
			int p = 0;
			int out = 0;
			while(out < 3){
				String c = sc.next();
				if(c.equals("HIT")){
					if(run<3)run++;
					else p++;
				}
				else if(c.equals("HOMERUN")){
					p += run+1;
					run = 0;
				}
				else{
					out++;
				}
			}
			System.out.println(p);
		}
	}
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
using namespace std;
#define ll   long long int
#define T int t; cin>>t; while(t--)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define PI 3.141592653589793238462643383



int main (){
    fast;

    int n;
    cin>>n;
    int l[n];

    for(int i=0;i<n;i++){
        cin>>l[i];
    }
    sort(l,l+n);
    int a,b,c;
    int ans = 0;
    for(int i=0;i<n-2;i++){
        for(int j=i;j<n-1;j++){
            for(int k=j;k<n;k++){
                a = l[i];
                b = l[j];
                c = l[k];
                if(a + b > c and a!=b and b!=c and c!= a) ans++;
            }
        }
    }
    cout<<ans<<endl;
}











Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M;
  
  cin >> N >> M;
  vector<int> vec(M);
  for (int i = 0; i <M; i++) {
    cin >> vec.at(i);
  }
  int sum = 0;
  for(int i=0;i<M;i++){
  sum = sum + vec.at(i);
  }
  int ans = N - sum;
  if(sum > N){
  ans = -1;
  }
  cout<< ans << endl;
  
 return 0; 
}

Measured memory_bytes: 3592
def solve(k,a,b):
    if a >= b:
        return 1+k
    if k <= a-1:
        return 1+k
    diff = b-a
    if diff <= 2:
        return 1+k

    k -= a-1
    ans = a

    r = int(k / 2)
    ans += diff * r;
    if k % 2:
        ans += 1
    return ans

k,a,b=map(int, raw_input().split(' '))
print solve(k,a,b)

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

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<double, double> P;
const ll INF = 1e15;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
//const ll mod = 1e10;
typedef priority_queue<string, vector<string>, greater<string> > PQ_ASK;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}

    mint &operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }

    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }

    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const {
        return pow(mod - 2);
    }

    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }

    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }

    friend std::istream &operator>>(std::istream &in, mint &o) {
        ll a;
        in >> a;
        o = a;
        return in;
    }

    friend std::ostream &operator<<(std::ostream &out, const mint &o) {
        out << o.x;
        return out;
    }

};


mint choose(ll n, ll a) {
    mint bunshi = 1;
    for (ll i = 0; i < a; i++) {
        bunshi *= (n - i);
    }
    mint bunbo = 1;
    for (ll i = 0; i < a; i++) {
        bunbo *= (1 + i);
    }

    return bunshi / bunbo;
}

int main() {

    ll n, a, b;
    cin >> n >> a >> b;

    mint all = mint(2).pow(n) - 1;

    mint ac = choose(n, a);
    mint bc = choose(n, b);

    mint ans = all - ac - bc;

    cout << ans << endl;
}


Measured memory_bytes: 768
n = int(input())
r = [list(map(int, input().split())) for _ in range(n)]
r.sort(key=lambda x: x[1], reverse=True)  # redはyを昇順でソート
b = [list(map(int, input().split())) for _ in range(n)]
b.sort()  # blueはxが降順にソート
cnt = 0  # cntの初期の設定
for i in range(n):  # blueのxが小さい方から全探索
    for j in range(len(r)):
        if r[j][0] < b[i][0] and r[j][1] < b[i][1]:
            cnt += 1
            r.pop(j)
            break
print(cnt)


Measured memory_bytes: 3064
def main():
    n,m = map(int,input().split())

    x = []
    for i in range(n):
        a,b = map(int,input().split())
        x.append((a,b))

    ans,ct = 0,0
    for a,b in sorted(x):
        for _ in range(b):
            ans += a
            ct += 1
            if ct == m:
                return ans
    return -1

if __name__ == "__main__":
    print(main())


Measured memory_bytes: 17800
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
from bisect import bisect_left
from itertools import product
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def LF(): return list(map(float, input().split()))
def LC(): return [c for c in input().split()]
def LLI(n): return [LI() for _ in range(n)]
def NSTR(n): return [input() for _ in range(n)]

def array2d(N, M, initial=0):
    return [[initial]*M for _ in range(N)]

def copy2d(orig, N, M):
    ret = array2d(N, M)
    for i in range(N):
        for j in range(M):
            ret[i][j] = orig[i][j]
    return ret


INF = float("inf")
MOD = 10**9 + 7


def main():
    X, K, D = MAP()

    # 到達候補は0に近い正と負の二つの数
    d, m = divmod(X, D)
    cand = (m, m-D)

    if X >= 0:
        if K <= d:
            print(X-K*D)
            return
        else:
            rest = (K-d)
            if rest % 2 == 0:
                print(cand[0])
                return
            else:
                print(-cand[1])
                return
    else:
        if K <= -d-1:
            print(abs(X+K*D))
            return
        else:
            rest = K-(-d-1)
            if rest % 2 == 0:
                print(-cand[1])
                return
            else:
                print(cand[0])
                return
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9264
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		String[] arrayO = sc.next().split("");
		String[] arrayE = sc.next().split("");

		for (int i=0;i<arrayE.length;i++) {
			System.out.print(arrayO[i]);
			System.out.print(arrayE[i]);
		}
		
		if (arrayO.length != arrayE.length){
			System.out.print(arrayO[arrayO.length-1]);
		}

	}
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

class BIT
{
public:
    vector<int> bit;
    int M;

    BIT(int M):
        bit(vector<int>(M+1, 0)), M(M) {}

    int sum_(int i) {
        if (!i) return 0;
        return bit[i] + sum_(i-(i&-i));
    }

		int sum(int i){
			return sum_(i+1);
		}

    void add_(int i, int x) {
        if (i > M) return;
        bit[i] += x;
        add_(i+(i&-i), x);
    }
		
		void add(int i, int x){
			add_(i+1, x);
		}
};

#define N 112345
int a[N];
multiset<int> s;

int main(){
	int n; scanf("%d", &n);
	REP(i, n){
		scanf("%d", a+i);
	}
	int ans = 0;
	for(int i = n-1; i>=0; i--){
		auto it = s.upper_bound(a[i]);
		if(it == s.end()){
			ans++;
		} else {
			s.erase(it);
		}
		s.insert(a[i]);
	}
	printf("%d\n", ans);
}





Measured memory_bytes: 5376
// https://atcoder.jp/contests/abc171/tasks/abc171_d

#include <bits/stdc++.h>
using namespace std;
#define watch(x) cerr << (#x) << " is " << (x) << endl;
#define endl '\n' 
#define int long long

const int maxn = 100500;

map<int, int> cnt;

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

    int N;
    cin >> N;

    int sum = 0;
    for(int i = 1; i <= N; i++) {
        int a;
        cin >> a;
        sum += a;
        cnt[a]++;
    }

    int Q;
    cin >> Q;
    for(int i = 1; i <= Q; i++) {
        int b, c;
        cin >> b >> c;

        sum -= cnt[b]*b;
        sum += cnt[b]*c;

        cnt[c] += cnt[b];
        cnt[b] = 0;

        cout << sum << endl;
    }
}


Measured memory_bytes: 9576
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int x = sc.nextInt();
		int[] a = new int[N];
		long cnt = 0;
		for(int i = 0 ; i < N ; i++) {
			a[i] = sc.nextInt();
		}
		for(int i = 0 ; i < N - 1 ; i++) {
			if(a[i] + a[i + 1] > x) {
				cnt += a[i] + a[i + 1] - x;
				if(a[i] > x) {
					a[i + 1] = 0;
				} else {
					a[i + 1] = x - a[i];
				}
			}
		}
		System.out.println(cnt);
	}
}


Measured memory_bytes: 50368
n = int(input())
ans = 0
tbl1 = [[0]*10 for i in range(10)]
tbl2 = [[0]*10 for i in range(10)]
# for j in range(10):
#     for k in range(10):
#         cnt1 = 0
#         cnt2 = 0
#         for i in range(1,n+1):
#             s = str(i)
#             if s[0] == str(k)and s[-1] == str(j):
#                 cnt1 += 1
#             if s[0] == str(j) and s[-1] == str(k):
#                 cnt2 += 1
#         ans += cnt1*cnt2
for i in  range(1,n+1):
    s = str(i)
    for j in range(10):
        for k in range(10):
            if s[0] == str(k)and s[-1] == str(j):
                tbl1[k][j] += 1
            if s[0] == str(j) and s[-1] == str(k):
                tbl2[j][k] += 1
for j in range(10):
        for k in range(10):
            ans += tbl1[k][j] * tbl2[j][k]
print(ans)

Measured memory_bytes: 42988
from collections import Counter

inputs = list(input())

count = 10 ** 15
kinds = len(set(inputs))

def cal(inputs, item):
    re = ''
    for index in range(len(inputs)-1):
        if inputs[index] == item or inputs[index+1] == item:
            re += item
        else:
            re += inputs[index]
    return re

if kinds == 1:
    count = 0
else:
    set_inputs = set(inputs)
    for set_input in set_inputs:
        item = inputs[:]
        total = 0
        while len(set(item)) != 1:
            item = list(cal(item, set_input))
            total += 1
        count = min(count, total)

print(count)

Measured memory_bytes: 3444
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<cmath>
#include<math.h>
#include<algorithm>
#include<string.h>
#include <iomanip>
#include <sstream>
using namespace std;

int main() {
  int A, B, C;
  int ans =0;

  cin >> A >> B >> C;

  if((A - B) <= C ){
    ans = C - (A - B);
  } else{
    ans = 0;
  }

  cout << ans << endl;

}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void)
{
    int N;

    cin >> N;

    int ans = 0;
    if(11 <= N)
    {
        if(!(N & 1)) N--;

        for(int n = N; n > 11; n -= 2)
        {
            int divisor = 1;
            for(int ni = n; ni > 2; ni -= 2)
            {
                if(!(n % ni)) divisor++;
            }
            if(8 == divisor) ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <stack>
#include <queue>

using ll = long long;

int main() {
    int S;
    std::cin >> S;

    int s12 = S / 100;
    int s34 = S % 100;

    if (0 < s34&&s34 <= 12 && 0 < s12 && s12 <= 12) {
        std::cout << "AMBIGUOUS" << std::endl;
    }
    else if (0 < s34&&s34 <= 12) {
        std::cout << "YYMM" << std::endl;
    }
    else if (0 < s12 && s12 <= 12) {
        std::cout << "MMYY" << std::endl;
    }
    else {
        std::cout << "NA" << std::endl;
    }


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int n; cin >> n;
    if (n == 2) {
        int x, y;
        cin >> x >> y;
        int mx = max(x,y);
        int mn = min(x,y);
        cout << mx - mn << endl;
        cout << mx << " " << mn << endl;
        return 0;
    }
    vint pos, neg;
    vector<P> ans;
    rep(i,n) {
        int x; cin >> x;
        if (x >= 0) pos.push_back(x);
        else neg.push_back(x);
    }
    if (neg.empty()) {
        sort(all(pos));
        ans.push_back(P(pos[0],pos[1]));
        neg.push_back(pos[0]-pos[1]);
        pos.erase(pos.begin(),pos.begin()+2);
    }
    if (pos.empty()) {
        sort(rall(neg));
        ans.push_back(P(neg[0],neg[1]));
        pos.push_back(neg[0]-neg[1]);
        neg.erase(neg.begin(),neg.begin()+2);
    }
    while (pos.size() > 1) {
        ans.push_back(P(neg.back(),pos.back()));
        neg.back() -= pos.back();
        pos.pop_back();
    }
    while (neg.size() > 1) {
        ans.push_back(P(pos.back(),neg.back()));
        pos.back() -= neg.back();
        neg.pop_back();
    }
    ans.push_back(P(pos[0],neg[0]));
    cout << pos[0] - neg[0] << endl;
    rep(i,ans.size()) {
        cout << ans[i].first << " " << ans[i].second << endl;
    }
}

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "cycle"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e3 + 5;

char c[MAXN][MAXN], c1[MAXN][MAXN], c2[MAXN][MAXN];

void solve(){
	int n, m;
	scanf("%d%d", &n, &m);
	REP(i, 0, n){
		scanf("%s", &c[i][0]);
		REP(j, 0, m){
			c1[i][j] = c2[i][j] = c[i][j];
		}
	}
	if (n == 3 && m == 3){
		c1[1][1] = c2[1][1] = '#';
	} else if (n == 3){
		REP(j, 1, m - 1){
			c1[0][j] = '#';
			c2[n - 1][j] = '#';
			REP(i, 1, n - 1){
				if (j & 1){
					c1[i][j] = '#';
				} else {
					c2[i][j] = '#';
				}
			}
		}
	} else {
		REP(i, 1, n - 1){
			c1[i][0] = '#';
			c2[i][m - 1] = '#';
			REP(j, 1, m - 1){
				if (i & 1){
					c1[i][j] = '#';
				} else {
					c2[i][j] = '#';
				}
			}
		}
	}
	REP(i, 0, n){
		printf("%s\n", c1[i]);
	}
	putchar('\n');
	REP(i, 0, n){
		printf("%s\n", c2[i]);
	}
}	

int main(){

	//freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();	
	}
}

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

using namespace std;
using LL = long long;
const LL LINF = 1e18;
const LL MOD = 998244353;

int main(){
    int N;cin >> N;vector<int> vec;
    for(int a = 0;a < N;a++){
        int b;cin >> b;
        vec.push_back(b);
    }
    vector<int> ans;
    while(!vec.empty()){
        int idx = -1;
        for(int a = 0;a < vec.size();a++){
            if(vec.at(a) == a+1)idx = a;
        }
        if(idx == -1){
            cout<<-1<<endl;
            return 0;
        }else{
            ans.push_back(vec.at(idx));
            vec.erase(vec.begin()+idx);
        }
    }
    reverse(ans.begin(),ans.end());
    for(int a = 0;a < ans.size();a++){
        cout<<ans.at(a)<<endl;
    }
}


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

int main(){
  int n;cin >> n;
  int h[n+1];rep(i,n)cin >> h[i];
  int dp[n+1];
  dp[0] = 0;dp[1] = abs(h[1]-h[0]);
  for(int i=2;i<n;++i){
    dp[i] = min(dp[i-1] + abs(h[i]-h[i-1]),dp[i-2] + abs(h[i]-h[i-2]));
  }
  cout << dp[n-1] << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) REP(i,0,n)
#define int long long
#define REP(i,l,r) for(int i=l;i<r;i++)
using namespace std;
typedef pair<int,int> P;
int gcd(int a,int b){
    if(a%b==0)return b;
    else return gcd(b,a%b);
}
int lcm(int a,int b){
    return a*b/gcd(a,b);
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
struct edge{
    int to,cost;
};
class dijkstra{
    int V;
    int d[100002];
    priority_queue<P,vector<P>,greater<P>>que;
    void update(int s,vector<edge> G[]){
        fill(d,d+V+1,100000000000ll);
        d[s]=0;
        que.push(make_pair(0,s));
        while(!que.empty()){
            P p=que.top();
            que.pop();
            int v=p.second;
            if(d[v]<p.first)continue;
            rep(i,G[v].size()){
                edge e=G[v][i];
                if(d[e.to]>d[v]+e.cost){
                    d[e.to]=d[v]+e.cost;
                    que.push(make_pair(d[e.to],e.to));
                }
            }
        }
    }
public:
    dijkstra(int v,int s,vector<edge> G[]){
        V=v;
        update(s,G);
    }
    int find(int e){
        return d[e];
;    }
};
class Union_Find{
private:
    vector<int> t,s;
public:
    Union_Find(int max_length){
        rep(i,max_length+1){
            t.push_back(i);
            s.push_back(1);
        }
    }
    void Union(int x,int y){
        if(same(x,y))return;
        int tx=Find(x),ty=Find(y);
        if(s[tx]<s[ty]){
            s[ty]+=s[tx];
            t[tx]=ty;
        }
        else if(s[tx]>s[ty]){
            s[tx]+=s[ty];
            t[ty]=tx;
        }
        else if(tx>ty){
            t[tx]=ty;
            s[ty]+=s[tx];
        }
        else{
            t[ty]=tx;
            s[tx]+=s[ty];
        }
    }
    int Find(int n){
        if(t[n]==n)return n;
        else return t[n]=Find(t[n]);
    }
    bool same(int x,int y){
        return Find(x)==Find(y);
    }
    int get_Size(int a){
        return s[a];
    }
};
signed main(){
    int a,b,t;
    cin>>a>>b>>t;
    cout<<(t/a)*b<<endl;
}


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

const int maxn = 105;
int q;
const long double eps = 1e-9;

int main()
{
    scanf("%d", &q);
    for(int i = 0; i < q; i ++) {
        int a, b;
        scanf("%d%d", &a, &b);
        if(a > b)
            swap(a, b);

        long double t = (long double) a * (long double) b - 1 ;
        long double sqt = floorl(sqrtl(t));
        long double ans = 2 * sqt;
        if(fabsl(floorl(t / sqt) - sqt) <= eps)
            ans -= 1.0;
        if(a - sqt <= 0.0 )
            ans -= 1.0;
        printf("%.0Lf\n", ans);
    }
    return 0;
}


Measured memory_bytes: 256
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
n=int(input())
p=factorization(n)
ans=0
if n==1:
    print(0)
    exit()
for i in range(len(p)):
    k=1
    while p[i][1]>0:
        p[i][1]-=k
        if p[i][1]>=0:
            ans+=1
            k+=1
        else:
            break
print(ans)

Measured memory_bytes: 9504
#include <bits/stdc++.h>
// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")
using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int,int> PII;

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

#define pb push_back
#define mp make_pair
#define st first
#define nd second

const int MOD = 1000000007;

int N, M, V, P;
int A[111111];
// int B[111111];

bool can(int K) {
  if (K < P) return true;
  if (A[K] + M < A[P-1]) return false;
  if (V <= P) return true;

  LL votes_left = M * (LL)(V-P);
  FOR(i,P-1,N) {
    if (i == K) continue;
    votes_left -= min(M, A[K]+M-A[i]);
  }
  return votes_left <= 0;
}

int main() {
  // ios_base::sync_with_stdio(0);

  scanf("%d%d%d%d", &N, &M, &V, &P);
  REP(i,N) scanf("%d", &A[i]);
  sort(A, A+N);
  reverse(A,A+N);
  int L = 0, R = N-1;
  while (L < R) {
    int S = (L+R+1)/2;
    if (can(S)) {
      L = S;
    } else {
      R = S - 1;
    }
  }
  printf("%d\n", L+1);
}


Measured memory_bytes: 640
a=input()
b=""
if int(len(a))%2==0:
  for i in range(int(len(a)/2)):
    b=b+a[2*i]
  print(b)
else:
  for i in range(int(len(a)/2)+1):
    b=b+a[2*i]
  print(b)

Measured memory_bytes: 9244
n,m=map(int,input().split())
arrival=set([])
deperture=set([])
for i in range(m):
    a,b=map(int,input().split())
    if a==1:
        deperture.add(b)
    if b==n:
        arrival.add(a)

if len(arrival&deperture)>=1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Measured memory_bytes: 19024
#include <stdio.h>
int main(void){
	int W,H,x,y,r;
	scanf("%d %d %d %d %d" , &W,&H,&x,&y,&r);
	if(x>0 && y>0 && 0<=y-r && 0<=x-r && y+r<=H  && x+r<=W){/**/
		printf("Yes\n");
	}

	else{
		printf("No\n");
	}
	
	return 0;
}

Measured memory_bytes: 584
#include <iostream>                                                             
#include <vector>                                                               
#define MAX_N 1000000                                                           
                                                                                
using namespace std;                                                            
                                                                                
int MAX = -MAX_N, MIN = MAX_N;                                                  
                                                                                
int main (void) {                                                               
  int n;                                                                        
  long long sum=0;                                                              
  long long a;                                                                  
  vector<int> v;                                                                
  cin >> n;                                                                     
  for (int i=0; i<n; i++) {                                                     
    cin >> a;                                                                   
    v.push_back(a);                                                             
    MIN = min(v[i],MIN);                                                        
    MAX = max(v[i],MAX);                                                        
    sum += v[i];                                                                
  }                                                                             
  cout << MIN << " " << MAX << " " << sum << endl;                              
}                                                                               
                                       

Measured memory_bytes: 3240
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int Y = scan.nextInt();

        for (int a=0; a<=N; a++) {
            for (int b=0; b<=N-a; b++) {
                 int c = N - a - b;
                 int total = a * 10000 + b * 5000 + c * 1000;
                if (total == Y) {
                    System.out.println(a + " " + b + " " + c);
                    return;
                }
            }
        }

        System.out.println("-1 -1 -1");
    }
}

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

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}
ll N, C;
ll imos[31][100010];
const int SPAN = 100002;
signed main() {
	cin >> N >> C;
  rep(i, N) {
    ll s, t, c;
    cin >> s >> t >> c;
    s--, c--;
    imos[c][s]++;
    imos[c][t]--;
  }
  for(int i = 0; i < C; i++) {
    for(int j = 1; j < 100002; j++) {
      imos[i][j] += imos[i][j - 1];
    }
  }
  for(int i = 0; i < C; i++) {
    for(int j = 1; j < 100002; j++) {
      if(imos[i][j]) imos[i][j] = 1;
    }
  }
  ll ans = 0;
  for(int j = 0; j < 100002; j++) {
    ll cnt = 0;
    for(int i = 0; i < C; i++) {
      cnt += imos[i][j];
      ans = max(ans, cnt);
    }
  }

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

Measured memory_bytes: 23680
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using ll = long long;
using namespace std;

int main() {
  string a, b;
  cin >> a >> b;
  if (a.length() > b.length()) {
    cout << "GREATER" << endl;
    return 0;
  }
  else if (a.length() < b.length()) {
    cout << "LESS" << endl;
    return 0;
  }
  else {
    for (int i = 0; i < a.length(); i++) {
      if (a[i] > b[i]) {
        cout << "GREATER" << endl;
        return 0;
      }
      else if (a[i] < b[i]) {
        cout << "LESS" << endl;
        return 0;
      }
    }
  }
  cout << "EQUAL" << endl;
}

Measured memory_bytes: 256
import queue

K = int(input())

Q = queue.Queue()

for i in range(1, 10):
    Q.put(i)

ans = 1
for k in range(K):
    ans = Q.get()
    ansm = ans % 10
    if ans%10 != 0:
        Q.put(10 * ans + ansm - 1)
    Q.put(10 * ans + ansm)
    if ans%10 != 9:
        Q.put(10 * ans + ansm + 1)

print(ans)

Measured memory_bytes: 18752
#include<bits/stdc++.h>
 using namespace std;
 int main()
 {
      string x,y;
      cin>>x>>y;
      int m=x.length(),n=y.length();
      int dp[m+1][n+1];
      for(int i=0;i<=m;i++)
      {
          for(int j=0;j<=n;j++)
          {
              if(i==0||j==0)
                dp[i][j]=0;
            else
                if(x[i-1]==y[j-1])
                    dp[i][j]=1+dp[i-1][j-1];
            else
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
          }
      }
      string s="";
      if(dp[m][n]==0)
      {
          cout<<s<<endl;
          return 0;
      }
      int i=m,j=n;
      while(i>0&&j>0)
      {
          if(x[i-1]==y[j-1])
          {
              s+=x[i-1];
              i--;
              j--;
          }
          else
            if(dp[i-1][j]>dp[i][j-1])
                i--;
            else
                j--;
      }
      reverse(s.begin(),s.end());
      cout<<s<<endl;
 }

Measured memory_bytes: 38816
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string a;
	int b=0;
	cin>>a;
	for(int i=0;i<a.size();i++)
	{
		if(a[i]=='C')
		{
			b=1;
		}
		if(a[i]=='F'&&b==1)
		{
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
	int H1, M1, H2, M2, K;
	cin >> H1>> M1>> H2>> M2>> K;

	int H = H2 - H1;
	int M = M2 - M1;


	cout << 60 * H + M - K << "\n";

	return 0;
}


Measured memory_bytes: 3620
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int result = 0;

			int n = scanner.nextInt();

			int[] a = new int[n + 2];
			a[0] = 0;

			for (int i = 1; i <= n; i++) {
				a[i] = scanner.nextInt();
				result += Math.abs(a[i] - a[i - 1]);
			}
			a[n + 1] = 0;
			result += Math.abs(a[n + 1] - a[n]);

			for (int i = 1; i <= n; i++) {
				int temp = result;
				temp -= Math.abs(a[i] - a[i - 1]) + Math.abs(a[i] - a[i + 1]);
				temp += Math.abs(a[i - 1] - a[i + 1]);
				System.out.println(temp);
			}
		}
	}
}


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

int main(void){
    int a,b,c;
    cin >> a;
    cin >> b;
    cin >> c; 
    if (a < b && b < c) {
        cout << "Yes" ;
    }
    else {
        cout << "No" ;
    
    }
    cout << endl;
    
    
}



Measured memory_bytes: 3108
#include<stdio.h>

main()
{
	int hight ;
	int wise ;
	int count ;
	char picture[256][256] ;

	scanf ( "%d %d", &hight, &wise );

	count = 0 ;
	while ( count < hight )
	{
		scanf ( "%s", picture[count] );
		count++;
	}

	count = 0 ;
	while ( count < hight )
	{
		printf ( "%s\n", picture[count] );
		printf ( "%s\n", picture[count] );
		count++;
	}

	return 0 ;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.TreeSet;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Queue;
public class Main {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        while(true){
            double ave=0;
            double var=0;
            int n=sc.nextInt();
            if(n==0)break;
            int s[]=new int [n];
            for(int i=0;i<n;i++){
                s[i]=sc.nextInt();
                ave+=s[i];
            }
            ave/=n;
            for(int i=0;i<n;i++){
                var+=(s[i]-ave)*(s[i]-ave);
            }
            var/=n;
            System.out.println(Math.sqrt(var));



        }
}

}



Measured memory_bytes: 31496