akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder.Abc
{
    internal class QuestionB
    {
        public static void Main(string[] args)
        {
            // 整数の入力
            int n = int.Parse(Console.ReadLine());

            // 整数配列の入力
            var dArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i));

            if (dArray.ElementAt(0) != 0)
            {
                Console.WriteLine(0);
                return;
            }

            Dictionary<int, int> dic = new Dictionary<int, int>();

            int max = -1;
            foreach (var d in dArray)
            {
                if (dic.ContainsKey(d))
                {
                    dic[d]++;
                }
                else
                {
                    dic.Add(d, 1);
                }
                if (max < d)
                {
                    max = d;
                }
            }

            if (dic[0] != 1)
            {
                Console.WriteLine(0);
                return;
            }

            long result = 1;

            for (int i = 1; i <= max; i++)
            {
                if (dic.ContainsKey(i) == false)
                {
                    Console.WriteLine(0);
                    return;
                }

                for(int j = 0; j < dic[i]; j++)
                {
                    result *= dic[i - 1];
                    if (result >= 998244353)
                    {
                        result %= 998244353;
                    }
                }
            }

            Console.WriteLine(result %= 998244353);
        }
    }
}


Measured memory_bytes: 22496
judge_int :: Integer -> Integer -> String
judge_int a b
    | a > b     = "a > b"
    | a < b     = "a < b"
    | otherwise = "a == b"

main = do
    given_str <- getLine
    let ab = (map read . words) given_str
    putStrLn(judge_int (head ab) (last ab))

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define int long long
#define uint unsigned int
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) ((int)(a).size())
#define PB(a) push_back(a)
#define EMP emplace
#define EMPB(...) emplace_back(__VA_ARGS__)
#define MP(a, b) make_pair(a, b)
#define MT(...) make_tuple(__VA_ARGS__)
#define Bit(n) (1LL << (n))
using namespace std;
using pii = pair<int, int>;
template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
const int MOD = 1000000007;
const int INF = 1LL << 30;
const double EPS = 1e-10;

int N, H, W;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N >> H >> W;
  cout << ((N-H+1)*(N-W+1)) << endl;

  return 0;
}

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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

struct UFTree {
    static const int MAX_N = 1e6;
    int p[MAX_N], r[MAX_N], s[MAX_N];

    UFTree(int n) : p(), r(), s() {
        for(int i = 0; i < n; ++i) {
            p[i] = i;
            r[i] = 0;
            s[i] = 1;
        }
    }

    int root(int x) {
        return p[x] == x ? x : p[x] = root(p[x]);
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }

    void unite(int x, int y) {
        x = root(x);
        y = root(y);
        if(x == y) return;

        if(r[x] < r[y]) {
            p[x] = y;
            s[y] = s[x] + s[y];
        } else {
            p[y] = x;
            s[x] = s[x] + s[y];
            if(r[x] == r[y]) r[x]++;
        }
    }

    int size(int x) {
        return s[root(x)];
    }
};


int n, m;
string s;

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

    UFTree t = UFTree(n);

    V<Pii> v(m);
    REP(i, m) {
        int a, b;
        cin >> a >> b;
        v[i] = {a, b};
    }

    Vl res(m);
    RREP(i, m-1, 0) {
        int a = v[i].first, b = v[i].second;
        if (t.same(a, b)) {
            res[i] = 0;
        } else {
            res[i] = t.size(a) * t.size(b);
        }
        t.unite(a, b);
    }

    ll cnt = 0;
    FOR(i, res) {
        cnt += *i;
        std::cout << cnt << '\n';
    }


    return 0;
}


Measured memory_bytes: 14592
l = input()
mod = 10**9+7

n = len(l)

dp = [[0]*2 for i in range(n)]

dp[0][0] = 1
dp[0][1] = 2

for i in range(1,n):
    dp[i][0] = dp[i-1][0]*3
    if l[i]=='1':
        dp[i][0] += dp[i-1][1]
        dp[i][1] = dp[i-1][1]*2
    else:
        dp[i][1] = dp[i-1][1]

    dp[i][0] %= mod
    dp[i][1] %= mod

ans = dp[n-1][0]+dp[n-1][1]
print(ans%mod)


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

int main() {
    int N;
    cin >> N;
    for (int i = 1; i < 10; i++)
    {
        if (N % i == 0 && N / i < 10)
        {
            cout << "Yes" << endl;
            return 0;
        }
        
    }
    cout << "No" << endl;
    
  return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
a = set([int(input()) for i in range(M)])
count = [0 for i in range(N)]
mod = 10**9 + 7

for i in range(N):
    if i+1 not in a:
        if i+1 == 1:
            count[i] += 1
        elif i+1 == 2:
            count[i] += count[0] + 1
        else:
            count[i] += count[i-1] + count[i-2]

print(count[-1] % mod)

Measured memory_bytes: 462744
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
	"strconv"
)

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	return sc
}

func main() {
	sc = initScanner(os.Stdin)
	fmt.Println(resolve(parseProblem()))
}

func parseProblem() int {
	n, x := scanInt(sc), scanInt(sc)
	xs := make([]int, n+1)
	for i := 0; i < n; i++ {
		xs[i] = scanInt(sc)
	}
	xs[n] = x
	sort.Sort(sort.IntSlice(xs))
	df := xs[1] - xs[0]
	for i := 1; i < n; i++ {
		v := xs[i+1] - xs[i]
		df = gcd(df, v)
	}
	return df
}

func gcd(a, b int) int {
	for b > 0 {
		t := a / b
		a, b = b, a-t*b
	}
	return a
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	a, _ := strconv.Atoi(sc.Text())
	return int(a)
}

