akhauriyash/Code-Regression huggingface dataset:
N = int(input())
points = [[int(s) for s in input().split()] for i in range(N)]
points.sort(key=lambda x: x[2], reverse=True)

for Cx in range(101):
    for Cy in range(101):
        kouho = set()
        for xi, yi, hi in points:
            if len(kouho) > 1:
                break  # 頂点が一意でない

            if hi > 0:
                """観測点の高さが1以上なら頂点高を予測"""
                kouho.add(hi + abs(xi - Cx) + abs(yi - Cy))
            else:
                """観測点の高さが0なら式を満たしているかチェック"""
                if list(kouho)[0] - abs(xi - Cx) - abs(yi - Cy) > 0:
                    kouho = set()
                    break

        if len(kouho) == 1:
            print('{} {} {}'.format(Cx, Cy, list(kouho)[0]))
            exit()


Measured memory_bytes: 3064
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>

using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define EPS 1e-8
#define LL_INF 0x3fffffffffffffff
#define INF 0x3f3f3f3f3f3f3f3f
#define MEM(a, b) memset(a, b, sizeof(a))
#define PPER(i, n, m) for (int i = n; i >= m; i--)
#define REPP(i, n, m) for (int i = n; i <= m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)
#define PER(i, n, m) for (int i = n; i > m; i--)
#define SA(n) scanf("%d", &(n))
#define SLLA(n) scanf("%lld", &(n))
#define MP make_pair
#define FF first
#define SS second
#define PB push_back
#define DE(val) cout << #val << ": " << val << endl;
 
const int dx44[6] = {0, -1, -1, 1, 1};
const int dy44[6] = {0, -1, 1, -1, 1};
const int dx4[6] = {0, 0, 1,-1};
const int dy4[6] = {1, -1, 0,0};
const int dx8[9] = {0, -1, 0, 1, 0, 1, 1, -1, -1};
const int dy8[9] = {0, 0, 1, 0, -1, 1, -1, 1, -1};
const int dx82[9] = {0, -1, -1, 1, 1, 2, 2, -2, -2};
const int dy82[9] = {0, 2, -2, 2, -2, 1, -1, 1, -1};

void update(ll& x,ll v){
    if(x==-1)x=v;
    else if(x>v)x=v;
}
 
ll po(ll a, ll b, ll mod)
{
    ll res = 1;
    a %= mod;
    for (; b; b >>= 1)
    {
        if (b & 1)
            res = res * a % mod;
        a = a * a % mod;
    }
    return res;
}
ll gcd(ll a, ll b)
{
    if (a == 0)
    {
        return b;
    }
    else
    {
        return gcd(b % a, a);
    }
}
void extgcd(ll a, ll b, ll &d, ll &x, ll &y)
{
    if (!b)
    {
        d = a;
        x = 1;
    }
    else
    {
        extgcd(b, a % b, d, y, x);
        y -= x * (a / b);
    }
}
ll inverse(ll a, ll n)
{
    ll d, x, y;
    extgcd(a, n, d, x, y);
    return d == 1 ? (x + n) % n : -1;
}
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const int maxn = 1e5 + 15;
const double PI = acos(-1.0);
const ll mod = 1e9 + 7;
/*************************************************************************/

bool check(string s) {
    int le = 0;
    int ri = s.length() -1;
    while(le < ri) {
        if(s[le] != s[ri]) {
            return false;
        }
        le++;
        ri--;
    }
    return true;
}

string v;
void solve() {
    cin>>v;
    if(check(v) && check(v.substr(0, (v.length() -1)/2 )) && check(v.substr((v.length() + 3 )/ 2 -1))) {
        puts("Yes");
    }else {
        puts("No");
    }
}

int main()
{   

    solve();
    return 0;
 
}
 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
typedef vector< pair<int,int> > vii;
typedef long long ll;
int main()
{
    int H, N;
    cin>>H>>N;
    vii v(N);
    vector<ll> dp(H + 1, 1000000000);
    dp[0] = 0;
    for(int i = 0; i < N; i++)
    {
        cin>>v[i].F >> v[i].S;
    }
    for(int i = 1; i <= H; i++)
    {
        for(int j = 0; j < N; j++)
        {
            dp[i] = min(dp[i], dp[max(i-v[j].F, 0)] + v[j].S);
        }
    }
    cout << dp[H] << endl;
}


Measured memory_bytes: 384
#include <algorithm>
#include <iostream>

using namespace std;

int main() {
  int w;
  while (true) {
    int x = 1150;
    cin >> w;
    if (w < 0) {
      return 0;
    }
    w -= 10;
    if (w > 0) {
      x += 125 * min(10, w);
    }
    w -= 10;
    if (w > 0) {
      x += 140 * min(10, w);
    }
    w -= 10;
    if (w > 0) {
      x += 160 * w;
    }
    cout << 4280 - x << endl;
  }
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
 
#define pb push_back
#define mp make_pair

typedef long long ll; 

#define fi first
#define se second
 
#define all(x) (x).begin(), (x).end()
 
using namespace std;             
//using namespace __gnu_pbds;
 
//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const int INF = (int)1e10;

int n, a[200500];

void solve() {
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];

    int last = 0, cur = 1;

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

    if (!last) {
        cout << -1;
        return;
    }

    cout << n - last;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int tt = 1;
 
    while (tt--) {
        solve();
    }
 
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define ff first
#define ss second
#define vll vector<ll>
#define sz size()
#define pb emplace_back
#define mp make_pair
#define MOD 1000000007
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);srand(time(NULL))
const int N = 100005;

