akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>

#define MAX 100

using namespace std;

typedef struct {
    string name;
    int cnt;
} Str_t;

int main()
{
    Str_t Blue[MAX];
    Str_t Red[MAX];
    int i,N,M,Max;

    for( i = 0; i < MAX; i++)for( i = 0; i < MAX; i++)
    {
        Blue[i].name = "NULL";
        Blue[i].cnt = 0;
        Red[i].name = "NULL";
        Red[i].cnt = 0;
    }
    cin >> N;
    string tmp;
    int CardNum = N;
    for(int i = 0; i < CardNum; i++)
    {
        cin >> tmp;
        for(int j = 0; j < MAX; j++)
        {
            if(Blue[j].name == tmp)
            {
                Blue[j].cnt++;
                break;
            }
            else if(Blue[j].name == "NULL")
            {
                Blue[j].name = tmp;
                Blue[j].cnt++;
                break;
            }
        }
    }
    cin >> M;
    CardNum = M;
    for(int i = 0; i < CardNum; i++)
    {
        cin >> tmp;
        for(int j = 0; j < MAX; j++)
        {
            if(Red[j].name == tmp)
            {
                Red[j].cnt++;
                break;
            }
            else if(Red[j].name == "NULL")
            {
                Red[j].name = tmp;
                Red[j].cnt++;
                break;
            }
        }
    }

    Max = 0;
    for( i = 0; i < MAX; i++)
    {
        if(Blue[i].name != "NULL")
        {
            int point = Blue[i].cnt;
            for(int j = 0; j < MAX; j++)
            {
                if(Red[j].name == Blue[i].name)
                {
                    point -= Red[j].cnt;
                }
                else if(Red[j].name == "NULL")
                {
                    break;
                }
            }
            if(point > Max)
            {
                Max = point;
            }
        }
        else
        {
            break;
        }
    }
    cout << Max <<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<ll,ll>;
#define For(i,a,b)  for(int i=a;i<=b;i++)
#define Forr(i,a,b) for(int i=a;i>=b;i--)
#define F first
#define S second
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define bpc __builtin_popcount
#define MOD (ll)(1e9+7)
#define INF (1e18)
#define EPS (1e-6)
#define NATHANLEE_IS_EVIL_AND_ELECTRIC true
#define int ll
#ifdef LOCAL_TEST
#define debug(...) do{\
	cerr<<__PRETTY_FUNCTION__<<" - "<<__LINE__<<\
	" : ("#__VA_ARGS__<<") = ";\
	_OUT(__VA_ARGS__);\
}while(0)
template<typename T>void _OUT(T x){cerr<<x<<"\n";}
template<typename T,typename...I>void _OUT(T x,I ...tail){cerr<<x<<", ";_OUT(tail...);}
#else
#define debug(...)
#endif
void INIT(){
#ifdef LOCAL_TEST
	freopen("D:\\input.in","r",stdin);
	freopen("D:\\output.out","w",stdout);
	freopen("D:\\error.out","w",stderr);
#endif
	ios::sync_with_stdio(!NATHANLEE_IS_EVIL_AND_ELECTRIC);
	cin.tie(0);
}

ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }
ll lcm(ll a,ll b) { return a/gcd(a,b)*b; }
ll fpow(ll b,ll p){
	b%=MOD;
	ll ans=1;
	while(p>0){
		if(p&1) ans=(ans*b)%MOD;
		p/=2;
		b=(b*b)%MOD;
	}
	return ans;
}

struct Meow{
	int w,s,v;
}a[1010];

int dp[1010][20010];

bool cmp(const Meow &A,const Meow &B){
	return A.s+A.w<B.s+B.w;
}

int32_t main() {
	INIT();
	//code...
	int n; cin>>n;
	For(i,0,n-1) cin>>a[i].w>>a[i].s>>a[i].v;
	sort(a,a+n,cmp);
	memset(dp,-1,sizeof(dp));
	For(i,0,n) dp[i][0]=0;
	int ans=0;
	For(i,1,n) For(j,0,20000){
		dp[i][j]=dp[i-1][j];
		if(j>=a[i-1].w && j-a[i-1].w<=a[i-1].s && dp[i-1][j-a[i-1].w]!=-1)
			dp[i][j]=max(dp[i][j],dp[i-1][j-a[i-1].w]+a[i-1].v);
		ans=max(ans,dp[i][j]);
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 161552
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

const int N = 1007;
const int INF = 1e9 + 239;

int n;
set<int> g[N];

void bfs(int st, int en, vector<int> &path) {
	vector<int> d(n, INF);
	vector<int> p(n, -1);
	queue<int> q;
	d[st] = 0;
	q.push(st);
	while (!q.empty()) {
		int v = q.front();
		q.pop();
		for (int t : g[v]) {
			if (d[t] > d[v] + 1) {
				d[t] = d[v] + 1;
				p[t] = v;
				q.push(t);
			}
		}
	}
	if (d[en] != INF) {
		int cur = en;
		while (cur != -1) {
			path.push_back(cur);
			cur = p[cur];
		}
	}
}

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

	int m;
	cin >> n >> m;
	vector<pair<int, int>> ed;
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		u--;
		v--;
		ed.push_back({u, v});
		g[u].insert(v);
	}
	for (auto t : ed) {
		int u, v;
		tie(u, v) = t;
		g[u].erase(v);
		vector<int> p;
		bfs(v, u, p);
		if (!p.empty()) {
			set<int> xx;
			for (auto vert : p) {
				xx.insert(vert);
			}
			int c = 0;
			for (auto vv : ed) {
				if (xx.count(vv.first) && xx.count(vv.second)) c++;
			}
			if (c == (int)p.size()) {
				cout << c << endl;
				for (auto x : p) {
					cout << x + 1 << ' ';
				}
				cout << endl;
				return 0;
			}
		}
		g[u].insert(v);
	}
	cout << -1 << endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
	int n;
  cin>>n;
  map<string,int> mp;
  rep(i,n){
    string s;
    cin>>s;
    mp[s]++;
  }
  cout<<mp.size()<<endl;
  
 

  return 0;
}


