akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;

class Program
{
    static void Main()
    {
        Scanner cin = new Scanner();
        //Random rnd = new Random();
        //Stopwatch sw = new Stopwatch();

        // A B C
        /*
        int A = cin.Nextint;
        int B = cin.Nextint;
        int C = cin.Nextint;
        */

        // N
        // a1 a2 ... aN

        int N;
        int[] D;

        N = cin.Nextint;
        D = cin.Scanint;


        int M;
        int[] T;

        M = cin.Nextint;
        T = cin.Scanint;


        // N M
        // a1 b1
        // ...
        // aM bM
        /*
        int N;
        int M;
        int[] A = new int[M];
        int[] B = new int[M];

        N = cin.Nextint;
        M = cin.Nextint;

        for(int i=0; i<M; i++)
        {
            A[i] = cin.Nextint;
            B[i] = cin.Nextint;
        }
         */



        Array.Sort(D);
        Array.Sort(T);

        bool ok = true;
        int extra = 0;
        for(int i = 0; i < T.Length; ) {
            if (T[i]==D[i+extra]) {
                i++;
            }
            else if (T[i] > D[i+extra]){
                extra++;
                continue;
            }
            else {
                ok = false;
                break;
            }
        }

        Console.WriteLine(ok ? "YES":"NO");

        /** ここに記述 */

        //Console.WriteLine(result ? "Yes" : "No");
        Console.Out.Flush();
    }
}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] Scan { get { return Console.ReadLine().Split(); } }
    public int[] Scanint { get { return Array.ConvertAll(Scan, int.Parse); } }
    public long[] Scanlong { get { return Array.ConvertAll(Scan, long.Parse); } }
    public double[] Scandouble { get { return Array.ConvertAll(Scan, double.Parse); } }
    public string Next
    {
        get
        {
            if (i < s.Length)
            {
                return s[i++];
            }
            string st = Console.ReadLine();
            while (st == "")
            {
                st = Console.ReadLine();
            }

            s 
            = st.
                Split
                (cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return Next;
        }
    }
    public int Nextint { get { return int.Parse(Next); } }
    public long Nextlong { get { return long.Parse(Next); } }
    public double Nextdouble { get { return double.Parse(Next); } }
}

Measured memory_bytes: 35824
import sys
input = sys.stdin.buffer.readline

def main():
    H,W,K = map(int,input().split())
    fib = [1,1,2,3,5,8,13,21,34]
    MOD = 10**9+7
    
    if W == 1:
        print(1)
    else:
        ans = [0 for _ in range(W)]
        ans[0] = 1
        for _ in range(H):
            use = [0 for _ in range(W)]
            for i in range(W):
                if i == 0:
                    use[i] = ans[i]*fib[W-1]+ans[i+1]*fib[W-2]
                elif i == W-1:
                    use[i] = ans[i]*fib[W-1]+ans[i-1]*fib[W-2]
                else:
                    use[i] = ans[i]*fib[i]*fib[W-i-1]+ans[i-1]*fib[i-1]*fib[W-i-1]+ans[i+1]*fib[i]*fib[W-i-2]
                use[i] %= MOD
            ans = use
        print(ans[K-1])
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 3192
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const long long INF = (long long)1e18+1;
#define DIV 1000000007
ll gcd(ll a, ll b) {
    return b != 0 ? gcd(b, a%b) : a;
}

map<ll, ll> prime_factorization(ll n){
    map<ll,ll> ret;
    for(ll i=2;i*i<=n;i ++){
        while(n%i==0){
            ret[i] ++;
            n /= i;
        }
    }
    if(n!=1) ret[n]=1;
    return ret;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    //start = chrono::system_clock::now();
        ll A, B;
        cin >> A >> B;
        ll div = gcd(A,B);
        auto divs = prime_factorization(div);
        cout << divs.size()+1 << endl;
    //end = chrono::system_clock::now();
    //cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
    return 0;
}

Measured memory_bytes: 256
n, m = gets.split.map(&:to_i)
a, c = [], []
n.times {a << gets.split.map(&:to_i)}
m.times {c << gets.to_i}

n.times do |i|
  sum = 0
  m.times {|j| sum += a[i][j] * c[j]}
  puts sum
end


Measured memory_bytes: 6980
n = int(input())
l = list(map(int,input().split()))
l.sort()
l.reverse()
squ = 0
rec = []
count = 0
tmp = 0
for i in l:
  if i == tmp:
    count += 1
  else:
    tmp = i
    count = 1
  
  if count == 2:
    rec.append(tmp)
  elif count == 4:
    squ = max([squ,tmp])

if len(rec)<2:
  print(squ*squ)
else:
  print(max([squ*squ,rec[0]*rec[1]]))

Measured memory_bytes: 14252
def main
  n = gets.to_i
  arr = Array.new(n){Array.new(n, 0)}
  n.times do
    arg = gets.split(" ").map(&:to_i)
    arg[1].times do |i|
      arg[2 + i..-1].each do |item|
        arr[arg[0] - 1][item - 1] = 1
      end
    end
  end
  arr.each{|item|puts item.join(" ")}
end
main

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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using pii = pair<int,int>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back


int main() {
  ll N; cin>>N;
  ll MOD=1e9+7;
  ll a=1,b=1,c=1;
  rep(i,N) {
    a*=10; a%=MOD;
    b*=9; b%=MOD;
    c*=8; c%=MOD;
  }
  b*=2;
  b%=MOD;
  ll ans=a-b+c;
  if(ans<0) ans+=MOD;
  ans%=MOD;
  cout<<ans<<endl;
}


Measured memory_bytes: 3496
#include <cstdio>
#include <algorithm>

typedef long long LL;
const int Mod = 1000000007;
const int MN = 75;

inline int qPow(int b, int e) {
	int a = 1;
	for (; e; e >>= 1, b = (LL)b * b % Mod)
		if (e & 1) a = (LL)a * b % Mod;
	return a;
}

