akhauriyash/Code-Regression huggingface dataset:
// 　　＿＿
// 　／　<＠ﾌ
//  ｜(ﾉﾉハ))
//  ﾉ从ﾟヮﾟ从
// 　ﾉ｜ｿﾉГ|つ author:hotarunx
// 〈_ﾉ^^^ヽ|
// 　~~tｧtｧ~
#include <algorithm>
#include <array>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long

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

    int a, b, c, k;
    cin >> a >> b >> c >> k;

    // b>a && c>b

    for (int i = 0; i <= k; i++) {
        if (!(b > a)) {
            b *= 2;
        } else if (!(c > b)) {
            c *= 2;
        } else {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

#define forn(i,n) for (int i = 0; i < int(n); ++i)
#define forsn(i,x,y) for(long long i = (x) ; i <= (y) ; ++i)
typedef long long ll;
typedef long double ld;

bool checkStr(string s, int p, string t) {
  if(s.size() - p < t.size()) return false;
  bool res = true;
  forn(i,t.size()) {
    if(s[p+i] != t[i]) {
      res = false;
      break;
    }
  }
  return res;
}

int main() {
  string s;
  cin >> s;
  bool res = false;
  for(int i = 0; i < s.size();) {
    int k = i;
    if(checkStr(s,i,"dream")) {
      if(checkStr(s,i+5,"er")) {
        if(checkStr(s,i+7,"a")) { // dream -> era
          i += 5;
        }
        else { // dreamer -> d/e?
          i += 7;
        }
      }
      else { // dream -> d?
        i += 5;
      }
    }
    else if(checkStr(s,i,"erase")) {
      if(checkStr(s,i+5,"r")) { //eraser
          i += 6;
      }
      else { // dream -> d/e?
        i += 5;
      }
    }
    //cout << i << endl;
    if(k==i) break; // false
    if(i==s.size()) {
      res = true;
      break;
    }
  }
  if(res) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
  return 0;
}


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

int main()
{
    int k, n, p;
    vector<int> price;

    scanf("%d%d", &n, &k);
    for(int i = 0; i < n; i++){
        scanf("%d", &p);
        price.push_back(p);
    }

    p = 0;
    sort(price.begin(), price.end());
    for(int i = 0; i < k; i++){
        p += price[i];
    }

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

    return 0;
}



Measured memory_bytes: 3760
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1000000000;
const double PI = acos(-1);
int num_edge = 0, head[100000];
struct Edge { int nxt, to; }edge[100000];
LL n, m, sum = 0, f[100000] = {}, W[1000][1000] = {}, now = 0;
string str;
void add_edge(int from, int to) {
	edge[++num_edge].nxt = from;
	edge[num_edge].to = to;
	head[from] = num_edge;
}

char p[1000][1000];
int main() {
	cin >> n;
	sum = 1;
	for (int i = 0; i < n; i++) {
		cin >> f[i];
		sum *= (f[i] % 2 == 0 ? 2 : 1);
	}
	cout << pow(3, n) - sum << std::endl;
	return 0;
}

Measured memory_bytes: 2688
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#include <map>
#include <set>
#include <tuple>
#include <unordered_map>
#include <iterator>
#include <string>
#include <limits>

using namespace std;

using i64 = int64_t;
using P = pair<i64, i64>;
i64 mod = 1000000007;
int int_max = 2147483647;
int max_n = 1e5;


int main(int argc, char **argv) {
    i64 k, a ,b;
    cin >> k >> a >>b;

    int k2 = ((a-1) / k)*k + k;

    if (k2 <= b)
        cout << "OK" << endl;
    else
        cout << "NG" << endl;

    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(){
    string str;
    cin >> str;
    if(str.length()<6){
        cout << "INVALID" << endl;
        return 0;
    }
    vector<bool> flag(3,false);
    for(int i=0;i<str.length();i++){
        if(str[i]>='0' && str[i]<='9'){
            flag[0]=true;
        }
        else if(str[i]>='A' && str[i]<='Z'){
            flag[1]=true;
        }
        else if(str[i]>='a' && str[i]<='z'){
            flag[2]=true;
        }
    }
    if(flag[0] && flag[1] && flag[2]){
        cout << "VALID" << endl;
    }
    else{
        cout << "INVALID" << endl;
    }
    return 0;
}

Measured memory_bytes: 3204
#include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
using namespace std;
int main() {
  char s[3]; cin >> s[0] >> s[1] >> s[2];
  sort(s,s+3);
  string ans="No"; 
  if(s[0]=='a' and s[1]=='b' and s[2]=='c') ans="Yes";
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
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();
				    int c = sc.nextInt();
				    try{
			              if(a < b){
	                         if(b < c) {
	                        	  System.out.println(a+" "+  b+" "+  c);
	                        	  } else {
	                                 if(a < c) {
	                                	 System.out.println(a+" "+  c+" "+  b);
	                                 } else {
	                                	 System.out.println(c+" "+  a+" "+  b);
	                                 }
	                             } 
			              }	                     
			              else {
	                    	  if(a < c) {
	                    		  System.out.println(b+" "+  a+" "+  c);
	                    		  } else {
	                    			  if(b < c) {
	                    				   System.out.println(b+" "+  c+" "+  a);
	                    				   } else {
	                    					   System.out.println(c+" "+  b+" "+  a);
	                    				   }
	                    		  }
	                               
	                             }
				    }catch(Exception e){
				     }
				  }
				}



Measured memory_bytes: 26208
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,a,n) for(int i=a; i<(n); i++)

using namespace std;

int main(){
	int n;
	while(cin >> n, n){
		string str[n];
		int cnt[n];
		rep(i,n) cnt[i] = 0;
 		rep(i,n) cin >> str[i];
		rep(i,n){
			rep(j,str[i].size()){
				if(str[i][j] != '.'){
					if(j-1 >= 0){
					 	str[i][j-1] = '+';
					}
					break;
				}
			}
		}

		for(int i = n-1;i>=0;i--){
			rep(j,str[i].size()){
				if(str[i][j] =='+'){
					for(int k = i-1;k>=0;k--){
						if(str[k][j] == '.') str[k][j] = '|';
						else break;
					}
				}
			}
		}
		rep(i,n){
			rep(j,str[i].size()){
				if(str[i][j] == '.') str[i][j] = ' ';
			}
		}
		rep(i,n)	cout << str[i] << endl;
		
	}
	return 0;
}

Measured memory_bytes: 3776
N, K = (int(i) for i in input().split())
H = [int(i) for i in input().split()]
#Hを昇順にしてN-Kまでの配列を足し合わせて出力する
if N-K > 0:
    num = sum(sorted(H)[0:N-K])
else:
    num = 0
print(num)

Measured memory_bytes: 25768
use std::collections::VecDeque;

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

    let k: usize = sc.read();
    let q: usize = sc.read();
    let d: Vec<usize> = sc.vec(k);
    for _ in 0..q {
        let n: usize = sc.read();
        let x: usize = sc.read();
        let m: usize = sc.read();

        let d: Vec<usize> = d.iter().map(|&d| d % m).collect();
        let mut sum = vec![0; k + 1];
        let mut zero = vec![0; k + 1];
        for i in 0..k {
            sum[i + 1] = sum[i] + d[i];
            zero[i + 1] = zero[i] + if d[i] == 0 { 1 } else { 0 };
        }
        let x = x % m;
        let last = (n - 1) / k * sum[k] + sum[(n - 1) % k] + x;
        let zero = (n - 1) / k * zero[k] + zero[(n - 1) % k];
        println!("{}", (n - 1) - (last / m - x / m) - zero);
    }
}

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

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


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