int main()
{
	ll n;
	cin>>n;
	ll ans=1e18;
	for(ll i=1;i*i<=n;i++)
	{
		if(n%i==0)
		{
			ll k=n/i;
			ans=min(ans,i-1+k-1);
		}
	}
	cout<<ans;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 1000000000000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
struct edge { int to, cost; };

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

long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

// mod. m での a の逆元 a^{-1} を計算するよ！
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


//aCbをmod.mで割った余りを求める
ll int c(ll int a, ll int b, ll int m) {
	ll int ans = 1;
	for (ll int i = 0; i < b; i++) {
		ans *= a - i;
		ans %= m;
	}
	for (ll int i = 1; i <= b; i++) {
		ans *= modinv(i, m);
		ans %= m;
	}
	return ans;
}
struct UnionFind {
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

	UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
		for (int i = 0; i < N; i++) par[i] = i;
	}
	int size(int a) {
		return par[root(a)];
	}

	int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y) { // xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
	}

	bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};

int b_s(vector<llint>&a,llint key) {
	int left = -1;
	int right = a.size();
	while (right - left > 1) {
		int mid = left + (right - left) / 2;
		if (a[mid] > key)right = mid;
		else left = mid;
	}
	return right;
}
int main() {
	llint n, m, k;
	cin >> n >> m >> k;
	hei(llint) a(n + 1, 0),b(m + 1, 0);
	rep(i, 0, n) {
		cin >> a[i+1];
		a[i + 1] += a[i];
	}
	rep(i, 0, m) {
		cin >> b[i+1];
		b[i + 1] += b[i];
	}
	
	int ans = 0;
	rep(i, 0, n + 1) {
		if(k>=a[i])ans = max(ans, b_s(b, k - a[i])-1+ i);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 6404
#include<stdio.h>
#include<iostream>
using namespace std;
int main(){
    int n;
    int k = 100;
    int div = 0;
    int amari = 0;
    cin >> n;
    for (int i = 0;i<3;i++){
        div = n/k;
        amari = n%k;
        if(div == 7){
            cout << "Yes";
            return 0;
        }
        n = amari;
        k=k/10;
    }
    cout <<"No";
    return 0;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 30)
#define MOD 1000000007
//int dy[4] = {-1,0,0,1};
//int dx[4] = {0,1,-1,0};



int main(){
  
  int n,sa,sb,ga,gb;
  string s;
  cin >> n >> sa >> sb >> ga >> gb >> s;
  vector<bool> dpa(s.size(),0),dpb(s.size(),0);
  sa--,sb--,ga--,gb--;
  dpa[sa] = dpb[sb] = true;
  for(int i = sa;i < s.size();i++){
    if(dpa[i] == false)continue;
    if(i+1 < s.size() && s[i+1] == '.'){
      dpa[i+1] = true;
    }
    if(i+2 < s.size() && s[i+2] == '.'){
      dpa[i+2] = true;
    }
  }
  for(int i = sb;i < s.size();i++){
    if(dpb[i] == false)continue;
    if(i+1 < s.size() && s[i+1] == '.'){
      dpb[i+1] = true;
    }
    if(i+2 < s.size() && s[i+2] == '.'){
      dpb[i+2] = true;
    }
  }
  if(!dpa[ga] || !dpb[gb]){
    cout << "No" << endl;
  }else if(ga > gb){
    bool is = false;
    int cnt = 0;
    for(int i = sb-1;i <= gb+1;i++){
      if(s[i] == '.')cnt++;
      else cnt = 0;
      if(cnt >= 3){
        is = true;
        break;
      }
    }
    if(is)cout << "Yes" << endl;
    else cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }

  
  


  

  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,d;
    cin>>d>>n;
    int ct=0;
    for(int i=1;i<1e7;i++){
        int cnt=0;
        int j=i;
        while(j%100==0){
            j/=100;
            cnt++;
        }
        if(cnt==d){
            ct++;
            if(ct==n)
                cout<<i;
        }
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"
#define pi 3.1415926535897932384626433832795028841971693993751058
#define maxn 100005

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define pq priority_queue
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
 
using namespace std;

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

//START OF CODE ->->->->->->->

void solve()
{
    int a,b;
    cin>>a>>b;

    if ( a != b && (a+b) % 2 != 0 )
    {
        cout<<"IMPOSSIBLE"<<endl;
    }
    else
    {
        cout<<(a+b)/2<<endl;
    }
    
}

//END OF CODE ->->->->->->->->

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

    while(t--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long i,l=0;
	string s1,s2;
	cin >> s1 >> s2;
	for(i=0;i<3;i++)
	{
		if(s1[i]==s2[i])
		{
			l++;
		}
		else
		{
			
		}
	}
	cout << l;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)

N, Q = map(int,input().split())
G = [[] for _ in range(N)]
counter = [0] * N

for _ in range(N-1):
    a, b = map(int,input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)

for _ in range(Q):
    p, x = map(int,input().split())
    counter[p-1] += x

seen = [False]*N

def dfs(v, seen, G, counter):
    seen[v] = True
    for u in G[v]:
        if not seen[u]:
            counter[u] += counter[v]
            dfs(u, seen, G, counter)

dfs(0, seen, G, counter)

for c in counter:
    print(c, end = " ")
print("")



Measured memory_bytes: 232948
#include <iostream>
#include <cstdio>
#include <vector>

int main(){
	int n, u, k, v;
	scanf("%d", &n);
	std::vector< std:: vector<int> > A(n, std::vector<int>(n, 0));
	for (int i = 0; i < n; i++){
		scanf("%d%d", &u, &k);
		for (int j = 0; j < k; j++){
			scanf("%d", &v);
			A[u - 1][v - 1] = 1;
		}
	}
	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			if (j != 0) printf(" ");
			printf("%d", A[i][j]);
		}
		printf("\n");
	}


	return 0;
}


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


const ll INF = 1e18;

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}

int main() {
  ll a, b;
  cin >> a >> b;
  ll g=gcd(a,b);
  if (g==1){
    cout<<1;
    return 0;
  }
  vector<P> f;
  ll G=g;
  for(ll i=2;i*i<=G;i++){
  //  cout<<i<<'i'<<G<<'G'<<endl;
    ll cnt=0;
    while(g%i==0){
      cnt++;
      g/=i;
    }
    if (cnt>0){
      f.push_back(make_pair(i,cnt));
  //    cout<<i<<'i'<<cnt<<'c'<<endl;

    }
  }
  if (g>1) f.push_back(make_pair(g,1));
  ll ans=0;
  ans+=f.size();
  ans++;
  cout<<ans;
}


Measured memory_bytes: 3592
// -----------------------------------------------
// Framework <https://github.com/vain0x/procon>
//
// See the bottom of file for solution.
// -----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let (N, W) = read!(usize, usize);
    let T = read![usize, i64; N];

    let mut dp = vec![vec![0; W + 1]; N + 1];

    for i in 0..N {
        let (dw, dv) = T[i];

        for w in 0..W + 1 {
            dp[i + 1][w] = max(dp[i + 1][w], dp[i][w]);

            let w2 = w + dw;
            if w2 <= W {
                dp[i + 1][w2] = max(dp[i + 1][w2], dp[i][w] + dv);
            }
        }
    }

    debug!(dp);

    let m = dp[N].iter().cloned().max().unwrap();

    println!("{}", m)
}