int Fac[MN * 2], iFac[MN * 2];
inline void Init(int N) {
	Fac[0] = 1;
	for (int i = 1; i <= N; ++i) Fac[i] = (LL)Fac[i - 1] * i % Mod;
	iFac[N] = qPow(Fac[N], Mod - 2);
	for (int i = N; i >= 1; --i) iFac[i - 1] = (LL)iFac[i] * i % Mod;
}

int Len;
char Str[MN];
int posr[MN], nxposb[MN], rcnt;

int N, Ans;

int stk[MN];
inline void Calc(int cnt, int csum) {
	int Sum = 0;
	if (!cnt) Sum = 1;
	else if (cnt <= rcnt) {
		static int vis[MN];
		for (int i = 1; i <= cnt; ++i) vis[i] = posr[i];
		int tot = cnt, mxp = 1;
		for (int i = 1; i <= cnt && stk[i] >= 2; ++i)
			mxp = vis[++tot] = nxposb[std::max(mxp, vis[i])];
		if (mxp <= Len) {
			std::inplace_merge(vis + 1, vis + cnt + 1, vis + tot + 1);
			int nwp = Len + 1, sum = 0, now = cnt, ok = 1;
			while (now && stk[now] == 1) --now;
			for (int i = tot; i >= 1; --i) {
				sum += nwp - vis[i] - 1;
				if (Str[vis[i]] == 'b') {
					sum -= stk[now] - 2;
					if (sum < 0) { ok = 0; break; }
					--now;
				}
				nwp = vis[i];
			}
			if (ok) {
				Sum = Fac[cnt];
				int len = 0, num = 1;
				for (int i = 1; i <= cnt; ++i) {
					++len;
					num += stk[i] * 2;
					if (i == cnt || stk[i] != stk[i + 1]) {
						Sum = (LL)Sum * iFac[len] % Mod;
						len = 0;
					}
				}
				Sum = (LL)Sum * Fac[N - csum + num] % Mod * iFac[num - 1] % Mod * iFac[N - csum + 1] % Mod;
			}
		}
	}
	Ans -= (Ans += Sum) >= Mod ? Mod : 0;
}
void DFS(int st, int mx, int sum) {
	Calc(st - 1, sum);
	if (sum < N) {
		stk[st] = 1;
		DFS(st + 1, 1, sum + 2);
	}
	for (int i = 2; i <= mx; ++i) {
		if (sum + i * 2 <= N + 3) {
			stk[st] = i;
			DFS(st + 1, i, sum + i * 2 - 2);
		}
	}
}

int main() {
	scanf("%d%d%s", &N, &Len, Str + 1);
	Init(N * 2 + 2);
	for (int i = 1; i <= Len; ++i)
		if (Str[i] == 'r')
			posr[++rcnt] = i;
	int nwposb = Len + 1;
	nxposb[Len + 1] = Len + 1;
	for (int i = Len; i >= 1; --i) {
		nxposb[i] = nwposb;
		if (Str[i] == 'b')
			nwposb = i;
	}
	DFS(1, (N + 3) / 2, 0);
	printf("%d\n", Ans);
	return 0;
}

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

using namespace std;

int main(void){
  int x, a, b;
  cin >> x >> a >> b;

  int dis_A = abs(x-a);
  int dis_B = abs(x-b);

  if(dis_A > dis_B)
    cout << "B" << endl;
  else
    cout << "A" << endl;

  return 0;
}


Measured memory_bytes: 256
token = require('fs').readFileSync('/dev/stdin', 'ascii').split(" ", 5);
W = parseInt(token[0], 10);
H = parseInt(token[1], 10);
x = parseInt(token[2], 10);
y = parseInt(token[3], 10);
r = parseInt(token[4], 10);
if (x - r < 0 || x + r > W || y - r < 0 || y + r > H) console.log("No");
else console.log("Yes");

Measured memory_bytes: 15532
#include <stdio.h>
int main(void) {
	int a, b, c, x;
	x = 0;
	scanf("%d %d %d", &a, &b, &c);
	for(a;a<=b;a++)
	{
		if (c%a == 0) {
			x++;
		}
	}
	printf("%d\n", x);
	return 0;
}




Measured memory_bytes: 2052
import math

a=input().split()
b=input().split()
T=int(input())

A=int(a[0])
V=int(a[1])
B=int(b[0])
W=int(b[1])


begin_dis=abs(B-A)
#print(begin_dis,(W-V)*T)

if((V-W)*T>=begin_dis):
  print("YES")
else:
  print("NO")

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

#define int long long
#define REP(i, l, r) for (int i = (l); i != (r); (l)<(r)?++i:--i)
#define popcount __builtin_popcountll

const int INF = 1LL<<60;
const int MOD = 1000000007;

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> t) {
    return "(" + to_string(get<0>(t)) + ", " + to_string(get<1>(t)) + ", " + to_string(get<2>(t)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> t) {
    return "(" + to_string(get<0>(t)) + ", " + to_string(get<1>(t)) + ", " + to_string(get<2>(t)) + ", " + to_string(get<3>(t)) + ")";
}

template <typename A>
string to_string(vector<A> v) {
    bool first = true;
    string result = "[";
    for (A i : v) {
        if (!first) result += ", ";
        first = false;
        result += to_string(i); 
    }
    return result + "]";
}

template <typename A>
string to_string(A x[], signed n) {
    string result = "{";
    for (signed i=0; i<n; ++i) {
        if (i!=0) result += ", ";
        result += to_string(x[i]); 
    }
    return result + "}";
}

string bin_string(int x) {
    const int d = 64;
    string result(d, ' ');
    for (signed i=d-1; i>=0; --i) result[d-1-i] = '0'+((x&1LL<<i)!=0);
    return result;
}

int powa(int base, int exp) {
    if (exp<=0) return 1;
    if (base<=0) return 0;
    int val = powa(base, exp>>1);
    val = val*val % MOD;
    if (exp&1) {
        val = val*base % MOD;
    }
    return val;
}

signed main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    
    int n, k;
    cin >> n >> k;
    int h[n+1];
    REP(i, 0, n) cin >> h[i];
    h[n] = 0;
    int dp[n+1][k+1];

    REP(i, 0, n+1) {
        REP(j, 0, min(i, k+1)) {
            dp[i][j] = INF;
            REP(r, 0, j+1) {
                dp[i][j] = min(dp[i][j], dp[i-r-1][j-r] + max(0LL, h[i]-h[i-r-1]));
            }
        }
        if (i <= k) dp[i][i] = h[i];
    }
    cout << dp[n][k];
}


