akhauriyash/Code-Regression huggingface dataset:
import java.time.Instant;
import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

public class Main {
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();

		int[] cnt = new int[N];
		for(int i=0; i<N; i++){
			int c = 0;
			int n = i+1;
			while(n<K) {
				n= n*2;
				c++;
			}
			cnt[i]=c;
		}

		Double ans = 0.0;

		for(int i=0; i<N; i++) {
			ans += (double) 1 / N * (double) (1 / Math.pow(2, cnt[i]));
		}

		System.out.println(ans);
	}
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int N,A,B; cin>>N>>A>>B;
  cout<<min(A,B)<<" "<<max(0ll,A+B-N)<<endl;
  }


Measured memory_bytes: 256
"""
この解答に自分用にコメントつけただけ
https://atcoder.jp/contests/abc135/submissions/6585300
"""

def main():
    S = input()
    dp = [[0 for _ in range(13)] for _ in range(len(S)+1)]
    # dp[i][j] は頭からi番目までの数字を13で割った時j余る数がいくつあるか
    MOD = 10**9 + 7

    dp[0][0] = 1 # 何もなしのとき０とする

    """
    たとえば５６７８という数字について考えるとき
    5：s[1][5] = 1で他のjが０
    56：5 -> 56なので、 dp[2][(5*10 + 6) % 13] += dp[1][5]
    先頭からi文字目まで見たときに余りが５となる数字列について、一桁増えると余りも一桁増える＆新たに増えた桁との和のさらにあまりが新たにできた数字の余り
    """

    for i in range(1, len(S)+1):
        if S[i-1] == "?":
            for j in range(10):
                for k in range(13):
                    dp[i][(k*10 + j) % 13] += dp[i-1][k] % MOD # 足し合わせなのでMODとっておく
        else:
            for k in range(13):
                dp[i][(k*10 + int(S[i-1])) % 13] += dp[i-1][k] % MOD # 足し合わせなのでMODとっておく

    print(dp[-1][5] % MOD)

if __name__ == "__main__":
    main()

Measured memory_bytes: 66612
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
int a[3][100005];

int main(void){
	scanf("%d",&n);
	for(int i=0;i<3;i++){
		for(int j=0;j<n;j++){
			scanf("%d",&a[i][j]);
		}
		sort(a[i],a[i]+n);
	}
	int now[2]={0,0};
	ll cnt=0;
	for(int i=0;i<n;i++){
		int vl=lower_bound(a[0],a[0]+n,a[1][i])-a[0];
		int vr=upper_bound(a[2],a[2]+n,a[1][i])-a[2];
		ll rest=vl;
		ll rest2=n-vr;
		if(rest>0){
			cnt+=rest*rest2;
		}
	}
	printf("%lld\n",cnt);
	return 0;
}

Measured memory_bytes: 1408
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip.split())
def main():
    n = I()
    dic = collections.defaultdict(lambda : ":(")
    for i in range(1,46300):
        tax = i*108//100
        dic[tax] = i
    print(dic[n])
main()

Measured memory_bytes: 81608
#include<iostream>
using namespace std;
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#define int long long int
#define inf 1000000000
#define pi acos(-1)
int32_t main()
{
	double a,b,h,m;
	cin>>a>>b>>h>>m;
	double angle1=(30*h+double(m)/2.0);
	double angle2=(6*m);
	double angle=abs(angle1-angle2);
	if(angle>180)
	  angle=360-angle;
	angle*=pi;
	angle/=180.0;
	double answer=sqrt(a*a+b*b-2*a*b*cos(angle));
	printf("%.10f\n",answer);
}


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


