akhauriyash/Code-Regression huggingface dataset:
/*
	Nishant Singh
	nishant.ns19@gmail.com
*/
#include <bits/stdc++.h>
#include <functional> 
#include <iostream> 

// ******** Big Integer ********
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
// #define ll1024  int1024_t
// ******** Big Integer ********

// ******** Using PBDS ********
// #include <ext/pb_ds/assoc_container.hpp> // Common file 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
// #define ook order_of_key    //count of strictly smaller elements
// #define fbo find_by_order   //find element at an index 
// ******** Using PBDS ********

using namespace std;
#define ll long long
#define ld long double
#define pll pair<long long,long long>
#define pii pair<int,int>
#define vll vector<ll>
#define vec vector
#define setcount(x) __builtin_popcountll(x)
#define f first
#define s second
#define mp make_pair
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define REV(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define in insert
#define init(x,a) memset(x,a,sizeof(x))
#define all(c) c.begin(),c.end()
#define pq priority_queue
#define ffl fflush(stdout)
#define mset multiset
#define out(x) cout<<#x<<" = "<<" "<<x<<"\n";
#define ub upper_bound
#define lb lower_bound 
#define ln "\n"
#define Y "YES"
#define N "NO"
ll const mod=1e9 + 7;
ll const inf=2e18;

// ******** Using PBDS ********
// typedef tree<long long, null_type, less<long long>, rb_tree_tag, 
//              tree_order_statistics_node_update> 
//                 os; 
// ******** Using PBDS ********

inline ll add(ll a,ll b) 
{ 
	return (a%mod + b%mod + mod)%mod; 
}

inline ll mul(ll a,ll b) 
{ 
	return (a%mod * b%mod + mod)%mod; 
}

inline ll sub(ll a,ll b) 
{ 
	return (a%mod - b%mod + mod)%mod; 
}

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

ll modexp(ll x, ll n){
	if(n==0){
		return 1;
	}
	else if(n&1){
		return (modexp((x*x)%mod, n/2)%mod * x%mod)%mod;
	}
	else{
		return (modexp((x*x)%mod, n/2)%mod);
	}
}

ll modinv(ll n)
{
	return modexp(n,mod-2);
}

// ******** GLOBAL VARIABLES ********


// ******** GLOBAL VARIABLES ********

void solve(){
	ll n;
	cin>>n;
	ll a[n];
	REP(i,n)
	{
		cin>>a[i];
	}
	sort(a,a+n);
	ll ans=0;
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			for(int k=j+1;k<n;k++)
			{
				if(a[i]+a[j]>a[k] && (a[i]!=a[j] && a[j]!=a[k]))
					{
						ans++;
					}
			}
		}
	}
	cout<<ans<<ln;

}  

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll T=1;
	// cin>>T; 	
	for(int t=1;t<=T;t++)
	{
		// cout<<"Case #"<<t<<": ";
		solve();
	}
	return 0;
}

Measured memory_bytes: 3656
import java.io.*;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a = sc.next(), b = sc.next();
        StringBuilder sb = new StringBuilder(a);
        if(sb.reverse().toString().equals(b))System.out.print("YES");
        else System.out.println("NO");
    }
}


Measured memory_bytes: 21844
def solve(A, n, s):
    ans = 0

    V = [False for i in range(n)] # 値が交換済みかどうか
    B = sorted(A)
    T = [None for i in range(10001)]
    for i in range(n):
        T[B[i]] = i
    for i in range(n):
        if V[i]: continue
        cur = i # カーソル(サークル内で動かす)
        S = 0 # サークル内の数字の総和
        m = 10000
        an = 0 # サークルに含まれる数字の数
        while True:
            V[cur] = True
            an += 1
            v = A[cur]
            m = min(m, v) # mがサークル内の数字の最小値
            S += v
            cur = T[v]
            if V[cur]: break
        ans += min(S + (an-2)*m, m+S+(an+1)*s)
    return ans

n = int(input())
A = list(map(int, input().split(' ')))
s = min(A)
ans = solve(A, n, s)
print(ans)


Measured memory_bytes: 5776
<?php
// C
fscanf(STDIN, '%d', $n);
$a = array_map('intval', explode(' ', trim(fgets(STDIN))));
sort($a);
$l = $a[$n - 1];
$r = -1;
$d = PHP_INT_MAX;
for ($i = 0; $i < $n - 1; $i++) {
    $td = $l % 2 === 0 ? abs(intdiv($l, 2) - $a[$i]) : min(abs(intdiv($l, 2) - $a[$i]), abs(intdiv($l, 2) + 1 - $a[$i]));
    if ($td < $d) {
        $d = $td;
        $r = $a[$i];
    }
}
echo implode(' ', [$l, $r]);

Measured memory_bytes: 17012
A, B, M = map(int, input().split())
a = [int(a) for a in input().split()]
b = [int(b) for b in input().split()]
X = [0] * M
Y = [0] * M
C = [0] * M
for i in range(M):
    X[i], Y[i], C[i] = map(int, input().split())

all_prices = []
for x, y, c in zip(X, Y, C):
        all_prices.append(a[x-1] + b[y-1] - c)

prices = [min(a) + min(b), min(all_prices)]

print(min(prices))

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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll n,v[300001],suma,remain;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>v[i];
    sort(v+1,v+n+1);
    reverse(v+1,v+n+1);
    remain=n-1;
    suma+=v[1];
    remain--;
    ll poz=2;
    while(poz<=n&&remain)
    {
        suma+=v[poz];
        remain--;
        if(remain)
        {
            suma+=v[poz];
            remain--;
        }
        poz++;

    }
    cout<<suma;
    return 0;
}


