akhauriyash/Code-Regression huggingface dataset:
void main() {
	auto ip = readAs!(int[]), N = ip[0], K = ip[1];
	auto S = rs.group.array;
	if(S.length == 1) {
		writeln(N);
		return;
	}
	ulong res;
	auto R = S.length - K;
	if(S.back[0] == '1') R++;
	auto upper = S.length;
	auto arr = new ulong[](S.length+1);
	arr[1] = S[0][1];
	foreach(i; 2..S.length+1) arr[i] = arr[i-1] + S[i-1][1];
	debug arr.writeln;
	foreach(i; 0..R) {
		if(S[i][0] == '0') {
			auto r = min(i+2*K, upper);
			debug writefln("%d %d: %d - %d = %d", r, i, arr[r], arr[i], arr[r] - arr[i]);
			res = max(res, arr[r] - arr[i]);
		} else {
			auto r = min(i+2*K+1, upper);
			debug writefln("%d %d: %d - %d = %d", r, i, arr[r], arr[i], arr[r] - arr[i]);
			res = max(res, arr[r] - arr[i]);
		}
	}
	res.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


Measured memory_bytes: 3836
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    int n, K; cin >> n >> K;
    vi a(n); for(auto& e : a) cin >> e;

    n -= K;
    int res = 1;
    res += (n + K - 2) / (K - 1);

    cout << res << endl;

    return 0;
}


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


const int mod = 1e9+7;

long long mult(long long first,long long second){
    return (((first%mod)*(second%mod))%mod);
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<long long>a(n);
    for(int i = 0; i < n; ++i){
        cin >> a[i];
    }
    long long ans = 0;
    vector<long long>second(n);
    second[n-1] = a[n-1];
    for(int i = n-1; i >= 2; --i){
        second[i-1] = a[i-1]+second[i];
    }
    second[n-1] = a[n-1];
//    second[]
//   for(long long s : second){
//        cout << s << " ";
//    }
    for(int i = 1; i < n; ++i){
        ans = (ans%mod + mult(a[i-1],second[i])%mod)%mod;
    }
//    ans = (ans%mod + )
//cout << "ANS? " << ans << endl;
//    cout << endl;
//    ans = 0;
//    for(int i = 0; i < n; ++i){
//        for(int j = i + 1; j < n; ++j){
//            ans = (ans%mod + mult(a[i],a[j])%mod)%mod;
//        }
//    }
    cout << ans << endl;


    return 0;
}


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

int main() {
  int r;
  cin >> r;
  int s = r * r;
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 3636
N = int(input())
myans = [ 0 for n in range(N+1)]
upper = int(N**(2/3))
#print(upper)
for x in range(1, 105):
    for y in range(1, 105):
        for z in range(1, 105):
            v = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if v < N+1:
                myans[v] += 1
#print(myans)
for a,b in enumerate(myans):
    if a != 0:
        print(b)


Measured memory_bytes: 9404
#include <iostream>
#include <stdio.h>

#include <vector>
#include <cctype>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <climits>

using namespace std;

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

	n = n % 10;

	if (n == 2 || n == 4 || n == 5 || n == 7 || n == 9) {
		cout << "hon" << endl;
	}
	else if (n == 0 || n == 1 || n == 6 || n == 8) {
		cout << "pon" << endl;
	}
	else if (n == 3 ) {
		cout << "bon" << endl;
	}

	return 0;
}

Measured memory_bytes: 3632
def prim(n, cost):
    mincost = [float("inf")]*n
    used = [False] * n
    mincost[0] = 0
    res = 0
    cnt = 1
    while True:
        u = -1
        for i in range(n):
            if (not used[i]) and (u == -1 or mincost[i] < mincost[u]):
                u = i
        if u == -1:
            break
        used[u] = True
        res += mincost[u]
        for v in range(n):
            if cost[u][v] != -1:
                mincost[v] = min(mincost[v], cost[u][v])
    return res


def main():
    n = int(input())
    g = []
    for _ in range(n):
        g.append(list(map(int, input().split())))
    print(prim(n, g))



if __name__ == '__main__':
    main()




Measured memory_bytes: 5892
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<string>
#include<set>
#include<vector>
using namespace std;

#define printYesNo(condition) cout << (condition ? "Yes" : "No") << endl

