akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char>cvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
bool exprime(int x){
  if(x<2) return false;
  for(int i=2;i*i<=x;i++){
    if(x%i==0) return false;
  }
  return true;
}
int main()	{
  int x;
  cin>>x;
  bool ex=false;
  for(int i=x;;i++){
    ex=exprime(i);
    if(ex==true){
      cout<<i<<endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define maxn 100005
#define ll long long
#define ld double
#define mod 998244353
using namespace std;
int num[maxn];
int a[maxn], b[maxn];
int main()
{
	int n;
	scanf("%d", &n);
	ll s = 0;
	for(int i = 0; i < n; i++)
		scanf("%d", &a[i]), s += a[i];
	int ncnt = 0;
	for(int i = 0; i < n; i++)
	{
		scanf("%d", &b[i]);
		if(b[i] <= a[i]) num[ncnt++] = a[i] - b[i];
		s -= b[i];
	}
	if(s < 0)
	{
		printf("-1\n");
		return 0;
	}
	sort(num, num + ncnt);
	num[ncnt] = 1;
	for(int i = 0; i <= ncnt; i++)
		if(s >= num[i])
			s -= num[i];
		else
		{
			printf("%d\n", n - i);
			return 0;
		}
	return 0;
 } 

Measured memory_bytes: 1408
macro_rules! get {
      ($t:ty) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.trim().parse::<$t>().unwrap()
          }
      };
      ($($t:ty),*) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              let mut iter = line.split_whitespace();
              (
                  $(iter.next().unwrap().parse::<$t>().unwrap(),)*
              )
          }
      };
      ($t:ty; $n:expr) => {
          (0..$n).map(|_|
              get!($t)
          ).collect::<Vec<_>>()
      };
      ($($t:ty),*; $n:expr) => {
          (0..$n).map(|_|
              get!($($t),*)
          ).collect::<Vec<_>>()
      };
      ($t:ty ;;) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.split_whitespace()
                  .map(|t| t.parse::<$t>().unwrap())
                  .collect::<Vec<_>>()
          }
      };
      ($t:ty ;; $n:expr) => {
          (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
      };
}

fn main() {
    // 入力
    let N = get!(i64);
    let S = get!(String).chars().collect::<Vec<_>>();
    let K = get!(usize);

    let p = S[K - 1];
    let ans = S.into_iter().map(|c| if c != p { '*' } else { c })
        .collect::<String>();

    // 出力
    println!("{}", ans);
}


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

int main() {
    int N; cin>>N;
    vector<ll>a(N);
    rep(i,N)cin>>a[i];
    deque<ll>d;
    d.push_front(a[0]);
    if(N%2!=0){
    for(int i=1;i<N;i++){
        if(i%2!=0)d.push_back(a[i]); 
        else d.push_front(a[i]);
    }
    }
    else {
         for(int i=1;i<N;i++){
        if(i%2==0)d.push_back(a[i]); 
        else d.push_front(a[i]);
    }
    }

    rep(i,N){
        cout<<d[i]<<" ";
    }
    cout<<endl;
}

Measured memory_bytes: 5376
import java.util.Scanner;
class Main
{
   public static void main(String[] args)
  	{
  	Scanner sc = new Scanner(System.in);
    	
    	while(true){
    	int n=0;
    	int H = sc.nextInt();
    	int W = sc.nextInt();
    	if(H==0 && W==0)break;
   	
    	for(int i = 0; i<H; i++){
       	for(int j = 0; j<W; j++){
          	if((i+j)%2==0)System.out.print("#");
          	else System.out.print(".");
       	}
       	System.out.println();     	
    	}
    	System.out.println();
}
}
}



Measured memory_bytes: 34748
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

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 H,W;
string S;

int main(){
    cin>>H>>W;
    rep(i,H){
        cin>>S;
        out(S);
        out(S);
    }
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int n,A,B;
	scanf("%d%d%d",&n,&A,&B);
	if(A>B){puts("0");return 0;}
	if(n==1){printf("%d\n",A==B);return 0;}
	long long s=(n-1)*1ll*A+B,t=(n-1)*1ll*B+A;
	printf("%lld\n",t-s+1);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int MAXN = 2001;
bitset<MAXN * MAXN> dp;

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<int> q(n);
    for(int i = 0; i < n; i++){
        cin >> q[i];
    }
    dp[0] = 1;
    for(int j = 0; j < n; j++){
        dp |= (dp << q[j]);
    }
    vector<int> all;
    for(int i = 1; i < n * MAXN; i++){
        if(dp[i]) all.push_back(i);
    }
    cout << all[(all.size() - 1) / 2];
    return 0;
}


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