Measured memory_bytes: 19220
#include <iostream>
#include <string>
using namespace std;
int main() {
	string s;
	int i;
	cin >> s;
	for (i = 0; s[i + 1] != 0; i++);
	for (; i >= 0; i--)
		cout << s[i];
	cout << endl;
	return 0;
}


Measured memory_bytes: 3152
import java.util.Scanner;

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();
        
        long[][] a = new long[n][m];
        for(int i = 0; i < n; i++){
            for(int j = 0; j < m; j++){
                a[i][j] = sc.nextInt();
            }
        }
        
        long[][] b = new long[m][l];
        for(int i = 0; i < m; i++){
            for(int j = 0; j < l; j++){
                b[i][j] = sc.nextInt();
            }
        }
        
        long[][] c = new long[n][l];
        for(int i = 0; i < n; i++){
            for(int j = 0; j < l; j++){
                for(int k = 0; k < m; k++){
                    c[i][j] += a[i][k] * b[k][j];
                }
            }
        }
        
        for(int i = 0; i < c.length; i++){
            System.out.print(c[i][0]);
            for(int j = 1; j < c[i].length; j++){
                System.out.print(" " + c[i][j]);
            }
            System.out.println();
        }
    }
}


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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

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

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

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

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; }

void Main(){
    int n;
    cin >> n;
    string c;
    cin >> c;
    int ans = 0;
    int count = 0;
    REP(i, c.size()) {
        if (c[i] == 'R') {
            count++;
        } 
    }
    REP(i, count) {
        if (c[i] == 'W') {
            ans++;
        }
    }
    cout << ans << en;
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t) Main();
    return 0;
}


Measured memory_bytes: 3760
#pragma GCC optimize ("-O3")
#include "bits/stdc++.h"
using namespace std ;
#define ld long double
#define _ ios_base::sync_with_stdio(false) ;cin.tie(NULL);cout.tie(NULL);
#define inp(a) for(auto& i : a) cin >> i;
#define out(a) for(auto i : a){cout << i << ' ';}cout << endl;
#define dbg(x) cerr << #x << " is " << x << endl;
#define ms(x,a) memset(x,(int)(a),sizeof(x))
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pii pair<int,int>
#define vi vector<int >
#define pb push_back
#define endl '\n'
#define ff first
#define ss second
const int N = 2e5+7 ;
const int INF = 1e9 ;
const int MOD = INF + 7 ;
string s ;
//#define int long long

int32_t main(){_
	int n,k ;
	cin >> n >> k ;
	vector<int> h(n) ;
	inp(h)
	sort(all(h)) ;
	int mn = INF ;
	for(int i = 0 ; i <= n-k ; i++){
		mn = min(mn, h[i+k-1]-h[i]) ;
	}
	cout << mn << endl ;


}

Measured memory_bytes: 640
if __name__ == '__main__':
    a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())
    e = int(input())
    k = int(input())
    
    a1 = b-a
    a2 = c-a
    a3 = d-a
    a4 = e-a
    b1 = c-b
    b2 = d-b
    b3 = e-b
    c1 = d-c
    c2 = e-c
    d1 = e-d
    
    if (a1 <= k and a2 <= k and a3 <= k and a4 <= k and b1 <= k and b2 <= k and b3 <= k and c1 <= k and c2 <= k and d1 <= k):
        print("Yay!")
    else:
        print(":(")


Measured memory_bytes: 3064
import java.util.*;
 
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int X = Integer.parseInt(sc.next());
        int[] L = new int[N+1]; 
        int D = 0;
        int count = 1;
        int ans = N+1;
        for(int i = 1; i <= N; i++) {
            L[i] = Integer.parseInt(sc.next());
            D += L[i];
            count++;
            if(D > X) {
                ans = count-1;
                break;
            }
        }
        
        System.out.println(ans);
    }
}

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

public static partial class Program
{
    //テンプレここから
    public static int ToInt(this string str) => int.Parse(str);
    public static long ToLong(this string str) => long.Parse(str);
    public static int[] ToInt(this string[] strs) => strs.Select(x => x.ToInt()).ToArray();
    public static long[] ToLong(this string[] strs) => strs.Select(x => x.ToLong()).ToArray();
    public static int[] ToIA(this string str, char opr = ' ') => str.Split(opr).ToInt();
    public static long[] ToLA(this string str, char opr = ' ') => str.Split(opr).ToLong();
    public static string CRL() => Console.ReadLine();
    public static void CWL(object obj) => Console.WriteLine(obj);
    public static int Diff(int a, int b) => (int)Diff(a, (long)b);
    public static long Diff(long a, long b) => Math.Abs(Math.Max(a, b) - Math.Min(a, b));
    public static int Sign(this int i) => Math.Sign(i);
    public static bool IsEven(this int i) => i % 2 == 0;
    public static int[] dx = new int[] { 0, -1, 0, 1 };
    public static int[] dy = new int[] { -1, 0, 1, 0 };
    public static int[] ToFlat(this int[] array) => array.Cast<long>().ToArray().ToFlat().Cast<int>().ToArray();
    public static long[] ToFlat(this long[] array)                  //平坦化
    {
        var min = array.Min();
        return array.Select(x => x - min).ToArray();
    }
    public static int Gcd(int a, int b) => (int)Gcd(a, (long)b);
    public static long Gcd(long a, long b)
    {
        if (b == 0)
        {
            return a;
        }

        return Gcd(b, a % b);
    }                       //最大公約数
    public static int Lcm(int a, int b) => (int)Lcm(a, (long)b);
    public static long Lcm(long a, long b) => a / Gcd(a, b) * b;    //最小公倍数
    //テンプレここまで
}

