akhauriyash/Code-Regression huggingface dataset:
#define vi vector<int>
//#define debug(x) cout<<#x<<":"<<x<<endl;
//#define UL unsigned long long
#define LL long long

#include<iostream>
#include<vector>
#include<iterator>
#include<algorithm>
using namespace std;

int main(){
	LL n;
	vi v;
	LL a,max=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a;
		v.push_back(a);
		max+=a;
	}
	sort(v.begin(),v.end());
	auto minus =find_if(v.begin(),v.end(),[](int x){return x%10 != 0;});
	if(minus==v.end() && max%10==0){
		cout<<0<<endl;
	}else if(max%10!=0){
		cout<<max<<endl;
	}else if(max%10==0){
		cout<<max - *minus<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int n, pow10=1, fn=0, i;
  
  cin>>n;
  for(i=0;i<8;i++){
    fn += n/pow10%10;
    pow10*=10;
  }
  
  if(n%fn==0)cout<<"Yes";
  else cout<<"No";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef pair<long long,long long> job;
priority_queue<job> hav;
int main(){
	int n=0;
	cin>>n;
	for(int i=1;i<=n;i++){
		long long a,b;
		cin>>a>>b;
		hav.push(make_pair(-b,a));
	}
	long long tim=0;
	for(int i=1;i<=n;i++){
		job here=hav.top();
		hav.pop();
		tim+=here.second;
		if(tim>-here.first){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
} 

Measured memory_bytes: 6544
MOD = 10**9+7
n = int(input())
a=[int(i) for i in input().split()]
tmp = 0
res = [0]*n
f=1
for i in a:
    tmp += f*i
    f=f*-1
res[0]=tmp
res[n-1] = 2*a[n-1]-res[0]
for i in range(n-2,0,-1):
    res[i] = 2*a[i]-res[i+1]

print(*res)


Measured memory_bytes: 90352
#include <bits/stdc++.h>
#define sp ' '
#define nyan "(=^・ω・^=)"
#define mkp make_pair
#define intmax 2147483647
#define llmax 9223372036854775807
#define lP pair<ll,ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;
const int mod = 1000000007, mod998 = 998244353;

int M;

int main() {
	cin >> M;
	cout << 48 - M << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<int,int> P;
typedef tuple<ll,int,int> T;
#define fi first
#define se second
#define all(v) (v).begin(),v.end()
set<string> c;
const ll mod=1000000007;
const ll mod2=998244353;
const ll inf=100000000000000000;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
vector<int> dy={-1,0,1,0},dx={0,-1,0,1};
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0;}
long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
int main(){
string s;
cin>>s;
ll res=0,cnt=0;
for(ll i=0;i<s.size();i++){
    if(s[i]=='1'){
        ll now=(ll)s.size()-i-1;
        (res+=modpow(3LL,now)*modpow(2LL,cnt))%=mod;
        cnt++;
    }
}
(res+=modpow(2LL,cnt))%=mod;
cout<<res<<endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

const int inf = 1000;

int main() {
    int n;
    cin >> n;
    string s[n];
    for (int i = 0; i < n; i++) cin >> s[i];
    int t[26];
    for (int i = 0; i < 26; i++) t[i] = inf;
    for (int i = 0; i < n; i++) {
        int u[26];
        for (int j = 0; j < 26; j++) u[j] = 0;
        for (int j = 0; j < s[i].length(); j++) {
            int k = s[i][j] - 'a';
            u[k]++;
        }
        for (int j = 0; j < 26; j++) {
            t[j] = min(t[j], u[j]);
        }
    }
    for (int i = 0; i < 26; i++) {
        for (int j = 0; j < t[i]; j++) {
            cout << (char) ('a' + i);
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
//1024

void calc_indxs(int num, std::vector<int>& indxs) {
    int i = 1;
    int j = 0;
    while (j != 10) {
        indxs[j] = (bool)(num&i);
        ++j;
        i <<= 1;
    }
}

int main() {
    int n;
    scanf("%d", &n);
    int sum = 0;
    std::vector< std::vector<bool> > fs(n);

    for (int i = 0; i != n; ++i) {
        fs[i].resize(10);
        int buf[10];
        scanf("%d%d%d%d%d%d%d%d%d%d", buf + 0, buf + 1, buf + 2, buf + 3, buf + 4, buf + 5, buf+ 6, buf + 7, buf + 8, buf + 9);
        for (int j = 0; j != 10; ++j) {
            fs[i][j] = (buf[j] == 1);
        }
    }

    std::vector<std::vector<int>> cs(n);
    for (int i = 0; i != n; ++i) {
        cs[i].resize(11);
        scanf("%d%d%d%d%d%d%d%d%d%d%d", &(cs[i][0]), &(cs[i][1])
            ,  &(cs[i][2]), &(cs[i][3])
            , &(cs[i][4]), &(cs[i][5])
            ,  &(cs[i][6]), &(cs[i][7])
            ,  &(cs[i][8]), &(cs[i][9]),  &(cs[i][10]));
    }

    int nn = 0;
    long long max = -1000000000;
    std::vector<int> indxs(10, 0);
    do {
        nn += 1;
        calc_indxs(nn, indxs);

        long long acc_sum = 0;
        for (int j = 0; j != fs.size(); ++j) {
           int tsum = 0;
           for (int i = 0; i != 10; ++i) {
               if (fs[j][i] && (indxs[i] != 0))
                   tsum += 1;
           }
           acc_sum += cs[j][tsum];
       }
/*       for (auto n : indxs)
           printf("%d ", n);
       printf("\n%lld\n", acc_sum);*/
       if (acc_sum > max) {
           max = acc_sum;
       }
    } while ( nn != 1023 );
    printf("%lld\n", max);
    return  0;
}


Measured memory_bytes: 256
#include<iostream>
#include<deque>
#include<vector>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;

deque<int> A[1100];

int main(){
    int n, tmp;
    int now[1100];
    int total;
    int sum=0;
    int days;

    cin >> n;
    total = n*(n-1)/2;
    rep(i,n){
        rep(j,n-1){
            cin >> tmp;
            tmp--;
            A[i].push_back(tmp);
        }
        A[i].push_back(1002);
        now[i] = A[i].front();
        //cout << now[i] << endl;
    }
    rep(i,n) A[1001].push_back(1001);
    rep(i,n) A[1002].push_back(1002);
    days=0;
    for(int i=0; i<total; i++){
        days++;
        for(int j=0; j<n; j++){
            if(j==now[now[j]]){
                //cout << j << now[j] << endl;
                now[now[j]] = 1001;
                now[j] = 1001;
                sum++;
            }
        }
        //rep(k,n) cout << now[k];
        //cout << endl;
        for(int j=0; j<n; j++){
            if(now[j]==1001){
                A[j].pop_front();
                now[j]=A[j].front();
            }
        }
        //rep(k,n) cout << now[k];
        //cout << days << endl;
        if(sum==total){
            cout << days << endl;
            return 0;
        }
    }
    cout << "-1" << endl;

    return 0;
}

Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;

const int INF = 1e9;
const int mod = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1.0);

int main()
{
    int n;
    cin >> n;
    vector<int> l(2*n);
    for(int i = 0; i < 2*n; i++) cin >> l[i];
    sort(l.rbegin(),l.rend());
    int ans = 0;
    for(int i = 1; i < 2*n; i += 2) ans += l[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using edge = struct {int to; ll cost;};

#define mod 1000000007
#define REP(i, n) for (int i = 0; i < n; i++)
#define INF (1 << 29)


void solve() {
    ll n, m;
    cin >> n >> m;
    if(n == 1ll && m == 1ll){
        cout << 1 << "\n";
    }
    else if(n == 1ll){
        cout << m-2ll << "\n";
    }
    else if(m == 1ll){
        cout << n-2ll << "\n";
    }
    else{
        cout << (n-2ll)*(m-2ll) << "\n";
    }
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int MAX = 1e5+5;
using namespace std;
int a[MAX],n;
int main(){
	while(cin>>n){
		map<int,int>b;
		for(int i=0; i<n; ++i){
			cin>>a[i];
			b[a[i]]++;
		}
		sort(a,a+n);
		int res = 0;
		int m = unique(a,a+n)-a;
		for(int i=0; i<m; ++i){
			if(a[i]>b[a[i]])
				res+=b[a[i]];
			else if(a[i]<b[a[i]])
				res+=b[a[i]]-a[i];
			else continue;
		}
		cout<<res<<endl;
	}
	return 0;	
}

Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define all(v) v.begin(),v.end()
#define vi vector<int> 
#define mod 1000000007
#define inf 1e17
#define fs first
#define ss second

template <typename T> 
void amax(T& x, T y) 
{ 
    if( x < y) x = y;
} 

template <typename T> 
void amin(T& x, T y) 
{ 
    if( x > y) x = y;
} 



int main(){
     
    int n,m;
    cin >> n >> m;
    
    cout << ((n==m)?"Yes":"No")<<endl;

}


Measured memory_bytes: 256
s = list(input())
cnt = 0
if s[0] == "0":
    for i in range(len(s)):
        if s[i] != str(i % 2):
            cnt += 1
else:
    for i in range(1, len(s) + 1):
        if s[i - 1] != str(i % 2):
            cnt += 1
print(cnt)


Measured memory_bytes: 9832
n = int(input())
s = [input() for i in range(n)]

cnt_ac = s.count('AC')
cnt_wa = s.count('WA')
cnt_tle = s.count('TLE')
cnt_re = s.count('RE')

print('AC x %s' % cnt_ac)
print('WA x %s' % cnt_wa)
print('TLE x %s' % cnt_tle)
print('RE x %s' % cnt_re)

Measured memory_bytes: 16216
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
        double x=sc.nextDouble();
        double pi=Math.PI;
        double area=x*x*pi;
        double length=2*x*pi;
        System.out.printf("%f %f",area,length);
        sc.close();

    }
}



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

// to increase precision
// std::cout<<std::fixed;
// 	std::cout<<std::setprecision(6)<<z;
//clock_t tStart = clock();
//printf("Time taken: %.9fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
#define maxn 200007

#define ll long long int

ll mod=1e9+7;



int main(){
	int l,r,d;
	cin>>l>>r>>d;
	int n1=l/d;
	int n2=r/d;
	if(l%d==0){
		cout<<n2-n1+1<<endl;
	}
	else{
		cout<<n2-n1<<endl;
	}
}

Measured memory_bytes: 3644
#include <iostream>
#include <iomanip>

using namespace std;

int main() {
    double w, h, x, y;
    cin >> w >> h >> x >> y;

    double size = w * h;
    cout << fixed << setprecision(20) << size / 2.0 << " " << (x * 2 == w && y * 2 == h ? 1 : 0) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin(); it!=(c).end(); it++)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define pr(a) cout << (a) << endl
#define PR(a,b) cout << (a) << " " << (b) << endl
#define F first
#define S second
typedef long long ll;
typedef pair<int,int> P;
const int MAX=1000000001;
const ll MAXL=1000000000000000001LL;
const ll mod=1000000007;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int main() {
  int n,m;
  cin >> n >> m;
  int r[n+1],d[n+1];
  memset(d,0,sizeof(d));
  rep(i,m) {
    int k;
    cin >> k;
    rep(j,k) {
      int x;
      cin >> x;
      r[x]=i;
    }
  }
  int k;
  cin >> k;
  rep(i,k) {
    int a,b;
    cin >> a >> b;
    if(r[a]==r[b]) {
      d[a]=1;
      d[b]=1;
    }
  }
  int ans=0;
  rep(i,n+1) ans+=d[i];
  pr(ans);
  return 0;
}


Measured memory_bytes: 1172
-- https://github.com/minoki/my-atcoder-solutions
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}
import Data.Char
import Data.Int
import Data.List
import Control.Monad
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM
import qualified Data.ByteString.Char8 as BS
import Data.Monoid

exEuclid :: (Eq a, Integral a) => a -> a -> (a, a, a)
exEuclid !f !g = loop 1 0 0 1 f g
  where loop !u0 !u1 !v0 !v1 !f 0 = (f, u0, v0)
        loop !u0 !u1 !v0 !v1 !f g =
          case divMod f g of
            (q,r) -> loop u1 (u0 - q * u1) v1 (v0 - q * v1) g r

modulo = 10^6+3 :: Int64
addMod, subMod, mulMod, divM :: Int64 -> Int64 -> Int64
addMod !x !y = (x + y) `rem` modulo
subMod !x !y = (x - y) `mod` modulo
mulMod !x !y = (x * y) `rem` modulo
recipM :: Int64 -> Int64
recipM !x = case exEuclid x modulo of
             (1,a,_) -> a `mod` modulo
             (-1,a,_) -> (-a) `mod` modulo
divM !x !y = x `mulMod` recipM y

newtype N = N { unwrapN :: Int64 } deriving (Eq)
instance Show N where
  show (N x) = show x
instance Num N where
  N x + N y = N ((x + y) `rem` modulo)
  N x - N y = N ((x - y) `mod` modulo)
  N x * N y = N ((x * y) `rem` modulo)
  fromInteger n = N (fromInteger (n `mod` fromIntegral modulo))
  abs = undefined; signum = undefined

instance Fractional N where
  N x / N y = N (divM x y)
  recip (N x) = N (recipM x)
  fromRational = undefined

factL :: [N]
factL = 1 : zipWith (*) factL (map fromInteger [1..])

factFromN :: Int -> Int -> N -> V.Vector N
factFromN n m factN = V.scanl' (\a b -> a * fromIntegral b) factN (V.enumFromN (n+1) (m-1))

factV :: V.Vector N
factV = V.scanl' (\a b -> a * fromIntegral b) 1 (V.enumFromN 1 (fromIntegral modulo - 1))

-- factM n == factL !! n == product (map fromInteger [1..n])
-- factM 150000 == 835006
-- factM 300000 == 142803
-- factM 600000 == 715492
-- factM 800000 == 598805
factM :: Int64 -> N
factM n | n < modulo = factV V.! fromIntegral n
        | otherwise = 0

solve :: Int -> Int -> Int -> N
solve x 0 n = (fromIntegral x)^n
solve !x !d !n = let !x' = fromIntegral x :: N
                     !d' = fromIntegral d :: N
                     !xd = unwrapN (x' / d')
                 in if xd + fromIntegral n - 1 >= modulo
                    then 0
                    else d'^n * factM (xd + fromIntegral n - 1) / factM (xd - 1)

main = do
  q :: Int <- readLn
  replicateM_ q $ do
    [x,d,n] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
    print (solve x d n)


Measured memory_bytes: 209660
import math
n,m,v,p=map(int,input().split())
lists=list(map(int,input().split()))
lists=sorted(lists)
def is_ok(N,m,v,p):
    counter=0
    howadd=0
    not_avoid=0
    judge=lists[N]+m
    for k in range(n-1,-1,-1):
        if k!=N:
            if judge<lists[k]:
                counter+=m
                howadd+=1
                not_avoid+=1
            elif judge==lists[k] and howadd<p-1:
                counter+=m
                howadd+=1
            elif judge==lists[k] and howadd==p-1:
                pass
            elif judge>lists[k] and howadd<p-1:
                howadd+=1
                counter+=m
            elif judge>lists[k] and howadd==p-1:
                counter+=min(judge-lists[k],m)    
    if not_avoid>=p:
            return False
    elif not_avoid<p:
        if counter<(m)*(v-1):
            return False
        elif counter>=(m)*(v-1):
            return True
start=0
end=n-1
for _ in range(30):
    c=(start+end)/2
    if is_ok(math.floor(c),m,v,p):
        end=c
    elif not (is_ok(math.floor(c),m,v,p)):
        start=c       
print(n-math.floor(end))

Measured memory_bytes: 62576
#include <cstdio>

char str[10];

// 65, 90
int main(int argc, char *argv[])
{
    scanf("%s", str);

    int table[26] = {0, };
    for(int i=0;str[i];i++) {
        int idx = str[i] - 'A';
        table[idx] += 1;
    }

    int cnt = 0;
    for(int i=0;i<26;i++) {
        if (table[i] == 2) cnt += 1;
    }

    if (cnt == 2)
        printf("Yes\n");
    else
        printf("No\n");

    return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main()
{int N,i;
 scanf("%d",&N);
 for(i=0;i<3;i++)
 {
   if(N<10)
     break;
   else
N=N%10;
 }
 if(N==2 || N==4 || N==5 || N==7 || N==9)
   printf("hon");
 else if(N==3)
   printf("bon");
 else
   printf("pon");
   
}


Measured memory_bytes: 1732
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();
        if(a >= 13) System.out.println(b);
        else if(a >= 6) System.out.println(b/2);
        else System.out.println(0);
    }
}

Measured memory_bytes: 35840
package main

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

var sc *bufio.Scanner

const bufferSize = 1024

func nextString() string {
	if !sc.Scan() {
		panic(nil)
	}
	return sc.Text()
}

var production bool

func debugf(format string, v ...interface{}) {
	if !production {
		fmt.Printf(format, v...)
	}
}

func answer(reader io.Reader, writer io.Writer) {
	sc = bufio.NewScanner(reader)
	buf := make([]byte, bufferSize)
	sc.Buffer(buf, 1e+7)
	sc.Split(bufio.ScanWords)
	s := nextString()

	if s[2] == s[3] && s[4] == s[5] {
		_, _ = fmt.Fprintf(writer, "Yes")
	} else {
		_, _ = fmt.Fprintf(writer, "No")
	}
}

func main() {
	production = true
	answer(os.Stdin, os.Stdout)
}


Measured memory_bytes: 640
n,k=map(int,input().split())
p=[]
for i in range(n):
    x,y=map(int,input().split())
    p.append([x,y])
ret=10**25
for a in range(n):
    for b in range(a):
        r=max(p[a][0],p[b][0])
        l=min(p[a][0],p[b][0])
        for c in range(n):
            for d in range(c):
                u=min(p[c][1],p[d][1])
                t=max(p[c][1],p[d][1])
                cnt=0
                for i in range(n):
                    if l<=p[i][0]<=r and u<=p[i][1]<=t:
                        cnt+=1
                if cnt>=k:
                    ret=min(ret,(r-l)*(t-u))
print(ret)

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

int main(){

	int k, n, sum;

	while(cin >> k){
		if(k == 0) break;
		
		sum = 0;
		
		for(int i=0; i<k*(k-1)/2; i++){
			cin >> n;
			sum += n;
		}
		
		cout << sum / (k - 1) << endl;
	}

	return 0;

}

Measured memory_bytes: 1160
n = int(input())
s1 = 0
s2 = 0
for i in range(n):
    t1, t2 = map(str, input().split())
    if t1 == t2:
        s1+=1
        s2+=1
    elif t1 > t2:
        s1+=3
    else:
        s2+=3
print(s1, s2)


Measured memory_bytes: 5600
#include <iostream>

using namespace std;

int main(void)
{
    int even_n, odd_n;
    cin >> even_n >> odd_n;

    int combination;
    combination = (even_n * (even_n-1))/2 + (odd_n * (odd_n-1))/2;
    
    cout << combination << endl;
    return 0;
}


Measured memory_bytes: 256
// Problem : B - Tag
// Contest : AtCoder - 東京海上日動　プログラミングコンテスト2020
// URL : https://atcoder.jp/contests/tokiomarine2020/tasks/tokiomarine2020_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define DEBUG fprintf(stderr, "Passing [%s] line %d\n", __FUNCTION__, __LINE__)
#define File(x) freopen(x".in","r",stdin); freopen(x".out","w",stdout)

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int, int> PII;
typedef pair <int, PII> PIII;

inline int gi()
{
    int f = 1, x = 0; 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 f * x;
}

inline LL gl()
{
    LL f = 1, x = 0; 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 f * x;
}

const int INF = 0x3f3f3f3f, N = 100003, M = N << 1;

LL a, b, v, w, t;

int main()
{
    //File("");
    cin >> a >> v >> b >> w >> t;
    if (abs(b - a) <= (v - w) * t) puts("YES");
    else puts("NO");
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>

#define DIV 1000000007
using namespace std;

bool cmp(const pair<int, int>& a, const pair<int, int>& b)
{
    return b.second < a.second;
}

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

    vector<pair<int,int>> red(N);
    for (int i = 0; i < N; i++)
        cin >> red[i].first>>red[i].second;

    vector<pair<int, int>> blue(N);
    for (int i = 0; i < N; i++)
        cin >> blue[i].first >> blue[i].second;

    sort(red.begin(), red.end(),cmp);
    sort(blue.begin(), blue.end());

    int ans = 0;
    vector<bool> red_used(N);
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if (red_used[j]) continue;
            if (blue[i].first > red[j].first&& blue[i].second > red[j].second) {
                ans++;
                red_used[j] = true;
                break;
            }
        }
    }

    cout << ans << endl;
}


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

#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <string_view>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout(a) cout << fixed << setprecision((int)(a))

//typedef===============
typedef long long       ll;
typedef long double     ld;
typedef vector<int>     Vi;
typedef vector<ll>      Vl;
typedef pair<int, int>  Pii;
typedef pair<ll, ll>    Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD1    = 1000000007;
constexpr ll MOD2   = 998244353;
constexpr ld PI     = 3.141592653589793L;

//member================
#define psb push_back
#define epb emplace_back
#define psf push_front
#define mkp make_pair
#define fst first
#define scd second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (n); ++(i))
#define reps(i, n)      for(int i = 1; (i) <= (n); ++(i))
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; --(i))
#define repbit(bit, n)  for(int bit = 0; (bit) < (1 << (n)); ++(bit))
#define ifbit(bit, i)   if((bit) & (1 << (i)))
#define CtoI(c)         int((c)) - int('0')
#define ItoC(c)         char((c) + '0')

//functions=============
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };

/*--------additional--------*/



/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    int n, d; cin >> n >> d;
    int ans = 0;
    while(n > 0){
        n -= d*2 + 1;
        ++ans;
    }

    cout << ans << endl;

return 0;
}

