akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main()
{

	char ch;

	scanf("%c", &ch);

	switch(ch) {
		case 'A':
			puts("T");
			break;
		case 'T':
			puts("A");
			break;
		case 'C':
			puts("G");
			break;
		case 'G':
			puts("C");
			break;
	}

	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using lint = long long;
using namespace std;

const int MOD = 1000000007;
const lint INF = 1LL << 60;

const double PI = acos(-1);
const double Rad2Deg = 180.0 / PI;
const double Deg2Rad = PI / 180.0;

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

    int ans = -1;
    int min = N * (1.00 / 1.08);

    for (int i = min-2; i < min+5; i++) {
        int x = floor(i * 1.08);
        if (x == N) {
            ans = i;
        }
    }

    if (ans < 0) cout << ":(" << endl;
    else cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<list>
#include<iomanip>
#include<cstdio>
using namespace std;
#define ll long long






int main()
{
	string s;
	cin>>s;
	ll i;
	ll ans=0;
	for(i=s.length()-1;i>=0;i--)
	{
		ans=(ans+(s[i]-'0'))%9;
	}
	if(ans==0)
	{
		cout<<"Yes"<<"\n";
	}
	else
	{
		cout<<"No"<<"\n";
	}
}

Measured memory_bytes: 3684
import numpy as np


def solve(x):
    primes_flag = np.ones(10 ** 6).astype(np.int)
    primes_flag[:2] = 0
    for p in range(10 ** 3):
        if primes_flag[p] == 1:
            primes_flag[p ** 2:10 ** 6:p] = 0
    for i in range(x, 10 ** 6):
        if primes_flag[i] == 1:
            return i
    return 0


def main():
    x = int(input())
    res = solve(x)
    print(res)


def test():
    assert solve(20) == 23
    assert solve(2) == 2
    assert solve(99992) == 100003


if __name__ == "__main__":
    test()
    main()


Measured memory_bytes: 37276
#include<iostream>
#include<vector>

using namespace std;

struct node{
    int left;
    int right;
    int parent;
};

void NLR(vector<node> tree,int id)
{
    if (id != -1)
    {
        cout << " " << id;
        NLR(tree, tree[id].left);
        NLR(tree, tree[id].right);
    }
}

void LNR(vector<node> tree,int id)
{
    if (id != -1)
    {
        LNR(tree, tree[id].left);
        cout << " " << id;
        LNR(tree, tree[id].right);
    }
}

void LRN(vector<node> tree,int id)
{
    if (id != -1)
    {
        LRN(tree, tree[id].left);
        LRN(tree, tree[id].right);
        cout << " " << id;
    }
}


int main()
{
    vector<node> tree;
    int n, id, l, r;
    cin >> n;
    tree.resize(n);
    for (int i = 0; i < n; i++)
    {
        cin >> id >> l >> r;
        tree[id].left = l;
        tree[id].right = r;
        tree[id].parent = -1;
    }

    for (int i = 0; i < n; i++)
    {
        if (tree[i].left != -1)
            tree[tree[i].left].parent = i;
        if (tree[i].right != -1)
            tree[tree[i].right].parent = i;
    }

    for (int i = 0; i < n; i++)
        if (tree[i].parent == -1)
        {
            id = i;
            break;
        }
    cout << "Preorder" << endl;
    NLR(tree, id);
    cout << endl;
    cout << "Inorder" << endl;
    LNR(tree, id);
    cout << endl;
    cout << "Postorder" << endl;
    LRN(tree, id);
    cout << endl;
    return 0;

}

Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
 int n,k,sum=0;
 cin>>n>>k;
 int a[n];
 for(int i=0;i<n;i++)
 {
     cin>>a[i];
 }
 sort(a,a+n);
 for(int i=0;i<k;i++)
 {
 sum+=a[i];
 }
 cout<<sum<<endl;
}

Measured memory_bytes: 3620
using System;
using System.Collections.Generic;
using System.Linq;

class Program {
    static int ReadInt() { return int.Parse(Console.ReadLine()); }
    static int[] ReadInts() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
    static string[] ReadStrings() { return Console.ReadLine().Split(); }

    static void Calc(int rows, int cols, int[] xs) {
        var tab = new int[rows, cols];
        int r = 0;
        int c = 0;
        int d = 1;

        for (int i = 0; i < xs.Length; i++) {
            for (int j = 0; j < xs[i]; j++) {
                tab[r, c] = i + 1;

                c += d;
                if (c < 0 || c >= cols) {
                    r++;
                    c -= d;
                    d *= -1;
                }
            }
        }

        for (int i = 0; i < rows; i++) {
            for (int j = 0; j < cols; j++) {
                Console.Write("{0} ", tab[i, j]);
            }
            Console.WriteLine();
        }
    }

    static void Main() {
        var hw = ReadInts();
        int rows = hw[0], cols = hw[1];
        ReadInt();
        var xs = ReadInts();
        Calc(rows, cols, xs);
    }
}

Measured memory_bytes: 13396
#include <stdio.h>
int main(void){
    char box[3] = {0};
    int counter = 0;
    scanf("%s", &box);
    for(int i = 0; i < 3; i++){
        if(box[i] == '1'){
            counter++;
        }
    }
    printf("%d\n", counter);
    return 0;
}

Measured memory_bytes: 128
package main

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

// input scanner
var sc = bufio.NewScanner(os.Stdin)