Measured memory_bytes: 106748
#include <iostream>
#include <string>
#include <set>
#include <vector>
#include <algorithm>


std::string input()
{
    std::string result;
    std::getline(std::cin, result, '\n');
    return result;
}

std::vector<bool> str2bit(const std::string& str)
{
    std::set<char> acgt = {'A','C','G','T'};
    std::vector<bool> result(str.size(), false);
    for(int i = 0; i < str.size(); ++i) {
        if(acgt.count(str[i]) > 0) {
            result[i] = true;
        }
    }
    return result;
}

void print(const std::vector<bool>& vec)
{
    for(auto elem: vec)
        std::cout << elem;
    std::cout << std::endl;
}

int true_continue(const std::vector<bool>& vec, int id)
{
    if(!vec[id])
        return 0;
    int length{};
    while(vec[id]) {
        ++id;
        ++length;
    }
    return length;
}

int solve(const std::string& str)
{
    auto bit = str2bit(str);
    int result{};
    for(int i = 0; i < str.size(); ++i) {
        int cont = true_continue(bit, i);
        if(cont > result)
            result = cont;
    }
    return result;
}

int main()
{
    auto in = input();
    std::cout << solve(in) << std::endl;
}


Measured memory_bytes: 256
import itertools
from collections import defaultdict
import collections
import sys
sys.setrecursionlimit(200000)
mod = 1000000007

s = list(input())
t = list(input())

ss = ''.join(s)
tt = ""
for i in range(len(t) - 1):
    tt += t[i]

if ss == tt:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9400
#include <iostream>
using namespace std;
int main(void){
string s;
int  y,ss=0;
cin>>s;
if(s[0]=='o'){
    ss++;
}
if(s[1]=='o'){
    ss++;
    }
if(s[2]=='o'){
    ss++;
}
y=(ss*100)+700;
cout<<y<<endl;
}

Measured memory_bytes: 3612
import sys

def solve(s):
    tmp_s = s
    while(len(tmp_s) > 0):
        if tmp_s.startswith("maerd"):
            tmp_s = tmp_s[5:]
        elif tmp_s.startswith("remaerd"):
            tmp_s = tmp_s[7:]
        elif tmp_s.startswith("esare"):
            tmp_s = tmp_s[5:]
        elif tmp_s.startswith("resare"):
            tmp_s = tmp_s[6:]
        else:
            return False

    return True

def main():
    line = sys.stdin.readline().rstrip()
    line_rev = line[::-1]

    if solve(line_rev):
        print("YES")
    else:
        print("NO")

    return 0

if __name__ == '__main__':
    sys.exit(main())


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

