akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
#include<set>

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
 
#define sPRINT(str) printf(#str "\n")
#define yOUT sPRINT(Yes)
#define nOUT sPRINT(No)
#define YOUT sPRINT(YES)
#define NOUT sPRINT(NO)
 
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()


using namespace std;
 
int main(void)
{   
    string s; 
    cin >> s;
    bool f = false;

    for(char c = 'a';c <= 'z';c++){
        REP(i, s.size()){
            if(s[i] == c)
                f=true;
        }
        if(f){
            f=false;
        }
        else {
            cout << c << endl;
            return 0;
        }
    }
        sPRINT(None);
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  set<int> a;
  for (int i = 0; i < k; i ++) {
    int l;
    cin >> l;
    for (int j = 0; j < l; j++) {
      int g = 0;
      cin >> g;
      a.insert(g);
    }
  }
  long long count = 0;
  for (int i = 0; i < n; i++) {
  set<int>::iterator iti = a.find(i+1);
    if (iti == a.end()) {
      count++;
    }
  }
  cout << count << '\n';
}

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


int main() {
  string s;
  cin >> s;
  ll n;
  n = s.size();
  rep(i,26){
    bool have = false;
    rep(j,n){
      if(s[j] == (char)(97+i)){
        have = true;
      }
    }
   if(!have){
     cout << (char)(97+i);
     return 0;
   }
  }
  cout << "None";
  
    
  return 0;
}




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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

int gcd(int a, int b){return b ? gcd(b, a%b) : a;}

int main(){
    int n;
    cin >> n;
    
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    
    //累積商
    vector<int> left(n+1, 0), right(n+1, 0);
    for (int i =  0; i < n; i++) left[i+1] = gcd(left[i], a[i]);
    for (int i =  n-1; i >= 0; i--) right[i] = gcd(right[i+1], a[i]);
    
    int res = 0;
    
    for (int i = 0; i < n; i++){
        
        int l = left[i];
        
        int r = right[i+1];
        
        chmax(res, gcd(l, r));
    }
    
    cout << res << endl;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
int main(){
int H,W;
cin>>H>>W;
 while(H!=0&&W!=0){
    for(int j=0; j<H; j++){
        for(int i=0; i<W; i++){
            if(j!=0&&j!=H-1&&i!=0&&i!=W-1){
                cout<<".";
            }
            else{
                cout<<"#";
            }
        }
        cout<<endl;
    }
    cout<<endl;
    cin>>H>>W;
 }
 return 0;
}


Measured memory_bytes: 3092
package main

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

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func main() {
	s := readLine()
	h := strings.Index(s, "A")
	t := strings.LastIndex(s, "Z")
	fmt.Println(t - h + 1)
}


Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <utility>
#include <string>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>

using namespace std;

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

	multimap<uint32_t, uint32_t> stores;
	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		stores.insert(make_pair(a, b));
	}

	uint64_t sum = 0;
	int remain = m;
	auto it = stores.begin();
	while (true) {
		uint64_t price = it->first;
		uint64_t amount = it->second;

		if (amount < remain) {
			remain -= amount;
			sum += amount * price;
		}
		else {
			sum += remain * price;
			break;
		}

		it++;
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 4992
from fractions import gcd

N,K = map(int, input().split())
A = [int(i) for i in input().split()]

M = max(A)

G = 0
for a in A:
    G = gcd(G, a)

if K % G == 0 and K <= M:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

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

#include <bits/stdc++.h>

using namespace std;

class TaskA
{
public:
  void solve(istream &cin, ostream &cout)
  {
    string S;
    cin >> S;
    cout << count(begin(S), end(S), '1') << endl;
  }
};


int main()
{
  TaskA solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return (0);
}


Measured memory_bytes: 256
#include<iostream>
#define ll long long

using namespace std;

ll n,y;

int main(){
  cin >> n >> y;
  bool f = false;
  for(int a=0;a <= 2000;a++){
    for(int b=0;b <= 2000;b++){
      int c = n - a - b;
      if(y == 10000*a + 5000*b + 1000*c && c >= 0){
        cout << a << " " << b << " " << c << endl;
        f = true;
        break;
      }
    }
    if(f) break;
  }
  if(!f) cout << -1 << " " << -1 << " " << -1 << endl;
  return 0;
}

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

const int NN=200;
int a[NN];
int n;

int main()
{
    string str;
    int n,k;
    scanf("%d%d",&n,&k);
    cin>>str;
    str[k-1]=str[k-1]+('a'-'A');
    cout<<str<<endl;
}


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

typedef long long ll;
#define pb push_back
#define mod 1000000007

// int gcd(int a, int b) {   if (b == 0) return a; return gcd(b, a % b);  }
// int lcm(int a,int b){return a/gcd(a,b)*b;}
ll solve(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    return max(a*c,max(b*d,max(a*d,b*c)));
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    // int t;
    // cin>>t;
    // while(t--){
    //     cout<<solve()<<"\n";
    // }
    cout<<solve();
    return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <cassert>
#include <random>
using namespace std;
using ll = long long;


int main() {
	const double PI = 3.14159265358979;
	double a, b, x; cin >> a >> b >> x;
	double lo = 0., hi = 90.;
	for (int i = 0; i < 1000; i++) {
		double mid = lo + (hi - lo) / 2.;
		double theta = (90 - mid) / 180 * PI;
		double r = sqrt(2*x / (a * tan(theta)));
		double t = r * tan(theta);
		if (t > a) {
			double k = t - a;
			double v = a * k * k / tan(theta) / 2;
			double u = v / (a * a);
			r += u;
		}
		if (r > b) hi = mid;
		else lo = mid;
	}
	printf("%.15f\n", lo);
	return 0;
}


Measured memory_bytes: 384
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		int b = a % 1000;
      	if(b == 0){
          System.out.println(b);   
        }else{
          System.out.println(1000 - b);             
        }

    }
}

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

