akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int mod=1e9+7,N=2e5+20;
ll n,k,dp[2500];
int qpow(ll x,int k){
	ll ans=1;
	while(k){
		if(k&1) ans*=x;
		k>>=1,x*=x;
		ans%=mod,x%=mod;
	}
	return ans;
}
int v[3000],cnt;
void init(){
	for(ll i=1;i*i<=n;i++)if(n%i==0){
		v[++cnt]=i;
		if(i*i!=n) v[++cnt]=n/i;
	}
	sort(v+1,v+cnt+1);
}
int main()
{
	cin>>n>>k;
	init();
	ll ans=0;
	for(int x=1;x<=cnt;x++){
		dp[x]=qpow(k,(v[x]+1)/2);
		for(int y=1;y<x;y++){
			if(v[x]%v[y]==0)
				dp[x]=(dp[x]-dp[y]+mod)%mod;	
		}	
		if(v[x]%2)
			ans=(ans+(dp[x]*v[x])%mod)%mod;
		else
			ans=(ans+(dp[x]*v[x]/2)%mod)%mod;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#最大二部マッチング
def dfs(v, edges, n, visited, matched):
    for u in edges[v]:
        if u in visited:
            continue
        visited.add(u)
        if matched[u] == -1 or dfs(matched[u], edges, n, visited, matched):
            matched[u] = v
            return True
    return False
def examC():
    N = I()
    ab = [LI() for _ in range(N)]
    cd = [LI() for _ in range(N)]
    xn = N; yn = N
    matched = [-1] * yn
    E = [set() for _ in range(xn)]
    for i in range(xn):
        for j in range(yn):
            if ab[i][0]<cd[j][0] and ab[i][1]<cd[j][1]:
                E[i].add(j)
    ans = 0
    for s in range(xn):
        ans += dfs(s, E, yn, set(), matched)
    print(ans)

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC()


Measured memory_bytes: 43356
def c(n,r):
    a = 1
    for i in range(r):
        a *= (n-i)
        a %= mod
    return a*ifact[r]%mod

mod = pow(10,9)+7
inv = [0,1]
fact = [1,1]
ifact = [1,1]
for i in range(2,16):
    inv.append(inv[mod%i]*(mod-mod//i)%mod)
    fact.append(i*fact[-1]%mod)
    ifact.append(ifact[-1]*inv[i]%mod)

t = int(input())
for _ in range(t):
    ans = 0
    n = int(input())-5
    for o in range(12):
        m = n-o
        if (m<0 or m&1):
            continue
        ans += c(11,o)*c(m//2+15,15)
        ans %= mod
    print(ans)

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

typedef long long ll;
typedef unsigned long long ull;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 9223372036854775807
#define MOD 1000000007
#define PI 3.1415926535

int main(void){

    string s;
    cin >> s;
    for (int i = 0; i < s.size();i++){
        if(s.at(i)=='7'){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

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

    int K;
    cin >> K;
    int eve = K / 2;
    int odd = K / 2 + K % 2;
    cout << eve * odd << endl;

    return 0;
}


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

typedef pair<int,int> P;
int N, D;

void solve() {
    vector<vector<int> > C(N, vector<int>(10000));
    for (int i = 0; i < N; i++) {
        int m; cin >> m;
        C[i].resize(m);
        for (int j = 0; j < m; j++) {
            cin >> C[i][j];
        }
    }

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 9999; j++) {
            C[i][j + 1] += C[i][j];
        }
    }

    queue<P> que;
    multiset<int> s;
    for (int i = 0; i < N; i++) que.push(P(0, i)), s.insert(0);
    vector<int> iter(N, 0);

    int count = 0;
    while (que.size()) {
        P p = que.front(); que.pop();
        int num = p.first;
        int idx = p.second;

        if (iter[idx] >= C[idx].size()) continue;
        auto ite = s.find(num);
        s.erase(ite);
        int max_ = max(*s.rbegin(), C[idx][iter[idx]]);
        int min_ = min(*s.begin(), C[idx][iter[idx]]);
        if (max_ - min_ <= D) {
            que.push(P(C[idx][iter[idx]], idx));
            s.insert(C[idx][iter[idx]]);
            iter[idx]++;
            count = 0;
        } else {
            s.insert(num);
            que.push(p);
            count++;
        }

        if (count > N) {
            break;
        }
    }

    cout << (count > N ? "No" : "Yes") << endl;
}

int main() {
    while (cin >> N >> D, N || D) solve();

    return 0;
}

Measured memory_bytes: 6740
#include <iostream>
#include <string>
#include <cmath>

using namespace std;


int main(){
  int n;
  string s,t;
  string ans;
  cin >> n >> s >> t;
  ans = s + t;

  for(int i = 0; i < n; i++){
    ans[i*2] = s[i];
    ans[i*2+1] = t[i];
  }

    cout << ans;
  
  return 0;
}

Measured memory_bytes: 256
s=input()
k=int(input())
a=[]
for t in s[:-1]:
  c=123-ord(t)
  if k<c or t=='a':
    a.append(t)
  else:
    k-=c
    a.append('a')
a.append(chr((ord(s[-1])-97+k)%26+97))
print(''.join(a))

Measured memory_bytes: 46704
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include <sstream>
#include<iomanip>
#include <ctype.h>

//#include<bits/stdc++.h>


using namespace std;
int main() {
	int n;
	cin >> n;
	vector<int>a, b;
	for (int i = 1; i <= n; i++) {
		int x; cin >> x;
		if (i % 2)a.push_back(x);
		else b.push_back(x);
	}
	if (n % 2) {
		reverse(a.begin(), a.end());
		for (int i = 0; i < a.size(); i++)cout << a[i] << " ";
		for (int i = 0; i < b.size(); i++) { cout << b[i]; if (i != b.size() - 1)cout << " "; }
		cout << endl;
	}
	else {
		reverse(b.begin(), b.end());
		for (int i = 0; i < b.size(); i++)cout << b[i] << " ";
		for (int i = 0; i < a.size(); i++) { cout << a[i]; if (i != a.size() - 1)cout << " "; }
		cout << endl;
	}

	return 0;
}

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

typedef pair<int,int> pii;
const int N=40010;
struct Edge{int from,to,next;} e[N<<5];
int h[N<<2],sum=0;
int low[N<<2],pre[N<<2];
int scc[N<<2],dfn,cnt;
int a[2][N],n;
pii Hash[N<<1];
stack<int> stk;
int node[N<<4],tot;

void add_edge(int u,int v)
{
	if(u==v) return;
	e[++sum].to=v;
	e[sum].from=u;
	e[sum].next=h[u];
	h[u]=sum;
}

void Build(int o,int l,int r)
{
	if(l==r)
	{
		node[o]=Hash[l].second;
		return;
	}
	node[o]=++tot;
	int mid=(l+r)/2;
	Build(o<<1,l,mid);
	Build(o<<1|1,mid+1,r);
	add_edge(node[o],node[o<<1]);
	add_edge(node[o],node[o<<1|1]);
}

void link(int o,int l,int r,int nl,int nr,int u)
{
	if(nl>nr) return;
	if(l>=nl&&r<=nr)
	{
		add_edge(u,node[o]);
		return;
	}
	int mid=(l+r)/2;
	if(nl<=mid) link(o<<1,l,mid,nl,nr,u);
	if(nr>mid) link(o<<1|1,mid+1,r,nl,nr,u);
}

void Init()
{
	for(int i=1;i<=n;i++)
	{
		Hash[2*i-1].first=a[0][i];
		Hash[2*i-1].second=i+n;
		Hash[2*i].first=a[1][i];
		Hash[2*i].second=i;
	}
	sort(Hash+1,Hash+1+2*n);
}

void Tarjan(int u)
{
	stk.push(u);
	low[u]=pre[u]=++dfn;
	for(int tmp=h[u];tmp;tmp=e[tmp].next)
		if(!pre[e[tmp].to])
		{
			Tarjan(e[tmp].to);
			low[u]=min(low[u],low[e[tmp].to]);
		}
		else if(!scc[e[tmp].to]) low[u]=min(low[u],pre[e[tmp].to]);
	if(pre[u]==low[u])
	{
		int o;cnt++;
		do{
			o=stk.top();
			stk.pop();
			scc[o]=cnt;
		}while(o!=u);
	}
}

bool check(int x)
{
	sum=dfn=cnt=0;tot=2*n;
	memset(h,0,sizeof(h));
	Build(1,1,2*n);
	for(int i=1;i<=n;i++)
		for(int k=0;k<2;k++)
		{
			int l=lower_bound(Hash+1,Hash+1+2*n,pii(a[k][i]-x+1,0))-Hash;
			int r=upper_bound(Hash+1,Hash+1+2*n,pii(a[k][i]+x-1,2*n+1))-Hash-1;
			int m=lower_bound(Hash+1,Hash+1+2*n,pii(a[k][i],(k^1)*n+i))-Hash;
			link(1,1,2*n,l,m-1,k*n+i);
			link(1,1,2*n,m+1,r,k*n+i);
		}
	while(!stk.empty()) stk.pop();
	memset(pre,0,sizeof(pre));
	memset(low,0,sizeof(low));
	memset(scc,0,sizeof(scc));
	for(int i=1;i<=tot;i++)
		if(!pre[i]) Tarjan(i);
	for(int i=1;i<=n;i++)
		if(scc[i]==scc[i+n]) return 0;
	return 1;
}

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d%d",&a[0][i],&a[1][i]);
	Init();
	int l=0,r=int(1e9),mid;
	while(l<r)
	{
		mid=(l+r)/2;
		if(check(mid)) l=mid+1;
		else r=mid-1;
	}
	printf("%d\n",check(l)?l:l-1);
	return 0;
}

Measured memory_bytes: 16384
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <iomanip>
#include <cassert>
#include <random>
#include <tuple>
#include <cstdint>

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

using namespace std;
typedef long long ll;

const int INF = 1 << 30;
const int MOD = 1e9 + 7;

int main() {
    int n, k; cin >> n >> k;
    vector<int> a(n); rep(i, n) cin >> a[i];
    int s = 0;
    rep(i, n) s += a[i];

    vector<int> divisor;
    for (int i = 1; i * i <= s; i++) {
        if (i * i == s) {
            divisor.push_back(i);
            break;
        }
        if (s % i == 0) {
            divisor.push_back(i);
            divisor.push_back(s/i);
        }
    }

    int ans = 1;
    for (int d: divisor) {
        vector<int> b(n);
        rep(i, n) {
            b[i] = a[i] % d;
        }
        sort(b.begin(), b.end());
        vector<ll> upcum(n+1, 0);
        vector<ll> downcum(n+1, 0);
        rep(i, n) {
            upcum[i+1] = upcum[i] + (d - b[i]);
            downcum[i+1] = downcum[i] + b[i];
        }

        ll mi = 1L << 60;
        rep(i, n+1) {
            mi = min(mi, max(downcum[i], (upcum[n] - upcum[i])));
        }
        if (mi <= k) ans = max(ans, d);
    }

    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 384
#line 2 "../../library/template.hpp"
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pl = pair<ll, ll>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0; i < (ll)n; i++)
#define rep3(i, l, r) for(ll i = l; i < (ll)r; i++)
#define per(i, n) for(ll i = (ll)n-1; i >= 0; i--)
#define per3(i, l, r) for(ll i = (ll)r-1; i >= (ll)l; i--)
#define all(v) begin(v), end(v)
template<class T, class U>
inline void cmax(T& a, U b) { if (a < b) a = b; }
template<class T, class U>
inline void cmin(T& a, U b) { if (a > b) a = b; }

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    cerr << fixed << setprecision(15);
  }
} io_setup;

constexpr char el = '\n';

template<typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U>& p) {
  os << p.first << " " << p.second;
  return os;
}
template<typename T, typename U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.first >> p.second;
  return is;
}
template<typename T>
ostream &operator<<(ostream &os, const vector< T > &v) {
  rep(i, v.size())
    os << v[i] << (i + 1 != v.size() ? " " : "");
  return os;
}
template<typename T>
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}
#line 2 "a.cpp"

