akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(); int max = 1, rem = 0;
		Map<String, Integer> map = new HashMap<String, Integer>();
		for (int i = 0; i < n; i++) {
			String s = sc.next();
			if(map.containsKey(s)) {
				rem = map.get(s)+1;
				map.replace(s, rem);
				max = Math.max(max,rem);
			}else map.put(s, 1);
		}
		List<String> list = new ArrayList<String>();
		for(String key : map.keySet()) if(map.get(key) == max) list.add(key);
		Collections.sort(list);
		StringBuilder sb = new StringBuilder();
		for(String key : list) sb.append(key+"\n");
		System.out.println(new String(sb));
	}
}


Measured memory_bytes: 86744
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef double db;
ll W,H;
ll vx0[6]={1,0,-1,-1,-1,0};
ll vy0[6]={0,1,1,0,-1,-1};
ll vx1[6]={1,1,0,-1,0,1};
ll vy1[6]={0,1,1,0,-1,-1};


ll c[102][102];
ll ans=0;
bool visited[102][102];

void dfs(ll x,ll y){
	visited[y][x]=1;
	ll nx,ny;
	for(ll i=0;i<6;i++){
		if(y%2){
			nx=x+vx1[i];
			ny=y+vy1[i];
		}
		else{
			nx=x+vx0[i];
			ny=y+vy0[i];
		}
		if(0<=nx&&nx<=W+1&&0<=ny&&ny<=H+1){
			if(c[ny][nx]) ans++;
			else if(!visited[ny][nx]) dfs(nx,ny);
		}
	}
	return;
}

int main()
{
	scanf("%lld%lld",&W,&H);
	for(ll i=1;i<=H;i++) for(ll j=1;j<=W;j++) scanf("%lld",&c[i][j]);
	dfs(0,0);
	printf("%lld\n",ans);
}

Measured memory_bytes: 3476
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		System.out.println(Math.min(A*N, B));
	}
}

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: 21716
#include <bits/stdc++.h>

using namespace std;

int main(){
  int X;
  cin >> X;
  if( X < 600 )
    cout << 8 << endl;
  else if (X < 800 )
    cout << 7 << endl;
  else if (X < 1000)
    cout << 6 << endl;
  else if (X < 1200)
    cout << 5 << endl;
  else if ( X < 1400)
    cout << 4 << endl;
  else if ( X < 1600)
    cout << 3 << endl;
  else if (X < 1800)
    cout << 2 << endl;
  else if (X < 2000)
    cout << 1 << endl;
  else
    cout << "error" << endl;
}

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

int main()
{
	string S;
	cin >> S;
	char str[2] = {'S','R'};
	if (S.at(1) == str[0] )
	{
		if (count(S.begin(), S.end(), str[1]) == 0)
		{
			cout << 0 << endl;
		}
		else {
			cout << 1 << endl;
		}

		return 0;
	}

	auto i = count(S.begin(), S.end(), str[1]);

	cout << i << endl;

	return 0;

}

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

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define fst first
#define snd second