int main()
{
      long long int n , T, sum=0, A[200005];
      cin>>n>>T;
      cin>>A[0];
      for(int i=1 ; i<n; i++)
      {
            cin>>A[i];
            int ans = A[i] - A[i-1];
            //cout<<A[i]<<" "<<A[i-1] <<" "<<ans<<endl;
            if( ans <= T)
                  sum=sum+ans;
            else
                  sum=sum+T;
                  //cout<<sum<<endl;
      }
      cout<<sum+T<<endl;;
}


Measured memory_bytes: 1792
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = []
y = []
c = []
for i in range(M):
    cnt1, cnt2, cnt3 = map(int, input().split())
    x.append(cnt1)
    y.append(cnt2)
    c.append(cnt3)
ans = 10**9+7

for i in range(0, M):
    ans = min(ans, a[x[i]-1] + b[y[i]-1] - c[i])

ans = min(ans, min(a)+min(b))
print(ans)

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

using std::cin;
using std::cout;
using std::endl;
using std::string;

bool is_number(char c) {
	if (c >= '0' && c <= '9') {
		return true;
	}
	return false;
}

string operate_J(string str) {
	string ret = "";
	for (int i = 0; i < str.length()-1; i++) {
		ret += str[i];
	}
	return (str[str.length()-1] + ret);
}

string operate_C(string str) {
	string ret = "";
	for (int i = 1; i < str.length(); i++) {
		ret += str[i];
	}
	return (ret + str[0]);
}

string operate_E(string str) {
	string sub1 = "";
	string sub2 = "";
	int l = str.length();
	int div = l/2;


	if (l%2 == 0) {
		for (int i = 0; i < div; i++) {
			sub1 += str[i];
			sub2 += str[div+i];
		}
		return (sub2 + sub1);
	}
	else {
		for (int i = 0; i < div; i++) {
			sub1 += str[i];
			sub2 += str[div+i+1];
		}
		return (sub2 + str[div] + sub1);
	}
}

string operate_A(string str) {
	string ret = "";
	int l = str.length();
	for (int i = 0; i < l; i++) {
		ret += str[l-i-1];
	}
	return ret;
}

string operate_P(string str) {
	string ret = "";
	for (int i = 0; i < str.length(); i++) {
		if (is_number(str[i])) {
			if (str[i] == '0') {
				ret += "9";
			}
			else {
				ret += str[i]-1;
			}
		}
		else {
			ret += str[i];
		}
	}
	return ret;
}

string operate_M(string str) {
	string ret = "";
	for (int i = 0; i < str.length(); i++) {
		if (is_number(str[i])) {
			if (str[i] == '9') {
				ret += "0";
			}
			else {
				ret += str[i]+1;
			}
		}
		else {
			ret += str[i];
		}
	}
	return ret;
}

string trans_str(string str, char ope) {
	if (ope == 'J') {
		return operate_J(str);
	}
	if (ope == 'C') {
		return operate_C(str);
	}
	if (ope == 'E') {
		return operate_E(str);
	}
	if (ope == 'A') {
		return operate_A(str);
	}
	if (ope == 'P') {
		return operate_P(str);
	}
	if (ope == 'M') {
		return operate_M(str);
	}
	return str;
}

int main(void) {
	int n;
	cin >> n;
	for (int t = 0; t < n; t++) {
		string ope,str;
		cin >> ope;
		cin >> str;
		string ret = str;
		int l = ope.length();

		for (int i = 0; i < l; i++) {
			ret = trans_str(ret, ope[l-i-1]);
		}

		cout << ret << endl;
	}
	return 0;
}

Measured memory_bytes: 3176
#include<iostream>
using namespace std;
int main(){
	int r, c;
	cin >> r >> c;
	int a[110][110];
	for (int i = 0; i < 110; i++){
		for (int j = 0; j < 110;j++){
			a[i][j] = 0;
		}
	}

	for (int i = 0; i < r; i++){
		for (int j = 0; j < c;j++){
			cin >> a[i][j];
		}
	}

	for (int i = 0; i < r; i++){
		for (int j = 0; j < c;j++){
			a[i][c] += a[i][j];
		}
	}
	for (int i = 0; i < r; i++){
		for (int j = 0; j < c + 1;j++){
			a[r][j] += a[i][j];
		}
	}
	//cout << endl;

	for (int i = 0; i <= r;i++){
		for (int j = 0; j <= c;j++){
			cout << a[i][j];
			if (j != c)cout << ' ';
		}
		cout << endl;
	}
		return 0;
}

Measured memory_bytes: 3112
#define _USE_MATH_DEFINES
#define INF 100000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

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

static const double EPS = 1e-8;



int main(){
	int R,C;
	while(~scanf("%d %d",&R,&C)){
		if(R==C && C==0) break;

		bitset<10000> bits[10];
		for(int y=0;y<R;y++){
			for(int x=0;x<C;x++){
				int num;
				scanf("%d",&num);
				bits[y][x] = (num >=1 ? true : false);
			}
		}

		int res = 0;
		bitset<10000> tmp[10];
		for(int S=0;S<=(1<<R)-1;S++){
			for(int i=0;i<10;i++) tmp[i] = bits[i];
			
			for(int i=0;i<R;i++){
				if(S & (1<<i)) tmp[i].flip();
			}

			int sum = 0;
			for(int x=0;x<C;x++){
				int rev = 0;
				for(int y=0;y<R;y++){
					if(tmp[y][x]) rev++;
				}
				rev = max(R-rev,rev);
				sum += rev;
			}
			res = max(sum,res);
		}


		printf("%d\n",res);

	}
}

