akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
using namespace std;

int main() {

    string s;
    cin >> s;

    int x;
    int min = 999;

    for (int i = 0; i < s.size() - 2; i++) {
        x = (s[i]-'0')*100 + (s[i+1]-'0')*10 + (s[i+2]-'0')*1;
        if (abs(753 - x) < min) {
            min = abs(753 - x);
        }
    }

    cout << min << endl;

    return 0;
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
num=0
for i in range(0,N):
    if B[i]>A[i]:
        num=num+A[i]
        c=B[i]-A[i]
        if A[i+1]>c:
            num=num+c
            A[i+1]=A[i+1]-c
        else:
            num=num+A[i+1]
            A[i+1]=0
    else:
        num=num+B[i]
print(num)

Measured memory_bytes: 18624
#include <iostream>
#include <cmath>

long long int n;

int main() {
    std::cin>>n;
    int i;
    for(i=sqrt(n);i>=1&&n%i!=0;--i);
    i=n/i;
    int cnt=0;
    while(i>0){
        i/=10;
        ++cnt;
    }
    std::cout<<cnt<<std::endl;
    return 0;
}

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

int c[500001];
int dfs(int p){
  if(!c[p]++)return p;
  c[p]=0;
  return dfs(p-1);
}

int main(){
  int n;
  cin>>n;
  int len=0,mx=0;
  while(n--){
    int x;
    cin>>x;
    mx=max(mx,x);
    if(x>5e5)x=5e5;
    if(!c[0]&&(len<x||(len==x&&mx<=x))){
      dfs(x);
      int llen=max(len,1);
      while(c[llen])llen++;
      len=llen-1;
      cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 5044
n,m,x = map(int,input().split())

books=[]

for _ in range(n):
    books.append(list(map(int,input().split())))

cost = 10**18
for i in range(2**n):

    i = format(i,'0{}b'.format(n))

    flg =0
    total =0
    skill=[0]*m
    for j in range(n):
        if i[j]=='1':
            book_j = books[j]
            
            total += book_j[0]

            for l in range(len(book_j)):
                if l==0:
                    continue
                else:
                    skill[l-1]+=book_j[l]

    for k in range(m):
        if skill[k]<x:
            flg+=1
    
    if flg==0:
        cost = min(cost,total)

if cost==10**18:
    print(-1)
else:
    print(cost)

Measured memory_bytes: 9244
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a, b;
    
    cin >> a;
    cin >> b;
    
    int max = 3;
    int anser = 1;
    for(int i = 1; i <= max; ++i)
    {
        if( i == a || i == b)
        {
            continue;
        }
        
        anser = i;
    }
    
    cout << anser;
    
    return 0;
}


Measured memory_bytes: 256
main = do
    n <- getLine >>= return . read 
    strlist <- sequence (take n (repeat getLine))
    let ans = solve n strlist
    putStrLn ans

solve :: Int -> [String] -> String
solve _ strings = if subA strings then "Yes" else "No"

subA :: [String] -> Bool
subA strings = and $ map subB tuples
    where tuples = subC $ map subE strings

subB :: (Int,Int,Int) -> Bool
subB (t,x,y) = t >= x+y && mod (x+y-t) 2 == 0

subC :: [(Int,Int,Int)] -> [(Int,Int,Int)]
subC = \xs -> zipWith subD xs ((0,0,0):xs)

subD ::  (Int,Int,Int) -> (Int,Int,Int) -> (Int,Int,Int)
subD (x,y,z) (a,b,c) = (x-a,y-b,z-c)

subF :: String -> [Int]
subF = map read . words

subE :: String -> (Int,Int,Int)
subE string = (\[a,b,c] -> (a,b,c)) (subF string)


Measured memory_bytes: 73084
import scala.io.StdIn

object Main {

  def main(args: Array[String]): Unit = {

    val w = StdIn.readLine()
    
    val countMap = collection.mutable.Map.empty[Char, Int]
    
    w.foreach { ch =>
      val c = countMap.getOrElse(ch, 0)
      countMap(ch) = c + 1
    }
    
    if (countMap.values.forall(_ % 2 == 0)) {
      println("Yes")
    } else {
      println("No")
    }
  }
}

Measured memory_bytes: 27220
#include<stdio.h>
int main()
{
 int num, suuti, i;
 int min = 1000000, max = -1000000; 
 long Sum = 0;
    
 scanf("%d", &num);
   
 for(i = 1; i <= num; i++){
   scanf("%d", &suuti);
   if(suuti > max)
     max = suuti;
   if(suuti < min)
     min = suuti;
   Sum += suuti;
 }
    
 printf("%d %d %ld\n", min, max, Sum);
   
 return 0;
}

Measured memory_bytes: 1812
function main()
    n = parse(Int, readline())
    ans = Dict{Int, Int}()
    for x in 1:100
        for y in 1:100
            for z in 1:100
                ret = g(x,y,z)
                ret > n && break
                if haskey(ans, ret)
                    ans[ret] += 1
                else
                    ans[ret] = 1
                end
            end
        end
    end

    for i in 1:n
        if haskey(ans, i)
            println(ans[i])
        else
            println(0)
        end
    end
end

g(x,y,z) = x^2 + y^2 + z^2 + x*y + y*z + z*x

main()

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

int main(){
	int x, y, z;
  	cin >> x >> y >> z;
  
  	swap(x, y);
  	swap(x, z);
  
  	cout << x << " " << y << " " << z << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	static class LongInteger {
		ArrayList<Integer> n;
		int dsum = -1;
		
		public LongInteger(String str) {
			n = new ArrayList<>();
			for(int i=str.length()-1; i>=0; i--) {
				n.add(str.charAt(i)-'0');
			}
		}
		
		public int dsum() {
			if(dsum == -1) {
				dsum=0;
				for(int i : n)
					dsum += i;
			}
			return dsum;
		}
		
		public void multi(int x) {
			ArrayList<Integer> nn = new ArrayList<>();
			int carry = 0;
			for(int i : n) {
				int temp = i*x+carry;
				nn.add(temp%10);
				carry = temp/10;
			}
			while(carry>0) {
				nn.add(carry%10);
				carry /= 10;
			}
			n = nn;
			dsum = -1;
		}
		
		public void add(int x) {
			int carry = x;
			int idx = 0;
			while(carry>0) {
				int temp = (idx < n.size() ? n.get(idx) : 0) + carry;
				dsum += temp%10 - (idx < n.size() ? n.get(idx) : 0);
				if(idx < n.size())
					n.set(idx, temp%10);
				else
					n.add(temp%10);
				carry = temp/10;
				idx++;
			}
		}
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		LongInteger N = new LongInteger(str);

		N.multi(9);
		
		for(int i=0; i<=str.length(); i++) {
			if(N.dsum() <= i*9) {
				System.out.println(i);
				break;
			}
			N.add(9);
		}
		
		sc.close();
	}

}

Measured memory_bytes: 47000
#include "bits/stdc++.h"
using namespace std;

int main() {
        int h, w, q;
        cin >> h >> w >> q;
        vector<string> s(h);
        for (int i = 0; i < h; i ++) cin >> s[i];
        vector<vector<int>> t(h, vector<int> (w));
        for (int i = 0; i < h; i ++) {
                for (int j = 0; j < w; j ++) {
                        if (s[i][j] == '1') t[i][j] = 1;
                        else t[i][j] = 0;
                }
        }
        vector<vector<int>> ver(h, vector<int> (w, 0));
        vector<vector<int>> hor(h, vector<int> (w, 0));
        for (int y = 0; y < h; y ++) {
                for (int x = 0; x < w; x ++) {
                        if (x + 1 < w) if (t[y][x] && t[y][x + 1]) hor[y][x] = 1;
                        if (y + 1 < h) if (t[y][x] && t[y + 1][x]) ver[y][x] = 1;
                }
        }
        for (int x = 0; x < w; x ++) {
                for (int y = 1; y < h; y ++) {
                        t[y][x] += t[y - 1][x];
                        ver[y][x] += ver[y - 1][x];
                        hor[y][x] += hor[y - 1][x];
                }
        }
        for (int y = 0; y < h; y ++) {
                for (int x = 1; x < w; x ++) {
                        t[y][x] += t[y][x - 1];
                        ver[y][x] += ver[y][x - 1];
                        hor[y][x] += hor[y][x - 1];
                }
        }
        while (q --) {
                int y1, x1, y2, x2;
                cin >> y1 >> x1 >> y2 >> x2;
                y1 --, x1 --, y2 --, x2 --;
                int sum = t[y2][x2] - (y1 - 1 >= 0 ? t[y1 - 1][x2] : 0) - ((x1 - 1 >= 0 ? t[y2][x1 - 1] : 0) - (y1 - 1 >= 0 && x1 - 1 >= 0 ? t[y1 - 1][x1 - 1] : 0));
                int versum = 0;
                y2 --;
                if (y1 <= y2) {
                        versum = ver[y2][x2] - (y1 - 1 >= 0 ? ver[y1 - 1][x2] : 0) - ((x1 - 1 >= 0 ? ver[y2][x1 - 1] : 0) - (y1 - 1 >= 0 && x1 - 1 >= 0 ? ver[y1 - 1][x1 - 1] : 0));
                }
                y2 ++;
                int horsum = 0;
                x2 --;
                if (x1 <= x2) {
                        horsum = hor[y2][x2] - (y1 - 1 >= 0 ? hor[y1 - 1][x2] : 0) - ((x1 - 1 >= 0 ? hor[y2][x1 - 1] : 0) - (y1 - 1 >= 0 && x1 - 1 >= 0 ? hor[y1 - 1][x1 - 1] : 0));
                }
                x2 ++;
                cout << sum - versum - horsum << endl;
        }
        return 0;
}



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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int N = 12;
ll dp[N][10];

void pre(){
	memset(dp, 0, sizeof(dp));
	for(int i = 0; i < 10; i++){
		dp[1][i] = 1;
	}
	for(int len = 2; len < N; len++){
		for(int i = 0; i < 10; i++){
			for(int j = -1; j < 2; j++){
				if(i + j < 0 || i + j > 9)continue;
				dp[len][i] += dp[len - 1][i + j];
			}
		}
	}
}

ll dfs(int len, int dig, int k, ll cur){
	if(len == 0){
		if(k == 1)return cur;
		return -1;
	}
	for(int i = max(dig - 1, 0); i <= min(dig + 1, 9); i++){
		if(k <= dp[len][i]){
			return dfs(len - 1, i, k, cur*10 + i);
		}
		k -= dp[len][i];
	}
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	pre();
	int k; cin>>k;
	ll sum = 0;
	for(int len = 1; len < N; len++){
		for(int i = 1; i <= 9; i++){
			if(k <= dp[len][i] + sum){
				cout<<dfs(len - 1, i, k - sum, i)<<'\n';
				exit(0);
			}
			sum += dp[len][i];
		}
	}

	return 0;
}

Measured memory_bytes: 3644
// Last Change: 08/26/2019 03:52:10.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

int main() {
  ll N, K;
  cin >> N >> K;
  vector<ll> l(N);
  for (auto &&e : l) {
    cin >> e;
  }
  sort(l.begin(), l.end(), greater<ll>());

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



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

int main(){
 int n, k; cin >> n >> k;
 vector< int > v(n);
 for(int i = 0; i < n; ++i) cin >> v[i];
 sort(v.begin(),v.end());
 int ans = INT_MAX;
 for(int i = 0; i + k - 1 < n; ++i){
    ans = min(ans,v[i + k - 1] - v[i]);
 }
 cout << ans << '\n';
}

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

struct Edge{
  int weight;
  int from;
  int to;
  Edge(int w,int f,int t):weight(w),from(f),to(t){}
};

const int inf = 1<<28;

bool operator<(Edge e1,Edge e2){
  return (e1.weight < e2.weight);
}

int nlist[110];

int parent(int i){
  if(nlist[i] == i) return i;
  else return (nlist[i] = parent(nlist[i]));
}

int main(){
  int n;
  cin>>n;
  vector<Edge> Elist;
  for(int i=0;i<n;i++) nlist[i]=i;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      int temp;
      cin>>temp;
      if(temp != -1){
	Elist.push_back(Edge(temp,i,j));
      }
    }
  }
  sort(Elist.begin(),Elist.end());
  int ans = 0;
  for(int i=0;i<Elist.size();i++){
    Edge e = Elist[i];
    int fp = parent(e.from);
    int tp = parent(e.to);
    if(fp != tp){
      ans += e.weight;
      nlist[fp] = tp;
    }
  }
  cout<<ans<<endl;
  return 0;
}

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

int main() {
  int a, b;
  cin >> a >> b;
  int x1 = 0;
  int x2 = 0;

  x1 = max(a, b);
  if(a > b){
    a--;
  }
  else{
    b--;
  }
  x2 = max(a, b);

  cout << x1 + x2 <<endl;
}


Measured memory_bytes: 256
//doaremon,squirtle is love
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define testcase ll t;cin>>t;while(t--)
#define input(x) ll x;cin>>x;
#define output(x) cout<<x<<endl;//to print (-1)
#define inputarray() ll n;cin>>n;ll arr[n];rep(0,n)cin>>arr[i];
#define deb(a) cout<<" :: "<<#a<<" = "<<a<<endl
#define deb2(a,b) cout<<" :: "<<#a<<" = "<<a<<" :: "<<#b<<" = "<<b<<endl
#define setbit(x)  __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define pii pair<int, int>
#define pll pair<long long int,long long int>
#define ub upper_bound // '>'
#define lb lower_bound // '>='
//erase,count,find,make_unique
#define len(arr) (sizeof(arr)/sizeof(arr[0]))
#define sz(x) ((long long)x.size())
#define make_unique(arr) arr.erase(unique(arr.begin(),arr.end()),arr.end()) //Makes a sorted array unique
#define rep(a,b) for(int i=a;i<b;i++)
#define updiv(a,b) (ceil)((a)*(1.0)/(b))
#define printarray(arr) cout<<"PRINT ARRAY"<<endl; rep(0,len(arr)) cout<<arr[i]<<" "; cout<<endl;
#define printvector(vect) cout<<"PRINT VECTOR"<<endl; for(auto x:vect) cout<<x<<" "; cout<<endl;
#define rev(x) reverse(all(x))
//LLONG_MAX, ULLONG_MAX INT_MAX
typedef long long int ll;
typedef unsigned long long int ull;
#define M 1000000007
using namespace std;
int main()
{
    fast
int a,b,c;
cin>>a>>b>>c;
cout<<c<<" "<<a<<" "<<b<<endl;
return 0;
}









Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(void){
	int c,n;
	double v,y;
	while(cin>>v){
		y=4.9*((v*v)/(9.8*9.8));
		n=1;
		while(1){
			if(y<5*n-5)break;
			n++;
		}
		cout<<n<<endl;
	}
	

}

Measured memory_bytes: 1224
#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
using namespace std;
using ll=long long;
using pll=pair<ll,ll>;
const ll MOD=1000000007;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const vector<pll> dir={{0,1},{1,0},{-1,0},{0,-1},{1,1},{-1,1},{1,-1},{-1,-1}};
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=b-1;i>=a;i--)
#define range(i) (i).begin(),(i).end()
#define rrange(i) (i).rbegin(),(i).rend()
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline ll lcm (ll a,ll b) {return a*b/gcd(a,b);}
inline constexpr int intpow(ll a,ll b){
    if(b==0) return 1;
    ll ans=intpow(a,b/2);
    return ans*ans%MOD*(b&1?a:1)%MOD;
}
inline constexpr int modf(ll n){
    ll ans=1;
    rep(i,0,n) {ans=ans*(n-i)%MOD;}
    return ans;
}

vector<ll> func,inv;
void init(ll n){
    func.resize(n+1);inv.resize(n+1);
    func[0]=1;
    rep(i,0,n) {func[i+1]=func[i]*(i+1)%MOD;}
    inv[n]=intpow(func[n],MOD-2);
    rrep(i,1,n+1) {inv[i-1]=inv[i]*i%MOD;}
}
ll comb(ll a,ll b) {return func[a]*inv[b]%MOD*inv[a-b]%MOD;}

inline long double median(vector<ll> v){
    ll size=v.size();
    sort(v.begin(),v.end());
    if (size % 2 == 1) return v[(size - 1) / 2];
    else return v[(size / 2) - 1] ;
}
template<class T> inline bool chmax(T& a,T b) {if(a<b){a=b;return 1;} return 0;}
template<class T> inline bool chmin(T& a,T b) {if(a>b){a=b;return 1;} return 0;}

int main(){
    ll s;
    cin>>s;
    ll a=round(sqrt(s)+0.5);
    if(a>1000000000) a=1000000000;
    ll b=round(sqrt(a*a-s)+0.5);
    ll ans=0;
    while(ans==0){
        if((a*a-s)%b==0) ans=b;
        b--;
    }
    cout<<0<<' '<<0<<' '<<a<<' '<<ans<<' '<<(a*a-s)/ans<<' '<<a;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int t;
  cin>>t;
  int temp=t%10;
  if(temp==2 ||temp==4||temp==5||temp==7 ||temp==9)
    cout<<"hon"<<endl;
  else if(temp==0 ||temp==1 ||temp==6||temp==8)
    cout<<"pon"<<endl;
  else
    cout<<"bon"<<endl;
  
  
  return 0;
  
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
//#pragma comment(linker,"/STACK:1024000000,1024000000")
//251103FD
//4008802802
//4008160009
using namespace std;
#define PB pop_back
#define PF pop_front
#define np next_permutation
#define eb emplace_back
#define pb push_back
#define bf push_front
#define mp make_pair
#define s second
#define f first
#define foreach(it, a) for(__typeof((a).begin()) it=(a).begin(); it!=(a).end(); it++)
#define Foreach(it, a) for(__typeof((a).rbegin()) it=(a).rbegin(); it!=(a).rend(); it++)
#define forn(i, a) for(register int i=0; i<a; i++)
#define Forn(i, a) for(register int i=1; i<=a; i++)
#define memINF 127
#define all(x) x.begin(), x.end()
#define FAST ios::sync_with_stdio(false)

typedef long long ll;
typedef pair<int,int> pi;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef unsigned int uint;

inline int in() 
{
    int x=0, c;
    while((uint)((c=getchar())-48)>=10) 
		if(c=='-') 
			return -in();
    do 
	{ x=(x<<3)+(x<<1)+(c^48); }
	while((uint)((c=getchar())^48)<10);
    return x;
}
inline int lcm(int a, int b){return a*b/__gcd(a, b);}

const int MAX=1e6+5;
const int n=1e5+5;

namespace DSU
{
    int par[MAX];
    inline void init(int x)
    {
        par[x]=x;
    }
    inline int find(int x)
    {
        return par[x]==x?x:par[x]=find(par[x]);
    }
    inline void unite(int x, int y)
    {
        x=find(x), y=find(y);
        if(x==y)
            return;
        par[x]=y;    
    }
};

int N, M, a, b, c, tot, to[n], dist[MAX];
vector<pi> e[MAX];
vi adj[MAX];
bool inside[n];
queue<int> q;

int main()
{
    N=in(), M=in();
    while(M--)
    {
        a=in(), b=in(), c=in();
        e[c].eb(mp(a, b));
    }
    tot=N;
    Forn(i, 1000000)
    {
        if(!e[i].size())
            continue;
        int pa;
        foreach(it, e[i])
        {
            DSU::init(it->f);
            DSU::init(it->s);
            inside[it->f]=false;
            inside[it->s]=false;
            to[it->f]=-1;
            to[it->s]=-1;
        }
        foreach(it, e[i])
            DSU::unite(it->f, it->s);
        foreach(it, e[i])
        {
            if(!inside[it->f])
            {
                pa=DSU::find(it->f);
                inside[it->f]=true;
                if(to[pa]<=0)
                    to[pa]=++tot;
                adj[to[pa]].eb(it->f);
                adj[it->f].eb(to[pa]);
            }
            if(!inside[it->s])
            {
                pa=DSU::find(it->s);
                inside[it->s]=true;
                if(to[pa]<=0)
                    to[pa]=++tot;
                adj[to[pa]].eb(it->s);
                adj[it->s].eb(to[pa]);
            }
        }
    }
    memset(dist, -1, sizeof(dist));
    dist[1]=0;
    q.push(1);
    while(!q.empty())
    {
        int t=q.front();
        q.pop();
        foreach(it, adj[t])
            if(dist[*it]<0)
                dist[*it]=dist[t]+1, q.push(*it);
    }
    printf("%d\n", dist[N]<0?-1:dist[N]>>1);
    return 0;
} 

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

// definitions
#define __Imperial_Lord__ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define _cps CLOCKS_PER_SEC
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define rep(i, l, r) for (long long i = (l); i < (long long)(r); i++)
#define repb(i, r, l) for (long long i = (r); i > (long long)(l); i--)
#define sum(a)     ( accumulate ((a).begin(), (a).end(), 0ll))
#define high(x) __builtin_popcountll(x)
#define pb push_back
#define pf push_front
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c <<endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d <<endl
#define exec cerr<<"Time taken : "<<(ld)(clock())/_cps<<"s"<<endl
#define mod1 998244353
#define mod 1000000007
#define pi 3.1415926535897932384

using namespace std;

// alias name for common data types
typedef vector<long long> vl;
typedef vector<long double> vld;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector< pair<long long, long long> > vp;
typedef vector<tuple<long long , long long , long long> > vtup;
typedef deque <long long> dql;
typedef deque <char> dqc;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;

const ll INF=1e18;

template <class ...Args>
istream &read_args(Args &...args) {return (cin >> ... >> args);}
#define read(...)   __VA_ARGS__; read_args(__VA_ARGS__)

// cin and cout overloaded for vectors
template<typename T>    istream& operator>>(istream& is,  vector<T>& v)
{
    for (auto& i : v) 
        is >> i;        
    return is;
}
template<typename T>    ostream& operator<<(ostream& os,  vector<T>& v)
{
    for (auto& i : v) 
        os << i << ' '; 
        return os;
}


// code beigns in main
int main()
{
    __Imperial_Lord__
    ll t=1;
    // cin >> t;
    
    while(t--)
    {
        ll read(n);
        vl a(n); cin >>a;
        ll cnt=0;
        rep(i,0,n)
        {
            if((i+1)%2 && a[i]%2) cnt++;
        }

        p1(cnt);
    }   
    exec;
}

Measured memory_bytes: 3792
from collections import deque
N = int(input())
de = deque()
for n in range(N):
    com = input().split()
    if com[0] == "insert":
        de.appendleft(com[1])
    elif com[0] == "delete":
        try:
            de.remove(com[1])
        except:
            pass
    elif com[0] == "deleteFirst":
        de.popleft()
    else:
        de.pop()
print(*de)
    
    



Measured memory_bytes: 69740
#include <stdio.h>
int main() {
    int a, b, c, x;
    scanf("%d%d%d%d", &a, &b, &c, &x);
    int cnt = 0;
    for(int i = 0; i <= a; i++){
        for(int j = 0; j <= b; j++){
            for(int k = 0; k <= c; k++){
                if(i * 500 + j * 100 + k * 50 == x)
                    cnt++;
            }
        }
    }
    printf("%d\n", cnt);
    return 0;
}
//3 4plans 0 1 2 3


Measured memory_bytes: 128
//in the name of god
#include <bits/stdc++.h>
using namespace std;
#define MAX_N (int)1e6+20
#define INF 1e9+20
#define pb push_back
#define F first
#define S second
typedef long long LL;
#define int LL
typedef pair<int,int> pii;
const int delta=(int)1e9+7;
int n,a,b,ans,x,y,z;
main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin>>n>>a>>b;
	for(int i=1;i<=n;++i){
		x=i; y=0;
		while(x){
			y+=x%10;
			x/=10;
		}
		if(a<=y && y<=b) ans+=i;
	}
	cout<<ans;
	return cout<<endl,0;
}

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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

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


// 最大公約数
ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  ll K , S; cin >> K >> S;
  ll x, y, z;
  ll ans = 0;

  rep(i, K + 1) {
    rep(j, K + 1) {
      z = S - i - j;
      if(z >= 0 && z <= K) ans++;
    }
  }

  cout << ans << endl;
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}


