akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define Return(expr) { Cout(expr); return 0; }
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(string, s, t);
  	t.pop_back();
    CoutYn(s == t);
}

Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
#include<cassert>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
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;}

string s;

void solve(){
    cin >> s;
    int n=s.length();
    if(s[n-1]=='s'){
        cout << s;
        cout << "es" << endl;
    }
    else{
        cout << s;
        cout << "s" << endl;
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(50);
    solve();
}

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

signed main(){
  int N,K;
  cin>>N>>K;
  int su[100];
  rep(i,N)su[i]=0;
  rep(i,K){
    int D;
    cin>>D;
    rep(j,D){
      int A;
      cin>>A;
      su[A-1]+=1;
    }
  }
  int ans=0;
  rep(i,N){
    if(su[i]==0)ans+=1;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
typedef long long ll ;
const ll MOD = 1e9 + 7 ;
const ll dx[4] = { -1,1,0,0 };
const ll dy[4] = { 0,0,-1,1 };
const ll MAX =  3e6 ;
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(),v.end()
long long gcd(long long  a, long long  b) { return (b == 0 ? a : gcd(b, a % b)); }
ll n , m , x ,y, k , Q , ans ; string s,t;
ll dp[22][MAX];
bool mat[22][22];

ll solve(int i , ll mask){

    if(i == n)
        return mask == ((1ll<<n) - 1);

    ll &ret = dp[i][mask];

    if(~ret)
            return ret;

    ret = 0;

    for(int j = 0 ; j < n ; ++j){

        if(!mat[i][j] || (mask>>j&1)) continue;

        ret = (ret%MOD + solve(i + 1 , mask|(1ll<<j))%MOD)%MOD;

    }

    return ret;


}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);  cout.tie(0);
//    freopen("test.in","r",stdin);

    cin>>n;

    for(int i = 0 ; i < n ; ++i)
        for(int j = 0 ; j < n ; ++j)
            cin>>mat[i][j];

    for(int i = 0 ; i < n ; ++i)
        for(int j = 0 ; j < (1ll<<n) ; ++j)
            dp[i][j] = -1 ;

    cout<<solve(0,0)<<'\n';

    return 0;
}


Measured memory_bytes: 387328
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <set>
#include <utility>

using namespace std;

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

  vector<int> restaurant_point; // id --> point
  multimap<string, int> restaurant_location; // city name --> ids
  set<string> locations;

  string S;
  int P;
  for (int i = 0; i < N; ++i) {
    cin >> S >> P;
    restaurant_point.push_back(P);
    restaurant_location.insert(make_pair(S, i));
    locations.insert(S);
  }

  for (auto l: locations){
    map<int, int, greater<int>> point_id;
    while(true) {
      auto itr = restaurant_location.find(l);
      if (itr == restaurant_location.end()) {
        break;
      } else {
        point_id.insert(make_pair(restaurant_point[itr->second], itr->second));
        restaurant_location.erase(itr);
      }
    }
    for (auto e: point_id) {
      cout << e.second + 1 << endl;
    }
  }

  return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

bool isPrime(int a){
	for (int i = 2;i*i <= a;i++){
		if(a%i == 0) return false;
	}
	return true;
}

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

	int n; cin >> n;
	int ans = 0;

	for (int i = 0;i < n;i++){
		int a; cin >> a;
		if(isPrime(a)) ans++;
	}

	cout << ans << endl;

	return 0;

}



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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO  cout << "NO"  << endl
#define No  cout << "No"  << endl

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    int ans = 0;
    string s; cin >> s;
    int c = 0;
    REP(i, s.length())
    {
        switch (s[i])
        {
            case 'A':
            case 'G':
            case 'C':
            case 'T':
                ++c;
                break;
            default:
                c = 0;
                break;
        }
        ans = max(ans, c);
    }
    cout << ans << endl;
} 
    
int main() 
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
        //MyDebugger.Test(process, "../TextFile2.txt");
        //MyDebugger.MakeTestCase("../TextFile2.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static void Write(object obj) {
#if DEBUG
        Debug.Write(obj.ToString());
#else
        Console.Write(obj.ToString());
#endif
    }

    static object process(TextReader input) {
        var n = int.Parse(input.ReadLine());

        var tbl = new int[10][];

        for (int i = 0; i < tbl.Length; i++)
            tbl[i] = new int[10];

        for (int i=1; i<=n; i++) {
            var s = i.ToString();
            tbl[s.First() - '0'][s.Last() - '0'] += 1;
        }

        long c = 0;
        for (int i = 0; i <= 9; i++) {
            for (int j = 0; j <= 9; j++) {
                c += tbl[i][j] * tbl[j][i];
            }
        }

        return c;
    }

}


Measured memory_bytes: 15428
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	var input = input.trim().split("\n")[1].split(" ");
	var ans = 0;
	for(var i=0;i<input.length;i++){
	    if(input[i] == input[i-1]){
	        ans++;
	        input[i] = -1;
	    }
	}
    console.log(ans);
}


//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <cassert>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <cassert>

using namespace std;

using int64 = long long;