#define int long long
#define ALL(x) x.begin(),x.end()
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb(x) push_back(x)
#define eb emplace_back
#define SORT(ls) sort(ls.begin(), ls.end())
#define DESC(ls) sort(ls.rbegin(), ls.rend()) 
#define mp(x, y) make_pair(x, y)
#define INF 1000000000
#define MOD 1000000007
#define F(i, a, n) for(i=a;i<n;i++)
#define SI(x) cin>>x
#define DI(x, y) cin>>x>>y
#define TI(x, y, z) cin>>x>>y>>z
#define FI(w, x, y, z) cin>>w>>x>>y>>z
#define SO(x) cout<<x<<"\n"
#define DO(x, y) cout<<x<<" "<<y<<"\n"
#define TO(x, y, z) cout<<x<<" "<<y<<" "<<z<< "\n"
#define FO(w, x, y, z) cout<<w<<" "<<x<<" "<<y<<" "<<z<<"\n"
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

bool dp[1000000];
bool vis[1000000];

bool solve(string &s, int idx, int n)
{
    if(idx == n)
        return true;
    if(idx + 4 > n)
        return false;
    if(vis[idx])
        return dp[idx];
    vis[idx] = true;
    bool &res = dp[idx];
    string p = s.substr(idx, 5);
    if(p == "erase")
        res |= solve(s, idx + 5, n);
    else if(p == "dream")
        res |= solve(s, idx + 5, n);
    string r = s.substr(idx, 6);
    if(r == "eraser")
        res |= solve(s, idx + 6, n);
    string t = s.substr(idx, 7);
    if(t == "dreamer")
        res |= solve(s, idx + 7, n);
    return res;
}

int32_t main(void)
{
    FASTER;
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int i, j;
    string s;
    SI(s);
    int n = s.length();
    if(solve(s, 0, n))
        SO("YES");
    else
        SO("NO");
    
    #ifdef LOCAL
    	cout<<endl<<endl<<"Time: "<<(float)clock()/CLOCKS_PER_SEC<<" seconds"<<endl;
    #endif
    return 0;
}


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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main(){
	int N;
	cin >> N;
	vector<string> vec(N);
	rep(i, N) cin >> vec.at(i);
	sort(vec.begin(), vec.end());
	int count = 1;
	rep(i, N) {
		if (i == 0) continue;
		if (vec.at(i) != vec.at(i - 1)) count++;
	}
	cout << count << endl;
}

Measured memory_bytes: 9652
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define Int int32_t
#define all(c) c.begin(), c.end()
#define FAST ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define pii pair<int,int>
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define bitcnt(n) __builtin_popcountll(n)
#define setpre(n) cout << fixed << setprecision(n)
#define tr(c) for(const auto& x : c )cout << x << " "; cout << "\n";
#define ol(c, s, e) for(int pos=s; pos<e; pos++)cout << c[pos] << " ";cout <<"\n";
#define PI acos(-1LL)

const int M = 1000000007;
const int N = 2e5 + 5;
const long long INF = 1e9 + 12;

vector<vector<int>> v;
int n, weight;
int dp[105][N];
int fun(int i = n, int w = weight){
    if(w < 0)
        return -INF;
    if(i <= 0)
        return 0;
    if(dp[i][w]!=-1)
        return dp[i][w];
    int ans = max(fun(i-1,w - v[i][0]) + v[i][1], fun(i-1,w));
    return dp[i][w] = ans;
}
void solve() {
    cin >> n >> weight;
    v.resize(n+1, vector<int>(2));
    memset(dp, 0, sizeof dp);
    for(int i=1; i<=n; i++) {
        cin >> v[i][0] >> v[i][1];
    }
    for(int i=1; i<=n; i++){
        dp[i][0] = 0;
    }
    for(Int i=1; i<=n; i++){
        for(Int j=0; j<=weight; j++){
            dp[i][j] = dp[i-1][j];
            if(j - v[i][0] >=0){
                dp[i][j] = max(dp[i-1][j-v[i][0]] + v[i][1] , dp[i-1][j]);
            }
        }
    }
    cout << dp[n][weight];
}

