akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES // for C++  
#include "bits/stdc++.h"
#define NUM ((long long)1000000007)
#define int long long

using namespace std;

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

    int h, w, sum = 0;
    cin >> h >> w;
    auto v = vector<vector<char>>(h, vector<char>(w, 0));
    auto flags = vector<vector<bool>>(h, vector<bool>(w, false));
    for (size_t i = 0; i < h; i++)
    {
        for (size_t j = 0; j < w; j++)
        {
            cin >> v[i][j];
        }
    }

    // 横
    for (size_t i = 0; i < h; i++)
    {
        for (size_t j = 0; j < w - 1; j++)
        {
            if (v[i][j] == '#' && v[i][j + 1] == '#')
            {
                flags[i][j] = true;
                flags[i][j + 1] = true;
            }
        }
    }

    // 縦
    for (size_t i = 0; i < h - 1; i++)
    {
        for (size_t j = 0; j < w; j++)
        {
            if (v[i][j] == '#' && v[i + 1][j] == '#')
            {
                flags[i][j] = true;
                flags[i + 1][j] = true;
            }
        }
    }

    // 全てがtrueか確かめる
    for (size_t i = 0; i < h; i++)
    {
        for (size_t j = 0; j < w; j++)
        {
            if (v[i][j] == '#')
            {
                if (flags[i][j] == true)
                {

                }
                else
                {
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mt make_tuple
#define mp make_pair
#define pu push_back
#define INF 1e18
#define MOD 1000000007
#define EPS 1e-6
#define ll long long int
#define ld long double
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define pr(v) { for(int i=0;i<v.size();i++) { v[i]==INF? cout<<"INF " : cout<<v[i]<<" "; } cout<<endl;}
#define t1(x)                cerr<<#x<<" : "<<x<<endl
#define t2(x, y)             cerr<<#x<<" : "<<x<<" "<<#y<<" : "<<y<<endl
#define t3(x, y, z)          cerr<<#x<<" : " <<x<<" "<<#y<<" : "<<y<<" "<<#z<<" : "<<z<<endl
#define t4(a,b,c,d)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<endl
#define t5(a,b,c,d,e)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<endl
#define t6(a,b,c,d,e,f)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<" "<<#f<<" : "<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define t(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
#define _ cerr<<"here"<<endl;
#define __ {ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}

using namespace std;
template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){ return out<<"("<<a.first<<", "<<a.second<<")";}
template <int> ostream& operator<<(ostream& os, const vector<int>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { if(v[i]!=INF) os << v[i]; else os << "INF";if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { os << v[i]; ;if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 

ll min(ll x, ll y)
{
  if(x<y) return x;
  return y;
}

int main()
{
  __;
  int n,k;
  cin >> n >> k;
  vector<int> v(n+1);
  vector<ll> left(n+1,INF),right(n+1,INF);
  left[0] = 0;
  right[0] = 0;

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

  int index = 0;
  for(int i=1;i<=n;i++)
  {
    if(v[i] > 0) break;
    else index = i;
  }

  for(int i = index;i>0;i--)
  {
    // left[index-i+1] = left[index-i];
    left[index-i+1] = abs(v[i]);
  }

  for(int i=index+1;i<=n;i++)
  {
    // right[i-index] = right[i-index-1];
    right[i-index] = v[i];
  }

  // t(left,right);

  ll min1 = INF;
  min1 = min(min1,left[k]);
  min1 = min(min1,right[k]);

  for(int i=1;i<k;i++)
  {
    min1 = min(min1,2*left[i]+right[k-i]);
    min1 = min(min1,2*right[i]+left[k-i]);
  }

  cout << min1 << endl;
  return 0;
}


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

int main() {
  int N, K, S;
  cin >> N >> K;
  int a, b;
  S = 1;
  
  for (int i = 0; i < N; i++) {
    a = S * 2;
    b = S + K;
    if (a > b) {
      S += K;
    }
    else {
      S *= 2;
    }
  }
  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 n = sc.nextInt();
		String[] s = new String[n];
		for(int i = 0 ; i < n ; i++) s[i] = sc.next();
		int m = sc.nextInt();
		String[] t = new String[m];
		for(int i = 0 ; i < m ; i++) t[i] = sc.next();
		int ans = -1001001001;
		for(int i = 0 ; i < n ; i++) {
			int cnt = 0;
			for(int j = 0 ; j < n ; j++) {
				if(s[i].equals(s[j])) {
					cnt++;
				}
			}
			for(int j = 0 ; j < m ; j++) {
				if(s[i].equals(t[j])) {
					cnt--;
				}
			}
			ans = Math.max(ans, cnt);
		}
		System.out.println(Math.max(ans, 0));
	}
}


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

ll gcd(ll a,ll b){
   if(b<a) swap(a,b);
   ll r = a%b;
   while(r){
       a = b;
       b = r;
       r = a%b;
   }
   return b;
}

ll lcs(ll a,ll b){
    return a/gcd(a,b)*b;
}

ll cnt(ll a,ll b,ll d){
    return b/d - (a-1)/d;
}

int main(){
    ll a,b,c,d,l;
    cin >> a >> b >> c >> d;
    l = lcs(c,d);
    cout << (b-a+1)-(cnt(a,b,c) + cnt(a,b,d) - cnt(a,b,l)) << endl;
    return 0;
}

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

int n;
vector<int> w;
vector<vector<int>> dp;

int solve(int l, int r);

int main() {
  while(1) {
    cin >> n;
    if(n == 0) break;
    w.resize(n);
    for(int i = 0; i < n; ++i) cin >> w[i];
    dp.assign(n, vector<int>(n, -1));
    for(int i = 0; i < n; ++i) dp[i][i] = 0;
    for(int i = 0; i < n - 1; ++i)
      if(abs(w[i + 1] - w[i]) <= 1) dp[i][i + 1] = 2;
    cout << solve(0, n - 1) << endl;
  }
  return 0;
}

int solve(int l, int r) {
  if(dp[l][r] != -1) return dp[l][r];
  int ans = 0;
  for(int i = l; i < r; ++i)
    ans = max(ans, solve(l, i) + solve(i + 1, r));
  if(r - l + 1 >= 4 && solve(l + 1, r - 1) == r - l - 1 &&
     abs(w[l] - w[r]) <= 1)
    ans = r - l + 1;
  return dp[l][r] = ans;
}


Measured memory_bytes: 3256
#include <iostream>

using namespace std;

int main(){

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

    if(a>b) cout << "a > b" << endl;
    else if (a<b) cout << "a < b" << endl;
    else cout << "a == b" << endl; 

    return 0;
}


Measured memory_bytes: 3088
package main

import (
	"fmt"
	"bufio"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
    sc.Scan()
    i, e := strconv.Atoi(sc.Text())
    if e != nil {
        panic(e)
    }
    return i
}

func main() {
	sc.Split(bufio.ScanWords)
	count := nextInt()
	a := make([]int, count)
	for i := 0; i < count; i ++ {
		a[i] = nextInt()
	}
	pairCount := 0
	for index, j := range a {
		if index + 1 == a[j - 1]  && index < j {
			pairCount ++
		}
	}
	fmt.Println(pairCount)
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int x, y;
  cin >> x, cin >> y;
  for (int i = 0; i < x + 1; i++) {
    if ((2 * i) + (4 * (x - i)) == y) {
      cout << "Yes" << endl;
      return 0;
    }    
  }
  cout << "No" << endl;  
}

Measured memory_bytes: 3588
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	hs := make([]int, n)
	for i := range hs {
		fmt.Scan(&hs[i])
	}

	for i := len(hs) - 2; i >= 0; i-- {
		switch {
		case hs[i]-hs[i+1] > 1:
			fmt.Println("No")
			return
		case hs[i]-hs[i+1] == 1:
			hs[i] -= 1
		}
	}
	fmt.Println("Yes")
}


Measured memory_bytes: 5504
#include <climits>
#include <iostream>
#include <string>
#include <vector>

long solve(long n, std::vector<long>& sizes)
{
  long result = 0;
  int len = static_cast<int>(sizes.size());
  long s = LONG_MAX;
  for(int i = 0; i < len; ++i) {
    if (sizes[i] < s) {
      s = sizes[i];
      result = i + n / s;
      if (n % s) result += 1;
    } else {
      result = result + 1;
    }
  }

  return result;
}

int main()
{
  long n;
  std::vector<long> sizes(5);
  std::cin >> n;
  for (auto& s : sizes) {
    std::cin >> s;
  }

  std::cout << solve(n, sizes) << std::endl;
}


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

#define rep(l, r) for (int i = (l); i < (r); i++)

typedef long long ll;
 
using namespace std;

bool has_only_one_char(vector<char> cv) {
    set<char> cs;
    for (int i = 0; i < cv.size(); i++) {
        cs.insert(cv[i]);
    }

    return cs.size() == 1;
}

void solve() {
    int h, w;
    cin >> h >> w;

    set<int> include_black_row, include_black_col;

    char a[h][w];
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> a[i][j];
            if (a[i][j] == '#') {
                include_black_row.insert(i);
                include_black_col.insert(j);
            }
        }
    }

    bool outputed;
    for (int i = 0; i < h; i++) {
        outputed = false;
        for (int j = 0; j < w; j++) {
            if (include_black_row.find(i) != include_black_row.end() && include_black_col.find(j) != include_black_col.end()) {
                cout << a[i][j];
                outputed = true;
            }
        }
        if (outputed) cout << endl;
    }
}

int main() {
    solve();

    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 h = sc.nextInt();
		int w = sc.nextInt();
		int[][] a = new int[h][w];
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				a[i][j] = sc.nextInt();
			}
		}

		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				a[i][j] = Math.abs(a[i][j] - sc.nextInt());
			}
		}

		boolean[][][] dp = new boolean[h][w][6481];
		dp[0][0][a[0][0]] = true;

		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (i == 0 && j == 0) continue;

				for (int k = 0; k < 6481; k++) {
					if (i > 0 && dp[i - 1][j][k]) {
						dp[i][j][Math.abs(k - a[i][j])] = true;
						if (k + a[i][j] < 6481) dp[i][j][k + a[i][j]] = true;
					}

					if (j > 0 && dp[i][j - 1][k]) {
						dp[i][j][Math.abs(k - a[i][j])] = true;
						if (k + a[i][j] < 6481) dp[i][j][k + a[i][j]] = true;
					}

				}

			}
		}

		for (int i = 0; i < 6481; i++) {
			if (dp[h - 1][w - 1][i]) {
				System.out.println(i);
				return;
			}
		}
	}
}


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