Measured memory_bytes: 3668
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
c = Counter(a)
d = [0,0]
for i in c:
    if c[i]>1:
        d.append(i)
    if c[i]>3:
        d.append(i)
d.sort()
print(d[-1]*d[-2])

Measured memory_bytes: 68760
abc = gets.chomp.split(" ").map(&:to_i)
count = 0

if abc.count(abc.max) != 3
  until abc.max - abc.min < 2
    count += 1
    abc.sort!
    abc[0] += 2
  end
  if abc.count(abc.max) == 2
    count += 2
  elsif abc.count(abc.max) == 1
    count += 1
  end
end

puts count


Measured memory_bytes: 1788
#include<iostream>
using namespace std;
int main()
{
	int N,ba,d,c1,c2;
	int tc,hc,flag;
	int taro[100],hana[100];
	while(1){
		int F[201] = {0};
		ba = 0;
		cin >> N;
		if(N==0) break;
		for(int i=0;i<N;i++){
			cin >> d;
			F[d] = 1;
		}
		c1=0; c2=0;
		for(int i=1;i<=N*2;i++){
			if(F[i] == 1){
				taro[c1] = i;
				c1++;
			}
			else if(F[i] == 0){
				hana[c2] = i;
				c2++;
			}
		}
	
	/////////////////////////////////////////////
		tc=N; hc=N; flag=0;
		while(1){
			for(int i=0;i<N;i++){
				if(ba < taro[i]){
					ba = taro[i];
					flag = 1;
					taro[i] = 0;
					tc--;
					break;
				}
			}
			if(tc == 0)
				break;
			if(flag == 0)
				ba = 0;
			flag = 0;

			for(int i=0;i<N;i++){
				if(ba < hana[i]){
					ba = hana[i];
					flag = 1;
					hana[i] = 0;
					hc--;
					break;
				}
			}
			if(hc == 0)
				break;
			if(flag == 0)
				ba = 0;
			flag = 0;
		}
		cout << hc << endl << tc << endl;
	}
	return 0;
}