Measured memory_bytes: 5208
#include <stdio.h>
#define LEN 10000
int main(void){
    int n;
    int a[LEN];
    int k;
    int c = 0;
    scanf("%d", &n);
    for(k = 0; k < n; k++){
        scanf("%d", &a[k]);
    }
    for(k = 0; k < n; k++){
        while(!(a[k]%2)){
            a[k] /= 2;
            c++;
        }
    }
    printf("%d\n", c);
    return 0;
}

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

#define MOD (1000000000+7)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) x.begin(), x.end()
#define print(vec,l,r) for(int i = l; i <= r; i++) cout << vec[i] <<" "; cout << endl;
#define forf(i,a,b) for(int i = (a); i < (b); i++)
#define forr(i,a,b) for(int i = (a); i > (b); i--)
// template starts
typedef long long int ll;
ll fact(ll n, ll p){
	ll ans = 1;
	for(ll i = 1; i <= n; i++){
		ans *= i;
		ans %= p;
	}
	return ans;
}
ll power(ll x, ll n, ll p){
	ll res = 1;
	if(n == 1) return x%p;
	if(n%2 == 1) res = x%p;

	ll temp = power(x,n/2,p);
	return res*((temp*temp)%p)%p;
}
ll inv(ll a, ll p){
	return power(a,p-2,p);
}
ll nCr(ll n, ll r, ll p){
	if(r > n) return 0;
	ll t1 = fact(n,p);
	ll t2 = inv(fact(r,p),p);
	ll t3 = inv(fact(n-r,p),p);

	return (((t1*t2)%p)*t3)%p;
}
vector<vector<ll> > multiply(vector<vector<ll> > &a, vector<vector<ll> > &b, ll p){
	int r1,c1,r2,c2;
	r1 = a.size(); c1 = a[0].size();
	r2 = b.size(); c2 = b[0].size();

	vector<vector<ll> > result(r1,vector<ll>(c2,0));

	if(c1 != r2) return result;

	for(int i = 0; i < r1; i++){
		for(int j = 0; j < c2; j++){
			for(int k = 0; k < c1; k++){
				result[i][j] += a[i][k]*b[k][j];
				result[i][j] %= p;
			}
		}
	}
	return result;
}

vector<vector<ll> > power(vector<vector<ll> >&a,ll n, ll p){
	int r = a.size();
	vector<vector<ll> > result(r,vector<ll>(r,0));
	for(int i = 0; i < r; i++) result[i][i] = 1;

	while(n > 0){
		if(n%2 == 1){
			result = multiply(result,a,p);
		}
		n /= 2;
		a = multiply(a,a,p);
	}
	return result;
}
// template ends here

void solve(){
	// code starts from here
	int N;
	cin >> N;
	string str;
	cin >> str;
	
	vector<vector<int> > vec(3);
	for(int i =0; i < N; i++){
		if(str[i] == 'R') vec[0].pb(i);
		else if(str[i] == 'G') vec[1].pb(i);
		else vec[2].pb(i);
	}
	ll ans = vec[0].size();
	ans = ans*vec[1].size();
	ans = ans*vec[2].size();
	for(int i = 0; i < N; i++){
		for(int d = 1; d < N; d++){
			if(i+d+d >= N) break;
			string temp;
			temp.pb(str[i]); temp.pb(str[i+d]);
			temp.pb(str[i+d+d]);
			
			sort(all(temp));
			if(temp == "BGR"){
				ans--;
			}
		}
	}
	cout << ans << endl;
}

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

	int T;
	//cin >> T;
	T = 1;
	while(T--){
		solve();
	}
	return 0;
}


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

A = [int(x) - 1 for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]

ans = 0
for i in range(N):
    ans += B[A[i]]
    if i > 0:
        if A[i] == A[i-1] + 1:
            ans += C[A[i-1]]

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>
#include <cstdint>



#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rrep(i, n) for(ll i = (ll)(n-1); i >= 0; i--)
#define repi(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rrepi(i,a,b) for(ll i=(ll)(b-1);i>=(ll)(a);i--)

#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a,b,c;cin>>a>>b>>c;
  ll d=a^b^c;
  if(d==a||d==b||d==c){
    if(a==b&&b==c){
      cout<<"No"<<endl;
      return 0;
    }
    cout<<"Yes"<<endl;
  }
  else {
    cout<<"No"<<endl;
  }

  return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);cout.precision(20);}} fast;

