akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repq(i,a,n) for(int i=a; i<=n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int const MOD = 1000000007;

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

signed main() {
    int n, l; cin >> n >> l;
    vector<string> v(n);
    rep(i,0,n) cin >> v[i];
    sort(v.begin(), v.end());
    rep(i,0,n) {
        cout << v[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef long long ll;
//////////////////////////////////////////////////////
int main(){
	string s;
	int K;
	getline(cin,s);
	SCD(K);
	
	set<string> S;
	
	int l = s.size();
	
	FORq(i,0,l-1){
		FORq(j,1,K){
			S.insert(s.substr(i,j));
			//cout << s.substr(i , j) << endl; 
		}
	}
	
	REP(i,K-1){
		S.erase(S.begin());
		//cout << *S.begin() <<"\n";
	}
	
	cout << *S.begin() <<"\n";
	
	return 0;
}

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

def num_divisors_table(n):
    table = [0] * (n + 1)
    
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
    
    return table

table = num_divisors_table(1000000)

ans = 0

for c in range(1,N):
    ans += table[N-c]

print(ans)

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ld> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;  // 小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;     // 大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define TS to_string
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


ll INF = 1e9;
ll MOD = 1000000007;
ll LINF = 1e18;
ld EPS = 1e-9;
ld PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b;}     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}

//-----------------------------------------
ll power_mod(ll x, ll y, ll m){
  ll res = 1;
  if(y>0){
    res = power_mod(x,y/2,m);
    if(y%2==0) res = (res*res)%m;
    else res = (((res*res)%m)*x)%m;
  }
  return res;
}

ll hash_trans(char c){
  return (ll)(c) + 1;
}

vvll ER; // 探したい文字の方が長い時に返す

// len文字のハッシュ値を返す
vvll rolling_hash1D(string str, ll len){
  ll n = str.size();
  if(n < len) return ER; // ER を返す

  vll mod = {1000000000 + 7, 1000000000 + 9, 1000000000 + 21};
  vll base = {257};

  ll mods = mod.size();

  vvll res(n,vll(mods));

  for(ll m=0;m<mods;m++){
    ll k = power_mod(base[0],len,mod[m]);

    ll hog = 0;
    for(ll i=0;i<len;i++) hog = ( hog * base[0] % mod[m] + hash_trans(str[i])) % mod[m];

    for(ll i=0;i+len<=n;i++){
      res[i][m] = hog;
      if(i+len < n) hog = (hog * base[0] % mod[m] + hash_trans(str[i+len]) - hash_trans(str[i]) * k + mod[m] * mod[m]) % mod[m];
    }
  }

  return res;
}
//-----------------------------------------

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

  string s, t;
  cin >> s >> t;

  vvll hs = rolling_hash1D(s,SZ(t));
  if(hs == ER) return 0;

  vvll ht = rolling_hash1D(t,SZ(t));

  for(int i=0;i<=SZ(s)-SZ(t)+1;i++){
    if(hs[i]==ht[0]) cout << i <<endl;
  }

  return 0;
}




Measured memory_bytes: 3256
A, B, C, D = map(int, input().split())

Cw = C
Dw = D

if Cw < Dw:
    Cw, Dw = Dw, Cw
while Cw % Dw != 0:
    Cw, Dw = Dw, Cw % Dw

E = C * D // Dw

A -= 1

ans = (B - B // C - B // D + B // E) - (A - A // C - A // D + A // E)

print(ans)

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

int main() {
    long long n;
    cin >> n;
    int size = log10(n) + 1;
    string str = "";
    rep (i, size) str += "9";
    int top = 0;
    while (true) {
        long long va = stoll(str.c_str());
        if (va <= n) {
            int sum = va % 10;
            while ((va /= 10) != 0) sum += (va % 10);
            cout << sum << endl;
            break;
        }
        top += str[top] == '0';
        str[top]--;
    }
    return 0;
}

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

int main() {
  int n, x;
  scanf("%d%d", &n, &x);
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  sort(a.begin(), a.end());
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    if (i == n - 1) {
      ans += a[i] == x;
    } else if (x >= a[i]) {
      x -= a[i];
      ++ans;
    } else {
      break;
    }
  }
  printf("%d\n", ans);
  return 0;
}


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

using namespace std;

typedef long long int Int;

int main(void)
{
    char c;

    cin>>c;
    if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o')
	cout<<"vowel"<<endl;
    else
	cout<<"consonant"<<endl;

    return 0;
}


Measured memory_bytes: 256
#方針: 中心点は 101×101パターンしかないので全探索できる。
n = gets.to_i
ary = Array.new(n){gets.split.map(&:to_i)}.sort_by{|a| a[2]}.reverse

puts ans = catch(:answer) {
  (0..100).each do |i|
    (0..100).each do |j|
      tmp1 = [] #h>0が矛盾しないか判定用
      tmp2 =[] #h=0が矛盾しないか判定用

      ary.each do |a|
        if a[2]>0
          tmp1 << (a[0]-i).abs + (a[1]-j).abs + a[2]
        else
          tmp2 << tmp1[0] - (a[0]-i).abs - (a[1]-j).abs
        end
      end

      flag1 = tmp1.all?{|t| t == tmp1[0]}
      flag2 = tmp2.all?{|t| t <= 0}
      throw :answer, "%d %d %d" % [i,j,tmp1[0]] if flag1&&flag2
    end
  end
}

Measured memory_bytes: 2424
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <bitset>
#include<iomanip>//小数点以下を精度良く表示

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define INF 2000000000
#define INF2 1000000000000000000
#define rep(i,n) for(int i=0;i<(n);i++)
typedef pair<int, int> P;
const ll MOD=1000000007;
using Graph = vector<vector<int>>;


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;
}
int up(int a, int b) {
    return (a + a % b) / b;
}