Measured memory_bytes: 3604
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int H = sc.nextInt();
			int W = sc.nextInt();
			if (H == 0 && W == 0) {
				break;
			} else {
				for (int i = 0; i < H; i++) {
					if (i % 2 == 0) {
						for (int j = 0; j < W; j++) {
							if (j % 2 == 0)
								System.out.print("#");
							else
								System.out.print(".");
						}
						System.out.println("");
					} else {
						for (int j = 0; j < W; j++) {
							if (j % 2 == 0)
								System.out.print(".");
							else
								System.out.print("#");
						}
						System.out.println("");
					}
				}
				System.out.println("");
			}
		}
		sc.close();
	}

}



Measured memory_bytes: 35784
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n-1; i >= 0; i--)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
const int mod = 1e9+7;
const int INF = 1e9;
const int MAX = 1e6;

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

Measured memory_bytes: 3592
package main

import "fmt"

func main() {
	var a int
	fmt.Scanf("%d", &a)
	if a%3 == 0 {
		if a == 0 {
			fmt.Println("0")
		} else {
			fmt.Println("3")
		}
	} else {
		fmt.Println(a % 3)
	}
}


Measured memory_bytes: 512
n, x = map(int, input().split())
list_A = list(map(int, input().split()))
list_SUM = []

ans = 0