int main(){
  vector<int> M(5);
  int ans = 0;
  for(auto& m : M){
    int t;
    cin >> t;
    ans += (t/10)*10;
    m = t%10;
  }
  sort(M.begin(), M.end());
  bool find_last = false;
  for(auto& m : M){
    if(m == 0) continue;
    if(find_last){
      ans += 10;
    }else{
      ans += m;
      find_last = true;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

          while(true){
              int    a      = sc.nextInt();
              String op     = sc.next();
              int    b      = sc.nextInt();
              answer[count] = 0;

              if(op.equals("?"))
                    break;

              switch(op){
                    case "+":
                        answer[count] = a+b;
                        break;
                    case "-":
                        answer[count] = a-b;
                        break;
                    case "*":
                        answer[count] = a*b;
                        break;
                    case "/":
                        if(b == 0)
                            break;
                        answer[count] = a/b;
                        break;
                    default:
                        break;
              }
              count++;
          }

          for(int i=0; i<count; i++){
            System.out.printf("%d\n", answer[i]);
          }
  }
}



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

int main(){
    ll x;
    cin >> x;
    ll a=100;
    ll cnt = 0;
    while(true){
        cnt++;
        a*=1.01;
        if(a>=x){
            break;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3632
import sys

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

cnt = 0
for n in range(N):  
  ## 勇者に、とりあえず自分の村を討伐してもらう
  cnt += min(A[n],B[n])
  
  ## 勇者に余力があるなら次の村のモンスターも討伐してもらう
  if A[n] < B[n]:
    
    ## 勇者強すぎwww次の村のモンスター全部倒せちゃうパターン
    if A[n+1] <= (B[n] - A[n]):
      cnt += A[n+1]
      A[n+1] = 0
    ## 流石にそこまでは...パターン
    else:
      cnt += (B[n] - A[n])
      A[n+1] -= (B[n] - A[n])
  
print(cnt)

Measured memory_bytes: 19156
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        int[] d = new int[N];
        for (int i = 0; i < N; i++)
            d[i] = int.Parse(Console.ReadLine());
        Console.WriteLine(d.Distinct().Count());
    }
}


Measured memory_bytes: 13276
#include <iostream>
#include <vector>
#include <complex>
#include <cmath>
#include <cstdio>

using namespace std;

const double EPS = 1e-8f;
const double PI = acos(-1.0);
typedef complex<double> P;

struct L { P p, q; L(P p, P q) : p(p), q(q) {} };
double dot(P a, P b) { return real(conj(a)*b); }
double cross(P a, P b) { return imag(conj(a)*b); }

bool ssIntersect(L a, L b){
	if(abs(imag((a.q-a.p)/(b.q-b.p)))<EPS) return false;
	return cross(a.q-a.p, b.p-a.p)*cross(a.q-a.p, b.q-a.p) < 0 &&
    	   cross(b.q-b.p, a.p-b.p)*cross(b.q-b.p, a.q-b.p) < 0;
}

double distLP(L l, P p){
	if(dot(l.q-l.p,p-l.p)<-EPS) return abs(p-l.p);
	if(dot(l.p-l.q,p-l.q)<-EPS) return abs(p-l.q);
	return abs(cross(l.q-l.p,p-l.p))/abs(l.q-l.p);
}

int main(){
	int N, s, g;
	double dist[100][100];
	while(cin >> N >> s >> g && N){
		vector< vector<P> > vp(N);
		for(int i=0;i<N;i++){
			int x, y, a, r; cin >> x >> y >> a >> r;
			for(int j=0;j<5;j++){
				double angle = (90+a+72*j)*PI/180;
				vp[i].push_back(P(x+r*cos(angle),y+r*sin(angle)));
			}
		}
		for(int i=0;i<N;i++){
			dist[i][i] = 0;
			for(int j=i+1;j<N;j++){
				dist[i][j] = 1e12;
				for(int k=0;k<5;k++){
					for(int l=0;l<5;l++){
						dist[i][j] = min(dist[i][j], distLP(L(vp[i][k], vp[i][(k+2)%5]), vp[j][l]));
						dist[i][j] = min(dist[i][j], distLP(L(vp[j][k], vp[j][(k+2)%5]), vp[i][l]));
						if(ssIntersect(L(vp[i][k], vp[i][(k+2)%5]), L(vp[j][l], vp[j][(l+2)%5]))){
							dist[i][j] = 0;
						}
					}
				}
				dist[j][i] = dist[i][j];
			}
		}
		for(int k=0;k<N;k++){
			for(int i=0;i<N;i++){
				for(int j=0;j<N;j++) dist[i][j] = min(dist[i][j], dist[i][k]+dist[k][j]);
			}
		}
		printf("%.8lf\n", dist[s-1][g-1]);
	}
}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  int A, B, C, X; scanf("%d %d %d %d", &A, &B, &C, &X);
  int ans = 0;
  for (int i = 0; i <= A; ++i) {
    for (int j = 0; j <= B; ++j) {
      int val = X - 500 * i - 100 * j;
      if (val >= 0 and (val % 50) == 0 and (val / 50) <= C) {
        ++ans;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define fi first
#define sc second
#define pii pair<int,int>
#define vi vector<int>
#define msi map<string,int>
#define si set<int>
#define all(v) v.begin(),v.end()
#define sz(v)  int((v).size())
#define rep(i,a,b)	for(int i=a;i<b;i++)
#define dep(i,a,b)	for(int i=a;i>=b;i--)
#define isinarr(i,n) ((i>=0)?((i<n)?1:0):0)
#define fastio  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define ppb pop_back
#define present(container, element) (container.find(element) != container.end())      //set,map etc.
#define cpresent(container, element) (find(all(container),element) != container.end())    //vector
#define hell 1000000007
#define PI 3.14159265
#define mp make_pair
#define	endl '\n'

using namespace std;
void solve()
{
	float l;
	cin>>l;
	cout << fixed << setprecision(8);
	float k=l/3;
	cout<<k*k*(l-(k*2.00));
} 



signed main()
{
    fastio
    int t=1;
    //cin>>t;
    while(t--)
    	solve();
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define pb push_back
#define eb emplace_back
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

template<class T>
bool chmax(T &a, T b){if(a < b){a = b; return true;} return false;}
template<class T>
bool chmin(T &a, T b){if(a > b){a = b; return true;} return false;}

int main(){
    ll n; cin >> n;
    vector<ll> a(n);
    bitset<8> bs(0);
    ll cnt = 0;
    rep(i,n) {
        cin >> a[i];
        if(a[i] >= 3200)cnt++;
        else bs[a[i] / 400] = 1;
    }
    ll min = bs.count();
    ll max = min + cnt;
    if(min == 0 && cnt > 0)min = 1;
    cout << min << " " << max << endl;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

// DON'T USE THESE MACROS DURING ICPC PRACTICE
#define For(i,n) for (int i=0; i<n; i++)
#define FOR(i,a,b) for (int i=a; i<=b; i++)
#define Down(i,n) for (int i=n-1; i>=0; i--)
#define DOWN(i,a,b) for (int i=b; i>=a; i--)

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef complex<ld> pt;
typedef vector<pt> pol;
typedef vector<int> vi;

const char nl = '\n';
const int INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll MOD = 1e9+7;
const ld EPS = 1e-10;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

const int N = 50;
ll adj[N][N], mat[N][N], res[N][N];

void multiply(int n, ll r[N][N], ll a[N][N], ll b[N][N]) {
	For(i,n) {
		For(j,n) {
			r[i][j] = 0;
			For(k,n) {
				r[i][j] += a[i][k] * b[k][j] % MOD;
			}
			r[i][j] %= MOD;
		}
	}
}

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

	int n; ll k;
	cin >> n >> k;

	For(i,n) {
		For(j,n) {
			cin >> adj[i][j];
			res[i][j] = (i==j);
		}
	}

	for ( ; k>0; k/=2) {
		if (k&1) {
			multiply(n, mat, res, adj);
			swap(res, mat);
		}
		multiply(n, mat, adj, adj);
		swap(adj, mat);
	}

	ll ans = 0;
	For(i,n) {
		For(j,n) {
			ans += res[i][j];
		}
	}
	cout << ans % MOD << nl;

	return 0;
}


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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	
	int a[30],i;
	string s;
	memset(a,0,sizeof(a));
	cin>>s;
	for(i=0;i<s.length();i++)
	{
		if(a[s[i]-'a']==1)
			{cout<<"no";return 0;}
		else
			a[s[i]-'a']+=1;
	}
	cout<<"yes";
    return 0;
}

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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

int k=0;

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL){
    y = x;
    if(z->key < x->key){
      x = x->left;
    }else{
      x = x->right;
    }
  }
    z->parent = y;

    if(y == NIL){
      root = z;
    }else{
      if(z->key < y->key){
      y->left = z;
    }else{
      y->right = z;
    }
  }

}

void inorder(Node u){


  if(u == NIL)return;
  inorder(u->left);
  k++;
  printf(" %d",u->key,k);
  inorder(u->right);

}
void preorder(Node u){
  if(u == NIL)return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } 
  }

  return 0;
}

Measured memory_bytes: 24040
/*
        _            _                  _            _       _     _         _   _          _          _             _        
       / /\         / /\               / /\         / /\    / /\  /\ \      /\_\/\_\ _     /\ \       /\ \     _    /\ \      
      / /  \       / /  \             / /  \       / / /   / / /  \ \ \    / / / / //\_\   \ \ \     /  \ \   /\_\ /  \ \     
     / / /\ \__   / / /\ \           / / /\ \__   / /_/   / / /   /\ \_\  /\ \/ \ \/ / /   /\ \_\   / /\ \ \_/ / // /\ \_\    
    / / /\ \___\ / / /\ \ \         / / /\ \___\ / /\ \__/ / /   / /\/_/ /  \____\__/ /   / /\/_/  / / /\ \___/ // / /\/_/    
    \ \ \ \/___// / /  \ \ \        \ \ \ \/___// /\ \___\/ /   / / /   / /\/________/   / / /    / / /  \/____// / / ______  
     \ \ \     / / /___/ /\ \        \ \ \     / / /\/___/ /   / / /   / / /\/_// / /   / / /    / / /    / / // / / /\_____\ 
 _    \ \ \   / / /_____/ /\ \   _    \ \ \   / / /   / / /   / / /   / / /    / / /   / / /    / / /    / / // / /  \/____ / 
/_/\__/ / /  / /_________/\ \ \ /_/\__/ / /  / / /   / / /___/ / /__ / / /    / / /___/ / /__  / / /    / / // / /_____/ / /  
\ \/___/ /  / / /_       __\ \_\\ \/___/ /  / / /   / / //\__\/_/___\\/_/    / / //\__\/_/___\/ / /    / / // / /______\/ /   
 \_____\/   \_\___\     /____/_/ \_____\/   \/_/    \/_/ \/_________/        \/_/ \/_________/\/_/     \/_/ \/___________/    
                                                                                                                              
*/
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)