int main()
{
	string s, t;
	cin >> s >> t;

	int ans = 0;
	for (int i = 0; i < 3; i++) {
		if (s[i] == t[i])
			ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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;
}

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

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

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

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


int main(){
ll n,a,b;
ll tmp,sum=0;
cin>>n>>a>>b;
tmp=n/(a+b);
sum+=a*tmp;
tmp=n%(a+b);
if(tmp>a){
    sum+=a;
}else{
    sum+=tmp;
}
cout<<sum<<endl;
}





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

int main() {
  vector<int> time(5);
  rep(i,5) cin >> time[i];
  sort(time.begin(), time.end());
  int ans = 100000000;
  do {
    int res = 0;
    rep(i,4) res += ceil(time[i]/10.0) * 10;
    res += time[4];
    ans = min(ans, res);
  } while(next_permutation(time.begin(), time.end()));
  cout << ans << endl;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
A = []
A_row = []
check = []
count = 0

for i in range(0, K):
    d = int(input())
    A = list(map(int, input().split()))
    A_row += A

for i in range(1, N + 1):
    check.append(i)

for i in range(0, N):
    for j in range(0, len(A_row)):
        if check[i] == A_row[j]:
            check[i] = 'None'

for i in range(0, len(check)):
    if check[i] != 'None':
        count += 1
print(str(count))

Measured memory_bytes: 9316
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define ll long long
#define ull unsigned long long
#define ld long double
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rbf(a, x) for (auto& a : x)
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define drep(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define pll pair<long long,long long>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vvc vector<vector<char>>
#define vc vector<char>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define Maxe(x) *max_element(all(x))
#define Mine(x) *min_element(all(x))
#define Size(x) ((ll)(x).size())
#define umap unordered_map
const long long INF = 1LL << 60;
const long double pi = 3.1415926535897932;
#define Fi first
#define Se second
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

    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;
    }

//lis,modpow,uf,modncr,soinsubunkai,yakusurekkyo
//mint,dijkstra,gyakugen
    vector<long long> divisor(long long n) {
        vector<long long> ret;
        for (long long i = 1; i * i <= n; i++) {
            if (n % i == 0) {
                ret.emplace_back(i);
                if (i * i != n) ret.emplace_back(n / i);
            }
        }
        sort(ret.begin(), ret.end()); // 昇順に並べる
        return ret;
    }

    signed main(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        ll n;
        cin>>n;
        vl A(n);
        rep(i,n)cin>>A[i];
        sort(all(A));
        umap<ll,ll> M;
        ll res=0;
        rep(i,n){
            if(M[A[i]])continue;
            if(i<n-1&&A[i]==A[i+1]){
                M[A[i]]++;
                continue;
            }
            bool c=true;
            vl x=divisor(A[i]);
            rbf(p,x){
                if(M[p]){
                    c=false;
                    break;
                }
            }
            M[A[i]]++;
            if(c)res++;
        }
        cout<<res<<"\n";
    }

Measured memory_bytes: 33344
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <stdio.h>

using namespace std;

int main() {
    string s;
    cin >> s;

    int digits = s.size();

    long long ans;
    ans = 0;

    vector<int> dp(digits);
    vector<int> a(digits);

    int sum = 0;
    int mul = 1;
    for (int i = 0; i < digits; ++i) {
        a[i] = (s[digits - i - 1] - '0') * mul;
        a[i] %= 2019;
        sum += a[i];
        sum %= 2019;
        dp[i] = sum;
        mul = ((mul*10) % 2019);
    }

    map<int, int> mp;
    mp[0]++;
    for (int i = 0; i < digits; i++) {
        ans += mp[dp[i]];
        mp[dp[i]]++;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5240
import math
N, D = map(int, input().split())
t = []
for i in range(N):
    t.append(list(map(int, input().split())))
count = 0
sum = 0
for i in range(0, N-1):
    for j in range(i + 1, N):
      for d in range(D):
        sum += pow(t[i][d] - t[j][d], 2)
        sqrt = math.sqrt(sum)
      if sqrt == int(sqrt):
        count += 1
      sum = 0
      sqrt = 0
print(count)

Measured memory_bytes: 3064
//https://atcoder.jp/contests/abc164/tasks/abc164_a
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
const ll LINF = 0x1fffffffffffffff;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
template<class T>bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1; } return 0;}
template<class T>bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1; } return 0;}
int main() {
  ll S,W; cin>>S>>W;
  if(S<=W) {
    cout<<"unsafe"<<endl;
  }else{
    cout<<"safe"<<endl;
  }
  return 0;
}

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