int main() {
  ll x, y, z;
  cin >> x >> y >> z;

  swap(x, y);
  swap(x, z);
  cout << x << " " << y << " "<< z;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  int64_t k;
  cin>>n>>k;
  vector<vector<int>> ab(n,vector<int>(2));
  for(int i=0;i<n;i++)
    cin>>ab.at(i).at(0)>>ab.at(i).at(1);
  sort(ab.begin(),ab.end());
  int64_t c=0;
  for(int i=0;i<n;i++){
    c+=ab.at(i).at(1);
    if(c>=k){
      cout<<ab.at(i).at(0)<<endl;
      break;
    }
  }
}

Measured memory_bytes: 5760
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math

# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
def main():
    N = int(input())
    txy = []
    for i in range(N):
        t,x,y = map(int, input().split())
        txy.append((t,x,y))
        
    xx = 0
    yy = 0
    for i, val in enumerate(txy):
        t,x,y = val
        tmp = abs(xx-x) + abs(yy-y)
        if tmp > t:
            print("No")
            sys.exit()
        tmptmp = (tmp - t) % 2
        if tmptmp == 1:
            print("No")
            sys.exit()
            
    print("Yes")
	
if __name__ == "__main__":
	main()


Measured memory_bytes: 63960
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner (System.in);
		int Alice = 0;
		int Bob = 0;
		
		int n = sc.nextInt();
		int [] a = new int[n];
		
		for(int i=0 ; i<n ; i++) {
			a[i] = sc.nextInt();
		}
		
		for(int j=n-1;j>0;j--) {
			for(int k=0;k<j;k++) {
				if(a[k]<a[k+1]) {
					int temp = a[k];
					a[k] = a[k+1];
					a[k+1] = temp;
				}
			}
		}
		
		for(int i=0 ; i<n ; i++) {
			if(i%2==0) Alice+=a[i];
			if(i%2==1) Bob+=a[i];
		}
		
		System.out.printf("%d\n",Alice-Bob);
	}
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long ll;
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;}
typedef pair<ll,ll> P;