/* define */
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define COUNT(V,X) (upper_bound((V).begin(),(V).end(),X)-lower_bound((V).begin(),(V).end(),X))
#define debug(x) cerr<<#x<<':'<<x<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto xXx:v)cerr<<xXx<<' ';cerr<<endl;
#define Yes(X) if(X){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define YES(X) if(X){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define ctoi(C) (C-'0')
#define pow2(x) ((long long)((long long)1<<x))

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int,int>;
using pl = pair<long long,long long>;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1,0,-1,0};
const long long dy[] = {0,1,0,-1};
const long long dx8[] = {1,1,0,-1,-1,-1,0,1};
const long long dy8[] = {0,1,1,1,0,-1,-1,-1};
const long long dx9[] = {1,1,0,-1,-1,-1,0,1,0};
const long long dy9[] = {0,1,1,1,0,-1,-1,-1,0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
long long max(long long x,int y){return max(x,(long long)y);}
long long max(int x,long long y){return max((long long)x,y);}
long long min(long long x,int y){return min(x,(long long)y);}
long long min(int x,long long y){return min((long long)x,y);}

/* liblary */



/* main */

signed main(){
	string S;
	cin >> S;
	ll N = S.size();
	ll s[N] = {0};
	FOR(i,0,N)s[i] = ctoi(S[i]);
	ll max[2*N];
	FOR(i,0,2*N){
		max[i] = (i ? max[i-1] : 0) + (s[0] ? 1 : 0);
		if(s[0])s[0]--;
		FOR(j,1,N){
			if(s[j]){
				s[j-1]++;
				s[j]--;
			}
		}
	}
	FOR(i,0,N)s[i] = ctoi(S[i]);
	ll min[2*N];
	FOR(i,0,2*N){
		if(i == 0)min[i] = (s[0]==2 ? 1 : 0);
		else min[i] = min[i-1] + (s[0]==2 ? 1 : 0);
		if(s[0]==2){
			s[0] = 1;
		}
		FOR(j,1,N){
			if(s[j] == 2){
				s[j]--;
				s[j-1]++;
			}
			if(s[j] == 1 && j == 2*N-i){
				s[j]--;
				s[j-1]++;
			}
		}
	}
	//DP[i][j] = i回目までの操作でj個使うような場合の数
	ll DP[2*N+1][2*N+1];
	FOR(i,0,2*N)FOR(j,0,2*N+1)DP[i][j] = 0;
	DP[0][0] = 1;
	if(max[0])DP[0][1] = 1;
	if(min[0])DP[0][0] = 0;
	FOR(i,1,2*N)FOR(j,0,2*N+1){
		DP[i][j] += DP[i-1][j];
		if(j)DP[i][j] += DP[i-1][j-1];
		//
		DP[i][j] %= 998244353;
		if(j > max[i])DP[i][j] = 0;
		if(j < min[i])DP[i][j] = 0;
	}
	cout << DP[2*N-1][max[2*N-1]] << endl;
}



Measured memory_bytes: 125440
integer N
integer,allocatable,dimension(:)::A,B
integer::mo=10**9+7
integer ans
logical ABsame
read*,N
allocate(A(N),B(N))
read*,A
call Heapsort(N,A)
select case(mod(N,2))
  case(1) 
    B(1)=0
    do i=1,N/2
      B(2*i)=i*2
      B(2*i+1)=i*2
    end do
  case(0)
    do i=1,N/2
      B(2*i-1)=2*i-1
      B(2*i)=2*i-1
    end do
end select
ABsame=.True.
do i=1,N
  if(A(i)/=B(i))ABsame=.false.
end do


if(ABsame)then
  ans=1
  do i=1,N/2
    ans=mod(ans*2,mo)
  end do
  print"(i0)",ans
else
  print"(i0)",0
endif
contains
subroutine heapsort(n,array)
  implicit none
!ここの入力は状況に応じて変更すること
  integer,intent(in) :: n
  integer,intent(inout) :: array(1:n)
  integer::i,k,j,l
  integer:: t

  l=n/2+1
  k=n
  do while(k /= 1)
     if(l > 1)then
        l=l-1
        t=array(L)
     else
        t=array(k)
        array(k)=array(1)
        k=k-1
        if(k == 1) then
           array(1)=t
           exit
        endif
     endif
     i=l
     j=l+l
     do while(j<=k)
        if(j < k)then
           if(array(j) < array(j+1))j=j+1
        endif
        if (t < array(j))then
           array(i)=array(j)
           i=j
           j=j+j
        else
           j=k+1
        endif
     enddo
     array(i)=t
  enddo
  return
end subroutine heapsort
end

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

int main() {
	string S;
	cin >> S;
  	int N = S.size();
  
	vector<char> S1(N);
	vector<char> S2(N);
	S1.at(0)='0';
	S2.at(0)='1';
	
	for (int i=1;i<N;i++){
		if(S1.at(i-1)=='0'){
			S1.at(i)='1';
		}
		else{
			S1.at(i)='0';
		}
		if(S2.at(i-1)=='0'){
			S2.at(i)='1';
		}
		else{
			S2.at(i)='0';
		}
	}
	int count1=0;
	int count2=0;
	for(int i=0;i<N;i++){
		if(S.at(i)!=S1.at(i)){
			count1++;
		}
		if(S.at(i)!=S2.at(i)){
			count2++;
		}
	}
	cout << min(count1,count2)<<endl;

}


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

main() {
    int A, B, M;
    cin >> A >> B >> M;
    vector<int> a;
    int a_min = 100000;
    rep(i, A) {
        int ai;
        cin >> ai;
        a.push_back(ai);
        if (ai < a_min) {
            a_min = ai;
        }
    }
    vector<int> b;
    int b_min = 100000;
    rep(i, B) {
        int bi;
        cin >> bi;
        b.push_back(bi);
        if (bi < b_min) {
            b_min = bi;
        }
    }
    vector<vector<int>> discount;
    rep(i, M) {
        int x, y, c;
        cin >> x >> y >> c;
        discount.push_back({x, y, c});
    }

    // cout << discount.size() << endl;

    int min_price = a_min + b_min;
    rep(i, M) {
        int price = a.at(discount.at(i).at(0) - 1) + b.at(discount.at(i).at(1) - 1) - discount.at(i).at(2);
        if (price < min_price) {
            min_price = price;
        }
    }

    cout << min_price << endl;
}

Measured memory_bytes: 7536
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
a = list(li())

maxa = max(a)

a.remove(maxa)

half = maxa / 2
minabs_from_half = 10**18

ans = -1
for ai in a:
    if abs(half - ai) < minabs_from_half:
        ans = ai
        minabs_from_half = abs(half - ai)

print(maxa, ans)

Measured memory_bytes: 14136
#include<cstdio>
#include<vector>
#include<algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int n,d,m[100],id[100],p[100],num;
vector<int> c[100];

int main(){
  while(scanf("%d%d",&n,&d), n){
    num = 0;
    rep(i,n){
      scanf("%d",&m[i]);

      c[i].resize(m[i]); p[i] = 0;
      rep(j,m[i]){
	scanf("%d",&c[i][j]);
	p[i] += c[i][j];
      }

      num += m[i];
      id[i] = m[i]-1;
    }

    bool f = true;
    rep(i,num){
      int maxv = -1, secv = -1;
      rep(j,n){
	secv = max(secv,p[j]);
	if(secv > maxv)swap(secv,maxv);
      }

      f = false;
      rep(j,n){
	if(id[j]>=0){
	  if(p[j] == maxv){
	    if(secv<0 || secv-d<=p[j]-c[j][id[j]]){
	      p[j] -= c[j][id[j]];
	      id[j]--;
	      f = true;
	      break;
	    }
	  }else if(maxv-d<=p[j]-c[j][id[j]]){
	    p[j] -= c[j][id[j]];
	    id[j]--;
	    f = true;
	    break;
	  }
	}
      }

      if(!f)break;
    }
    printf(f?"Yes\n":"No\n");
  }
}

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

int main() {
  int N;
  cin >> N;
  vector<vector<int>> can(2, vector<int>(N));
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < N; j++) {
      cin >> can[i][j];
    }
  }
  
  int f = 0;
  for (int i = 0; i < N; i++) {
    int ge = 0;
    for (int j = 0; j < i+1; j++) {
      ge += can[0][j];
    }
    for (int j = i; j < N; j++) {
      ge += can[1][j];
    }
    f = max(ge, f);
  }
  
  cout << f << endl;
}