int main()
{
    int n, k;
    cin >> n >> k;

    int ans = 0;
    for(int i = 0; i < n; i++)
    {
        int temp;
        cin >> temp;
        if(temp >= k)
            ans++;
    }
    cout << ans;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll unsigned long long int 
int main()
{
    std::ios::sync_with_stdio(false);
    cin.tie(0);
 
        ll n,i,j,k;
        cin>>n;
        ll lmt= (ll)(1e18);
        ll a[n],flg=0;
  		long double ans =1;
        for(i=0;i<n;i++)
        {
            cin>>a[i];
            if(a[i]==0){
              flg=1;
            }
        }
        if(flg==1){ 
          cout<<"0\n";
          return 0;
        }
        else 
        {
            for(i=0;i<n;i++)
            {
                if((a[i]*ans)>lmt)
                {
                    flg=1;
                    cout<<"-1\n";
                    return 0;
                }
                ans*=a[i];
            }
           cout << (ll)ans << endl;
        }
    return 0;
}

Measured memory_bytes: 4404
N = int(input())
a = [int(i) for i in input().split()]

x4count = 0
x2count = 0
for i,x in enumerate(a):
    if x % 4 == 0:
        x4count += 1
    elif x % 2 == 0:
        x2count += 1

# 2の処理
if x2count > 0:
    N = N - x2count + 1

if x4count >= N//2:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 14252
#include<iostream>
#include<cstdio>
#include<math.h>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<map>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;

int prime[105000];
vector<int> primenumber;
int d[105000];
int q, l, r;

int main(){
	
	primenumber.push_back(2);
	prime[1] = 0;
	prime[2] = 1;
	for (int i = 3; i <= 100000; i++) {
		int ope = 0;
		for (int j = 0; j < primenumber.size(); j++) {
			if (i%primenumber[j] == 0) {
				prime[i] = 0;
				ope++;
				break;
			}
		}
		if (ope == 0) {
			prime[i] = 1;
			primenumber.push_back(i);
		}
	}
	/*
	for (int i = 1; i <= 20; i++) {
		cout << i << " " << prime[i] << endl;
	}
	*/
	d[1] = 0;
	for (int i = 3; i <= 105000; i += 2) {
		d[i] += d[i - 2] + max(0,prime[i]+prime[(i+1)/2]-1);
	}
	
	cin >> q;
	for (int i = 0; i < q; i++) {
		cin >> l >> r;
		if (l == 1)cout << d[r] << endl;
		else cout << d[r]-d[l-2] << endl;
	}
	return 0;
}

Measured memory_bytes: 1536
#include <iostream>
using namespace std; 
int main()
{

int n; 
cin >> n ;
int b ; 
bool flag = 0 ; 
int arr[n] ;
for(int i=0;i<n;i++)
	{
		cin>>arr[i];
		if(arr[i]%2==0 && (arr[i]%3!=0 && arr[i]%5!=0))
		{
			flag=1;
		}
	}
	
	cout<<(flag == 1? "DENIED" : "APPROVED")<<endl;

}


Measured memory_bytes: 256
#![allow(unused_imports)]
use proconio::{
   fastout, input,
   marker::{Bytes, Isize1, Usize1},
};

#[fastout]
fn main() {
   input! {
      q: usize,
      lr: [(usize, usize); q]
   }
   let n = 200000;
   let mut prime = vec![true; n + 1];
   prime[0] = false;
   prime[1] = false;
   for i in 2..=n {
      if !prime[i] {
         continue;
      }
      let mut j = 2;
      while i * j <= n {
         prime[i * j] = false;
         j += 1;
      }
   }
   let mut bit = vec![0; n / 2 + 1];
   for i in 2..=n / 2 {
      if prime[i] && prime[(i + 1) / 2] {
         bit.add(i, 1);
      }
   }

   for &(l, r) in lr.iter() {
      println!("{}", bit.range(l, r + 1));
   }
}

use std::ops::{AddAssign, Sub};
trait BIT<T: Copy + Clone + Sub + AddAssign> {
   fn add(&mut self, idx: usize, w: T);
   fn sum(&self, idx: usize) -> T;
   fn range(&self, l: usize, r: usize) -> T;
}
impl<T: Copy + Clone + Sub<Output = T> + AddAssign> BIT<T> for [T] {
   /// let mut bit = vec![0; n+1];
   /// for (i, w) in 0..q {
   ///    bit.add(i, w);
   /// }
   fn add(&mut self, idx: usize, w: T) {
      let mut j = (idx + 1) as i64;
      while j < self.len() as i64 {
         self[j as usize] += w;
         j += j & -j;
      }
   }
   /// [0, r]
   fn sum(&self, idx: usize) -> T {
      let mut i = (idx + 1) as i64;
      let mut sum = self[0];
      while i != 0 {
         sum += self[i as usize];
         i -= i & -i;
      }
      sum
   }
   /// [l, r)
   fn range(&self, l: usize, r: usize) -> T {
      match (l, r) {
         (0, _) => self.sum(r - 1),
         _ => self.sum(r - 1) - self.sum(l - 1),
      }
   }
}


Measured memory_bytes: 5408
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
template<typename T> inline void chkmin(T &a, const T &b) { a = a < b ? a : b; }
template<typename T> inline void chkmax(T &a, const T &b) { a = a > b ? a : b; }

const int MAXN = 500005;
int siz[MAXN], n;
struct Edge { int v, w; };
vector<Edge> gra[MAXN];
LL ans;
P res(MAXN, MAXN);

void dfs1(int u, int fa) {
	siz[u] = 1;
	for (Edge &e : gra[u]) if (e.v != fa) {
		dfs1(e.v, u);
		siz[u] += siz[e.v];
	}
}

void dfs2(int u, int fa, int s) {
	int mn = s;
	for (Edge &e : gra[u]) if (e.v != fa) {
		dfs2(e.v, u, s + siz[u] - siz[e.v]);
		chkmax(mn, siz[e.v]);
	}
	chkmin(res, P(mn, u));
}

void dfs3(int u, int fa, LL d) {
	ans += d << 1, siz[u] = 1;
	for (Edge &e : gra[u]) if (e.v != fa) {
		dfs3(e.v, u, d + e.w);
		siz[u] += siz[e.v];
	}
}

int main() {
	scanf("%d", &n);
	for (int i = 1; i < n; i++) {
		int u, v, w; scanf("%d%d%d", &u, &v, &w);
		gra[u].push_back(Edge { v, w });
		gra[v].push_back(Edge { u, w });
	}
	dfs1(1, 0);
	dfs2(1, 0, 0);
	int rt = res.second;
	dfs3(rt, 0, 0);
	int mn = 1e9;
	for (Edge &e : gra[rt]) {
		if (siz[e.v] * 2 == n) return printf("%lld\n", ans - e.w), 0;
		chkmin(mn, e.w);
	}
	printf("%lld\n", ans - mn);
	return 0;
}

Measured memory_bytes: 22400
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second

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

	int n;
	cin >> n;
	int arr[100000] = {};
	for(int x=1; x<=100; x++){
		for(int y=1; y<=100; y++){
			for(int z=1; z<=100; z++){
				int a = x*(x+y+z) + y*(y+z) + z*z;
				arr[a]++;
			}
		}
	}

	for(int i=1; i<=n; i++){
		cout << arr[i] << "\n";
	}


	
	

	return 0;
}

