akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define INF (1e9)

int N, x;

int main() {
    cin >> N >> x;

    vi A(N + 2);
    for (int i = 0; i < N; i++) {
        cin >> A[i + 1];
    }

    ll ans = 0;
    for (int i = 1; i < N + 2; i++) {
        if (A[i] + A[i - 1] > x) {
            ans += A[i] + A[i - 1] - x;
            A[i] -= A[i] + A[i - 1] - x;
        }
    }

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


Measured memory_bytes: 640
S=input()
A=int(S[:2])
B=int(S[2:])
if 0<A<13 and 0<B<13:
  print('AMBIGUOUS')
elif 0<A<13 and (12<B<99 or B==0):
  print('MMYY')
elif 0<B<13 and (12<A<99 or A==0):
  print('YYMM')
else:
  print('NA')

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

int gcd(int a, int b){
    if(b > 0){
        return gcd(b, a % b);
    }else{
        return a;
    }
}

int lcm(int a, int b){
    return ((a / gcd(a, b)) * b);
}

int main() {
    int a, b;
    while(cin >> a >> b){
        cout << gcd(a,b) << " " << lcm(a,b) << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>
#include <bitset>
#include <iomanip>

#include <queue>
#include <cstdio>

#include <list>
#include <set>
#include <map>


#define PI (3.14159265358979323846)
#define INF (1e+9)
#define DIV_NUM (1000000007)

using namespace std;


bool seen[501][501];

int N, W;
int X, Y, Z;
int con;
//    string S;


char field[501][501];
int  dist[501][501];

typedef pair<int, int> P;
queue<P> que;


//typedef vector<vector<int>> v;
vector<double> vi;
vector<double> wi;


set<int> s1;
map<string, int> m1;
map<string, int> m2;

int weight[110], value[110];
int dp[110][10010];


int main(){
  
  
    // input data
    string ss ;


    cin >> N >> W;

  
    //        std::cout << m1[ss] << ss  << "\n";


    for (int i = 0; i < N; i++) {
        cin >> value[i] >> weight[i];
    }

    for (int w = 0; w <= W; ++w) {
        dp[0][w] = 0;
    }


    for (int i = 0; i < N; i++) {

      //  std::cout << i << "\n";

        for (int w = 0; w <= W; w++) {
                
            if(w>=weight[i]){

                dp[i+1][w] = max(dp[i+1][w - weight[i]] + value[i], dp[i][w]);
            }
            else {
                dp[i+1][w] = dp[i][w];

            }
        
        }

    }



 
    
    std::cout << dp[N][W] << "\n";

        return 0;

}



Measured memory_bytes: 7064
#include <map>
#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;

const int N = 200005;

int n, ans, a[N];

inline int Up(int x) {
  int r = 1;
  while (r < x) r <<= 1;
  return r;
}
int Gao2() {
  static map<int, int> mp;
  int res = 0;
  for (int i = 1; i <= n; ++i) {
    ++mp[a[i]];
  }
  map<int, int>::iterator p = mp.end();
  --p;
  while (1) {
    int x = p->first;
    int t = 0;
    if (2 * x > (1 << 30)) {
      t = Up(x + 1);
    } else {
      t = Up(2 * x);
      if (t == 2 * x) {
        res += p->second / 2;
        p->second &= 1;
      }
      t /= 2;
    }
    for (; t > x; t /= 2) {
      int y = t - x;
      if (mp.find(y) == mp.end())
        continue;
      int us = min(mp[x], mp[y]);
      res += us;
      mp[x] -= us, mp[y] -= us;
    }
    if (p == mp.begin())
      break;
    --p;
  }
  return res;
}

int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
  }
  ans = Gao2();
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 10368
N = int(input())
mod = 10**9+7
arr = [1 for i in range(N+1)]
for i in range(2,N+1):
    if arr[i] > 0:
        j = 2*i
        while(j<N+1):
            arr[j] = 0
            j += i
prime = []
for i in range(2,N+1):
    if arr[i] != 0:
        prime.append(i)
count = 1
for n in prime:
    tmp = n
    i = 0
    while(tmp < N+1):
        i += N//tmp
        tmp *= n
    count *= (i+1)
print(count%mod)

Measured memory_bytes: 3064
// INCLUDES
#include <bits/stdc++.h>
#include<assert.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
//DEFINES
#define MAX 1000001
#define pii pair<int, int>
#define F first
#define S second
#define all(s) begin(s),end(s)
#define MIN3POS(a, b, c) (a) =< (b) ? ((a) =< (c) ? 1 : 3) : ((b) =< (c) ? 2 : 3)
#define MAX3POS(a,b,c) (a) >= (b) ? ((a) >= (c) ? 1 : 3) : ((b) >= (c) ? 2:3)
#define endl '\n'
#define int long long
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define FOR(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define IOS   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);}
//NAMESPACES
using namespace __gnu_pbds; 
using namespace std;
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
//HELPERS
vector<vector<int>> mp;
vector<int> visited,dp;
vector<int> powers2(32,0);void initialize(){ for(int i=1;i<powers2.size();i++) powers2[i] = powers2[i-1]*2;}
void dfs(int node) {
    if(visited[node]) return;
    visited[node] =1;
    for(auto child : mp[node]){
        dfs(child);
        dp[node] = max(dp[node],1+dp[child]);
    }
}
int32_t main()
{
IOS
int n,m;
cin>>n>>m;
visited.resize(n+1,0);
dp.resize(n+1,0);
mp.resize(n+1);
FOR(i,0,m) {
    int a,b;
    cin>>a>>b;
    mp[a].push_back(b);
}
FOR(i,1,n+1){
    if(!visited[i]) dfs(i);
}
cout<<*max_element(all(dp));
return 0;
}
// Use emplace back in place of pushback
// Use tie function , for object destructuring

Measured memory_bytes: 9344
use std::io::*;

const MOD: usize = 998244353;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let s: usize = itr.next().unwrap().parse().unwrap();
    let a: Vec<usize> = (0..n)
        .map(|_| itr.next().unwrap().parse().unwrap())
        .collect();

    let mut dp: Vec<Vec<usize>> = vec![vec![0; 6666]; n + 1];
    dp[0][0] = 1;
    for i in 0..n {
        for j in 0..s + 1 {
            dp[i + 1][j] += dp[i][j] * 2;
            dp[i + 1][j] %= MOD;
            if j >= a[i] {
                dp[i + 1][j] += dp[i][j - a[i]];
                dp[i + 1][j] %= MOD;
            }
        }
    }
    println!("{}", dp[n][s]);
}