/*1回の交換で整列完了するということに注目  1からNまでN個の要素を持つ集合が昇順に並ぶのは、任意の要素について、値がkであるならばその要素は左からk番目に存在するということ*/

int main(){
  int N;
  cin >> N;
  int p[N];
  int count = 0;         //番号数(1以上)と値の不一致箇所の数
  
  for(int i = 1; i <= N; i++){
    cin >> p[i];
    if(p[i] != i){
      count += 1;
      if(count > 2){                             //2個より多ければ修正は不可能
        cout << "NO" << endl;
        return 0;
      }
    }
  }

  cout << "YES" << endl;
  return 0;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include <iomanip>
#include <math.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60
const double PI = 3.14159265358979323846;

int c[10][10];

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

	int N; cin >> N;
	for (int i = 1; i <= 9; i++) {
		for (int j = 1; j <= 9; j++) {
			for (int k = 1; k <= N; k++) {
				int a = k % 10;
				int b = k;
				while (b >= 10) b /= 10;
				if (b == i && a == j) c[i][j]++;
			}
		}
	}

	ll ans = 0;
	for (int i = 1; i <= 9; i++) {
		for (int j = 1; j <= 9; j++) ans += ll(c[i][j]) * ll(c[j][i]);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())

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

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def SI(): return input().split()

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')

from math import ceil, floor, log2
from collections import deque
from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product

def solve():
    n = II()

    V = [[] for _ in range(n)]
    for i in range(n):
        a, b, c = MI()
        V[i] = [a, b, c]

    dp = [[0] * 3 for _ in range(n)]
    for i in range(3):
        dp[0][i] = V[0][i]

    # dp[i][0] -> dp[i+1][1], dp[i+1][2]
    for i in range(1, n):

        for j in range(3):
            for k in range(3):
                if j == k: continue
                dp[i][k] = max(dp[i-1][j] + V[i][k], dp[i][k])
    print(max(dp[-1]))


if __name__ == '__main__':
    solve()


Measured memory_bytes: 42940
import java.util.Scanner;

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 spendAll = b / a;

        System.out.println(Math.min(c, spendAll));
    }
}

Measured memory_bytes: 23508
def gcd(x, y):
    if x == 0:
        return y
    else:
        return gcd(y % x, x)


def lcm(x, y):
    return x * y // gcd(x, y)


def calc(n, x, y):
    z = lcm(x, y)
    return n // x + n // y - n // z


a, b, c, d = map(int, input().split())
ans = calc(b, c, d) - calc(a-1, c, d)
print(b - a + 1 - ans)


Measured memory_bytes: 3064
s = list(input())
ans = [0]*len(s)
i = 0
while i < len(s):
    if s[i]=="R":
        count = 1
        while s[i] =="R":
            i += 1
            count += 1
        ans[i-1] += count//2
        ans[i] += (count-1)//2
    else:
        sta = i
        count = 1
        while i < len(s) and s[i] == "L":
            i += 1
            count += 1
        ans[sta] += count//2
        ans[sta-1] += (count-1)//2
print(*ans)


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

// int/long:		-2147483648 - 2147483648 (-2^31 <= int < 2^31)
// long/long long:	-9223372036854775808 - 9223372036854775807 (-2^63 <= long < 2^63)

#define	INF (1<<29)
//536870912

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// bit: &/and, |/or, ^/xor, ~/not

#define	MOD 1000000007

int	main() {
	long N;
	cin >>N;
	long nn=sqrt(N);
	for (long i=nn; i>=1; i--) {
		if (0==N%i) {
			cout <<(i+N/i-2) <<endl;
			return 0;
		}
	}
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  vector<int>a;
  for(int i= 0; 3 > i; i++){
    int tmp;cin>>tmp;
    a.push_back(tmp);
  }
  sort(a.begin(),a.end());
  if(a[0]==5 && a[1]==5 && a[2]==7)cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
import java.io.*
import java.util.*

val pw = PrintWriter(System.out)
fun solve(a: Int, b: Int){
    if(a <= b){
        println((0 until b).map{ a }.joinToString(separator=""))
    }else{
        println((0 until a).map{ b }.joinToString(separator=""))
    }
    pw.flush()
    return
}


fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val a = sc.next().toInt()
    val b = sc.next().toInt()
    solve(a, b)
}