Measured memory_bytes: 1024
module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=1)}([function(t,e,r){"use strict";t.exports=class{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.size=t.length,this.items=t,this.ind=0}enq(t){this.size+=1,this.items.push(t)}deq(){var t=this.items[this.ind];return this.size-=1,this.ind+=1,t}clear(){this.items=[],this.size=0,this.ind=0}}},function(t,e,r){"use strict";var n=r(2);r(3)(n.readFileSync("/dev/stdin","utf8"))},function(t,e){t.exports=require("fs")},function(t,e,r){"use strict";var n=r(4),i=r(5);t.exports=function(t){var e=new n(t);i(e)}},function(t,e,r){"use strict";var n=r(0);t.exports=class{constructor(t){var e=t.trim().split(/\s+/g);this.inp=new n(e)}inr(){return this.inp.deq()}in(){return parseInt(this.inp.deq(),10)}fin(){this.inp.clear()}}},function(t,e,r){"use strict";var n=r(0);t.exports=function(t){for(var e=t.in(),r=new Array(e),i=0;i<e;i++)r[i]=[];for(var s=0;s<e-1;s++){var o=t.in()-1,u=t.in()-1,c=t.in();r[o].push({v:u,c:c}),r[u].push({v:o,c:c})}var a=new Array(e).fill(-1);a[0]=0;var f=new n;for(f.enq(0);f.size>0;)for(var l=f.deq(),p=r[l].length,v=0;v<p;v++){var d=r[l][v];-1==a[d.v]&&(a[d.v]=a[l]+d.c,f.enq(d.v))}for(var h=0;h<e;h++)console.log(a[h]%2?0:1)}}]);

Measured memory_bytes: 88640
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
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;
}
 
using namespace std;

//ここから

int dp[45][450][450];
void solve(){
  int n,ma,mb;
  cin>>n>>ma>>mb;
  vector<int>a(n),b(n),c(n);
  rep(i,n)cin>>a[i]>>b[i]>>c[i];
  rep(i,n+1){
    rep(j,401){
      rep(k,401){
        dp[i][j][k]=1e9;
      }
    }
  }
  dp[0][0][0]=0;
  rep(i,n){
    rep(j,401){
      rep(k,401){
        if(j-a[i]>=0&&k-b[i]>=0)chmin(dp[i+1][j][k],dp[i][j-a[i]][k-b[i]]+c[i]);
        chmin(dp[i+1][j][k],dp[i][j][k]);
      }
    }
  }
  int ans=1e9;
  for(int i=1;i<=40;++i){
    chmin(ans,dp[n][i*ma][i*mb]);
  }
  cout<<(ans!=1e9?ans:-1);
}

int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
  solve();
	return 0;
}


Measured memory_bytes: 32896
get_string(String) :-
  current_input(Input),
  read_string(Input, ' \n', '', _, String).
 
get_number(Number) :-
  get_string(String),
  number_string(Number, String).
 
main :-
  get_number(K),
  get_number(A),
  get_number(B),
  (A//K=:=B//K -> (A mod K =:= 0 -> writeln('OK') ; (B mod K =:= 0 -> writeln('OK') ; writeln('NG'))) ; writeln('OK')).

Measured memory_bytes: 8056
#include "stdio.h"

int main()
{
	int a,b,ans;
	scanf("%d %d", &a,&b);
	if (a + b >= a - b && a + b >= a*b)ans = a + b;
	if (a - b >= a * b && a - b >= a+b)ans = a - b;
	if (a * b >= a - b && a * b >= a+b)ans = a * b;
	printf("%d", ans);
	return 0;
}


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

int mod = 1e9+7;

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

  int x = c-a, y = d-b;

  cout << c-y << " " << d+x << " " << a-y << " " << b+x << endl;
  
  return 0;
}
    


Measured memory_bytes: 256
package main
import . "fmt"
import "sort"
func main() {
  var s string
  var k,n int
  var t []string
  var m []int
  Scan(&s)
  Scan(&k)
  n = len(s)
  m = make([]int,n)
  for i:=0;i<n;i++ {
    m[i] = int(s[i:i+1][0])-97
  }
  set := make(map[string]struct{})
  for j:=0;j<26;j++ {
    for i:=0;i<n;i++ {
      if m[i] == j {
        for p:=i+1;p<=i+k;p++ {
          if p > n { break }
          set[s[i:p]] = struct{}{}
        }
      }
    }
    if len(set) >= k { break }
  }
  n = len(set)
  t = make([]string,n)
  i := 0
  for key,_ := range set {
    t[i] = key
    i++
  }
  sort.Strings(t)
  Println(t[k-1])
}

Measured memory_bytes: 768
#include<stdio.h>
int main(){
    char k[1];
    int a,b,c=0;
    scanf("%d %s %d",&a,k,&b);
    if(k[0]=='+'){
        c=a+b;
    }else if(k[0]=='-'){
        c=a-b;
    }
    printf("%d\n",c);
    return 0;
}

Measured memory_bytes: 128
a, b = map(lambda x: int(x) - 1, raw_input().split())
x = [['.'] * 100 for _ in xrange(100)]
for i in xrange(50, 100):
    for j in xrange(100):
        x[i][j] = '#'
for i in xrange(0, 50, 2):
    if b:
        for j in xrange(0, 100, 2):
            if b:
                x[i][j] = '#'
                b -= 1
for i in xrange(99, 49, -2):
    if a:
        for j in xrange(0, 100, 2):
            if a:
                x[i][j] = '.'
                a -= 1
print '\n'.join(['100 100'] + [''.join(_) for _ in x])


Measured memory_bytes: 2692
//??????????????¨?????????
process.stdin.resume();