Measured memory_bytes: 158560
#include<bits/stdc++.h>
using namespace std;
vector<int> vi;
vector<int> :: iterator vit;
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int n,i,j,k,a,b;
    cin>>n>>a;
    cout<<(n-a)+1<<endl;
    return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    // 境界より右にある.の数を求める
    val s = readLine()!!
    var w = s.filter { it == '.' }.count()
    var b = 0
    var ans = w

    // 境界を左端からずらしていき、境界の左にある#の数と右にある.の数の和を計算する
    // 最小ならば値を更新する
    for(i in (0 until n)){
        if(s[i] == '#'){
            b++
        }else{
            w--
        }
        ans = Math.min(ans, b + w)
    }

    println(ans)
}


Measured memory_bytes: 36220
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <cassert>
#include <random>
using namespace std;
using ll = long long;

int main() {
	int n, m, k; cin >> n >> m >> k;
	vector<vector<int>> edg(n), blc(n);
	for (int i = 0; i < m; i++) {
		int a, b; cin >> a >> b;
		a--; b--;
		edg[a].push_back(b);
		edg[b].push_back(a);
	}
	for (int i = 0; i < k; i++) {
		int a, b; cin >> a >> b;
		a--; b--;
		blc[a].push_back(b);
		blc[b].push_back(a);
	}
	bool used[200003] = {};
	auto func = [&](auto &self, auto &s, int pos) -> void {
		s.insert(pos);
		used[pos] = true;
		for (int e : edg[pos]) {
			if (used[e]) continue;
			self(self, s, e);
		}
	};
	vector<set<int>> s;
	for (int i = 0; i < n; i++) {
		if (used[i]) continue;
		s.emplace_back();
		func(func, s.back(), i);
	}
	vector<int> ans(n);
	int sz = s.size();
	for (int i = 0; i < sz; i++) {
		for (int pos : s[i]) {
			int cnt = 0;
			for (int b : blc[pos]) {
				cnt += s[i].count(b);
			}
			ans[pos] = s[i].size() - edg[pos].size() - cnt - 1;
		}
	}
	for (int i = 0; i < n; i++) {
		cout << ans[i] << " \n"[i == n - 1];
	}
	return 0;
}


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

int main() {
    int s;
    cin >> s;
    int a = s / 100;
    int b = (s - a * 100) / 10;
    int c = s - a * 100 - b * 10;
    cout << a + b + c << endl;
}

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

using namespace std;

typedef long long ll;

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

	string s;
	cin >> s;
	
	int n = s.size();

	int mn = 999;
	for(int i = 0; i <= n - 3;i++){
		int t = stoi(s.substr(i, 3));
		mn = min(mn, abs(t - 753));
	}

	cout << mn << endl;

}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"

