akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<long long> vll;

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   string a,b,c;
   cin>>a>>b>>c;
   cout<<'A'<<b.at(0)<<'C';
   return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD @
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int main(){
  int n, m, c, b[100], a[100][100], ans=0;
  cin >> n >> m >> c;
  for(int i=0;i<m;i++)cin >> b[i];
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++)cin >> a[i][j];
    int x=c;
    for(int j=0;j<m;j++)x+=a[i][j]*b[j];
    if(x>0)ans++;
  }
  cout << ans << endl;
  return 0;
}


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

const int pr = 998244353;

long long invv(long long x){
    int lft = pr - 2;
    long long gop = x, ret = 1;
    while(lft){
        if(lft&1) ret = (ret * gop) % pr;
        lft >>= 1;
        gop = (gop * gop) % pr;
    }
    return ret;
}

long long fact[300001], inv[300001];

int main(){
    int n;
    long long a, b, k;
    scanf("%d%lld%lld%lld",&n,&a,&b,&k);
    fact[0] = inv[0] = 1;
    for(int i=1;i<=n;i++){
        fact[i] = (fact[i-1] * i) % pr;
        inv[i] = invv(fact[i]);
    }
    long long gcdd = __gcd(a, b);
    if(k % gcdd){
        printf("0\n");
        return 0;
    }
    a /= gcdd; b /= gcdd; k /= gcdd;
    long long aa, bb;
    aa = -1;
    for(int i=0;i<=b;i++){
        if(k < a * i) break;
        if((k - (a * i)) % b == 0){
            aa = i;
            bb = (k - (a * i)) / b;
        }
    }
    if(aa == -1){
        printf("0\n");
        return 0;
    }
    long long ans = 0;
    while(aa <= n && bb >= 0){
        //printf("%lld %lld\n", aa, bb);
        if(bb <= n){
            long long cal1 = fact[n], cal2 = fact[n];
            cal1 = (cal1 * inv[aa]) % pr;
            cal1 = (cal1 * inv[n-aa]) % pr;
            cal2 = (cal2 * inv[bb]) % pr;
            cal2 = (cal2 * inv[n-bb]) % pr;
            cal1 = (cal1 * cal2) % pr;
            ans = (ans + cal1) % pr;
        }
        aa += b;
        bb -= a;
    }
    printf("%lld\n", ans);
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ut i=(a);i<(ut)(b);i++)
#define REP(i,b) FOR(i,0,b)
#define ALL(c) c.begin(),c.end()
#define PB push_back
#define cat //cout << __LINE__ << endl;
using namespace std;
typedef long long LL;
typedef double ld;
typedef LL ut;
typedef vector<ut> VI;
typedef pair<ut,ut> pr;
typedef pair<ut,pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef priority_queue<ut,VI> PQ;
const int SIZE=2*1e5;
const LL INF=1<<30;
const LL p=7+1e9;
VI A,B,C;

int main(){
	string s;
	LL x,y,z;
	LL ans=0;
	LL N,K;
	cin >> N;
	A=VI(N);
	B=VI(N);
	C=VI(N);
	REP(i,N){cin >> A[i];}
	REP(i,N){cin >> B[i];}
	REP(i,N){cin >> C[i];}
	sort(ALL(A));sort(ALL(B));sort(ALL(C));
	int nowA=0,nowC=0;
	REP(i,N){
		while(A[nowA]<B[i] and nowA!=N) nowA++;
		while(C[nowC]<=B[i] and nowC!=N) nowC++;
		ans+=nowA*(N-nowC);
	}

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

Measured memory_bytes: 2560
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		// TODO ABC_085_B
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();

		int[] D = new int[N+1];
		Arrays.fill(D, 0);

		int i=0, j=0, tmp = 0;
		int ret = 0;

		for(i = 0;i < N; i++) {

			tmp = sc.nextInt();

			for(j=0; j<=i; j++) {
				if(D[j] == tmp) {
					break;
				} else if(D[j] == 0){
					D[j] = tmp;
					break;
				}
			}
		}
		// Scannerクラスのインスタンスをクローズ
		sc.close();

		for(i = 0;i < N+1; i++) {
			if(D[i] == 0) {
				// 出力
				ret = i;
				break;
			}
		}
		System.out.println(ret);
	}
}


Measured memory_bytes: 36004
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;


int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    ll sum1 = 0, sum2 = 0;
    ll diff;
    ll min_diff = 3*1e15;

    for(int i = 0; i < n; i++){
        cin >> a[i];
        sum2 += a[i];
    }
    for(int i = 0; i < n-1; i++){
        sum1 += a[i];
        sum2 -= a[i];
        min_diff = min(min_diff, abs(sum1-sum2));
    }
    cout << min_diff << endl;

    return 0;

}


Measured memory_bytes: 1792
//! Framework <https://github.com/vain0x/procon>

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

use std::collections::*;

