akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
// types
typedef long long ll; 
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
// IO
#define fo(i, n) for (int i = 0; i < n; i++)
#define fo1(i, n) for (int i = 1; i <= n; i++)
#define sc(n) scanf("%d", &n) 
#define sca(a, n) fo(i, n) sc(a[i])
#define pd(a) printf("%d ", a)
#define pld(a) printf("%d\n", a)
#define pda(a, n) fo(i, n) pd(a[i])
#define pl printf("\n")
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b) 
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
// math
const ll mod = 1e9+7;
template<typename T> T gcf(T a, T b) {return (b == 0) ? a : gcf(b, a%b);} 
template<typename T> T lcm(T a, T b) {return (a*b)/gcf(a, b);}
template<typename T> T sumTo(T x) {return x * (x+1) / 2;}
template<typename T> T sumSquaresTo(T x) {return x * (x+1) * (2*x+1) / 6;}
template<typename T> T ceilDiv(T n, T d) {return (n+d-1)/d;}

int diff(int a, int b) {
    return max(a-b, b-a);
}

void solve() {
    int n; sc(n);
    string s; cin >> s;
    bool red[n+1]; fo1(i, n) red[i] = s[i-1] == 'R';
    int rp[n+1]; rp[0] = 0; 
    fo1(i, n) {
        rp[i] = rp[i-1];
        if (red[i]) rp[i]++;
    }
    int ans = 1e9;
    fo(nr, n+1) {
        int nswap = nr-rp[nr];
        int nrep = diff(nr, rp[n]);
        ans = min(ans, nswap+nrep);
    }
    cout << ans;
}

