akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
     
    using namespace std;
     
    typedef long long ll;
    typedef unsigned long long ull;
    typedef vector<int> vi;
    typedef vector<ll> vl;
    typedef pair<int, int> pii;
    typedef pair<ll, ll> pll;
     
    #define REP(i, n) for(int i=0; i<(n); ++i)
    #define FOR(i, a, b) for(int i=(a); i<(b); ++i)
    #define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)
     
    #define DEBUG(x) cout<<#x<<": "<<x<<'\n'
    #define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
    #define ALL(a) (a).begin(), (a).end()
     
    #define CHMIN(a, b) a=min((a), (b))
    #define CHMAX(a, b) a=max((a), (b))
     
    const ll MOD=1000000007ll;
    // const ll MOD=998244353ll;
    #define FIX(a) ((a)%MOD+MOD)%MOD
     
    const double EPS=1e-11;
    #define EQ0(x) (abs((x))<EPS)
    #define EQ(a, b) (abs((a)-(b))<EPS)
     
    ll dp[114514][4];
     
    int main(){
    	ios::sync_with_stdio(false);
    	cin.tie(0);
    	string s;
    	cin>>s;
    	dp[s.size()][3]=1;
    	FORR(i, 0, s.size()){
    		FORR(j, 0, 4){
    			if(j==3){
    				if(s[i]=='?'){
    					dp[i][j]=(dp[i+1][j]*3)%MOD;
    				}
    				else{
    					dp[i][j]=dp[i+1][j];
    				}
    			}
    			else if(s[i]=='?'){
    				dp[i][j]=(dp[i+1][j]*3+dp[i+1][j+1])%MOD;
    			}
    			else if(s[i]-'A'==j){
    				dp[i][j]=(dp[i+1][j]+dp[i+1][j+1])%MOD;
    			}
    			else{
    				dp[i][j]=dp[i+1][j];
    			}
    		}
    	}
    	cout<<dp[0][0]<<'\n';
    	return 0;
    }

Measured memory_bytes: 3664
while 1:
    h,w=map(int,raw_input().split())
    if h==w==0: break
    ans=[['#' for v in range(w)] for x in range(h)]
    for i in range(1,h-1):
        for j in range(1,w-1):
            ans[i][j]='.'
    for i in range(h):
        print ''.join(ans[i])
    print ''

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

int main(){
int X, Y, ans=0; cin >> X >> Y;
if(X==3){ ans+=100000; }
if(Y==3){ ans+=100000; }
if(X==2){ ans+=200000; }
if(Y==2){ ans+=200000; }
if(X==1){ ans+=300000; }
if(Y==1){ ans+=300000; }
if(X==1&&Y==1){ ans+=400000; }
cout << ans << "\n";
}

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

int main()
{
    int H, W, N;
    scanf("%d %d", &H, &W);
    scanf("%d", &N);
    int A[N+100];
    for(int i = 0; i < N; ++i) scanf("%d", &A[i]);

    int mp[H][W];
    int cur = 0;
    for(int i = 0; i < H; ++i) {
        bool right = i%2;
        for(int j = 0; j < W; ++j) {
            int k = right ? j : W - 1 - j;
            mp[i][k] = cur + 1; --A[cur];
            if(A[cur] == 0) ++cur;
        }
    }

    for(int i = 0; i < H; ++i) {
        for(int j = 0; j < W; ++j){
            printf("%d ", mp[i][j]);
        }
        printf("\n");
    }
    return 0;
}

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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
//ll MOD = 1000000007;
ll MOD = 998244353;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

// a^b mod を計算する
ll mod_pow(ll a, ll b, ll p) {
    if (b == 0) return 1;
    if (b & 1) return (a * mod_pow(a, b - 1, p)) % p;
    ll t = mod_pow(a, b / 2, p);
    return (t * t) % p;
}

signed main()
{   
  gearup;
  ll n; cin >> n;
  vl d(n);
  rep(i,n)cin>>d[i];
  
  if(d[0] != 0){
      out(0);
      return 0;
  }
  ll res = 1;
  map<int,ll> mp;
  rep1(i,n){
      if(d[i] == 0){
          out(0);
          return 0;
      }
      mp[d[i]]++;
  }
  for(auto m:mp){
      int num = m.first;
      if(num == 1)continue;
      if(mp[num-1] == 0){
          out(0);
          return 0;
      }
      res = res * mod_pow(mp[num-1],m.second,MOD) % MOD;
  }
  out(res);
}


Measured memory_bytes: 7296
def main():
    n_max, w_max = map(int, input().split())

    v_list = []
    w_list = []
    for i in range(n_max):
        v, w = map(int, input().split())
        v_list.append(v)
        w_list.append(w)

    dp = [[0] * (w_max + 1) for _ in range(n_max + 1)]
    # i : 対象とする品物
    for i in range(n_max-1, -1, -1):
        # j : 残りの重さ
        for j in range(w_max + 1):
            if j < w_list[i]:
                dp[i][j] = dp[i+1][j]
            else:
                temp0 = dp[i+1][j]
                temp1 = dp[i+1][j - w_list[i]] + v_list[i]
                dp[i][j] = max(temp0, temp1)

    print(dp[0][w_max])


if __name__ == '__main__':
    main()



