akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;
int main()
{
	int a, b, c, x, y,sum=0;
	cin >> a >> b >> c >> x >> y;
	int max = x > y ? x : y;
	for (int i = 0; i <= max * 2; i+=2)
	{
		int temp = i * c;
		if (i / 2 < x) temp += (x - i / 2)*a;
		if(i/2<y)temp+= +(y - i / 2)*b;
		if (sum==0||temp < sum)sum = temp;
	}
	printf("%d", sum);
	return 0;
}

Measured memory_bytes: 256
import math
inlist=input("").split(" ")
a=int(inlist[0])
b=int(inlist[1])
h=int(inlist[2])
m=int(inlist[3])
sita1=h*30+0.5*m
sita2=m*6
sita=sita1-sita2
d=a**2+b**2-2*a*b*math.cos(math.radians(sita))
e=math.sqrt(d)
print(e)


Measured memory_bytes: 9448
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい

#define ALL(x) x.begin(),x.end()
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<int, vector<int>, greater<int> > gpq; //逆順priority_queue
typedef priority_queue<int> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const double PI=3.1415926535;

ll gcd(ll x,ll y){
    ll b=max(x,y),s=min(x,y);
    if(s<=0)return b;
    return gcd(s,b%s);
}


int main(){    
    double R;
    cin>>R;
    cout<<setprecision(15)<<R*2.0*3.1415926535<<endl;
}


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

int main(void) {
    int n,k;
    cin >> n >> k;
    vector<int> a(n,0);
    int tmp;
    rep(i,n){
        cin >> tmp;
        a[tmp-1]++;
    }
    sort(a.begin(),a.end(),greater<int>());
    int res=0;
    rep(i,k){
        res += a[i];
    }
    cout << n-res << endl;
    return 0;
}

Measured memory_bytes: 1024
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

import bisect
from collections import deque

def main():
	n=II()
	A=[II() for _ in range(n)]

	Q=deque()
	Q.append(A[0])

	for i in A[1:]:
		x=bisect.bisect_left(Q,i)
		if x==0:
			Q.appendleft(i)
		else:
			Q[x-1]=i
	print(len(Q))





















if __name__ == "__main__":
	main()


Measured memory_bytes: 80552
#include<iostream>
using namespace std;
int main(){
  int N, B[100];
  cin >> N;
  for(int i=0; i<N-1; i++) cin >> B[i];
  unsigned int ans=0;
  ans += B[0];
  for(int i=1; i<N-1; i++){
    if(B[i] < B[i-1]){
      ans += B[i];
    }else{
      ans += B[i-1];
    }
  }
  ans += B[N-2];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 888
import java.util.*;

public class Main {

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

        String str = scanner.next();

        if(str.charAt(0) == 'A'){
            int cntC = 0;
            for(int i=2; i<str.length()-1; i++){
                if(str.charAt(i) == 'C'){
                    cntC++;
                }
            }

            HashSet<Character> set = new HashSet<>();
            set.add('A');
            set.add('C');

            if(cntC == 1){
                for(char c: str.toCharArray()){
                    if(Character.isUpperCase(c) && !set.contains(c)){
                        System.out.println("WA");
                        return;
                    }
                }

                System.out.println("AC");
                return;
            }
        }
        System.out.println("WA");
        return;
    }

    static List<Integer> primeList(int n) {
        List<Integer> list = new ArrayList<>();
        boolean[] prime = new boolean[n + 1];
        Arrays.fill(prime, true);
        prime[0] = false;
        prime[1] = false;
        for (int i = 2; i < Math.sqrt(n); i++) {
            if (!prime[i]) continue;
            for (int j = 2; i * j <= n; j++) {
                prime[i * j] = false;
            }
        }
        for (int i = 0; i < prime.length; i++) {
            if (prime[i]) list.add(i);
        }

        return list;
    }
}

Measured memory_bytes: 21716
N=int(input())
A=list(map(int,input().split()))

limit=10**9+7
S=[0]
for i in range(N):
    A[i]=A[i]%limit
for i in range(1,N):
    S.append((S[i-1]+A[-i])%limit)
ans=0
for i in range(N-1):
    ans+=A[i]*S[-1-i]
    ans=ans%limit
print(ans)


Measured memory_bytes: 31760
# coding: utf-8
# Here your code !
fin = False
while fin == False:
    lists = []
    times = int(input())
    if times == 0:
        fin == True
        break
    else:
        for i in range(times):
            a = int(input())
            lists.append(a)
        lists.remove(max(lists))
        lists.remove(min(lists))
        s = 0
        for i in lists:
            s+=i
        result = int(s/len(lists))
        print(result)
    
    

Measured memory_bytes: 7572
use proconio::fastout;
use proconio::input;
use proconio::marker::Usize1;

#[fastout]
fn main() {
    input! {
        n: u64, k: u64,
        an: [Usize1; n],
    }
    let mut visited = vec![0; n as usize];
    let mut town = 0;
    let mut ans = None;
    for i in 1..=n {
        if k == i {
            ans = Some(an[town]);
            break;
        }
        if visited[town] != 0 {
            let lead = visited[town] - 1;
            let circle_size = i - lead - 1;
            ans = Some(
                visited
                    .iter()
                    .position(|&x| x == ((k - lead) % circle_size) + lead + 1)
                    .unwrap(),
            );
            break;
        }
        visited[town] = i;
        town = an[town];
    }
    println!("{}", ans.unwrap() + 1);
}