for i in range(n-1):
    value = list_A[i] + list_A[i+1]
    if value > x:
        list_A[i+1] = max(0, list_A[i+1] - (value - x))
        ans += value - x

print(ans)

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

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	string s; long long n;
	cin >> s >> n;
	for(int i=0;i<s.length();i++){
		if(s[i]-'0' > 1){
			if(n >= i+1){
				cout << s[i] << "\n";
			}
			else{
				puts("1");
			}
			return 0;
		}
	}
	puts("1");
	return 0;
}

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

/**
 * vector<int>ar(3);
 * for(auto&e:ar){
 *     scanf("%d",&e);
 * }
 * sort(ar.begin(),ar.end())
 * int sum=accumulate(ar.begin(),ar.end(),0);
 ***/

int main(){
    double pai=3.141592653589;
    double r;
    scanf("%lf",&r);
    printf("%.8lf %.8lf\n",r*r*pai,r*2*pai);
    return 0;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll n, x, a;
  a = 0;
  x = 0;
  string s;
  in2(n, s);
  rep(i, n){
    if(s[i] == 'I')
      x++;
    else
      x--;
    a = max(a, x);
  }
  out(a);
  memi;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int sum=0,i,n;
  
  while(1){
    scanf("%d",&sum);
    if(sum==0) break;
    
    for(i=0;i<9;i++){
      scanf("%d",&n);
      sum-=n;
    }
    printf("%d\n",sum);
  }
  return 0;
}

