akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >>N;
  if (N%10 == 2 || N%10 == 4|| N%10 == 5|| N%10 == 7|| N%10 == 9){
    cout<<"hon";
  }
  if (N%10 ==0|| N%10 == 1 || N%10 == 6 || N%10== 8){
    cout <<"pon";
  }
  if ( N%10 ==3){
    cout <<"bon";
  }
	return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ll long long
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test int t; cin>>t; while(t--)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define f0(i,n) for( ll i = 0; i < ( n ); i ++)
#define f1(i,n) for(i = 1; i <= ( n ); i ++)
#define f(i,m,n) for(auto i = ( m ); i <= ( n ); i ++)
#define nl cout<<"\n"
#define  mod 1000000007
#define fi first
#define se second
#define all(a) a.begin(),a.end()
#define rall(v) v.rbegin(), v.rend()
#define SZ(x) ((ll)x.size())
#define mem(a, b) memset(a, b, sizeof(a));
#define make_graph(k) int x,y; f0(i,k){cin>>x>>y; adj[x].pb(y); adj[y].pb(x);}
#define dekh cout<<"dekh"

#define o_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define o_setpll tree<pair<ll,ll>, null_type, less<pair<ll,ll>>, rb_tree_tag, tree_order_statistics_node_update>
typedef vector<ll> vl;




/*ll Pow(ll a, ll b, ll m){
    if(b==0)return 1;
    if(b%2==0){
        ll x = a*a;
        x%=m;
        return Pow(x,b/2,m);
    }
    return (a*Pow(a,b-1,m))%m;
}
*/
vector<ll>adj[200005];
 ll vis[200005]={0};

//ll p;ll arr[200005];

void dfs(ll x)
{
    cout<<x;nl;
    vis[x]=1;

    for(auto child : adj[x])
    {   if(!vis[child])
         {
             dfs(child);
         }
    }

}




ll n,k;
ll a[100005], b[100005], c[100005];
ll dp[100005][5];
ll solve(ll i, ll ch)
{
    if(i>=n)return 0;
    if(dp[i][ch]!=-1)return dp[i][ch];
    ll ans;
    if(ch==1)
    {
         ans = max(solve(i+1 ,2)+ a[i], solve(i+1,3 )+a[i]);
    }

    else if(ch==2)
    {
         ans = max(solve(i+1 ,1)+ b[i], solve(i+1,3 )+b[i]);
    }

    else if(ch==3)
    {
        ans = max(solve(i+1 ,2)+ c[i], solve(i+1,1 )+c[i]);
    }


        return dp[i][ch]=ans;


}

int main()
{
    fast
 mem(dp,-1);
   cin>>n;
   f0(i,n)
   {
       cin>>a[i]>>b[i]>>c[i];
   }
       ll ans1 = solve(0,1);
       ll ans2 = solve(0,2);
       ll ans3 = solve(0,3);
       cout<<max(ans1,max(ans2,ans3));


}





Measured memory_bytes: 20796
#include <iostream>

using namespace std;

long long a[310][310],sum=0;

int main(){
    int i,j,k,n;
    cin >> n;
    for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            cin >> a[i][j];
        	if(j<i)
            sum += a[i][j];
        }
    }
    for(i=0;i<n;i++){
        for(j=0;j<i;j++){
            for(k=0;k<n;k++){
            	if(j==k || k==i){
            		continue;
            	}
            	
                if(a[i][j] > a[i][k]+a[k][j]){
                    cout << -1 << endl;
                    return 0;
                }
            	
            	if(a[i][j] == a[i][k]+a[k][j]){
                    sum -= a[i][j];
            		break;
            		//cout <<i <<" " << j << " "<< k << endl;
                }
            }
        }
    }
    cout << sum << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) (a).begin(),(a).end()
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  ll k;cin>>s>>k;
  ll l=s.length();
  set<string> st;
  for(ll pos=0;pos<l;++pos) {
    for(ll num=1;num<6;++num) st.insert(s.substr(pos,num));
  }
  ll cnt=1;
  for(auto e:st) {
    if(cnt==k) print(e);
    cnt++;
  }
  return 0;
}

Measured memory_bytes: 1664
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n = ni()
txy = nan(n)

ct = 0
cx, cy = 0, 0
flag = True
for i in range(n):
    t, x, y = txy[i]
    nx, ny = abs(cx - x), abs(cy - y)
    p = abs(nx - ny)
    if ct + t < nx + ny:
        flag = False
    if t > nx + ny and (ct + t) % 2 != p % 2:
        flag = False
    cx, cy = x, y
    ct = t

print("Yes" if flag else "No")

Measured memory_bytes: 27308
// Author: HarshKumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 6, M = 1e9 + 7;
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    ll n;
    cin >> n;
    cout << !n;
}

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


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

    const ll MOD = 1e9+7;
    int n; cin >> n;
    ll ten = 1LL, nine = 1LL, eight = 1LL;
    rep(i,n){
        ten = (ten*10)%MOD;
        nine = (nine*9)%MOD;
        eight = (eight*8)%MOD;
    }
    ll a = ten, b = ((2*nine)%MOD - eight + MOD)%MOD;
    cout << (a - b + MOD)%MOD << endl;
}

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

const int N = 1e5 + 10;

int n, Q, K;
long long dep[N];
vector<pair<int,int> > V[N];

void dfs(int x, int fa){
    for(int i=0; i<V[x].size(); i++){
        int j = V[x][i].first;
        if(j == fa) continue;
        dep[j] = dep[x] + V[x][i].second;
        dfs(j, x);
    }
}

