akhauriyash/Code-Regression huggingface dataset:
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す
  if n==1
    return Array.new(size){init}
  else
    return Array.new(n).map{Array.new(size){init}}
  end
end

n=gets.to_i
a=get_i

flag=true
a.each do|num|
  if (num%2).zero?
    unless (num%3).zero? or (num%5).zero?
      flag=false
      break
    end
  end
end
puts yn_judge(flag,"APPROVED","DENIED")

Measured memory_bytes: 1788
# Problem https://atcoder.jp/contests/abc082/tasks/abc082_b
# Python 3rd Try

yes = "Yes"
no = "No"

def solver(sStr,tStr):
    ssStr = ''.join(sorted(sStr))
    srtStr = ''.join(sorted(tStr,reverse=True))
    result = yes if ssStr < srtStr else no
    return result

if __name__ == "__main__":
    s = input()
    t = input()
    answer = solver(s,t)
    print(answer)


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

int main(){
  int x=0;
  int n;
  char s[111];
  int y=0;

  scanf(" %d",&n);
  scanf(" %s",s);

   for(int i=0;i<n;i++){
    if(s[i]=='I'){
      x++;
    }else if(s[i]=='D'){
      x--;
    }
    y=max(y,x);
  }

  cout << y << endl;

  return 0;

}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
int years[3001]={0},a,b,c,f=0;
for(int i=0;i<3000;i++){
	if(i%4==0){
		if(i%100==0 && i%400==0){
			years[i]=1;
		}else if(i%100!=0){
			years[i]=1;
		}
	}
}	
while(1){
	scanf("%d %d",&a,&b);
	if(a==0 && b==0) break;
	f==0?f=1:printf("\n");
	c=0;
	a+=(a%4==0?0:4-a%4);
	for(int i=a;i<=b;i+=4){
		if(years[i]==1){
			printf("%d\n",i);
			c++;
		}
	}
	printf("%s",c==0?"NA\n":"");
}
}

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

int main(){
  string S,T,U;
  int A,B;
  cin >>S>>T;
  cin>>A>>B;
  cin>>U;
  
  if (U==S){
    cout<<A-1<<" "<<B;
      return 0;
  }
  cout<<A<<" "<<B-1;
  

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <ios>
#include <vector>
#include <algorithm>
using namespace std;

template <typename T>
void insertion_sort(vector<T> & A, int g);

template <typename T>
void shell_sort(vector<T> & A);

int cnt = 0;

int main()
{
    ios::sync_with_stdio(false);
    int n = 0;
    cin >> n;
    vector<int> A(n);
    for (auto & ai : A) cin >> ai;
    shell_sort(A);
    return 0;
}

template <typename T>
void insertion_sort(vector<T> & A, int g){
    for (int i = g; i != A.size(); ++i){
        auto v = A[i];
        auto j = i - g;
        while (j >= 0 and A[j] > v){
            A[j+g] = A[j];
            j -= g;
            ++cnt;
        }
        A[j+g] = v;
    }
}


template <typename T>
void shell_sort(vector<T> & A){
    cnt = 0;
    vector<int> G;
    for (int gi = 1; gi <= A.size(); gi = 3 * gi + 1) G.push_back(gi);
    reverse(G.begin(), G.end());
    for (auto gi: G) insertion_sort(A, gi);

    cout << G.size() << endl;
    cout << G[0];
    for (auto it=G.begin()+1; it!=G.end(); ++it) cout << ' ' << *it;
    cout << endl;
    cout << cnt << endl;
    for (auto ai : A) cout << ai << '\n';
}

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

#define nl '\n'

using namespace std;

typedef long long ll;

void solve() {
  int n;
  cin >> n;

  ll a[n];
  unordered_map<ll, ll> count;
  ll sum = 0;
  for (ll& i: a) {
    cin >> i;
    count[i]++;
    sum += i;
  } 

  int q;
  cin >> q;
  while (q--) {
    int b, c;
    cin >> b >> c;
    sum += count[b] * (c - b);
    count[c] += count[b];
    count.erase(count.find(b));
    cout << sum << nl;
  } 
}

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

  // int t;
  // cin >> t;
  // while (t--) {
  solve();
  // }

  return 0;
}

Measured memory_bytes: 7452
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	string s;
	cin >> s;	

	int sz = s.size();

	vector<int> occs(3);
	for (int i = 0; i < sz; ++i) {
		++occs[s[i] - 'a'];
	}

	sort(occs.begin(), occs.end());
	if (occs[2] - occs[0] <= 1) {
		cout << "YES\n";
	} else {
		cout << "NO\n";
	}

	return 0;

}

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

int main()
{
     int num[8];
     int pattan[7][4] = {{11000000, 11000000, 0, 0},
                         {10000000, 10000000, 10000000, 10000000},
                         {11110000, 0, 0, 0},
                         {1000000, 11000000, 10000000, 0},
                         {11000000, 1100000, 0, 0},
                         {10000000, 11000000, 1000000, 0},
                         {1100000, 11000000, 0, 0} };
     while (cin >> num[0]) {
          for (int i = 1; i < 8; i++) cin >> num[i];
          int t = 0;
          while (num[t] == 0) t++;
          //char
          for (int i = 0; i < 7; i++) {
               //sift
               for (int j = 0; j < 8;j++) {
                    //good mach
                    int flag = 1, tmp = 1;
                    for (int k = 0; k < j; k++) tmp *= 10;
                    for (int k = 0; k < 4; k++)
                         if (num[t + k] != (pattan[i][k] / tmp) && t + k < 8) flag = 0;
                    char str = 'A' + i;
                    if (flag) cout << str << endl;
               }
          }
     }

     return 0;
}