Measured memory_bytes: 24288
#include<bits/stdc++.h>
#define mems(a,x) memset(a,x,sizeof(a))
#define first fi
#define second se
using namespace std;
typedef long long ll;
const int mod=1e9+7,MS=105,N=66;
const double eps=1e-8;
ll inv(ll x){return x==1?x:(mod-mod/x)*inv(mod%x)%mod;}
ll inv(ll x,ll mod){return x==1?x:(mod-mod/x)*inv(mod%x,mod)%mod;}
ll qpow(ll a,ll n){ll ans=1;while(n){if(n&1) ans=ans*a%mod;a=a*a%mod;n>>=1;}return ans;}
ll mul(ll a,ll b){ll ans=0;while(b){if(b&1) ans=(ans+a)%mod;a=(a+a)%mod;b>>=1;};return ans;}
ll qpow(ll a,ll n,ll mod){ll ans=1;while(n){if(n&1) ans=ans*a%mod;a=a*a%mod;n>>=1;}return ans;}
ll mul(ll a,ll b,ll mod){ll ans=0;while(b){if(b&1) ans=(ans+a)%mod;a=(a+a)%mod;b>>=1;};return ans;}
struct vec
{
    double x,y;
    vec(double x=0,double y=0):x(x),y(y){}
    vec operator+(const vec&o)const{ return vec(x+o.x,y+o.y);}
    vec operator-(const vec&o)const{ return vec(x-o.x,y-o.y);}
    double operator*(const vec&o)const{ return x*o.x+y*o.y;}
    double operator^(const vec&o)const{ return x*o.y-y*o.x;}
    vec operator/(const double&o)const{ return vec(x/o,y/o);}
    vec operator*(const double&o)const{ return vec(x*o,y*o);}
    void sc(){scanf("%lf%lf",&x,&y);}
    double len(){return sqrt(x*x+y*y);}
};
struct Mat
{
    ll a[MS][MS];
    int n,m;
    Mat(int n=0,int m=0):n(n),m(m) { mems(a,0);}
    Mat operator*(const Mat&B)const
    {
        Mat C(n,B.m);
        for(int i=1;i<=n;i++)
            for(int j=1;j<=B.m;j++)
                for(int k=1;k<=m;k++)
                C.a[i][j]=(C.a[i][j]+a[i][k]*B.a[k][j])%mod;
        return C;
    }
};
int n,k;
vec a[N];
double c[N];
vec s1,s2;
vec polar(double a,double r){return vec(cos(r)*a,sin(r)*a);}
bool intersect(vec c1,vec c2,double r1,double r2)
{
    double d=(c1-c2).len();
    if(d-eps>r1+r2) return false;
    double a=acos((r1*r1+d*d-r2*r2)/(2*r1*d));
    double t=atan2(c2.y-c1.y,c2.x-c1.x);
    s1=c1+polar(r1,t-a);
    s2=c1+polar(r1,t+a);
    return true;
}
bool judge(double T)
{
    for(int i=1;i<=n;i++)
    {
        for(int j=i+1;j<=n;j++)
        {
            if(!intersect(a[i],a[j],T/c[i],T/c[j])) continue;
            int x=0,y=0;
            for(int k=1;k<=n;k++)
            {
                if(c[k]*(s1-a[k]).len()<=T+eps) x++;
                if(c[k]*(s2-a[k]).len()<=T+eps) y++;
            }
            if(x>=k||y>=k) return true;
        }
        int x=0;
        for(int j=1;j<=n;j++)
            if(c[j]*(a[i]-a[j]).len()<=T+eps) x++;
        if(x>=k) return true;
    }
    return false;
}
int main()
{
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
        a[i].sc(),scanf("%lf",&c[i]);
    double l=0,r=200000;
    //cout<<judge(2.4)<<endl;return 0;
    for(int i=1;i<=50;i++)
    {
        double m=(l+r)/2;
        if(judge(m)) r=m;
        else l=m;
    }
    printf("%.10f\n",(l+r)/2);
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func sum(a []int) int {
	ret := 0
	for _, v := range a {
		ret += v
	}
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	n, k := nextInt(), nextInt()
	h := nextInts(n)
	sort.Sort(sort.Reverse(sort.IntSlice(h)))

	var ans int
	if k >= n {
		ans = 0
	} else {
		ans = sum(h[k:n])
	}
	puts(ans)
	wt.Flush()
}

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func nextMega() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


Measured memory_bytes: 4224
# AOJ 0177 Distance Between Two Cities
# Python3 2018.6.20 bal4u

while True:
	n = int(input())
	if n == 0: break
	a = [0]*120
	for i in range(n): a[i] = int(input())
	k = int(input())
	cnt = 0
	l, r = 0, n-1
	while l <= r:
		cnt += 1
		m = (l + r) >> 1
		if k == a[m]: break
		if k < a[m]: r = m-1
		else: l = m+1
	print(cnt)


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

const int kInf = 0x3f3f3f3f;

int n, a, b, res, mnb = kInf, tot_dif;

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a >> b;
        res += a;
        if (a > b) mnb = min(mnb, b);
        tot_dif += abs(a - b);
    }
    if (tot_dif == 0) cout << 0;
    else cout << res - mnb;
}

Measured memory_bytes: 384
#include <stdio.h>
int main(void){
    // Your code here!
    char str[50][26] = {};
    char ch;
    int N;
    
    scanf("%d ",&N);
    
    for(int i = 0; i < N;i ++){
        char tmp[51];
        scanf("%50s",tmp);
        for(int j = 0; tmp[j] != '\0'; j++){
            str[i][tmp[j]-'a']++;
        }
    }
    
    for(int i = 0; i < 26;i++){
        int min = 100;
        for(int j = 0; j < N; j++){
            if(str[j][i] < min){
                min = str[j][i];
            }
        }
        
        for(int j = 0; j < min; j++){
            printf("%c",i + 'a');
        }
    }
}


Measured memory_bytes: 128
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
#define ln '\n'
const long long MOD = 1000000007LL;
//const long long MOD = 998244353LL;
typedef long long ll;
typedef unsigned long long ull; 
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
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; }
///////////////////////////////////////////////////////////////////////////////////////////////////