Measured memory_bytes: 4372
def main():
    A,B,M = map(int,input().split(" "))
    A = list(map(int,input().split(" ")))
    B = list(map(int,input().split(" ")))
    ans = min(A)+min(B)
    for _ in range(M):
        x,y,c = map(int,input().split(" "))
        x -= 1
        y -= 1
        ans = min(ans,A[x]+B[y]-c)
    print(ans)
if __name__ == "__main__":
    main()

Measured memory_bytes: 18736
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
    // ifstream in("data1.txt");
    // cin.rdbuf(in.rdbuf());
    int ans = 0;
    vector<int> v(5);
    rep(i, 5) { cin >> v[i]; }
    int min = 11;
    rep(i, 5) {
        int c = v[i] % 10;
        if(c == 0) {
            ans += v[i];
        } else {
            ans += v[i] + (10 - c);
        }
        if(c != 0 && min > c) {
            min = c;
        }
    }

    if(min == 11) {
        cout << ans << endl;
        return 0;
    }
    cout << ans - (10 - min) << endl;
}


Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);

int main()
{
    ll v[100] = {0};
    v[0] = 2;
    v[1] = 1;

    int n;
    cin >> n;
    for (int i = 2; i <= n; i++) {
        v[i] = v[i - 2] + v[i - 1];
    }

    cout << v[n] << endl;

    return 0;
}

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

#define ll      long long
#define MAX     1000007
#define inf     99999999999999
#define MOD     1000000007
#define pii     pair<int,int>
#define FIN     freopen("input.txt","r",stdin);
#define FOUT    freopen("output.txt","w",stdout);

int main ()
{
    ll a,b;
    string s;
    scanf("%lld %lld",&a,&b);
    cin>>s;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='-' && i!=a)
        {
            printf("No\n");
            return 0;
        }
    }
    if(s.size()!=(a+b+1) || s[a]!='-')
    {
        printf("No\n");
        return 0;
    }
    printf("Yes\n");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define endl '\n'
#define pb push_back
#define fi first
#define se second
#define PI acos(-1)
#define all(c) (c).begin(),(c).end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

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

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

int modpow(int x, int n, int m) {
	x %= m;
	int res = 1;
	while(n > 0) {
		if(n & 1)
			res = res * x % m;
		x = x * x % m;
		n >>= 1;
	}
	return res;
}

const ll inf = 2e18;
const int mod = 1e9 + 7;
const int N = 1e5 + 10;

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	srand(chrono::steady_clock::now().time_since_epoch().count());
	#ifndef ONLINE_JUDGE
		// freopen("input.txt", "r", stdin);
		// freopen("output.txt", "w", stdout);
	#endif

	int n;
	cin >> n;
	map<int, int> m;
	for(int i = 0; i < n; i++) {
		int x;
		cin >> x;
		m[x]++;
	}
	for(auto it : m) {
		if(it.se >= 2) {
			cout << "NO";
			return 0;
		}
	}
	cout << "YES";

	return 0;
}

Measured memory_bytes: 12800
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
count=0
for i in range(n):
    p=c
    a=list(map(int,input().split()))
    for j in range(m):
        p+=a[j]*b[j]
    if p>0:
        count+=1
print(count)


Measured memory_bytes: 3060
M = 10**9+7
N = int(input())
A = list(map(int,input().split()))

ans = 0
for k in range(61):
    N1 = 0
    N1 = sum([1 for a in A if ( (a >> k) & 1)])
    ans += (((1<<k)) *(N-N1) *N1)
    ans %= M    

print(ans)

Measured memory_bytes: 42156
#include <cstdio>
int main() {
    int t, n, s, e, sum;
    for (; ;) {
        scanf("%d", &t);
        if (t == 0) break;
        sum = 0;
        scanf("%d", &n);
        for (int i = 0; i < n; i++) {
            scanf("%d %d", &s, &e);
            sum+= e-s;
        }
        (sum >= t) ? printf("OK\n") : printf("%d\n", t-sum);
    }
    return 0;
}



Measured memory_bytes: 2688
#include<bits/stdc++.h>
#define ll long long int
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
int main()
{
    FAST();
    ll n,i,j,k=1,a,b,x;
    cin>>n;
    cout<<(n*(n-1))/2<<endl;

    return 0;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 9)

S = input()
K = int(input())

chars = sorted(set(S))
checked = set()


