akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ARB ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define bp  __builtin_popcount
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const int maxn=1e5+5;
const  double EPS = 1e-14;

int main()
{
    ARB
    ll l, r;
    cin >> l >> r;
    ll ans=1e9;
    int rj = r/2019, lj = l/2019;
    if(lj==rj)
        for(ll i=l; i<=r-1; i++)
        {
            for(ll j=i+1; j<=r; j++)
            {
                ans = min(ans, i*j%2019);
            }
        }
    else
        ans = 0;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = 1; i <= (int)(n); i++)
#define drep(i, n) for(int i = (n)-1; i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()
#define dup(x,y) (((x)+(y)-1)/(y))
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
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; }

// Mod int
const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%mod+mod)%mod){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%mod+mod)%mod; return *this;}
  mint operator-() const { return mint(0) - *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=mod) x-=mod; return *this;}
  mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}
//

const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> s(h);
  rep(i, h) cin >> s[i];
  vvi dist(h, vi(w, INF));
  if (s[0][0] == '#') {cout<<-1<<endl; return 0;};
  vvi used(h, vi(w, 0));
  dist[0][0] = 0;
  used[0][0] = 1;
  queue<P> q;
  q.emplace(0, 0);
  while (!q.empty()) {
    int i = q.front().first, j = q.front().second;
    q.pop();
    int d = dist[i][j];
    rep(dir, 4) {
      int ni = i + di[dir], nj = j + dj[dir];
      if (ni<0||nj<0||ni>=h||nj>=w) continue;
      if (s[ni][nj] == '#') continue;
      if (used[ni][nj]) continue;
      dist[ni][nj] = d + 1;
      used[ni][nj]++;
      q.emplace(ni, nj);
    }   
  }
  if (dist[h-1][w-1] == INF) {cout << -1 << endl; return 0;};
  int ans = h*w;
  rep(i, h) rep(j, w) if (s[i][j] == '#') ans--;
  ans -= dist[h-1][w-1] + 1;
  cout << ans << endl;
}

Measured memory_bytes: 3668
const Main = input => {
  input = input.split("\n")

  const n = parseInt(input[0], 10)
  const arr = input[1].split(' ')

  const rec = (memo, i) => {
    if (i === n) return 1 / memo
    return rec(memo + 1 / parseInt(arr[i], 10), i + 1)
  }

  console.log(rec(0, 0))
}

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

Measured memory_bytes: 7500
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int n,a[200009];
	double len,len2;
	string s;
	cin>>n;
	// sprintf(len, "%.9f", n/3); 

	len=n/3.000000;
	len2=n-(2*len);
	 printf("%.10f\n", len * len2 * len );
	// float temp = float(len);
	// cout<<len*len*len2;
	// cout<<len*len*len;
	
	return 0;
}

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

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = INT()

def make_divisors(n):
	for i in range(floor(n**0.5), 0, -1):
		if n % i == 0:
			if i <= 10**9 and n//i <= 10**9:
				return i

			if i != n // i:
				if n//i <= 10**9 and S//(n//i) <= 10**9:
					return i

a = ceil(S**(1/2))
b = ceil(S**(1/2))
if a * b == S:
	c = d = 0
else:
	c = make_divisors(a*b-S)
	if c == 0:
		c = d = 0
	else:
		d = ((a*b)-S)//c
print(0, 0, a, d, c, b)


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

int main(){
    ll A,B,C,X,Y;cin>>A>>B>>C>>X>>Y;
    ll ans=1e9;
    for(int i=0;i<=100000;++i){
        ll tmp=A*i;
        int j=Y;
        if(X-i>0){
            tmp+=2*C*(X-i);
            j-=X-i;
        }
        tmp+=min(B*max(0,j),2*C*max(0,j));
        ans=min(ans,tmp);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
  #define endl "\n"
  #define ll long long int
  #define vi vector<int>
  #define vll vector<ll>
  #define vvi vector < vi >
  #define pii pair<int,int>
  #define pll pair<long long, long long>
  #define mod 1000000007
  #define inf 1000000000000000001;
  #define all(c) c.begin(),c.end()
  #define mp(x,y) make_pair(x,y)
  #define mem(a,val) memset(a,val,sizeof(a))
  #define pb push_back
  #define f first
  #define se second
  
  using namespace std;
  int main()
  {
    std::ios::sync_with_stdio(false);
    ll n=0,m=0,k=0,x=0,t1=0,t2=0,t3=0,f=0,sum=0,count=0;

    cin>>n>>k;
    ll arr[n+1],dp[n+1];
    arr[0]=inf; dp[0]=0; 
   
    for (ll i = 1; i <= n; ++i){
      cin>>arr[i];
    }
    dp[1]=0;

    for (ll i = 2; i <= n; ++i)
    {
      dp[i]=INT_MAX;
      for (ll j = 1; j <=k; ++j)
      {
        if(i-j>=0)
         dp[i]=min(abs(arr[i]-arr[i-j])+dp[i-j],dp[i]);
      }
    }

    cout<<dp[n]<<endl;

    return 0;
  }



Measured memory_bytes: 5136
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define MAXN 100101
#define LL long long
using namespace std;
int n;
int a[MAXN],loc[MAXN],l[MAXN],r[MAXN],ls[MAXN],rs[MAXN];
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
        l[i]=i-1;
        r[i]=i+1;
        loc[a[i]]=i;
    }
    LL ans=0;
    for(int i=1;i<n;i++)
    {
        int tx=loc[i],L=l[tx],R=r[tx];
        ans+=((L?(ls[L]+1)*(LL)(rs[tx]+1):0)+(R<=n?(ls[tx]+1)*(LL)(rs[R]+1):0))*(LL)i;
        rs[L]=ls[R]=R-L-1;l[R]=L;r[L]=R;
     
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 2560
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.IO.Compression;
using System.Linq;
using System.Numerics;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        private const long COMDIV = 1000000007;
        static void Main(string[] args)
        {
            var AB = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Console.WriteLine(AB[0] * AB[1]);
        }

    }
}

