akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod

struct edge{int to, cost;};

class Graph
{
public:
    int N;
    vector<vector<edge>> G;
    vec ans;

    Graph(int N): N(N){
        G = vector<vector<edge>>(N, vector<edge>(0));
        ans = vec(N, -1);
    }

    void add_Directed_edge(int from, int to, int cost = 1){
        G[from].push_back(edge({to, cost}));
    }

    void add_Undirected_edge(int v1, int v2, int cost = 1){
        add_Directed_edge(v1, v2, cost);
        add_Directed_edge(v2, v1, cost);
    }

    void dfs(int v, vec &c, int &i, int &M, int p = -1){
        ans[v] = c[i++];
        if(p != -1) M += ans[v];
        for(auto e: G[v]) if(e.to != p){
            dfs(e.to, c, i, M, v);
        }
    }

};

signed main(){

    int N; cin >> N;
    vec a(N - 1), b(N - 1);
    Graph G(N);
    REP(i, N - 1){
        cin >> a[i] >> b[i];
        G.add_Undirected_edge(a[i] - 1, b[i] - 1);
    }
    vec c(N); cin >> c;
    Sort(c); Reverse(c);
    int M = 0, i0 = 0;
    G.dfs(0, c, i0, M);
    Out(M);
    REP(i, N) cout << G.ans[i] << " ";
    cout << endl;

    return 0;
}


Measured memory_bytes: 1664
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████  
//
#include "bits/stdc++.h"
using namespace std;
#define INF (1LL<<60)
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl
#define SP << " " << 
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;}
#define MSB(x) (63-__builtin_clzll(x))
#define pcnt(x) (__builtin_popcountll(x))
#define parity(i,j) (i&(1LL<<j))
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int n;
  cin >> n;

  cout << (n+1)/2 << endl;

  return 0;
}

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