Measured memory_bytes: 3072
require 'set'

def reachable edges, from, wall
  q = [from]
  r = Set.new
  until q.empty?
    t = q.shift
    unless t==wall or r.include?(t) 
      r << t
      edges[t].each{|x| q << x}
    end
  end
  r
end

def path_s edges, from, to
  pre = []
  q = [from]
  loop{
    p = q.shift
    edges[p].each{|v|
      if v == to
        pre[v] = p
        path = [v]
        until path[-1]==from
          path << pre[path[-1]]
        end
        return path.reverse
      end
      if v != pre[p]
        pre[v] = p
        q << v
      end
    }
  }
end

n = gets.to_i
es = Array.new(n+1){[]}
(n-1).times{
  a, b = gets.split.map(&:to_i)
  es[a] << b
  es[b] << a
}

path = path_s(es, 1, n)

while path.size > 2
    path.shift
    if path.size>2
      path.pop
    end
end

b_reach = reachable(es, path[0], path[1])
w_reach = reachable(es, path[1], path[0])


b_c = b_reach.size
w_c = w_reach.size
puts (b_c > w_c) ? "Fennec" : "Snuke"


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

int main() {
  int H, N;
  int sum = 0;
  cin >> H >> N;
  vector<int> kougeki(N);
  for (int i = 0; i < N; i++) {
    cin >> kougeki.at(i);
    sum += kougeki.at(i);
  }
  
  if (sum >= H) {
    cout << "Yes" << endl;
  }
  else if (sum < H) {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long  fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y){
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
// index が条件を満たすかどうか
vector<long long int >meguru;
bool isOK(int index, int key) {
	if (meguru[index] >= key) return true;
	else return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
	int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = (int)meguru.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, key)) right = mid;
		else left = mid;
	}
	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
