akhauriyash/Code-Regression huggingface dataset:
n = int(input())
xyh = [list(map(int, input().split())) for _ in range(n)]

test = [(x,y,h) for x,y,h in xyh if h > 0]
test = test[0]
for cx in range(101):
    for cy in range(101):
        # h > 0で中心座標の高さを見積もる
        x,y,h = test
        H = h + abs(x - cx) + abs(y - cy)

        # 全データに適合するか        
        if all([max(H - abs(x - cx) - abs(y - cy), 0) == h for x,y,h in xyh]):
            print(cx, cy, H)
            exit()

Measured memory_bytes: 9192
#include <bits/stdc++.h>
using namespace std;
#define REP(a,b) for(long long a = 0;a < b;++a)
long long gcd(int a,int b){
    if(b == 0) return a;
    return gcd(b,a%b);
}
int main(){
    int a,b;
    cin >> a >> b;
    cout << a + b + 1 - gcd(a,b) << endl;
    return 0;
}


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

int main() {
	long long W , H,x,y;
	cin >> W>>H>>x>>y; 
	double s = W * H / 2.0;
	int t = 0;
	if (2*x ==W&&2*y==H) {
		t = 1;
	}
	printf("%.10f %d\n", s,t);
	return 0;
}


Measured memory_bytes: 3760
#include <stdio.h>
#include <stdlib.h>

int main(void) {
    int n,m,k;
    int *a;
    a=(int*)malloc(210000*sizeof(int));
    (void)scanf("%d",&n);
    k=n-1;
    while(k){
        (void)scanf("%d",&m);
        a[m]++;
        k--;
    }
    for(m=1;m<=n;m++){
        printf("%d\n",a[m]);
    }
    return 0;
}

Measured memory_bytes: 2484
#pragma GCC optimize("Ofast")
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <set>
#include <map>
#include <queue>
#include <cstring>
#include <cmath>
#include <bitset>
#include <iomanip>
//#include <unordered_map>

using namespace std;

template<typename T> void uin(T &a, T b) {if (b < a) a = b;}
template<typename T> void uax(T &a, T b) {if (b > a) a = b;}


#define int long long
#define double long double
#define right right228
#define mp make_pair
#define all(v) v.begin(), v.end()

const int MOD = 1e9 + 7;

int mod(int x) {
	x %= MOD;
	if (x < 0) x += MOD;
	return x;
}

int fp(int a, int b) {
	int res = 1;
	for (; b; b >>= 1, a = mod(a * a)) {
		if (b & 1) res = mod(res * a);
	}
	return res;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); ++i) {
		if (s[i] == '?') s[i]='D';
	}
	cout << s << endl;
	return 0;
}

/*

1
3 2 2
1 2 3 1 
2 3 1 0
1
1 3

01.a
3 3 4
...
.#.
...
1 1 1 3 8 
1 3 1 3 64
2 1 1 3 24
2 1 3 3 40

3 4 3
1 2
2 2
2 4
3
1 1 1 4
2 2 3 3
3 2 2 4

*/


Measured memory_bytes: 3488
import math
n, d = map(int, input().split())
xy = [list(map(int, input().split())) for i in range(n)]
ans = 0
for i in range(len(xy)):

    # print(math.sqrt(pow(xy[i][0], 2) + pow(xy[i][1], 2)))
    if math.sqrt(pow(xy[i][0], 2) + pow(xy[i][1], 2)) <= d:
        ans += 1
print(ans)

Measured memory_bytes: 45448
# -*- coding: utf-8 -*-

def main(N):
    ans = 0
    for i in range(1,N+1):
        count = 0
        n = i
        while(n%2==0):
            count += 1
            n /= 2
        ans = max(ans, count)
    
    print(2**ans)
            
    

if __name__ == '__main__':
    N = int(input())
    main(N)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <string.h>
#define rep(i, n) for(int i = 0; i<(n); i++)
using namespace std;
typedef long long ll;
static const int MAX = 200000; 
//pi = 3.14159265358979323846