int main(){
    int W,H,x,y;
    cin >> W >> H >> x >> y;
    int a=0;
    if((double)y/x==(double)H/W)a=1;
    if(W==x&&H==y)a=0;
    cout << fixed<<setprecision(10)<<(double)W*(double)H/2<<" "<<a<<endl;
    return 0;
}


Measured memory_bytes: 256
//保留所有权利。
#include<iostream>
#include<stdio.h>//printするよ
#include<vector>
#include<algorithm>//辞書順はnext_permutationだよ
#include<set>
#include<string>
#include<sstream>
#include<string.h>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<utility>//swapで数値交換するよ
//END OF LIBRARIES.
#define rt "\n"//改行を最速化させるよ
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(v) for (int i = 0; i < (v).size(); i++) { cin >> (v)[i]; }
#define sort(s) sort(s.begin(),s.end())
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define cncn int cnt=0
#define smsm int sum=0
#define str srting
#define v vector
#define please return
#define AC 0//おまじないだよ
#define Rapid cin.tie(0);ios::sync_with_stdio(false)
//END OF DEFINE.
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vcha;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
//printf("%02d:%02d:%02d\n", h, m, s);・・・2文字は埋める・h、m、ｓ
//END OF TYPEDEF.

//最大公約数（GCD）を求めるよ
//最小公倍数（LCM）は＜＜　A × B ÷ GCD　 ＞＞で求まるよ

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

//for A以上B未満でI探索 for (int I = A; i <= B; i++)
//string s = to_string(i);
int a = 0, b = 0, x = 0, y = 0, z = 0, n = 0, sum = 0;
string s = ""; asas; cncn;

int main(void) {
	int p, q, r;
	cin >> p >> q >> r;
	cout << min(min(p + q, q + r), p + r) << rt;
	please AC;
}

Measured memory_bytes: 256
N, A, B = map(int, input().split())
box = []
for i in range(1, N+1 ):
    n = len(str(i))
    j = i
    temp = 0
    while n != 0:
        temp += (j % 10)
        j = int(j / 10)
        n -= 1
    if A <= temp <= B:
        box.append(i)
print(sum(box))

Measured memory_bytes: 3296
#include<iostream>
#include <cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  string S; int K;
  cin >> S;
  cin >> K;
  vector<string> T;
  int N = S.size();
  rep(i, N){
    for(int j=1; j<=5; j++){
      T.push_back(S.substr(i, j));
    }
  }
  sort(T.begin(), T.end());
  ll M = T.size();
  int cnt = 1;
  string ans;
  for(ll i=0; i<M; i++){
    if(cnt==K){ans = T[i]; break;}
    if(T[i] != T[i+1]) cnt++; 
  }
cout << ans << endl;
     
}

Measured memory_bytes: 1660
#include<stdio.h>