Measured memory_bytes: 1152
fn main() {
    let v = read_vec::<u32>();
    let n = v[0];
    let _k = v[1];
    let ds = read_vec::<u32>();
    let mut ans = 0;
    for i in n.. {
        let mut is_ok = true;
        let mut j = i;
        while j > 0 {
            if ds.contains(&(j % 10)) {
                is_ok = false;
                break;
            }
            j /= 10;
        }
        if is_ok {
            ans = i;
            break;
        }
    }
    println!("{}", ans);
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <iomanip>
#include <stack>
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <algorithm>
#include <iterator>
#include <string>
#include <cstring>
//#include <fstream>
#include <complex>
#define _USE_MATH_DEFINES
#include <cmath>
#include <math.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n;i>0;i--)
#define arep(a,i,n) for(int i=(a);i<(n);i++)
#define SORT(v) sort((v).begin(),(v).end())
const ll INF = (1LL << 50);
typedef pair<int, int> P;

int main() {

	int N;
	cin >> N;

	int flag = 0;
	int temp;
	for (int i = 0; i <= N; i++) {
		if (int(i*1.08) == N) {
			flag = 1;
			temp = i;
		}
	}

	if (flag) cout << temp << endl;
	else cout << ":(" << endl;

	return 0;

}

Measured memory_bytes: 256
import math

a,b,x = (int(num) for num in input().split())
suf2 = a*b
vol = a*a*b
if (vol/2)>=x:
    l1 = x*2 / suf2
    x = float(b)/l1
    ans = math.degrees(math.atan(x))
else:
    l2 = (vol-x)*2 / (a*a)
    x = l2/float(a)
    ans = math.degrees(math.atan(x))
    
print(round(ans,6))

Measured memory_bytes: 3188
N,M = map(int,input().split())
list_N = list(map(int,input().split()))

count = 0

get = sum(list_N)/(4*M)

for i in range(N):
    if list_N[i] >= get:
        count += 1

if count >= M:
    print("Yes")
else:
    print("No")


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

int main() {
    vector<string> input(2);
    cin >> input[0] >> input[1];
    sort(input[0].begin(), input[0].end());
    sort(input[1].begin(), input[1].end(), greater<>());
    if (input[0] < input[1]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        final Scanner scanner = new Scanner(System.in);
        final String s = scanner.nextLine();

        final StringBuilder cand0Builder = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            cand0Builder.append(i % 2 == 0 ? '0' : '1');
        }

        final String cand0 = cand0Builder.toString();

        int diffCount0 = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == cand0.charAt(i)) {
                diffCount0++;
            }
        }

        System.out.println(Math.min(diffCount0, cand0.length() - diffCount0));
    }
}


Measured memory_bytes: 27708
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <cstring>

using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define alpa 26
#define D 365

int d;
int c[alpa];
int s[alpa];
int c_sum[alpa][D+1];
int idx[alpa];
int suf[alpa];

int main() {
    cin >> d;

    rep(i,alpa) cin >> c[i];

    rep(i,alpa) c_sum[i][0] = 0;

    rep(i,alpa){
        for(int j = 0; j <= d; j++){
            c_sum[i][j] = c_sum[i][j-1]+c[i];
        }
    }

    rep(i,d){
        int max_idx = 0;
        rep(j,alpa){
            cin >> s[j];

            suf[j] = s[j] + c_sum[j][idx[j]+1];

            if (suf[max_idx] < suf[j]){
                max_idx = j;
            }
            else if (suf[max_idx] == suf[j]){
                if (c[max_idx] < c[j]){
                    max_idx = j;
                }
            }
        }

        rep(j,alpa){
            if (j != max_idx) idx[j]++;
            else idx[j] = 0;
        }

        cout << max_idx+1 << endl;
    }

    return 0;
}

Measured memory_bytes: 3648
#include<stdio.h>
#include<stdlib.h>
typedef struct list{
  int nodeid;
  int parent;
  int depth;
  int child_num;
  int *child_list;
  int type;
}node_list;

void renew_depth(node_list *,int);

int main(){
  int i,j,n,k,id,*child;
  node_list *A;

  scanf("%d",&n);

  A = malloc(sizeof(node_list)*n);
  for(i=0;i<n;i++){
    A[i].parent = -1;
    A[i].depth = 0;
    A[i].child_list =NULL;
  }
  for(i=0;i<n;i++){
    scanf("%d %d",&id,&k);
    A[id].nodeid=id;
    A[id].child_num=k;
    if(k>0){
      A[id].child_list = malloc(sizeof(int)*k);
      for(j=0;j<k;j++){
	scanf("%d",&A[id].child_list[j]);
	A[A[id].child_list[j]].parent = id;
	A[A[id].child_list[j]].depth += 1;
      }
    }
  }
  for(i=0;i<n;i++){
    if(A[i].parent ==  -1){
      renew_depth(A,i);
      break;
    }
  }  

  for(i=0;i<n;i++){
    printf("node %d: parent = %d, depth = %d,",i,A[i].parent,A[i].depth);
    if(A[i].depth == 0){
      printf(" root,");
    }
    else if(A[i].child_list == NULL){
      printf(" leaf,");
    }
    else printf(" internal node,");
    printf(" [");
    for(j=0;j<A[i].child_num;j++){
      if(j==0)printf("%d",A[i].child_list[j]);
      else printf(", %d",A[i].child_list[j]);
      
    }
    printf("]\n");
    free(A[i].child_list);
  }
  free(A);
  return 0;
}

