akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pf push_front
#define fr first
#define sc second
#define r_0 return 0
#define ld long double
using namespace std;

    const ll N = 1e2 + 7;
    const ll mod = 1e9 + 7;



void solve(){
    int x;
    for(int i = 1; i <= 5; ++ i){
        cin >> x;
        if(!x){
            cout << i;
            exit(0);
        }
    }
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int tt = 1;
    //cin >> tt;
    while(tt --){
            solve();
    }
}

/**

**/


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define M 1000000007
#define all(a) (a).begin(),(a).end()
#define rep(i,n) reps(i,0,n)
#define reps(i,m,n) for(int i=(m);i<(n);i++)
int main(){
  ll n,d,k;cin>>n>>d>>k;
  vector<P> p(n);
  rep(i,n){
    ll a,b;cin>>a>>b;
    p[i]=P(a,b);
  }
  sort(all(p));
  queue<ll> q;
  ll c=(p[0].second+k-1LL)/k;
  ll m=c;
  q.push(0LL);
  reps(i,1,n){
    while(!q.empty()){
      if(p[i].first>p[q.front()].first+d*2){
        m-=(p[q.front()].second+k-1LL)/k;
        q.pop();
      }else{
        break;
      }
    }
    if(p[i].second<=m*k){
    }else{
      p[i].second-=m*k;
      m+=(p[i].second+k-1LL)/k;
      c+=(p[i].second+k-1LL)/k;
      q.push(i);
    }
  }
  cout<<c;
}

Measured memory_bytes: 4224
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>

using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ll> pdl;
typedef pair<ld, ld> pdd;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
//typedef boost::multiprecision::cpp_int bigint;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	ll A, B, C;
	cin >> A >> B >> C;
	ll c = 0;
	ll p = min(A,B);
	while (c < C) {
		if (A % p == 0 && B % p == 0)c++;
		p--;
	}
	cout << p+1 << endl;
	return 0;
}

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

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

using namespace std;

enum{
  DIAG, PREI, PREJ
};

pair<int, string> LCS(const string &a, const string &b){
  int n1=a.length();
  int n2=b.length();
  int dp[1+n1][1+n2];
  int v[1+n1][1+n2];
  string path;

  for(int i=0;i<1+n1;++i){
    for(int j=0;j<1+n2;++j){
      dp[i][j]=0;
      v[i][j]=-1;
    }
  }

  for(int i=0;i<n1;++i){
    for(int j=0;j<n2;++j){
      if(a[i]==b[j]){
	dp[i+1][j+1] = dp[i][j]+1;
	v[i+1][j+1] = DIAG;
      }
      else {
	if(dp[i][j+1] > dp[i+1][j]){
	  dp[i+1][j+1] = dp[i][j+1];
	  v[i+1][j+1] = PREI;
	}
	else {
	  dp[i+1][j+1] = dp[i+1][j];
	  v[i+1][j+1] = PREJ;
	}
      }
    }
  }
  int ni = n1;
  int nj = n2;
  while(v[ni][nj] !=-1){
    if(v[ni][nj] == DIAG){
      path+=(a[ni-1]);
      --ni;
      --nj;
    }
    else if(v[ni][nj] == PREI){
      ni--;
    }
    else {
      nj--;
    }
  }
  reverse(path.begin(), path.end());
  return make_pair(dp[n1][n2], path);
}

int main()
{
  string s;
  while(cin >> s){
    if(s == "#END")break;
    pair<int, string> ans(0, "");
    REP(i, 1, (int)s.length()){
      string a = s.substr(0, i);
      string b = s.substr(i, (s.length()-i));
      ans = max(LCS(a, b), ans);
    }
    cout << ans.second << endl;
  }
  return 0;
}

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

const int N = 36666, MOD = 1e9 + 7;
bool isnp[N];
vector<int> pri;
int val[N];
int fpow(int a, int b) {
  int ans = 1;
  for(; b > 0; b >>= 1, a = 1ll * a * a % MOD) {
    if(b & 1) {
      ans = 1ll * ans * a % MOD;
    }
  }
  return ans;
}

int main() {
  ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  isnp[0] = isnp[1] = true;
  for(int i = 2; i < N; i++) {
    if(!isnp[i]) {
      pri.push_back(i);
      for(int j = i + i; j < N; j += i) {
        isnp[j] = true;
      }
    }
  }
  int n; cin >> n;
  vector<int> v(n), oth;
  for(auto &x: v) {
    cin >> x;
    int t = x;
    for(int i = 0; i < int(pri.size()) && pri[i] <= t; i++) {
      if(t % pri[i] == 0) {
        int cnt = 0;
        while(t % pri[i] == 0) {
          t /= pri[i];
          cnt++;
        }
        val[i] = max(val[i], cnt);
      }
    }
    if(t > 1) {
      oth.push_back(t);
    }
  }
  sort(oth.begin(), oth.end());
  oth.erase(unique(oth.begin(), oth.end()), oth.end());
  int lcm = 1;
  for(int i = 0; i < int(pri.size()); i++) {
    lcm = 1ll * lcm * fpow(pri[i], val[i]) % MOD;
  }
  for(auto &x: oth) lcm = 1ll * lcm * x % MOD;
  int ans = 0;
  for(int i = 0; i < n; i++) {
    ans += 1ll * lcm * fpow(v[i], MOD - 2) % MOD;
    if(ans >= MOD) ans -= MOD;
  }
  cout << ans << "\n";
}


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