void swap(string s) {
    int low = 0;
    int high = s.length()-1;
    while (low < high) {
        char tmp = s[low];
        s[low] = s[high];
        s[high] = tmp;
        low++;
        high--;
    }
}




int main(){
    int n;
    cin >> n;
    ll ans = 0;
    for (int i = 1; i <= n; i++) {
        if (i % 3 == 0 || i % 5 == 0) {
            continue;
        }
        else {
            ans += i;
        }

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

Measured memory_bytes: 3636
#include <iostream>

using namespace std;

int main()
{
	int  s;

	cin >> s;

	int a = s / 100, b = s%100;

	if ( (a >= 1 && a <= 12) && !( b >= 1 && b <= 12 ) ) {
		cout << "MMYY";
	}
	else if (!(a >= 1 && a <= 12) && (b >= 1 && b <= 12)) {
		cout << "YYMM";
	}
	else if ((a >= 1 && a <= 12) && (b >= 1 && b <= 12)) {
		cout << "AMBIGUOUS";
	}
	else {
		cout << "NA";
	}
}

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

int main()
{
	int n;cin>>n;
	int arr[n];
	long long int ans=0;
	int temp;
	for(int& i:arr)
		cin>>i;
	for(int i=1;i<n;i++)
	{
		temp=arr[i]-arr[i-1];
		if(temp<0)
		{
			arr[i]+=abs(temp);
			ans+=abs(temp);
		}
	}
	cout<<ans;
}
		



Measured memory_bytes: 4344
// #pragma GCC optimize("O3")
    #include<bits/stdc++.h>
    using namespace std;
     
    #define ll long long
    #define pb push_back
    #define N 1000000007
    #define N2 998244353
    #define Nmax 100001
    #define INF (ll)1e18
    #define pll pair<ll,ll>
    #define pii pair<ll,ll>
    #define mp make_pair
    #define fi first
    #define se second
    #define rep(i,n) rep2(i,0,n)
    #define rep2(i,m,n) for(ll i=m;i<(n);i++)
    #define get(n) ll (n); scanf("%lld",&(n));
    #define get2(n,k) ll (n),(k); scanf("%lld%lld",&(n),&(k));
    #define get3(n,m,k) ll (n),(m),(k); scanf("%lld%lld%lld",&(n),&(m),&(k));
    #define gets(s) string (s); cin >> (s);
    #define ALL(c) (c).begin(),(c).end()
    #define fill_nums(A,n) vector<ll> A((n)); for(ll i=0;i<n;i++) scanf("%lld",&A[i]);
    #define fill_edges(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1); adj[b-1].pb(a-1);}
    #define fill_direct(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1);}
    #define pi 3.1415926535897
     
    int main() {
        
        get2(n,m);
     
        vector<ll> A(m);
        vector<vector<ll>> C(m, vector<ll>());
     
        rep(i,m) {
            get2(a,b);
            A[i]=a;
     
            rep(j,b) {
                get(c);
                C[i].push_back(--c);
            }
        }
        
        ll val = pow(2,n)+1e-9;
        // cout<<val<<endl;
        vector<vector<ll>> dp(val, vector<ll>(m+1,-1));
        
        rep(i,m+1)
            dp[0][i]=0;
     
        rep2(i,1,val)
            dp[i][0]=INF;
     
        std::function<ll(ll,ll)> solve = [&](ll mask, ll idx) {
     
            // cout<<mask<<" "<<idx<<endl;
            if(idx==-1)
                return INF;
     
            if(dp[mask][idx]!=-1)
                return dp[mask][idx];
     
            ll ans = solve(mask, idx-1);
            ll orig = mask;
     
            for(auto i:C[idx-1])
                if((1<<i)&mask)
                    mask = mask ^ (1<<i);
     
            ans = min(solve(mask, idx-1)+A[idx-1],ans);
     
            return dp[orig][idx] = ans;
        };
     
        ll mini = INF;
        mini = min(solve(val-1,m),mini);
   
     
        printf("%lld\n",mini==INF ? -1 : mini);
     
        return 0;  
    }

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

int main(){
  int N,ans=0,Ave=0;
  double sum=0,ave=0;
  cin >> N;
  vector<int> x(N);
  for (int i=0;i<N;i++){
  cin >> x.at(i);
  sum+=x.at(i);
  }
  ave=(sum)/N+0.5;
  Ave=ave;
  for (int i=0;i<N;i++){
  ans+=(x.at(i)-Ave)*(x.at(i)-Ave);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())
l = list(map(int,input().split()))
ans = 0

for i in range(1,n):
    if l[i]-l[i-1] < 0:
        ans += abs(l[i]-l[i-1])
        l[i] = l[i]+abs(l[i]-l[i-1])


print(ans)

Measured memory_bytes: 105188
# Union-Find
# https://note.nkmk.me/python-union-find/
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

N = int(input())
xy = [0] * N
i_to_x = {}
for i in range(N):
    x, y = map(int, input().split())
    xy[i] = (x-1, y-1)
    i_to_x[i] = x-1

xy.sort(key=lambda x: x[1])

uf = UnionFind(N)

max_x = N-1
x_set = set()
hist_x_min = N
for x, y in xy:
    x_set.add(x)
    if x == max_x:
        while max_x in x_set:
            max_x -= 1
    else:
        uf.union(x, max_x)
#         print(x, max_x)
        if x < hist_x_min:
            for x_ in range(x+1, hist_x_min):
                uf.union(x, x_)
#                 print(x, x_)
    hist_x_min = min(hist_x_min, x)
#     print(max_x)
# print(uf)

ans = [0] * N
for i in range(N):
    ans[i] = uf.size(uf.find(i_to_x[i]))
print('\n'.join(map(str, ans)))

Measured memory_bytes: 94280
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset
typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;
#define mp make_pair
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
//void IO(){
//	#ifndef ONLINE_JUDGE
//	    freopen("input.txt", "r", stdin);
//	    freopen("output.txt", "w", stdout);
//	#endif
//}
// end of Template

str s,ans;
int k;
set <str> sub;
set <str> :: iterator itr;
void getlength(int x){
    if(x<=s.size()){
        str temp = "";
        for(int i=0;i<x;i++){
            temp += s[i];
        }
        sub.insert(temp);
        for(int i=x;i<s.size();i++){
            temp.replace(0,1,"");
            temp+=s[i];
            sub.insert(temp);
        }


    }

}
int main(){
	//IO();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>s;
    cin>>k;
    for(int i=1;i<=5;i++)getlength(i);
    int idx = 0;
    for(itr=sub.begin();itr!=sub.end();itr++){
        idx++;
        if(idx==k){ans=*itr;break;}
    }
    cout<<ans<<newl;
}


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

namespace HABIT{
    #define f(a,b,c,d) for(register int a=b,c=d;a<=c;a++)
    #define g(a,b,c,d) for(register int a=b,c=d;a>=c;a--)
    #define LOCAL
    typedef int i32;
    typedef unsigned int u32;
    typedef long long int i64;
    typedef unsigned long long int u64;
    typedef pair<i32,i32> pii;
    const i32 MAXN=1024;
    typedef i32 ar[MAXN];
    
    template<typename T> inline T Max(T a) { return a; }
    template<typename T,typename... Args> inline T Max(T a,Args... args){
        T b=Max(args...);
        return (a>b)?a:b;
    }
    template<typename T> inline T Min(T a) { return a; }
    template<typename T,typename... Args> inline T Min(T a,Args... args){
        T b=Min(args...);
        return (a<b)?a:b;
    }

    #ifdef LOCAL
        inline char gc() { return getchar(); }
    #else
        inline char gc() {
            static char s[1<<20|1]={0},*p1=s,*p2=s;
            return (p1==p2)&&(p2=(p1=s)+fread(s,1,1<<20,stdin),p1==p2)?EOF:*(p1++);
        }
    #endif
    inline i64 read(){
        register i64 ans=0;register char c=gc();register bool neg=0;
        while(c<48||c>57) neg^=!(c^'-'),c=gc();
        while(c>=48&&c<=57) ans=(ans<<3)+(ans<<1)+(c^48),c=gc();
        return neg?-ans:ans;
    }

    char Output_Ans[1<<20|1],*Output_Cur=Output_Ans;
    inline void output() { Output_Cur-=fwrite(Output_Ans,1,Output_Cur-Output_Ans,stdout); }
    inline void print(char c){
        if(Output_Cur-Output_Ans+1>>20) output();
        *(Output_Cur++)=c;
    }
    inline void print(char *s) { while(*s) print( *(s++) ); }
    inline void print(u64 x){
        if(!x) { print('0'); return ; }
        char buf[30]={0},*p=buf+28;
        while(x) *(p--)=x%10+48,x/=10;
        print(p+1);
    }
    inline void print(u32 x) { print( (u64)x ); }
    inline void print(i64 x){
        if(x<0) print('-'),x=-x;
        print( (u64)x );
    }
    inline void print(i32 x){
        if(x<0) print('-'),x=-x;
        print( (u64)x );
    }
}
using namespace HABIT;

i32 N,M,Q,Maxn,A[64],B[64],C[64],D[64],Tmp[16];
inline void pre(){
    N=read();
    M=read();
    Q=read();
    f(i,1,I,Q)
        A[i]=read(),B[i]=read(),C[i]=read(),D[i]=read();
}
inline void check(){
    i64 Ans=0;
    f(i,1,I,Q)
        if(Tmp[ B[i] ]-Tmp[ A[i] ]==C[i])
            Ans+=D[i];
    Maxn=Max(Ans,Maxn);
}
void dfs(i64 n,i64 minn){
    if(n==N+1){
        check();
        return ;
    }
    f(i,minn,I,M){
        Tmp[n]=i;
        dfs(n+1,i);
        Tmp[n]=0;
    }
}

int main(){
    pre();
    dfs(1,1);
    print(Maxn);
    output();
    return 0;
}

Measured memory_bytes: 3540
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    char s[102];
    while(cin>>n)
    {
        int vis[26];

        scanf("%s",s);
        //cout<<s[0]<<endl;
        int maxn=0;
        for(int i=1;i<n;i++)
        {
            memset(vis,0,sizeof(vis));
            int cnt=0;
            for(int j=0;j<i;j++)
            {
                for(int k=i;k<n;k++)
                {
                    //cout<<s[k]<<s[j]<<endl;
                    if(s[k]==s[j]&&vis[s[k]-'a']==0)
                    {
                        cnt++;
                        vis[s[k]-'a']=1;
                    }

                }
            }
            if(cnt>maxn)
                maxn=cnt;
        }
        cout<<maxn<<endl;

    }
    return 0;
}


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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;

#define rep(a,n) for(int a = 0;a < n;a++)
#define repi(a,b,n) for(int a = b;a < n;a++)

const ull mod = (ull)1e9 + 7;

int main(void)
{
	ll h, w, k;
	cin >> h >> w >> k;
	k--;
	vector<vector<ll>> dp(h+1, vector<ll>(w, 0));
	dp[0][0] = 1;
	for (int i = 1; i <= h; i++) {
		for (int j = 0; j < w; j++) {
			for (int a = 0; a < 1 << (w-1); a++) {
				bool valid = true;
				for (int d = 1; d < w; d++) {
					bool right = a & (1 << d);
					bool left = a & (1 << (d-1));
					if (right && left) {
						valid = false;
						break;
					}
				}
				if (!valid) continue;
				if (a & (1 << (j - 1))) {
					(dp[i][j - 1] += dp[i-1][j]) %= mod;
				}
				else if (a & (1 << j)) {
					(dp[i][j + 1] += dp[i-1][j]) %= mod;
				}
				else {
					(dp[i][j] += dp[i-1][j]) %= mod;
				}
			}
		}
	}
	cout << dp[h][k] << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ll MOD = (ll) (1e9 + 7);
const double PI = acos(-1.0);
const int limit = 200010;

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

//------------------------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    char c;
    cin >> c;
    if(c == 'A') cout << 'T' << endl;
    if(c == 'T') cout << 'A' << endl;
    if(c == 'G') cout << 'C' << endl;
    if(c == 'C') cout << 'G' << endl;
   
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(i,a,b) for(int i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
const int inf = 1<<30;
typedef long double ld;
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; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
int main(){
  int n;  cin >> n;
  vector<int> a(n),b(n,0);
  rep(i,0,n){
    int x;  cin >> x;
    a[i] = x+1;
  }
  b[0] = 3;
  ll ans = 1;
  rep(i,0,n){
    ans *= b[a[i]-1];
    ans %= mod;
    b[a[i]-1]--;
    b[a[i]]++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use itertools_num::ItertoolsNum;
#[allow(unused_imports)]
use std::cmp;
#[allow(unused_imports)]
use std::iter;
#[allow(unused_imports)]
use superslice::*;

fn run() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let n: usize = sc.read();
    let mut xl = sc.read_pairs::<i64>(n);

    xl.sort_by_cached_key(|x| x.0 + x.1);
    let mut prev = std::i64::MIN;
    let mut ans = 0;
    for (x, l) in xl.into_iter() {
        if prev <= x - l {
            ans += 1;
            prev = x + l;
        }
    }
    println!("{}", ans);
}

fn main() {
    std::thread::Builder::new()
        .name("run".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(run)
        .unwrap()
        .join()
        .unwrap();
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn read_pairs<T: std::str::FromStr>(&mut self, n: usize) -> Vec<(T, T)> {
        (0..n).map(|_| (self.read(), self.read())).collect()
    }
    pub fn read_pairs_1_indexed(&mut self, n: usize) -> Vec<(usize, usize)> {
        (0..n)
            .map(|_| (self.read::<usize>() - 1, self.read::<usize>() - 1))
            .collect()
    }
    pub fn read_chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    pub fn read_char_grid(&mut self, n: usize) -> Vec<Vec<char>> {
        (0..n).map(|_| self.read_chars()).collect()
    }
    pub fn read_matrix<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n)
            .map(|_| (0..m).map(|_| self.read()).collect())
            .collect()
    }
}


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

int main() {
    int a;
    cin>>a;
    vector<double> vec(a);
    double sum=0;
    rep(i,a){
        cin>>vec.at(i);
       // cout<<vec.at(i);
    }
    rep(i,a){
        sum+=1/vec.at(i);
       // cout<<1/vec.at(i)<<endl;
    }
    cout<<1/sum<<endl;

}



Measured memory_bytes: 256
// dile a la jardinera que traigo flores

#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define sz(x) int(x.size())
#define all(v) (v).begin(),(v).end()
#define trace(x) cout << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define FER(i,a,b) for(int i = int(a); i < int(b); ++i)
#define IFR(i,a,b) for(int i = int(a); i >= int(b); i--)
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef long double ld;

const ld conv=380000;

int main(){	
	fastio;
	cout<<fixed<<setprecision(8);
	int n;cin>>n;
	ld tot=0;
	FER(i,0,n){
		ld val;
		string s;
		cin>>val>>s;
		if(s=="BTC")val*=conv;
		tot+=val;
	}
	cout<<tot<<endl;
	return 0;
}


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


void solve(long long N){
    for (int i = sqrt(N); i > 0; i--)
    {
        if(N%i==0){
            cout<<i+N/i-2<<endl;
            return;
        }
    }
    
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
N,K = [int(i) for i in input().split()]
li = [int(i) for i in input().split()]
R = li[0]
S = li[1]
P = li[2]
Ta = input()
T = ['a'] * N
for i in range(N) :
    T[i] = Ta[i]
sum = 0
for i in range(N) :
    if i < N - K :
        if T[i] == "r" :
            if T[i+K] == "r" :
                T[i+K] = "k"
            sum+=P
        elif T[i] == "s" :
            if T[i+K] == "s" :
                T[i+K] = "k"
            sum+=R
        elif T[i] == "p" :
            if T[i+K] == "p" :
                T[i+K] = "k"
            sum+=S
        else :
            sum=sum
    else :
        if T[i] == "r" :
            sum+= P
        elif T[i] == "s" :
            sum+= R
        elif T[i] == "p" :
            sum+= S
        else :
            sum +=0
print(sum)

Measured memory_bytes: 4084
#include<bits/stdc++.h>
#define fo(i,a,b) for((i)=(a);i<=(b);i++)
#define rfo(i,a,b) for((i)=(a);i>=(b);i--)
#define inrange(x,y,z) (((x)>=(y))&&((x)<=(z)))
#define ALL(vec) ((vec).begin(),(vec).end())
#define SOR(vec) sort(ALL(vec))
#define UNI(vec) (vec).erase(unique(ALL(vec)),(vec).end())
using namespace std;
int n,x,mx;
string s;
int main(){
	#ifdef FILIN
		#ifndef DavidDesktop
			freopen(FILIN,"r",stdin);
			freopen(FILOUT,"w",stdout);
		#endif
	#endif
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>s;
	x=mx=0;
	for(int i=0;i<n;i++){
		if(s[i]=='I') x++;
		else x--;
		mx=max(mx,x);
	}
	cout<<mx<<endl;
	return 0;
}



Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        String[] lines = getStdin();
        
        for (int i = 0; i < lines.length; i++){
            String str = lines[i];
            String[] str1 = str.split(" ");
            int j = 0;
            int num = Integer.parseInt(str1[j]);
            int num1 = Integer.parseInt(str1[j + 1]);
            int n = num;
                if (num > num1){
                    num = num1;
                    num1 = n;
                    System.out.println(num + " " + num1);
                } else if (num == 0 && num1 ==0){
                    return;
                } else {
                    System.out.println(num + " " + num1);
                }
        }
    }

  
  private static String[] getStdin() {
    Scanner scanner = new Scanner(System.in);
    ArrayList<String> lines = new ArrayList<>();
    while (scanner.hasNext()) {
      lines.add(scanner.nextLine());
    }
    return lines.toArray(new String[lines.size()]);
  }
  
}



Measured memory_bytes: 38332
#include <iostream>

using namespace std;

int main(){
    
    // Your code here!
    while(true){
        int n,x;
        cin>>n>>x;
        int count=0;
        
        if(n==0 && x==0){
            break;
        }
        
        else if(n!=0 && x==0){
            cout<<0<<endl;
        }
        
        else{
            for(int a=1; a<=n-2; a++){
                for(int b=a+1; b<=n-1; b++){
                    for(int c=b+1; c<=n; c++){
                        if(a+b+c==x){
                            count+=1;
                        }
                    }
                }
            }
            cout<<count<<endl;
        }
    }
        
    return 0;
}



Measured memory_bytes: 3084
#include<bits/stdc++.h>
#include<limits>
#define ll long long
#define F first
#define S second
#define pb push_back
#define oo 1e18
#define endl '\n'
#define si size()
#define all(v) v.begin(),v.end()
#define FASTIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);

using namespace std;
int dx[] = {0,0,1,-1};
int dy[] = {1,-1,0,0};
const long double Pi=acos(-1),e=2.718;
const int N=3e3+10,mod=1e9+7;
ll n,a[N],dp1[N][N][2],k,dp2[N][N][2];
ll solve1(int L,int R,bool T){
    if(L>R)return 0;
    ll &ret=dp1[L][R][T];
    if(ret+1)return ret;
    if(T){
        ret = min(solve1(L,R-1,!T),solve1(L+1,R,!T));
    }
    else{
        ret = max(solve1(L,R-1,!T)+a[R],solve1(L+1,R,!T)+a[L]);
    }
    return ret;
}
ll solve2(int L,int R,bool T){
    if(L>R)return 0;
    ll &ret=dp2[L][R][T];
    if(ret+1)return ret;
    if(!T){
        ret = min(solve2(L,R-1,!T),solve2(L+1,R,!T));
    }
    else{
        ret = max(solve2(L,R-1,!T)+a[R],solve2(L+1,R,!T)+a[L]);
    }
    return ret;
}
int main()
{
    memset(dp1,-1,sizeof dp1);
    memset(dp2,-1,sizeof dp2);

    FASTIO
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    cout << solve1(0,n-1,0)-solve2(0,n-1,0) << endl;
    return 0;
}
/**

*/


Measured memory_bytes: 283520
#include <cstdio>
#include <algorithm>

int main() {
	double W, H, x, y;
	scanf("%lf %lf %lf %lf", &W, &H, &x, &y);
	bool flag = x == W / 2 && y == H / 2;
	printf("%.10f %d", W * H / 2, flag ? 1 : 0);
}

Measured memory_bytes: 128
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/STACK: 20000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define vec vector
#define all(x) x.begin(), x.end()
#define deb(x) cerr<<#x<<" = "<<x<<endl
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main(){IOS;
    ll x;cin>>x;
    ll much = x-x%500;
    ll less = (x-much)-(x-much)%5;
    cout<<much*2+less<<endl;
}

Measured memory_bytes: 256
n, a, b = map(int, input().split(" "))
sum = 0
for e in range(a, n + 1):
    c = 0
    ee = e
    while True:
        c += e % 10
        e = e // 10
        if e == 0:
            break
    if a <= c <= b:
        sum += ee
print(sum)

Measured memory_bytes: 8848
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
  int n,r;
  cin >> n >> r;
  if(n>=10) cout << r << "\n";
  else cout << r + 100*(10-n) << "\n";
  return 0;
}


Measured memory_bytes: 256
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))

