akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef pair<string , int> s_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
//#define INF (1e9)
#define PI (acos(-1))
//#define mod (1000000007)
typedef long long int64;
const int64 INF = 1LL << 58;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<typename T> void remove(T & vector, unsigned int index){vector.erase(vector.begin() + index);}


const int limit = 100010;
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d) {
  depth[v] = d;
  for (auto &e : tree[v]) {
    if (e.to == p) continue;
    dfs(e.to, v, d + e.cost);
  }
}

int main(void) {
  int n; cin >> n;
  for (int i = 0; i < n - 1; ++i) {
    int a, b, c;cin >> a >> b >> c;
    a--, b--;
    tree[a].push_back({b, c});
    tree[b].push_back({a, c});
  }
  int q, k; cin >> q >> k; k--;

  dfs(k, -1, 0);

  for (int i = 0; i < q; ++i) {
    int x, y; cin >> x >> y;
    x--, y--;
    cout << depth[x] + depth[y] << endl;
  }
  return 0;
}


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

int main()
{
    ll n;
    cin>>n;
    ll i;
    vector<pair<int,int>>v;
    for(i=0;i<n;i++)
    {
       ll n;
       cin>>n;
       v.push_back( make_pair(n,i+1));

    }
    sort(v.begin(),v.end());
    for(i=0;i<n;i++)
    {
       cout<<v[i].second<<" ";
    }
    return 0;
}


Measured memory_bytes: 1780
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

const double G = 9.8;
int n;
double vx[1010];
double vy[1010];
double ex, ey;

// Y  = -G / 2.0 * x^2 / vx^2 + vy * x / vx
// Y' = -G * x / vx^2 + vy / vx
// grad * vx^2 / -G + vy * vx / G = x

double X(double grad) {
  double sum = 0;
  REP(i, n) {
    double x = -grad * vx[i] * vx[i] / -G + vy[i] * vx[i] / G;
    if (x < 0) { continue; }
    sum += x;
  }
  return sum;
}

double Y(double grad) {
  double sum = 0;
  REP(i, n) {
    double x = -grad * vx[i] * vx[i] / -G + vy[i] * vx[i] / G;
    if (x < 0) { continue; }
    double y = -G / 2.0 * x * x / vx[i] / vx[i] + vy[i] * x / vx[i];
    sum += y;
  }
  return sum;
}

int main() {
  while (scanf("%d", &n), n) {
    REP(i, n) {
      scanf("%lf %lf", &vx[i], &vy[i]);
    }
    scanf("%lf %lf", &ex, &ey);
    double infY = 1e+100;
    double supY = -1e+100;
    REP(i, n) {
      double t = ex / vx[i];
      double y = -G / 2.0 * t * t + vy[i] * t;
      infY = min(infY, y);
    }
    {
      double left = -1e+6;
      double right = 1e+6;
      REP(iter, 200) {
        double mid = (left + right) / 2.0;
        if (X(mid) >= ex) {
          right = mid;
        } else {
          left = mid;
        }
      }
      supY = max(supY, Y(left));
    }
    //cout << infY << " "<< supY << " " << ey << endl;
    if (infY - ey <= EPS && -EPS <= supY - ey) {
      puts("Yes");
    } else {
      puts("No");
    }
  }
}

Measured memory_bytes: 896
#include <iostream>

using namespace std;

const int MAX_N = 10000;
const int MAX_Q = 500;