func nextString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func nextIntSlice(sc *bufio.Scanner, n int) (a []int) {

	a = make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = nextInt(sc)
	}
	return a
}

func resolve(n int) int {
	return n
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 4316
//dhruv
#include<bits/stdc++.h>
using namespace std;
 
#define int long long
#define ll long long
#define ffor(i,n) for(int i = 0;i < (n); ++i)
#define fro(i,j,n) for(int i = (j);i < (n); ++i)
#define all(v) v.begin(),v.end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vpii vector<pii>
#define ff first
#define ss second
const int mod = 1e9 + 7;
 
template<typename T>
T binpow(T a,T b,T mod){
	T res = 1;
	while(b){
		if(b&1){
			res = (res*a)%mod;
		}
		b /= 2;
		(a *= a) %= mod;
	}
	return res;
}
 
 
template<typename T>
T binpow(T a,T b){
	T res = 1;
	while(b){
		if(b&1){
			res = (res*a);
		}
		b /= 2;
		a *= a;
	}
	return res;
}
 
template<typename T>
T add(T a,T b){
	return (a + b)%mod;
}
template<typename T>
T sub(T a,T b){
	return add(a,mod - b);
}
template<typename T>
T mul(T a,T b){
	return (a*b)%mod;
}

int make_int(string s){
	int x = 0;
	reverse(s.begin(),s.end());
	string tmp = s;
	for(int i = 0;i < s.length(); ++i){
		x *= 10;
		x += (int)(tmp.back() - '0');
		tmp.pop_back();
	}
	return x;
}
 
string make_string(int s){
	string x;
	while(s){
		x.push_back(char(s%10 + '0'));
		s /= 10;
	}
	reverse(x.begin(),x.end());
	return x;
}


const int inf = 1e18 + 5;

signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n,k;
	cin >> n >> k;
	int a[n];
	ffor(i,n){
		cin >> a[i];
	}
	int cnt = 0;
	int s = 1;
	while(s < n){
		s += (k - 1);
		cnt++;
	}
	cout << cnt;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep_1(i, n) for (int(i) = 0; (i) <= (n); (i)++)
#define rep_2(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {
  double r;
  cin >> r;

  cout << 2 * M_PI * r << endl;

  return 0;
}

Measured memory_bytes: 3752
/**
 *  Square Route (Problem D, Practice Contest for Japan Domestic, 2007-06-24)
 *  by Kenji Inoue, 2007-06-28
 **/

#include <iostream>
#include <vector>

using namespace std;

int main() {
  int h[1501], w[1501];

  int N, M;
  while (cin >> N >> M, (N || M)) {
    for (int i=0; i<N; i++) {
      int t; cin >> t; h[i] = t;
    }
    for (int i=0; i<M; i++) {
      int t; cin >> t; w[i] = t;
    }

    vector<int> V(1500001), H(1500001);
    for (int i=0; i<N; i++) {
      int len = 0;
      for (int j=i; j<N; j++) {
        len += h[j];
        V[len]++;
      }
    }
    for (int i=0; i<M; i++) {
      int len = 0;
      for (int j=i; j<M; j++) {
        len += w[j];
        H[len]++;
      }
    }

    int count = 0;
    for (int i=1; i<=1500000; i++) {
      count += V[i] * H[i];
    }
    cout << count << endl;
  }

  return 0;
}

Measured memory_bytes: 12000
#include <iostream>
using namespace std;
int max(int a,int b){
    return a>b?a:b;
}
int min(int a,int b){
    return a<b?a:b;
}

int main(void){
    int N;
    cin >> N;
    int A[N];
    for(int i=0;i<N;i++)cin>>A[i];
    
    long long money = 1000;
    long long stock = 0;
    
    for(int i=1;i<N;i++){
        if(A[i-1] < A[i]){
            stock = money / A[i-1];
            money += stock*(A[i] - A[i-1]);
        }
    }
    cout << money << endl;
}


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

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

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