signed main(){
    FAST
    int tc = 1;
//    TODO: check for tc
//    cin >> tc;
    for (int t = 1; t <= tc; t++) {
        solve();
    }
}


Measured memory_bytes: 167720
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<int>>;
const int INT_INF = 1001001001;

int main(){
    int n,m;
    cin >> n >> m;
    int sum = m*1900 + 100*(n-m);
    cout << sum * pow(2,m) << endl;
}

Measured memory_bytes: 256
//For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;
    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            ll a,b,c,d;
            cin>>a>>b>>c>>d;
            ll ans=max({a*d,a*c,b*c,b*d});
            cout<<ans<<endl;
        }
        return 0;
    }


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

using namespace std;
typedef long long int lli;
typedef vector<int> iv;
typedef vector<bool> bv;
typedef vector<string> sv;
typedef vector<long long int> llv;
typedef vector<double> dv;
#define debug_ printf("OK\n")

#define sor_(vec) sort(vec.begin(),vec.end())
#define rev_(vec) reverse(vec.begin(),vec.end())
#define rep(i,n) for(int i=0;i<static_cast<int>(n);i++)
#define reps(i,n,s) for(int i=static_cast<int>(s);i<static_cast<int>(n);i++)
#define isposi(num) if(num>0)

const long long mod = 1000000007;

bool IsPrime(int num){
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
    return true;
}

void solve(lli a){
    while (!IsPrime(a)) {
        a++;
    }
    std::cout<<a;
}

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    lli a;
    std::cin>>a;
    solve(a);
    return 0;
}


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

int main(){
  int K; cin >> K;
  string S; cin >> S;
  if(K >= S.length()){
    cout << S;
  }
  else{
    for(int i = 0; i < K; i++){
      cout << S[i];
    }
    cout << "...";
  }

}

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

#define tezi ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define endl "\n"
#define int long long
#define pii pair<int, int>
#define piii pair<int, pair<int, int>>
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define deb(x) cout << #x << " = " << x << endl
#define all(x) x.begin(), x.end()
#define MAX 1000000000000000001
#define MAXN 1000000
#define mod 1000000007
#define PI 3.1415926535897932384626

int mod_exp(int x, int y);

//ofstream fout("file.out");
//ifstream fin("file.in");

void solve(){
    int x, n, ans = 0, prev = MAX;
    cin >> x >> n;
    vector<int> a(n);
    set<int> s;
    for(int i = 0; i < n; ++i){
        cin >> a[i];
        s.insert(a[i]);
    }
    for(int i = -200; i <= 200; ++i){
        if(s.find(i) != s.end()) continue;
        if((int)abs(x - i) < prev){
            ans = i;
            prev = abs(x - i);
        }
    }
    cout << ans << endl;
}

int32_t main(){
    tezi;
    int t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
    return 0;
}

int mod_exp(int x, int y){
    y %= mod;
    int res = 1;
    while(y > 0){
        if(y % 2 != 0) res = (res * x) % mod;
        x = (x * x) % mod;
        y /= 2;
    }
    return res;
}


Measured memory_bytes: 3652
import math


def koch(k, p1, p2):
    if k==0:
        print('{0:.8f} {1:.8f}'.format(p1[0],p1[1]))

    s = [p1[0]*2/3+p2[0]/3, p1[1]*2/3+p2[1]/3]
    u = [(p1[0]+p2[0])/2+(p1[1]-p2[1])*math.sqrt(3)/6,
         (p1[1]+p2[1])/2+(p2[0]-p1[0])*math.sqrt(3)/6]
    t = [p1[0]/3+p2[0]*2/3, p1[1]/3+p2[1]*2/3]
    if k==1:
        print('{0:.8f} {1:.8f}'.format(p1[0],p1[1]))
        print('{0:.8f} {1:.8f}'.format(s[0],s[1]))
        print('{0:.8f} {1:.8f}'.format(u[0],u[1]))
        print('{0:.8f} {1:.8f}'.format(t[0],t[1]))
    elif k>0:
        koch(k-1,p1,s)
        koch(k-1,s,u)
        koch(k-1,u,t)
        koch(k-1,t,p2)
    if k==n:
        print('{0:.8f} {1:.8f}'.format(p2[0],p2[1]))

n = int(input())
koch(n, [0,0],[100,0])


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

#define REP(i,n) for(int i=0;i<(n);i++)
#define EPS (1e-7)
#define INF (2e9)
// cout << setprecision(10)

using namespace std;
typedef long long int ll;
typedef pair<ll, ll> PI;