int main() {
    int n_1, n_2;
    int s[MAX_N + 1];
    int t;
    int ans = 0;

    cin >> n_1;
    
    for (int i = 0; i < n_1; i++) {
        cin >> s[i];
    }

    cin >> n_2;

    for (int i = 0; i < n_2; i++) {
        cin >> t;
        int j = 0;
        s[n_1] = t;

        while (s[j] != t) {
            j++;
        }

        if (j != n_1) {
            ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3036
#include <iostream>
using namespace std;
int main()
{
    int N,i;cin>>N;string S;cin>>S;
    int test=0;
    for(i=0;i<N;i++){
        if(S[i]=='A'&&S[i+1]=='B'&&S[i+2]=='C'){
            test+=1;
    }
    }
    cout<<test;

    return 0;
}


Measured memory_bytes: 256
int main(){
    int W, H, x, y, r;
    
    scanf("%d%d%d%d%d", &W, &H, &x, &y, &r);
    
    if(W >= (x + r) && H >= (y + r) && 0 <= (x - r) && 0 <= (y - r))
    printf("Yes\n");
    else
    printf("No\n");
    
    return 0;
}


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

int main() {
    string s,t;cin>>s>>t;
    int a,b;cin>>a>>b;
    string u;cin>>u;
    if(u==s)--a;
    else --b;
    cout<<a<<" "<<b<<endl;
	return 0;
}

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

using ll = long long;
#define ALL(c) (c).begin(), (c).end()
const int MOD = 1000000007;

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

    map<char, int> m;
    for (int i = 0; i < s.size(); i++) {
        m[s[i]]++;
    }

    if (abs(m['a'] - m['b']) <= 1 && abs(m['b'] - m['c']) <= 1 && abs(m['c'] - m['a']) <= 1) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 512
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int max = Integer.MAX_VALUE;
	    for(int i=0;i<n;i++) {
	    	int num = sc.nextInt();
	    	int count=0;
	    	while(num % 2 == 0) {
	    		num=num / 2;
	    		count++;
	    	}
	    	max = Math.min(max, count);
	    }
	   System.out.println(max);
	}

}

Measured memory_bytes: 22868
#include <iostream>
using namespace std;
int main(void){
    int a,b,c;
    string s;
    cin>>a>>s>>b;
    
    c = s.size();
    
    char d = s[b-1];
    for(int i = 0;i<c;i++){
        if(s[i]!=d)
        cout<<'*';
        else
        cout<<s[i];
    }
    cout<<endl;
}


Measured memory_bytes: 256
module Main where

import qualified Data.Vector as Vector
import Data.List as List
import Data.Vector.Unboxed as V
import qualified Data.ByteString.Char8 as BS
import Data.Maybe as Maybe

main :: IO ()
main =
    solve =<< getInts

getInt :: IO Int
getInt = read <$> BS.unpack <$> BS.getLine

splitLine :: IO [BS.ByteString]
splitLine = BS.words <$> BS.getLine

getInts :: IO (V.Vector Int)
getInts = V.fromList <$> List.map fst <$> Maybe.mapMaybe BS.readInt <$> splitLine

solve :: V.Vector Int -> IO ()
solve v = print (if (v V.! 1 == 1) then 0 else (max 0 $ (v V.! 0) - (v V.! 1)))



Measured memory_bytes: 380
#include <iostream>
#include <string>

using namespace std;

int main(){

    string W, T;
    int cnt=0;

    cin >> W;

    for(int i=0; W[i]; i++){
        if(W[i] >= 'A' && W[i] <= 'Z') W[i]+= 'a' - 'A';
    }

    while(1){
        cin >> T;        
        if(T == "END_OF_TEXT") break;

        for(int i=0; T[i]; i++){
            if(T[i] >= 'A' && T[i] <= 'Z') T[i]+= 'a' - 'A';
        }
        if(W == T) cnt++;
    }    

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 3136
#include <stdio.h>

int main(void)
{
	int a,i,N,hyou1[100001],Q,B,C;
	long long total=0,sa,answer[100000];
	for(i=0;i<100001;i++)hyou1[i]=0;
	scanf("%d",&N);
	for(i=0;i<N;i++){
		scanf("%d",&a);
		hyou1[a]++;
		total+=a;
	}
	scanf("%d",&Q);
	for(i=0;i<Q;i++){
		scanf("%d",&B);
		scanf("%d",&C);
		sa=C-B;
		total+=hyou1[B]*sa;
		hyou1[C]+=hyou1[B];
		hyou1[B]=0;
		answer[i]=total;
	}
	for(i=0;i<Q;i++)printf("%lld\n",answer[i]);
	return 0;
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

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

  int N;
  std::cin >> N;

  std::string S;
  std::cin >> S;

  bool ok = N % 2 == 0;

  if(ok){
      for(int i=0;i<N/2;++i){
          if(S[i] != S[i+N/2]){
              ok = false;
              break;
          }
      }
  }

  if(ok){
      std::cout << "Yes" << std::endl;
  }else{
      std::cout << "No" << std::endl;
  }
}


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

struct Benri {
    Benri() {
        std::cin.tie(0); ios::sync_with_stdio(false);
        cout << fixed << setprecision(12);
    }
} benri;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
const long long MOD = 1000000007;
const long long MOD2 = 998244353;
const int INF = 1 << 28;


void add(ll &a, ll b) {
    a = (a + b) % MOD;
}


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

    ll dp[51][52][2600] = {};
    dp[0][0][0] = 1;
    rep(i, N) {
        rep(a, N + 1) {
            rep(k, K + 1) {
                if (dp[i][a][k] == 0) continue;
                int k2 = k + 2 * a;
                add(dp[i + 1][a][k2], dp[i][a][k] * (2 * a + 1));
                if (a > 0) add(dp[i + 1][a - 1][k2], dp[i][a][k] * a * a);
                add(dp[i + 1][a + 1][k2], dp[i][a][k]);
            }
        }
        
    }

    cout << dp[N][0][K] << endl;
    
}

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

using namespace std;

void solve() {
    int N;
    cin >> N;
    string S;
    map<char, long long> march;
    for (int i = 0; i < N; i++)
    {
        cin >> S;
        march[S[0]]++;
    }
    long long m, a, r, c, h;
    m = march['M'];
    a = march['A'];
    r = march['R'];
    c = march['C'];
    h = march['H'];
    long long ans;
    ans = m * a * (r + c + h) + (m * r + a * r) * (c + h) + (m + a + r) * c * h;
    cout << ans << endl;
}

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

Measured memory_bytes: 3632
def solve(string):
    n, x, *m = map(int, string.split())
    return str(n + (x - sum(m)) // min(m))


if __name__ == '__main__':
    n, m = map(int, input().split())
    print(solve('{} {}\n'.format(n, m) + '\n'.join([input() for _ in range(n)])))


Measured memory_bytes: 38256
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>
#include <cstring>

using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
#define RREP(i,n) for(int i = n - 1; i >= 0; i--)

#define ALL(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

#define UNIQUE(v) do{sort(v.begin(), v.end()); v.erase( unique(v.begin(), v.end()), v.end() );} while(0)


#define y0 y3487465
#define y1 y8687969

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
ll MOD = 1000000007;

ll N;
const ll MAX_N  = 200000;
ll A[MAX_N], S[MAX_N];

ll calc(ll l, ll m, ll r) {
  ll P = S[l], Q = S[m] - S[l], R = S[r] - S[m], SS = S[N - 1] - S[r];
  ll MA = max(max(P, Q), max(R, SS));
  ll mi = min(min(P, Q), min(R, SS));
  return MA - mi;
}


int main(){
  cin >> N;
  REP(i, N) cin >> A[i];

  ll s = 0;
  REP(i, N) {
    s += A[i];
    S[i] = s;
  }

  ll l = 0, r = 2;
  ll ans = INFi;
  for(int m = 1; m < N - 1; m++) {
    while(l < m - 1 && abs(S[m] - 2 * S[l]) > abs(S[m] - 2 * S[l + 1])) {
      l++;
    }
    while(r < N - 1 && abs(S[N - 1] + S[m] - 2 * S[r]) > abs(S[N - 1] + S[m] - 2 * S[r + 1])) {
      r++;
    }
    ans = min(ans, calc(l, m, r));
  }

  cout << ans << endl;

  return 0;
}


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

using namespace std;

#define MP make_pair
#define PB push_back
#define f first
#define s second

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<int> vi;

//int dr1[] = {-1, 0, 1, 0};
//int dc1[] = {0, 1, 0, -1};
//int dr3[] = {0, 1, 2, 3, 2, 1, 0, -1, -2, -3, -2, -1, -1, 1, 0, 0};
//int dc3[] = {3, 2, 1, 0, -1, -2, -3, -2, -1, 0, 1, 2, 0, 0, -1, 1};
const int MOD = 1000000007;
const int INF = 1000000007;

ll modx(ll a)
{
    return (a%MOD+MOD)%MOD;
}

ll times(ll a, ll b)
{
    return modx(modx(a)*modx(b));
}

ll add(ll a, ll b)
{
    return modx(modx(a)+modx(b));
}

ll sub(ll a, ll b)
{
    return modx(MOD+modx(a)-modx(b));
}

ll fastExp(ll base, ll exp)
{
    if(exp == 0LL)
    {
        return 1LL;
    }

    if(exp%2==0)
    {
        return fastExp(times(base, base), exp/2);
    }
    else
    {
        return times(base, fastExp(times(base, base), exp/2));
    }
}


const int MAXN = (int)1e5+1;
int N, M, ct[MAXN];


int main()
{
    //freopen("input.in","r",stdin);
    //freopen("output.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> N >> M;
    ll penalty = 0, correct = 0;
    for(int i=0; i<M; i++)
    {
        int prob;
        string ans;
        cin >> prob >> ans;
        if(ans == "WA" && ct[prob] != -1)
        {
            ct[prob]++;
        }
        if(ans == "AC" && ct[prob] != -1)
        {
            penalty += ct[prob];
            ct[prob]=-1;
        }
    }

    for(int i=1; i<=N; i++)
    {
        if(ct[i] == -1) correct++;
    }

    cout << correct << " " << penalty;
    return 0;
}


Measured memory_bytes: 640
import sys
Input = []
while True:
    try:
        a,b = list(map(int, input().split()))
        Input += a,b
    except EOFError:
        break
    if a!=0:
        for j in range(a):
            for i in range(b):
                if j==0 or i==0 or j==a-1 or i==b-1:
                    print("#", end="")
                else:
                    print('.',end='')
            print()
        print()


Measured memory_bytes: 7008
'use strict'
function Main(input) {
  let x = input.split("\n");
  let text = x[1];
  // ネット上にあったコードを拝借
  let alphabet = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
  let ans = [];
  for(let i = 0; i < text.length; i++){
     let n = alphabet.indexOf(text[i]) + x[0]*1;
    if(n >= 26){
    	n -= 26;
    };
    ans.push(alphabet[n]);
  }
  console.log(ans.join(''));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7580
#include<stdio.h>

int n,team[100];

int main(){
	scanf("%d",&n);
	for(int i=0;i<n*(n-1)/2;i++){
		int a,b,c,d;
		scanf("%d%d%d%d",&a,&b,&c,&d);
		if(c==d){
			team[a]++;
			team[b]++;
		}
		if(c>d){
			team[a]+=3;
		}
		if(c<d){
			team[b]+=3;
		}	
	}
	for(int i=1;i<=n;i++){
		int res=0;
		for(int j=1;j<=n;j++){
			if(team[j]>team[i])res++;
		}
		printf("%d\n",res+1);
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main(){
	ll n,x,y;
	cin>>n;
	ll a=INT_MIN,b=INT_MAX,c=INT_MIN,d=INT_MAX;
	for(int i=0;i<n;i++){
		cin>>x>>y;
		a=max(a,x+y);
		b=min(b,x+y);
		c=max(c,x-y);
		d=min(d,x-y);
	}
	cout<<max ( (a-b), (c - d) )<<endl;
}

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

signed main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int A;
    int B, K;
    cin >> A >> B >> K;
    cout << max(A - K, 0LL) << " " << max(B - max(K - A, 0LL), 0LL) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define vpush(a,x) a.push_back(x);
#define _GLIBCXX_DEBUG
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    int p;
    string s;
    int count=0;
    vector<bool> flag(n,false);
  	vint count2(n);
    rep(i,m){
        cin>>p>>s;
        if(s=="AC"){
            if(!flag[p-1]){
                count++;
                flag[p-1]=true;
            }
        }
        else{
            if(!flag[p-1]){
                count2[p-1]++;
            }
        }
    }
  	int count3=0;
  	rep(i,n){
      if(flag[i]){
		count3+=count2[i];
      }
    }
    cout<<count<<' '<<count3<<'\n';
    return(0);
}

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

int main(){
    long long x;
    cin >> x;
    if(x%11 == 0){
        cout << x/11*2;
    }else if(x%11 <= 6){
        cout << x/11*2 + 1;
    }else{
        cout << x/11*2 + 2;
    }
    return 0;
}

Measured memory_bytes: 256
#gcdは3.4.3だとfractionsにある
from fractions import gcd

from math import factorial as f

from math import ceil,floor,sqrt

from sys import exit

from copy import deepcopy
import numpy as np

import bisect
import re


ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))



def main():
    a,b = mi()
    print(max(a-2*b,0))

main()


Measured memory_bytes: 23188
#pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = 1'000'000'007LL; /*998'244'353LL;*/
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
const int dx[4]={ 1,0,-1,0 };
const int dy[4]={ 0,1,0,-1 };

string S;

signed main(){
    cin >> S;
    rep(i, 8) S.pop_back();
    cout << S << endl;
}

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

#define pb push_back
#define mp make_pair
#define f1 first
#define s2 second

#define fastio ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(x...) cerr << "[" << #x << "]: " << x << "\n";

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ll, ll> pl;

ld const PI = 4*atan((ld)1);

int const N = 3e5 + 7;

int row[N];
int col[N];
map<ii, bool> fq;
int main()
{
	fastio;

	int h, w, m;
	cin >> h >> w >> m;

	int r, c;
	for (int i = 0; i < m; ++i)
	{
		cin >> r >> c;
		row[r]++;
		col[c]++;

		fq[{r, c}] = true;
	}

	int rmax = 0, cmax = 0;
	vector<int> vr, vc;

	for (int i = 1; i <= h; ++i)
	{
		if (rmax == row[i]) vr.pb(i);
		else if (rmax < row[i])
		{
			vr.clear();
			vr.pb(i);
			rmax = row[i];
		}
	}

	for (int i = 1; i <= w; ++i)
	{
		if (cmax == col[i]) vc.pb(i);
		else if (cmax < col[i])
		{
			vc.clear();
			vc.pb(i);
			cmax = col[i];
		}
	}

	for (auto x : vr)
	{
		for (auto y : vc)
		{
			if (!fq.count({x, y}))
			{
				cout << rmax + cmax << '\n';
				return 0;
			}
		}
	}
	cout << rmax + cmax - 1 << '\n';
	return 0;
}


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

int main(){
    int n;
    int d[110];
    cin >> n;
    for(int i = 0; i < n; i++) cin >> d[i];

    int num[110] = {0};
    for(int i = 0; i < n; i++){
        num[d[i]]++;
    }
    
    int res = 0;
    for(int d = 1; d <= 100; d++){
        if(num[d]){ //num[d] がtrueであるということは０ではないといこと！
            res++;
        }
    }

    cout << res << endl;

} 

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include <string>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include<bits/stdc++.h>
#include <set>
#define ll   long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#define inf 0x3f3f3f3f
#define pi 3.1415926535898
#define mod 998244353
#define N 1000010
using namespace std;
char s[N];
int tot;
struct A
{
    int l,r;

} a[N];
int cmp(A a,A b)
{
    return a.l-a.r>b.l-b.r;
}
int main()
{
    int n,i,j,l,r,ln,rn;
    ln=rn=0;
    cin>>n;
    for(int i=1; i<=n; i++)
    {
        l=r=0;
        cin>>s+1;
        for(int j=1; s[j]; j++)
        {
            if(s[j]=='(')
                l++;
            else if(s[j]==')')
            {
                if(l)
                    l--;//匹配
                else
                    r++;
            }
        }
        if(l&&!r)
            ln+=l;//剩下((((((
        else if(!l&&r)
            rn+=r;//剩下))))))
        else if(l&&r)
            a[++tot]=(A)
        {
            l,r
        };//剩下))))))((((((
    }
    sort(a+1,a+1+tot,cmp);
    for(i=1; i<=tot; i++)
        if(ln<a[i].r)
            return printf("No\n"),0;
        else
            ln-=a[i].r,ln+=a[i].l;//匹配
    if(ln!=rn)
        return printf("No\n"),0;
    printf("Yes\n");
    return 0;
}


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

template<typename T>
T pow(T a, long long n, T e = 1) {
    T ret = e;
    while (n) {
        if (n & 1) ret *= a;
        a *= a;
        n >>= 1;
    }
    return ret;
}

template<int mod>
struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(long long x_) { if ((x = x_ % mod + mod) >= mod) x -= mod; }
    ModInt& operator+=(ModInt rhs) { if ((x += rhs.x) >= mod) x -= mod; return *this; }
    ModInt& operator-=(ModInt rhs) { if ((x -= rhs.x) < 0) x += mod; return *this; }
    ModInt& operator*=(ModInt rhs) { x = (unsigned long long) x * rhs.x % mod; return *this; }
    ModInt& operator/=(ModInt rhs) { x = (unsigned long long) x * rhs.inv().x % mod; return *this; }

    ModInt operator-() const { return -x < 0 ? mod - x : -x; }
    ModInt operator+(ModInt rhs) const { return ModInt(*this) += rhs; }
    ModInt operator-(ModInt rhs) const { return ModInt(*this) -= rhs; }
    ModInt operator*(ModInt rhs) const { return ModInt(*this) *= rhs; }
    ModInt operator/(ModInt rhs) const { return ModInt(*this) /= rhs; }
    bool operator==(ModInt rhs) const { return x == rhs.x; }
    bool operator!=(ModInt rhs) const { return x != rhs.x; }
    ModInt inv() const { return pow(*this, mod - 2); }

    friend ostream& operator<<(ostream& s, ModInt<mod> a) { s << a.x; return s; }
    friend istream& operator>>(istream& s, ModInt<mod>& a) { s >> a.x; return s; }
};

using mint = ModInt<1000000007>;

mint fact[202020];
mint factinv[202020];

void init() {
    fact[0] = 1;
    for (int i = 1; i < 202020; i++) {
        fact[i] = fact[i - 1] * i;
    }
    factinv[202020 - 1] = fact[202020 - 1].inv();
    for (int i = 202020 - 2; i >= 0; i--) {
        factinv[i] = factinv[i + 1] * (i + 1);
    }
    assert(factinv[0] == 1);
}

mint ncr(int n, int r) {
    return fact[n] * factinv[r] * factinv[n - r];
}

mint partition(int n, int r) {
    if (r > n) return 0;
    return ncr(n - 1, r - 1);
}

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

    init();
    int n, k;
    cin >> n >> k;
    int m = n - k;
    if (m == 0) {
        for (int i = 1; i <= k; i++) {
            cout << (i == 1 ? 1 : 0) << '\n';
        }
        return 0;
    }
    for (int i = 1; i <= k; i++) {
        mint blue = partition(k, i);
        mint red = 0;
        if (i > 1) red += partition(m, i - 1);
        red += partition(m, i) * 2;
        red += partition(m, i + 1);
        cout << blue * red << '\n';
    }
}