def dfs(s):
    for c in chars:
        if len(checked) >= K:
            return
        next_s = s + c
        if next_s not in checked and next_s in S:
            checked.add(next_s)
            if len(checked) == K:
                print(next_s)
                return
            elif len(next_s) <= len(S):
                dfs(next_s)


dfs('')


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

//関数
//main関数
int main() {
    
    
    
    //入力
    long N,A,B,C,D,E;
    cin>>N>>A>>B>>C>>D>>E;
    
    
    //計算
    long Min=min(A,min(B,min(C,min(D,E))));
    long length=N/Min;
    if(N%Min!=0) {
        length++;
    }
    //cout<<length<<endl;
    
    //出力
    cout<<length+4<<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG_ 
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

int main(void) {
    ll n;
    cin >> n;
    vector<ll> d(n);
    REP(i, n) cin >> d[i];

    ll ret = 0;
    REP(i, n) FOR(j, i+1, n) {
        ret += d[i] * d[j];
    }
    cout << ret << endl;

    return 0;
}

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

int main(){
    int N,K; cin >> N >> K;
    string S; cin >> S;
    vector<int> num;
    if(S[0]=='0') num.push_back(0);
    for(int i=0;i<N;){
        int j=i;
        while(true){
            if(j<S.size()&&S[i]==S[j]) j++;
            else break;
        }
        num.push_back(j-i);
        i=j;
    }
    if(S.back()=='0') S.push_back(0);

    vector<int> sum(num.size()+1,0);
    for(int i=0;i<num.size();i++) sum[i+1]=sum[i]+num[i];

    int ans=0;
    for(int left=0;left<sum.size();left+=2){
        int right=left+2*K+1;
        if(right>=sum.size()) right=sum.size()-1;
        ans=max(ans,sum[right]-sum[left]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1272
#![allow(non_snake_case)]
#[allow(unused_imports)]
use std::io::{self, Write};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
     };
    ($next:expr, isize1) => {
        read_value!($next, isize) - 1
     };
     ($next:expr, $t:ty) => {
         $next().parse::<$t>().expect("Parse error")
    };
}
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}
#[allow(dead_code)]
const MOD: u64 = 1000000007;
#[allow(dead_code)]
fn to_num(c: char) -> i64 {
    c as i64 - 48
}


fn main() {
    input!{
        c: String,
    }
    let ans = match c.chars().collect::<Vec<char>>()[0]  {
        'a' | 'i' | 'u' | 'e' | 'o' => "vowel",
        _ => "consonant",
    };
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  int sl = s.length();
  int len = sl + t.length();
  for (int be = sl - 1; be >= 0; --be) {
    bool concatable = 1;
    REP(i, 0, sl - be) {
      if (s[be + i] != t[i]) concatable = 0;
    }
    if (concatable) len =sl+t.length() -(sl - be);
  }
  len=max(n,len);
  cout<<len<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int a, b, i, num, len;
    scanf("%d %d", &a, &b);
    num = b - a;
    len = 0;

    for(i=0; i<num; i++){
        len = len + i;
    }
    
    len = len - a;

    printf("%d\n",len);

    return 0;
}

Measured memory_bytes: 128
s=input()
n=[0,0,0]
for i in range(len(s)):
    if s[i] == "a":
        n[0]+=1
    elif s[i] == "b":
        n[1]+=1
    else:
        n[2]+=1
if abs(n[0]-n[1]) <= 1 and abs(n[1]-n[2]) <= 1 and abs(n[0]-n[2]) <= 1:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;

int main(){
  ll N;
  string S;
  cin >> N;
  vector<string> w;
  for (ll i=0; i<N; i++){
    cin >> S;
    sort(S.begin(), S.end());
    w.emplace_back(S);
  }
  sort(w.begin(), w.end());
  ll ans = 0;
  for (int i=0; i<N; i++){
    auto lb = lower_bound(w.begin(), w.end(), w[i]);
    auto ub = upper_bound(w.begin(), w.end(), w[i]);
    ans += max((ll)(ub - lb - 1), (ll)0);
  }
  cout << ans / 2 << endl;
  return 0;
}

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

int main() {

  int A,B,C,D;
  cin >> A >> B >> C >> D;
  
  if(A>B){
    A = B;
  }
  if(C>D){
    C = D;
  }
    

    cout << A+C << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <stdio.h>
#include <iomanip>

using namespace std;

//typedefリスト
typedef vector<long long int> vint;
typedef vector<string> vstr;
typedef long long int llint;

int main(void) {
	int A, B;
	cin >> A >> B;
	cout << max(max(A + B, A - B), A*B) << endl;
}


Measured memory_bytes: 256
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        n:usize,
        k:usize,
    }

    let mut itazura = [0; 101];

    for _i in 0..k {
        input! {
            di: usize,
            a: [usize; di],
        }

        for j in a {
            itazura[j-1] = 1;
        }
    }

    let mut tot = 0;
    for i in 0..n {
        if itazura[i]==0 { tot += 1; }
    }

    println!("{}", tot);
}


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