ll N, M;
int A, B, C;
priority_queue<PI> q;
int main(void){
    cin >> N >> M;
    REP(i, N){
        cin >> A;
        q.emplace(A, 1);
    }
    REP(i,M){
        cin >> B >> C;
        q.emplace(C, B);
    }
    ll res = 0;
    while(N>0){
        auto p = q.top();
        res += min(p.second, N) * p.first;
        q.pop();
        N -= p.second;
    }
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 6384
#include <iostream>

using namespace std;

int n;

int main(void)
{
	cin >> n;
	bool ans = false;
	for(int i = 0; i <= 100; i++){
		for(int j = 0; j <= 100; j++){
			if(4*i+7*j == n) ans = true;
		}
	}
	if(ans) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 384
W, H, N = map(int, input().split())

x = [0] * N
y = [0] * N
a = [0] * N

for i in range(N):
    x[i], y[i], a[i] = map(int, input().split())

X1 = 0
X2 = W
Y1 = 0
Y2 = H

for i in range(N):

    if a[i] == 1:
        X1 = max(X1, x[i])
    if a[i] == 2:
        X2 = min(X2, x[i])
    if a[i] == 3:
        Y1 = max(Y1, y[i])
    if a[i] == 4:
        Y2 = min(Y2, y[i])

if X1 >= X2 or Y1 >= Y2:
    print('0')
else:
    entire = (Y2-Y1) * (X2-X1)
    print(entire)


Measured memory_bytes: 3064
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Queue;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        int[][] map = new int[h + 2][w + 2];
        long wall = 0;
        for (int i = 0; i < h; i++) {
            String s = sc.next();
            for (int j = 0; j < w; j++) {
                char c = s.charAt(j);
                if (c == '#') {
                    map[i + 1][j + 1] = -1; // -1は通れない
                    wall++;
                } else {
                }
            }
        }
        Arrays.fill(map[0], -1);
        Arrays.fill(map[h + 1], -1);
        for (int i = 0; i < h + 2; i++) {
            map[i][0] = -1;
            map[i][w + 1] = -1;
        }
        sc.close();
        Queue<Pos> queue = new ArrayDeque<Pos>();
        boolean visited[][] = new boolean[h + 2][w + 2];
        queue.add(new Pos(1, 1));
        map[1][1] = 1;
        fin: while (!queue.isEmpty()) {
            Pos pos = queue.poll();
            int ci = pos.i;
            int cj = pos.j;
            int dx[] = { 0, 1, 0, -1 };
            int dy[] = { -1, 0, 1, 0 };
            for (int i = 0; i < 4; i++) {
                int ni = ci + dx[i];
                int nj = cj + dy[i];
                if (map[ni][nj] != -1 && !visited[ni][nj]) {
                    map[ni][nj] = map[ci][cj] + 1;
                    visited[ni][nj] = true;
                    queue.add(new Pos(ni, nj));
                    if (ni == h && nj == w) {
                        break fin;
                    }
                }
            }
        }

        if (map[h][w] == 0) {
            System.out.println(-1);
        } else {
            System.out.println(h * w - wall - map[h][w]);
        }
    }
}

class Pos {
    int i, j;

    Pos(int i, int j) {
        this.i = i;
        this.j = j;
    }
}


Measured memory_bytes: 23892
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/rope>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define fo(i, n1, n, x) for(int i = n1; i <= n; i += x)
#define foo(i, n, n1, x) for(int i = n; i >= n1; i -= x)
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
//using namespace __gnu_pbds;
//using namespace __gnu_cxx;


using ll = long long;

//#define int ll

using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;



const int N = 2e5 + 11, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 1e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 6e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-4;
const double PI = acos(-1.0);


//template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }


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

int n, k, d, ans, x;
bool us[111];
main() {
  file("threesum");
  ios;
  cin >> n >> k;
  fo(i, 1, k, 1) {
    cin >> d;
    fo(j, 1, d, 1) cin >> x, us[x] = 1;
  }
  fo(i, 1, n, 1) ans += !us[i];
  cout << ans;
  return 0;
}
/**

*/


Measured memory_bytes: 3660
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <chrono>
#include <climits>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

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

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

template <class T>
istream& operator >> (istream& in, vector<T> &v)
{
	for (T &x : v)
		in >> x;
	return in;
}

template <class T>
ostream& operator << (ostream& out, const vector<vector<T>> &v)
{
	for (const vector<T> &x : v)
		out << x << '\n';
	return out;
}

template <class T>
ostream& operator << (ostream& out, const vector<T> &v)
{
	for (const T &x : v)
		out << x << ' ';
	return out;
}

long long gcd (long long a, long long b)
{
	if (b > a)
		swap(a, b);
	return (b ? gcd(b, a % b) : a);
}

using ll   = long long;
using pii  = pair<int, int>;
using pll  = pair<long long, long long>;
using tiii = pair<pair<int, int>, int>;
using vi   = vector<int>;
using vl   = vector<long long>;
using vvi  = vector<vector<int>>;
using vvl  = vector<vector<long long>>;

#define F          first
#define S          second
#define First      first.first
#define Second     first.second
#define Third      second
#define mp         make_pair
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define per(i,b,a) for (int i = (b); i > (a); i--)
#define all(x)     x.begin(), x.end()
#define ret(x)     return cout << x, 0;
#define throwex    throw runtime_error ("Found the error.");

const int h = 1000000007;

signed main()
{
	ios::sync_with_stdio(false);
	#ifdef ONLINE_JUDGE
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.setstate(ios::failbit);
	#endif

	map<int, int> m;
	int n;
	cin >> n;
	vi v(n);
	cin >> v;
	// n2 - n1 = h1 + h2
	ll ans = 0;
	rep(i,0,n)
	{
		ans += m[i - v[i]];
		m[v[i] + i]++;
		// cerr << ans << ' ';
	}
	cout << ans;
}


Measured memory_bytes: 21048
import math
def resolve():
    def is_prime(n):
        if n == 1:
            return False
 
        for k in range(2, int(math.sqrt(n)) + 1):
            if n % k == 0:
                return False
 
        return True
    X = int(input())
 
    while True:
        if is_prime(X):
            print(X)
            return
        else:
            X += 1
 
    return
 
resolve()

Measured memory_bytes: 3060
#include <cstdio>

using namespace std;
 
int main(){
	int a; 
	int b;
	int c;
	int d;
	scanf("%d %d",&a,&b);
	c = a*b;
	d = (a*2)+(b*2);
	printf("%d %d\n",c,d);
	
	return 0;
}

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