Measured memory_bytes: 1792
using System;

namespace AtCoder{
    public static class AtCoder{
        public static void Main(){
            int k = int.Parse(Console.ReadLine());
            var input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);

            for(int i = a; i <= b; i++){
                if(i % k == 0){
                    Console.WriteLine("OK");
                    return;
                }
            }
            Console.WriteLine("NG");
        }
    }
}

Measured memory_bytes: 27536
#include <stdio.h>

int main(void)
{
	int c,i,j,s,k,out[26];
	for(i=0;i<26;i++) out[i]=0;
	while((c=getchar())!=EOF){
		
		for(j='a',k='A',s=0;j<='z';j++,k++,s++){
			if(j==c || k==c) out[s]+=1;
		}
	}
	for(i='a',j=0;j<26;i++,j++)	printf("%c : %d\n",i,out[j]);


return 0;
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  i64 n; cin >> n;
  i64 ans = 1;
  reps(i, n) ans *= i;
  cout << ans << '\n';
}



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

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

    string si;
    ll maxcnt=0;
    map<string, ll> s;
    rep(i, n){
        cin >> si;
        s[si]+=1;
        if(maxcnt<s[si]) maxcnt=s[si];
    }
    // print
    for (auto p : s) {
        auto value = p.first;
        auto cnt = p.second;
        if(maxcnt==cnt) cout << value << endl;
    }
    return 0;

}