void renew_depth(node_list *A,int i){
  int j;
  for(j=0;j<A[i].child_num;j++){
    A[A[i].child_list[j]].depth += A[i].depth ;
    renew_depth(A,A[i].child_list[j]);
  }
}


Measured memory_bytes: 4908
#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 ff                  first
#define ss                  second
#define endl                "\n"
#define loop(i,s,e)         for(int i=s;i<e;i++)
#define int                 long long
#define vi                  vector<int> 
#define S(v)                sort(v.begin(),v.end())
#define RS(v)               sort(v.rbegin(),v.rend())
#define R(v)                reverse(v.begin(),v.end())
#define mxpq(T)             priority_queue <T>
#define mnpq(T)             priority_queue<T,vector<T>,greater<T>>
#define prv(v)              for(auto &x : v)cout << x << " ";
#define piirv(v)            for(auto &x : v)cout << x.ff << " " << x.ss << endl;
#define prvv(v)             for(auto &x : v)for(auto &y : x.ss)cout << y << " ";
#define mp                  make_pair
#define pii                 pair<int,int>
#define mset(a,f)           memset(a , f , sizeof(a))
#define pb                  push_back
#define inf                 INT_MAX
#define INF                 LLONG_MAX
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;
 
const int N = 2e6 + 6;
const int M = 1e9+7;
int A[N];
int n , m;

void solve()
{
	int n;
	cin >> n;
	n--;

	string res = "";

	while(n >= 0)
	{
		int j = n%26;
		res = (char)('a' + j) + res;
		n /= 26;
		n--;
	}

	cout << res;
}			
 
int32_t main()
{
 
cout<<fixed<<setprecision(16);
 
ios_base:: sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
 	
 
 	int t = 1;
 	// cin >> t;
 	while(t--)solve();
  
}