int main(){
    int a,b,c,x;
    cin>>a>>b>>c>>x;
    int cnt=0;
    for(int i=0;i<=a;i++){
        for(int j=0;j<=b;j++){
            int k=(x-(500*i+100*j))/50;
            if(k>=0 and k<=c){
                cnt++;
            }
        }
    }
    cout<<cnt;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
long mod = (long) 1e9 + 7;
long factorials[500001];

int pre_factorials(int n){

    factorials[0] = 1;

    for (int i = 0; i < n; i++) {
        factorials[i + 1] = (long)(i + 1) * factorials[i] % mod;
    }
    
    return 0;
}

long modpow(long a, long p){
    
    if (p == 0) return 1;
    
    if (p % 2 == 0) {
        return modpow(a * a % mod, p / 2);
    
    } else
        return a * modpow(a, p - 1) % mod;
}

long comb(long a, long b){

    long af = factorials[(int) a];
    long bf = factorials[(int) b];
    long abf = factorials[(int) (a - b)];
    long res = af * modpow(bf, mod - 2) % mod * modpow(abf, mod - 2) % mod;
    return res;
}

int main(){
    
    long s, ans = 0;
    cin >> s;
    
    long t = s / 3;
    pre_factorials(10000);
    
    for(long i = 1; i <= t; i++){
        ans += comb(s - 2 * i - 1, i - 1);
        ans %= mod;
    }
    
    cout << ans << "\n";
    
    return 0;
}



Measured memory_bytes: 3268
/**************************
*                         *
*  Nothing Is Impossible  *
*                         *
**************************/
#include <algorithm>
#include <pthread.h>
#include <iostream>
#include <fstream>
#include <ctype.h>
#include <string>
#include <vector>
#include <thread>
#include <math.h>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#define GetRand(Min, Max) ((rand()%(int)(((Max) + 1)-(Min))) + (Min))
#define Rep(i, min, max) for(int i = min; i < max; ++i)
#define PB push_back
#define MP make_pair
typedef long long ll;
typedef long double ld;
using namespace std;

int main()
{
    ios::sync_with_stdio(NULL);
    cin.tie(NULL); cout.tie(NULL);
    int n,m;    cin >> n >> m;
    int ans = (n*(n-1))/2;
    ans += (m*(m-1))/2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# Shiritori

n = int(input().strip())
ws = []
w = None
ret = 'Yes'
for i in range(n):
    w_ = input().strip()
    if w_ in ws:
        ret = 'No'
    else:
        ws.append(w_)
    if w is None:
        w = w_
        continue
    if w[-1] != w_[0]:
        ret = 'No'
    w = w_
print(ret)


Measured memory_bytes: 3060
#include<stdio.h>
#include<math.h>
int main()
{
    double x1,y1,x2,y2,result,distance;
    scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);

    result=(((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1)));
    distance=sqrt(result);
    printf("%lf\n",distance);

    return 0;



}




Measured memory_bytes: 2136
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<functional>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
const int MAX = 510000;
const int MOD = 1000000007;

LL N,M,S;
string s;
int main(){
    cin>>N>>M;
    int cnt0=0;
    int cnth=0;
    for(int i=1;i<=N;i++){
        if(i%M==0)cnt0++;
        else if(M%2==0 && (i%M)==(M/2))cnth++;
    }
    cout<<(LL)pow(cnt0,3)+(LL)pow(cnth,3)<<endl;


    return 0;
}


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

char thn[20],ary[120][20];
int main(){
	int N,tl,cnt;
	bool isok;
	cin>>thn>>N;
	tl=strlen(thn);
	for(int i=0;i<N;i++){
		cin>>ary[i];
	}
	for(int i=0;i<N;i++){
		for(int j=10;j<10+tl-1;j++){
			ary[i][j]=ary[i][j-10];
		}
	}
	cnt=0;
	for(int i=0;i<N;i++){
		for(int j=0;j<10;j++){
			isok=true;
			for(int k=0;k<tl;k++){
				if(thn[k]!=ary[i][j+k]){
					isok=false;
					break;
				}
			}
			if(isok){
				cnt++;
				break;
			}
		}
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 1164
#include <stdio.h>

int main(){
	int i,j,k;
	int a,b;
	
	scanf("%d%d",&a,&b);

	if(a<10&&b<10){
		
		printf("%d\n",a*b);
		return 0;
	}
	printf("-1\n");
	
  return 0;

}


Measured memory_bytes: 128
import math
import itertools
def dist (s,t):
  return ((s[0]-t[0])**2+(s[1]-t[1])**2)**0.5

n = int(input())
l = []
for _ in range(n):
  l.append(tuple(map(int,input().split())))

candidates = []
for l_i in itertools.permutations(l):
  lgh = 0
  for i in range(n-1):
    lgh += dist(l_i[i],l_i[i+1])
  candidates.append(lgh)
print(sum(candidates)/len(candidates))

Measured memory_bytes: 4400
#include <stdio.h>
int main(void){
int n,m;
int sum = 0;
scanf("%d %d",&n,&m);
int c[m];
for (int i = 0;i < m;i++){
	scanf("%d",&c[i]);
	sum += c[i];
	}
	n -= sum;
	if(n < 0) printf("-1");
	else printf("%d",n);
  	return 0;
}


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

int main() {
  int x1,y1,x2,y2; cin >>x1 >>y1 >>x2 >>y2;
  int x3,y3,x4,y4;
  int sx = x2-x1, sy = y2-y1;
  x3 = x2-sy; y3 = y2+sx;
  x4 = x3-sx; y4 = y3-sy;
  
  cout <<x3 <<" " <<y3 <<" " <<x4 <<" " <<y4;
  //cout <<ans;
  cout <<endl;
}


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

using namespace std;

int check(string s, string t);

int main()
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	int mx = 0;
	for (int i = 1; i < s.length() - 1; i++) {
		mx = max(mx, check(s.substr(0, i), s.substr(i, s.length() - i)));
	}
	cout << mx << endl;

	return 0;
}

int check(string s, string t)
{
	vector<bool> a(26), b(26);
	char j;
	int k;
	for (int i = 0; i < s.length(); i++) {
		for (j = 'a', k = 0; j <= 'z'; j++, k++) {
			if (s[i] == j) {
				a[k] = true;
			}
		}
	}
	for (int i = 0; i < t.length(); i++) {
		for (j = 'a', k = 0; j <= 'z'; j++, k++) {
			if (t[i] == j) {
				b[k] = true;
			}
		}
	}

	int ans = 0;
	for (int i = 0; i < 26; i++) {
		if (a[i] && b[i]) {
			ans++;
		}
	}
	return ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <cmath>

using namespace std;

const int MAX_N = 256;
const int M = 256;
int N, S, A, C;
int I[MAX_N + 10], R[MAX_N + 10], O[MAX_N + 10];

int main()
{
    while (cin >> N, N) {
        for (int i = 1; i <= N; ++i)
            cin >> I[i];

        S = A = C = 16;
        double H = 1e9;
        for (int s = 0; s <= 15; ++s) {
            for (int a = 0; a <= 15; ++a) {
                for (int c = 0; c <= 15; ++c) {
                    R[0] = s;
                    map<int, int> x;
                    for (int i = 1; i <= N; ++i) {
                        R[i] = (a * R[i - 1] + c) % M;
                        O[i] = (I[i] + R[i]) % M;
                        if (x.count(O[i]) == 0) {
                            x.insert(map<int, int>::value_type(O[i], 1));
                        }
                        else
                            x[O[i]]++;
                    }

                    double h = 0;
                    map<int, int>::iterator it = x.begin();
                    while (it != x.end()) {
                        h -= (*it).second * log((*it).second);
                        ++it;
                    }

                    if (h + 1e-9 < H) {
                        H = h;
                        S = s;
                        A = a;
                        C = c;
                    }
                }
            }
        }
        cout << S << " " << A << " " << C << endl;
    }

    return 0;
}

Measured memory_bytes: 1248
# import math
from decimal import Decimal
A, B = [x for x in input().split(" ")]
A = int(A)
B = int(Decimal(B) * 100)

# if A > 10**15 or A < 0:
#   exit(1)
# if B < 0 or B > 10:
#   exit(1)

print(A * B // 100)


Measured memory_bytes: 10072
S = list(input())
ans1 = 0
ans2 = 0
# 10101010...
for i in range(len(S)):
  if i % 2 == 0:
    if S[i] == '0':
      ans1 += 1
  if i % 2 != 0:
    if S[i] == '1':
      ans1 += 1

# 01010101...
for i in range(len(S)):
  if i % 2 == 0:
    if S[i] == '1':
      ans2 += 1
  if i % 2 != 0:
    if S[i] == '0':
      ans2 += 1
print(min(ans1, ans2))

Measured memory_bytes: 3956
#include <iostream>

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

using namespace std;

int main(){
	int x, a, b, ans;
	cin >> x >> a >> b;
	ans = 0;
	x -= a;
	while(x>=b){
		ans++;
		x -= b;
	}
	cout << x << endl;
	return 0;
}



Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int a = Integer.parseInt(sc.next());
    int b = Integer.parseInt(sc.next());
    
    int x = b-a;
    System.out.println(x*(x+1)/2-b);
  }
}

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

#define F first
#define S second

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 55, M = 8010, INF = 0x3f3f3f3f;

int n;
int a[N];
vector<PII> res;

void add(int x, int u)
{
	for (int i = 1; i <= n; i ++ )
	{
		a[i] += x;
		res.push_back({u, i});
	}
}

int main()
{
	cin >> n;
	int maxa = -INF, axi, mina = INF, ini;
	for (int i = 1; i <= n; i ++ )
	{
		cin >> a[i];
		if (a[i] > maxa) maxa = a[i], axi = i;
		if (a[i] < mina) mina = a[i], ini = i;
	}
	
	if (abs(maxa) > abs(mina)) add(maxa, axi);
	else add(mina, ini);
	
	if (a[1] > 0)
	{
		for (int i = 1; i < n; i ++ ) res.push_back({i, i + 1});
	}
	else
	{
		for (int i = n; i > 1; i -- ) res.push_back({i, i - 1});
	}
	
	cout << res.size() << endl;
	for (auto u : res) cout << u.F << ' ' << u.S << endl;
	
	return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const long long INF = 1000000007;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
// chmax chmin
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(void){
    int A,B,C,D; cin >> A >> B >> C >> D;
    if(A+B > C+D) cout << "Left" << endl;
    else if(A+B < C+D) cout << "Right" << endl;
    else cout << "Balanced" << endl;
    return 0;
}

Measured memory_bytes: 256
input()
A = [int(i) for i in input().split()]

solved = False
while not solved:
    solved = True
    mod = min(A)
    new_A = [mod]

    for i, v in enumerate(A[:]):
        hp = v % mod
        if solved and hp != 0:
            solved = False
            new_A.append(hp)

    if solved:
        print(mod)
        exit()
    else:
        A = new_A


Measured memory_bytes: 14224
import bisect
N = int(input())
L = list(map(int, input().split()))
 
L.sort()
 
ans = 0
 
for k in range(N-2):
    for j in range(k+1, N-1):
        ans += bisect.bisect_left(L[j+1:], L[k]+L[j])
 
 
print(ans)

Measured memory_bytes: 52284
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 5050;
const int K = 1e18;
const int M = 1e9;
const int mod = 1e9 + 7;
int dp[N][N], s[N][N], p[N];
int binpow(int x, int y){
    int res = 1;
    while(y){
        if (y % 2){
            res = res * x % mod;
        }
        x = x * x % mod;
        y /= 2;
    }
    return res;
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n, m;
    cin >> n >> m;
    for (int i = 0; i <= m; i++){
        p[i] = binpow(binpow(2, i), mod - 2);;
    }
    for (int i = 1; i <= m; i++){
        dp[1][i] = binpow(2, i);
        s[1][i] = (s[1][i - 1] + i * p[i] % mod * dp[1][i]) % mod;
    }
    for (int i = 2; i <= n; i++){
        for (int j = 1; j <= m; j++){
            dp[i][j] = ((j + 1) * dp[i - 1][j] + binpow(2, j - 1) * s[i - 1][j - 1]) % mod;
            s[i][j] = (s[i][j - 1] + j * p[j] % mod * dp[i][j]) % mod;
        }
    }
    cout << dp[n][m];
}


Measured memory_bytes: 398236
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>

using namespace std;

const int INF = 100000;

int main()
{
	long long int n,a[INF] = {0};

	scanf("%lld", &n);

	for(int i = 0; i < n; i++)
	{
		scanf("%lld", &a[i]);
	}

	sort(a,a+n);

	int j = n-1;
	int cnt = 1;

	bool check = true;

	while(1)
	{

		//cout << "j = " << j << "half = " << a[j] << endl;

		long long int sum = 0;

		long long int max = a[j];
		int half;

		for(int i = 0; i <= j; i++)
		{
			sum += a[i];
		}

		int m = 0;

		for(int i = 0; i < n; i++)
		{
			m += a[i];

			if (a[j] <= m * 2)
			{
				half = i;

				if (i == j)
				{
					check = false;
				}

				break;
			}
		}

		

		for(int i = j; i >= 0; i--)
		{
			if (a[j] <= (sum - a[i]) * 2)
			{
				//cout << "sub = " << a[i] << endl;
				cnt++;
			}

			sum -= a[i];
		}

		if (!check)
		{
			break;
		}

		j = half;
	}

	

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

	return 0;
}
	

Measured memory_bytes: 1152
def main():
  N,K= map(int,input().split())
  h = list(map(int,input().split()))
  dp = [-1]*N
  dp[0] = 0
  for i in range(1,N):
    tmp = i - K
    if tmp < 0: tmp = 0
    cost_min = 10**9
    for j in range(tmp,i):
      ans = dp[j] + abs(h[i] - h[j])
      if cost_min > ans: cost_min = ans
    dp[i] = cost_min
  print(dp[N-1])

if __name__ == '__main__':
  main()

Measured memory_bytes: 13932
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
using namespace std;

typedef __int128 Long;
const int mod = 998244353;

int n;
char str[101];
map<Long, int> dp;

void Print(Long s) {
  printf("%d ", (int)s);
  while (s > 1) {
    putchar('0' + (s & 1));
    s >>= 1;
  }
  putchar('@');
}

inline int Add(int a) {
  return a >= mod ? a - mod : a;
}

inline int Mul(int a, int b) {
  return (long long)a * b % mod;
}

int Dfs(Long s) {
  if (dp.count(s)) {
    return dp[s];
  }
  dp[s] = Dfs(s >> 1);
  if (s & 1) {
    dp[s] = Add(dp[s] << 1);
  }

  int len = 0;
  while ((Long)1 << len + 1 <= s) {
    ++len;
  }
  for (int d = 1; d < len; ++d) {
    Long t = s & ((Long)1 << d) - 1;
    for (int k = 2; k * d <= len; ++k) {
      t &= s >> (k - 1) * d & ((Long)1 << d) - 1;
      dp[s] = Add(dp[s] + Mul(Dfs(t | (Long)1 << d), Dfs(s >> k * d)));
    }
  }

  // Print(s);
  // printf(" %d\n", dp[s]);
  return dp[s];
}

int main(void) {
  scanf("%s", str);
  n = strlen(str);
  Long s = 1;
  for (int i = 0; i < n; ++i) {
    s = s << 1 | (str[i] - '0');
  }
  dp[1] = 1;
  printf("%d\n", Dfs(s));
  return 0;
}


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

signed main(){
    int A,B,C;
    cin >>A>>B>>C;
    int D=C-A+B;
    if(D>0){
        cout <<D<<endl;
    }
    else{
        cout<<0<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;
template<class T> inline void chmax(T& a, T b) { a = max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = min(a, b); }

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2) % mod;
}
/*--------Library Zone!--------*/


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

Measured memory_bytes: 256
from numba import njit


@njit
def main(X):
    for a in range(-200, 201):
        for b in range(-200, 201):
            if pow(a, 5) - pow(b, 5) == X:
                print(a, b)
                return


if __name__ == '__main__':
    X = int(input())
    main(X)


Measured memory_bytes: 110280
#include<iostream>
#include<cmath>
#include<algorithm>
#include<sstream>
using namespace std;

int main(void){
  string S;
  long int int_S[15] = {0};
  long int sum = 0;
  cin >> S;
  for(int i = 0; i < S.size(); i++){
    int_S[i] = S[i] - '0';
    //cout << int_S[i] << endl;
  }
for(long int bit = 0; bit < (1<<(int) (S.size() - 1)); bit++){
  long int temp_sum = int_S[0];
  if(S.size() == 1){
    sum = int_S[0];
    break;
  }
  for(int j = 0; j < S.size() - 1; j++){
    if(bit & (1<<j)){
      sum += temp_sum;
      temp_sum = int_S[j + 1];
      if(j == S.size() - 2){sum += temp_sum;}
      //cout << "1:" << bit << " " << j << " " << sum << endl;
    }
    else if(j == S.size() - 2){
      sum += temp_sum*10 + int_S[j + 1];
      //cout << "2:" << bit << " " << j << " " << sum << endl;
    }
    else{
      temp_sum = temp_sum*10 + int_S[j + 1];
      //cout << "3:" << bit << " " << j << " " << sum << endl;
    }
  }
}
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
public class Hello{
    public static void Main(){
        var a = new long[100001];
        var input = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        var n = input[0];
        var k = input[1];
        
        for(var i = 0;i < n;i++){
            var x = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
            var value = x[0];
            var index = x[1];
            a[value] += index;
        }
        for(var i = 0;i < a.Length;i++){
            if(k <= a[i]){
                Console.WriteLine(i);
                return;
            }else{
                k -= a[i];
            }
        }
    }
}


Measured memory_bytes: 18016
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define REPS(i,s,n) for(int i=(s); i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define EPS (1e-10)

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

P p[50];
int r[50];
int m[50];
int n;

class Line{
public:
  P pp;
  P d;
  Line(){}
  Line(P pos, P dir){pp=pos; d=dir/abs(dir);}
};

static inline double outp(const P &a, const P &b){
  return (conj(a)*b).imag();
}

double dist(const Line &l, const P &pp){
  return abs(outp(l.d, pp-l.pp) / abs(l.d));
}

int cnt(const Line &l){
  int ret = 0;
  REP(i,n){
    double d = dist(l,p[i]);
    if(d >= r[i]-EPS && d <= r[i]+m[i]+EPS) ret++;
  }
  return ret;
}

int main(){
  while(scanf("%d",&n), n){
    REP(i,n){
      int a,b,c,d;
      scanf("%d%d%d%d",&a,&b,&c,&d);
      p[i].real() = a; p[i].imag() = b;
      r[i] = c;        m[i] = d;
    }
    int ans = 0;
    if(n == 1){
      puts("1");
      continue;
    }

    REP(i,n) REPS(j,i+1,n) REP(k,2) REP(l,2){
      P p1 = p[i], p2 = p[j];
      P v = p2 - p1;
      double r1 = r[i];
      double r2 = r[j];
      if(k==1) r1 += m[i];
      if(l==1) r2 += m[j];
      //cout << p1 << " " << r1 <<endl;
      //cout << p2 << " " << r2 <<endl;

      REP(t,2){
	double tmp;
	if(t==0) tmp = abs(r1 - r2) / abs(v);
	if(t==1) tmp = abs(r1 + r2) / abs(v);
	if(tmp <= 1.0){
	  {
	    double theta = acos(tmp);
	    P vv = (v/abs(v)) * P(cos(theta), sin(theta));
	    P start = p1 + r1*vv;
	    Line ln(start,vv*P(0,1));
	    //printf("i=%d, j=%d: (%f, %f), (%f, %f)\n",i,j,start.real(),start.imag(),(vv*P(0,1)).real(),(vv*P(0,1)).imag());
	    ans = max(ans, cnt(ln));
	  }
	  {
	    double theta = -acos(tmp);
	    P vv = (v/abs(v)) * P(cos(theta), sin(theta));
	    P start = p1 + r1*vv;
	    Line ln(start,vv*P(0,1));
	    //printf("i=%d, j=%d: (%f, %f), (%f, %f)\n",i,j,start.real(),start.imag(),(vv*P(0,1)).real(),(vv*P(0,1)).imag());
	    ans = max(ans, cnt(ln));
	  }
	}
      }
    }
    printf("%d\n",ans);
  }

  return 0;
}

Measured memory_bytes: 904
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
  std::vector< pair<int,int> > a;
  int N,h,m,M;
  pair<int,int> time;

  cin >> N;
  for(int i = 0; i < N ;i++){
    cin >> h >> m;
    time.first = h;
    time.second = m;
    a.push_back(time);
  } 
  cin >> M;
  for(int i = 0; i < M ;i++){
    cin >> h >> m;
    time.first = h;
    time.second = m;
    a.push_back(time);
  }
  std::sort(a.begin(),a.end());//昇順ソート

  cout << a[0].first << ":";
     if( a[0].second < 10 ){ cout << "0";}
    cout << a[0].second;

  for(int i = 1 ; i < a.size() ; i++){
    if(a[i].second == a[i-1].second && a[i].first == a[i-1].first ) continue;

    cout << " " << a[i].first << ":";
     if( a[i].second < 10 ){ cout << "0";}
    cout << a[i].second;

  }	
  cout << endl;

  return 0;
}

Measured memory_bytes: 1212
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std;
#define ll long long
int a[105];
int main()
{
    int n;
    scanf("%d",&n);
    int cnt=0;
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
        if(a[i]%2==1&&i%2==1)cnt++;
    }
    printf("%d",cnt);
    return 0;
}



Measured memory_bytes: 3752
#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000007;
typedef pair<int, int> P;
 
int main(){
  int H, W;
  cin >> H >> W;
  int d[H][W];
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      d[i][j] = INF;
    }
  }
  char A[H][W];
  queue<P> que;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin >> A[i][j];
      if(A[i][j] == '#'){
        que.push(P(i,j));
        d[i][j] = 0;
      }
    }
  }
 
  int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
 
  int ans1 = 0;
  while(que.size()){
      P p = que.front(); que.pop();
 
      for(int i = 0; i < 4; i++){
          int nx = p.first + dx[i], ny = p.second + dy[i];
 
          if(0 <=nx && nx < H && 0 <=ny && ny < W && d[nx][ny] == INF){
              que.push(P(nx, ny));
              d[nx][ny] = d[p.first][p.second] + 1;
              ans1 = d[nx][ny];
          }
      }
  }
  cout << ans1 << endl;
}