public static partial class Program
{
    static void Main()
    {
        var ny = CRL().ToIA();
        var n = ny[0];
        var y = ny[1];

        for (int ten = 0; ten <= n; ten++)
        {
            for (int five = 0; five <= n - ten; five++)
            {
                var one = n - ten - five;
                if (ten * 10000 + five * 5000 + one * 1000 == y)
                {
                    CWL($"{ten} {five} {one}");
                    return;
                }
            }
        }

        CWL("-1 -1 -1");
    }
}


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

class Main {
	static int n;
	static int w;
	static int[] value;
	static int[] weight;
	static long[][] dp;

	static long knapsack(int idx, int rweight) {
		if (rweight < 0) {
			return -(int) 1e9;
		}
		if (idx == n) {
			return 0;
		}
		if (dp[idx][rweight] != -1) {
			return dp[idx][rweight];
		}
		long take = value[idx] + knapsack(idx + 1, rweight - weight[idx]);
		long leave = knapsack(idx + 1, rweight);
		return dp[idx][rweight] = Math.max(take, leave);
	}

	public static void main(String[] args) throws IOException {

		PrintWriter out = new PrintWriter(System.out);
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		n = Integer.parseInt(st.nextToken());
		w = Integer.parseInt(st.nextToken());
		value = new int[n];
		weight = new int[n];
		for (int i = 0; i < n; i++) {
			st = new StringTokenizer(br.readLine());
			weight[i] = Integer.parseInt(st.nextToken());
			value[i] = Integer.parseInt(st.nextToken());
		}
		dp = new long[n][w + 1];
		for (long[] i : dp) {
			Arrays.fill(i, -1);
		}
		out.println(knapsack(0, w));
		out.close();

	}
}


Measured memory_bytes: 139272
#include <stdio.h>

int main(void) {
  char s1[101], s2[101], s3[101];
  
  scanf("%s %s %s", s1, s2, s3);
  
  printf("%c%c%c\n", s1[0], s2[0], s3[0]);
  
  return 0;
}

Measured memory_bytes: 128
n  = int(input())
a = list(map(int,input().split()))
ans = 0
mn = 0
for i in range(n):
    if a[i] < 0:
        mn += 1
        a[i] = abs(a[i])
    ans += a[i]
if 0 in a or mn%2 == 0:
    print(ans)
else:
    print(ans - 2*min(a))

Measured memory_bytes: 64880
#include<stdio.h> 

int main(void) {     

int i,j,x;    

int max=0;     

int min=0;    

long sum=0L;          

scanf("%d",&j);          

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

scanf("%d",&x);        

sum+=(long)x;        

if(i==0){             

max=x;             

min=x;        

}         

if(x>max){             

max=x;         

}else if(x<min){             

min=x;         

}        

x=0;     

}    

printf("%d %d %ld\n",min,max,sum);          

return 0; 

}  

Measured memory_bytes: 600
#include<iostream>

using namespace std;

int main(){
  typedef long int li;
  li a = 100000,b;
  int n;
  cin >> n;
  
  for(int i = 0; i < n; i++){
    a = a * 1.05;
    b = a%1000;
    if(b != 0) a = a - b + 1000;
  }
  cout << a << endl;
}

Measured memory_bytes: 2996
TAIL = 1000000000000000000000000000
while gets
    a,b,n = $_.chomp.split.map(&:to_i)
    a *= TAIL

    k = (a/b - (a/b/TAIL).floor*TAIL)
    s = 0
    n.times do
        k *= 10
        s += k/TAIL
        k -= (k/TAIL).floor*TAIL
    end
    puts s
end

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

using namespace std;
typedef long long ll;
typedef vector<ll> vl ;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;

#define rep(i,N) for(int i=0; i < (int)N; i++)
#define all(v) (v).begin(),(v).end()

const int INF = 1001001001;
const int MAX_N = 200005;

vi a, ans;
vi to[MAX_N];
int dp[MAX_N];

void dfs(int v, int p=-1){
	int i = lower_bound(dp, dp+MAX_N, a[v]) -dp;
	int old = dp[i];
	dp[i] = a[v];
	ans[v] = i;
	if(p!=-1) ans[v] = max(ans[v], ans[p]);
	for(int u : to[v]){
		if(u == p) continue;
		dfs(u, v);
	}
	dp[i] = old;
}

int main(){
	int n; cin >> n;
	a = ans = vi(n); rep(i,n) cin >> a[i];

	rep(i,n-1){
		int u, v; cin >> u >> v;
		u--; v--;
		to[u].push_back(v);
		to[v].push_back(u);
	}
	fill(dp, dp+MAX_N, INF);
	dp[0] = -INF;
	dfs(0);
	rep(i,n){
		cout << ans[i] <<endl;
	}
}

Measured memory_bytes: 30880
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;

typedef long long ll;

ll mod = 1000000007;

ll pw(ll i, ll k){
	if(k==0) return 1;
	if(k==1) return i;
	ll z = pw(i, k/2);
	if(k%2==0) return (z*z)%mod;
	return (((z*z)%mod)*i)%mod;
}

ll inv(ll i){
	return pw(i, mod-2);
}

ll fact(ll n){
	if(n==1) return 1;
	return (n*fact(n-1))%mod;
}