long long int big[60][2] = {};

int main() {
	double r;
	cin >> r;
	cout << fixed << setprecision(8) << 2 * r  * 3.1415926535<< endl;
}

Measured memory_bytes: 3796
N = int(input())
S = [input() for _ in range(N)]
M = int(input())
T = [input() for _ in range(M)]

dic = {}
for s in S:
    if s in dic.keys():
        dic[s] += 1
    else:
        dic[s] = 1
for t in T:
    if t in dic.keys():
        dic[t] -= 1
    else:
        dic[t] = -1

possible = dic.values()
print(max(possible) if max(possible) > 0 else 0)


Measured memory_bytes: 3064
from math import factorial
C = lambda y, x: factorial(y) // factorial(x) // factorial(y - x)
mod = 1000000007
def solve():
    n, k = map(int, input().split())
    for i in range(1, k + 1):
        if i <= (n - k) + 1:
            print(C(n - k + 1, i) * C(k - 1, i - 1) % mod)
        else:
            print(0)
solve()


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

int main(){
    int N;
    vector<double> v;
    cin >> N;
    for (int i = 0; i < N; ++i){
        double a;
        cin >> a;
        v.push_back(a);
    }
    sort(v.begin(), v.end());
    double ans = v[0];
    for (int i = 1; i < N; ++i){
        ans = (ans + v[i]) / 2;
    }
    cout << setprecision(15) << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int k;
queue<string>q;
int main()
{
    scanf("%d",&k);
    if(k<=9) cout<<k<<endl;
    q.push("1");
    q.push("2");
    q.push("3");
    q.push("4");
    q.push("5");
    q.push("6");
    q.push("7");
    q.push("8");
    q.push("9");
    int now=9;
    while(now<=k)
    {
        string s=q.front();q.pop();
        int t=s.back()-'0';
        for(int i=t-1;i<=t+1;i++)
            if(i>=0&&i<=9)
            {
                now++;
                string t=s+(char)('0'+i);
                if(now==k)
                {
                    cout<<t<<endl;return 0;
                }
                q.push(t);
            }
    }
}


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

int main() {
    string S;
    cin >> S;
    int ans = 0;
    rep(i, S.size() - 1) {
        if (S[i] != S[i + 1]) ans += 1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3764
#pragma GCC optimize ("O3")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<cstring>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	int dig = ((tmp & ma0) ^ ma0) ? 68 - __builtin_ctzll((tmp & ma0) ^ ma0) : 0;
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += (64 - dig >> 3);
	while ((ct = *ci++) >= '0') tmp = tmp * 10 + ct - '0';
	return tmp;
}

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


	int N = getint();
	int A[100100];
	ll B[100100];
	A[0] = getint();
	B[0] = 1;
	if (A[0] > 1) {
		printf("-1\n");
		return 0;
	}
	int OK = 1;
	int i = 1;
	for (; i <= N; i++) {
		A[i] = getint();
		B[i] = (B[i - 1] - A[i - 1]) * 2;
		if (B[i] < A[i]) OK = 0;
		if (B[i] > 2e8) {
			i++;
			break;
		}
	}

	if (!OK) {
		printf("-1\n");
		return 0;
	}

	for (; i <= N; i++) {
		A[i] = getint();
		B[i] = (B[i - 1] - A[i - 1]) * 2;
		if (B[i] > 1e13) {
			B[i] = 1e13;
			i++;
			break;
		}
	}
	for (; i <= N; i++) {
		A[i] = getint();
		B[i] = 1e13;
	}

	ll kotae = 0;
	ll kari = 0;
	for (int i = N; i >= 0; i--) {
		kari += A[i];
		kotae += min(kari, B[i]);
	}

	printf("%lld\n", kotae);

	Would you please return 0;
}

Measured memory_bytes: 2908
#include<bits/stdc++.h>
#define ll long long
#define inf 0x3f3f3f3f
using namespace std;
const int maxn = 1e5+5;
ll mod = 1e9+7;
ll pre[maxn], pp[maxn];

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

int main(){
	ll n, k; cin >> n >> k;
	for(ll i = 1; i <= n; i++) pp[i] = pp[i-1] + i;
	ll ans = 0, x, y;
	for(ll i = k; i >= 1; i--){
		pre[i] = p(k / i, n);
		for(int j = i*2; j <= k; j += i){
			pre[i] = (pre[i] - pre[j] + mod) % mod;
		}
		ans = (ans + pre[i] * i % mod) % mod;
	}
	cout << ans << endl;
}

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

int main(){
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    for(int i = 0; i < k; i++){
        if(a >= b) b *= 2;
        else if(b >= c) c *= 2;
    }
    if(a < b && b < c) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3584
//inlclude before define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
#include<assert.h>
#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> P1;
typedef long long int ll;

//define
#define INF 1e9
#define NUM 1000000007
#define all(x) begin(x),end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);i++)
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))