Measured memory_bytes: 0
#include<stdio.h>
#include<string.h>
 
#define N 1001
 
char X[N], Y[N];
 
  
void LCS(char X[], char Y[]){
  int i,j;
  int C[1001][1001]; 
  int m = strlen(X+1), n = strlen(Y+1);
  
  for(i = 1; i < m+1; i++){
    C[i][0] = 0;
  }
  for(i = 0; i < n+1; i++){
    C[0][i] = 0;
  }
  for(i = 1; i < m+1; i++){
    for(j =1; j < n+1; j++){
      if(X[i] == Y[j]){
        C[i][j] = C[i-1][j-1]+1;
      }else if(C[i-1][j] >= C[i][j-1]){
        C[i][j] = C[i-1][j];
      }else{
        C[i][j] = C[i][j-1];
      }
    }
  }
  
  printf("%d\n",C[i-1][j-1]);
}
  
int main(){
  int i,n;
  scanf("%d",&n);
  for(i = 0; i < n; i++){
    scanf("%s",X+1);
    scanf("%s",Y+1);
    LCS(X,Y);
  }
  
  return 0;
}

Measured memory_bytes: 4520
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			int[] a = IntStream.range(0, n).map(i -> scanner.nextInt()).sorted().toArray();
			// 最大値を取得する
			int max = a[n - 1];
			// 最大値/2に一番近い値を取得する
			int[] b = new int[n - 1];
			IntStream.range(0, n - 1).forEach(i -> b[i] = Math.min(a[i], max - a[i]));
			Arrays.sort(b);
			int next = b[n - 2];
			System.out.println(max + " " + ((Arrays.binarySearch(a, next) >= 0) ? next : (max - next)));
		}
	}
}


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

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

	vector<int> a(n+1) ;
	vector<int> b(n) ;

	rep(i,n+1){
		cin>>a[i] ;
	} 

	rep(i,n){
		cin>>b[i] ;
	}

	ll ans=0 ;

	rep(i,n){

		int x=min(a[i],b[i]) ;
		ans+=x ;
		b[i]-=x ;
		x=min(a[i+1],b[i]) ;
		ans+=x ;
		a[i+1]-=x ;

	}

	cout<<ans ;
	

	
}


int main(){

	
	int y ;

	y=1 ;
	//cin>>y ;

	while(y--)
	{	
		solve() ;
	}

}

Measured memory_bytes: 4024
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████   
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████  
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define INF (1LL<<60)
#define fs first
#define sc second
#define pb push_back
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<vector<P> > Graph;

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(0);  
  //問題文を読む時間をケチらない！！

  int k,a,b;
  cin >> k >>a >> b;

  if(a+2 >= b || k <= a) cout << k+1 << endl;

  else{
    int tmp = max(0LL,k-(a-1));
    int ans = a + (b-a)*(tmp/2);
    if(tmp % 2 == 1) ans++;
    cout << ans << 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;
using ll = int64_t;
using pint = pair<int, int>;

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

    ll k;
    cin >> k;

    ll one_length = 0;
    char ans;
    for (int i = 0; i < (int)s.size(); ++i)
    {
        if (s[i] != '1')
        {
            ans = s[i];
            break;
        }
        else
            ++one_length;
    }

    if (k <= one_length)
        cout << "1" << endl;
    else
        cout << ans << endl;
}

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

int N, M;
int A[1000000], B[1000000];

bool binary_search(int x) {
    int left = 0, right = N, mid;
    while (left < right) {
        mid = (left + right) / 2;
        if (A[mid] == x)
            return true;
        if (x < A[mid])
            right = mid;
        else
            left = mid + 1;
    }
    return false;
}