Measured memory_bytes: 28300
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
 
using namespace std;
typedef long long ll;
 
int main(){
  int N,K;
  cin >> N >> K;

  vector<int> a(N);
  for(auto &ai:a) cin >> ai;

  map<int,int> v;

  int cur=0;
  int scur=0;
  for(cur=0;cur<min(N,K-1);cur++){
    scur+=a[cur]; scur%=K;
    v[scur-cur-1]++;
    //cout << scur-cur-1 << endl; 
  }
  ll ans=v[0];

  
  int rcur=0;
  for(int i=0;i<N;i++){
    rcur+=a[i]; rcur%=K;
    v[rcur-i-1]--;
    //cout << "# " << rcur-i-1 << endl; 
    if(cur<N){
      scur+=a[cur]; scur%=K;
      v[scur-cur-1]++;
      //cout << scur-cur-1 << endl; 
      cur++;
    }
    ans+=v[rcur-i-1]+v[rcur-i-1-K];
  }

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


Measured memory_bytes: 19840
// --https://kenkoooo.com/atcoder/#/table/soma62jp
#include <iostream>
#include <string>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstring>

using namespace std;

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

	int N,X,ans,cnt;

	cin >> N >> X;

	cnt = N;
	ans = X;

	vector<int> m(N);

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

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

	cnt += ans / m[0];

	cout << cnt << endl;

	return 0;

}


Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.*;
public class Main {
	

	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String n = sc.nextLine();
		String s = sc.nextLine();
		char[] chars = s.toCharArray();
		
		int ans = 0;
		for(int i=0; i< chars.length; i++) {
			if(chars[i] == 'A') {
				if(i + 2 >= chars.length) {
					break;
				}
				
				if(chars[i+1] == 'B' && chars[i+2] == 'C') {
					ans += 1;
				}
			}
		}
		
		System.out.println(ans);
		

		


		
		
	}
	


}

 

Measured memory_bytes: 21844
/*jai_ganeshdeva*/

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pu push  //  adds the value to the last of the queue 
#define lld long long int
#define ins insert /// used in set to insert the values 
#define adv advance  /// used to increment the iterator
#define mp make_pair
#define fi first
#define se second
#define all(c) c.begin(),c.end()
#define PI 3.1415926
#define INF (lld)1e18
#define vl  vector<long long int >
#define vpl vector< pair<lld ,lld> >
#define vvl vector<vector<lld> > 
#define pll pair <lld,lld>
#define modA(cccc,bbbb ,p) (((cccc+bbbb)%p+p)%p)
#define modS(cccc,bbbb ,p) (((cccc-bbbb)%p+p)%p)
#define modM(cccc,bbbb ,p) ((((cccc%p)*(bbbb%p))%p+p)%p)

long long int modp(lld a,lld p,lld n)
{
    lld d[100];
    lld i,j,k,l;
    if(n==0) return 1;
    for(i=0;n>=1;i++)
    {
        d[i]=n%2;
        n/=2;
    }
    l=i;
    long long int e=1;
    if(d[0]==1) e*=(a%p);
    for(i=1;i<l;i++)
    {
        a*=a;
        a=a%p;
        if(d[i]==1) 
        {
            e*=a;
            e=e%p;
        }
    }
    return e%p;
}
lld modInverse(lld n, lld p) 
{ 
    return modp(n, p, p-2); 
}

lld fac[1000001]; 

void getfac(lld p)
{
    fac[0] = 1; 
    for (lld i=1 ; i<=200000; i++) 
        fac[i] = fac[i-1]*i%p; 
}    

long long int nCrmodp(lld n, lld r,lld p) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
     
    return (fac[n]* modInverse(fac[r], p) % p * 
            modInverse(fac[n-r], p) % p) % p; 
}


long long int gcd(lld b,lld a)
{
    if(a<b) return gcd(a,b);
    if(a%b==0) return b;
    return gcd(a%b , b);
}

lld p1=1e9 + 7,p2=998244353;
lld l,r,mid,ans=0;
lld n,i,j,k,m;
lld x,y,n1,b=0,a,n2,h,z,c;
vector<vector<lld> > v(200001);
vector<bool > visited(200001,false);
vector<lld> w(200001),pa(200001);

queue<lld> q;
void bfs()
{
    q.pu((lld)1);
    while(!q.empty())
    {
        x=q.front();
        q.pop();
        if(visited[x]==true)
            continue;
        visited[x]=true;
        l=v[x].size();
        for(i=0;i<l;i++)
        {
            if(visited[v[x][i]]==false)
            {
                w[v[x][i]] = w[x]+1;
                pa[v[x][i]] =x;
                q.pu(v[x][i]);
            }
        }
    }
}
void solve()
{
    cin>>x>>n;
    lld s=0;
    for(i=0;i<n;i++)
    {
        cin>>l;
        s+=l;
    }
    if(s>=x) cout<<"Yes";
    else cout<<"No";
}



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t=1;
    
    //cin>>t;
    //cout<<t;
     //getfac(p1);
    //check the value by which modulo is to be taken
    for(int i=0;i<t;i++)
    {
   //     cout<<"Case #"<<i+1<<": ";
           solve();
        cout<<"\n";
    }
    return 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define yawn ios_base::sync_with_stdio(false); cin.tie(NULL);
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b){return (a*b)/gcd(a, b);}
int freq1[300005];
bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
}
int main()
{
    yawn;
    int n;
    cin>>n;
    map< string, vector< pair<int,int> >  > a;
    for(int i=0;i<n;++i)
    {
       string x; int y;
       cin>>x>>y;
        a[x].push_back(make_pair(i+1,y));
    }
    for(auto x : a)
    {
        sort(x.second.rbegin(),x.second.rend(),sortbysec);
        for(int i=0;i<x.second.size();++i)
        {
            cout<<x.second[i].first<<endl;
        }
    }
}


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