Measured memory_bytes: 25216
import sys
def input(): return sys.stdin.readline().strip()


def main():
    N, K = map(int, input().split())
    h = [int(input()) for _ in range(N)]
    h.sort()
    cand = 10**10
    for i in range(N - K + 1):
        cand = min(cand, h[i + K - 1] - h[i])
    print(cand)





if __name__ == "__main__":
    main()


Measured memory_bytes: 44380
#! /usr/bin/env python
# -*- coding : utf-8 -*-

import re
import sys

def main() :
	s=sys.stdin.read()
	
	for pattern in [r"([a-z])\1", r"([a-z])[a-z]\1"] :
		mo=re.search(pattern, s)
		if mo :
			print "%d %d"%(mo.start()+1, mo.end())
			return
	
	print "-1 -1"

if __name__=="__main__" :
	main()


Measured memory_bytes: 2692
# coding:utf-8

import sys
import heapq
from collections import defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def dijkstra(start: int, size: int, G: dict) -> list:
    costs = [INF] * size
    costs[start] = 0
    hp = []
    heapq.heappush(hp, (0, start))
    while hp:
        hc, hv = heapq.heappop(hp)
        for to, move_cost in G[hv]:
            if hc + move_cost >= costs[to]:
                continue
            costs[to] = hc + move_cost
            heapq.heappush(hp, (costs[to], to))

    return costs