process.stdin.setEncoding('utf8');
process.stdin.on('data', function (chunk) {
    const chunks = chunk.split(' ');
    var hight = parseInt(chunks[0]);
    var width = parseInt(chunks[1]);
    var areaOfRectanglar = hight * width;
    var lengthOfRectanglar = (hight + width) * 2;
    console.log(areaOfRectanglar, lengthOfRectanglar);
})

Measured memory_bytes: 15672
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define mex 1000005
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
//vector<int> adj[mex];
//a+b=a^b+2*(a&b)

int main(){
	fast
	ll a;
	cin>>a;
	cout<<(a+a*a+a*a*a);
	
}


Measured memory_bytes: 3648
import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int A = sc.nextInt();
   int B = sc.nextInt();
   int C = sc.nextInt();
   int D = sc.nextInt();
 
   if(B<=C || D<=A)System.out.println(0);
   else if(C<=A&& B<=D) System.out.println(B-A);
   else if(A<=C&& D<=B) System.out.println(D-C);
   else if(A<C&&B>C) System.out.println(B-C);
   else System.out.println(D-A);
 }
}

Measured memory_bytes: 23124
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		long n = long.Parse(Console.ReadLine());//long.Parseはstringをlongに変換。
    long[] nums = new long[4];//数字と、3,5,7の個数
    long answer = 0;

    for(int i = 0; i < 9; i++)//桁数
    {
      for(int j = 0; j < Math.Pow(3,i+1); j++)
      {
        int jj = j;
        long digit = 0;
        long memo = 1;
        for(int k = 0; k < 4; k++) nums[k] = 0;
        while(true)
        {
          if(jj % 3 == 0)
          {
            nums[0] += 3*memo;
            nums[1]++;
          }else if(jj % 3 == 1)
          {
            nums[0] += 5*memo;
            nums[2]++;
          }else if(jj % 3 == 2)
          {
            nums[0] += 7*memo;
            nums[3]++;
          }
          jj /= 3;
          digit++;
          memo *= 10;
          if(digit > i) break;
        }
        //Console.WriteLine(nums[0]);
        if(nums[0] <= n && nums[1] > 0 && nums[2] > 0 && nums[3] > 0) answer++;
      }
    }
    
		Console.WriteLine(answer);
	}
}

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