int main() {
  long long a,b,c,d;
  cin>>a>>b>>c>>d;
  long long k=lcm(c,d);
  long long kotae=0;
  kotae=b-a+1-(b/c-a/c)-(b/d-a/d)+(b/k-a/k);
  if(a%c==0||a%d==0)kotae--;
  cout<<kotae<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main
{
	public static void main(String args[])
	{
        Scanner sc=new Scanner(System.in);
        
        int x=sc.nextInt();
        int a=sc.nextInt();

        if(x<a){
            System.out.println('0');
        }
        else{
            System.out.println("10");
        }
    }
}

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

#define no std::cout << "No"
#define yes std::cout << "Yes"

int main() {
    int a, b;
    std::string input;
    std::cin >> a >> b >> input;

    if(input.size() != a + b + 1){
        no;
        return 0;
    }

    if(input[a] != '-'){
        no;
        return 0;
    }else{
        input[a] = '0';
    }

    for(auto block : input){
        if(block == '-'){
            no;
            return 0;
        }
    }

    yes;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<functional>
using namespace std;
int main()
{
	long long N, A, B, C, D, E, min, an = 4;
	scanf("%lld%lld%lld%lld%lld%lld", &N, &A, &B, &C, &D, &E);
	min = A;
	if (B < min) min = B;
	if (C < min) min = C; 
	if (D < min) min = D; 
	if (E < min) min = E; 
	if (N % min == 0) {
		an += N / min;
	}
	else {
		N -= N % min;
		N += min;
		an += N / min;
	}
	printf("%lld", an);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//(a+b-1)/b

signed main(){
	string s; cin>>s;
	int ans=0;
	rep(i,0,s.size())if(s[i]=='1')ans++;
	cout<<ans<<endl;
	return 0;
}

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

#define int long long
struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
using intpair = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((int)((a) + (b) - 1)/(int)(b))

int f(string s){
    int ret = 0;
    for(char c: s) ret += c - '0';
    return ret;
}

signed main(){
    int n, a, b;
    cin >> n >> a >> b;
    int ans = 0;
    reps(i,1,n){
        int t = f(to_string(i));
        if(a <= t && t <= b) ans += i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <set>
#include <cstdlib> 
using namespace std;
set<int>s;
int n,a;
int main(){
	cin>>n;
	while (n--){cin>>a;
	s.insert(a);
	}
	cout<<s.size();
	return 0;	
}


Measured memory_bytes: 256
from itertools import permutations
N = int(input())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
count = 0
a,b = 0,0
for i in permutations([j+1 for j in range(N)],N):
  count += 1
  if list(i) == P:
    a = count
    if list(i) == Q:
      b = count
      break
  elif list(i) == Q:
    b = count
  else:
    continue
print(abs(a-b))

Measured memory_bytes: 9200
#include<bits/stdc++.h>
#define ff first
#define ss second
#define INF (int)2e9
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

int main(void){
	ios::sync_with_stdio(false); cin.tie(NULL);
	string s; cin>>s;
	string t; cin>>t;
	int ans=0;
	for(int i=0;i<3;i++){
		if(s[i]==t[i]) ans++;
	}
	cout<<ans;
	return 0;
}

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

using namespace std;

typedef long long ll;

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  ll N, K; cin >> N >> K;
  ll cnt = 0;
  if(K == 0){
    cout << N*N << endl;
  }else{
    for(ll b=1;b<=N;b++){
      cnt += max(0LL, (N / b) * (b - K)) + max(0LL, N %b - K + 1);
    }
    cout << cnt << endl;
  }
}

Measured memory_bytes: 256
/// kAAzuki Hoshino
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple

int n,adj[701][701],m,color[701],c[3];
vi dp(702,0);
vpi v;

void dfs(int s, int col){
    if(color[s]!=-1){
        if(color[s]!=col){
            cout << -1 << endl;
            exit(0);
        }
        return ;
    }
    color[s]=col;
    c[col]++;
    for(int i=1;i<=n;i++)if(adj[s][i])dfs(i, col^1 );
}

signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);

cin >> n >> m;
for(int i=1;i<=n;i++){
    color[i]=-1;
    for(int j=1;j<=n;j++)if(i!=j)adj[i][j]=1;
}
for(int i=1;i<=m;i++){
    int x,y;
    cin >> x >> y;
    adj[x][y]=0;
    adj[y][x]=0;
}

for(int i=1;i<=n;i++){
    if(color[i]==-1){
        c[0]=0;c[1]=0;
        dfs(i,0);
        v.pb({c[0],c[1]});
    }
}
dp[0]=1;
for(auto t:v){
    vi ndp(701,0);
    for(int i=0;i<=n;i++){
        if(dp[i]){
            ndp[t.fs+i]=1;
            ndp[t.sc+i]=1;
        }
    }
    dp = ndp;
}
int ans = 1e18;
for(int i=0;i<=n;i++){
    if(dp[i]){
        int t = n-i;
        ans = min( i*(i-1)/2 + t*(t-1)/2 , ans );
    }
}
cout << ans << endl;

return 0;
}
///....


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

using namespace std;
using ll = long long;

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

  ll cur = 1;
  while (cur * (cur + 1) / 2 < x) {
    cur++;
  }

  cout << cur << '\n';
  return 0;
}

Measured memory_bytes: 3624
import itertools
n = int(input())
pl = list(map(int,input().split()))
ql = list(map(int,input().split()))
li = [i for i in range(1,n+1)]
it = list(itertools.permutations(li, n))
a = 0
b = 0
for i,t in enumerate(it):
    #print(i,list(t))
    if list(t) == pl:
        a = i
    if list(t) == ql:
        b = i
print(abs(a-b))

Measured memory_bytes: 46192
N,K = list(map(int,input().split()))
x = list(map(int,input().split()))

d_min = 2*(x[N-1]-x[0])

for i in range(N-K+1):
	
	if x[i+K-1] <= 0:
		d = -x[i]
	elif x[i] < 0 and 0 < x[i+K-1]:
		d = min(-x[i],x[i+K-1])+x[i+K-1]-x[i]
	else:
		d = x[i+K-1]
	
	d_min = min(d,d_min)

print(d_min)



Measured memory_bytes: 14224
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>

using namespace std;
using ll = long long;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
const double PI = 4.0 * atan(1.0);

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

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

    cout << pow(r, 2) << endl;
    return 0;
}


Measured memory_bytes: 256
///**Bismillahir Rahmanir Rahim.**