int main() {
  int N;
  std::cin >> N;
  std::vector<int> as;
  for (int i = 0; i < N; ++i) {
    int a;
    std::cin >> a;
    as.push_back(a);
  }
  std::sort(as.begin(), as.end());
  int A = 0, B = 0;
  for (int i = 0; i < N; ++i) {
    if (i % 2 == 0)
      A += as[N - 1 - i];
    else
      B += as[N - 1 - i];
  }
  std::cout << A - B << std::endl;
}


Measured memory_bytes: 256
s = input()
t = input()

#contest
#son
wrap = 0
index = -1
for  i in t:
    index = s.find(i,index+1)
    if index != -1:
        continue
    wrap +=1
    index = s.find(i)
    if index ==  -1:
        print(-1)
        exit()
print(len(s)*wrap+index+1)

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

int64_t beki(int64_t n,int64_t x){
 int64_t s,ans;
  s=(n*n)%1000000007;
  ans=(s*n)%1000000007;
  return ans;}

int main() {
int64_t n,k,a;
  a=0;
  n=3;
  cin>>k;
  vector<int64_t> ans(k);
  ans.at(k-1)=1;
  for(int64_t i=k-2;i>=0;i--){
  ans.at(i)=beki(k/(i+1),3);
    for(int64_t j=1;(i+1)*j<=k;j++){
    ans.at(i)=ans.at(i)-ans.at((i+1)*j-1);
     }
    ans.at(i)=ans.at(i)+beki(k/(i+1),3);
  }
  for(int64_t i=0;i<k;i++){a=a+(i+1)*ans.at(i);
  while(a>=1000000007){a=a-1000000007;}}
  cout<<a<<endl;
}  