int main(){
    int n, m, a, b, ans = 0;
    cin >> n >> m;
    vector<int> high(n);
    vector<int> view(n,0);
    vector<vector<int>> road(m,vector<int>(2));
    for (int i = 0; i < n; i++) cin >> high.at(i);
    for (int j = 0; j < m; j++){
        cin >> a >> b;
        a--;
        b--;
        if(high.at(a) <= high.at(b)) view.at(a)++;
        if(high.at(b) <= high.at(a)) view.at(b)++;
    }

    for(int i = 0; i < n; i++){
        if (view.at(i) == 0) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 9520
# coding: utf-8

S = input().split()

N = int(S[0])
A = int(S[1])
B = int(S[2])

total = 0

for i in range(1, N+1):
    j = i
    dig = 0
    while i > 0:
        dig += i % 10
        i = int(i / 10)
    if dig >= A and dig <= B:
        total += j

print(total)


Measured memory_bytes: 67320
#include <iostream>
#include <cstdio>
#include <math.h>
#include <vector>





using namespace std;

typedef long long int ll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
const int MOD = 1000000007;
const int INF = INT_MAX;



int main(int argc, char const *argv[])
{
    int a, b;
    cin >> a >> b;

    cout << a+b/2 << endl;
    





    return 0;
}




//              g++ -std=c++1z  

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

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

int n,a[6010],nxt[6010],dp[6010][6010],add=0,ans=0;
vector <int> v;

int point(int i,int j,int k)
{
	return (v[i]==v[j]&&v[j]==v[k] ? 1:0);
}

void trans(int i,int j,int k)
{
	if(k>=v.size()) return;
	if(k==v.size()-1)
	{
		ans=max(ans,dp[i][j]+point(i,j,k));
		return;
	}
	//rep(a,3) for(int b=a+1;b<3;b++) dp[k+a][k+b]=max(dp[k+a][k+b],dp[i][j]+point(i,j,k+3-a-b));
	dp[k][k+1]=max(dp[k][k+1],dp[i][j]+point(i,j,k+2));
	dp[k][k+2]=max(dp[k][k+2],dp[i][j]+point(i,j,k+1));
	dp[k+1][k+2]=max(dp[k+1][k+2],dp[i][j]+point(i,j,k)); 
	
	dp[i][k]=max(dp[i][k],dp[i][j]+point(j,k+1,k+2));
	dp[i][k+1]=max(dp[i][k+1],dp[i][j]+point(j,k,k+2));
	dp[i][k+2]=max(dp[i][k+2],dp[i][j]+point(j,k,k+1));
	
	dp[j][k]=max(dp[j][k],dp[i][j]+point(i,k+1,k+2));
	dp[j][k+1]=max(dp[j][k+1],dp[i][j]+point(i,k,k+2));
	dp[j][k+2]=max(dp[j][k+2],dp[i][j]+point(i,k,k+1));
}

int main()
{
	cin>>n;
	repn(i,n*3) scanf("%d",&a[i]);
	v.pb(0);
	repn(i,n*3)
	{
		if(i+2<=n*3&&i%3==0&&a[i]==a[i+1]&&a[i+1]==a[i+2])
		{
			add++;
			i=i+2;
			continue;
		}
		v.pb(a[i]);
	}
	rep(i,6005) nxt[i]=-1;
	repn(i,v.size()-1)
	{
		for(int j=i+1;j<v.size();j++)
		{
			if(v[i]==v[j])
			{
				nxt[i]=j;
				break;
			}
		}
	}
	rep(i,6005) rep(j,6005) dp[i][j]=-1;
	dp[1][2]=0;
	repn(i,v.size()-1) for(int j=i+1;j<v.size();j++)
	{
		if(dp[i][j]==-1) continue;//cout<<i<<' '<<j<<' '<<dp[i][j]<<' '<<nxt[i]<<' '<<nxt[j]<<endl;
		ans=max(ans,dp[i][j]);
		trans(i,j,(j+3)/3*3);
		if(nxt[i]!=-1&&j/3*3<nxt[i]/3*3) trans(i,j,nxt[i]/3*3);
		if(nxt[j]!=-1&&j/3*3<nxt[j]/3*3) trans(i,j,nxt[j]/3*3);
	}
	cout<<ans+add<<endl;//cout<<ans<<endl;
	//rep(i,v.size()) cout<<v[i]<<' ';
	return 0;
}
/*
5
1 5 2 1 3 3 1 1 5 4 4 4 4 4 3 
*/

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

#define ll long long

// GCD, LCM
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main()
{
    int N,Y;
    cin>>N>>Y;

    for(int i=0;i<=N;i++){
        for(int j=0;j<=N;j++){
            if((i+j)<=N){
                int k = N-i-j;
                int temp = 10000*i+5000*j+1000*k;

                if(temp==Y){
                    cout<<i<<" "<<j<<" "<<k<<endl;
                    return 0;
                }
            }

        }
    }

    cout<<"-1 -1 -1"<<endl;

    return 0;
}

Measured memory_bytes: 256
import itertools

n,k=map(int,input().split())
a=list(map(int,input().split()))
mod=10**9+7
ans=0
a.sort()
a=list(itertools.accumulate(a))
pin=0


lst=[1,1]
for i in range(2,n+10):
  lst.append((lst[-1]*i)%mod)

def combinations(n,r):
  xxx=lst[n]
  xxx*=pow(lst[n-r],mod-2,mod)
  xxx%=mod
  xxx*=pow(lst[r],mod-2,mod)
  xxx%=mod

  return xxx

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


for i in range(n-k+1):
  pin+=1
  now=n-k+1-i
  ans+=(a[-1]-a[-now-1]-a[now-1])*combinations(pin+k-3,k-2)
  ans%=mod


print(ans)

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

int main()
{
    int H, W;
    cin >> H >> W;
    vector<vector<char>> A(H, vector<char>(W));
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            cin >> A.at(i).at(j);
        }
    }
    for (int i = 0; i < H + 2; i++)
    {
        if (i == 0 || i == H + 1)
        {
            for (int j = 0; j < W + 2; j++)
            {
                cout << '#';
            }
        }
        else
        {
            for (int j = 0; j < W + 2; j++)
            {
                if (j == 0 || j == W + 1)
                {
                    cout << '#';
                }
                else
                {
                    cout << A.at(i - 1).at(j - 1);
                }
            }
        }
        cout << endl;
    }
}

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

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

    if (a == 1)
        a = 14;
    if (b == 1)
        b = 14;
    
    if (a > b)
        cout << "Alice" << endl;
    else if (a == b)
        cout << "Draw" << endl;
    else
        cout << "Bob" << endl;
    return 0;
}

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

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define repi(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define uniqueV(x)                                                             \
  sort(x.begin(), x.end());                                                    \
  x.erase(unique(x.begin(), x.end()), x.end());
#define debug(x) cerr << #x << ": " << x << '\n'
#define debug2(x, y)                                                           \
  cerr << "(" << #x << ", " << #y << ") = "                                    \
       << "(" << x << ", " << y << ")" << '\n'

typedef long long int ll;
typedef pair<int, int> P;

const long long INF = 3e18 + 12;
const int inf = 1e9;

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

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

  int x, y;
  cin >> x >> y;

  debug(y - 2 * x);
  if ((y - 2 * x) % 2 == 0 && (y - 2 * x) >= 0) {
    int b = (y - 2 * x) / 2;
    debug(b);
    debug(x - b);
    if (x - b >= 0) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 3636
fun main(args : Array<String>) {
    val list = mutableListOf<String>()

    do {
        val line = readLine()
        if (line != null) {
            list.add(line)
        } else {
            break
        }
    } while (true)

    list.map { requireNotNull(it) }.let {
        val result= CanYouSolveThis().exec(*it.toTypedArray())
        println(result)
    }
}

class CanYouSolveThis {
    fun exec(vararg args : String) : String{
        val nmc = args[0].split(" ").let {
            Triple(it[0], it[1], it[2])
        }

        val b = args[1].split(" ")

        return (2 until args.size).map {position ->
            val a = args[position].split(" ")
            val result = a.zip(b).map {
                it.first.toInt() * it.second.toInt()
            }.sum() + nmc.third.toInt()

            result > 0
        }.count { it }.toString()
    }
}

Measured memory_bytes: 37872
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    String str;
    char[] ch;
    int i, n, m;
    int[] count;
    char c;

    count = new int[26];

    for(;sc.hasNextLine();){
      str = sc.nextLine();
      m = str.length();
      ch = new char[m];
      for(i = 0;i < m;i++){
        ch[i] = str.charAt(i);
        if(ch[i] >= 'a' && ch[i] <= 'z'){
          ch[i] -= 'a' - 'A';
        }
        if(ch[i] >= 'A' && ch[i] <= 'Z'){
          count[ch[i] - 'A']++;
        }
      }

    }

    for(i = 0;i < 26;i++){
      c = (char)('a' + i);
      System.out.println(c + " : " + count[i]);
    }


    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

Measured memory_bytes: 17348
//Radhe Radhe
#include<bits/stdc++.h>
#define godspeed  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define mod 1000000007 //1e9+7
#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i,n)    for(ll i=0; i<n; i++)
#define rep1(i,a,b)    for(ll i=a; i<b; i++)
#define repV(i,n)    for(ll i=0; i<v.size(); i++)
#define fixed cout.setf(ios::fixed);
#define Precise cout.precision(7);
#define yes cout<<"Yes"<<'\n';
#define no cout<<"No"<<'\n';
using namespace std;

int main()
{
    godspeed
    ll  i,j,n,k,x;
    cin>>n;
    vector<ll> v(n+1,0);
    rep1(i,1,105)
    rep1(j,1,105)
    rep1(k,1,105)
    {
        ll nn=i*i+j*j+k*k+i*j+j*k+k*i;
        if(nn<=n)
            v[nn]++;
    }
    rep1(i,1,n+1)
    {

        cout<<v[i]<<endl;
    }
    return 0;
}


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

int main() {
    string s;
    cin >> s;
    bool y=true;
    for (int i=0; i<s.size(); i++)
    {  
        if (i%2==0 && s[i] == 'L')
        {
            y = false;
            break;
        }
        else if (i%2==1 && s[i] == 'R')
        {
            y = false;
            break;
        }
    }
    if (y == true) cout << "Yes";
    else cout << "No";

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main{
	static IntStream REPS(int v){return IntStream.range(0,v);}
	static IntStream REPS(int l,int r){return IntStream.rangeClosed(l,r);}
	static IntStream INS(int n) {return REPS(n).map(i->getInt());}
	static Scanner s=new Scanner(System.in);
	static int getInt(){return Integer.parseInt(s.next());}
	public static void main(String[]$){
		int n=getInt();
		long l=1;
		for(int i=0;i<n;++i) {
			l=lcm(l,s.nextLong());
		}
		System.out.println(l);
	}
	public static long gcd(long a, long b) {
		return b == 0 ? a : gcd(b, a % b);
	}
	public static long lcm(long a, long b) {
		return a/gcd(a,b)*b;
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
//#define int long long  
int main(){
	int Q,H,S,D,N;
	long long answer=0;
	cin >> Q >> H >> S >> D >> N;
    int one =min({4*Q,2*H,S});
	long long int two = min((2*one),D);
	answer=N/2 *two;
	if(N%2==1){answer+=one;}
	//cout << one << " " << two << endl;
	cout << answer << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int main(int argc, char const *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k;
  int ans = 0;
  bool notlike[10] = {false};
  int t;
  cin >> n >> k;
  for (int i = 0; i < k; ++i) {
    cin >> t;
    notlike[t] = true;
  }
  while (true) {
    int tmp = n;
    while (true) {
      if (tmp == 0) {
        cout << n << "\n";
        return 0;
      }
      if (notlike[tmp % 10])break;
      tmp /= 10;
    }
    n++;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using P = pair<ll, ll>;
const long double PI = acos(-1.0L);
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }


int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll ch1 = a*c;
    ll ch2 = a*d;
    ll ch3 = b*c;
    ll ch4 = b*d;
    ll ans = max({ch1, ch2, ch3, ch4});
    cout << ans << endl;
}

Measured memory_bytes: 3580
n = int(input())
a = list(map(int,input().split()))
s1 = []
s2 = []
for i in range(n):
  if i % 2 == 0:
    s1.append(a[i])
  else:
    s2.append(a[i])

if n % 2 == 0:
  for x in list(reversed(s2)) + s1:
    print(x, end=' ')
else:
  for x in list(reversed(s1)) + s2:
    print(x, end=' ')
print()

Measured memory_bytes: 26184
using System;
using static System.Console;
using static System.Math;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TemplateAlgorithm
{
    class Program
    {
        public const long Inf = (long)1e18;
        public const double eps = 1e-6;
        public const string alfa = "abcdefghijklmnopqrstuvwxyz";
        public const string ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        public const int MOD = 1000000007;
        
        // c ot i
        static int ToInt(char c) => c - '0';

        static void Main(string[] args)
        {
            int K, S;
            int[] data = IO.ReadIntArr();
            K = data[0];
            S = data[1];

            int comb = 0;
            for (var x = 0;  x <= K; x++)
            {
                for (var y = 0; y <= K; y++)
                {
                    int z = S - x - y;
                    if (0 <= z && z <= K) comb++;
                }
            }
            WriteLine(comb);
        }

        #region  範囲

        public static bool InRange<T>(T begin, T end, T value) where T : IComparable<T> 
            => value.CompareTo(begin) >= 0 && value.CompareTo(end) <= 0;

        #endregion

        #region MIN,MAX

        /// <summary>
        /// 最大値を返す
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="vals"></param>
        /// <returns></returns>
        public static T MaxValue<T>(params T[] vals) => vals.Max();

        /// <summary>
        /// 最小値を返す
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="vals"></param>
        /// <returns></returns>
        public static T MinValue<T>(params T[] vals) => vals.Min();
        #endregion
    }

    #region IO

    /// <summary>
    /// IO
    /// </summary>
    public class IO
    {
        public static string ReadStr(bool isTrim = false) => (isTrim) ? ReadLine().Trim() : ReadLine();
        public static int ReadInt() => int.Parse(ReadStr());

        public static long ReadLong() => long.Parse(ReadStr());

        public static decimal ReadDecimal() => decimal.Parse(ReadStr());
        public static double ReadDouble() => double.Parse(ReadStr());
        public static string[] ReadStrArr(char separator = ' ') => ReadLine().Split(separator);
        public static int[] ReadIntArr() => Array.ConvertAll(ReadStrArr(), int.Parse);
        public static long[] ReadLongArr() => Array.ConvertAll(ReadStrArr(), long.Parse);

        public static decimal[] ReadDecimalArr() => Array.ConvertAll(ReadStrArr(), decimal.Parse);
        public static double[] ReadDoubleArr() => Array.ConvertAll(ReadStrArr(), double.Parse);        
    }

    #endregion    
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
const int maxn = 100005;
int a[maxn];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    long long ans = 0, sum;
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = 1; i < n; i++){
        int l = 0, r = n - 1;
        sum = 0;
        while(r > i && (l < r || r % i))
            ans = max(ans, sum += a[l] + a[r]), l += i, r -= i;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
#define long int64_t

int main() {
	ios_base::sync_with_stdio( false );

	vector<pair<int, bool>> A( 9 );
	for( int i = 0; i < 9; ++i ) { cin >> A[i].first; }

	int N;
	cin >> N;
	for( int i = 0; i < N; ++i ) {
		int b;
		cin >> b;

		for( int j = 0; j < 9; ++j ) {
			if( A[j].first == b ) { A[j].second = true; }
		}
	}

	bool ans = false;
	if( A[0].second && A[1].second && A[2].second ) { ans = true; }
	if( A[3].second && A[4].second && A[5].second ) { ans = true; }
	if( A[6].second && A[7].second && A[8].second ) { ans = true; }
	if( A[0].second && A[3].second && A[6].second ) { ans = true; }
	if( A[1].second && A[4].second && A[7].second ) { ans = true; }
	if( A[2].second && A[5].second && A[8].second ) { ans = true; }
	if( A[0].second && A[4].second && A[8].second ) { ans = true; }
	if( A[2].second && A[4].second && A[6].second ) { ans = true; }

	cout << (ans ? "Yes" : "No") << endl;

	return 0;
}


Measured memory_bytes: 256
N = int(input())

V_list_str = input().split()
V_list_int = list(map(int,V_list_str))
C_list_str = input().split()
C_list_int = list(map(int,C_list_str))

max = 0
div_list = []

for i in range(N):
    div_list.append(V_list_int[i]-C_list_int[i])
    if div_list[i] > 0:
        max += div_list[i]

print(max)  

Measured memory_bytes: 3064
use std::cmp::min;

fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let s: String = read(&mut stdin_lock, &mut buf, b'\n');
    let cv: Vec<char> = s.chars().collect();

    let mut c1 = 0; // 0101...
    let mut c2 = 0; // 1010...
    for i in 0..cv.len() {
        if i % 2 == 0 {
            if cv[i] == '0' {
                c2 += 1;
            } else {
                c1 += 1;
            }
        } else {
            if cv[i] == '0' {
                c1 += 1;
            } else {
                c2 += 1;
            }
        }
    }
    let ans = min(c1, c2);
    println!("{}", ans);
}


Measured memory_bytes: 4352
import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));

        int n = Integer.parseInt(bf.readLine());
        String[] s = new String[n];
        for(int i=0; i<n; i++) {
          char[] t = bf.readLine().toCharArray();
          Arrays.sort(t);
          s[i] = new String(t);
        }
        Arrays.sort(s);
        long count = 1;
        long ans = 0;
        for(int i=1; i<n; i++) {
          if(s[i].equals(s[i-1])) count++;
          else {
            ans += count*(count-1)/2;
            count=1;
          }
        }
        ans += count*(count-1)/2;
        out.println(ans);
        // StringTokenizer st = new StringTokenizer(bf.readLine());
        // int[] a = new int[n]; for(int i=0; i<n; i++) a[i] = Integer.parseInt(st.nextToken());
        // int n = Integer.parseInt(st.nextToken());

        out.close(); System.exit(0);
    }
}


Measured memory_bytes: 48604
def dfs(t):
    if 0 not in already:
        return 1
    allReach=0
    for i in range(n):
        if connect[t][i]==1 and already[i]==0:
            already[i]=1
            allReach+=dfs(i)
            already[i]=0
    return allReach

n,m=map(int,input().split())
connect=[[0 for i in range(n)]for j in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    connect[a-1][b-1]=1
    connect[b-1][a-1]=1
already=[0 for i in range(n)]
already[0]=1
print(dfs(0))


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;cin>>a>>b>>c;
  int k;cin>>k;
  int tmp=0;
  while(b<=a){
    b*=2;
    tmp++;
  }
  int tmp2=0;
  while(c<=b){
    c*=2;
    tmp2++;
  }
  if(k>=tmp+tmp2){cout <<"Yes"<<endl;return 0;}
  cout <<"No"<<endl;
}

Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int a[n+1];
  for(int i=0;i<n;i++)cin>>a[i];
  int sum = 0;
  for(int i=0;i<n;i++){
  	for(int j=i+1;j<n;j++){
    	sum += a[i]*a[j];
    }
  }
  cout << sum << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n,mod=1e9+7;
  string s,t;
  cin >> n >> s >> t;
  map<char,int> mp;
  mp[s[0]]++;
  for(int i=1;i<n-1;i++){
    mp[s[i]]+=mp[t[i]];
    mp[s[i]]%=mod;
  }
  cout << mp[t[n-1]] << endl;
  return 0;
}


Measured memory_bytes: 3320
import std.stdio, std.string, std.conv, std.range, std.algorithm;

void main() {
	auto _n = readln;
	string[] n, d = [];
	foreach (string l; lines(stdin)) n ~= l.chomp;
	
	["S", "H", "C", "D"].each!(_s => iota(1, 14).each!(_i => d ~= "%s %d".format(_s, _i)));
	auto r = d.filter!(a => !n.canFind(a));
	r.each!(a => a.writeln);
}

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

using namespace std;

long long int zet(long long int n){
  if(n<0) n=-n;
  return n;}
  

int main(){
  long long int n,kosu;
  cin>>n>>kosu;
  
  long long int oika=-1;
  long long int p=-1;
  long long int j=0;
  long long int r[n];
  for(long long int i=0;i<n;i++){
    cin>>r[i];}
  
  
  while(p<0){
    p=r[j];
    oika++;
    j++;}

  
  long long int answer=5000000000;
  for(long long int i=0;i<kosu-1;i++){
    if(oika-1-i<0 || oika+kosu-i-2>=n)continue;
    answer=min(2*min(zet(r[oika-1-i]),r[oika+kosu-i-2])+max(zet(r[oika-1-i]),r[oika+kosu-i-2]),answer);
  }

  if(oika>=kosu){answer=min(zet(r[oika-kosu]),answer);}
  if(oika+kosu<=n){answer=min(r[oika+kosu-1],answer);}
  
  cout<<answer<<endl;

 
}


Measured memory_bytes: 1024
import sys
import copy
from collections import deque
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, h = na()
ab = [na() for i in range(n)]

attack = []
for p in ab:
    attack.append([p[0], 0])
    attack.append([p[1], 1])

attack.sort(reverse=True)

cnt = 0
for a in attack:
    if a[1]==1:
        cnt += 1
        h -= a[0]
    else:
        cnt += h//a[0] if h%a[0]==0 else h//a[0] + 1
        h = 0
    if h <= 0:
        break

print(cnt)


Measured memory_bytes: 79968
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long int ll;
typedef vector<pair<ll,ll> > Q;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(int)(n);i++)

 int main()
 {
   int a,b,c;
   cin>>a>>b>>c;

   if(a==b && b==c) cout<<"Yes";
   else cout<<"No";

   cout<<endl;
 }