Measured memory_bytes: 13328
#![allow(unused_imports)]
use proconio::input;
use proconio::marker::*;
use std::collections::VecDeque;

fn main() {
  input!{
    n: usize,
    vals: [Chars;n]
  }
  let mut memo: Vec<usize> = vec![0;5];
  for v in vals {
    match v[0] {
      'M' => memo[0] += 1,
      'A' => memo[1] += 1,
      'R' => memo[2] += 1,
      'C' => memo[3] += 1,
      'H' => memo[4] += 1,
      _ => {}
    }
  }
  
  let mut total = 0;
  for i in 0..5 {
    if memo[i] == 0 { continue }
    for ii in i+1..5 {
      if memo[ii] == 0 { continue }
      for iii in ii+1..5 {
        if memo[iii] == 0 { continue }
        total += memo[i] * memo[ii] * memo[iii];
      }
    }
  }
  
  println!("{}", total);
}

Measured memory_bytes: 10576
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int L = sc.nextInt();
    int R = sc.nextInt();
    int d = sc.nextInt();
    int answer = 0;
    for(int i = L; i <= R; i++){
      if(i % d == 0){
        answer++;
      }
    }
    System.out.println(answer);
  }
}

Measured memory_bytes: 35616
#include "iostream"
#include "vector"
#include "string"
#include "algorithm"
#include "math.h"
#include "cstring"
#include "stack"
#include "queue"

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