def main():
    h,w = readInts()
    maze = [input() for _ in range(h)]
    print('#'*(w+2))
    for i in range(h):
        print('#' + maze[i] + '#')
    print('#'*(w+2))
if __name__ == '__main__':
  main()


Measured memory_bytes: 5272
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    vector<int> num(n + 1);
    map<int,int> mt;
    for (int i = 1;i <= n;i++) {
        cin >> num[i];
    }
    for (int i = 1;i <= n;i++) {
        mt[num[i]] = i;
    }
    for (int i = 1;i <= n;i++) {
        cout << mt[i] << " ";
    }
    cout << "\n";
}


Measured memory_bytes: 5888
a=[0]*5
a[0]=int(input())
a[1]=int(input())
a[2]=int(input())
a[3]=int(input())
a[4]=int(input())
amari=10
for i in range(5):
  if a[i]%10!=0:
    tmp=a[i]%10
  else:
    tmp=10
  amari=min(amari,tmp)
  a[i]=(int((a[i]-1)/10) + 1)*10
print(sum(a)-10+amari)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;

//inline int read(){int t = 0;int neg=1;char c;while((c=getchar_unlocked())!='\n'&&c!=' '&&c!=EOF){if(c=='-'){neg=-1;continue;}t=t*10+c-48;}return neg*t;}
//inline int readl(){long long t = 0;long long neg=1ll;char c;while((c=getchar_unlocked())!='\n'&&c!=' '&&c!=EOF){if(c=='-'){neg=-1ll;continue;}t=t*10+c-48;}return neg*t;}