int main() {
	
	int A,B,C;
	
	cin >> A;
	cin >> B;
	cin >> C;
	
	if((C >= A)&&(C<=B)){
	printf("Yes");
	}
	else{
	printf("No");
	}
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll MOD = pow(10,9)+7;

int main(){
    ll n; cin >> n;
    ll left = 1;
    ll right = 1;
    ll mid = 1;
    for(int i=0; i<n; i++){
        left *= 10;
        left %= MOD;
        right *= 9;
        right %= MOD;
        mid *= 8;
        mid %= MOD;
    }

    ll ans = (left+mid - right - right) % MOD;
    if(ans < 0) ans += MOD;

    cout << ans << endl;
}

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

using namespace std;

#define LL long long
#define DD double
#define Pb push_back
#define Bp pop_back
#define Pf push_front
#define Fp pop_front
#define Ub upper_bound
#define Lb lower_bound
#define In insert
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define X first
#define Y second
#define mx1 10
#define mx2 110
#define mx3 1010
#define mx4 10010
#define mx5 100010
#define mx6 1000010

typedef vector<LL> Vl;
typedef vector<DD> Vd;
typedef vector<bool> Vb;
typedef vector<Vl> VVl;
typedef pair<LL, LL> Pll;
typedef pair<DD, DD> Pdd;
typedef vector<Pll> Vpl;
typedef vector<Pdd> Vpd;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
typedef deque<LL> Dl;

LL _set(LL N, LL pos) {return N = N | (1 << pos);}
LL _reset(LL N, LL pos) {return N = N & ~(1 << pos);}
bool _check(LL N, LL pos) {return (bool)(N & (1 << pos));}
bool _upper(char a) {return a >= 'A' && a <= 'Z';}
bool _lower(char a) {return a >= 'a' && a <= 'z';}
bool _digit(char a) {return a >= '0' && a <= '9';}

LL dx[] = {1, -1, 0, 0, -1, -1, 1, 1};
LL dy[] = {0, 0, 1, -1, -1, 1, -1, 1};

///**************************DONE****************************///

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    for(int i = 0; i < c - a; i++)
        cout << 'R';
    for(int i = 0; i < d - b; i++)
        cout << 'U';
    for(int i = 0; i < c - a; i++)
        cout << 'L';
    for(int i = 0; i < d - b; i++)
        cout << 'D';
    cout << 'L';
    for(int i = 0; i <= d - b; i++)
        cout << 'U';
    for(int i = 0; i <= c - a; i++)
        cout << 'R';
    cout << 'D';
    cout << 'R';
    for(int i = 0; i <= d - b; i++)
        cout << 'D';
    for(int i = 0; i <= c - a; i++)
        cout << 'L';
    cout << 'U';
    return 0;
}


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

typedef vector<int> vi;

#define pb push_back
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

const int MN = 100010;

int n;
int a[MN];

int main() {
	cin >> n;
	vi xs;

	rep(i, n) {
		cin >> a[i];
		xs.pb(a[i]);
	}

	sort(ALL(xs));
	int cnt = 0;

	rep(i, n) {
		int p = lower_bound(ALL(xs), a[i]) - xs.begin();
		if (p % 2 != i % 2) {
			++cnt;
		}
	}

	cout << cnt / 2 << endl;
	return 0;
}

Measured memory_bytes: 1148
#S = input()
#S, W2 = input().split()
#I = int(input())
A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))

#D1 = []
#D2 = [[]] * 4
#D1 = [0] * 5
#D2 = [[0] * 5 for i in range(4)]
#D3 = [[[0] * 5 for i in range(4)] for i in range(3)]

X = (C + B - 1)//B
Y = (A + D - 1)//D 

print( 'Yes' if Y>=X else 'No')


Measured memory_bytes: 9160
#include<bits/stdc++.h>
#define maxl 100010

using namespace std;

const double pi=acos(-1.0);
const int inf=0x3f3f3f3f;

int n,m;
long long ans;
struct node
{
	int a,b,id;
}a[maxl];

inline bool cmp(node &x,node &y)
{
	return x.a+x.b>y.a+y.b;
}

inline void prework()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d%d",&a[i].a,&a[i].b),a[i].id=i;
	sort(a+1,a+1+n,cmp);
}

inline void mainwork()
{
	long long suma=0,sumb=0;
	for(int i=1;i<=n;i++)
	{
		if(i&1)
			suma+=a[i].a;
		else
			sumb+=a[i].b;
	}
	ans=suma-sumb;
}

inline void print()
{
	printf("%lld",ans);
}

int main()
{
	prework();
	mainwork();
	print();
	return 0;
}

Measured memory_bytes: 1408
using System;
using System.Collections.Generic;

class Program {

    static int Main(string[] args) {
        List<int[]> list = new List<int[]>();

        int n = InputN();

        for (int i = 0; i < n; i++) {
            list.Add(InputInt());
        }

        Check(list);

        return 0;
    }

    static int InputN() {
        string v = Console.ReadLine();
        return int.Parse(v);
    }

    static int[] InputInt() {
        string v = Console.ReadLine();
        string[] vs = v.Split(' ');

        return new int[] { int.Parse(vs[0]), int.Parse(vs[1]) };
    }

    static void Check(List<int[]> list) {
        int minID = 100;
        int maxValue = -1;

        for (int i = 0; i < list.Count; i++) {
            if (maxValue == list[i][1]) {
                if (list[i][0] < minID) {
                    maxValue = list[i][1];
                    minID = list[i][0];
                }
            }
            else if (maxValue < list[i][1]) {
                maxValue = list[i][1];
                minID = list[i][0];
            }
        }

        Console.WriteLine(string.Format("{0} {1}", minID, maxValue));
    }
}