/////////////////////
// Code starts here//
/////////////////////


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

    int K;
    string S;

    cin >> K >> S;

    if (S.size() <= K) {
        cout << S << "\n";
    } else {
        cout << S.substr(0, K) << "...\n";
    }

    return 0;
}


Measured memory_bytes: 3656
n, total = map(int, input().split())

x=0
y=0
z=0

found = False
for i in range(int(total / 10000 + 1)):
  x = i
  for j in range(int((total - 10000 * i) / 5000 + 1)):
    y = j
    z = n - x - y
    sum = 10000 * x + 5000 * y + 1000 * z
    if sum == total:
      found = True
      break

  if found == True:
    break

if found == False:
  x = -1
  y = -1
  z = -1

print("{} {} {}".format(x, y, z))

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int a,b;
    cin>>a>>b;

    int n=1, ans=0;
    while(n<b){
        n+=a-1;
        ans++;
    }
    
    cout<<ans<<endl;
}

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

using namespace std;
typedef long long ll;
typedef long int lt;
typedef vector<ll> vi;
typedef vector<int> vin;
typedef pair<ll,ll> pll;
typedef pair<int,int> pin;
#define all(a) a.begin(),a.end()
#define rep(i,a,b) for(int i=a;i<b;++i)
#define f(i,b) for(int i=0;i<b;++i)
#define per(i,a,b) for(int i=a;i>=b;--i)
#define test(t) int t; cin>>t; while(t--) solve()
#define endl "\n"
#define p1 cout<<"YES"<<endl
#define p0 cout<<"NO"<<endl
#define fst ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

const int mod=1e9+7;

ll mod_pow(ll a,ll n,ll mod)	//(a^n)%mod
{	ll res=1;
	while(n){	if(n&1)	res=(res*a)%mod; n/=2; a=(a*a)%mod;	}
	return res;
}

void solve();

int main()
{
    fst;
    //test(t);
     solve();
}

/**********************<="Actual code strats here"=>*****************************/

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

    vi a(n);
    rep(i,0,n) cin>>a[i];

    ll ans=0;
    for(int i=0;i+1<n;i+=2)
    {
        ans^=(a[i]^a[i+1]);
    }

    rep(i,0,n) cout<<(a[i]^ans)<<" ";
    cout<<endl;
}

Measured memory_bytes: 4772
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    for(int i = 0; i < n; i++) {
        cin >> v[i];
    }
    auto check = [&](double x) {
        int ret = 0;
        for(int i = 0; i < n; i++) {
            ret += ceil(v[i] / x) - 1;
        }
        return ret;
    };
    double l = 0, r = 1e9;
    for(int i = 0; i < 300; i++) {
        double mid = (l + r) / 2;
        if(check(mid) <= k) r = mid;
        else l=mid;
    }
    cout << (int)ceil(l);
    return 0;
}

Measured memory_bytes: 3948
# Acceptance of input

import sys

f_i = sys.stdin

V, E = map(int, f_i.readline().split())

adj = [[] for i in range(V)]

for l_i in f_i:
    s, t = map(int, l_i.split())
    adj[s].append(t)
    adj[t].append(s)


# dfs traverse

prenum = [1] + [None] * (V - 1)
parent = [0] * V
lowest = [V] * V

import collections

path = collections.deque()
path.append(0)

cnt = 1

while path:
    u = path[-1]
    adj_v = adj[u]
    for v in adj_v:
        if not prenum[v]:
            parent[v] = u
            path.append(v)
            cnt += 1
            prenum[v] = cnt
            adj[u].remove(v)
            adj[v].remove(u)
            break
    if u == path[-1]:
        for v in adj_v:
            lowest[u] = min(lowest[u], prenum[v])
        p = parent[u]
        lowest[p] = min(lowest[u], lowest[p])
        path.pop()


# output

ans = set()

for u in range(1, V):
    p = parent[u]
    if prenum[p] <= lowest[u]:
        ans.add(p)

if parent.count(0) >= 3:
    ans.add(0)
else:
    ans.discard(0)

ans = list(ans)
ans.sort()

if ans:
    print(*ans, sep = '\n')

Measured memory_bytes: 13200
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long[][] ko = new long[19][19];
    long t = 0;
    for(int i = 0; i < n; i++) {
      double A = sc.nextDouble();
      A = (double)Math.pow(10, 9) * A;
      long c = (long)(A + 0.01);
      int x = 0;
      int y = 0;
      while((c % 2) == 0) {
        x++;
        c /= (long)2; 
      }
      while((c % 5) == 0) {
        y++;
        c /= (long)5; 
      }
      if(x > 18) x = 18;
      if(y > 18) y = 18;
      ko[x][y]++;
      if((x >= 9) && (y >= 9)) t++;
    }
    long ans = 0;
    for(int i = 0; i < 19; i++) {
      for(int j = 0; j < 19; j++) {
        for(int a = 0; a < 19; a++) {
          for(int b = 0; b < 19; b++) {
            if(((i + a) >= 18) && ((j + b) >= 18)) {
              ans += (ko[i][j] * ko[a][b]);
            }
          }
        }
      }
    }
    ans -= t;
    ans /= (long)2;
    System.out.println(ans);
  }
}

