akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
#include<algorithm>
#include<functional>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

#define rep(i,x,y) for(int i=(x); i<(y); ++i)

template <typename T>
void vec_print(vector<T> VEC){
  rep(i, 0, VEC.size()){
    cout << VEC[i] << " ";
  }
  cout << "\n";
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  rep(i, 0, MAT.size()){
    rep(j, 0, MAT[i].size()){
      cout << MAT[i][j] << " ";
    }
    cout << "\n";
  }
};

template <typename CLASS1, typename CLASS2>
class HOGE{
  public:
    CLASS1 key;
    CLASS2 value;
    HOGE(ll key, ll value){
      this->key = index;
      this->value = value;
    };
    ~HOGE(void){
      return;
    };

    void print(void){
      cout << "key : " << key << ", value : " << value << "\n";
      return;
    };
    
    bool operator==(const HOGE &obj){
      return (this->value == obj.value);
    };
    bool operator<(const HOGE &obj){
      return (this->value < obj.value);
    };
    bool operator>(const HOGE &obj){
      return (this->value > obj.value);
    };
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll a, b, c;
  cin >> c >> a >> b;

  cout << (a*c)/2 << "\n";

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
 
int h,w,k;
ll dp[1000][110];
int s[] = {1,1,2,3,5,8,13,21};
 
int main(int argc, char const *argv[])
{
	cin>>h>>w>>k;
	if(w == 1)
		{
			printf("1\n");
			return 0;
		}
	dp[0][0] = 1;
	rep(i,0,h)
		rep(j,0,w)
		{
			dp[i][j] %= mod;
			if(j == 0)
			{
				dp[i+1][j+1] += dp[i][j] * s[max(0,w - j - 2)];
				dp[i+1][j] += dp[i][j] * s[w - j - 1];
			}
			else if(j != 0)
			{
				dp[i+1][j+1] += dp[i][j] * s[j] * s[max(0,w - j - 2)];
				dp[i+1][j] += dp[i][j] * s[j] * s[w - j - 1];
				dp[i+1][j-1] += dp[i][j] * s[max(0,j-1)] * s[w-j-1];
			}
		}		
	cout<<dp[h][k-1]%mod<<endl;	
	return 0;
}


Measured memory_bytes: 3712
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0
#include <iostream>
#include <vector>
#define FOR(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;

int main() {
  int N;
  cin >> N;
  vector<ll> a(N);
  ll sum = 0;
  FOR(i, N) {
    cin >> a[i];
    sum ^= a[i];
  }

  FOR(i, N) { cout << (sum ^ a[i]) << " "; }
  cout << endl;
  return 0;
}


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

using namespace std;

#define INP "solve"
#define OUT "solve"

const int QQ = 3e5 + 10;
const int maxN = 3e5 + 100;
const int maxM = 3e5 + 10;
const long long oo = 1e18;
const int module = 998244353;
const long double du = 1e-9;

void doc() {
    freopen(INP ".inp","r",stdin);
    freopen(OUT ".out","w",stdout);
}
typedef pair<int, int> i2;
typedef pair<i2, int> i3;
#define x first.first
#define y first.second
#define z second
long long IT[maxN * 4];
void update(int i, int L, int R, int u, long long val) {
    if (L > u || R < u) return;
    if (L == R) {
        IT[i] = val;
        return;
    }
    int mid = (L + R) >> 1;
    update(i << 1, L, mid, u, val);
    update(i << 1 | 1, mid + 1, R, u, val);
    IT[i] = min(IT[i << 1], IT[i << 1 | 1]);
}
long long Get(int i, int L, int R, int u, int v) {
    if (L > v || R < u) return oo;
    if (L >= u && R <= v) return IT[i];
    int mid = (L + R) >> 1;
    long long Left = Get(i << 1, L, mid, u, v);
    long long Right = Get(i << 1 | 1, mid + 1, R, u, v);
    return min(Left, Right);
}
void solve() {
    int n, m;
    cin >> n >> m;
    vector <i3> a(m);
    for (int i = 0; i < m; i++)
        cin >> a[i].y >> a[i].x >> a[i].z;
    a.push_back(i3(i2(1, 1), 0));
    sort(a.begin(), a.end());
    m++;
    for (int i = 1; i < m * 4; i++) IT[i] = oo;
    long long F[m];
    for (int i = 0; i < m; i++) F[i] = oo;
    F[0] = 0;
    update(1, 0, m - 1, 0, 0);
    for (int i = 1; i < m; i++) {
        int id = lower_bound(a.begin(), a.begin() + i, i3(i2(a[i].y, -1), -1)) - a.begin();
        long long Val = Get(1, 0, m - 1, id, i - 1);
        F[i] = min(oo, Val + a[i].z);
        update(1, 0, m - 1, i, F[i]);
    }
    long long Res = oo;
    for (int i = 0; i < m; i++) {
        if (a[i].x >= n) Res = min(Res, F[i]);
    }
    cout << (Res >= oo ? -1 : Res);
}
int main(int argc,char *argv[]) {
    //srand(time(nullptr));
    ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr);
    ///doc();
    solve();
}


Measured memory_bytes: 7284
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <cstring>
#include <cmath>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for (int i = (int)(k); i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rREP(i, k, n) for (int i = (int)(n)-1; i >= k; i--)