Measured memory_bytes: 600
n = int(input())
S = 100000

for i in range(n):
    S = int(S*1.05)
    slist = list(str(S))
    if slist[-3:] == ['0','0','0'] :
        S = S
    else:
        S = S  - int(slist[-3])*100 - int(slist[-2])*10 - int(slist[-1])*1 + 1000

print(S)


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

int N;

int main(){
	vector < int > arr; cin >> N;
	for(int i = 1 ; i <= N ; ++i){int x; cin >> x; arr.push_back(x);}
	vector < int > op;
	while(!arr.empty()){
		int t = -1;
		for(int i = 0 ; i < arr.size() ; ++i)
			if(arr[i] == i + 1) t = i;
		if(t == -1){puts("-1"); return 0;}
		op.push_back(t + 1); arr.erase(arr.begin() + t);
	}
	reverse(op.begin() , op.end());
	for(auto t : op) cout << t << endl;
	return 0;
}

Measured memory_bytes: 256
from heapq import heapify,heappop,heappush
n=int(input())
a=list(map(int,input().split()))
heapify(a)
while len(a)!=1:
    b=heappop(a)
    c=heappop(a)
    heappush(a,(b+c)/2)
print(a[0])

Measured memory_bytes: 3060
N=int(input())
l=len(str(N))