#include <bits/stdc++.h>
#define clr(a, v)             memset(a, v, sizeof a)
#define all(v)                v.begin(), v.end()
#define ast(v)                sort(v.begin(),v.end())
#define dst(v)                sort(v.begin(),v.end(), greater <int> ())
#define fast ios_base::       sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ass(cur, v)           cur.assign(v.begin(), v.end())
#define rep(i, l, r)          for (int i = l; i < r; i++)
#define rep2(i, l, r)         for (int i = l-1; i >= r; i--)
#define sfs(s)                scanf("%s", s)
#define sfl(n)                scanf("%lld", &n)
#define sffl(n, m)            scanf("%lld %lld",&n,&m)
#define sfffl(n, m, o)        scanf("%d %d %d",&n,&m, &o)
#define pf(n)                 printf("%d", n)
#define debug                 printf(" debug\n")
#define yes                   printf("YES\n")
#define no                    printf("NO\n")
#define sp                    printf(" ")
#define nl                    cout << "\n"
#define prln(n)               printf("%d\n", n)
#define pfl(n)                printf("%lld\n", n)
#define I(n)                  cin >> n
#define II(n, m)              cin >> n >> m
#define III(a, b, c)          cin >> a >> b >> c
#define P(n)                  cout << n
#define PP(n, m)              cout << n << " " << m << "\n"
#define PPP(a, b, c)          cout << a << " " << b << " " << c << "\n"
#define R(n)                  return n
#define mid(b, e)             (b+e)/2
#define left(node)            node*2
#define right(node)           node*2+1
#define pii                   pair<int,int>
#define mp                    make_pair
#define pb                    push_back
#define S                     second
#define F                     first
#define PI                    3.1415926

struct greaters{
    bool operator()(const long& a, const long& b) const{
        return a > b;
    }
};

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

typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;
const int N = 2e5+5;
const int mod = 1e9+7;

void reset(){

}

int main(){
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fast;
    int tc = 1, cas = 0;
    while(tc--){
        reset();
        int n; I(n);
        vector <int> v(n+5), v2(n+5), v3(n+5);
        rep(i, 1, n+1){
          I(v[i]);
        }
        rep(i, 1, n+1){
          I(v2[i]);
        }
        rep(i, 1, n){
          I(v3[i]);
        }
        int ans = 0;
        rep(i, 1, n+1){
            ans += v2[v[i]];
            if(i == 1){
                continue;
            }
            if(v[i] == v[i-1]+1){
                ans += v3[v[i-1]];
            }
        }
        P(ans);
    }
    return 0;

}

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



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

import sys
#import bisect
#from collections import deque
import math

#############################
#         59 58 57     1
# Ai = 0xbi bi bi ... bi
# 
#############################

#############################
#   N-1 N
#   Σ   Σ     (Ai xor Aj)
#   i=1 j=i+1
#
#   59  N-1 N       d      d
# = Σ   Σ   Σ     (bi xor bj) * 2^(d-1)
#   d=1 i=1 j=i+1
#############################

#############################
#   N-1 N       d      d
#   Σ   Σ     (bi xor bj)
#   i=1 j=i+1
#
# = (bx のうち 1 の数) * (bx のうち 0 の数)
#############################

def input():
    return sys.stdin.readline().rstrip('\n')

N = int(input())
A = list(map(int, input().split()))

s = 0 #sum

for d in range(60):
    B = [1 & (a >> d) for a in A]
    s += B.count(1) * B.count(0) * (2**d)
    #print(d,B,B.count(1),B.count(0),2**(d-1),s)

#print(s)
print(s % (10**9+7))


Measured memory_bytes: 141728
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int[] bcount = new int[s.length()+1];
        for (int i = 0; i < s.length(); i++) {
            if(s.charAt(i)=='B') {
                bcount[i]++;
            }
        }
        for (int i = 0; i < s.length(); i++) {
            bcount[i+1] += bcount[i];
        }
        long ans = 0;
        for (int i = 0; i < s.length(); i++) {
            if(s.charAt(i)=='W') {
                ans += (long)bcount[i];
            }
        }
        System.out.println(ans);
    }
}

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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; cin >> N;
    int A[N]; rep(i, N) cin >> A[i];
    int ans = mod;
    for(int aim = -100; aim <= 100; aim++){
        int res = 0;
        rep(i, N){
            res += (A[i]-aim)*(A[i]-aim);
        }
        ans = min(ans, res);
    }
    cout << ans << endl;
    return 0;
}

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

#define MAX 200000

int main(){

  int R[MAX], n, i=0;
  int maxv=-2000000000, minv=0;

  scanf("%d",&n);
  for(i=0; i<n; i++){
    scanf("%d",&R[i]);
  }

  minv = R[0];

  for(i=1; i<n; i++){
    maxv = fmax(maxv,R[i]-minv);
    minv = fmin(minv,R[i]);
  }

  printf("%d\n",maxv);

  return 0;
}

Measured memory_bytes: 1380
#include <iostream>

using namespace std;

int main(){
    int A;
    //Aを定義
    int B;
    //Bを定義
    int C;
    //Cを定義
    cin >> A >> B >> C;
    //A,B,Cの順で標準入力
    if (C >= A && C <= B){
        cout << "Yes" << endl;
        //CがA以上かつB以下である場合の処理
    } else {
        cout << "No" << endl;
        //それ以外の処理
    }
}

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

bool C(int* num, int* used, int p, bool dou){
	if(p == 10) for(int i = 1; i < 10 && num[i] == used[i]; i++) if(i + 1 == 10) return true;
	if(num[p] - used[p] >= 3){
		used[p] += 3;
		if(C(num, used, p, dou)) return true;
		used[p] -= 3;
	}
	if(num[p] - used[p] >= 2 && !dou){
		used[p] += 2;
		if(C(num, used, p, true)) return true;
		used[p] -= 2;
	}
	if(num[p] - used[p] >= 1 && p + 2 < 10){
		used[p]++; used[p + 1]++; used[p + 2]++;
		if(C(num, used, p, dou)) return true;
		used[p]--; used[p + 1]--; used[p + 2]--;
	}
	if(num[p] - used[p] == 0){
		return C(num, used, p + 1, dou);
	}
	return false;
}