ll mod = 1e9 + 7;

int main()
{
  int n, k;
  cin >> n >> k;
  ll a[101];
  for (int i = 0; i < n; i++)
  {
    cin >> a[i];
  }
  ll dp[101][100010];	//i人にj個以内
  fill(dp[0], dp[1], 0);
  for (int i = 0; i < 101; i++)
  {
    dp[i][0] = 1;
  }
  for (int i = 0; i < n; i++)
  {
    for (int j = 0; j < k; j++)
    {
      if (j >= a[i])
      {
        dp[i + 1][j + 1] = (dp[i + 1][j] + dp[i][j + 1] - dp[i][j - a[i]]) % mod;
      }
      else
      {
        dp[i + 1][j + 1] = (dp[i + 1][j] + dp[i][j + 1]) % mod;
      }
    }
  }
  cout << (dp[n][k] + mod) % mod << "\n";
}

Measured memory_bytes: 79104
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        for(int i = 0; i < s.length(); i++){
            for(int j = 1; j < s.length() - i; j++){
                if(s.charAt(i) == s.charAt(i + j)){
                    System.out.println("no");
                    System.exit(0);
                }
            }
        }
        System.out.println("yes");
    }
}

Measured memory_bytes: 22868
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pr;
int N;
vector<string> S;
vector<int> P;
map<string, vector< pr > > s;
int main(void){
    cin >> N;
    S.resize(N);
    P.resize(N);
    for (int i=0;i<N;i++){
        cin >> S[i] >> P[i];
        s[S[i]].push_back(make_pair(P[i], (i+1)));
    }
    for (auto it=s.begin();it!=s.end();it++ ){
        sort(it->second.begin(),it->second.end());
        for (int i=it->second.size()-1;i>=0;i--)
            cout << it->second[i].second << endl;
    }

}

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