if N<=9:
    ans=N
elif N%10**(l-1)==10**(l-1)-1:
    ans=N//10**(l-1) + 9*(l-1)
else:
    ans= (N//10**(l-1) - 1) + 9*(l-1)

print(ans)


Measured memory_bytes: 38256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <unordered_map>
using namespace std;

class Solver
{
public:
	long a;
	long b;


	Solver() {
		cin >> a;
		cin >> b;

		
	}

	void exec() {
		if(a > b) {
			swap(a, b);
		}
		string ans = "";
		for (int i = 0; i < b; ++i)
		{
			ans += to_string(a);
		}


		cout << ans << endl;
	}
};


int main(){
	Solver co = Solver();
	co.exec(); 
}


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

int main(){
  int N;
  cin >> N;
  int d[N];
  for(int i=0;i<N;i++){
    cin >> d[i];
  }
  
  sort(d,d+N);
  int tmp1 = d[N/2-1];
  int tmp2;
  for(int j=N/2;j<N;j++){
    if(d[N/2-1]==d[j]){
      cout << '0';
      return 0;
    }else{
      tmp2 = d[j];
      break;
    }
  }
  cout << tmp2-tmp1;
  return 0;
}

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

#define debug(x) cerr << #x << ": " << x << endl

int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  string s;
  cin >> s;
  int k;
  cin >> k;
  int j = 0;
  while (j < s.length() && s[j] == '1')
    ++j;
  if (k <= j)
    cout << "1\n";
  else
    cout << s[j] << '\n';
  return 0;
}

Measured memory_bytes: 256
x,n=map(int,input().split())
p=list(map(int,input().split()))
a=101
m=101-x
for i in range(102):
  i=100-i
  if i in p:
    continue
  M=abs(i-x)
  if M<=m:
    m=M
    a=i
print(a)

Measured memory_bytes: 9136
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main implements Runnable { //クラス名はMain1

	public static void main(String[] args) {
		Thread.setDefaultUncaughtExceptionHandler((t, e) -> System.exit(1));
		new Thread(null, new Main(), "", 1024 * 1024 * 1024).start(); //16MBスタックを確保して実行
	}

	/**
	 * for (int i = 0; i < N; i++) {}
	 * System.out.println();
	 * HashMap<Integer, Integer> hm = new HashMap<>();
	 * int[] s = new int[M];
	 * ArrayDeque<Integer> deq = new ArrayDeque<>();
	 *
	 * 文字列のSort
	 * String sorted = S.chars()
						.sorted()
						.collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append)
						.toString();
	 * for (char i = 'a'; i <= 'z'; i++) {}
	 */
	public void run() {
		FastScannerMainB sc = new FastScannerMainB(System.in);

		try {
			//String S = sc.nextLine().trim();

			//int[] a = new int[N];
			//long l = sc.nextLong();
			//ArrayList<Integer> arr = new ArrayList<Integer>();
			//for (int i = 0; i < N; i++) {}
			//for (char i = 'a'; i <= 'z'; i++) {}
			long X = sc.nextLong();
			long X2 = X;
			long count = 0;

			long x500 = X / 500;

			count = 1000 * x500;

			//System.out.println(X / 500);
			//System.out.println(count);
			count += 5 * ((X - 500 * (X / 500)) / 5);
			System.out.println(count);

			/*
			while (true) {
				if (X2 >= 500) {
					X2 = X2 - 500;
					count = count + 1000;
				}
				if (X2 >= 5) {
					X2 = X2 - 5;
					count = count + 5;
				}
				if (X2 < 5) {
					break;
				}
			}
			*/

			//System.out.println(count);

		} catch (Exception e) {
			e.printStackTrace();
		}

	}
}