int main()
{
    int n;
    cin>>n;
    int h[n];
    for(int i=0;i<n;i++)
    {
        cin>>h[i];
    }
    int a[n];
    a[n-1]=0;
    a[n-2]=abs(h[n-1]-h[n-2]);
    for(int i=n-3;i>=0;i--)
    {
        a[i]=min(a[i+1]+abs(h[i]-h[i+1]),a[i+2]+abs(h[i]-h[i+2]));
    }
    cout<<a[0];
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main(int argc, char* argv[]) {
  long long N;
  cin >> N;

  long long a[N];
  for (long long i = 0; i < N; ++i)
    cin >> a[i];

  long long diff[N];
  diff[0] = 0;
  for (long long i = 2; i < N; i += 2) {
    long long d = 2 * (a[i - 1] - a[i - 2]);
    diff[i] = diff[i - 2] + d;
  }
  diff[1] = 0;
  for (long long i = 3; i < N - 1; i += 2) {
    long long d = 2 * (a[i - 1] - a[i - 2]);
    diff[i] = diff[i - 2] + d;
  }

  long long gap = 2 * (a[N - 1] - a[N - 2]) + diff[N - 2];
  for (long long i = 1; i < N; i += 2)
    diff[i] -= gap;

  long long rets[N];
  rets[0] =  (2 * a[0] - (diff[1] - diff[0])) / 2;
  for (long long i = 1; i < N; ++i) {
    rets[i] = rets[0] + diff[i];
  }


  for (long long i = 0; i < N; ++i)
    cout << rets[i] << " ";
  cout << endl;

  return 0;
}

Measured memory_bytes: 3712
#include <stdio.h>
#include <string.h>
 
int main(void)
{
 char S[10];
  scanf("%s", &S);
  
  if(strcmp(S, "ABC") == 0){
     printf("ARC\n");
     }else if(strcmp(S, "ARC") == 0){
       printf("ABC\n");
     }
 	return (0);
}

Measured memory_bytes: 1616
#include <bits/stdc++.h>
#include <string>
#define ft first
#define sc second
#define pt(sth) cout << sth << "\n"
#define moca(a, s, b) a=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
template<class T>bool chmax(T &a, const T &b) {if(a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if(b<a) {a=b; return 1;} return 0;}
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;

/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/


ll cnt[MAX*100]={};
int main(void) {
  ll i, j, k;
  
  ll N;
  cin >> N;
  ll a[MAX];
  
  map<ll, ll> mp[2];
  for(i=0; i<N; i++) {
    cin >> a[i];
    
    mp[i&1][a[i]]++;
  }
  mp[0][-1]=0;
  mp[1][-1]=0;
  
  priority_queue<pll> qu[2];
  for(i=0; i<2; i++) {
    for(auto it=mp[i].begin(); it!=mp[i].end(); it++) {
      qu[i].push(pll(it->sc, it->ft));
    }
  }
  
  pll p=qu[0].top(); qu[0].pop();
  pll q=qu[1].top(); qu[1].pop();
  
  if(p.sc==q.sc) {
    pll p1=qu[0].top(), q1=qu[1].top();
    pt(min(N-p.ft-q1.ft, N-p1.ft-q.ft));
  }else {
    pt(N-p.ft-q.ft);
  }
  
  
}
 
 


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

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


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define R cin>>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define for(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main(){
    char b; R b;
    if (b == 'A') cout << 'T' << "\n";
    else if (b == 'T') cout << 'A' << "\n";
    else if (b == 'C') cout << 'G' << "\n";
    else cout << 'C' << "\n";
}


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

ll mod = 1e9+7;

ll modpower(ll a, ll r){ //a^r
    ll x = 1;
    while (r > 0) {
        if (r & 1) x = x * a % mod;
        r >>= 1;
        a = a * a % mod;
    }
    return x;
}

ll modinv(ll a){
    return modpower(a, mod-2);
}

int main() {
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    sort(A.begin(), A.end());
    ll ans = 0;
    vector<ll> fact(N+1, 1), invfact(N+1, 1);
    for (int i = 2; i <= N; i++) fact[i] = fact[i-1]*i%mod;
    invfact[N] = modinv(fact[N]);
    for (int i = N-1; i >= 2; i--) invfact[i] = invfact[i+1]*(i+1)%mod;
    
    for (int i = 0; i <= N-K; i++) {
        ans = ans + mod - fact[N-1-i]*invfact[N-i-K]%mod*invfact[K-1]%mod*A[i]%mod;
        ans = (ans%mod+mod)%mod;
    }
    reverse(A.begin(), A.end());
    for (int i = 0; i <= N-K; i++) {
        ans += fact[N-1-i]*invfact[N-i-K]%mod*invfact[K-1]%mod*A[i]%mod;
        ans = (ans%mod+mod)%mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
using Base.Collections
function dijkstra(G,s,N)
	dist=ones(Int,N)*10^15
	dist[s]=0
	P=PriorityQueue(Int,Int)
	P[s]=0
	while !isempty(P)
		(u,cost)=peek(P)
		dequeue!(P)
		for (v,c)=G[u]
			nxt=cost+c
			if dist[v]>nxt
				dist[v]=nxt
				P[v]=nxt
			end
		end
	end
	dist
end
function main()
	N,M,S,T=map(x->parse(Int,x),split(readline()))
	Gs=[Pair{Int,Int}[] for _=1:N]
	Gt=[Pair{Int,Int}[] for _=1:N]
	for s=readlines()
		u,v,a,b=map(x->parse(Int,x),split(s))
		push!(Gs[u],v=>a)
		push!(Gs[v],u=>a)
		push!(Gt[u],v=>b)
		push!(Gt[v],u=>b)
	end
	ds=dijkstra(Gs,S,N)
	dt=dijkstra(Gt,T,N)
	ans=Array{Int}(N)
	ret=10^15
	for i=N:-1:1
		ret=min(ret,ds[i]+dt[i])
		ans[i]=10^15-ret
	end
	println.(ans)
end
main()


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

int main(){
    int n;
    cin >> n;
    double x[n];
    string u[n];
    
    for(int i=0;i<n;i++){
        cin >> x[i] >> u[i];
    }
    double sum = 0;
    for(int i=0;i<n;i++){
        if(u[i] == "BTC"){
            sum += x[i] * 380000.0;
        }
        else{
            sum += x[i];
        }
    }
    cout << sum << endl;
}

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

int main() {
  int a, b, n;
  while(cin >> a >> b >> n) {
    int s = 0;
    while(n--) {
      a = a%b*10;
      s += a/b%10;
    }
    cout << s << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <string>
#include <cctype>
#include <map>
#include <queue>

using namespace std;

const int mod = 1000000007;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define ll long long

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

    int maxNum = 1;
    int minNum = 1000;
    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a;

        maxNum = max(a, maxNum);
        minNum = min(a, minNum);
    }

    cout << (maxNum - minNum) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <cstring>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <ctime>
#include <cctype>
#include <stack>
#include <map>
#include <time.h>
using namespace std;
#define loop(i, st, en) for(int i = st; i <= en; ++i)
#define reverse(i, st, en) for(int i = st; i >= en; --i)
#define wh(t) while(t--)
#define mem(i, x) memset(i, x, sizeof(i))
#define ssc(x) scanf("%s", x)
#define dsc(x) scanf("%d", &x)
#define lldsc(x) scanf("%I64d",&x)
#define lfsc(x) scanf("%lf", &x)
#define csc(x) scanf("%c",&x)
#define to_(s,i) s[i]-'0'
typedef long long ll;
const int MAXN=3e3+10;
const int MAX=5e6;
const int INF=0x3f3f3f3f;
const ll P=1e9+7;
const ll C=1e5;
/*Atcode2370*/
int n;
int m;
long long dp[3010][3010][2];
int main(){
    scanf("%d%d",&n,&m);
    dp[0][0][0]=1;
    for(int i=1;i<=n;i++) dp[0][i][1]=1;
    for(int i=1;i<=m;i++){
        dp[i][0][0]=(dp[i-1][1][1]+dp[i-1][1][0]+dp[i-1][0][0])%P;
        dp[i][0][1]=dp[i-1][0][1];
        dp[i][1][0]=((dp[i-1][0][0]+dp[i-1][2][0])%P+2*dp[i-1][1][0]%P+dp[i-1][1][1])%P;
        dp[i][1][1]=((dp[i-1][0][1]+dp[i-1][2][1])%P+dp[i-1][1][1])%P;
        dp[i][n][0]=(dp[i-1][n-1][0]+dp[i-1][n][0])%P;
        dp[i][n][1]=(dp[i-1][n-1][1]+dp[i-1][n][1])%P;
        for(int j=2;j<=n-1;j++){
            dp[i][j][0]=((dp[i-1][j-1][0]+dp[i-1][j+1][0])%P+2*dp[i-1][j][0]%P)%P;
            dp[i][j][1]=((dp[i-1][j-1][1]+dp[i-1][j+1][1])%P+2*dp[i-1][j][1]%P)%P;
        }
    }
    long long ans=0;
    if(n==1) ans++;
    for(int i=0;i<=n;i++){
        ans=(ans+dp[m][i][0])%P;
    }
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 141568
#include "bits/stdc++.h"
using namespace std;
const int N = 1e5 + 5;

vector< pair< int, int> > conn[32];
int s[N];


int main() {
    int n, c;
    cin >> n >> c;
    for (int i = 1; i <= n; ++i) {
        int a, b, x;
        cin >> a >> b >> x;
        conn[x].emplace_back(a, b);
    }

    for (int i = 1; i <= c; ++i) sort(conn[i].begin(), conn[i].end());
    for (int i = 1; i <= c; ++i) {
        for (int j = 0; j < conn[i].size(); ++j) {
            if (j and conn[i][j - 1].second == conn[i][j].first) conn[i][j].first++;
            s[conn[i][j].first]++;
            s[conn[i][j].second + 1]--;
        }
    }

    for (int i = 1; i < N; ++i) s[i] += s[i - 1];
    int res = *max_element(s, s + N);
    cout << res << endl;
}

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

enum mass{
    none,black,white
};

vector<int> v[100001];
mass m[100001];

int main() {

    int n;

    cin >> n;

    for(int i=0; i<n-1; i++){
        int a,b;
        cin >> a >> b;
        v[a].push_back(b);
        v[b].push_back(a);
    }

    for(int i=0; i<100001; i++){
        m[i] = none;
    }

    m[1] = black;
    m[n] = white;

    queue<int> q;

    q.push(1);
    q.push(n);

    int white_count,black_count;

    white_count = black_count = 1;

    while(!q.empty()){

        int now_mass = q.front();
        q.pop();

        for(int i=0; i<v[now_mass].size(); i++){
            if(m[v[now_mass][i]] == none){
                m[v[now_mass][i]] = m[now_mass];
                q.push(v[now_mass][i]);
                if(m[now_mass] == black){
                    black_count++;
                }
                else if(m[now_mass] == white){
                    white_count++;
                }
            }
        }

    }

    string ans = "Snuke";

    if(black_count > white_count){
        ans = "Fennec";
    }

    cout << ans << endl;



    return 0;
}

Measured memory_bytes: 6272
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace ACprac
{
    class Program
    {
        static void Main(string[] args)
        {
            int menP = 700;
            string s = Console.ReadLine();

            for(int i = 0; i < 3; i++)
            {
                if(s.Substring(i, 1).Equals("o"))
                {
                    menP = menP + 100;
                }
            }

            Console.WriteLine(menP);
        }

    }
}

Measured memory_bytes: 13140
#include <stdio.h>
#include <vector>

int main(int argc, char* argv[]){
    int a, b;
    char op;
    std::vector<int> results;
    while(true) {   
        scanf("%d %c %d", &a, &op, &b);
        switch(op) {
            case '+': {
                results.push_back(a + b);
                break;
            }
            case '-': {
                results.push_back(a - b);                
                break;
            }
            case '*': {
                results.push_back(a * b);
                break;
            }
            case '/': {
                results.push_back(a / b);
                break;
            }
            case '?': {
                goto end;
            }
        }
    }
    end:
    for(auto i: results){
        printf("%d\n", i);
    }
}


Measured memory_bytes: 2748
h, w = map(int, input().split())

lis = []
for _ in range(h):
    tmp = input()
    lis.append(list(tmp))
    
flag = 0
delg = []
for i in range(h):
    for j in range(w):
        if lis[i][j] == "#":
            flag = 1
            break
        else:
            flag = 0
    
    if flag == 0:
        delg.append(i)
        
nlis = []

if delg != False:    
    for k in range(h):
        if k not in delg:
            nlis.append(lis[k])
            
h = h - len(delg)

flg = 0
delr = []

for k in range(w):
    for i in range(h):
        if nlis[i][k] == "#":
            flg = 1
            break
        else:
            flg = 0
    
    if flg == 0:
        delr.append(k)
        
delr = list(reversed(delr))


if delr != False:
    for i in range(h):
        for j in delr:
            nlis[i].pop(j)

for l in nlis:
    print("".join(l))

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

int main() {
	string S;
	cin >> S;
	int ans0 = 0;
	for (int n = 0;n<S.size();++n) {
		if (1 == n%2) {
			if ('0' != S[n]) {
				ans0++;
			}
		}
		else {
			if ('1' != S[n]) {
				ans0++;
			}
		}
	}
	int ans1 = 0;
	for (int n = 0; n < S.size(); ++n) {
		if (1 == n % 2) {
			if ('1' != S[n]) {
				ans1++;
			}
		}
		else {
			if ('0' != S[n]) {
				ans1++;
			}
		}
	}
	cout << min(ans0,ans1) <<endl;
}


Measured memory_bytes: 3692
#include <iostream>

using namespace std;

int main()
{
  int n, k, toggle = 0, happy;
  char c, c_prev;
  cin >> n >> k >> c_prev;

  for (int i = 1; i < n; i++) {
    cin >> c;
    if (c != c_prev) {
      toggle++;
    }
    c_prev = c;
  }
  //cout << toggle << endl;

  happy = n - 1 - toggle;
  if (k*2 <= toggle) {
    cout << happy + 2*k << endl;
  } else {
    cout << n - 1 << endl;
  }

  return 0;
}


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

int main() {
	int n;cin>>n;
	long long k;cin>>k;
	int ans;
	vector<pair<long long,long long>> p(n);
	for(int i=0;i<n;i++){
		cin>>p[i].first>>p[i].second;
	}
	sort(p.begin(),p.end());
	long long count=0;
	for(int i=0;i<n;i++){
		count+=p[i].second;
		if(count>=k){
			ans=p[i].first;
			break;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define fr front()
#define tp top()
typedef long long int ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <pii, int> ppi;
typedef pair <int, pii> pip;
#define iofast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define iofile freopen("input.txt","r",stdin),freopen("output.txt","w",stdout)
const ll LLINF = 1e18;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1);
const int SIZE = 1111;

int N, M;
char ch[SIZE][SIZE];
int dp[SIZE][SIZE];

int main (){
	
	scanf("%d %d", &N, &M);
	for(int i=1;i<=N;i++){
		getchar();
		for(int j=1;j<=M;j++){
			scanf("%c", &ch[i][j]);
		}
	}
	memset(dp,0,sizeof(dp));
	dp[1][1]=1;
	for(int i=1;i<=N;i++){
		for(int j=1;j<=M;j++){
			if(ch[i][j]=='.'){
				dp[i][j]=max(dp[i][j],dp[i-1][j]+dp[i][j-1]);
				dp[i][j]%=MOD;
			}
		}
	}
	printf("%d\n", dp[N][M]);
	
	return 0;
}

Measured memory_bytes: 6144
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
//deque/functional/iterator/list/map/memory/numeric/queue/set/stack/utility/vector
//#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int mod=1e9+7;

ll fact(ll n){
    if(n==0) return 1;
    else return (n*fact(n-1))%mod;
}

int main(){
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    cout<<fact(n)<<endl;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

ll n,L,T;
vl a;

int main(){
	cin>>n>>L>>T;
	a=vl(n);
	ll I=0;
	for(int i=0;i<n;i++){
		ll x,t;
		cin>>x>>t;
		if(t==1){
			a[i]=(x+T)%L;
			I=(I-(T+x)/L%n+n)%n;
		}
		else{
			a[i]=(x-T%L+L)%L;
			(I+=(T+L-x-1)/L)%=n;
		}
	}
	sort(a.begin(),a.end());
	for(int i=0;i<n;i++) cout<<a[(n-I+i)%n]<<endl;
}


Measured memory_bytes: 1920
#include <iostream>

using namespace std;

int selectionSort(int A[],int n){
    int counts = 0;
    for(int i=0;i<n;i++){
        int minn = i;
        for(int j=i;j<n;j++){
            if(A[j]<A[minn]){
                minn = j;
            }
        }
        if(minn!=i){
            int temp = A[i];
            A[i] = A[minn];
            A[minn] = temp;
            counts++;
        }
    }
    return counts;
}
int main()
{
    int n;
    cin>>n;
    int A[n];
    for(int i=0;i<n;i++){
        cin>>A[i];
    }
    int counts = selectionSort(A,n);
    for(int i=0;i<n;i++){
        if(i>0) cout<<" ";
        cout<<A[i];
    }
    cout<<endl;
    cout<<counts<<endl;
    return 0;
}




Measured memory_bytes: 3076
#include<bits/stdc++.h>
using namespace std; 
#define all(c) c.begin(),c.end()
#define REP(i,a,b) for(int i=a;i<=b;++i)
#define tr(container,it) \
for(auto it=container.begin();it!=container.end();++it)
typedef long long ll ; 
typedef vector<int> vi;
#define mod 1000000007



int main()
{
 //freopen("input.txt","r",stdin);
 //freopen("output.txt","w",stdout);
  //ios::sync_with_stdio(0);
// cin.tie(0);
/* int n;
cin>>n;
vector<array<int,2>>v(n);
REP(i,0,n-1)
cin>>v[i][0]>>v[i][1];
sort(all(v));
 */
int n;
cin>>n;
vector<double>dp(n+1);
dp[0]=1;
for(int i=0;i<n;++i){
  double p_head;
  cin>>p_head;
  for(int j=i+1;j>=0;--j){
    dp[j]=dp[j]*(1-p_head);
    if(j-1>=0)
    dp[j]+=dp[j-1]*p_head;
    
  }
}
double sum=0;
for(int i=n/2+1;i<=n;++i)
sum+=dp[i];
printf("%.10lf",sum);
    return 0;
}

Measured memory_bytes: 3868
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define repc2(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define inf 2e9
#define linf 9000000000000000000ll
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

const int A = 0;
const int C = 1;
const int G = 2;
const int T = 3;

template <ll MOD>
class mod_int {
   public:
    ll val;
    constexpr mod_int(const ll x = 0) noexcept : val(x % MOD) {}
    constexpr ll &value() noexcept { return val; }
    constexpr const ll &value() const noexcept { return val; }
    constexpr mod_int operator+(const mod_int r) const noexcept { return mod_int(*this) += r; }
    constexpr mod_int operator-(const mod_int r) const noexcept { return mod_int(*this) -= r; }
    constexpr mod_int operator*(const mod_int r) const noexcept { return mod_int(*this) *= r; }
    constexpr mod_int operator/(const mod_int r) const noexcept { return mod_int(*this) /= r; }
    constexpr mod_int &operator+=(const mod_int r) noexcept {
        val += r.val;
        if (val >= MOD) {
            val -= MOD;
        }
        return *this;
    }
    constexpr mod_int &operator-=(const mod_int r) noexcept {
        if (val < r.val) {
            val += MOD;
        }
        val -= r.val;
        return *this;
    }
    constexpr mod_int &operator*=(const mod_int r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr mod_int &operator/=(mod_int r) noexcept {
        ll exp = MOD - 2;
        while (exp) {
            if (exp % 2) {
                *this *= r;
            }
            r *= r;
            exp /= 2;
        }
        return *this;
    }
};
const ll M = 1000'000'007;
using mint = mod_int<M>;

int n;
mint dp[4][4][109];

mint solve(int n) {
    rep(i, 4) {
        rep(j, 4) { dp[i][j][2] = 1; }
    }
    repc2(i, 3, 100) {
        rep(p1, 4) {
            rep(p2, 4) {
                mint &cur = dp[p1][p2][i];
                rep(j, 4) { cur += dp[j][p1][i - 1]; }
                if (p1 == G && p2 == C) {
                    cur -= dp[A][G][i - 1];
                    cur -= dp[A][T][i - 2];
                    cur -= dp[A][G][i - 2];
                } else if (p1 == C && p2 == G) {
                    cur -= dp[A][C][i - 1];
                } else if (p1 == A && p2 == C) {
                    cur -= dp[G][A][i - 1];
                } else if (p1 == T && p2 == C) {
                    cur -= dp[A][G][i - 2];
                }
            }
        }
    }
    mint ans = 0;
    rep(i, 4) {
        rep(j, 4) { ans += dp[i][j][n]; }
    }
    return ans;
}

int main() {
    cin >> n;
    cout << solve(n).value() << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    long long a, b;
    cin >> a >> b;
    long long damage = 0;
    long long from;
    long long to;
    cin >> to;
    for(int i = 0; i < n - 1; i++){
        from = to;
        cin >> to;
        damage += min((to - from) * a, b);
    }
    cout << damage << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;  //これで"std::cout"が"cout"と書ける

//MACRO
typedef long long ll;                  //64bit以上を表現可能な型
#define INF 100000000                  //ほぼ無限
#define itn int                        //タイポ対策
#define all(x) (x).begin(), (x).end()  //sort(all(x))などとする
#define SZ(x) ((int)(x).size())        //size()簡略化
//repetition
#define FOR(i, p, b) for (int i = (p); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define repR(i, n) for (int i = n; i >= 0; i--)
//debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \<< " " << __FILE__ << endl;
template <class T>
bool chMAX(T &a, const T &b) {  //aよりbが大きければaに代入
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chMIN(T &a, const T &b) {  //aよりbが小さければaに代入
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

//
//
//

int main() {
    int a = 0, b = 0;
    int n = 0, m = 0;
    cin >> n >> m;

    int cnt[n] = {0};

    rep(i, m) {
        cin >> a >> b;
        cnt[a - 1]++;
        cnt[b - 1]++;
    }
    rep(i, n) {
        cout << cnt[i] << endl;
    }

}

Measured memory_bytes: 256
import copy
def inputInline():
    N = int(input())
    cards = input().split(" ")
    return cards

def selectionSort(list):
    cards=copy.deepcopy(list)
    n = len(cards)
    count = 0
    for i in range(n):
        min_j = i
        for j in range(i + 1, n):
            if int(cards[j][1]) < int(cards[min_j][1]):
                min_j = j
        if min_j != i:
            temp = cards[i]
            cards[i] = cards[min_j]
            cards[min_j] = temp
            count += 1
    return (" ".join(cards), count)

def bubbleSort(list):
    cards=copy.deepcopy(list)
    N = len(cards)
    count = 0
    flag = True
    while flag:
        flag = False
        for i in range(N - 1):
            if int(cards[i][1]) > int(cards[i + 1][1]):
                temp = cards[i]
                cards[i] = cards[i + 1]
                cards[i + 1] = temp
                flag = True
                count += 1
    return (" ".join(cards), count)
cards=inputInline()
sortedbubble=bubbleSort(cards)[0]
sortedselection=selectionSort(cards)[0]
print(sortedbubble)
print("Stable")
print(sortedselection)
if sortedbubble==sortedselection:
    print("Stable")
else:
    print("Not stable")

Measured memory_bytes: 8232
import java.util.*;
import java.io.*;

class Main {

	void solve() {

		char[] a = incharar();
		int cost = 0;
		
		for (int i=0; i<a.length/2; i++) {
			if (a[i] != a[a.length-i-1]) cost++;
		}
		out.println(cost);

	}

	public static Scanner in = new Scanner(System.in);
	public static PrintWriter out = new PrintWriter(System.out);

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

	public int inint() {
		return in.nextInt();
	}

	public long inlong() {
		return in.nextLong();
	}
	
	public String instr() {
		return in.next();
	}

	public int[] inintar(int num) {
		int[] a = new int[num];
		for (int i=0; i<num; i++) {
			a[i] = in.nextInt();
		}
		return a;
	}

	public char[] incharar() {
		return in.next().toCharArray();
	}

}

Measured memory_bytes: 23764
#include<iostream>

using namespace std;

int main() {
  long long n , m;
  cin >> n >> m;

  long long ans = 0;

  if(m >= 2*n) {
    ans = n;
    m = m - 2*n;
    ans += m/4;
  }else {
    ans = m/2;
  }

  cout << ans << endl;

  return 0;
}


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

int main(){

  int i,j,n,a,b,c,x,y[10001];
  while(1){
    int count=1;
    x=0;
  cin >> n >>a >> b >> c >> x;
  if(n==0 && a==0 && b==0 && c==0 && x==0)break;
  
  for(i = 1; i <= n; i++){
    cin >> y[i];
  }

  for(i = 1;; i++){
    if(i>10001){
      cout << -1 << endl;
      break;
    }
    if(x==y[count])count++;
    if(count==n+1){
      cout << i-1 << endl;
      break;
    }
    x = (a*x+b)%c;
  }

  

    }
  return 0;
}

Measured memory_bytes: 1164
X, N = map(int,input().split())
if N==0:
    print(X)
else:
    P = list(map(int,input().split()))
    P.sort()
    Q = [i-1 for i in range(-10,111)]
    for a in P:
        Q.remove(a)
    Q1 = [abs(b - X) for b in Q]
    print(Q[Q1.index(min(Q1))])
 

Measured memory_bytes: 9196
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <random>
#include <chrono>
#include <string>
#include <bitset>
#include <cassert>
#include <queue>
#include <memory>

//#pragma comment(linker, "/STACK:16777216")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("unswitch-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,abm,mmx,avx,avx2,popcnt,tune=native")

using namespace std;

//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

#define ll long long
#define ull unsigned long long
//#define double long double
#define int ll
//#define int ull
//#define int short
//#define int unsigned short
//#define int unsigned int
#define mp make_pair
#define F first
#define S second
#define pii pair<int, int>
#define hash hash228
#define get get228
const int SZ = 1e3 + 4;
const double EPS = 1e-7;
const int mod = 998244353;
const int hashpow = 127;
const int inf = 2e9;

#define kek cout << "kek"

int a, b, c;

void read() {
    cin >> a >> b >> c;
}

void solve() {
    if (4 * a * b < (c - a - b) * (c - a - b) && c >= a + b) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
}

signed main() {

#ifdef __LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif

//    int t;
//    cin >> t;
//    for (int i = 0; i < t; ++i) {
    read();
    solve();
//    }

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>

int main() {
  size_t N;
  intmax_t T;
  scanf("%zu %jd", &N, &T);

  std::vector<intmax_t> t(N);
  for (auto& ti: t) scanf("%jd", &ti);
  t.push_back(2e9);

  intmax_t res = 0;
  intmax_t cur = t[0];
  for (size_t i = 1; i <= N; ++i) {
    res += std::min(T, t[i]-cur);
    cur = t[i];
  }

  printf("%jd\n", res);
}


Measured memory_bytes: 4096
#include <stdio.h>

int main()
{
	int s,i,d;
	
	while(scanf("%d",&d)!=EOF){
		s=0;
		for(i=1;d*i<600;i++){
			s+=(d*i*d*i*d);
		}
		printf("%d\n",s);
	}
	return 0;
}

Measured memory_bytes: 596
#if 1

#include <bits/stdc++.h>
using namespace std;
vector <int> v[100005];
long long b[100005],w[100005],m = 1000000007,n,x,y;
void f(int x)
{
    b[x] = w[x] = 1;
    for(int i = 0;i < v[x].size();i++)
    {
        if(b[v[x][i]] != 0)continue;
        f(v[x][i]);
        b[x] *= w[v[x][i]];
        b[x] %= m;
        w[x] *= w[v[x][i]]+b[v[x][i]];
        w[x] %= m;
    }
}
int main()
{
    scanf("%d",&n);
    n--;
    while(n--)
    {
        scanf("%d %d", &x, &y);
        v[x].push_back(y);
        v[y].push_back(x);
    }
    f(1);
    printf("%lld\n",(b[1]+w[1]) % m);
}

#endif // 1++


Measured memory_bytes: 11392
#include <bits/stdc++.h>
using namespace std;
int dp[100005];
int input[100005];
int frog(int n){
    int res;
    if(n == 1) res = abs(input[1] - input[0]);
    else if(n == 0) res = 0;
    else if(dp[n] != -1){
        return dp[n];
    }
    else{
        res = min(abs(input[n - 1] - input[n]) + frog(n - 1),
                abs(input[n - 2] - input[n]) + frog(n - 2));
    }
    dp[n] = res;
    return res;
}
int main()
{
    int n;
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        dp[i] = -1;
    }
    for(int i = 0;  i < n; i++){
        cin >> input[i];
    }
    cout << frog(n - 1);


}

Measured memory_bytes: 6724
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;
int main()
{
    while (true) {
        int n;
        cin >> n;
        if (n == 0) {
            break;
        }
        vector<int> isprime(2 * n + 1, 1);
        int cnt = 0;
        for (int i = 2; i <= 2 * n; i++) {
            if (not(isprime[i] == 1)) {
                continue;
            }
            if (i > n) {
                cnt++;
            }
            for (int j = 2; i * j <= 2 * n; j++) {
                isprime[i * j] = 0;
            }
        }
        cout << cnt << endl;
    }
    return 0;
}

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

int main(){
  
  int a,b,c;
  cin >> a >> b >> c;
  
  if( a*b < c ){
    
    cout << a*b << endl;
    
  }
  
  else{
    
    cout << c << endl;
    
  }
  
}
  


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

using namespace std;

#define int long long
#define endl '\n'
#define MOD 1000000007
#define maxn 100010

void solve() {
    int n;
    cin >> n;


    vector<int> v(n), b(n);

    int ct = 0;
    bool ans = false;
    for (int i = 0; i < n; i++)
        cin >> v[i];
    for (int i = 0; i < n; i++) {
        cin >> b[i];
        if (v[i] > b[i] and ct == 0)
            ans = true, ct++;
        else if (v[i] < b[i] and ct == 0)
            ans = false, ct++;
    }

    if (v == b) {
        cout << 0;
        return;
    }

    if (ans)
        swap(v, b);
    ct = 0;
    while (next_permutation(v.begin(), v.end())) {
        if (b != v)
            ct++;
        else
            break;
    }
    cout << ct + 1 << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
const int MAXN = 200005;
long long a[MAXN], ans;
int main()
{
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i)
    {
        scanf("%lld", a + i);
        if(a[i] < a[i-1])
        {
            ans += a[i - 1] - a[i];
            a[i] = a[i - 1];
        }
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 3292
package main

import "fmt"

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)

	total := b - a + 1
	lcm := lcm(c, d)

	num1 := f(b, c) - f(a-1, c)
	num2 := f(b, d) - f(a-1, d)
	num3 := f(b, lcm) - f(a-1, lcm)
	fmt.Println(total - (num1 + num2 - num3))

}

//1~x
func f(x int, a int) int {
	return x / a
}
func lcm(i, j int) int {
	return i * j / gcd(i, j)
}
func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}


Measured memory_bytes: 512
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 result = 0;

		if(A == B) {
			result = A + B;
		}else if(A >B) {
			result = A + A - 1;
		}else if(B>A) {
			result = B + B -1;
		}
		System.out.println(result);





	}
}


Measured memory_bytes: 21972
#include<bits/stdc++.h>
#include<cstring>
using namespace std;
int main(){
	char T[200000];
	cin>>T;
	int i,n=strlen(T);
	for(i=0;i<n;i++){
		if(T[i]=='?'){
			T[i]='D';
		}
		cout<<T[i];
	}
}
	
			

Measured memory_bytes: 3816
//dequeを用いた深さ優先探索

#include <bits/stdc++.h>
#include <queue>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for(int i=0;i<n;i++)
queue<int> U;
//vector<int> dist;
vector<bool> seen(101010);
vector<int> group(101010);
vector<set<int>> member(101010);
Graph friends(101010);
Graph block(101010);
int group_id=1;

void dfs(int v){
  seen[v] = true;
  group[v] = group_id;
  member[group_id].insert(v);
  for(auto next_v : friends[v]){
      if(!seen[next_v]) dfs(next_v);
  }
}
int main() {
    // 頂点数と辺数、s と t
    int n, m, k; cin >> n >> m >> k;
    // グラフ入力受取
    for(int i=0;i<m;i++) {
      int a, b;
      cin >> a >> b;
      a--;b--;
      friends[a].push_back(b);
      friends[b].push_back(a);
    }
    for(int i=0;i<k;i++){
      int c, d;
      cin >> c >> d;
      c--;d--;
      block[c].push_back(d);
      block[d].push_back(c);
    }
    rep(i,n){
      if(!seen[i]){
        dfs(i);
        group_id++;
      }
    }
    rep(i,n){
      int x = group[i];
      int ans = member[x].size() - 1 - friends[i].size();
      for(int y : block[i]){
        if(member[x].count(y)) ans --;
      }
      cout << ans << " ";
    }
}

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

signed main() {
  int H;
  cin >> H;

  if(H==1) {
    puts("1");
    return 0;
  }
  int b = (int)log2(H) + 1;
  cout << (1LL<<b) - 1 << endl;
}


Measured memory_bytes: 256
a,b,c= map(int, input().split())

if a==b:
    if a != c:
        print("Yes")
    else: 
        print("No")
elif b==c:
    if c != a:
        print("Yes")
    else :
        print("No")
elif c==a :
    if a != b:
        print("Yes")
    else:
        print("No")
else :
    print("No")



# h = sorted(h,reverse = True)
# print(sum(h[k:]))zz

# s,t= map(str, input().split())
# a,b= map(int, input().split())
# u = input()
# print("x"*len(u))

# if(u == s):
#     print(a-1,b)
# else:
#     print(a,b-1)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
const int N=1<<10;
int n,m;
char a[N][N];
void solve(int x)
{
    int now=1;x=(1<<x)-1;
    a[1][1]='1';
    while(now<x)
    {
        int nx=now*2+1;
        for(int i=1;i<=now;i++)
            for(int j=1;j<=now;j++)
            a[i+now+1][j+now+1]=a[i+now+1][j]=a[i][j+now+1]=a[i][j];
        a[now+1][now+1]='1';
        now=nx;
    }
}
int main()
{
    memset(a,'0',sizeof(a));
    scanf("%d%d",&n,&m);
    if(n>m)
    {
        solve(n);
        for(int i=1;i<=(1<<n)-1;i++)
        {
            for(int j=1;j<=(1<<m)-1;j++)
                putchar(a[i][j]);
            putchar('\n');
        }
    }
    else
    {
        solve(m);
        for(int i=1;i<=(1<<n)-1;i++)
        {
            for(int j=1;j<=(1<<m)-1;j++)
                putchar(a[j][i]);
            putchar('\n');
        }
    }
}


Measured memory_bytes: 2304
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define bp __builtin_popcount
#define debug(x) cerr << #x << " = " << x << endl;

const int MOD = 1e9 + 7;
const int INF = 1e18;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it : t)cout<<it<<" ";}
inline int powerexp(int a, int b, int m = MOD){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 

bool primality_test(int n){
  if(n <= 1) return false;
  if(n == 2) return true;
  if(n % 2 == 0) return false;
  for(int i = 3; i * i <= n;i += 2)
	if(n % i == 0) return false;
  return true;
}

void solve(){
   int n;
   cin >> n;
   vector<int> v;
   for(int i = 0; i < n; i++){
	   int x;
	   cin >> x;
	   v.push_back(x);  
	 }
  int cnt = 0;
  for(auto it : v) cnt += primality_test(it);
  cout << cnt << endl;
}

//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}



Measured memory_bytes: 3244
import sys

def hitBlow(a, b):
    hit = 0
    blow = 0
    for i in range(len(a)):
        if a[i] == b[i]:
            hit += 1
        else:
            for j in range(len(b)):
                if a[i] == b[j]:
                    blow += 1

    return [hit, blow]

for s in sys.stdin:
    a = list(map(int, s.split()))
    b = list(map(int, input().split()))

    hit, blow = hitBlow(a, b)

    print(hit, blow)

Measured memory_bytes: 6720
A, B = map(int,input().split())
D = 2
ans = 1
A_l = []
B_l = []
MAX = max(A, B)
q_MAX = int(MAX ** (1/2))
for i in range(2, q_MAX+1):
    if A % D == 0:
        while True:
            if A % D != 0:
                break
            A //= D
        A_l.append(D)
    if B % D == 0:
        while True:
            if B % D != 0:
                break
            B //= D
        B_l.append(D)
    if i == q_MAX:
        A_l.append(A)
        B_l.append(B)
    if A == B == 1:
        break
    D += 1
for a in A_l:
    if a in B_l:
        ans += 1
print(ans)


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


#define ll long long
#define pb push_back

#define loop(i, a, b) for(int i = (a); i < (b); i++)
#define loopb(i, a, b) for(int i = (a); i > (b); --i)

typedef pair <int,int> ii;
typedef vector <int> vi;
typedef vector <ii> vii;
typedef vector <ll> vl;

const int mod = 1e9+7;
const ll inf = 2e18+5;


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    ll h,n,x;
    cin>>h>>n;
    ll sum=0;
    loop(i,0,n){
        cin>>x;
        sum+=x;
    }
    if(sum>=h)  cout<<"Yes";
    else        cout<<"No";
   
    return 0;
}   

Measured memory_bytes: 256
N, K = map(int, input().split())
hList = [0]*N
for i in range(N):
    hList[i] = int(input())

hList = sorted(hList)

ansList = [0]*(N-K+1)

for i in range(N-K+1):
    ansList[i] = hList[i+K-1] - hList[i]

print(min(ansList))

Measured memory_bytes: 10852
#include<stdio.h>
#define N 10

void deal(int x,int y,int n,int ptnx[],int ptny[],int data[N][N]){
  int i;
  for (i=0;i<n;i++)
    if ((0<=x+ptnx[i]) && (0<=y+ptny[i]) &&
        (x+ptnx[i]<N) && (y+ptny[i]<N)){
      data[x+ptnx[i]][y+ptny[i]]++;
    }
}

int main(){
  int i,j,x,y,size,max=0,cnt=0;
  int data[N][N];
  int ptnx1[]={0,0,0,1,-1},ptny1[]={0,-1,1,0,0};
  int ptnx2[]={0,0,0,-1,-1,-1,1,1,1},ptny2[]={0,-1,1,-1,0,1,-1,0,1};
  int ptnx3[]={0,0,0,-1,-1,-1,1,1,1,0,0,-2,2},ptny3[]={0,-1,1,-1,0,1,-1,0,1,2,-2,0,0};
  for (i=0;i<N;i++)
    for (j=0;j<N;j++)
      data[i][j]=0;

  while (scanf("%d,%d,%d",&x,&y,&size)!=EOF){
    if (size==1){
      deal(x,y,sizeof(ptnx1)/sizeof(ptnx1[0]),ptnx1,ptny1,data);
    }else if (size==2){
      deal(x,y,sizeof(ptnx2)/sizeof(ptnx2[0]),ptnx2,ptny2,data);
    }else if (size==3){
      deal(x,y,sizeof(ptnx3)/sizeof(ptnx3[0]),ptnx3,ptny3,data);
    }
  }

  for (i=0;i<N;i++)
    for (j=0;j<N;j++){
      if (data[i][j]==0)
        cnt++;
      if (data[i][j]>max)
        max=data[i][j];
    }
  printf("%d\n%d\n",cnt,max);
  return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <algorithm>

using namespace std;

int main(void) {
	const long long MOD = 1000000007;
	int n;
	cin >> n;
	long long ans = 1;
	for (int i = 1; i <= n; i++) {
		ans *= i;
		ans %= MOD;
	}

	cout << ans;

}

Measured memory_bytes: 3160
#include <stdio.h>
#include <math.h>
int main()
{	int n,m,t;
	scanf("%d%d",&n,&m);
	if(m-n<10000000)
	{
		while(m%n) n++;
		printf("%d",m/n);
	}
	else
	{
		t=m/n;
		while(m%t) t--;
		printf("%d",t);
	}
	return 0;
}

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

using namespace std;

typedef long long ll;

const int N = 1e5 + 5;
int parent[N];
int rnk[N];

int getParent(int x)
{
  if(parent[x] == x)
    return x;
  return parent[x] = getParent(parent[x]);
}

void connect(int x, int y)
{
  x = getParent(x), y = getParent(y);
  if(x == y)
    return;
  if(rnk[x] <= rnk[y])
  {
    parent[x] = y;
    rnk[y] += rnk[x];
  }
  else
  {
    parent[y] = x;
    rnk[x] += rnk[y];
  }
}

bool isconnected(int x, int y)
{
  return getParent(x) == getParent(y);
}

int main()
{
 ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
 int n;
 cin >> n;
 for(int i = 0; i < n; i++)
  parent[i] = i, rnk[i] = 1;
 vector<pair<int, int>> points(n);
 vector<pair<int, pair<int, int>>> dist;
 vector<pair<pair<int, int>, int>> sortx, sorty;
 for(auto &x: points)
 {
   cin >> x.first >> x.second;
 }
 for(int i = 0; i < n; i++)
 {
   sortx.push_back({points[i], i});
   sorty.push_back({{points[i].second, points[i].first}, i});
 }
 sort(sortx.begin(), sortx.end());
 sort(sorty.begin(), sorty.end());
 for(int i = 1; i < n; i++)
 {
   int dif = sortx[i].first.first - sortx[i - 1].first.first;
   dist.push_back({dif, {sortx[i].second, sortx[i - 1].second}});
   dif = sorty[i].first.first - sorty[i - 1].first.first;
   dist.push_back({dif, {sorty[i].second, sorty[i - 1].second}});
 }
 sort(dist.begin(), dist.end());
 ll ans = 0;
 for(auto &x: dist)
 {
   int firstNode = x.second.first, secondNode = x.second.second;
   if(isconnected(firstNode, secondNode))
    continue;
   ans += x.first;
   connect(firstNode, secondNode);
 }
 cout << ans;
 return 0;
}


Measured memory_bytes: 8876
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

vector<vector<int>> dp(3005, vector<int>(3005));

int main() {
	int N, T;
	cin >> N >> T;
    vector<P> p(N);
    rep(i,N) cin >> p[i].first >> p[i].second;
    sort(all(p));

    int ans = 0;
    rep(i,N) {
        rep(j, T) {
            chmax(dp[i+1][j], dp[i][j]);
            int nj = j + p[i].first;
            if (nj<T) chmax(dp[i+1][nj], dp[i][j]+p[i].second);
        }
        int now = dp[i][T-1] + p[i].second;
        chmax(ans, now);
    } 

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


Measured memory_bytes: 35712