vector<vector<int>> G;
bool win = false;
int dfs(int v, int pv) {
	int cnt = 0;
	for (auto nv : G[v]) {
		if (nv==pv) continue;
		if (dfs(nv,v)) cnt++;
	}
	if (cnt == 0) return 1;
	if (cnt == 1) return 0;
	if (cnt > 1) {
		win = true;
		return 0;
	}
}

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
	int N; cin >> N;
	G.resize(N);
	rep(i,N-1) {
		int u,v; cin >> u >> v;
		--u; --v;
		G[u].emplace_back(v);
		G[v].emplace_back(u);
	}

	if(dfs(0,-1)) win = true;
	cout << (win ? "First" : "Second") << ln;
}


Measured memory_bytes: 5888
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <cstdio>
#include <complex>
#include <cstdint>
#include <tuple>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

const int N = 100005;

int f(int x, int y, int c, int r) {
	if (y == 0) return x;
	if (x == c)return c + y;
	if (y == r)return c + r + c - x;
	if (x == 0)return c + r + c + r - y;
}

int main() {
	int r, c, n;
	scanf("%d%d%d", &r, &c, &n);
	vector<PII> pp;
	REP(i, n) {
		int x1, y1, x2, y2;
		scanf("%d%d%d%d", &y1, &x1, &y2, &x2);
		if ((x1 == 0 || x1 == c || y1 == 0 || y1 == r) && (x2 == 0 || x2 == c || y2 == 0 || y2 == r)) {
			int s = f(x1, y1, c, r);
			int t = f(x2, y2, c, r);
			pp.PB(MP(s, t));
			pp.PB(MP(t, s));
		}
	}
	SORT(pp);
	stack<int> st;
	for (auto p : pp) {
		if (p.first < p.second)st.push(p.first);
		else {
			if (st.top() != p.second) {
				printf("NO\n");
				return 0;
			}
			st.pop();
		}
	}
	printf("YES\n");
	return 0;
}

Measured memory_bytes: 2420
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	String s = sc.next();
      	int sum = 0;
      	for(int i = 0; i < s.length(); i++){
        	if(s.charAt(i) == 'o') sum++;
        }
      	System.out.println(700 + (sum*100));
    }
}

Measured memory_bytes: 35556
import sys
h,w=map(int,input().split())
s=[list(input()) for i in range(h)]

for i in range(h):
    for j in range(w):
        if s[i][j]=='#':
            cnt=0
            for k,l in [(1,0),(0,1),(-1,0),(0,-1)]:
                ny,nx=i+k,j+l
                if nx>=0 and nx<w and ny>=0 and ny<h:
                    if s[ny][nx]=='#':
                        cnt+=1
            if cnt==0:
                print('No')
                sys.exit()
print('Yes')

Measured memory_bytes: 3064
#include <stdio.h>

int main(){
  long long i,n,a,b,c,d;

  scanf("%lld %lld %lld %lld %lld",&n,&a,&b,&c,&d);
  for(i=0;i<n;i++){
    if(c*(n-1-i)-d*i<=b-a&&b-a<=-c*i+d*(n-1-i)){
      printf("YES");
      return 0;
    }
  }
  printf("NO");
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef pair<int, int> P;

signed main(){
    int a, b;
    cin >> a >> b;
    cout << max(a, b) * 2 - !(a==b) << endl;
}


Measured memory_bytes: 256
using System;
using System.ComponentModel;

namespace rensyuu1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n3 = 0;
            while (true)

            {
                string se1 = Console.ReadLine();
                string[] se2 = se1.Split(new char[] { ' ' });
                int H = int.Parse(se2[0]);
                int W = int.Parse(se2[1]);

                if (H == 0 && W == 0)
                {
                    break;
                }


                var arr = new string('#', W);
                int n1 = 1;
                while (true)
                {
                    Console.WriteLine(arr);
                    if (n1 == H)
                    {
                        break;
                    }
                    n1++;
                }


                n3++;
                Console.WriteLine();

            }

        }
    }

}


Measured memory_bytes: 15888
let split_string ?(pattern="") = Str.split @@ Str.regexp pattern
let (n, a, b) = Scanf.sscanf (read_line ()) "%d %d %d" @@ fun n a b -> (n, a, b)
let xs = read_line () |> split_string ~pattern:" " |> List.map int_of_string |> Array.of_list

let xs = Array.init (n - 1) @@ fun i -> xs.(i + 1) - xs.(i)

let () = Printf.printf "%d\n" @@ Array.fold_left (fun sum i -> sum + (min (i * a) b)) 0 xs

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



int main(){
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll ans;
    ans = max(a*c, max(b*d, max(b*c, a*d)));
    cout << ans << endl;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,NAME,...) NAME
#define pr(...) GET_MACRO(__VA_ARGS__,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)
#define pr1(a) (#a)<<"="<<(a)
#define pr2(a,b) pr1(a)<<", "<<pr1(b)
#define pr3(a,b,c) pr2(a,b)<<", "<<pr1(c)
#define pr4(a,b,c,d) pr3(a,b,c)<<", "<<pr1(d)
#define pr5(a,b,c,d,e) pr4(a,b,c,d)<<", "<<pr1(e)
#define double long double
using namespace std;
const int N = 301;
const int INF = 1e9;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
typedef pair<int,int> P;
typedef long long ll;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
ostream& operator<<(ostream& o,vector<auto> &a){int i=0;for(auto t:a)o<<(i++?" ":"")<<t;return o;}
istream& operator>>(istream& i,vector<auto> &a){for(auto &t:a)i>>t;return i;}
void prArr(auto a,string s=" "){int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}
typedef tuple<int,int,int> T;
int n;
int m;
vector<T> A;