Measured memory_bytes: 6516
def merge as, left, mid, right
  l_as = as.slice(left..mid)
  r_as = as.slice((mid + 1)..right)
  l_as << Float::INFINITY
  r_as << Float::INFINITY

  l_i, r_i = [0, 0]
  cnt = 0
  left.upto(right) do |i|
    if l_as[l_i] <= r_as[r_i]
      as[i] = l_as[l_i]
      l_i += 1
    else
      cnt += (mid + 1 + r_i - i)
      as[i] = r_as[r_i]
      r_i += 1
    end
  end
  return cnt
end

def merge_sort as, left, right
  cnt = 0
  if left < right
    mid = (left + right) / 2
    cnt += merge_sort as, left, mid
    cnt += merge_sort as, mid + 1, right
    cnt += merge as, left, mid, right
  end
  return cnt
end

n = gets.chomp.to_i
as = gets.chomp.split(' ').map(&:to_i)
cnt = merge_sort as, 0, n - 1
puts cnt


Measured memory_bytes: 40216
#include <bits/stdc++.h>
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 fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
#define dame { printf("No\n"); return 0;}
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e17)


signed main(){
    int a,b;
    cin >> a >> b;
    cout << int( (3 * a + b) / 2) << endl; 
}


Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;

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

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

int main() {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;

  map<string, long long> MA;

  for (int i = 0; i < N; i++) {
    string S;
    cin >> S;
    sort(S.begin(), S.end());
    MA[S]++;
  }

  long long ans = 0;

  for (auto ma : MA) {
    ans += ma.second * (ma.second - 1) / 2;
  }

  cout << ans << "\n";
}

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

int main(){
    ll n,res;
    cin>>n;
    vector<ll> x(n),y(n),h(n);
    rep(i,n){
        cin>>x[i]>>y[i]>>h[i];
        if(h[i]!=0) res=i;
    }
    rep(i,101){
        rep(j,101){
            ll tmph=h[res]+abs(x[res]-i)+abs(y[res]-j);
            bool flag=0;
            rep(k,n){
                if(h[k]!=max(tmph-abs(x[k]-i)-abs(y[k]-j),(ll)0)) break;
                if(k==n-1) flag=1;
            }
            if(flag){
                cout<<i<<' '<<j<<' '<<tmph;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 998244353
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 1LL<<59

int main(){
    ll i,j;
    ll n;
    cin>>n;
    priority_queue<P> q;
    ll a[n];
    vector<ll> b(n);
    ll x;
    for(i=0;i<n;i++){
        cin>>b[i];
    }
    for(i=0;i<n;i++){
        cin>>a[i];
        q.push(P(a[i],i));

    }
    ll ok=0;
    ll cnt=0;
    for(i=0;i<n;i++) if(a[i]==b[i]) ok++;
    ll loop=0;
    while(ok<n){
        P f=q.top();
        q.pop();
        ll u=f.se;
        ll up=u+1;
        if(up>=n) up-=n;
        ll un=u-1;
        if(un<0) un+=n;

        if(a[u]<b[u]){
            cout<<-1<<endl;
            return 0;
        }

        if(a[u]>b[u]){
            if((a[u]-b[u])%(a[up]+a[un])==0) {
                cnt+=(a[u]-b[u])/(a[up]+a[un]);
                a[u]=b[u];
                ok++;
            }
            else {
                if(a[u]/(a[up]+a[un])==0) {
                    cout<<-1<<endl;
                    return 0;
                }
                cnt+=a[u]/(a[up]+a[un]);
                a[u]=a[u]%(a[up]+a[un]);
                if(a[u]<b[u]){
                    cout<<-1<<endl;
                    return 0;
                }
                q.push(P(a[u],u));
            }
        }


    }
    cout<<cnt<<endl;

    return 0;
}

Measured memory_bytes: 8944
import java.util.Scanner;
public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a*b%2==1){
            System.out.println("Odd");
        }
        else{
            System.out.println("Even");
        }
    }
}

Measured memory_bytes: 21588
#include <algorithm>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
#include <math.h>
#include <utility>
#include <map>
#include <queue>
#include <stack>

using namespace std;

#define INF 210000000
#define int long long

int gcd(int a, int b) {
  int amari = a % b;
  int c = b;
  if (amari == 0) {
    return b;
  } else {
    return gcd(b, amari);
  }
}

int lcm(int a, int b) { return a * b / gcd(a, b); }

signed main() {
    int n;
    int t;
    cin >> n >> t;
    int ans = t;
    int time[n];
    for (int i=0;i<n;i++){
        cin >> time[i];
    }
    for (int i=1;i<n;i++){
        if(time[i] - time[i-1] < t){
            ans += time[i] - time[i-1];
        }
        else{
            ans+=t;
        }
    }
    cout << ans;
}



Measured memory_bytes: 1792
from collections import Counter

M = 998244353
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
r = 0
if a[0] == 0 and c[0] == 1:
    r = i = 1
    while c[i]:
        r = r * pow(c[i - 1], c[i], M) % M
        n -= c[i]
        i += 1
print((r, 0)[n > 1])


Measured memory_bytes: 19928
N=int(input())
H=list(map(int,input().split()))

max_h=H[0]

flg =0
for i in range(N):
    max_h =max(max_h,H[i])

    if max_h-1>H[i]:
        flg+=1

if flg!=0:
    print('No')
else:
    print('Yes')


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

int main(){

  int N;
  cin>>N;

	
  cout<<pow(N,3)<<endl;
}

Measured memory_bytes: 384
import java.util.Scanner;
public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
	    int n,m,hangout;
	    int assignment = 0;  // n days , m assingment
	 
	    n = sc.nextInt();
	    m = sc.nextInt();
	    
	    int[] arr = new int[m];
	    
	    for(int i = 0; i<m; i++) {
	    	arr[i] = sc.nextInt();
	    	assignment = assignment+arr[i];
	    }
	    hangout = n-assignment;
	    
	    
	    if(hangout>=0) {
	    	System.out.println(hangout);
	    }
	    else {
	    	System.out.println("-1");
	    }
	    
	    

	}

}