#define endl '\n'
#define pb emplace_back
#define mkp make_pair
#define p_q priority_queue
#define INF 2000000000
#define PI 3.1415926
#define coutdb cout << fixed << setprecision(13)

const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};
const long long MOD = 1e9+7;

// typedef long long ll;
#define int long long

template <typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

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

  int L, R; cin >> L >> R;
  if(R/2019 > L/2019){
    cout << 0 << endl;
    return 0;
  }
  L %= 2019; R %= 2019;
  if(R <= L) cout << 0 << endl;
  else {
    int mn = 114514;
    for(int i = L; i <= R; i++){
      for(int j = i+1; j <= R; j++){
        mn = min(mn, (i*j)%2019);
      }
    }
    cout << mn << endl;
  }
}

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

using namespace std;
using ll = long long;
#define all(x) (x).begin(), (x).end()
#define asc(v) sort(all(v))

int main() {
	int N, t=0, tmp1, tmp2;
	vector<pair<int, int>> tasks;
	bool result = false;
	
	cin >> N;
	for(int i=0; i<N; i++) {
		cin >> tmp1 >> tmp2;
		tasks.push_back(make_pair(tmp2, tmp1));
	}
	asc(tasks);
	
	for(int i=0; i<tasks.size(); i++){
		t += tasks[i].second;
		if(t > tasks[i].first) {
			cout << "No" << "\n";
			return 0;
		}
	}
	
	cout << "Yes" << "\n";
	
	return 0;
}