typedef long long ll;

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int t; cin>>t; while(t--)
#define nl cout<<"\n";
#define sp cout<<" ";
#define rep(i, a, b) for(long long i=a; i<b; i++)

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
double PI = 4*atan(1);

int main()
{
    optimize();

    int a, b, k;

    cin>> a>> b>>k;

    vector <int > v;

    for(int i= 1; i<=a && i<=b; i++)
    {
        if( b%i==0 && a%i==0)
            v.push_back(i);
    }

    cout << v[v.size()- k];
    nl;

    return 0;
}




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

namespace PaizaTest
{
    class Program
    {
        static void Main(string[] args)
        {
            var nk = Console.ReadLine().Split(' ').Select(int.Parse).ToList();

            // n: 整数
            var n = nk[0];
            // k: 進数の基数
            var k = nk[1];

            // 計算の流れ
            // 1. 基数の指数倍でKの制約の最大数が10なのでk^10より大きいか判定
            // 2-1. 大きければその数で割ってその桁数を割れた分の数を記録して、余りを1つ小さい次数で1.の処理を行う
            // 2-2. 大きくなければ、0を記録し、あまりを1つ小さい次数で1.の処理を行う

            // 指数を求める
            var rankNum = 0;
            for (int i = 0;  ; i++)
            {
                rankNum = i;
                if ( n < Math.Pow(k, rankNum))
                {
                    break;
                }
            }

            Console.WriteLine(rankNum);

            //var currentN = n;
            //// ビットの計算
            //for (int i = rankNum; i >= 0; i--)
            //{
            //    var pow = Math.Pow(k, i);
            //    var quotient = currentN / pow;
            //    if (quotient > 0)
            //    {
            //        var remain = currentN % pow;
            //    }

            //}
        }
    }
}


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

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n,i,a[100],s,p,np,th=1000;
	cin>>n;
	for(i=0;i<n;i++) cin>>a[i];
	s=1000; p=0;
	for(i=1;i<n;i++) {
		if(a[i]>a[i-1]) {
			np=s/a[i-1];
			s-=(np*a[i-1]);
			p+=np;
		}
		if(a[i]<a[i-1]) {
			s+=(p*a[i-1]);
			p=0;
		}
	}
	s+=(p*a[n-1]);
	cout<<max(th,s);	
}

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

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