Measured memory_bytes: 62976
#include <stdio.h>        
#include <stdlib.h>          
int puzz[3][3];
int temp[3][3];
int dx[4] = { 0, 1, 0,-1};
int dy[4] = { 1, 0,-1, 0};
 
void empty(int *x, int *y){
  int i,j;
  for (i = 0; i < 3; ++i){
    for (j = 0; j < 3; ++j){
      if (!puzz[i][j]){
	*x = j;
	*y = i;
	return;
      }
    }
  }
}
void swap(int *a, int *b){
  int temp = *a;
  *a = *b;
  *b = temp;
}
 
int cal(){
  int sum = 0,i,a;
  for (i = 0; i < 9; ++i){
   a = puzz[i / 3][i % 3];
    if (a){
      a--;
      sum += abs(i / 3 - a / 3) + abs(i % 3 - a % 3);
    }
  }
  return sum;
}
 
int dfs(int x, int y, int p, int dep, const int lim){
  int h,i,nx,ny,res;
    h = cal();
  if(h == 0) return dep;
 
  if(dep + h > lim) return -1;
 
  for(i = 0; i < 4; ++i){
    nx = x + dx[i];
    ny = y + dy[i];
 
    if(p != -1 && i == (p + 2) % 4) continue;
 
    if(0 <= nx && nx < 3 && 0 <= ny && ny < 3){
      swap(&puzz[y][x], &puzz[ny][nx]);
      res = dfs(nx, ny, i, dep + 1, lim);
      if (res != -1) return res;
      swap(&puzz[y][x], &puzz[ny][nx]);
    }
  }
  return -1;
}
 
int main(){
  int i,j,ans,x,y,l;
  for(i = 0; i < 3; ++i){
    for(j = 0; j < 3; ++j)scanf("%d", &puzz[i][j]);
  }
 
  
  empty(&x, &y);
  
  for(l = 0; l < 100; ++l){
    for(i = 0; i < 3; ++i){
      for(j = 0; j < 3; ++j) temp[i][j] = puzz[i][j];
    }
   ans = dfs(x, y, -1, 0, l);
    if(ans != -1){
      printf("%d\n", ans);
      break;
    }
    for(i = 0; i < 3; ++i){
      for(j = 0; j < 3; ++j) puzz[i][j] = temp[i][j];
    }
 
    ans = -1;
    if(l == 99) printf("%d\n", ans);
  }
  return 0;
}



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

int hit(string a,string b){
	int res = 0;
	for(int i=0;i<4;i++){
		if(a[i] == b[i]) res++;
	}
	return res;
}

int blow(string a,string b){
	int res = 0;
	for(int i=0;i<4;i++){
		for(int j=0;j<4;j++){
			if(i != j && a[i] == b[j]){
				res++;
				break;
			}
		}
	}
	return res;
}

int main(void){
	string a,b;

	while(cin>>a>>b, a!="0"){
		cout<<hit(a,b)<<" "<<blow(a,b)<<endl;
	}

	return 0;
}

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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

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

  int x, n;
  cin >> x >> n;
  set<int> s;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    s.insert(a);
  }

  int ans = -1000;
  for (int k = -1000; k <= 1000; k++) {
    if (s.find(k) != s.end()) continue;
    if (abs(k - x) < abs(ans - x)) {
      ans = k;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3656
#include<iostream>
using namespace std;
int main(){
  int a, b, c;
  cin >> a >> b >> c;
  int n = 3;
  if(a == b) --n;
  if(b == c) --n;
  if(c == a) --n;
  if(a == b && b == c) ++n;
  cout << n;
}

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

using namespace std;
using int64 = long long;
const int mod = 1e9 + 7;
//const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

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

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

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}


int main() {
  int N;
  cin >> N;
  vector< int64 > A(N), B(N);
  for(int i = 0; i < N; i++) {
    cin >> A[i] >> B[i];
    A[i] *= 2;
    B[i] *= 2;
  }
  vector< int64 > xs{A}, ys{B};
  sort(begin(xs), end(xs));
  sort(begin(ys), end(ys));
  int64 low = N & 1 ? xs[N / 2] : (xs[N / 2] + xs[N / 2 - 1]) / 2;
  int64 high = N & 1 ? ys[N / 2] : (ys[N / 2] + ys[N / 2 - 1]) / 2;
  if(N % 2 == 0) cout << (high - low + 1) << "\n";
  else cout << (high - low + 2) / 2 << "\n";
}




Measured memory_bytes: 9484
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        if (b - a == c - b) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}


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

int main(){
	int n,k;
	cin>>n>>k;
	vector<int>a(n),dp(n,1e9+7);
	for(auto &i:a)cin>>i;
	dp[0] = 0;
	for(int i=1;i<n;i++)for(int j=1;j<=k;j++)if(i-j>=0)dp[i]=min(dp[i],dp[i-j]+abs(a[i]-a[i-j]));
	cout<<dp[n-1]<<endl;
}


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