int main(){
	string str;
	int num[12];
	int used[12];
	bool poss;
	
	while(getline(cin, str)){
		poss = false;
		for(int i = 0; i < 12; i++) num[i] = 0;
		
		for(int i = 0; i < str.size(); i++){
			if(str[i] >= 48 && str[i] < 58) num[str[i] - 48]++;
		}
		for(int n = 1; n < 10; n++){
			if(num[n] < 4){
				num[n]++;
				
				for(int i = 0; i < 12; i++) used[i] = 0;
				
				if(C(num, used, 1, false)){
					if(poss) cout << " ";
					cout << n;
					poss = true;
				}
				
				num[n]--;
			}
		}
		if(!poss) cout << "0";
		cout << endl;
		for(int i = 0; i < 15; i++) str[i] = 0;
	}
	
	return 0;
}

Measured memory_bytes: 1176
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>
#include <cassert>
#include <bitset>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define EL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using Graph = std::vector<std::vector<int> >;
const int INF = 1e17;
/* libraries */

constexpr int MOD = 1e9+7;
struct mint
{
	int v;
	mint():v(0){}
	mint(int v):v((v+MOD)%MOD){}
	mint operator-()const{ return mint(0) - *this; }
	mint& operator+=(const mint& a){ if((v+=a.v)>=MOD) v-=MOD; return *this; }
	mint& operator-=(const mint& a){ if((v+=MOD-a.v)>=MOD) v-=MOD; return *this; }
	mint& operator*=(const mint& a){ (v*=a.v)%=MOD; return *this; }
	mint& operator/=(const mint& a){ (*this) *= a.inv(); return *this; }
	mint operator+(const mint& a)const{ return mint(*this) += a; }
	mint operator-(const mint& a)const{ return mint(*this) -= a; }
	mint operator*(const mint& a)const{ return mint(*this) *= a; }
	mint operator/(const mint& a)const{ return mint(*this) /= a; }
	bool operator<(const mint& a)const{ return v < a.v; }
	bool operator==(const mint& a)const{ return v == a.v; }
	mint pow(int k)const{ mint r(1),t(v); while(k){ if(k&1) r*=t; t*=t; k>>=1; } return r; }
	mint inv()const{ return pow(MOD-2); }
	static mint comb(int n, int k) {
		if(n-k<k) k=n-k;
		mint num(1), dom(1);
		for(int i=0;i<k;i++) { num*=n-i; dom*=i+1; }
		return num/dom;
	}
};
std::istream& operator>>(std::istream&i,mint&a){ int t; i>>t; a=mint(t); return i; }
std::ostream& operator<<(std::ostream&o,const mint&a){ o<<a.v; return o; }


signed main() {
	int n,k;
	std::cin >> n >> k;
	mint ans=0;
	for(int i=k;i<=n+1;i++) {
		mint x = mint(2*n-i+1)*mint(i)/mint(2)-mint(i-1)*mint(i)/mint(2)+mint(1);
		ans+=x;
	}
	print(ans);
	return 0;
}


Measured memory_bytes: 3636
class in{struct myIterator{int it;const bool rev;explicit constexpr myIterator(int it_, bool rev=false):it(it_),rev(rev){}int operator*(){return it;}bool operator!=(myIterator& r){return it!=r.it;}void operator++(){rev?--it:++it;}};const myIterator i,n;public:explicit constexpr in(int n):i(0),n(n){}explicit constexpr in(int i,int n):i(i,n<i),n(n){}const myIterator& begin(){return i;}const myIterator& end(){return n;}};

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, x;
    cin >> n >> x;
    if(x < 2 || x > 2 * n - 2) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << '\n';
    vector<int> ans(2 * n - 1, 0);
    if(x >= n) {
        int ope = x - n;
        auto l = ans.begin(), r = ans.end() - 1;
        int cnt = 1;
        for(int i : in(ope)) {
            *l = cnt++;
            *r = cnt++;
            ++l;
            --r;
        }
        for( ; l != r ; ++l)
          *l = cnt++;
        *r = cnt;
    }
    else {
        int ope = n - x;
        auto l = ans.begin(), r = ans.end() - 1;
        int cnt = 2 * n - 1;
        for(int i : in(ope)) {
            *l = cnt--;
            *r = cnt--;
            ++l;
            --r;
        }
        for( ; l != r ; ++l)
          *l = cnt--;
        *r = cnt;
    }
    for(int x : ans) cout << x << '\n';
    return 0;
}

Measured memory_bytes: 2304
w, h, n = map(int, input().split())
w0 = h0 = 0

for i in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        w0 = max(x, w0)
    elif a == 2:
        w = min(x, w)
    elif a == 3:
        h0 = max(y, h0)
    elif a == 4:
        h = min(y, h)

w = max(0, w - w0)
h = max(0, h - h0)

print(w * h)


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