const (
	initialBufSize = 10e4
	maxBufSize     = 10e6
)

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

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextInt64() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

// util
func max(l []int) (int, int) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n > ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

func min(l []int) (int, int) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n < ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

// main
func main() {
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	s := next()
	t := next()
	a := nextInt()
	b := nextInt()
	u := next()
	if u == s {
		fmt.Println(a-1, b)
	}
	if u == t {
		fmt.Println(a, b-1)
	}
}


Measured memory_bytes: 640
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>

using namespace std;

int main(){

    int n,m,x;
    cin >> n >> m >> x;

    int c[n];
    int A[n][m];

    for(int i=0;i<n;i++){
        cin >> c[i];
        for(int j=0;j<m;j++){
            cin >> A[i][j];
        }
    }

    int mn=3000000;

    for(int b=0;b<(1<<n);b++){
        int pay=0;
        int B[m]={};
        for(int i=0;i<n;i++){
            if(b&(1<<i)){
                pay+=c[i];
                for(int j=0;j<m;j++){
                    B[j]+=A[i][j];
                }
            }
        }
        bool isok=true;
        for(int i=0;i<m;i++){
            if(B[i]<x){
                isok=false;
                break;
            }
        }
        if(isok==true)mn=min(mn,pay);
    }

    if(mn == 3000000)cout << -1 << endl;
    else cout << mn << endl;



}

Measured memory_bytes: 3636
// https://atcoder.jp/contests/abc135/tasks/abc135_c

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define EPS (1e-9)
#define INF (1e9)
#define INFL (1e18)
#define MOD (1000000007)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOREACH(x, a) for (auto &(x) : (a))
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define LEN(x) (sizeof(x) / sizeof(*(x)))
// ll gcd(long a, long b) { return b ? gcd(b, a % b) : a; }
// ll lcm(long a, long b) { return a * b / gcd(a, b); }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    ll sum = 0;
    cin >> n;
    vector<int> a(n + 1), b(n, 0);
    REP(i, n + 1) cin >> a[i];
    REP(i, n) cin >> b[i];
    REP(i, n) {
        // bに対して左側のa
        if (a[i] <= b[i]) {
            sum += a[i];
            b[i] -= a[i];
            a[i] = 0;
        } else {
            sum += b[i];
            a[i] -= b[i];
            b[i] = 0;
        }
        // bに対して右側のa
        if (a[i + 1] <= b[i]) {
            sum += a[i + 1];
            b[i] -= a[i + 1];
            a[i + 1] = 0;
        } else {
            sum += b[i];
            a[i + 1] -= b[i];
            b[i] = 0;
        }
    }
    cout << sum << endl;
    // REP(i, n) cout << b[i] << " ";

    return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin>>m>>n;
int maxv=0,minv=10000000,a,b;
for(int i=1;i<=n;i++){
	cin>>a>>b;
	if(a>maxv){
		maxv=a;
	}
	if(b<minv){
		minv=b;
	}
}
if(minv<maxv){
	cout<<0;
}
else{
	cout<<minv-maxv+1;
}
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;


int main(){
    int   N;
    long long sum,answer;
    cin >> N;
    long long   a[N],b[N];
    for(long long  i=0;i<N;i++){
        b[i]=0;
    }
    for(long long i=0;i<N;i++){
        cin >> a[i];
        b[a[i]-1]++;
    }
    sum=0;

    for (long long i=0;i<N; i++){
        sum+=b[i]*(b[i]-1)/2;
    }

    for(long long i=0;i<N;i++){
        answer=sum;
        answer-=(b[a[i]-1]-1);
        cout << answer << endl;
    }
    return 0;
}

Measured memory_bytes: 5760
# B - Popular Vote
def main():
    N, M, *A = map(int, open(0).read().split())
    A.sort(reverse=True)
    lim = sum(A) / (4 * M)
    print("Yes" if A[M - 1] >= lim else "No")


if __name__ == "__main__":
    main()


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

using namespace std;
using ll = long long;

using Field = vector<vector<int>>;
using Graph = vector<vector<int>>;
using VI = vector<int>;
using VC = vector<char>;
using PI = pair<int, int>;

#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(x) x.begin(), x.end()

const int mod = 1000000007;

static const int MAX_V = 200;
int V, E;
vector<vector<int>> G(MAX_V,vector<int>());
vector<int> match(MAX_V);
vector<int> used(MAX_V);

void add_edge(int u, int v) {
    G.at(u).push_back(v);
    G.at(v).push_back(u);
}

bool dfs(int v) {
    if (G.at(v).empty()) return false;

    used.at(v) = true;
    for (int i = 0; i < G.at(v).size(); i++) {
        int u = G.at(v).at(i);
        int w = match.at(u);
        if (w < 0 || (!used.at(w) && dfs(w))) {
            match.at(v) = u;
            match.at(u) = v;
            return true;
        }

    }
    return false;
}