//function

/*ll gcd(ll a, ll b) {
	if (b == 0) return a;
	else return gcd(b, a%b);
}*/

/*ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a * (b / g);
}*/

/*int dig(int a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}*/

int main () {
	int c[3][3];
	VI a (3), b (3);
	int n = 3;

	rep (i, n) {
		rep (j, n) {
			cin >> c[i][j];
		}
	}

	a[0] = 0;
	REP(i,0,n){
		b[i] = c[0][i] - a[0];
	}
	
	REP (i, 1, n) {
		a[i] = c[i][0] - b[0];
	}

	//rep (i, n) cout << a[i] << " " << b[i] << endl;

	bool flag = true;
	rep (i, n) {
		rep (j, n) {
			if (a[i] + b[j] != c[i][j]) flag = false;
		}
	}

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

}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<numeric>
#include<algorithm>
#include<complex>
#include<queue>
#include<stdlib.h>
#include<map>
#include<cmath>
#include<stdio.h>
#include<stdlib.h>
#include<set>
#include<iomanip>

#define ll long long int
#define MOD 1000000007
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define mp make_pair

using namespace std;

int main(){
    ll n,m,d;
    cin >> n >> m >> d;
    if(d!=0){
        double ans = (double)(((2*(n-d))/(pow(n,2)))*(m-1));
        cout << setprecision(20) << ans << endl;
    }
    else{
        double ans = (double)((n/pow(n,2))*(m-1));
        cout << setprecision(20) << ans << endl;
    }
    return 0;
}


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