Measured memory_bytes: 9276
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<functional>
#include<map>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define PII pair<int,int>
#define PLI pair<long long, int>
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define ctoi(x) (x - 'a') 
#define CTOI(x) (x - 'A')
#define BIT(x) (1 << (x))
LL culmod(LL a, LL m){
    long long b = m, u = 1, v = 0;
    while(b){
        long long t = a / b;
        a -= t * b;
        std::swap(a, b);
        u -= t * v;
        std::swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
long long C;
using namespace std;
int main(){
    LL N, M, K;
    cin >> N >> M >> K;
    long long NM = (long long) N * M;
    C=1;
    REPA(i, NM-1){
        C = C * i % MOD;
    }
    REPA(i, K - 1){
        C = (C * culmod(i, MOD))%MOD;
    }
    REPA(i, NM-K+1){
        C = (C * culmod(i, MOD))%MOD;
    }
    long long ans = 0;
    for(LL x = 0;x < N;++x){
        LL d = (x+1)*x/2;
        d%=MOD;
        d*=M*M;
        d%=MOD;
        d*=C;
        d%=MOD;
        ans += d;
        ans %= MOD;
    }
    for(LL y = 0;y < M;++y){
        LL d = (y+1)*y/2;
        d%=MOD;
        d*=N*N;
        d%=MOD;
        d*=C;
        d%=MOD;
        ans += d;
        ans %= MOD;
    }

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


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[]p = new int[n];

    int cou = 0;
    for(int i=0; i<n; i++) {
    	p[i] = sc.nextInt();
    	    	}
    for(int i=1; i<n-1; i++) {
    	if(p[i]<p[i-1] && p[i]>=p[i+1]) {
    		cou++;
    	}else if(p[i]>=p[i-1] && p[i]<p[i+1]){
    		cou++;
    	}
    }   
    System.out.println(cou);
    }
}



Measured memory_bytes: 35320
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            int? X = null;

            var d = N / 1.08;
            if (d == (int)d)
            {
                X = (int)d;
            }
            else
            {
                var i = (int)d;
                var t = (int)(i * 1.08);
                if (t == N)
                {
                    X = i;
                }
                else
                {
                    if (d > i)
                    {
                        t = (int)((++i) * 1.08);
                    }
                    else
                    {
                        t = (int)((--i) * 1.08);
                    }

                    if (t == N)
                    {
                        X = i;
                    }
                }
            }

            if (X == null)
            {
                Console.WriteLine(":(");
            }
            else
            {
                Console.WriteLine(X);
            }
        }
    }
}


Measured memory_bytes: 11092
#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>;
const int INF = 1001001001;

int main() {
  int N, T;
  cin >> N >> T;
  vector<int> c(N), t(N);
  int flag = 0;
  rep(i,N) cin>>c[i]>>t[i];
  int ans = 1011;
  rep(i,N){
    if(t[i] <= T){
      ans = min(ans, c[i]);
      flag = 1;
    }
  }
  if(flag){
    cout<<ans<<endl;
  }else cout<<"TLE"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define N 200010
int n,a[N],b[N];
int main(){
    cin>>n;
    rep(i,n)cin>>a[i];
    rep(i,n)cin>>b[i];
    int j=0,bef=-1;
    rep(i,n){
	if(bef!=a[i])j=0;
	if(a[i]==b[i]){
	    for(;j<n;j++){
		if(a[j]!=a[i]&&b[j]!=a[i]){
		    swap(b[i],b[j]);
		    break;
		}
	    }
	    if(a[i]==b[i]){cout<<"No\n";return 0;}
	}
	bef=a[i];
    }
    cout<<"Yes\n";
    rep(i,n){if(i)cout<<" ";cout<<b[i];}
    cout<<"\n";
}

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

typedef long long ll;

const int mod = 1e9 + 7;

int po[44];

int N, X, Y, Z;

unordered_map<ll, int> chk;
unordered_map<ll, int> mm[44];
int dp(int n, ll V) {
    while(chk.find(V) == chk.end()) V /= 11;

    if(mm[n].find(V) != mm[n].end()) return mm[n][V];
    int &ret = mm[n][V];

    ll p = 1;
    int sum = 0;
    for(int i = 0; i < 17; i++) {
        ll x = (V / p) % 11;
        if(x == 0) break;
        sum += x;
        p *= 11;
    }

    if(sum == X + Y + Z) return ret = po[n];
    if(n == 0) return ret = 0;

    ret = 0;
    for(int i = 1; i <= 10; i++) {
        ret += dp(n - 1, V + p * i);
        ret %= mod;
    }
    return ret;
}

void dfs(int sum, ll V) {
    chk[V] = 1;
    if(sum == X + Y + Z) return;

    int rem;
    if(sum < X) rem = X - sum;
    else if(sum < X + Y) rem = X + Y - sum;
    else rem = X + Y + Z - sum;

    ll p = 1;
    for(int i = 0; i < 17; i++) {
        if(V / p == 0) break;
        p *= 11;
    }

    for(int i = 1; i <= min(rem, 10); i++) {
        dfs(sum + i, V + p * i);
    }
}

int main() {
    po[0] = 1;
    for(int i = 1; i < 44; i++) {
        po[i] = 1LL * po[i - 1] * 10 % mod;
    }

    cin >> N >> X >> Y >> Z;

    dfs(0, 0);
    cout << dp(N, 0);
}


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

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;


    for(int i=0; i<s.size(); i++){
        for(int j=0; j<n; j++){
            if(s[i]=='Z'){
               s[i]='A';
        }
            else s[i] += 1;
        }
    }


    cout << s << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

		// 入力値の取得
		int X = sc.nextInt();

		// 結果の出力
		while (!isPrime(X)) {
			X++;
		}
		System.out.println(X);

		sc.close();
	}

	public static boolean isPrime(int num) {
		if (num < 2)
			return false;
		else if (num == 2)
			return true;
		else if (num % 2 == 0)
			return false;

		double sqrtNum = Math.sqrt(num);
		for (int i = 3; i <= sqrtNum; i += 2) {
			if (num % i == 0) {
				// 素数ではない
				return false;
			}
		}

		// 素数である
		return true;
	}
}


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

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