#define debug(x) cerr<<#x<<": "<<x<<endl;

#define fi first
#define se second

#define vi vector<int>
#define pb push_back
#define mp make_pair

#define pcnt __builtin_popcount

typedef long long ll;

const ll inf = 900900900100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n,a;
    cin >> n >> a;
    int x[55]={};
    ll dp[3010][55]={};
    rep(i,n) cin >> x[i];
    dp[0][0]=1;
    rep(i,n){
        rrep(k,i+1){
             rrep(j,2501){
                dp[j+x[i]][k+1] += dp[j][k];
            }
        }
    }
    ll ans=0;
    // REP(i,1,2501){
    //     if(i%a==0){
    //         ans += dp[i][i/a];
    //     }
    // }
    REP(i,1,n+1){
        ans += dp[a*i][i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1664
from collections import deque
import copy

N, K=map(int, input().split())
v =  deque(list(map(int, input().split())))
score = []
k = min(N,K)

for A in range(k + 1):
  for B in range(k - A + 1):
    V = copy.deepcopy(v)
    temochi = []
    #print(A,B)
    
    for _ in range(A):
      temochi.append(V.popleft())
    for _ in range(B):
      temochi.append(V.pop())
    for _ in range(K - A - B):
      if K - A - B == 0:
        break
        
      temochi.sort()
      if len(temochi)==0 or temochi[0] >= 0:
        break
      else:
        del temochi[0]
    #print(temochi)
    score.append(sum(temochi))
print(max(score))
        

Measured memory_bytes: 3444
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""078-b"""

import sys
import pprint
import re

import itertools
pp = pprint.PrettyPrinter(indent=2)

def main():
    """Main function."""
    x, y, z = list(map(int, input().split(' ')))

    print((x - z) // (y + z))


if __name__ == '__main__':
    sys.exit(main())

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

ll a,b,c;

int main(){
    cin >> a >> b >> c;
    if(a <= c && c <= b)cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<string>
#include<map>
#include<iomanip>
#include<vector>
#include<cmath>
#define mod 1000000007
#define pa(a,b) make_pair(a,b)
#define LL  long long int
using namespace std;
int buf[50];
inline void write(int x)
{
	int p=0;
	do{
		buf[p++]=x%10;
		x/=10;
	}while(x>0);
	for(int i=p-1;i>=0;i--)putchar('0'+buf[i]);
}
long long int read_int(){
	char r;
	bool start=false,neg=false;
	long long int ret=0;
	while(true){
		r=getchar();
		if((r-'0'<0 || r-'0'>9) && r!='-' && !start){
			continue;
		}
		if((r-'0'<0 || r-'0'>9) && r!='-' && start){
			break;
		}
		if(start)ret*=10;
		start=true;
		if(r=='-')neg=true;
		else ret+=r-'0';
	}
	if(!neg)
		return ret;
	else
		return -ret;
}
int main()
{
    int n ; string s ; cin>>n>>s;  int forw=0 , backw=0; int with=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='(')with++;
        else if(s[i]==')'&&with)with--;
        else forw++;

    }
    string temp="" ; for(int i=0;i<forw;i++)temp+="("; temp+=s; with = 0;
    for(int i=temp.size()-1;i>=0;i--)
    {
        if(temp[i]==')')with++;
        else if(temp[i]=='('&&with)with--;
        else backw++;

    }
     cout<<temp ; for(int i=0;i<backw;i++)cout<<")";
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()

using namespace std;

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

int nextInt() {int a; cin >> a; return a;}
char nextChar() {char a; cin >> a; return a;}
double nextDouble() {double a; cin >> a; return a;}
string nextString() {string a; cin >> a; return a;}

void inputVector(vector<int> &v, int &n) {rep(i,n){v.push_back(nextInt());}}
void inputVector(vector<double> &v, int &n) {rep(i,n){v.push_back(nextDouble());}}
void inputVector(vector<string> &v, int &n) {rep(i,n){v.push_back(nextString());}}

int dp[20002][256];

signed main() {
    int N, M;
    while (cin >> N >> M) {
	if (N == 0) break;

	vector<int> C, x;
	inputVector(C, M);
	inputVector(x, N);

	rep(i, N + 1) rep(j, 256) dp[i][j] = INT_MAX;
	dp[0][128] = 0;
	rep(i, N) {
	    rep(j, 256) {
		if (dp[i][j] >= INT_MAX) continue;
		rep(k, M) {
		    int val = j + C[k];
		    if (val > 255) val = 255;
		    else if (val < 0) val = 0;
		    int dif = (x[i] - val) * (x[i] - val);
		    dp[i + 1][val] = min(dp[i + 1][val], dp[i][j] + dif);
		}
	    }
	}
	int ret = INT_MAX;
	rep(i, 256) {
	    ret = min(ret, dp[N][i]);
	}
	cout << ret << endl;
    }

    return 0;
}

Measured memory_bytes: 43316
from collections import Counter

mod = 10 ** 9 + 7

N, *A = map(int, open(0).read().split())

C = Counter()
for a in A:
    if a in C:
        continue

    i = 2
    while i * i <= a:
        if a % i == 0:
            cnt = 0
            while a % i == 0:
                a //= i
                cnt += 1
            C[i] = max(C[i], cnt)
        i += 1
    if a > 1:
        C[a] = max(C[a], 1)

L = 1
for i, c in C.items():
    L *= pow(i, c, mod)
    L %= mod

print(sum(L * pow(a, mod - 2, mod) for a in A) % mod)

Measured memory_bytes: 45404
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef vector<string> vs;
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
const double PI = acos(-1.0);


vector<Pll> prime_factorize(ll n){
    vector<Pll> ret;
    int tmp = 2;
    for (ll a = 2; a * a <= n; a++){
        if (n % a != 0) continue;
        int ex = 0;
        while (n % a == 0){
            ex++;
            n /= a;
        }
        ret.push_back(make_pair(a, ex));
    }
    if (n != 1) ret.push_back(make_pair(n, 1));
    return ret;
}


int main() {
    ll N;
    cin >> N;
    vector<Pll> p = prime_factorize(N);
    ll ans = 0;
    for(auto x: p){
        ll y = x.second;
        ll tmp = 1;
        while(y - tmp >= 0){
            y -= tmp;
            ans++;
            tmp++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a, b, c, d, e;
    cin >> a >> b >> c >> d >> e;
    
    if(a < 0 && b < 0)
    {
        cout << c * (b - a) << endl;
    }
    else if(a > 0 && b > 0)
    {
        cout << e * (b - a) << endl;
    }
    else
    {
        cout << e * b + c * (- a) + d << endl;
    }


}

Measured memory_bytes: 3076
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<stdlib.h>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
int pr[2000];
int main(){
	int a;scanf("%d",&a);
	long long ret=1;
	pr[0]=pr[1]=-1;
	for(int i=2;i<2000;i++){
		if(pr[i]!=-1){
			pr[i]=1;
			for(int j=i*2;j<2000;j+=i)pr[j]=-1;
		}
	}
	for(int i=0;i<2000;i++){
		if(pr[i]==1){
			int c=a;
			int now=0;
			while(c){
				now+=c/i;
				c/=i;
			}
			ret=ret*(1+now)%mod;
		}
	}
	printf("%lld\n",ret);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
constexpr ll INF = (1LL << 60);

int main(){ 
  string s, t;
  cin >> s >> t;
  int n = s.size();

  map<char, char> ss, tt;
  bool ok = true;
  for (int i = 0; i < n; i++) {
    char a = s[i], b = t[i];

    if (ss.count(b)) if (ss[b] != a) ok = false;
    if (tt.count(a)) if (tt[a] != b) ok = false;
    ss[b] = a;
    tt[a] = b;
  }

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

  return 0;
} 

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

int main(){
    int n, k, temp, sum=0;
    vector<int> pn;
    cin >> n >> k;
    for(int i=0;i<n;i++){
        cin >> temp;
        pn.push_back(temp);
    }
    sort(pn.begin(),pn.end());
    for(int i=0;i<k;i++) sum += pn.at(i);
    cout << sum << endl;
}

Measured memory_bytes: 3640
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

template <class T>
bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
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;
}

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(v) (v).begin(), (v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;


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

    int N;
    cin >> N;
    vi a(N), b(N), c(N);

    REP(i, N) cin >> a[i];
    REP(i, N) cin >> b[i];
    REP(i, N) cin >> c[i];

    sort(ALL(a));
    sort(ALL(c));

    ll ans = 0;
    REP(i, N){
        ll x = distance(a.begin(), lower_bound(ALL(a),b[i]));
        ll y = distance(upper_bound(ALL(c),b[i]), c.end());
        ans += x*y;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1408
import java.util.LinkedList;
import java.util.Scanner;

/**
 * 
 */

/**
 * @author kawakami
 *
 */
class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner as = new Scanner(System.in);
        
        int n=as.nextInt();           //??°????????????n
        LinkedList<Integer> list = new LinkedList<Integer>();
        StringBuilder sb = new StringBuilder();
         
         
         
         
         
        for(int i=0;i<n;i++){         //??\???????????????????????????????´????????´?
             
            list.add(Integer.parseInt(as.next()));
     
        }
         
         
        for(int l=n-1;l>=0;l--){      //?????????????´???????????????¨???
             
            if(l==0){
            	
            	sb.append(list.removeLast());
            	
            }
            else{
            	
            	sb.append(list.removeLast()).append(" ");
            	
            }
             
        }
        
        System.out.println(sb.toString());

	}

}

Measured memory_bytes: 26040
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PI 4*atan(1.0)
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
using namespace std;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
const int SIZE=100050;
//int arr[SIZE]={};
//ここまでテンプレ
int main(){
	char A[150],B[150];
	cin>>A>>B;
	if(strlen(A)>strlen(B)){
		cout<<"GREATER"<<endl;
		return 0;
	}
	else if(strlen(B)>strlen(A)){
		cout<<"LESS"<<endl;
		return 0;
	}
	for(int i=0;i<strlen(A);i++){
		if(A[i]-'0'>B[i]-'0'){
			cout<<"GREATER"<<endl;
			return 0;
		}
		else if(B[i]-'0'>A[i]-'0'){
			cout<<"LESS"<<endl;
			return 0;
		}
	}
	cout<<"EQUAL"<<endl;
	return 0;
}

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

namespace Circle
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = Console.ReadLine();
            double r = double.Parse(line);

            CalculateCircle problem = new CalculateCircle(r);

            Console.WriteLine(problem.GetArea().ToString("F6") + " " +
                problem.GetLength().ToString("F6"));
        }
    }

    /// <summary>
    /// 円に関する計算を行うクラス
    /// </summary>
    public class CalculateCircle
    {
        private double r;

        public CalculateCircle(double r)
        {
            this.r = r;
        }

        public double GetArea()
        {
            return r * r * Math.PI;
        }

        public double GetLength()
        {
            return 2 * r * Math.PI;
        }

    }
}

Measured memory_bytes: 20080
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int H,W;
    cin>>H>>W;
    for(int i=0;i<H;i++){
        string S;
        cin>>S;
        int count=0;
        for(int k=0;k<W;k++){
            if(k==W-1){
            if(S[k]=='c'){
                cout<<"0"<<endl;
            }
            else if(count==0)cout<<"-1"<<endl;
            else if(count>0){
                cout<<count<<endl;
            }
            }
            else if(S[k]=='c'){
                cout<<"0 ";
                count=1;
            }
            else if(count==0)cout<<"-1 ";
            else if(count>0){
                cout<<count<<' ';
                count++;
            }
        }
}
}



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

int main(){
  int N, X;
  cin >>N>>X;
  
  vector<int>L(N);
  int D = 0;
  int ans = 1;
  repeat(i,N){
    cin >>L[i];
    D += L[i];
    if(D>X) break;
    ans++;
  } 
  
  cout <<ans<< endl;
}


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

int main(){
  int N;
  cin >> N;
  
  int64_t L0,L1,L2;
  L0 = 2;
  L1 = 1;
  
  if (N == 0){
    cout << L0 << endl;
  }else if(N == 1){
    cout << L1 << endl;
  }else{
    for (int i = 1; i < N; i++){
      L2 = L1+L0;
      L0 = L1;
      L1 = L2;
    }
    cout << L1 << endl;
  }
  
}

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

#define ll long long
#define endl "\n"

ll ser(ll n){
	return (n*(n+1))/2;
}

int main(){
	ios_base::sync_with_stdio(false);
	
	ll n;
	cin>>n;
	vector<ll>cnt;
	for(ll i=2;i*i<=n;i++){
		ll t=0;
		while(n%i==0){
			n=n/i;
			t++;
		}
		if(t) cnt.push_back(t);
	}

	if(n>1) cnt.push_back(1);

	sort(cnt.begin(),cnt.end());

	ll ans=0;

	for(ll now:cnt){
		ll lo=1,hi=1e5;
		while(hi-lo>1){
			ll mid=(lo+hi)/2;
			if(ser(mid)<=now){
				lo=mid;
			}else{
				hi=mid;
			}
		}
		if(ser(hi)<=now){
			//cout<<hi<<endl;
			ans+=hi;
		}
		else{
			//cout<<lo<<endl;
			ans+=lo;
		}
	}

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

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



int main(){
  int M,N;
  cin >>M>>N;
  
  if(M==N){
    cout << "Yes" <<endl;
  }else{
    cout << "No" <<endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main() {
    double H;
    scanf("%lf", &H);

    int depth = 1;
    double h = H;

    while(h > 1.0) {
        h = floor(h/2.0);
        depth++;
    }
    printf("%lu\n", (unsigned long)pow(2.0, depth) - 1);
    return 0;
}

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

namespace ABC153A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a,c,b,d,e,f;
            var word = Console.ReadLine().Split(' ');
            a = int.Parse(word[0]);
            b = int.Parse(word[1]);
            c = a / b;
            d = a % b;
            if (d != 0)
                e = 1;
            else
                e = 0;
            f = c + e;
            Console.WriteLine(f);
            Console.ReadKey();
           
               
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <vector>
#include <queue>
#include <math.h>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <algorithm>
#include <set>
#include <climits>
#include <numeric>

//usings
using namespace std;

//type def
typedef long long int64;
typedef pair<int, int> ii;

//consts
const int mod = 1e9 + 7;

//methods
template<typename T>
bool chmax(T& source, const T& compare_to) {
    if(source < compare_to) {
        source = compare_to;
        return true;
    }
    return false;
}

int modpow(int64 base, int n) {
    int64 ret = 1;
    while(n) {
        if(n & 1) ret = ret * base % mod;
        base = base * base % mod;
        n >>= 1;
    }
    return ret;
}

class Solution {
private:
public:
    int solve(vector<string>& a) {
        unordered_set<string> cnt(a.begin(), a.end());
        return cnt.size();
    }
};

int main() {
    int n;
    cin >> n;
    vector<string> a(n);
    for(int i = 0; i < n; ++i) cin >> a[i];
    Solution sol;
    auto ret = sol.solve(a);
    cout << ret << endl;
}

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

int main() {

	char n,m;
	cin >> n;
	cin >> m;

	if (n == '9' || m=='9') {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}


	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
#define INF 1000000000000000005
#define F first
#define S second
#define LB lower_bound
#define UB upper_bound
#define vc vector
#define vll vector<long long>
#define pll pair<long long,long long> 
#define pb push_back
#define all(v) v.begin(),v.end()
#define T ll test;cin>>test; while(test--)
#define rep(i,a,n) for(ll i=a;i<(long long)n;++i)
#define repr(i,n,a) for(ll i=n;i>(long long)a;--i)
#define MAX 1000005
#define sz(x) (ll)x.size()
#define ins insert
#define mp make_pair
#define int  long long
typedef  long long ll;
typedef long double ld;
using namespace std;

inline int add(int a,int b){a+=b;if(a>=mod)a-=mod;return a;}
inline int sub(int a,int b){a-=b;if(a<0)a+=mod;return a;}
inline int mul(int a,int b){return (a*1ll*b)%mod;}
inline int power(int a,int b){int rt=1;while(b>0){if(b&1)rt=mul(rt,a);a=mul(a,a);b>>=1;}return rt;}
inline int inv(int a){return power(a,mod-2);}

signed  main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);
	ll n;
	cin>>n;
	ld val,res;
	ll cnt=0;
	cin>>val;
	rep(i,0,n) 
	{
		ld x,y;
		cin>>x>>y;
		if(sqrt(x*x+y*y)<=val) cnt++;
	}
	cout<<cnt<<endl;
	//if(sqrt())
}
   

Measured memory_bytes: 3824
#include <bits/stdc++.h> 
using namespace std;
signed main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a+b-c==0 || a+c-b==0 || b+c-a==0)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
  return(0);
}


Measured memory_bytes: 256
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations
import sys
import bisect
import string
import math
import time
from fractions import gcd
#import random


def I(): return int(input())


def MI(): return map(int, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


YN = ['Yes', 'No']
MOD = 10**9+7
inf = float('inf')
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)


show_flg = False
# show_flg = True


def main():
    X = int(input())
    dp = [0] * (X + 1)
    dp[0] = 1

    for i in range(0, X):
        if dp[i] == 1:
            for k in range(100, 106):
                if i + k < len(dp):
                    dp[i+k] = 1

    print(dp[X])


if __name__ == '__main__':
    main()


Measured memory_bytes: 65644
#d
X,Y,Z,K = map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
C.sort(reverse=True)

ab = sorted([aa+bb for aa in A for bb in B ],reverse=True)[:K]
ans = sorted([aabb+cc for aabb in ab for cc in C ],reverse=True)[:K]

for aa in ans:
    print(aa)

Measured memory_bytes: 232432
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;

int main(){
    ll n, a, b;
    while(cin>>a>>b>>n){
        ll ans=0;
        ans=a*(n-1)/b-a*((n-1)/b);
        for(ll i=0; i<=a&&i<=min(b, n); ++i){
        	ans=max(ans, a*i/b-a*(i/b));
        }
        for(ll i=1, j=b-1; i<=1000000&&j<=n; ++i,j+=b){
        	ans=max(ans, a*(j)/b-a*(j/b));
        }
        cout<<ans<<endl;
    }
  return 0;
}




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

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,n) for(int i=1;i<=(int)(n);i++)
#define rep3(i,n) for(int i=0;i<=(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
#define repll(i,n) for(ll i=0;i<(ll)(n);i++)
#define repll2(i,n) for(ll i=1;i<=(ll)(n);i++)
#define REPLL(i,m,n) for(ll i=m;i<(ll)(n);i++)
#define INF (int)1e9  //
#define LINF (ll)4e18  //
#define MOD (int)(1e9)+7
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define PI 3.1415926535898

//------------------------------------------------------

int main() {
    int x, t;
    cin >> x >> t;
    cout << max(x - t, 0) << endl;
    return 0;
}



Measured memory_bytes: 256
cell = [[0] * 10 for i in xrange(10)]

large = [[0,0,1,0,0],
         [0,1,1,1,0],
         [1,1,1,1,1],
         [0,1,1,1,0],
         [0,0,1,0,0]]

medium= [[0,0,0,0,0],
         [0,1,1,1,0],
         [0,1,1,1,0],
         [0,1,1,1,0],
         [0,0,0,0,0]]

small = [[0,0,0,0,0],
         [0,0,1,0,0],
         [0,1,1,1,0],
         [0,0,1,0,0],
         [0,0,0,0,0]]

size = [0,small,medium,large]

while True:
    try:
        x, y, s = [int(i) for i in raw_input().split(',')]
    except EOFError:
        break
    except ValueError:
        break
    p = size[s]
    for i in xrange(5):
        for j in xrange(5):
            px = i+x-2
            py = j+y-2
            if(px in xrange(10) and py in xrange(10)):
                cell[py][px] += p[i][j]
print reduce(lambda x,y:x+y,map(lambda x:x.count(0),cell))
print max(map(max,cell))

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

int main() {
	
	int n;
	cin >> n;
	
	if(n < 357){
		puts("0");
		return 0;
	}
	
	int ans = 0;
	
	for(int i = 357; i <= n;){
		int temp = i;
		int next_i;
		bool while_flag = true;
		bool count3 = false;
		bool count5 = false;
		bool count7 = false;
		switch(temp % 100){
			case 33:
				count3 = true;
				next_i = i + 2;
				break;
			case 35:
				count3 = true;
				count5 = true;
				next_i = i + 2;
				break;
			case 37:
				count3 = true;
				count7 = true;
				next_i = i + 16;
				break;
			case 53:
				count5 = true;
				count3 = true;
				next_i = i + 2;
				break;
			case 55:
				count5 = true;
				next_i = i + 2;
				break;
			case 57:
				count5 = true;
				count7 = true;
				next_i = i + 16;
				break;
			case 73:
				count7 = true;
				count3 = true;
				next_i = i + 2;
				break;
			case 75:
				count7 = true;
				count5 = true;
				next_i = i + 2;
				break;
			case 77:
				count7 = true;
				next_i = i + 56;
				break;
			default:
				while_flag = false;
				break;
		}
		temp /= 100;
		while(temp && while_flag){
			switch(temp % 10){
				case 3:
					count3 = true;
					break;
				case 5:
					count5 = true;
					break;
				case 7:
					count7 = true;
					break;
				default:
					while_flag = false;
					break;
			}
			if(!while_flag) break;
			temp /= 10;
		}
		if(while_flag && count3 && count5 && count7){
			// cout << i << endl;
			ans++;
		}
		i = next_i;
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N,ans = 0;
	cin >> N;
	string s[N];
	rep(i,N)cin >> s[i];
	for(int k=0;k<N;k++){ //(0,k)番目の要素を*とする
		bool ok = 1;
		for(int i=0;i<N;i++){
			for(int j=0;j<N;j++){
				if((i+k)%N==j)continue;
				if(s[i][(j-k+N)%N]==s[j][(i-k+N)%N]){
				}else {
					ok = 0;
					break;
				}
			}
			if(!ok)break;
		}
		if(ok)ans++;
	}
	cout << ans*N << endl;
}

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

int main() {
  int N, M; // N cities, M  
  cin >> N >> M;
//  cout << N << "," <<M << endl;
   vector< vector<int> > A(N);
  
  // Prepare connction matrix
   rep(i, N){
      A[i] = vector<int>(N); 
      rep(j, N){
     	A[i][j]=0;
      }
   }  
   
  int p,q;
  rep(i, M){
    cin >> p >> q ;
    if (p-1>N || q-1>N){
      cout << "Input exceeding error" << endl;
      break;
    }
    else{
 		//     cout << p << ',' << q << endl;
    }
    A[p-1][q-1]++;
    A[q-1][p-1]++;
  }
    
   rep(i, A.size()){
     rep(j,A[i].size()){
 //    cout << A[i][j];
     }
 //    cout << endl;
   }

  vector<int> PathCount(N);
  // init PathCount
  rep(i,N)
    PathCount[i]=0;
  
  // Sum over 2nd dim.
  rep(i,N){
    rep(j,N){
    	if (A[i][j])
          PathCount[i]+=A[i][j];
  	}
    cout << PathCount[i] << endl;
  }
}  
  
  


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

int main() {
    int N; cin>>N;
    int ans=0;
    int sum=0;
    for (int i = 0; i < N; i++){
        int d; cin>>d;
        sum+=d;
        ans-=d*d;
    }
    cout<<(ans+sum*sum)/2<<endl;
}

Measured memory_bytes: 3624
def main():
    S = input()
    N = len(S)
    idx_a = ((N - 1) // 2)
    idx_b = ((N + 3) // 2) - 1
    A = S[:idx_a]
    B = S[idx_b:]
    if S == S[::-1] and A == A[::-1] and B == B[::-1]:
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()

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

public class Main {
		public static void main(String[] args) throws IOException {
		
		// 入出力高速化 java.io.* とthrows IOExceptionを忘れずに
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
 
		String[] NMin = br.readLine().split(" ");
		int N = Integer.parseInt(NMin[0]);
		int M = Integer.parseInt(NMin[1]);
		
		long[][] Axy = new long[N][2];
		long[][] Cxy = new long[M][2];
		
		for(int Nin=0; Nin<N; Nin++){
			String[] Nxy = br.readLine().split(" ");
			Axy[Nin][0] = Long.parseLong(Nxy[0]);
			Axy[Nin][1] = Long.parseLong(Nxy[1]);
		}
		for(int Min=0; Min<M; Min++){
			String[] Mxy = br.readLine().split(" ");
			Cxy[Min][0] = Long.parseLong(Mxy[0]);
			Cxy[Min][1] = Long.parseLong(Mxy[1]);
		}
		
		int[] ans =new int[N];
		
		for(int n=0; n<N; n++){
			long Max = 1000000000;
			int near = 0;
			for(int m=0; m<M; m++){
				long man = Math.abs(Axy[n][0]-Cxy[m][0])+Math.abs(Axy[n][1]-Cxy[m][1]);
				if(man<Max){
					Max = man;
					near = m+1;
				}
			}
			ans[n]=near;
		}
		    
		for(int a=0; a<N; a++){
		    System.out.println(ans[a]);
		}
	}
}


Measured memory_bytes: 32400
require 'prime'
require 'set'
require 'tsort'
include Math
ALP = ('a'..'z').to_a
INF = 0xffffffffffffffff
def max(a,b);              a > b ? a : b                              end
def min(a,b);              a < b ?  a : b                             end
def swap(a,b);             a, b = b, a                                end
def gif;                   gets.to_i                                  end
def gff;                   gets.to_f                                  end
def gsf;                   gets.chomp                                 end
def gi;                    gets.split.map(&:to_i)                     end
def gf;                    gets.split.map(&:to_f)                     end
def gs;                    gets.chomp.split.map(&:to_s)               end
def gc;                    gets.chomp.split('')                       end
def pr(num);               num.prime_division                         end
def pr?(num);              Prime.prime?(num)                          end
def digit(num);            num.to_s.length                            end
def array(s,ini=nil);      Array.new(s){ini}                          end
def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}}          end
def rep(num);              num.times{|i|yield(i)}                     end
def repl(st,en,n=1);       st.step(en,n){|i|yield(i)}                 end


s = gc
loop{
  s.pop
  c = s.size
  if  c % 2 == 1
    next
  else
    c /= 2
    a = s.each_slice(c).to_a
    break if a[0] == a[1]
  end
}
puts s.size

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

class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int n = saori.saori_hayami();
		int ans = 1;
	
		while(true){
			if(ans *2 > n){
				break;
			}
			ans *= 2;
		}
		System.out.println(ans);
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 21076
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pr pair<ll, ll>
#define vct vector<ll>
#define vpt vector<pr>
#define st set<ll>
#define pq priority_queue<ll>
#define mat vector<vector<ll> >
#define F(i, n) for (i = 0; i < (1LL*n); i++)
#define Fr(i, n) for (i = n - 1; i >= 0; i--)
struct custom_hash
{
    static uint64_t splitmix64(uint64_t x)
    {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const
    {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umap unordered_map<long long, int, custom_hash>
void prv(vct v)
{
    for (ll i = 0; i < v.size(); i++)
        cout << v[i] << " ";
    cout << "\n";
}
ll poww(ll x, ll y, ll m)
{
    ll res = 1;
    while (y)
    {
        if (y % 2 == 0)
        {
            x = (x * x) % m;
            y = y / 2;
        }
        else
        {
            res = (res * x) % m;
            y--;
        }
    }
    return res;
}
void deb(string s, ll n)
{
    cout << s << " : " << n << "\n";
}
void prn(ll n) { cout << n << "\n"; }
void prs(string n) { cout << n << "\n"; }

mat mt;
void setmtsize(ll m,ll n, ll ini=0){
    mt.resize(m,vector<ll>(n,ini));
}
void prmt(mat m){
    for(ll i=0;i<(1LL*m.size());i++)prv(m[i]);
}

ll n, k, m, l, r, x, y, ans=0;
ll t, t1, t2;

ll i, j;
ll a, b;
ll mod = 1000000007;


void solve()
{
    cin>>l>>r>>n;
    ll cn=0;
    for(i=l;i<=r;i++){
        if(i%n==0)cn++;
    }
    prn(cn);
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll t = 1;
    // cin >> t;
    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 3644
#include <stdio.h>
#include <math.h>
#define true 1
#define false 0

int hantei(int );
int main(){
  int s,n,x,i,count=0;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&s);
    if((x=hantei(s))==true)count++;
   }
  printf("%d\n",count);

  return 0;
}
int hantei(int s)
{
  int i;
  double rs;
  rs=sqrt(s);
  if(s<2)return false;
  else if(s==2)return true;
  else if(s%2==0)return false;

  for(i=3;i<=rs;i+=2)
    {
      if(s%i==0)return false;
    }
  return true;
}



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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n,m,d;

int main(){
  cin>>n>>m>>d;
  // dp[pos][last] = E
  // dp[pos+1][last] = sum(dp[pos])/n + cnt(last)/n
  // d==0
  // dp[pos+1][last] = sum(dp[pos])/n + 1/n
  // d>0
  // 1 <= last <= d, n-d+1 <= last <= n
    // dp[pos+1][last] = sum(dp[pos])/n + 1/n
  // d+1 <= last <= n-d
    // dp[pos+1][last] = sum(dp[pos])/n + 2/n
  if(d==0){
    double ans = (double)(m-1)/n;
    printf("%.9f\n",ans);
    return 0;
  }
  int cnt2 = max(0, (n-d) - d);
  int cnt1 = n-cnt2;
  double e1 = 0.0, e2 = 0.0;
  double rn = 1.0 / n;
  double n1 = 1.0 / n;
  double n2 = 2.0 / n;
  // sum(prev) = e1+e2
  // next e1 = r1 * (e1 + e2 + 1) 
  // next e2 = r2 * (e1 + e2 + 2)
  m--;
  // while(m--){
    double sum = (e1 * cnt1 + e2 * cnt2) * rn;
    e1 = sum + n1;
    e2 = sum + n2;
  // }
  double ans = (e1 * cnt1 + e2 * cnt2) * rn * m;
  printf("%.9f\n",ans);
  return 0;
}


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

typedef long long ll;
typedef long double ld;

int MOD=1000000007;

int main(){
  ll K,x=0;
  cin >> K;
  queue<ll> que;
  for(ll i=1; i<=9; i++) que.push(i);
  for(ll i=1; i<K; i++){
    x=que.front();
    if(x%10!=0) que.push(10*x+x%10-1);
    que.push(10*x+x%10);
    if(x%10!=9) que.push(10*x+x%10+1);
    que.pop();
  }
  cout << que.front() << endl;
}


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

#define pi 3.14159265358979323846
#define ll long long


int main()
{
    ll a,sum=0;
    cin>>a;
    for(int i=2;i<=a;i++){
        if(i%3==0 || i%5==0 || (5%i==0 && 3%i==0)){

        }
        else sum+=i;
    }
    cout<<sum+1<<endl;


}


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

using namespace std;

int dp[2005][2005];
int cnt[2005];
int n,x,y;

int main()
{
    //freopen("file.inp","r",stdin);
    cin >> n >> x >> y;
    for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++)
    {
        dp[i][j] = dp[j][i] = j - i;
    }
    for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++)
    {
        dp[i][j] = min(dp[i][j], dp[i][x] + dp[y][j] + 1);
        cnt[dp[i][j]]++;
    }
    for (int i = 1; i < n; i++)
    {
        cout << cnt[i] << "\n";
    }
    return 0;
}


Measured memory_bytes: 15872
#include<iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>
#include <bitset>
using namespace std;
int N;
int x;
set<int> S;
vector<int> G[205];
int L[205];
int R[205];
vector<int> Me,Mo;
bitset<205> U;
bool prime(int nr)
{
    if(nr<=2)return 0;
    for(int i=2;i*i<=nr;i++)if(nr%i==0)return 0;
    return 1;
}
bool pairup(int nod)
{
    if(U[nod])return 0;
    U[nod]=1;
    for(auto it:G[nod])
    {
        if(!R[it])
        {
            L[nod]=it;
            R[it]=nod;
            return 1;
        }
    }
    for(auto it:G[nod])
    {
        if(pairup(R[it]))
        {
            L[nod]=it;
            R[it]=nod;
            return 1;
        }
    }
    return 0;
}
int main()
{
    cin>>N;
    for(int i=1;i<=N;i++)
    {
        cin>>x;
        if(S.find(x)!=S.end())
        {
            S.erase(x);
        }
        else
        {
            S.insert(x);
        }
        S.insert(x+1);
    }
    for(auto it:S)
        if(it%2==0)
            Me.push_back(it);
        else
            Mo.push_back(it);
    for(int i=0;i<Me.size();i++)
    {
        for(int j=0;j<Mo.size();j++)
        {
            if(prime(abs(Mo[j]-Me[i])))
                G[i+1].push_back(j+1);
        }
    }
    bool ok=1;
    int k=0;
    while(ok)
    {
        ok=0;
        U.reset();
        for(int i=0;i<Me.size();i++)
        {
            if(!L[i+1]&&pairup(i+1))
            {
                k++;
                ok=1;
            }
        }
    }
    int rez=k+(((int)Me.size()-k)/2)*2+(((int)Mo.size()-k)/2)*2+(((int)Me.size()-k)%2)*3;
    cout<<rez;
    return 0;
}


Measured memory_bytes: 256
import math, sys
inp = int(input())
var = list(map(int,input().split()))
l = []
for i in range(inp-1):
  a = math.fabs(sum(var[0:i+1]) - sum(var[i+1:inp+1]))
  if a==0:
        print(0)
        sys.exit()
  l.append(a)
l.sort()
print(int(l[0]))

Measured memory_bytes: 9128
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
char c;
cin >> c;
if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
  cout << "vowel" << endl;
} else {
  cout << "consonant" << endl;
}

return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
const int MOD = 1e9+7;
const long long INF = 1e18+10;

/*--------------------------------------------------------------------*/


signed main(){
	int a,b,k;
	cin>>a>>b>>k;

	if(k<=a){
		cout<<a-k<<' '<<b<<endl;
	}else{
		cout<<0<<' '<<max(0ll,a+b-k)<<endl;
	}


	return 0;
}



Measured memory_bytes: 3628
/*#include <bits/stdc++.h>
using namespace std;
string ans,s[3055][3055],s1,s2;
int dp[3055][3055],n,m,ma;
int main()
{
 
    cin>>s1>>s2;
    if (s1.size()>s2.size()) swap(s1,s2);
    n=s1.size();
    m=s2.size();
    for (int i=0;i<n;i++)
    {
        for (int j=0;j<m;j++)
        {
            dp[i+1][j+1]=dp[i][j+1];
            s[i+1][j+1]=s[i][j+1];
            if (s1[i]==s2[j])
            {
                    dp[i+1][j+1]++;
                    s[i+1][j+1]=s[i+1][j+1]+s1[i];
            }
            if (dp[i+1][j+1]<=dp[i+1][j])
            {
                s[i+1][j+1]=s[i+1][j];
                dp[i+1][j+1]=dp[i+1][j];
            }
            //cout<<s[i+1][j+1]<<dp[i+1][j+1]<<" ";
        }
 
    }
    for (int i=0;i<=m;i++)
    {
        if (dp[n][i]>ma)
        {
            ma=dp[n][i];
            ans=s[n][i];
        }
    }
    cout<<ans;
}*/
#include<bits/stdc++.h>
using namespace std;
int dp[1009][1009],m,n,ans,md=1e9+7;
string s[10000];
int main()
{
    cin>>n>>m;
    for (int i=0;i<n;i++)
    {
         cin>>s[i];
    }
    memset(dp,0,sizeof(dp));
    dp[1][1]=1;
    for (int i=1;i<=n;i++)
    {
        for (int j=1;j<=m;j++)
        {
            if (i==1 && j==1) continue;
            if (s[i-1][j-1]=='#') continue;
            dp[i][j]=dp[i-1][j]%md+dp[i][j-1]%md;
            dp[i][j]%=md;
 
        }
    }
    cout<<dp[n][m];
}

Measured memory_bytes: 5376