typedef long long int ll;
typedef string str;

int main ()
{
	// ios::sync_with_stdio(0);
 //    cin.tie(0);
 //    cout.tie(0);
	ll t,n,m,k,i,a,b,j;
	str st;
	cin >> st;
	n=st.length();
	ll f=0;
	for(i=0;i<n/2;i++)
	{
		if(st[i]!=st[n/2-i-1])
		{
			f=1;
			break;
		}
	}
	str s;
	for(i=0;i<n;i++)
	{
		s[i]=st[n-i-1];

	}
	for(i=0;i<n;i++)
	{
		if(s[i]!=st[i])
			f=1;
	}
	for(i=0;i<n/2;i++)
	{
		if(s[i]!=s[n/2-i-1])
		{
			f=1;
			break;
		}
	}
	if(f)
		cout << "No\n";
	else 
		cout << "Yes\n";
	return 0;
}

Measured memory_bytes: 256
n, k = list(map(int, input().split()))
D=[]
A=[]
flg = 0
counta = 0
for i in range(k):
    D.append(int(input()))
    A.append(list(map(int, input().split())))
#print(A)
for i in range(n):
    flg = 1
    for j in A:
        if j.count(i+1) == 1:
            flg=0
    if flg==1:
        counta+=1
print(counta)

Measured memory_bytes: 9208
#include<bits/stdc++.h>
using namespace std;
#define int             long long int
#define pb              push_back
#define se              second
#define mp              make_pair
#define fi              first
#define del(a,vec)      vec.erase(std::remove(vec.begin(), vec.end(), a), vec.end());
#define search(f,l,v)   binary_search(f,l,v)
#define iter(a,b)       vector<int>::iterator a,b
#define lower(v,num)    lower_bound (v.begin(), v.end(), num);
#define upper(v,num)    upper_bound (v.begin(), v.end(), num); 
#define removecopy(a)   unique(a.begin(), a.end()); 
#define vi              vector<int> 
#define pi              pair<int,int>    
#define vpi             vector<pi>      
#define mlbb            ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)    
int mod =1000000007;
namespace Rahul{
    bool isPrime(int n) 
    {if (n <= 1)  return false; if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
    return true; }
    int pow (int x, int n,int mod) {//calculate x^n
    if (n == 0) return 1;

    int res = pow (x, n / 2,mod);

    res = (res * res) % mod;
    if (n % 2) res = (res * x ) % mod;

    return res;
    }
    int _gcd(int a,int b)
    {
        if(a==0)
            return b;
        else    
            return _gcd(b%a,a);
    }
    //s.erase(s.find(2)) where s={1,2,3,3,2}; 
};
using namespace Rahul;
int32_t main()
{
    mlbb;
   int a,b;
    cin>>a>>b;
   
   
     int sum = 0;
     for(int i=0;i<b;i++)
    {
        int x;
        cin>>x;
        sum+=x;
        
    }
    if(sum>=a)cout<<"Yes\n";
    else cout<<"No\n";
    
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MAX 1005
#define pb push_back
#define mp make_pair
#define pii pair<long long,long long>
#define read(a) scanf("%d",&a)
#define p1(a) cout<<"Check "<<a<<endl;
#define p2(a,b) cout<<"Check "<<a<<' '<<b<<endl;
#define p3(a,b,c) cout<<"Check "<<a<<' '<<b<<' '<<c<<endl;
#define fo(i,n) for(i=0;i<n;i++)
#define ll long long
#define clr(a) memset(a,0,sizeof(a))
#define MOD 1000000007
#define INF 10000000000000;

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string st[MAX];
    for(int i=0;i<n;i++) cin>>st[i];
    long long dp[MAX][MAX];
    dp[0][0]=0;
    dp[1][1]=0;
    clr(dp);
    bool ti=true,tj=true;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(i==0 && j>0){
                if(st[i][j]=='#') tj=false;
                dp[i+1][j+1]=1&tj;
                continue;
            }
            else if(i>0 && j==0){
                if(st[i][j]=='#') ti=false;
                dp[i+1][j+1]=1&ti;
                continue;
            }
            if(st[i][j]=='#') dp[i+1][j+1]=0;
            else dp[i+1][j+1]=(dp[i][j+1]+dp[i+1][j])%MOD;
            //p3(i,j,dp[i+1][j+1]);
        }
    }
    cout<<dp[n][m]%MOD<<endl;

    return 0;

}


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