using namespace std;
using ll=long long;
const ll INF = 100000000;

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

    string s;
    ll res[4] = {};
    rep(i, n) {
        cin >> s;
        if (s == "AC") {
            res[0]++;
        } else if (s == "WA") {
            res[1]++;
        } else if (s == "TLE") {
            res[2]++;
        } else if (s == "RE") {
            res[3]++;
        }
    }
    cout << "AC x " << res[0] << endl;
    cout << "WA x " << res[1] << endl;
    cout << "TLE x " << res[2] << endl;
    cout << "RE x " << res[3] << endl;
    return 0;
}

Measured memory_bytes: 3624
import java.util.Arrays;
import java.util.Scanner;
public class Main
{
	static int n,a[];

	public static void main(String[] args) 
	{
		Scanner in=new Scanner(System.in);
		for(;;)
		{
			int d=in.nextInt();//全長
			if(d==0)
				return;
			n=in.nextInt();//店舗数
			int m=in.nextInt();//注文数
			a=new int[n+1];//店舗の位置格納
			int ans=0;
			a[0]=0;
			for(int i=1;i<n;++i)
				a[i]=in.nextInt();
			a[n]=d;
			Arrays.sort(a);
			for(int i=0;i<m;++i)
			{
				int k=in.nextInt();//配達先
				ans+=binary(k);
			}
			System.out.println(ans);
		}
	}