Measured memory_bytes: 3588
use std::io::*;
use std::str::FromStr;

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


fn main() {
    let n : i32 = read();

    for a in 0..n / 4 + 1 {
        for b in 0..n / 7 + 1 {
            if a * 4 + b * 7 == n {
                println!("Yes");
                return;
            }
        }
    }
    println!("No")
}


Measured memory_bytes: 4352
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    int N, X, ans;
    cin >> N >> X;
    vector<int> m(N);
    for(int i = 0; i < N; i++){
        cin >> m[i];
        X -= m[i];
    }
    sort(m.begin(), m.end());
    ans = N + X / m[0];
    cout << ans << endl;
}

Measured memory_bytes: 3580
n,m = map(int, input().split())
h = list(map(int, input().split()))

ans=[True] * n # true == good

for i in range(m):
    a,b = list(map(int,input().split()))
    a-=1
    b-=1
    if h[a] >= h[b]:
        ans[b]=False
    if h[a] <= h[b]:
        ans[a]=False

print(sum(ans))

Measured memory_bytes: 85052
#include<stdio.h>
int main(void) {
  int X, Y, Z;
  int store;
  scanf("%d %d %d", &X, &Y, &Z);
  store = X;
  X = Y;
  Y = store;
  store = X;
  X = Z;
  Z = store;
  printf("%d %d %d", X, Y, Z);
  return 0;
}

Measured memory_bytes: 1736
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<string>
#include<map>
#include<set>
#include<functional>
#include<list>
#include<bitset>
#include<numeric>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<int, int> p;