int main() {
  int N;
  cin >> N;
  
  int64_t l0 = 2;
  int64_t l1 = 1;
  
  for(int i=2;i<=N;i++){
    int64_t l2 = l1 + l0;
    l0 = l1;
    l1 = l2;
  }
  
  cout << l1 << endl;
}

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

using namespace std;
int main(){
    int n,m;
    cin >> n >> m;
    vector<int> x(m);
    for(int i = 0;i < m;i++){
        cin >> x[i];
    }
    sort(x.begin(),x.end());
    vector<int> interval(m-1);
    for(int i = 0;i < (m-1);i++){
        interval[i] = x[i+1] - x[i];
    }
    sort(interval.begin(),interval.end());
    int result = 0;
    for(int i = 0;i < (m-n);i++){
        result += interval[i];
    }
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <math.h>

#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;



int main() {

    int a, b;
    cin >> a >> b;
    int x, y;
    x = 0;
    y = 0;
    rep(i,b)
    {
        x += a * pow(10, i);
    }
    rep(i,a)
    {
        y += b * pow(10, i);
    }

    if(y>x)
    {
        x = y;
    }
    cout << x << endl;

    return 0;
}

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

int main()
{
    int A, B, C, D, E;
    int list[5] = {0};

    int max = 0, maxInd = 0;

    for (int i = 0; i < 5; i++)
    {
        cin >> list[i];
        if (list[i] % 10 != 0)
        {
            if (max < 10 - list[i] % 10)
            {
                max = 10 - list[i] % 10;
                maxInd = i;
            }
        }
    }

    int ans = 0;

    for (int i = 0; i < 5; i++)
    {
        if (i != maxInd)
        {
            if(list[i]%10 != 0) ans += list[i] + (10 - list[i] % 10);
            else ans += list[i];
        }
    }
    cout <<ans + list[maxInd] <<endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define faster() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const long long int infLL = 9000000000000000000;
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(a) (a).begin(),(a).end()
#define mx_int_prime 999999937
const int inf = 2000000000;
const double PI = acos(-1);
const double eps = 1e-9;
typedef long double ld;
#define MOD 1000000007
typedef long long ll;
const int mx=2e5+125;
ll pr[mx],ar[mx],br[mx];
#define PB push_back
#define endl '\n'
#define S second
#define F first
int main()
{
    int n;
    cin>>n;
    string s,t;
    cin>>s>>t;
    string ans="";
    for(int i=0; i<n; i++)
        ans+=s[i],ans+=t[i];
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 3512
#coding: euc-jp
class Main
  def self.main
    x, y, z, k = read
    a = Array.new(3).map{read.sort.reverse}
    stack = []
    flag = false
    [x, y].max.times do |i0|
      (i0 < x ? [y, i0].min : 0).times do |i1|
        s = a[0][i0] + a[1][i1]
        break if flag && s < stack[k - 1] || (i0 + 1) * (i1 + 1) > k
        d = stack.distribution(s)
        stack.insert(d, s)
      end
      (i0 < y ? [x, i0 + 1].min : 0).times do |i1|
        s = a[0][i1] + a[1][i0]
        break if flag && s < stack[k - 1] || (i0 + 1) * (i1 + 1) > k
        d = stack.distribution(s)
        stack.insert(d, s)
      end
      flag = true if ! flag && stack.length >= k
      stack = stack[0..(k - 1)] if flag
    end

    a[0] = stack
    a[1] = a[2]
    x = a[0].length
    y = a[1].length
    stack = []
    flag = false
    [x, y].max.times do |i0|
      (i0 < x ? [y, i0].min : 0).times do |i1|
        s = a[0][i0] + a[1][i1]
        break if flag && s < stack[k - 1] || (i0 + 1) * (i1 + 1) > k
        d = stack.distribution(s)
        stack.insert(d, s)
      end
      (i0 < y ? [x, i0 + 1].min : 0).times do |i1|
        s = a[0][i1] + a[1][i0]
        break if flag && s < stack[k - 1] || (i0 + 1) * (i1 + 1) > k
        d = stack.distribution(s)
        stack.insert(d, s)
      end
      flag = true if ! flag && stack.length >= k
      stack = stack[0..(k - 1)] if flag
    end

    k.times {|i| puts stack[i]}
  end

  def self.read
    gets.chomp.split.map(&:to_i)
  end
end

module Sort
  def distribution(v) #index2 pow2
    return 0 if (l = self.length) == 0
    pos = 0
    ind = l.index2
    (ind + 1).times do |i|
      if pos + (ind - i).pow2 <= l && self[pos + (ind - i).pow2 - 1] > v then
        pos += (ind - i).pow2
      end
    end
    return pos
  end
end

module Calc
  def index2
    if self < 1 then ; return nil ; end
    num = self >> 1
    r = 0
    while num > 0
      num = num >> 1
      r += 1
    end
    return r
  end

  def pow2
    return self < 0 ? 0 : 1 << self
  end
end

class Array
  include Sort
end

class Integer
  include Calc
end

Main.main


Measured memory_bytes: 46008
import java.util.*;

public class Main{
  public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N =sc.nextInt();
		int D = sc.nextInt();
		int count = 0;
		for(int i = 0;i < N;i++) {
			int X = sc.nextInt();
			int Y = sc.nextInt();
			if(Math.sqrt(Math.pow(X, 2) + Math.pow(Y, 2))<= D) {
				count++;
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 60612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
ll dp[12][1002];
int main(){
    int d,g;cin >> d >> g;
    vector<int> p(d),c(d);
    for(int i=0;i<d;i++) cin >> p[i] >> c[i];
    ll ans=LINF;
    for(int bit=0;bit<(1<<d);bit++){
        ll cost=0;
        ll problem=0;
        for(int i=0;i<d;i++){
            if((bit>>i)&1){
                cost+=p[i]*100*(i+1)+c[i];
                problem+=p[i];
            }
        }
        //cout << "cost" << cost << endl;
        if(cost>=g) ans=min(ans,problem);
        else{
            ll need=g-cost;
            for(ll i=d-1;i>=0;i--){
                if(need==0) continue;
                if(!((bit>>i)&1)){
                    ll cnt=(need%(100*(i+1))==0)?need/(100*(i+1)):need/(100*(i+1))+1;
                    //cout << "need" << need << "cnt" << cnt << endl;
                    if(cnt<p[i]){
                        problem+=cnt;
                        need=0;
                    }
                    else{
                        need-=100*(i+1)*(p[i]-1);
                        problem+=p[i]-1;
                    }
                }
            }
            if(need>0) continue;
            ans=min(ans,problem);
        }
        //cout << "problem" << problem << " " << bit << " " << ans << endl;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,M,*X = map(int,read().split())

MOD = 10 ** 9 + 7

def mult(a,b,c,d,e,f):
    # (a+bx+cx^2)(d+ex+fx^2) modulo 1-4x+2x^2-x^3
    a,b,c,d,e = a*d,a*e+b*d,a*f+b*e+c*d,b*f+c*e,c*f
    b += e; c -= 4*e; d += 2*e; e = 0
    a += d; b -= 4*d; c += 2*d; d = 0
    a %= MOD; b %= MOD; c %= MOD
    return a,b,c

# (1/x)^i modulo (1-4x+2x^2-x^3)
M = 10 ** 5
A1 = [0] * (M+1)
a,b,c = 1,0,0
for i in range(M+1):
    A1[i] = (a,b,c)
    a,b,c = b+4*a,c-2*a,a
    a %= MOD; b %= MOD; c %= MOD

# (1/x)^Mi modulo (1-4x+2x^2-x^3)
A2 = [0] * (M+1)
a,b,c = 1,0,0
d,e,f = A1[M]
for i in range(M+1):
    A2[i] = (a,b,c)
    a,b,c = mult(a,b,c,d,e,f)

def power(n):
    # (1/x)^n modulo (1-4x+2x^2-x^3)
    q,r = divmod(n,M)
    a,b,c = A1[r]
    d,e,f = A2[q]
    return mult(a,b,c,d,e,f)

X.append(N)

a,b,c = 0,1,1
prev_x = 0
for x in X:
    a,b,c = mult(a,b,c,*power(x - prev_x))
    b -= a; c -= a
    prev_x = x

answer = a
print(answer)

Measured memory_bytes: 39208
#include <stdio.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repi(i, n, a) for(int i = a; i < n; ++i)

int main(void) {
  int n, i, j, ans = 0;
  scanf("%d", &n);
  int a[n];
  rep(i, n) scanf("%d", &a[i]);
  int flag = 1;
  rep(i, n) {
    int minj = i, t;
    repi(j, n, i) if(a[j] < a[minj]) minj = j;
    t = a[i], a[i] = a[minj], a[minj] = t;
    if(i != minj) ++ans;
  }
  rep(i, n) {
    if(i) printf(" %d", a[i]);
    else printf("%d", a[i]);
  }
  printf("\n%d\n", ans);
  return 0;
}


Measured memory_bytes: 2688