Measured memory_bytes: 256
from math import log2,floor
L = int(input())
ans = []

r = floor(log2(L))

for i in range(r):
    ans.append('{} {} {}'.format(i+1,i+2,0))
    ans.append('{} {} {}'.format(i+1,i+2,2**i))

for t in range(r-1,-1,-1):
    if 2**r <= L-2**t:
        ans.append('{} {} {}'.format(t+1,r+1,L-2**t))
        L -= 2**t

print('{} {}'.format(r+1,len(ans)))
for s in ans:
    print(s)

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


using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)
typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

const int  INF = 1 << 29;
const ll INFL = 1LL << 60;
const ll mod = 998244353;
#define VQ vector<priority_queue<pair<ll,vector<int>>>>
#define VQQ vector<vector<pair<ll,vector<int>>>>


int main() {


	int n;
	cin >> n;
	VI v(n);
	REP(i, n)v[i] = i;
	vector<double> x(n), y(n);
	REP(i, n)cin >> x[i] >> y[i];

	double ans = 0;
	double cnt = 0;
	do {
		cnt += 1;
		double tmp = 0;
		REP(i, n - 1) {
			ans += sqrt(((x[v[i + 1]] - x[v[i]])*(x[v[i + 1]] - x[v[i]])) + ((y[v[i + 1]] - y[v[i]])*(y[v[i + 1]] - y[v[i]])));
		}
	} while (next_permutation(ALL(v)));

	ans /= cnt;
	cout << fixed << setprecision(15) << ans << endl;

}


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