int main() {
    cin >> N;
    for (int i = 0; i < N; i++)
        cin >> A[i];
    cin >> M;
    for (int i = 0; i < M; i++)
        cin >> B[i];

    sort(A, A + N);
    sort(B, B + M);
    int ans = 0;
    for (int i = 0; i < M; i++) {
        if (binary_search(B[i]))
            ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3736
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int K = 3005;
int x[K][K];
int n,k;
int getsize(int x1,int y1,int x2,int y2){
    return x[x2][y2]-x[x2][y1]-x[x1][y2]+x[x1][y1];
}
int main(){
    scanf("%d%d",&n,&k);
    int a,b,i,j;
    char c;
    for(i = 1; i <= n; i++){
        scanf("%d%d %c",&a,&b,&c);
        a %= (2*k);
        b %= (2*k);
        if(c == 'W')
            b += k;
        x[a%(2*k)+1][b%(2*k)+1]++;
    }
    for(i = 1; i <= 2*k; i++){
        for(j = 1; j <= 2*k; j++){
            x[i][j] = x[i][j]+x[i-1][j]+x[i][j-1]-x[i-1][j-1];
        }
    }
    int ans = 0,sum;
    for(i = 1; i <= k; i++){
        for(j = 1; j <= k; j++){
            sum = getsize(0,0,i,j);
            sum += getsize(i,j,k+i,k+j);
            sum += getsize(k+i,k+j,2*k,2*k);
            sum += getsize(k+i,0,2*k,j);
            sum += getsize(0,k+j,i,2*k);
            sum = max(n-sum,sum);
            ans = max(ans,sum);
        }
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 24832
"use strict";
function Main(input) {
    let at = input.split("\n").map((v) => v - 0);
    let k = at[5];
    for (let n = 0; n < 4; n++) {
        for (let m = n+1; m < 5; m++) {
            let d = at[m] - at[n];
            if (d > k) {
                console.log(':(');
                return;
            }
        }
    }
    console.log('Yay!');
}
if (typeof window === 'undefined') Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;
int a[10010];
int main(){
    int n,i,cg=0,ans=0;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d",&a[i]);
        if(cg){cg=0;continue;}
        if(a[i]==a[i-1]) cg=1,ans++;
        else cg=0;
    }
    printf("%d",ans);
    return 0;
}


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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PI acos(-1.0)
#define eps 1e-6
#define pf printf
#define sf scanf
#define sd(n) scanf("%d", &n)
#define sdd(n1, n2) scanf("%d %d", &n1, &n2)
#define sddd(n1, n2, n3) scanf("%d %d %d", &n1, &n2, &n3)
#define sl(n) scanf("%lld", &n)
#define sll(n1, n2) scanf("%lld %lld", &n1, &n2)
#define slll(n1, n2, n3) scanf("%lld %lld %lld", &n1, &n2, &n3)
#define rep(i, n) for (i = 0; i < n; ++i)
#define rep0(i, n) for (i = 0; i <= n; ++i)
#define rep1(i, n) for (i = 1; i <= n; ++i)
#define repp(i, a, n) for (i = a; i <= n; ++i)
#define repb(i, a, n) for (i = a; i >= n; --i)
#define asort(a) sort(a.begin(), a.end())
#define all(a) (a).begin(), (a).end()
#define sq(n) (n)*(n)
#define mem(a, n) memset(a, n, sizeof(a))

using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    int n, i, j;
    string s;
    cin >> n >> s;
    j = s.size();
    rep(i, j) {
        s[i] += n;
        if (s[i] > 'Z') s[i] -= 26;
    }
    cout << s << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;

template <typename T>
T gcd(T a, T b){
    if(b == 0) return a;
    return gcd(b, a % b);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, x_s;
    cin >> n >> x_s;
    int ans;
    cin >> ans;
    ans = abs(ans - x_s);
    REP(i, n - 1) {
        int x;
        cin >> x;
        x = abs(x - x_s);
        ans = gcd(ans, x);
    }
    cout << ans << endl;
    return 0;
}


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

vector<ll>to[100005];
vector<ll>point;
vector<ll>check;
vector<ll>res(100005);
ll x,y;

void dfs(ll v, ll p=-1){
  
  res[x]++;
  check[v]=x;
  for(int i=0; i<to[v].size(); i++){
    ll u=to[v][i];
    if(u==p) continue;
    if(check[u]!=-1) continue;
    dfs(u,v);
  }
  
}


int main(){
  ll n,m,k;
  cin >> n >> m >> k;
  
  point.resize(n);
  check.resize(n,-1);
  
  for(int i=0; i<m; i++){
    ll a,b;
    cin >> a >> b;
    a--; b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  
  vector<ll>noto[n];
  for(int i=0; i<k; i++){
    ll a,b;
    cin >> a >> b;
    a--; b--;
    noto[a].push_back(b);
    noto[b].push_back(a);
  }
  
  for(int i=0; i<n; i++){
    if(check[i]!=-1){
      point[i]=res[check[i]];
      continue;
    }
    x=i;
    dfs(i);
    point[i]=res[i];
  }
  
  for(int i=0; i<n; i++){
    point[i]-=to[i].size();
    for(int j=0; j<noto[i].size(); j++){
     if(check[i]==check[noto[i][j]])point[i]--;
    }
    cout << point[i]-1 << " " ;
  }
  
  
}
  
  
  
  


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

int main() {
  int N;
  int M;
  int64_t K;
  cin >> N;
  cin >> M;
  cin >> K;
  vector<int64_t> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  vector<int64_t> B(M);
  for (int j = 0; j < M; j++) {
    cin >> B[j];
  }

  int64_t total_time = 0;
  int max_read;
  int a = 0;
  int b = 0;
  while (a < N) {
    if (total_time + A[a] > K) {
      break;
    }
    total_time += A[a];
    a++;
  }

  max_read = a;

  while (b < M) {
    if (total_time + B[b] <= K) {
      total_time += B[b];
      b++;
      max_read = max(a + b, max_read);
    } else if (a > 0) {
      a--;
      total_time -= A[a];
    } else {
      break;
    }
  }

  cout << max_read << endl;
}


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

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

	int N; cin >> N;
	int a[110];
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	sort(a, a + N);
	int ans = 100000000;
	for (int i = a[0]; i <= a[N - 1]; i++) {
		int sum = 0;
		for (int j = 0; j < N; j++) {
			sum += pow((i - a[j]), 2);
		}
		ans = min(sum, ans);
	}
	cout << ans;
}

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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FasterScanner in = new FasterScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, FasterScanner in, PrintWriter out) {
            final int a = in.nextInt();
            final int b = in.nextInt();
            final int c = in.nextInt();
            if (a == b) out.println(c);
            else if (a == c) out.println(b);
            else out.println(a);
        }

    }

    static class FasterScanner {
        private InputStream in;
        private byte[] buffer;
        private int bufPointer;
        private int bufLength;

        public FasterScanner(InputStream in) {
            this.in = in;
            buffer = new byte[1024];
        }

        private boolean hasNextByte() {
            if (bufPointer < bufLength) return true;
            bufPointer = 0;
            try {
                bufLength = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            return (bufLength > 0);
        }

        private int readByte() {
            if (hasNextByte()) return buffer[bufPointer++];
            return -1;
        }

        private static boolean isPrintableChar(int c) {
            return (c >= 33 && c <= 126);
        }

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

        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }

        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || b > '9') throw new NumberFormatException();

            while (true) {
                if (b >= '0' && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

    }
}



Measured memory_bytes: 23380
#include <iostream>
#include <sstream>

int main () {
  int n1,cnt=0;
  std::cin>>n1;
  int S[n1];
  for(int i=0;i<n1;i++){
    std::cin>>S[i];
  }
  int n2;
  std::cin>>n2;
  int T[n2];
  for(int i=0;i<n2;i++){
    std::cin>>T[i];
  }

  int left=0;
  int right=n1-1;
  int c,num;
  for(int i=0;i<n2;i++){
    num=T[i];
    left=0;
    right=n1-1;
    while(left<=right){
      c=int((left+right)/2.0);
      if(S[c]>num){
	right=c-1;
      }
      if(S[c]<num){
	left=c+1;
      }
      if(S[c]==num){
	cnt++;
	break;
      }
    }
  }
  std::cout<<cnt<<'\n';
  return 0;
}


Measured memory_bytes: 3660
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#pragma region Macros
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define all(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define CEIL(a,b) ((a+b-1)/b)
int GCD(int a, int b) // assuming a,b >= 1
{
	if (a < b)
		swap(a, b);
	if (b == 0)
		return a;
	if (a % b == 0)
		return b;
	return GCD(b, a % b);
}
int LCM(int a, int b) // assuming a,b >= 1
{
	return  a * b / GCD(a, b);
}
inline bool BETWEEN(int x, int min,int max) {
	if (min <= x && x <= max)
		return true;
	else
		return false;
}
using namespace std;
#pragma endregion
signed main() {
	int A,B;
	cin >>A >> B ;
	cout << (A+B)%24;
}

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

int a, b, g;

int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

int main() {
	scanf("%d%d", &a, &b);
	g = gcd(a, b);
	cout<<1LL*a/g*b<<endl;
	
	return 0;
}

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

int main() {
  int K ;  
  string S ;
  
  cin >> K ;
  
  cin >> S ;
  
  if (S.size() > K){
    for (int i = 0 ; i < K ; i++ ){
    cout << S.at(i) ;
    }
    cout << "..." << endl ; 
  }
  
  else {
    cout << S << endl ; 
    
  }
  
  
  
}

Measured memory_bytes: 3620
#ABC52.B
N = int(input())
S = input()
x = 0
cnt = 0

for i in range(N):
    if S[i]=='I':
        cnt +=1
        x = max(x,cnt)
    elif S[i]=='D':
        cnt -=1
        x = max(x,cnt)
print(x)


Measured memory_bytes: 2940
import java.util.*;
 
public class Main{
  static public void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int num[] = new int[3];
    num[0] = sc.nextInt();
    num[1] = sc.nextInt();
    num[2] = sc.nextInt();
    
    int count5 = 0, count7 = 0;
    
    for(int i=0; i<3; i++){
      if(num[i] == 5){
        count5++;
      }else if(num[i] == 7){
        count7++;
      }else{
        System.out.println("NO");
      }
    }
    
    if(count5 == 2 && count7 == 1)
      System.out.println("YES");
    else{
      System.out.println("NO");
    }
    
  }
}

Measured memory_bytes: 23764
#include <cmath>

#include <cstdlib>
#include <iostream>
#include <string>
#include <typeinfo>

using namespace std;
int main (){
    int A,B;
    cin >> A >> B;
    string As,Bs;
    As = to_string(A);
     Bs = to_string(B);
    string Cs=As+Bs;
    int C = stoi(Cs);
    double sCd = sqrt(C);
    int sCi = int(sCd);
    double sCdd = double(sCi);
    if (sCd==sCdd){
        cout << "Yes";
    }else{
        cout << "No";
    }
    return 0;
}



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

using namespace std;

#define int long long
#define MOD 1000000007

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>
void print(T x)
{
    std::cout << x << '\n';
}

//typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 100005
//#define int long long

int h, w;

signed main()
{
    cin >> h >> w;

    int x = h * w;

    int anc = ceil(x / 2.0);

    if (h == 1 || w == 1)
    {
        cout << "1" << endl;
        return 0;
    }

    cout << anc << endl;

    return 0;
}


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

using namespace std;

// #define mod 1000000007
// #define mod1 9982
#define int  long long int
#define pii pair<int,int>
#define vpii vector<pii>
#define vi vector<int>
#define fi first
#define se second
#define psb push_back
#define ppb pop_back
#define fio ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL)
#define all(x) x.begin(),x.end()
#define endl "\n"

const int maxn=5e5+5;
int bit[maxn];
int vis[maxn];
int ar[maxn];
int ans[maxn];

vector<tuple<int,int,int>> v;

void update(int x,int v)
{
    for(;x<maxn;x += x&-x)
        bit[x]+=v;
}

int query(int x)
{
    int sum=0;
    for(;x;x -= x&-x)
        sum+=bit[x];
    return sum;
}

void solve()
{
    for(int i=0;i<maxn;i++)
    {
        vis[i]=-1;
        bit[i]=0;
    }
    int n,q;
    cin>>n>>q;
    for(int i=1;i<=n;i++)
        cin>>ar[i];
    for(int i=1;i<=q;i++)
    {
        int l,r;
        cin>>l>>r;
        v.psb({r,l,i});
    }
    sort(all(v));
    int j=0,l,r,ind;
    for(int i=1;i<=n;i++)
    {
        if(vis[ar[i]]!=-1)
            update(vis[ar[i]],-1);
        vis[ar[i]]=i;
        update(vis[ar[i]],1);
        while(j<q)
        {
            tie(r,l,ind)=v[j];
            if(r!=i)
                break;
            ans[ind]=query(r)-query(l-1);
            j++;
        }
    }
    for(int i=1;i<=q;i++)
        cout<<ans[i]<<endl;
}

int32_t main()
{
    fio;
    int t;
    // cin>>t;
    t=1;
    while(t--)
        solve(); 
}

/*
./a.out <input.txt > output.txt
*/


Measured memory_bytes: 31252
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n,m; cin>>n>>m;
	vector<bool> v1(m,true),v2(m);
	int tmp,num;
	//for(auto i:v1) cout<<i<<" "; cout<<"\n\n";
	REP(i,1,n)
	{
		cin>>tmp;
		fill(v2.begin(),v2.end(),false);
		REP(j,1,tmp)
		{
			cin>>num;
			v2[num-1]=true;
		}
		//for(auto i:v2) cout<<i<<" "; cout<<"\n";
		//for(auto i:v1) cout<<i<<" "; cout<<"\n";
		REP(j,0,m-1)
		{
			v1[j]=(v1[j] && v2[j]);
		}
		//for(auto i:v1) cout<<i<<" "; cout<<"\n\n";
	}
	int cnt=0;
	REP(i,0,m-1) if(v1[i]) cnt++;
	cout<<cnt<<"\n";
	return 0;
}







Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<utility>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#define EPS 1e-9
#define PI acos(-1.0)
#define INF 0x3f3f3f3f
#define LL long long
const int MOD = 1E9+7;
const int N = 100000+5;
const int dx[] = {0,0,-1,1,-1,-1,1,1};
const int dy[] = {-1,1,0,0,-1,1,-1,1};
using namespace std;