int main() {

    int n, k, q;
    cin >> n >> k >> q;

    int wa[n];

    rep(i, n){
        wa[i] = k;
    }
    rep(i, q){
        int kazu;
        cin >> kazu;
        wa[kazu - 1]++;
    }
    rep(i, n){
        wa[i] -= q;
        if(wa[i] > 0){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }

}




Measured memory_bytes: 1024
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <queue>
using namespace std;
#define N 1000

int main(){
    int n;
    cin>>n;
    if (n%2==1) cout<<(n+1)/2<<endl;
    else cout<<n/2<<endl;
}

Measured memory_bytes: 256
unittest
{
	assert( [ "4", "6 5 6 8" ].parse.expand.solve == 3 );
	assert( [ "5", "4 5 3 5 4" ].parse.expand.solve == 3 );
	assert( [ "5", "9 5 6 8 4" ].parse.expand.solve == 1 );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	input.popFront;
	auto hs = input.front.split.to!( long[] );
	return tuple( hs );
}

auto solve( long[] hs )
{
	auto ans = 0L;
	auto m = 0L;
	foreach( h; hs )
	{
		if( m <= h )
		{
			ans++;
			m = h;
		}
	}
	return ans;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll n,x,i,prev=0,curr=0;
    cin>>n>>x;
    ll arr[n];
    for(i=1;i<=n;i++)
        cin>>arr[i];
    i=1;
    while(curr<=x){
        curr=prev+arr[i];
        prev=curr;
        i+=1;
    }
    cout<<i-1<<endl;
    return 0;
}


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

// 最小公倍数を求める
int euqlid (int a, int b){
  int temp;
  temp = a % b;
  if(temp == 0)return b;
  return euqlid(b,temp);
}

int main(){
  int n,k;
  cin >> n >> k;
  int cnt = 0;
  int i =0;
  while(true){
    if(pow(k,i) <= n){
      cnt++;
      i++;
    }
    else break;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 512
def solve():
  h, w = map(int, input().split())
  table = []
  for _ in range(h):
    table.append(list(map(int, input().split())))
  
  
  count = 0
  result = []

  for i in range(h):
    j = 0
    while j < w:
      if table[i][j] % 2 != 0:
        s = j
        j += 1
        while j < w:
          if table[i][j] % 2 != 0 or j == w - 1:
            table[i][s] -=1
            table[i][j] += 1
            for k in range(s, j):
              count += 1
              result.append(((i, k), (i, k + 1)))
            break
          j += 1
      j += 1
  i = 0
  while i < h:
    if table[i][-1] % 2 != 0:
      s = i
      i += 1
      while i < h:
        if table[i][-1] % 2 != 0 or i == h - 1:
          for k in range(s, i):
            count += 1
            result.append(((k, w-1), (k+1, w-1)))
          break
        i += 1
    i += 1
  print(count)
  for e in result:
    print(e[0][0] + 1, e[0][1] + 1, e[1][0] + 1, e[1][1]+ 1)



solve()

Measured memory_bytes: 36692
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
    int n, m;
    cin >> n >> m;
    vl x(m);
    rep(i, m) cin >> x[i];
    sort(all(x));
    vl d(m-1);
    REP(i, 1, m) d[i-1] = x[i] - x[i-1];
    sort(all(d));
    ll ans = 0LL;
    rep(i, m-n) ans += d[i];
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>

int main()
{
  int64_t n;
  int64_t k;
  std::cin >> n >> k;
  std::vector<int64_t> a(n);
  for (auto& itr : a)
  {
    int64_t tmp;
    std::cin >> tmp; --tmp;
    itr = tmp;
  }
  std::unordered_map<int64_t, int64_t> visited;
  int64_t now = 0;
  int64_t count = 0;
  while(visited.find(now) == visited.end())
  {
    visited.emplace(std::pair<int64_t, int64_t>(now, count));
    now = a[now];

    ++count;
  }
  int64_t loop = count - visited[now];
  int64_t index;
  if (k > visited[now])
  {
    k -= visited[now];
    index = visited[now] + (k % loop);
  }
  else
  {
    index = k;
  }

  for (auto itr: visited)
  {
    if (itr.second == index)
    {
      std::cout << itr.first + 1 << std::endl;
      break;
    }
  }

  return 0;
}

Measured memory_bytes: 12796
fun main(args : Array<String>) {
    while (true) {
        var (a, b) = readLine()!!.split(" ").map(String::toInt)
        if (a == 0 && b == 0) {
            break
        }
        when {
            a <= b -> println("$a $b")
            a > b -> println("$b $a")
        }
    }
}



Measured memory_bytes: 32252
#include <stdio.h>

int main(void)
{
	int a;
	int b;
	int sum;
	int c = 1;
	
	while (scanf("%d %d", &a, &b) != EOF){
		
		sum = a + b;
		
		for (; sum / 10 != 0; sum /= 10){
			c++;
		}
		
		printf("%d\n", c);
		c = 1;
	}
	
	return (0);
}

Measured memory_bytes: 600
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		long B = sc.nextLong();
		long N = sc.nextLong();
		sc.close();

		long m = Math.min(N, B - 1);
		long v = ((long) Math.floor((double) A * m / B) - A * (long) Math.floor((double) m / B));
		System.out.println(v);
	}
}


Measured memory_bytes: 35740
#include <stdio.h>
#include <cstdio>
#include <vector>
#include <iostream>
#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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){
	int k;
	vector<int> m(3);
	REP(i, 3){
		cin >> m[i];
	}
	cin >> k;
	sort(m.begin(), m.end());
	REP(i, k){
		m[2] *= 2;
	}
	cout << m[0] + m[1] + m[2] << endl;
}


Measured memory_bytes: 256
#!python3.8
# -*- coding: utf-8 -*-
# abc170/abc170_b
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    X, Y = i2nn()
    if Y % 2 == 0 and 2 * X <= Y <= 4 * X:
        print('Yes')
    else:
        print('No')
    return

main()


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

#define pow(x) (x)*(x)
#define F first
#define S second
#define all(c) c.begin(), c.end()
#define pb push_back
#define skip continue
#define PI 3.14159265
#define name "input"

typedef unsigned long long ull;
typedef  long long ll;
typedef long double ld;