//高速なScanner
class FastScannerMainB {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

	public FastScannerMainB(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenizer = null;
	}

	public String next() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public String nextLine() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken("\n");
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}
}


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

int main(){
 int N;
 cin >> N;
 bool flag = false;
 for(int i = 0; i < 100; i++){
   for(int j = 0; j < 100; j++){
     if(4 * i + 7 * j == N){
       flag = true;
     }
   }
 }
 if(flag){
   cout << "Yes" << endl;
 }
 else{
   cout << "No" << endl;
 }
}

Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;
const int MAXN=100005;
struct point
{
	int t,x,y;
}p[MAXN];
bool cmp(point a,point b)
{
	return a.t<b.t;
}
int n;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d %d %d",&p[i].t,&p[i].x,&p[i].y);
	}
	sort(p+1,p+n+1,cmp);
	int x=0,y=0,t=0;
	for(int i=1;i<=n;i++)
	{
		int a=abs(p[i].x-x)+abs(p[i].y-y);
		int tt=p[i].t-t;
		t=p[i].t;
		x=p[i].x;
		y=p[i].y;
		if(tt<a||((tt-a)%2==1))
		{
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
}

Measured memory_bytes: 1280
#include<iostream>
#include<math.h>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<iomanip>
using namespace std;
#define INF 1<<20


struct edge{
	int to;
	int cost;
	edge() {};
	edge(int a, int b) {
		to = a;
		cost = b;
	}
};

struct Node {
	int pos;
	int cost;
	Node() {};
	Node(int a, int b) {
		pos = a;
		cost = b;
	}
	bool operator <(const Node& rhs) const {
		return cost > rhs.cost;
	}
};

void dijkistra(int st, int TO,int V,vector<vector<edge> > graph) {
	priority_queue<Node> q;
	vector<int> d(V);
	for (int i = 0;i < V;i++) {
		d[i] = INF;
	}
	d[st] = 0;
	q.push(Node(st, 0));
	while (!q.empty()) {
		Node s = q.top(); q.pop();
		int pos = s.pos;
for (int i = 0;i < graph[pos].size();i++) {
	int to = graph[pos][i].to;
	int cost = graph[pos][i].cost;
	if (d[pos] + cost < d[to]) {
		d[to] = d[pos] + cost;
		q.push(Node(to, d[to]));
	}

}
	}
	cout << d[TO] << endl;
}
int partition(int A[], int p, int r) {
	int x = A[r];
	int i = p - 1;
	for (int j = p;j < r;j++) {
		if (x >= A[j]) {
			i = i + 1;
			swap(A[i], A[j]);
		}
	}
	swap(A[i + 1], A[r]);
	return i + 1;
}
void quicksort(int A[], int p, int r) {
	if (p < r) {
		int q = partition(A, p, r);
		quicksort(A, p, q - 1);
		quicksort(A, q + 1, r);
	}
}

int getNumberOfCoin(int C[], int n, int m) {
	int T[50000];
	for (int j = 0;j <= n;j++) {
		T[j] = INF;
	}
	T[0] = 0;
	for (int i = 0;i < m;i++) {
		for (int j = 0;j <= n;j++) {
			if (j - C[i] >= 0) {
				T[j] = min(T[j], T[j - C[i]] + 1);
			}
		}
	}
	return T[n];
}
int knapsack(int w, int n, int* v, int* ww) {
	int W[101][10001];
	for (int j = 0;j <= w;j++) {
		W[0][j] = 0;
	}
	for (int i = 0;i < n;i++) {
		for (int k = 0;k < n;k++) {
			for (int j = 0;j <= w;j++) {
				if (j - ww[k] < 0) {
					W[i + 1][j] = W[i][j];
				}
				if (j - ww[i] >= 0) {
					W[i + 1][j] = max(W[i][j], W[i][j - ww[k]] + v[k]);

				}
			}
		}
	}
	return W[n][w];
}
int fib(int n) {
	vector<int> v(n + 1);
	v[0] = 1;
	v[1] = 1;
	for (int i = 2;i < n + 1;i++) {
		v[i] = v[i - 2] + v[i - 1];
	}
	return v[n];
}
int isPrime(int x) {
	if (x <= 1) return false;
	if (x > 2 && x % 2 == 0) return false;
	for (int i = 2;i <= sqrt(x);i++) {
		if (x%i == 0) {
			return false;
		}
	}
	if (x == 2) return true;
	return true;
}
int gnc(int a, int b) {
	while (b%a != 0) {
		if (a > b) swap(a, b);
		else {
			b = b%a;
		}
	}
	return a;
}
int calc(int a, long long int b, long long int m) {
	if (b == 0) return 1;
	else if (b % 2 == 0) {
		long long int d = calc(a, b / 2, m);
		return (d*d) % m;
	}
	else {
		long long int d = calc(a, b -1, m);
		return (d*a) % m;
	}
}
vector<pair<int, int> > b(100000);
vector<int> src(100000);

int main() {
	int x;
	cin >> x;
	if (x < 1200) {
		cout << "ABC" << endl;
	}
	else cout << "ARC" << endl;

	return 0;
	}




Measured memory_bytes: 1408
#include <bits/stdc++.h> 
using namespace std; 
  
// Function to return gcd of a and b 
long long int gcd(long long int a,long long int b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
  
// Function to find gcd of array of 
// numbers 
long long int findGCD(long long int a, long long int b,long long int c) 
{ 
      long long result;
        result = gcd(a,b); 
        if(result == 1) 
        { 
           return 1; 
        } 
        else
        {
              result=gcd(result,c);
        }
    return result; 
} 
int main()
{
      long long int a,b,c,ans=0,n,i,j,k;
      cin>>n;
      for(i=1;i<=n;i++)
      {
            for(j=1;j<=n;j++)
            {
                  for(k=1;k<=n;k++)
                  {
                        ans+=findGCD(i,j,k);
                  }
            }
      }
      cout<<ans;
      //cout<<findGCD(2,2,2);

 
      
 
 
    return 0;
}

Measured memory_bytes: 3636
n = int(input())
a = list(map(int,input().split()))

adic = {}
for i in range(n):
    if a[i] not in adic:
        adic[a[i]] = 0
    adic[a[i]] += 1

alist = sorted(adic.items(),reverse = True)
before = 0
after = 0

for i in range(len(alist)):
    if before == 0:
        if alist[i][1] >= 4:
            before = alist[i][0]
            after = alist[i][0]
            break
        elif alist[i][1] >= 2:
            before = alist[i][0]
    else:
        if alist[i][1] >= 2:
            after = alist[i][0]
            break
print(before * after)




Measured memory_bytes: 69912
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int a,b,c,d,e;
	cin>>a>>b>>c>>d>>e;
	if(a>b)swap(a,b);
	if(b>c)swap(b,c);
	if(a>b)swap(a,b);
	if(d>e)swap(d,e);
	cout<<a+d-50<<endl;
	return 0;
	}



Measured memory_bytes: 3100
#include <stdio.h>

int main(){
    int n,m,i,j,a[100000],maxv,tmp;
    while(1){
        scanf("%d %d", &n, &m);
        if(n==0 && m==0) break;
        for(i=0; i<n; i++){
            scanf("%d", &a[i]);
            
        }
        maxv = 0; // answer
        for(i = 0; i < n; i++){
            for( j = 0; j < n; j++){
                // i, j is integers
                if (i!=j) {
                    tmp = a[i] + a[j];
                    if ( tmp > maxv && tmp <= m ) maxv = tmp;
                }
            }
        }
        if (maxv==0){printf("NONE\n");}
        else{printf("%d\n", maxv);}
    }
    return 0;
}

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

int main(){
    ll a,b,k;
    cin>>a>>b>>k;
    ll ansa,ansb;
    if(a+b<=k){
        ansa=0;
        ansb=0;
    }else if(a-k>=0){
        ansa = a-k;
        ansb = b;
    }else{
        ansa = 0;
        ansb = b-k+a;
    }
    cout<<ansa<<" "<<ansb<<endl;
    return 0;
}

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

//namespace _1_A
//{
class Program
{
    static void Main(string[] args)
    {
        ArrayList array = new ArrayList();
        int[] suu = new int[2];
        int ans = 0;
        string inp = Console.ReadLine();
        string[] oup = inp.Split(' ');

        suu[0] = int.Parse(oup[0]);
        suu[1] = int.Parse(oup[2]);
        inp = oup[1];

        while (inp.CompareTo("?") != 0)
        {
            if (inp.CompareTo("+") == 0)
                ans = suu[0] + suu[1];
            else if (inp.CompareTo("-") == 0)
                ans = suu[0] - suu[1];
            else if (inp.CompareTo("*") == 0)
                ans = suu[0] * suu[1];
            else if (inp.CompareTo("/") == 0)
                ans = suu[0] / suu[1];

            array.Add(ans);
            inp = Console.ReadLine();
            oup = inp.Split(' ');
            suu[0] = int.Parse(oup[0]);
            suu[1] = int.Parse(oup[2]);
            inp = oup[1];
        }

        foreach (object obj in array)
        {
                Console.WriteLine(obj.ToString());
        }
        //Console.Read();
    }
}
//}

Measured memory_bytes: 9816
package main

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

func main() {
	sc.Split(bufio.ScanWords)
	N, H := nextInt(), nextInt()
	a := make([]int, N)
	b := make([]int, N)
	maxA := 0
	for i := 0; i < N; i++ {
		a[i] = nextInt()
		b[i] = nextInt()
		if a[i] > maxA {
			 maxA = a[i]
		}
	}
	sort.Ints(b)

	res := 0
	for i := len(b) - 1; i >= 0 && H > 0; i-- {
		if maxA > b[i] {
			break
		} else {
			res++
			H -= b[i]
		}
	}

	if H > 0 {
		res += (H + maxA - 1) / maxA
	}
	fmt.Println(res)
}


// -------- Library --------
var sc = bufio.NewScanner(os.Stdin)

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

func nextInt() int {
	v, err := strconv.Atoi(next())
	if err != nil {
		fmt.Println("Failed to read int", err)
		os.Exit(1)
	}
	return v
}

func nextIntArray(size int) []int {
	res := make([]int, size)
	for i := 0; i < size; i++ {
		res[i] = nextInt()
	}
	return res
}

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

int main() 
{
  int n,m;
  cin >> n >> m;
  int matrix[n][m];
  int vector[m];
  int i,j;
  int ans = 0;
  for(i = 0;i < n;i++){
    for(j = 0;j < m;j++){
      cin >> matrix[i][j];
    }
  }
  for(i = 0;i < m;i++){
    cin >> vector[i];
  }
  for(i = 0;i < n;i++){
    for(j = 0;j < m;j++){
      ans += matrix[i][j]*vector[j];
    }
    cout << ans << endl;
    ans = 0;
  }
  return 0;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define endl "\n"
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 2e+9 + 10;
typedef pair<ll, ll> P;

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

  int N; cin >> N;
  vec v(N);
  rep(i,N) cin >>v[i];
  sort(ALL(v));
  v.erase(unique(ALL(v)), v.end());
  cout << v.size() << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;

class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
        String s;
        int ans = Integer.MAX_VALUE;

        void solve(InputReader in, PrintWriter out) {
            s = in.next();

            for (char c : s.toCharArray()) {
                String[] parts = s.split(Character.toString(c));
                int maxLen = 0;
                for (String part : parts) maxLen = Math.max(maxLen, part.length());
                ans = Math.min(ans, maxLen);
            }

            out.println(ans);
        }
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() { return Integer.parseInt(next()); }

        long nextLong() { return Long.parseLong(next()); }

        int[] nextIntArray(int n) {
        	int[] arr = new int[n];
        	for (int i = 0; i < n; ++i) {
        		arr[i] = nextInt();
        	}
        	return arr;
        }

        long[] nextLongArray(int n) {
            long[] arr = new long[n];
            for (int i = 0; i < n; ++i) {
                arr[i] = nextLong();
            }
            return arr;
        }
    }
}