namespace c
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] hw = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int h = hw[0];
            int w = hw[1];
            string[] a = new string[h];
            string[] odd = new string[h];
            string[] even = new string[h];
            for (int i = 0; i < h; i++)
            {
                a[i] = Console.ReadLine();
            }

            //even
            for (int i = 0; i < h; i++)
            {
                StringBuilder sb = new StringBuilder();
                if (i % 2 == 0)
                {
                    for (int j = 0; j < w - 1; j++)
                    {
                        sb.Append('#');
                    }
                    sb.Append('.');
                }
                else
                {
                    sb.Append('#');
                    for (int j = 1; j < w; j++)
                    {
                        sb.Append(a[i][j]);
                    }
                }
                even[i] = sb.ToString();
            }
            //odd
            for (int i = 0; i < h; i++)
            {
                StringBuilder sb = new StringBuilder();
                if (i % 2 == 1)
                {
                    sb.Append('.');
                    for (int j = 0; j < w - 1; j++)
                    {
                        sb.Append('#');
                    }
                }
                else
                {
                    for (int j = 0; j < w - 1; j++)
                    {
                        sb.Append(a[i][j]);
                    }
                    sb.Append('#');

                }
                odd[i] = sb.ToString();
            }

            for (int i = 0; i < h; i++)
            {
                Console.WriteLine(even[i]);
            }
            Console.WriteLine();
            for (int i = 0; i < h; i++)
            {
                Console.WriteLine(odd[i]);
            }
        }
    }
}


Measured memory_bytes: 9048
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define P pair<ll,ll>
#define Graph vector<vector<ll>>
#define INF (1ll<<60)
#define mod 1000000007
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;}

int main(){
    ll n,k;cin>>n>>k;
    vector<ll> a(n),ins(n);
    rep(i,n){
        cin>>a[i];
        ins[i]=a[i];
    }

    ll ans=INF;
    rep(i,(1<<n)){
        ll visible=1;//見える建物の数
        rep(j,n){
            if(j==0) continue;
            if((i>>j)&1) visible++;
        }
        if(visible<k) continue;//k個以上じゃないとだめ

        ll sum=0;//見るのに必要な費用
        ll MAX=0;//j個目のビルの手前にある建物のうち、最大の高さ
        rep(j,n){
            if(j==0) continue;
            if((i>>j)&1){
                rep(k,j) MAX=max(MAX,a[k]);
                if(MAX-a[j]+1ll>=0){    
                    sum+=(MAX-a[j]+1ll);
                    a[j]+=(MAX-a[j]+1ll);
                }
            }
        }

        rep(j,n) a[j]=ins[j];//aを元に戻す

        ans=min(ans,sum);
    }

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

Measured memory_bytes: 256
//----------------------------------------------------------------------
// ITP1_1_B:   X Cubic
//----------------------------------------------------------------------

//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include <iostream>

//----------------------------------------------------------------------
// Definitions
//----------------------------------------------------------------------

//----------------------------------------------------------------------
// Entry point
//----------------------------------------------------------------------
int main()
{
    size_t result = 1, num = 0;

    std::cin >> num;

    for( size_t calcCnt = 0; calcCnt < 3; ++calcCnt )
    {
        result *= num;
    }

    std::cout << result << std::endl;

    return 0;
}

Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,T;
  cin>>n>>T;
  int cmin=1001;
  for(int i=0;i<n;i++){
    int c,t;
    cin>>c>>t;
    if(t<=T&&c<cmin){cmin=c;}
  }
  if(cmin==1001){cout<<"TLE"<<endl;}
  else{cout<<cmin<<endl;}
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include <bitset>
#include <list>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    ll s[n+1];
    s[0]=0;
    for(int i=1; i<=n; i++){
        ll a;
        cin >> a;
        s[i]=s[i-1]+a;
    }
    sort(s,s+n+1);
    ll ans=0, cnt=0, curr=s[0];
    for(int i=0; i<n+1; i++){
        if(s[i]==curr) cnt++;
        else{
            ans+=cnt*(cnt-1)/2;
            curr=s[i];
            cnt=1;
        }
    }
    ans+=cnt*(cnt-1)/2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
import bisect
A, B, Q = map(int, input().split())
INF = float('inf')
s = [-INF] + [int(input()) for _ in range(A)] + [INF]
t = [-INF] + [int(input()) for _ in range(B)] + [INF]

for q in range(Q):
    x = int(input())
    b,d = bisect.bisect_right(s,x), bisect.bisect_right(t,x)
    res = INF
    for S in [s[b-1], s[b]]:
        for T in [t[d-1], t[d]]:
            d1, d2 = abs(S-x) + abs(T-S), abs(T-x) + abs(S-T)
            res = min(res, d1,d2)
    print(res)
    


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

typedef long long ll;

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

    int n; cin >> n;
    vector<int> t(n),x(n),y(n);
    for(int i=0;i<n;i++) cin >> t[i] >> x[i] >> y[i];
    int a,b,c;
    a = b = c = 0;
    bool ok = true;
    for(int i=0;i<n;i++){
        int uku = abs(x[i]-b)+abs(y[i]-c);
        if(t[i]-a>=uku && (t[i]-a)%2==uku%2){
            a = t[i];
            b = x[i];
            c = y[i];
        }else{
            ok = false;
            break;
        }
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 1408
using System;

namespace ABC152
{
	class Program
	{
		static void Main(string[] args)
		{
			string[] strs = Console.ReadLine().Split(' ');
			int n = int.Parse(strs[0]);
			int m = int.Parse(strs[1]);

			string result = "";

			if(n == m)
			{
				result = "Yes";
			}
			else
			{
				result = "No";
			}

			Console.WriteLine(result);
		}
	}
}


Measured memory_bytes: 11092
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(container) container.begin(),container.end()
#define fast ios::sync_with_stdio(0); cin.tie(0)
#ifndef ONLINE_JUDGE
#include "debug.cpp"
#endif
#define int long long
const int mod = 1e9+7;  
int power(int a,int b) { if(b==0) return 1; int res = power(a,b/2); if(b&1) return res * res * a; else return res * res; }

bool possible(int mid,int k,int ar[],int n){
  for(int i=0;i<n;i++){
    if(ar[i]>mid) k = k - ar[i]/mid;
  }
  return k>=0;
}

int32_t main(){
    
  fast;
  int n,k; cin >> n >> k;
  int ar[n] = {0};

  for(int i=0;i<n;i++) cin >> ar[i];

  int low = 1, high = *max_element(ar,ar+n);
  int ans = -1;

  while(low<=high){
    int mid = low + (high-low)/2;
    if(possible(mid,k,ar,n)){
      ans = mid;
      high = mid - 1;
    }else{
      low = mid + 1;
    }
  }

  cout << ans;

  return 0;
}

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

int main()
{   
    long int a, b, c;
    while (scanf("%ld", &a) != EOF) {
        scanf("%ld", &b);
        c = a * b;
        while (a != b) {
            if (a > b)
                a = a - b;
            else
                b = b - a;
        }
        printf("%ld ", a);
        printf("%ld\n", c / a);
    }
    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] lines = line.split(" ");
		int X = Integer.parseInt(lines[0]);
		int A = Integer.parseInt(lines[1]);

		if(X < A) {
			System.out.println(0);
		}else {
			System.out.println(10);
		}
	}

}