void faster(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

const ll INF = 1e18;
const ll MOD = 998244353;
const ll MAXN = 6e5 + 1;
const ld EPS = 1e-12;

//это приём, позволяющий возводить любое число в n-ую степень за O(logn)
int binPow(int v, int u, int mod) {
    if(!u)  return 1;   
    int res = binPow(v, u / 2, mod);  
    res = (res * 1ll * res) % mod;  
    if(u & 1) 
        res = (res * 1ll * v) % mod;  
    return res; 
} 
//это количество чисел от 1 до n, взаимно простых с n Асимтотика O(sqrt(n))
int phi (int n) {
    int result = n;
    for (int i=2; i*i<=n; ++i)
        if (n % i == 0) {
            while (n % i == 0)
                n /= i;
            result -= result / i;
        }
    if (n > 1)
        result -= result / n;
    return result;
}
//NOD
int gcd (int a, int b) {
    return b ? gcd (b, a % b) : a; }
int lcm(int a, int b) { 
    return a / gcd (a, b) * b; }

int fib(int n){ int a=0,b=1; for (int i = 0; i < n; ++i){ b=b+a; a=b-a; }return b; }
bool compare(const string &c1,const string &c2){ return c1.size() < c2.size(); }


string alph = "abcdefghijklmnopqrstuvwxyz";

int a,b,h,m;
void solve(){
    cin >>a>>b>>h>>m;
    double rad = 2*M_PI*((60*h+m)/720.0 - m/60.0);
    double sq = a*a+b*b;
    sq -= 2*a*b*cos(rad);
    printf("%.10lf\n", sqrt(sq));
}

int main(){

    faster();

    int T=1; 
    //cin>>T;

    while(T--){
        solve();
        cout<<"\n";
    }
    return 0;     
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int n;
vector<int> g[100000];
vector<int> ord;

void dfs(int v) {
    for (int to : g[v]) {
        dfs(to);
    }
    ord.pb(v);
}

int d[100000];

int main() {
    scanf("%d", &n);
    for (int i = 1; i < n; ++i) {
        int from;
        scanf("%d", &from), --from;
        g[from].pb(i);
    }
    dfs(0);
    for (int x : ord) {
        vector<int> ch;
        for (int to : g[x]) {
            ch.pb(d[to]);
        }
        int dep = 0, ad = 1;
        sort(ch.begin(), ch.end(), greater<int>());
        for (int y : ch) {
            dep = max(dep, y + ad);
            ++ad;
        }
        d[x] = dep;
    }
    cout << d[0] << endl;
    return 0;
}


Measured memory_bytes: 11252
//#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <cstring>
#include <climits>
#include <queue>
#include <algorithm>
#include <utility>
#define INF INT_MAX / 2
using namespace std;

typedef pair<int, int> P;
typedef long long ll;

int main(void) {
	int n,m;
	while(cin >> n >> m,n+m!=0){
	vector<int> s1(n),s2(m);
	int sum1,sum2;
	sum1 = sum2 = 0;
	for(int i=0;i<n;i++){
		cin >> s1[i];
		sum1 += s1[i];
	}
	for(int i=0;i<m;i++){
		cin >> s2[i];
		sum2 += s2[i];
	}
	sort(s1.begin(),s1.end());
	sort(s2.begin(),s2.end());
	bool f = false;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(sum1-s1[i]+s2[j] == sum2-s2[j]+s1[i] && !f){
				cout << s1[i] << " " << s2[j] << endl;
				f = true;

			}
		}
	}
	if(!f)cout << -1 << endl;
}

}

// command shift d duplicate
// command ctrl 上下
// command D
// command caps G → '' ""
// vector<vector<int>> a(N,vector<int>(M,-1));

Measured memory_bytes: 1216
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define EVEL 1
 
#ifndef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD = 1000000007;
const int INF = 2000000000;
    int ans=0,id;
    int N,M;
    ll A,B,C,W;
    vector<int> G[100];
    ll sum=0;
 
int main(){
    ios_base::sync_with_stdio(false);
    cin>>N>>M;
    REP(i,M){
        cin>>A>>B;
        G[A-1].push_back(B-1);
        G[B-1].push_back(A-1);
    }
    REP(i,N){
        cout<<G[i].size()<<endl;
    }
 
 
    //cout<<ans;
 
    return 0;
}

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


public class Main {
    int N,M;
    int[] A, B, C;
    Pair[] pairs;

    private class Pair implements Comparable<Pair> {
        int b,c;
        public Pair(int b, int c) {
            this.b = b;
            this.c = c;
        }

        public int compareTo(Pair other) {
            return other.c - this.c;
        }
    }

    private void solve() {
        N = nextInt();
        M = nextInt();
        A = new int[N];
        for(int i = 0;i < N;i++) {
            A[i] = nextInt();
        }

        B = new int[M];
        C = new int[M];
        pairs = new Pair[M];
        for(int i = 0;i < M;i++) {
            B[i] = nextInt();
            C[i] = nextInt();
            pairs[i] = new Pair(B[i], C[i]);
        }

        Arrays.sort(A);
        Arrays.sort(pairs);

        int idx = 0;
        for(int i = 0;i < M;i++) {
            while(idx < N && pairs[i].b > 0 && A[idx] < pairs[i].c) {
                pairs[i].b--;
                A[idx] = pairs[i].c;
                idx++;
            }
        }

        long ans = 0;
        for(int i = 0;i < N;i++) {
            ans += A[i];
        }

        out.println(ans);
    }

    public static void main(String[] args) {
        out.flush();
        new Main().solve();
        out.close();
    }

    /* Input */
    private static final InputStream in = System.in;
    private static final PrintWriter out = new PrintWriter(System.out);
    private final byte[] buffer = new byte[4096];
    private int p = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (p < buflen)
            return true;
        p = 0;
        try {
            buflen = in.read(buffer);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (buflen <= 0)
            return false;
        return true;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrint(buffer[p])) {
            p++;
        }
        return hasNextByte();
    }

    private boolean isPrint(int ch) {
        if (ch >= '!' && ch <= '~')
            return true;
        return false;
    }

    private int nextByte() {
        if (!hasNextByte())
            return -1;
        return buffer[p++];
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = -1;
        while (isPrint((b = nextByte()))) {
            sb.appendCodePoint(b);
        }
        return sb.toString();
    }

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

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

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


Measured memory_bytes: 47496
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

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

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};

void solve(string s) {
  const int n = s.size();
  int a = -1, z = -1;
  REP(i,n) {
    if (s[i] == 'A' && a == -1) a = i;
    if (s[i] == 'Z') z = i;
  }
  cout << z - a + 1 << endl;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	string s;
	cin >> s;
	solve(s);
	return 0;
}


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

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

using namespace std;

const int MX = 18;

char s[2 * MX + 1], a[MX], b[MX];
long long dp[MX][MX];