Measured memory_bytes: 23380
#include<stdio.h>

int main(void) {
   int n;
   scanf("%d",&n);

   int a = n / 100;
   int b = (n / 10) % 10;
   int c = (n % 10) % 10;

   if(a == 1) {
      a = 9;
   } else if(a == 9) {
      a = 1;
   }

   if(b == 1) {
      b = 9;
   } else if(b == 9) {
      b = 1;
   }

   if(c == 1) {
      c = 9;
   } else if(c == 9) {
      c = 1;
   }

   printf("%d%d%d\n", a,b,c);
   
   return 0;
}


Measured memory_bytes: 1664
#include<iostream>
#include<algorithm>
using namespace std;
long long int cara(long long int x);
//long long int a[200000];
int main() {

	//A
	int h, a;
	cin >> h >> a;
	int i = 0;
	while (1) {
		h = h - a;
		i++;
		if (h <= 0) {
			cout << i << endl;
			return 0;
		}
	}


	//B
	/*int h, n;
	cin >> h >> n;
	int i, a;
	for (i = 0; i < n; i++) {

		cin >> a;
		h = h - a;
		if (h <= 0) {
			cout << "Yes" << endl;
			return 0;
		}


	}
	cout << "No" << endl;
	return 0;*/
	//C
	/*int n, k;
	int i;
	cin >> n >> k;

	for (i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n);
	long long int sum = 0;
	if (k >= n) {
		cout << 0 << endl;
		return 0;
	}
	for (i = 0; i <= n - k - 1; i++) {
		sum = sum + a[i];
	}
	cout << sum << endl;
	return 0;
	*/

	//E
	/*int h, n;
	int a[1000], b[1000];
	int i, j, k;
	cin >> h >> n;
	for (i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}

	//体力hに対して使用する最小の魔力を求めるDP
	int DP[10001];
	DP[0] = 0;
	int min;
	for (i = 1; i <= h; i++) {
		min = 100000000;
		for (j = 0; j < n; j++) {
			if (a[j] >= i) {
				if (min > b[j]) {
					min = b[j];
				}
			}
			else {
				if (DP[i - a[j]] + b[j] < min) {
					min = DP[i - a[j]] + b[j];
				}
			}
		}
		DP[i] = min;
	}
	cout << DP[h] << endl;
	return 0;
	*/

	//D


	/*long long int n;
	cin >> n;
	cout << cara(n) << endl;
	return 0;*/

}
long long int cara(long long int x) {

	int i = 0;
	if (x == 1) {
		return 1;
	}
	else {
		return 1  + 2 * cara((long long int)(x / 2));
	}

}