	static public int binary(int ob)
	{
		int ri=n-1;
		int le=0;
		int res=0;
		while(ri>=le)
		{
			int mid=(le+ri)/2;
			if(a[mid]>ob)
				ri=mid-1;
			else
				le=mid+1;
		}
		res=Math.min(Math.abs(ob-a[ri]),Math.abs(a[le]-ob));
		return res;
	}
	static public void debug(Object... o)
	{
		System.out.println(Arrays.deepToString(o));
	}
}

Measured memory_bytes: 63152
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i,n) for(int i = 0;i < n;i++)
#define NIL = -1;
#define all(x) x.begin(),x.end()
const ll INF = 1e9;
const ll mod = 1e9 + 7;

int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}

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

ll lcm(ll a,ll b){
    return ((a * b == 0)) ? 0 : (a / gcd(a,b) * b);
}

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


//////////////////////////////////////////////////////////////////////////////////////

int a[1000001];
int main() {
    int k;
    cin >> k;
    a[1] = 7 % k;
    for (int i = 2;i <= k;i++){
        a[i] = (a[i-1]*10 + 7) % k;
    }

    for (int i = 1;i <= k;i++){
        if (a[i] == 0){
            cout << i << endl;
            return 0;
        }
    }

    cout << -1 << endl;
}

Measured memory_bytes: 7488
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
//#include <stdio.h>
//#include <stack>
//#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
//#include <fstream>
//#include <list>
//#include <iomanip>
#include <stdlib.h>
#include <cctype>

using namespace std;

#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define ssort(z) sort(z.begin(),z.end())
#define rsort(z) sort(z.rbegin(),z.rend())
#define eerase(z) z.erase(unique(z.begin(),z.end()),z.end())
#define ccnt(z,w) count(z.begin(),z.end(),w)