int main() {
	int n, x;
	cin >> n >> x;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	int ans = 0;
	int j = 0;
	while (x > 0) {
		if (j == n - 1) {
			if (x == a[j]) {
				ans++;
			}
			break;
		}
		x -= a[j];
		j++;
	//	cout << x << endl;
		if (x >= 0) {
			ans++;
		}
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <vector>
#include <queue>
#include <cstring>
#include <algorithm>

using namespace std;
const int MAX = 1e5+5;

int dp[MAX];
bool vis[MAX];
vector<int> rev[MAX];

int calc(int i) {
    if (vis[i]) {
        return dp[i];
    } else {
        dp[i] = 0;
        vis[i] = true;
        for (auto j : rev[i]) {
            dp[i] = max(dp[i], calc(j)+1);
        }
        return dp[i];
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N, M, x, y, val=0;
    cin >> N >> M;
    
    memset(dp, 0, MAX);
    memset(vis, false, MAX);
    
    for (int i=1; i<=M; i++) {
        cin >> x >> y;
        rev[y].push_back(x);
    }
    
    for (int i=1; i<=N; i++) {
        val = max(val, calc(i));
    }

    cout << val << "\n";
}


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

#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

using namespace std;

typedef long long LL;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "[ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "]";

    return os;
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    int a, b;
    cin >> a >> b;

    print((a + b) % 24);

}


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

typedef long long ll;
#define max(x, y) x>y?x:y

int getmax(int n)
{
    char s[16];
    int i, len;
    ll res=0;
    sprintf(s, "%d", n);
    len=strlen(s);

    for(i=1;i<len;++i) {
        char t=s[i];
        int x, y;
        s[i]=0;
        x=atoi(s);
        s[i]=t;
        y=atoi(s+i);
        res=max(res, (ll)x*y);
    }
    return res;
}

int main(void)
{
    int q;
    scanf("%d", &q);
    while (q--) {
        int n, res;
        scanf("%d", &n);
        res=0;
        while (n>=10) {
            n=getmax(n);
            ++res;
        }
        printf("%d\n", res);
    }
    return 0;
}

Measured memory_bytes: 608
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using intpair=pair<int,int>;
using llpair=pair<ll,ll>;
using llvec=vector<ll>;
using llmat=vector<vector<ll>>;
#define PI 3.141592653589793
#define llmattp(name,a,b,num) name(a,vector<ll>(b,num))
#define INTINF 1<<30
#define LLINF 1LL<<60
#define ABS(x) ( (x)>0 ? (x) : -(x) )
#define gsort(vbeg,vend) sort(vbeg,vend,greater<>())

template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

ll gcd(ll a, ll b) { //最大公約数
	if(a==0||b==0) return 0;
	if(a<b) swap(a,b);
	ll tmp = a%b;
	while(tmp!=0) {
		a = b;
		b = tmp;
		tmp = a%b;
	}
	return b;
}

ll factorial(ll x) { //階乗
	ll f=1;
	for(ll i=2; i<x; i++) {
		f*=i;
	}
	return f;
}

ll nPr(ll n, ll r) {
	ll result=1;
	for(ll i=r+1; i<=n; i++) result*=i;
	return result;
}

ll nCr(ll n, ll r) {
	if (n == r) { return 1; }
	if (r > n) { return 0; }

	if (r > n / 2) { r = n - r; }

	if (n == 0) { return 0; }
	if (r == 0) { return 1; }
	if (r == 1) { return n; }

	double result = 1;
	for (double i = 1; i <= r; i++) {
		result *= (n - i + 1) / i;
	}

	return (ll)result;
}

ll GreaterBinarySearch(ll *array, ll key, ll max, ll min) { //にぶたんgreater
	if(array[max]<array[min]) {
		return NULL;
	} else {
		ll mid = max + (min-max)/2;
		if(array[mid]<key) {
			return GreaterBinarySearch(array,key,max,mid-1);
		} if(array[mid]>key) {
			return GreaterBinarySearch(array,key,mid+1,min);
		} else {
			return mid;
		}
	}
}

int DigitNum(ll n) { //桁数
	int digit=0;
	ll wari=1LL;
	while(n/wari) {
		digit++;
		wari*=10;
	}
	return digit;
}

bool IsPrime(ll num) { //素数判定
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

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

	// 素数である
	return true;
}

vector<ll> Divisor(ll x) { // 約数列挙
	vector<ll> result;
	ll i=1LL;
	for( ; i*i<x; i++) {
		if(x%i) continue;
		result.push_back(i);
		result.push_back(x/i);
	}
	if(i*i==x&&x%i==0)
		result.push_back(i);
	
	sort(result.begin(),result.end());
	return result;
}

vector<llpair> PrimeFact(ll x) { // 素因数分解 {素因数,指数}
	vector<llpair> result;
	ll ex=0LL;
	if(x%2==0) {
		while(x%2==0) {
			x/=2;
			ex++;
		}
		result.push_back({2,ex});
	}

	for(ll i=3LL; i*i<=x; i+=2) {
		if(x%i) continue;

		ex=0LL;
		while(x%i==0) {
			x/=i;
			ex++;
		}
		result.push_back({i,ex});
	}

	if(x!=1) result.push_back({x,1});

	return result;
}

bool Palind(string s) { //回文判定
	return s == string(s.rbegin(), s.rend());
}

struct Node{
	vector<int> next;
	int prev;
	ll cnt;
};

int main() {
	int N; cin>>N;
	int Anum[N+1]; for(int i=0; i<N+1; i++) Anum[i]=0;

	int rmv=0;
	for(int i=0; i<N; i++) {
		int A; cin>>A;
		if(A>N) rmv++;
		else    Anum[A]++;
	}
	for(int i=1; i<N+1; i++) {
		if(Anum[i]<i)
			rmv+=Anum[i];
		else
			rmv+=Anum[i]-i;
	}

	cout<<rmv<<endl;
}


Measured memory_bytes: 640
N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=[i for i in input()]
H=[]
sum=0
if N<=K:
    for i in T:
        if i=="r":
            sum+=P
        elif i=="s":
            sum+=R
        else:
            sum+=S
else:
    for i in range(K):
        if T[i]=="r":
            H.append("p")
            sum+=P
        elif T[i]=="s":
            H.append("r")
            sum+=R
        else:
            H.append("s")
            sum+=S
    for i in range(K,N):
        if T[i]=="r" and H[i-K]=="p":
            if (i+K)<N and T[i+K]=="p":
                H.append("r")
            else:
                H.append("s")
            
        elif T[i]=="r":
            H.append("p")
            sum+=P
        elif T[i]=="s" and H[i-K]=="r":
            if (i+K)<N and T[i+K]=="r":
                H.append("s")
            else:    
                H.append("p")
        elif T[i]=="s":
            H.append("r")
            sum+=R
        elif T[i]=="p" and H[i-K]=="s":
            if (i+K)<N and T[i+K]=="s":
                H.append("p")
            else:    
                H.append("r")
        elif T[i]=="p":
            H.append("s")
            sum+=S
print(sum)            

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

int N;
LL X, D[60];

LL f(int lv, LL k){
    if (k <= 0) return 0;
    LL r = (D[lv] - 1) / 2;
    if (k >= D[lv]) return (1ll << (lv+1)) - 1;
    if (k <= r) return f(lv-1, k-1);
    if (k == r+1) return 1ll << lv;
    return (1ll << lv) + f(lv-1, k-r-1);
}

int main(){
    scanf("%d %lld", &N, &X);
    D[0] = 1;
    for (int i=1; i<=N; i++) D[i] = 2*D[i-1] + 3;
    printf("%lld\n", f(N, X));
    return 0;
}


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

using namespace std;

int main()
{
    ///{}
    int d,t,s;
    cin>>d>>t>>s;
    if((double)d/(double)s<=(double)t)
    cout << "Yes" << endl;
    else
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3620
N,X = map(int,input().split())
L = list(map(int,input().split()))
tmp = 0
for i in range(N):
  tmp = tmp + L.pop(0)
  if(tmp == X):
    print(str(i + 2))
    exit()
  elif(tmp > X):
    print(str(i + 1))
    exit()
  else:
    pass
if(i + 1 == N):
  print(str(N + 1))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    ll N, K;
    cin >> N >> K;

    ll tmp = N % K;
    cout << min(tmp, abs(K - tmp)) << endl;
    return 0;
}

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

#define ll long long
#define value(x) cout<<#x<<" "<<x<<'\n';
#define print_vec(vec) for(auto x: vec) cout<<x<<" "; \
                        cout<<endl;

void solve()
{
	int n, k;
	cin >> n >> k;
	vector<int> v(n);
	for (int i = 0; i < n; i++)
		cin >> v[i];
	// print_vec(v);
	sort(v.begin(), v.end());
	int sum = 0;
	for (int i = 0; i < k; i++) {
		sum += v[i];
	}
	cout << sum << '\n';
}

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


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

int main()
{
    string s;
    cin>>s;
    sort(s.begin(),s.end());
    if(s[0]==s[1]&&s[2]==s[3]&&s[1]!=s[2])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    static char[][]grid = new char[1000][1000];
    static int[][]dp = new int[1000][1000];
    static int H, W;
    static int MOD = 1000000007;
    public static void main(String[]args){
        Scanner in = new Scanner(System.in);
        H = in.nextInt();
        W = in.nextInt();
        in.nextLine();
        for(int i = 0 ; i < H ; ++i){
            char[]g = in.nextLine().toCharArray();
            for(int j = 0 ; j < W ; ++j){
                grid[i][j] = g[j];
            }

        }
        solve();
        System.out.println(dp[H-1][W-1]);
    }

    private static void solve() {
        dp[0][1] = grid[0][1] != '#' ? 1 : 0;
        dp[1][0] = grid[1][0] != '#' ? 1 : 0;
        for(int j = 2 ; j < W ; ++j){
            if(grid[0][j]=='#')
                    continue;
            dp[0][j] = dp[0][j-1] != 0 ? 1 : 0;
        }
        for(int i = 2 ; i < H ; ++i){
            if(grid[i][0]=='#')
                    continue;
            dp[i][0] = dp[i-1][0] != 0 ? 1 : 0;
        }
        for(int i = 1 ; i < H ; ++i){
            for(int j = 1 ; j < W ; ++j){
                if(grid[i][j]=='#')
                    continue;
                dp[i][j] = (dp[i][j-1]+dp[i-1][j]) % MOD;
            }
        }
    }
}

Measured memory_bytes: 52008
import sys
# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===
def main():
    n = ni()
    a = na()
    q = ni()

    cnt = collections.Counter(a)

    total = sum(a)
    for _ in range(q):
        b, c = ns()

        if c in cnt.keys():
            cnt[c] += cnt[b]
        else:
            cnt[c] = cnt[b]
        total += (c - b) * cnt[b]
        cnt[b] = 0

        print(total)

if __name__ == '__main__':
    main()


Measured memory_bytes: 24924
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;

ll rep_pow(ll a, ll b){//繰り返し2乗法
    if(b==0) return 1;
    else if(b%2==0){
        ll memo = rep_pow(a, b/2);
        return memo*memo%mod;
    }else{
        return rep_pow(a, b-1)*a%mod;
    }
}

ll nCr(ll n, ll r){//mod逆元使ったnCr
    ll ret=1;
    rep(i,r){
        ret *= n-i;//分子
        ret %= mod;
        ret *=rep_pow(r-i, mod-2);//mod逆元によりr!で割ると同値
        ret %= mod;
    }
    return ret;
}
ll gcd(ll a, ll b){ if(b==0) return a; return gcd(b, a%b);}



int main(){
    fast_io

    string s;
    cin>>s;
    int n=s.size();
    int n0=0;
    int n1=0;
    rep(i,n){
        if(s[i]=='0') n0++;
        else n1++;
    }

    cout<<2*min(n0, n1)<<endl;

    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
//#define MOD 1000000007
#define INF 1000000000

#define MOD 998244353

void solve_zenkoku2_b() {
	ll N, ans;
	cin >> N;

	vector<ll> dist(100001, -1);
	ll D;
	rep(i, N) {
		cin >> D;
		if (i == 0 && D != 0) {
			ans = 0;
			cout << ans << "\n";
			return;
		}
		if (dist[D] == -1) {
			dist[D] = 1;
		}
		else {
			dist[D]++;
		}
	}

	ll prev;
	bool is_departed = false;
	if (dist[0] != 1) {
		ans = 0;
	}
	else {
		ans = 1;
		prev = 1;
		rep2(i, 1, 100001) {
			if (dist[i] != -1) {
				if (is_departed) {
					ans = 0;
					break;
				}
				rep(j, dist[i]) {
					ans *= prev;
					ans %= MOD;
				}
				prev = dist[i];
			}
			else {
				is_departed = true;
			}
		}
	}

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

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

	solve_zenkoku2_b();

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <cstring>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <fstream>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>

int main() {
	ll n;
	string s;
	ll ans = 0;
	cin >> n >> s;
	REP(i, s.size() - 2) {
		if (s[i] == 'A' and s[i + 1] == 'B' and s[i + 2] == 'C')ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
int ans=0,n,m,i,j,k,a[55][55],b[55][5],max=200000000;
char s;
scanf("%d %d\n",&n,&m);
for(i=0;i<52;i++){
for(j=0;j<4;j++){
b[i][j]=0;
}
}
for(i=0;i<n;i++){
for(j=0;j<m;j++){
scanf("%c\n",&s);
if(s=='W'){
a[i][j]=0;
}
else if(s=='B'){
a[i][j]=1;
}
else{
a[i][j]=2;
}
}
scanf("\n");
}
for(i=0;i<n;i++){
for(j=0;j<m;j++){
if(a[i][j]==0){
b[i][0]++;
}
else if(a[i][j]==1){
b[i][1]++;
}
else{
b[i][2]++;
}
}
}
for(j=1;j<n;j++){
for(k=j+1;k<n;k++){
for(i=0;i<j;i++){
ans=ans+(m-b[i][0]);
}
for(i=j;i<k;i++){
ans=ans+(m-b[i][1]);
}
for(i=k;i<n;i++){
ans=ans+(m-b[i][2]);
}
if(ans<max){
max=ans;
}
ans=0;
}
}
printf("%d\n",max);
return 0;
}


Measured memory_bytes: 2092
A = input ()
B = input ()
C = input ()
X,Y,Z = 0,0,0
P = A
Q = X
while True:
  if len(P)==Q:
    if P==A:
      print ('A')
    elif P==B:
      print ('B')
    else:
      print ('C')
    break
  if P==A:
    X += 1
  elif P==B:
    Y += 1
  else:
    Z += 1
  if P[Q]=='a':
    P = A
    Q = X
  elif P[Q]=='b':
    P = B
    Q = Y
  else:
    P = C
    Q = Z

Measured memory_bytes: 8844
//==========//============================================================================
// Name        : Hello5.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <vector>
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using p = pair<int,int>;//<key,value>


int main() {
int n;
cin>>n;
int maxl=0;
int sum=0;
vector<int>l(n);
rep(i,n) cin>>l[i];
rep(i,n){
sum+=l[i];
}

rep(i,n)
maxl=max(maxl,l[i]);


if(maxl<sum-maxl)
	{cout<<"Yes"<<endl;
	}
else
cout<<"No"<<endl;
return 0;
}







Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;

const int M=3005;

int n,t;
struct Node
{
	int a,b;
	void read()
	{
		scanf("%d%d",&a,&b);
	}
	bool operator<(const Node &B) const
	{
		return a<B.a;
	}
}node[M];
int dp[M];

int main()
{
	scanf("%d%d",&n,&t);
	for(int i=0;i<n;i++)
		node[i].read();
	sort(node,node+n);
	for(int i=0;i<n;i++)
	{
		for(int j=t-1;j>=max(t-node[i].a,0);j--)
			dp[t]=max(dp[t],dp[j]+node[i].b);
		for(int j=t-1;j>=node[i].a;j--)
			dp[j]=max(dp[j],dp[j-node[i].a]+node[i].b);
	}
	printf("%d\n",dp[t]);
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
#include<vector>
using namespace std;
int main() {
	int a;	cin >> a;
	if (a == 1) {
		cout << "Hello World" << endl;
		return 0;
	}
	int b, c;	cin >> b >> c;
	cout << b + c << endl;

	cin >> a;
}

Measured memory_bytes: 764
# coding: utf-8

import sys
import math
import collections
import itertools
import bisect
INF = 10 ** 13
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def lcm(x, y) : return (x * y) // math.gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def LS() : return input().split()
def RS(N) : return [input() for _ in range(N)]
def LRS(N) : return [input().split() for _ in range(N)]
def PL(L) : print(*L, sep="\n")
def YesNo(B) : print("Yes" if B else "No")
def YESNO(B) : print("YES" if B else "NO")

def divisor(N):
    res = []

    for i in range(1, int(math.sqrt(N)) + 1):
        if N % i != 0:
            continue

        res.append(i)
        if i * i != N:
            res.append(N/i)
    
    return res

N = I()

ans = 0
for x in divisor(N):
    if x == 1:
        continue
    
    tmp = N
    while tmp % x == 0:
        tmp /= x
    tmp %= x

    if tmp == 1:
        ans += 1

ans += len(divisor(N-1)) - 1

print(ans)


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

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define rep(i, n) for(int i=0;i<(int)(n);i++)

int main(void){
	int r;
	scanf("%d",&r);
	printf("%d",r*r);
    return 0; 
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define int long long
int a[314514];
using namespace std;
signed main(){
    int n;
    cin>>n;
    for(int i=0;i<n*3;i++){
        cin>>a[i];
    }
    sort(a,a+n*3);
    reverse(a,a+n*3);
    int ans=0;
    for(int i=1;i<2*n;i+=2){
        ans+=a[i];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 2560
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <set>

using namespace std;

#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define pb push_back
#define mp make_pair
#define fs first
#define sc second

typedef long long ll;

int main() {
    string s;
    cin >> s;
    int n = s.size();
    if (n % 2 == 0) {
        int ans = 0;
        while (ans < n / 2) {
            if (s[n / 2 + ans] != s[n / 2] || s[n / 2 - 1 - ans] != s[n / 2]) {
                break;
            }
            ++ans;
        }
        cout << n / 2 + ans << endl;
    } else {
        int ans = 0;
        while (ans < n / 2) {
            if (s[n / 2 + 1 + ans] != s[n / 2] || s[n / 2 - 1 - ans] != s[n / 2]) {
                break;
            }
            ++ans;
        }
        cout << n / 2 + 1 + ans << endl;
    }
    return 0;
}


Measured memory_bytes: 512
S=input()
if (S=="SUN"):
    print(7)
elif (S=="MON"):
    print(6)
elif (S=="TUE"):
    print(5)
elif (S=="WED"):
    print(4)
elif (S=="THU"):
    print(3)
elif (S=="FRI"):
    print(2)
elif (S=="SAT"):
    print(1)

Measured memory_bytes: 38384
#include <iostream>

using namespace std;

int main () {
	long long N, T, a, prev;
	long long ans = 0;
	cin >> N >> T >> prev;
	while (cin >> a) {
		if (a - prev >= T) {
			ans += T;
		} else {
			ans += a - prev;
		}
		prev = a;
	}
	cout << ans + T << endl;
}


Measured memory_bytes: 256
// The moment you think of giving up you have already lost the battle
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long int ll;
typedef long double dl;
#define PI  3.14159265358979323846
#define Mod 1000000007
ll fast(ll n,ll a,ll m)
{
    if(n==0)
        return 1;
    else if(n==1)
        return a;
    else
    {
        ll r=fast(n/2,a,m);
        if(n%2==0)
        {
            return (((r%m)*(r%m))%m);
        }
        else
        {
            return (((((r%m)*a)%m)*r)%m);
        }
    }
}

int main()
{
  ll n,K;
  cin>>n>>K;
  ll a[n];
  ll i,j;
  for(i=0;i<n;i++)
  {
      cin>>a[i];
  }
  ll dp[n+1][K+1],pref[n+1][K+1];
  memset(pref,0,sizeof(pref));
  memset(dp,0,sizeof(dp));
  for(i=0;i<=a[0];i++)
  {
      dp[1][i]=1;
  }
  pref[1][0]=dp[1][0];
  for(i=1;i<=K;i++)
  {
      pref[1][i]=(pref[1][i-1]%Mod+dp[1][i]%Mod)%Mod;
  }
  for(i=2;i<=n;i++)
  {
      dp[i][0]=dp[i-1][0]%Mod;
      for(j=1;j<=K;j++)
      {
          ll u=j-a[i-1];
          if(u<=0)
          dp[i][j]=pref[i-1][j];
          else
          dp[i][j]=pref[i-1][j]-pref[i-1][u-1];

          if(dp[i][j]<0)
          {
              dp[i][j]+=Mod;
              dp[i][j]%=Mod;
          }


      }

      pref[i][0]=dp[i][0]%Mod;
      for(j=1;j<=K;j++)
        pref[i][j]=(pref[i][j-1]%Mod+dp[i][j]%Mod)%Mod;
  }
  cout<<dp[n][K];



}


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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(lol i=0;i<lol(n);i++)
#define REPD(i,n) for(lol i=n-1;i>=0;i--)
#define FOR(i,a,b) for(lol i=a;i<=lol(b);i++)
#define FORD(i,a,b) for(lol i=a;i>=lol(b);i--)
#define VL vector<lol>
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) lol(x.size()) //sizeをsize_tからllに直しておく
//定数
#define PI 3.1415926535897932385 //pi
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//最大値最小値
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main()
{
    string s, t; cin >> s >> t;
    int a, b; cin >> a >> b;
    string u; cin >> u;
    map<string, int> ma;
    ma[s] = a; ma[t] = b;
    ma[u]--;

    cout << ma[s] << " " << ma[t] << endl;
    return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define ll long long

using namespace std;

ll dp[101][100002] = {0};
ll cost[101][2];

int main(){
    ios::sync_with_stdio(0); cin.tie();
    int N, W,tmp,a,b;
    cin >> N >> W;
    for(int i = 0 ; i < N ; i ++){
        cin >> a >> b;
        cost[i][0] = a;
        cost[i][1] = b;
    }
    for(int i =  0 ; i < W+1 ; i++ ){
    if( i  < cost[0][0]) dp[0][i] = 0; 
    else{
        dp[0][i] = cost[0][1];
    }
    }
    for(int i = 1 ; i < N ; i ++ ){
        for(int j = 0 ; j < W+1 ; j++){
            
            if( j >= cost[i][0] ) dp[i][j] =  max( dp[i-1][j] , dp[i-1][j - cost[i][0]] + cost[i][1]  );
            else{
                dp[i][j] = dp[i-1][j];
                //cout << i << " " << j << " " << dp[i-1][j] << " " << dp[i-1][j- cost[i][0]] + cost[i][1] << endl;
            } 
        }
    }
    //cout << dp[N-1][W-1] << endl;
    /*for(int i = 0 ; i < N ; i++){
        for(int j = 0 ; j  < W+1; j++){
            cout << dp[i][j] << " ";
        }
        cout << "\n";
    }*/
    cout << dp[N-1][W];
}

Measured memory_bytes: 78336
# -*- coding: utf-8 -*-

def main():

    A, B, C = map(int, input().split())

    if A == B and A != C or A == C and A != B or B == C and A != B:
        ans = 'Yes'

    else:
        ans = 'No'

    print(ans)


if __name__ == "__main__":
    main()

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

int main() {

	int N, max = 0, m = 0, n;
	cin >> N;
	vector<int> a(N);
	for (int i = 0; i < N;i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	max = a[N - 1];
	n = max / 2;
	m = a[0];
	for (int i = 1; i < N - 1; i++) {
		if (a[i] < n) {
			m = a[i];
		}
		else if (a[i] == n) {
			m = a[i];
			break;
		}
		else {
			if (abs(n - m) >= abs(n - a[i])) {
				m = a[i];
				break;
			}
		}
	}
	cout << max << " " << m << endl;


	return 0;
}

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

int main(){
    int x,y;
    int i=1;
    cin >> x >> y;
    if(x%y==0){
        cout << -1 << endl;
    }else{
        while((x*i)%y==0){
            i++;
        }
        cout << x*i << endl;
    }
    
    
    
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long dp[50];
long long fib(int n){
if (n<=1) return 1;
if (dp[n]) return dp[n];
return dp[n]=fib(n-1)+fib(n-2);
}
int main(){
int n; cin>>n; cout<<fib(n)<<endl;
}


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

int main(){
    int N;
    cin>>N;
    int en;
    en=N%10;
    if(en==3){
        cout<<"bon"<<endl;
    }
    else if(en==0 || en==1 || en==6 || en==8 ){
        cout<<"pon"<<endl;
    }
    else{
        cout<<"hon"<<endl;
    }
}

Measured memory_bytes: 3636
#include <cstdlib>
#include <iostream>

using namespace std;

int main(){
    int day = 0;
    int coin = 0;
    int a,b,c;
    cin >> a >> b >> c;


    while(coin < c){
        day ++;
        coin += a;
        if(day % 7 == 0){
            coin += b;
        }
    }

    cout << day << endl;

    return 0;
}


Measured memory_bytes: 3108
n,k = map(int,input().split())
a = list(map(int,input().split()))
t = input()
dp = [[0]*n for _ in range(3)]
for i in range(k):
    if t[i] == 'r':
        dp[2][i] = a[2]
    if t[i] == 's':
        dp[0][i] = a[0]
    if t[i] == 'p':
        dp[1][i] = a[1]
for i in range(k,n):
    id = -1
    if t[i] == 'r':
        id = 2
    if t[i] == 's':
        id = 0
    if t[i] == 'p':
        id = 1
    for x in range(3):
        for y in range(3):
            if x == y:
                continue
            if x == id:
                dp[x][i] = max(dp[x][i], dp[y][i-k] + a[x])
            else:
                dp[x][i] = max(dp[x][i], dp[y][i-k])

ans = 0
for i in range(k):
    ans += max(dp[0][n-1-i], dp[1][n-1-i], dp[2][n-1-i])
print(ans)

Measured memory_bytes: 8820
def _input():
    n = int(input())
    return n

def probability(number):
    odd = 0
    for i in range(1,number + 1):
        if i % 2 == 1:
            odd += 1
    return round(odd / number, 6)

if __name__ == "__main__":
    number = _input()
    print('{:.9f}'.format(probability(number)))
    
    

Measured memory_bytes: 2940
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>

using namespace std;

int main(){
	int N;
  	cin >> N;
  	priority_queue<float, vector<float>, greater<float> > v;
  	for(int i = 0; i < N; i++){
    	float a;	
    	cin >> a;
      	v.push(a);
    }
  	while(v.size() > 1){
    	float b = v.top();
      	v.pop();
      	float c = v.top();
      	v.pop();
      	v.push((b+c)/2);
    }
  	float ans = v.top();
  	cout << ans << endl;
}

Measured memory_bytes: 256
#ifdef BUILT_LOCAL

#include "niklib.h"

#endif

#include <iostream>
#include <utility>
#include <numeric>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <cstdio>
#include <map>
#include <cmath>
#include <set>
#include <list>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef __int128 lll;
constexpr ll mod = 1000000007;

#define bs(n) (1ull<<(ull)(n))
#define rep(i, n) for(ll (i) = 0;(i) < (n);(i)++)

int main() {
    int n;
    cin >> n;
    int d[3];
    rep(i, 3) {
        d[i] = n % 10;
        n /= 10;
        if (d[i] == 7) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int K = sc.nextInt();
		int[] A = new int[N];
		long[] SA = new long[N+1];
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
			SA[i+1] = SA[i] + A[i];
		}
		int[] B = new int[M];
		long[] SB = new long[M+1];
		for(int i = 0; i < M; i++) {
			B[i] = sc.nextInt();
			SB[i+1] = SB[i] + B[i];
		}
		int ans = 0;
		for(int i = 0; i <= N; i++) {
			long c = K - SA[i];
			if(c < 0)
				break;
			int lb = -1, ub = M+1, mid;
			while(lb + 1 < ub) {
				mid = (lb + ub) / 2;
				if(SB[mid] > c)
					ub = mid;
				else
					lb = mid;
			}
			ans = Math.max(ans, lb + i);
		}
		System.out.println(ans);
	}

}

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

using namespace std;

const int N = 105;

int cnt[26];
char s[N][N];
bool done[N][N];

int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%s", s[i]);
    for (int j = 0; j < m; j++) {
      cnt[s[i][j] - 'a']++;
    }
  }
  vector<int> need;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (done[i][j]) continue;
      done[i][j] = 1;
      done[n - i - 1][j] = 1;
      done[i][m - j - 1] = 1;
      done[n - i - 1][m - j - 1] = 1;
      
      set<pair<int, int>> s;
      
      s.insert({i, j});
      s.insert({n - i - 1, j});
      s.insert({i, m - j - 1});
      s.insert({n - 1 - i, m - 1 - j});
      need.push_back(s.size());
      
      //for (auto it : s) printf("%d %d\n", it.first, it.second); printf("\n");
    }
  }
  priority_queue<int> pq;
  for (int i = 0; i < 26; i++) {
    pq.push(cnt[i]);
  }
  sort(need.begin(), need.end());
  reverse(need.begin(), need.end());
  //for (auto it : need) printf("%d ", it); printf("\n");
  for (auto it : need) {
    int now = pq.top();
    pq.pop();
    if (it > now) {
      puts("No");
      return 0;
    }
    pq.push(now - it);
  }
  puts("Yes");
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <assert.h>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main(){
  string s;
  cin>>s;
  ll flag = 0;
  rep(i,0,s.sz){
    if(s[i]=='7')flag = 1;
  }
  if(flag==1){
      cout << "Yes" << endl;
  }
  else{
      cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3624
/**
 * ????????¢?????¨?????¨

?????? r ???????????¢?????¨?????¨?????????????±???????????????°?????????????????????????????????

Input
??????????????° r ????????????????????????

Output
??¢?????¨?????¨?????????????????????????????§????????£????????????????????????????????????????????????????°???°?????°??¨??????0.00001
??\???????????????????????§?????????????????¨????????????

Constraints
0 < r < 10,000
Sample Input
2
Sample Output
12.566371 12.566371
 */

#include <iomanip>
#include <iostream>
#include <sstream>
#include <cmath>

int main(int argc, char const *argv[]) {
  double r = 1;
  const static long double Pi = std::atan((long double)INFINITY) * 2;

  while (true) {
    std::string Param;

    getline(std::cin, Param);
    std::istringstream iss(Param);
    iss >> r;

    if (r > 10000) {
      std::cout << "Error: 0 < r < 10000" << std::endl;
    } else {
      break;
    }
  }

  std::cout << std::fixed << std::setprecision(6) << r * r * Pi << " " << r * 2 * Pi << std::endl;

  return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <sstream>
#include <math.h>
#include <queue>
#include <map>
#include <set>
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;


int main(){
long long N,A,B;
cin>>N>>A>>B;
long long ans,odd;
ans=N/(A+B);
odd=N%(A+B);
long long result=0;
result=min(A,odd);
cout<<result+ans*A<<"\n";
return 0;
}

Measured memory_bytes: 256
N = int(input())
accepts = [1, 6, 9, 36, 81, 216, 729, 1296, 6561, 7776, 46656, 59049]
m = [float("inf") for _ in range(200000+1)]
m[0] = 0

for i in range(N+1):
    for j in accepts:
        if m[i] + 1 < m[i+j]:
            m[i+j] = m[i] + 1

print(m[N])

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

namespace Program
{
    class Ex2
    {
        public static void Main()
        {
            var num = int.Parse(Console.ReadLine());
            var rests = new List<Restaurant>();
            
            for (int i = 1; i <= num; i++)
            {
                var cont = Console.ReadLine();
                var split = cont.Split(' ');
                rests.Add(new Restaurant() { City = split[0], Point = int.Parse(split[1]), Index = i});
            }
            
            foreach (var rest in rests.OrderBy(e => e.City).ThenByDescending(e => e.Point))
                Console.WriteLine(rest.Index);
        }
        
		class Restaurant
        {
            public string City { get; set; }
            public int Point { get; set; }
            public int Index { get; set; }
        }
    }
}

Measured memory_bytes: 11604
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;

int main() {
    string s;
    cin >> s;
    if (s.at(0) == s.at(1) && s.at(1) == s.at(2)) {
        cout << "No" << endl;
    }
    else {
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 3608