int main(){
    int x, y, z;
    scanf("%d", &n);
    for(int i=1; i<n; i++){
        scanf("%d %d %d", &x, &y, &z);
        V[x].push_back(make_pair(y, z));
        V[y].push_back(make_pair(x, z));
    }
    scanf("%d %d", &Q, &K);
    dep[K] = 0;
    dfs(K, -1);
    while(Q--){
        scanf("%d %d", &x, &y);
        printf("%lld\n", dep[x] + dep[y]);
    }
    return 0;
}


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

public class Main {

	static long expo(long base, long exp) {
		long t = 1L;
		while (exp > 0) {
			if (exp % 2 != 0)
				t = (t * base);

			base = (base * base);
			exp /= 2;
		}
		return t;
	}

	public static void main(String args[]) throws Exception {
		MyScanner sc = new MyScanner();
		PrintWriter pr = new PrintWriter(System.out);
		String a = sc.nextLine() , b = sc.nextLine();
		
		if(a.equals(b.substring(0, b.length() - 1)))
			System.out.println("Yes");
		else
			System.out.println("No");
		pr.close();
	}

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

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

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

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

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

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

Measured memory_bytes: 32564
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
    int n; cin>>n;
    map<P, ll> mp;
    for(int i=0; i<n; i++){
        string a; cin>>a;
        int d=-1; ll x=0;
        for(char c:a){
            if(c=='.'){
                d=0;
                continue;
            }
            x*=10;
            x+=(int)(c-'0');
            if(d!=-1) d++;
        }
        int c2=0, c5=0;
        while(x%2==0){
            x/=2; c2++;
        }
        while(x%5==0){
            x/=5;
            c5++;
        }
        if(d!=-1){
            c2-=d, c5-=d;
        }
        mp[{c2, c5}]++;
    }
    ll ans=0;
    for(auto p:mp){
        for(auto q:mp){
            if(p.first.first+q.first.first>=0 && p.first.second+q.first.second>=0){
                ans+=p.second*q.second;
            }
        }
    }
    for(auto p:mp){
        if(p.first.first>=0 && p.first.second>=0){
            ans-=p.second;
        }
    }
    ans/=2;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3600
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int l = sc.nextInt();
		int[][] fuels = new int[n][n];
		int[][] gass = new int[n][n];
		for (int i = 0; i < n; i++) {
		    Arrays.fill(fuels[i], Integer.MAX_VALUE / 2);
		    fuels[i][i] = 0;
		    Arrays.fill(gass[i], Integer.MAX_VALUE / 2);
		    gass[i][i] = 0;
		}
		for (int i = 0; i < m; i++) {
		    int a = sc.nextInt() - 1;
		    int b = sc.nextInt() - 1;
		    int c = sc.nextInt();
		    fuels[a][b] = c;
		    fuels[b][a] = c;
		}
		for (int i = 0; i < n; i++) {
		    for (int j = 0; j < n; j++) {
		        for (int k = 0; k < n; k++) {
		            fuels[j][k] = Math.min(fuels[j][k], fuels[j][i] + fuels[i][k]);
		        }
		    }
		}
		for (int i = 0; i < n; i++) {
		    for (int j = 0; j < n; j++) {
		        if (fuels[i][j] <= l) {
		            gass[i][j] = 1;
		        }
		    }
		}
		for (int i = 0; i < n; i++) {
		    for (int j = 0; j < n; j++) {
		        for (int k = 0; k < n; k++) {
		            gass[j][k] = Math.min(gass[j][k], gass[j][i] + gass[i][k]);
		        }
		    }
		}
		int q = sc.nextInt();
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < q; i++) {
		    int a = sc.nextInt() - 1;
		    int b = sc.nextInt() - 1;
		    if (gass[a][b] >= Integer.MAX_VALUE / 2) {
		        sb.append(-1).append("\n");
		    } else {
		        sb.append(gass[a][b] - 1).append("\n");
		    }
		}
		System.out.print(sb);
   }
}


Measured memory_bytes: 95628
#include<iostream>
#include<cstdio>
using namespace std;
int s[101];
int main()
{
	int i,j,n,m,p;
	cin>>n>>m;
	for(i=1;i<=n;i++)cin>>s[i];
	for(i=2;i<=m;i++)
	{
		for(j=1;j<n;j++)
		{
		    if((s[j]%i)>(s[j+1]%i))
			{
				p=s[j];s[j]=s[j+1];s[j+1]=p;
			}	
		}
	}
	for(i=1;i<=n;i++)cout<<s[i]<<endl;
	return 0;
}

Measured memory_bytes: 3016
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main() {
  
  long a,b; cin>>a>>b;
  string ans;
  if(a<=0 and b>=0) ans="Zero";
  else if(a>0) ans="Positive";
  else{
    if((b-a)%2==0) ans="Negative";
    else ans="Positive";
  }
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 256
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), cout, ", ") << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, ostream &os = cout, string sep = " ")
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), os, ", ") << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, N);
    ll ans = 0;
    if (N % 2 == 0)
    {
        ll f = 10;
        while (f <= N)
        {
            ans += N / f;
            f *= 5;
        }
    }
    OUT(ans);
}

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

int main(){
    int n,m,l;
    cin >> n >> m;  
    vector<int> coins(m),count(n+1);
    for(int i=0;i<m;i++) cin >> coins.at(i);
    for (int i = 0; i <= n; i++) count[i] = i ;
    for (int i = 1; i < m; i++){  
        for (int j = coins[i]; j <= n; j++){
                count[j] = min(count[j],count[j-coins[i]]+1);
        }
        
    }
    cout << count[n] << endl;
    return 0;
}


Measured memory_bytes: 3164
#include <bits/stdc++.h>
const int mod = 1e9 + 7;
inline int mul( int x , int y ){ return 1LL * x * y % mod ;}
int power_mod( int x , int y ){int ret = 1;while( y ){if( y & 1 ) ret = mul( ret , x );y >>= 1;x = mul( x , x );}return ret;}
inline int read(){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}return x*f;}
using namespace std;
const int maxn = 1e5 + 50;