int main() {
	ll n;
	cin >> n;
	vector<ll> a;
	for(int i=0; i<n; i++){
		ll x;
		cin >> x;
		a.push_back(x);
	}
	vector<int> sums;
	ll f = fact(n);
	ll s = 0;
	sums.push_back(0);
	for(int i=2; i<=n; i++){
		s += (f * inv(i)) % mod;
		s %= mod;
		sums.push_back(s);
	}
	ll tot = 0;
	for(int i=0; i<n; i++){
		ll val = 0;
		val += sums[i];
		
		val%=mod;
		val += sums[n - 1 - i];
		val%=mod;
		val += f;
		val%=mod;
		tot += (val*a[i])%mod;
		tot%=mod;
	}
	cout << tot << endl;
	return 0;
}

Measured memory_bytes: 3444
n,s = map(int,input().split())
a = list(map(int,input().split()))
dp1 = [[0 for i in range(s+1)] for j in range(n+1)]
dp2 = [[0 for i in range(s+1)] for j in range(n+1)]
mod = 998244353
dp1[0][0] = 1
for i in range(1,n+1):
  x = a[i-1]
  for j in range(1,s+1):
    p = 0
    q = 0
    if j == x:
      p += i
      q += i*(n-i+1)
    if j>x:
      dif = dp1[i-1][j-x]
      p = dif
      q = dif*(n+1-i)
    p += dp1[i-1][j]
    q += dp2[i-1][j]
    dp1[i][j] = p%mod
    dp2[i][j] = q%mod
print(dp2[n][s])

Measured memory_bytes: 192008
#include<iostream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cassert>
using namespace std;

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define fr(i,c) for(__typeof(c.begin()) i=c.begin();i!=c.end();i++)
#define pb push_back
#define mp make_pair
#define all(c) c.begin(),c.end()
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl

typedef vector<int> vi;
typedef pair<int,int> pi;
typedef long long ll;
const int inf=(int)1e9;
const double EPS=1e-9, INF=1e12;

#define back(x) x[x.size()-1]
inline bool vowel(char c){return c=='a'||c=='i'||c=='u'||c=='e'||c=='o';}
inline bool voiceless(char c){return c=='k'||c=='s'||c=='t'||c=='h'||c=='p';}