#define debug(x) cout<<(#x)<<"="<<(x)<<", ";
#define debug1(x) debug(x) cout<<'\n';
#define debug2(x1, x2) debug(x1) debug(x2) cout<<'\n';
#define debug3(x1, x2, x3) debug(x1) debug(x2) debug(x3) cout<<'\n';
#define debug4(x1, x2, x3, x4) debug(x1) debug(x2) debug(x3) debug(x4) cout<<'\n';
#define debug5(x1, x2, x3, x4, x5) debug(x1) debug(x2) debug(x3) debug(x4) debug(x5) cout<<'\n';

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> pi;
typedef pair<lli,lli> plli;
typedef vector<int> vi;
typedef vector<lli> vlli;
typedef vector<pi> vpi;
typedef vector<plli> vplli;
const lli M=1000000007ll;

int main(){
	fast_io 
	string a,b; cin>>a>>b;
	a+=b[b.size()-1];
	if(a==b) cout<<"Yes";
	else cout<<"No";
	
	return 0;
}

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

int main() {
    int N; cin >> N;
    string s = to_string(N);
    ll res = 0;
    for (int i = 0; i < s.size(); i++) {
        res += s[i]-'0';
    }
    if (N % res == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>
#include <math.h>
using namespace std;

int main()
{
	int a, b;
	cin >> a >> b;
	if (a < b) {
		cout << "a < b" << endl;
	} else if (a > b) {
		cout << "a > b" << endl;
	} else {
		cout << "a == b" << endl;
	}

	return 0;
}



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

 #define PI 3.14159265358979323846264338327950L

 int main(void) {
 int a, b, h, m;
 scanf("%d%d%d%d", &a, &b, &h, &m);

 long double rad = PI * 2 * (
 (long double)h / 12.0 + ((long double)m / 60.0) / 12.0 - (long
double)m / 60.0);

 long double rsq = (long double)(a * a + b * b) - (long double)(2 * a *
b) * cosl(rad);

printf("%20.20Lf\n", sqrtl(rsq));

   return 0;
}


Measured memory_bytes: 2584
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int x = scanner.nextInt();
			int n = scanner.nextInt();
			int e = scanner.nextInt();
			if ((x | n | e) == 0)
				break;
			int[] v = new int[x];
			for (int i = 0; i < x; i++) {
				v[i] = scanner.nextInt();
			}
			int[][] ev = new int[n + 1][2];
			while (e-- > 0) {
				int p = scanner.nextInt();
				int k = scanner.nextInt();
				int val = scanner.nextInt();
				ev[p][0] = k;
				ev[p][1] = val;
			}
			Map<Integer, double[]> map = new HashMap<Integer, double[]>();
			double[] d = new double[n + 1];
			d[0] = 1.0;
			map.put(0, d);
			for (int i = 0; i < n; i++) {
				Map<Integer, double[]> tmpMap = new HashMap<Integer, double[]>();
				tmpMap.putAll(map);
				for (Entry<Integer, double[]> entry : map.entrySet()) {
					if (entry.getValue()[i] == 0)
						continue;
					for (int k = 0; k < x; k++) {
						int c = entry.getKey();
						int nm = Math.min(n, i + v[k]);
						if (ev[nm][0] == 1)
							nm = Math.min(n, nm + ev[nm][1]);
						else if (ev[nm][0] == 2)
							c += ev[nm][1];
						else if (ev[nm][0] == 3)
							c = Math.max(0, c - ev[nm][1]);
						double[] tmp;
						double np = entry.getValue()[i] / x;
						if (!tmpMap.containsKey(c)) {
							tmp = new double[n + 1];
							tmp[nm] = np;
							tmpMap.put(c, tmp);
						} else {
							tmp = tmpMap.get(c);
							tmp[nm] += np;
						}

					}
				}
				map = tmpMap;
			}
			double ans = 0;
			for (Entry<Integer, double[]> entry : map.entrySet()) {
				ans += entry.getKey() * entry.getValue()[n];
			}
			System.out.println((int) ans);
		}
	}
}

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