class Main {
  public static void main(String[] args) throws java.lang.Exception {
    
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    int[] intArray = Arrays.stream(br.readLine().split(" "))
                    .mapToInt(Integer::parseInt)
                    .toArray();

    int a = intArray[0];
    int b = intArray[1];
    
    if (a*b %2 == 0){
      System.out.println("Even");
    } else {
      System.out.println("Odd");
    }

  }
}

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

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

	int n;

	cin >> n;

	if(n==0)
	{
		cout << 0 << '\n';
		return 0;
	}

	string res;

	while(1)
	{
		if(n==0)
		{
			break;
		}
		if(n>0)
		{
			if(n%(-2)==0)
			{
				res = '0' + res;
			}
			else
			{
				res = '1' + res;
			}
			n/=(-2);
		}
		else
		{
			if(n%(-2)==0)
			{
				n/=(-2);
				res = '0' + res;
			}
			else
			{
				n/=(-2);
				n+=1;
				res = '1' + res;
			}
		}
	}

	cout << res << '\n';

	return 0;	
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 #include <ext/pb_ds/tree_policy.hpp>
 #include <ext/pb_ds/assoc_container.hpp>
 #include<chrono>
 using namespace std;
 using namespace std::chrono;      
 using namespace __gnu_pbds; 
 #define fastio     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
 #define fi         first
 #define se         second
 #define int         long long 
 #define pb         push_back
 #define emp        emplace_back
 #define vv(x)      vector<x>
 #define mp(x,y)    map<x,y>
 #define dq(x)      deque<x>
 #define pql(x)     priority_queue<x>
 #define pqs(x)     priority_queue<x,vv(x),greater<x> >
 #define M          1000000007
 #define forf(i,a,b) for(int i=a;i<b;i++)
 #define it(x)      x::iterator
 #define ll         long long 
 #define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
 #define time__(d)  for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false); debug("%s time : %.4fs", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
 #define vii        vector<int>
 #define big        3e18
 #define sm         -2e9
 #define mkr        make_pair
 #define vpi        vector<pair<int,int> >
 #define pii        pair<int,int>
 #define rng        500005
 #define sz(x)      (int)x.size()
 #define rv(x)      reverse(x.begin(),x.end())
 #define out(x)     cout<<x.fi<<" "<<x.se<<endl;

//#define ordered_set tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update> 
  
void pr_init()
{
   
    #ifndef ONLINE_JUDGE
    freopen("gin.txt", "r", stdin);
    freopen("gout.txt", "w", stdout);
   
    #endif
}


int n,k,a[101],dp[101][100001],cum[101][100001];
//cin >> n >> k ;
void solve()
{
   cin >> n >> k;

   forf(i,1,n+1) cin >> a[i];
   

   for(int j=0;j<=k;j++)
     {
      cum[0][j] = 1;
     }

   forf(i,1,n+1)
   {
     for(int j=0;j<=k;j++)
     {
        int id = max((int)0,j-a[i]);

        int vl = cum[i-1][j] - (id>=1?cum[i-1][id-1]:0);
        vl = (vl+M)%M;
        dp[i][j] += vl;
        dp[i][j] %= M;
     }
     cum[i][0] = dp[i][0]%M;

     for(int j=1;j<=k;j++)
     {
      cum[i][j] = dp[i][j]+cum[i][j-1];
      cum[i][j]%=M;
     }

   }
   
   // forf(i,1,n+1)
   // {
   //  forf(j,0,k+1) cout<<dp[i][j]<<" ";
   //  cout<<"\n";
   // }
   
   cout<<dp[n][k]%M;
}


int32_t main()
{
  pr_init();
  //fastio;
  
  auto start = high_resolution_clock::now(); 
 
  solve();
  auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start); 
   // cout << "Time taken by function: "
   //       << duration.count() << " microseconds" << endl; 

 }
      
      

Measured memory_bytes: 160612
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const mod = 1000000007

// 1MB
const ioBufferSize = 1 * 1024 * 1024

var sc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	sc.Split(bufio.ScanWords)
	return sc
}()

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	n, k := nextInt(), nextInt()

	d := n / k
	res := min(n-d*k, (d+1)*k-n)

	fmt.Println(res)
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define si(n) scanf("%d",&n);
#define PI acos(-1.0)
#define sl(n) scanf("%lld",&n);
#define sf(n) scanf("%lf",&n);
#define ss(n) scanf("%s",n);
#define for0(i,n) for(ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define forc(i,j,n) for(ll i=j;i<n;i++)
#define pb push_back
#define sor(n) sort(n.begin(),n.end())
#define sorcmp(n) sort(n.begin(),n.end(),cmp)
#define rev(n) reverse(n.begin(),n.end())
#define pi(x)  printf("%d",x);
#define pl(x)  printf("%lld",x);
#define pf(x)  printf("%.10lf",x);
#define ps(x)  printf("%s",x);
#define en() printf("\n");
#define random_shuffle(r...)random_shuffle(r,[](int _){return rand()%_;})
#define SQR(a) (a)*(a)
#define sp(x) fixed<<setprecision(x)
#define mod 1000000007
#define endl '\n'
#define pii pair<int,int>
#define pll pair<ll,ll>
#define bug cout<<"Here"<<endl
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}
template <typename T> T POW(T B,T P){ if(P==0) return 1; if(P&1) return B*POW(B,P-1);  else return SQR(POW(B,P/2));}
ll powmod(ll a, ll b){ll ans = 1;while(b){if(b&1) ans = ans*a%mod;a = a*a%mod;b >>= 1;}return ans;}


int main()
{

	int n;
	cin>>n;
	vector<pii>v;
	for(int i=0;i<n;i++)
    {
        int x,y;
        cin>>x>>y;
        v.pb({x,y});
    }

    for(int i=0;i<=n-3;i++)
    {
        if(v[i].first==v[i].second)
        {
            if(v[i+1].first==v[i+1].second)
            {
                if(v[i+2].first==v[i+2].second)
                {
                    return cout<<"Yes"<<endl,0;
                }
            }
        }
    }

    cout<<"No"<<endl;


	return 0;
}




Measured memory_bytes: 3624
#include <stdio.h>
int main(void)
{
    int a, b, c, x, ans = 0;
    int i, j, k;
    scanf("%d %d %d %d", &a, &b, &c, &x);

    for (i = 0; i < a+1; i++)
    {
        for (j = 0; j < b+1; j++)
        {
            for (k = 0; k < c+1; k++)
            {
                if(500*i + 100*j + 50*k == x)
                {
                    ans++;
                }
            }
        }
    }
    printf("%d\n", ans);
    return 0;
}


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