using ll = long long;

int main()
{
    int N;
    cin >> N;
    map<string, int> ma;
    // vector<pair<string, int>>
    string buf;
    for(int i = 0; i<N; i++){
        cin >> buf;
        if(ma.find(buf) == ma.end()){
            ma[buf] =1;
        }else{
            ma[buf] += 1;
        }
    }
    vector<pair<int, string>> ch(N);
    int j = 0;
    for(auto i = ma.begin(); i != ma.end(); ++i){
        ch.at(j) = make_pair(i->second, i->first);
        j++;
    }

    vector<string> result;
    sort(ch.rbegin(), ch.rend());
    int max = ch.at(0).first;
    for(auto aa : ch){
        if(aa.first == max){
            // cout << aa.second << endl;
            result.push_back(aa.second);
        }else{
            break;
        }
    }

    sort(result.begin(), result.end());
    for(auto aa : result){
        cout << aa << endl;
    }





}

Measured memory_bytes: 30068
s = input()
n = len(s)
alp = [chr(ord('a')+i)for i in range(26)]
a = s[0] == 'A'
b = s.count('C') == 1 and s.index('C') >=2 and s.index('C')<= n-2
c = True
for i in range(n):
    if i == 0:continue
    if s[i] == 'C':continue
    if s[i] not in alp:
        c = False
ok = a and b and c
if ok:print('AC')
else:print('WA')

Measured memory_bytes: 3064
#include <iostream>

#define NMAX 100

int selectionSort(int A[], int N) {
    int minj;
    int temp;
    int j;
    int cnt = 0;
    bool flag;
    
    for (int i=0; i<N; i++) {
        minj = i;
        flag = 0;
        for (j=i; j<N; j++) {
            if (A[j] < A[minj]) {
                minj = j;
                flag = 1;
            }
        }
        temp = A[minj];
        A[minj] = A[i];
        A[i] = temp;
        if (flag==1)
            cnt++;
    }
    return cnt;
}

int main() {
    int N;
    int A[NMAX];

    std::cin >> N;
    for (int i=0; i<N; i++)
        std::cin >> A[i];
    
    int cnt = selectionSort(A, N);
    
    for (int i=0; i<N; i++) {
        if (i!=0)
            std::cout << " ";
        std::cout << A[i];
    }
    std::cout << std::endl;
    std::cout << cnt << std::endl;
}


Measured memory_bytes: 3096
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		int c = Integer.parseInt(sa[1]);
		int[][] d = new int[c][c];
		for (int i = 0; i < c; i++) {
			sa = br.readLine().split(" ");
			for (int j = 0; j < c; j++) {
				d[i][j] = Integer.parseInt(sa[j]);
			}
		}
		int[][] cnt = new int[3][c];
		for (int i = 0; i < n; i++) {
			sa = br.readLine().split(" ");
			for (int j = 0; j < n; j++) {
				int x = (i + j) % 3;
				cnt[x][Integer.parseInt(sa[j]) - 1]++;
			}
		}
		br.close();

		int ans = Integer.MAX_VALUE;
		for (int i = 0; i < c; i++) {
			for (int j = 0; j < c; j++) {
				if (i == j) continue;
				for (int k = 0; k < c; k++) {
					if (i == k || j == k) continue;
					int sum = 0;
					for (int x = 0; x < c; x++) {
						sum += cnt[0][x] * d[x][i];
						sum += cnt[1][x] * d[x][j];
						sum += cnt[2][x] * d[x][k];
					}
					ans = Math.min(ans, sum);
				}
			}
		}
		System.out.println(ans);
	}
}


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

void solve(long long N, vector<long long> a){
	long long odd = 0;
  long long even = 0;
  long long f = 0;
  for ( long long i = 0; i < N; i++ ) {
    if ( a[i] % 2 == 1 ) odd ++;
    else if ( a[i] % 2 == 0 && a[i] % 4 != 0 ) even ++;
    else if ( a[i] % 4 == 0 ) f ++;
  }

  N -= even / 2;
  if (even % 2 == 1) { odd ++; }
  if (f >= odd || (N % 2 == 1 && f + 1 >= odd)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

int main(){	
	long long N;
	scanf("%lld",&N);
	vector<long long> a(N-1+1);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&a[i]);
	}
	solve(N, a);
	return 0;
}



Measured memory_bytes: 1792
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<math.h>
int main() {
	int d, a;
	double x = 0.0, y = 0.0, r=0.0;
	while (~fscanf(stdin, "%d,%d", &d, &a), (d || a))
		x += sin(r)*d,
		y += cos(r)*d,
		r += a/180.0*(4*atan(1));
	fprintf(stdout, "%d\n%d\n", (int)x, (int)y);
	return 0;
}

Measured memory_bytes: 608
use proconio::input;
use std::cmp;