int main(){
int a,b,c,x;
scanf("%d %d %d",&a,&b,&c);
if(a>b){
x=b;
b=a;
a=x;}
if(b>c){
x=c;
c=b;
b=x;}
if(a>b){
x=b;
b=a;
a=x;}

printf("%d %d %d\n",a,b,c);

return 0;
}

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

int main() {
	int a,b,c,i;
	i = 0;
	cin >> a >> b >> c;
	while(a <= b){
		if(c % a == 0){
			i++;
		}
		a++;
	}
	cout << i << endl;
	return 0;
}

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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = 1e9+7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	VI w(n);
	rep(i, n) cin>>w[i];
	ll wa =0, sm=accumulate(all(w), 0LL);
	ll ans = sm;
	rep(i, n){
		wa += w[i];
		ans = min(ans, abs(wa - (sm - wa)));
	}
	cout << ans <<"\n";
	return 0;
}


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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265359;

const ll MOD = (ll) 1e9 + 7;
const ll MAXN = (ll) 1e3 + 10;
const ll INF = (ll) 2242545357980376863;
const ld EPS = (ld) 1e-8;

ll dp[MAXN][MAXN];
char mp[MAXN][MAXN];

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n, m;
	cin >> n >> m;
	for(int i = 1;i<=n;i++)for(int j = 1;j<=m;j++) cin >> mp[i][j];
	dp[0][1] = 1;
	for(int i = 1;i<=n;i++)for(int j = 1;j<=m;j++){
		if(mp[i][j] == '#') continue;
		dp[i][j] = dp[i-1][j] + dp[i][j-1];
		dp[i][j] %= MOD;
	}
	cout << dp[n][m];
	return 0;
}


/*

                                 ____              ,----..               ,----..
   ,---,                       ,'  , `.           /   /   \             /   /   \
  '  .' \                   ,-+-,.' _ |          /   .     :           /   .     :
 /  ;    '.              ,-+-. ;   , ||         .   /   ;.  \         .   /   ;.  \
:  :       \            ,--.'|'   |  ;|        .   ;   /  ` ;        .   ;   /  ` ;
:  |   /\   \          |   |  ,', |  ':        ;   |  ; \ ; |        ;   |  ; \ ; |
|  :  ' ;.   :         |   | /  | |  ||        |   :  | ; | '        |   :  | ; | '
|  |  ;/  \   \        '   | :  | :  |,        .   |  ' ' ' :        .   |  ' ' ' :
'  :  | \  \ ,'        ;   . |  ; |--'         '   ;  \; /  |        '   ;  \; /  |
|  |  '  '--'          |   : |  | ,             \   \  ',  /          \   \  ',  /
|  :  :                |   : '  |/               ;   :    /            ;   :    /
|  | ,'                ;   | |`-'                 \   \ .'              \   \ .'
`--''                  |   ;/                      `---`                 `---`
                       '---'

*/


Measured memory_bytes: 9088
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	static class Result {
		// 成績の種類
		public enum GRADE {
			A, B, C, D, F;
		}

		GRADE grade = GRADE.F;

		// 成績判定
		Result(int m, int f, int r) {
			if (m < 0 || f < 0) {
				return;
			} else if (m + f >= 80) {
				grade = GRADE.A;
			} else if (m + f >= 65) {
				grade = GRADE.B;
			} else if (m + f >= 50 || r >= 50) {
				grade = GRADE.C;
			} else if (m + f >= 30) {
				grade = GRADE.D;
			}
		}
	}

	static Scanner sc = new Scanner(System.in);

	static int m = 0, f = 0, r = 0;

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		// 成績を管理するリスト
		ArrayList<Result> ResultList = new ArrayList<Result>();

		// 入力処理
		while (inputNums()) {
			// 成績を生成
			Result result = new Result(m, f, r);
			// リストに追加
			ResultList.add(result);
		}

		// 出力処理
		print(ResultList);
	}

	// 入力処理
	static boolean inputNums() {

		m = sc.nextInt();
		f = sc.nextInt();
		r = sc.nextInt();
		if (m == -1 && f == -1 && r == -1) {
			return false;
		} else {
			return true;
		}
	}

	// 表示処理
	static void print(ArrayList<Result> List) {
		List.forEach(v -> System.out.println(v.grade.toString()));
	}

}



Measured memory_bytes: 31920
#include <iostream>
#include <stdio.h>
#include <set>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
using namespace std;


int main(void)
{
	int H, W, N; cin >> H >> W >> N;
	int x = max(H, W);
	int ans = 1;
	while (ans*x < N)ans++;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	LL N, L;
	in >> N >> L;

	LL ans = 0, min = 114514;
	rep(i, N)
	{
		LL res = L + i;
		ans += res;
		if (std::abs(min) > std::abs(res))
		{
			min = res;
		}
	}
	ans -= min;

	out << ans << std::endl;
}


Measured memory_bytes: 256
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools, os, pdb
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def _pf(s): return print(s, flush=True)
def perr(s): return print(s, file=sys.stderr)

ans = []
lines_dict =None
d=None
def main():
    global AB, PX, T
    if 'LOCAL' in os.environ:
        N = 2* 10** 5
        Q = 2 * 10 ** 5
        AB = [[i, i + 1] for i in range(1, N)]
        PX = [[i, 10] for i in range(Q)]
    else:
        N, Q = LI()
        T = [[] for _ in range(N+1)]
        PX = [0] * (N+1)
        for i in range(1, N+1):
            PX[i] = 0
        for i in range(N-1):
            a, b = LI()
            T[a] += [b]
            T[b] += [a]

        for i in range(Q):
            p, x = LI()
            PX[p] += x

        dfs(1, -1)
        for i in PX[1:]:
            print(i, end=' ')
        #  ans = [0 for _ in range(N)]

def dfs(parent, parent_parent):

    for node in T[parent]:
        if node != parent_parent:

            PX[node] += PX[parent]
            dfs(node, parent)