Measured memory_bytes: 35824
function Main(input){
    input = input.split("\n");
    var n = parseInt(input[0],10);
    var k = 1;

    var u = [];
    for(var i = 0;i < n;i++){
        u[i] = input[k++];
    }

    var m = parseInt(input[k++],10);var st = 1;
    for(var i = 0;i < m;i++){
        var t = input[k++];var flag = true;
        for(var j = 0;j < n;j++){
            if(t == u[j]){
                if(st == 1)
                    console.log("Opened by " + t);
                else
                    console.log("Closed by " + t);
                st *= -1;
                flag = false;
                break;
            }
        }
        if(flag)
            console.log("Unknown " + t);
    }
}
Main(require("fs").readFileSync("/dev/stdin","utf8"));

Measured memory_bytes: 16928
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sqr(x) ((x)*(x))
#define mp make_pair
#define uint unsigned
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){
	int x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(int a){
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
	write(a); puts("");
}
const int N=3005;
inline int ksm(ll a,int b,int mod){
	int ans=1;
	for(;b;b>>=1){
		if(b&1)ans=ans*a%mod;
		a=a*a%mod;
	}
	return ans;
}
int n,mod,ans;
int s[N][N],c[N][N];
signed main(){
	n=read(); mod=read();
	s[0][0]=c[0][0]=1; 
	for(int i=1;i<=n+1;i++){
		s[i][1]=1; c[i][0]=1;
		for(int j=1;j<=i;j++)c[i][j]=(c[i-1][j]+c[i-1][j-1])%mod;
		for(int j=2;j<=n+1;j++)s[i][j]=((ll)s[i-1][j]*j+s[i-1][j-1])%mod;
	}
	for(int i=0;i<=n;i++){
		int sum=0,jb=ksm(2,n-i,mod); ll dq=1;
		for(int j=0;j<=i;j++){
			int t=(ll)dq*c[n][i]%mod,sss=0;
			//if(i<=10)cout<<i<<" "<<j<<" "<<sss<<" "<<s[i+1][j+1]<<endl;
			sum=(sum+(ll)s[i+1][j+1]*t)%mod;
			dq=dq*jb%mod;
		}
		sum=(ll)sum*ksm(2,ksm(2,n-i,mod-1),mod)%mod;
		ans=(ans+(i&1?-1:1)*sum)%mod;
		//cout<<i<<" "<<sum<<endl;
	}
	cout<<(ans+mod)%mod<<endl;
}
/*
问题：选出任意个不同的n位2进制数，满足对于任意位数，都至少出现了两个1
容斥，求至少i位最多出现1个1的方案数
即对于其中i位，这些数并没有交集 
对于这i位，可以不选，也可以分配掉
这i位有值中有k个出现1个1，i-k没出现1，的选了j个数 
可以发现答案是c(n,i)*c(i,k)*s(k,j)*(2^((n-i)*j))
但这i位没1的情况呢？
这i位没1有2^(n-i)个数，每个选和不选都可以，直接乘2^(2^(n-i)) 
ss是第二类斯特林数的前缀和 
*/ 

Measured memory_bytes: 69504
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
int main()
{
	int n;
	int w[110];
	int i,j;
	int min = 0;
	scanf("%d", &n);
	for (i = 1;i <= n;i++)scanf("%d", &w[i]);
	for (i = 1;i <= n;i++)
	{
		int x;
		int left = 0;
		int right = 0;
		for (j = 1;j <= n;j++)
		{
			if (j <= i)left += w[j];
			else right += w[j];
		}
		x = abs(right - left);
		if(i==1)min = x;
		if (x<min)min = x;
	}
	printf("%d\n", min);
	return 0;
}

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

int main(){
  
  int N, M;
  int tmp1;
  long tmp2;
  
  cin >> N >> M;
  
  vector<long> A(N);
  vector<pair<long, int>> CB(M);
  
  for (int i = 0; i < N; i++) cin >> A.at(i);
  for (int i = 0; i < M; i++) { 
    cin >> tmp1 >> tmp2;
    CB.at(i) = make_pair(tmp2, tmp1);
  }
  
  sort(CB.begin(), CB.end(), greater<pair<long, int>>());
  sort(A.begin(), A.end());
  int j = 0, k = 0;
  
  for (int i = 0; i < N ; i++) {
    if (A.at(i) < CB.at(j).first) {
      A.at(i) = CB.at(j).first;
      k++;
      if (k == CB.at(j).second) {
        k = 0;
        j++;
        if (j == M) break;
      }
    } else break;
  }
  
  cout << accumulate(A.begin(), A.end(), 0LL);
  
  return 0;
}

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

using namespace std;

int mod = 1e9 + 7;

int find(int a, vector<int>& group) {
    while (a != group[a]) {
        a = group[a];
    }
    return a;
}

void unite(int group_a, int group_b, vector<int>& group, vector<int>& rank) {
    if (rank[group_a] < rank[group_b]) swap(group_a, group_b);
    group[group_b] = group_a;
    rank[group_a] += rank[group_b];
    return;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    // N-1 -(built edges)
    int N, M, a, b;
    cin >> N >> M;
    vector<int> group(N + 1);
    for (int i = 0; i <= N; i++) {
        group[i] = i;
    }
    vector<int> rank(N + 1, 0);
    int ans = N - 1;
    for (int j = 0; j < M; j++) {
        cin >> a >> b;
        int group_a = find(a, group), group_b = find(b, group);
        if (group_a != group_b) {
            ans--;
            if (ans == 0) {
                cout << 0;
                return 0;
            }
            unite(group_a, group_b, group, rank);
        }
    }
    cout << ans;

    return 0;
}

Measured memory_bytes: 3988
import Data.List

main :: IO ()
main = getLine >>= main' . fmap read . words
    where
        main' [n, a, b] = getLine >>= mapM_ putStrLn . solve a b

solve :: Int -> Int -> String -> [String]
solve a b = walk 0 0
    where
        walk a' b' ('a' : xs')
            | a' + b' < a + b = "Yes" : walk (a' + 1) b' xs'
            | otherwise = "No" : walk a' b' xs'
        walk a' b' ('b' : xs')
            | a' + b' < a + b && b' < b = "Yes" : walk a' (b' + 1) xs'
            | otherwise = "No" : walk a' b' xs'
        walk a' b' (_ : xs')  = "No" : walk a' b' xs'
        walk _ _ _ = []


Measured memory_bytes: 5372
def main():
    n = int(input())
    d = list(map(int, input().split()))
    m = int(input())
    t = list(map(int, input().split()))
    d.sort()
    t.sort()
    x = -1
    y = -1
    while x < n and y < m-1:
        x += 1
        y += 1
        while x < n and d[x] != t[y]:
            x += 1
    if x < n:
        print("YES")
    else:
        print("NO")

if __name__ == "__main__":
    main()


Measured memory_bytes: 127568
//#define LOCAL

#ifndef LOCAL
#include <bits/stdc++.h>
#else
#include "total.h"
#endif
#define fori(n) for(long long i=0;i<n;i++)
#define forr(i,x,y) for(long long i=x;i<y;i++)
#define forj(n) for(long long j=0;j<n;j++)
#define ll long long
#define d7 1000000007
#define en cout<<"\n";

using namespace std;

void dfs(ll s, vector<bool> &v, vector<ll> adj[]){
    if(v[s]) return;
    v[s]=true;
    //cout<<s+1<<" ";
    for(auto u: adj[s]){
        if(!v
           [u]){
            dfs(u,v,adj);}
    }
}
void bfs(vector<ll> &dis, vector<ll> adj[], ll s, vector<ll> &parent){
    dis[s]=0;
    //parent[s]=-1;
    queue<ll> q;
    q.push(s);
    while(!q.empty()){
        ll z=q.front();
        //cout<<z<<" ";
        q.pop();
        for(auto v:adj[z]){
            if(dis[v]==0){
            q.push(v);
            dis[v]=dis[z]+1;
                parent[v]=z;
            }
        }
    }
}

ll modexp(ll x, ll n,ll m){
    if(n==0) return 1%m;
    ll u=modexp(x,n/2,m);
    u=(u*u)%m;
    if(n%2==1) u=(u*x)%m;
    return u;
}

ll gcd(ll a, ll b){
    if(b==0) return a;
    return gcd(b, a%b);
}

tuple<ll,ll,ll,ll> expA(tuple<ll,ll,ll,ll> v, ll n){
    if(n==0){return {1,0,1,0};}
    if(n==1){return v;}
        ll x1,y1,z1,w1;
        ll x2,y2,z2,w2;
        tie(x1,y1,z1,w1) = expA(v, n/2);
        x2=(x1*x1+y1*z1)%d7;
        y2=(x1*y1+y1*w1)%d7;
        z2=(z1*x1+w1*z1)%d7;
        w2=(z1*y1+w1*w1)%d7;
    if(n%2==0){
        return {x2,y2,z2,w2};
    }
    else{
        return {x2+z2,y2+w2,x2,y2};
    }
}

int main(){
    
    ll n;
    cin>>n;
    ll sum=0;
    fori(n){
        forj(n){
            for(ll kk=0;kk<n;kk++){
                sum+=gcd(kk+1,gcd(i+1,j+1));
            }
        }
    }
    cout<<sum;
    
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;

int main()
{
  string S,T;
  cin >> S >> T;
  int cnt = 0;
  REP(i,S.size()){
    if(S.at(i)!=T.at(i)){
      cnt++;
    }
  }

  cout << cnt << endl;
}

Measured memory_bytes: 3920
#include<stdio.h>
#include<string.h>
int main()
{
    long long int N,t,S[100];
    scanf("%lld",&N);
    int l=0;
    int P=0;
    t=N;
    while(N!=0)
    {
        S[l]=N%10;
        N=N/10;
        P=P+S[l];
        l++;
    }
if(t%P==0)
    printf("Yes\n");
else
    printf("No\n");

}


Measured memory_bytes: 1620
#include <bits/stdc++.h>
using namespace std;
int main ()
{
    long long n, q, w, e, r;
    cin >> n;
    q=0;
    w=0;
    e=0;
    r=0;
    for (int i=0; i<n; ++i)
    {
        string t;
        cin >> t;
        if (t=="AC")
            q+=1;
        else if (t=="WA")
            w+=1;
        else if (t=="TLE")
            e+=1;
        else
            r+=1;
    }
    cout << "AC x " << q << endl;
    cout << "WA x " << w << endl;
    cout << "TLE x " << e << endl;
    cout << "RE x " << r << endl;
}


Measured memory_bytes: 3628
#include<cstdio>
int I,O,T,J,L,S,Z,now,ans;
int main()
{
	scanf("%d%d%d%d%d%d%d",&I,&O,&T,&J,&L,&S,&Z);
	now=(I&1)+(J&1)+(L&1);
	if(now>=2&&I&&J&&L)
	{
		--I,--J,--L;
		ans+=3;
	}return printf("%lld\n",ans+O+I/2*2+J/2*2+L/2*2),0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define MS(x, i) memset(x, i, sizeof x)
#define debug(x) cout << #x << ": " << x << endl
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define MOD 1000000007
#define NOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

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

const int maxn = 1e5 + 10;
const int inf = 0x3f3f3f3f;
char F[200];

inline ll read() {
    ll ret = 0, sgn = 1;
    char ch = getchar();
    while(ch < '0' || ch > '9'){
        if(ch == '-') sgn = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9'){
        ret = ret*10 + ch - '0';
        ch = getchar();
    } 
    return ret*sgn;
}

inline void write( ll x ) {
    ll tmp = x > 0 ? x : -x;
    if(x < 0) putchar('-');
    int cnt = 0;
    while(tmp > 0) {
        F[cnt++] = tmp % 10 + '0';
        tmp /= 10;
    }
    while(cnt > 0) putchar(F[--cnt]);
}

int main()
{
    NOS
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);

    int n, r;
    cin >> n >> r;

    if(n >= 10)
        cout << r << endl;
    else
        cout << 100 * (10 - n) + r << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main {

  public static String getParent(int i, int[] h) {
    if (i == 1)
      return "";
    return "parent key = " + h[(int) (i / 2) - 1] + ", ";
  }

  public static String getLeft(int i, int[] h) {
    int childIdx = i * 2;
    if (childIdx > h.length)
      return "";
    return "left key = " + h[childIdx - 1] + ", ";
  }

  public static String getRight(int i, int[] h) {
    int childIdx = i * 2 + 1;
    if (childIdx > h.length)
      return "";
    return "right key = " + h[childIdx - 1] + ", ";
  }

  public static void printProperties(int i, int[] h) {
    System.out.print("node " + i + ": ");
    System.out.print("key = " + h[i-1] + ", ");
    System.out.print(getParent(i, h));
    System.out.print(getLeft(i, h));
    System.out.print(getRight(i, h));
    System.out.println();
  }

  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    int n = s.nextInt();
    int[] h = new int[n];
    for (int i = 0; i < n; i++) {
      h[i] = s.nextInt();
    }
    s.close();
    for (int i = 1; i <= n; i++) {
      printProperties(i, h);
    }
  }
}



Measured memory_bytes: 27372
#include<cstdio>
#include<vector>
#include<algorithm>


using namespace std;
using ll=long long;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vi>;


int main(void)
{
	int n, k;

	while(scanf("%d%d", &n, &k)==2)
	{
		vi a(n);
		int x;

		for(int i=0;i<n;i++)
		{
			scanf("%d", &a[i]);
			if(a[i]==1) x=i;
		}

		printf("%d\n", (n-1-1)/(k-1)+1);
	}

	return 0;
}


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

int64_t gcd(int64_t a,int64_t b){
  int64_t r=max(a,b)%min(a,b);
  if(r==0){
    return min(a,b);
  }
  return gcd(min(a,b),r);
}
int main(){
  int N;
  cin >> N;
  vector<int64_t> A(N);
  cin >> A.at(0);
  int64_t ans=A.at(0);
  for(int i=1;i<N;i++){
    cin >> A.at(i);
    ans=gcd(ans,A.at(i));
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	char b;
	cin >> b;
	if (b == 'A') cout << 'T';
	else if (b == 'T') cout << 'A';
	else if (b == 'C') cout << 'G';
	else cout << 'C';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,n)  for (int i=(int)(a); i<=(int)(n); ++i)
#define rrep(i,a,n) for (int i=(int)(a); i>=(int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) rep(i, x.size()) cerr << x[i] << (i == x.size() - 1 ? "\n" : " ")
#define all(x) x.begin(),x.end()
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;

//=============================
int N,M,K;
string S,T;
vector<int> A;
vector<int> B;
//=============================
void input()
{
    cin>>N>>M>>K;
}
//=============================
void func(){}
//=============================
void solve()
{
    cout<<(N+M>=K ? "Yes" : "No")<<endl;

}
//=============================
signed main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 256
h,w = map(int,input().split())
a = [input() for _ in range(h)]
b = 0
check = True
for i in range(h):
  for j in range(w):
    if b == j:
      if a[i][j] == ".":
        check = False
    elif b+1 == j:
      if a[i][j] == "#":
        b = j
    else:
      if a[i][j] == "#":
        check = False
  if not check:
    break
if check:
  print("Possible")
else:
  print("Impossible")

Measured memory_bytes: 9120
#include<bits/stdc++.h>
#include<unistd.h>
using namespace std;
#define pb(x) push_back(x);
typedef long long  int ll;
ll mod = 998244353;
ll hmaxii=0;
vector<ll>values[2*100000+1];
ll MAXN = 2*100000+1;
ll spf[2*100000+1];
//vector<ll>values[];
ll diff,x,y,z;
ll flag=1;ll price[1001][1001];

ll gcd(ll a,ll b) { return b?gcd(b,a%b):a; }



void solution(){
    int n;
    cin>>n;
    int temp = n%10;
    string ss;
    if(temp==3){
        ss="bon";
    }
    else if(temp==0||temp==1||temp==6||temp==8){
        ss="pon";
    }
    else{
        ss="hon";
    }
    cout<<ss<<endl;
}


int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //sieve();
    /*ll powe[64];
    powe[0]=1;
    ll i=1;
    while(i<64){
        powe[i] = powe[i-1]*2;
        i++;
    }*/
    ll t;
    //cin>>t;
    t=1;
    while(t--){
        solution();
    }
    return 0;
}


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

int max(int a, int b)
{
   if(a > b) return a;
  return b;
}

int main()
{
  int n; cin>>n;
  int arr[n];
  for(int i = 0; i < n; i++)
    cin>>arr[i];
  int ans = 0;
  int cnt = 0;
  for(int i = 0; i < n - 1; i++)
  {
    if(arr[i] >= arr[i + 1]) cnt++;
    else
    {
      ans = max(ans,cnt);
      cnt = 0;
    }
  }
  cout<<max(ans,cnt);
  
  return 0;
}

Measured memory_bytes: 640
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

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

            if (a + b == c || a + c == b || b + c == a) {
                out.println("Yes");
            } else {
                out.println("No");
            }
        }
    }
}



Measured memory_bytes: 21588
#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(void){
  int r;
  cin >> r;
  cout << r*r << endl;
  return 0;
}

Measured memory_bytes: 3640
N, M = gets.split.map(&:to_i)
H = gets.split.map(&:to_i)
arr = Array.new(N) { Array.new() }
M.times do
  a, b = gets.split.map(&:to_i)
  arr[a - 1].append(b)
  arr[b - 1].append(a)
end
# p arr
good = N
arr.each_with_index do |hill, ind|
  max = H[ind]
  flag = false
  hill.map do |a|
    if max <= H[a - 1]
      flag = true
    end
  end
  good -= 1 if flag
end
puts good


Measured memory_bytes: 26960
/*
16:50 - 17:23
 */

#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<algorithm>
#include<cassert>
#include<climits>
#include<iomanip>
#include<string>
#include<cstring>
#include<cstdlib>

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define IINF (INT_MAX)
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b)) < EPS)
#define MAX 500
#define pow2(a) ((a)*(a))