vector<ll> ed[100005],node[100005];
ll dp[100005][2];
void dfs(ll s,ll p)
{
    for(auto e:ed[s]){
        if(e==p)
        continue;
        node[s].push_back(e);
        dfs(e,s);
    }
}

void count(ll s)
{
    if(node[s].size()==0)
    {
        dp[s][0]=1;
        dp[s][1]=1;
        return;
    }
    for(auto e:node[s])
      count(e);
    
dp[s][0]=1;
for(auto e:node[s])
dp[s][0]=(dp[s][0]*(dp[e][0]+dp[e][1])%mod)%mod;

dp[s][1]=1;
for(auto e:node[s])
dp[s][1]=(dp[s][1]*(dp[e][0]))%mod;
}
int main() {
    ll n,x,y;
    cin>>n;
    n--;
    while(n--)
    {   cin>>x>>y;
     
        ed[x].push_back(y);
        ed[y].push_back(x);
    }
    dfs(1,-1);
    count(1);
    cout<<(dp[1][0]+dp[1][1])%mod;
    
}

Measured memory_bytes: 18304
#include <vector>
#include <set>
#include <cstdio>
using namespace std;

int main(){
	int N;
	long long W,tV=0,tW=0,x=0;
	scanf("%d%lld",&N,&W);
	vector<pair<long long,long long> >v(N);
	for(int i=0;i<N;i++)scanf("%lld%lld",&v[i].second,&v[i].first),tV+=v[i].first,tW+=v[i].second;
	if(W>tW)W=tW;
	if(tW<10000000){
		vector<long long>bag(W+1);
		bag[0]=1;
		for(auto &e:v){
			x+=e.second;
			if(x>W)x=W;
			for(int j=x;j>=e.second;j--)if(bag[j-e.second]&&bag[j]<bag[j-e.second]+e.first)
				bag[j]=bag[j-e.second]+e.first;
		}
		for(int i=0;i<W;i++)bag[i+1]=max(bag[i+1],bag[i]);
		printf("%lld\n",bag[W]-1);
	}else if(tV<10000000){
		vector<long long>bag(tV+1);
		bag[0]=1;
		for(auto &e:v){
			x+=e.first;
			for(int j=x;j>=e.first;j--)if(bag[j-e.first]&&(!bag[j]||bag[j]>bag[j-e.first]+e.second))
				bag[j]=bag[j-e.first]+e.second;
		}
		int i=0,mi;
		for(;i<=tV;i++)if(bag[i]&&bag[i]-1<=W)mi=i;
		printf("%d\n",mi);
	}else if(N<=40){
		int n=N/2;
		set<pair<long long,long long> >se1,se2;
		for(int i=0;i<1<<n;i++){
			long long V=0,w=0;
			for(int j=0;j<n;j++)if(i&(1<<j))V+=v[j].first,w+=v[j].second;
			se1.emplace(w,V);
		}
		for(int i=0;i<1<<(N-n);i++){
			long long V=0,w=0;
			for(int j=0;j<(N-n);j++)if(i&(1<<j))V+=v[j+n].first,w+=v[j+n].second;
			se2.emplace(w,V);
		}
		for(auto it=se1.begin();it!=se1.end();){
			auto it2=it;
			for(++it2;it2!=se1.end()&&it->second>=it2->second;)it2=se1.erase(it2);
			++it;
		}
		for(auto it=se2.begin();it!=se2.end();){
			auto it2=it;
			for(++it2;it2!=se2.end()&&it->second>=it2->second;)it2=se2.erase(it2);
			++it;
		}
		long long r=0;
		for(auto &e1:se1){
			auto it=se2.lower_bound({W-e1.first+1,0});
			if(it!=se2.begin()){
				--it;
				r=max(r,e1.second+it->second);
			}
		}
		printf("%lld\n",r);
	}else{
		return 1;
	}
}

Measured memory_bytes: 1024
package main

import (
	"bufio"
	"os"
	"strconv"
	"strings"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	for scanner.Scan() {
		n, _ := strconv.Atoi(scanner.Text())
		if n == 0 {
			break
		}
		for i := 0; i < n; i++ {
			scanner.Scan()
			buf := strings.Split(scanner.Text(), " ")
			math, _ := strconv.Atoi(buf[0])
			english, _ := strconv.Atoi(buf[1])
			japanese, _ := strconv.Atoi(buf[2])
			if math == 100 || english == 100 || japanese == 100 {
				fmt.Println("A")
			} else if math + english >= 180 {
				fmt.Println("A")
			} else if math + english + japanese >= 240 {
				fmt.Println("A")
			} else if math + english + japanese >= 210 {
				fmt.Println("B")
			} else if math + english + japanese >= 150 && (math >= 80 || english >= 80) {
				fmt.Println("B")
			} else {
				fmt.Println("C")
			}
		}
	}
}


Measured memory_bytes: 1276
using System;using System.Linq;
class A{static void Main(){
int[]n=Console.ReadLine().Split().Select(int.Parse).ToArray();
int n1=int.Parse(Console.ReadLine());
int ans=0;
for(int i=0;i<n1;i++){
int []s=Console.ReadLine().Split().Select(int.Parse).ToArray();
	if(s[1]<=n[0]||s[0]>=n[1]){ans++;}

}	Console.WriteLine(n1==ans?0:1);


































	
}}