int main() {
    //
    int num;
    int l = 0;
    int r = 0;
    int Min = 99999;

    cin >> num;

    vector<int> vec(num);
    for (int i = 0; i < num; i++) {
        cin >> vec.at(i);
        r += vec.at(i);
    }

    Min = r;
    for (int i = 0; i < num; i++) {
        l += vec.at(i);
        r -= vec.at(i);

        Min = min(Min, abs(l - r));
    }

    cout << Min;
    //
}


Measured memory_bytes: 3596
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int a = sc.nextInt();
      int b = sc.nextInt();
      if((b-a)%2==0)System.out.println("Alice");
      else System.out.println("Borys");
    } 
}


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

using namespace std;

typedef long long LL;

const int maxn=100005;
const int INF=0x3f3f3f3f;

int cnt[maxn];

int main()
{
	int n,x;
	int MAX=0,MIN=INF;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&x);
		MAX=max(x,MAX);MIN=min(x,MIN);
		cnt[x]++;
	}
	if(MAX-MIN>1||(cnt[n-1]!=2&&cnt[n-1]!=n&&cnt[n-1])||(cnt[1]!=n&&cnt[1]>1)||(MAX==MIN&&MAX!=1&&MAX!=n-1&&n/MAX<2)||(MAX!=MIN&&((n-cnt[MIN])/(MAX-cnt[MIN])<2)))puts("No");
	else puts("Yes");
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<functional>
#include<string>
#include<cstring>
#include<array>
#include<iomanip>
#include<list>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<bitset>
#include <queue>
#include<boost/multiprecision/cpp_int.hpp>