int x[N];
int dp[N][50];
int main(){
    int n;
    scanf("%d",&n);
    for(int i=1; i<=n; i++)
        scanf("%d",&x[i]);

    int L,Q;
    scanf("%d%d",&L,&Q);
    for(int i=1; i<=n ;i++){
        int pos=upper_bound(x+1,x+1+n,x[i]+L)-x-1;
        if(x[i]+L>=x[n])
            dp[i][0]=n;
        else
            dp[i][0]=pos;
    }

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

    while(Q--){
        int a,b;
        scanf("%d%d",&a,&b);
        if(b<a)
            swap(a,b);
        LL res=0;
        for(int i=30; i>=0; i--){
            if(dp[a][i]<b){
                res+=(1<<i);
                a=dp[a][i];
            }
        }
        printf("%lld\n",res+1);
    }
    return 0;
}


Measured memory_bytes: 20736
import java.util.*;
public class Main {
  
  private static long X = 1000000007;
  
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    
    long[][] memo = new long[N+1][N+1];
    for (int i = 0; i <= N; i++) {
      for (int j = 0; j <= N; j++) {
        memo[i][j] = -1;
      }
    }
    for (int i = 1; i <= K; i++) {
      long count = (comb(N-K+1, i, memo) * comb(K-1, i-1, memo)) % X;
      System.out.println(count);
    }
  }
  
  private static long comb(int n, int r, long[][] memo) {

    if (r == n || r == 0) {
      return 1;
    }
    if (n == 0) {
      return 0;
    }

    if (memo[n][r] != -1) {
      return memo[n][r];
    }

    memo[n][r] = (comb(n-1, r-1, memo) + comb(n-1, r, memo)) % X;
    
    return memo[n][r];
  }
}


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

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

		int x[n];

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

		for(int i=0;i<n-1;i++){
				cout<<x[n-1-i]<<' ';
		}

		cout<<x[0]<<endl;

		return 0;
}

Measured memory_bytes: 3112