int main() {
    int t = 1;
    //scanf("%d", &t);
    while (t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 4764
object Main extends App {
  val ss = io.StdIn.readLine.split('/')

  val year = ss(0).toInt
  val month = ss(1).toInt
  val day = ss(2).toInt

  val out = (year,month,day) match {
    case (2019,m,_) if m <= 4 => "Heisei"
    case (y,_,_) if y >= 2019 => "TBD"
    case _ => "Heisei"
  }

  println(out)
}

Measured memory_bytes: 27200
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
ans = 0
for i in range(n):
    ans += b[a[i]-1]
    if i < n-1 and a[i+1] == a[i] + 1:
        ans += c[a[i]-1]
print(ans)

Measured memory_bytes: 3064
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iostream>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <string>
#include <vector>
#include <iomanip>
 
using namespace std;
typedef long long ll;
using gra = vector<vector<ll>>;
using gram = vector<unordered_map<ll,ll>>;
 
typedef unsigned long long ull;
 
template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
 
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> T dup(T a, T b) { return (a + b - 1) / b; }
template <class T> T modpow(T x, T p, T m) { T a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
// template <class T> void prim(T a) { for(ll i=0;i<a.size();++i) { cout << a[i]; } cout << "\n"; }
template< typename T >
T mod_pow(T x, T n, const T &p) {
  T ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= p;
    (x *= x) %= p;
    n >>= 1;
  }
  return ret;
}
 
#define mod 1000000007LL
#define INF 10000000000000000LL
 
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (ll i = 1; i <= n; ++i)
#define rrep(i, n) for (int i = (n - 1); i >= 0; --i)
#define rrep1(i, n) for (int i = n; i > 0; --i)
 
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
//#define modpow(x, p, m) { ll a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
 
#define m0(h) memset(h, 0, sizeof(h))
#define m1(h) memset(h, 1, sizeof(h))
#define m(h, n) memset(h, (n), sizeof(h))
#define all(n) (n).begin(),(n).end()
#define bit(n) (1LL << (n))
#define pb push_back
#define mp make_pair
 
//#ifdef LOCAL
//
//#define dpri(...) fprintf(stderr, __VA_ARGS__)
//#define pria(g) rep(i,g.size()){ cout << i << "{"; rep(j,g[i].size()) cout << g[i][j] << " "; cout << "}" << "\n"; }
//#else
//#define dpri(...) 42
//#define pria(g) 42
//#endif
//
//
//
 

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ---------------------
  // コーディング開始
  // ---------------------
  ll n;
  ll k;
  double p;
  cin >> n >> k;
  vector<double> d;
  d.pb(0);
  rep(i,n){
    cin >> p;
    double g = p*(p+1)/2.0/p + d[i];
    //double g = p*(p+1)/2.0/p;
    d.pb(g);
    //pri(g);
  }
  double ans = 0;
  rep1(i,n-k+1){
      //pri(d[i+k-1]-d[i-1]);
      chmax(ans,d[i+k-1]-d[i-1]);
  }
  cout << fixed << setprecision(12) << ans << endl;
  //pri(ans);


  return 0;
}


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

int n, h[101010];

int main(){
  cin >> n;
  rep(i, n) cin >> h[i];
  h[n] = 1e9 + 100;
  h[0]--;
  for(int i = 1; i < n; i++){
    if(h[i] > h[i - 1])
      h[i]--;
    if(h[i] > h[i + 1]){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

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

signed main(){

  string s,t;
  cin >> s >> t;

  int a[26][26] = {},b[26][26] = {};

  for(int i = 0; i < s.size(); i++){
    a[s[i]-'a'][t[i]-'a'] = 1;
    b[t[i]-'a'][s[i]-'a'] = 1;
  }
  for(int i = 0; i < 26; i++){
    int cnt1 = 0,cnt2 = 0;
    for(int j = 0; j < 26; j++){
      cnt1 += a[i][j];
      cnt2 += b[i][j];
      if(cnt1 >= 2 || cnt2 >= 2){
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 776
import sys
input = sys.stdin.readline
from operator import itemgetter
from scipy.sparse import csr_matrix
import numpy as np

N = int(input())

XY = [[i] + [int(x) for x in input().split()] for i in range(N)]

edge = [set() for _ in range(N)]
for key in [itemgetter(1),itemgetter(2)]:
  XY.sort(key = key)
  for i in range(N-1):
    i1,x1,y1 = XY[i]
    i2,x2,y2 = XY[i+1]
    d = min(abs(x1-x2),abs(y1-y2))
    edge[i1].add((i2,d))
    
# csr形式に直す
col = []
row = []
value = []
for i in range(N):
  for j,v in edge[i]:
    col.append(i)
    row.append(j)
    value.append(v)
value = np.array(value,dtype=int)
graph = csr_matrix((value,(row,col)),shape=(N,N))

# 最小全域木
from scipy.sparse.csgraph import minimum_spanning_tree
tree = minimum_spanning_tree(graph, overwrite = True).astype(int)
answer = tree.sum()
print(answer)

Measured memory_bytes: 91628
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		if(a < b && b < c && a < c) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 26228
import datetime
import calendar

def trans(month, day, year=2004):
    past = datetime.date(year, month, day)
    result = calendar.day_name[past.weekday()]
    return result
    
while True:
    month, day = map(int, input().split())
    if month == day == 0: break
    print(trans(month, day))
    


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

using namespace std;

const int maxn = 300010, p = 998244353;

#define ll long long

int n, A, B;
ll k;
int fact[maxn + 5];

int add(int a, int b){
	return ((ll) a + b) % p;
}

int mul(int a, int b){
	return ((ll) a * b) % p;
}

int pot(int x){
	int arr[38];
	arr[0] = x;
	
	for(int i = 1; i < 31; i++){
		arr[i] = mul(arr[i - 1], arr[i - 1]);
	}
	
	int sol = 1;
	
	for(int i = 0; i < 31; i++){
		if((p - 2) & (1 << i)) sol = mul(sol, arr[i]);
	}
	
	return sol;
}

int divi(int a, int b){	
	return mul(a, pot(b));
}

int main(){
	cin >> n >> A >> B >> k;
	
	fact[0] = 1;
	
	for(int i = 1; i < maxn; i++) fact[i] = mul(fact[i - 1], i);
	
	int sum = 0;
		
	for(int a = 0; a <= n; a++){
		ll x = (ll)a * (ll)A;
		int b;
		
		if(k < x) continue;
		
		if((k - x) % B != 0) continue;
		
		b = (k - x) / B;
		
		if(b > n) continue;
		
		int c = divi(fact[n], fact[n - a]);
		int d = divi(fact[n], fact[n - b]);
		int e = divi(c, fact[a]);
		int f = divi(d, fact[b]);		
		
		sum = add(sum, mul(e, f));
	}
	
	cout << sum;

	return 0;
}

Measured memory_bytes: 4768
// abc054b: Template Matching
#include <bits/stdc++.h>
using namespace std;

using vs = vector<string>;

#define rep(i,n) for(int i=0;i<(n);i++)
#define in(x) cin>>(x)
#define oute(x) cout<<(x)<<endl

bool page(int ox, int oy, vs &map, vs &man){
  int n=man.size();
  bool flag = true;
  rep(y,n){
    string mini = map[oy+y].substr(ox,n);
    if(mini != man[y]){
      flag = false;
      break;
    }
  }
  return flag;
}

int main(){
  int n,m;in(n);in(m);
  vs a(n), b(m);
  rep(i,n) in(a[i]);
  rep(i,m) in(b[i]);

  int org_n = n-m+1;
  rep(oy,org_n){
    rep(ox,org_n){
      bool res = page(ox,oy,a,b);
      if(res){
        oute("Yes");
        return 0;
      }
    }
  }
  oute("No");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,d[1000];
  cin>>n;
  for(int i=0;i<n;i++)cin>>d[i];
  int cnt[10000]={};
  for(int i=n-1;i>=0;i--){
    int sum=0;
    for(int j=0;j<4;j++){
      if(i-j<0)break;
      sum+=d[i-j]*pow(10,j);
      cnt[sum]++;
    }
  }
  int i=0;
  while(cnt[i])i++;
  cout<<i<<endl;
  return 0;
}



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

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


Measured memory_bytes: 3592
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

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

        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {
            List<String> firstRow = Arrays.asList(br.readLine().split(" "));
            int N = Integer.parseInt(firstRow.get(0));
            int K = Integer.parseInt(firstRow.get(1));

            List<String> secondRow = Arrays.asList(br.readLine().split(" "));
            List<Integer> lengthList = new ArrayList<>();
            for (String str : secondRow) {
                lengthList.add(Integer.parseInt(str));
            }

            sortNaturalOrder(lengthList);

            int ans = 0;
            for (int i = lengthList.size() - 1; K > 0; i--) {
                ans += lengthList.get(i);
                K--;
            }

            System.out.println(ans);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }

    private static void sortNaturalOrder(List<Integer> intList) {
        for (int i = 0; i < intList.size() - 1; i++) {
            for (int j = intList.size() - 1; j > i; j--) {
                if (intList.get(j - 1) > intList.get(j)) {
                    int tmp = intList.get(j - 1);
                    intList.set(j - 1, intList.get(j));
                    intList.set(j, tmp);
                }
            }
        }
    }
}

Measured memory_bytes: 21332
#include <stdio.h>

void swap(int* a, int* b){
    int temp;

    temp = *a;
    *a = *b;
    *b = temp;
}

void swap1(int *x, int *y)
{
    *y ^= *x;  *x ^= *y;  *y ^= *x;
}

void swap2(int *x, int *y)
{
    *y = *x - *y;  *x -= *y;  *y += *x;
}

int main(void){
    int x, y, z;

    scanf("%d %d %d", &x, &y, &z);

    swap(&x, &y);
    swap1(&x, &z);

    printf("%d %d %d\n", x, y, z);

    return 0;
}

Measured memory_bytes: 1688
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>

int main(){
  int A, B, C, X; cin >> A >> B >> C >> X;

  int cnt = 0;
  for (int a=0;a<=A;a++){
    for (int b=0;b<=B;b++){
      int res = X-500*a-100*b;
      if (res%50==0 && 0<=res && res/50 <= C) cnt++; 
    }
  }

  cout << cnt << endl;



  // cout << fixed << setprecision(6);
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    Scanner in = new Scanner(System.in);
    public void solve() {
        int n = in.nextInt(), k = in.nextInt();
        int[] l = new int[n];
        for(int i = 0; i < n; i++) {
        		l[i] = in.nextInt();
        }
        Arrays.sort(l);
        int sum = 0;
        for(int i = l.length - 1; i > l.length - 1 - k; i--) {
        		sum += l[i];
        }
        System.out.println(sum);
   

    }

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

Measured memory_bytes: 23508
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int a,b;
	cin>>a>>b;
	int p=(a+b);
	int q=(abs(a-b));
	if(p%2==0 || q%2==0)
	{
		if(p%2==0)
		{
			cout<<p/2<<endl;
		}
		else
		cout<<q/2<<endl;
	}
	else
	cout<<"IMPOSSIBLE"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> h(n);
  for(int i=0; i<n; i++) cin >> h[i];
  sort(h.begin(), h.end());
  ll minn = 1000000000;
  for(int i=0; i<n-k+1; i++){
    ll rem = h[i+k-1]-h[i];
    minn = min(minn, rem);
  }
  cout << minn << endl;
}

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

int main(){
    string s;
    cin >> s;
    if(s[0] == s[1] || s[1] == s[2] || s[2] == s[3]){
        cout << "Bad" << endl;
    }
    else{
        cout << "Good" << endl;
    }
}

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

const int MOD = 1000000007;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define copy(from, to) copy(from.begin(), from.end(), back_inserter(to))
#define sort(a) sort(a.begin(), a.end())
#define reverse(s) reverse(s.begin(), s.end())
#define p(s) cout << (s) << endl

typedef long long ll;
using namespace std;

template<class T>
void load(vector<T> &v, int n) {
  for (int i = 0; i < n; ++i) {
    T t;
    cin >> t;
    v.push_back(t);
  }
}

template<class T>
T max(vector<T> &v) {
  return *max_element(v.begin(), v.end());
}

template<class T>
T min(vector<T> &v) {
  return *min_element(v.begin(), v.end());
}

void py(bool isUpper = false) {
  if (isUpper) {
    p("YES");
  } else {
    p("Yes");
  }
}

void pn(bool isUpper = false) {
  if (isUpper) {
    p("NO");
  } else {
    p("No");
  }
}

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

  int m = 0;
  for (int i = 1; i <= sqrt(x); ++i) {
    for (int j = 2; j <= 10; ++j) {
      if (pow(i, j) == x) {
        p(x);
        return 0;
      } else if (pow(i, j) < x) {
        m = max(m, (int)pow(i, j));
      }
    }
  }
  p(m);
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
   vector<long int > v;  
  int x,r,d,ans;
  scanf("%d%d%d",&r,&d,&x);
  int i;
  v.push_back(x);
  for(i=1;i<=10;++i)
  {
    ans=r*v[i-1] - d;
    v.push_back(ans);
  }
  
  for(i=1;i<v.size();++i)
      printf("%ld\n",v[i]);
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define chmin(a,b) (a)=min((a),(b));
#define chmax(a,b) (a)=max((a),(b));
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) cout<<(#v)<<":";for(auto(x):(v)){cout<<" "<<(x);}cout<<endl;
#define printVS(vs) cout<<(#vs)<<":"<<endl;for(auto(s):(vs)){cout<<(s)<< endl;}
#define printVV(vv) cout<<(#vv)<<":"<<endl;for(auto(v):(vv)){for(auto(x):(v)){cout<<" "<<(x);}cout<<endl;}
#define printP(p) cout<<(#p)<<(p).first<<" "<<(p).second<<endl;
#define printVP(vp) cout<<(#vp)<<":"<<endl;for(auto(p):(vp)){cout<<(p).first<<" "<<(p).second<<endl;}

inline void output(){ cout << endl; }
template<typename First, typename... Rest>
inline void output(const First& first, const Rest&... rest) {
    cout << first << " "; output(rest...);
}

using ll = long long;
using Pii = pair<int, int>;
using TUPLE = tuple<int, int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
const int inf = 1ll << 60;
const int mod = 1e9 + 7;
using Graph = vector<vector<int>>;

class WarshallFloyd {
private:
    const int n;
    vector<vector<int>> d;
public:
    WarshallFloyd(int _n) : n(_n), d(_n, vector<int>(_n)) {
        rep(i, n) rep(j, n) {
            d[i][j] = (i == j ? 0 : inf);
        }
    }
    // undirected
    void setDist(int i, int j, int c) {
        d[i][j] = min(d[i][j], c);
        d[j][i] = min(d[j][i], c);
    }
    int getDist(int i, int j) {
        return d[i][j];
    }
    void calc() {
        rep(k, n) rep(i, n) rep(j, n) {
            d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
        }
    }
    void disp() {
        printVV(d);
    }
};

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

    int n, m;
    while (cin >> n >> m, n) {
        vector<WarshallFloyd> wf(2, WarshallFloyd(n));
        rep(i, m) {
            int a, b, c;
            char t;
            cin >> a >> b >> c >> t;
            a--, b--;
            wf[t == 'S'].setDist(a, b, c);
        }

        rep(k, 2) wf[k].calc();

        int q;
        cin >> q;
        int s;
        vi a(n, inf);
        rep(i, q) {
            int t;
            cin >> t;
            t--;
            if (i == 0) {
                a[t] = 0;
            }
            else {
                vi b(n, inf);
                rep(j, n) {
                    chmin(b[j], a[j] + wf[0].getDist(s, t));
                    rep(k, n) {
                        if (j == k) continue;
                        chmin(b[k], a[j] + wf[0].getDist(s, j) + wf[1].getDist(j, k) + wf[0].getDist(k, t));
                    }
                }
                a = b;
            }
            s = t;
        }

        cout << *min_element(all(a)) << endl;
    }
}

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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)





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






int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    int i,j,n,x;
    LL ans=0;
    V<int>v;
    cin >> n;
    for(i=0;i<n;i++)
    {
        cin >> x;
        v.PSB(x);
    }
    sort(v.B,v.E);
    for(i=0;i<n;i++)
    {
        for(j=i+1;j<n;j++)
        {
            x=v[i]+v[j];
            auto check=lower_bound(v.B,v.E,x);
            ans+=(check-v.B-j-1);
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 384
n = int(input())
x = []
u = []
ans = 0

for i in range(n):
    a, b = map(str, input().split())
    x.append(float(a))
    u.append(b)

for i in range(n):
    if u[i] == "JPY":
        ans += x[i]
    else:
        ans += x[i] * 380000.0

print(ans)


Measured memory_bytes: 3060
#include <stdio.h>
typedef long long int lld;

int main(void) {
  int k;
  lld cnt[200], s = 0;
  scanf("%d", &k);
  for (int i = k; i > 0; i--) {
    cnt[i - 1] = (k / i) * (k / i) * (k / i);
    for (int j = i * 2; j <= k; j += i) {
      cnt[i - 1] -= cnt[j - 1];
    }
    s += i * cnt[i - 1];
  }
  printf("%lld\n", s);
}

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

int main(){
	scanf("%d%d", &n, h);
	rep(i,n-1){
		scanf("%d", h+i+1);
		if(h[i]-1 == h[i+1]) h[i+1]++;
		else if(h[i] > h[i+1]) return 0*puts("No");
	}
	puts("Yes");
}

Measured memory_bytes: 640
eval"N,*A="+`dd`.split*?,
b=A[N,N].reverse
puts N.times{|i|$*[v=A[i]]||=i;v!=b[i]||(N=v;$.=i)}<A.count(N)?:No:[:Yes,(t=[N])*(k=[$*[N]||0,b[..$.].count(N)].min),b-t,t*=b.count(N)-k]

Measured memory_bytes: 89408
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for(; n>0;n--) {
			if(Math.sqrt((double)n) % 1 == 0) {
				System.out.println(n);
				return;
			}
		}
	}
}


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

#define N 500001
#define A 500001
#define BLOCK 710 // ~sqrt(N)

int cnt[A], a[N], ans[N], answer = 0;
long long arr[N];
struct node {
	int L, R, i;
}q[N];

bool cmp(node x, node y) {
	if(x.L/BLOCK != y.L/BLOCK) {
		// different blocks, so sort by block.
		return x.L/BLOCK < y.L/BLOCK;
	}
	// same block, so sort by R value
	return x.R < y.R;
}

void add(int position) {
	cnt[a[position]]++;
	if(cnt[a[position]] == 1) {
		answer++;
	}
}

void remove(int position) {
	cnt[a[position]]--;
	if(cnt[a[position]] == 0) {
		answer--;
	}
}

unordered_map<long long, int> coords;

int main() {
	int n;
	int m;
	scanf("%d %d", &n, &m);
	coords.clear();
	int t = 0;
	for(int i=0; i<n; i++)
		scanf("%lld", &arr[i]);
	for(int i = 0; i<n; i++) {
	    if(coords.find(arr[i])==coords.end())
    	    coords[arr[i]] = t++;
	}
	for(int i = 0; i<n; i++)
    	a[i] = coords[arr[i]];
	for(int i=0; i<m; i++) {
		scanf("%d%d", &q[i].L, &q[i].R);
		q[i].L--; q[i].R--;
		q[i].i = i;
	}

	sort(q, q + m, cmp);

	int currentL = 0, currentR = 0;
	for(int i=0; i<m; i++) {
		int L = q[i].L, R = q[i].R;
		while(currentL < L) {
			remove(currentL);
			currentL++;
		}
		while(currentL > L) {
			add(currentL-1);
			currentL--;
		}
		while(currentR <= R) {
			add(currentR);
			currentR++;
		}
		while(currentR > R+1) {
			remove(currentR-1);
			currentR--;
		}
		ans[q[i].i] = answer;
	}

	for(int i=0; i<m; i++)
    	printf("%d\n", ans[i]);
}

Measured memory_bytes: 39032
//ProblemA

#ifdef _MYPC
#include "mypc.h"
#endif // _MYPC

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <memory>
#include <cstdio>
#include <cstring>

using namespace std;

//ProblemA

class Solve {
private:
	long long x, y;

	void solve() {
		cin >> x >> y;
		
		if (x % y == 0) {
			cout << -1 << endl;
		}
		else {
			cout << x << endl;
		}
	}

public:
	Solve() { solve(); }
};

int main(int argc, char* argv[]) {
	unique_ptr<Solve> solve = make_unique<Solve>();
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = 999999999;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int s,b;
    int N, A, B;
    cin >> N >> A >> B;
    char S[N];
    REP(i,N){
        cin >> S[i];
    }
    s = 0;
    b = 0;
    REP(i,N){
        if(S[i] == 'a'){
            if(s < A+B ){
                cout << "Yes\n";
                s++;
            }else{
                cout << "No\n";
            }
        }else if(S[i] == 'b'){
            if(s < A+B && b <B){
                cout << "Yes\n";
                s++;
                b++; 
            }else{
                cout << "No\n";
            }
        }else if(S[i] == 'c'){
            cout << "No\n";
        }
    }
    return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <string>

using namespace std;

int hantei(string s){
    int flag = 0;
    int len = s.size() / 2;
    if (len != 0){
        for(int i = 0; i < len ; i++){
            if(s[i] == s[s.size() - i - 1]){
                if(i == len - 1){flag = 1;}
                else{continue;}
            }
        else{break;}
        }
    }
    else{
        flag = 1;
    }

    return flag;
}

int main(){
    string s, s1,s2;
    cin >> s;
    int N = s.size();
    s1 = s.substr(0,(N - 1)/ 2);
    s2 = s.substr((N + 1) / 2, (N - 1) / 2);

    int flag = 0;
    string ans;

    int f = hantei(s);
    int f1 = hantei(s1);
    int f2 = hantei(s2);

    if (f == 1 && f1 == 1 && f2 == 1){
        ans = "Yes";
    }
    else{ans = "No";}

    cout << ans << endl;

    return 0;

}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define dump(x) cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef vector<int> VI;
typedef vector<long long> VL;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = (int)1e9;
const long long mod = (long long)1e9 + 7;
const double pi = acos(-1.0);

template <class T>void Sort(vector<T> & a) { sort(a.begin(), a.end()); }
template <class T>void ReSort(vector<T>& a) { sort(a.rbegin(), a.rend()); }
template <class T>void Reverse(vector<T>& a) { reverse(a.begin(), a.end()); }
template <class T>void Unique(vector<T>& a) { a.erase(unique(a.begin(), a.end()), a.end()); }
template <class T>T Sum(vector<T> a, T init = 0) { return accumulate(a.begin(), a.end(), init); }

//INPUT//
void CINPUT() {}
template<class H, class ...T> void CINPUT(H&& h, T&& ...t) { cin >> h; CINPUT(forward<T>(t)...); }
#define in(...) int __VA_ARGS__; CINPUT(__VA_ARGS__);
#define In(T,...) T __VA_ARGS__; CINPUT(__VA_ARGS__);
#define Vin(T,name,n) int n; cin>>n; vector<T> name(n); rep(i,n)cin>>name[i];
#define VIn(T,name,n) vector<T> name(n); rep(i,n)cin>>name[i];

//OUTPUT//
void print() { cout << endl; }
template <class H> void print(H&& h) { cout << h << endl; }
template <class H, class... T> void print(H&& h, T&& ... t) { cout << h << " "; print(forward<T>(t)...); }
template<class T>void out(T n) { cout << n << endl; }
template<class T>void out(vector<T> a, string sep = " ", string end = "\n") { for (int i = 0; i < (int)a.size(); ++i)cout << a[i] << (i == (int)a.size() - 1 ? end : sep); }
void yes(bool f) { puts(f ? "yes" : "no"); }
void Yes(bool f) { puts(f ? "Yes" : "No"); }
void YES(bool f) { puts(f ? "YES" : "NO"); }
void poss(bool f) { puts(f ? "possible" : "impossible"); }
void Poss(bool f) { puts(f ? "Possible" : "Impossible"); }
void POSS(bool f) { puts(f ? "POSSIBLE" : "IMPOSSIBLE"); }

int main() {
	in(k);
	out((k / 2) * ((k + 1) / 2));
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int cnt=1,n;
    string s;
    char c;
    cin>>n>>s;
    c=s[0];
    for(int i=1;i<n;i++)
    {
        if(c!=s[i])
        {
            cnt++;
            c=s[i];
        }
    }
    cout<<cnt<<endl;

}


Measured memory_bytes: 512
c = []
for i in range(3):
    c.append(list(map(int, input().split())))
if (c[1][0] - c[0][0] == c[1][1] - c[0][1] == c[1][2] - c[0][2]) and\
   (c[2][0] - c[1][0] == c[2][1] - c[1][1] == c[2][2] - c[1][2]):
    print('Yes')
else:
    print('No')

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

int main(){
    string s;
    cin >> s;
    __int64_t ans = 0;
    for(int i = 0; i < (1 << static_cast<int>(s.size() - 1)); i++){
        __int64_t x = s.at(0) - '0';
        for(int j = 0; j < static_cast<int>(s.size() - 1);j++){
            if(i & (1 << j)){
                ans += x;
                x = 0;
            }
            x = 10 * x + (s.at(j + 1) - '0');
        }
        ans += x;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

int main(){
  double now = 100;
  ll X; cin >> X;
  rep(i,100000){
    now *= 1.01;
    now = (ll)now;
    if(now>=X){
      cout << i+1 << endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 3636
N = gets.to_i
S = N.times.map{
	gets.to_i(2)
}
D = lambda{|i|
	d, p, q, r = -1, 0, 1<<(N-1-i), 0
	until q == 0
		raise if 0 != q&r
		d, p, q, r = d+1, p|q, 0, (p^q)&q
		s = r
		until 0 == (t = s&-s)
			q |= S[N-t.bit_length]
			s ^= t
		end
	end
	return d
}
p(((0...N).map(&D).max rescue -1))


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

int main(){
  int N,d,k;
  int a[200000] = {0};
  cin>>N;
  for(int i=0;i<N;i++){
    cin>>a[i];
  }
  d = N;
  k = 1;
  for(int j=0;j<N;j++){
    if(a[j]==k){
      k++;
    }
  }
  if(k==1){
    cout<<-1<<endl;
  }
  else{
    cout<<N-k+1<<endl;
  }
  return 0;
}


Measured memory_bytes: 1024
#include<algorithm>
#include <bits/stdc++.h>
#include <math.h>
#include <queue>
using namespace std;
int main(void){
	int x,a,b;
	cin>>x>>a>>b;
	if(abs(x-a)<abs(x-b)) cout<<"A\n";
	else cout<<"B\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <set>

using namespace std;
typedef long long LL;
static const double EPS = 1e-9;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n) 
int func(int n){
  int c5=0, p=1;
  while(pow(5,(double)p)<=n){
    c5 += floor(n/pow(5, (double)p));
  p++;
  }
  return (c5);
}
int main(void){
  int n;
  while(cin>>n,n){
    cout<<func(n)<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define Pi pair<int,int>
#define all(V) V.begin(),V.end()

int R;
vector<int> r(8);
vector<vector<pair<int, int>>> T(200);
vector<vector<int>> Cost(200, vector<int>(200, -1));

int main() {
	int N, M, a, b, c;
	cin >> N >> M >> R;
	r.resize(R);
	for (int i = 0;i < R;i++) {
		cin >> a;
		r[i] = a - 1;
	}
	for (int i = 0;i < M;i++) {
		cin >> a >> b >> c;
		a--;b--;
		T[a].push_back({ c,b });
		T[b].push_back({ c,a });
	}
	priority_queue<Pi, vector<Pi>, greater<Pi>> Q;
	Pi p;
	for (int i = 0;i < N;i++) {
		Q.push({ 0,i });
		while (!Q.empty()) {
			a = Q.top().first;
			b = Q.top().second;
			Q.pop();
			if (Cost[i][b]<0 || Cost[i][b]>a) {
				Cost[i][b] = a;
				for (Pi k : T[b])
					Q.push({ a + k.first,k.second });
			}
		}
	}
	int al = 1, ans;
	for (int i = 0;i < R;i++)
		al *= i+1;
	for (int i = 0;i < al;i++) {
		c = 0;
		next_permutation(all(r));
		for (int j = 0;j < R - 1;j++) {
			a = r[j];b = r[j + 1];
			c += Cost[a][b];
		}
		if (i) ans = min(ans, c);
		else ans = c;
		c = 0;
	}
	cout << ans << endl;
}

Measured memory_bytes: 1532
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}



template< typename T>
T power(T x,int k){
    T ret=1;
    while(k>0){
        if(k&1) (ret*=x);
        (x*=x); 
        k >>= 1;
    }
    return ret;
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(20);

    int n,m;
    cin>>n>>m;
    vector<P> v(m);
    rep(i,m){
        cin>>v[i].F>>v[i].S;
    }

    rep(x,1000){
        if(x>0&&x<power<int>(10,n-1)) continue;
        if(x==0&&n>1) continue;
        string sx=to_string(x);
        bool flag=true;
        rep(i,m){
            flag&=(sx[v[i].F-1]==v[i].S+'0');
        }
        if(flag){
            cout<<x<<endl;
            return 0;
        }
    }

    cout<<-1<<endl;


}

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

namespace ITP1_5_C
{
    class Program
    {
        static void Main(string[] args)
        {
            var list = new List<int[]>();
            string input;
            while ((input = Console.ReadLine()) != "0 0")
                list.Add(input.Split(' ').Select(x => Convert.ToInt32(x)).ToArray());
            foreach (var l in list)
            {
                char pat;
                for (int height = 0; height < l[0]; height++)
                {
                    if (height % 2 == 0) pat = '#';
                    else pat = '.';
                    for(int width = 0; width < l[1]; width++)
                    {
                        Console.Write(pat);
                        if (pat == '#') pat = '.';
                        else pat = '#';
                    }
                    Console.WriteLine();
                }                   
                Console.WriteLine();
            }
        }
    }
}

Measured memory_bytes: 9444
n = int(input())
d = {
    'AC': 0,
    'WA': 0,
    'TLE': 0,
    'RE': 0
}

for _ in range(n):
    s = input()
    d[s] += 1

print(f"AC x {d['AC']}")
print(f"WA x {d['WA']}")
print(f"TLE x {d['TLE']}")
print(f"RE x {d['RE']}")


Measured memory_bytes: 9056
let input_int_array n =
	Array.init n (fun _ -> Scanf.scanf "%d " (fun v -> v))
let get_int () = Scanf.scanf "%d " (fun v -> v)

let c a b =
	Array.fold_left (fun u v -> u + abs (v-b)) 0 a

let () =
	let n = get_int ()
	in let a = Array.mapi
		(fun i v -> v - i - 1)
		(input_int_array n)
	in let b =
		let b = Array.copy a
		in Array.sort Pervasives.compare b; b
	in
	(
		if n mod 2 = 1 then (
			c b b.(Array.length b / 2)
		) else (
			min
				(c b b.(Array.length b / 2))
				(c b b.(Array.length b / 2 - 1))
		)
	)
	|> string_of_int |> print_endline

Measured memory_bytes: 8576
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

int main(){
  ll N; cin>>N;
  vector<ll> d(N), c(N);

  rep(i,N) cin>>d[i]>>c[i];
  //sum
  ll sum = 0;
  rep(i,N) sum += d[i] * c[i];
  //桁数
  ll k = 0;
  rep(i,N) k += c[i];

  ll ans = 0;
  ans += k-1;
  //何回9を減らせばいいのか
  ll v = (sum-1)/9;

  ans += v;
  cout<<ans<<endl;

}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
int k, a, b;
int main()
{
    cin >> k;
    cin >> a >> b;
    if(a%k==0)
        cout << "OK" << endl;
    else{
        if((a/k+1)*k<=b)
            cout << "OK" <<endl;
        else
            cout << "NG" << endl;
    }
    return 0;
}


Measured memory_bytes: 3472
n = int(input())
lst = list(map(int,input().split()))
ans = [0 for _ in range(n)]

total = sum(lst) // 2
ans[-1] = (total - (sum(lst[::2])) + lst[-1])*2

for i in reversed(range(n-1)):
    ans[i] = (lst[i] - (ans[i+1]//2))*2

print(str(ans).replace('[','').replace(']','').replace(',',''))


Measured memory_bytes: 14216
#pragma region template
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
/*
const long long MOD = 1e9 + 7, MAX = 1e18, larg = 1e5, INF = -1e9;
long long max_value = INF, max_index = -1;
long long min_value = MAX, min_index = -1;*/
long long A, B, C, D, E, F, G, H, I, J, K, L, N, M, O, P, Q, R, S, T, U, V, W, x, y, z;
typedef long long ll;
typedef pair<ll, ll> Pa;

/*
template <std::int_fast64_t Modulus> class modint {
	using u64 = std::int_fast64_t;
public:
	u64 a;
	constexpr modint(const u64 x = 0) noexcept : a(x% Modulus) {}
	constexpr u64& value() noexcept { return a; }
	constexpr const u64& value() const noexcept { return a; }
	constexpr modint operator+(const modint rhs) const noexcept {
		return modint(*this) += rhs;
	}
	constexpr modint operator-(const modint rhs) const noexcept {
		return modint(*this) -= rhs;
	}
	constexpr modint operator*(const modint rhs) const noexcept {
		return modint(*this) *= rhs;
	}
	constexpr modint operator/(const modint rhs) const noexcept {
		return modint(*this) /= rhs;
	}
	constexpr modint& operator+=(const modint rhs) noexcept {
		a += rhs.a;
		if (a >= Modulus) {
			a -= Modulus;
		}
		return *this;
	}
	constexpr modint& operator-=(const modint rhs) noexcept {
		if (a < rhs.a) {
			a += Modulus;
		}
		a -= rhs.a;
		return *this;
	}
	constexpr modint& operator*=(const modint rhs) noexcept {
		a = a * rhs.a % Modulus;
		return *this;
	}
	constexpr modint& operator/=(modint rhs) noexcept {
		u64 exp = Modulus - 2;
		while (exp) {
			if (exp % 2) {
				*this *= rhs;
			}
			rhs *= rhs;
			exp /= 2;
		}
		return *this;
	}
};
#pragma endregion

typedef modint<MOD> m;
m func[400001];
void funcinit(int N)
{
	func[0] = 1;
	for (int i = 1; i <= N; i++)
	{
		func[i] = func[i - 1] * i;
	}
}
m comb(m n, m r)
{
	if (n.a <= 0 || n.a < r.a)
	{
		return 0;
	}
	return func[n.a] / (func[r.a] * func[(n - r).a]);
}*/

string s;
set<int> pos[26];
int main() {
	cin >> N >> s >> Q;
	rep(i, N) {
		pos[s[i] - 'a'].insert(i);
	}
	rep(i, Q) {
		char c;
		cin >> A >> B;
		if (A == 1) {
			cin >> c;
			B--;
			pos[s[B] - 'a'].erase(B);
			s[B] = c;
			pos[s[B] - 'a'].insert(B);
		}
		if (A == 2) {
			cin >> C;
			int count = 0;
			B--;
			rep(j, 26) {
				auto it = pos[j].lower_bound(B);
				if (it != pos[j].end() && *it < C) count++;
			}
			cout << count << endl;
		}
	}
}


Measured memory_bytes: 24196
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long int n,m,b[200000],s[200002],now=0;
    cin >> n >> m;
    for(int i=0;i<m;i++){
        cin >> b[i];
    }
    for(int i=0;i<m;i++){
        if(b[i]+1==b[i+1]){
            cout << "0" << endl;
            return 0;
        }
    }
    s[0]=1;
    if(b[now]==1){
        s[1]=0;
        now++;
    }else{
        s[1]=1;
    }
    if(b[now]==2){
        s[2]=0;
        now++;
    }else{
        s[2]=s[1]+1;
    }
    for(int i=3;i<=n;i++){
        if(i==b[now]){
            now++;
            s[i]=0;
            //cout << i <<"is 0" << endl;
            continue;
        }
        s[i]=(s[i-1]+s[i-2])%1000000007;
        if(s[i]/1000000007 && s[i-1]/1000000007){
            s[i]%=1000000007;
            s[i-1]%=1000000007;
        }
    }
    //for(int i=0;i<n;i++){
    //    cout << s[i] << " ";
    //}
    //cout << endl;
    cout << s[n]%1000000007 << endl; 
    return 0;
}

Measured memory_bytes: 2560
using System;
using System.Linq;

class P
{
  static void Swap<T>(ref T a, ref T b)
  {
    var c = a;
    a = b;
    b = c;
  }

  static void Main()
  {
    for(var tc=1;; tc++) {
      var a = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
      if(a[0] > a[1])
        Swap(ref a[0], ref a[1]);
      if(a[1] == 0) break;
      Console.WriteLine("{0} {1}", a[0], a[1]);
    }
  }
}

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

void ioinit() { ios::sync_with_stdio(0); cin.tie(0); }

int main() {
  ioinit();
  int N, ans = 0;
  vector<int> V,C;
  cin >> N;
  for(int i; i < N; i++){
    int v;
    cin >> v;
    V.push_back(v);
  }
  for(int i; i < N; i++){
    int c;
    cin >> c;
    C.push_back(c);
  }
  for(int i; i < N; i++){
    if(V[i]-C[i] > 0) ans += V[i]-C[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
def merge(A, left, mid, right):
    n1 = mid - left
    n2 = right - mid
    INF = 1000000001

    L = A[left:left + n1] + [INF]
    R = A[mid:mid + n2] + [INF]

    i = 0
    j = 0
    for k in range(left, right):
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1
    return right - left
            
def mergeSort(A, left, right):
    cnt = 0
    if left+1 < right:
        mid = (left + right) // 2
        cnt += mergeSort(A, left, mid)
        cnt += mergeSort(A, mid, right)
        cnt += merge(A, left, mid, right)
    return cnt

n = int(input())
A = list(map(int, input().split()))
left = 0
right = n
cnt = mergeSort(A, left, right)
print(' '.join(map(str, A)))
print(cnt)


Measured memory_bytes: 66776
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll a, b;
  cin >> a >> b;
  int x = 1;
  int ans = 0;
  
  while(x<b) {
    x += a -1;
    ans++;
  }
  
  cout << ans << "\n";

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/adaptors.hpp>
#include <boost/multiprecision/cpp_int.hpp>

/***** type *****/
using namespace std;
using ll = long long;
using ld = long double;
template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;
template <class T> using vvvt = vector<vector<vector<T>>>;
using ml = boost::multiprecision::cpp_int;

/***** define *****/
#define all(c) (c).begin(), (c).end()            // begin to end
#define rep(i, b, e) for (ll i = b; i < e; i++)  // repeat
#define repr(i, b, e) for (ll i = b; e < i; i--) // repeat reverse
/***** const value *****/
#define llong_max 9223372036854775807            // 9 * 10^18
#define ldbl_max 1.79769e+308                    // 1.7 * 10^308
#define mod 1000000007                           // 1e9 + 7
#define pi 3.14159265                            // 3.14 ...
#define nya 10                                   // nya size
/***** for each macro *****/
#define fori(i, ...) if(ll i = -1) for(__VA_ARGS__) if(i++, true)
#define each(i, e, v) fori(i, auto& e: v)
#define forir(i, ...) if(ll i = Size(v)) for(__VA_ARGS__) if(i--, true)
#define eachr(i, e, v) forir(i, auto& e: boost::adaptors::reverse(v))

/***** lambda *****/
auto Adjust = [] // add vector or sub vector
(auto b, auto e, auto x)
{ for (auto it = b; it != e; ++it)* it += x; };
auto Bit = [] // long long bit shift
(auto n) { return (1LL << n); };
auto Count = [] // long long count value
(auto b, auto e, auto x) { return (ll)count(b, e, x); };
auto CtoLL = [] // char to long long
(auto c) { return (ll)(c - '0'); };
auto Divc = [] // long double div ceiling
(auto a, auto b) { return ceil((ld)a / (ld)b); };
auto Nya = [] // long long nya size
(auto n) { return (ll)pow(10, n); };
auto Size = []  // long long collection size
(auto& c) { return (ll)(c).size(); };
auto Sum = []   // long long accumulate
(auto b, auto e) { return accumulate(b, e, 0LL); };
auto VVT = []   // vector<vector<T>> resize 
(auto& vvt, auto ysize, auto xsize)
{ vvt.resize(ysize); each(i, vy, vvt) vy.resize(xsize); };
auto VVVT = []   // vector<vector<vector<T>>> resize 
(auto& vvvt, auto zsize, auto ysize, auto xsize)
{ vvvt.resize(zsize); each(z, vz, vvvt) VVT(vz, ysize, xsize); };
auto InVVT = []  // input vector<vector<T>> (T != struct)
(auto& vvt) { each(y, vy, vvt) each(x, e, vy) cin >> e; };
auto InVVVT = [] // input vector<vector<vector<T>>> (T != struct)
(auto& vvvt) { each(z, vz, vvvt) InVVT(vz); };


int main(void)
{
	ll N; cin >> N;
	string s, t; cin >> s >> t;

	rep(i, 0, N)
	{
		cout << s[i] << t[i];
	}

	return 0;
}


Measured memory_bytes: 256
def readinput():
    n=int(input())
    l=list(map(int,input().split()))
    return n,l

def main(n,a):
    MOD=10**9+7
    hist=[0]*61
    bs=[]
    for i in range(n):
        # s=list(reversed(bin(a[i])[2:]))
        # for j in range(len(s)):
        #     if s[j]=='1':
        #         hist[j]+=1
        # bs.append(s)

        s=bin(a[i])[2:]
        bs.append(s)
        for j in range(len(s)):
            if s[j]=='1':
                hist[len(s)-j-1]+=1
        # j=0
        # ai=a[i]
        # while ai>0:
        #     if ai&1==1:
        #         hist[j]+=1
        #     ai = ai >> 1
        #     j+=1


    #print(bs)
    #print(hist)
    sum=0
    for i in range(n-1):
        s=bs[i]
        b=1
        for j in range(len(s)):
            if s[len(s)-1-j]=='0':
                sum=(sum+hist[j]*b)%MOD
            else:
                sum=(sum+( n-i-hist[j] )*b)%MOD
                hist[j]-=1
            b*=2
        for j in range(len(s),61):
            sum=(sum+hist[j]*b)%MOD
            b*=2
    # b=1
    # for j in range(61):
    #     sum=(sum+( hist[j]*(n-hist[j])*b )%MOD )%MOD
    #     b*=2

    return sum

if __name__=='__main__':
    n,l=readinput()
    ans=main(n,l)
    print(ans)


Measured memory_bytes: 157604
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>

using namespace std;

typedef long long ll;

ll f(ll n){

	ll res=0;

	while(n>0){
	res+=n%10;
	n/=10;
	}

	return res;
}
double g(ll n){
return(double)n/f(n);
}

int main(){

	vector<ll>res;
	ll base=1;

	int i,j;

	for(i=0;i<15;i++){
		for(j=1;j<150;j++){
			res.push_back(base*(j+1)-1);
		}
		base*=10;
	}

	sort(res.begin(),res.end());
	res.erase(unique(res.begin(),res.end()),res.end());

	for(i=0;i<res.size();i++){
		for(j=i+1;j<res.size();j++){
			if(g(res[i])>g(res[j])){
				res.erase(res.begin()+i--);
				break;
			}
		}
	}

	int K;

	cin>>K;

	for(i=0;i<K;i++){
	cout<<res[i]<<endl;
	}


return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define M 32768+1
int main()
{
  int n,num[M]={0},i,j,k,l;
  for(i=1;i*i<=M;i++){
    num[i*i]++;
    for(j=i;i*i+j*j<=M;j++){
      num[i*i+j*j]++;
      for(k=j;i*i+j*j+k*k<M;k++){
	num[i*i+j*j+k*k]++;
	for(l=k;i*i+j*j+k*k+l*l<M;l++){
	  num[i*i+j*j+k*k+l*l]++;
	}
      }
    }
  }
  while(cin>>n,n){
    cout<<num[n]<<endl;
  }
}

Measured memory_bytes: 932
#include <bits/stdc++.h>
using namespace std;
int main(){
  vector<int> a(3);
  cin >> a.at(0) >> a.at(1) >> a.at(2);
  
  sort(a.begin(), a.end());
  cout << (a.at(0) + a.at(1)) << endl;
  return 0;
}

Measured memory_bytes: 256