bool check(int r,int g,int b){
  static bool mem[N][N][N];
  static bool used[N][N][N]={};
  if(used[r][g][b]) return mem[r][g][b];
  used[r][g][b] = 1;
  int i = lower_bound(A.begin(),A.end(),T(b,-1,-1)) - A.begin();

  bool res = 1;
  for(;i < m && res;i++){
    int R,L,x; tie(R,L,x) = A[i];
    if(R > b) break;
    if(x == 1) res &= r < L && g < L;
    else if(x == 2) res &= r < L && g >= L;
    else if(x == 3) res &= r >= L && g >= L;
  }
  return mem[r][g][b] = res;
}

int mem[N][N][N];
bool used[N][N][N];
int dfs(int r,int g,int b){
  vector<int> Idx({r,g,b});
  sort(Idx.begin(),Idx.end());
  r = Idx[0], g = Idx[1], b = Idx[2];
  int idx = b;
  if(!check(r,g,b)) return mem[r][g][b] = 0;
  if(idx == n) return 1;
  if(used[r][g][b]) return mem[r][g][b];
  used[r][g][b] = 1;
  
  ll res = 0;
  res = (res + dfs(idx+1,g,b));
  res = (res + dfs(r,idx+1,b));
  res = (res + dfs(r,g,idx+1));
  return mem[r][g][b] = res % mod;
}