int main(){
    int n;
    cin >> n;
    bool possible=true;
    vector<int> t(n+1,0);
    vector<int> x(n+1,0);
    vector<int> y(n+1,0);
    for(int i=0; i<n; i++){
        cin >> t.at(i+1) >> x.at(i+1) >> y.at(i+1);
    }
    for(int i=0; i<n; i++){
        int dt,dx,dy;
        dt=t.at(i+1)-t.at(i);
        dx=abs(x.at(i+1)-x.at(i));
        dy=abs(y.at(i+1)-y.at(i));
        if(dt < dx+dy) possible=false;
        if((dt-dx-dy)%2 == 1) possible=false; 
    }
    if(possible) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 4576
#include <iostream>
#include <cmath>

int main(){
   int N, M;
   std::cin >> N >> M;
   int s[M], c[M];
   bool N_flag = false;
   for(int i=0; i<M; ++i){
      std::cin >> s[i] >> c[i];
      s[i] = N - s[i] + 1;
      if(s[i]==N) N_flag = true;
   }
   int ans = 0;
   bool flag[N];
   std::fill(flag, flag+N, false);
   for(int i=0; i<M; ++i){
      if(flag[s[i]-1]) continue;
      for(int j=i+1; j<M; ++j){
	 if(s[i]==s[j] && c[i]!=c[j]){
	    std::cout << -1 << std::endl;
	    return 0;
	 }
      }
      if(N>1 && s[i]==N && c[i]==0) {
	 std::cout << -1 << std::endl;
	 return 0;
      }
      ans += c[i] * std::pow(10, s[i]-1);
      flag[s[i]-1] = true;
   }
   if(!N_flag && N>1) ans += std::pow(10, N-1);
   std::cout << ans << std::endl;
   return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(buffer.readLine());
        long mod = (int)1e9+7;
        long [] pow10 = new long[n+1];
        long [] pow8 = new long[n+1];
        long [] pow9 = new long[n+1];
        pow8[0] = pow9[0] = pow10[0] = 1;
        for (int pos = 1; pos <= n; pos++) {
            pow8[pos] = (pow8[pos-1]%mod*8)%mod;
            pow9[pos] = (pow9[pos-1]%mod*9)%mod;
            pow10[pos] = (pow10[pos-1]%mod*10)%mod;
        }
        long ans = (pow10[n]%mod - (pow8[n]+(pow9[n]%mod - pow8[n]%mod + mod)*2%mod)%mod + mod)%mod;
        System.out.println(ans);
    }
}


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

const int mxN = 1e3 + 2, mxS = 2e4 + 2;

class Block
{
public:
    Block() {}
    Block(int _weight, int _solid, int _value) {weight = _weight; solid = _solid; value = _value;}

    int weight, solid, value;
};

int n;
long long dp[mxN][mxS];
Block blocks[mxN];

bool cmp(Block& a, Block& b)
{
    return (a.solid + a.weight) < (b.solid + b.weight);
}

int main()
{
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        int a, b, c;
        cin >> a >> b >> c;
        blocks[i] = Block(a, b, c);
    }

    sort(blocks, blocks + n, cmp);

    long long ret = 0;
    for (int i = 0; i < n; i++)
    {
        for (int w = 0; w < mxS; w++)
        {
            // calc dp[i][w]. 
            if (i > 0)
            {
                dp[i][w] = dp[i - 1][w];
                if (min(w - blocks[i].weight, blocks[i].solid) >= 0)
                    dp[i][w] = max(dp[i][w], dp[i - 1][min(w - blocks[i].weight, blocks[i].solid)] + blocks[i].value);
            }
            if (i == 0 && w == blocks[i].weight)
            {
                dp[i][w] = blocks[i].value;
            }
            ret = max(ret, dp[i][w]);
        }
    }
    cout << ret << endl;
}

Measured memory_bytes: 159740
N = int(input())
X = list(map(int, (input().split())))

distance = lambda Xi, P: (Xi - P) ** 2

X_min = min(X)
X_max = max(X)

answer = None
for P in range(X_min, X_max + 1):
    total = 0
    for Xi in X:
        total += distance(Xi, P)
    answer = min(total, answer) if answer is not None else total

print(answer)


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

#define forn(l, r) for(int i = l; i < (r); ++i)
#define forj(l, r) for(int j = l; j < (r); ++j)
#define TAM 1000100
#define SYNC ios::sync_with_stdio(0);
#define $ << ' ' <<
#define F first
#define S second
#define endl '\n'


using namespace std;

using ll = long long int;
using ii = pair<int, int>;
using vii = vector<ii>;
using vi = vector<int>;
using graph = vector<vi>;
const int INF = 0x3f3f3f3f;
const int MAXN = 112345;
const ll mod = 1000000007;



int main() {
    //SYNC
    string a; int b;
    int n;
    cin >> n;
    vector<tuple<string, int, int>> rest;
    for (int i = 0; i < n; i++) {
        cin >> a >> b;
        b *= -1;
        rest.push_back(make_tuple(a, b, i+1));
    }
    sort(rest.begin(), rest.end());
    for (auto i : rest) {
        cout << get<2>(i) << endl;
    }
    return 0;
}


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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

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