int main(int argc,char *argv[]){
	//freopen( "in.txt" , "r" , stdin );
	string zhu;
	cin>>zhu;
	if(zhu[0]=='a'||zhu[0]=='e'||zhu[0]=='i'||zhu[0]=='o'||zhu[0]=='u')
		cout<<"vowel"<<endl;
	else
		cout<<"consonant"<<endl;
	
	return 0;
}

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

#define ls(x) ch[x][0]
#define rs(x) ch[x][1]
#define rep(i , j , k) for(int i = j ; i <= k ; i ++)
#define Rep(i , j , k) for(int i = j ; i >= k ; i --)

using namespace std ;
using ll = long long ;
using pii = pair <int , int> ;
using vii = vector <int> ;

auto ot = [&]() { cerr << "ATS TXDY" << '\n' ; int ATS_nantf_txdy = true ; } ;
auto _ios = [&]() { ios :: sync_with_stdio(false) ; cin.tie(nullptr) ; cout.tie(nullptr) ; } ;

namespace stO_ATS_Orz {
  template < class T > void cmax(T & x , T y) { if(x > y) x = y ; }
  template < class T > void cmin(T & x , T y) { if(x < y) x = y ; }
  template < class T > void abs(T x) { if(x < 0) x = -x ; }
  int n , cnt = 0 ;
  void main() {
    cin >> n ;
    while(n - 100 >= 0) {
      n -= 100 ;
      cnt ++ ;
    }
    if(cnt * 5 >= n) {
      cout << '1' << '\n' ;
    }
    else {
      cout << '0' << '\n' ;
    }
  }
}
signed main() {
  _ios() ; ot() ;
  return stO_ATS_Orz :: main() , 0 ;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;

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

    int board_scale;
    int paint_num;
    std::cin >> board_scale >> paint_num;

    int squares = pow(board_scale,2);
    std::cout << squares - paint_num << '\n';
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<time.h>
typedef unsigned int uint;
typedef long long ll;

int main()
{
    char s[100];
    int i, j,n;
    scanf("%s", s);
    n = strlen(s);
    for (i = 0; i <n ; i++)
    {
        if(i%2==0)
        {
            if(s[i]=='L')
                break;
        }
        else
        {
            if(s[i]=='R')
                break;
        }
    }
    if(i==n)
        printf("Yes");
    else
    {
        printf("No");
    }
    
        return 0;
}

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

int main(){
  
  int A,B;
  cin >> A >> B;
  
  if (A >= 13){
    cout << B << endl;
  }else if(A >= 6){
    cout << B/2 << endl;
  }else{
    cout << 0 << endl;
  }
  
}

Measured memory_bytes: 256
#include<iostream>
#include<string>

using namespace std;

int main(){
    int N,*a,max=-1,sum,sum_temp=-1,temp;
    cin >> N;
    a = new int[N];
    for(int i=0;i<N;i++){
        cin >> a[i];
        if(max < a[i]) max = a[i];
    }
    for(int i=0;i<=max;i++){
        sum = 0;
        for(int j=0;j<N;j++){
            temp = a[j]-i;
            sum += temp*temp;
        }
        if(sum_temp > 0){
            if(sum_temp > sum) sum_temp = sum;
        }
        else{
            sum_temp = sum;
        }
    }
    cout << sum_temp;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    
   int n;
   cin>>n;
   int a[10005]={0};
   for(int i=1;i<101;i++){
       for(int j=1;j<101;j++){
           for(int k=1;k<101;k++){
               if((i*i+j*j+k*k+i*j+j*k+k*i)<=10000){
                   int z=i*i+j*j+k*k+i*j+j*k+k*i;
                   a[z]++;
               }
           }
       }
   }
    for(int i=1;i<=n;i++)cout<<a[i]<<endl;  
    
}

Measured memory_bytes: 3628
import java.util.*

fun main(args: Array<String>) {
  solve()
}

fun solve() {
  val sc = Scanner(System.`in`)
  val N: Int = sc.nextInt()
  val S: String = sc.next()
  var cur: Char = '0'
  var ans: Int = 0
  for(si in S) {
    if (!si.equals(cur)) {
      cur = si
      ans += 1
    }
  }
  println(ans)
}


Measured memory_bytes: 35048
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
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; 
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n;
  cin>>n;
  ll a,b;
  cin>>a>>b;
  for(int i=a;i<=b;i++){
    if(i%n==0){
      COUT("OK");
      return 0;
    }
  }
  COUT("NG");
}

Measured memory_bytes: 3632
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;





int main(){
    ll n;
    cin>>n;
    vector<vector<ll>> edge(n,vector<ll>(n));
    for(auto &i:edge){
        for(auto &t:i){cin>>t;}
    }
    vector<ll> dp(1LL<<n,0);
    dp[0]=1;
    for(ll i=0;i+1<1LL<<n;i++){
        ll count=0;
        for(ll t=0;t<n;t++){if(i>>t&1){count++;}}
        for(ll t=0;t<n;t++){
            if((i>>t&1)==0 && edge[t][count]){(dp[i|(1LL<<t)]+=dp[i])%=MOD;}
        }
    }
    cout<<dp.back()<<endl;
    
    
    return 0;
}


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

using namespace std;
typedef long long ll;
#define FOR(i,n) for(int i=0; i<int(n); i++)
#define FOR1(i,m,n) for(int i=int(m); i<int(n); i++)

const int MAXN=1e6;
const int MOD=1e9+7;
int n;
vector<ll> A;