int main() {
	int n;
	ignore = scanf("%d %s", &n, s);
	
	long long ans = 0;
	for (int msk = 0; msk < (1 << n); msk++) {
		int p = 0, q = 0;
		for (int i = 2 * n - 1, m = msk; i >= n; i--, m /= 2) {
			if (m & 1) a[p++] = s[i];
			else b[q++] = s[i];
		}
		
		dp[0][0] = 1;
		for (int i = 0; i <= p; i++)
			for (int j = 0; j <= q; j++) {
				if (i + j == 0) continue;
				dp[i][j] = 0;
				if (i > 0 && s[i + j - 1] == a[i - 1]) dp[i][j] += dp[i - 1][j];
				if (j > 0 && s[i + j - 1] == b[j - 1]) dp[i][j] += dp[i][j - 1];
			}
		
		ans += dp[p][q];
	}
	
	printf("%lld\n", ans);
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int k,a,b;cin>>k>>a>>b;
  if(a%k==0||b%k==0) cout<<"OK"<<endl;
  else if(a/k<b/k) cout<<"OK"<<endl;
  else cout<<"NG"<<endl;
  return 0;
}

Measured memory_bytes: 3576
N = int(input())
xyh = [list(map(int, input().split())) for _ in range(N)]

for i in range(N):
    if xyh[i][2] != 0:
        x = xyh[i][0]
        y = xyh[i][1]
        h = xyh[i][2]

for i in range(101):  # x座標
    for j in range(101):  # y座標
        tmp_h = abs(x-i)+abs(y-j)+h
        cnt = 0
        for k in range(N):
            if xyh[k][2] == max(0,tmp_h-abs(xyh[k][0]-i)-abs(xyh[k][1]-j)):
                cnt += 1
        if cnt == N:
            ans_x = i
            ans_y = j
            ans_h = tmp_h
            break
print(ans_x, ans_y, ans_h)

Measured memory_bytes: 47468
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
#define all(ppp) ppp.begin(),ppp.end()
#define out(ppp) cout<<(ppp)<<endl
#define out1(ppp) cout<<(ppp) 

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define pb push_back

typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
typedef vector<vpi> vvpi;

typedef set<pi> spi;

map<ll,ll> mp;

const int INF=INT_MAX;
ll mymod(ll a,ll b){
    a%=MOD;
    ll result=1;
    while(b>0){
        if(b&1){
            result=(result*a)%MOD;
        }
        a=(a*a)%MOD;
        b>>=1;
    }
    return result;
    
}



int main(){
    ll N;
    cin>>N;
    vl A(N);
    F0R(i,N){
        cin>>A[i];
    }
    F0R(i,N){
        ll copy=A[i];
        for(ll j=2;j*j<=copy;j++){
            if(copy%j!=0) continue;

            ll num=0;
            while(copy%j==0){
                num++;
                copy/=j;
            }
            mp[j]=max(mp[j],num);
        }
        if(copy!=1){
            mp[copy]=max(mp[copy],1ll);
        }
    }
    ll LCM=1;
    for(auto tmp:mp){
        LCM*=mymod(tmp.first,tmp.second);
        LCM%=MOD;
    }
    ll ans=0;
    for(int i=0;i<N;i++){
        ll now=LCM;
        now*=mymod(A[i],MOD-2);     // inverse of A[i]
        now%=MOD;
        ans+=now;
        ans%=MOD;
    }
    out(ans);
    return 0;
}


Measured memory_bytes: 896
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-9;

	int n;
	boolean[] bs;

	void run(){
		for(;;){
			n=sc.nextInt();
			if(n==0){
				break;
			}
			bs=new boolean[2*n+1];
			for(int i=0; i<n; i++){
				bs[sc.nextInt()]=true;
			}
			solve();
		}
	}

	void solve(){
		int ba=0;
		@SuppressWarnings("unchecked")
		LinkedList<Integer>[] a=new LinkedList[2];
		a[0]=new LinkedList<Integer>();
		a[1]=new LinkedList<Integer>();
		for(int i=1; i<=2*n; i++){
			if(bs[i]){
				a[0].addLast(i);
			}else{
				a[1].addLast(i);
			}
		}

		for(;;){
			for(int i=0; i<2; i++){
				int k=0;
				for(int e : a[i]){
					if(e>ba){
						k=e;
						break;
					}
				}
				if(k>0){
					ba=k;
					a[i].remove((Integer)k);
				}else{
					ba=0;
				}
				if(a[i].size()==0){
					break;
				}
			}
			if(a[0].size()==0||a[1].size()==0){
				break;
			}
		}
		println(a[1].size()+"");
		println(a[0].size()+"");
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		// System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		new Main().run();
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;

const ll INF = 1LL << 60;
struct UnionFind{
    vll par;
    vll rank;
    //* member functions
    UnionFind(ll n){
        par = vll(n);
        rank = vll(n, 0);
        for(ll i=0; i< n; i++) par[i] = i;
    }

    int find(ll x){
        if(par[x] == x) return x;
        else{
            return par[x] = find(par[x]);
        }
    }

    void unite(ll x, ll y){
        x = find(x); y = find(y);
        if(x == y) return;

        if(rank[x] < rank[y]){
            par[x] = y; //* new root is y
        }
        else {
            par[y] = x; //* new root is x
            if(rank[x] == rank[y]) rank[x] ++;
        }
    }

    bool same(ll x, ll y){
        return find(x) == find(y);
    }
};

void solve(long long N, long long M, std::vector<long long> p, std::vector<long long> x, std::vector<long long> y){
    UnionFind uf(N);
    for(ll i=0; i< M; i++){
        uf.unite(x[i]-1, y[i]-1);
    }
    vector<pll> mysets(N+1);
    for(ll i=0; i< N; i++){
        mysets[i].first = uf.find(i);
        mysets[i].second = i;
    }
    mysets[N].first = INF; mysets[N].second = INF;

    sort(mysets.begin(), mysets.end());
    ll i=0, j=0, k, cnt=0;
    while(i<N){
        while(j<N && mysets[j].first == mysets[j+1].first){
            j++;
        }
        set<ll> tmpset;
        for(k=i; k<= j; k++){
            tmpset.insert(mysets[k].second);
        }
        for(k=i; k<= j; k++){
            if(tmpset.count(p[mysets[k].second]-1)) cnt ++;
        }
        j++;
        i=j;
    }
    cout << cnt << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> p(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&p[i]);
    }
    std::vector<long long> x(M);
    std::vector<long long> y(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&x[i]);
        scanf("%lld",&y[i]);
    }
    solve(N, M, std::move(p), std::move(x), std::move(y));
    return 0;
}