fn main() {
    input! {
        x: i128,
        n: i128,
        mut p: [i128; n]
    };
    if n == 0 {
        println!("{}", x);
        return;
    }
    let mut y = x;
    loop {
        if p.iter().find(|&&x| y == x) == None {
            break;
        }
        y = y + 1;
    }

    let mut z = x - 1;

    loop {
        if p.iter().find(|&&x| z == x) == None {
            break;
        }
        z = z - 1;
    }

    let ans = if (x - y).abs() < (x - z).abs() {
        if y == z {
            cmp::min(y, z)
        } else {
            y
        }
    } else {
        if y == z {
            cmp::min(y, z)
        } else {
            z
        }
    };
    println!("{}", ans);
}


Measured memory_bytes: 2168
/*==============================================*\
ID:          shahidul_brur
 
Name:     Md. Shahidul Islam
Study:      CSE, BRUR
Address:  Rangpur, Bangladesh
 
 mail: shahidul.cse.brur@gmail.com
 FB  : fb.com/shahidul.brur
 Blog: shahidul-brur.blogspot.com(in Bengali),
       shahidul-brur-en.blogspot.com(in English)
\*===============================================*/
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define all(a)  a.begin(), a.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))
 
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};

const double pi = acos(-1.0);
const double eps = 1e-6;
const int mod = (int)1e9+7;
const int maxn = (int)2e5+5;
const int logn = 20;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    string s; cin>>s;
    if(s=="Sunny") cout << "Cloudy";
    else if(s=="Cloudy") cout << "Rainy";
    else cout << "Sunny";
    return 0;
}



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