Measured memory_bytes: 256
let readIntArray () =
    stdin.ReadLine().Split(" ") |> Array.map int

let choice ok ng bool = if bool then ok else ng

readIntArray ()

readIntArray ()
|> fun x ->
    x
    |> Array.filter (fun y -> y % 2 = 1 || y % 3 = 0 || y % 5 = 0)
    |> Array.length
    |> (=)
    <| (x |> Array.length)
|> choice "APPROVED" "DENIED"
|> printfn "%s"


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

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


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

int degreeCheck(int turn)
{
    if (turn >= 360){
        turn -= 360;
    }else if (turn < 0){
        turn += (360 + turn);
    } 
    return turn;
}

double radian(int turn)
{
    return ((double)turn * M_PI / 180.0);
}

void move(double * x, double * y, int turn, int d)
{
    //printf("sin and cos : %lf %lf\n", sin(radian(turn)), cos(radian(turn)));
    *y += (sin(radian(turn)) * d);
    *x += (cos(radian(turn)) * d);
}

int main(void)
{
    double x = 0, y = 0;
    int d, t, turn = 90;

    while (1){
        scanf("%d,%d", &d, &t);
        //turn = degreeCheck(turn);
        if (d == 0 && t == 0){
            break;
        }

        move(&x, &y, turn, d);
        turn -= t;
        //turn = degreeCheck(turn);

        //printf("move to : %d %d,  degree : %d\n", x, y, turn);
    }
    printf("%d\n%d\n", (int)x, (int)y);

    return (0);
}



Measured memory_bytes: 2032
h,w,m=map(int,input().split())
hl=[0]*(h)
wl=[0]*(w)
bom=[]
for i in range(m):
  h1,w1=map(int,input().split())
  bom.append([h1-1,w1-1])
  hl[h1-1]+=1
  wl[w1-1]+=1

mh=max(hl)
mw=max(wl)
ans=mh+mw
mhl=set()
mwl=set()
for i in range(h):
  if mh==hl[i]:
    mhl.add(i)
    
for i in range(w):
  if mw==wl[i]:
    mwl.add(i)

count=len(mhl)*len(mwl)
for i in range(len(bom)):
  if bom[i][0] in mhl and bom[i][1] in mwl:
    count-=1
if count>0:
  print(ans)
else:
  print(ans-1)


Measured memory_bytes: 216344
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<string>
#include<algorithm>
#include<iostream>
#include<bitset>
#include<functional>
#include<numeric>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cassert>
#include<cmath>
#include<iomanip>
#include<random>
#include<ctime>
#include<complex>
using namespace std;
typedef long long LL;
typedef double D;
#define all(v) (v).begin(), (v).end()
mt19937 gene(233);
typedef complex<double> Complex;
#define fi first
#define se second
#define ins insert
#define pb push_back
inline char GET_CHAR(){
	const int maxn = 131072;
	static char buf[maxn],*p1=buf,*p2=buf;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,maxn,stdin),p1==p2)?EOF:*p1++;
}
inline int getInt() {
	int res(0);
	char c = getchar();
	while(c < '0') c = getchar();
	while(c >= '0') {
		res = res * 10 + (c - '0');
		c = getchar();
	}
	return res;
}

inline LL fastpo(LL x, LL n, LL mod) {
	LL res(1);
	while(n) {
		if(n & 1) {
			res = res * (LL)x % mod;
		}
		x = x * (LL) x % mod;
		n /= 2;
	}
	return res;
}
LL gcd(LL a, LL b) { return b ? gcd(b, a % b) : a; }

inline string itoa(int x, int width = 0) {
  string res;
  if(x == 0) res.push_back('0');
  while(x) {
    res.push_back('0' + x % 10);
    x /= 10;
  }
  while((int)res.size() < width) res.push_back('0');
  reverse(res.begin(), res.end());
  return res;
}
const int _B = 131072;
char buf[_B];
int _bl = 0;
inline void flush() {
	fwrite(buf, 1, _bl, stdout);
	_bl = 0;
}
__inline void _putchar(char c) {
	if(_bl == _B) flush();
	buf[_bl++] = c;
}
inline void print(LL x, char c) {
	static char tmp[20];
	int l = 0;
	if(!x) tmp[l++] = '0';
	else {
		while(x) {
			tmp[l++] = x % 10 + '0';
			x /= 10;
		}
	}
	for(int i = l - 1; i >= 0; i--) _putchar(tmp[i]);
	_putchar(c);
}
struct P {
	D x, y;
};
const int N = 300033;
const int LOG = 20;
const int mod = 1e9 + 7;
const int inf = 1e9 + 7;
int n, m;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main() {
	int n;
	int cnt = 0;
	cin >> n;
	for(int i = 1; i <= n; i++) {
		int x;
		cin >> x;
		cnt += (x % 2 == 1 && i % 2 == 1);
	}
	cout << cnt << endl;
}






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