Measured memory_bytes: 10368
h, w, n = map(int, input().split())
sr, sc = map(int, input().split())
s = input()
t = input()
sr -= 1; sc -= 1
 
L=0; R=w-1; U=0; D=h-1;
is_drop = False
for i in range(n)[::-1]:
    if t[i] == 'U': D = min(D+1, h-1)
    if t[i] == 'D': U = max(U-1, 0)
    if t[i] == 'L': R = min(R+1, w-1)
    if t[i] == 'R': L = max(L-1, 0)
    if s[i] == 'U': U += 1
    if s[i] == 'D': D -= 1
    if s[i] == 'L': L += 1
    if s[i] == 'R': R -= 1
    if R < L or D < U: is_drop = True
if (not L <= sc <= R) or (not U <= sr <= D):  is_drop = True

print( "NO" if is_drop else "YES" )


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

int main (){
    ll N;
    cin >> N;
    ll n = 1;
    //for(ll i = 0; i*i < N; i++) n = i + 1;

    ll ans = 0;
    ll now = 0;

    for(int i = 1; i <= N; i++) {
        ans += i*((N/i))*((N/i)+1)/2;
    }


    for(ll i = 1; i <= N && 0; i++) {
        now = 0;;
        ll temp = i;
        for(ll j = 1; j*j <= i; j++) {
            if(!(i%j)) {
                now += 2;
                if(i/j == j) now--;
            }
        }
        cout << i << ':' << now << endl;
        ans += now*i;
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 3632
// #include <stdio.h>
// #include <string.h>
//#include <iostream>
#include <utility>
#include <cstdio>
#include <stack>
#include <queue>
#include <algorithm>
#include <map>
#include <string>
#include <set>

using namespace std;
typedef pair<int, int> XY;// Pair型変数の宣言
    
int main()
{
    
  	int Nmax = 100000;
    int N,K;
    int h[Nmax];
    
    int i,j,k;
    int len;   // 文字列の長さ
    int flag=0;

/*    
    // int型スタック
    stack<int> stack;   
    stack.push(777);
    stack.push(778);
    stack.push(779);
  
	int tmpsl = stack.top();  // LAST要素の参照
 // 	int tpmsf = stack.back(); // FIRST要素の参照
 //	printf("%d %d \n",tmpsl,tmpsf);
    stack.pop();// LAST要素の削除（取出しではない）
 // 	if( stack.empty() == true) printf("empty stack\n");
     
    // int型キュー
    queue<int> que;
  	que.push(999);
  	que.push(998);   
  	que.push(997);    
  	int tmpqs = que.front(); // FIRST要素の参照
  	int tmpqe = que.back();  // LAST要素の参照
 //	printf("%d %d \n",tmpqs,tmpqe);
  	que.pop();  // FIRST要素の削除（取出しではない）
  //	if( que.empty() == true) printf("empty que\n");
    
    // ２次元座標を扱うキュー
    queue<XY> xyque; // ２次元座標型変数のキュー
  	XY p; 
  	xyque.pop();	// FIRST要素の削除。キューが空のときは削除が予約されて次のPOPが即削除される
  	xyque.push( XY(5,5) );
    xyque.push( XY(5,5) );
   	p = xyque.front();  // FIRST要素からのコピー
 // 	printf("%d %d\n", p.first, p.second);
  	
    
  que.back();
  //  sort(&(que.front()), &(que.back()));
     */   
    
      
    // 入力読込
    // 文字列
//    scanf("%s", String);   
    
    // 数列
    scanf("%d %d", &N,&K);
    for(i=1;i<=N;i++){
        scanf("%d ",&h[i]);
    }
    
    int ninzu=0;
    for(i=1;i<=N;i++){
        if(h[i]>=K) ninzu++;
    }
    
    // 文字列の長さをチェック
    // 文字列は配列の0からlen-1に格納されてる
//    len = strlen( String );
//  	printf("%d\n",len);
    

  // 結果出力
    printf("%d \n", ninzu);
    
    

    
  return 0;
   
}

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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll n, W;
    cin >> n >> W;
    vector<ll> v(n);
    vector<ll> w(n);
    vector<ll> m(n);
    for(i = 0;i < n;++i){
        cin >> v.at(i) >> w.at(i) >> m.at(i);
    }
    vector<vector<ll>> dp(n+1, vector<ll>(W+1,0));
    for(i = 1;i <= n;++i){
        ll a;
        rep(a, w.at(i-1)){
            deque<pair<ll,ll>> deq;
            for(j = 0;j*w.at(i-1) + a <= W;++j){
                ll tmpw = j*w.at(i-1) + a;
                ll val = dp.at(i-1).at(tmpw) - j*v.at(i-1);
                while((!deq.empty()) && deq.back().first <= val) deq.pop_back();
                deq.emplace_back(val, j);
                dp.at(i).at(tmpw) = deq.front().first + j*v.at(i-1);
                if(j - deq.front().second == m.at(i-1)) deq.pop_front();
            }
        }
    }
    cout << dp.at(n).at(W) << endl;
    return 0;
}


Measured memory_bytes: 11080
fun main(args: Array<String>){
    val s = readLine()!!
    val direct = mutableSetOf<Char>()
    s.forEach {
        direct += it
    }
    if (direct.contains('N').xor(direct.contains('S'))
        || direct.contains('E').xor(direct.contains('W'))) {
        println("No")
    }
    else {
        println("Yes")
    }
}


Measured memory_bytes: 35788
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = scan.nextInt();
		}
		for (int i = 0; i < n; i++) {
			b[i] = scan.nextInt();
		}
		scan.close();
		int[] SA = new int[n+1];
		int[] SB = new int[n+1];
		SA[0] = 0;
		SB[0] = 0;

		for (int i = 1; i <= n; i++) {
			SA[i] = SA[i-1] + a[i-1];
			SB[i] = SB[i-1] + b[i-1];
		}
		int ans = 0;

		for (int i = 1; i <= n; i++) {
			int c = (SA[i]-SA[0])+(SB[n]-SB[i-1]);
			ans = Math.max(ans, c);
		}

		System.out.println(ans);
	}
}


Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int n;
vector<vector<int>> g(100010);
int dist1[100010], dist2[100010];