pub struct Scan(Box<dyn Iterator<Item = &'static str>>); // '

impl Scan {
    fn new() -> Self {
        let mut buf = String::new();
        let read_line = move || {
            std::io::stdin().read_line(&mut buf).unwrap();
            Box::leak(buf.split_off(0).into_boxed_str()).split_whitespace()
        };
        Scan(Box::new(std::iter::repeat_with(read_line).flatten()))
    }

    pub fn word<T: std::str::FromStr>(&mut self) -> T {
        self.0.next().unwrap().parse().ok().unwrap()
    }

    pub fn list<T: std::str::FromStr>(&mut self, len: usize) -> Vec<T> {
        std::iter::repeat_with(|| self.word()).take(len).collect()
    }
}

// editorial の解法

const P: usize = 998244353;

fn main() {
    let mut scan = Scan::new();

    let N = scan.word::<usize>();
    let S = scan.word::<usize>();
    let A = scan.list::<usize>(N);

    // dp[i][x] = n
    //    T を 0..i の部分集合とし、U を T の部分集合とする。
    //    ΣA(j) (j∈U) = x となる。
    //    このような状態の数が n
    let mut dp = vec![vec![0; S + 1]; N + 1];

    // i = 0 のとき T = U = {} しかありえない。
    dp[0][0] = 1_usize;

    for i in 0..N {
        for x in 0..=S {
            // i を T, U の両方に入れる。
            if x + A[i] <= S {
                dp[i + 1][x + A[i]] += dp[i][x];
            }

            // i を T に入れて、U には入れない。
            // または、i を T にも U にも入れない。(遷移先は同じ。)
            dp[i + 1][x] += dp[i][x] * 2;
        }

        for x in 0..=S {
            dp[i + 1][x] %= P;
        }
    }

    println!("{}", dp[N][S]);
}


Measured memory_bytes: 72592
N,x,MOD = map(int, input().split())
s = x
flag = False
sflag = False
if N == 1:
  flag = True
  sflag = True
  print(s)
for i in range(1,MOD):
  x = (x*x) % MOD
  s += x
  if N == (i+1):
    flag = True
    break
if flag == True:
  if sflag == False:
    print(s)
else:
  t_s = 0
  cnt = 0
  init = x
  for i in range(MOD):
    x = (x*x) % MOD
    t_s += x
    cnt += 1
    if x == init:
      break
  bi = (N-MOD)//cnt
  res = (N-MOD)%cnt
  s += t_s * bi
  for i in range(res):
    x = (x*x) % MOD
    s += x
  print(s)

Measured memory_bytes: 9244
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, int> Pli;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const int mod = 1e+9 + 7;
const int INF = 1e+9;

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

    int n;
    cin >> n;
    vector<Pli> a(n);
    for(int i = 0; i < n; ++i){
        ll p;
        cin >> p;
        a[i] = P(p, i);
    }
    sort(a.begin(), a.end(), greater<P>());
    set<int> s;
    ll res = 0;
    for(int i = 0; i < n; ++i){
        int pos = a[i].second;
        s.insert(pos);
        vector<int> left(2, -1);
        vector<int> right(2, n);
        auto it = s.find(pos);
        for(int j = 0; j < 2; ++j){
            if(it == s.begin()) break;
            --it;
            left[j] = *it;
        }
        it = s.find(pos);
        for(int j = 0; j < 2; ++j){
            ++it;
            if(it == s.end())   break;
            right[j] = *it;
        }
        res += a[i].first * ((left[0]-left[1]) * (right[0]-pos) + (pos-left[0]) * (right[1]-right[0]));
    }
    cout << res << endl;
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
#define Max(a) (*max_element(ALL(a)))
#define Min(a) (*min_element(ALL(a)))
using namespace std;
struct UF
{
  vector<ll> par;
  vector<ll> sz;
  vector<ll> rank;
  UF(ll n):par(n),sz(n),rank(n){
    for(ll i = 0; i < n; i++){
      par[i] = i;sz[i] = 1;rank[i] = 0;
    }
  }
  ll find(ll x) {
    if (par[x] == x) return x;
    else return par[x] = find(par[x]);
  }
  void merge(ll x, ll y) {
    x = find(x); y = find(y);
    if (x == y) return;
    if(rank[x] < rank[y]){
      par[x] = y;
      sz[y] += sz[x];
    }
    else{
      par[y] = x;
      sz[x] += sz[y];
      if(rank[x] == rank[y])rank[x]++;
    }
  }
  bool same(ll x, ll y) { return find(x) == find(y); }
  ll size(ll n){return sz[find(n)];}
};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m;cin>>n>>m;
  UF uni(n);
  for(ll i=0;i<m;i++){
    ll a,b;cin>>a>>b;
    a--;b--;
    uni.merge(a,b);
  }
  ll ans = 0;
  for(ll i=0;i<n;i++){
    ans = max(ans,uni.size(i));
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 7932
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<string>
#include<vector>
#include<cctype>
using namespace std;
int main(){
	int co[4][3][10]={0};//[棟][階][部屋]
	int n;
	cin>>n;int b,f,r,v;
	for(int i=0;i<n;i++){
		cin>>b>>f>>r>>v;//b棟f階のr番目の部屋にv人が追加で入居した
		b--;f--;r--;
		co[b][f][r]+=v;
	}
	for(int i=0;i<4;i++){
		for(int j=0;j<3;j++){
			for(int k=0;k<10;k++){
				cout<<" "<<co[i][j][k];
			}
			cout<<endl;
		}
		
		if(i<3)cout<<"####################"<<endl;
	}

return 0;
}

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

using namespace std;

#define int long long
#define fr(i, n) for(int i=0;i<n;i++)
#define frr(i, n) for(int i=n;i>=0;i--)
#define fra(i, a, n) for(int i=a;i<n;i++)
#define frra(i, a, n) for(int i=a;i>=n;i--)
#define f(i, a) for(auto &i:a)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define ff first
#define ss second
#define endl '\n'

typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef map<int, int> mii;
typedef set<int> si;
typedef unordered_map<int, int> uii;
typedef unordered_set<int> usi;

const int mod = 1e9 + 7;
const int MAXN = 2e5 + 5;
const int inf = 1e9+10;
const double eps = 1e-9;
const double pi = 3.14159265358979323;

int power(int x, int y) {
    int res = 1;
    while (y) {
        if (y & 1)res = (res * x) % mod;
        x = (x * x) % mod;
        y >>= 1;
    }
    return res;
}

void solve() {
    //CODE BEGIN
    int n, W;
    cin >> n >> W;
    vi wt(n), v(n);
    vi dp(MAXN, inf);
    for (int i = 0; i < n; ++i) {
        cin >> wt[i] >> v[i];
    }
    dp[0] = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = MAXN - 1; j >= v[i]; --j) {
            dp[j] = min(dp[j], wt[i] + dp[j - v[i]]);
        }
    }
    int maxx = 0;
    fr(i, MAXN)if (dp[i] <= W)maxx = max(maxx, i);
    cout << maxx << endl;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int test = 1;
//    cin >> test;
    for (int i = 0; i < test; ++i) {
//        cout << "Case #" << i + 1 << ": ";
        solve();
    }
    return 0;
}


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