int main() {
  string N;
  char n;
  cin >> N;
  n = N[N.size()-1];
  
  if ( n == '2' || n == '4' || n == '5' || n == '7' || n == '9' ) {
    cout << "hon" << endl;
  } else if ( n == '0' || n == '1' || n == '6' || n == '8' ) {
    cout << "pon" << endl;
  } else {
    cout << "bon" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3132
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 1
#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR
#endif


//改造
typedef long long int ll;
using namespace std;




//ここから編集する


int main() {
    ll numbers[100001];
    ll N,K;
    cin >> N >> K;
    REP(i,0,100001){
        numbers[i] = 0;
    }
    REP(i,0,N){
        ll a,b;
        cin >> a >> b;
        numbers[a] += b;
    }
    ll lower = 0;
    REP(i,0,100001){
        lower += numbers[i];
        if(lower >= K){
            cout << i << endl;
            break;
        }
    }
}


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

const int MX = 100001;

struct Uf {
  vector<int> p;
  Uf(int mx) {
    p = vector<int>(mx);
    for(int i=0;i<mx;i++) {
      p[i] = i;
    }
  };

  int find(int i) {
    if(p[i] == i) {
      return i;
    }
    return p[i] = find(p[i]);
  }

  bool is_same_group(int i, int j) {
    return find(i) == find(j);
  }

  void unite(int i, int j) {
    int root_i = find(i);
    int root_j = find(j);
    p[root_i] = root_j;
  }
};

int solve(int n, int m, vector<int> p, vector<int> x, vector<int> y) {
  map<int, int> mp;

  for(int i= 0;i<n;i++) {
    mp[p[i]-1] = i;
  }

  Uf uf = Uf(MX);
  for(int i=0;i<m;i++) {
    //cout << "uniting " << mp[x[i]-1] << " " << mp[y[i]-1] << endl;
    uf.unite(mp[x[i]-1], mp[y[i]-1]);
  }
  /*
  for(int i = 0;i<n;i++) {
    cout << i << " -> " << uf.find(i) << endl;
  }
  */
  int res = 0;
  for(int i=0;i<n;i++) {
    if(uf.is_same_group(p[i]-1, i))
      res++;
  }
  return res;
}

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> p(n), x(m), y(m);
  for(int i=0;i<n;i++) {
    cin >> p[i];
  }
  for(int i=0;i<m;i++) {
    cin >> x[i] >> y[i];
  }
  cout << solve(n, m, p, x, y);
}

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

int main() {
    int n;
    cin >> n;
    vector<int> p(n);
    for(int i = 0; i < n; i++){
        cin >> p[i];
    }
    for(int i = p.size()-1; i > -1; i--){
        cout << p[i];
        if(i != 0){
            cout << " ";
        }
    }
    cout << endl;
}


Measured memory_bytes: 3116
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
int main(void){
  int A, B, K;
  cin >> A >> B >> K;
  int N = max(A,B);
  int ans[N];
  int count = 0;
  map<int, int> D;
  for (int i=1;i<=N;i++){
    if((A%i)==0 && (B%i)==0){
      count++;
      D[count] = i;
    }
  }
  cout << D[count-K+1] << endl;
  return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    int N;
    int a[100010];
    cin>>N;
    REP(i,N) {
        cin>>a[i];
        a[i]--;
    }
    int cnt=0;
    REP(i,N){
    if(a[a[i]]==i) cnt++;
    }
    cout<<cnt/2<<endl;

    return 0;
}

Measured memory_bytes: 640
#include<functional>
#include<algorithm>
#include<iostream>
#include<string>

template<class T>
class Vector{
protected:
	int sz,cap;
	T *p;
public:
	Vector():sz(0),cap(0),p(0){}
	~Vector(){
		clear();
	}
	void swap(Vector &v){
		std::swap(sz,v.sz);
		std::swap(cap,v.cap);
		std::swap(p,v.p);
	}
	int size()const{return sz;}
	bool empty()const{return !sz;}
	void push_back(T v){
		if(sz==cap)reserve(sz?sz*2:1);
		new(p+sz++) T(v);
	}
	void pop_back(){
		p[--sz].~T();
		if(sz&&sz*4<cap){
			reserve(cap/2);
		}
	}
	void resize(int n){
		clear();
		if(n==0)return;
		cap=1;
		while(cap<n)cap*=2;
		reserve(cap);
		for(int i=0;i<n;i++)new(p+i) T();
		sz=n;
	}
	void reserve(int n){
		T *p=(T*)operator new(n*sizeof(T));
		for(int i=0;i<sz;i++){
			new(p+i) T(this->p[i]);
			this->p[i].~T();
		}
		if(this->p)operator delete(this->p);
		this->p=p;
		cap=n;
	}
	void clear(){
		for(int i=0;i<sz;i++){
			p[i].~T();
		}
		if(p)operator delete(p);
		sz=cap=0;
		p=0;
	}
	T& operator[](int i)const{
		return p[i];
	}
	T& front()const{
		return p[0];
	}
	T& back()const{
		return p[sz-1];
	}
};


template<class T,class C=std::less<T> >
class BinaryHeap :private Vector<T>{
	C cmp;
public:
	void push(T v){
		Vector<T>::push_back(v);
		int i=Vector<T>::size();
		T * const q=Vector<T>::p-1;
		while(1<i && cmp(q[i],q[i/2])){
			std::swap(q[i/2],q[i]);
			i/=2;
		}
	}
	T top()const{
		return Vector<T>::p[0];
	}
	void pop(){
		std::swap(Vector<T>::front(),Vector<T>::back());
		Vector<T>::pop_back();
		int i=1;
		T * const q=Vector<T>::p-1;
		while(i*2<=Vector<T>::size()){
			int j=2*i;
			if(j+1<=Vector<T>::size() && cmp(q[j+1],q[j]))j++;
			if(cmp(q[j],q[i])){
				std::swap(q[i],q[j]);
				i=j;
			}else break;
		}
	}
	bool empty()const{return Vector<T>::empty();}
};


using namespace std;

int main(){
	BinaryHeap<int,greater<int> > heap;
	string s;
	while(1){
		cin>>s;
		if(s=="end")break;
		if(s=="insert"){
			int n;
			cin>>n;
			heap.push(n);
		}else if(s=="extract"){
			cout<<heap.top()<<endl;
			heap.pop();
		}
	}
	return 0;
}

Measured memory_bytes: 5964
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N; cin >> N;
    vector<int64_t> L(N+1);
    L[0] = 2;
    L[1] = 1;
    for (int i=2;i<=N;i++) L[i] = L[i-1] + L[i-2];
    cout << L[N] << endl; 
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stack>
using namespace std;
int main(){
    stack<int> st;
    int n; cin >> n;
    if(n == 0){
        cout << 0 << endl;
        return 0;
    }
    while(n){
        int rem = n&1;
        st.push(rem);
        n -= rem;
        n /= -2;
    }
    while(!st.empty()){
        cout << st.top();
        st.pop();
    }
    cout << endl;
    return 0;
}
//Saw the solution video

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

//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//s.find(w[i])==string::npos
//findの使い方

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>(b);i--)

long long int n,cnt=0,ans=0,a,b,c,cmp[100000],data[100000],m,h,x,y;

string s,w;

int main(void){
      cin >> s;
      rep(i,s.size()){
          if(i==3){
              cout  << "8"; 
          }
          else if(i!=3){
              cout << s[i];
          }
      }
      cout << endl;
return 0;
}


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

int main(){
    int N, Q;  cin >> N >> Q;
    vector<ll> A(N), X(Q);
    for(int i=0; i<N; i++) cin >> A[i];
    for(int i=0; i<Q; i++) cin >> X[i];
    vector<ll> S(N), evenS(N);
    S[0] = A[0];  evenS[0] = A[0];
    for(int i=1; i<N; i++){
        S[i] = S[i-1] + A[i];
        evenS[i] = evenS[i-1];
        if(i%2==0) evenS[i]+=A[i];
    }

    int P = N/2+1;
    vector<ll> B(P+1);
    B[1] = 1e18;
    if(N%2==1) B[P] = A[N-P] + A[N-2*P+1];
    else B[P] = 0;
    for(int p=2; p<P; p++){
        B[p] = A[N-p] + A[N-2*p+1];
    }

    for(int i=0; i<Q; i++){
        ll x = X[i];
        if(2*x <= B[P]){
            cout << S[N-1] - S[P-2] << endl;
        }else{
            int l = 1, r = P-1;
            int p = l + (r-l)/2;
            while(!(B[p+1] < 2*x && 2*x <= B[p])){
                if(B[p+1] >= 2*x) l = p + 1;
                else r = p;
                p = l + (r-l)/2;
            }

            if(N%2==0){
                cout << S[N-1] - S[N-p-1] + S[N-2*p-1] - evenS[N-2*p-1] << endl;
            }else{
                cout << S[N-1] - S[N-p-1] + evenS[N-2*p-1] << endl;
            }
        }
    }
}


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