int solve(){
  int minv = 1000000007, ans = 0;
  int n;  cin >> n;
  for(int i=0; i<n; i++){
    int p;  cin >> p;
    if(minv>=p){
      ans++;
      minv = p;
    }
  }
  cout << ans << endl;
  return 0;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long fac[4010], finv[4010], inv[4010]; 
long long MOD = 998244353;
long long pow2[4010]; 
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < 4005; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long power(long long a, int n){
	long long ans = 1; long long mul = a; 
	while(n){
		if(n & 1){
			ans *= mul; ans %= MOD; 
		}
		n >>= 1; 
		mul = mul * mul % MOD; 
	}
	return ans; 
}
long long solve(int n, int k, int p){
/* k面サイコロをn個投げて高々一方しか出ちゃダメなペアがp個 */
	long long res = 0; 
	for(int t = 0; t <= p; t++){
		res += (((COM(p, t) * pow2[t]) % MOD) * COM(k-p*2+n-1, n-t)) % MOD; 
	 	res %= MOD; 
	}
	return res; 
}
int main(){
	int K, N; cin >> K >> N; COMinit(); 
	pow2[0] = 1;
	for(int i = 1; i < 4005; i++){
		pow2[i] = pow2[i-1] * 2 % MOD; 
	}
	for(int i = 2; i <= K*2; i++){
		int t = min((i-1)/2, (K*2+1-i)/2); 
		long long ans = 0; 
		if(i % 2){
			ans += solve(N, K, t);
			ans %= MOD; 
		}
		else{
			ans += solve(N-1, K-1, t); 
			ans += solve(N, K-1, t); 
			ans %= MOD; 
		}
		cout << ans << "\n"; 
	}
}

Measured memory_bytes: 384
var input=require("fs").readFileSync(0,"utf8").split("\n");
var m=input[0].split(" ");
n=+m[0];
m=+m[1];
var qq=input.slice(1,1+m).map(ln=>ln.split(" ").map(Number));
qq.sort((p,q)=>p[1]-q[1]);
var ans=0;
var las=-1;
qq.map(q=>{
  if(las<=q[0]){
    las=q[1];
    ans++;
  }
});
console.log(ans);


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

static const string word{"ABC"};

int main() {
  int N;
  string S;
  cin >> N;
  cin >> S;

  int ans{};
  for (size_t pos{}; (pos = S.find(word, pos)) != string::npos; pos += word.size()) {
    ++ans;
  }

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<map>
#define int long long
using namespace std;
main()
{
	//freopen("input.txt","rt",stdin);
	int a,b,t;
	cin>>a>>b>>t;
	int d = t/a;
	cout<<d*b<<endl;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
typedef long long int ll;
#define crap ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);


int main() {
	crap;
	ll n;
	cin >> n;
	if( n==1 ){
	        ll a,b,c;
	       cin >> a >> b >> c; 
	       cout << max(max(a,b),c);
	    }
	else{
	   ll val[n][3],dp[n][3];
	   for( int i=0; i<n; i++ ){
	       for( int j=0; j<3; j++){
	           cin >> val[i][j];
	       }
	   }
	   dp[0][0] = val[0][0];
	   dp[0][1] = val[0][1];
	   dp[0][2] = val[0][2];
	   for( int i=1; i<n; i++ ){
	       dp[i][0] = val[i][0] + max(dp[i-1][1],dp[i-1][2]);
	       dp[i][1] = val[i][1] + max(dp[i-1][0],dp[i-1][2]);
	       dp[i][2] = val[i][2] + max(dp[i-1][0],dp[i-1][1]);
	   }
	   cout << max( max(dp[n-1][0],dp[n-1][1]),dp[n-1][2]);
	}
	

	return 0;
}

Measured memory_bytes: 8308
n,k=map(int,input().split())
p=list(map(int,input().split()))
x=sum(p[:k])
max_x=x
idx=0
for i in range(k,n):
  x=x+p[i]-p[i-k]
  if max_x<x:
    idx=i-k+1
    max_x=x
ans=0
for i in range(idx,idx+k):
  ans+=(p[i]*(p[i]+1)//2)/p[i]
print(ans)

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

int main()
{
    long long n,cnt[5]={},ans=0;
    cin>>n;
    string s;
    for (int i=0; i<n; i++)
    {
        cin>>s;
        if (s[0]=='M') cnt[0]++;
        if (s[0]=='A') cnt[1]++;
        if (s[0]=='R') cnt[2]++;
        if (s[0]=='C') cnt[3]++;
        if (s[0]=='H') cnt[4]++;
    }
    for (int i=0; i<5; i++)
    {
        for (int j=i+1; j<5; j++)
        {
            for (int k=j+1; k<5; k++)
            {
                ans+=cnt[i]*cnt[j]*cnt[k];
            }
        }
    }
    cout<<ans<<'\n';
    return 0;
}


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

int main(){
	string s1,s2;
  	cin >> s1 >> s2;
  	vector<vector<int>> dp(s1.size()+1,vector<int>(s2.size()+1,0));
    
    for(int i=1;i<=s1.size();i++){
     for(int j=1 ; j<=s2.size();j++){
    	if(s1[i-1] == s2[j-1]) dp[i][j] = 1+ dp[i-1][j-1];
      	else dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
     }
    }
  
  	int i=s1.size();
  	int j = s2.size();
  	int index = dp[i][j];
   vector<int> v(index,0);
	while(i>0 && j>0){
    	if(s1[i-1]==s2[j-1]){
          v[index-1] = i-1;
          index--;
          i--;j--;
        }
        else{
        	if(dp[i-1][j] > dp[i][j-1]){
              i--;
            }
          	else{
              j--;
            }
        }
    }
  	
  for(int k=0;k<v.size();k++) cout << s1[v[k]];
  return 0;

}
                                          
                    


Measured memory_bytes: 35584
#include <bits/stdc++.h>
using namespace std;
#define dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
typedef long long ll;
typedef long double ld;
const ll inf = 1e18;
const int nax = 1e6 + 7;
const ll mod = 1e9 + 7;
//ll tree[4 * nax];
//9uS-22RSwk7gQqh

int main(){
	dhoom;
	string s;
	cin >> s;
	int p = 2019;
	map< int , int > mp;
	mp[0]++;
	int t = 0 , p2 = 1;
	int ans = 0;
	for(int i = s.size() -1  ; i >= 0; i--){
		t = (t+(s[i] - '0')*p2)%p;
		ans += mp[t];
		mp[t]++;
		p2=p2*10%p;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3788
"use strict"

const main = (input) => {
    const _input = input.split("\n");
    const A = _input[1].split(" ").map(e => parseInt(e));
    let reciprocalNumberSum = 0;

    A.forEach((value) => {
        reciprocalNumberSum += (1/value);
    });

    console.log(1/reciprocalNumberSum);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main() {
    long long N, M;
    cin >> N >> M;

    priority_queue<long long> A;

    for (long long i = 1; i <= N; ++i) {
        long long a;
        cin >> a;
        A.push(a);
    }

    for (long long i = 1; i <= M; ++i) {
        long long a = A.top();
        A.pop();
        A.push(a / 2);
    }

    long long ans = 0;

    for (long long i = 1; i <= N; ++i) {
        long long a = A.top();
        A.pop();
        ans += a;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1400
import sys
import random
input = sys.stdin.readline


def solve(n, s):
    sub = [int(s[i])-1 for i in range(n)]
    
    table = [0]*(n+1)
    p = 2
    for i in range(len(bin(n))-1):
        for j in range(p, n+1, p):
            table[j] += 1
        p *= 2
    
    for i in range(n):
        table[i+1] += table[i]
    
    ans = 0
    for i in range(n):
        if sub[i]%2:
            judge = table[n-1]-table[n-1-i]-table[i]
            if not judge:
                ans += 1
    
    
    if ans%2:
        res = 1
    else:
        if 1 in sub:
            res = 0
        else:
            res = 0
            for i in range(n):
                if sub[i]:
                    judge = table[n-1]-table[n-1-i]-table[i]
                    if not judge:
                        res += 1
            return res%2*2
    
    return res
    
    
def main():
    n = int(input())
    s = input()
    
    ans = solve(n, s)
    print(ans)
    
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 128076
sa=list(input())
sb=list(input())
sc=list(input())

play="a"
ia=0
ib=0
ic=0
for _ in range(len(sa)+len(sb)+len(sc)):
    if(play=="a" and ia==len(sa)):
        print("A")
        exit()
    elif(play=="b" and ib==len(sb)):
        print("B")
        exit()
    elif(play=="c" and ic==len(sc)):
        print("C")
        exit()
    elif(play=="a"):
        play=sa[ia]
        ia+=1
    elif(play=="b"):
        play=sb[ib]
        ib+=1
    elif(play=="c"):
        play=sc[ic]
        ic+=1
    

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

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

#define MOD 1000000007

int main(int argc, char **argv)
{
    int N, M;
    cin >> N >> M;
    int a[M];
    REP(i, M) cin >> a[i];

    bool f[N + 1];
    REP(i, N + 1) f[i] = false;
    REP(i, M) f[a[i]] = true;
    ll dp[N + 1];
    dp[0] = 1;
    dp[1] = (f[1])? 0 : 1;
    FOR(i, 2, N + 1) {
        if (f[i]) dp[i] = 0;
        else {
            dp[i] = (dp[i - 2] + dp[i - 1]) % MOD;
        }
    }
    cout << dp[N] << endl;
    return 0;
}


Measured memory_bytes: 1536
using System;
using System.Collections.Generic;
using System.Linq;
using static Atcoder;
using System.Threading.Tasks;
using System.ComponentModel;

public class Hello
{

    public static void Main()
    {
        int[] nums = SpRead(' ').Select(a => int.Parse(a)).ToArray();
        int N = nums[0];
        int M = nums[1];

        string[] s_1 = new string[N];
        string[] s_2 = new string[M];

        for (int i = 0; i < N; i++)
        {
            s_1[i] = Console.ReadLine();
        }
        for (int i = 0; i < M; i++)
        {
            s_2[i] = Console.ReadLine();
        }

        string s = "";

        for (int i = 0; i < (N - M) + 1; i++)
        {
            for (int j = 0; j < (N - M) + 1; j++)
            {
                s = s_1[i].Substring(j, M);
                if (s == s_2[0])
                {
                    for (int k = 0; k < M; k++)
                    {
                        s = s_1[i + k].Substring(j, M);
                        if (s != s_2[k]) break;
                        if (k + 1 == M) {
                            Console.WriteLine("Yes");
                            return;
                        }
                    }
                }
            }
        }
        Console.WriteLine("No");
    }
}



public class Atcoder
{
    static void Swap<T>(ref T a, ref T b)
    {
        var t = a;
        a = b;
        b = t;
    }
    public static int LCM(int a, int b)
    {
        int c = a * b;
        if (a < b) Swap(ref a, ref b);
        int d = a % b;
        while (d != 0)
        {
            a = b;
            b = d;
            d = a % b;
        }
        return c / b;
    }
    public static string strReverce(string s)
    {
        return new string(s.Reverse().ToArray());
    }
    public static int Cin()
    {
        return int.Parse(Console.ReadLine());
    }
    public static bool IsPrime(int n)
    {
        if (n < 2) return false;
        if (n == 2) return true;
        if (n % 2 == 0) return false;

        //double sqrtNum = Math.Sqrt(n);
        for (int i = 3; i < n; i += 2)
        {
            if (n % i == 0) return false;
        }
        return true;
    }
    public static string[] SpRead(char c)
    {
        return Console.ReadLine().Split(c);
    }
}


Measured memory_bytes: 13396
#include<iostream>
#include<algorithm>
#include<array>
#include<map>
#include<vector>
using namespace std;

typedef pair<int, int> P;
map<int, P> mp;
map<P, int> sum;

int main() {
  int h, w, d;
  cin >> h >> w >> d;
  int a[310][310];
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
		cin >> a[i][j];
      mp[a[i][j]] = P(i, j);
	}
  }
  int q;
  cin >> q;
  int l[100100], r[100100];
  for (int i = 0; i < q; i++) {
    cin >> l[i] >> r[i];
  }
  for (int i = 0; i < d; i++) {
    for (int j = 0; i + (j+1) * d <= h * w; j++) {
      //if (i == 0 && j == 0)continue;
      int c = i + j * d;
      sum[P(i, j + 1)] = abs(mp[c + d].first - mp[c].first) + abs(mp[c + d].second - mp[c].second) + sum[P(i, j)];
    }
  }
  for (int i = 0; i < q; i++) {
    cout << sum[P(l[i] % d, r[i] / d)] - sum[P(l[i] % d, l[i] / d)] << endl;
  }
}

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

using namespace std;
typedef long long ll;

int main(){
    int n;
    ll ans = 0;
    cin>>n;
    vector<int> a(n+1),b(n);
    rep(i,n+1) cin>>a[i];
    rep(i,n) cin>>b[i];
    rep(i,n){
        if(b[i] - a[i] > 0){
            ans += a[i];
            b[i] -=a[i];
            if(a[i+1]-b[i]>0){
                ans += b[i];
                a[i+1] -= b[i];
            }else{
                ans += a[i+1];
                a[i+1]=0;
            }
        }else{
            ans += b[i];
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define MOD 1000000007
ll bigpow(ll base,ll pw,ll M)
{
	if(pw==0) return 1;
	if(pw%2==0)
	{
		ll ret=bigpow(base,pw/2,M);
		return ((ret%M)*(ret%M))%M;
	}
	else return ((base%M)*(bigpow(base,pw-1,M)))%M;

}
ll maxi(ll a,ll b)
{
    if(a>b)return a;
    return b;
}
ll mini(ll a,ll b)
{
    if(a<b)return a;
    return b;
}
ll abse(ll a)
{
    if(a<0)return -a;
    return a;
}
ll ceili(ll a,ll div)
{
    return (a+div-1)/div;
}
int h,w;
ll**  dp;

char** v;
ll f(int i,int j)
{
    if(i>h||j>w) return 0;
    if(v[i][j]=='#')return 0;
    if(dp[i][j]!=-1)return dp[i][j];
    if(i==h&&j==w) return 1;
    return dp[i][j]=(f(i+1,j)+f(i,j+1))%MOD;
}
int main(void)
{
    //io;
    int T=1,cas=0,i,j;
    char c;
    //cin>>T;
    while(T--)
    {
        cin>>h>>w;

        dp=new ll*[h+5];
        for(i=0;i<h+5;i++)dp[i]=new ll[w+5];
        v=new char*[h+5];
        for(i=0;i<h+5;i++)v[i]=new char[w+5];

        for(i=0;i<h;i++)
        {
            scanf(" %s",v[i]);
        }


      for ( i = 0; i <=h; i++)
        for ( j = 0; j <= w; j++)
            dp[i][j] = -1;
        h--;w--;
        dp[h][w]=1;
    cout<<f(0,0);

    }
}


Measured memory_bytes: 9216
#include <iostream>
#include <algorithm>
#include <vector>
#include <chrono>
#include <iostream>

using namespace std;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    
    if (a == b + c){
        cout << "Yes\n";
    }else if(b == a + c){
        cout << "Yes\n";
    }else if(c == a + b){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }
}

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

int n, x = 0;
int cnt[3] = {0};
bool ans = 0;

int main() {
  int i, a;
  cin >> n;
  for(i = 0; i < n; ++i) {
    cin >> a;
    if(a % 4 == 0)
      ++cnt[0];
    else if(a % 2 == 0)
      ++cnt[1];
    else
      ++cnt[2];
  }
  if(cnt[0] + cnt[1] == n) ans = 1;
  if(cnt[1] > 0) {
    x = cnt[1] - 1;
    ++cnt[2];
  }
  if(cnt[0]+1 >= cnt[2]) ans = 1;
  if(ans)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#![allow(unused_mut)]
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(unused_imports)]
#![allow(dead_code)]
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    let mut next = || { iter.next().unwrap() };
    input_inner!{next, $($r)*}
  };
  ($($r:tt)*) => {
    let stdin = std::io::stdin();
    let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
    let mut next = move || -> String{
      bytes
        .by_ref()
        .map(|r|r.unwrap() as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect()
    };
    input_inner!{next, $($r)*}
  };
}
macro_rules! input_inner {
  ($next:expr) => {};
  ($next:expr, ) => {};

  ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($next, $t);
    input_inner!{$next $($r)*}
  };
}
macro_rules! read_value {
  ($next:expr, ( $($t:tt),* )) => {
    ( $(read_value!($next, $t)),* )
  };

  ($next:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
  };

  ($next:expr, chars) => {
    read_value!($next, String).chars().collect::<Vec<char>>()
  };

  ($next:expr, usize1) => {
    read_value!($next, usize) - 1
  };

  ($next:expr, $t:ty) => {
    $next().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  input!{
    A: u128,
    B: u128,
    N: u128,
  }
  let ans = if B > N {
    (A * N) / B - A * (N / B)
  } else if B == N {
    (A * (N-1)) / B - A * ((N-1) / B)
  } else {
    (A * (B-1)) / B - A * ((B-1) / B)
  };

  // for x in 0..N+1 {
  //   let i = (A * x) / B - A * (x / B);
  //   println!("{}: {}", x, i);
  // }

  println!("{}", ans);
}


Measured memory_bytes: 2128
//#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
//#include <queue>
//#include <stack>
#include <cstring>
#include <cassert>

using namespace std;

#ifdef LOCAL_DEBUG
#include <local_debug.h>
#define DEBUG(x...) cerr << #x << " = "; DBG::_print(x)
#else
#define DEBUG(x...)
#endif

#define SZ(a) int((a).size())
#define REP(i,n) for(int i=0,_n=(n);i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)

typedef long long llong;
typedef vector<int> VI;
typedef vector<VI> VVI;

const string RGB = "RGB";

int main(int argc, char* argv[]) {
   ios_base::sync_with_stdio(false); 
   cin.tie(nullptr);

   int N;
   cin >> N;
   string S;
   cin >> S;
   S = "x" + S;
   
   VVI prefix_sum(3, VI(N+1));
   FOR(i, 1, N) {
      REP(m, 3) {
         prefix_sum[m][i] = prefix_sum[m][i-1];
         if (S[i] == RGB[m])
            ++prefix_sum[m][i];
      }
   }

   llong res = 0;
   FOR(j, 2, N) {
      FOR(k, j+1, N) {
         if (S[j] == S[k])
            continue;
         int dist = k-j;
         REP(m, 3) {
            if (RGB[m] == S[j] || RGB[m] == S[k])
               continue;
            res += prefix_sum[m][j-1];
            int i = j-dist;
            if (i > 0 && S[i] == RGB[m])
               --res;
         }
      }
   }

   cout << res << '\n';

   return 0;
}


Measured memory_bytes: 3676
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
struct edge{
  int to, cost;
  edge(int t, int c) {
    to = t, cost = c;
  }
};
int N,M;
vector<edge> G[100005];
int D[100005];
bool dfs(int v){
  bool ret=true;
  for(auto to : G[v]){
    if(D[to.to]==2e9){
      D[to.to]=D[v]+to.cost;
      if(!dfs(to.to))return false;
    }else{
      ret&=(D[to.to]==D[v]+to.cost);
    }
  }
  return ret;
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin>>N>>M;
  FOR(i,0,M){
    int l,r,d;
    cin>>l>>r>>d;
    G[l].push_back(edge(r,d));
    G[r].push_back(edge(l,-d));
  }
  FOR(i,0,N+1)D[i]=2e9;
  FOR(i,1,N+1){
    if(D[i]==2e9){
      D[i]=0;
      if(!dfs(i)){
        cout<<"No"<<endl;
        return 0;
      }
    }
  }
  cout<<"Yes"<<endl;
  return 0;
}

Measured memory_bytes: 12928
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define ll long long
#define endl "\n"
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using namespace std;
const int N = 2e5 + 10;
const ll inf = 1e18 + 10, mod = 1e9 + 7;
ll x, y, a, b, c, r[N], g[N], u[N], k = 1, ans;
vector <ll> e;
int main()
{
    //ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("lca_rmq.in", "r", stdin);
    //freopen("lca_rmq.out", "w", stdout);
    cin >> x >> y >> a >> b >> c;
    for(int i = 1; i <= a; i++)cin >> r[i];
    for(int i = 1; i <= b; i++)cin >> g[i];
    for(int i = 1; i <= c; i++)cin >> u[i];
    sort(r + 1, r + 1 + a);
    sort(g + 1, g + 1 + b);
    sort(u + 1, u + 1 + c);
    reverse(u + 1, u + 1 + c);
    for(int i = a; i >= a - x + 1; i--)e.pb(r[i]);
    for(int i = b; i >= b - y + 1; i--)e.pb(g[i]);
    sort(e.begin(), e.end());
    for(int i = 0; i < e.size(); i++)
    {
        if(e[i] < u[k])e[i] = u[k++];
        ans += e[i];
    }
    cout << ans;

}


Measured memory_bytes: 5748
/**akshaykumar99**/

#include<bits/stdc++.h>
using namespace std;

#define F first
#define S second
#define pp pop_back()
#define pu(x) push_back(x)
#define eb(x) emplace_back(x)
#define mp(a,b) make_pair(a,b)
#define all(v) v.begin(),v.end()
#define f(i,x,n) for(i=x;i<n;i++)
#define rall(v) v.rbegin(),v.rend()

const int MOD=1e9+7 , INF=INT_MAX;
const long long LINF=LLONG_MAX;

typedef long long ll;
typedef long double ld;
typedef vector<int> ivc;
typedef pair<int,int> ipr;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int r;
    cin>>r;
    ll z=r*r*3;
    cout<<z<<endl;
    

}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

n = int(input())
S = sorted(map(int, input().split()), reverse=True)
L = [S[0]]
used = [False]*(1<<n)
used[0] = True
for i in range(n):
  L.sort(reverse=True)
  idx = 0
  for j, s in enumerate(S):
    if used[j]:
      continue
    if L[idx] > s:
      L.append(s)
      used[j] = True
      idx += 1
      if idx == 1<<i:
        break
  else:
    print("No")
    exit()
print("Yes")

Measured memory_bytes: 39592
#include<iostream>
#include<math.h>
#include <string>
#include <stack>
#include<stdio.h>
#include <queue> 
#include <functional>
#define rep(i,n) for (int i=0; i < (int)(n); i++)

using namespace std;

int main(){
	
	stack<int> st; // スタックを宣言＋初期化
	
	int a,b,c,d,e,num;
	int i,j,k;
	int arr[100];
	int arr2[100][100];
	char x,y,z;
	char crr[100];
	char crr2[100][100];
	string str2;
	string str;
	stack<int> istk; // 整数値を格納するスタックを宣言
    stack<string> sstk; // 文字列を格納するスタックを宣言	
	queue<int> ique; // 整数値を格納するキューを宣言
    queue<string> sque; // 文字列を格納するキューを宣言

	
	
	cin >> num;
	
	rep(i , num){
		
		
		cin >> str;
		

		
		j = 0;
		
		
		while(1){
			
			x = NULL;
			
			if(str[j] == NULL) break;
		
			switch(str[j]){
				
				case '0':
				
				j=j+1;
					break;
					
					
	
				case '1':
				
				
				x = '.';
				j = j+1;
				while(1){
					if(str[j] == '0') break;
					if(x == '.' ) x = ',';
					else if(x == ',' ) x = '!';
					else if(x == '!' ) x = '?';
					else if(x == '?' ) x = ' ';
					else x = '.';
					j = j+1;
				}
				j = j+1;
					break;
					
				case '2':
				
				
				x = 'a';
				j = j+1;
				while(1){
					if(str[j] == '0') break;
					if(x == 'a' ) x = 'b';
					else if(x == 'b' ) x = 'c';
					else x = 'a';
					j = j+1;
				}
				j = j+1;
					break;
				case '3':
				
				
				x = 'd';
				j = j+1;
				while(1){
					if(str[j] == '0') break;
					if(x == 'd' ) x = 'e';
					else if(x == 'e' ) x = 'f';
					else x = 'd';
					j = j+1;
				}
				j = j+1;
					break;
				case '4':
				
				
				x = 'g';
				j = j+1;
				while(1){
					if(str[j] == '0') break;
					if(x == 'g' ) x = 'h';
					else if(x == 'h' ) x = 'i';
					else x = 'g';
					j = j+1;
				}
				j = j+1;
					break;
				case '5':
				
				
				x = 'j';
				j = j+1;
				while(1){
					if(str[j] == '0') break;
					if(x == 'j' ) x = 'k';
					else if(x == 'k' ) x = 'l';
					else x = 'j';
					j = j+1;
				}
				j = j+1;
					break;
				case '6':
				
				
				x = 'm';
				j = j+1;
				while(1){
					if(str[j] == '0') break;
					if(x == 'm' ) x = 'n';
					else if(x == 'n' ) x = 'o';
					else x = 'm';
					j = j+1;
				}
				j = j+1;
					break;
				case '7':
				
				
				x = 'p';
				j = j+1;
				while(1){
					if(str[j] == '0') break;
					if(x == 'p' ) x = 'q';
					else if(x == 'q' ) x = 'r';
					else if(x == 'r' ) x = 's';
					else x = 'p';
					j = j+1;
				}
				j = j+1;
					break;
				case '8':
				
				
				x = 't';
				j = j+1;
				while(1){
					if(str[j] == '0') break;
					if(x == 't' ) x = 'u';
					else if(x == 'u' ) x = 'v';
					else x = 't';
					j = j+1;
				}
				j = j+1;
					break;
				case '9':
				
				
				x = 'w';
				j = j+1;
				while(1){
					if(str[j] == '0') break;
					if(x == 'w' ) x = 'x';
					else if(x == 'x' ) x = 'y';
					else if(x == 'y' ) x = 'z';
					else x = 'w';
					j = j+1;
				}
				j = j+1;
					break;

			}
			
//			str2[k] = x;
//			k = k+1;
			if(x == NULL ) continue; 
			cout << x;		

				
				
		}
		
		cout << endl;
		
		
		
	}
		
	return 0;
		
}

Measured memory_bytes: 0
//Sinhov : "Hi stalker!"
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mod 1000000007
int main() {
    ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
    string s;
    ll i;
    cin>>s;
    for(i=0;i<s.length();i++){
        if(s[i]=='9'){
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
    return 0;
}

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

int main() {
	int n, m;
	cin >> n >> m;
	string result = "";
	for (int i = 0; i < n; i++)
		result += "?";
	for (int i = 0; i < m; i++) {
		int s;
		char c;
		cin >> s >> c;
		s--;
		if (result[s] != '?' && result[s] != c) {
			cout << "-1\n";
			return 0;
		}
		result[s] = c;
	}
	if (n == 1) {
		if (result[0] == '?')
			result[0] = '0';
	} else {
		if (result[0] == '?')
			result[0] = '1';
		else if (result[0] == '0') {
			cout << "-1\n";
			return 0;
		}
		for (int i = 1; i < n; i++)
			if (result[i] == '?')
				result[i] = '0';
	}
	cout << result << '\n';
	return 0;
}


Measured memory_bytes: 3600
#include<iostream>
using namespace std;
int main(){
  int n,m,i,j,b;
  int a[1001]={};
  int ans[1001]={};

  cin >>n >>m;
  for(i=0;i<n;++i)
    cin >>a[i];
  for(i=0;i<m;++i){
    cin >>b;
    for(j=0;j<n;++j){
      if(b>=a[j]){
	ans[j]++;
	break;
      }
    }
  }
  int num,top=0;
  for(i=0;i<n;++i){
    if(ans[i]>top){
      num = i+1;
      top = ans[i];
    }
  }
  cout <<num << endl;
  return 0;
}

Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
int d=365, n=26;
int c[27];
int s[366][27];
int a[366];
int sat[366]={};
int last[27]={};
uint64_t get_rand_range( uint64_t min_val, uint64_t max_val ) {

    srand((int)time(NULL));
    static mt19937_64 mt64(rand());

    uniform_int_distribution<uint64_t> get_rand_uni_int( min_val, max_val );

    return get_rand_uni_int(mt64);
}

int calcdiff(int t, int q){
    int p=a[t];
    int lp=0,rp=d+1,lq=0,rq=d+1;
    For(i,1,d+1){
        if(a[i]==p){
            if(i<t) lp=max(lp,i);
            else if(i>t) rp=min(rp,i);
        }
        else if(a[i]==q){
            if(i<t) lq=max(lq,i);
            else if(i>t) rq=min(rq,i);
        }
        if(i==t) a[i]=q;
    }
    int diff=s[t][q]-s[t][p];
    diff -= (t-lp) * (rp-t) * c[p];
    diff += (t-lq) * (rq-t) * c[q];
    return diff;
}
void Main(){
    clock_t start = clock();
    cin >> d;
    For(i,1,n+1) cin >> c[i];
    For(i,1,d+1) For(j,1,n+1) cin >> s[i][j];
    For(i,1,d+1) a[i] = i%n + 1;
    For(i,1,d+1){
        sat[i] = sat[i-1] + s[i][a[i]];
        last[a[i]] = i;
        For(j,1,n+1){
            sat[i] -= (i-last[j]) * c[j];
        }
    }
    double time = static_cast<double>(clock() - start) / CLOCKS_PER_SEC * 1000.0;
    while(time < 1950){
        int t = get_rand_range(1,d);
        int q = get_rand_range(1,n);
        if(calcdiff(t,q)>0){
            a[t] = q;
        }
        time = static_cast<double>(clock() - start) / CLOCKS_PER_SEC * 1000.0;
    }
    For(i,1,d+1) cout << a[i] << endl;

}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

Measured memory_bytes: 3684
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

int main() {
    int N;
    cin >> N;
    vector< vector<ll> > A(N, vector<ll>(N, INF)), dist(N, vector<ll>(N, INF));
    REP(i, N) REP(j, N) {
        cin >> A[i][j];
        dist[i][j] = A[i][j];
    }

    REP(i, N)
        REP(j, N)
            REP(k, N) {
                if(dist[i][j] > dist[i][k] + dist[k][j]) {
                    dist[i][j] = dist[i][k] + dist[k][j];
                }
            }

    bool flag = true;
    REP(i, N)
        REP(j, N) if(A[i][j] != dist[i][j]) flag = false;
    if(!flag) {
        cout << -1 << endl;
        return 0;
    }

    ll total = 0;
    // REP(i, N)
    //     REP(j, i) {
    //         total += A[i][j];
    //     }
    REP(i, N)
        REP(j, i) {
            bool flag = true;
            REP(k, N) {
                if(k != i && j != k && dist[i][j] >= dist[i][k] + dist[k][j]) {
                    // total -= dist[i][j];
                    flag = false;
                }
            }
            if(flag) total += dist[i][j];
        }
    cout << total << endl;
    return 0;
}

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

#define trace(...) __f( #__VA_ARGS__ , __VA_ARGS__ )
template <typename Arg1>
void __f( const char* name , Arg1&& arg1 ) {
        cerr << name << " : " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f( const char* na , Arg1&& arg1 , Args&&... args ) {
        const char* c = strchr( na + 1 , ',' );
        cerr.write( na , c - na ) << " : " << arg1 << " , ";
        __f( c + 1 , args... );
}
#define endl "\n"
#define all(V) V.begin(),V.end()
#define Unique(V) sort(all(V)),V.erase(unique(all(V)),V.end())
#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long int LL;
typedef pair <int,int> pii;
const int MOD = 1e9 + 7;
const int inf = 1e9;
const double EPS = 1e-9;
const double PI = acos(-1.0);
const long long INF = 1e18;
const int N = 1e5 + 5;

int a[ N ];
pair <int,int> x[ N ];

bool cmp( pii aa , pii bb ) {
        return aa.second > bb.second;
}
int main( ) {
        IO;
        #ifdef LOCAL
            freopen( "input.txt" , "r" , stdin );
        #endif // LOCAL
        int n , m;
        cin >> n >> m;
        for( int i = 1; i <= n; i++ ) cin >> a[i];
        for( int i = 1; i <= m; i++ ) {
                cin >> x[i].first >> x[i].second;
        }
        sort( x + 1 , x + m + 1 , cmp );
        sort( a + 1 , a + n + 1 );
        //for( int i = 1; i <= m; i++ ) trace( x[i].first , x[i].second );
        int id = 1 , rem = x[1].first , val = x[1].second;
        for( int i = 1; i <= n; i++ ) {
                a[i] = max( a[i] , val );
                rem--;
                if( rem < 1 ) ++id , rem = x[id].first , val = x[id].second;
        }
        LL ans = 0;
        //for( int i = 1; i <= n; i++ ) cout << a[i] << " "; cout << endl;
        for( int i = 1; i <= n; i++ ) ans += a[i];
        cout << ans << endl;
        return 0;
}










Measured memory_bytes: 1408
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		// スペース区切りの整数の入力
      ArrayList<Integer> upList = new ArrayList<Integer>();
      while (sc.hasNextInt()) {
        upList.add(sc.nextInt());
      }
      int moExp = 0;
      int sum = 0;
      for (int i = 0; i < upList.size(); i++) {
        if (moExp < upList.get(i)) {
          moExp = upList.get(i);
        }
        sum = sum += upList.get(i);
      }
      sum = sum - (moExp / 2);
		
		
		// 出力
		System.out.println(sum);
	}
}

Measured memory_bytes: 23124
#include <queue>
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <cstdio>
#define rep(i, n) for(long long i = 0;(i) < (n);(i)++)
using namespace std;
using ll = long long;


int N;
string str;

int main()
{
	cin >> N >> str;
	if (N % 2) {
		cout << "No" << endl;
		return 0;
	}
	if (str.substr(0, N / 2) == str.substr(N / 2, N))
	{
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    #include<string.h>
    using namespace std;
    #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #define endl "\n"
    #define Max(x,y,z) max(x,max(y,z))
    #define Min(x,y,z) min(x,min(y,z))
    #define fr(i,s,e) for(i=s;i<e;i++)
    #define rf(i,s,e) for(i=s-1;i>=e;i--)
    #define pb push_back
    #define eb emblace_back
    #define mp make_pair
    #define ff first
    #define ss second
    #define ll long long
    #define trace1(x)                cerr<<#x<<": "<<x<<endl
    #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
    #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
    #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
    #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
    #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
    #define vl vector<long long>
     
    #define vi vector<int> 
    #define vii vector< vector<int> >
    #define vll vector< vector<long long> >
    #define vpi vector< pair<int,int> >   
    #define vpl vector< pair<ll,ll> >   
    typedef pair<pair<int, int>,int> P;
     #define mod %1000000007
     
    bool less_vectors(const vector<int>& a,const vector<int>& b) 
    {
       return a.size() > b.size();
    }
     
    int gcd(int a,int b)
    {
    	if(a%b==0)
    		return b;
    		else
    			return gcd(b,a%b);
    }
     
    bool cmp(pair<int,pair<int,int> >  p1,pair<int,pair<int,int> > p2)
    {
    		return p1.ff>p2.ff;
    }
    vi t;
	ll k=0;
	int n;
	vi color;
	vii g;
	void dfs(int s,int p,int l)
	{
		t[s]=p;
		if(s==n)
		{
			k=l;
		}
		vi::iterator it=g[s].begin();
		for(;it!=g[s].end();it++)
		{
			if(*it!=p)
			{
				dfs(*it,s,l+1);
			}
		}
		
	}
	int dfs1(int s,int p)
	{
		vi::iterator it=g[s].begin();
		ll k=0;
		for(;it!=g[s].end();it++)
		{
			if(*it!=p && color[*it]!=2)
			{
				k+=dfs1(*it,s);
			}
		}
		if(color[s]!=1)
			k++;
			return k;
	}
    int main()
    {
    	IOS;
    	
		cin>>n;
		g.resize(n+1);
		int u,v;
		for(int i=0;i<n-1;i++)
		{
			cin>>u>>v;
			g[u].pb(v);
			g[v].pb(u);
		}
		t.resize(n+1);
		dfs(1,-1,0);
		k=k-1;
		int h=k/2;
		color.resize(n+1,0);
		int y=t[n];
		for(int i=0;i<h;i++)
		{
			color[y]=2;
			y=t[y];
		}
		h=k/2+k%2;
		color[1]=1;
		color[n]=2;
		for(int i=0;i<h;i++)
		{
			color[y]=1;
			y=t[y];
		}
		int b=dfs1(1,-1);
		int w=n-(2+k+b);
		bool ch=1;
		if(k%2)
		{
			if(w>b)
				ch=0;
				else
					ch=1;
		}
		else
		{
			if(b>w)
				ch=1;
				else
					ch=0;
		}
		if(ch)
			cout<<"Fennec";
			else
				cout<<"Snuke";
				
    	return 0;
    		
    } 

Measured memory_bytes: 11264
import sys
import math  # noqa
import bisect  # noqa
import queue  # noqa


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


if __name__ == '__main__':
    S = int(input())

    x1, y1 = 0, 0
    x2, y2 = 1000000000, 1
    y3 = math.ceil(S / 1000000000)
    x3 = x2 * y3 - S
    print('{} {} {} {} {} {}'.format(x1, y1, x2, y2, x3, y3))


Measured memory_bytes: 38640
#include <bits/stdc++.h>
using namespace std;
int i,s;
char a[1000000],b;
int main() 
{
    while((b=getchar())!='\n')
    {
        s++;
        if(b=='S')a[i++]=b;
        if(b=='T')a[i++]=b;
        if(a[i-2]=='S'&&a[i-1]=='T')s-=2,i-=2;
    }
    cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 384
H,W=map(int,input().split())
S=[]
for i in range(H):
    s=input()
    S.append(s)
L=[[0]*W for _ in range(H)]
R=[[0]*W for _ in range(H)]
D=[[0]*W for _ in range(H)]
U=[[0]*W for _ in range(H)]

for i in range(H):
    for j in range(W):
        if S[i][j]==".":
            if j==0:
                L[i][j]=1
            else:
                L[i][j]=L[i][j-1]+1
for i in range(H):
    for j in range(W-1,-1,-1):
        if S[i][j]==".":
            if j==(W-1):
                R[i][j]=1
            else:
                R[i][j]=R[i][j+1]+1

for j in range(W):
    for i in range(H-1,-1,-1):
        if S[i][j]==".":
            if i==(H-1):
                D[i][j]=1
            else:
                D[i][j]=D[i+1][j]+1

for j in range(W):
    for i in range(H):
        if S[i][j]==".":
            if i==0:
                U[i][j]=1
            else:
                U[i][j]=U[i-1][j]+1
ans=0
X=[[0]*W for _ in range(H)]
for i in range(H):
    for j in range(W):
        X[i][j]=L[i][j]+R[i][j]+D[i][j]+U[i][j]-3
    ans=max(ans,max(X[i]))
print(ans)

Measured memory_bytes: 213124
n,k=map(int, input().split())
a=list(map(int,input().split()))
ans=0

if n==k:
  print(1)
  exit()

if (n-1)%(k-1) == 0:
  print((n-1)//(k-1))
else:
  print((n-1)//(k-1)+1)

Measured memory_bytes: 20404
#include <iostream>
#include <vector>
#include <algorithm>
#define REP(i, a, n) for(int i = (a); i < (n); i++)
using namespace std;
 
int A, L, d[6];
 
void toarray(int a) {
  REP(i, 0, L) {
    d[i] = a % 10;
    a /= 10;
  }
}
 
int number() {
  int n = 0;
  REP(i, 0, L) n = n * 10 + d[i];
  return n;
}
 
int find(int n, vector<int> &v) {
  REP(i, 0, v.size()) if(v[i] == n) return i;
  return -1;
}
 
int main(void) {
  while(cin >> A >> L, A || L) {
    vector<int> v;
    for(int i = 0; true; i++) {
      int idx;
      if((idx = find(A, v)) >= 0) {
        cout << idx << " " << A << " " << (i - idx) << endl;
        break;
      }
      v.push_back(A);
      toarray(A);
      sort(d, d + L);
      int nmin = number();
      reverse(d, d + L);
      int nmax = number();
      A = nmax - nmin;
    }
  }
 
  return 0;
}

Measured memory_bytes: 3160
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
#include <string>
#include <set>
#include <algorithm>
#include <utility>
#include <cstring>
#include <cmath>
using namespace std;


int main() {
    int a,b,c;
    cin>>a>>b>>c;
    cout<<min(b/a,c)<<endl;
    return 0;
}


Measured memory_bytes: 256
main(n,m,e,j,z){char a[]="C";for(;;){scanf("%d",&n);if(!n)exit(0);for(;n--;a[0]=67){scanf("%d%d%d",&m,&e,&j);z=m+e+j;(z>149&&(m>79||e>79))||z>209?a[0]=66:0;z>239||z-j>179||m>99||e>99||j>99?a[0]=65:0;puts(a);}}}

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

using namespace std;
int n;
long double x[9], y[9];
long double get(vector < int > &v){
    long double ans = 0;
    for(int i = 1; i < v.size(); i++){
        ans += sqrt(((x[v[i]] - x[v[i - 1]]) * (x[v[i]] - x[v[i - 1]]) + ((y[v[i]] - y[v[i - 1]]) * (y[v[i]] - y[v[i - 1]]))));
    }
    return ans;
}
long double man;
int main(){
    vector < int > v;
    cin >> n;
    long double N = 1;
    for(int i = 1; i <= n; i++){
        cin >> x[i] >> y[i];
        v.push_back(i);
        N *= i;
    }
    man += (get(v));
    while(next_permutation(v.begin(), v.end())){
        man += (get(v));
    }
    cout << fixed << setprecision(10) << (man / N);
}


Measured memory_bytes: 256