n = II()

G = defaultdict(list)
for _ in range(n - 1):
    a, b, c = LI()
    a -= 1
    b -= 1
    G[a].append((b, c))
    G[b].append((a, c))

q, k = LI()
k -= 1
C = dijkstra(k, n, G)

for _ in range(q):
    x, y = LI_()
    print(C[x] + C[y])


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


int main(){
    int r,d, x0;
    cin >> r >> d >> x0;
    int x[12];
    x[0] = x0;
    
    for(int i = 1; i < 11; i++){
        x[i] = r * x[i - 1] - d;
    }
    
    for(int i = 1; i < 11; i++){
        cout << x[i] << endl;
    }
    
  //  cout << endl;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;
#define int long long

int32_t main()
{
    int n,a,b; cin>>n>>a>>b;
    if((n*a)<=b)cout<<n*a;
    else cout<<b;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define all(a) (a).begin(),(a).end()
#define vecin(a) rep(i,a.size())cin >> a[i]
#define vecout(a) rep(i,a.size()){cout << a[i];cout << (i == a.size() - 1 ? "\n":" ");}
#define rep(i,x) for(ll i = 0;i<x;i++)
#define REP(i,x) for(ll i = 1;i<=x;i++)
#define mp make_pair
#define debug(x) cerr << #x << ": " << x << "\n"
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const dou pi = 3.14159265358;
const ll mod = 1000000007LL;
//const ll mod = 998244353LL;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T, class U> inline bool chmin(T& a, const U& b){ if(a > b){ a = b; return 1; } return 0; }
template<class T, class U> inline bool chmax(T& a, const U& b){ if(a < b){ a = b; return 1; } return 0; }
template<class T, class U> inline bool change(T& a,U& b){if(a > b){swap(a,b);return 1;}return 0;}
//0の場合のアレンジに注意
template<class T>
T gcd(T a,T b){
    if(a == 0)return b;
    else if(b == 0)return a;
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
template<class T>
T lcm(T a,T b){
    return a / gcd(a,b) * b;
}

//素数判定O(sqrt(N))
template<class T>
inline bool isp(T n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
const ll cmax = 1000000;
vector<ll> fac(cmax),finv(cmax),inv(cmax);

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < cmax; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll nCk(ll n, ll k){
    if(fac[0] == 0)COMinit();
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logm)
ll modpow(ll n,ll m,ll MOD){
    if(m == 0)return 1;
    if(m < 0)return -1;
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}
ll mypow(ll n,ll m){
    if(m == 0)return 1;
    if(m < 0)return -1;
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n);
        m >>= 1;
        n *= n;
    }
    return res;
}

template<class T = ll>
T in(){T x;cin >> x;return x;}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll N = in();
    vector<ll> vec(N);
    vecin(vec);
    ll ans = 1;
    rep(i,N){
        ans = lcm(ans,vec[i]);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 26588
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) begin(x), end(x)
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
  #define debug(x) cout << #x " => " << (x) << endl
#else
  #define debug(x) 0
#endif
using lint = long long;
constexpr int MOD = (int)1e9 + 7;
constexpr double EPS = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

namespace std {
template <> struct hash<pair<int, int>> {
  size_t operator()(const pair<int, int> &p) const {
    constexpr static unsigned s = CHAR_BIT * sizeof(size_t) / 2;
    return (size_t)p.first << s | p.second;
  }
};
}

using Weight = int;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(void) {}
  Edge(int src, int dst) : src(src), dst(dst) {}
  Edge(int src, int dst, Weight weight) : src(src), dst(dst), weight(weight) {}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void edges_to_graph(Graph &graph, const Edges &edges, const int vertices, const bool directed = true) {
  graph.clear(), graph.resize(vertices);
  for (const auto &e : edges) graph[e.src].emplace_back(e);
  if (!directed) for (const auto &e : edges) graph[e.dst].emplace_back(Edge(e.dst, e.src, e.weight));
}

void dfs(Graph &g, int v, int p, int prev_col, unordered_map<pair<int, int>, int> &cmap) {
  int col = 0;
  for (const auto &e : g[v]) {
    if (e.dst == p) continue;
    ++col;
    if (col == prev_col) ++col;
    cmap[{ v, e.dst }] = col;
    dfs(g, e.dst, v, col, cmap);
  }
}

void bfs(Graph &g, unordered_map<pair<int, int>, int> &cmap) {
  queue<tuple<int, int, int>> que;
  que.push(make_tuple(0, -1, 0));
  while (!que.empty()) {
    int v = get<0>(que.front()), p = get<1>(que.front()), pc = get<2>(que.front());
    que.pop();
    int col = 1;
    for (const auto &e : g[v]) {
      if (e.dst == p) continue;
      if (col == pc) ++col;
      cmap[{ v, e.dst }] = col;
      que.push(make_tuple(e.dst, v, col));
      ++col;
    }
  }
}

Graph graph;
int main(void) {
  int n;
  cin >> n;
  Edges edges(n - 1);
  rep (i, n - 1) {
    int a, b;
    cin >> a >> b;
    edges[i] = {--a, --b, 0};
  }
  edges_to_graph(graph, edges, n, false);
  int maxi = 0;
  rep (i, n) maxi = max(maxi, (int)graph[i].size());
  unordered_map<pair<int, int>, int> cmap;
  dfs(graph, 0, -1, 0, cmap);
  // bfs(graph, cmap);
  cout << maxi << "\n";
  rep (i, n - 1) cout << cmap[{ edges[i].src, edges[i].dst }] << "\n";
  return 0;
}

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

fn main() {
    input! {
        n: u64, mm: u64
    }
    let mut m = mm;
    let ret = if m < n * 2 {
        std::cmp::min(n, m/2)
    } else {
        m -= n * 2;
        m / 4 + n
    };
    println!("{}" ,ret);
}

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


int main()
{
    int a, b;
    cin >> a >> b;
    if (a > b)
        swap(a, b);
    if (a == 1 && b == 2)
        cout << 3;
    else if (a == 1 && b == 3)
        cout << 2;
    else 
        cout << 1;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] l = new int[4];
        while (sc.hasNext()) {
            String[] b = sc.nextLine().split(",");
            switch (b[1]) {
            case "A":
                l[0]++;
                break;
            case "B":
                l[1]++;
                break;
            case "AB":
                l[2]++;
                break;
            case "O":
                l[3]++;
                break;
            }
        }
        for (int i : l) {
            System.out.println(i);
        }
    }
}