if __name__ == '__main__':
    main()


Measured memory_bytes: 232784
use proconio::input;
use proconio::marker::{Bytes, Chars};

// x ** n % mods を求める
pub fn mod_pow(x: i64, n: i64, mods: i64) -> i64 {
    if n == 0 {
        return 1;
    }
    let mut res = mod_pow(x * x % mods, n / 2, mods);
    if n % 2 == 1 {
        res = res * x % mods;
    }
    return res;
}

// (1/n) % mods を求める
pub fn mod_inv(n: i64, mods: i64) -> i64 {
    return mod_pow(n, mods-2, mods);
}

// nCk % mods を求める
pub fn mod_comb(n: i64, k: i64, mods: i64) -> i64 {
    let sum1 = (n-k+1..n+1).fold(1, |ac, x| ac * x % mods);
    let sum2 = (1..k+1).fold(1, |ac, x| ac * x % mods);
    return sum1 * mod_inv(sum2, mods) % mods;
}

// nCk の組み合わせを列挙する
pub fn combination(n: usize, k: usize) -> Vec<Vec<usize>> {
    let mut ans = Vec::new();
    if k == 1 {
        for i in 1..n+1 {
            let mut tmp = Vec::new();
            tmp.push(i);
            ans.push(tmp);
        }
    }
    else {
        for iter in combination(n-1, k-1) {
            let max = iter.iter().max().unwrap();
            for j in *max+1..n+1 {
                let mut tmp = iter.clone();
                tmp.push(j);
                ans.push(tmp);
            }
        }
    }
    ans
}


fn main() {
    input!{
        n: usize,
        mut a: [usize; n],
    }
    a.sort();
    let max = a[n-1];
    let mut flag = vec![1; max];
    for i in 0..a.len()-1 {
        if a[i] == a[i+1] {
            flag[a[i]-1] = 0;
        }
        let mut j = 2;
        while a[i]*j <= max {
            flag[a[i]*j-1] = 0;
            j += 1;
        }
    }
    let mut ans = 0;
    for iter in a {
        ans += flag[iter-1];
    }
    println!("{}", ans);
//    println!("{:?}", flag);
}


Measured memory_bytes: 8936
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, M, A[105][105], B[105], ans[105];

int main(){
  scanf("%d%d", &N, &M);
  for (int i = 0; i < N; i++){
    for (int j = 0; j < M; j++){
      scanf("%d", &A[i][j]);
    }
  }
  for (int j = 0; j < M; j++) scanf("%d", B+j);

  for (int i = 0; i < N; i++){
    for (int j = 0; j < M; j++){
      ans[i] += A[i][j] * B[j];
    }
    printf("%d\n", ans[i]);
  }

  return 0;
}