int biparticle_matching() {
    int res = 0;
    fill(match.begin(), match.end(), -1);
    for (int v = 0; v < V; v++) {
        if (match.at(v) < 0) {
            fill(ALL(used), 0);
            if (dfs(v)) res++;
        }
    }
    return res;

}

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int N; cin >> N;
    vector<pair<int, int>> R(N);
    vector<pair<int, int>> B(N);
    REP(i, N) cin >> R.at(i).first >> R.at(i).second;
    REP(i, N) cin >> B.at(i).first >> B.at(i).second;

    V = 2 * N;

    REP(i, N) {
        REP(j, N) {
            if (R.at(i).first < B.at(j).first && R.at(i).second < B.at(j).second) {
                add_edge(i, j + N);
            }
        }
    }

    int ans = biparticle_matching();

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define dbg(x) cout<<"( "<<#x<<" -> "<<x<<" )"<<endl;
using namespace std;
ll gcd(ll a,ll b)
{
    if (b==0LL)
    return a;
    return (gcd(b,a%b));
}
int main()
{
    ll a,b;
    scanf("%lld%lld",&a,&b);
    ll g=gcd(a,b);
    ll val=(a*b)/g;
    printf("%lld\n",val);
    return 0;
}


Measured memory_bytes: 3808
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
    REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

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



int main(int argc, const char * argv[]) {
    
   
    
    //input
    ll n; cin >> n;
    ll HP[100100][3];
    ll DP[100100][3];
    memset(DP, 0, sizeof(DP));
    memset(HP, 0, sizeof(HP));
    
    rep(i,n) cin >> HP[i][0] >> HP[i][1] >> HP[i][2];
    
    //DP
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 3; k++) {
                if(j==k) continue;
                chmax( DP[i][j], DP[i - 1][k] + HP[i - 1][k]);
            }
        }
    }
    
    cout << max( { DP[n][0], DP[n][1], DP[n][2]}) << endl;
    
    
}


Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <complex>
#include <regex>
#include <random>
using namespace std;

#define rep(i,n)	for(lint i = 0; i < n; i++)
#define repr(i,n)	for(lint i = n - 1; i >= 0; i--)
#define repi(i,ini,n)	for(lint i = ini; i < n; i++)
#define repir(i,ini,n)	for(lint i = n-1; i >= ini; i--)
#define repb(i,start,end)	for(lint i = start; i <= end; i++)
#define repbr(i,start,end)	for(lint i = end; i >= start; i--)

#define bit(n)				(1LL << (n))

#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define rg(v, ini, end) v.begin() + ini, v.begin()+end

#define ret return 0;
#define chmax(a, b) a=mmax(a,b)
#define chmin(a, b) a=mmin(a,b)

using lint = long long;
using ulint = unsigned long long;
using ld = long double;
struct xy
{
	lint x, y;
	xy() :x(0), y(0) {}
	xy(lint _x, lint _y) : x(_x), y(_y) {}
	xy operator+(const xy& p) const
	{
		return xy(x + p.x, y + p.y);
	}
	bool operator<(xy p) const
	{
		if (y == p.y)
			return x < p.x;
		return y < p.y;
	}
};
struct xyd
{
	ld x, y;
	xyd() :x(0), y(0) {}
	xyd(long double _x, long double _y) : x(_x), y(_y) {}
};
using vec = vector<lint>;
using vecd = vector<ld>;
using vecs = vector<string>;
using vecp = vector<xy>;
template<class T> using vect = vector<T>;
class vec2 : public vector<vector<lint>>
{
public:
	vec2() {}
	vec2(lint n) : vector(n) {}
	vec2(lint h, lint w) : vector(h, vector<lint>(w)) {}
	vec2(lint h, lint w, lint v) : vector(h, vector<lint>(w, v)) {}
};

template<class T> using priq = priority_queue<T>;
template<class T> using rpriq = priority_queue<T, vector<T>, greater<T>>;
template<class Key, class Val> using hashmap = unordered_map<Key, Val>;
template<class Key> using hashset = unordered_set<Key>;

mt19937 mtrand((random_device())());

const double pi = 3.141592653589793238462;
const lint intmax = 9223372036854775807;
const lint inf = 1100100100100100100LL;

constexpr lint div2(lint p, lint q)
{
	return (p + q - 1) / q;
}

#if(__cplusplus < 201703L)

	lint gcd(lint a, lint b) {
		while (1) {
			if (a < b) swap(a, b);
			if (!b) break;
			a %= b;
		}
		return a;
	}

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

#endif

template<class T>
struct nval {
	lint n;		// counts
	T val;
	nval() : n(0) {};
	nval(lint _n, T _val) : n(_n), val(_val) {};
};

template<class It, class It2>
auto spacel(It i, It2 end)
{
	if (i + 1 == end)
	{
		return '\n';
	}
	else
	{
		return ' ';
	}
}

ostream& setp(ostream& ost)
{
	cout << setprecision(60) << fixed;
	return ost;
}

const ulint mod = 1000000007;
//const ulint mod = 998244353;
const ld eps = 0.0000001;

int main()
{
	lint n;
	cin >> n;
	lint a = 0, b = 0;
	rep(i, n)
	{
		string s, t;
		cin >> s >> t;
		if (s < t)
			a+=3;
		else if(s > t)
			b+=3;
		else
		{
			a++; b++;
		}
	}

	cout << b << ' ' << a << endl;

	return 0;
}



Measured memory_bytes: 3148
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pII;
#define pb push_back
#define mp make_pair
#define clr(x,y) memset(x,y,sizeof(x))
const int inf=0x3f3f3f3f;
const ll mod=1e9+7;
const int maxn=1e6+5;
//ll fmod(ll x,ll y){ll res=1;while(y){if(y&1)res=res*x%mod;y>>=1;x=x*x%mod;}return res;}
//ll gcd(ll x,ll y){return y==0?x:gcd(y,x%y);}
int main()
{
   int n;
   while(cin>>n)
   {
       if(n%2)
        cout<<(n/2)*(n/2+1)<<endl;
       else
        cout<<(n/2)*(n/2)<<endl;
   }

}
















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