string in;
vector<string> compose(){
	int n=in.size();
	vector<string> res;
	string tmp;
	rep(i,n){
		tmp.pb(in[i]);
		if(vowel(in[i])){
			if(i<n-1&&(in[i+1]=='a'||in[i+1]=='i'||in[i+1]=='u')){
				tmp.pb(in[++i]);
			}
			res.pb(tmp);
			tmp="";
		}
		else{
			if(in[i]=='\''){
				res.pb(tmp);
				tmp="";
			}
			else if(in[i]=='n'&&(i==n-1||!vowel(in[i+1])&&in[i+1]!='y')){
				res.pb(tmp);
				tmp="";
			}
		}
	}
	return res;
}
int main(){
	while(cin>>in,in!="#"){
		vector<string> v=compose();
		int n=v.size();
		bool flag=0;
		rep(i,n){
			bool res=!flag;
			if(res){
				res=0;
				int vw=0;
				rep(j,v[i].size())if(vowel(v[i][j]))vw++;
				if(voiceless(v[i][0])&&vw==1){
					if((back(v[i])=='i'||back(v[i])=='u')&&
						(i==n-1||voiceless(v[i+1][0])))res=1;
					if((back(v[i])=='a'||back(v[i])=='o')&&i<n-1&&
						voiceless(v[i+1][0])&&(v[i+1][1]=='y'?v[i+1][2]:v[i+1][1])==back(v[i]))res=1;
				}
			}
			flag=res;
			if(res){
				bool ok=0;
				rep(j,v[i].size())if(!ok&&vowel(v[i][j])){
					cout<<"("<<v[i][j]<<")";
					ok=1;
				}
				else cout<<v[i][j];
			}
			else cout<<v[i];
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
n = int(input())
A = list(map(int, input().split()))
mina = abs(A[0])
minus = 0
sumA = 0
for a in A:
    if a < 0:
        minus += 1
        a = -a
    sumA += a
    mina = min(a, mina)
if minus % 2 == 1:
    sumA -= 2 * mina
print(sumA)

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

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if(a == b && b == c){
    cout << "No" << endl;
  }
  else if((a == b|| a == c)||b == c){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
//<============ Author --> @venom ============>//
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fo(i,n)           for(int i=0;i<n;i++)
#define int               long long
#define pb                emplace_back
#define mp                make_pair
#define ff                first
#define ss                second
#define all(x)            x.begin(), x.end()
#define sortall(x)        sort(all(x))
#define sortrev(x)        sort(all(x), greater<int>())
#define w(x)              int x; cin>>x; while(x--)
#define trunc(x,y)        fixed<<setprecision(y)<<x
#define mk(arr, n, type)  type *arr=new type[n];
#define PI                3.1415926535897932384626
#define mod               1000000007
#define inf               1e18
#define FIO               ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef pair<int, int>    pi;
typedef vector<int>       vi;
typedef vector<pi>        vpi;
typedef vector<vi>        vvi;
typedef tree<int, null_type, less<int>, rb_tree_tag,
        tree_order_statistics_node_update> indexed_set;
const int N = 3e5, M = N;
int mpow(int base, int exp);
int gcd(int a, int b) {if (a == 0) return b; return gcd(b % a, a);}
//<----------------------------------------------------------------------------->//
void fastIO()
{
  FIO;
#ifndef ONLINE_JUDGE
  // for getting input from input.txt
  freopen("input.txt", "r", stdin);
  // for writing output to output.txt
  freopen("output.txt", "w", stdout);
#endif
}

int32_t main()
{
  FIO;

  int n; cin >> n;
  int x;
  vi h;

  fo(i, n)
  {
    cin >> x;
    h.pb(x);
  }

  vi dp(n, inf);
  dp[0] = 0;

  fo(i, n)
  {
    for (int j : {i + 1, i + 2})
    {
      if (j < n)
      {
        dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
      }
    }
  }

  cout << dp[n - 1] << "\n";

  return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((int)result * base) % mod;
    base = ((int)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

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

typedef long long ll;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    double l;
    cin >> l;
    double i = l / 3;
    cout << setprecision(10) << fixed << i*i*i <<endl;


    return 0;
}



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

int main() {
  int N, a, b, c, d;
  
  cin >> N; //1234, 1222

  a = N / 1000; //1, 1
  b = (N % 1000) / 100; //2, 2
  c = (N % 100) / 10; //3, 2
  d = N % 10; //4, 2
  
  if (a == b && b== c) {
    cout << "Yes" << endl;
  }
  else if (b == c && c == d) {
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<sstream>
using namespace std;
#define ll long long
#define ld long double
 
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fb(i,a,b) for(ll i=a;i>=b;i--)
 
#define mp make_pair
#define pb push_back
 
#define ft first
#define sd second
 
 
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 
#define pll pair<ll,ll>
#define V vector<ll>
#define S set<ll>
#define VV vector<V> 
 
const ll N = 100005;
const ll M = 1000000007;
 
int main(){
 //ll t;
 //cin>>t;
 //while(t--){
  char a,b;
  cin>>a>>b;
  if(a>=b){
  	string s;
  	ll j=a-'0';
  	f(i,0,j){
  		s.pb(b);
	  }
	  cout<<s;
  }
  else{
  	string s;
  	ll j=b-'0';
  	f(i,0,j){
  		s.pb(a);
	  }
	  cout<<s;
  }
}
//}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#include<set> 
#include<math.h>
#define pai arccos(-1);
#define keta(n) cout << fixed << setprecision((n));
#define ll long long;
int main(){
  int n,calc=0;
  cin>>n;
  bool judge = false;
  for(int c=0;c<50;c++){
    for(int d=0;d<50;d++){
        if(n==4*c+7*d)
          judge = true;      
    }
  }
 	if(judge ==true)cout<<"Yes";
  else cout<<"No";

}


Measured memory_bytes: 256
// mod custom_lib;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}


fn read_n<T: FromStr>(n: u32) -> Vec<T> {
  read_n_logic::<T>(n, vec![])
}

fn read_n_logic<T: FromStr>(n: u32, mut a: Vec<T>) -> Vec<T> {
  match n {
    0 => a,
    _ => {
      a.push(read::<T>());
      read_n_logic(n - 1, a)
    }
  }
}

fn main() {
  let n = read::<usize>();
  let m = read::<u32>();
  let a = read_n::<usize>(m);

  let mut dp = vec![0; n + 3];
  let mut st = vec![true; n + 3];
  let md = 1_000_000_007;
  dp[0] = 1;

  for i in a {
    st[i] = false;
  }

  if st[1] {
    dp[1] = 1;
  }


  for i in 2..n + 2 {
    if st[i] {
      dp[i] = (dp[i - 1] + dp[i - 2]) % md;
    }
  }

  println!("{}", dp[n] % md);
}

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

using namespace std;

int n, AC, WA, TLE, RE;
string s;

int main()
{
	cin >> n;
	
	for(int i = 1; i <= n; i++)	
		{
			cin >> s;
			
			if(s[0] == 'A') AC++;
			
			if(s[0] == 'W') WA++;
			
			if(s[0] == 'T') TLE++;
			
			if(s[0] == 'R') RE++;
		}
	
	cout << "AC" << " " << "x" << " " << AC << '\n';
	cout << "WA" << " " << "x" << " " << WA << '\n';
	cout << "TLE" << " " << "x" << " " << TLE << '\n';
	cout << "RE" << " " << "x" << " " << RE << '\n';
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int n;
long long ans = 1000000000000000000ll, sum, sum1; 
long long a[200010];
int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) scanf("%lld", &a[i]), sum += a[i];
	for(int i = 1; i < n; ++i) 
	{
		sum1 += a[i];
		sum -= a[i];
		ans = min(ans, abs(sum - sum1));
	}
	cout << ans << endl;
	return 0;
} 

Measured memory_bytes: 1792
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

#define rep(i, n) for(int i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

const ll MOD = 1000000007;  // 1e9 + 7

// Digit DP.

// In each digit, x and y is in one of the three.
// - x=0, y=0
// - x=0, y=1 (In this case, most significant bit must appear in the left bits)
// - x=1, y=1

// (digit)
// (L <= x is already satisfied by the left bits)
// (y <= R is already satisfied by the left bits)
// (most significant bit already appeared)
ll dp[60][2][2][2];

char l[61];
char r[61];

ll f(int pos, int flagX, int flagY, int flagZ) {
  if (pos == -1) {
    return 1;
  }
  if (dp[pos][flagX][flagY][flagZ] != -1) {
    return dp[pos][flagX][flagY][flagZ];
  }
  ll ret = 0;
  // x 0, y 0
  if (flagX || l[pos] == '0') {
    ret += f(pos - 1, flagX, (r[pos] == '1') ? 1 : flagY, flagZ);
  }
  // x 0, y 1
  if ((flagX || l[pos] == '0') && (flagY || r[pos] == '1') && flagZ) {
    ret += f(pos - 1, flagX, flagY, flagZ);
  }
  // x 1, y 1
  if (flagY || r[pos] == '1') {
    ret += f(pos - 1, (l[pos] == '0') ? 1 : flagX, flagY, 1);
  }
  ret %= MOD;
  dp[pos][flagX][flagY][flagZ] = ret;
  return ret;
}

int main(int argc, char** argv) {
  ll L, R;
  cin >> L >> R;
  for (ll i = 59; i >= 0; --i) {
    l[i] = ((L >> i) & 1) ? '1' : '0';
    r[i] = ((R >> i) & 1) ? '1' : '0';
  }

  memset(dp, -1, sizeof(dp));
  ll ans = f(59, 0, 0, 0);
  cout << ans << endl;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
int X[101010];


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N) {
		cin>>x;
		X[x-1]=i+1;
	}
	FOR(i,N) cout<<X[i]<<" ";
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 1280
#include <stdio.h>
#define A 0
#define B 1
#define C 2
#define D 3
int main(void){
	int rankL[4];
	int rankR[4];
	int i;
	double l,r;
	for(i = 0; i< 4; i++){
		rankL[i] = 0;
		rankR[i] = 0;
	}
	while(scanf("%lf%lf",&l,&r) != EOF){
		if(l >= 1.1){
			rankL[A]++;
		}else if(l >= 0.6){
			rankL[B]++;
		}else if(l >= 0.2){
			rankL[C]++;
		}else{
			rankL[D]++;
		}
		if(r >= 1.1){
			rankR[A]++;
		}else if(r >= 0.6){
			rankR[B]++;
		}else if(r >= 0.2){
			rankR[C]++;
		}else{
			rankR[D]++;
		}
	}
	for(i = 0; i < 4; i++){
		printf("%d %d\n",rankL[i],rankR[i]);
	}
	return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a=scan.nextInt();
		int b=scan.nextInt();
		int c=scan.nextInt();
		int d=scan.nextInt();
		System.out.println(Math.min(a, b)+Math.min(c, d));

	}

}


Measured memory_bytes: 27064
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef pair<int,int> pii;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
template<class Type> void line(const Type &a){int cnt=0;for(auto &elem:a){if(cnt++)cout<<' ';cout<<elem;}cout<<endl;}

int main(){
	int n;
	cin>>n;
	
	vi p(n);
	REP(i,n) cin>>p[i];
	
	int cnt=0;
	int num=INF;
	REP(i,n){
		if(num>p[i]) cnt++;
		num=min(num,p[i]);
	}
	
	cout<<cnt<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
 
using namespace std;
 
const int MOD=1e9+7;
const double PI=3.14159265359;
 
double ssum(long long i){
    string s=to_string(i);
    double ans=0;
    for(char c:s){
        ans+=c-'0';
    }
    return ans;
}
 
int main(){
    
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int k;
    cin>>k;
    
    long long cur=0;
    while(k--){
        
        double rat=-1;
        long long next=0;
        for(long long i=1; i<1e15; i*=10){
            double tr=(cur+i)/ssum(cur+i);
            if(rat==-1 || tr<rat){
                next=cur+i;
                rat=tr;
            }
        }
        cout<<next<<endl;
        cur=next;
    }
    
    /*
    for(int i=1; i<100; i++){
        cout<<i<<" "<<i/ssum(i)<<endl;
    }
    
    int n=50000;
    
    vector<double> rats(n);
    for(int i=1; i<n; i++){
        rats[i]=i/ssum(i);
    }
    for(int i=1; i<n; i++){
        if(rats[i]<=*min_element(rats.begin()+i, rats.end())){
            cout<<i<<":"<<rats[i]<<",";
            
        }
    }
    */
        
    
    
    return 0;
    
    
    
    
}

Measured memory_bytes: 256
#桁数を返す
#Nの桁数を返す (Nが0のときは0が返る)
#10進法のときは、10で割り続ければ桁数が返る
def calc_digits(n):
    res = 0
    while( int(n) ):
        res += 1
        n /= 10
    return res

N = int(input())
ans = float('inf')

for i in range(1,N+1):
    #調べるのはNの1/2乗まででよい
    if i * i > N:
        break

    if ( N % i == 0):
        #Nがiで割り切れたら約数は B と i
        B = N / i
        temp = max((calc_digits(i)),calc_digits(B))
        ans = min(ans,temp)

print(ans)


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

#define lli long long int
#define pb push_back
#define in insert
#define pi pair<int, int>
#define pii pair<int, pi>
#define mp make_pair
#define fir first
#define sec second
#define MAXN 2000011

signed main()
{
  int n;
  cin >> n;
  lli sum = 0;
  for (lli i = 1; i <= n; i++)
  {
    for (lli j = 1; j <= n; j++)
    {
      for (lli k = 1; k <= n; k++)
      {
        lli aux = __gcd(i, j);
        lli ans = __gcd(aux, k);
        sum += ans;
      }
    }
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 3636
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.IO.Compression;
using System.Linq;
using System.Text;

namespace Atcoder
{
    class Program
    {
        private const long COMDIV = 1000000007;
        static void Main(string[] args)
        {
            var NM = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] ret = new int[NM[0]];
            for (int i = 0; i < NM[1]; i++)
            {
                var ab = Console.ReadLine().Split().Select(x => int.Parse(x) - 1).ToArray();
                ret[ab[0]]++;
                ret[ab[1]]++;
            }

            Console.WriteLine(string.Join("\n",ret));
        }
    }
}

Measured memory_bytes: 13396
import kotlin.math.abs
import kotlin.math.pow

fun main() {
    println(solve())
}

val solve: () -> Any = {
    val X = readLong()
    var A = 0
    var B = 0
    for (a in 0..1000) {
        for (b in -1000..1000) {
            if (a.toDouble().pow(5).toLong() - b.toDouble().pow(5).toLong() == X) {
                A = a
                B = b
            }
        }
    }
    "$A $B"
}

val mod: Int = 1_000_000_007

fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)

fun <T> T.alsoPrintln() = also { println(this) }

fun Boolean.toYesOrNo(yes: String = "Yes", no: String = "No") = if (this) yes else no

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

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

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    ll N;
    cin >> N;
    vector<ll> A(N);
    REP(i, N) cin >> A[i];

    map<ll, ll> cnt;
    REP(i, N) cnt[A[i]]++;
    vector<ll> B;
    for(auto x: cnt) B.push_back(x.second);
    sort(B.begin(), B.end());
    ll M = B.size();
    //cout << B << endl;

    ll sum = 0;
    REP(i, M) sum += B[i];
    vector<ll> rui(N+1, 0);
    REP(i, N){
        ll val = N-i;
        rui[val] = sum;
        ll kosu = B.end() - lower_bound(B.begin(), B.end(), val);
        sum -= kosu;
    }

    //cout << rui << endl;

    
    for(int k=1;k<=N;k++){
        ll lb = -1;
        ll ub = N+1;
        while(ub-lb>1){
            ll md = (lb+ub)/2;
            if(rui[md]/k >= md) lb = md;
            else ub = md;
        }
        cout << ub - 1 << endl;
    }
    
    
    return 0;
}

Measured memory_bytes: 26220
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int tl = 100000;

    int n, c;
    cin >> n >> c;

    vector<vector<int>> req(c, vector<int>(tl + 1, 0));
    for (int i = 0; i < n; i++) {
        int s, t, c;
        cin >> s >> t >> c;
        req[c - 1][s]++;
        req[c - 1][t]--;
    }

    vector<int> rec(tl + 1, 0);
    for (int i = 0; i < c; i++) {
        for (int j = 1; j <= tl; j++) {
            if (req[i][j] > 0) {
                rec[j - 1]++;
            } else if (req[i][j] < 0) {
                rec[j]--;
            }
        }
    }

    for (int i = 1; i <= tl; i++) {
        rec[i] += rec[i - 1];
    }

    int res = 0;
    for (int i = 0; i <= tl; i++) {
        res = max(res, rec[i]);
    }

    cout << res << endl;
}


Measured memory_bytes: 14072
s=input()
lists=list(s)
lists=list(map(int,lists))
a=len(lists)
li=[0]*a
for i in range (0,a):
  if i%2==0:
    li[i]=1
counts=0
for j in range (0,a):
  if li[j]==lists[j]:
    counts=counts+1
if counts>=(a-counts):
  print(a-counts)
else:
  print(counts)

Measured memory_bytes: 4724
#include<stdio.h>
 
#define MAX 100
#define WHITE -1
#define GRAY 0
#define BLACK 1
 
int n,t;
int color[MAX],d[MAX],f[MAX],Adj[MAX][MAX];
 
dfs(){
  int i;
 
  for(i=0;i<n;i++) color[i]=WHITE;
  t=0;
  for(i=0;i<n;i++){
    if(color[i]==WHITE) visit(i);
  }
}
 
visit(int r){
  int i;
 
  color[r]=GRAY;
  d[r]=++t;
 
  for(i=0;i<n;i++){
    if(Adj[r][i]==1 && color[i]==WHITE) visit(i);
  }
 
  color[r]=BLACK;
  f[r]=++t;
}
 
int main(){
  int i,u,k,j,v;
 
  for(i=0;i<MAX;i++){
    for(j=0;j<MAX;j++){ 
      Adj[i][j]=0;
    }
  }
 
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d",&v);
      Adj[u-1][v-1]=1;
    }
  }
 
  dfs();
 
  for(i=0;i<n;i++){
    printf("%d %d %d\n",i+1,d[i],f[i]);
  }
 
  return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()

using namespace std;

int A, B;

int N, M, C, D;


int main() {
	cin >> N;
	int res = 0;
	rep1(i, N) if (pow(i, 2) <= N) res = pow(i, 2);


	cout << res;


}




Measured memory_bytes: 256
#include "bits/stdc++.h"
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/pb_ds/assoc_container.hpp"
using namespace std;
////////////// Prewritten code follows. Look down for solution. ////////////////
#define x first
#define y second
#define LEN(x) ((int)(x).size())
#define ALL(x) x.begin(), x.end()
using ll = long long;
using llu = long long unsigned;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;
using vpii = vector<pii>;

const ld EPS = 1e-9;
inline int cmp(ld x, ld y = 0, ld tol = EPS) {
	return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}

const int MOD = 1;
inline int mod(ll x, int m = MOD) {
	return (int)(((x%m) + m)%m);
}

template<typename T, typename M = __gnu_pbds::null_type>
using ordered_set = __gnu_pbds::tree<T, M, less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;

////////////////////////// Solution starts below. //////////////////////////////

int n, d;

int main () {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // cout.precision(10);
	cin >> n >> d;
	int ans = 0;
	while(n--) {
		ll x, y;
		cin >> x >> y;
		ans += (x*x + y*y) <= d*1LL*d;
	}
	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 3632
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<iostream>
#define int long long
using namespace std;
const int maxn=200005;
int k,n;
double a[maxn+4]; 
bool check(double x){
	int cnt=0;
	for(int i=1;i<=n;i++){
		double e=(double)a[i]/x;
		int t=floor(e);
		int u=a[i]/t;
		if(fabs(u-x)<=1e-15)t--;
		cnt+=t;
	}
	return cnt<=k;
}
signed main()
{
	scanf("%lld%lld",&n,&k);
	double r=-1;
	for(int i=1;i<=n;i++){
		scanf("%lf",&a[i]);
		r=max(r,a[i]);
	}
	double l=0,mid,ans=r;
	while(r-l>=1e-6){
		double mid=(l+r)/2.0;
		if(check(mid))ans=mid,r=mid;
		else l=mid;
		//printf("%lf %lf %lf %lf\n",l,r,ans,mid);
	}
	printf("%.0f",ceil(ans));
	return 0;
}


Measured memory_bytes: 5312
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
#define INF 1000000000
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repX(i, n ,x) for (int i = x; i < (int)(n); i++)
#define repM(i, n) for (int i = n; i > 0; i--)

int main() {
    string S,T;
    cin >> S >> T;
    cout << T << S << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    int i;
    char a[100000];
    scanf("%s", a);
    for(i = 0; i < 100000; i++)
    {
        if(a[i] == '\0') break;
        if(i % 2 == 0) printf("%c", a[i]);
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <set>
#include <math.h>
#include <queue>
#define rep(i,n) for (int i = 0; i < (n); ++i)
typedef long long ll;
using namespace std;

int main() {
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> s(h);
    rep(i,h) cin >> s[i];
    int ans=0;
    rep(bit1,1<<h) {
        rep(bit2,1<<w) {
            int cnt=0;
            rep(i,h)rep(j,w) {
                if(bit1>>i&1) continue;
                if(bit2>>j&1) continue;
                if(s[i][j]=='#') cnt++;
            }
            if(cnt==k) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3164
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int arr[6];
  	int index;
  	for(int i=0;i<5;i++)
    {
      	scanf("%d",&arr[i]);
      if(arr[i]==0)
        index=i;
    }
  	printf("%d",index+1);
 
 
}

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 1; i < n; ++i) cin >> a[i];
    vector<int> res(n, 0);
    for (int i = 1; i < n; ++i) {
        ++res[a[i]-1];
    }
    for (int i = 0; i < n; ++i) cout << res[i] << endl;
    return 0;
}

Measured memory_bytes: 4844
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
	   String s = sc.next();
	   String year =("2018");
	   String month = s.substring(4);
	   System.out.println(year + month);	
	}
}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
#define REP(i, n) for (int i=0, i##_limit=(n); i<i##_limit; ++i)
#define FOR(i, a, b) for (int i=(a), i##_limit=(b); i<i##_limit; ++i)
#define pb push_back
#define mp make_pair
using namespace std;
using ll = long long;
using pi = pair<int, int>;

int main()
{
    int N;
    cin >> N;
    int H[N];
    REP(i, N) cin >> H[i];

    bool flag = true;
    H[0] -= 1;
    FOR(i, 1, N)
    {
        if (H[i-1] < H[i]) --H[i];
        if (H[i-1] > H[i]) { flag = false; break; }
    }

    cout << (flag ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll a,b,c,i,j,k,l,m,n,ans,tmp,hoge,fuga,piyo;
ll x[10010],y[10010];
string s,str;
int main(){
  cin>>a>>b>>c>>k;
  if(a>=k){
    cout<<k;
  }else if(a+b>=k){
    cout<<a;
  }else{
    cout<<(a-(k-a-b));
  }
  return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define init ios::sync_with_stdio(0); cin.tie(NULL);cout.tie(NULL);
using namespace std;

//  =========     /\       /|    |====/|
//      |        /  \       |    |   / |
//      |       /____\      |    |  /  |
//      |      /      \     |    | /   |
//  ========= /        \  =====  |/====|  
//  code

int main(){
    init;
    long long int MAX = 1e18;
    long long int N,i,j,k,l,W;
    cin>>N>>W;
    long long int w[N+1],v[N+1],total = 0;
    for(i=1;i<=N;i++){
        cin>>w[i]>>v[i];
        total += v[i];
    }

    long long int dp[total+1][N+1];
    for(i = 0;i <= total; i++){
        for(j = 0;j <= N;j++){
            if(i == 0)
                dp[i][j] = 0;
            else dp[i][j] = MAX;
        }
    }

    for(i = 1;i <= total;i++){
        for(j=1;j <= N;j++){
            if(i - v[j] >= 0)
                dp[i][j] = min(dp[i][j] , min(dp[i-v[j]][j-1] + w[j] , dp[i][j-1]));
            else dp[i][j] = min(dp[i][j] , dp[i][j-1]);
        }
    }
    k = -1;
    for(i=0;i<=total;i++)
        if(dp[i][N] <= W)
            k = max(k , i);
    cout<<k<<endl;
    return 0;
}

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

int main(){

  while(1){
    int x, y;
    cin>>x>>y;
    if(x == 0 && y == 0 )break;

    if (x > y )swap(x,y);
    cout<<x<<" "<<y<<endl;
  }

  return 0;
}

    



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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;
constexpr int mod2 = 998244353;
template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }
template<typename T>
bool isin(T y, T x, T h, T w) { return (0 <= y && 0 <= x && y < h && x < w); }
template<typename T>
bool isin1(T y, T x, T h, T w) { return (0 < y && 0 < x && y <= h && x <= w); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	os << v[0];
	for (int i = 1; i < v.size(); i++) os << " " << v[i];
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u; return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}


void Main() {
	string L; cin >> L;
	int N = L.size();
	vvll dp(N+1, vll(2, 0));
	
	dp[0][0] = 1;
	for (int i = 0; i < N; i++) {
		if (L[i] == '1') {
			(dp[i+1][0] += dp[i][0] * 2) %= mod;
			(dp[i+1][1] += dp[i][0]) %= mod;
		} else {
			(dp[i+1][0] += dp[i][0]) %= mod;
		}
		(dp[i+1][1] += dp[i][1] * 3) %= mod;
	}
	cout << (dp[N][0] + dp[N][1]) % mod << endl;
}

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


Measured memory_bytes: 5840