Measured memory_bytes: 46584
N, W = map(int,input().split())
dp = [[0]*(W+1) for _ in range(N+1)]
for n in range(1,N+1):
  wn, vn = map(int,input().split())
  dp[n][:] = dp[n-1][:]
  for w in range(W+1):
    if w + wn > W: break
    dp[n][w+wn] = max(dp[n][w+wn],dp[n-1][w]+vn)
print(max(dp[N]))

Measured memory_bytes: 128960
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
import java.util.Scanner;



class Main {

	
	public static void main(String[] argv){

		Scanner sc = new Scanner(System.in);
		
		String s = sc.nextLine();
		
		char[] c = s.toCharArray();
		
		boolean findC = false,findF = false;
		
		for(int i = 0;i<c.length;i++){
			if(!findC && c[i] == 'C'){
				findC = true;
			}
			if(findC && c[i] == 'F'){
				findF = true;
				break;
			}
		}
		
		if(findC && findF){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}

	}


}



class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}


Measured memory_bytes: 10056
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	}

	void solve() {
		Scanner sc = new Scanner(System.in);
		int d = Integer.parseInt(sc.next());
		int n = Integer.parseInt(sc.next());
		sc.close();

		if(n == 100) n++;
		if(d==0)System.out.println(n);
		else if(d==1)System.out.println(100*n);
		else if(d==2)System.out.println(10000*n);
	}
}



Measured memory_bytes: 23764
#include <iostream>
#include <iomanip> //setprecision()
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <set>
using ll = long long;
using namespace std;

int main() {
    ll a,n,sum=0;
    vector<int> v;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        v.push_back(a);
    }
    sort(v.begin(),v.end(),greater<int>());
    for(int i=0;i<n;i++){
        sum+=v[i/2];
    }
    cout<<sum-v[0];
}


Measured memory_bytes: 4316
#include<stdio.h>
#include<math.h>
#include<string.h>

int main(){

    char canvas[52][52];
    int h = 0;
    int w = 0;
    int loop_h = 0;
    int loop_w = 0;
    int flag = 0;
    char strin[52];

    memset(canvas, 0x00, sizeof(canvas));

    scanf("%d%d", &h, &w);
    while ('\n' != getchar());
    for (loop_h = 0; loop_h < h; loop_h++){
        memset(strin, 0x00, sizeof(strin));
        fgets(strin, 52, stdin);

        for (loop_w = 0; loop_w < w; loop_w++){
            canvas[loop_h + 1][loop_w + 1] = strin[loop_w];
        }
    }

    for (loop_h = 1; loop_h < h + 1; loop_h++){
        for (loop_w = 1; loop_w < w + 1; loop_w++){
            if ('#' == canvas[loop_h][loop_w]){

                if (('#' != canvas[loop_h - 1][loop_w])
                    && ('#' != canvas[loop_h + 1][loop_w])
                    && ('#' != canvas[loop_h][loop_w - 1])
                    && ('#' != canvas[loop_h][loop_w + 1])){
                    flag = 1;
                    break;
                }
            }
        }
    }

    if (0 == flag){
        printf("Yes");
    }
    else{
        printf("No");
    }

    return 0;
}


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

int N, A[100005], B[100005];

int sim(int x){
  
  for(int i=0;i<N;i++) B[i] = A[i];
  
  B[0] -= x;
  B[N-1] -= x;
  
  for(int i=0;i<N-1;i++){
    B[i+1] -= B[i];
  }
  
  return B[N-1];
}

signed main(){
  
  cin>>N;
  
  for(int i=0;i<N;i++) cin>>A[i];
  
  int L = 0, R = 1e15;
  
  while( L + 1 < R ){
    
    int M = ( L + R ) / 2;
    
    if( sim(M) < 0 ) R = M;
    else L = M;
    
  }
  
  vector<int> ans;
  
  ans.push_back( L * 2 );
  
  A[0] -= L;
  A[N-1] -= L;
  
  for(int i=0;i<N-1;i++){
    ans.push_back( A[i] * 2 );
    A[i+1] -= A[i];
  }
  
  for(int i=0;i<N;i++){
    
    if(i) cout<<' ';
    cout<<ans[i];
    
  }
  
  cout<<endl;
  
  return 0;
}


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