int main(){
  int n, m;
  cin >> n >> m;
  vector<int> a(50);
  vector<int> b(50);
  vector<int> c(50);
  vector<int> d(50);

  for(int i = 0; i < n ; i++){
    cin >> a.at(i) >> b.at(i);
  }
  for(int i = 0; i < m ; i++){
    cin >> c.at(i) >> d.at(i);
  }

  for(int i = 0; i < n ; i++){
    int dist;
    int ans = 1;
    int tmp = abs(a.at(i) - c.at(0)) + abs(b.at(i) - d.at(0));
    for(int j = 0; j < m; j++){
      dist = abs(a.at(i) - c.at(j)) + abs(b.at(i) - d.at(j));
      if( dist < tmp){
        tmp = dist;
        ans = j + 1;
      }
    }
    cout << ans << endl;
  }
}


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



void solve(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    int x = c-a;
    int y = d-b;
    cout << c - y << " " << d + x << " " << c - y - x << " " << d + x - y << endl;
}

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <math.h>
#include <map>
#include <time.h>
#include <iomanip>
#include <bitset>

using namespace std;

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

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

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

    rep(i, 0, m) {
        int k;
        cin >> k;
        n -= k;
    }

    if(n < 0) n = -1;
    cout << n << endl;
}


Measured memory_bytes: 3640
s = input()
if s == "SUN":
  print(7)