long long p = 1000000007;

int main(){
    long long N, K;
    cin >> N >> K;
    long long ans = 0;
    for(long long l = K; l <= N + 1; l++){
        ans += l*(N + 1 - l) + 1;
        ans %= p;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
N,M=map(int,input().split())
BA=[]
for i in range(M):
  a,b=map(int,input().split())
  BA.append([b,a])
  
BA.sort()
ans=0
prev=-1
for i in range(M):
  if prev<=BA[i][1]:
    prev=BA[i][0]
    ans+=1
print(ans)

Measured memory_bytes: 59992
import java.util.*;
public class Main {

	public static void main(String[] args) {
		int two=200;
		int three=300;
		int five=500;
		Scanner std=new Scanner(System.in);
		int weight=std.nextInt();
		while (weight!=0){
			int min=1000000;
			for (int i=0;i<=weight/two;i++){
				for (int j=0;j<=weight/three;j++){
					for (int k=0;k<=weight/five;k++){
						if (i*two+j*three+k*five==weight){
							int temp=0;
							temp+=380*(i/5)*5*0.8+380*(i%5);
							temp+=550*(j/4)*4*0.85+550*(j%4);
							temp+=850*(k/3)*3*0.88+850*(k%3);
							if (temp<min)
								min=temp;
						}
					}
				}
			}	
			System.out.println(min);
			weight=std.nextInt();
		}
	}
}

Measured memory_bytes: 19168
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <algorithm>

using namespace std;


bool solve(){
	int h,w;
	cin>> h>> w;
	vector<string> str(h);
	for(int i=0;i<h;i++){
		cin>> str[i];
	//	cout<<str[i]<<endl;
	}
	vector<vector<int> > semi(h, vector<int>(w,0));
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			char c = str[i][j];
			semi[i][j] = c - '0';
	//		cout<< semi[i][j];
		}
	//	cout<<endl;
	}
	
	
	vector<vector<int> > ans(h+1, vector<int>(w+1,1<<10));		//+1テ」ツつ?ッツシツ?
	//ans[0][0] = 0;
	ans[0][1] = 0;												//テ」ツ?禿」ツ?」テ」ツ?。テ」ツつ?ッツシツ?
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			ans[i+1][j+1] = min(ans[i][j+1], ans[i+1][j]) + semi[i][j];
	//		printf("%2.0d ",ans[i+1][j+1]);
		}
	//	cout<<endl;
	}
	cout<< ans[h][w]<< endl;
	
	
	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	solve();

	return 0;
}

 

Measured memory_bytes: 1264
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;

int main(){
    int h,w;
    cin>>h>>w;
    char inp[h][w];
    int dp[h][w];

    for(int i=0;i<h;i++)
        for(int j=0;j<w;j++)
            cin>>inp[i][j],dp[i][j]=0;

    for(int i=0;i<h;i++){
        if(inp[i][0]=='.')
            dp[i][0]=1;
        else
            break;
    }

    for(int j=0;j<w;j++){
        if(inp[0][j]=='.')
            dp[0][j]=1;
        else
            break;
    }

    for(int i=1;i<h;i++){
        for(int j=1;j<w;j++){
            if(inp[i][j]=='.')
                dp[i][j] = (dp[i-1][j] + dp[i][j-1])%mod;
        }
    }

    cout<<dp[h-1][w-1];
}


Measured memory_bytes: 5120
#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().split_whitespace().map(|s| s.to_string()).collect::<Vec<String>>()
        }
    };
    (;;$n:expr) => {
        {
            (0..$n).map(|_| scan!()).collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

const MOD: i64 = 1_000_000_007;

fn main() {
    let (_, _) = scan!(usize, usize);
    let xs = scan!(i64;;);
    let ys = scan!(i64;;);

    let mut sum_x = 0;
    for (i, &x) in xs.iter().enumerate() {
        sum_x += x * i as i64 - (xs.len() - 1 - i) as i64 * x;
        sum_x %= MOD;
    }

    let mut sum_y = 0;
    for (i, &y) in ys.iter().enumerate() {
        sum_y += y * i as i64 - (ys.len() - 1 - i) as i64 * y;
        sum_y %= MOD;
    }

    println!("{}", sum_x * sum_y % MOD);
}


Measured memory_bytes: 10492