using namespace std;


// Library - maxflow - begin 17:01
struct edge{
  int to,cap,rev;
  edge(int to=IINF,int cap=IINF,int rev=IINF):to(to),cap(cap),rev(rev){}
};

vector<vector<edge>> G;
bool used[MAX];

void add_edge(int from,int to,int cap){
  G[from].push_back(edge(to,cap,G[to].size()));
  G[to].push_back(edge(from,0,G[from].size()-1));
}

int dfs(int v,int t,int f){
  if(v==t)return f;
  used[v] = true;
  for(int i=0;i<G[v].size();i++){
    edge &e = G[v][i];
    if(!used[e.to] && e.cap > 0){
      int d = dfs(e.to,t,min(f,e.cap));
      if(d>0){
	e.cap -= d;
	G[e.to][e.rev].cap += d;
	return d;
      }
    }
  }
  return 0;
}

int max_flow(int s,int t){
  int flow = 0;
  for(;;){
    memset(used,0,sizeof(used));
    int f = dfs(s,t,IINF);
    if(f == 0)return flow;
    flow += f;
  }
}

// Library - maxflow - end 17:07

struct Point{
  double x,y,v;
  Point(double x=IINF,double y=IINF,double v=IINF):x(x),y(y),v(v){}
};

struct Data{
  double cost;
  int from,to;
  Data(double cost=IINF,int from=IINF,int to=IINF):cost(cost),from(from),to(to){}
  bool operator < (const Data& a)const{ return cost < a.cost; }
};