Measured memory_bytes: 2420
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <sstream>
#include <fstream>
#include <cmath>
#include <stack>
#include <queue>
#include <list>
#include <map>

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;

#define MAX(x,y) ( (x) > (y) ? (x) : (y) )
#define MIN(x, y) ( (x) < (y) ? (x) : (y) )
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define IVFOR(p,a) for(vector<int>::iterator p = (a).begin(); p!=(a).end(); p++)
#define ILFOR(p,a) for(list<int>::iterator p = (a).begin(); p!=(a).end(); p++)
#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define CHECK(x)  cout << #x << " = " << (x) << endl
#define FINA(y) cout << (y) << endl

int main(){

  int n;
  cin >> n;

  char s[n];
  cin >> s;

  int max = 0;
  int x = 0;
  
  FOR(i,0,n){
    if(s[i] == 'I'){
      x++;
      if(x > max)
	max = x;
    }
    else
      x--;
  }

  FINA(max);

 return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val s = StringBuilder(readLine()!!)
    val list = listOf("dream","dreamer","erase","eraser")
 
    while (s.isNotEmpty()){
        val erase = list.find { s.endsWith(it) }
        if(erase==null){
            println("NO")
            return
        }else{
            s.delete(s.length-erase.length , s.length)
        }
    }
    println("YES")
}

Measured memory_bytes: 39144
import Data.List

solve :: [Int] -> [Int] -> Int
solve as bs = if sum d1 * (-1) > sum d2
                 then -1 else chd1 + chd2
  where
    ab = sort . map (uncurry (-)) $ zip as bs
    (d1,d2) = span (<= 0) ab
    chd1 = length . filter (/=0) $ d1
    chd2 = fst . foldl f (0,sum d1 * (-1)) $ reverse d2
    f (c,r) d = if r > 0 then (c+1,max 0 (r-d)) else (c,r)

main :: IO ()
main = do
    _ <- getLine
    a <- map read . words <$> getLine :: IO [Int]
    b <- map read . words <$> getLine :: IO [Int]
    print $ solve a b

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

inline void init(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
}

int main() {
	init();
	int n, m;
	cin >> n >> m;
	vector<int> st, ed;
	for(int i = 0; i < m; ++i){
		int a, b;
		cin >> a >> b;
		if(a == 1)
			st.push_back(b);
		if(b == n)
			ed.push_back(a);
	}
	sort(ed.begin(), ed.end());
	for(auto num : st)
		if(binary_search(ed.begin(), ed.end(), num)){
			cout << "POSSIBLE";
			return 0;
		}
	cout << "IMPOSSIBLE";
	return 0;
}


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