int main() {
  int N;
  cin >> N;
  
  vector<double> v(N);
  for (int i = 0; i < N; i++) {
    cin >> v[i];
  }
 
  sort(v.begin(), v.end());
  
  double avg = 0.0;
  for (int i = 0; i < N-1; i++) {
    if (i==0) avg = (v[i] + v[i+1])/2;
    else avg = (avg + v[i+1])/2;
  }
  
  cout << avg << endl;
  
}

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

const int MOD = 1000000007;

const int MAX_V = 81 * 81 * 2;
int dp[81][81][MAX_V];

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<int>> A(H, vector<int>(W)), B(H, vector<int>(W)), C(H, vector<int>(W));
    rep(i, H) rep(j, W) cin >> A[i][j];
    rep(i, H) rep(j, W) cin >> B[i][j];
    rep(i, H) rep(j, W) C[i][j] = abs(A[i][j] - B[i][j]);

    dp[0][0][C[0][0]] = 1;
    rep(i, H) {
        rep(j, W) {
            rep(bias, MAX_V) {
                if (dp[i][j][bias] == 0) continue; // i,jマス目でこの偏り(bias)になるルートは無い
                if (j != W - 1) { // 横方向
                    dp[i][j + 1][bias + C[i][j + 1]] = 1;
                    dp[i][j + 1][abs(bias - C[i][j + 1])] = 1;
                }

                if (i != H - 1) { // 縦方向
                    dp[i + 1][j][bias + C[i + 1][j]] = 1;
                    dp[i + 1][j][abs(bias - C[i + 1][j])] = 1;
                }
            }
        }

    }

    rep(i, MAX_V) {
        if (dp[H - 1][W - 1][i]) {
            cout << i << endl;
            return 0;
        }
    }
}


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

int main() {
	long long N,K;
	cin >> N >> K;
	vector<int>A(N);  
	vector<int>SUM(N + 1);
	long long sum = 0; 
	SUM[0] = 0;
	for (long long n = 0;n<N;++n) {
		cin >> A[n];
		sum += A[n]; 
		SUM[n + 1] = (sum  - (n + 1))%K;
	}
	map<int,int>mp;
	for (int n = 1;n < K;++n) {
		if (n<=N) {
			mp[SUM[n]]++;
		}
	}
	long long ans = 0;
	for (long long n = 0; n <= N; ++n) {
		ans += mp[SUM[n]];
		mp[SUM[n + 1]]--;
		if ((n + K) <= N) {
			mp[SUM[n + K]]++;
		}
	}
	cout << ans <<  endl;
	return 0;
}

Measured memory_bytes: 14284
#include<bits/stdc++.h>
using namespace std;
int main(){
  int key = 0;
  string a,b;
  cin >> a >> b;
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  reverse(b.begin(),b.end());
  vector<string> A = {a,b};
  sort(A.begin(),A.end());
  if(a == b)
    cout << "No" << endl;
  else if(A.at(0) == a)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
// Sky's the limit :)
#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 T = 1; 
    // cin >> T; 
    while (T--) {
        int n, m, k;
        cin >> n >> m >> k;
        map<int, int> mx, my;
        map<pair<int, int>, int> mp;
        for (int i = 0; i < k; i++) {
            int x, y;
            cin >> x >> y;

            mx[x]++, my[y]++;
            mp[{x, y}]++;
        }

        int x = 0, y = 0;
        for (auto &&it : mx)
            x = max(x, it.second);
        for (auto &&it : my) 
            y = max(y, it.second);

        vector<int> vx, vy;
        for (auto &&it : mx) {
            if (it.second == x)
                vx.push_back(it.first);
        } 
        for (auto &&it : my) {
            if (it.second == y)
                vy.push_back(it.first);
        } 

        int ans = x + y - 1;
        for (auto &&x : vx) {
            for (auto &&y : vy) {
                if (mp.find({x, y}) == mp.end()) {
                    cout << ++ans << '\n';
                    exit(0);
                }
            }
        }

        cout << ans << '\n';
        
    }
    
    return 0;
}



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

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

    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin>>a.at(i);
    }

    int alice=0,bob=0;

    // aの要素を大きい順にソート
    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());

    if(n%2==0){
        for(int i=0; i<n; i+=2){
            alice+=a.at(i);
            bob+=a.at(i+1);
        }
    }else{
        for(int i=0; i<n-1; i+=2){
            alice+=a.at(i);
            bob+=a.at(i+1);
        }
        alice+=a.at(n-1);
    }

    cout<<alice-bob<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int x,y,a,b,c;
  cin>>x>>y>>a>>b>>c;
  int w[a+1],m[b+1],u[c+1];
  for(int i=1;i<=a;i++)
    cin>>w[i];
  sort(w+1,w+a+1);
  reverse(w+1,w+a+1);
  for(int i=1;i<=b;i++)
    cin>>m[i];
  sort(m+1,m+b+1);
  reverse(m+1,m+b+1);
  for(int i=1;i<=c;i++)
    cin>>u[i];
  sort(u+1,u+c+1);
  reverse(u+1,u+c+1);
  vector <int> v;
  for(int i=1;i<=x;i++)
    v.push_back(w[i]);
  for(int i=1;i<=y;i++)
    v.push_back(m[i]);
  for(int i=1;i<=c;i++)
    v.push_back(u[i]);
  sort(v.begin(),v.end());
  reverse(v.begin(),v.end());
  long long ans=0;
  for(int i=0;i<x+y;i++)
    ans+=v[i];
  cout<<ans;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define INF 1234567890