Measured memory_bytes: 9616
#include<iostream>
#include<algorithm>
#define rep(a,b) for(int i=a;i<b;i++)
using namespace std;
int main()
{
    int H,n;
    cin>>H>>n;
    int sum=0;
    rep(0,n){
        int a;
        cin>>a;
        sum+=a;
    }
    if(sum>=H) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


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

#define CH(N,A,B) (A<=N&&N<B)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define RREP(i,a,b) for(int i=(b-1);a<=i;i--)

using namespace std;

string S;
int L;

int main() {

  while(1){
    cin>>S>>L;
    if(S=="0"&&L==0) break;
    int ans = 0;
    set<string> st;
    map<string, int> m;
    while(1){
      //00????????????
      string ts = "";
      REP(i,0,L-S.size()) ts += "0";
      S = ts + S;
      //check
      if(st.find(S) != st.end()){
        cout<<m[S]<<" "<<stoi(S)<<" "<<ans-m[S]<<endl;
        break;
      }
      st.insert(S);
      m[S] = ans;
      ans++;
      //?????°?????????
      vector<char> v[2];
      REP(i,0,S.size()) v[0].push_back(S[i]), v[1].push_back(S[i]);
      sort(v[0].begin(),v[0].end()); sort(v[1].begin(),v[1].end(),greater<char>());
      //int?????????
      int num[2] = {0,0};
      REP(k,0,2){
        int di = 1;
        REP(i,0,v[k].size()){
          num[k] += ((int)(v[k][v[k].size()-1-i]-'0'))*di;
          di *=10;
        }
      }
      int diff = num[1] - num[0];
      //00????????????
      S = to_string(diff);
      ts = "";
      REP(i,0,L-S.size()) ts += "0";
      S = ts + S;
    }

  }
  return 0;
}

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

int main() {
    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;

    vector<vector<bool>> dp(F+1, vector<bool>(F+1, false));
    dp[0][0] = true;

    vector<int> DW = {100*A, 100*B, 0, 0};
    vector<int> DS = {0, 0, C, D};

    double best_c = 0;
    int water = 100*A, sugar = 0;
    for (int w = 0; w <= F; w++) {
        for (int s = 0; w + s <= F; s++) {
            if (dp[w][s]) {
                if (w > 0 && s * 100 <= w * E) {
                    double c = (double)s / (w+s);
                    if (c > best_c) {
                        best_c = c;
                        water = w;
                        sugar = s;
                    }
                }
                for (int i = 0; i < 4; i++) {
                    int nw = w + DW[i];
                    int ns = s + DS[i];
                    if (nw + ns <= F)
                        dp[nw][ns] = true;
                }
            }
        }
    }

    cout << (water + sugar) << " " << sugar << endl;
}


Measured memory_bytes: 1408
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <cstring>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

int main(){
    double a, b;
    cin >> a >> b;
    
    rep (i, 1010) {
        if (floor(i * 0.08) == a && floor(i * 0.10) == b) {
            cout << i;
            return 0;
        }
    }
    cout << -1;

    
    
    
    
    return 0;
    
}


Measured memory_bytes: 3748
#include<iostream>
using namespace std;
int main()
{
    char n[1000];
    int flag=0;
    cin >> n;
    for(int i=0; i<3; i++)
    {
        if(n[i]=='7')
        {
            flag=1;
            break;
        }
    }
    if(flag==1)
        cout << "Yes";
    else
        cout << "No";
}


Measured memory_bytes: 3640
package main

import (
  "bufio"
  "container/list"
  "fmt"
  "os"
  "strconv"
  "strings"
)

const size = 1000000
var reader = bufio.NewReaderSize(os.Stdin,size)
func NextLine() string {
  var line,buffer []byte
  var isPrefix bool = true
  var err error
  for ;isPrefix; {
    line,isPrefix,err = reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
  }
  return string(buffer)
}
func Next2Ints() (int,int) {
  var x,y int
  var s []string = strings.Split(NextLine()," ")
  x,_ = strconv.Atoi(s[0])
  y,_ = strconv.Atoi(s[1])
  return x,y
}
func Next3Ints() (int,int,int) {
  var x,y,z int
  var s []string = strings.Split(NextLine()," ")
  x,_ = strconv.Atoi(s[0])
  y,_ = strconv.Atoi(s[1])
  z,_ = strconv.Atoi(s[2])
  return x,y,z
}

func main() {
  const infty int64 = 9223372036854775800
  var n,m int = Next2Ints()
  graph := make([]map[int]int64,n)
  var score []int64 = make([]int64,n)
  for i:=0;i<n;i++ {
    graph[i] = map[int]int64{}
    score[i] = infty
  }
  for i:=0;i<m;i++ {
    var a,b,c int = Next3Ints()
    graph[b-1][a-1] = int64(-c);
  }
  stack := list.New()
  score[n-1] = 0
  stack.PushFront([]int{n-1,0})
  for stack.Len() > 0 {
    r,_ := stack.Remove(stack.Front()).([]int)
    f,t := r[0],r[1]
    for k,v := range graph[f] {
      if k == 0 && t > n+1 && score[k] > score[f]+v {
        fmt.Println("inf")
        os.Exit(0)
      }
      if score[k] > score[f]+v {
        score[k] = score[f]+v
        stack.PushFront([]int{k,t+1})
      }
    }
  }
  fmt.Println(-score[0])
}

Measured memory_bytes: 2048
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long c = sc.nextLong();
		long k = sc.nextLong();
		if(a<k) {
			long somme = a;
			k-=a;
			if(b<k) {
				k-=b;
				System.out.println(somme-k);
			}else {
				System.out.println(somme);
			}
		}else {
			System.out.println(k);
		}
		sc.close();
	}

}


Measured memory_bytes: 35720