int main() {
  string s;cin>>s;
  int n=s.size();
  rep(i,n){
    s.pop_back();
    int x=s.size();
    if(s.substr(0,x/2)==s.substr(x/2)){
      cout<<x<<endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3588
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
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;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    ll p = 1;
    ll ans = 0;
    REP(i, n) {
        ll a; cin >> a;
        if (a > p) {
            if (a%p==0) {
                ans += (a/p-1);
                if (p==1) p++;
            } else ans += a/p;
        }
        else if (a==p) p++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define int64 long long
#define uint64 unsigned long long
using namespace std;

int main()
{
	int64 nn, sum = 0;
	cin >> nn;
	vector<int64> aa(nn);
	for(int64 ii = 0;ii < nn;ii++)
	{
		cin >> aa[ii];
		sum ^= aa[ii];
	}
	for(int64 ii = 0;ii < nn;ii++)
	{
		cout << (sum ^ aa[ii]) << ' ';
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 4688
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;

int main() {
  int a,b,c,d,e,k;
  cin >> a >>b >>c>>d>>e>>k;
  if (e-a > k) cout << ":(" << endl;
  else cout << "Yay!" << endl;
  return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>

using namespace std;
typedef long long ll;

int gcd(int x, int y) {
  if (x < y) swap(x, y);
  while (y > 0) {
    int r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//for(int i = ; i < ; i++){}

int main(){
  int n;
  cin>>n;
  cout<<n/3<<endl;
  return 0;
}




Measured memory_bytes: 256
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
    static final Scanner     sc = new Scanner(System.in);
    static final PrintStream so = System.out;
    static int MOD = (int)1E9 + 7;
    public static void main(String[] args) {
        int n = ni();
        long[] s = new long[n+1];
        s[0] = 1;
        s[1] = 1;
        for (int i = 2; i <= n; i++) {
            s[i] = s[i-1] + s[i-2];
            s[i] %= MOD;
        }
        
        int m = ni();
        if (m == 0) {
            so.println(s[n]);
            return;
        }
        
        int[] a = new int[m + 2];
        for (int i = 1; i <= m; i++) {
            a[i] = ni();
        }
        a[m+1] = n+1;
        long ans = s[a[1]-1];
        
        for (int i = 2; i <= m+1; i++) {
            int diff = a[i] - a[i-1] - 2;
            if (diff < 0) {
                so.println(0);
                return;
            }
            
            ans *= s[diff];
            ans %= MOD;
        }
        so.println(ans);
    }
    
    
    static int gcd(int m, int n) {
        if(m < n) return gcd(n, m);
        if(n == 0) return m;
        return gcd(n, m % n);
    }
    
    static long lcm(int m, int n) {
        return (long) m * n / gcd(m, n);
    }

    private static long nl() {
        return sc.nextLong();
    }

    private static int ni() {
        return sc.nextInt();
    }

    private static String ns() {
        return sc.next();
    }

    private static char[] nsToChars() {
        return sc.next().toCharArray();
    }

    private static long[] nlongs(int n) {
        return nlongs(n, 0);
    }
    private static int[] nints(int n) {
        return nints(n, 0);
    }

    private static long[] nlongs(int n, int offset) {
        long[] a = new long[offset + n];
        for (int i = 0; i < n; i++)
            a[offset + i] = nl();
        return a;
    }

    private static int[] nints(int n, int offset) {
        int[] a = new int[offset + n];
        for (int i = 0; i < n; i++)
            a[offset + i] = ni();
        return a;
    }
}


Measured memory_bytes: 48848
using System;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        var N = Int64.Parse(Console.ReadLine());
        var count = Math.Sqrt(N);
        var ans = int.MaxValue;
        for (int i=1;i<=count;++i)
        {
            if (N % i == 0)
            {
                var num1 = i+1;
                var num2 = N / i + 1;
                var num = Math.Max(Math.Ceiling(Math.Log10(num1)), Math.Ceiling(Math.Log10(num2)));
                if (num < ans) ans = (int)num;
            }
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>  // sort, 二分探索, etc
#include <iomanip>  // setprecision (浮動小数点の出力の誤差)
#include <map>
#include <queue>
#include <set>
#include <stack>

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=a,i##_len=(b);i<i##_len;++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define cauto const auto&
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define SIZE(x) ((ll)(x).size()) // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 1000000007
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

using namespace std;
using ll = long long;
using ull = unsigned long long;

template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b;return true;}return false;}

const char newl = '\n';

ll qp(ll a,ll b){ll ans=1;do{if(b&1)ans*=a;a*=a;}while(b>>=1);return ans;}
ll qp(ll a,ll b,ll mod){ll ans=1;do{if(b&1)ans=ans*a%mod;a=a*a%mod;}while(b>>=1);return ans;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll comb(int n, int r) {
    vector<vector<ll> > v(n+1, vector<ll>(r+1, 0));
    for(int i=0;i<n+1;i++) {v[i][0]=1; if(i < r+1)v[i][i]=1; }
    for(int i=1;i<n+1;i++) {for(int j=1;j<min(i,r+1);j++) {v[i][j]=v[i-1][j-1]+v[i-1][j];}}
    return v[n][r];
}

// INT_MAX   = 2.1e+09 (2147483647)
// LONG_MAX  = 9.2e+18 (9223372036854775807)
// LLONG_MAX = 9.2e+18 (9223372036854775807)


int main() {
    string s;
    cin >> s;

    if (s == "ABC") {
        cout << "ARC" << newl;
    } else {
        cout << "ABC" << newl;
    }


    return 0;
}


Measured memory_bytes: 3104
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

//解説ガン見

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

ll A[5001], B[200][5001], C[5002][5002];
int daishou[5002];
int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);


	int N = getint(), M = getint();
	rep1(i, N - 1) A[i + 1] = getint() + A[i];
	rep1(i, N) rep(j, M) B[j][i] = ((ll)getint() << 20) + i;

	const int m = (1 << 20) - 1;
	rep(i, M) {
		memset(daishou, 0, sizeof(daishou));
		sort(B[i] + 1, B[i] + N + 1);
		rep1(j, N) {
			int x = B[i][j] & m;
			int b = B[i][j] >> 20;

			daishou[x] = x;
			int shou = daishou[x - 1];
			if (!shou) shou = x;
			int dai = daishou[x + 1];
			if (!dai) dai = x;

			C[shou][dai] += b;
			C[x + 1][dai] -= b;
			C[shou][x - 1] -= b;
			daishou[dai] = shou;
			daishou[shou] = dai;
		}
	}

	rep1(i, N) for (int j = N; j > i; j--) {
		C[i][j - 1] += C[i][j];
	}
	for (int j = N; j > 0; j--) rep1(i, j - 1) {
		C[i + 1][j] += C[i][j];
	}

	ll kotae = 0;
	rep1(i, N) for (int j = N; j >= i; j--) {
		ll kari = A[i] - A[j] + C[i][j];
		if (kotae < kari) kotae = kari;
	}
	printf("%lld", kotae);

	Would you please return 0;
}

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

int main(){
    int n,a,b;
    cin >> n >> a >> b;
    int ans1, ans2;
    ans1 = min(a,b);
    cout << ans1;
    cout << ' ';
    if(n-a >= b) cout << 0 << endl;
    else if(n-a < b){
        ans2 = b - (n-a);
        cout << ans2 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
 
class Main{
    public static void main(String[] args){
        BufferedReader sc=new BufferedReader(new InputStreamReader(System.in));
        try{
	    String[] st = sc.readLine().split(" ");
	    int N = Integer.valueOf(st[0]), M = Integer.valueOf(st[1]);
	    int[] pool = new int[N];
	    TreeSet<Integer> aa = new TreeSet<Integer>();
	    for(int i=0; i<N; i++)
	        pool[i]=Integer.valueOf(sc.readLine());
	    int c = 0;
	    for(int i=N-1; i>=0; i--){
		if(!aa.contains(pool[i])){
		    System.out.println(pool[i]);
		    aa.add(pool[i]);
		    if(++c==M)
			break;
		}
	    }
	}catch(Exception e){
            System.out.println("Error");
	}
    }
}

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

int main(){
    int K, X, l, r;
    cin >> K >> X;
    l = max(-1000000, X-(K-1));
    r = min(1000000, X+(K-1));
    for(int i = l;i <= r;i++){
        cout << i << ' ';
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
  
int main() {
  int a,b,c,x,y,min,i,t;
  cin>>a>>b>>c>>x>>y;
  min=a*x+b*y;
  for (i = 0; i <= max(x,y); i++) {
    if(x-i>=0 and y-i>=0){
      t=a*(x-i)+b*(y-i)+c*2*i;
    }else if(x-i<0){
      t=b*(y-i)+c*2*i;
    }else{
      t=a*(x-i)+c*2*i;
    }
    if(min>t){
      min=t;
    }
  }
  cout << min << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
    vector<int> a(3);
    for(auto &i : a)cin>>i;
    sort(a.begin(),a.end());
    if(a[0]==a[2])cout<<1;
    else if(a[0]==a[1]||a[1]==a[2])cout<<2;
    else cout<<3;
}


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

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

    int a, b;
    cin >> a >> b;
    if (a < 10 && b < 10)
        cout << a * b << endl;
    else
        cout << -1 << endl;
    return 0;
}

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

using namespace std;

int main () {

    int n, k;
    cin >> n >> k;
    int poz;
    for(int i = 1; i <= n; ++i) {
        int x;
        cin >> x;
        if(x == 1) poz = i;
    }

    int best = 1e9;
    for(int i = 1; i <= k; ++i) {
        int dr = max(0, n-poz-(k-i));
        int st = max(0, poz-1-(i-1));

        best = min(best, st / (k - 1) + dr / (k - 1) + (st%(k-1)!=0) + (dr%(k-1)!=0));
    }

    cout << best + 1;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
    int A, B, res, tap; cin >> A >> B;
    res = 1;
    tap = 0;
    while(true)
    {
        if (res >= B)
        {
            break;
        }
        res--;
        res += A;
        tap++;
    }
    cout << tap << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int co[5];
  	for(int i=0;i<5;i++){
    	cin>>co[i];
    }
  	int k;cin>>k;
    	if(co[4]-co[0]>k){
          cout<<":("<<endl;
    		return 0;
        }
          cout<<"Yay!"<<endl;
    		return 0;
  
  
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)
typedef pair<int, int> pi;
typedef pair<int, pi> pii;
#define f first
#define s second
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<pii> vpii;
#define pb push_back
#define pf push_front
#define all(v) v.begin(), v.end()
#define INF (int) 1e9 + 100
#define LLINF (ll) 1e18
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

int h, hh, m, mm, k;

int main() {
	fastio; cin >> h >> m >> hh >> mm >> k;
	int a = h * 60 + m, b = hh * 60 + mm;
	cout << max(0, b-k-a) << "\n";
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
	int a[3][3], b[3][3] = {0};
	for (int i = 0; i < 3; ++i)
	{
		for (int j = 0; j < 3; ++j)
			cin >> a[i][j];
	}
	int n;
	cin >> n;
	while (n --)
	{
		int num;
		cin >> num;
		for (int i = 0; i < 3; ++i)
		{
			for (int j = 0; j < 3; ++j)
			{
				if (num == a[i][j])
					b[i][j] = 1;
			}
		}
	}
	int ans = 0;
	for (int i = 0; i < 3; ++i)
	{
		if (b[i][0] && b[i][1] && b[i][2])
			ans = 1;
		if (b[0][i] && b[1][i] && b[2][i])
			ans = 1;
	}
	if (b[0][0] && b[1][1] &&  b[2][2])
		ans = 1;
	if (b[0][2] && b[1][1] && b[2][0])
		ans = 1;
	if (ans)
		cout << "Yes" << '\n';
	else
		cout << "No" << '\n';

	return 0;
}

Measured memory_bytes: 3544
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   main.cpp                                           :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: monoue <marvin@student.42.fr>              +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/22 12:30:15 by monoue            #+#    #+#             */
/*   Updated: 2020/04/23 15:16:21 by monoue           ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include <bits/stdc++.h>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/algorithm/string/classification.hpp> // is_any_of
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/math/tools/minima.hpp>

#define MOD 1e9+7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = (n); i >= 0; --i)

namespace adaptor = boost::adaptors;
using namespace std;
using boost::math::tools::brent_find_minima;
using boost::irange;
using boost::algorithm::join;
using boost::algorithm::split;
using boost::algorithm::replace_all;
using boost::multiprecision::cpp_int;
using ll = long long;
using P = pair<int, int>;

// TOP
void	Main()
{
	ll	n;
	cin >> n;
	vector<ll>	V(n);
	rep(i, n)
		cin >> V.at(i);
	sort(V.begin(), V.end(), greater<>());
	vector<ll>	VB(2);
	ll j = 0;
	rep(i, n - 1)
	{
		if (V.at(i) == V.at(i + 1))
		{
			VB.at(j) = V.at(i);
			j++;
			if (j > 1)
				break ;
			i++;
		}
	}
	cout << VB.at(0) * VB.at(1) << endl;
}
// END

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


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef  vector<int> vi ;
typedef  vector<string> vs ;
typedef  vector<long long> vl ;
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) FOR(i,0,n)
ll freq[10000000] = {0};
int main() {
	int p,q,r;
  cin>>p>>q>>r;
  vi lol;
  lol.push_back(p);
  lol.push_back(q);
  lol.push_back(r);
  sort(lol.begin(),lol.end());
  cout<<lol[0]+lol[1]<<endl;
	return 0;
}


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

using namespace std;

long long mem[405][405];
int ans[405][405];
int n;
long long arr[405];


int main()
{
	cin >> n;
	for(int i=1;i<=n;i++)
	{
		cin >> arr[i];
		arr[i]+=arr[i-1];
	}
	for(int i=1;i<=n;i++)
	{
		mem[i][i]=0;
		ans[i][i]=i;
	}
	for(int len=1;len<n;len++)
	{
		for(int i=1;i+len<=n;i++)
		{
			int j=i+len;
			int ll=ans[i][j-1],rr=ans[i+1][j];
			mem[i][j]=(1LL<<60);
			for(int k=ll;k<=rr;k++)
			{
				long long cur=arr[j]-arr[i-1]+mem[i][k]+mem[k+1][j];
				if(cur<mem[i][j])
				{
					mem[i][j]=cur;
					ans[i][j]=k;
				}
			}
		}
	}
	cout << mem[1][n] << endl;
}

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

int main() {
    int N;
    cin >> N;
    vector<vector<int>> F(N, vector<int>(10));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 10; j++) {
            cin >> F[i][j];
        }
    }
    vector<vector<int>> P(N, vector<int>(11));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 11; j++) {
            cin >> P[i][j];
        }
    }

    int res = INT32_MIN;
    for (int i = 1; i < (1 << 10); i++) {
        int sum = 0;
        for (int j = 0; j < N; j++) {
            int cnt = 0;
            for (int k = 0; k < 10; k++) {
                if ((i >> k) & 1 && F[j][k]) cnt++;
            }
            sum += P[j][cnt];
        }
        res = max(res, sum);
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

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

        doStuff();
    }

    public static void doStuff() 
	{
        String s = in.nextLine();
		char[] c = s.toCharArray();
		char[] c2 = new char[c.length];
		for(int i = 0; i < c.length; i++)
		{
			c2[i] = c[c.length - i - 1];
		}
		
		String toRet = new String(c2);
		
		System.out.println(toRet);
    }

    public static void solve() 
	{
    
    }
}

Measured memory_bytes: 15292
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static final PrintWriter out = new PrintWriter(System.out,false);

	static void solve() throws IOException{
		int[][] table = new int[30][30];
		String s;
		while ((s = br.readLine()) != null) {
			String[] ss = s.split(",");
			int x = Integer.parseInt(ss[0]) + 10;
			int y = Integer.parseInt(ss[1]) + 10;
			int size = Integer.parseInt(ss[2]);

			switch(size) {
				case 3:
					table[x-2][y]++;
					table[x][y-2]++;
					table[x+2][y]++;
					table[x][y+2]++;
				case 2:
					table[x-1][y-1]++;
					table[x+1][y-1]++;
					table[x-1][y+1]++;
					table[x+1][y+1]++;
				case 1:
					table[x][y]++;
					table[x-1][y]++;
					table[x][y-1]++;
					table[x+1][y]++;
					table[x][y+1]++;
			}
		}

		int cnt = 0, max = 0;

		for (int i=10; i<20; i++) {
			for (int j=10; j<20; j++) {
				if (table[i][j] == 0) cnt++;
				else max = Math.max(max, table[i][j]);
			}
		}

		out.println(cnt);
		out.println(max);
	}

	public static void main(String[] args) throws Exception {
		long start = System.currentTimeMillis();

		solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		br.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}

Measured memory_bytes: 24292
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n):return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)
# from sys import setrecursionlimit
# setrecursionlimit(1000000)
# from collections import Counter,deque,defaultdict
# import itertools
# import math
# import networkx as nx
# from bisect import bisect_left,bisect_right
# from heapq import heapify,heappush,heappop
a,b,m=n1()
A=n1()
B=n1()
X=n3(m)

A2=sorted(A)
B2=sorted(B)
ans=A2[0]+B2[0]
for a,b,c in X:
    if A[a-1]+B[b-1]-c<ans:
        ans=A[a-1]+B[b-1]-c
    
print(ans)

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

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// chmax, chmin
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

void solve(long long N, std::string S) {
  int ans = 0;
  for(int i = 0 ; i + 3 <= S.size() ; i++){
    if( S.substr(i, 3) == "ABC"){
      ans++;
    }
  }
  cout << ans << endl;
}

int main() {
  long long N;
  scanf("%lld", &N);
  std::string S;
  std::cin >> S;
  solve(N, S);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll ZERO = 0;
const int Inf = 1000000000;
const ll INF= 1e18;
const ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<ll,ll> P;

int main() {
    ll Q,H,S,D;
    cin >> Q >> H >> S >> D;
    int N;
    cin >> N;
    S = min(Q * 4,min(H * 2,S));
    ll ret = 0;
    if(N % 2 == 1) {
        N--;
        ret += S;
    }
    ret += min(N * S,N / 2 * D);
    cout << ret << endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	// Code for B - Not Found
	var S string
	fmt.Scanf("%s", &S)

	ans := make(map[string]int, len(S))
	for i := 0; i < len(S); i++ {
		ans[string(S[i])]++
	}

	for i := 0; i < 26; i++ {
		char := string('a' + i)
		if ans[char] == 0 {
			fmt.Println(char)
			break
		}
		if i == 25 {
			fmt.Println("None")
		}
	}

}


Measured memory_bytes: 2828
N = int(input())

res = [0 for x in range(4)]

for i in range(N):
    a = input()
    if a == 'AC':
        res[0] += 1
    elif a == 'WA':
        res[1] += 1
    elif a == 'TLE':
        res[2] += 1
    else:
        res[3] += 1


print('AC x ' + str(res[0]))
print('WA x ' + str(res[1]))
print('TLE x ' + str(res[2]))
print('RE x ' + str(res[3]))

Measured memory_bytes: 9216
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(true){
        	String sent = sc.nextLine();
        	if(sent.equals("END OF INPUT"))break;
        	String[] sent2 = sent.split(" ") ;//" "??§?????????
        	for(int i=0;i<sent2.length;i++){//???????????°
        		System.out.print(sent2[i].length());//??????????????????
        	}
        	System.out.println();
        }
    }
 
}

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

vector<int>to[200005];//辺を入力するための配列を準備
vector<int>ans;//答の配列を準備
void dfs(int v,int p=-1){
  //注目しているのはv、親は第二引数なし、デフォルト引数
  for(int u:to[v]){//辺に沿ってvに入るuを一つ一つチェック
    if (u==p)continue;//逆走させない枝刈り
    ans[u]+=ans[v];//累積和、今がv、次がu
    /*cout<<ans[v]<<endl;
    cout<<ans[u]<<endl;
    cout<<"---------"<<endl;*/
    dfs(u,v);//再帰、uが始点、vが終点?
  }
}
int main(){
  int n,q;
  cin>>n>>q;  
  rep(i,n-1){
    int a,b;
    cin>>a>>b;
    --a;--b;//ノード番号は1始まりなので0始まりに修正
    to[a].push_back(b);//aに入る辺はbから
    to[b].push_back(a);
  }
  ans.resize(n);//resizeしないとエラー、ノード数の配列が必要
  rep(i,q){
    int p,x;
    cin>>p>>x;
    --p;//ノード番号は1始まりなので0始まりに修正
    ans[p]+=x;//ノードpに対して大きさxを加える
    /*cout<<x<<endl;
    cout<<ans[p]<<endl;
    cout<<"---------"<<endl;*/    
  }
  dfs(0);//ゼロから深さ優先探索を開始、親はp=-1（デフォルト引数）
  rep(i,n){//ノード0からの大きさを出力
    cout<<ans[i]<<endl;
  }
  return 0;
}

Measured memory_bytes: 23424