#define pii pair<int,int>
#define LL long long
using namespace std;

int main () {
    //clock_t start = clock();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n;
    string s;
    cin >> s;
    int r=0,w=0;
    for (int i=0;i<s.size();i++) {
        if (s[i] == 'R') r++; else w++;
    }
    int ans = 0;
    for (int i=0;i<r;i++){
        if (s[i] == 'W') ans++;
    }
    cout << ans << endl;
    //cerr << fixed << setprecision(3) << (clock()-start)*1./CLOCKS_PER_SEC << endl;
    return 0;
}

Measured memory_bytes: 3728
import java.util.*;

public class Main { //クラス名はMain
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int X = Integer.parseInt(sc.next());
    	System.out.println(X == 3 || X == 5 || X == 7 ? "YES" : "NO");
    }
}


Measured memory_bytes: 23764
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i==n-1];};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    ll H[100010];
    cin >> N;
    rep(i,0,N) cin >> H[i];
    ll ans = 0;
    rrep(i,N-2,0){
        if(H[i] > H[i+1]){
            H[i]--;
        }
    }
    bool ok = true;
    rep(i,0,N-1){
        if(H[i] > H[i+1]) ok = false;
    }
    if(ok){
        print("Yes");
    }else{
        print("No");
    }

    
}


Measured memory_bytes: 1024
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<vector>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define FOR(i,s,e) for (int i=s;i<e;i++)
#define FOE(i,s,e) for (int i=s;i<=e;i++)
#define FOD(i,s,e) for (int i=s;i>=e;i--)
#define SET(a,e) memset(a,e,sizeof(a))
#define LL long long
#define LD long double
#define pb push_back
#define x first
#define y second
#define PII pair<int,int>
#define PLI pair<LL,int>
#define PIL pair<int,LL>
#define PLL pair<LL,LL>
#define eps 1e-9
#define mp make_pair

int n,m,ans,tmp,a[100005];