using ll = long long;
ll INF = LLONG_MAX;
 
using vc = vector<char>;
using vi = vector<int>;
using vb = vector<bool>;
using state = pair<int, int>;

vector<vi> graph;


int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int N, M; cin >> N >> M;
    graph.resize(N);

    vector<vb> visited (N, {false, false, false});
    vector<vi> dist (N, {-1, -1, -1});

    F0R(i, M) {
        int u, v; cin >> u >> v;
        --u; --v;
        graph[u].push_back(v);
    }

    int S, T; cin >> S >> T;
    --S; --T;

    queue<state> q;
    visited[S][0] = true;
    dist[S][0] = 0;
    q.push({S, 0});

    while (!q.empty()) {
        int pos = q.front().first;
        int par = q.front().second;
        q.pop();

        if (pos == T && par == 0) {
            cout << dist[pos][par] / 3 << endl; return 0;
        }

        for (int nPos : graph[pos]) {
            int nPar = (par + 1) % 3;
            if (visited[nPos][nPar]) continue;
            dist[nPos][nPar] = dist[pos][par] + 1;
            visited[nPos][nPar] = true;
            q.push({nPos, nPar});
        }
    }
    cout << -1 << endl;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007


int main(){

  int h,w;
  cin >> h >> w;
  vector<string> s(h);
  rep(i,h)cin >> s[i];
  vector<int> v(26,0);
  rep(i,h)rep(j,w)v[s[i][j]-'a']++;
  int cnt = 0;
  if(h & 1)cnt++;
  if(w & 1)cnt++;
  if(cnt == 0){
    bool is = true;
    rep(i,26)if(v[i] % 4 != 0)is = false;
    if(is)cout << "Yes" << endl;
    else cout << "No" << endl;
  }else if(cnt == 1){
    int cnt_ = 0;
    rep(i,26){
      if((v[i] % 4) == 2)cnt_ += 2;
      else if(v[i] & 1)cnt_ = -(1 << 30);
    }
    if(cnt_ < 0){
      cout << "No" << endl;
    }else if(h & 1){
      if(cnt_ <= w)cout << "Yes" << endl;
      else cout << "No" << endl;
    }else{
      if(cnt_ <= h)cout << "Yes" << endl;
      else cout << "No" << endl;
    }
  }else{
    int cnt_ = 0,cnt__ = 0;
    rep(i,26){
      if((v[i] % 4) == 2)cnt_ += 2;
      else if(v[i] & 1)cnt__++;
    }
    if(cnt__ != 1){
      cout << "No" << endl;
    }else{
      if(h+w-2 >= cnt_)cout << "Yes" << endl;
      else cout << "No" << endl;
    }
  }

  
  




  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b){return (a*b)/gcd(a, b);}


int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    string s,t;
    cin>>s>>t;
    int x,y; cin>>x>>y;
    string l; cin>>l;
    if(l==s) x--;
    else y--;
    cout<<x<<" "<<y;
}


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

using namespace std;

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

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define inf 0x7fffffff
#define RG register
#define inf 0x7fffffff
#define mkp make_pair
#define maxn 100205
typedef unsigned int U;
using namespace std;
typedef long long ll;
const ll mod = 998244353;
const  double eps = 1e-8;
const double pi = acos(-1);
inline ll read(){
    ll x = 0, f = 1;
    char ch = getchar();
    while(ch > '9' || ch < '0') {if(ch == '-') f = -1;ch = getchar();}
    while(ch >= '0' && ch <= '9'){x = x *10 + ch -'0';ch = getchar();}
    return x * f;
}
int n,m;
ll t,a;
int main(){
	int i,j;
	ll x,y;
	//freopen("a.out","r",stdin);
	//freopen("a.ans","w",stdout);
	n=read();
	for(i=1;i<=n;i++){
		x=read(),y=read();
		if(!t) {t=x,a=y;continue;}
		ll l=t/x+(t%x!=0),r=a/y+(a%y!=0);
		t=x*max(l,r);
		a=y*max(l,r);
	}
	printf("%lld\n",a+t);
	return 0;
}

Measured memory_bytes: 3664
//?????????P282-286 ????????§????????????

#include <iostream>
#include <queue>

using namespace std;
static const int N = 100;
static const int UNREACHABLE = -1;

int n, M[N][N];	//M[N][N]?????£??\??????
int d[N];	//???i????????¢???d[i]???????´???????

void bfs(int);

int main(){
	int u,k,v;
	cin >> n;
	//??£??\???????????????????±????
	for(int i=0; i<N; i++){
		for(int j=0; j<N; j++){
			M[i][j] = 0;
		}
	}
	for(int i=0; i<n; i++){
		cin >> u >> k;
		for(int j=0; j<k; j++){
			cin >> v;
			M[u-1][v-1] = 1;
		}
	}

	//?§???????0??¨?????????????????¢?´¢???????§?
	bfs(0);

	return 0;
}