Measured memory_bytes: 26140
from statistics import median
N = int(input())
X = list(map(int, input().split()))

Y = X + [0]
Z = X + [10**9 + 1]

ymed = median(Y)
zmed = median(Z)

if ymed == zmed:
    for _ in range(N):
        print(ymed)
else:
    for i in X:
        if i <= ymed:
            print(zmed)
        else:
            print(ymed)


Measured memory_bytes: 27200
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
using vd= vector<double>;
using vvd= vector<vd>;
using vc= vector<char>;
using vs= vector<string>;
using vb= vector<bool>;
using vl= vector<ll>;
#define rep(i,x,n) for(int i=x; i<n; i++)
#define all(x) x.begin(), x.end()

int main(){
  vi a(3);
  rep(i,0,3){
    cin >> a[i];
  }
  sort(all(a));
  cout << a[2]*10+a[1]+a[0];
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MAX_N 100005
int N;
int p[MAX_N];
int visited[MAX_N];
int main(){
  
  cin>>N;
  for(int i=1;i<=N;i++){
    cin>>p[i];
    visited[i]=-1;
  }
  queue<int> Q;
  Q.push(1);
  visited[1]=0;
  
  while(!Q.empty()){
    int pos=Q.front();Q.pop();
    for(int i=1;i<=6;i++){
      int to=pos+i;
      if(to>N)continue;
      while(visited[to]==-1&&p[to]!=0){
	visited[to]=visited[pos]+1;
	to+=p[to];
      }
      if(visited[to]!=-1)continue;
      visited[to]=visited[pos]+1;
      Q.push(to);
    }
  }
  
  cout<<visited[N]<<endl;

  return 0;
}

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

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

#define MAX_N 100100

ll GCD(ll a, ll b) {
    if (a <= 0 || b <= 0) {
        return -1;
    }
    if (a > b) {
        if (a % b == 0) {
            return b;
        } else {
            GCD(b, a % b);
        }
    } else if (a < b) {
        if (b % a == 0) {
            return a;
        } else {
            GCD(a, b % a);
        }
    } else {
        return a;
    }
}

bool IsPrime(int n) {
    for (ll i = 2; i*i <= n; i++) {
        if (n%i == 0) {
            return false;
        }
    }
    return n != 1;
}

ll prime[MAX_N];
bool is_prime[MAX_N+1];
ll sieve(ll n) {
    ll p = 0;
    rep (i, n+1) {
        is_prime[i] = true;
    }
    is_prime[0] = is_prime[1] = false;
    for (ll i = 2; i <= n; i++) {
        if (is_prime[i]) {
            prime[p++] = i;
            for (ll j = 2*i; j <= n; j += i) {
                is_prime[j] = false;
            }
        }
    }
    return p;
}

vector<ll> Divisor(int n) {
    vector<ll> res;
    for (ll i = 1; i*i <= n; i++) {
        if (n%i == 0) {
            res.push_back(i);
            if (i != n/i) {
                res.push_back(n/i);
            }
        }
    }
    sort(res.begin(), res.end());
    return res;
}

vector<Pll> PrimeFactor(ll n) {
    vector<Pll> res;
    for (ll i = 2; i*i <= n; i++) {
        if (n%i) {
            continue;
        }
        res.emplace_back(i, 0);
        while (n%i == 0) {
            n /= i;
            res.back().second++;
        }
    }
    if (n != 1) {
        res.emplace_back(n, 1);
    }
    return res;
}

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N, M;
    cin >> N >> M;

    if (IsPrime(M)) {
        cout << 1 << endl;
        return 0;
    }

    vector<ll> div = Divisor(M);

    ll ans = 1;
    rep (i, div.size()) {
        if (M/div[i] >= N) {
            ans = div[i];
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  long long sum;
  cin >> N;
  sum = 0;
  for(int i = 0; i <= N; i++){
    if(i%3 != 0 && i%5 != 0){
      sum += i;
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 3592
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int INF = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

int main() {
    int n, ans = 0;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int l, r;
        cin >> l >> r;
        ans += r-l+1;
    }
    cout << ans << "\n";
    return 0;
}


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

use proconio::input;

fn main() {
    input! {
        n: usize,
        l: [u64; n],
        // mut l: [u64; n],
    }

    // l.sort();
    // l.dedup();
    let mut ans = 0;
    for a in 0..l.len() {
        for b in a..l.len(){
            for c in b..l.len() {
                if l[a] == l[b] || l[b] == l[c] || l[c] == l[a] {
                    continue;
                }

                if l[a] + l[b] > l[c] && l[b] + l[c] > l[a] && l[c] + l[a] > l[b] {
                    // println!("{} {} {}", l[a], l[b], l[c]);
                    // println!("{} {} {}", a, b, c);
                    ans += 1;
                }
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2156
a,l = list(map(int, input().split()))
x = (4*a - l)/2
y = (l - 2*a)/2
if a==l==0:print('Yes')
else:
    if a>=l or l%2!=0:
        print('No')
    elif x+y == a and 2*x + 4*y == l:
        print('Yes' if y>=0 and x >= 0 else 'No')

Measured memory_bytes: 9184
import java.util.Scanner;

public class Main {
	private static Scanner sc;
	
	public static void main(String[] args) {
		sc =  new Scanner(System.in);
		//case : 入力された数値を取得するとき
		int n = Integer.parseInt(sc.next());
		//case : 入力された文字列を取得するとき
//		String str = sc.next();
		if(400<=n && n<=599) {
			System.out.println(8);
		} else if (600<=n && n<=799) {
			System.out.println(7);			
		} else if (800<=n && n<=999) {
			System.out.println(6);			
		} else if (1000<=n && n<=1199) {
			System.out.println(5);			
		} else if (1200<=n && n<=1399) {
			System.out.println(4);			
		} else if (1400<=n && n<=1599) {
			System.out.println(3);			
		} else if (1600<=n && n<=1799) {
			System.out.println(2);			
		} else if (1800<=n && n<=1999) {
			System.out.println(1);			
		}
	}
	

}


Measured memory_bytes: 35664
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
#define REP(i,n) for(long long i(0);(i)<(n);(i)++)


void solve(long long N){
    cout << (N-2)*180 << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner in=new Scanner(System.in);
		int n,m;
		int edge[][]=new int[15][15];
		int a[][]=new int[205][205];
		n=in.nextInt();
		m=in.nextInt();
		for(int i=0;i<=9;i++)
			for(int j=0;j<=9;j++)
				edge[i][j]=in.nextInt();
		for(int k=0;k<=9;k++)
			for(int i=0;i<=9;i++)
                for(int j=0;j<=9;j++)
                	edge[i][j]=Math.min(edge[i][j],edge[i][k]+edge[k][j]);
		long ans=0;
		for(int i=1;i<=n;i++)
			for(int j=1;j<=m;j++)
			{
				a[i][j]=in.nextInt();
				if(a[i][j]!=-1)ans+=edge[a[i][j]][1];
			}
		System.out.println(ans);
	}
}

Measured memory_bytes: 45768
program main
  implicit none
  integer :: a, b, i
  read(*, *) a, b
  i = b - a
  write(*, "(i0)") height_ith(i) - b

  contains

  function height_ith(i)
    implicit none
    integer, intent(in) :: i
    integer :: height_ith
    height_ith = i * (i + 1) / 2
  end function height_ith
end program main


Measured memory_bytes: 256