void dfs1(int v, int p) {
    for (int nv : g[v]) {
        if (nv == p) continue;
        dist1[nv] = dist1[v] + 1;
        dfs1(nv, v);
    }
}

void dfs2(int v, int p) {
    for (int nv : g[v]) {
        if (nv == p) continue;
        dist2[nv] = dist2[v] + 1;
        dfs2(nv, v);
    }
}

int main() {
    int n, u, v;
    cin >> n >> u >> v;
    u--;
    v--;
    rep(i, 0, n - 1) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    dfs1(u, -1);
    dfs2(v, -1);

    int ans = 0;
    rep(i, 0, n) {
        if (dist1[i] < dist2[i]) ans = max(ans, dist2[i]);
    }
    cout << ans - 1 << endl;
    return 0;
}


Measured memory_bytes: 10368
//auto 関数名 = [(&:ラムダ外の引数をとる時))](引数の型1 引数名1, 引数の型2, 引数名2, ...) { 関数の処理 }; //inside main() define function. take care of };
// for (int tmp = 0; tmp < (1 << ビット数); tmp++) {
//   bitset<ビット数> s(tmp);
//   // (ビット列sに対する処理)
// }
// sort(配列変数.begin(), 配列変数.end());
// do {
//   // 順列に対する処理
// } while (next_permutation(配列変数.begin(), 配列変数.end()));
//const double PI = acos(-1); M_PI
// cout << fixed << setprecision(10);
// set<int>st{ 3,1,4,1,5,9,2,6,5,3,5 };
//     for (auto itr = st.begin(); itr != st.end(); ++itr) {
//         cout << *itr;
//     }
#include <bits/stdc++.h>
#include <regex>
using namespace std;
#define _GLIBCXX_DEBUG 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end() //sort(all(vec)); ,reverse(all(vec));etc
int main(){
  int n,m;
  cin>>n>>m;
  vector<int>h(n);
  vector<vector<int>>vec(n,vector<int>(1));
  rep(i,n){
    cin>>h.at(i);
  }
  int a,b;
  rep(i,m){
    cin>>a>>b;
    vec.at(a-1).push_back(h.at(b-1));
    vec.at(b-1).push_back(h.at(a-1));
  }
  int sum=0;
  rep(i,n){
    for(int j=0;j<vec.at(i).size();j++){
      if(vec.at(i).at(j)>=h.at(i)){
        goto SKIP;
      }
    }
    sum+=1;
    //cout<<h.at(i)<<endl;
    SKIP:;
  }
cout<<sum<<endl;



}

Measured memory_bytes: 9768
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define fi first
#define se second
using namespace std;
typedef pair<string,int> P;
vector<P>v1,v2,v3;
int x;
string s;
main(){
  while(cin>>s,s!="$")cin>>x,v1.push_back(P(s,x));
  while(cin>>s,s!="$")cin>>x,v2.push_back(P(s,x));
  while(cin>>s,s!="$")cin>>x,v3.push_back(P(s,x));
  r(i,v1.size())if(v1[i].fi==v2[0].fi&&v1[i].se>=v2[0].se){
    int flag=0,jj=0,ff=0;
    r(j,(int)v2.size()-2){
      jj=j+1;
      if(i+jj>=v1.size()){flag++;break;}
      if(v2[jj].se!=v1[i+jj].se||v2[jj].fi!=v1[i+jj].fi)flag++;
    }
    jj++;
    if(v2.size()==1)jj++;
    else if(i+jj>=v1.size())flag++;
    else if((v2[v2.size()-1].fi!=v1[i+jj].fi||v2[v2.size()-1].se>v1[i+jj].se))flag++;
    if(v2.size()!=1){
      if(!flag&&v2[jj].fi==v1[i+jj].fi&&v2[jj].se<=v1[i+jj].se){
        v1[i].se-=v2[0].se;
        r(j,v2.size()-2)v1.erase(v1.begin()+i+1);
        v1[i+1].se-=v2[v2.size()-1].se;
        r(j,v3.size())v1.insert(v1.begin()+i+1,v3[(int)v3.size()-1-j]);
      }
      if(flag)goto L;
      ff++;
    }
    else{
      if(flag)goto L;
      v1[i].se-=v2[0].se;
      r(j,v3.size())v1.insert(v1.begin()+i,v3[(int)v3.size()-1-j]);
      ff++;
    }
    r(j,v1.size())if(v1[j].se==0)v1.erase(v1.begin()+j);
    r(j,(int)v1.size()-1)if(v1[j].fi==v1[j+1].fi)
      v1[j].se+=v1[j+1].se,v1.erase(v1.begin()+j+1),j--;
    break;
    L:;
  }
  r(k,v1.size())cout<<v1[k].fi<<' '<<v1[k].se<<' ';
  cout<<'$'<<endl;
}

Measured memory_bytes: 3344
N = int(input())
A = list(map(int,input().split()))
summary = sum(A)
d = {}
for a in A:
  if a in d:
    d[a] += 1
  else:
    d[a] = 1
    
Q = int(input())
for _ in range(Q):
  B, C = list(map(int,input().split()))
  if B not in d:
    b = 0
  else:
    b = d[B]
    d[B] = 0
  if C in d:
    d[C] += b
  else:
    d[C] = b
  summary = summary + b * (C - B)
  print(summary)