int main(int argc, char *argv[])
{
    ll ans = 0;
    cin >> n;
    A.resize(n+1);
    A[1] = A[2] = 1;
    FOR1(i,3,n+1) A[i] = (2*A[i-1] - A[i-2] + A[i-3] + MOD) % MOD;
    FOR(i,n) ans = (ans + (A[i] * (n-1)) % MOD * (n-1)) % MOD;
    FOR(i,n-1) ans = (ans + (i+1)*A[i]) % MOD;
    ans = (ans + (n-1)*A[n-1] + n*A[n]) % MOD;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 8064
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<queue>
#include<algorithm>
#include<iostream>
using namespace std;
typedef long long ll;
const int N=100000+5;
int a[3];
int main()
{
    scanf("%d%d%d",&a[0],&a[1],&a[2]);
    sort(a,a+3);
    printf("%d\n",a[2]*10+a[1]+a[0]);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
typedef long long ll;

int kaijo(int n)
{
	if (n == 0)
		return 1;
	return (n * kaijo(n -1));
}

int nijo(int n)
{
	return n * n;
}
int main()
{
	int n;
	scanf("%d",&n);
	int ch = kaijo(n);
	int p[ch];
	int x[n+1], y[n+1];
	float sum = 0;
	for (int i = 1; i <= n; i++)
	{
		scanf("%d%d", &x[i], &y[i]);
	}
	for (int i = 1; i <= n; i++)
	{
		for(int j = 1; j <= n; j++)
		{
			if (i != j)
			{
				sum += sqrt(nijo(x[i]-x[j]) + nijo(y[i]-y[j]));
			}
		}
	}
	printf("%f", sum / n);
	return (0);
}


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

int main() {
  double W, H, x, y;
  cin >> W >> H >> x >> y;
  cout << fixed << setprecision(6);
  
  cout << W * H / 2 << " ";
  
  if (x == W / 2 && y == H / 2)
    cout << '1' << endl;
  else
    cout << '0' << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+50;
int n,K;
int p[N],q[N],py[N],qy[N],a[10][N];
int A[N],Ay[N];
void Inv(int a[N],int R[N])
{
	int i;
	static int b[N];
	for(i=1;i<=n;i++) b[a[i]]=i;
	//printf("S%d %d %d\n",a[1],b[2],b[3]);
	for(i=1;i<=n;i++) R[i]=b[i];
}
void trans(int a[N],int b[N])
{
	int i;
	for(i=1;i<=n;i++) a[i]=b[a[i]];
}
void gnew(int a[N],int R[N],int cs)
{
	int i,x,top,rcs,now;
	static int nxt[N],vis[N],val[N],stk[N];
	memset(vis,0,sizeof(vis));
	for(i=1;i<=n;i++) nxt[i]=a[i];
	for(i=1;i<=n;i++)
	{
		if(vis[i]) continue;
		top=0;
		x=i;
		while(vis[x]==0) stk[top++]=x,vis[x]=1,x=nxt[x];
		rcs=cs%top;
		x=i;now=rcs;
		while(1)
		{
			val[x]=stk[now];
			if(nxt[x]==i) break;
			x=nxt[x];
			now++;if(now==top) now=0;
		}
	}
	for(i=1;i<=n;i++) R[i]=val[i];
}
int main()
{
	int i;
	scanf("%d%d",&n,&K);K--;
	for(i=1;i<=n;i++) scanf("%d",&p[i]);
	for(i=1;i<=n;i++) scanf("%d",&q[i]);
	
	Inv(p,py);Inv(q,qy);
	memcpy(a[0],p,sizeof(p));
	memcpy(a[1],q,sizeof(q));
	for(i=2;i<6;i++)
	{
		memcpy(a[i],a[i-2],sizeof(a[i-2]));
		Inv(a[i],a[i]);
		trans(a[i],a[i-1]);
	}
	for(i=1;i<=n;i++) A[i]=i;
	trans(A,p);trans(A,qy);trans(A,py);trans(A,q);
	Inv(A,Ay);
	gnew(A,A,K/6);gnew(Ay,Ay,K/6);
	trans(Ay,a[K%6]);
	trans(Ay,A);
	for(i=1;i<=n;i++) printf("%d ",Ay[i]);
	return 0;
}

Measured memory_bytes: 8960
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [[input().split()] for _ in range(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes) if b else print(no)
# from collections import Counter,deque,defaultdict
# import itertools
# import math
# import networkx
# from bisect import bisect_left,bisect_right
s=s0()
t=s0()
p0(s==t[:-1])

Measured memory_bytes: 9156
import sys

stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


n = ni()
res = [list(input().split() + [i + 1]) for i in range(n)]
res = list(map(lambda x: (x[0], int(x[1]), x[2]), res))
res = sorted(res, key=lambda x: x[0])
start = 0
start_res = res[0][0]
sor_res = []
ans = []
for i in range(n):
    if start_res != res[i][0]:
        end = i - 1
        sor_res += sorted(res[start:end + 1], key=lambda x: x[1], reverse=True)
        start = i
        start_res = res[i][0]
    if i == n - 1:
        end = i
        sor_res += sorted(res[start:end + 1], key=lambda x: x[1], reverse=True)
for r in sor_res:
    print(r[2])


Measured memory_bytes: 9128
#include<algorithm>
#include<cstdio>
#define K 51
#define M 32
#define N 6
using namespace std;
int a[N],b[M],i,j,k,l,m,n,o,p,q;long long f[M][K][N],g[N][M][K][N];long long x,y;
inline void solve(long long h[M][K][N],int s)
{
    for(p=s+1;p<=o;p++)l<i+a[j]?h[k|1<<j][min(m,i+a[j])][p]+=h[k][l][o]:h[k|1<<j][l][o+1]+=h[k][l][o];
    for(p=o+1;p<=b[k]+1;p++)l<=i+a[j]?h[k|1<<j][min(m,i+a[j])][p]+=h[k][l][o]:h[k|1<<j][l][o]+=h[k][l][o];
}
int main()
{
    scanf("%d%d",&n,&m);
    for(i=0;i<n;i++)scanf("%d",a+i);
    sort(a,a+n),f[0][a[--n]][0]=1;
    for(i=1;i<1<<n;i++)b[i]=b[i>>1]+(i&1);
    for(i=0;i<m;i++)
    {
        for(j=0;j<1<<n;j++)for(k=0;k<=b[j];k++)g[k][j][i][k]=f[j][i][k];
        for(j=0;j<n;j++)for(k=0;k<1<<n;k++)if(~k>>j&1)for(l=i;l<=m;l++)for(o=0;o<=b[k];o++)for(solve(f,0),q=0;q<=o;q++)solve(g[q],q);
        for(j=0;j<1<<n;j++)for(k=i;k<=m;k++)for(l=0;l<=b[j];l++)for(o=0;o<=l;o++)f[j][k][l]-=g[o][j][k][l];
        for(j=0;j<1<<n;j++)for(k=i;k<=m;k++)for(l=0;l<=b[j];l++)for(o=l;o<=b[j];o++)g[l][j][k][o]=0;
    }
    for(i=0;i<=n;i++)x+=f[(1<<n)-1][m][i];
    for(i=y=1;i<=n;i++)y*=i*m;
    return 0*printf("%.16lf\n",(double)x/y);
}


Measured memory_bytes: 512
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<LL> PQ_DESC;
typedef priority_queue<LL, VL, greater<LL>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef priority_queue<VL> PQ_DESC_VL;
typedef priority_queue<VL, vector<VL>, greater<VL>> PQ_ASC_VL;
typedef priority_queue<PLL> PQ_DESC_PLL;
typedef priority_queue<PLL, vector<PLL>, greater<PLL>> PQ_ASC_PLL;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    LL n;cin>>n;
    //n--;

    string s="";


    while(n>0){
        s = char(((n-1)%26)+'a') + s;
        n = (n-1)/26;
    }
    cout<<s<<endl;
    
	return;
}

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

Measured memory_bytes: 3644
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>

using namespace std;

typedef long long ll;
const int Maxn = 1e9 + 10;
const int N = 1e5 + 10;
const int INF=(0x7fffffff)/2;
int a[210];

int main(){
	int n;
	while(~scanf("%d", &n)){
		for(int i = 0; i < 2 * n; i++)
			cin >> a[i];
		sort(a, a + 2 * n);
		ll sum = 0;
		for(int i = 0; i < 2 * n; i = i + 2)
			sum += a[i];
		printf("%lld\n", sum);
		}
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        int[] a = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        int md = (n % 2 == 0) ? n - 1 : n; //最大の奇数
        int me = (n % 2 == 0) ? n : n - 1; //最大の偶数
        List<int> b = new List<int>();
        for (int i = md; i > 0; i -= 2)
            b.Add(a[i - 1]);
        for (int i = 2; i <= me; i += 2)
            b.Add(a[i - 1]);
        int[] ans = b.ToArray();
        if (n % 2 == 0)
            Array.Reverse(ans);
        for (int i = 0; i < n - 1; i++)
            Console.Write("{0} ", ans[i]);
        Console.WriteLine(ans[n - 1]);
    }
}

Measured memory_bytes: 42152
#include <stdio.h>
int main(void){
    int i=0,flg1=0,flg2=0;
    char str[101];
    scanf("%s",str);
    while(str[i]!='\0'){
        if(str[i]=='C') flg1=1;
        if(flg1==1&&str[i]=='F') flg2=1;
        i++;
    }
    if(flg2==1) printf("Yes\n");
    else        printf("No\n");
    return 0;
}

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

void Probability(double p[], int n)
{


    double dp[n + 1][n + 1];
    memset(dp, 0.0, sizeof(dp));


    dp[0][0] = 1.0;

    for (int i = 1; i <= n; i += 1) {


        for (int j = 0; j <= i; j += 1) {


            if (j == 0)
                dp[i][j] = dp[i - 1][j]
                           * (1.0 - p[i]);
            else
                dp[i][j] = dp[i - 1][j]
                               * (1.0 - p[i])
                           + dp[i - 1][j - 1] * p[i];
        }
    }

    double ans = 0.0;
    for (int i = (n + 1) / 2; i <= n; i += 1)
        {
            ans += dp[n][i];
        }

    cout<<fixed<<setprecision(10)<<ans<<endl;
}

int main(){

int n;
cin>>n;



double p[n+1];
for(int i=1;i<=n;i++){
cin>>p[i];
}
p[0]=0.0;

 Probability(p,n);



return 0;
}


Measured memory_bytes: 70528
from bisect import bisect_left as bisect
from numpy import cumsum
N=int(input())
A,B,C=[sorted([int(_) for _ in input().split()]) for __ in range(3)]
ableAonB=[]
ableBonC=[]
ans=0
for b in B:
    ableAonB.append(bisect(A,b))
sumAonB=(cumsum(ableAonB))
for c in C:
    ableBonC.append(bisect(B,c))
for c in ableBonC:
    if c==0:continue
    ans+=sumAonB[c-1]
print(ans)
    

Measured memory_bytes: 33936
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <array>

using namespace std;

auto main()-> int
{    
    size_t N, K;
    cin >> N >> K;
    
    string str;
    cin >> str;

    for (size_t i = 0; i < str.length(); i++)
    {
        if (i == (K - 1))
            cout << char(::tolower(str[i]));
        else
            cout << str[i];
    }
}


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

namespace AtCoder200531
{
    class Program
    {
        static void Main(string[] args)
        {
            //int n = int.Parse(Console.ReadLine());
            //List<int> inputs = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToList();
            char[] input = Console.ReadLine().ToCharArray();

            if (Char.IsUpper(input[0]))
            {
                Console.WriteLine("A");
            }
            else
            {
                Console.WriteLine("a");
            }
        }
    }
}


Measured memory_bytes: 25628
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
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; }
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const vi d8x = {1, 0, -1, 0, 1, -1, -1, 1};
const vi d8y = {0, 1, 0, -1, 1, 1, -1, -1};
const vi d4x = {1, 0, -1, 0};
const vi d4y = {0, 1, 0, -1};

//----------------ここからだよ-------------------

int main(){
    int N; string S;
    cin>>N; cin>>S;
    int cnt =0;
    rep(i,N-2){
        if(S[i]=='A'&&S[i+1]=='B'&&S[i+2]=='C') cnt++;
    }
    cout<<cnt<<endl;
}

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

#define endl "\n"
#define lli long long int
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define mp make_pair
#define ct1(x) cout<<x<<endl;
#define ct2(x,y) cout<<x<<" "<<y<<endl;
#define ct3(x,y,z) cout<<x<<" "<<y<<" "<<z<<endl;
#define ct4(w,x,y,z) cout<<w<<" "<<x<<" "<<y<<" "<<z<<endl;
#define ct5(v,w,x,y,z) cout<<v<<" "<<w<<" "<<x<<" "<<y<<" "<<z<<endl;
#define ct6(u,v,w,x,y,z) cout<<u<<" "<<v<<" "<<w<<" "<<x<<" "<<y<<" "<<z<<endl;
#define sq(x) ((x)*(x))
#define all(x) x.begin(),x.end()
#define ff first
#define ss second

const int MOD = (int)1e9 + 7;

lli solve(){
    int d,x,i,j,maxVal,temp;
    cin>>d;
    vector<vector<int>> v(d, vector<int>(3,0));
    for(i=0; i<d; i++){
        for(j=0; j<3; j++){
            cin>>x;
            v[i][j]=x;
        }
    }
    vector<vector<int>>dp(d, vector<int>(3,0));
    for(i=0; i<3; i++){
        dp[0][i]=v[0][i];
    }
    for(i=1; i<d; i++){
        for(j=0; j<3; j++){
            if(j==0){
                temp= max(dp[i-1][1], dp[i-1][2]);
                dp[i][j]=temp+v[i][j];
            }else if(j==1){
                temp= max(dp[i-1][0], dp[i-1][2]);
                dp[i][j]=temp+v[i][j];
            }else if(j==2){
                temp= max(dp[i-1][0], dp[i-1][1]);
                dp[i][j]=temp+v[i][j];
            }
            // cout<<dp[i][j]<<" ";
        }
        // maxVal=-1;
        // for(j=0; j<3; j++){
        //     if(dp[i][j]>maxVal)
        //         maxVal=dp[i][j];
        // }
        // cout<<endl;
    }
    maxVal=-1;
    for(i=0; i<3; i++){
        if(dp[d-1][i]>maxVal)
            maxVal=dp[d-1][i];
    }
    return maxVal;
}

int main() {
    FASTER
	// lli testCases;
	// cin>>testCases;
	// for(lli caseLevel=1; caseLevel<=testCases; caseLevel++)
	// {
	    // cout<<"Case #"<<caseLevel<<": ";
        cout<<solve()<<endl;
        // cout<<endl;
	// } /
	return 0;
}

Measured memory_bytes: 14200
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll>pi;
const int MAXN=10;
const int MOD=1000000007;
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define DEC(i,a,b) for(int i=(a);i>=(b);i--)
#define fst first
#define snd second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define db(x) cerr<<#x<<" = "<<x<<"\n"
#define LOW(v,x) (lower_bound(all(v),(x))-(v).begin())

typedef long double ld;
int N,K;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	cin>>N>>K;
	ld ans=0.0;
	FOR(i,1,N){
		if(1<=i&&i<=K-1){
			int x=i,c=0;
			while(x<K){
				x<<=1;
				c++;
			}
			ld cur=1.0;
			FOR(k,1,c)cur*=0.5;
			ans+=cur;
		}
		else{
			ans+=1.0;
		}
	}
	ans/=N;
	cout<<fixed<<setprecision(11)<<ans<<"\n";
}
/*
1 3
#.#


2 3
#.#
..#

3 3
##.
#.#
..#

3
2 5
6 1
3 7
Ans:6

4
3 7
2 9
8 16
10 8
Ans:9
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
 
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
int main() {
    int n, k; cin >> n >> k;
    COMinit();
    int r = n - k + 1;
    // cout << COM(1998, 1) * COM(2, 2) << endl;
    // cout << COM(1998, 2) * COM(2, 1) << endl;
    // cout << COM(1998, 3) * COM(2, 0) << endl;
    for (int i = 1; i <= k; ++i) {
        cout << COM(r, i) * COM(k - 1, k - i) % MOD << endl;
    }
 
    return 0;
}

Measured memory_bytes: 12160
#include<stdio.h>
int main()
{
    int n,x,min,max;
    long long sum;
    min=0,max=0,sum=0;
    scanf("%d",&n);
    if(n>0)
    {
        scanf("%d",&x);
        min=max=sum=x;
    }
    int i;
    for(i = 1;i<=n-1;i++)
    {
        scanf("%d",&x);
        if(min>x)
        {
            min=x;
        }
        if(max<x)
        {
            max=x;
        }
        sum+=x;
    }
    printf("%d %d %lld\n",min,max,sum);
    return 0;
}

Measured memory_bytes: 600
import sys

def main():
    K, S = map(int, input().split())

    cnt = 0
    for x in range(K+1):
        for y in range(K+1):
            if x+y > S:
                break

            z = S - x - y
            if z <= K:
                cnt += 1

    print(cnt)


if __name__ == "__main__":
    main()

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define fi first
#define se second
#define inf (INT_MAX/2-1)
#define infl (1LL<<62)
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define sz(a) (int)(a).size()
#define all(a) begin(a),end(a)
#define y0 y5656
#define y1 y7878
#define aaa system("pause");
#define dbg(x) cerr<<(#x)<<": "<<(x)<<'\n',aaa
#define dbga(x,n) cerr<<(#x)<<"[]: ";for(int _=0;_<n;_++)cerr<<x[_]<<' ';cerr<<'\n',aaa
#define dbgs(x) cerr<<(#x)<<"[stl]: ";for(auto _:x)cerr<<_<<' ';cerr<<'\n',aaa
#define dbgp(x) cerr<<(#x)<<": "<<x.fi<<' '<<x.se<<'\n',aaa
#define x fi
#define y se
#define maxn 200000

using namespace std;

int n;
pii v[maxn+5];

void umax (int &a, int b) {
  a = max(a, b);
}

struct LAZY {
  int yy[4*maxn+5], lazy[4*maxn+5];
  ///suma pe itv, query max itv
  void update (int p, pii itv, pii ok, int val) {
    if (lazy[p] != 0) {
      yy[p] += lazy[p];
      if (itv.fi < itv.se) {
        lazy[p*2] += lazy[p];
        lazy[p*2+1] += lazy[p];
      }
      lazy[p] = 0;
    }
    if (itv.se < ok.fi || ok.se < itv.fi) return;
    if (itv.fi >= ok.fi && itv.se <= ok.se) {
      yy[p] += val;
      if (itv.fi < itv.se) {
        lazy[p*2] += val;
        lazy[p*2+1] += val;
      }
      return;
    }
    int mid = (itv.fi + itv.se) / 2;
    update(p*2, {itv.fi, mid}, ok, val);
    update(p*2+1, {mid+1, itv.se}, ok, val);
    yy[p] = max(yy[p*2], yy[p*2+1]);
  }
  int q_query;
  void query (int p, pii itv, pii ok) {
    if (lazy[p] != 0) {
      yy[p] += lazy[p];
      if (itv.fi < itv.se) {
        lazy[p*2] += lazy[p];
        lazy[p*2+1] += lazy[p];
      }
      lazy[p] = 0;
    }
    if (itv.se < ok.fi || ok.se < itv.fi) return;
    if (itv.fi >= ok.fi && itv.se <= ok.se) {
      umax(q_query, yy[p]);
      return;
    }
    int mid = (itv.fi + itv.se) / 2;
    query(p*2, {itv.fi, mid}, ok);
    query(p*2+1, {mid+1, itv.se}, ok);
  }
  int prequery (int l, int r) {
    q_query = -INT_MAX;
    query (1, pii(1, n), pii(l, r));
    return q_query;
  }
};

LAZY aint;

int main () {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  cin >> n;
  int i, j, z;
  for (i = 1; i <= n; i++) cin >> v[i].x >> v[i].y;
  int ans = 0;
  auto sim = [&ans] () { ///calculeaza doar distantele pentru stanga jos
    vector<pii> u(1);
    int i, j, z;
    for (i = 1; i <= n; i++) {
      u.pb(pii(-v[i].x, v[i].y));
    }
    sort(1+all(u), [](pii a, pii b) {return a.y < b.y; });
    fill(all(aint.yy), 0);
    fill(all(aint.lazy), 0);
    for (i = 1; i <= n; i++) {
      aint.update(1, pii(1, n), pii(i, i), u[i].x);
    }
    for (i = 2; i <= n; i++) {
      aint.update(1, pii(1, n), pii(1, i-1), u[i].y-u[i-1].y); ///le adaug diferenta pe Oy
      umax(ans, -aint.prequery(i, i) + aint.prequery(1, i-1));
    }
  };
  sim();
  for (i = 1; i <= n; i++) v[i].y = -v[i].y;
  sim();
  cout << ans;
  return 0;
}

Measured memory_bytes: 14732
#include<iostream>
#include<vector>
using namespace std;
typedef long long ll;
#define ip(arr, n) for(int i=0; i<n; i++) cin>>arr[i];
#define ip1(arr, n) for(int i=1; i<=n; i++) cin>>arr[i];
#define op(arr, n) for(int i=0; i<n; i++) cout<<arr[i]<<" ";
#define fstIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define debug(x) cout<<x<<"\n";
#define inf 1e9
#define INF 1e16
#define MOD 1000000007


int main(){

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif

    int n;
    cin>>n;
    
    if(n>=30){
        cout<<"Yes\n";
    }
    else cout<<"No\n";
    
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

vector<int> v, d;

void fastio() {
    ios::sync_with_stdio(false);
    cin.tie(NULL), cout.tie(NULL);
}

int main() {
    string a, b;
    cin >> a >> b;
    int i;
    for (int i=0; i<a.size(); i++) {
        if (i == a.size() - 1 && a[i] == b[i]) {
            cout << "Yes";
            return 0;
        }
        else if (a[i] != b[i]) break;
    }
    /*
    for (int i=0; i<a.size(); i++) {
        if (i == a.size() - 1 && a[i] == b[i + 1]) {
            cout << "Yes";
            return 0;
        }
        else if (a[i] != b[i + 1]) break;
    }
     */
    cout << "No";
    return 0;
}