Measured memory_bytes: 3600
{-
 - `chebyshev n' returns the number of primes between n+1 and 2n.
 - e.g.:
 -   chebyshev 10 == 4    -- 11, 13, 17, 19
 -   chebyshev 13 == 3    -- 17, 19, 23
 -}

import Control.Monad  -- when

chebyshev :: Int -> Int
chebyshev n = length [x | x<-[n + 1 .. 2 * n], prime x]
 
prime :: Int -> Bool
prime n | n >= 2 = [x | x<-fs, n`mod`x == 0] == []
  where fs = takeWhile (\x->x*x <= n) ([2] ++ [3,5..])
                         -- x*x is faster than x^2

main :: IO ()
main = do n <- readLn
          when (n /= 0) $ do
            print (chebyshev n)
            main

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

using namespace std;

int main() {

	int n;

	cin >> n;

	// vector<int> a(n);

	int res = 0;

	for(int i = 1; i < n + 1; i++) {

		int k;
		cin >> k;

		if(i%2 && k%2) {
			res++;
		}
	}

	cout << res <<'\n';



	return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> pi;
typedef pair<int,int> vi;

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i < b; i++)


bool sort_by(vi c, vi d){
	return c.S < d.S;
}

int solve(int arr[], int odds, int pos, int max){
	if(pos == max){
		//cout << odds << endl;
		return (odds!=max?1:0);
	}
	int a = solve(arr, ((arr[pos]-1)%2==0?odds:odds+1), pos+1, max);
	int b = solve(arr, ((arr[pos]%2)==0?odds:odds+1), pos+1, max);
	int c = solve(arr, ((arr[pos]+1)%2==0?odds:odds+1), pos+1, max);
	return a+b+c;
}

int main() {
	int N;
	cin >> N;
	int arr[N];
	REP(i, 0, N) cin >> arr[i];
	
	cout << solve(arr, 0, 0, N);


}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        Integer K = Integer.parseInt(scanner.next());
        Integer N = Integer.parseInt(scanner.next());
        Integer[] dis = new Integer[N];
        Integer[] total = new Integer[N];

        for (int i = 0; i < N; i++) {
           dis[i] = Integer.parseInt(scanner.next());
        }
        for (int i = 0; i < N-1; i++) {
            total[i] = Math.abs(dis[i] - dis[i + 1]);
        }

        total[N-1] = Math.abs((K - dis[N-1]) + dis[0]);
        Arrays.sort(total);
        total[total.length-1] = 0;
        Integer sum = 0;
        for (int i = 0; i < total.length; i++) sum += total[i];
        System.out.println(sum);
    }
}


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

int main(){
    int W,H,x,y,r;
    cin >> W >> H >> x >> y >> r;
    if(x-r>=0&&x+r<=W&&y-r>=0&&y+r<=H)printf("%s\n", "Yes");
    else printf("%s\n", "No");
    return 0;
}


Measured memory_bytes: 3096
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		System.out.println(br.readLine().toUpperCase());
	}

}

Measured memory_bytes: 24104
import java.io.*;

class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb=new StringBuilder();
		int i=1;
		while(true){
			int x=Integer.parseInt(br.readLine());
			if(x==0) break;
			sb.append("Case "+i+": "+x+"\n");
			i++;
			}
		System.out.print(sb);
	}
}		

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

int main() {
	long n;
	cin>>n;
	int count;
	vector<int> d(100);
	if (n==0) cout << 0 << endl;
	else if(n==1) cout << 1 << endl;
	else {
		for(int i=0;i<100;i++) {
			if(n%(-2)==0){
				d[i]=0;
				n/=(-2);
			}
			else {
				d[i] = 1;
				if(n>0)n = -1*(n/2);
				else n = n/(-2)+1;
			}
			if(n==1){
				count = i;
				break;
			}
		}
		cout << "1";
		for (int i=count;i>=0;i--){
			cout << d[i];
		}
		cout << endl;
	}
}


Measured memory_bytes: 256
Q = int(input())
AB = [list(map(int,input().split())) for _ in range(Q)]

def cn(A,B):
    score = A*B-1
    L = A+1
    R = score
    if L>R:
        return 0
    while L!=R:
        tmp = (L+R)//2
        if score > tmp*(tmp+1):
            L = tmp+1
        else:
            R = tmp
    return (L-1-A+score//L)
for ab in AB:
    print(cn(ab[0],ab[1])+cn(ab[1],ab[0]))


Measured memory_bytes: 3064
#include <iostream>

using namespace std;
long long dp[101][100001];
int main()
{
    long long n, w;
    cin>>n>>w;
    long long items[n][2];
    for(int i=0;i<n;i++)
    {
        cin>>items[i][0]>>items[i][1];
    }
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=100000;j++)
        {
            dp[i][j]=-1;
        }
    }
    dp[0][0]=0;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<=100000;j++)
        {
            if(dp[i][j]!=-1)
            {
                if(dp[i+1][j]!=-1)
                dp[i+1][j]=min(dp[i][j],dp[i+1][j]);
                else
                dp[i+1][j]=dp[i][j];
                if(dp[i+1][j+items[i][1]]!=-1)
                dp[i+1][j+items[i][1]]=min(dp[i+1][j+items[i][1]],dp[i][j]+items[i][0]);
                else
                dp[i+1][j+items[i][1]]=dp[i][j]+items[i][0];
            }
        }
    }
    for(int i=100000;i>=0;i--)
    {
        if(dp[n][i]<=w&&dp[n][i]!=-1)
        {
            cout<<i<<endl;
            break;
        }
    }
}

Measured memory_bytes: 79104
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), k = sc.nextInt() - 1;
        String s = sc.next();
        System.out.println(s.substring(0, k) + s.substring(k, k + 1).toLowerCase() + s.substring(k + 1));
    }
}


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

int main(){
  int N;
  cin >> N;
  int X =0;
  
  for (int i=1;i<46298;i++){
    long double j=i*1.08;
    int k=j;
    if (k==N){
      X=i;
      break;
    }
  }
  
  if (X==0){
    cout << ":(" << endl;
  }
  else{
    cout << X << endl;
  }
  return 0;
  
}

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

if 400 <= n and n <= 599:
    print(8)
elif 600 <= n and n <= 799:
    print(7)
elif 800 <= n and n <= 999:
    print(6)
elif 1000 <= n and n <= 1199:
    print(5)
elif 1200 <= n and n <= 1399:
    print(4)
elif 1400 <= n and n <= 1599:
    print(3)
elif 1600 <= n and n <= 1799:
    print(2)
else:
    print(1)


Measured memory_bytes: 61768
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for (int i = a; i < b; i++)
using namespace std;

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <tuple>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <stack>
#include <bitset>

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

	vector<pair<pair<string, int>, int>> v(N);

	rep(i, N) {
		cin >> v.at(i).first.first >> v.at(i).first.second;
		v.at(i).first.second *= -1;
		v.at(i).second = i + 1;
	}

	sort(v.begin(), v.end());

	rep(i, N) {
		cout << v.at(i).second << endl;	
	}
}

Measured memory_bytes: 256
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, D, *XY = map(int, read().split())

    ans = 0
    for x, y in zip(*[iter(XY)] * 2):
        if x ** 2 + y ** 2 <= D ** 2:
            ans += 1

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 54780
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDight(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int, int>;
typedef vector<int> vit;

//最大公約数
lol gcd(lol x, lol y){
  if(x < y) swap(x, y);
  lol r = x % y;
  while(r != 0){
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}

//最小公倍数
lol lcm(lol x, lol y){
  lol a = x * y;
  return (a / gcd(x, y));
}

signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  int n;
  cin >> n;
  lol a[n + 5], ans = 0;
  rep(i, n){
    cin >> a[i];
    ans = (a[i] ^ ans);
  }
  rep(i, n){
    if(n - 1 == i){
      cout << (a[i] ^ ans) << '\n';
    }else {
      cout << (a[i] ^ ans) << " ";
    }
  }
  return 0;
}


Measured memory_bytes: 5096
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    int c=0;
    for(int i=0;i<2;i++){
    if(a>b){
        c=c+a;
        a=a-1;
    }
    else{
     c=c+b;
     b=b-1;
    }
    }
    cout<<c<<endl;
}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

char STR[1000001];
int SUM[3000001];

int main()
{
	int i, j, a, sum, max;
	char data[] = {'J', 'O', 'I'};
	scanf("%s", STR);
	
	a = 0;
	j = 0;
	sum = 0;

	for(i = 0; STR[i] != '\0'; i++){
		if(STR[i] == data[a])
		{
			sum++;
		}
		else
		{
			SUM[j++] = sum;
			a = (a + 1) % 3;
			sum = 0;
			i--;
		}
	}
	SUM[j++] = sum;
	
	max = 0;


	for(i = 0; i < j; i += 3){
		if(SUM[i + 1] <= SUM[i] && SUM[i + 1] <= SUM[i + 2] && max < SUM[i + 1])
		{
			max = SUM[i + 1];
		}
	}

	printf("%d\n", max);
	
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>

using namespace std;

const int MAX = 505;

int d[MAX + 1];

void init() {
    for(int i = 1; i <= MAX; ++i){
        d[i] = i;
    }
}

int find(int n) {
    return (d[n] == n) ? d[n] : d[n] = find(d[n]);
}

bool Union(int a, int b) {
    int x = find(a);
    int y = find(b);
    if(x != y) d[x] = y;
    return x != y;
}

struct E {
    E(int len = 0, int node1 = 0, int node2 = 0, bool is_delete = false):len(len), node1(node1), node2(node2), is_delete(is_delete){}
    int len, node1, node2;
    bool is_delete;
};

bool cmp(const E& l, const E& r){
    return l.len < r.len;
}

vector<E> edge, mst;

pair<int, int> kruskal(bool make_mst = false)
{
    init();
    int res = 0, num = 0;
    for(auto& e : edge){
        if(e.is_delete) continue;
        if(Union(e.node1, e.node2)){
            if(make_mst) mst.push_back(e);
            res += e.len;
            num++;
        }
    }
    return make_pair(res, num);
}

int main()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
    int N, M;
    cin >> N >> M;
    int S, D, C;
    for(int i = 0; i < M; ++i){
        cin >> S >> D >> C;
        edge.push_back(E(C, S, D));
    }
    sort(edge.begin(), edge.end(), cmp);
    int mst_len = kruskal(true).first;
    int num = 0, len = 0;
    for(auto& e : mst){
        pair<int, int> res;
        for(auto& i : edge){
            if(e.node1 == i.node1 && e.node2 == i.node2){
                i.is_delete = true;
                res = kruskal();
                i.is_delete = false;
            }
        }
        if(res.second < N - 1 || res.first > mst_len){
            num++;
            len += e.len;
        }
    }
    cout << num << " " << len << endl;
}

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

using namespace std;

int main(){
        string s1, s2, s3;
        cin>>s1>>s2>>s3;
        string res;
        res+=s1[0]-32;
        res+=s2[0]-32;
        res+=s3[0]-32;
        cout<<res<<endl;
        return 0;
}


Measured memory_bytes: 256
using System.Collections.Generic;
using System;

public class Fee
{
    public int L { get; set; }
    public int w { get; set; }
    public int f { get; set; }
}
public class hello
{
    public static void Main()
    {
        while (true)
        {
            var fees = new List<Fee>();
            FeeSet(fees);
            var n = int.Parse(Console.ReadLine().Trim());
            if (n == 0) break;
            var ans = 0;
            for (int i = 0; i < n; i++)
            {
                string[] line = Console.ReadLine().Trim().Split(' ');
                var a = Array.ConvertAll(line, int.Parse);
                var L = a[0] + a[1] + a[2];
                for (int j = 0; j < 6; j++)
                    if (L <= fees[j].L && a[3] <= fees[j].w) { ans += fees[j].f; break; }
            }
            Console.WriteLine(ans);
        }
    }
    public static void FeeSet(List<Fee> f)
    {
        var a = new int[] { 60, 80, 100, 120, 140, 160 };
        var b = new int[] { 2, 5, 10, 15, 20, 25 };
        var c = new int[] { 600, 800, 1000, 1200, 1400, 1600 };
        for (int i = 0; i < 6; i++)
            f.Add(new Fee { L = a[i], w = b[i], f = c[i] });
    }
}

Measured memory_bytes: 9400
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <string>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <bitset>
#include <queue>
#include <utility>
#include <functional>
#include <sstream>
using namespace std;
#define ll long long
 
int main(void){
    ll a, b, c;
    cin >> a >> b >> c;
    if(c-a-b>0 && 4*a*b<(c-a-b)*(c-a-b))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
lint mod       = 1000000007;

// Eratosthenes's sieve
// create list of prime numbers in O(N)
// check if the given number is prime in O(1)
struct Sieve {
    vector<bool> isPrime;
    Sieve(size_t max) : isPrime(max + 1, true) {
        isPrime[0] = false;
        isPrime[1] = false;

        for (size_t i = 2; i * i <= max; ++i)
            if (isPrime[i])
                for (size_t j = 2; i * j <= max; ++j)
                    isPrime[i * j] = false;
    }
    bool operator()(size_t n) { return isPrime[n]; }
};

struct mint {
    lint v;
    lint _mod;
    mint() : v(0) {}
    mint(signed v, lint _mod = mod) : v(v), _mod(_mod) {}
    mint(lint t, lint _mod = mod) : _mod(_mod) {
        v = t % _mod;
        if (v < 0)
            v += _mod;
    }

    mint pow(lint k) {
        mint res(1), tmp(v);
        while (k) {
            if (k & 1)
                res *= tmp;
            tmp *= tmp;
            k >>= 1;
        }
        return res;
    }
    static mint add_identity() { return mint(0); }
    static mint mul_identity() { return mint(1); }
    mint inv() { return pow(_mod - 2); }

    mint &operator+=(mint a) {
        v += a.v;
        if (v >= _mod)
            v -= _mod;
        return *this;
    }
    mint &operator-=(mint a) {
        v += _mod - a.v;
        if (v >= _mod)
            v -= _mod;
        return *this;
    }
    mint &operator*=(mint a) {
        v = v * a.v % _mod;
        return *this;
    }
    mint &operator/=(mint a) { return (*this) *= a.inv(); }

    mint operator+(mint a) const { return mint(v) += a; };
    mint operator-(mint a) const { return mint(v) -= a; };
    mint operator*(mint a) const { return mint(v) *= a; };
    mint operator/(mint a) const { return mint(v) /= a; };

    mint operator-() const { return v ? mint(_mod - v) : mint(v); }

    bool operator==(const mint a) const { return v == a.v; }
    bool operator!=(const mint a) const { return v != a.v; }
    bool operator<(const mint a) const { return v < a.v; }
};
ostream &operator<<(ostream &os, mint m) { return os << m.v; }

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint n, p;
    cin >> n >> p;
    string s;
    cin >> s;
    mod = p;

    if (p == 2 || p == 5) {
        lint ret = 0;
        for (int i = 0; i < n; ++i) {
            if ((s[i] - '0') % p == 0) {
                ret += i + 1;
            }
        }
        cout << ret << "\n";
        return 0;
    }
    vector<mint> t(n, 0);
    mint tens = 1;
    for (int i = n - 1; i >= 0; --i) {
        int curr = (s[i] - '0');
        t[i]     = tens * curr;
        tens *= 10;
    }
    for (int i = n - 2; i >= 0; --i) {
        t[i] += t[i + 1];
    }
    lint ret = 0;
    map<int, lint> cnt;
    cnt[0]++;
    // tens = mint(10).pow(n - 1);
    for (int i = 0; i < n; ++i) {
        mint tag = t[i];
        ret += cnt[tag.v];
        cnt[t[i].v]++;
        // tens /= 10;
    }
    cout << ret << "\n";

    return 0;
}

Measured memory_bytes: 4116
#include<map>
#include<queue>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<vector>
#include<cstring>
#include<algorithm>
#define lc (x<<1)
#define rc (x<<1|1)
#define gc getchar()
#define mk make_pair
#define pi pair<int,int>
using namespace std;
typedef long long ll;
const int N=1e5+10;

template<class o> void qr(o &x) {
	char c=gc; x=0; int f=1;
	while(!isdigit(c)){if(c=='-')f=-1; c=gc;}
	while(isdigit(c)) x=x*10+c-'0',c=gc;
	x*=f;
}
template<class o> void qw(o x) {
	if(x/10) qw(x/10);
	putchar(x%10+'0');
}
template<class o> void pr1(o x) {
	if(x<0)x=-x,putchar('-');
	qw(x); putchar(' ');
}
template<class o> void pr2(o x) {
	if(x<0)x=-x,putchar('-');
	qw(x); puts("");
}

int a[44]={0,1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main() {
	int n; qr(n);pr2(a[n]);
	return 0;
}



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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

ll n;

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

  cin>>n;
  cout<<180*(n-2)<<endl;

  return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
A_sum = sum(A[1:])

tot = 0
for i in range(N-1):
    tot += (A[i]*A_sum)%(10**9+7)
    tot = tot%(10**9+7)
    A_sum -= A[i+1]
    
print(tot)

Measured memory_bytes: 31436
#include <bits/stdc++.h>
#define FIN         ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ii          pair<int,int>
#define F           first
#define S           second
#define pb          push_back
#define all(x)      (x).begin(),(x).end()
#define rall(x)     (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a)   for(int i = a; i >= 0; i--)
#define fori(i,m)   for(auto i = m.begin(); i != m.end(); i++) 
#define w(t)        while(t--)
#define sz(s)       int(s.size())
#define cls(a,car)  memset(a,car,sizeof (a))
#define db(x)       cerr << #x << " is " << x << '\n'
#define FL          freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout);
#define EjecuteTime cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
#define angle(x)    double(x * acos(-1) / 180.0)
using namespace std;
typedef long long   ll;
typedef vector<int> vi;
typedef vector<ii>  vii;
const int N = 1 * 1e5 + 5;
const ll mod = 1e9 + 7;
const double E = 1e-9;
int dx[] = {1, 0}, dy[] = {0, 1};
//int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
//int dx[] = {2, 1, -1, -2, -2, -1, 1, 2}, dy[] = {1, 2, 2, 1, -1, -2, -2, -1};
//int dx[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy[] = {0 ,1, 1, 1, 0, -1, -1, -1};
// fflush(stdout)
// cout << flush
// a + b = a ^ b + 2 * (a & b)
int sumMod(int a, int b){return 0LL + a + b > mod ? a + b - mod : a + b;}
int H, W;
char v[1005][1005];
int dp[1005][1005];
int f(int i, int j){
    if(i == H - 1 && j == W - 1)
        return 1;
    int &ans = dp[i][j];
    if(ans == -1){
        ans = 0;
        for(int k = 0; k < 2; k++){
            int x = i + dx[k];
            int y = j + dy[k];
            if(x >= 0 && x < H && y >= 0 && y < W && v[x][y] == '.')
                //ans = (ans % mod + f(x, y)% mod) % mod;
                ans = sumMod(ans, f(x, y));
        }
    }
    return ans;
}
int main(){
    //FL;
    FIN;
    cin >> H >> W;
    for(int i = 0; i < H; i++)
        for(int j = 0; j < W; j++)
            cin >> v[i][j];
    cls(dp, -1);
    cout << f(0, 0) << '\n';
    EjecuteTime;
    return 0;
}       

Measured memory_bytes: 8812
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,b,n) for(int i=b;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define all(obj) (obj).begin(),(obj).end()

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin>>n;
    ll tot=0;
    vector<int> a[3];
    string ss;cin>>ss;
    rep(i,(int)ss.size()){
      if(ss[i]=='R')a[0].push_back(i);
      else if(ss[i]=='G')a[1].push_back(i);
      else a[2].push_back(i);
    }
    rep(i,(int)ss.size())for(int j=i+1;j<(int)ss.size();j++){
          if(ss[j]==ss[i])continue;
          if((ss[i]=='R'&&ss[j]=='G')||(ss[i]=='G'&&ss[j]=='R')){
            int f=upper_bound(a[2].begin(),a[2].end(),j)-a[2].begin();
            tot+=a[2].size()-f;
            if(2*j-i<(int)ss.size()&&ss[2*j-i]=='B')tot--;
          }
          else if((ss[i]=='R'&&ss[j]=='B')||(ss[i]=='B'&&ss[j]=='R')){
            int f=upper_bound(a[1].begin(),a[1].end(),j)-a[1].begin();
            tot+=a[1].size()-f;
            if(2*j-i<(int)ss.size()&&ss[2*j-i]=='G')tot--;
          }
          else if((ss[i]=='G'&&ss[j]=='B')||(ss[i]=='B'&&ss[j]=='G')){
            int f=upper_bound(a[0].begin(),a[0].end(),j)-a[0].begin();
            tot+=a[0].size()-f;
            if(2*j-i<(int)ss.size()&&ss[2*j-i]=='R')tot--;
          }
    }
    cout<<tot<<endl;
    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
const int Maxn=1e5+10;
int N,M;
vector<int> G[Maxn];
int Parents[Maxn];
stack<int> St;
int Dp[Maxn];
int main()
{
	cin>>N>>M;
	for(int i=1;i<=M;i++)
	{
		int X,Y;
		cin>>X>>Y;
		++Parents[Y];
		G[X].push_back(Y);
	}
	for(int i=1;i<=N;i++)
	{
		if(Parents[i]==0)
		{
			St.push(i);
		}
	}
	while(!St.empty())
	{
		int T=St.top();
		St.pop();
		for(int i=0;i<G[T].size();i++)
		{
			int to=G[T][i];
			Dp[to]=max(Dp[to],Dp[T]+1);
			--Parents[to];
			if(Parents[to]==0)
			{
				St.push(to);
			} 
		}
	}
	cout<<*max_element(Dp+1,Dp+1+N)<<endl; 
	return 0; 
}

Measured memory_bytes: 6528
#include<iostream>
#include<algorithm>
#include <iostream> 
#include <algorithm> 
#include<string>
#include<queue>
#include<utility>
#include<fstream>
#include<queue>
#include<set>
#include<stack>
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define I(a) scanf("%d",&a)
#define I2(a,b) scanf("%d%d",&a,&b)
#define I3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define L(a) scanf("%lld",&a)
#define L2(a,b) scanf("%lld%lld",&a,&b)
#define L3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define PI(a) printf("%d",a)
#define PL(a) printf("%lld",a)
#define PT(t) printf("Case %d: ",t)
#define PB push_back
#define x first
#define y second
#define xx first.first
#define xy first.second
#define yx second.first
#define yy second.second
#define SC scanf
#define PC printf
#define NL printf("\n")
#define SET(a) memset(a,0,sizeof a)
#define SETR(a) memset(a,-1,sizeof a)
#define SZ(a) ((int)a.size())-1
#define f(i,a,b) for(int i=a;i<=b; i++)
#define fr(i,a,b) for(int i=a;i<=b; i++)
#define frr(i,a,b) for(int i=a;i>=b; i--)
#define frv(i,a)  for(int i=0;i<a.size();i++)
#define pi 2.0*acos(0.0)
#define R(a) freopen(a, "r", stdin);
#define W(a) freopen(a, "w", stdout);
#define CB(x) __builtin_popcount(x)
#define STN(a) stringtonumber<ll>(a)
#define lol printf("BUG\n")
#define Endl "\n"
#define mk make_pair
using namespace std;
template <class T> inline T BM(T p, T e, T M)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    }
    return (T)ret;
}
template <class T> inline T gcd(T a, T b)
{
    if(b == 0)return a;
    return gcd(b, a % b);
}
template <class T> inline T mdINV(T a, T M)
{
    return BM(a, M - 2, M);
}
template <class T> inline T PW(T p, T e)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p);
        p = (p * p);
    }
    return (T)ret;
}
 
 
template <class T>bool ISLEFT(T a, T b, T c)
{
    if(((a.xx - b.xx) * (b.yy - c.yy) - (b.xx - c.xx) * (a.yy - b.yy)) < 0.0)return 1;  //Uporer dike //A,b,c, x okkher ordera sorted
    else return 0;
}
 
 
typedef pair<int,int >P;
//////////////////////////
/////////////////////////
//#include<bits/stdc++.h>
using namespace std;
#define Base1   101LL
#define Base2   10000079LL
#define Base3   10000103LL
#define MOD1    1000000007LL
#define MOD2    1000000009LL
#define MOD3    1000000021LL
#define mx 100000//Number of charter of main string
#define mx1 25000// Number off character of total charcater
#define mx2 500// Number of pattern and number of ch of each pattern

int main(){

    int n;
    I(n);
    ll ar[10][10];
    SET(ar);
    for(int i = 1;i<=n;i++){
        int fi = i % 10;
        int x = i;
        while(x > 9){
            x  /= 10;
        }
        ar[x][fi] ++;

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

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    char S[7];
    cin >> S;
    if(S[2]== S[3]) {
        if(S[4]==S[5]){
       cout << "Yes" << endl;
        }
        else cout << "No" << endl;
     }
    else cout << "No" << endl;
    return 0;
}

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

vector<pair<int, int> > v;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k; cin >> n >> k;
	if ((n - 1) * (n - 2) / 2 < k) {
		cout << -1 << '\n';
		return 0;
	}
	for (int i = 2; i <= n; i++)
		v.push_back(make_pair(1, i));
	for (int i = 2; i <= n; i++)
		for (int j = i + 1; j <= n; j++) {
			if (k) {
				k--;
				continue;
			}
			v.push_back(make_pair(i, j));
		}
	cout << v.size() << '\n';
	for (int i = 0; i < v.size(); i++)
		cout << v[i].first << " " << v[i].second << '\n';
	return 0;
}	

Measured memory_bytes: 384
n, m, x = map(int,input().split())

c = []
a = []

for i in range(n):
    num = list(map(int,input().split()))
    c.append(num[0])
    a.append(num[1:])

cnt = 0

cost_t = n*10**5

for i in range(2**n):
    argo = [0 for _ in range(m)]
    cost = 0
    for j in range(n):
        if ((i >> j) & 1):
            cost += c[j]
            for k in range(m):
                argo[k] += a[j][k]

    if min(argo) >= x:
        cnt += 1
        if cost < cost_t:
            cost_t = cost
        
if cnt == 0:
    print(-1)
else:
    print(cost_t)

Measured memory_bytes: 9172
#include<stdio.h>
#define MAX 100
#define INFTY (1<<21)
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,M[MAX][MAX];

void dijkstra(){
  int minv,i,j,v,u;
  int d[MAX],color[MAX];

  for(i=0;i<n;i++){
    d[i]=INFTY;
    color[i]=WHITE;
  }

  d[0]=0;
  color[0]=GRAY;
  while(1){
    minv=INFTY;
    u=-1;
    for(i=0;i<n;i++){
      if(minv>d[i] && color[i]!=BLACK){
	u=i;
	minv=d[i];
      }
    }
    if(u==-1){
      break;
    }
    color[u]=BLACK;
    for(v=0;v<n;v++){
      if(color[v]!=BLACK && M[u][v]!=INFTY){
	if(d[v]>d[u]+M[u][v]){
	  d[v]=d[u]+M[u][v];
	  color[v]=GRAY;
	}
      }
    }
  }
  for(i=0;i<n;i++){
    printf("%d %d\n",i,(d[i]==INFTY ? -1 : d[i]));
  }
}

int main(){
  int i,j,k,u,c,v;

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

  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d%d",&v,&c);
      M[u][v]=c;
    }
  }

  dijkstra();

  return 0;
}
  
    
    



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

int main(){
    int N;
    cin >> N;
    int max_f = 0;
    int num;
    for (int i = 0; i < N; i++){
        cin >> num;
        max_f += num - 1;
    }
    cout << max_f << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
//const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

int main() {
    int n, k; cin >> n >> k;
    int ans = 0;
    rep(i,n){
        int a; cin >> a;
        if (a >= k) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 500 + 10;
char mp1[N][N], mp2[N][N];
int n, m;
int main() {
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++) scanf("%s", mp1[i] + 1);
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) mp2[i][j] = mp1[i][j];
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (j & 1 && i != n)
                mp1[i][j] = '#';
            if (!(j & 1) && i != 1)
                mp2[i][j] = '#';
        }
    }
    for (int j = 1; j <= m; j++) {
        mp1[1][j] = '#';
        mp2[n][j] = '#';
    }
    for (int i = 1; i <= n; i++) puts(mp1[i] + 1);
    puts("");
    for (int i = 1; i <= n; i++) puts(mp2[i] + 1);
    return 0;
}

Measured memory_bytes: 1280
N=parse(readline())
F=Int[1,1,2,6,24,120,720,5040]
function f()
	ret=0
	used=zeros(Int,N)
	id=N
	for p=parse.(split(readline()))
		c=0
		used[p]=1
		for u=used[1:p]
			c+=1-u
		end
		ret+=c*F[id]
		id-=1
	end
	ret
end
println(abs(f()-f()))

Measured memory_bytes: 123676
#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>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define n_p(v) next_permutation(v.begin(),v.end())
#define to_ll(b) stoll(b)
#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; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp

signed main(){
  vvi vec(3,vi(3));
  rep(i,0,3){
	int a,b,c; cin>>a>>b>>c;
    vec[i][0]=a; vec[i][1]=b; vec[i][2]=c;
  }
	bool ok=false;
	int a=vec[0][0]+vec[1][1]+vec[2][2];
    int b=vec[0][1]+vec[1][2]+vec[2][0];
    int c=vec[0][2]+vec[1][0]+vec[2][1];
  	if(a==b && b==c) ok=true;
	if(ok) cout<<"Yes";
	else cout<<"No";
	return 0;
}

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
const int inf = 1000000001;
const ll INF = 1e16;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<<fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };

int main() {
	int x = 0;
	int n, i;
	cin >> n;
	string s;
	cin >> s;
	int M = 0;
	for (i = 0; i < n; i++) {
		if (s[i] == 'I')
			x++;
		else
			x--;
		M = max(M, x);
	}
	cout << M << endl;
}

Measured memory_bytes: 256
program abc080c
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n,i,j,profit=-1000000000,cd(0:9)
    integer(int32), allocatable:: f(:,:), p(:,:)

    read*, n
    allocate(f(10,n), p(11,n))
    do i=1,n
        read*, f(:,i)
    end do
    do i=1,n
        read*, p(:,i)
    end do

    do i=1,2**10-1
        do j=0,9
            if (btest(i,j)) then
                cd(j)=1
            else
                cd(j)=0
            end if
        end do
        profit = max(profit,calc_profit(cd))
    end do
    print'(i0)', profit
contains
    function calc_profit(a) result(ret)
        integer(int32):: a(10), ret, shop, day
        integer(int32):: cnt(n)
        cnt(:) = 0
        do shop=1,n
            do day=1,10
                if (a(day)==1 .and. f(day,shop)==1) cnt(shop)=cnt(shop)+1
            end do
        end do
        ret = 0
        do shop=1,n
            ret=ret+p(cnt(shop)+1,shop)
        end do
    end function
end program abc080c

Measured memory_bytes: 384