Measured memory_bytes: 20816
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
// #define double long double
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define all(a) a.begin(),a.end()
#define sort(a) sort(all(a))
#define rsort(a) sort(all(a),greater<>())
#define debg(a) cout<<#a<<" "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
template<class T> inline int out(const T &t){ print(t); putchar('\n'); return 0; }
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
typedef long long ll;
typedef pair<int,int> P;
const long long MOD=1000000007;
clock_t time_ini = clock();
double time_diff(){
  ll time_tmp = clock();
  const double time = static_cast<double>(time_tmp - time_ini) / CLOCKS_PER_SEC * 1000.0;
  return time;
}
#define saiaku if(time_diff() > 1990)

vector<long double> gP;
ll gN;

long double dfs(ll n, long double p, ll cnt){
  if(cnt>gN/2){return 0;}
  if(n<0 && cnt==0){return 0;}
  if(n<0){return 1;}
  long double sum=0;
  sum += (p * dfs(n-1,gP[n-1],cnt));
  sum += (p * dfs(n-1,1-gP[n-1],cnt+1));
  return sum;
}

void solve_old(long long N, std::vector<long double> p){
  copy(p.begin(), p.end(), back_inserter(gP));
  gN = N;
  long double sum_h=0, sum_t=0;
  sum_h += dfs(N-1,p[N-1],0);
  sum_t += dfs(N-1,1-p[N-1],1);
  sp(sum_h+sum_t);
}

vector<vector<long double>> dp(3000, vector<long double>(3000));
void solve(long long N, std::vector<long double> p){
  dp[0][0] = 1;
  for (ll i = 1; i <= N; i++) {
      for (ll j = 0; j <= i; j++) {
        if(j==0){
          dp[i][j] = dp[i-1][j] * (1-p[i-1]);
        } else if (j==i) {
          dp[i][j] = dp[i-1][j-1]*p[i-1];
        } else {
          dp[i][j] = dp[i-1][j-1]*p[i-1] + dp[i-1][j] * (1-p[i-1]);
        }
      }
  }
  long double sum=0;
  for (ll j = N/2+1; j <= N; j++) {
      sum += dp[N][j];
  }
  sp(sum);
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long double> p(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%Lf",&p[i]);
    }
    solve(N, std::move(p));
    return 0;
}


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

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

  int64_t ans= 0;
  for(int64_t a=1; a<N; a++){
    ans+= (N-1)/ a;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>


/* 
*    coder :: ATUL_PANDEY_2608
*        >>> INDIA <<<
*/
using namespace std;
using namespace __gnu_pbds;

// #define  part ..
#define pb(a) push_back(a)
#define all(a) a.begin(),a.end() 
#define mod 1000000007
//#define maxx 200006
#define ll long long 
#define quick    ios_base::sync_with_stdio(NULL),cin.tie(0);
#define listll vector< long long > 
#define listi vector< int> 
#define pii   pair<int , int> 
#define pll pair<long long , long long > 
#define minheap priority_queue<long long , vector< long long >, greater<long long > >
#define rep(i,a,b) for(int i=a;i<b;i++)
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}


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


// end of #define 

// define globals ...
const int maxx = 2e5+26;

//write function from here ...







int Main(){


ll x,y,n;
cin>>x>>y>>n;




ll cntx[x+20];
ll cnty [y+20];
fill(cnty ,cnty+y+20,0LL );

fill(cntx,cntx+x+20,0LL);
ll arx[n+3],ary[n+3];

for(int  i =0 ; i  < n;i++)
{
	ll a,b;
	cin>>a>>b;
	arx[i]=a;
	ary[i]=b;
	cntx[a]++;
	cnty[b]++;
	
	
	
}


ll xx =0  ;
for(int  i =0 ; i < x+15;i++)
{
	if( xx < cntx[i] ){
		xx = cntx[i];
	}
}


ll yy =0  ;
for(int  i =0 ; i < y+15;i++)
{
	if( yy < cnty[i] ){
		yy = cnty[i];
	}
}


ll gx[x+26] , gy [y+26];
fill(gx ,gx + x+ 26, 0 );
fill(gy , gy+y+26, 0 );

int  xcnt =0 , ycnt =0 ;
for(int  i =0 ; i < x+15;i++)
{
	if( xx ==cntx[i] ){
		
		gx[i] = 1;
		xcnt++;
		
	}
}







for(int  i =0 ; i < y+15;i++)
{
	if( yy ==cnty[i] ){
		
		gy[i] = 1;
		ycnt++;
	}
}

ll cnt = 0 ;
int flag =0;
for( int i=0 ; i <n ; i ++ ){
	
	if(gx[arx[i]] && gy[ary[i]]) cnt++;
	
	
}

if(cnt ==xcnt*ycnt )
flag=1;







cout<<xx+yy-flag<<endl;
return 0;

}

















int main(){
 quick;
int t =1; 
//cin>>t;
while(t-- )
 Main();

 return 0;


}


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

vector<int> pre, in, pos;
int p=0;

void rec(int l, int r){
   if(l>=r) return;
   int root=pre[p++];
   int m=distance(in.begin(), find(in.begin(), in.end(), root));
   rec(l, m);
   rec(m+1, r);
   pos.push_back(in[m]);
}

int main(){
   int n, num;
   cin >> n;
   for(int i=0; i<n; i++){
      cin >> num;
      pre.push_back(num);
   }
   for(int i=0; i<n; i++){
      cin >> num;
      in.push_back(num);
   }

   rec(0, n);

   for(int i=0; i<n; i++){
      if(i) cout << " ";
      cout << pos[i];
   }
   cout << endl;
}


Measured memory_bytes: 3152
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define poq pop_back
#define tof ios_base :: sync_with_stdio(NULL);cin.tie(0);cout.tie(0)



using namespace std;

vector<ll> vec;