int main()
{
    int no_of_stones, no_of_steps;
    cin >> no_of_stones >> no_of_steps;

    vector <int> height(no_of_stones + 1, 0);
    for(int i = 1; i <= no_of_stones; i++)
        cin >> height[i];

    const int oo = 1e9;
    vector <int> minimum_cost(no_of_stones + 1, oo);
    minimum_cost[1] = 0;

    for(int i = 2; i <= no_of_stones; i++)
    {
        for(int j = i - 1; j >= max(1, i - no_of_steps); j--)
        {
            minimum_cost[i] = min(minimum_cost[i], minimum_cost[j] + abs(height[i] - height[j]));
        }
    }

    cout << minimum_cost[no_of_stones];
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <algorithm>
#include <math.h>

using namespace std;


int main(){

	int a,b,n,sum;

	while(scanf("%d %d %d",&a,&b,&n)!=EOF){

		sum = 0;
		a = 10*(a % b);
		for(int i=0; i < n; i++){
			sum += a/b;
			a = 10*(a % b);
		}

		printf("%d\n",sum);
	}

	return 0;
}

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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cout<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<int, int> P;
struct Edge{ll from, to, cost;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

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

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

vector<P> G[101000];
ll N, K, Q;
map<ll, ll> dist;

void gen_dist(ll f, ll c){
  ll S = G[c].size();
  rep(i, S){
    ll v = G[c][i].first;
    ll cost = G[c][i].second;
    if(v==f)continue;
    dist[v] += dist[c] + cost;
    gen_dist(c, v);
  }
}

/**************************************
** A main function starts from here  **
***************************************/
int main(){
  cin >> N;
  rep(i, N-1){
    ll a, b, c;
    cin >> a >> b >> c;
    //if(a>b)swap(a,b);
    a--;b--;
    G[a].push_back({b, c});
    G[b].push_back({a, c});
  }

  cin >> Q >> K;
  K--;
  dist[K] = 0;
  gen_dist(-10, K);
  llvec x(Q, 0);
  llvec y(Q, 0);
  rep(i, Q){
    cin >> x[i] >> y[i];
    x[i]--;y[i]--;
  }

  rep(i, Q){
    cout << dist[x[i]] + dist[y[i]] << endl;
  }
  return 0;
}


Measured memory_bytes: 26496
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll N;ll a[3001];
ll dp[3001][3001];
ll ans(ll ind1,ll ind2){
      if(ind1==ind2){
            if((N-1+ind1-ind2)%2==0)return a[ind1];
            else return -1*a[ind1];
      }
      if(dp[ind1][ind2]!=-1)return dp[ind1][ind2];ll x;
      if((N-1-ind2+ind1)%2==0)x = 1;
      else x = -1;
      if(x==1)dp[ind1][ind2] = max(ans(ind1+1,ind2)+x*a[ind1],ans(ind1,ind2-1)+x*a[ind2]);
      else dp[ind1][ind2] = min(ans(ind1+1,ind2)+x*a[ind1],ans(ind1,ind2-1)+x*a[ind2]);
      return dp[ind1][ind2];
}
int main(){
      cin>>N;for(ll i=0;i<N;i++)cin>>a[i];memset(dp,-1,sizeof(dp));
      cout<<ans(0,N-1)<<endl;
      return 0;
}


Measured memory_bytes: 70784
r, g, b, n = map(int, input().split())

ans = 0
for i in range(n//r+1):
    for j in range(n//g+1):
        if r*i + g*j > n:
            break
        if (n - r*i - g*j) == 0 or ((n - r*i - g*j) >= b and (n - r*i - g*j) % b == 0):
            ans += 1
print(ans)


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

int main() {
    ll t1,t2,a1,a2,b1,b2; cin >>t1>>t2>>a1>>a2>>b1>>b2;
    ll p,q;
    p=(a1-b1)*t1; q=(a2-b2)*t2;
    if(p>0){
        p=-p; q=-q;
    }
        if(p+q<0){
            cout << 0 << endl;
        }else if(p+q==0){
            cout << "infinity"<<endl;
        }else{
            ll r=-p/(p+q);
            ll s=-p%(p+q);
            if(s==0){
                cout << r*2 << endl;
            }else{
                cout << r*2+1 << endl;
            }
        }
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
import random
from collections import deque
from decimal import *
import queue

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	N,K = inputMap()
	A = inputList()

	ans = 1
	ans_old = 1
	mae = 0
	for i,val in enumerate(A):
		if i < K:
			continue
		tmp = A[i-K]
		if val > tmp:
			print("Yes")
		else:
			print("No")



#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()


Measured memory_bytes: 101316
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
#define REP(i, n) for (int i = 0; (i64)(i) < (i64)(n); ++i)

#ifdef ENABLE_DEBUG
template <typename T>
void debug(T value) {
  cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  cerr << value << ", ";
  debug(args...);
}
#define DEBUG(...)                              \
  do {                                          \
    cerr << " \033[33m (L" << __LINE__ << ") "; \
    cerr << #__VA_ARGS__ << ":\033[0m ";        \
    debug(__VA_ARGS__);                         \
    cerr << endl;                               \
  } while (0)
#else
#define debug(...)
#define DEBUG(...)
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  vector<tuple<int, int, bool>> ps(2 * N);
  REP(i, 2 * N) {
    int x, y;
    cin >> x >> y;
    ps[i] = {x, y, i < N};
  }
  sort(ps.begin(), ps.end());
  set<int> red;
  int count = 0;
  REP(i, 2 * N) {
    auto [x, y, is_red] = ps[i];
    if (is_red) {
      red.insert(y);
    } else if (red.size()) {
      auto it = red.lower_bound(y);
      if (it == red.begin()) continue;
      --it;
      assert(*it < y);
      ++count;
      red.erase(it);
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
int N, M=0;
int main () {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	while (cin>>N>>M) {
		N+=M+1;
		if (N==1) {
			cout<<1<<endl;
		}
		else cout<<ceil(log(N)/log(10))<<endl;
	}
}

Measured memory_bytes: 3564
def main():
    n=int(input())
    c=input()
    ans = 0
    tmp=c[0]
    for i in c[1:]:
        if tmp != i:
            ans += 1
            tmp = i
    if tmp == c[-1]:
        print(ans+1)
    else:
        print(ans)
if __name__ == '__main__':
    main()


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

using namespace std;

#define REP(i,m) for(int i=0; i<m; i++)
#define FOR(i,n,m) for(int i=n; i<m; i++)
#define INF 1000000007
#define INFL (1LL << 60)
#define MOD 998244353
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define ll long long int
#define P pair<ll, ll>

int main(){
	while(true){
		int r, c;
		cin >> r >> c;
		if(r+c==0) break;
		int f[r][c];
		REP(i, r) REP(j, c) cin >> f[i][j];
		int res = 0;
		REP(i, (1<<r)){
			int cur = 0;
			REP(x, c){
				int ones = 0;
				REP(y, r){
					if((f[y][x] + (i>>y))%2==1) ones++;
				}
				cur += max(ones, r-ones);
			}
			res = max(cur, res);
		}
		cout << res << endl;
	}
	return 0;
} 


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

int main(void)
{
	int n;

	while(cin >> n, n){
		int c = 0;

		while(n > 1){
			c++;
			if(n % 2 == 0)
				n /= 2;
			else
				n = n*3+1;
		}
		cout << c << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
import java.util.Scanner;

public class Main {

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

	Scanner sc = new Scanner(System.in);

	
	void run() {
		int n  = sc.nextInt();
		int k  = sc.nextInt();

		if(k==n){
			System.out.println(1);
			return;
		}
		
		int x = (n-1 + k - 2)/(k-1) ;
		System.out.println(x);
		
	}
}


Measured memory_bytes: 21460
#include <bits/stdc++.h>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <iostream>
#include <iomanip>
using namespace std;
typedef long long LL;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

int main(){
    string SA, SB, SC;
    cin >> SA >> SB >> SC;

    reverse(SA.begin(), SA.end());
    reverse(SB.begin(), SB.end());
    reverse(SC.begin(), SC.end());

    char next_turn = 'a';
    while(true){
        switch (next_turn)
        {
            case 'a':
                if(SA.size()==0){
                    cout << "A" << endl;
                    return 0;
                }

                next_turn = SA[SA.size()-1];
                SA.pop_back();
                break;
            case 'b':
                if(SB.size()==0){
                    cout << "B" << endl;
                    return 0;
                }

                next_turn = SB[SB.size()-1];
                SB.pop_back();
                break;
            case 'c':
                if(SC.size()==0){
                    cout << "C" << endl;
                    return 0;
                }
                next_turn = SC[SC.size()-1];
                SC.pop_back();
                break;
            default:
                break;
        }

    }
    return 0;
    
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define s second
#define f first
long long const mod = 1000000007;
#define inf 1000000000000000000
inline ll add(ll a, ll b){ return ((a%mod)+(b%mod)+mod)%mod;}
inline ll mul(ll a, ll b){ return (((a%mod)*(b%mod))%mod+mod)%mod;}
inline ll sub(ll a, ll b){ return ((a%mod)-(b%mod)+mod)%mod;}

ll power(ll x,ll y,ll m)
{
    if (y == 0)
        return 1;
    ll p = power(x, y/2, m) % m;
    p = (p * p) % m;
    return (y%2 == 0)? p : (x * p) % m;
}

ll modInv(ll x)
{
    return power(x,mod-2,mod)%mod;
}


vector<string> func(ll n)
{
    vector<string>v,v1;
    if(n==1)
    {
        v.push_back("a");
        //cout<<"a\n";
        return v;
    }
    v=func(n-1);
    //ll id=n;
    for(auto s:v)
    {
        //char c=s[n-2];
        //ll id=int(c)-'a';
        //cout<<id<<endl;
        set<char>st;
        for(char c:s)
        {
            st.insert(c);
        }
        ll id=st.size();
        for(ll i=0;i<26&&i<=id;i++)
        {
            string p=s+char(i+'a');
            v1.push_back(p);
            //cout<<p<<endl;
        }
    }
   // cout<<n<<" returning\n";
    return v1; 
}


int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    
    ll n;
    cin>>n;
    vector<string>v;
    v=func(n);
    for(auto s:v)
        cout<<s<<endl;
    
    return 0;
}


Measured memory_bytes: 10956
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author NikuKyabe
 */

#include <iostream>
#include <fstream>

#include "bits/stdc++.h"

using namespace std;
#define int long long


class ABiscuitGenerator {
public:
    void solve(std::istream &in, std::ostream &out) {
      int a, b, t;
      in >> a >> b >> t;
      out << t / a * b << endl;
    }
};


signed main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout << fixed;
  ABiscuitGenerator solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}


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

int main(){
    int K;cin >> K;
    int X[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    cout << X[K - 1] << endl;
}

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

int main() {
  int N, a = 0, b = 0;
  cin >> N;
  vector<int> A(N);
  for(int i = 0; i < N; i++){
    cin >> A.at(i);
  }
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
  for(int i = 0; i < N; i++){
    if(i % 2 == 0) a += A.at(i);
    else b += A.at(i);
  }
  cout << a - b << endl;
}


Measured memory_bytes: 256
H, W, K = map(int,input().split())
c = list(list(input()) for _ in range(H))
ans = 0

#bit演算
for i in range(2 ** H):
  for j in range(2 ** W):
    b = 0
    for k in range(H):
      for l in range(W):
        #縦も横も塗らない色が黒のマスを数える
        if i >> k & 1 and j >> l & 1 and c[k][l] == "#": b += 1
    if b == K: ans += 1

print(ans)

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

int main()
{
  map<string, int> Blood;
  string input;
  char c;
  int n;

  while (cin >> n >> c >> input){
    Blood[input]++;
  }

  cout << Blood["A"] << '\n' << Blood["B"] << '\n';
  cout << Blood["AB"] << '\n' << Blood["O"] << '\n';

  return (0);
}

Measured memory_bytes: 1216
A = Array.new(3, Array.new(3))
3.times { |i|
  A[i] = gets.split.map(&:to_i)
}
N = gets.to_i
Blist = Array.new(N)
N.times{ |i|
  Blist[i] = gets.to_i
}

Blist.each{ |b|
  3.times { |i|
    3.times { |j|
      if b == A[i][j] then
        A[i][j] = 0
      end
    }
  }
}

ans = 'No'
3.times { |i|
  if A[i][0] == 0 && A[i][1] == 0 && A[i][2] == 0 then
    ans = 'Yes'
  end
}
3.times { |i|
  if A[0][i] == 0 && A[1][i] == 0 && A[2][i] == 0 then
    ans = 'Yes'
  end
}
if A[0][0] == 0 && A[1][1] == 0 && A[2][2] == 0 then
  ans = 'Yes'
end
if A[0][2] == 0 && A[1][1] == 0 && A[2][0] == 0 then
  ans = 'Yes'
end

puts ans


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long int
#define ll long long int
#define vi vector<int> 
#define vl vector<ll> 
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vpii vector<pii>
#define vpll vector<pair<ll,ll>>
#define umap unordered_map
#define uset unordered_set
#define all(c) c.begin(), c.end()
#define maxarr(A) *max_element(A, A+n) 
#define maxvec(v) *max_element(all(v)) 
#define minarr(A) *min_element(A, A+n);
#define minvec(v) *min_element(all(v));
#define lb(v,elem) lower_bound(all(v),elem)
#define ub(v,elem) upper_bound(all(v),elem)
#define pb push_back 
#define ff first 
#define ss second
#define sz(z) (int)z.size()
#define rep(i,a,b) for(int i=a; i<b; ++i)
#define rev(i,a,b) for(int i=a; i>=b; i--)
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define debug(v) for(ll i=0; i<v.size(); i++) cout<<v[i]<<" "; cout<<endl;
#define debugn(v,n) for(ll i=0; i<n; i++) cout<<v[i]<<" "; cout<<endl;
#define deb(sum) cout<<"sum = "<<sum<<endl;
#define mod 1000000007
#define INF (ll)1e18
#define endl "\n"
#define pi 3.142857142857143

  
ll binpow(ll a, ll b) {
	if (b == 0)
		return 1;
	ll res = binpow(a, b / 2);
	if (b % 2)
		return res * res * a;
	else
		return res * res;
}

ll modexpo(ll x, ll y, ll p){  
	ll res = 1;  
	x = x % p; 
	if (x == 0) return 0;
	while (y > 0){   
		if (y & 1)  
			res = (res*x) % p;  
		y = y>>1;
		x = (x*x) % p;  
	}  
	return res;  
}

vector<int> getPrimes(int M){
	
	vi p(M,1);
	vector<int>prime;
	for(int i=2; i*i <= M; ++i){
		if(p[i]){
			for(int j = i*i; j<=M; j+=i) 
				p[j] = 0;
		}
	}
	rep(i,2,M) if(p[i]) prime.push_back(i);
	return prime;
}


int main() { 
	FASTIO;
	//freopen("1.in","r",stdin);
	//vi pm = getPrimes(100005);
	int t=1;
	//cin>>t; 
	while(t--){
		ll n;
		cin>>n;
        string s = "";
		while(n!=0){
			n--;
			char c = 'a' + n%26;
			s = c + s;
			n/=26LL;
		}
		cout<<s<<endl;
	}

  return 0;
} 


Measured memory_bytes: 3652
#include <iostream>
using namespace std;
int main(){
    int n,min=9999999,max=-1000000,su;
    long long sum=0;     
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>su;
        if(su<min) min=su;
        if(su>max) max=su;
        sum+=su;
    }
    cout<<min<<" "<<max<<" "<<sum<<endl;
}

Measured memory_bytes: 3124
/// Rustで競技プログラミングの入力をスッキリ記述するマクロ
///
/// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
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, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[inline]
#[allow(dead_code)]
fn gcd(mut m: u64, mut n: u64) -> u64 {
    if m < n {
        std::mem::swap(&mut m, &mut n);
    }

    loop {
        let k = m % n;
        if k == 0 {
            return n;
        }

        m = n;
        n = k;
    }
}

#[inline]
#[allow(dead_code)]
fn lcm(m: u64, n: u64) -> u64 {
    m / gcd(m, n) * n
}

macro_rules! eprint(
    ($($arg:tt)*) => { {
        use std::io::Write;
        let r = write!(&mut ::std::io::stderr(), $($arg)*);
        r.expect("failed printing to stderr");
    } }
);

macro_rules! eprintln(
    ($($arg:tt)*) => { {
        use std::io::Write;
        let r = writeln!(&mut ::std::io::stderr(), $($arg)*);
        r.expect("failed printing to stderr");
    } }
);

macro_rules! dbg {
    ($val:expr) => {
        // Use of `match` here is intentional because it affects the lifetimes
        // of temporaries - https://stackoverflow.com/a/48732525/1063961
        match $val {
            tmp => {
                eprintln!(
                    "[{}:{}] {} = {:#?}",
                    file!(),
                    line!(),
                    stringify!($val),
                    &tmp
                );
                tmp
            }
        }
    };
}

fn main() {
    input! {
        x: chars,
    }

    let mut answer = 0u64;
    let mut s_count = 0u64;
    for &c in &x {
        if c == 'S' {
            s_count += 1;
            answer += 1;
        } else {
            if s_count > 0 {
                s_count -= 1;
                answer -= 1;
            } else {
                answer += 1;
            }
        }
    }
    println!("{}", answer);
}


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

int main(void)
{

    int a, b;
    cin >> a >> b;

    if (a < 10 && b < 10)
    {
        cout << a * b << endl;
        ;
    }
    else
    {
        cout << "-1" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream> 
#include <vector> 
#include <algorithm> 
#include <bits/stdc++.h> 
#include <stdlib.h> 
#include <stdio.h> 
#include <functional> 
#include<math.h> 
#include<cstring>
using namespace std;
int main(void){
    // Your code here!
    int a,b,c;
    cin >> a >> b >>c;
    if(a * c <= b){
        cout << c << endl;
    }
    else{
        cout << b / a << endl;
    }
}


Measured memory_bytes: 256
import numpy as np


if __name__ == '__main__':
    N, M, C = map(int, input().split())

    B = np.array(list(map(int, input().split())))

    A = []
    for i in range(N):
        A.append(list(map(int, input().split())))

    A = np.array(A)

    print(len(np.where(A.dot(B) + C > 0)[0]))

Measured memory_bytes: 14444
s,t=sorted(input()),sorted(input())
for i in range(min(len(s),len(t))):
    if ord(s[i])<ord(t[-i-1]):
        print("Yes")
        break
    elif ord(s[i])>ord(t[-i-1]):
        print("No")
        break
else:
    print("Yes" if len(s)<len(t) else "No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define isIn(x,y,h,w) (x >= 0 && x < h && y >= 0 && y < w)

#define int long long
//using ll = long long;
using P = pair<int,int>;

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

template<class T> T &chmin(T &a,const T &b){ return a = min(a,b); }
template<class T> T &chmax(T &a,const T &b){ return a = max(a,b); }

const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

struct QuickFind{
	vector<int> par;
	vector<vector<int>> group;
	QuickFind(int n) : par(n),group(n){
		for(int i = 0;i < n;i++){
			par[i] = i;
			group[i].push_back(i);
		}
	}
	int find(int x){
		return par[x];
	}
	void unite(int x,int y){
		x = par[x],y = par[y];
		if(x == y) return;
		if(group[x].size() < group[y].size()) swap(x,y);
		for(int v : group[y]) par[v] = x;
		group[x].insert(group[x].end(),group[y].begin(),group[y].end());
		group[y].clear();
		par[y] = x;
	}
	bool same(int x,int y){
		return par[x] == par[y];
	}
};

signed main(){
	int n,m;
	cin >> n >> m;
	QuickFind qf(n);
	for(int i = 0;i < m;i++){
		int a,b;
		cin >> a >> b; a--;b--;
		qf.unite(a,b);
	}
	int ma = 0;
	for(int i = 0;i < n;i++){
		chmax(ma,(int)qf.group[i].size());
	}
	cout << ma << endl;
}

Measured memory_bytes: 23168
#include <cmath>
#include <iostream>
#include <vector> 
#include <algorithm>

int main()
{
    long long N;
    std::cin >> N;
    std::vector<long long> A(N, 0);
    for (int i=0; i<N; i++)
    {
        std::cin >> A.at(i);
    }

    int M = 1000005;
    std::vector<long long> cnt(M, 0);
    for (const long long& i: A)
    {
        if (cnt.at(i)!=0)
        {
            cnt.at(i)++;
            continue;
        }

        for (int j=i; j<M; j+=i) cnt.at(j)++;
    }

    long long ans=0;
    for (const long long& i: A)
    {
        if (cnt.at(i) == 1) ans++;
    }
    std::cout << ans;
}

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

#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); ++i)
#define rep(i, n) repi(i, 0, n)
#define all(x) (x).begin(), (x).end()

int N,M,K[10],S[10][10],P[10];
bool C[10];

void input() {
  cin >> N >> M;
  rep(i, M) {
    cin >> K[i];
    rep(j, K[i]) {
      cin >> S[i][j];
    }
  }
  rep(i, M) {
    cin >> P[i];
  }
}

inline void Main() {
  // code
  input();

  int res = 0;

  rep(bit, 1 << N) {
    rep(i, N) {
      C[i] = bit & (1 << i);
    }

    int rb = 0;

    rep(i, M) {
      int rj = 0;
      rep(j, K[i]) {
        if(C[S[i][j]-1]) rj++;
      }
      if(rj % 2 == P[i]) rb++;
    }

    if(rb == M) res++;
  }

  cout << res << endl;
}

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


Measured memory_bytes: 256
X, N = map(int, input().split())
if N == 0:
        print(X)
else:
        p = list(map(int, input().split()))

        for i in range(101):
                if X - i not in p:
                        print(X - i)
                        break
                if X + i not in p:
                        print(X + i)
                        break

Measured memory_bytes: 61560
//vvk
#include "bits/stdc++.h"
using namespace std;
 
using ll = long long;
 
const ll inf = 1e18;
const int N = 2 * 1e5 + 1;

ll res , k , n;
ll w[105] , v[105] , dp[105][N];

ll go(ll idx , ll sum) {
    if(idx >= n) {
        if(sum <= k) return 0;
        else return -inf;
    }
    if(dp[idx][sum] != -1) return dp[idx][sum];
    ll xx = 0 , yy = 0;
    if(w[idx] + sum <= k) {
        xx = v[idx] + go(idx + 1 , sum + w[idx]);
    }
    yy = go(idx + 1 , sum);

    return dp[idx][sum] = max(xx , yy);
}

void solve(){
    cin >> n >> k;
    for(int i = 0; i < n; i++) {
        cin >> w[i] >> v[i];
    }
    memset(dp , -1 , sizeof(dp));
    cout << go(0 , 0);
}
 
int main(int argc, char const *argv[]){
    ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
    ll t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
}

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

class doubly_list_node{
    public :
        doubly_list_node *next,*back;
        int data;
        doubly_list_node(doubly_list_node *_back ,doubly_list_node *_next , int _data ){
            back = _back;
            next = _next;
            data = _data;
        }
};

class doubly_list{
    public:
        doubly_list_node *start,*end;
        doubly_list(){
            start = new doubly_list_node(0,0,0);
            end = new doubly_list_node(start,0,0);
            start->next = end;
        }
        ~doubly_list(){
            doubly_list_node *node = start;
            while(node){
                doubly_list_node *next = node->next;
                delete node;
                node = next;
            }
        }
        void insert(int data){
            doubly_list_node *pre_first = start->next;
            doubly_list_node *node = new doubly_list_node(start,pre_first,data);
            start->next = node;
            pre_first->back = node;
        }
        doubly_list_node* search(int i){
            doubly_list_node *node = start->next;
            while(node){
                if(node->data == i){
                    return node;
                }
                node = node->next;
            }
            return node;
        }
        void search_delete(int i){
            doubly_list_node *node = start->next;
            while(node){
                if(node->data == i){
                    node->back->next = node->next;
                    node->next->back = node->back;
                    delete node;
                    return;
                }
                node = node->next;
            }
            return;
        }
        void deleteFirst(){
            doubly_list_node *pre_first = start->next;
            doubly_list_node *pre_second = pre_first->next;
            start->next = pre_second;
            pre_second->back = start;
        }  
        void deleteLast(){
            doubly_list_node *first_from_back = end->back;
            doubly_list_node *second_from_back = first_from_back->back;
            end->back = second_from_back;
            second_from_back->next = end;
        }
        void show_list(){
            
        }
};

int main(){
    doubly_list d_list;
    int n,data;
    string command;
    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> command;
        if(command == "deleteFirst" || command == "deleteLast"){
            if(command == "deleteFirst"){
                d_list.deleteFirst();
            }else{
                d_list.deleteLast();
            }
        }else{
            cin >> data;
            if(command == "insert"){
                d_list.insert(data);
            }else if(command == "delete"){
                d_list.search_delete(data);
            }
        }
    }
    doubly_list_node *node_result = d_list.start->next;
    while(node_result->data){
        if(node_result->next == d_list.end){
            cout << node_result->data << endl;
        }else{
            cout << node_result->data << " ";
        }
        node_result = node_result->next;
    }

}


Measured memory_bytes: 37364
N = int(input())
a = []
for i in range(N):
    a.append(list(map(str,input().split())))

ans = 0
for i in range(len(a)):
    if a[i][1] == 'JPY':
        ans += float(a[i][0])
    else:
        ans += float(a[i][0]) * 380000
print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
	string a="CODEFESTIVAL2016";
	string b;
	int sum=0;
	cin>>b;
	for(int i=0;i<b.length();i++)
	{
		if(a[i]!=b[i])
		{
			sum++;
		}
	}
	cout<<sum;
	return 0;
} 

Measured memory_bytes: 256
fun main(args:Array<String>):Unit {
    val map = mutableMapOf<String, Int> ()
    repeat(readLine()!!.trim().toInt()){
        val (name, num) = readLine()!!.trim().split(' ')
        if (map.containsKey(name)){
            map[name] = map[name]!! + num.toInt()
        }else{
            map[name] = num.toInt()
        }
    }
    map.toList().sortedWith(compareBy({it.first.length}, Pair<String, Int>::first)).forEach { println("${it.first} ${it.second}") }
}


Measured memory_bytes: 40888
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}


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

    int count = 0;
    ll b = 0;
    priority_queue<ll> p1;
    priority_queue<ll> p2;

    ll ans = 0;

    rep(i,n){
        int x;
        cin >> x;
        if(x==1){
            ll y,z;
            cin >> y >> z;
            b += z;
            if(count==0){
                p1.push(y);
            }else if(count%2==0){
                ll t = -p2.top();
                if(t<y){
                    p2.pop();
                    p2.push(-y);
                    p1.push(t);
                    ans += (y-t);
                }else{
                    ll tt = p1.top();
                    if(tt<=y){
                        ans += 0;
                    }else{
                        ans += tt - y;
                    }
                    p1.push(y);
                }
            }else{
                ll t = p1.top();
                if(t<y){
                    p2.push(-y);
                    ans += (y-t);
                }else{
                    p2.push(-t);
                    p1.pop();
                    p1.push(y);
                    ans += abs(y-t);
                }
            }
            count++;
        }else{
            cout << p1.top() << ' ' << ans+b << endl;
        }
    }

    return 0;
}
 
 


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

int main() {
    string s, t;
    cin >> s >> t;
    int S = s.size();
    vector<int> onaji(S);
    rep(i,S){
        if(s.at(i)==t.at(i)){
            onaji.at(i) = true;
        }
        else{
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 3624
N = input()

if N[-1] =="2" or N[-1] =="4" or N[-1] =="5" or N[-1] =="7" or N[-1] =="9":
  print("hon")
  
elif N[-1] =="0" or N[-1] =="1" or N[-1] =="6" or N[-1] =="8":
  print("pon")
  
else:
  print("bon")

Measured memory_bytes: 9020
#include <stdio.h>
 
int abs(int n)
{
    if (n > 0) return (n);
     
    return (n * -1);
}
 
int max(int a, int b)
{
    a = abs(a);
    b = abs(b);
     
    if (a > b) return (a);
     
    return (b);
}
 
int main(void)
{
    int i;
    int n;
    int x[3], y[3];
    int t[2];
    int sum;
     
    scanf("%d %d %d", &t[0], &t[1], &n);
     
    x[0] = y[0] = 1;
    sum = 0;
    scanf("%d %d", &x[0], &y[0]);
    for (i = 0; i < n - 1; i++){
        scanf("%d %d", &x[1], &y[1]);
         
        x[2] = x[1] - x[0];
        y[2] = y[1] - y[0];
         
        if ((x[2] > 0 && y[2] > 0) || x[2] < 0 && y[2] < 0){
            sum += max(x[2], y[2]);
        }
        else {
            sum += abs(x[2]) + abs(y[2]);
        }
         
        x[0] = x[1];
        y[0] = y[1];
    }
     
    printf("%d\n", sum);
     
    return 0;
}


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

int main (void){
  int n,d,ans = 0;
  int R,G,B;
  cin >> R >> G >> B >> n;

  for(int i = 0;i <= n/R;i++){
    for(int j = 0;j <= n/G;j++){
      d = R*i + G*j;
      if((n-d) % B == 0 && n >= d){
        ans++;
      }
      }
    }

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

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define rep(i, n) for(int i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
using vi = vector<int>;
const int MOD = 1e9+7;
 
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;
}
 
int main() {
	int N;
  	cin >>N;
  	int x,y;
  	x = 800*N;
  	y = 200*(N/15);
    cout << x-y << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		char[] sArray = S.toCharArray();
		String result = "Good";
		for (int i = 0; i < 3; i++) {
			if (sArray[i] == sArray[i + 1]) {
				result = "Bad";
			}
		}
		System.out.println(result);
		sc.close();
	}
}

Measured memory_bytes: 23764
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>

using namespace std;

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

typedef long long ll;

void Main()
{
    int n; cin >> n;
    int a[200010];
    rep(i, n) cin >> a[i + 1];
    int res[200010];
    int cnt = 0;
    for (int i = n; i > 0; --i) {
        int other = 0;
        for (int j = 2; true; ++j) {
            if (j * i > n) {
                break;
            }
            if (res[j * i] == 1) {
                ++other;
            }
        }
        if (a[i] == 0) {
            if (other % 2 == 0) {
                res[i] = 0;
            } else {
                res[i] = 1;
                ++cnt;
            }
        } else {
            if (other % 2 == 0) {
                res[i] = 1;
                ++cnt;
            } else {
                res[i] = 0;
            }
        }
    }
    cout << cnt << endl;
    rep(i, n)
    {
        if (res[i + 1] == 1) {
            cout << (i + 1);
            if (i == n - 1) {
                cout << endl;
            } else {
                cout << " ";
            }
        }
    }
}

int main()
{
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	Main();
}


Measured memory_bytes: 2560
import math
import sys
from collections import Counter

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result

arr_data = getinputdata()

w = arr_data[0][0]

cnt=Counter(w)

flg=True

for k in cnt:
    
#    print(k,cnt[k])
    
    if cnt[k] % 2==1:
        
        flg=False
        break
        
        
print("Yes" if flg else "No")

        
    
    

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

int main() {
    int N;
    cin >> N;
    int *A = new int[N];
    int changes = 0;
    for (int i=0;i<N;i++)
    {
        cin >> A[i];
        if (i>0)
        {
            if(A[i] == A[i-1])
            {
                changes++;
                A[i] = -1;
            }
        }
    }

    cout << changes;
    return 0;
}


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

struct Benri { Benri() { std::cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(12);}} benri;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
using pll = pair<ll, ll>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

constexpr long long MOD = 1000000007;
constexpr long long MOD2 = 998244353;
constexpr double EPS = 1e-10;
constexpr int INF = 1001001001;
constexpr ll LINF = 1001001001001001001ll;



int main() {
    string s; cin >> s;
    string a =  "Sunny", b  = "Cloudy" , c =  "Rainy";
    if (s == a) cout << b << endl;
    else if (s == b) cout << c << endl;
    else cout << a << endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); i++)
#define rep(i, n) rep2(i, 0, n)
#define ALL(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
const int INF = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS = 1e-10;
const int MOD = int(1e9)+7;
template<typename T> inline bool chmin(T& a, T b) {if(a>b) {a=b; return true;} return false;}
template<typename T> inline bool chmax(T& a, T b) {if(a<b) {a=b; return true;} return false;}


vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}


int main() {
  ll N, K; cin >> N >> K;
  Vll A(N);
  rep(i, N) cin >> A[i];

  ll sum = 0;
  rep(i, N) sum += A[i];
  
  auto div = divisor(sum);
  reverse(ALL(div));

  for (auto e : div) {
    Vll b(N);
    rep(i, N) {
      b[i] = A[i] % e;
    }
    sort(ALL(b));

    Vll s1(N+1), s2(N+1);
    rep(i, N) {
      s1[i+1] += s1[i] + b[i];
      s2[i+1] += s2[i] + e - b[N-i-1];
    }

    ll cmin = INFll;
    rep(i, N+1) {
      chmin(cmin, max(s1[i], s2[N-i]));
    }  
    if (cmin <= K) {
      cout << e << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
import collections

N = int(input())
A = list(map(int, input().split()))

Q = int(input())

A_counter = collections.Counter(A)

sumA = sum(A)

for _ in range(Q):
    B, C = map(int, input().split())

    #Bの個数をカウントする。もし0なら0
    if A_counter[B] == 0:
        print(sumA)
    else:
        sumA =sumA - (B * A_counter[B])
        sumA = sumA + (C * A_counter[B])
        print(sumA)
        A_counter[C] = A_counter[B] + A_counter[C]  
        A_counter[B] = 0

Measured memory_bytes: 21188
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

res = 0
for i in range(N):
    res += B[A[i] - 1]

    if i >= 1 and A[i] == A[i - 1] + 1:
        res += C[A[i - 1] - 1]

print(res)


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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(b % a == 0) System.out.println(a+b);
		else System.out.println(b-a);
	}

}


Measured memory_bytes: 23764
from math import sqrt, floor
def is_prime(n):
    if n < 2: return False
    if n == 2: return True
    if n % 2 == 0: return False
    for i in range(3, floor(sqrt(n))+1, 2):
        if n % i == 0: return False
    return True

val = (lambda x: x if x % 2 != 0 or x == 2 else x + 1)(int(input()))

for i in range(val, val * 2 + 1):
    if is_prime(i):
        print(i)
        exit()



Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<map>
#include<queue>
#include<vector>
#include<set>
#include<list>
#include<cstring>
#include<cctype>
#include<cmath>
#include<bitset>
#include<cstdio>
#include<cstdlib>
#include<ctime>
using namespace std;
using ll = long long;

int main(void){
    int n,m;
    cin >> n >> m;
    
    int a[m],b[m];
    vector<int> v(n+1,0);
    for(int i = 0;i < m;i++){
        cin >> a[i] >> b[i];
        a[i]--;b[i]--;
        if(b[i] == n-1)v[a[i]]++;
    }

    bool check = false;
    for(int i = 0;i < m;i++){
        if(a[i] == 0){
            if(v[b[i]] > 0)check = true;
        }
    }
    
    if(!check)cout << "IM";
    cout << "POSSIBLE" << endl;
}

Measured memory_bytes: 5552