class Main {
    public static void main(String[] args) throws IOException {
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); //コンソールから入れる際に高速に入れる方法

        
        String strArr[] = br.readLine().split(" ");
      	 
        String temp = strArr[1]; 
      	strArr[1] = strArr[0];
      	strArr[0] = strArr[2];
      	strArr[2] = temp;
          System.out.println(strArr[0] + " " + strArr[1] + " " + strArr[2]);
    }
}

Measured memory_bytes: 20948
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<n;++i)

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 502;
const int MAX_V = 1005;

struct edge
{
	int to,cap,rev;
};

vector<edge> G[MAX_V];
int level[MAX_V];
int iter[MAX_V];
int n,m;
int a[MAX_N],b[MAX_N];

void add_edge(int from,int to,int cap)
{
	G[from].push_back((edge){to,cap,G[to].size()});
	G[to].push_back((edge){from,0,G[from].size()-1});
}

void bfs(int s)
{
	memset(level,-1,sizeof(level));
	queue<int> que;
	level[s] = 0;
	que.push(s);
	while(!que.empty()){
		int v = que.front();
		que.pop();
		rep(i,G[v].size()){
			edge &e = G[v][i];
			if(e.cap > 0 && level[e.to] < 0){
				level[e.to] = level[v] + 1;
				que.push(e.to);
			}
		}
	}
}