int N,M,source,sink;
Point troops[MAX];
Point base[MAX];
bool check[MAX];
vector<Data> info;


inline double getDist(Point a,Point b){ return sqrt(pow2(a.x-b.x)+pow2(b.y-a.y)); }

int main(){
  while(cin >> N >> M, N|M){
    info.clear();
    rep(i,N)cin >> troops[i].x >> troops[i].y >> troops[i].v;
    rep(i,M){
      cin >> base[i].x >> base[i].y; check[i] = false;
      rep(j,N)info.push_back(Data(getDist(base[i],troops[j])/troops[j].v,j,N+i));
    }
    sort(info.begin(),info.end());
    source = N+M; sink = source+1;
    G.resize(sink+1);
    rep(i,sink+1)G[i].clear();
    rep(i,N)add_edge(source,i,1);
    rep(i,M)add_edge(N+i,sink,1);
    int finish = 0;
    /*
    int sp = 0;
    rep(i,info.size()){
      add_edge(info[i].from,info[i].to,1);
      if(!check[info[i].to-N]){ finish++; check[info[i].to-N] = true; }
      sp = i + 1;
      if(finish == M)break;
    }
    */
    vector<vector<edge>> tmp = G;
    double ans = IINF;
    double L = 0, R = (1<<27),H;
    rep(_,100){
      H = (L+R)*0.5;
      G = tmp;
      rep(i,info.size()){
	if(equals(info[i].cost,H) || info[i].cost < H)add_edge(info[i].from,info[i].to,1);
	else break;
      }
      if(max_flow(source,sink) == M){
	ans = min(ans,H);
	R = H;
      } else L = H;
    }

    cout << setiosflags(ios::fixed) << setprecision(8) << ans << endl;

  }
  return 0;
}