int main () {
	scanf("%d",&n);
	FOE(i,1,n) {
		scanf("%d",&a[i]);
	}
	FOE(i,1,n) {
		if (a[i]==i) {
			if (i==1) swap(a[i],a[i+1]);
			else if (i==n) swap(a[i],a[i-1]);
			else swap(a[i],a[i+1]);
			++ans;	
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

int dig_sum(int n){
  if(n<10) return n;
  return dig_sum(n/10)+n%10;
}

int main() {
  int N,A,B;
  cin >> N >> A >> B;
  int r=0;
  for(int i=1;i<N+1;i++){
    int temp = dig_sum(i);
    if(temp>A-1 && temp<B+1){
      r += i;
    }
    
  }
  cout << r << endl;
  
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

ll n,h;
Vi a,b;
vector<PLL> p;

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    cin>>n>>h;
    a.resize(n);
    b.resize(n);
    ll tp = 0,fg=0;
    rep(i,n){
        cin>>a[i]>>b[i];
        p.pb(mp(b[i],i));
        if(tp <= a[i]){
            if(a[i] == tp){
                if(b[i] < b[fg])fg = i;
            }else{
                fg = i;
            }
            tp = a[i];
        }
    }
    Sort(p);
    ll ans = 0;
    rep(i,p.size()){
        if(true){
            if(p[i].first <= tp )break;
            h -= p[i].first;
            ans++;
            if(h <= 0)break;
        }
    }
    while (1){
        if(h<=0)break;
        ans += h/tp;
        if(h % tp !=0){
            ans++;
        }
        break;
    }
    print(ans);
    return 0;
}

Measured memory_bytes: 3956
N,M=map(int,input().split())
S=list(map(int,input().split()))
S.sort()
L=[0]*(M-1)
for i in range(M-1):
    L[i]=abs(S[i]-S[i+1])

L.sort()
goukei=0
if M-N>=1:
    for i in range(M-N):
        goukei+=L[i]
else:
    print(0)
    exit()
print(goukei)

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

#define ll long long
#define ull unsigned long long
#define openfiles ifstream cin("input.txt"); ofstream cout("output.txt");

using namespace std;

ll a[5000], dp[500][500], sum[500][500];

ll solve(int l, int r)
{
    if(l == r)
    {sum[l][l] = a[l]; return 0;}
    for(int i = l; i < r; i++)
    {
        if(!dp[l][i])
            solve(l, i);
        if(!dp[i+1][r])
            solve(i + 1, r);
        if(dp[l][r] == 0)
            dp[l][r] = dp[l][i] + dp[i+1][r] + sum[l][i] + sum[i+1][r];
        else
            dp[l][r] = min(dp[l][r], dp[l][i] + dp[i+1][r] + sum[l][i] + sum[i+1][r]);
    }
    sum[l][r] = sum[l][l] + sum[l+1][r];
    return dp[l][r];
}
int main()
{
    int n;
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> a[i];
    cout << solve(0, n - 1);
}
//10 20 30 40
//30 50 70
//90 140


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

struct restaurant{
	int no;
	char city[15];
	int point;
}; 

bool cmp(restaurant a, restaurant b){
	if(strcmp(a.city, b.city) > 0)return 0;
	else if(strcmp(a.city, b.city) < 0)return 1;
	else{
		return a.point > b.point;
	}
}

int main(){
	int n;
	restaurant r[110];
	cin >> n;
	for(int i = 0; i < n; i ++){
		cin >> r[i].city >> r[i].point;
		r[i].no = i + 1;
	}
	sort(r, r + n, cmp);
	for(int i = 0; i < n; i ++){
		cout << r[i].no << '\n';
	}
	return 0; 
} 

Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    auto nmx = readints;
    int n = nmx[0], m = nmx[1], x = nmx[2];
    auto a = readints;

    auto xs = new int[n + 2];
    for (int i = 0; i < a.length; i++) {
        xs[a[i]] = 1;
    }

    int s = xs[0..x].sum;
    int t = xs[x+1..$].sum;
    writeln(min(s, t));
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	char a;
	cin>>a;
	switch(a){
		case 'A':
		cout<<"T"<<endl;
		break;
		
		case 'C':
		cout<<"G"<<endl;
		break;
		
		case 'T':
		cout<<"A"<<endl;
		break;
		
		case 'G':
		cout<<"C"<<endl;
		break;
	}
	return 0;
}

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

int main(){
    ll N,C;
    cin >> N >> C;
    vector<ll> x(N);
    vector<ll> v(N);
    rep(i,N){
        cin >> x[i] >> v[i];
    }
    vector<ll> right_rotate_max(N);
    ll calorie = 0;
    calorie += v[0];
    right_rotate_max[0] = calorie - x[0];
    rep(i,N - 1){
        calorie += v[i + 1];
        right_rotate_max[i + 1] = max(right_rotate_max[i], calorie - x[i + 1]);
    }
    calorie = 0;
    calorie += v[N - 1];
    vector<ll> left_rotate_max(N);
    left_rotate_max[N - 1] = calorie - (C - x[N - 1]);
    rep(i,N - 1){
        calorie += v[N - i - 2];
        left_rotate_max[N - i - 2] = max(left_rotate_max[N - i - 1], calorie - (C - x[N - i - 2]));
    }
    /*rep(i,N){
        cout << left_rotate_max[i] << " " << right_rotate_max[i] << endl;
    }*/
    ll ans = 0;
    calorie = 0;
    rep(i,N){
        ans = max(ans, left_rotate_max[i]);
        ans = max(ans, right_rotate_max[i]);
    }
    rep(i,N - 1){
        calorie += v[i];
        ans = max(ans, calorie - 2 * x[i] + left_rotate_max[i + 1]);
    }
    calorie = 0;
    rep(i,N - 1){
        calorie += v[N - 1 - i];
        ans = max(ans, calorie - 2 * (C - x[N - i - 1]) + right_rotate_max[N - i - 2]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 6424
import math

A, B, C, D = map(int, input().split())

#何ターンで倒せるかを比較、ターン数が小さい方が強い。ターン数が同じなら高橋が勝ち。

if math.ceil(C / B) <= math.ceil(A / D):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9024
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    cout << (n+1)/2 << endl;
    return 0;
}


Measured memory_bytes: 3636
N, L = map(int, input().split())
apple = [i+L for i in range(N)]
sum_apple = (sum(apple))
sa = float("inf")

for i in range(N):
    apple_pie = apple[:i] + apple[i+1:]
    count = 0
    for j in range(len(apple_pie)):
        count += apple_pie[j]
        if sa > abs(sum_apple - count):
            sa = abs(sum_apple - count)
            ans = count
print(ans)


Measured memory_bytes: 3060
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

const int MOD_TYPE = 1;
const ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const ld PI = acos(-1.0);
const ld EPS = 1e-11;

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#pragma endregion

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);

  ll x;
  cin >> x;
  ll ans = 0;
  ans += (x / 11) * 2;
  x %= 11;
  if (x == 0)
    ;
  else if (x <= 6)
    ans++;
  else
    ans += 2;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <set>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

typedef long long ll;
typedef long long int llt;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    if((b*10+c)%4==0)
        cout << "YES" << endl;
        else
            cout << "NO" << endl;
        return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
	long long N, M;
	cin >> N >> M;
	vector<vector<long long>>stu(N, vector<long long>(2));
	vector<vector<long long>>spa(M, vector<long long>(2));
	for (int i = 0;i < N;++i) {
		for (int j = 0;j < 2;++j) {
			cin >> stu[i][j];
		}
	}
	for (int i = 0;i < M;++i) {
		for (int j = 0;j < 2;++j) {
			cin >> spa[i][j];
		}
	}
	vector<int>ans(N);
	for (int i = 0;i < N;++i) {
		long long Min = 10000000000;
		for (int j = 0;j < M;++j) {
			long long dis = abs(stu[i][0] - spa[j][0]) + abs(stu[i][1] - spa[j][1]);
			if (Min > dis) {
				Min = dis;
				ans[i] = j + 1;
			}
		}
	}
	for (int i = 0;i < ans.size();++i) {
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import itertools
n,k=map(int,input().split())
a=list(map(int,input().split()))
l=[]
c=0
for i in range(n):
    for j in range(i,n):
        b=sum(a[i:j+1])
        l.append(b)
l.sort()
for i in range(len(l)):
    l[i]=format(l[i],'b').zfill(len(format(l[-1],'b')))
m=len(l[0])
l=l[::-1]
r=[0]*m
for i in range(m):
    for j in range(len(l)):
        if l[j][i]=='1':
            r[i]+=1
#print(l)
#print(r)
for i in range(m):
    ll=[]
    lll=[]
    if r[i]>=k:
        for j in range(len(l)):
            if l[j][i]=='1':
                ll.append(l[j])
            else:
                lll.append(l[j])
        l=ll
        if len(l)<k:
            l=l+lll
        elif len(l)==k:
            c+=2**(m-i-1)
            break
        elif len(l)>k:
            c+=2**(m-i-1)
        #print(c)
        #print(l)
    else:
        ll=l

#print(l)
ans=int(l[0],2)
for i in range(len(l)):
    ans&=int(l[i],2)
if len(l)>k:
    print(c)
else:
    print(ans)

Measured memory_bytes: 167448
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;

namespace problem001
{
	class Program
	{
		static void Main(string[] args)
		{
			int n = int.Parse(ReadLine());
			var s = ReadLine().Split(' ');
			int ans = 0;
			int i = 1;
			for(int j = 0; j < n; j++)
			{
				if (int.Parse(s[j]) == i)
				{
					i++;
				}
				else
				{
					ans++;
				}
			}
			if(ans == n)
			{
				ans = -1;
			}
			WriteLine(ans);
		}
	}
}


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

int main() {
  string N;
  cin>>N;
  if(N=="a"||N=="i"||N=="u"||N=="e"||N=="o"){
    cout << "vowel"<<endl;
  }else{
    cout << "consonant"<<endl;
    }
}

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


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    cout << fixed << setprecision(15);
#ifndef ONLINE_JUDGE
    freopen("../input.txt", "r", stdin);
    freopen("../output.txt", "w", stdout);
#endif
    long long x,y;
    cin>>x>>y;
    long  long a=(4*x-y)/2;
    long long b=x-(a);
    if(a>=0&&b>=0){
        if(a+b==x){
            if(2*a+4*b==y){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool mini(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define y1 y1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;

void Main(){
  int A,B,C,X,Y;
  cin>>A>>B>>C>>X>>Y;

  ll ans=0;

  mini(A,2*C);
  mini(B,2*C);

  if(A+B>2*C){
    ans=min(X,Y)*2*C+(X-min(X,Y))*A+(Y-min(X,Y))*B;
  }
  else{
    ans=A*X+B*Y;
  }

  cout<< ans<<"\n";
}

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


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

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

  int ans = 0;
  vector<int> h(N);
  for (int i = 0; i < N; i++) {
    cin >> h.at(i);
    if (h.at(i) >= K) ans++;
  }

    cout << ans << endl;
  }

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

using namespace std;


signed main(){

	int n;
	cin >> n;

    long long ans = 1LL * n * (n + 1) * (n + 2) / 6;
    for(int i = 0; i < n - 1; ++i){
		int u, v;
		cin >> u >> v;
		if(u > v)
			swap(u, v);
        --u;
        ans -= 1LL * (u + 1) * (n - v + 1);
    }
    cout << ans << endl;
}



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

char toupper(string s) {
  return s[0]-32;
}

int main() {
  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;
  cout << toupper(s1) << toupper(s2) << toupper(s3) << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

// inf
constexpr ll infl = 10000000000000000LL;
constexpr int inf = 1000000000;

int main() {
    int n;
    cin >> n;
    vector<int> b(n);
    for (int i = 0; i < n - 1; ++i) {
        cin >> b[i];
    }

    int ans = b[0] + b[n - 2];
    for (int i = 1; i < n - 1; ++i) {
        ans += min(b[i - 1], b[i]);
    }

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

Measured memory_bytes: 888
N = int(input())
p = list(map(int, input().split()))
pp = p[:]
p.sort()
count = 0

for i in range(len(p)):
    if p[i] != pp[i]:
        count += 1
    else:
        pass

if count == 2 or count== 0:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3060
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		Long n = sc.nextLong();
		Long k = sc.nextLong();
		long num = k;
		for(int i=1; i<n; i++){
			num *= k-1;
		}
		System.out.println(num);
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define mset(x, y) memset(x, y, sizeof x)
#define mcpy(x, y) memcpy(x, y, sizeof x)
using namespace std;

typedef long long LL;
typedef pair <int, int> pii;

inline int Read()
{
	int x = 0, f = 1, c = getchar();
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (;  isdigit(c); c = getchar())
		x = x * 10 + c - '0';
	return x * f;
}

const int MAXN = 50;

int k = 38, n = k * (k - 1) + 1, a[MAXN][MAXN];

int main()
{
#ifdef wxh010910
	freopen("data.in", "r", stdin);
#endif
	printf("%d %d\n", n, k);
	for (int i = 1; i <= k; i ++)
	{
		printf("1");
		for (int j = (i - 1) * (k - 1) + 2; j <= i * (k - 1) + 1; j ++)
			printf(" %d", j), a[i][j - (i - 1) * (k - 1) - 2] = j;
		putchar(10);
	}
	for (int i = 0; i < k - 1; i ++)
		for (int j = 0; j < k - 1; j ++)
		{
			printf("%d", i + 2);
			for (int l = 2, cur = j; l <= k; l ++, cur = (cur + i) % (k - 1))
				printf(" %d", a[l][cur]);
			putchar(10);
		}
}


Measured memory_bytes: 512
#n=input()
#li=input().split()
#d=["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"]
#import math

n=int(input())
li=list(map(int,input().split()))
check=0
ans=[]
for m in range(n):
    if li[m]<=m+1:
        continue
    else:
        print(-1)
        check=1
        break
if check==0:
    box=[]
    for i in range(n):
        for j in range(n-i):
            if li[j]==j+1:
                box.append(j+1)
        flag=0
        while flag==0:
            if box[-1]<len(li):
                if li[box[-1]-1]==li[box[-1]]:
                    box[-1]+=1
                    continue
                else:
                    flag=1
            else:
                flag=1
        li_a=li[:box[-1]-1]
        li_b=li[box[-1]:]
        ans.append(li[box[-1]-1])
        li=li_a+li_b
    for i in range(n):
        print(ans.pop())


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

int n, m;
string s, t;
int ans;

void in();
void solve();
void out();

int main(){
    ios::sync_with_stdio(false);
    cout.tie(0);
    cin.tie(0);
    in();
    solve();
    out();
}

void in(){
    cin >> n >> m;
    //cin >> s >> t;
}

void solve(){
    ans = n * (n - 1) / 2 + m * (m - 1) / 2;
}

void out(){
    cout << ans;
}


Measured memory_bytes: 256
import numpy as np

L = int(input())

l = [0, 0]
for c in np.arange(0, L, 0.001):
    s = (((L-c)**2)/4)*c
    if c == 0:
        l[0] = s
    else:
        l[1] = s
        if l[0] >= l[1]:
            ans = l[0]
            break
        l[0] = l[1]
    #print(s)

print(ans)


Measured memory_bytes: 20184
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
int n,dx[8]={-1,-1,-1,0,0,1,1,1},dy[8]={-1,0,1,-1,1,-1,0,1},ans;
map<P,int> m;
bool check(int x, int y) {
  return x>=0&&x<n&&y>=0&&y<n;
}

P S(vector<string> s) {
  P p=P(0,0);
  for(int i=0; i<n; i++) {
    for(int j=0; j<n; j++) {
      if(s[i][j]=='#') p.first|=1<<(i*n+j);
      if(s[i][j]=='@') p.second=i*n+j;
    }
  }
  return p;
}

vector<string> change(vector<string> s) {
  vector<string> t=s;
  for(int i=0; i<n; i++) {
    for(int j=0; j<n; j++) {
      int c=0;
      for(int k=0; k<8; k++) {
        int x=i+dx[k],y=j+dy[k];
        if(!check(x,y)) continue;
        if(s[x][y]!='.') c++;
      }
      if(s[i][j]=='#') {
        if(c==2||c==3) t[i][j]='#';
        else t[i][j]='.';
      }
      if(s[i][j]=='.') {
        if(c==3) t[i][j]='#';
        else t[i][j]='.';
      }
      if(s[i][j]=='@') t[i][j]='@';
    }
  }
  return t;
}

int main() {
  while(cin >> n && n) {
    vector<string> s(n);
    for(int i=0; i<n; i++) cin >> s[i];
    queue<P> que;
    P p=S(s);
    que.push(p);
    m.clear();
    m[p]=0;
    while(!que.empty()) {
      P p=que.front();que.pop();
      vector<string> s(n);
      bool f=1;
      for(int i=0; i<n; i++) {
        for(int j=0; j<n; j++) {
          if(p.first&(1<<(i*n+j))) s[i]+='#',f=0;
          else s[i]+='.';
        }
      }
      s[p.second/n][p.second%n]='@';
      if(f) {
        cout << m[p] << endl;
        goto end;
      }
      int nx=p.second/n,ny=p.second%n,c=m[p];
      for(int i=0; i<8; i++) {
        int x=nx+dx[i],y=ny+dy[i];
        if(!check(x,y)||s[x][y]!='.') continue;
        vector<string> t=s;
        t[nx][ny]='.';
        t[x][y]='@';
        t=change(t);
        P q=S(t);
        if(m.count(q)) continue;
        m[q]=c+1;
        que.push(q);
      }
    }
    cout << -1 << endl;
  end:;
  }
  return 0;
}

Measured memory_bytes: 2480
#include<stdio.h>
int main(void){
	int N;
	scanf("%d",&N);
	int L[N];
	int a;
	int sum=0;
	for(a=0;a<N;a++){
		scanf("%d",&L[a]);
		sum+=L[a];
	}
	for(a=0;a<N;a++){
		if(L[a]>=(sum-L[a])){
			printf("No");
			break;
		}else{
			if(a==N-1){
				printf("Yes");
			}
		}
	}
	
return 0;
}

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

void f(queue<int> &q, vector<int> &dist, int np, int d) {
  if (dist[np] != INF) return;
  q.push(np);
  dist[np] = d;
  return;
}

int main() {
  int n, x, y;
  cin >> n >> x >> y;
  x--; y--;
  vector<int> g(n);
  rep(i, n) cin >> g[i];
  queue<int> q;
  vector<int> ans(n);
  rep(i, n) {
    vector<int> dist(n, INF);
    f(q, dist, i, 0);
    while(!q.empty()) {
      int v = q.front(); q.pop();
      int d = dist[v]+1;
      if (v+1 < n) f(q, dist, v+1, d);
      if (v-1 >= 0) f(q, dist, v-1, d);
      if (v == x) f(q, dist, y, d);
      if (v == y) f(q, dist, x, d);
    }
   rep(j, n) ans[dist[j]]++;
  }
  
  for (int k=1; k<n; k++) {
    cout << ans[k]/2 << endl;
  }
  
}

Measured memory_bytes: 256