Measured memory_bytes: 29696
#include <stdio.h>
#include <iostream>
using namespace std;

int main(void){
 int N,T,i,c,t;
 int min = 1001;
 cin >> N >> T;
 for(i = 0;i < N;i++){
   cin >> c >> t;
   if(t <= T && c < min){
     min = c;
   }
 }
 if(min >= 1001){
   cout<< "TLE" <<endl;
 }
 else{
 cout<< min <<endl;
 }
return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> PI;
typedef vector<int> vi;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#define pb push_back
#define f first
#define s second


bool p[1000001];


main(){
  rep(i,1000001)p[i]=true;

  p[0]=p[1]=false;
  for(int i=2;i<=1000000;i++){
    if(p[i]==false)continue;
    for(int j=2*i;j<=1000000;j+=i)p[j]=false;
  }

  int n,x;
  while(cin>>n>>x,n|x){
    int mo[n];
    rep(i,n)cin>>mo[i];
    bool can[x+1];
    memset(can,0,sizeof(can));

    can[0]=1;
    rep(i,x+1){
      if(can[i]){
        rep(j,n){
          if(i+mo[j]<=x)can[i+mo[j]]=1;
        }
      }
    }

    while(true){
      if(can[x] && p[x]){
        cout<<x<<endl;
        break;
      }
      x--;
      if(x<2){
        cout<<"NA"<<endl;
        break;
      }
    }
  }
}

Measured memory_bytes: 2816
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 2
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	sol := solver{}
	sol.n = n
	sol.ans = make([]string, 0)
	sol.dfs("", 'a')

	for i := 0; i < len(sol.ans); i++ {
		fmt.Fprintln(writer, sol.ans[i])
	}
}

type solver struct {
	n   int
	ans []string
}

func (sol *solver) dfs(s string, m byte) {
	if len(s) == sol.n {
		sol.ans = append(sol.ans, s)
		return
	}
	b := strings.Split(s, "")
	l := len(b)
	b = append(b, "")
	for i := 0; i < int(m-'a'); i++ {
		b[l] = fmt.Sprintf("%c", 'a'+i)
		sol.dfs(strings.Join(b, ""), m)
	}
	b[l] = fmt.Sprintf("%c", m)
	sol.dfs(strings.Join(b, ""), m+1)
}


Measured memory_bytes: 10112
use std::cmp;
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::VecDeque;
use std::io::Read;
use std::usize::MAX;

macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();let mut next = || { iter.next().unwrap() };input_inner!{next, $($r)*}};($($r:tt)*) => {let stdin = std::io::stdin();let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));let mut next = move || -> String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()};input_inner!{next, $($r)*}};}
macro_rules! input_inner {($next:expr) => {};($next:expr, ) => {};($next:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($next, $t);input_inner!{$next $($r)*}};}
macro_rules! read_value {($next:expr, ( $($t:tt),* )) => {( $(read_value!($next, $t)),* )};($next:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()};($next:expr, chars) => {read_value!($next, String).chars().collect::<Vec<char>>()};($next:expr, usize1) => {read_value!($next, usize) - 1};($next:expr, [ $t:tt ]) => {{let len = read_value!($next, usize);(0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()}};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}

fn solve() {
    input! {
        n: usize,
        m: usize,
        a: [usize;m]
    }

    let mut total = 0;
    for i in 0..m {
        total += a[i];
    }

    if n >= total {
        println!("{}", n - total);
    } else {
        println!("-1");
    }
}

fn main() {
    let thd = std::thread::Builder::new().stack_size(104_857_600);
    thd.spawn(|| solve()).unwrap().join().unwrap();

    /*
    // 入力を一括で読み込む場合
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut input = buf.split_whitespace();

    // inputに対しnext()で読み込んでいく
    let q: usize = input.next().unwrap().parse().unwrap();
    */
}

const LARGE_PRIME: u64 = 1_000_000_007;

// @〜でsnippet


Measured memory_bytes: 2316
n, weightMax = map(int, input().split())
itemList = [[0 for _ in range(weightMax+1)] for _ in range(n+1)]

for i in range(n):
    w,v = list(map(int, input().split()))
    for j in reversed(range(weightMax+1)):
        if j-w >= 0:
            itemList[i+1][j] = max([itemList[i][j],itemList[i][j-w] + v])
        else:
            itemList[i+1][j] = itemList[i][j]
print(max(itemList[n]))


Measured memory_bytes: 173320
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n; cin>>n;
  vector<int> t(n+1),x(n+1),y(n+1);
  t[0] = x[0] = y[0] = 0;
  for(int i = 1; i<=n; ++i){
    cin>>t[i]>>x[i]>>y[i];
  }
  bool is_able = true;
  for(int i=1; i<=n; ++i){
    int dist = abs(x[i] -x[i-1]) + abs(y[i] - y[i-1]);
    int dt = t[i] - t[i-1];
    if( dt < dist ) is_able = false;
    if( dist%2 != dt%2 ) is_able = false;
  }
  if (is_able) cout << "Yes"<<endl;
  else cout << "No"<<endl;
  return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<map>
#include<math.h>
using namespace std;

int main() {
	string s;
	bool f = 1;
	cin >> s;
	for(int i = 0; i < s.size(); i++) {
		if (i % 2 == 0) {
			if (!(s[i] == 'R' || s[i] == 'U' || s[i] == 'D')) {
				f = 0;
			}
		}
		else {
			if (!(s[i] == 'L' || s[i] == 'U' || s[i] == 'D')) {
				f = 0;
			}
		}
	}
	if (f == 1)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3636
n,k,q = map(int,input().split())
a = [int(input()) for _ in range(q)]

l = [k - q for _ in range(n)]
for i in a:
    idx = i - 1
    l[idx] += 1

for i in l:
    if i <= 0:
        print('No')
    else:
        print('Yes')



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

int main()
{ 
  int n, k ;
  cin >> n >> k ;
  vector<int64_t> data(n) ;
  for(int i = 0 ; i < n ; i++)
  {
    cin >> data.at(i) ;
  }
  sort(data.begin(), data.end()) ;

  int64_t answer = 10000000000 ;
  for(int i = 0 ; i < n ; i++)
  {
    if(i + (k - 1) >= n)
    {
      break ;
    }
    int64_t calcu = data.at(i + (k - 1) ) - data.at(i) ;
    answer = min(answer, calcu) ;
  }

  cout << answer << endl ;
}


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

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

    int N, M; cin >> N >> M;
    vector<int> v(M);
    for (int i = 0; i < N; i++) {
        int K; cin >> K;
        for (int i = 0; i < K; i++) {
            int A; cin >> A;
            v[A-1]++;
        }
    }
    int ans = 0;
    for (int i = 0; i < M; i++) {
        if (v[i] == N) ans++;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <typeinfo>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T>
using Tree =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;  // check the limits, dummy

typedef long long ll;
const int inf = INT_MAX / 2;
const ll infl = 1LL << 60;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T>
void print(const vector<T> v) {
  cout << "[ ";
  F0R(i, v.size()) { cout << v[i] << ' '; }
  cout << "]" << '\n';
}

int mod(int i, int j) {
  return (i % j) < 0 ? (i % j) + 0 + (j < 0 ? -j : j) : (i % j + 0);
}

// --------------------------------------------------------
// This is tool
// --------------------------------------------------------
void Main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  string S;
  int K, A, B;
  cin >> S;
  if (S == "ABC") {
    cout << "ARC" << endl;
  } else {
    cout << "ABC" << endl;
  }
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
}

Measured memory_bytes: 3640
c_0, c_1, c_2, N = 0, 0, 0, int(input())
for i in map(int, input().split()):
    if i % 4 == 0: c_2 += 1
    elif i % 2 == 0: c_1 += 1
    else: c_0 += 1
if c_1 == 0: result = "Yes" if c_2 >= c_0 - 1 else "No"
else: result = "Yes" if c_2 >= c_0 else "No"
print(result)

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

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

    int x[N+1];
    for(int i = 0; i < N; i++) {
        cin >> x[i];
    }
    x[N] = X;

    int y[M+1];
    for(int i = 0; i < M; i++) {
        cin >> y[i];
    }
    y[M] = Y;

    sort(x, x+N+1);
    sort(y, y+M+1);
    
    int max_x = x[N];
    int min_y = y[0];
    int flag = 0;

    if(min_y <= max_x) {
        flag = 1;
    }

    if(flag == 1) {
        cout << "War";
    }
    else {
        cout << "No War";
    }

    cout << endl;
    return 0;
}

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

int main(){
	ll n,W;
	cin >> n >> W;
	vector<ll> w(n),v(n);
	rep(i,n) cin >> w[i] >> v[i];
	vector<vector<ll>> dp(n+10,vector<ll>(W+10));
	for(int i(1);i<=n;++i){
		for(int j(0);j<=W;++j){

			if(W >= w[i-1] && j - w[i-1]>= 0){
				if(dp[i-1][j-w[i-1]] + v[i-1] > dp[i-1][j]){
					dp[i][j] = dp[i-1][j-w[i-1]] + v[i-1];
				}else{
					dp[i][j] = dp[i-1][j];
				}
			}else{
				dp[i][j] = dp[i-1][j];
			}
		}
	}
	cout << dp[n][W] << endl;
	return 0;
}

Measured memory_bytes: 87296
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <numeric>
#include <climits>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <utility>
////////////////////////////////////////////////
#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 REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define REPe(e, mp) for (auto& e : mp)
#define all(x) x.begin(), x.end()
////////////////////////////////////////////////
using namespace std;
using ll = long long int;
using vecint = vector<int>;
using vecll = vector<ll>;
using vec2int = vector<vector<int>>;
using P = pair<int, int>;
const ll MOD = 1000000007;  // 1e9+7
////////////////////////////////////////////////
////////////////////////////////////////////////
int main() {
  ////////////////////////////////////////////////
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ////////////////////////////////////////////////
  int n;
  cin >> n;
  vecint a(n * n, 0);
  REPe(e, a) {
    cin >> e;
    --e;
  }
  vec2int cost(n, vecint(n, 0));
  vec2int exist(n, vecint(n, 1));
  REP(i, n) {
    REP(j, n) { cost[i][j] = min({i, j, n - i - 1, n - j - 1}); }
  }
  const int dx[4] = {+1, -1, 0, 0};
  const int dy[4] = {0, 0, +1, -1};
  auto isin = [&](int i, int j) -> bool {
    return (0 < i && i < n && 0 < j && j < n);
  };
  int ans = 0;
  REPe(e, a) {
    int i = e / n;
    int j = e % n;
    ans += cost[i][j];
    exist[i][j] = 0;
    queue<P> q;
    q.push({i, j});
    while (!q.empty()) {
      P p = q.front();
      q.pop();
      int fac = exist[p.first][p.second];
      REP(k, 4) {
        int x = p.first + dx[k];
        int y = p.second + dy[k];
        if (!isin(x, y)) continue;
        if (cost[x][y] > cost[p.first][p.second] + fac) {
          cost[x][y] = cost[p.first][p.second] + fac;

          q.push({x, y});
        }
      }
    }
    // REP(i, n) {
    //   REP(j, n) { cout << cost[i][j] << " "; }
    //   cout << ": ";
    //   REP(j, n) { cout << exist[i][j] << " "; }
    //   cout << endl;
    // }
    // cout << endl;
  }
  cout << ans << endl;
}
//////////////////////////////////////////////


Measured memory_bytes: 6052
import math
N, K = map(int, input().split())
A = list(map(int, input().split()))

ind = A.index(1)
ans = 0
if ind == 0 or ind == N - 1:
    ans = math.ceil((N - 1) / (K -1))
else:
    # 左部分
    ans += math.ceil((ind) / (K - 1))
    tmp = ind % (K - 1)
    # 右側部分
    if tmp == 0:
        ans += math.ceil((N - ind - 1) / (K - 1))
    else:
        ans += math.ceil((N - ind - 1 - K +  1 + tmp) / (K - 1))

print(ans)

Measured memory_bytes: 13812
#include <iostream>
#include <queue>
#include <assert.h>
#define MAX_V 100
using namespace std;

int adjacencyMatrix[MAX_V][MAX_V] = {};
int d[MAX_V];
int V;

void bfs(int start)
{
    queue<int> Q;
    Q.push(start);

    for (int i = 0; i < V; ++i)
        d[i] = -1;

    d[start] = 0;

    while (!Q.empty()) {
        int u = Q.front();
        Q.pop();
        for (int i = 0; i < V; ++i) {
            if (d[i] != -1) continue;
            if (adjacencyMatrix[u][i] == 1) {
                d[i] = d[u] + 1;
                Q.push(i);
            }
        }
    }
    return;
}

int main()
{
    cin >> V;

    for (int i = 0; i < V; ++i) {
        int u, k;
        cin >> u >> k;
        assert(u = i + 1);
        for (int j = 0; j < k; ++j) {
            int tmp;
            cin >> tmp;
            adjacencyMatrix[i][tmp - 1] = 1;
        }
    }

    bfs(0);

    for (int i = 0; i < V; ++i)
        cout << i + 1 << " " << d[i] << endl;

    return 0;
}

Measured memory_bytes: 3140
#!/usr/bin/env python3
import sys, math, fractions, itertools


def solve(A: int, B: int, C: int):
    print(max(C - (A-B), 0))
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    solve(A, B, C)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5340
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define rep(i,n) for(long i = 0;i<n;i++)
const long long MOD = 1000000007LL;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
int main(){
    int a,b;
    cin >> a >> b;
    if(a>12){
        cout << b << endl;
    }
    else if(a>=6){
        cout << b/2 << endl;
    }
    else{
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;using int32=int_fast32_t;using uint32=uint_fast32_t;using int64=int_fast64_t;using uint64=uint_fast64_t;using pi=pair<int32,int32>;using pll=pair<int64,int64>;using vi=vector<int32>;using vvi=vector<vector<int32>>;using vll=vector<int64>;using ll=int64;using ull=uint64;
#define all(x) x.begin(),x.end()
inline ll read(){ll x=0,f=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return x*f;}
void Main(){
    ll N = read(), K = read();
    vector<int> H(N);
    for(auto &h:H) h = read();
    sort(all(H));
    int ans=0x7fffffff;
    for(int i=0;i+K<=N;i++){
        ans = min(ans,H[i+K-1]-H[i]);
    }
    printf("%d\n", ans);
}
int main(){cin.tie(nullptr);ios::sync_with_stdio(false);Main();return 0;}

Measured memory_bytes: 640
N = int(input())
mod = 10 ** 9 + 7
S1 = input()
S2 = input()

i = 0
d = []
while i < N:
    if S1[i] == S2[i]:
        d.append(1)
        i += 1
    else:
        d.append(2)
        i += 2

memo = 3 if d[0] == 1 else 6
for x, y in zip(d[:-1], d[1:]):
    if (x, y) == (1, 1):
        memo *= 2
    elif (x, y) == (1, 2):
        memo *= 2
    elif (x, y) == (2, 1):
        memo *= 1
    else:
        memo *= 3
    memo %= mod

print(memo)

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

int main(){
int a,b,c,n,f;
cin>>a>>b>>c>>n;
  f=0;
for(int i=0;i<n/a+1;i++){
  for(int j=0;j<(n-i*a)/b+1;j++){
    if((n-i*a-b*j)%c==0){
      f++;
    }
  }
}
  cout<<f<<endl;
}


Measured memory_bytes: 256
package main

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

func main() {
	N := ReadInt()
	a := ReadInts(N)
	sort.Ints(a)
	for i, j := 0, N-1; i < j; {
		a[i], a[j] = a[j], a[i]
		i++
		j--
	}
	ans := 0
	for i := 1; i < N; i++ {
		ans += a[i/2]
	}
	fmt.Println(ans)
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int) { Scan(&i); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


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

namespace ConsoleApp15
{
    class Class339
    {
        static void Main()
        {
            var NT = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = NT[0], T = NT[1];
            int min = int.MaxValue;
            for(int i = 0; i < N; i++)
            {
                var ct = Console.ReadLine().Split().Select(int.Parse).ToArray();
                if (ct[1] <= T) min = Math.Min(min, ct[0]);
            }
            if (min == int.MaxValue) Console.WriteLine("TLE");
            else
            Console.WriteLine(min);
        }
    }
}


Measured memory_bytes: 13268
open System
open System.Collections.Generic

[<AutoOpen>]
module Cin =
    let read f = stdin.ReadLine() |> f
    let reada f = stdin.ReadLine().Split() |> Array.map f

    let readInts() =
        read string
        |> Seq.toArray
        |> Array.map (fun x -> Convert.ToInt32(x.ToString()))

module Util =
    let strRev (s: string): string =
        s
        |> Seq.rev
        |> Seq.map string
        |> String.concat ""

    let inline roundup (x: ^a) (y: ^a): ^a =
        let one = LanguagePrimitives.GenericOne
        (x + y - one) / y

type Pair = int * int

[<EntryPoint>]
let main _ =
    let N = read int
    let A = Array.zeroCreate N
    let xys = Array.zeroCreate N
    for i in 0..N-1 do
        let a = read int
        A.[i] <- a
        let xy = ResizeArray<Pair>()
        for _ in 0..a-1 do
            let [|x;y|] = reada int
            xy.Add((x-1,y))
        xys.[i] <- xy

    let mutable ans = 0
    let lim = (1 <<< N)
    for bit in 0..lim-1 do
        let mutable ok = true
        let mutable cnt = 0
        // i番目の人物を正直者と仮定
        for i in 0..N-1 do
            let bi = bit &&& (1 <<< i)
            if bi > 0 then
                cnt <- cnt + 1
                for xy in xys.[i] do
                    let x,y = xy
                    let bx = bit &&& (1 <<< x)
                    let bx = if bx > 0 then 1 else 0
                    // 仮定と実際の証言が矛盾しているか検証
                    if y <> bx then ok <- false

        if ok then
            // printfn "bit: %d, ans: %d, cnt: %d, ok: %b" bit ans cnt ok
            ans <- max ans cnt

    printfn "%d" ans

    0 // return an integer exit code


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

int main(){
    double a, res;
    while(cin >> a){
	res = a;
	for(int i = 2;i <= 10;i++){
	    if(i % 2 == 0)a *= 2;
	    else a/=3;
	    res += a;
	}
	printf("%.9lf\n", res);
    }
    return 0;
}

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


int main(){

    
    int i;

    vector<int> n(4);

    map<int, int> mp;


    cin >> n.at(0) >> n.at(1) >> n.at(2) >> n.at(3);


    for( i = 0 ; i < 4 ; i = i + 1 ){

         mp[n.at(i)] += 1;

         }

    
    if( mp[1] == 1 && mp[7] == 1 && mp[9] == 1 && mp[4] == 1 ) cout << "YES" << endl;

    else cout << "NO" << endl;


    return 0;

    }


Measured memory_bytes: 256
program main

read*,i1,i2,i3,i4,i5

if(i1==0)then
print*,'1'
end if
if(i2==0)then
print*,'2'
end if
if(i3==0)then
print*,'3'
end if
if(i4==0)then
print*,'4'
end if
if(i5==0)then
print*,'5'
end if

end program

Measured memory_bytes: 2788
# -*- coding: utf-8 -*-
from itertools import product
s = list(input())
n = len(s)
x = []
for i in range(n-1):
    x.append(s[i])
    x.append("")
x.append(s[n-1])

res = 0
for l in product(["","+"],repeat=n-1):
    for i in range(n-1):
        x[2*i+1] = l[i]
    res += eval("".join(x))
print(res)


Measured memory_bytes: 3060
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}
struct Combination{
private:
    ll N;
    vector<ll> fac, facinv;

public:
    Combination(ll n){
        N = n;
        fac.push_back(1); fac.push_back(1);
        rep(i,2,N+1) fac.push_back(fac[i-1] * i % MOD);
        rep(i,0,N+1) facinv.push_back(power(fac[i], MOD-2));
    }
    ll power(ll x, ll n){
        if(n == 0) return 1LL;
        ll res = power(x * x % MOD, n/2);
        if(n % 2 == 1) res = res * x % MOD;
        return res;
    }
    ll nck(ll n, ll k){
        if(k == 0 || n == k) return 1LL;
        return fac[n] * facinv[k] % MOD * facinv[n-k] % MOD;
    }
    ll npk(ll n, ll k){
        if(k == 0 || n == k) return 1LL;
        return fac[n] * facinv[n-k] % MOD;
    }
    ll get(ll x){return fac[x];};
    ll getinv(ll x){return facinv[x];};
};
Combination cb(2000010);

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll r1,c1,r2,c2;
    cin >> r1 >> c1 >> r2 >> c2;
    ll ans = 0;
    rep(c,c1,c2+1){
        ll start = c + r1;
        ll end = c + r2;
        ll val = (cb.nck(end+1, c+1) - cb.nck(start, c+1) + MOD) % MOD;
        ans += val;
        ans %= MOD;
    }
    print(ans);

    

}

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

#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
#define SQR(n) ((n) * (n))

//???
struct Point
{
  double x, y;
  
  Point() {}
  Point(double x, double y) : x(x), y(y) {}

  Point operator + (Point p) { return (Point(x + p.x, y + p.y)); }
  Point operator - (Point p) { return (Point(x - p.x, y - p.y)); }
  Point operator * (double a) { return (Point(x * a, y * a)); }
  Point operator / (double a) { return (Point(x / a, y / a)); }

  void input() { scanf("%lf %lf", &x, &y); }
  void output() { printf("%.10lf %.10lf", x, y); }
  void outputln() { output(); putchar('\n'); }
  double abs() { return (sqrt(norm())); }
  double norm() { return (SQR(x) + SQR(y)); }
  
  bool operator < (const Point &p) const {
    return (equals(x, p.x) ? y < p.y : x < p.x);
  }

  bool operator == (const Point &p) const {
    return (equals(x, p.x) && equals(y, p.y));
  }

};

//??????
struct Segment
{
  Point p1, p2;

  Segment() {}
  Segment(Point p1, Point p2) : p1(p1), p2(p2) {}

  void input() { p1.input(); p2.input(); }
  
};

struct Circle
{
  Point c;
  double r;
  Circle(Point c, double r) : c(c), r(r) {}
};
  
//??´???
typedef Segment Line; 
//????????????
typedef Point Vector;
typedef vector < Point > Polygon;

double dot(Vector a, Vector b)
{
  return (a.x * b.x + a.y * b.y);
}

double cross(Vector a, Vector b)
{
  return (a.x * b.y - a.y * b.x);
}

Point project(Segment s, Point p)
{
  Point base = s.p2 - s.p1;

  return (s.p1 + base * (dot(p - s.p1, base) / base.norm()));
}

main()
{
  int n;
  Segment s;

  s.input(); cin >> n;
  for(int i = 0; i < n; i++) {
    Point p;
    p.input();
    project(s, p).outputln();
  }

  return (0);
}

Measured memory_bytes: 3220