using namespace std;
#define int long long
const int MOD = 1000000007;

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<int> A(N);
	vector<int> B(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	for (int i = 0; i < N; i++) {
		cin >> B[i];
	}
	vector<int> AA(N);
	vector<int> BB(N);
	for (int i = 0; i < N; i++) {
		AA[i] = (A[i] ^ A[(i + 1) % N]);
		BB[i] = (B[i] ^ B[(i + 1) % N]);
	}
	for (int i = 0; i < N; i++) {
		AA.push_back(BB[i]);
		//cerr << AA.back()<<endl;
	}
	for (int i = 0; i < N; i++) {
		AA.push_back(BB[i]);
	}
	vector<int> X(AA.size(), 0);

	X[0] = AA.size();
	{
		int i = 1, j = 0;
		while (i < AA.size()) {
			while (i + j < AA.size() && AA[j] == AA[i + j]) ++j;
			X[i] = j;
			if (j == 0) {
				++i;
				continue;
			}
			int k = 1;
			while (i + k < AA.size() && k + X[k] < j) X[i + k] = X[k], ++k;
			i += k;
			j -= k;
		}
	}
	// for (int i = 0; i < AA.size(); i++) {
	// 	cerr << AA[i] << " ";
	// }
	// cerr << endl;
	// for (int i = 0; i < AA.size(); i++) {
	// 	cerr << X[i] << " ";
	// }
	// cerr << endl;
	vector<int> res;
	for (int i = N; i < 2 * N; i++) {
		if (X[i] >= N) {
			res.push_back(N - (i - N));
			if(res.back() == N)res.back() = 0;
		}
	}
	sort(res.begin(), res.end());
	for (int i = 0; i < res.size(); i++) {
		cout << res[i] << " " << (A[res[i]] ^ B[0]) << "\n";
	}
	return 0;
}

Measured memory_bytes: 22316
use std::io::stdin;

macro_rules! read {
    ($t: ty) => {{
        let mut line = String::new();
        stdin().read_line(&mut line);
        line.trim().parse::<$t>().unwrap()
    }};
    ($($t: ty), *) => {{
        let mut line = String::new();
        stdin().read_line(&mut line);
        let mut iter = line.split_whitespace();
        (
            $(iter.next().unwrap().parse::<$t>().unwrap(), )*
        )
    }}
}
macro_rules! reads {
    ($e:expr, $t:ty) => {{
        let mut v = vec![];
        for _ in 0..$e {
            let mut line = String::new();
            stdin().read_line(&mut line);
            v.push(line.trim().parse::<$t>().unwrap());
        }
        v
    }};
}