Measured memory_bytes: 1680
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define call(var) cout<<#var<<"="<<var<<endl;
#define dup(x,y) (((x)+(y)-1)/(y))
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
const int INTMAX = 2147483647;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

int main(){
    ll n;cin >> n;
    int count = 1;
    for(ll k=2;k*k<=n-1;++k){
        if((n-1)%k==0){
            ++count;
            if((n-1)/k!=k) ++count;
            cerr << "err1 " << k << endl;
        }
    }

    for(ll k=2;k*k<=n;++k){
        if(n%k==0){
            ll m = n;
            while(m%k==0 && m!=0) m /= k;
            cerr << k << " " << m << endl;
            if(m%k==1){
                cerr << "err2 " << k << endl;
                ++count;
            }
        }
    }
    if(n%(n-1)==1) ++count;
    cout << count << endl;
}

Measured memory_bytes: 256
#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/dynamic_bitset.hpp>
namespace adaptor = boost::adaptors;
using index_t = std::size_t;

namespace lib
{
	using graph_t = std::vector<std::set<index_t>>;
	template<class T>using weighted_graph_t = std::vector<std::map<index_t, T>>;
	template<class T>using pair = std::pair<T, T>;

	struct max_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::max(lhs, rhs);
		}
	};
	struct min_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::min(lhs, rhs);
		}
	};

	constexpr max_t max;
	constexpr min_t min;

	template<class T>auto order_by(T func)
	{
		return [=](auto&& lhs, auto&& rhs)
		{
			return func(lhs) < func(rhs);
		};
	}

	template<class T>constexpr auto max_v = std::numeric_limits<T>::max();
	template<class T>constexpr auto min_v = std::numeric_limits<T>::min();

	template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;
	
	template<class T>constexpr T pow(T val, std::uint64_t p)
	{
		auto ret = T(1);
		auto s = 1ULL;
		for (auto i = 0; i < 63; ++i, s <<= 1)
		{
			if (p & s)
			{
				ret *= val;
			}
			val *= val;
		}
		return ret;
	}
	template<class Range>void sort(Range& rng)
	{
		std::sort(std::begin(rng), std::end(rng));
	}
	template<class Range, class Pred>void sort(Range& rng, Pred pred)
	{
		std::sort(std::begin(rng), std::end(rng), pred);
	}
}

void Main()
{
	int x;
	std::cin >> x;
	std::cout << 1 - x << std::endl;
}

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

Measured memory_bytes: 3644
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    x,n=MI()
    pp=set(MI())
    for d in range(100):
        if x-d not in pp:
            ans=x-d
            break
        if x+d not in pp:
            ans=x+d
            break
    print(ans)

main()

Measured memory_bytes: 9212
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

long long N, K, ans;
long long P[1 << 18];

int main() {
	cin >> N >> K;
	for (int i = 0; i < N; i++) cin >> P[i];
	sort(P, P + N);
	for (int i = 0; i < K; i++) ans += P[i];
	cout << ans << endl;
	return 0;
}

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

int main() {
	int N,T;
	cin >> N >> T;
  vector<int> c(N);
  vector<int> t(N);
  rep(i,N){
    cin >> c[i] >> t[i];
  }
  int ans = 9999;
  rep(i,N){
    if(t[i]<=T){
      ans = min(ans,c[i]);
    }
  }
  cout << ((ans != 9999) ? to_string(ans) : "TLE") << endl;
}

Measured memory_bytes: 256