void printVec(std::vector<int> & vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec2(std::vector<Int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

Int gcd(Int a, Int b) {
	return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
	return a / gcd(a, b) *b;
	//a*bは64bit integer overflow
}

bool comp(const string a, const string b) {
	return a.length() < b.length();
}

bool integer(double num) {
	return floor(num) == num;
}

string gen(int num) {
	string str = "";
	for (int i = 0; i < num; i++) str += ".";
	return str;
}
Int fact(int num) {
	if (num == 0) return 1;
	else return num * fact(num - 1);
}



int main() {
	//int a, b, c,d; cin >> a>>b>>c>>d ;
	string s,t; cin >> s;
	if (s == "a" || s == "i" || s == "u" || s == "e" || s == "o")cout << "vowel";
	else cout << "consonant";

	cout << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
import math 
# sys.stdin = open('input.txt', 'r')  
# sys.stdout = open('output.txt', 'w')
n = int(input())
height = list(map(int, input().split()))
x = height[0]
ans = 0
for i in range(1, n):
	if x >  height[i]:
		ans += (x - height[i])
	x = max(x, height[i])
print(ans)

Measured memory_bytes: 32976
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int r = Integer.parseInt(sc.next());
    pw.println(
      2 * Math.PI * r
    );
  }
}


Measured memory_bytes: 35876
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Vec  =vector<int>;

int		main(void)
{
	string s, t;
	cin >> s >> t;
	int count = 0;
	for (int i = 0; i < 3; i++)
	{
		if (s[i] == t[i])
			count++;
	}
	cout << count << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>

using namespace std;

int main(){
  std::cin.tie(nullptr);                  // 標準入出力高速化
  std::ios_base::sync_with_stdio(false);  // SとS++の入出力出力を非同期
  double a,b;
  cin>>a>>b;
  cout<<ceil((b-1)/(a-1))<<endl;
}

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

using namespace std;

int main(int argc, char *argv[]) {
  int n, z, w;
  cin >> n >> z >> w;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<vector<int>> f(n, vector<int>(2));
  for (int i = n - 1; i >= 0; i--) {
    int v1 = (i > 0 ? a[i - 1] : w);
    int v2 = (i > 0 ? a[i - 1] : z);
    f[i][0] = abs(a.back() - v1);
    f[i][1] = abs(a.back() - v2);
    for (int j = i + 1; j < n; j++) {
      f[i][0] = max(f[i][0], f[j][1]);
      f[i][1] = min(f[i][1], f[j][0]);
    }
  }
  cout << f[0][0] << endl;
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<string,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l,ans;
string s,t;
ll d[200010],dp[500][500];

int main(){
  cin >> s;
  char c = 'W';
  m = l = 0;
  rep(i,0,s.sz){
    if(s[i] != c){
      m++;
      c = s[i];
    }
  }
  c = 'B';
  rep(i,0,s.sz){
    if(s[i] != c){
      l++;
      c = s[i];
    }
  }
  print(min(l,m));
  return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    // 整数の入力
    int N;
    int cnt=0;
    int a,b;
    cin >> N;
    for(int i=1;i<N;i++){
      for(int j=1;j*j<=N-i;j++){
         a = (N-i)%j;
         b = (N-i)/j;
        //cout << i <<" "<< j <<" " << (N-i)%j<< endl;
        if(a == 0){
          if(b == j){
            cnt+=1;
          }
          else{
            cnt+=2;
          }
       }
      }
    }

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


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

using namespace std;

int main(){
  int N; cin >> N;
  if(N == 1){
	cout << "! 1" << endl;
	return 0;
  }

  int mx = 0, left = 0;
  for(int i=2;i<=N;++i){
	cout << "? 1 " << i << endl;
	int x; cin >> x;
	if(x > mx){
	  left = i;
	  mx = x;
	}
  }

  vector<int> ans(N);
  ans[0] = left;
  for(int i=1;i<=N;++i){
	if(i == left) continue;
	cout << "? " << left << " " << i << endl;
	int x; cin >> x;
	ans[x] = i;
  }

  cout << "!";
  for(int i=0;i<N;++i)
	cout << " " << ans[i];
  cout << endl;
  
  return 0;
}

Measured memory_bytes: 3652
loop{
	num = gets.to_i()
	
	if num == 0 then
		break
	end

	data = gets.split.map(&:to_i).sort
	sum = data.inject(:+)
	min = sum
	a = [0]
	while(!data.empty?) do
		d = data.pop()
		tmp = []
		flag = 0
		for e in a do
			f = d + e
			if (f == (sum/2)) then
				min = sum - f * 2
				flag =1
				break
			elsif (f < (sum/2))
				min = [min,sum - f * 2].min
				tmp.push(f)
			end
		end
		a.concat(tmp)
		a.uniq!
		if flag == 1 then
			break;
		end
	end

	p min

}

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

int N;
const int MAX_N = 2.0e5 + 100;
pair<int, int> BA[MAX_N];

int main() {
    cin >> N;
    for (int i = 0; i < N; i++) cin >> BA[i].second >> BA[i].first;

    sort(BA, BA+N);
    
    bool ans = true;
    ll cnt = 0;
    for (int i = 0; i < N; i++) {
        cnt += BA[i].second;
        if (cnt > BA[i].first) {
            ans = false;
            break;
        }
    }

    if (ans) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 1792
N=int(input())
ANS=[0]*(10**6)
count=0
c=1
for i in range(1,100):
    for j in range(1,100):
        for z in range(1,100):
            c=i**2+j**2+z**2+i*j+j*z+z*i
            ANS[c]+=1
for i in range(1,N+1):
    print(ANS[i])

Measured memory_bytes: 16796
import sys
input = sys.stdin.readline
H, W, K = map(int, input().split())
c = [list(input())[: -1] for _ in range(H)]
res = 0
for i in range(1 << H):
  for j in range(1 << W):
    table = [[c[i][j] for j in range(W)] for i in range(H)]
    t = 0
    for u in range(H):
      for v in range(W):
        if (1 << u) & i or (1 << v) & j: continue
        if c[u][v] == "#": t += 1
    res += t == K
print(res)

Measured memory_bytes: 74552
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>
#include <functional>

using namespace std;
#define ALL(x)              (x).begin(),(x).end()
#define REP(i, n)           for (int (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n)       for (int (i) = m ; (i) < (ll)(n) ; ++(i))
#define INF                 (int)2e9
#define MOD                 (1000 * 1000 * 1000 + 7)
#define Ceil(x, n)          (((((x))+((n)-1))/n))
#define CeilN(x, n)         (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)        ((x)-(x)%(n))
#define IsOdd(x)            (((x)&0x01UL) == 0x01UL)
#define IsEven(x)           (!IsOdd((x)))
#define M_PI                3.14159265358979323846
typedef long long           ll;
typedef pair<ll, ll>        P;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
// 枝定義
struct Edge
{
	int	to;
	ll	dist;
	Edge(){}
	Edge(int to, ll dist) : to(to), dist(dist){}
};

template <class E>
using Graph = vector<vector<E>>;

// dfs
Graph<Edge>		G;
vector<int>		color;
bool dfs(int from, int fromCol)
{
	color[from] = fromCol;
	for (auto next : G[from]) {
		if (color[next.to] == 0) {
			int nextCol;
			if (IsEven(next.dist)) {
				nextCol = fromCol;
			} else {
				nextCol = fromCol * -1;
			}
			dfs(next.to, nextCol);
		}
	}

	return true;
}

// メイン
int main()
{
	int N;
	cin >> N;
	G.resize(N);
	REP(i, N - 1) {
		int a, b, c;
		cin >> a >> b >> c;
		a--, b--;
		G[a].emplace_back(Edge(b, c));
		G[b].emplace_back(Edge(a, c));
	}

	color.resize(N, 0);
	REP(i, N) {
		if (color[i] == 0) {
			if (!dfs(i, 1)) {
				break;
			}
		}

		bool isFin = true;
		for (int j = 0; j < N; j++) {
			if (color[j] == 0) {
				isFin = false;
				break;
			}
		}
		if (isFin) {
			break;
		}
	}

	REP(i, N) {
		if (color[i] == 1) {
			cout << 1 << endl;
		} else {
			cout << 0 << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 9600
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
template<typename T, typename U> static void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> static void amax(T &x, U y) { if(x < y) x = y; }

int main() {
	int n; int d;
	while(~scanf("%d%d", &n, &d)) {
		ll ans = 0;
		ans += d;
		ans += (ll)(n - d - 1) * (n - d - 2) / 2;
		ans += (ll)(n - d - 1) * min(3, d + 1);
		printf("%lld\n", ans);
	}
	return 0;
}

Measured memory_bytes: 3220