using namespace std;
using namespace boost::multiprecision;

using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldb = long double;

#define REP(i,a,b) for(ll i = a; i < b; ++i)
#define PRI(s) cout << s << endl
#define PRIF(v, n) printf("%."#n"f\n", v)
#define PRIY PRI("Yes")
#define PRIN PRI("No")
template<typename A, typename B>
void mins(A& a, const B& b) { a = min(a, (A)b); };
template<typename A, typename B>
void maxs(A& a, const B& b) { a = max(a, (A)b); };


struct node {
	int id;
	unordered_set<int> link;
	unordered_map<int, int> dp;
};
ll N;
vector<node> nod;

ll f(int ind, int par) {
	ll sum = 1;
	for (int c : nod[ind].link) {
		if (c == par)continue;
		nod[ind].dp[c] = f(c, ind);
		sum += nod[ind].dp[c];
	}
	if (par != -1) {
		nod[ind].dp[par] = N - sum;
	}
	return sum;
}



//拡張ユークリッドの互除法。戻り値は最大公約数、x,yはax+by=gcd(a,b)を満たす組の一つ
long long gcdext(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long g = gcdext(b, a % b, y, x);
	y -= a / b * x;
	return g;
}

//モジュラ逆数
long long modinv(long long a, long long mod) {
	long long x, y;
	gcdext(a, mod, x, y);
	x = ((x % mod) + mod) % mod;
	return x;
}
ll modpow(ll r, ll n, ll mod) {
	ll ans = 1;
	ll tmp = r;
	while (n > 0) {
		if ((n & 1) > 0) {
			ans = ans * tmp % mod;
		}
		tmp = tmp * tmp % mod;
		n >>= 1;
	}
	return ans;
}

int main() {
	cin >> N;
	nod.resize(N);
	REP(i, 0, N)nod[i].id = i;
	REP(i, 0, N - 1) {
		int a, b;
		cin >> a >> b;
		--a; --b;
		nod[a].link.insert(b);
		nod[b].link.insert(a);
	}
	f(0, -1);
	ll sum = 0;
	ll mod = 1e9 + 7;
	REP(i, 0, N) {
		ll tmp = modpow(2, N - 1, mod) - 1;
		for (int c : nod[i].link) {
			tmp -= (modpow(2,nod[i].dp[c],mod) - 1);
		}
		sum += tmp;
	}
	sum = (sum % mod + mod) % mod;
	ll ans = (sum * modinv(modpow(2, N, mod), mod) % mod + mod) % mod;
	PRI(ans);
	return 0;
}


Measured memory_bytes: 73560