vector<int>ns;
vector<int>nums;
int a;
int getans(const int s) {
	
	if (nums[a] == -1) {
		int ans = 0;
		a++;
		ans += getans(s + 1);
		while (1) {
			if (a+1 == ns.size())break;
			if (ns[a+1] != s + 1)break;
			a++;
			ans += getans(s + 1);
		}
		return ans;
	}
	else if (nums[a] == -2) {
		int ans = 1;
		a++;
		ans *= getans(s + 1);
		while (1) {
			if (a+1 == ns.size())break;
			if (ns[a+1] != s + 1)break;
			a++;
			ans *= getans(s + 1);
		}
		return ans;
	}
	else {
		int ans = nums[a];
		return ans;
	}
}
int main() {
	while (1) {
		a = 0;
		int N; cin >> N;
		if (!N)break;
		ns.clear();
		nums.clear();
		ns.resize(N);
		nums.resize(N);
		for (int i = 0; i < N; ++i) {
			string st; cin >> st;
			int n = st.find_first_not_of('.');
			ns[i] = n;
			if (st.substr(n) == "+")nums[i] = -1;
			else if (st.substr(n) == "*")nums[i] = -2;
			else nums[i] = stoi(st.substr(n));

		}
		int ans=getans(0);
		cout << ans << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3008
using System;
using System.Collections.Generic;
using System.Linq;
class MainClass
{
  static void Main(string[] args)
  {
    AnswerA();
  }
  public static void AnswerA()
  {
    int cnt = 0;
    string input = Console.ReadLine();
    for(int i = 0; i < input.Length; i++)
    {
      if (input[i] == '1')
        cnt++;
    }

    Console.WriteLine(cnt.ToString());
  }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  // ここにプログラムを追記
  int A , B , N ;
  cin >> A >> B ;
  N = 0;
  while(1 + (A-1)* N < B ){
    N++;
}
  cout << N << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<stdio.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fr(i,j,n)   for(long long i=j;i<(n);++i)
#define bk(i,j,n)   for(long long i=j;i>=n;--i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define endl "\n"
#define MOD 1000000007
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define srt(x) sort(x.begin(),x.end());
#define run ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ordered_set tree<ll , null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>

typedef long long ll;
ll n,m,x;
ll a[15][15],c[15];
ll ans=INT_MAX;
void fun(ll ind,ll pai,ll cur[])
{

    if(ind>=n)
        return ;

    ll f=0;
    ll b[15];
    fr(i,0,15)
    {
        b[i]=cur[i];
    }
    fun(ind+1,pai,b);
    fr(i,0,m)
    {
        cur[i]+=a[ind][i];
        if(cur[i]<x)
            f=1;
    }
    if(f)
    {
        fun(ind+1,pai+c[ind],cur);
    }
    else
    {
        ans=min(ans,pai+c[ind]);

    }

}

int main()
{
    run;

    cin>>n>>m>>x;
    fr(i,0,n)
    {
        cin>>c[i];
        fr(j,0,m)
        {
            cin>>a[i][j];
        }
    }
    ll b[15]={0};
    fun(0,0,b);
    if(ans==INT_MAX)
    {
        ans=-1;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int n; cin >> n;
    int x = n % 2 == 0 ? n+1 :n;

    vector<pii> ans;
    FOR(i,1,n) FOR(j,i+1,n+1) {
        if (i+j != x) ans.emplace_back(i,j);
    }
    
    OUT(ans.size())
    REP(i,ans.size()) cout << ans[i].first << " " << ans[i].second << '\n';

    return 0;
}

Measured memory_bytes: 384
n = int(input())
a = []
b = []
for i in range(n):
    x,y = map(int,input().split())
    a.append(x)
    b.append(y)
a = a[::-1]
b = b[::-1]

cnt = 0
for i in range(n):
    ac = a[i]+cnt
    if ac % b[i] != 0:
        cnt += b[i]*(ac//b[i]+1) - ac    
print(cnt)

Measured memory_bytes: 11820
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(a) (a).begin(),(a).end()
typedef long long ll;
#define rep1(i,n) for(int i=1;i<=int(n);++i)
#define lb(s,x) (lower_bound(all(s),x)-s.begin())
#define ub(s,x) (upper_bound(all(s),x)-s.begin())
#define uniq(a) a.erase(unique(all(a)),a.end())
#define bit(k) (1LL<<(k))
const int INF = 1e9;

#define debug(x) cerr<<(#x)<<": "<<(x)<<endl
template<class T,class U>
ostream& operator<<(ostream& o, const pair<T,U> &p){
    o<<"("<<p.first<<", "<<p.second<<")";
    return o;
}
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }


int main(void){
    int x,a;
    cin >> x >> a;
    cout << ((x < a) ? "0" : "10") << endl;
    return 0;
}


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

#define taskname ""
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define for0(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex <ld> cd;
typedef vector <cd> vcd;
typedef vector <int> vi;

template<class T> using v2d = vector <vector <T> >;
template<class T> bool uin(T &a, T b)
{
    return a > b ? (a = b, true) : false;
}
template<class T> bool uax(T &a, T b)
{
    return a < b ? (a = b, true) : false;
}

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

const int maxN = 1e7 + 10;

int n, f[maxN];
int lp[10000010];
vector <int> pr;
void init()
{
    for (int i = 2; i <= 1e7; ++i)
    {
        if (lp[i] == 0)
        {
            lp[i] = i;
            pr.eb(i);
        }
        for (int j = 0; j < (int)pr.size() && pr[j] <= lp[i] && i * pr[j] <= 1e7; ++j)
        {
            lp[i * pr[j]] = pr[j];
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    init();
    cin >> n;
    f[1] = 1;
    fore(i, 2, n)
    {
        int x = i, d = lp[i], cnt = 0;
        while (x % d == 0)
        {
            x /= d;
            cnt++;
        }
        f[i] = f[x] * (cnt + 1);
    }
    ll ans = 0;
    for1(i, n)
    {
        ans += (ll)i * f[i];
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 84260
import java.util.*;
public class Main {
    public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
        int n,m,c,yn;
        ArrayList<Integer> list_num = new ArrayList<Integer>();
        String line;
        Map<String,Integer> list = new HashMap<String,Integer>();
        n=sc.nextInt();
        for(int a=0;a<100;a++){
            list_num.add(0);
        }
        for(int a=0;a<n;a++){
            line = sc.next();
            if(list.containsKey(line)){
                int num = list.get(line);
                list_num.set(num,list_num.get(num)+1);
            }
            else{
                int size_num = list.size();
                list.put(line,size_num);
                list_num.set(list.get(line),1);
            }
        }
        m=sc.nextInt();
        for(int a=0;a<m;a++){
            line = sc.next();
            if(list.containsKey(line)){
                int num = list.get(line);
                list_num.set(num,list_num.get(num)-1);
            }
            else{
                int size_num = list.size();
                list.put(line,size_num);
                list_num.set(list.get(line),-1);
            }
        }
        int v = Collections.max(list_num);
        System.out.println(v);
    }
}


Measured memory_bytes: 21716
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

int main() {
  char a[105][105];
  int H,W; cin >> H >> W;
  for ( int i = 1; i <= H; i++ ) {
    for ( int j = 1; j<= W; j++ ) {
      cin >> a[i][j];
    }
  }

  for ( int i = 0; i <= H+1; i++ ) {
    for ( int j = 0; j <= W+1; j++ ) {
      if ( i == 0 || i == H+1 ) {
	cout << "#";
	if ( j == W+1) cout << endl;
      }else if ( j == 0 || j == W+1 ) {
	cout << "#";
	if ( j == W+1 ) cout << endl;
      } else {
	cout << a[i][j];
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
mod = 1e9+7
def add(a, b):
    c = a + b
    if c >= mod:
        c -= mod
    return c
"""
Given H and N pairs, pairs[0] is attack while pairs[1] is cost. H is the monster health. Find the
minimum cost to get to H

knapsack

dp[i][j] - Minimum cost to reach up to j, such that only first i-th elements are considered

For each new element, its optimal is
dp[i][j] = max(dp[i-1][j-cost[i]], dp[i-1][j])
"""
def main():
    INF = 1e9 + 7
    H, N = [int(x) for x in raw_input().split()]
    value = [0 for _ in range(N)]
    cost = [0 for _ in range(N)]
    
    for i in range(N):
        A, B = [int(x) for x in raw_input().split()]
        value[i] = A
        cost[i] = B
    
    #dp = [[0 for _ in range(H+1)] for _ in range(N)]
    dp = [INF for _ in range(H+1)]
    
    dp[0] = 0
    
    for i in range(N):
        #new_dp = [INF for j in range(H+1)]
        for j in range(H+1):
            after_health = max(0, j - value[i])
            dp[j] = min(dp[after_health] + cost[i], dp[j])
        #dp = new_dp
            
            
    print(dp[H])
    

main()

Measured memory_bytes: 33768
#include<stdio.h>

int d[45];

int fi(int n){
  if( n == 0 || n ==1 ) return d[n] = 1;
  if( d[n] != -1 ) return d[n];
  return d[n] = fi(n-1) + fi(n-2);
}

int main(){
  int i, n;

  for( i = 0 ; i < 45 ; i++ ) d[i] = -1;

  scanf("%d",&n);
  printf("%d\n",fi(n));

  return 0;
}



Measured memory_bytes: 2104
def insertionSort(A, N, g):
    global count
    for i in range(g, N):
        v = A[i]
        j = i - g
        while j >= 0 and  A[j] > v:
            A[j+g] = A[j]
            j = j - g
            count += 1
            A[j+g] = v
    return 0

def shellSort(A, N):
    global count
    count = 0
    G = []
    h = 1

    while h <= N:
        G.append(h)
        h = 3 * h + 1
    
    G.reverse()

    for _ in range(len(G)):
        insertionSort(A, N, G[_])
    return G

if __name__ == '__main__':
    N = int(input())
    A = [int(input()) for x in range(N)]

    m = shellSort(A, N)
    print(len(m))
    print(' '.join(map(str,m)))
    print(count)
    print(*A, sep='\n')


Measured memory_bytes: 53288
#include <iostream>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <algorithm>

typedef long long ll;

using namespace std;

int main() {
    set<string> keihin;
    int N;
    cin >> N;
    for (int i = 0; i < N; i++) {
        string s;
        cin >> s;
        keihin.insert(s);
    }
    cout << keihin.size() << endl;
    return 0;
}



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

const double eps = 1e-9;

struct Task {
	int n, c, k;
	vector<int> t;

	Task(int n, int c, int k): n(n), c(c), k(k) , t(n){
		for (auto& item : t) {
			cin >> item;
		}
	}

	void run() {
		sort(t.begin(), t.end());
		int placesLeft = 0;
		int when = 0;
		int result = 0;

		for (auto& item : t) {
			if (!placesLeft || when < item) {
				when = item + k;
				placesLeft = c - 1;
				++result;
			} else {
				--placesLeft;
			}
		}

		cout << result << '\n';
	}
};

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

	int t = 1;
	while (t--) {
		int n, c, k;
		cin >> n >> c >> k;
		Task test(n, c, k);
		test.run();
	}
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;

void solve(){
    int n,k;
    cin >> n >> k;
    int h[n+10];
    rep(i,n){
        cin >> h[i];
    }
    int dp[n+10];
    dp[0]=0;
    dp[1]=abs(h[1]-h[0]);
    for(int i=2; i<n; i++){
        //dp[i-k]+abs(h[i]-h[i-k])の最小値を求めればいい
        //dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]) , dp[i-2]+abs(h[i]-h[i-2]));
        int m=1e9;
        for(int j=1; j<=k; j++){
            if(i>=j) m = min(m, dp[i-j]+abs(h[i]-h[i-j]));
        }
        dp[i]=m;
    }
    cout << dp[n-1] << endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<set>
#include<map>
#include<cmath>
#include<algorithm>
using namespace std;
#include<vector>
#define int long long int
vector<int> vec;
int power(int a,int b)
{
	int x=pow(a,b);
	return x;
}
int stooi(vector<int> &here)
{
	int answer=0;
	int n=here.size();
	int j;
	for(j=0;j<n;j++)
	{
		answer+=(here[j])*power(10,n-1-j);
	}
	return answer;
}
void function2(vector<int> &here,int initial,int final,int count1,int count2,int count3)
{
	if(initial>final)
	{
		int x=stooi(here);
		if(count1!=0&&count2!=0&&count3!=0)
		{
			vec.push_back(x);
		}
	}
	else
	{
		here.push_back(3);
		function2(here,initial+1,final,count1+1,count2,count3);
		here.pop_back();
		here.push_back(5);
		function2(here,initial+1,final,count1,count2+1,count3);
		here.pop_back();
		here.push_back(7);
		function2(here,initial+1,final,count1,count2,count3+1);
		here.pop_back();
	}
}
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int j;
	int n;
	cin>>n;
	for(j=1;j<=9;j++)
	{
		vector<int> here;
		function2(here,0,j-1,0,0,0);
	}
	sort(vec.begin(),vec.end());
	int answer=0;
	for(j=0;j<vec.size();j++)
	{
		if(vec[j]<=n)
		   answer++;
    }
    cout<<answer<<endl;
}



Measured memory_bytes: 4204
#include<iostream>
#include<string>
#include<cstring>
using namespace std;
 
string S,R;
char T[5]="ACGT";
int U,a,q;
 
int power[12]={1,4,16,64,256,1024,4096,16384,65536,262144,1048576,4194304};
 
bool V;
 
bool x1[4];
bool x2[16];
bool x3[64];
bool x4[256];
bool x5[1024];
bool x6[4096];
bool x7[16384];
bool x8[65536];
bool x9[262144];
bool x10[1048576];
bool x11[4194304];
bool x12[16777216];
 
void insert(){
    U=0;
    for(int i=0;i<S.size();i++){
        for(int j=0;j<4;j++){
            if(T[j]==S[i]){
                U += power[i]*j;
            }
        }
    }
    a=S.size();
    if(a==1){
        x1[U]=true;
    }
    if(a==2){
        x2[U]=true;
    }
    if(a==3){
        x3[U]=true;
    }
    if(a==4){
        x4[U]=true;
    }
    if(a==5){
        x5[U]=true;
    }
    if(a==6){
        x6[U]=true;
    }
    if(a==7){
        x7[U]=true;
    }
    if(a==8){
        x8[U]=true;
    }
    if(a==9){
        x9[U]=true;
    }
    if(a==10){
        x10[U]=true;
    }
    if(a==11){
        x11[U]=true;
    }
    if(a==12){
        x12[U]=true;
    }
}
 
void find(){
    U=0;
    V=false;
    for(int i=0;i<S.size();i++){
        for(int j=0;j<4;j++){
            if(T[j]==S[i]){
                U += power[i]*j;
            }
        }
    }
    a=S.size();
    if(a==1 && x1[U]==true){
        V=true;
    }
    if(a==2 && x2[U]==true){
        V=true;
    }
    if(a==3 && x3[U]==true){
        V=true;
    }
    if(a==4 && x4[U]==true){
        V=true;
    }
    if(a==5 && x5[U]==true){
        V=true;
    }
    if(a==6 && x6[U]==true){
        V=true;
    }
    if(a==7 && x7[U]==true){
        V=true;
    }
    if(a==8 && x8[U]==true){
        V=true;
    }
    if(a==9 && x9[U]==true){
        V=true;
    }
    if(a==10 && x10[U]==true){
        V=true;
    }
    if(a==11 && x11[U]==true){
        V=true;
    }
    if(a==12 && x12[U]==true){
        V=true;
    }
    if(V==true){
        cout<<"yes"<<endl;
    }
    else{
        cout<<"no"<<endl;
    }
}
 
int main(){
    cin>>q;
    for(int i=0;i<q;i++){
        cin>>R>>S;
        if(R=="insert"){
            insert();
        }
        if(R=="find"){
            find();
        }
    }
    return 0;
}

Measured memory_bytes: 2572
#include <stdio.h>
#include <stdlib.h>

int gcd(int a, int b)
{
  int c;
  if(b<a)
  {
    c = a;a = b;b = c;
  }
  for(c=a%b; c!=0; c=a%b)
  {
    a=b;b=c;
  }
  return b;
}

main()
{
  int N,X,i,*x,a;
  
  scanf("%d%d",&N,&X);
  x = malloc(sizeof (int)*N);
  
  for(i=0; i<N; i++)
  {
    scanf("%d",&a);
    x[i] = abs(a - X);
  }
  
  for(i=0; i<N-1; i++)
  {
    x[i+1] = gcd(x[i], x[i+1]);
  }
  
  printf("%d\n",x[N-1]);
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>

#include <vector>

#include <algorithm>

using namespace std;

#define repeat(n) for(int _ = 1; _ <= n; _++)

int main()
{
	ios::sync_with_stdio(false);
#ifdef CAI_WEI_HAN
	freopen("test.in", "r", stdin);
#endif
	
	string a, b, c;
	cin >> a >> a >> b >> c;
	
	int ans = 0;
	for(int i = 0; i < a.length(); i++) {
		if(a[i] == b[i] && b[i] == c[i])
			;
		
		else if(a[i] == b[i] || a[i] == c[i] || b[i] == c[i])
			ans += 1;
		
		else
			ans += 2;
	}
	
	cout << ans;
}


Measured memory_bytes: 256
N=int(input())
xl=[list(map(int,input().split()))for _ in range(N)]
rl=[[x+l,x-l]for x,l in xl]
rl.sort()
now=-10**9
ans=0
for r,l in rl:
    if l>=now:
        ans+=1
        now=r
print(ans)

Measured memory_bytes: 42716
import java.util.*;

public class Main{
  static public void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    
    String input = sc.next();
    
    if(input.equals("ABC")){
      System.out.println("ARC");
    }else{
      System.out.println("ABC");
    }
    
  }
}

Measured memory_bytes: 35620
from math import *
from collections import *
from itertools import *
from bisect import *
from operator import *
import sys
sys.setrecursionlimit(1000000)
def io():
    return map(int,input().split())
def op():
    return list(map(int,input().split()))
def o():
    return int(input())
def kl(con,x=0):
    if x==0:print('Yes') if con else print('No')
    elif x==1:print('yes') if con else print('no')
    elif x==2:print('YES') if con else print('NO')

MOD =    1000000007
MAX=2147483647
MIN=-2147483648
p=input
l,l1,l2,l3=[],[],[],[]
# for _ in range(o()):
n,k=io()
l=op()
x=y=0
i=0
fr=[0]*(200002)
while 1:
    if fr[l[i]]==0:
        l1.append(l[i])
        fr[l[i]]=1
        i=l[i]-1
    else:
        y=l1.index(l[i])
        x=len(l1)-y
        break
if k<=len(l1):
    print(l1[k-1])
else:
    k-=y
    k%=x
    if k==0:
        k=x
    print(l1[y+k-1])

Measured memory_bytes: 96172
from operator import xor

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

D = {}

for a in A :
    if a not in D :
        D[a] = 1
    else :
        D[a] += 1

if len(D) == 1 and D.get(0,0) == N :
    ans = "Yes"
elif len(D) == 3 :
    V = list(D.values())
    K = list(D.keys())
    
    if xor(K[0],K[1]) != K[2] :
        ans = "No"
    elif (V[0] == V[1] == V[2]) :
        ans = "Yes"
    else :
        ans = "No"
elif len(D) == 2 :
    if D.get(0,0)*3 == N or D.get(0,0)*3 - 1 == N :
        ans = "Yes"
    else :
        ans = "No"
else :
    ans = "No"
print(ans)

Measured memory_bytes: 14212
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1e9+7;
const int N=2e5+9;
int main()
{
    FASTINOUT;
    int x;
    cin>>x;
    string s;
    cin>>s;
    char cur=s[0];
    int c=1;
    for (int i=1;i<x;i++){
        if (cur!=s[i]){
            c++;
            cur=s[i];
        }
    }
    cout<<c;
    return 0;
}


Measured memory_bytes: 512
#include <stdio.h>

int main()
{
    int x[3]={0},i,maior=0,area=0;
    scanf("%d%d%d",&x[0],&x[1],&x[2]);
    for(i=0;i<3;i++)
    {
        if(x[i]>maior)
        {
            maior=x[i];
        }
    }

    if(x[0]==maior)
    {
        x[0]=1;
    }else if(x[1]==maior)
    {
        x[1]=1;
    }else if(x[2]==maior)
    {
        x[2]=1;
    }
    area=x[0]*x[1]*x[2]*1/2;
    printf("%d\n",area);

    return 0;
}


Measured memory_bytes: 128
import java.util.*;

 class Main {
 	public static void main(String[] args) {
 		Scanner sc = new Scanner(System.in);
 		int N = Integer.parseInt(sc.next());
 		int[] x = new int[N];
 		int[] y = new int[N];
 		int[] h = new int[N];
 		for (int i=0;i<N;i++) {
 			x[i] = Integer.parseInt(sc.next());
 			y[i] = Integer.parseInt(sc.next());
 			h[i] = Integer.parseInt(sc.next());
 		}

 		loop:for (int i=0;i<=100;i++) {
 			for (int j=0;j<=100;j++) {
 				for (int l=0;l<N;l++) {//
	 				int height = h[l]+Math.abs(x[l]-i)+Math.abs(y[l]-j);//
	 				for (int k=0;k<N;k++) {
	 					int h_pred = h[k]+Math.abs(x[k]-i)+Math.abs(y[k]-j);
	 					if (h[k]==0) {
	 						if (height>h_pred) {
	 							break;
	 						}
	 					} else {
		 					if (height!=h_pred) {
		 						break;
		 					}
	 					}
	 					if (k==N-1) {
	 						System.out.println(i + " " + j + " " + height);
	 						break loop;
	 					}
	 				}
	 			}
 			}
 		}
 	}
 }

Measured memory_bytes: 23764
import bisect
import collections
import copy
import functools
import heapq
import math
import sys
from collections import deque
from collections import defaultdict
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
INF = float("inf")
MOD = 10**9+7

kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]
 
gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]
 
def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

def nPr(n,r):
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

N,K = map(int,input().split())
lines = [[] for _ in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    lines[a-1].append(b-1)
    lines[b-1].append(a-1)

not_visited = [-1]*N
not_visited[0] = 0
stack = deque()
stack.append(0)

ans = K
loop = 1
while stack:
    now = stack.popleft()
    c = len(lines[now])
    if loop == 1:
        ans *= nPr(K-1,c)
    else:
        ans *= nPr(K-2,c-1)
    for nex in lines[now]:
        if not_visited[nex] == -1:
            not_visited[nex] =  not_visited[now] + 1
            stack.append(nex)
    loop += 1
    ans %= MOD

print(ans)

Measured memory_bytes: 102924
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    map<string,int> ma;
    int vmax=0;
    for(int i=0;i<n;i++){
        string a;
        cin>>a;
        if(ma.find(a)==ma.end()){
            ma[a]=1;
        }else{
            ma[a]++;
        }
        vmax=max(vmax,ma[a]);
    }
    priority_queue<string,vector<string>,greater<string>> ans;
    for(auto it=ma.begin();it!=ma.end();it++){
        if(it->second==vmax){
            ans.push(it->first);
        }
    }
    while(!ans.empty()){
        cout<<ans.top()<<"\n";
        ans.pop();
    }
    return(0);
}

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

int main(){
  long long n,smallest=1000000000000008,ans=0;
  cin >> n;
  long long a[6];
  for(int i = 1;i<=5;i++)
  {
    cin >> a[i];
    if(a[i]<smallest)smallest = a[i];
  }
  ans=4+(n+smallest-1)/smallest;
  cout << ans <<endl;
  return 0;
}
  
  

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

typedef long long LL;
const int N = 1e5 + 50;
const int mod = 1e9 + 7;

inline void Inc(int &x, int y) {
  if ((x += y) >= mod) x -= mod;
}

struct BIT {
  int a[N];
  BIT() { memset(a, 0, sizeof a); }
  inline void add(int x, int val) {
    for (; x < N; x += x & (- x)) Inc(a[x], val);
  }
  inline int Sum(int x) {
    int res = 0;
    for (; x > 0; x -= x & (- x)) Inc(res, a[x]);
    return res;
  }
  inline void Add(int l, int r, int val) {
    l = max(l, 1);
    if (l > r) return;
    add(l, val); add(r + 1, mod - val);
  }
} F, G;

int n;
LL A, B, a[N], ra[N], rb[N];

int main() {
  scanf("%d%lld%lld", &n, &A, &B);
  for (int i = 1; i <= n; i ++) scanf("%lld", &a[i]);
  a[0] = - 2e18;
  a[n + 1] = 2e18;
  ra[n] = rb[n] = n;
  for (int i = n - 1; ~ i; i --) {
    ra[i] = rb[i] = i;
    if (a[i + 1] - a[i] >= A) ra[i] = ra[i + 1];
    if (a[i + 1] - a[i] >= B) rb[i] = rb[i + 1];
  }
  int f, g;
  for (int i = 0, pa = 1, pb = 1; i <= n; i ++) {
    f = i ? F.Sum(i) : 1;
    g = i ? G.Sum(i) : 1;
    while (pa <= n + 1 && a[pa] - a[i] < A) pa ++;
    while (pb <= n + 1 && a[pb] - a[i] < B) pb ++;
    if (pa <= n + 1) G.Add(pa - 1, rb[i + 1], f);
    if (pb <= n + 1) F.Add(pb - 1, ra[i + 1], g);
  }
  Inc(f, g);
  printf("%d\n", f);
  return 0;
}


Measured memory_bytes: 3328
#include <iostream>

using namespace std;

int main(void){
    int a=0;
    int b=0;
    int c=0;

    cin >> a >> b >> c;

    if(a==7&&b==5&&c==5)cout << "YES" << endl;
    else if(a==5&&b==7&&c==5)cout << "YES" << endl;
    else if(a==5&&b==5&&c==7)cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}

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

#define int long long

#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint,int> P1;
typedef pair<int,pint> P2;
typedef pair<pint,pint>PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD=1000000007;
const ll INF=1e18;
int dx[]={0,0,1,-1};
int dy[]={-1,1,0,0};

int N;

signed main(){
    cin.tie(0);
	ios::sync_with_stdio(false);
    cin>>N;
    int k=2;
    while(k*(k-1)<N*2){
        k++;
    }
    if(k*(k-1)!=N*2){
        cout<<"No"<<endl;
        return 0;
    }
    cout<<"Yes"<<endl;
    cout<<k<<endl;
    vector<vint> G(k);
    
    int pos=1;
    rep(i,0,k){
        rep(j,1,k-i){
            G[i].pb(pos);
            G[i+j].pb(pos);
            pos++;
        }
    }
    
    rep(i,0,k){
        cout<<k-1;
        for(auto x:G[i])cout<<" "<<x;
        cout<<endl;
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}

Measured memory_bytes: 3200
N, M = list(map(int, input().split()))

A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

result = False
for i in range(N - M + 1):
    for j in range(N - M + 1):
        for k in range(M):
            s1 = A[i + k][j : j + M]
            s2 = B[k]
            if s1 != s2:
                break
        else:
            result = True
            break

if result == True:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
using System;
using static System.Console;

class Program
{
    public static void Main(string[] args)
    {
        int N = int.Parse(ReadLine());
        int A = int.Parse(ReadLine());

        // 500円で払いきれるか判定
        if ((500 - N) >= 0)
        {
            WriteLine("Yes");
        }
        else
        {
            int temp = N % 500;
            WriteLine((A - temp) >= 0 ? "Yes" : "No");
        }
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>

using namespace std;

int main()
{
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  
  int num_negs = 0;
  for (int i = 0; i < N; ++i) {
    if (A[i] < 0) ++num_negs;
  }

  vector<long long> B(N);
  for (int i = 0; i < N; ++i) {
    B[i] = abs(A[i]);
  }

  long long sum = 0;
  for (int i = 0; i < N; ++i) {
    sum += B[i];
  }

  if (num_negs % 2 == 0) {
    cout << sum << endl;
  }
  else {
    sort(B.begin(), B.end());
    cout << sum - 2 * B[0] << endl;
  }
  
  return 0;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

int main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int x, a;
    cin >> x >> a;

    if (x < a) {
        cout << 0 << "\n";
    } else {
        cout << 10 << "\n";
    }

    return 0;
}

Measured memory_bytes: 888
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????

		BufferedReader insBR = new BufferedReader(new InputStreamReader(System.in));
		//??£??????????????????????????????????????°
		String strLine = "";

		while(true){
			try{

				String strScan = insBR.readLine();
				if("".equals(strScan) || strScan == null){
					break;
				}else{
					strLine += strScan;
				}


			}catch(IOException e){
				System.out.println(e);
			}

		}

		//?°????????????????
		strLine = strLine.toLowerCase();
		//System.out.println("strLine:" + strLine);

		//str???????§£??????char[]???????´?
		char[] aryLine= strLine.toCharArray();
		//System.out.println("aryLine.length:" + aryLine.length);

		char x = 'a';

		//int[] intCount = new int[26];

		//a???z?????§?????°?????????
		for(int i = 'a'; i <= 'z'; i++){
			//??¢????????????????????????????????????????????°
			int intCount = 0;
			//????????????length?????°?????????
			for(int j = 0; j < aryLine.length; j++){

				//System.out.println("int i:" + i );

				int alphNum = aryLine[j];
				//System.out.println("alphNum:" + alphNum);
				//??¢???????????????????????????????????¢??????
				if( i == alphNum){
					//System.out.print("i:" + i + "/j:" + alphNum);
					//System.out.print(" ");
					intCount++;
				}
			}

			System.out.print(x++);
			System.out.println(" : " + intCount);

		}
	}

}

Measured memory_bytes: 17800
import numpy as np
# 完成状態は010101 or 101010

S = np.array(list(input()), dtype = np.int8)
L = len(S)
A = np.arange(L) & 1
B = 1 - A

x1 = (A != S).sum()
x2 = (B != S).sum()
answer = min(x1,x2)
print(answer)

Measured memory_bytes: 14284
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using ll = long long;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
const ll INF = 1LL << 60;

struct mint {
  ll x;
  mint(ll x = 0) : x(x % MOD) {}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD - a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime MOD
  mint inv() const { return pow(MOD - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  rep(i, s.size()) {
    if (s[i] == '1')
      s[i] = '9';
    else
      s[i] = '1';
  }
  cout << s << endl;
  return 0;
}


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

int main()
{
	int h, w;
	cin >> h >> w;
	auto p = vector<string>(h);
	for(auto& q : p) cin >> q;
	cout << string(w + 2, '#') << endl;
	for(auto q : p) cout << "#" << q << "#" << endl;
	cout << string(w + 2, '#') << endl;
	return 0;
}

Measured memory_bytes: 256
use std::cmp::{max, min};
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let n: usize = input().unwrap();
    let h: Vec<i32> = input_vec().unwrap();

    let mut ans = h[0];
    for i in 0..n-1 {
        if h[i+1] > h[i] {
            ans += h[i+1] - h[i];
        }
    }

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

fn input<T: FromStr>() -> Result<T, T::Err> {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    Ok(buf.trim().parse().ok().unwrap())
}

fn input_vec<T: FromStr>() -> Result<Vec<T>, T::Err> {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    Ok(buf
        .trim()
        .split_whitespace()
        .map(|x| x.parse().ok().unwrap())
        .collect::<Vec<_>>())
}

fn input_two<T: FromStr>() -> Result<(T, T), T::Err> {
    let tmp = input_vec::<String>().unwrap();
    Ok((tmp[0].parse()?, tmp[1].parse()?))
}

fn input_three<T: FromStr + Clone>() -> Result<(T, T, T), T::Err> {
    let tmp = input_vec::<T>().ok().unwrap();
    // println!("{:?}", tmp);
    Ok((tmp[0].clone(), tmp[1].clone(), tmp[2].clone()))
}


Measured memory_bytes: 4352
import heapq
X,Y,Z,K = map(int,input().split())
As = sorted(list(map(int,input().split())),reverse=True)
Bs = sorted(list(map(int,input().split())),reverse=True)
Cs = sorted(list(map(int,input().split())),reverse=True)
q = []
heapq.heapify(q)
heapq.heappush(q,(-(As[0]+Bs[0]+Cs[0]),0,0,0))
list_ijk = [(0,0,0)]
for i in range(K):
    # valueのマイナス値の小さい順にpop(優先度付きqueue)
    v,i,j,k = heapq.heappop(q)
    if i < len(As)-1 and (i+1,j,k) not in list_ijk:
        heapq.heappush(q,(-(As[i+1]+Bs[j]+Cs[k]),i+1,j,k))
        list_ijk.append((i+1,j,k))
    if j < len(Bs)-1 and (i,j+1,k) not in list_ijk:
        heapq.heappush(q,(-(As[i]+Bs[j+1]+Cs[k]),i,j+1,k))
        list_ijk.append((i,j+1,k))
    if k < len(Cs)-1 and (i,j,k+1) not in list_ijk:
        heapq.heappush(q,(-(As[i]+Bs[j]+Cs[k+1]),i,j,k+1))
        list_ijk.append((i,j,k+1))
    print(-v)    

Measured memory_bytes: 4572
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repm(i,m,n) for (int i = (m); i < (n); i++)
#define rrep(i,n) for (int i = (n); i >= 0; i--)
using namespace std;
typedef long long ll;

int main() {
  int n;
  cin >> n;
  
  cout << 1110 - n << endl;
   
  return 0;
}

Measured memory_bytes: 256
H,W,N=map(int,input().split())
AB=[list(map(int,input().split())) for i in range(N)]

from collections import defaultdict
from collections import Counter

ANS = defaultdict(int)

for a,b in AB:
    for i in [a-1,a,a+1]:
        for j in [b-1,b,b+1]:
            if 2<=i<H and 2<=j<W:
                ANS[(i,j)]+=1

counter=Counter(ANS.values())
ANSLIST=[0]*10
for c in counter:
    ANSLIST[c]=counter[c]
ANSLIST[0]=(H-2)*(W-2)-sum(counter.values())

for a in ANSLIST:
    print(a)

Measured memory_bytes: 166228
N,M=map(int,input().split())
X=list(map(int,input().split()))
X.sort()
d=[0]*(M-1)
for i in range(M-1):
    d[i]=X[i+1]-X[i]
d.sort(reverse=True)
ans=0
for i in range(N-1,M-1):
    ans+=d[i]
print(ans)

Measured memory_bytes: 14088
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll dp[100005][4];
vector<ll> adj[100005];
ll func(ll i,ll x)
{
	ll j,max1=0,d;
	if(x!=0)
	{
		if(dp[i][x]!=-1)
			return dp[i][x];
	}
	for(j=1;j<=3;j++)
	{
		if(j!=x)
		{
			d=func(i-1,j)+adj[i][j-1];
			if(d>max1)
				max1=d;
		}
	}
	dp[i][x]=max1;
	return dp[i][x];
	
}
int main()
{
	ll n,i,a,b,c,j;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=3;j++)
			dp[i][j]=-1;
	}
	for(i=1;i<=n;i++)
	{
		cin>>a>>b>>c;
		adj[i].push_back(a);
		adj[i].push_back(b);
		adj[i].push_back(c);
	}
	cout<<func(n,0)<<endl;
}


Measured memory_bytes: 16640
import sys
n,k = list(map(int, input().split()))
s = list(input())

if s[k-1] == "A":
    s[k-1] = "a"
elif s[k-1] == "B":
    s[k-1] = "b"
else:
    s[k-1] = "c"

print("".join(s))

Measured memory_bytes: 3060
class unionfind:
    def __init__(self, n):
        self.n = n
        self.root = [-1]*(n+1)
        self.rnk = [0]*(n+1)
    def find(self, x):
        if(self.root[x] < 0):
            return x
        else:
            self.root[x] = self.find(self.root[x])
            return self.root[x]
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if(x == y):
            return 
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x
        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1
    def same(self, x, y):
        return self.find(x) == self.find(y)
    def count(self, x):
        return -self.root[self.find(x)]
import sys
input=sys.stdin.readline
n=int(input())
l=[tuple(map(int,input().split())) for i in range(n)]
l.sort(key=lambda x:x[0])
import collections
d=collections.defaultdict(int)
j=1
for i in l:
    if d[i]==0:
        d[i]=j
        j+=1
pq=[]
for i in range(n-1):
    pq.append((l[i+1][0]-l[i][0],d[l[i]],d[l[i+1]]))
l.sort(key=lambda x:x[1])
for i in range(n-1):
    pq.append((l[i+1][1]-l[i][1],d[l[i]],d[l[i+1]]))
ans=0
pq.sort(key=lambda x:x[0])
uf=unionfind(n)
for c,x,y in pq:
    if not uf.same(x,y):
        ans+=c
        uf.unite(x,y)
print(ans)

Measured memory_bytes: 133716