Measured memory_bytes: 3620
#include <stdio.h>
#define NUM 100010
#define INF 1000000010

int main(void){
    int N;
    long long sum = 0;
    long long count = 0;
    long long min_ = INF;

    scanf("%d", &N);
    for(int i = 0; i < N; i++){
        long long a;
        scanf("%lld", &a);

        if(a < 0){
            a = -a;
            count++;
        }
        min_ = min_ < a ? min_:a;

        sum += a;
    }

    if(count % 2 == 0){
        printf("%lld\n", sum);
    }else{
        printf("%lld\n", sum - min_ * 2);
    }

    return 0;
}


Measured memory_bytes: 256
#リストの挿入と最大値の取得を同時に行う
#そのようなものを高速でできるデータ構造としてheapq(優先度つきqがあげられる)
#最大値を取得する関数はheapqには入ってないためリストの要素を-1倍してから最小値を求めればいい
n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
a=list(map(lambda x:x*(-1),a))

import heapq
heapq.heapify(a)
for i in range(m):
  min_a=heapq.heappop(a)*(-1)
  heapq.heappush(a,min_a//2*(-1))
print(sum(a)*(-1))




Measured memory_bytes: 14224
#include <cstdio>
#include <algorithm>
#include <functional>
#include <stack>
#include <cmath>
#include <map>
using namespace std;

#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 llong long long

int main() {
  int m,d;
  while(1) {
    scanf("%d %d", &m, &d);
    if(m == 0 && d == 0) break;
    int t = 3;
    if(m > 1) t += 31;
    if(m > 2) t += 29;
    if(m > 3) t += 31;
    if(m > 4) t += 30;
    if(m > 5) t += 31;
    if(m > 6) t += 30;
    if(m > 7) t += 31;
    if(m > 8) t += 31;
    if(m > 9) t += 30;
    if(m > 10) t += 31;
    if(m > 11) t += 30;
    t += d-1;
    switch(t%7) {
    case(0):
      printf("Monday\n");
      break;
    case(1):
      printf("Tuesday\n");
      break;
    case(2):
      printf("Wednesday\n");
      break;
    case(3):
      printf("Thursday\n");
      break;
    case(4):
      printf("Friday\n");
      break;
    case(5):
      printf("Saturday\n");
      break;
    case(6):
      printf("Sunday\n");
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 2544
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;


public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int A = input.nextInt();
        int B = input.nextInt();

        List <Integer> list = Arrays.asList(1,2,3);

        list.stream().filter(l -> !l.equals(A) && !l.equals(B)).forEach(System.out::println);
    }
}


Measured memory_bytes: 26836
import java.util.Scanner;

public class Main {

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

		System.out.println(48-a);


	}

	public static int res(int n) {
		if(n==1) {
			return 1;
		}

		return n+res(n-1);
	}
}




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

using namespace std;
#define int long long
#define double long double
#define rep(i, n) for(int i=0;i<(n);++i)
#define INF (1ll<<60)
#define FI first
#define SE second
typedef pair<int, int> pii;
#define l_b lower_bound
#define u_b upper_bound

int N;
vector<int> ch[1010];
int X[1010];
bool dp[5050];

pii dfs(int cur) {
    if (ch[cur].empty()) {
        //葉
        return pii(X[cur], 0);
    }
    vector<pii> children;
    int sum = 0;
    rep(i, ch[cur].size()) {
        pii child = dfs(ch[cur][i]);
        children.push_back(child);
        sum += child.FI + child.SE;
    }
    memset(dp, 0, sizeof(dp));
    dp[0] = true;
    int base = 0;
    for (pii child:children) {
        int a = child.FI, b = child.SE;
        int c = max(a, b) - min(a, b);
        base += min(a, b);
        for (int i = 5049; i >= c; --i) {
            if (dp[i - c]) {
                dp[i] = true;
            }
        }
    }
    int add = -1;
    for (int i = 0; i <= X[cur] - base; ++i) {
        if (dp[i])
            add = X[cur] - base - i;
    }
    if (add == -1) {
        cout << "IMPOSSIBLE" << endl;
        exit(0);
    }
    return pii(X[cur], sum + add - X[cur]);
}

signed main() {
    cin >> N;
    for (int i = 1; i < N; ++i) {
        int p;
        cin >> p;
        --p;
        ch[p].push_back(i);
    }
    rep(i, N) {
        cin >> X[i];
    }
    dfs(0);
    cout << "POSSIBLE" << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#define sqr(x) (x)*(x)
using namespace std;
int n,m,i,s;
int main()
{
	cin>>n;
	for (i=1;s<n;i++) s+=i;
	cout<<i-1;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F(i,n) for (int i=1; i<=(int)n; i++)
#define FF(i,n) for (int i=0; i<(int)n; i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pi pair < int , int >
#define re(x) (int)x.size()
#define y1 u228
using namespace std;
typedef long long ll;
const int N = 2e5+228;
const int big = 2e9;
const int md = 1e9 + 7;
string s;
int k;
vector < string > v;
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);
    //freopen("input.txt","r",stdin);
    cin>>s;
    cin>>k;
    int n=re(s);
    FF(i,n){
        string tex="";
        for (int j=i; j<=min(n-1,i+4); j++){
            tex+=s[j];
            v.pb(tex);
        }
    }
    sort(all(v));
    v.resize(unique(all(v))-v.begin());
    cout<<v[k-1]<<endl;
    return 0;
}







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

using namespace std;

int n;
int a[maxn];

int main() {
	scanf("%d",&n);
	for (int i=0;i<n;i++)
		scanf("%d",&a[i]);
	sort(a+0,a+n);
	reverse(a+0,a+n);
	int x=0,y=0;
	while (x+1<n && a[x+1]>x+1) 
		x++;
	while (y<n && a[y]>x)
		y++;
	if ((a[x]-x)&1 && (y-x)&1) puts("Second");
		else puts("First");
}

Measured memory_bytes: 640