signed main(){
  cin>>n>>m;

  A.resize(m);
  for(int i=0;i<m;i++){
    int l,r,x;
    cin>>l>>r>>x;
    A[i] = T(r,l,x);
  }
  sort(A.begin(),A.end());

  int ans = dfs(0,0,0);
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 186624
#include<bits/stdc++.h>
#define REP(i,x) for(int i=0,i##_len=(x);i<i##_len;++i)
#define rep(i,a,b) for(int i=(a),i##_len(b);i<i##_len;++i)
#define All(x) begin(x),end(x)
#define rAll(x) rbegin(x),rend(x)
using namespace std;
using ll = long long;

int main(){
    string n;cin>>n;
    int a[4];
    REP(i,4) a[i]=n[i]-'0';
    vector<char> mp={'-','+'};
    REP(bit,1<<3){
        int res=a[0];
        REP(j,3) {
            if(bit>>j&1) res+=a[j+1];
            else res-=a[j+1];
        }
        if(res==7){
            cout<<a[0];
            REP(i,3) cout<<mp[bit>>i&1]<<a[i+1];
            cout<<"=7"<<endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
#include<stdio.h>

int main() {

	int s[15];

	int i,j;

	int tof = 0;

	for (i = 0; i < 9; i++) {
		scanf("%d", &s[i]);
	}
	s[9] = s[0];
	s[10] = s[1];
	s[11] = s[2];
	for (j = 0; j < 9; j=j+3) {

		for (i = 0; i < 2; i++) {

			if (s[i + j] - s[i + j + 3] != s[i + j + 1] - s[i + j + 4]) {
				tof = 1;
				break;
			}
		}
	}
	
	
	for (j = 0; j < 2;  j++) {

		for (i = 0; i < 9; i=i+3) {

			if (s[i + j+1] - s[i + j ] != s[i + j + 4] - s[i + j + 3]) {
				tof = 1;
				break;
			}
		}
	}

	if (tof == 1) {
		printf("No");
	}
	else {
		printf("Yes");
	}
	return 0;
}


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

int main()
{
	int X[3], ans;
	std::cin >> X[0] >> X[1] >> X[2];

	std::sort(X, X + 3);

	int n0 = (X[2] - X[0]) / 2;
	int n1 = (X[2] - X[1]) / 2;
	
	int diff0 = X[2] - n0 * 2 - X[0];
	int diff1 = X[2] - n1 * 2 - X[1];


	if (diff0 == diff1) {
		ans = n0 + n1 + diff0;
	} else {
		ans = n0 + n1 + 2;
	}

	std::cout << ans << std::endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,k; //入力値
  string arr[5] = {}; //測定値格納用配列
  int cnt = 0; //回文数格納 
  
  //入力値の取得
  cin >> n >> k;
   
  //配列に格納
  for(int i = n; i <= k; i++){
    string s = std::to_string(i);
  	int len = s.length();
    for(int ii = 0; ii < len; ii++){
      arr[ii] = s.substr(ii,1);
    }
    //回文判定(1文字目と5文字目・2文字目と4文字目一致)
    if((arr[0] == arr[4]) && (arr[1] == arr[3])){
      cnt++;
    } 
  }
  //結果を出力
  cout << cnt << endl;
}

Measured memory_bytes: 256
using System;
    class Program
    {
        static void Main(string[] args)
        {
            //入力
            string[] xInputMax = Console.ReadLine().Split(' ');
            int xMaxX = int.Parse(xInputMax[0]);
            int xMaxY = int.Parse(xInputMax[1]);

            string[] xInputX = Console.ReadLine().Split(' ');
            long[] x = new long[xMaxX];
            long xSumX = 0;
            for (int i = 0; i < xMaxX; ++i)
            {
                x[i] = long.Parse(xInputX[i]);
                xSumX += x[i] * (2 * i - xMaxX + 1);
            }

            string[] xInputY = Console.ReadLine().Split(' ');
            long[] y = new long[xMaxY];
            long xSumY = 0;
            for (int i = 0; i < xMaxY; ++i)
            {
                y[i] = long.Parse(xInputY[i]);
                xSumY += y[i] * (2 * i - xMaxY + 1);
            }

            long xDivisor = 1000000007;
            Console.WriteLine(((xSumX % xDivisor) * (xSumY % xDivisor)) % xDivisor);
        }
    }

Measured memory_bytes: 33996
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <time.h>
#include <vector>
#include <stdio.h>
#include <queue>
#include <map>
#define ll long long
using namespace std;
int num[100005]; 
int main()
{
    int n;
    cin>>n;
    ll sum = 0;
    for(int i=0;i<n;i++)
    {
    	cin>>num[i];
    	num[i]*=2;
    	if(i&1)
    		sum -= num[i];
		else sum += num[i];
	}
	int ans[100005];
	ans[0] = sum / 2;
	cout<<sum/2;
    for(int i=1;i<n;i++)
    {
    	ans[i] = (num[i-1] - ans[i-1]);
    	//cout<<num[i]<<" "<<num[i-1]<<endl;
    	cout<<" "<<ans[i];
	}
    
    return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ii;
typedef pair<string,ll> si;
typedef pair<ii,ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
#define sort(a) sort(a.begin(),a.end());
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define mp make_pair
#define F first
#define S second
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define nl "\n"
const int MOD = 1e9+7;
const ld PI = 3.1415926535898;
const ll LLMAX = LLONG_MAX;
#define N (int)1e6+1

int main()
{
	ios
	int n,w;
	cin>>n>>w;
	ll weight[100000+1];
	memset(weight,-1,sizeof(weight));
	ll a,b;
	for(int i=0;i<n;i++)
	{
		cin>>a>>b;
		for(int i=100000;i>=0;i--)
		{
			if(weight[i]==-1)continue;
			else if(weight[i]+a<=w)
			{
				if(weight[i+b]!=-1)
					weight[i+b]=min(weight[i+b],weight[i]+a);
				else
					weight[i+b]=weight[i]+a;
			}
		}
		if(weight[b]==-1)weight[b]=a;
		else weight[b]=min(weight[b],a);
	}
	ll ans=0;
	for(int i=100000;i>=0;i--)
	{
		if(weight[i]!=-1 && weight[i]<=w)
		{
			ans=i;
			break;
		}
	}
	cout<<ans<<nl;
}

Measured memory_bytes: 1024
import sys
from collections import deque
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return map(int, sys.stdin.readline().split())

def main():
    n, k = LI()
    g = [[] for i in range(n+1)]
    for i in range(n-1):
        a, b = LI()
        g[a].append(b)
        g[b].append(a)

    s = 1
    Q = deque([s])
    ans = k
    Qappend = Q.append
    searched = [0] * (n+1)
    searched[s] = 1
    Qp = Q.popleft
    cand = k - 1
    while len(Q) != 0:
        temp = 1
        v = Qp()
        for i in g[v]:
            if searched[i] == 1:
                continue
            searched[i] = 1
            temp = temp * cand % MOD
            cand -= 1
            Qappend(i)
        ans = ans * temp % MOD
        cand = k - 2
    print(ans % MOD)


if __name__ == "__main__":
    main()


Measured memory_bytes: 25880
while(1):
  a,op,b = input().split()
  a ,b = int(a), int(b)
  if(op == '+'): print(a+b)
  if(op == '-'): print(a-b)
  if(op == '*'): print(a*b)
  if(op == '/'): print(int(a/b))
  if(op == '?'): break


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

int n, k;
int a[100050];
long long ans;


bool find(long long p)
{
	long long cnt = 1, l = p;
	for (int i = 0; i < n; i++)
	{
		if (a[i] <= l)
			l -= a[i];
		else
			if (a[i] > p) return 0;
			else
				l = p - a[i], cnt++;
		if (cnt > k) return 0;
	}
	return 1;
}

int main()
{
	scanf("%d%d", &n, &k);
	long long tot = 0;
	for (int i = 0; i < n; i++)
		cin >> a[i], tot += a[i];
	long long l = 0, r = tot;
	while (l<=r)
	{
		long long mid = (l + r) / 2;
		if (find(mid))
			ans = mid, r = mid - 1;
		else
			l = mid + 1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3544
<?php
function koch($p1, $p2, $n, $start = false) {
    list($p1x, $p1y) = $p1;
    list($p2x, $p2y) = $p2;
    
    if ($start) {
        return "{$p1x} {$p1y}\n" . koch($p1, $p2, $n) . "{$p2x} {$p2y}\n";
    } elseif ($n > 0) {
        $sx = (2 * $p1x + $p2x) / 3;
        $sy = (2 * $p1y + $p2y) / 3;
        $tx = ($p1x + 2 * $p2x) / 3;
        $ty = ($p1y + 2 * $p2y) / 3;
        
        $x = $tx - $sx;
        $y = $ty - $sy;
        $cos = cos(M_PI / 3);
        $sin = sin(M_PI / 3);
        $ux = $sx + $x * $cos - $y * $sin;
        $uy = $sy + $x * $sin + $y * $cos;
        
        $s = [$sx, $sy];
        $t = [$tx, $ty];
        $u = [$ux, $uy];
        $n--;
        
        return koch($p1, $s, $n) . "{$sx} {$sy}\n" . koch($s, $u, $n) . "{$ux} {$uy}\n" . koch($u, $t, $n) . "{$tx} {$ty}\n" . koch($t, $p2, $n);
    }
}

$n = (int)trim(fgets(STDIN));

print koch([0, 0], [100, 0], $n, true);


Measured memory_bytes: 9672
n=int(input())
stri=[]
time=[]

for _ in range(n):
  s,t=input().split()
  stri.append(s)
  time.append(t)
x=input()

ind=stri.index(x)

ans=0

for i in range(ind+1,n):
  ans+=int(time[i])
  
print(ans)

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

#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end() 
#define sz(v) (int)((v).size())
#define fs first
#define sd second

typedef long long ll;

typedef pair < int, int > pi;
typedef pair < pi, int > ppi;

typedef vector < int > vi;
typedef vector < vector < int > > vvi;
typedef vector < pi > vpi;
typedef vector < vpi > vvpi;
typedef vector < ppi > vppi;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}

void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}

#ifdef LOCAL
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

double get_time() {
	return 1.0 * clock() / CLOCKS_PER_SEC;
}

/*
5 4 2 1 1
4 4  
// }
*/

int main() {
	int n;
	cin >> n;
	vi a(n);
	for(int i = 0; i < n; i++)
		cin >> a[i];
	sort(all(a), greater<int>());
	ll res = a[0];
	int need = n - 2;
	for(int i = 1; i < n && need > 0; i++) {
		if(need >= 2) {
			res += 2*a[i];
			need -= 2;
		}
		else {
			res += a[i];
			need--;
		}
	}	
	cout << res << '\n';
}


Measured memory_bytes: 4052
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int>sb;
int main()
{int t,i;
while(cin>>t)
{
int b=0,c=0;
int a[1001];
for(i=0;i<t;i++)
cin>>a[i];
for(i=0;i<t;i++)
{if(a[i]%2==0)
sb.push_back(a[i]);}
for(i=0;i<sb.size();i++){
if((sb[i]%3==0)||(sb[i]%5==0))
b=0;
else
{b=-1;
break;}}
if(b==0)
printf("APPROVED\n");
else
printf("DENIED\n");
}}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll                long long int
#define ld                long double
#define F                 first
#define S                 second
#define C                 continue
#define G                 goto done
#define pb                push_back
#define pf                push_front
#define ppb               pop_back
#define ppf               pop_front
#define sz                size()
#define pi                acos(-1.0)
#define mod               1000000007
#define maxe              *max_element
#define mine              *min_element
#define min3(a,b,c)       min(a,min(b,c))
#define max3(a,b,c)       max(a,max(b,c))
#define min4(a,b,c,d)     min(a,min(b,min(c,d)))
#define max4(a,b,c,d)     max(a,max(b,max(c,d)))
#define mem(a,b)          memset(a,b,sizeof(a))
#define all(a)            (a).begin(),(a).end()
#define gcd(a,b)          __gcd(a,b)
#define lcm(a,b)          ((a)*((b)/gcd(a,b)))
#define case(a)           cout<<"Case "<<(a)<<": "
#define point(a)          fixed<<setprecision(a)
#define get(a)            for(auto &x:a) cin>>x;
#define print(a)          for(auto x:a) cout<<x<<" "; cout<<endl;
#define uniq(a)           sort(all(a)); (a).erase(unique((a).begin(),(a).end()),(a).end())
#define big(a)            transform((a).begin(),(a).end(),(a).begin(),::toupper)
#define small(a)          transform((a).begin(),(a).end(),(a).begin(),::tolower)
#define ischar(a)         (('a'<=a&&a<='z')('A'<=a&&a<='Z'))
#define isvowel(a)        (a=='a'||a=='e'||a=='i'||a=='o'||a=='u'||a=='A'||a=='E'||a=='I'||a=='O'||a=='U')
#define fast              ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define tc                int test; cin>>test; while(test--)
using namespace std;
int main()
{
    ll n; cin>>n; ll a[n]; get(a);
    ll s=0;
    for(ll i=0;i<n;i++)
    {
        s=(s%mod+a[i]%mod)%mod;
    }
    ll ans=0;
    for(ll i=0;i<n;i++)
    {
        s=(s-a[i]+mod)%mod;
        ans=(ans%mod + s%mod*a[i]%mod)%mod;
    }
    cout<<ans;
}




















Measured memory_bytes: 5104
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvv vector<vvl>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvvl(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
typedef __int128_t lll;
using namespace std;

int main(int argc, char const *argv[]) {
  ll n;std::cin >> n;
  vector<pair<string, ll>> v(n);

  re(i, n) std::cin >> v[i].first >> v[i].second;
  string s;std::cin >> s;
  re(i, n){
    if(v[i].first==s){
      ll ans = 0;
      for(int j=i+1;j<n;j++) ans+=v[j].second;
      std::cout << ans << '\n';
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c,n) for(int i=c;i<n;i++)
 
int main(void) {
  int n,m;
  cin>>n>>m;
  
  string str;
  if(n==1){str="0";}
  if(n==2){str="10";}
  if(n==3){str="100";}
  
  vector<int> a(n,-1);
  bool empty=0;
  rep(i,0,m){
    int s,c;
    cin>>s>>c;
    if(s==1&&n>1&&c==0){empty=1;break;}
    if(a[s-1]==-1||a[s-1]==c){
      a[s-1]=max(a[s-1],c);
      str[s-1]=c+'0';
    }
    else{empty=1;break;}
  }

  if(empty==1){cout<<-1<<endl;}
  else{cout<<str<<endl;}

  return 0;
}


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

int main() {
  
  double A,B,H,M;
  cin >> A >> B >> H >> M;

  double theta = max(30*M/60+30*H-6*M,6*M-30*H-30*M/60);
  if(theta > 180) theta = 360-theta;
  double rad = M_PI*(theta/180);

  cout << fixed << setprecision(15);
  cout << sqrt(A*A+B*B-2*A*B*cos(rad)) << endl;
  

}


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

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

    vector<ll> left(n), right(n);
    rep(i,n) cin >> left[i] >> right[i];
    sort(left.begin(),left.end(),greater<ll>());
    sort(right.begin(),right.end());

    ll ans = 0, count = 0;
    rep(i,n) {
        count += left[i]; ans = max(ans, count);
        count -= right[i]; ans = max(ans, count);
    }

    count = 0;
    rep(i,n) {
        count -= right[i]; ans = max(ans, count);
        count += left[i]; ans = max(ans, count);
    }
    
    cout << ans * 2 << endl;
    return 0;
}

Measured memory_bytes: 4836
s=input()
l=len(s)
ans=0
for i in range(0,l,2): #[0,2,...]
  if not (s[i]=='R' or s[i]=='U' or s[i]=='D'):
    ans=1
for i in range(1,l,2): #[1,3,...]
  if not (s[i]=='L' or s[i]=='U' or s[i]=='D'):
    ans=1
if ans==0:
  print('Yes')
else:
  print('No')
    

Measured memory_bytes: 3060
//#pragma GCC optimize("O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
//#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>
 
using namespace std;
 
using ll = long long;
 
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int r, g, b, n;
    cin >> r >> g >> b >> n;
    int ans = 0;
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= n; j++) {
            int t = n - i * r - j * g;
            if (t >= 0 && t % b == 0) {
                ans++;
            }
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,-1,sizeof(x))
const int INF = 1e9 + 1;
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589793;
const int MAX_N = 2e5;

int d, c[365], s[365][26], t[365], last[26], u;

void input(){
  cin >> d;
  rep(i, 26) cin >> c[i];
  rep(i, d){
    rep(j, 26){
      cin >> s[i][j];
    }
  }
  rep(i, d){
    int k;
    cin >> k;
    k--;
    t[i] = k;
  }
  fill(last, last+26, 0);
}

int test(int k, int i){
  ll res = 0;
  rep(j, 26){
    if(j == k) continue;
    res -= c[j] * last[j];
  }
  
  return res + s[i][k];
}

void greedy(){
  rep(i, d){
    rep(i, 26) last[i]++;
    int res = -INF;
    rep(k, 26){
      if(res < test(k, i)){
        u = k;
        res = test(k, i);
      }
    }
    last[u] = 0;
    t[i] = u;
  }
}

int p_calc(){
  ll res = 0;
  int last[26];
  fill(last, last+26, 0);
  rep(i, d){
    res += s[i][t[i]];
    rep(i, 26) last[i]++;
    last[t[i]] = 0;
    rep(j, 26){
      res -= c[j]*last[j];
    }
  }
    
  return res;
}
  
  
int main(){
  input();
  greedy();
  ll ans = p_calc();
  
  rep(i, 10000){
    int p = i%365, q, tmp = t[p];
    
    q = s[i%365][i%26]%26;
      
      
    t[p] = q;
    if(ans > p_calc()){
      t[p] = tmp;
    }
  }
  
  rep(i, d) cout << t[i]+1 <<endl;
}

  



Measured memory_bytes: 3676
//拓展欧几里得 
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
#define f(i,a,b) for(register int i=a;i<=b;++i)
#define ll long long
inline int read()
{
	int s=0,w=1;register char ch=getchar();
	while(ch<'0'||ch>'9') { if(ch=='-') w=-1;ch=getchar();}
	while(ch>='0'&&ch<='9') { s=(s<<1)+(s<<3)+(ch^48);ch=getchar();}
	return s*w;
}
int main()
{
	int n=read(),ans=0;
	f(i,1,n) {
		int x=read();
		if((i&1)&&(x&1))++ans;
	}
	cout<<ans;
	return 0;
}

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

int main()
{
ll n ;
cin >> n ;
vector<ll> ans(n);
vector<ll> a(n);
rep(i, n){
  cin >> a[i];
}
map<ll,pair<ll,ll>> m;
rep(i,n){
  m[a[i]].first++;
  if(m[a[i]].first==1)m[a[i]].second=i+1;
}
ll num=0,cnt,itr;
ll minitr;
ll sum=0;
for (auto i = m.rbegin(); i != m.rend(); ++i) {
  if(num==0){
    num=i->first;
    cnt=i->second.first;
    itr=i->second.second;
    minitr=itr-1;
    continue;
  }
  ans[minitr]+=(cnt+sum)*(num-i->first);
  sum+=cnt;
  num=i->first;
  cnt=i->second.first;
  itr=i->second.second;
  minitr=min(minitr,itr-1);
}
ans[minitr]+=(cnt+sum)*num;
for(auto an:ans)cout << an << endl;
return 0;
}

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

using namespace std;

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

const char sp = ' ';
const char cmm = ',';
const int MOD = 1000000007;

using ll = long long;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    cout << '[';
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len-1) s << ", ";
    }
    cout << ']';
    return s;
}

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int a, b, c;
    cin >> a >> b >> c;
    Judge(a==b and b==c);




    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <sstream> //C++
#include <queue> //C++
#include <string> //C++
#include <iostream> //C++
#include <vector> //C++
#include <algorithm> //C++
using namespace std; //C++
#define rep(i, a, n) for (i = (a); i < (n); i++)

//scanf("%d",&x);
//printf("%d",x);
//for(i=0;i<N;i++){  }
//if( == ){  }else{  }
//while( ){  }

/*
int N, i;
int H[100];
scanf("%d", &N);
for (i = 0; i < N; i++) scanf("%s", &H[i]);
*/





int main()
{
	string s;
	int i;
	int Ans[10];

	cin >> s;

	istringstream ss;

	rep(i, 0, s.size()-2) {
		ss = istringstream(s.substr(i, 3));

		int t = atoi(s.substr(i, 3).c_str());

		Ans[i] = abs(t - 753);
	}
	
	int min = 1000;
	rep(i, 0, s.size()-2) {
		if (min > Ans[i]) {
			min = Ans[i];
		}
	}

	cout << min;

	return 0;

	

	
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;
const int MAX_N=50;
int N,a[MAX_N];
int main(){
	cin>>N;
	int ma=0;
	REP(i,N){
		cin>>a[i];
		if (abs(a[i])>abs(a[ma])){
			ma=i;
		}
	}
	int f;
	if (a[ma]>=0){
		f=1;
	}else{
		f=-1;
	}
	cout<<2*(N-1)<<endl;
	REP(i,N){
		if (i!=ma){
			cout<<ma+1<<" "<<i+1<<endl;
		}
	}
	REP(i,N-1){
		if (f==1){
			cout<<i+1<<" "<<i+2<<endl;
		}else{
			cout<<N-i<<" "<<N-i-1<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

			int N = scan.nextInt();

			long mod = (long)1e9+7;

			long g = 1;
			long g2 = 1;
			long g3 = 1;
			long g4 = 1;

			for(int i = 0;i<N;i++) {
				g = (g*10)%mod;
				g2 = (g2*8)%mod;
				g3 = (g3*9)%mod;
				g4 = (g4*9)%mod;

			}

			g3 =  (g3+g4)%mod;

			g3 = (g3-g2+mod)%mod;

			g = (g-g3+mod)%mod;

			System.out.println(g);


		}


	}


}


Measured memory_bytes: 35648
#include <iostream>
#include <thread>
#include <chrono>
#include <random>
#include <fstream>
#include <time.h>

#define ll long long int
#define ull unsigned long long int
#define pr(x) (std::cout << x << std::endl)



int main()
{
    ull k;
    char s[100];
    std::cin >> s;
    std::cin >> k;
    char c='0';
    int idx=0;
    ull count=0;

    while(c){
        c = s[idx];
        if(c == '1') count++;
        else break;
        idx++;
    }

    if(count < k) pr((int)s[count] - '0');
    else pr(1);
    return 0;
}

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

int N, M, H[100'010], ans[100'010];

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> N >> M;
	for (int i = 1; i <= N; ++i)
		cin >> H[i];
	for (int i = 0; i < M; ++i)
	{
		int a, b;
		cin >> a >> b;
		if (H[a] >= H[b]) ans[b] = 1;
		if (H[a] <= H[b]) ans[a] = 1;
	}
	cout << count(ans + 1, ans + N + 1, 0);
}

Measured memory_bytes: 4396
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
#define int long long
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}

int n, a, b, p[100], ta[3];

signed main() {
	cin >> n >> a >> b;
	for (int i = 0; i < n; i++) {
		cin >> p[i];
		if (p[i] <= a)ta[0]++;
		else if (p[i] <= b)ta[1]++;
		else ta[2]++;
	}
	sort(ta, ta + 3);
	cout << ta[0] << endl;
	getchar(); getchar();
	return 0;
}

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

int main() {
	int N, T;
	cin >> N >> T;
	int minc = 1001;
	for (int i = 0; i < N; i++) {
		int c, t;
		cin >> c >> t;
		if (t <= T && minc > c)minc = c;
	}
	if (minc == 1001)cout << "TLE" << endl;
	else cout << minc << endl;
}

Measured memory_bytes: 256
//! 尺卂乃卂.卂ﾌ乇乇ㄒ
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define mip             map<pair<int,int>,int>
#define mic             map<char,int> 
#define all(v)          v.begin(),v.end()  
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define itr(v)          for(auto it:v)
#define show(arr,n) for(int i=0;i<n;i++) cout<<arr[i]<<" "; cout<<"\n";
#define fi(i,n)         for(int i=0;i<n;i++)
#define fd(i,n)         for(int i=n-1;i>=0;i--)
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

//mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

bool cmp(int a,int b) {return a>b;}
int fast_pow(int b,int p,int m=1){
     if(p==0) return 1;
     if(p==1) return b;
    int res=fast_pow(b,p/2,m);  res=(res*res)%m;
    if(p%2==0) return res; else return  (b*res)%m;
}
int mmi(int a,int m){ return fast_pow(a,m-2,m);}

int a[200001],b[200001];

int32_t main()
{
    FIO
    int n; cin>>n;
    // string s[n];
    map<string,int> m;
    fi(i,n){
        string s; cin>>s;
        m[s]++;
    }
    cout<<m.size()<<"\n";
    return 0;
}

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

public class Main {
	
	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner();
		PrintWriter out = new PrintWriter(System.out);
		out.println(sc.next().substring(0, 3));
		
		out.flush();
	}
	
	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;
		
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}


Measured memory_bytes: 32796
#include<bits/stdc++.h>
#define fr(i,j,n)   for(int i=j;i<n;i++)
#define pb          push_back
#define rf(i,j,p)   for(int i=p;i>=j;i--)
#define vi          vector<int>
#define vll         vector<long long>
#define ll          long long
#define hmm         "\n"
#define sp          " "
#define srt(v)      sort(v.begin(), v.end());
#define down        cout<<hmm;
#define faaast      ios_base::sync_with_stdio(0);cin.tie(nullptr);
using namespace std;
int main()
{
  string s ; cin >> s ;
  string t="", tt="" ;
  fr(i,0,s.size())
  {
      if(i%2==0)t+="0";
      else t+="1";
  }
  fr(i,0,s.size())
  {
      if(i%2==0)tt+="1";
      else tt+="0";
  }
  int a1=0, a2=0;
  fr(i,0,s.size())
  {
      if(t[i]!=s[i])a1++;
      if(tt[i]!=s[i])a2++;
  }
  cout<<min(a1,a2)<<hmm;
}


Measured memory_bytes: 3820
const inputs = require('fs')
  .readFileSync('/dev/stdin', 'utf8')
  .trim()
  .split(/\s+/)

const N = parseInt(inputs[0])
const A = new Array(N)
const B = new Array(N)

for (let i = 0, p = 1; i < N; i += 1) {
  A[i] = parseInt(inputs[p++])
  B[i] = parseInt(inputs[p++])
}

const cmp = (a, b) => a - b
A.sort(cmp)
B.sort(cmp)

if (N % 2 == 0) { // even
  const i1 = N / 2 - 1
  const i2 = N / 2
  const maxMed = B[i1] + B[i2]
  const minMed = A[i1] + A[i2]
  console.log(maxMed - minMed + 1)
} else { // odd
  const i = (N - 1) / 2
  const maxMed = B[i]
  const minMed = A[i]
  console.log(maxMed - minMed + 1)
}


Measured memory_bytes: 77100