int dfs(int v,int t,int f)
{
	if(v==t){
		return f;
	}
	for(int &i = iter[v];i<G[v].size();i++){
		edge &e = G[v][i];
		if(e.cap > 0 && level[v] < level[e.to]){
			int d = dfs(e.to,t,min(f,e.cap));
			if(d>0){
				e.cap -= d;
				G[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

int max_flow(int s,int t)
{
	int flow = 0;
	for(;;){
		bfs(s);
		if(level[t]<0){
			return flow;
		}
		memset(iter,0,sizeof(iter));
		int f;
		while((f=dfs(s,t,INF)) > 0){
			flow += f;
		}
	}
}

int gcd(int x, int y){
    if(x % y == 0){
        return y;
    }
    gcd(y,x % y);
}

int main()
{
    while(1){
        scanf("%d%d",&n,&m);
        if(n == 0 && m == 0){
            break;
        }
    	rep(i,n){
    		scanf("%d",&a[i]);
    	}
        rep(i,m){
            scanf("%d",&b[i]);
        }
        rep(i,n+m+2){
            G[i].clear();
        }
        rep(i,n){
            add_edge(0,i+1,1);
        }
        rep(i,m){
            add_edge(n+i+1,n+m+1,1);
        }
        rep(i,n){
            rep(j,m){
                if(gcd(a[i],b[j]) > 1){
                    add_edge(i+1,n+j+1,INF);
                }
            }
        }
        printf("%d\n",max_flow(0,n+m+1));
    }

	return 0;
}

Measured memory_bytes: 9480
#include <iostream>
#include<algorithm>
using namespace std;
int a[1000],b[1000];
int h[10001];

int main(void){
    int hh,n;
    cin>>hh>>n;
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
    }
    fill(h,h+10001,100000000);
    int minm=100000000;
    h[0]=0;
    for(int i=0;i<hh;i++){
        for(int k=0;k<n;k++){
            if(i+a[k]>=hh){minm=min(h[i]+b[k],minm);continue;}
            h[i+a[k]]=min(h[i]+b[k],h[i+a[k]]);
        }
    }
    cout<<minm;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <deque>
#include <bitset>
using namespace std;

#define rep(i, n) for (int i=0; i<int(n); i++)
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
using ll = long long;


int main() {
	int a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;
	vector<int> vec_w;
	vector<int> vec_s;

	for (int i=0; i<=3000; i++) {
		for (int j=0; j<=3000; j++) {
			if (100*i*a + 100*j*b <= f) vec_w.push_back(100*i*a + 100*j*b);
		}
	}
	for (int i=0; i<=3000; i++) {
		for (int j=0; j<=3000; j++) {
			if (i*c+j*d<=f) vec_s.push_back(i*c+j*d);
		}
	}
	double max_d = 0.0;
	int res_ws = 0;
	int res_s = 0;
	for (auto w: vec_w) {
		for (auto s: vec_s) {
			if (w+s > f) continue;
			double d = 100*s/double(w+s);
			if (d<=e*100/double(100+e) && d>=max_d) {
				max_d = d;
				res_ws = w+s;
				res_s = s;
			}
		}
	}
	cout << res_ws << " " << res_s << endl;
}

Measured memory_bytes: 4200
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>


using namespace std;

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


int main() {
	int N;
	cin >> N;
	cout << (N+1) / 2 << endl;
	
	return 0;
}

Measured memory_bytes: 888
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(){
	int N;
	cin>>N;
	float x[N],sum=0;
	string u[N];
	for(int i=0;i<N;i++){
		cin>>x[i]>>u[i];
	}
	for(int i=0;i<N;i++){
		if(u[i]=="JPY"){
			sum+=x[i];
		}else{
			sum+=x[i]*380000.0f;
		}
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip> //setprecision
#include <limits>
using namespace std;
int main(){
  int n;
  cin >> n;
  int sum=0;
  vector<long long>a(n);
  for(int i=0; i<n; i++){
    cin >> a[i];
  }
  sort(a.begin(),a.end());
  int s=1;
  for(int i=0; i<n-1; i++){
    if(a[i]==a[i+1]) s++;
    else{
      if(a[i]>s){sum+=s;}
      else if(a[i]<s){
        sum+=(s-a[i]);
      }
      s=1;
    }
  }
  if(a[n-1]>s){sum+=s;}
  else if(a[n-1]<s){
    sum+=(s-a[n-1]);
  }
  cout << sum << endl;
}


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

int main() {
  int N;
  cin >> N;
  
  for(int i=0; i<N; i++){
    string A;
    cin >> A;
    
    if(A == "Y"){
      cout << "Four" << endl;
      return 0;
    }    
  }
  
  cout << "Three" << endl;
}


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

int main()
{
    int k,x;
    cin>>k>>x;

    int cnt = k-1;
    int dnt = k-1;
    for(int i = x-cnt; i < x; i++)
    {
        cout<<i<<" ";
        cnt--;
    }
    cout<<x<<" ";
    for(int i = x+1; dnt > 0; i++)
    {
        cout<<i<<" ";
        dnt--;
    }
    cout<<endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int n,c,k;cin>>n>>c>>k;
  vector<int> a(n);
  for(int i = 0; n > i; i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  int mn = a[0];
  int nwp = 1;
  int ans = 1;
  for(int i = 1; n > i; i++){
    if(a[i]-mn > k){
      ans++;
      mn = a[i];
      nwp = 1;
    }else if(nwp == c){
      ans++;
      mn = a[i];
      nwp = 1;
    }else{
      nwp++;
    }

  }
  cout << ans << endl;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>

#define REP(i,n) for(i=0;i<n;i++)

//prototype declaration
int iin();
long long llin();
double din();
char cin();
void stin(char *s);
void iout(int i);
void llout(long long i);
void dout(double i);
void cout(char c);
void stout(char *s);
int gcd(int a, int b);
int lcm(int a, int b);
long long llgcd(long long a, long long b);
long long lllcm(long long a, long long b);
int asc(const void *a, const void *b);
int desc(const void *a, const void *b);
double to_deg(double rad);
double distance(int xi, int yi, int xj, int yj);

//main function
int main() {
    int N = iin(), i, j;
    int x[N], y[N];
    double d[N][N];
    double d_sum = 0;
    REP(i,N) {
        x[i] = iin();
        y[i] = iin();
    }
    REP(i,N) {
        REP(j,N) {
            if (i == j) {
                d[i][j] = 0;
                d_sum += d[i][j];
                continue;
            }
            d[i][j] = distance(x[i], y[i], x[j], y[j]);
            d_sum += d[i][j];
        }
    }
    dout(d_sum / N);
    return 0;
}

//body function
int iin() {
    int i;
    scanf("%d", &i);
    return i;
}

long long llin() {
    long long i;
    scanf("%lld", &i);
    return i;
}

double din() {
    double i;
    scanf("%lf", &i);
    return i;
}

char cin() {
    char c;
    scanf("%c", &c);
    return c;
}

void stin(char *s) {
    scanf("%s", s);
}

void iout(int i) {
    printf("%d\n", i);
}

void llout(long long i) {
    printf("%lld\n", i);
}

void dout(double i) {
    printf("%lf\n", i);
}

void cout(char c) {
    printf("%c\n", c);
}

void stout(char *s) {
    printf("%s\n", s);
}

/*
    int型の最大公約数
*/

int gcd(int a, int b) {
    int r;

    if (a < b) {
        r = a;
        a = b;
        b = r;
    }

    r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}

/*
    int型の最小公倍数
*/

int lcm(int a, int b) {
    int r = llgcd(a, b);
    a /= r;
    return a * b;
}

/*
    long long型の最大公約数
*/

long long llgcd(long long a, long long b) {
    long long r;

    if (a < b) {
        r = a;
        a = b;
        b = r;
    }

    r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}

/*
    long long型の最小公倍数
*/

long long lllcm(long long a, long long b) {
    long long r = llgcd(a, b);
    a /= r;
    return a * b;
}

/*
    int型の昇順用比較関数
*/

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

/*
    int型の降順用比較関数
*/

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

/*
    弧度法を度数法に
*/

double to_deg(double rad) {
    return rad * 180.0 / (atan(1.0) * 4.0);
}

double distance(int xi, int yi, int xj, int yj) {
    return hypot(xj - xi, yj - yi);
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define llu unsigned long long int
#define Endl endl
#define mod  998244353
#define mkp make_pair
#define pb push_back
#define cin(n) scanf("%d",&n)
#define cout(n) printf("%d ",n)
#define sf(n) scanf("%d",&n)
#define pf(n) printf("%d ",n)
#define bitget(n) __builtin_popcountll(n)
ll n,m;
ll dx[] = {1,1,0,-1,-1,-1,0,1};
ll dy[] = {0,-1,-1,-1,0,1,1,1};
ll dxx[] = {1,-1,0,0};
ll dyy[] = {0,0,-1,1};
ll modexpo(ll x,ll y){if(y==0)return 1;if(y%2){ll viky=modexpo(x,y/2);
return (((x*viky)%mod)*viky)%mod;}else{ll viky=modexpo(x,y/2);return (viky*viky)%mod;
}}
// ll intpoint(ll x1, ll y1, ll x2, ll y2) { return ( __gcd(abs(x1-x2),abs(y1-y2))+1); }
bool isvalid(ll x,ll y) { return (x>=1&&x<=n&&y>0&&y<=m); }
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// int pp = uniform_int_distribution<int>(0, kk-1)(rng);
// ---------------------///////////////---------------------------------
// ---------------------///////////////----------------------------------
// -------------/////////////////---------------------------------///////



int main() {
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll n,m;
    cin>>n>>m;

    ll ans = 1;
    if(m==1){
        cout<<0;
        return 0;
    }

    for(ll i = 1; i<=100;i++){

        // ll val = 
        ans = ans + n-1;
        // cout<<ans<<" ";
        if(ans>=m){
            cout<<i;
            return 0;
        }
    }

    

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
ll a[3],m[3],c[3];

ll gcd(ll x,ll y){
  if(!y) return x;
  return gcd(y,x%y);
}

ll lcm(ll x,ll y){
  if(x < y) swap(x,y);
  return x*y/gcd(x,y);
}
int main(void){
  while(cin >> a[0] >> m[0] >> a[1] >> m[1] >> a[2] >> m[2] && a[0]){
    for(int i = 0; i < 3; i++){
      ll x = 1;
      c[i] = 0;
      do{
	x = (x*a[i])%m[i];
	c[i]++;
      }while(x!=1);
    }
    cout << lcm(c[0],lcm(c[1],c[2])) << endl;
  }
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
int cnt;
int main(){
	int a,b,c,x;
	cin>>a>>b>>c>>x;
	for(int i=0;i<a+1;i++){
		for(int j=0;j<b+1;j++){
			for(int k=0;k<c+1;k++){
				if(i*500+j*100+k*50==x){
					cnt++;
				}
			}
		}
	}
	cout<<cnt<<endl;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i,s,n) for(int i=s;i< (int)n; i++)
#define ll long long 
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
  ll n,k; cin >>n>>k;
  vector<ll> a(n);
  map<ll,ll> mp;
  rep(i,n){
    cin >>a[i];
    mp[a[i]]++;
  }
  vector<ll> b;
  for(auto x:mp){
    b.push_back(x.second);
  }
  sort(all(b));
  ll sum=0;
  rep(i,b.size()-k){
    sum+=b[i];
  }
  cout <<sum<<endl;
}

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

template<typename T, T M>
struct modint {
T n;
constexpr modint(const T n = 0) : n((n % M + M) % M) {}
constexpr modint pow(T r) const {
modint ans(1), a(n);
while(r) { if (r & 1) ans *= a; a *= a; r >>= 1; }
return ans;
}
constexpr modint& operator+= (const modint r) {
n += r.n; if (n >= M) n -= M; return *this;
}
constexpr modint& operator-= (const modint r) {
n -= r.n; if (n < 0) n += M; return *this;
}
constexpr modint& operator*= (const modint r) {
n = n * r.n % M; return *this;
}
constexpr modint operator+ (const modint r) const { return modint(n) += r; }
constexpr modint operator- (const modint r) const { return modint(n) -= r; }
constexpr modint operator* (const modint r) const { return modint(n) *= r; }
/* Divisions only work for prime modules */
constexpr modint& operator/= (const modint r) { return (*this) *= r.pow(M-2); }
constexpr modint operator/ (const modint r) const { return modint(n) /= r; }
};

template<typename T>
struct modfact {
vector<T> fact, invfact;
constexpr modfact(int n): fact(n + 1), invfact(n + 1) {
fact[0] = T(1);
for(int i = 1; i <= n; i++)
fact[i] = fact[i - 1] * T(i);
invfact[n] = T(1) / fact[n];
for(int i = n - 1; i >= 0; --i)
invfact[i] = invfact[i + 1] * T(i + 1);
}
constexpr T p(int n, int k) const {
// permutations: n! / k!
if (k < 0 || k > n) return T(0);
return fact[n] * invfact[k];
}
constexpr T c(int n, int k) const {
// combinations(binomial coefficient): n! / (k! * (n - k)!)
if (k < 0 || k > n) return T(0);
return p(n, k) * invfact[n - k];
}
};

typedef modint<long, 1000000007L> mint;

int main() {
  int n, m;
  cin >> n >> m;
  
  modfact<mint> mf(m);
  mint ans = mf.c(m, n) * mf.fact[n];
	mint b(ans);
  for (int i = 1; i <= n; ++i) {
   	if (i % 2) {
      b -= mf.c(n, i) * mf.c(m - i, n-i) * mf.fact[n - i];
    } else {
      b += mf.c(n, i) * mf.c(m - i, n-i) * mf.fact[n - i];
    }
  }
  mint res = ans * b;
  cout << res.n << endl;
  return 0;
}

Measured memory_bytes: 11080
s=input()
k=int(input())
ans,bns=0,0
for i in range(len(s)):
    if s[i]!="1":
        ans=s[i]
        break
    else:
        bns+=1 #0の連続
if k<=bns: #k=何番目
    print(1)
else:
    print(ans)
    


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

int main(){
  char c;
  cin >> c;
  
  if (c == 'A') cout << 'T' << endl;
  if (c == 'T') cout << 'A' << endl;
  if (c == 'C') cout << 'G' << endl;
  if (c == 'G') cout << 'C' << endl;
  
  
}

Measured memory_bytes: 256
N, K = map(int, input().split())
ans = 0

if K == 0:
	print(N * N)
else:
	for i in range(K + 1, N + 1):
		ans += (N // i) * (i - K)
		if N % i >= K:
			ans += N % i - (K - 1)
	print(ans)

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

using namespace std;
using ll = long long;

int main() {
  ll N, D;
  cin >> N >> D;
  vector<vector<ll>> X(N, vector<ll>(D));
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < D; ++j) {
      cin >> X[i][j];
    }
  }
  ll ret = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = i+1; j < N; ++j) {
      double d = 0;
      for (int k = 0; k < D; ++k) {
        d += pow(X[i][k]-X[j][k], 2);
      }
      d = sqrt(d);
      if (d == int(d))
        ret++;
    }
  }
  cout << ret << endl;
}


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


fun main(args: Array<String>) {
    val inputReader = InputReaderabc148_a(System.`in`)

    val a = inputReader.nextLine().toInt()
    val b = inputReader.nextLine().toInt()

    print(6 - (a+b))
}

class InputReaderabc148_a(stream: InputStream) {
    private var reader: BufferedReader = BufferedReader(InputStreamReader(stream))
    private var tokenizer: StringTokenizer? = null

    init {
        tokenizer = null
    }

    operator fun next(): String {
        while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
            try {
                tokenizer = StringTokenizer(reader.readLine())
            } catch (e: IOException) {
                throw RuntimeException(e)
            }

        }
        return tokenizer!!.nextToken()
    }

    fun nextInt(): Int {
        return Integer.parseInt(next())
    }

    fun nextLong(): Long {
        return java.lang.Long.parseLong(next())
    }

    fun nextDouble(): Double {
        return java.lang.Double.parseDouble(next())
    }

    fun nextLine(): String {
        var str = ""
        try {
            str = reader.readLine()
        } catch (e: IOException) {
            e.printStackTrace()
        }

        return str
    }
}


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

int main(){
	int a[31] = {}, n;
	for(int i=0 ; i<28 ; ++i ){
		cin >> n;
		a[n] = 1;
	}
	for(int i=1 ; i<31 ; ++i ){
		if( !a[i] ){
			cout << i << endl;
		}
	}
}

Measured memory_bytes: 0
#pragma warning(disable: 4996)
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <sstream>
#include <fstream>
#include <math.h>
#include <algorithm>

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

int main() {
    int n,rtow = 0,wtor = 0;
    string s,s2;
    cin >> n >> s;
    s2 = s;
    int k = s.size();
    rep(i, k) {
        s2[i] = 'W';
        if (s[i] == 'R')rtow++;
    }
   
    int ans = rtow;
    rep(i, k) {
        s2[i] = 'R';
        if (s[i] == 'W')wtor++;
        if (s[i] == 'R')rtow--;
        if (max(wtor, rtow) <= ans)ans = max(rtow, wtor);
    }
    cout << ans << endl;
return 0;
}

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

int main() {
int N;
  cin >>N;
 int ans = 0;
  vector<int> K = {105,165,195,135,189};
  for(int i=0;i<5;i++) {
   if(N >= K[i])ans++;
  }
  printf("%d\n",ans);
  }


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define int long long
#define FOR(i, m, n) for(int i = m;i < n;i++)
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1000000007;
const long long INF = 1LL << 60;
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;
    VI pro(n);
    rep(i,n) cin >> pro[i];
    SORT(pro);
    cout << pro[n/2] - pro[n/2-1] << endl;
    return 0;
}

Measured memory_bytes: 1024
/**
 *	   author: nayakashutosh9 
**/
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
#define mod 1000000007
#define inf 1e18
 
/*******************************************************************/
 


int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
 //    int t,tc=1;cin>>t;
	// cin.ignore();
	// while(t--){

	// }
	int n;cin>>n;
	string s;cin>>s;
	if(s.length()>n){
		string ans=s.substr(0,n);
		ans+="...";
		cout<<ans<<endl;
	}
	else cout<<s<<endl;
}

Measured memory_bytes: 3644
#include<stdio.h>
#include<string.h>
#include <stdlib.h>

int main(){
    int N,D,S=0,SUM=0;
    int X[10][10];
    scanf("%d %d",&N,&D);
    for (int i=0; i<N; i++) {
        for (int j=0; j<D; j++) {
            scanf("%d",&X[i][j]);
        }
    }
    for (int i=0; i<N-1; i++) {
        for (int j=i+1; j<N; j++) {
            S=0;
            for (int k=0; k<D; k++) {
                S+=(X[i][k]-X[j][k])*(X[i][k]-X[j][k]);
            }
            if(S==1){
                SUM++;
            }
            for (int z=2; (z*z)<=S; z++) {
                if(S==(z*z)){
                    SUM++;
                    break;
                }
            }
        }
    }
    printf("%d\n",SUM);
    return 0;
}

Measured memory_bytes: 128
N, A, B = [int(n) for n in input().split()]

def dismantle(n):
  ans = 0
  while n > 0:
    ans += n % 10
    n //= 10
  return ans

ans = 0
for i in range(N+1):
  comp = dismantle(i)
  if i > 0 and A <= comp and comp <= B:
    ans += i

print(ans)

Measured memory_bytes: 2940
// -*- coding:utf-8-unix -*-

use proconio::input;

fn main() {
    input! {
        s: String,
        t: String,
    }

    let vs: Vec<char> = s.chars().collect();
    let vt: Vec<char> = t.chars().collect();
    let mut saved = 0;
    for i in 0..vs.len() - vt.len() + 1 {
        let mut current = 0;
        // println!("i: {}", i);
        for j in 0..vt.len() {
            // println!("j: {}", j);
            if i + j >= vs.len() {
                continue;
            }

            if vs[i + j] == vt[j] {
                current += 1;
            } else {
                continue;
            }
        }
        // println!("streak: {}", current);
        saved = saved.max(current);
    }
    println!("{}", vt.len() - saved);
}


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

using namespace std;

const int MOD = 1000000007;

struct mint {
  int n;
  mint(int n_ = 0) : n(n_) {}
};

mint operator-(mint a) {
  return -a.n + MOD * (a.n != 0);
}
mint operator+(mint a, mint b) {
  int x = a.n + b.n;
  return x - (x >= MOD) * MOD;
}
mint operator-(mint a, mint b) {
  int x = a.n - b.n;
  return x + (x < 0) * MOD;
}
mint operator*(mint a, mint b) {
  return (long long)a.n * b.n % MOD;
}
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }
istream &operator>>(istream &i, mint &a) { return i >> a.n; }
ostream &operator<<(ostream &o, mint a) { return o << a.n; }

mint dp[100003][3][2]; // EQ, LT, GT

enum { EQ, LT, GT };

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  const int n = s.size();
  dp[n][EQ][0] = 1;
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < 2; k++) {
        for (int x = 0; x < 2; x++) {
          for (int y = 0; y < 2; y++) {
            int v = x + y + k;
            int u = v % 2;
            if ((x ^ y) != v % 2) continue;
            int nj = j;
            if (s[i] - '0' < u) nj = GT;
            if (s[i] - '0' > u) nj = LT;
            dp[i][nj][v / 2] += dp[i + 1][j][k];
          }
        }
      }
    }
  }
  cout << dp[0][LT][0] + dp[0][EQ][0] << endl;
}



Measured memory_bytes: 2816
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};


  
int main(){
  int r;
  cin>>r;
  
  int ans;
  ans = 3*r*r;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256