fn main() {
    let s = read!(String);
    let y = s[0..4].parse::<u32>().unwrap();
    let m = s[5..7].parse::<u32>().unwrap();
    let d = s[8..10].parse::<u32>().unwrap();
    if y <= 2019 {
        if m <= 4 {
            if d <= 30 {
                println!("Heisei");
                return;
            }
        }
    }
    println!("TBD");
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
bool vis[105];
ll a[55],b[55];
bool bfs(ll s,ll e,vector<ll> &v){
    memset(vis,0,sizeof(vis));
    queue<ll> q;
    q.push(s);
    vis[s]=1;
    while(!q.empty()){
        ll u=q.front();q.pop();
        for(auto &ele:v){
            if(!vis[u%ele])vis[u%ele]=1,q.push(u%ele);
        }
    }
    return vis[e];
}
bool chk(ll n,vector<ll> &v){
    for(ll i=0;i<n;i++)if(!bfs(a[i],b[i],v))return 0;
    return 1;
}
int main(){
    cin.tie(NULL); cout.tie(NULL);
    ios_base:: sync_with_stdio(false);
    ll n;cin>>n;
    ll mx=0;for(ll i=0;i<n;i++)cin>>a[i],mx=max(mx,a[i]);
    for(ll i=0;i<n;i++)cin>>b[i];
    ll ans = 0;
    vector<ll> v;
    for(ll i=mx+1;i>0;i--){
        vector<ll> tmp;
        for(ll j=i-1;j>0;j--)tmp.push_back(j);
        for(auto &ele:v)tmp.push_back(ele);
        if(!chk(n,tmp)){
            if(i==mx+1)return cout<<"-1"  ,0 ;
            ans+=(1ll<<i);
            v.push_back(i);
        }
    }

    //for(auto &ele:v)cout<<ele<<" ";cout<<endl;
    cout<<ans;
}




Measured memory_bytes: 256
import sys
n = int(input())
w = [input() for _ in range(n)]
if len(w) != len(set(w)):
    print('No')
    sys.exit(0)

w.insert(0, w[0][0])
w.append(w[-1][-1])

for i in range(1, n + 1):
    if w[i - 1][-1] != w[i][0] or w[i][-1] != w[i + 1][0]:
        print('No')
        sys.exit(0)
print('Yes')

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

int main(){
    int N;
    cin >> N;

    string S;
    cin >> S;

    int count = 0;

    for(int i = 0; i < N - 2; i++){
        if(S.at(i) == 'A' && S.at(i + 1) == 'B' && S.at(i + 2) == 'C') count++;
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
n,k = gets.split.map(&:to_i)

ue = []
n.times do |i|
  a = i + 1
  sum = 0
  until a >= k
    a = a * 2
    sum += 1
  end
  ue << sum
end

sum = 0
c = 1/n.to_f
ue.each do |a|
  b = 0.5 ** a
  sum += b * c
end


p sum

Measured memory_bytes: 2684
<?php
fscanf(STDIN, "%d %d", $H, $W);
$ans = [];
for ($i = 0; $i < $H; $i++) {
    $str = trim(fgets(STDIN));
    $m[$i] = str_split($str);
}

for ($i = 0; $i < $H; $i++) {
    for ($j = 0; $j < $W; $j++) {

        if ($m[$i][$j] !== '.') continue;

        $y = $i;
        $x = $j;
        $step = 0;

        $s = array_pad(array(), $H, array_pad(array(), $W, null));
        $s[$i][$j] = 0;
        $next = [];
        $next[$i][$j] = 1;
        $next2 = [];
        
        while(true) {
            
            foreach ($next as $y => $v1) {
                foreach ($v1 as $x => $dummy) {
                    $s[$y][$x] = $step;
         
                    // 右に進む
                    if (isset($m[$y][$x+1]) && is_null($s[$y][$x+1]) && $m[$y][$x+1] === '.') {
                        $next2[$y][$x+1] = 1;
                    }
                    // 左に進む
                    if (isset($m[$y][$x-1]) && is_null($s[$y][$x-1]) && $m[$y][$x-1] === '.') {
                        $next2[$y][$x-1] = 1;
                    }
                    // 上に進む
                    if (isset($m[$y-1][$x]) && is_null($s[$y-1][$x]) && $m[$y-1][$x] === '.') {
                        $next2[$y-1][$x] = 1;
                    }
                    // 下に進む
                    if (isset($m[$y+1][$x]) && is_null($s[$y+1][$x]) && $m[$y+1][$x] === '.') {
                        $next2[$y+1][$x] = 1;
                    }
         
                }
            }
            if (empty($next2)) break;
         
            // リセット
            $next = $next2;
            $next2 = [];
            $step++;
        
        }
        $ans[] = $step;
    }
}
printf("%d", max($ans));


Measured memory_bytes: 4604
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
namespace io{
    #define ll long long
    #define inf 0x3f3f3f3f
    #define il inline 
    #define in1(a) read(a)
    #define in2(a,b) in1(a),in1(b)
    #define in3(a,b,c) in2(a,b),in1(c)
    #define in4(a,b,c,d) in2(a,b),in2(c,d)
    il void readl(ll &x){
        x=0;ll f=1;char c=getchar();
        while(c<'0'||c>'9'){if(c=='-')f=-f;c=getchar();}
        while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
        x*=f;
    }
    il void read(int &x){
        x=0;int f=1;char c=getchar();
        while(c<'0'||c>'9'){if(c=='-')f=-f;c=getchar();}
        while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
        x*=f;
    }
}using namespace io;
int n,m,c;
int b[105];
int main(){
	int ans=0;
	in3(n,m,c);
	for(int i=1;i<=m;i++) read(b[i]);
	for(int i=1;i<=n;i++){
		int a;
		ll sum=0;
		for(int j=1;j<=m;j++){
			read(a);
			sum+=a*b[j];
		}
		sum+=c;
		if(sum>0) ans++;
	} 
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
#include <cassert>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

vector<pii> v;

ll dp[110][110];

ll f(int l, int r){
	if(dp[l][r] != -1) return dp[l][r];
	assert(l >= 0 && r < v.size());
	ll ret = 1e18;
	for(int i = l; i < r; i++) {
		ret = min(ret, f(l, i) + f(i+1, r) + v[l].fi*v[i].se*v[i+1].fi*v[r].se);
	}
	return dp[l][r] = ret;
}

int main(){
	int n;
	cin>>n;
	v.resize(n);
	rep(i, n) cin>>v[i].fi>>v[i].se;
	rep(i, 110) rep(j, 110) dp[i][j] = -1;
	rep(i, 110) dp[i][i] = 0;
	cout<<f(0, n-1)<<endl;
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
typedef unsigned long long ll;

int d = 365;
int types = 26;

vector<int>c(types, 0);
vector<vector<int>>s(d, vector<int>(types, 0));
vector<int>last(types, 0);
vector<int>ans(d, 0);

// given a list of types for each day, return a list of satisfaction at the end of each day
vector<int> computeScore(vector<int> t){
    REP(i, types) last[i] = 0;

    vector<int>satisByDay(d, 0);
    int satis = 0;
    REP(i, d){ 
        int today = t[i]-1;
        satis += s[i][today];
        last[today] = i+1;
        REP(j, types){
            satis = satis - c[j]*(i + 1 - last[j]);
        }
        // cout << satis << endl;
        satisByDay[i] = satis;
    }
    return satisByDay;
}

pair<vector<int>, int> greedyComputeT(){
    vector<int>satisByDay(d, 0);
    int satis = 0;

    REP(i, types) last[i] = 0;

    REP(i, d){ 
        int maxSatis = -INF;
        int maxj = 0;
        REP(j, types){
            int curr_satis = s[i][j];
            
            REP(k, types){
                if(j!=k) curr_satis -= c[k]*(i + 1 - last[k]);
            }
            if (curr_satis > maxSatis) {
                maxSatis = curr_satis;
                maxj = j;
            }
        }
        // cout << satis << endl;
        satis += maxSatis;
        satisByDay[i] = satis;
        ans[i] = maxj;
        last[maxj] = i+1;
        // cout << satis << endl;
    }
    return pair<vector<int>, int>(ans, satis);
}

int main(){
    int d;
    cin >> d;

    // bool cp = false;
    REP(i, types) cin >> c[i];
    REP(i, d) REP(j, types){
        cin >> s[i][j];
    } 
    vector<int>t(d, 0);
    REP(i, d){
        t[i] = rand() % 26+1;
    }

    pair<vector<int>, int> ans = greedyComputeT();
    vector<int> greedyT = ans.first;
    // int greedySatis = ans.second;

    REP(i, d) cout << greedyT[i]+1 << endl;
    // cout << greedySatis << endl;

}

Measured memory_bytes: 3708
#line 2 "header.hpp"

//%snippet.set('header')%
//%snippet.fold()%
#ifndef HEADER_H
#define HEADER_H

// template version 2.0
using namespace std;
#include <bits/stdc++.h>

// varibable settings
const long long INF = 1e18;
template <class T> constexpr T inf = numeric_limits<T>::max() / 2.1;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define _rrep(i, n) rrepi(i, 0, n)
#define rrepi(i, a, b) for (ll i = (ll)((b)-1); i >= (ll)(a); --i)
#define r_rep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(i, a) for (auto &&i : a)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(...) make_tuple(__VA_ARGS__)
#define ub upper_bound
#define lb lower_bound
#define lpos(A, x) (lower_bound(all(A), x) - A.begin())
#define upos(A, x) (upper_bound(all(A), x) - A.begin())
template <class T> inline void chmax(T &a, const T &b) { if ((a) < (b)) (a) = (b); }
template <class T> inline void chmin(T &a, const T &b) { if ((a) > (b)) (a) = (b); }
template <typename X, typename T> auto make_table(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto make_table(X x, Y y, Z z, Zs... zs) { auto cont = make_table(y, z, zs...); return vector<decltype(cont)>(x, cont); }

#define cdiv(a, b) (((a) + (b)-1) / (b))
#define is_in(x, a, b) ((a) <= (x) && (x) < (b))
#define uni(x) sort(all(x)); x.erase(unique(all(x)), x.end())
#define slice(l, r) substr(l, r - l)

typedef long long ll;
typedef long double ld;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;

template <typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;
void check_input() { assert(cin.eof() == 0); int tmp; cin >> tmp; assert(cin.eof() == 1); }

#if defined(PCM) || defined(LOCAL)
#else
#define dump(...) ;
#define dump_1d(...) ;
#define dump_2d(...) ;
#define cerrendl ;
#endif

#endif /* HEADER_H */
//%snippet.end()%
#line 2 "solve.cpp"
template<class T=ll> using vec = vector<T>;
struct Fast { Fast() { std::cin.tie(0); ios::sync_with_stdio(false); } } fast;


int solve() {
    ll a, v;cin>>a>>v;
    ll b, w;cin>>b>>w;
    ll t;cin>>t;

    ll d = abs(a-b);
    if (v<=w) {
        cout << "NO" << endl;
    }
    else{
        ll vd = v - w;
        cout << (vd*t>=d ? "YES" : "NO") << endl;
    }

    return 0; 
}


int main(){/*{{{*/
    solve();
    check_input();
    return 0;
}/*}}}*/


Measured memory_bytes: 3656
module mod_tree
  implicit none
  type arraylist
    integer :: num = 0
    integer, pointer :: arr(:) => null()
  end type
  type tree
    type(arraylist), pointer :: egs(:) => null()
    integer, pointer :: dist(:) => null()
  contains
    procedure :: add => add
    procedure :: dfs => dfs
  end type
  interface tree
    module procedure :: newt
  end interface tree
contains
  subroutine appende(a)
    integer, pointer, intent(inout) :: a(:)
    integer :: n
    integer, allocatable :: tmp(:)
    n = size(a)
    allocate(tmp(n))
    tmp = a
    deallocate(a)
    allocate(a(2*n))
    a(1:n) = tmp
    deallocate(tmp)
  end
  subroutine adde(list,e)
    class(arraylist), intent(inout) :: list
    integer, intent(in) :: e
    if (.not.associated(list%arr)) allocate(list%arr(1))
    if (list%num == size(list%arr)) call appende(list%arr)
    list%num = list%num+1
    list%arr(list%num) = e
  end
  function gete(list,i) result(ret)
    class(arraylist), intent(inout) :: list
    integer, intent(in) :: i
    integer :: ret
    ret = list%arr(i)
  end
  function newt(n) result(ret)
    integer, intent(in) :: n
    type(tree) :: ret
    allocate(ret%egs(n))
    allocate(ret%dist(n))
    ret%dist = 0
  end
  subroutine add(this,fm,to)
    class(tree), intent(inout) :: this
    integer, intent(in) :: fm, to
    call adde(this%egs(fm),to)
  end
  recursive subroutine dfs(this,v,p,d)
    class(tree), intent(inout) :: this
    integer, intent(in) :: v, p, d
    integer :: n, i, u
    this%dist(v) = d
    n = this%egs(v)%num
    do i = 1, n
      u = gete(this%egs(v),i)
      if (u == p) cycle
      call dfs(this,u,v,d+1)
    end do
  end
end module mod_tree
program abc138d
    use mod_tree
    implicit none
    integer::N,Q,P,X
    integer::i
    integer,allocatable,dimension(:)::U,T,A,B
    integer(8),allocatable,dimension(:)::D
    logical,allocatable,dimension(:)::Visited
    type(tree)::G
    read*,N,Q
    allocate(U(0:N),T(0:N),D(N),A(N-1),B(N-1))
    G=tree(N)
    do i=1,N-1
        read*,A(i),B(i)
        call add(G,A(i),B(i))
        call add(G,B(i),A(i)) 
    end do
    call dfs(G,1,-1,0)
    U=0;T=0
    do i=1,N-1
        if(G%dist(A(i))<G%dist(B(i)))then
            U(B(i))=A(i)
        else
            U(A(i))=B(i)
        endif
    end do

    do i=1,Q
        read*,P,X
        T(P)=T(P)+X
    end do
    
    allocate(Visited(0:N))
    Visited=.false.
    do i=1,N
        if(.not.visited(i))then
            call solve(i)
        endif
        print"(i0)",T(i)
    end do
contains
recursive subroutine solve(Num)
    integer::Num
    if(U(Num)/=0.and. .not.(Visited(U(Num))))then
        call solve(U(Num))
    endif
    T(Num)=T(Num)+T(U(Num))
    Visited(Num)=.true.
end subroutine
end program

Measured memory_bytes: 39936
#include <iostream>
using namespace std;
const long INF = 1e9;
const long MOD = 1e9 + 7;

bool isPrime(int num)
{
    bool state = true;
    for (int i = 2; i * i <= num; i++)
    {
        if (num % i == 0)
        {
            state = false;
        }
    }
    return state;
}

int main()
{
    int t, cnt = 0;
    cin >> t;
    for (int i = 0; i < t; i++)
    {
        int num;
        cin >> num;
        if (isPrime(num))
        {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}



Measured memory_bytes: 3104
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        
        // board[i][j]: 迷路
        char[][] board = new char[h][w];
        for (int i = 0; i < h; i++) {
            String str = sc.next();
            for (int j = 0; j < w; j++) {
                board[i][j] = str.charAt(j);
            }
        }
        
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if (board[i][j] == '.') continue;
                int count = 0;
                if (i-1 >= 0 && board[i-1][j] == '#') count++;
                if (i+1 < h && board[i+1][j] == '#') count++;
                if (j-1 >= 0 && board[i][j-1] == '#') count++;
                if (j+1 < w && board[i][j+1] == '#') count++;
                
                if (count <= 0) {
                    System.out.println("No");
                    return;
                }
            }
        }
        System.out.println("Yes");
    }
}

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

using namespace std;

int u[100001];
int cnt[100001];

int main () {
	int n, m;
	cin >> n >> m;
	u[1] = 1;
	for (int i = 1;i <= n;i ++) cnt[i] = 1;
	while (m --) {
		int x, y;
		cin >> x >> y;
		if (u[x]) {
			if (cnt[x] == 1) u[x] = 0;
			cnt[x] --;
			cnt[y] ++;
			u[y] = 1;
		}
		else {
			cnt[x] --;
			cnt[y] ++;
		}
	}
	int ans = 0;
	for (int i = 1;i <= n;i ++) ans += u[i];
	cout << ans;
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void print_num(int *array, int N);

int main() {
  int N, num;
  int i;
  int *array;

  scanf("%d", &N);

  array = (int *) calloc(N, sizeof(int));
  if (!array) {
    abort();
  }

  for (i=0; i<N; i++) {
    scanf("%d", &array[i]);
  }

  int j;
  int index;
  for (i=0; i<N; i++) {
    index = -1;
    for (j=i-1; j>=0; j--) {
      if (array[j] > array[i]) {
        index = j;
      }
      else {
        break;
      }
    }
    if (index != -1) {
      int tmp = array[i];
      memmove(&array[index+1], &array[index], sizeof(int)*(i-index));
      array[index]  = tmp;
    }
    print_num(array, N);
  }

  return 0;
}

void print_num(int *array, int N) {
  int i;
  for (i=0; i<N; i++) {
    printf("%d", array[i]);
    if (i + 1 != N) {
      putchar(' ');
    }
  }
  putchar('\n');
}

Measured memory_bytes: 636
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
typedef long long int ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<signed(n);i++)
#define EREP(i,n) for(int i=1;i<=signed(n);i++)
#define ALL(a) (a).begin(),(a).end()
using std::cout;
using std::vector;
using std::endl;
using std::cin;
using std::string;
//#define EVEL 1
#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD = 1000000007;
const ll INF = 50000000000000000;
typedef std::pair<int,int> P;
struct edge {int to,cost;};
#define VMAX 301
    int N;
    ll d[VMAX][VMAX];
    ll A[VMAX][VMAX];
    bool vis[VMAX][VMAX]={};
    ll ans=0;
    bool No=false;
    void warshall_floyd(int n) { // nは頂点数
      for (int i = 0; i < n; i++)      // 経由する頂点
        for (int j = 0; j < n; j++)    // 開始頂点
          for (int k = 0; k < n; k++){  // 終端
          if(d[j][k]> d[j][i] + d[i][k]){No=true;return;}
          if(d[j][k] == d[j][i] + d[i][k]&&!(i==k||i==j)){vis[j][k]=true;}
            d[j][k] = std::min(d[j][k], d[j][i] + d[i][k]);
        }
    }
int main(){
    std::ios_base::sync_with_stdio(false);
    cin>>N;
    REP(i,N)REP(j,N){
        cin>>d[i][j];
    }
    warshall_floyd(N);
    if(No)cout<<"-1";
    else{
        for(int i=0;i<N;i++){
            for(int j=i+1;j<N;j++){
                //DEB(i)DEB(j)TF(vis[i][j])END
                if(!vis[i][j])ans+=d[i][j];
            }

        }
        cout<<ans;
    }
    return 0;
}

Measured memory_bytes: 1024
import sys
import bisect

def input():
    return sys.stdin.readline().rstrip()

def LIS(seq):
	l = [seq[0]]
	for i in range(1,len(seq)):
	    if seq[i] >= l[-1]:
	        l.append(seq[i])
	    else:
	        l[bisect.bisect_right(l, seq[i])] = seq[i]

	return(len(l))

def main():
	n=int(input())
	a=[int(input()) for _ in range(n)]
	print(LIS(a[::-1]))

main()

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

int main() {
  int N;
  int c = 0;
  cin >> N;
  int t = N;
  while (t > 0) {
    c += t % 10;
    t /= 10;
  }
  if (N % c == 0)
    puts("Yes");
  else
    puts("No");
}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

int f(double x) {
  return (x < 0.2) + (x < 0.6) + (x < 1.1);
}

void solve() {
  double l, r;
  vi lt(4), rt(4);
  while (cin >> l >> r) lt[f(l)]++, rt[f(r)]++;
  rep(i, 4) cout << lt[i] << ' ' << rt[i] << endl;
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n, m;
    cin >> n >> m;
    vector<vector<pii>> adj(n);
    REP(i,n-1){
        adj[i+1].emplace_back(i,0);
    }
    REP(i,m){
        int32 l,r,c;
        cin >> l >> r >> c;
        l--;r--;
        adj[l].emplace_back(r, c);
    }
    vector<int64> dist(n, LLINF);
    dist[0] = 0;
    priority_queue<pii, vector<pii>, greater<pii>> pque;
    pque.emplace(0,0);
    while(!pque.empty()){
        pii p = pque.top();
        pque.pop();
        if(dist[p.second] < p.first)continue;
        for(pii q : adj[p.second]){
            if(dist[q.first] > dist[p.second] + q.second){
                dist[q.first] = dist[p.second] + q.second;
                pque.emplace(dist[q.first], q.first);
            }
        }
    }
    if(dist[n-1] == LLINF)dist[n-1] = -1;
    ANS(dist[n-1]);
    return 0;
}

Measured memory_bytes: 10112
/** Bismillahir Rahmanir Raheem **/
/**
********************************************************************
******************* Author:Ashik Iqbal****************************
********************************************************************
**/
/**
Name : Ashik Iqbal.
Email: ashiqueiqbal998@gmail.com.
Computer Science and Engineering.
North South University.
Dhaka, Bangladesh.
**/

#include <bits/stdc++.h>
using namespace std;


/** templates starts here **/
#define ll long long int
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define pb push_back
#define stll stack<ll>
#define qll queue<ll>
#define pqll priority_queue<ll>
#define mpii map<int,int>
#define mpll map<ll,ll>
#define mpss map<string,string>
#define mpsi map<string,int>
#define mpis map<int,string>
#define mpsll map<string,ll>
#define mplls map<ll,string>
#define sit set<int>::iterator
#define slit set<ll>::iterator
#define rev(v) reverse(v.begin(),v.end())
#define srt(v) sort(v.begin(),v.end())
#define grtsrt(v) sort(v.begin(),v.end(),greater<int>())
#define asrt(a) sort(a, a+n)
#define grtasrt(a) sort(a, a+n,greater<int>())
#define FOR(i,j,k) for(int i=j;i<k;i++)
#define REV(i,j,k) for(int i=j;i>k;i--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL)
#define mem(a,x) memset(a,x,sizeof(a))
#define inf 0x3f3f3f3f
#define mx 1000005
const int mod=1e9+7;
const int N = (int) 1e5 + 5;
/** templates ends here **/


int main ()
{

    fast;
    ll n, K;
    cin>>n>>K;
    ll a[n];
    FOR(i, 0, n)cin>>a[i];
    if(n == K)
    {
        cout<<"1"<<endl;
        return 0;

    }
    asrt(a);
    ll mn = a[0];
    ll cnt = 0;
    if(n == K){
            cout<<"1"<<endl;
            return 0;
    }
    FOR(i, 0, n)
    {
        if(a[i] == mn && mn!=a[n-1])
        {
            cnt++;
            ll ff = K-1;
            if((i+ff)<n)
            a[i+ff] = mn;
            //for(ll bb = 0; bb<K; bb++)
            //{
                //v.pb(mn);
           // }
        }
        //i+=(K-2);
    }
   // FOR(i, 0, v.size())cout<<v[i]<<endl;
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define l first
#define r second

using namespace std;

const int maxn = 3e5 + 1;

int a[maxn];

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int a, b, c;
    cin >> a >> b >> c;
    for (int i = 0; i < 100000; i++) {
        if (a % 2 || b % 2 || c % 2) {
            cout << i;
            return 0;
        }
        a += b; c += a - b;
        b += c - a + b;
        swap(a, c); swap(a, b);
        a /= 2; b /= 2; c /= 2;
    }
    cout << -1;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <iostream>
using namespace std;
typedef long long LL;
const int inf = 1 << 30;
const LL INF = 1LL << 60;
const int MaxN = 100000;
const double eps = 1e-6;
const double PI = acos(-1.0);

int N;

int main()
{
	while(scanf("%d", &N) != EOF)
	{
		printf("%d\n", N / 3);
	}
	return 0;
}

Measured memory_bytes: 256