void solve() {
  string s;
  cin >> s;
  sort(all(s));
  if (s == "abc") cout << "Yes" << '\n';
  else cout << "No" << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) solve();
}


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

int main()
{
    int t, sum = 0, sum1 = 0, sum2 = 0, sum3 = 0;
    string s;
    cin>>t;
    while(t--)
    {
        cin>>s;
        if(s == "AC")
        {
            sum++;
        }
        else if(s == "WA")
        {
            sum1++;
        }
        else if(s == "TLE")
        {
            sum2++;
        }
        else
        {
            sum3++;
        }
    }
    cout<<"AC x "<<sum<<endl;
    cout<<"WA x "<<sum1<<endl;
    cout<<"TLE x "<<sum2<<endl;
    cout<<"RE x "<<sum3<<endl;
    return 0;
}

Measured memory_bytes: 3524
#include<stdio.h>

int main(){
    int n;
    int mod;
    int flag = 0;
    int answer;

    scanf("%d", &n);

    int i;

    for(i = 1; i < 10; i++){
        mod = n % i;
        if(mod == 0){
            answer = n / i;
            if(answer < 10){
                flag++;
            }
        }
    }

    if(flag > 0){
        printf("Yes");
    }else{
        printf("No");
    }

    return 0;
}

Measured memory_bytes: 128
n = int(input())
d = {'M':0,'A':0,'R':0,'C':0,'H':0}
march = 'MARCH'
for _ in range(n):
    s = input()
    if s[0] in march:
        d[s[0]] += 1
s = 0
for i in range(3):
    for j in range(i+1,4):
        for k in range(j+1,5):
            s += d[march[i]]*d[march[j]]*d[march[k]]
print(s)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ll mod2 = 998244353;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  string s; cin >> s;
  vector<vector<int>> cnt(3, vector<int>(n+1));
  rep(i, n) {
    rep(j, 3) cnt[j][i+1] = cnt[j][i];
    if(s[i] == 'R') {
      cnt[0][i+1]++;
    } else if(s[i] == 'G') {
      cnt[1][i+1]++;
    } else {
      cnt[2][i+1]++;
    }
  }
  ll ans = 0;
  rep(i, n) REP(j, i+1, n) {
    if(s[i] == s[j]) continue;
    if(s[i] != 'R' && s[j] != 'R') {
      ans += cnt[0][n] - cnt[0][j+1] - (2*j-i < n && s[2*j-i] == 'R');
    } else if(s[i] != 'G' && s[j] != 'G') {
      ans += cnt[1][n] - cnt[1][j+1] - (2*j-i < n && s[2*j-i] == 'G');
    } else if(s[i] != 'B' && s[j] != 'B') {
      ans += cnt[2][n] - cnt[2][j+1] - (2*j-i < n && s[2*j-i] == 'B');
    }
  }
  cout << ans << endk;
  return 0;
}


Measured memory_bytes: 3696
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }

int main() {
    string s;
    cin >> s;
    int n = int(s.size());
    int co = 1;
    for (int i = 0; i < n-1; i++) {
        if (s[i] != s[i+1]) co++;
    }
    cout << co-1 << endl;
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<map>
using namespace std;
using ll = long long;

map<int, int> prime_factor(int n){
	map<int, int> res;
	for (int i = 2; i * i <= n; i++) while (n % i == 0) res[i]++, n /= i;
	if (n != 1) res[n]++;
	return res;
}

int main(){
	int n;
	cin >> n;
	map<int, int> mp;
	for (int i = 1; i <= n; i++){
		map<int, int> p = prime_factor(i);
		for (int j = 1; j <= i; j++) mp[j] += p[j];
	}
	int ans = 0, p = 0, q = 0;
	//p^74
	for (int i = 1; i <= n; i++){
		if (mp[i] >= 74) ans++;
	}
	//p^24*q^2
	for (int i = 1; i <= n; i++){
		if (mp[i] >= 24) p++;
		if (mp[i] >= 2) q++;
	}
	ans += p * (q - 1);
	p = q = 0;
	//p^14*q^4
	for (int i = 1; i <= n; i++){
		if (mp[i] >= 14) p++;
		if (mp[i] >= 4) q++;
	}
	ans += p * (q - 1);
	p = q = 0;
	//p^4*q^4*r^2
	for (int i = 1; i <= n; i++){
		if (mp[i] >= 4) p++;
		if (mp[i] >= 2) q++;
	}
	ans += p * (p - 1) * (q - 2) / 2;
	cout << ans << endl;
}

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

public class Main {
	Scanner sc = new Scanner(System.in);

	void run() {
		for (;;) {
			int n = sc.nextInt();
			int m = sc.nextInt();
			if ((n | m) == 0) return;
			double[][] g = new double[n][n];
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < n; j++) {
					g[i][j] = sc.nextDouble();
				}
			}

			double[][] dp = new double[2][n];
			for (int i = 0; i < n; i++) dp[0][i] = 1;
			for (int i = 0; i < m - 1; i++) {
				for (int j = 0; j < n; j++) {
					for (int k = 0; k < n; k++) {
						dp[(i + 1) & 1][k] = Math.max(dp[(i + 1) & 1][k], dp[i & 1][j] * g[j][k]);
					}
				}
			}

			double max = 0;
			for (int i = 0; i < n; i++) max = Math.max(max, dp[(m - 1) & 1][i]);
			BigDecimal bd = new BigDecimal(max);
			System.out.println(bd.setScale(2, BigDecimal.ROUND_HALF_UP));
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 72764
#include<bits/stdc++.h>
using namespace std;
map<string, int> mp;
const int maxn = 1e5;
string str[maxn+5];
int main() {
	int n;
	cin >> n;
	int flag = 1;
	for(int i = 1; i <= n; i++) {
		cin >> str[i];
	}
	mp[str[1]] = 1;
	for(int i = 2; i <= n; i++) {
		char x = str[i - 1][str[i - 1].size()-1];
		char y = str[i][0];
		if(x != y || mp[str[i]] == 1) {
			flag = 0;
			break;
		}
		mp[str[i]] = 1;
	}
	if(flag) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}

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

const int LIMIT = 10000000;

char in[LIMIT], *p = in;

__inline int nextInt(void) {
		
	register int res = 0;
	register bool neg = false;
	
	while (*p < '0' || *p > '9')
		 if (*p++ == '-')neg ^= 1;
	
	while (*p >= '0' && *p <= '9')
		res = res * 10 + *p++ - '0';
		
	return neg ? -res : res;
		
}

const int N = 100005;

int n, m;

struct Node {
	
	int lt, rt, sum;
	
}tree[N << 2];

void buildTree(int p, int l, int r) {
	
	tree[p].lt = l;
	tree[p].rt = r;
	tree[p].sum = 0;
	
	if (l == r)return;
	
	int mid = (l + r) >> 1;
	
	buildTree(p << 1, l, mid);
	buildTree(p << 1 | 1, mid + 1, r);
	
	return;
	
}

int query(int p, int l, int r) {
	
	if (tree[p].lt == l && tree[p].rt == r)
		return tree[p].sum;
		
	int mid = (tree[p].lt + tree[p].rt) >> 1;
	
	if (r <= mid)
		return query(p << 1, l, r);
	if (l > mid)
		return query(p << 1 | 1, l, r);
	return query(p << 1, l, mid) + query(p << 1 | 1, mid + 1, r);
	
}

void add(int p, int x, int y) {
	
	tree[p].sum += y;
	
	if (tree[p].lt == tree[p].rt)
		return;
		
	int mid = (tree[p].lt + tree[p].rt) >> 1;
	
	if (x <= mid)
		add(p << 1, x, y);
	else
		add(p << 1 | 1, x, y);
		
	return;
	
}

signed main(void) {
	
	fread(p, 1, LIMIT, stdin);
	
	n = nextInt();
	m = nextInt();
	
	buildTree(1, 1, n);
	
	for (register int i = 1; i <= m; ++i) {
		
		int k = nextInt();
		int x = nextInt();
		int y = nextInt();
		
		if (k)
			printf("%d\n", query(1, x, y));
		else
			add(1, x, y);
			
	}
	
	return 0;
		
}

Measured memory_bytes: 7232
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <deque>
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
void print(vec v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(vecll v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}


#define INF 1e9+7
#define LLINF 1e18+7
const ll MOD=1e9+7;
const int N=500000;


main(){
    string s;
    cin>>s;
    rep(i,s.size()-1){
        if(s[i]==s[i+1]){
            cout<<i+1<<" "<<i+2<<endl;
            return 0;
        }
        if(i<s.size()-3&&s[i]==s[i+2]){
            cout<<i+1<<" "<<i+3<<endl;
            return 0;
        }
    }
    cout<<"-1 -1";return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <algorithm>
using namespace std;
char str[10][10]={};
int main(){
  int h,w,x=1,y=1;
  scanf("%d %d",&h,&w);
  for(int i=1;i<=h;i++){
    scanf("%s",str[i]+1);
  }
  do{
    str[y][x]='.';
    if(str[y][x+1]=='#'){
      x++;
    }
    else if(str[y+1][x]=='#'){
      y++;
    }
    else{
      printf("Impossible");
      return 0;
    }
  }while(x!=w||y!=h);
  str[h][w]='.';
  for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++){
      if(str[i][j]=='#'){
        printf("Impossible");
        return 0;
      }
    }
  }
  printf("Possible");
  return 0;
}


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

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


Measured memory_bytes: 256
/*
  Vivek Rathi
  CSE 2nd Year
  MNNIT
*/
#include<bits/stdc++.h>
using namespace std;
#define M 1000000007
#define ll long long int
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define present(c,x) ((c).find(x) != (c).end())
#define null NULL
#define mp make_pair
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define inf 1e17
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
int main()
{
	boost
	ll n,k;
	cin>>n>>k;
	ll h[n];
	for(ll i=0;i<n;i++) cin>>h[i];
	ll dp[n];
	for(ll i=0;i<n;i++) dp[i]=inf;
	dp[n-1]=0;
	for(ll i=n-2;i>=0;i--)
	{
		for(ll j=i+1;j<n&&j<i+k+1;j++)
		{
			dp[i]=min(dp[i],dp[j]+abs(h[j]-h[i]));
		}
	}
	cout<<dp[0]<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 4e18;
const long double EPS = 1e-10;

int main() {
  int n, K;
  cin >> n >> K;
  vector<pair<int, int>> p(n);
  rep(i, n) cin >> p[i].first >> p[i].second;

  vector<int> x(n), y(n);
  rep(i, n) {
    x[i] = p[i].first;
    y[i] = p[i].second;
  }
  sort(x.begin(), x.end());
  sort(y.begin(), y.end());

  vector<vector<int>> c(n + 1, vector<int>(n + 1, 0));
  rep(i, n) {
    rep(j, n) {
      rep(k, n) {
        if (p[i].first == x[j] && p[i].second == y[k]) {
          c[j + 1][k + 1]++;
        }
      }
    }
  }
  rep(i, n) {
    rep(j, n) {
      c[i + 1][j + 1] += c[i + 1][j] + c[i][j + 1] - c[i][j];
    }
  }

  ll ans = INF;
  rep(i, n) {
    FOR(j, i, n) {
      rep(k, n) {
        FOR(l, k, n) {
          if (c[j + 1][l + 1] - c[i][l + 1] - c[j + 1][k] + c[i][k] >= K) {
            ll rx = max(1, x[j] - x[i]), ry = max(1, y[l] - y[k]);
            ans = min(ans, rx * ry);
          }
        }
      }
    }
  }
  cout << ans << endl;

  






  
  return 0;
}

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int n;cin >> n;
    int a, b;
    if(n == 2){
        cin >> a >> b;
        cout << a+b << endl;
    }else{
        cout << "Hello World" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,m,k,a[300010],b[300010],x[300010],y[300010],ans,c,d,f,aa,bb;
int main(){
	cin>>n>>m>>k;
	for (int i=0;i<k;i++){
		cin>>x[i]>>y[i];
a[x[i]]++;
b[y[i]]++;
	}

	for(int i=1;i<=n;i++)
	c=max(c,a[i]);
for(int i=1;i<=m;i++)
d=max(d,b[i]);

for(int i=1;i<=n;i++){
if(a[i]==c)
aa++;
}


for(int i=1;i<=m;i++){
if(b[i]==d)
bb++;
}

for(int i=0;i<k;i++){
if(a[x[i]]==c&&b[y[i]]==d)
f++;

}
if(f<aa*bb)
cout<<c+d<<endl;
else
cout<<c+d-1<<endl;

	return 0;
}


Measured memory_bytes: 13000
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Map<String, Integer> map = new HashMap<>();
		for (int i = 0; i < n; i++) {
			String s = sc.next();
			if (map.containsKey(s)) {
				map.put(s, map.get(s) + 1);
			} else {
				map.put(s, 1);
			}
		}
		
		int max = 0;
		for (Integer i : map.values()) {
			max = Math.max(max, i);
		}
		
		List<String> list = new ArrayList<>();
		for (Map.Entry<String, Integer> e : map.entrySet()) {
			if (e.getValue() == max) {
				list.add(e.getKey());
			}
		}
		Collections.sort(list);
		for (String string : list) {
			System.out.println(string);
		}
		
	}
}




Measured memory_bytes: 82604
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define int               long long
#define fr                first
#define sc                second
#define vc                vector
#define endl              '\n'
#define pii               pair<int,int>
#define msi               map<string,int>
#define mii               map<int,int>
#define psi               pair<string,int>
#define pis               pair<int,string>
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define LSB(i)            ((i)&-(i))

template<typename T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

string s, t;
const int N = 3e3 + 5;
int dp[N][N];

int dynamic(int pos1, int pos2)
{
    if (pos1 >= s.size() || pos2 >= t.size())
        return 0;
    if (dp[pos1][pos2] != -1)
        return dp[pos1][pos2];
    int ans = INT_MIN;
    if (s[pos1] == t[pos2])
        ans = max(ans, dynamic(pos1 + 1, pos2 + 1) + 1);
    else
        ans = max(dynamic(pos1 + 1, pos2 + 1), max(dynamic(pos1 + 1, pos2), dynamic(pos1, pos2 + 1)));
    dp[pos1][pos2] = ans;
    return ans;
}

void solve()
{
    cin >> s >> t;
    mem1(dp);
    int haha =  dynamic(0, 0);
    string ee = "";
    for (int i = 0; i < s.size(); i++)
    {
        for (int j = 0; j < t.size(); j++)
        {
            if (dp[i][j] == haha && haha > 0 && s[i] == t[j])
            {
                ee += s[i];
                haha--;
                break;
            }
        }
    }
    cout << ee;
}
signed main() {
    ios_base::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t = 1;
    //cin>>t;
    while (t--) solve();
    return 0;
}

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

int main() {
	int n; cin >> n;
	vector<int>a1(n), a2(n);
	for (auto&& x : a1)cin >> x;
	for (auto&& x : a2)cin >> x;
	for (int i = 0; i < n - 1; i++)a1[i + 1] += a1[i];
	for (int i = 0; i < n - 1; i++)a2[i + 1] += a2[i];
	int ans = a1[0] + a2[n - 1];
	for (int i = 1; i < n; i++) {
		int tmp = a1[i] + a2[n - 1] - a2[i - 1];
		if (ans < tmp)ans = tmp;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/python3
# import bisect
# from collections import Counter, deque, OrderedDict, defaultdict
# from copy import copy, deepcopy # pythonのみ．copyは1次元，deepcopyは多次元．
# from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
# from functools import reduce
# from heapq import heapify, heappop, heappush
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np  # Pythonのみ！
# from operator import xor
# import re
# from scipy.sparse.csgraph import connected_components  # Pythonのみ！
# ↑cf.  https://note.nkmk.me/python-scipy-connected-components/
# from scipy.sparse import csr_matrix
# import statistics # Pythonのみ
# import string
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    # https://stackoverflow.com/a/33356284
    import itertools
    
    
    def primes(n):
        """ Input n>=6, Returns a list of primes, 2 <= p < n """
        zero = bytearray([False])
        size = n//3 + (n % 6 == 2)
        sieve = bytearray([True]) * size
        sieve[0] = False
        for i in range(int(n**0.5)//3+1):
            if sieve[i]:
                k = 3*i+1 | 1
                start = (k*k+4*k-2*k*(i & 1))//3
                sieve[(k*k)//3::2*k] = zero*((size - (k*k)//3 - 1) // (2 * k) + 1)
                sieve[start::2*k] = zero*((size - start - 1) // (2 * k) + 1)
        ans = [2, 3]
        poss = itertools.chain.from_iterable(
            itertools.zip_longest(*[range(i, n, 6) for i in (1, 5)]))
        ans.extend(itertools.compress(poss, sieve))
        return ans
    n=int(input())
    p=primes(55555)
    l=[]
    for i in p:
        if i%5==1:
            l.append(i)
    print(*l[:n])

    
resolve()

Measured memory_bytes: 67696
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
signed main(){
  vi A={1,3,5,7,8,10,12};
  int X,Y;
  cin>>X>>Y;
  int x=3,y=3;
  rep(i,0,A.size()){
    if(A[i]==X)
      x=1;
    if(A[i]==Y)
      y=1;
    }
  if(2==X)
    x=2;
  if(2==Y)
    y=2;
  string ans="No";
  if(x==y)
    ans="Yes";
  cout<<ans;
  }


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

using namespace std;
typedef long long ll;
typedef long double ld;

ll n, m, q, l, r, M[505][505];

int main()
{
	cin >> n >> m >> q;
	for (int i = 1; i <= m; i++)
	{
		cin >> l >> r;
		for (int j = 1; j <= l; j++)
			M[j][r]++;
	}
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
			M[i][j] += M[i][j - 1];
	for (int i = 1; i <= q; i++)
	{
		cin >> l >> r;
		cout << M[l][r] << '\n';
	}
	return 0;
}


Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int Lim = 1e4 + 10;
int n;
vector <ll> V;
ll S(ll x) {
	ll res=0;
	while(x) {
		res+=x%10;
		x/=10;
	}
	return res;
}
ll merge(ll x,int k) 
{
	while(k--) 
		x=x*10+9;
	return x;
}
double calc (ll x) {
	return (double) x/S(x);
}
void Work() {
	for(int i=1;i<=9;++i) 
		V.push_back(i);
	ll x=1;int k=1;
	while(merge(x,k) <=1e15) 
	{
		ll now=merge(x,k) ;
		ll nxt=merge(x+1,k) ;
		if(calc(now) <= calc(nxt)) 
		{
			x++;
			V.push_back(now) ;
		}
		else {
			x/=10;
			k++;
		}
	}
	for(int i=0;i<n;++i) 
		cout<<V[i]<<endl;
}
int main() {
//	freopen("D.in","r",stdin);
//	freopen("D.out","w",stdout);
	scanf("%d",&n);
	Work() ;
	return 0;
}


Measured memory_bytes: 256
// finish date: 2018/07/11
#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<double> vd;
typedef vector<vector<double>> vvd;
typedef vector<vector<vector<double>>> vvvd;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, pair<int, int>> plii;
const int bigmod = 1000000007;
const int INF = 1050000000;


int main() {
    int N;
    string S;
    cin >> N >> S;
    int cnt = 0;
    string s1 = "", s2 = "";
    rep(i, N) {
        if (S[i] == '(') cnt++;
        else cnt--;
        if(cnt < 0){
            s1+='(';
            cnt = 0;
        }
    }
    rep(i,cnt){
        s2+=')';
    }

    cout << s1 + S + s2 << endl;

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cctype>
#include <cstdio>
using namespace std;

int main () {
    string s;
    getline(cin, s);
    
    for (int i = 0; i < s.length(); i++) {
        if (islower(s[i])) {
            printf("%c",s[i]-32);
        } else if(isupper(s[i])) {
            printf("%c",s[i]+32);
        } else {
            printf("%c",s[i]);
        }
    }
    cout << endl;
}


Measured memory_bytes: 3144