int main()
{
ll n,v;
cin>>n;
for (ll i=0;i<3*n;i++)
{
      cin>>v;
      vec.pb(v);
}
sort(vec.begin(),vec.end());
ll j=0;
ll ans=0;
for (ll i=3*n-1;i>=n+1;i-=2)
{
      ans+=vec[i-1];
      j++;
}
cout<<ans;
}


Measured memory_bytes: 6384
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast")
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
using ll=long long;
using P=pair<ll,ll>;
using PP=tuple<ll,ll,ll>;
using S=multiset<ll>;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
void decimal(int x){cout<<fixed<<setprecision(x);}
//ll GCD(ll a,ll b){if(b==0) return a; return GCD(b,a%b);}
//ll LCM(ll a,ll b){return(a/GCD(a,b))*(b/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*POW(a,b-1)%mod;ll k=POW(a,b/2);return k*k%mod;}
vi calc(ll x){vi res;while(x>0){res.eb(x%10);x/=10;}reverse(all(res));return res;}

void solve(){
  int n; cin>>n;
  vi l(n);
  rep(i,n) cin>>l[i];
  sort(all(l));
  if(n<3){
    out(0); return;
  }
  ll ans=0;
  rep(i,n-2){
    REP(j,i+1,n-1){
      REP(k,j+1,n){
        if(l[i]==l[j]||l[j]==l[k]||l[k]==l[i]) continue;
        if(l[i]+l[j]>l[k]) ans++;
      }
    }
  }
  out(ans);
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}


Measured memory_bytes: 3660
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
char c;
int x[20001][2],y[20001][2];
vector<int>v[40001];
int b[40001],f,n;
void dfs(int p,int col){
  b[p]=col;
  r(i,v[p].size()){
    if(!(p==v[p][i]+n||p+n==v[p][i])&&b[v[p][i]]&&b[v[p][i]]!=col)f++;
    else if(!b[v[p][i]]){
      if(p==v[p][i]+n||p+n==v[p][i]){
        if(col==1)dfs(v[p][i],2);
        else dfs(v[p][i],1);
      }
      else dfs(v[p][i],col);
    }
  }
}
int main(){
  while(cin>>n,n){
    memset(b,0,sizeof(b));
    r(i,40001)v[i].clear();
    r(i,n){
      cin>>x[i][0]>>y[i][0]>>c;
      if(c=='x')x[i][1]=x[i][0]+1,y[i][1]=y[i][0];
      else x[i][1]=x[i][0],y[i][1]=y[i][0]+1;
    }
    r(i,n)v[i].push_back(i+n),v[i+n].push_back(i);
    r(i,n)r(j,n)if(i!=j&&i<j)r(l,2)r(k,2){
      if(abs(x[i][l]-x[j][k])+abs(y[i][l]-y[j][k])==1){
        int p1=i,p2=j;
        if(l)p1+=n;
        if(k)p2+=n;
        v[p1].push_back(p2);
        v[p2].push_back(p1);
      }
    }
    f=0;
    r(i,n*2)if(!b[i])dfs(i,1);
    cout<<(f?"No":"Yes")<<endl;
  }
}

Measured memory_bytes: 7528
#include<iostream>
#include<map>
using namespace std;
int main(){
	int n;
	cin>>n;
	map<string,int> m;
	for(int i=0;i<n;i++){
		string temp;
		cin>>temp;
		m[temp]++;
	}
	cin>>n;
	for(int i=0;i<n;i++){
		string temp;
		cin>>temp;
		m[temp]--;
	}
	int maxv=-2147483647;
	for(map<string,int>::iterator it=m.begin();it!=m.end();it++){
		maxv=max((*it).second,maxv);
	}
	cout<<max(0,maxv);
	return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    cout<<fixed<<setprecision(20);
    ld a,b,h,m; cin>>a>>b>>h>>m;
    ld a_t=0.5*(60*h+m),b_t=6*m;
    ld co=cos((a_t-b_t)/180*3.141592653589793);
    cout<<sqrt(a*a+b*b-2*a*b*co)<<endl;
}

Measured memory_bytes: 4092
fn read<T: std::str::FromStr>() -> T {
	let mut s = String::new();
	std::io::stdin().read_line(&mut s).ok();
	s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
	read::<String>().split_whitespace()
		.map(|e| e.parse().ok().unwrap()).collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
	(0..n).map(|_| read_vec()).collect()
}

pub trait LexicalPermutation {
	/// Return `true` if the slice was permuted, `false` if it is already
	/// at the last ordered permutation.
	fn next_permutation(&mut self) -> bool;
}
impl<T> LexicalPermutation for [T] where T: Ord {
	/// Original author in Rust: Thomas Backman <serenity@exscape.org>
	fn next_permutation(&mut self) -> bool {
		// These cases only have 1 permutation each, so we can't do anything.
		if self.len() < 2 { return false; }

		// Step 1: Identify the longest, rightmost weakly decreasing part of the vector
		let mut i = self.len() - 1;
		while i > 0 && self[i-1] >= self[i] {
			i -= 1;
		}

		// If that is the entire vector, this is the last-ordered permutation.
		if i == 0 {
			return false;
		}

		// Step 2: Find the rightmost element larger than the pivot (i-1)
		let mut j = self.len() - 1;
		while j >= i && self[j] <= self[i-1]  {
			j -= 1;
		}

		// Step 3: Swap that element with the pivot
		self.swap(j, i-1);

		// Step 4: Reverse the (previously) weakly decreasing part
		self[i..].reverse();

		true
	}
}

fn main() {
	let n: usize = read();
	let mut b: Vec<usize> = read_vec();

	let mut a: Vec<usize> = vec![0; n];
	a[0] = b[0];
	a[1] = b[0];
	for i in 1..n-1 {
		let bi = b[i];
		a[i + 1] = bi;
		a[i] = std::cmp::min(a[i], bi);
	}

	println!("{}", a.iter().sum::<usize>());
}


Measured memory_bytes: 4352