void bfs(int s){
	queue<int> q;	//?¬?????¨???????????????????????¨??????????????????????????????\???
	q.push(s);

	for(int i=0; i<n; i++){		//???????????????????????¢?´¢??¶??????UNREACHABLE??????????????????
		d[i] = UNREACHABLE;
	}
	
	d[s] = 0;	//?§????????????¢???0???????????????

	int u;	//u????????¨??¢?´¢???????????????
	while(!q.empty()){
		u = q.front(); 
		q.pop();
		for(int v=0; v<n; v++){
			if(M[u][v]==0) continue;			//????????????????????£??????????????????	
			if(d[v] != UNREACHABLE) continue;	//??¢?´¢???????????????????????????
			d[v] = d[u] + 1;
			q.push(v);	//v????????¢?´¢?????£????????§???????????¢?´¢???????????¨??????v????????\??????????????????
		}
	}
	//???????????¨?§??????????????????¢?????¨???
	for(int i=0; i<n; i++){
		cout << i+1 << " " << d[i] << endl;
	}
}

Measured memory_bytes: 1244
#include<bits/stdc++.h>
#define ll long long
#define rgi register int
#define rgl register ll
#define maxn 300005
#define mod 1000000007
#define inf 1000000007
namespace lib
{
	using namespace std;
	class fastio
	{
		private:
			#define _NUMLEN 111
			char _num[_NUMLEN],_ch;
			int _f,_head;
		public:
			inline void gc(char & _c) {_c=getchar();}
			template<typename _T> inline fastio & operator - (_T & _x)
			{
				_x=0;
				while(!isdigit(_ch)) _f|=_ch=='-',gc(_ch);
				while(isdigit(_ch)) _x=(_x<<1)+(_x<<3)+(_ch^48),gc(_ch);
				_f&&(_x=-_x,_f=0);
				return *this; 
			}
			inline void pc(char _c) {putchar(_c);}
			template<typename _T> inline fastio & operator + (_T _x)
			{
				_T _k;
				if(_x==0) {pc('0'),pc(' ');return *this;}
				if(_x<0) pc('-'),_x=-_x;
				while(_x>0) _k=_x/10,++_head,_num[_head]=(_x-(_k<<1)-(_k<<3))^48,_x=_k;
				while(_head>0) pc(_num[_head]),--_head;
				pc(' ');
				return *this; 
			}
			#define endl pc('\n')
		fastio() {_f=0,_head=0,_ch=' ';}
	}io;
}using namespace lib;

ll cnt[65],ans;
signed main()
{
//	freopen("ttin.in","r",stdin);
//	freopen("ttout.out","w",stdout);
//	ios::sync_with_stdio(false);
//	cin.tie(0),cout.tie(0);
	ll n,a;
	io-n;
	for(rgi i=1;i<=n;++i)
	{
		io-a;
		for(rgi j=0;j<61;++j)
			cnt[j]+=a&1,a>>=1;
	}
	ll t=1;
	for(rgi i=0;i<61;++i)
	{
		(ans+=((cnt[i]*(n-cnt[i])%mod)*t)%mod)%=mod;
		(t<<=1)%=mod;
	}
	io+ans;
	return 0;
}


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

using namespace std; 

const int MAX = 1010 ;

vector< vector<int> >in(MAX) , out(MAX) ;
int before[MAX] , vis[MAX] , mark[MAX] , donottake[MAX] , timer[MAX];
int tim = 0 ;
int n , m ;

vector<int>ans ;

void dfs(int node , int par , int start)
{
	timer[node] = ++tim ;
	vis[node] = 1 ;
	mark[node] = 1 ;
	before[node] = par ;
	if(node != start)
	{ 
		int cnt = 0 ;
		for(auto &child : in[node])
		{
			if(mark[child] && child != par)
			{
				mark[node] = 0 ;
				return ;
			}
		}
		int now = 0 ;
		int found = 0 ;
		for(auto &child : out[node])
		{
			if(mark[child] && child != start)
			{
				if(timer[child] > now)
					now = timer[child] , found = child ; 
			}
			if(child == start)
				cnt++ ;
		}
		if(now != 0)
		{
			before[found] = -1 ;
			while(before[node] != -1)
			{
				ans.push_back(node) ;
				node = before[node] ;
			}
			ans.push_back(found) ;
			reverse(ans.begin() , ans.end()) ;
			printf("%d\n" , ans.size()) ;
			for(auto &i : ans)
				printf("%d\n" , i) ;
			exit(0) ;
		}
		if(cnt == 1)
		{
			while(before[node] != -1)
			{
				ans.push_back(node) ;
				node = before[node] ;
			}
			ans.push_back(start) ;
			reverse(ans.begin() , ans.end()) ;
			printf("%d\n" , ans.size()) ;
			for(auto &i : ans)
				printf("%d\n" , i) ;
			exit(0) ;
		}
	}
	for(auto &child : out[node])
	{
		if(mark[child])
			return ;
      	if(donottake[child])
           continue ;
		dfs(child , node , start) ;
	}
	mark[node] = 0 ;
}

int readInt () {
	bool minus = false;
	int result = 0;
	char ch;
	ch = getchar();
	while (true) {
		if (ch == '-') break;
		if (ch >= '0' && ch <= '9') break;
		ch = getchar();
	}
	if (ch == '-') minus = true; else result = ch-'0';
	while (true) {
		ch = getchar();
		if (ch < '0' || ch > '9') break;
		result = result*10 + (ch - '0');
	}
	if (minus)
		return -result;
	else
		return result;
}

int main()
{
	n = readInt() ;
	m = readInt() ;
	for(int i = 0 ; i < m ; ++i)
	{
		int x , y ;
		x = readInt() ;
		y = readInt() ;
		out[x].push_back(y) ;
		in[y].push_back(x) ;
	}
	for(int i = 1 ; i <= n ; ++i)
	{
		if(!vis[i])
			dfs(i , -1 , i) ;
		donottake[i] = 1 ;
	}
	return printf("-1\n") , 0 ;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
    public static void main(String args[]){

        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int result = 0;

        result = result + (X/500)*1000;
        X = X -  (X/500)*500;
        result = result + (X/5)*5;

        System.out.println(result);

    }
}

Measured memory_bytes: 21844