Measured memory_bytes: 3604
#include <iostream>
#include <string>
using namespace std;
int main()
{
	string s;
	cin >> s;
	for (int i = 0; i < s.length(); i++)
	{
		s[i] = 'x';
	}
	for (int i = 0; i < s.length(); i++)
	{
		cout << s[i];
	}}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <queue>
#include <map>
#include <set>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <valarray>
using namespace std;

#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()
const int INF = 1<<29;

typedef double number;
typedef valarray<number> point;

number dot(const point& a, const point& b) {
  return (a * b).sum();
}
point cross(const point& a, const point& b) {
  return a.cshift(+1)*b.cshift(-1)
       - a.cshift(-1)*b.cshift(+1);
}
number dist2(const point& a, const point& b) {
  return dot(a-b, a-b);
}
number norm(const point& a) {
  return sqrt(dot(a,a));
}
ostream & operator<<(ostream &stream, point a) {
  stream << "(";
  REP(i, a.size()) {
    if (i) stream << ", ";
    stream << a[i];
  }
  stream << ")";
  return stream;
}

// xNgÜíèÌñ] * axis : ñ]²ÌPÊxNg
point rotate(point axis, double ang, point a) {
  return a * cos(ang) + (1.0 - cos(ang)) * dot(a, axis) * axis + cross(axis, a) * sin(ang);
}

int main() {
  int n;
  while(cin >> n, n) {
    point nowvec(3);
    cin >> nowvec[0] >> nowvec[1] >> nowvec[2];
    vector<point> p(n, point(3));
    double r[n];
    REP(i, n) {
      cin >> p[i][0] >> p[i][1] >> p[i][2] >> r[i];
    }
    point now(3);
    while(1) {
      double mik = INF;
      int hoge;
      REP(i,n) {
        double a = dot(nowvec, nowvec);
        double b = 2*dot(nowvec, p[i]-now);
        double c = dot(p[i]-now,p[i]-now) - r[i]*r[i];

        double D = b*b - 4*a*c;
        if (D < 0) continue;
        double k = (b - sqrt(b*b-4*a*c)) / (2*a);
        if (k < 0) continue;
        if (mik > k) {
          mik = k;
          hoge = i;
        }
      }
      if (mik == INF) break;
      point vop(p[hoge]-now-nowvec*mik); // å«³rÌÍ¸
      // cout << mik << endl;
      // cout << "a " << norm(nowvec) << endl;
      // cout << r[hoge] << " " << norm(vop) << endl;
      point axis(cross(nowvec, vop));
      now = now + nowvec*mik;
      if (norm(axis) < 1e-7) {
        //cout << now << endl;
        nowvec = -nowvec;
        continue;
      }
      axis = axis / norm(axis);
      //cout << norm(nowvec*mik) << endl;
      double ang = acos(dot(vop, nowvec) / norm(vop) / norm(nowvec));
      nowvec = rotate(axis, ang*2 + M_PI, nowvec);
    }
    printf("%.6f %.6f %.6f\n", now[0], now[1], now[2]);
  }
}

Measured memory_bytes: 0