using namespace std;

int main()
{
  int n, *d;
  cin >> n;
  d = new int[n];

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

  sort(d, d+n);

  cout << d[n/2] - d[n/2 - 1] << endl;

  delete [] d;

  return 0;
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
class Scanner //標準入力
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int Int() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = Int() + add;
        }
        return Array;
    }

    public long Long() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = Long() + add;
        }
        return Array;
    }
}
class Program {
    static Scanner cin = new Scanner();

    static void Main(string[] args) {
        int N = cin.Int();
        int M = cin.Int();

        for (int g = M / N; g >= 1; g--) {
            if (M % g == 0) {
                Console.WriteLine(g); break;
            }
        }
        Console.ReadLine();
    }
}


Measured memory_bytes: 13140
#include<cstdio>
#include<cstring>
#include<algorithm>
typedef long long ll;
int sum = 0;

template<typename T>
inline void read(T &x){
    x = 0; char ch = getchar(); int f = 1;
    for(;ch < '0' || ch > '9'; ch = getchar()) if(ch == '-') f = -1;
    for(;ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
    x *= f;
}
int main(){
    char ch = getchar();
    for(;ch < '0' || ch > '9'; ch = getchar()) ;
    for(;ch >= '0' && ch <= '9'; ch = getchar()) sum = (sum + ch - '0') % 9;
    if(!sum) printf("Yes\n");
    else printf("No\n");
    return 0;
}
/*

*/

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

int main(){
    int n, k;
    cin>>n>>k;
    int h[n];
    vector <int> cost(n, INT32_MAX);

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

    cost[0] = 0;
    
    for(int i = 0; i < n; ++i){
        for(int j = i + 1; j <= i + k; ++j){ 
            if(j < n){
                cost[j] = min(cost[j], cost[i] + abs(h[i] - h[j]) );
            }
        }
    }
    cout<<cost[n-1]<<"\n";
    
    return 0;
}

Measured memory_bytes: 1024
/*Coded by::
    **Avinash Tiwary**
    **BE/10298/2015**
    **Production Engineer**
    **Producing <code>**
*/
#include<bits/stdc++.h>
#define buf ios_base::sync_with_stdio (0), cin.tie (0)
typedef long long ll;
typedef double dob;
#define MAX 50010
#define M5 500009
#define M6 2000009
#define M 1000000007
#define inf LLONG_MAX
using namespace std;
typedef vector<ll> V;
typedef queue<ll > Q;
typedef stack<ll> S;
typedef pair<ll,ll> P;
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
ll fac[M6],not_prime[M6],ar[M6];
ll power(ll x,ll n)
{   if(n==0) return 1;
    else if(n%2 == 0) return power((x*x),n/2);
    else return (x*power((x*x),(n-1)/2));
}
void fact(){
    fac[0]=1;
    for(ll i=1;i<21;i++) fac[i]=(i*fac[i-1]);
}
void sieve(){
    not_prime[1]=1; not_prime[0]=1;
    for(ll p=2;p*p<M6;p++){
        if(!not_prime[p]){
            for(ll i=p*2;i<=M6;i+=p) not_prime[i]=1;
        }
    }
}
ll modi(ll a, ll m){
    ll m0 = m, t, q; ll x0 = 0, x1 = 1;
    if (m == 1) return 0;
    while (a > 1){  q = a / m; t = m; m = a % m, a = t;t = x0;x0 = x1 - q * x0; x1 = t;}
    if (x1 < 0) x1 += m0;return x1;
}
int main(){
    buf; 
    //sieve(); 
    //fact();
    ll i,j,k,test,flag,ans,n,p,m,t,a,b,c; string s1;
    //cin>>test;
    test=1;
    while(test--){
        cin>>s1;
        string te=s1; reverse(te.begin(),te.end());
        if(s1==te) {cout<<"0"; return 0;}
        string s2="";
        for(i=0;i<s1.size();i++) if(s1[i]!='x') s2+=s1[i];
        te=s2; reverse(te.begin(),te.end());
        if(s2==te){
            i=0;
            V v1,v2; ll i1=0,i2=0;
            for(j=0;j<s1.size();j++) v1.pb(0),v2.pb(0);
            while(i<s1.size()){
                if(s1[i]!='x') i1++;
                else v1[i1]++;
                i++;
            }
            if(s1[i-1]!='x') v1.pb(0),i1++;
            else i1++;
            j=s1.size()-1;
            while(j>=0){
                if(s1[j]!='x') {
                    i2++;
                }
                else {v2[i2]++;}
                j--;
            }
            if(s1[0]!='x') v2.pb(0),i2++;
            else i2++;
            ll x=0;
            for(i=0;i<s1.size();i++) if(s1[i]=='x') x++;
            ans=0;
            for(i=0;i<i1;i++){
                ans+=max(v1[i],v2[i]);
            }
            cout<<ans-x;
            return 0;
        }
        cout<<"-1";
    }
    return 0;
} 

Measured memory_bytes: 2244
#include <iostream>

using namespace std;

int main (){

    int x;
    cin  >> x;

int unitDigit = x %10;

if(unitDigit == 2 || unitDigit == 4 || unitDigit == 5 || unitDigit == 7 || unitDigit == 9){
    cout << "hon";
} else if (unitDigit == 3){
    cout << "bon";
} else {
    cout << "pon";
}

    return 0;   
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define MOD 1000000007
template <typename Type>
istream &operator>>(istream &in, vector<Type> &vec) {
    ll n = vec.size();
    for (ll i = 0; i < n; i++)
        in >> vec[i];
    return in;
}
template <typename Type>
ostream &operator<<(ostream &out, vector<Type> &vec) {
    for (auto val : vec)
        out << val << " ";
    return out;
}
#define PI 3.14159265
bool istriangle(ll a,ll b,ll c)
{
    if(a==b || a==c || b==c)
    return false;
    if(a+b>c && a+c >b && b+c>a)
    return true;
    else 
    return false;
}
void solve()
{
    ll ans = 0;
    ll n;
    cin>>n;
    vector<ll>a(n);
    cin>>a;
    for(ll i=0;i<n;i++)
    {
        for(ll j=i+1;j<n;j++)
        {
            for(ll k=j+1;k<n;k++)
            {
                if(istriangle(a[i],a[j],a[k]))
                // cout<<i+1<<" "<<j+1<<" "<<k+1<<endl;
                ans++;
            }
        }

    }
    cout<<ans<<endl;
}
int main()
{
    ll t=1;
    
    while(t--)
    solve();
    return 0;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

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

int main()
{
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;

    int dx = tx - sx, dy = ty - sy;

    rep(i, dx)
    {
        cout << "R";
    }
    rep(i, dy)
    {
        cout << "U";
    }
    rep(i, dx)
    {
        cout << "L";
    }
    rep(i, dy)
    {
        cout << "D";
    }

    cout << "L";
    rep(i, dy + 1)
    {
        cout << "U";
    }
    rep(i, dx + 1)
    {
        cout << "R";
    }
    cout << "DR";
    rep(i, dy + 1)
    {
        cout << "D";
    }
    rep(i, dx + 1)
    {
        cout << "L";
    }
    cout << "U" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
int C[26];
int self[26];
int in[26];

void solve() {
	string S, T;
	cin >> S >> T;
	N = sz(S);
	memset(C, -1, sizeof(C));
	rep(i, 0, N) {
		int f = S[i] - 'a', t = T[i] - 'a';
		if(C[f] != -1) {
			if(C[f] != t) {
				cout << "No\n"; return;
			}
		}
		else {
			C[f] = t;
			in[t]++;
		}
	}
	// debug(vi(in, in + 26));
	rep(i, 0, 26) {
		if(in[i] >= 2) {
			cout << "No\n"; return;
		}
	}
	cout << "Yes\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 916
#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i=(a); i<(int)(b); i++)
#define FORD(i, a, b) for (int i=a; i>(int)(b); i--)
#define PPC(x) __builtin_popcount(x)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define ithBit(m, i) ((m) >> (i) & 1)
#define ft first
#define sd second
#define kw(a) ((a) * (a))
#ifdef DEBUG
#include "debug.h"
#else
#define dbg(...) 0
#endif
using namespace std;

const int maxN = 21;

int T[maxN];

void solve()
{
	long long n, k;
	scanf ("%lld%lld", &n, &k);
	
	n %= k;
	n = min(n, llabs(n - k));
	printf("%lld\n", n);
}

int main()
{
	int t;
t=1;////	scanf ("%d", &t);
	FOR(tid, 1, t+1)
	{
		//printf("Case #%d: ", tid);
		solve();
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'

using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;
const ll MOD = 998244353;

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

struct position{
  ll i,j,depth;
};

int main() {
  int H,W,K;
  cin >> H >> W >> K;
  vector<string> A(H);
  repeat(i,H) cin >> A[i];
  queue<position> Q;
  repeat(i,H){
    repeat(j,W){
      if(A[i][j] == 'S'){
        Q.push({i,j,0});
        break;
      }
    }
  }
  ll rest=INF;
  vector<vector<bool>> visit(H,vector<bool>(W,false));
  while(!Q.empty()){
    position u = Q.front();
    Q.pop();
    if(visit[u.i][u.j]) continue;
    visit[u.i][u.j] = true;
    rest = min(rest,min(min(u.i,H-1-u.i),min(u.j,W-1-u.j)));
    if(u.depth==K) continue;
    repeat(d,4){
      ll ni = u.i+di[d];
      ll nj = u.j+dj[d];
      if(ni<0||H<=ni||nj<0||W<=nj||A[ni][nj] == '#') continue;
      Q.push({ni,nj,u.depth+1});
    }
  }
  int ans = (rest? (rest-1)/K+1:0)+1;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1280
import collections
N=int(input())
A=list(map(int,input().split()))
"""
c=collections.Counter(A)
values=list(c.values())	#aのCollectionのvalue値のリスト(n_1こ、n_2こ…)
for i in range(len(values)):
    values[i]=(values[i]-1)%2
print(len(values)-sum(values)%2)
"""
#""Nが奇数なので""
#len(set(A))%2==0なら取り除きたい最小限のカードの枚数は偶数、それらそのまま除くことが可能である
#len(set(A))%2==1なら取り除きたい最小限のカードの枚数は奇数、そのままは除けず、1枚犠牲になる
print(len(set(A))-(len(set(A))+1)%2)

Measured memory_bytes: 64940
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<numeric>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define pque(type) priority_queue<type,vector<type>,greater<type> >
 
int main(void){
	int n, c = 0, d = 0; cin >> n;
	string s,t; cin >> s;
	rep(i, n){
		if(s[i] == '('){
			c++;
		}else{
			if(c > 0){
				c--;
			}else{
				d++;
			}
		}
	}
	rep(i, d) cout << '(';
	cout << s;
	rep(i, c) cout << ')';
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
s = sum(a)
x = 0
y = 0
ans = float('inf')
for i in range(n-1):
    s -= a[i]
    x += a[i]
    y = s
    ans = min(ans,abs(x-y))
print(ans)

Measured memory_bytes: 24812
n, k, c = map(int, input().split())
s = input()

def yutori(s, inv):
    ans = [0] * k
    index = 0
    for i in range(k):
        if inv:
            ans[(k - 1) - i] = (n - 1) - s.find('o', index)
            index = s.find('o', index) + (c + 1)
        else:
            ans[i] = s.find('o', index)
            index = ans[i] + (c + 1)
    return ans

l = yutori(s, 0)
r = yutori(s[::-1], 1)
for i, j in zip(l, r):
    if i == j:
        print(i + 1)


Measured memory_bytes: 20744
use proconio::*;
use proconio::marker::*;
use std::collections::*;

fn run() {
    input! {
        n: usize,
        mut s: [Bytes; n],
    }
    s.iter_mut().for_each(|s| s.reverse());
    s.sort_by_key(|s| s.len());
    const F: usize = 26;
    let mut map = BTreeMap::<usize, BTreeMap<&[u8], [bool; F]>>::new();
    let mut ans = 0;
    for s in s.iter() {
        let mut bit = 0;
        let mut pos = s.len();
        for (&len, map) in map.iter().rev() {
            while pos > len {
                pos -= 1;
                bit |= 1 << (s[pos] - b'a') as usize;
            }
            let pre = &s[..pos];
            if let Some(v) = map.get(pre) {
                ans += v.iter().enumerate().filter(|p| (bit >> p.0) & 1 == 1 && *p.1).count();
            }
        }
        let len = s.len();
        let pre = &s[..(len - 1)];
        let k = (s[len - 1] - b'a') as usize;
        map.entry(len - 1).or_insert(BTreeMap::new()).entry(pre).or_insert([false; 26])[k] = true;
    }
    println!("{}", ans);
}

fn main() {
    run();
}

Measured memory_bytes: 23296
#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string.h>
#include <stdlib.h>
#include <limits>
#include <iomanip>
using namespace std;

#define MAX_N 100000

int main(){


    int H, N;
    cin >> H >> N;

    vector<int> A(N, 0);
    bool b_att[MAX_N];

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


    int sum_att = 0;

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

    if( H <= sum_att ) cout << "Yes" << endl;
    else cout << "No" << endl;

}

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

#define ll long long
#define INF_LL 1LL << 60
#define INF 99999999
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }


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

    ll s = 0;
    string tmp = to_string(N);
    rep(i,tmp.size()) s += (tmp[i]-'0');

    if( N%s == 0 ) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
mod = 998244353
N = int(input())
A = [int(input()) for i in range(N)]
A.sort()
S = sum(A)

PS = [0 for i in range(N+1)]
for i in range(N):
    PS[i+1] = PS[i] + A[i]

# D[i][r]: i個塗った時点でR=rとなる場合の数
D = [[0 for _ in range(PS[i]+1)] for i in range(N+1)]
D[0][0] = 1
# D2[i][r]: i個塗った時点でR=r, B=0となる場合の数
D2 = [[0 for _ in range(PS[i]+1)] for i in range(N+1)]
D2[0][0] = 1

for i in range(N):
    for j in range(PS[i]+1):
        if D[i][j] == 0:
            continue
        D[i+1][j] = (D[i+1][j] + D[i][j] * 2) % mod
        D[i+1][j+A[i]] = (D[i+1][j+A[i]] + D[i][j]) % mod

for i in range(N):
    for j in range(PS[i]+1):
        if D2[i][j] == 0:
            continue
        D2[i+1][j] = (D2[i+1][j] + D2[i][j]) % mod
        D2[i+1][j+A[i]] = (D2[i+1][j+A[i]] + D2[i][j]) % mod

border = (S + 1) // 2

result = 3 ** N
result -= 3 * sum(D[N][border:])
if border * 2 == S:
    result += 3 * D2[N][border]

print(result % mod)


Measured memory_bytes: 317960
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int n,a[3];
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);//a[0]<=a[1]<=a[2]
    if(a[0]*a[0]+a[1]*a[1]==a[2]*a[2]){
      cout<<"YES"<<endl;
    }else{
      cout<<"NO"<<endl;
    }
  }
}
  

Measured memory_bytes: 1168
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
int getDigit(int n);            // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// class
// ------------------------------------------------
class Combi
{
  public:
    Combi();
    long long Combination(long long n, long long k);
    long long nPk_modp(long long n, long long k, long long p);
  private:
    vector<vector<long long>> memo;
    long long n_num;
    long long k_num;
    void Resize(long long n, long long k);
};

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<long> vll;
// code
// ------------------------------------------------
int main() {

    ll n;
    cin >> n;

    if(n % 2)
    {
        cout << n / 2 << endl;
    }
    else
    {
        cout << (n -1) / 2 << endl;
    }
    
    return 0;
}
// funcの実体
// ------------------------------------------------
int getDigit(int n)
{
  int i = 1;
  while(1)
  {
    n = n / 10;
    if(n == 1)
      break;
    i++;
  }
  return i;
}
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Combi::Combi(){
  n_num = -1;
  k_num = -1;
};
ll Combi::Combination(ll n, ll k)
{
  Resize(n,k);

  ll ret;
  if(memo[n][k] != 0)
  {
    ret = memo[n][k];
  }
  else if(n == k || k == 0)
  {
    memo[n][k] = 1;
    ret = 1;
  }
  else
  {
    ret = Combination(n - 1, k - 1) + Combination(n - 1, k);
    memo[n][k] = ret;
  }
  return ret;
}

void Combi::Resize(ll n, ll k)
{
  if(n_num <= n || k_num <= k)
  {
    n_num = (n + 1) * 2;
    k_num = (k + 1) * 2;
    memo.resize(n_num);
    for(auto itr = memo.begin(); itr != memo.end(); ++itr)
    {
      itr->resize(k_num);
    }
  }
}

long long Combi::nPk_modp(long long n, long long k, long long p)
{
  ll ans = 1;
  for(long long i = k; i <= n; i++)
  {
    ans = (ans * i) % p;
  }

  return ans;
};


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,a,b) for(int i=(int)(a-1);i>=b;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

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

#define INF INT_MAX/3

int main(){
    cin.sync_with_stdio(false);
    int a, b, c, d, l, r;
    cin >> a >> b >> c >> d;
    l = a + b, r = c + d;
    if (l < r) cout << "Right" << endl;
    else if (l > r) cout << "Left" << endl;
    else cout << "Balanced" << endl;
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
//ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
ll p, c, limit;
int flag;
int dfs(ll n) {
	if (n > limit)return 0;
	p = n, flag = 0;
	while (p) {
		if (p % 10 == 3)flag |= 1;
		if (p % 10 == 5)flag |= 2;
		if (p % 10 == 7)flag |= 4;
		p /= 10;
	}
	if (flag == 7)c++;
	dfs(n * 10 + 3);
	dfs(n * 10 + 5);
	dfs(n * 10 + 7);
}
int main() {
	ll n;
	cin >> n;
	limit = n;
	dfs(0);
	printf("%lld\n", c);
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

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

        if(A>B || (N == 1 && A!=B))
            System.out.println(0);
        else if(N==2){
            if(A == B)
                System.out.println(1);
            else
                System.out.println(3);
        } else {
            System.out.println((long)(B-A)*(N-2)+1);
        }
    }
}

Measured memory_bytes: 21844
N = int(input())
A = list(map(str, input().split()))

Hina = ["P","W","G","Y"]

Pink = A.count("P")
White = A.count("W")
Green  = A.count("G")
Yello = A.count("Y")

if Yello != 0:
    print("Four")
else:
    print("Three")

Measured memory_bytes: 3064
//ProblemD

#ifdef _MYPC
#include "mypc.h"
#endif // _MYPC

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <memory>
#include <cstdio>
#include <cstring>

using namespace std;

//ProblemD

#define MAXN 100000
#define INF 1000000007

class Solve {
private:
	int n, m;
	struct Node {
		int cost;
		int no = -1;
	};
	vector<Node> a;
	vector<vector<int>> edges;
	vector<bool> flags;

	long long min_cost = 0;
	vector<int> rest;
	int no = 0;

	void make_tree(int i) {
		flags[i] = true;
		a[i].no = no;

		for (auto j : edges[i]) {
			if (!flags[j]) make_tree(j);
		}
	}

	void solve() {
		cin >> n >> m;
		a.resize(n);
		edges.resize(n);
		flags.assign(n, false);
		rest.reserve(n);

		for (int i = 0; i < n; i++) cin >> a[i].cost;
		for (int i = 0; i < m; i++) {
			int x, y;
			cin >> x >> y;
			edges[x].push_back(y);
			edges[y].push_back(x);
		}
		
		for (int i = 0; i < n; i++) if (!flags[i]) {
			make_tree(i);
			no++;
		}

		if (no == 1) {
			cout << 0 << endl;
			return;
		}

		int cnta = 0, cntb = 0;
		fill(flags.begin(), flags.begin() + no, false);

		sort(a.begin(), a.end(), [](const Node&x, const Node& y) {
			return x.cost < y.cost;
		});

		for (int i = 0; i < n && cnta + cntb < 2 * no - 2; i++) {
			if (!flags[a[i].no]) {
				flags[a[i].no] = true;
				cnta++;

				min_cost += a[i].cost;
			}
			else if(cntb < no - 2) {
				cntb++;
				min_cost += a[i].cost;
			}
		}

		if (cnta + cntb == 2 * no - 2) {
			cout << min_cost << endl;
		}
		else {
			cout << "Impossible" << endl;
		}
	}

public:
	Solve() { solve(); }
};

int main(int argc, char* argv[]) {
	unique_ptr<Solve> solve = make_unique<Solve>();
	return 0;
}


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

public class Main{
	static void main() throws Exception{
		long a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt(),d=sc.nextInt();
		if(a>=0 && c>=0) {
			pw.println(b*d);
			return;
		}
		if(b<=0 && d<=0) {
			pw.println(a*c);
			return;
		}
		long ans=Long.MIN_VALUE;
		
		ans=Math.max(ans, a*c);
		ans=Math.max(ans, a*d);
		ans=Math.max(ans, b*c);
		ans=Math.max(ans, b*d);
		if(a<=0 && b>=0) {
			ans=Math.max(ans, 0);
		}
		if(c<=0 && d>=0) {
			ans=Math.max(ans, 0);
		}
		pw.println(ans);
	}
	public static void main(String[] args) throws Exception{
		sc=new MScanner(System.in);
		pw = new PrintWriter(System.out);
		int tc=1;
//		tc=sc.nextInt();
		while(tc-->0)
			main();
		pw.flush();
	}
	static PrintWriter pw;
	static MScanner  sc;
	static class MScanner {
		StringTokenizer st;
		BufferedReader br;
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int[] intArr(int n) throws IOException {
	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public long[] longArr(int n) throws IOException {
	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public int[] intSortedArr(int n) throws IOException {
	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        shuffle(in);
	        Arrays.sort(in);
	        return in;
		}
		public long[] longSortedArr(int n) throws IOException {
	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        shuffle(in);
	        Arrays.sort(in);
	        return in;
		}
		public Integer[] IntegerArr(int n) throws IOException {
	        Integer[]in=new Integer[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public Long[] LongArr(int n) throws IOException {
	        Long[]in=new Long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
	static void shuffle(int[]in) {
		for(int i=0;i<in.length;i++) {
			int idx=(int)(Math.random()*(i+1));
			int tmp=in[i];
			in[i]=in[idx];
			in[idx]=tmp;
		}
	}
	static void shuffle(long[]in) {
		for(int i=0;i<in.length;i++) {
			int idx=(int)(Math.random()*(i+1));
			long tmp=in[i];
			in[i]=in[idx];
			in[idx]=tmp;
		}
	}
}

Measured memory_bytes: 25404
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<queue>
#include<map>
using namespace std;                       
typedef long long ll;

 int main()
 { char a[10];
    cin>>a;
	if(strcmp(a,"ABC")==0)
	cout<<"ARC"<<endl;
	else
	cout<<"ABC"<<endl; 
}


Measured memory_bytes: 3636
import java.util.Scanner;

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

		String a = sc.next();
		String b = sc.next();
		String c = sc.next();

		if (a.charAt(a.length() - 1) != b.charAt(0)) {
			System.out.println("NO");
		} else if (b.charAt(b.length() - 1) != c.charAt(0)) {
			System.out.println("NO");
		} else {
			System.out.println("YES");
		}
	}
}

Measured memory_bytes: 21972
#![allow(
    non_snake_case,
    unused_variables,
    unused_assignments,
    unused_mut,
    dead_code
)]
use proconio::fastout;
use proconio::input;
//use proconio::marker::Usize1;
//use proconio::marker::Chars;
//use std::collections::HashSet;
// use std::cmp::*;
//use std::collections::VecDeque;

#[fastout]
fn main() {
    input! {
       k: usize
    }
    let mut g = vec![vec![1; 201]; 201];
    for i in 1..201 {
        for j in 1..201 {
            if i == j {
                g[i][j] = i;
            }
            if i > j {
                g[i][j] = g[j][i];
            }
            g[i][j] = gcd(j, i);
        }
    }
    // 同じ数
    let ans1 = k * (k + 1) / 2;
    // 2つが同じ数。
    // 各ペアの6倍。
    let mut ans2 = 0;
    for i in 1..k {
        for j in i + 1..k + 1 {
            ans2 += g[i][j];
        }
    }
    ans2 *= 6;
    let mut ans3 = 0;
    for i in 1..k - 1 {
        for j in i + 1..k {
            for l in j + 1..k + 1 {
                ans3 += g[i][g[j][l]];
            }
        }
    }
    ans3 *= 6;

    println!("{}", ans1 + ans2 + ans3);
}

fn gcd(a: usize, b: usize) -> usize {
    if a % b == 0 {
        b
    } else {
        gcd(b, a % b)
    }
}

//fn gcd3(a: u64, b: u64, c: u64) -> u64 {
//    gcd(a, gcd(b, c))
//}


Measured memory_bytes: 2312
# https://atcoder.jp/contests/abc159/tasks/abc159_a
read n m ; n=$((n)) ; m=$((m))
A=()
for ((i = 0; i < n; i++)) ; do
  A+=($((2)))
done
for ((j = 0; j < m; j++)) ; do
  A+=($((1)))
done
ans=$((0))
for ((i = 0; i < ${#A[*]}; i++)) ; do
  for ((j = i+1; j < ${#A[*]}; j++)) ; do
    if [ $(((A[i] + A[j]) % 2)) -eq $((0)) ] ; then
      ans=$((ans+1))
    fi
  done
done
echo $ans


Measured memory_bytes: 1648
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int n;
  cin >> n;

  cout << n * n * n << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+10;
int a[maxn];
int b[maxn];
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		a[i]=1;
	b[1]=1;
	while(m--)
	{
		int t1,t2;
		scanf("%d%d",&t1,&t2);	
		a[t1]--;
		a[t2]++;
		if(b[t1])
			b[t2]=1;
		if(a[t1]==0)
			if(b[t1]==1)
				b[t1]=0;
	}
	int ans=0;
	for(int i=1;i<=n;i++)
		if(b[i])
			ans++;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
#include <numeric>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<Pll> vp;
typedef vector<bool> vb;
#define rep(i, a, n) for (ll i = (a); i < (n); ++i)
#define rrep(i, a, n) for (ll i = (a); i > (n); --i)
#define erep(i, a, n) for (ll i = (a); i <= (n); ++i)
#define rerep(i, a, n) for (ll i = (a); i >= (n); --i)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define SORT(x) sort(all(x))
#define RSORT(x) sort(all(x),greater<ll>())
#define vec_max(V) *max_element(all(V))
#define vec_min(V) *min_element(all(V))
#define vec_sum(V) accumulate(all(V), 0LL)
#define print(X) cout << (X) << "\n"
#define _ << " " <<
#define Yes print("Yes")
#define No print("No")
static const int INF = 1e+9+7;

int main(){
	int a,b,c;
	cin >> a >> b >> c;
	
	if(c -(a - b) > 0) print(c-(a-b));
	else print(0);
    
 return 0;
}


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

#define name ""
#define ini freopen(name".inp","r",stdin); freopen(name".out","w",stdout)
#define foe(it,c) for (__typeof(c.begin()) it = c.begin(); it != c.end(); it++)
#define long long long 
#define db double 
#define pii pair <int, int>
#define pll pair <long, long>
#define all(c) c.begin(), c.end()
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

const int INF = 1e9+7;
const int MOD = 1e9+7;
const int dx[4] = {0,0,-1,1};
const int dy[4] = {-1,1,0,0};

int main()
{
  fastio;
  string s; cin >> s;
  for (int i = 0; i < s.size(); i++){
    if (s[i] == '7') return cout << "Yes", 0;
  }
  cout << "No";
  return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define ll          long long
#define endl        "\n"
#define si(a)       scanf("%d",&a)
#define si2(a,b)    scanf("%d%d",&a,&b)
#define sl(a)       scanf("%lld",&a)
#define sl2(a,b)    scanf("%lld%lld",&a,&b)
#define pb          push_back
#define mk          make_pair
#define loop(n)     for(int i=0; i<n; i++)
#define FOR(a,b)    for(int i=a; i<=b; i++)
#define sz          size()
#define ff          first
#define ss          second
#define mem(a,val)  memset(a, val, sizeof(a))
#define md          1000000007
#define pi          acos(-1.0)

ll a[200010], ans=0;
map<ll,ll>m;
vector<ll>v;
string s,q;


int main()
{
   ll t,n,i,j,k,l,mn=0, mx=0, tmp=0;
   sl(n);
   if(n<3)
   {
       cout<<0<<endl;
       return 0;
   }

    m[0]=1;
    for(int i=3; i<=n; i++)
    {
        tmp=0;
        for(j=3; j<=n; j++)
        {
            if(j<=i)
              tmp+=m[i-j];
            tmp%=md;
        }
        m[i]=tmp;
    }

    cout<<m[n]<<endl;
}




Measured memory_bytes: 3704
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <queue>
#include <utility>
using namespace std;

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

#define For(i, a, b) for(int i = (a); i < (b); i++)
#define Rep(i, n) For(i, 0, (n))
#define Rrep(i, n) for(int i = (n - 1); i >= 0; i--)
#define pb push_back

const int inf = 999999999;
const int mod = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int main(){
	int n; cin >> n;
	vector<int> a;
	Rep(i, n){
		int t; cin >> t;
		a.pb(t - i - 1);
	}
	sort(a.begin(), a.end());
	int b = a[n/2];
	ll ans = 0;
	Rep(i, n){
		ans += abs(a[i] - b);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1400