if s == "MON":
  print(6)
if s == "TUE":
  print(5)
if s == "WED":
  print(4)
if s == "THU":
  print(3)
if s == "FRI":
  print(2)
if s == "SAT":
  print(1)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define int long long
using namespace std;
#define deb(x) cout<<#x<<" = "<<x<<"\n";

signed main()
{
	//freopen("input.txt", "r", stdin);
	
	int n; cin>>n;
	
	int odd = (n+1)/2;
	
	cout<<double(odd)/double(n);
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h> 
#include <string>
#include <iomanip>
#include <queue>
using namespace std;
int main(){
    string s;
    string ans;
    cin >> s;
    int l = s.size();
    for(int i = 0; i < l; i++){
        int nl = ans.size();
        if(s[i] == '1') ans = ans + '1';
        if(s[i] == '0') ans = ans + '0';
        if(s[i] == 'B' and nl != 0) ans.erase(ans.begin()+nl-1);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define N 1000000007
using namespace std;
vector <ll> adj[200000];
map <pair<ll,ll>, pair<ll,ll>> mapp;
void dfs(ll i = 1, ll p = 0, ll x = 0)
{
    ll c = 1;
    for(auto j : adj[i])
    {
        if(c == x)
            c++;
        if(j != p)
        {
            mapp[mp(min(i,j),max(i,j))].ss = c;
            dfs(j ,i, c);
            c++;
        }
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,m,a,b,i;
    cin>>n;
    for(i=1;i<n;i++)
    {
        cin>>a>>b;
        if(a > b)
            swap(a,b);
        adj[a].pb(b);
        adj[b].pb(a);
        mapp[mp(a,b)] = mp(i,0);
    }
    a = 0;
    for(i=1;i<=n;i++)
        a = max(a, (ll)adj[i].size());
    cout<<a<<"\n";
    dfs();
    set <pair<ll,ll>> st;
    for(auto i : mapp)
        st.insert(i.ss);
    for(auto i : st)
        cout<<i.ss<<"\n";
    return 0;
}

Measured memory_bytes: 22912
#include<iostream>
#include<cstring>
#include<vector>
#include<queue>
using namespace std;
struct HeapNode{
	int u;
	int d;
	bool operator < (const HeapNode& rhs)const{
		return d>rhs.d;
	}
};
int d[100005],vis[100005];
int main(){
	int k;
	cin>>k;
	priority_queue<HeapNode>Q;
	Q.push((HeapNode){1,0});
	memset(d,0x3f,sizeof(d));
	d[1]=0;
	
	while (!Q.empty()){
		HeapNode x=Q.top();	Q.pop();
		int u=x.u,v;
		if (vis[u]) continue;
		vis[u]=1;
		for (int v=(u+1)%k,cost=1;cost>=0;v=u*10%k,cost--)
			if (d[v]>d[u]+cost){
				d[v]=d[u]+cost;
				Q.push((HeapNode){v,d[v]});
			}
	}
	cout<<d[0]+1<<endl;
}

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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define int long long

using namespace std;
typedef long long ll;

const int maxn = 1e5 + 5, inf = 2e9;

class node
{
public:
  int Max, Min, pos;
  ll sum;
  node(int _Max = 0, int _Min = 0, int _pos = 0, ll _sum = 0)
  {
    Max = _Max; Min = _Min; pos = _pos; sum = _sum;
  }
  node operator + (const node & other) const
  {
    node res;
    res.Max = max(Max, other.Max);
    res.Min = min(Min, other.Min);
    res.sum = sum + other.sum;
    res.pos = (Max < other.Max) ? other.pos : pos;
    return res;
  }
}ST[4 * maxn];
int lazy[4 * maxn];
ll res[maxn];
int N, a[maxn];

#define lc id << 1
#define rc id << 1 | 1
void build(int id, int l, int r)
{
  lazy[id] = -1;
  if (l == r){
    ST[id].sum = ST[id].Max = ST[id].Min = a[l];
    ST[id].pos = l;
    return;
  }
  int mid = (l + r) / 2;
  build(lc, l, mid); build(rc, mid + 1, r);
  ST[id] = ST[lc] + ST[rc];
}

void dolazy(int id, int l, int r)
{
  if (lazy[id] != -1){
    ST[id].Max = ST[id].Min = lazy[id];
    ST[id].sum = 1ll * (r - l + 1) * lazy[id];
    ST[id].pos = l;
    if (l != r){
      lazy[lc] = lazy[id];
      lazy[rc] = lazy[id];
    }
  }
}

void update(int id, int l, int r, int L, int R, int val)
{
  dolazy(id, l, r);
  if (l > R || L > r || L > R) return;
  if (l == r){
    if (ST[id].Min >= val) ST[id] = node(val, val, l, val);
    else{

    }
    return;
  }
  if (L <= l && r <= R){
    if (ST[id].Min >= val){
      lazy[id] = val;
      ST[id].Max = ST[id].Min = val;
      ST[id].sum = (r - l + 1) * val;
      ST[id].pos = l;
      if (l != r){
        lazy[lc] = val;
        lazy[rc] = val;
      }
      return;
    }
  }
  int mid = (l + r) / 2;
  update(lc, l, mid, L, R, val); update(rc, mid + 1, r, L, R, val);
  ST[id] = ST[lc] + ST[rc];
}

ll query(int id, int l, int r, int L, int R, int val)
{
  dolazy(id, l, r);
  if (l > R || L > r || L > R) return 0;
  if (l == r){
    if (ST[id].Min >= val) return ST[id].Min - val;
    return 0;
  }
  if (L <= l && r <= R){
    if (ST[id].Min >= val){
      return ST[id].sum - 1ll * (r - l + 1) * val;
    }
  }
  int mid = (l + r) / 2;
  return query(lc, l, mid, L, R, val) + query(rc, mid + 1, r, L, R, val);
}

node getsum(int id, int l, int r, int L, int R)
{
  dolazy(id, l, r);
  if (l > R || L > r || L > R) return node(-inf, inf);
  if (L <= l && r <= R){
    return ST[id];
  }
  int mid = (l + r) / 2;
  return getsum(lc, l, mid, L, R) + getsum(rc, mid + 1, r, L, R);
}

signed main(void)
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  if (fopen("A.INP", "r")){
    freopen("A.INP", "r", stdin);
    freopen("A.OUT", "w", stdout);
  }
  cin >> N;
  for (int i = 1; i <= N; ++i){
    cin >> a[i];
  }
  build(1, 1, N);
  int pos = getsum(1, 1, N, 1, N).pos;
  while (true){
    int np = getsum(1, 1, N, 1, pos - 1).pos;
    res[pos] = query(1, 1, N, pos, N, a[np]);
    update(1, 1, N, pos, N, a[np]);
    if (pos == 1) break;
    pos = np;
  }
  for (int i = 1; i <= N; ++i){
    cout << res[i] << '\n';
  }
}


Measured memory_bytes: 18304
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//#define int long long


int main() {
  int a,b,c;
  cin >> a>>b>>c;
  
  cout << (a+b>=c?"Yes":"No") << endl;

  
}



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

int n;
char t;
char c[200005];

int main()
{
int sum_r=0;//Rに変換する操作をする回数
int sum_w=0;//Wに変換する操作をする回数
cin>>n;
for(int i=0;i<n;i++)
{cin>>t;c[i]=t;if(t=='R')sum_w++;}

//白白白白から始めて赤白白白としていく
int ans=sum_w;
for(int i=0;i<n;i++)
{
if(c[i]=='R'){sum_w--;}
if(c[i]=='W'){sum_r++;}
ans=min(ans,max(sum_r,sum_w));
}

cout <<ans;

}

Measured memory_bytes: 3820