Measured memory_bytes: 3216
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
int dfs(string s,int x, int y, int z,ll n){
    char a='7',b='5',c='3';
    int cnt=0;
    if(s.length()>9) return 0;
    if(!s.empty()&&stol(s)>n) return 0;
    if(x+y+z==7){ cnt++;  } 
    cnt += dfs(s+a,4,y,z,n);
    cnt += dfs(s+b,x,2,z,n);
    cnt += dfs(s+c,x,y,1,n);
    return cnt;
}
int main() {
    ll n;
    cin>>n;
    cout<<dfs("",0,0,0,n)<<endl;;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repe(i, n) for (int i = 0; i <= (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define KOZYUN(a) sort(all(a),greater<int>())
#define int ll
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORe(i, m, n) for(int i = m;i <= n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
#define IN(a) cin >> a
#define INT(a) int a; cin >> a
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int a,b; cin >> a >> b;
    if(a != 1 && b != 1) OUT(1);
    else if(a != 2 && b != 2) OUT(2);
    else OUT(3);

    return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class DTeleporter {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        int N, K;
        cin >> N >> K;
        vector<vector<int>> next(65, vector<int>(N));
        REP(i, N) {
            int a;
            cin >> a;
            a--;
            next[0][i] = a;
        }
        REP(k, 61) {
            REP(i, N) {
                next[k+1][i] = next[k][next[k][i]];
            }
        }

        int cur = 0;
        REV(k, 60, 0) {
            if (K >> k & 1) {
                cur = next[k][cur];
            }
        }
        cout << cur + 1 << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    DTeleporter solver;
    solver.solve(in, out);
    return 0;
}


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

const int N = 1e5+4;
int n, m, x, y, ans = -1;
int dp[N], vis[N], sya[N];
vector<int> act[N], pas[N];

void dfs(int x){
	vis[x] = 1;
	for(int i = 0; i < pas[x].size(); i++){
		int cur = pas[x][i];
		dp[cur] = max(dp[cur], dp[x]+1);
		sya[cur]--;
		if(!sya[cur] && !vis[cur])
			dfs(cur);
	}
}

int main(){
	memset(dp, 0, sizeof dp);
	memset(vis, 0, sizeof vis);
	memset(sya, 0, sizeof sya);

	cin >> n >> m;
	for(int i = 0; i < m; i++) {
		cin >> x >> y; // x -> y
		act[x].push_back(y); // x -> y
		pas[y].push_back(x); // y <- z
		sya[x]++;
	}
	for(int i = 1; i <= n; i++) if(!sya[i] && !vis[i])
		dfs(i);
	for(int i = 1; i <= n; i++) ans = max(ans, dp[i]);
	cout << ans << endl;
}

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int x,a,b; cin>>x>>a>>b;
	if (b<=a) cout<<"delicious"<<endl;
	else if (b<=a+x) cout<<"safe"<<endl;
	else cout<<"dangerous"<<endl;
	return 0;
}


Measured memory_bytes: 256
x,n = map(int,input().split())
ans = 0
if n == 0:
    print(x)
else:
    p = sorted(list(map(int,input().split())), reverse=True)
    data = []
    for i in range(200,-100,-1):
        if not(i in p):
            data.append(i)
    #print(data)
    mi = 1000
    for i in data:
        #print(p)
        if mi >= abs(i-x):
            mi = abs(i-x)
            ans = i
    print(ans)


Measured memory_bytes: 9192
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

int main() {
    int n, m;
    int a[1010], b[1010], c[1010];
    int d[110][110];
    cin >> n >> m;
    imfor(i, n) {
        imfor(j, n) {
            if (i == j) {
                d[i][j] = 0;
            }
            else {
                d[i][j] = 99999999;
            }
        }
    }
    imfor(i, m) {
        cin >> a[i] >> b[i] >> c[i];
        a[i]--;
        b[i]--;
        d[a[i]][b[i]] = c[i];
        d[b[i]][a[i]] = c[i];
    }
    imfor(k, n) {
        imfor(i, n) {
            imfor(j, n) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
    int ans = m;
    imfor(i, m) {
        int f = 0;
        imfor(j, n) {
            if (d[j][a[i]] + c[i] == d[j][b[i]]) {
                f = 1;            
            }
        }
        if (f == 1) {
            ans--;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
S = input()
L = []
for i in range(len(S)):
    L.append(S[i])

n = len(S)
ans = []
for i in range(2 ** (n - 1)):
    obj = []
    for j in range(n - 1):
        if (i >> j) & 1:
            obj.append(j)
        else:
            obj.append(-1)
    # print(obj)
    s = ''
    s += L[0]
    for j in range(len(obj)):
        if obj[j] == -1:
            s += L[j + 1]
            continue
        else:
            s += '+'
            s += L[j + 1]
    # print(s)
    idx = 0
    now = 0

    while True:
        if now == len(s) - 1:
            ans.append(int(s[idx:]))
            break
        if s[now] == '+':
            ans.append(int(s[idx:now]))
            idx = now + 1
            now = idx
        else:
            now += 1
print(sum(ans))


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

using namespace std;

int main() {
    vector<long long> primeList;
    int check[1000000];
    for (int i = 0; i < 1000000; i++) check[i] = 0;
    for (int i = 2; i < 1000000; i++) {
        if (check[i] == 0) {
            primeList.push_back((long long)i);
            for (int j = 1; j*i < 1000000; j++) check[i*j] = 1;
        }
    }
    long long a, b; cin >> a >> b;
    long long x = __gcd(a, b);
    a /= x;
    b /= x;
    int n = x;
    long long res = 1;
    //cout << x << endl;
    for (int i : primeList) {
        if (x %i == 0) {
            int count = 0;
            while(x%i == 0) {
                count++;
                x /= i;
            }
            res++;
        }
    }
    if (x != 1) res++;
    cout << res;
}

Measured memory_bytes: 5240
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned int ui;
typedef pair<int,int> P;
typedef pair<ll,ll> LP;
#define All(v) (v).begin(),(v).end()
#define Rep(i,n) for(int i = 0; i < (int)n; i++)
#define Reps(i,n) for(int i = 1; i <= (int)n; i++)
#define For(i,m,n) for(int i = m; i < n; i++)
#define Fors(i,m,n) for(int i = m; i <= n; i++)
#define Inf 2e9
#define F first
#define S second
#define pb push_back
#define mp make_pair
struct speed{speed(){cin.tie(); ios::sync_with_stdio(false); cout << fixed << setprecision(18);}}aaa;

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

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


int main (){
    int l,r;
    cin >> l >> r;
    ll ans = Inf;
    For(i,l,r){
        Fors(j,l+1,r){
            ans = min(ans,i*ll(j)%2019);
            if(ans == 0){
                cout << 0 << "\n";
                return 0;
            }
        }
    }
    cout << ans << "\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <algorithm>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef complex<ld> compd;
#define rep(i,n)	for(int i=0;i<n;i++)
#define srep(i,a,n)	for(int i=a;i<n;i++)
#define REP(i,n)	for(int i=0;i<=n;i++)
#define SREP(i,a,n)	for(int i=a;i<=n;i++)
#define rrep(i,n)	for(int i=n-1;i>=0;i--)
#define RREP(i,n)	for(int i=n;i>=0;i--)
#define all(a)	(a).begin(),(a).end()
#define mp(a,b)	make_pair(a,b)
#define mt	make_tuple
#define fst	first
#define scn second
#define bicnt(x)	__buildin__popcount(x)
#define debug(x)	cout<<"debug: "<<x<<endl
#define DEBUG 0

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;
const ld eps = 1e-9;
const int dx[] = { 0,1,0,-1 };
const int dy[] = { 1,0,-1,0 };

ll dp[64][2];

int main() {
	int n;	cin >> n;
	if (n == 1) {
		cout << 3 << endl;
		return 0;
	}
	string s, t;	cin >> s >> t;
	if (s[0] == s[1])	dp[1][1] = 6;
	else	dp[0][0] = 3;
	srep(i, 1, n) {
		if (i > 1 && s[i] == s[i - 1]) {
			dp[i][1] = (dp[i - 2][0] * 2 + dp[i - 2][1] * 3) % mod;
		}
		else if (s[i] == t[i]) {
			dp[i][0] = (dp[i - 1][0] * 2 + dp[i - 1][1]) % mod;
		}
	}
	cout << (dp[n - 1][0] + dp[n - 1][1]) % mod << endl;
	return 0;
}

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

using namespace std;



int main(void)
{
	int p[3];
	int z[2];

	int max_p , max_z;

	cin >> p[0] >> p[1] >> p[2] >> z[0] >> z[1];

	max_p = min(p[0] , min(p[1] , p[2]));
	max_z = min(z[0] , z[1]);

	cout << max_p + max_z - 50 << endl;

	return 0;
}

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

int main() {
    string S;
    cin >> S;
    long long ans = 0;
    rep(i, pow(2, S.size() - 1)) {
        string tmp;
        tmp += S[0];
        rep(j, S.size() - 1) {
            if (i & (1 << j)) {
                ans += stoll(tmp);
                tmp = "";
            }
            tmp += S[j + 1];
        }
        if (tmp != "") {
            ans += stoll(tmp);
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main(void) {
    int N,M;
    int64_t sum = 0;
    int64_t tmpi,tmpt;
    cin >> N;

    vector<int> T(N);
    for(int i=0;i<N;i++) {
        cin >> T[i];
        sum += T[i];
    }

    cin >> M;
    vector<int> ans(M);
    for(int i=0;i<M;i++) {
        cin >> tmpi >> tmpt;
        ans[i] = tmpt - T[tmpi-1] + sum;
    }

    for(int i=0;i<M;i++) {
        cout << ans[i] << "\n";
    }

    return 0;
}


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

int main() {
  int N;
  scanf("%d", &N);
  vector<int64_t> L(N + 1);
  
  L.at(0) = 2;
  L.at(1) = 1;
  
  for (int i = 2; i < N + 1; i++) {
    L.at(i) = L.at(i - 2) + L.at(i - 1);
  }
  
  cout << L.at(N) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
signed main()
{
	ios::sync_with_stdio(0);
    cin.tie(0);
	int n;
	pair<pair<string,int>,int>a[101];
	cin>>n;
	for(int i=0;i<n;i++){
		a[i].second=i+1;
		cin>>a[i].first.first>>a[i].first.second;
		a[i].first.second*=-1;
	}
	sort(a,a+n);
	for(int i=0;i<n;i++)cout<<a[i].second<<endl;
    return 0;
}


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

#define fread freopen("in.txt","r",stdin)
#define fwrite freopen("out.txt","w",stdout)
#define MAX 2000005
#define PI acos(-1)
#define piar pair<string,int>

using namespace std;



int main()
{
  ///  fread;
//    fwrite;

    queue<piar>Q;
    int n, timelimit,wait = 0;
    cin>>n>>timelimit;
    for(int i = 0 ; i<n ; i++)
    {
        piar a;
        cin>>a.first>>a.second;
        Q.push(a);
    }
    while(!Q.empty())
    {
        piar x = Q.front();
        if(x.second<=timelimit)
        {
            int temp = x.second;
            x.second += wait;
            wait += temp;
            Q.pop();
            cout<<x.first<<" "<<x.second<<endl;
        }
        else
        {
            x.second -=timelimit;
            wait += timelimit;
            Q.pop();
            Q.push(x);

        }
    }
    return 0;
}



Measured memory_bytes: 6308
N = int(input())
a = [int(i) for i in input().split()]
x = 0
y = sum(a)
ans = 10**18
for i in range(N-1):
  x += a[i]
  y -= a[i]
  tmp = abs(x-y)
  ans = min(tmp,ans)
print(ans)

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX

int n,x[8],y[8];
vector<int> v;
double ans;


signed main() {
    cin >> n;
    rep(i,n) cin >> x[i] >> y[i], v.pb(i);
    do {
        rep11(i,n) {
            int a = abs(x[v[i-1]]-x[v[i]]), b = abs(y[v[i-1]]-y[v[i]]);
            ans += sqrt(a*a + b*b);
        }
    } while(next_permutation(all(v)));
    double hoge = 1;
    rep1(i,n) hoge *= i;
    cout << setprecision(20) << ans/hoge << endl;
}




Measured memory_bytes: 256
N,A,B=map(int,input().split())
S=input()
t_count=0
b_count=0
flag=None

for i in S:
  if i=="c":
    print("No")
  else:
    if i=="a":
      t_count+=1
      if t_count<=A+B:
        print("Yes")
      else:
        print("No")
    else:
      b_count+=1
      if b_count<=B:
        t_count+=1
        if t_count<=A+B:
          print("Yes")
        else:
          print("No")
      else:
        print("No")

Measured memory_bytes: 9316
N = int(input())
A = [0] + list(map(int, input().split()))+[0]

total = sum([abs(A[i] - A[i+1]) for i in range(N+1)])

for i in range(1,N+1):
  shortcut = - abs(A[i-1]-A[i+1]) + abs(A[i-1]-A[i]) + abs(A[i] - A[i+1])
  print(total- shortcut)

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
typedef long long ll;
typedef vector<ll> vll;

string to_binString(ll n){
    string bins = "";
    ll size = log2(n);
    for(int i=size;i>=0;i--){
        if(pow(2,i) <= n){
            n -= pow(2,i);
            bins += '1';
        }
        else bins += '0'; 
    }
    return bins;
}
int main()
{
    ll n,m;
    cin >> n;
    vll a(n);
    set<ll> pat;
    rep(i,n)cin >> a[i];
    cin >> m;
    vll b(m);
    rep(i,m)cin >> b[i];

    REP(i,1,pow(2,n)){
        string s = to_binString(i);
        //cout << s << endl;
        ll tmp = 0;
        rep(i,s.size())if(s[s.size() - i - 1] == '1')tmp += a[n-i-1];
        pat.insert(tmp);
    }

    /*sort(pat.begin(), pat.end());
    rep(i,pat.size()-1)cout << pat[i] << " ";
    printf("\n");*/

    rep(i,m){
        auto res = pat.find(b[i]);
        cout << ((res != pat.end())?"yes":"no") << endl;
    }
    

    return 0;
}


Measured memory_bytes: 3468
// miracles!  this is a code about them!
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstring>
#include <cassert>
using namespace std;
#define rep(i,a,n) for (int i=a;i<(int)(n);i++)
#define per(i,a,n) for (int i=(n)-1;i>=(int)(a);i--)
template<typename T> ostream& operator<<(ostream& s, vector<T> t) {rep(i, 0, t.size()) s << (i ? " " : "") << t[i]; return s;}
template<typename T> istream& operator>>(istream& s, vector<T> &t) {rep(i, 0, t.size()) s >> t[i]; return s;}
template<typename T, typename U> ostream& operator<<(ostream& s, pair<T, U> t) {s << "(" << t.first << "," << t.second << ")"; return s;}
template<typename T, typename U> istream& operator>>(istream& s, pair<T, U> &t) {s >> t.first >> t.second; return s;}
typedef long long ll;

ll solve(vector<ll> a, bool run) {
    ll cur = 0;
    ll res = 0;
    
    rep(i, 0, a.size()) {
        a[i] += cur;
        
        bool plus = (i % 2 == run);
        //cout << i << ": " << a[i] << ", " << plus << endl;
        if (plus && a[i] <= 0) {
            res += llabs(1 - a[i]);
            cur += 1 - a[i];
            a[i] = 1;
        }
        if ((!plus) && (a[i] >= 0)) {
            res += llabs(a[i] + 1);
            cur -= a[i] + 1;
            a[i] = -1;
        }
    }
    return res;
}

int main() {
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> a(n);
    cin >> a;
    ll res = 0;
    rep(i, 1, n) a[i] += a[i - 1];
    res = min(solve(a, 0), solve(a, 1));
    cout << res << endl;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)

using namespace std;
typedef long long int ll;
typedef pair <long long int, int> P;

int par[100010]; //親
int height[100010];  //木の深さ

//n要素で初期化
void init (int n){
    for (int i=0;i<n;i++){
        par[i]=i;
        height[i]=0;
    }
}

//木の根を求める
int find (int x){
    if (par[x]==x){
        return x;
    }
    else{
        return par[x] = find(par[x]);
    }
}

//xとyの属する集合を併合
void unite (int x, int y){
    x=find(x);
    y=find(y);
    if (x==y) return;
    
    if (height[x] < height[y]){
        par[x]=y;
    }
    else {
        par[y]=x;
        if (height[x]==height[y]) height[x]++;
    }
}

//xとyが同じ集合に属するか否か
bool same (int x, int y){
    return find(x) == find(y);
}

const int MAX_E=200010;

struct edge {int u, v; ll cost; };

bool comp(const edge& e1, const edge& e2){
    return e1.cost < e2.cost;
}

edge es[MAX_E];
int V, E;

int kruscal(){
    sort(es, es+E, comp); //edge.costが小さい順にソート
    init(V);
    int res=0;
    rep(i,0,E){
        edge e=es[i];
        if (!same(e.u, e.v)){
            unite(e.u, e.v);
            res+=e.cost;
        }
    }
    return res;
}

int main(){
    cin>>V;
    P x[V], y[V];
    rep(i,0,V){
        cin >> x[i].first >> y[i].first;
        x[i].second=i; y[i].second=i;
    }
    sort(x,x+V);
    rep(i,0,V-1){
        es[i]=edge{x[i].second, x[i+1].second, x[i+1].first-x[i].first};
    }
    sort(y,y+V);
    rep(i,0,V-1){
        es[i+V-1]=edge{y[i].second, y[i+1].second, y[i+1].first-y[i].first};
    }
    E=2*V-2;
    cout << kruscal() << endl;;
}


Measured memory_bytes: 7296
inputs = []
loop do
    input = gets.split(" ")
    input.map!(&:to_i)
    if input[0] == 0 && input[1] == 0; break; end
    inputs << input
end
inputs.each do |input|
    input[0].times do
        puts "#" * input[1]
    end
    print "\n"
end


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

int main() {
    int a, b, c; cin >> a >> b >> c;
    int min_price = 20000;
    min_price = min(min_price, a+b);
    min_price = min(min_price, a+c);
    min_price = min(min_price, b+c);
    cout << min_price << endl;

}


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

#define ll long long int
#define ld long double
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define INF 0x3f3f3f3f // 100'000'000'000'000
#define all(x) x.begin(),x.end()
#define show(x) cerr<<#x<<" : "<<x<<'\n';
#define yogeshk972() cerr<<"\nTime Taken : "<<(float)(clock()-time_p)/CLOCKS_PER_SEC<<"\n";
clock_t time_p=clock();

using namespace std;
const int N= 1e5+10, mod=1e9+7;

int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);  

    double r;
    cin>>r;
    cout<<fixed<<setprecision(5)<<(2*acos(-1)*r);
    
    return 0;
}



Measured memory_bytes: 3820
import java.util.*;

public class Main {
    static public void main(String[] args){
        Scanner sc=new Scanner(System.in);
        String s=sc.next();
        char[] str=s.toCharArray();
        int[] stack=new int[26];
        int[] max=new int[26];
        for(int i=0;i<26;i++){
            stack[i]=-1;
            max[i]=-1;
        }
        for(int i=0;i<str.length;i++){
            if(i-stack[str[i]-'a']-1>max[str[i]-'a']){
                max[str[i]-'a']=i-stack[str[i]-'a']-1;
            }
            stack[str[i]-'a']=i;
        }
        for(int i=0;i<26;i++){
            if(str.length-stack[i]-1>max[i]){
                max[i]=str.length-stack[i]-1;
            }
        }
        int result=1000;
        
        for(int i=0;i<26;i++){
            if(max[i]>=0){
                if(result>max[i]){
                    result=max[i];
                }
            }
        }
        System.out.println(result);
    }
}


Measured memory_bytes: 21716