akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
    public static void main(String[] args) {
       
        FastScanner sc = new FastScanner();
	    int N=sc.nextInt();
		int[] nums=new int[N];
		for(int i=0;i<N;i++){
		    nums[i]=sc.nextInt();
		}
		
	    Arrays.sort(nums);
	    System.out.println(nums[N/2]-nums[N/2-1]);
       
    }
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

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

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

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

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

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

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

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

	public double nextDouble() {
		return Double.parseDouble(next());
	}
	
	public char[][] nextCharsHW(int H,int W){
		char[][] chars=new char[H][W];
		for(int i=0;i<H;i++) {
			String str=next();
			for(int j=0;j<W;j++) {
				chars[i][j]=str.charAt(j);
			}
		}
		return chars;
	}
	
	public int[][] nextIntsNM(int N,int M){
		int[][] ints=new int[N][M];
		for(int i=0;i<N;i++) {
			for(int j=0;j<M;j++) {
				ints[i][j]=nextInt();
			}
		}
		return ints;
	}
}

Measured memory_bytes: 25308
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>    
#include <cstring>
#include <array>
#include <cctype>
#include <string.h>
#include <vector>
#include <limits.h>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cassert>
#include <algorithm>
#include <functional>
#include <sstream>
#include <iomanip>
#include <cstdlib>
#include <stdio.h>
#include <bitset>
using namespace std;
#define PI 3.14159265359
#define mp make_pair
#define pb push_back
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,n) FOR(i,0,n)
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
const int INF = 1<<29;
typedef long long ll;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#define max 1<<28

int n;
int a[max];

int main(){
	ios_base::sync_with_stdio(false); //Fast I/O
	cin.tie(NULL);
	//freopen("in.txt","r",stdin);
	//freopen("output.txt","w",stdout);	

	cin >> n;

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

	int cc=0;

	for(int i=0;i<n;i++){
		int tmp=a[i];
		while(tmp%2==0){
			tmp=tmp/2;
			cc++;
		}
	}

	cout << cc << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
#define el '\n'
#define MOD 1000000007
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a,b,t;
    cin >> a >> b >> t;
    cout << (t/a)*b<< el;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
s = str(input())
t = int(n/2)

s_1half = s[:t]
s_2half = s[t:]

if n % 2 == 1:
    print("No")
elif s_1half == s_2half:
    print("Yes")
elif s_1half != s_2half:
    print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    ll n, a, b;
    cin >> n >> a >> b;
    for(int i = a; i <= b; i++){
        if(i %n == 0){
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define fix(n) cout<<fixed<<setprecision(n)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
using namespace std;
typedef long long ll;
const ll mod=1000000007;
double pi=3.1415926535;

int main(){
  int n,w;
  cin>>n;
  co((n+1)/2);
  return 0;
}


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

int main() {
  int N, K;
  cin >> N >> K;
  string S;
  cin >> S;
  if(S.at(K-1)=='A') {
    S.at(K-1) = 'a';
  }
  if(S.at(K-1)=='B') {
    S.at(K-1) = 'b';
  }
  if(S.at(K-1)=='C') {
    S.at(K-1) = 'c';
  }
  

  cout << S << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
const int MAX_TEST = 100;

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

//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i-1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
      finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
//組み合わせ
long long COM (int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

void solve() {
	int n, m;
	cin >> n >> m;
	int ans = (1900 * m) + 100 * (n - m);
	int p = 2;
	for (int i = 1; i <= m; ++i) {
		ans *= p;
	}
	cout << ans << endl;
	return;
}

int main() {
    solve();
    return 0;
}



Measured memory_bytes: 256
import sys

if sys.subversion[0] == "PyPy":
    import io, atexit

    sys.stdout = io.BytesIO()
    atexit.register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

    sys.stdin = io.BytesIO(sys.stdin.read())
    input = lambda: sys.stdin.readline().rstrip()
RS = raw_input
RA = lambda x=int: map(x, RS().split())
RN = lambda x=int: x(RS())


def solve():
    best = 2000
    ls = len(s)
    lt = len(t)
    for i in range(ls - lt + 1):
        diff = 0
        for j in range(lt):
            if t[j] != s[j + i]:
                diff += 1
        best = min(best, diff)
    print(best)
    return




s = RS()
t = RS()
solve()


Measured memory_bytes: 68004
declare var require: (x: string) => any;

function Main(input: string[]) {
  const [n, m] = input[0].split(' ').map(x => +x);
  // const arr = input.slice(1, m+1).map(s => s.split(' ').map(x => +x)).sort();
  //
  // let ans = 0;
  // arr.reduce((pre: number, cur: number[]) => {
  //   if (pre <= cur[0]) {
  //     ans++;
  //     return cur[1];
  //   } else {
  //     return Math.min(pre, cur[1]);
  //   }
  // }, n+1);
  //
  // console.log('%d', ans + 1);

  const arr = new Int32Array(n).fill(n);
  input.forEach((s, i) => {
    if (i == 0 || i > m) return;
    const [a, b] = s.split(' ').map(x => +x - 1);
    arr[a] = Math.min(arr[a], b);
  });

  let ans = 0;
  arr.reduce((wall, cur, i) => {
    if (i >= wall) {
      ans++;
      return cur;
    } else {
      return Math.min(wall, cur);
    }
  }, n);
  // let wall = n;
  // for (var i = 0; i < n; i++){
  //   if (i >= wall) {
  //     ans++;
  //     wall = arr[i];
  //   } else {
  //     wall = Math.min(wall, arr[i]);
  //   }
  // }

  console.log(ans);
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8').split('\n'));


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

using namespace std;


int main() {
    int n,a,b;
    cin>>n>>a>>b;
    int count=0;
    for (int i = 1 ; i <n+1 ; ++i) {
        int c=i%10+i/10%10+i/100%10+i/1000%10+i/10000;
        if(c<=b && c>=a)count+=i;
    }
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import itertools
import numpy as np

X = list(map(int,readline().split()))
Y = list(map(int,readline().split()))

for i in [1,3,5]:
    X[i] += 1
    Y[i] += 1

X1 = X[:2]; X2 = X[2:4]; X3 = X[4:]
Y1 = Y[:2]; Y2 = Y[2:4]; Y3 = Y[4:]

def cumprod(arr,MOD):
    L = len(arr); Lsq = int(L**.5+1)
    arr = np.resize(arr,Lsq**2).reshape(Lsq,Lsq)
    for n in range(1,Lsq):
        arr[:,n] *= arr[:,n-1]; arr[:,n] %= MOD
    for n in range(1,Lsq):
        arr[n] *= arr[n-1,-1]; arr[n] %= MOD
    return arr.ravel()[:L]

def make_fact(U,MOD):
    x = np.arange(U,dtype=np.int64); x[0] = 1
    fact = cumprod(x,MOD)
    x = np.arange(U,0,-1,dtype=np.int64); x[0] = pow(int(fact[-1]),MOD-2,MOD)
    fact_inv = cumprod(x,MOD)[::-1]
    return fact,fact_inv

U = 2 * 10 ** 6 + 10
MOD = 10**9 + 7
fact, fact_inv = make_fact(U,MOD)

answer = 0
for p in itertools.product([0,1],repeat=6):
    x1,x2,x3,y1,y2,y3 = [A[i] for A,i in zip([X1,X2,X3,Y1,Y2,Y3],p)]
    sgn = (-1) ** sum(p)
    a,b,c,d = x2-x1, x3-x2, x2-x1+y2-y1, x3-x2+y3-y2
    c += 2; d += 2; sgn = -sgn
    # (1+A)^c(1+B)^d / (A-B)^2 における A^aB^b の係数
    # まずはa+b+2次式部分を抽出する：A側の次数で持つ
    D = a + b + 2
    # A^i B^j の寄与。
    L = max(0, D-d)
    R = min(c, D)
    if L > R:
        continue
    x = fact[c] * fact_inv[L:R+1] % MOD * fact_inv[c-R:c-L+1][::-1] % MOD
    L,R = D-R,D-L
    y = fact[d] * fact_inv[L:R+1] % MOD * fact_inv[d-R:d-L+1][::-1] % MOD
    x *= y[::-1]
    x %= MOD
    # B=1と見立てる。(1-A)^2 で割って、A^(a-L)の係数
    np.cumsum(x,out=x)
    x %= MOD
    np.cumsum(x,out=x)
    x %= MOD
    L,R = D-R,D-L
    if 0 <= a-L < len(x):
        answer += sgn * x[a-L]

answer %= MOD
print(answer)

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

typedef pair<int,int> II;

int sqr(int x) { return x * x;
}
double dis(II a, II b) {
	return sqrt(sqr((a.first - b.first)) + sqr(a.second - b.second));
}

II a[10];


int main() {
	//freopen("inp.txt", "r", stdin);
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n = 0;
	cin >> n;
	

	for(int i=0;i<n;i++) cin >> a[i].first >> a[i].second;
	vector<int> vt;
	for(int i=0;i<n;i++) {
		vt.push_back(i);
	}
	
	double res= 0 ;
	do {
		for(int i=0;i<(int) vt.size() - 1; i++) {
			res += dis(a[vt[i]], a[vt[i+1]]);
		}
	} while (next_permutation(vt.begin(), vt.end()));
	
	for(int i=1;i<=n;i++) res /= i;
	cout << fixed << setprecision(10) << res;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int len;
string s; 
int main(){
	getline(cin,s);
	len=s.size();
	if(s[0]==s[len-1]){
		if(len%2==1){
			cout<<"Second";
		}
		else{
			cout<<"First";
		}
	}
	else{
		if(len%2==1){
			cout<<"First";
		}
		else{
			cout<<"Second";
		}
	}
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pb          push_back
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mode        998244353
#define mod         1000000007
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define ld          long double
#define sz(x)       (ll)x.size()
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define all(x)      x.begin(),x.end()
#define mset(x)     memet(x,0,sizeof x)
#define pi          3.14159265358979323


void solve()
{
       ll n;
       cin>>n;
       vl pos,neg;
       rep(i,0,n)
       {
              ll x;
              cin>>x;
              if(x<0) neg.push_back(x);
              else pos.push_back(x);
       }
       sort(pos.begin(),pos.end());
       sort(neg.begin(),neg.end());
       reverse(neg.begin(),neg.end());
       if(neg.size()==0)
       {
              ll ans=0;
              ans=-1*pos[0];
              for(ll i=1; i<n; i++) ans+=pos[i];
              cout<<ans<<endl;
              ll f=pos[0];
              rep(i,1,n-1)
              {
                     cout<<f<<" "<<pos[i]<<endl;
                     f-=pos[i];
              }
              cout<<pos[n-1]<<" "<<f<<endl;
              return;
       }
       if(pos.size()==0)
       {
              ll ans=0;
              ans=neg[0];
              rep(i,1,n) ans+=abs(neg[i]);
              cout<<ans<<endl;
              ll f=neg[0];
              rep(i,1,n)
              {
                     cout<<f<<" "<<neg[i]<<endl;
                     f-=neg[i];
              }
              return;
       }
       ll ns=neg.size(), ps=pos.size();
       ll ans=0;
       for(ll x:neg) ans+=abs(x);
       for(ll x:pos) ans+=x;
       cout<<ans<<endl;
       rep(i,1,ns) { cout<<pos[ps-1]<<" "<<neg[i]<<endl; pos[ps-1] += abs(neg[i]); }
       rep(i,0,ps-1) { cout<<neg[0]<<" "<<pos[i]<<endl; neg[0] -= pos[i]; }
       cout<<pos[ps-1]<<" "<<neg[0]<<endl;
}


int main() {
	ll T = 1;
//	pre();
	speed_up
	//cin>>T;
	while(T--)
	    solve();
	return 0;
}


Measured memory_bytes: 2804
#include<stdio.h>
int main(void)
{
	int a,b,c=0,d=0,i,j,k;
	scanf("%d %d",&a,&b);
	int x[a],a1[200],b1[200],c1[200],y[200][200];
	for(i=0;i<a;i++) scanf("%d",&x[i]);
	for(i=0;i<a;i++){
		for(j=0;j<b;j++){
			y[i][j]=-1;
		}
	}
	for(i=0;i<b;i++){
		scanf("%d %d %d",&a1[i],&b1[i],&c1[i]);
		if(a1[i]<=x[0]&&x[0]<=b1[i]){
			y[0][i]=0;
		}
	}
	for(i=0;i<a;i++){
		for(j=0;j<b;j++){
			if(y[i][j]!=-1){
				for(k=0;k<b;k++){
					if(a1[k]<=x[i+1]&&x[i+1]<=b1[k]){
						c=c1[j]-c1[k];
						if(c<0) c=-c;
						if(y[i+1][k]>=y[i][j]+c){
							y[i+1][k]=y[i+1][k];
						}
						else y[i+1][k]=y[i][j]+c;
					}
				}
			}
		}
	}
	for(i=0;i<b;i++){
		if(d<=y[a-1][i]){
			d=y[a-1][i];
		}
	}
	printf("%d\n",d);
	return 0;
}


Measured memory_bytes: 2892
using System;
using System.Linq;

class Program
{
  static void Main()
  {
    int N = int.Parse(Console.ReadLine());
    int[] d = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
    Array.Sort(d);
    Console.WriteLine(d[N/2] - d[(N/2) - 1]);
  }
}

Measured memory_bytes: 18016
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>

using namespace std;

const int N=21005,M=N*10,nn=105,INF=1e9;

typedef long long LL;

int n,m,tot,In[nn][nn],Out[nn][nn],H[nn],W[nn],S,T,sum;

int h[N],e[M],nxt[M],fl[M],f[N],vis[N],calc,Now[N],ans;

char Map[nn][nn];

void Add(int x,int y,int z)
{
	e[++tot]=y; nxt[tot]=h[x]; fl[tot]=z; h[x]=tot;
}

bool aug(int x)
{
	vis[x]=calc;
	if (x==T) return 1;
	for (int i=Now[x];i;i=nxt[i]) if (fl[i] && vis[e[i]]<calc && f[x]==f[e[i]]+1)
	{
		if (aug(e[i]))
		{
			fl[i]--; fl[i^1]++; Now[x]=i; return 1;
		}
	}
	return Now[x]=0;
}

void flow()
{
	memcpy(Now,h,sizeof(h));
	for (;;)
	{
		calc++;
		if (aug(S)) ans++;else break;
	}
}

bool check()
{
	int tmp=INF;
	for (int i=1;i<=sum;i++) if (vis[i]==calc)
	{
		for (int j=h[i];j;j=nxt[j]) if (fl[j] && vis[e[j]]<calc)
			tmp=min(tmp,f[e[j]]+1-f[i]);
	}
	if (tmp==INF) return 0;
	for (int i=1;i<=sum;i++) if (vis[i]==calc) f[i]+=tmp;
	return 1;
}

int main()
{
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++)
	{
		scanf("%s",Map[i]+1);
		for (int j=1;j<=m;j++) if (Map[i][j]!='.')
		{
			In[i][j]=++tot; Out[i][j]=++tot;
			if (Map[i][j]=='S') S=Out[i][j];
			else if (Map[i][j]=='T') T=In[i][j];
		}
	}
	for (int i=1;i<=n;i++) for (int j=1;j<=m;j++) if (Map[i][j]=='S')
	{
		for (int k=1;k<=n;k++) if (Map[k][j]=='T')
		{
			printf("-1\n"); return 0;
		}
		for (int k=1;k<=m;k++) if (Map[i][k]=='T')
		{
			printf("-1\n"); return 0;
		}
	}
	for (int i=1;i<=n;i++) H[i]=++tot; for (int i=1;i<=m;i++) W[i]=++tot;
	sum=tot; tot=1;
	for (int i=1;i<=n;i++) for (int j=1;j<=m;j++) if (Map[i][j]!='.')
	{
		Add(In[i][j],Out[i][j],1); Add(Out[i][j],In[i][j],0);
		Add(Out[i][j],H[i],INF); Add(H[i],Out[i][j],0);
		Add(Out[i][j],W[j],INF); Add(W[j],Out[i][j],0);
		Add(H[i],In[i][j],INF); Add(In[i][j],H[i],0);
		Add(W[j],In[i][j],INF); Add(In[i][j],W[j],0);
	}
	for (flow();check();flow());
	printf("%d\n",ans);
	return 0;
}

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

int main(void){
    double l; cin >> l;
    double V1 = l / 27;
    double V2 = l * l * V1;
    printf("%.12lf\n",V2);
    return 0;
}


Measured memory_bytes: 256
l,r = list(map(int, input().split()))

l1 = l%2019
r1 = r%2019
if r >= l + 2019 - l1:
    r1 = 2019

ans = float("inf")
for i in range(l1,r1):
    for j in range(i+1, r1+1):
        ans = min(ans, ((i*j)%2019))

print(ans)

Measured memory_bytes: 40812
#include <stdio.h>
#include <cstdlib>
#include <cassert>
#include <iostream>
#include <set>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <complex>
#include <map>
#include <queue>
#include <array>
#include <bitset>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef long double ld;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<pii> vii;
typedef vector<string> vs;
//typedef long long int;

int main() {
  std::ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  vi a(n);
  int d = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    d = __gcd(a[i], d);
  }
  for (int i = 0; i < n; ++i) {
    if (a[i] >= k && (a[i] - k) % d == 0) {
      cout << "POSSIBLE\n";
      return 0;
    }
  }
  cout << "IMPOSSIBLE\n";
  return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
#include <malloc.h>
#include <string.h>
int lucas(char *ch){
    int i,j,k,n,p,max,length;
    int record[100]={0};                                         //aabbca
    int record1[100]={0};
    for(i=0;i<strlen(ch);i++){              //统计出现次数
        for(j=i;j<strlen(ch);j++){
            if(ch[i]==ch[j]){
                record1[i]++;
            }
        }
    }
    for(i=0;i<strlen(ch)-1;i++){            // 对重复数超过3的置换
        while(record1[i]>=3){
            for(j=i+1;j<strlen(ch);j++){
                if(ch[j]==ch[i]){
                    ch[j]='1';
                    break;
                }
            }
            record1[i]--;
        }
    }
    for(i=1;i<strlen(ch)-1;i++){//统计每一种情况下重复的数目
        for(j=0;j<i;j++){
            for(k=i;k<strlen(ch);k++){
                if(ch[j]==ch[k]&&ch[j]!='1'){
                    record[i-1]++;
                }
            }
        }
    }
    max=record[0];
    for(i=1;i<strlen(ch)-2;i++){
        if(record[i]>max){
            max=record[i];
        }
    }
    return max;
}
int main()
{
    int n;
    scanf("%d",&n);
    char ch[n];
    scanf("%s",&ch);
    printf("%d",lucas(ch));
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	char str[3];
	cin>>str;
	for(int i=0;i<=2;i++){
		if(str[i]=='7'){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

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

int main()
{
	int y,m,d,t;
	while(cin >> y >> m >> d)
	{
		t = y*10000+m*100+d;

		if(t < 18680908)
		{
			cout << "pre-meiji" << endl;
		}
		else if(t < 19120730)
		{
			cout << "meiji " << y-1867 << " " << m << " " << d << endl;
		}
		else if(t < 19261225)
		{
			cout << "taisho " << y-1911 << " " << m << " " << d << endl;
		}
		else if(t < 19890108)
		{
			cout << "showa " << y-1925 << " " << m << " " << d << endl;
		}	
		else
		{
			cout << "heisei " << y-1988 << " " << m << " " << d << endl;
		}
	}
}

Measured memory_bytes: 0
function Main(input) {
	const data = input.split("\n").map(n => n.split(" ").map(p => Number(p)));
	const [n, m] = data[0];
	let maxL = data[1][0];
	let minR = data[1][1];
	for (let i = 2; i <= m; i++) {
		const [l, r] = data[i];
		maxL = maxL < l ? l : maxL;
		minR = r < minR ? r : minR;
	}
	console.log(0 <= minR - maxL ? minR - maxL + 1 : 0);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 50448
from operator import itemgetter

N = int(input())
list =[]
for i in range(N):
    SP = input().split()
    SP[1] = int(SP[1])
    SP.append(i+1)
    list.append(SP)
    # s = SP[0]
    # p = int(SP[1])
    # s, p = map(input().split())
    # p = int(p)

list2 = sorted(list, key=itemgetter(1), reverse=True)
# print(list2)
list3 = sorted(list2, key=itemgetter(0))
# print(list3)

for i in range(N):
    print(list3[i][2])

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

using namespace std;

typedef long long ll;

ll mod;

ll powimod(ll x,ll n,ll mod){
    ll res=1;
    while(n){
        if(n&1) res=(res*x)%mod;
        x=(x*x)%mod;
        n>>=1;
    }
    return res;
}

ll powi(ll x,ll n){
    ll res=1;
    while(n){
        if(n&1) res*=x;
        x*=x;
        n>>=1;
    }
    return res;
}

vector<int> z_function(string s) {
    int n = (int) s.length();
    vector<int> z(n);
    for (int i = 1, l = 0, r = 0; i < n; ++i) {
        if (i <= r)
            z[i] = min (r - i + 1, z[i - l]);
        while (i + z[i] < n && s[z[i]] == s[i + z[i]])
            ++z[i];
        if (i + z[i] - 1 > r)
            l = i, r = i + z[i] - 1;
    }
    return z;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    string s;
    cin>>s;
    int ans=0;
    for(int i=0;i<n;)
    {
    char var=s[i];
    while(s[i]==var&&i<n)
    {
    i++;
    }
    ans++;
    }
    cout<<ans;
}


Measured memory_bytes: 3724
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
	// write your code here
        Scanner scanner=new Scanner(System.in);
        int n=scanner.nextInt();
        int[] a1=new int[n];
        int[] a2=new int[n];
        for(int i=0;i<n;i++){
            a1[i]=scanner.nextInt();
        }
        for(int i=0;i<n;i++){
            a2[i]=scanner.nextInt();
        }
        int index=0;
        int max=cal(a1,a2,index);
        index++;
        for(int i=1;i<n;i++){
            int next=cal(a1,a2,index);
            if(max<next){
                max=next;
            }
            index++;
        }
        System.out.println(max);


    }
    public static int cal(int[] a1,int[] a2,int index){
        int result=0;
        for(int i=0;i<=index;i++){
            result+=a1[i];
        }
        for(int i=index;i<a1.length;i++){
            result+=a2[i];
        }
        return result;
    }
}


Measured memory_bytes: 24916
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<=(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  int a,b,c,x;
  cin>>a>>b>>c>>x;
  int ans=0;
  rep(i,a){
    rep(j,b){
      rep(k,c){
        if(500*i+100*j+50*k==x){
          ans++;
        }
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3600
n = int(input())
chk = [[set(),set()] for _ in range(n)]
for o in range(n):
  a = int(input())
  for i in range(a):
    x,y = [int(i) for i in input().split()]
    if y == 0:
      chk[o][0].add(x-1)
    if y == 1:
      chk[o][1].add(x-1)
    
chk = tuple(chk)
answer = 0
for i in range(2**n):
  b = format(i,'b')
  b = b.zfill(n)[::-1]
  chk_0 = set()
  chk_1 = set()
  p = []
  for j in range(n):
    if b[j] == '1':
      p.append(j)
      chk_1.add(j)
    if b[j] == '0':
      chk_0.add(j)
  #print(b,p,chk_0,chk_1)
  for i in p:
    #print(chk[i][0],chk[i][1])
    if not chk[i][0] <= chk_0:
      break
    if not chk[i][1] <= chk_1:
      break
    if i == p[len(p)-1]:
      #print('!')
      answer = max(answer,len(p))
      
print(answer)

Measured memory_bytes: 3064
#include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
typedef long long ll;

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

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

  // 比率はx:y
  int x[N], y[N];
  for (int i = 0; i < N; i++) {
    cin >> x[i] >> y[i];
  }

  ll A = x[0], B = y[0];
  for (int i = 0; i < N; i++) {
    ll n1 = A / x[i];
    ll n2 = B / y[i];
    if (A % x[i] != 0) n1++;
    if (B % y[i] != 0) n2++;
    ll n = max(n1, n2);
    A = n * x[i];
    B = n * y[i];
  }

  cout << A + B << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define f(i,a,n) for(ll i=a;i<n;i++)
#define w(_t) ll _t;cin>>_t;while(_t--)
ll md=1000000007;
map<ll,ll> mp;
bool add(ll nm){
    if(nm%2==0)
    {
        if(mp[2]==1) return false;
        while(nm%2==0) nm/=2;
        mp[2]=1;
    }
    for(ll i=3;i*i<=nm;i++){
        if(nm%i==0){
            if(mp[nm]==1) return false;
            while(nm%i==0) nm/=i;
            mp[i]=1;
        }
    }
    if(nm>1){
        if(mp[nm]==1) return false;
        mp[nm]=1;
    }
    return true;
}

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

int main() {
    ios::sync_with_stdio(false);cin.tie(0);
    ll n;cin>>n;
    ll a[n];
    f(i,0,n) cin>>a[i];
    bool flag=true;
    f(i,0,n) if(add(a[i])==false) {
        flag=false;
        break;
    }
    if(flag) {cout<<"pairwise coprime"; return 0;}
    ll g=a[0];
    f(i,1,n) g=gcd(g,a[i]);
    if(g==1) {cout<<"setwise coprime"; return 0;}
    cout<<"not coprime";
    
    return 0;
}

Measured memory_bytes: 11460
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>
#include <complex>

using namespace std;

const double Eps = 1e-9;
const double PI = 4*atan(1.0);

int main()
{
	int n;
	while (scanf("%d", &n), n)
	{
		double area[2];
		area[0] = area[1] = 0;
		for (int w = 0; w < 2; ++w)
		{
			int s = 0;
			for (int i = 1; i < n; ++i)
			{
				int v;
				scanf("%d", &v);
				s += v;
				area[w] += sin(v*PI/180);
			}
			area[w] += sin((360-s)*PI/180);
			if (!w)
				scanf("%d", &n);
		}
		if (abs(area[0] - area[1]) < Eps)
			puts("0");
		else if (area[0] > area[1])
			puts("1");
		else
			puts("2");
	}

	return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#include <iostream>
#include <array>
#include <vector>
#include <deque>
#include <string>
#include <algorithm>
#include <functional>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <utility>
#include <memory>
#include <valarray>
#include <climits>

using namespace std;

using ll = long long int;

#define loop(i, N) for (int i = 0; i < N; ++i)
#define scanInt(x) int x; scanf("%d", &x); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &x); getchar();
#define scanVecInt(A, N) vector<int> A(N); loop(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); loop(i, N){scanf("%lld", &(A[i])); getchar();}

int main()
{
    scanLLInt(K);
    const ll N = 50;
    printf("%lld\n", N);
    const ll h = K / N;
    const ll j = K % N;
    vector<ll> A(N);
    loop(i, N){
        if (i < j){
            A[i] = N * 2 + h - j;
        }else{
            A[i] = N + h - j - 1;
        }
    }
    loop(i, N - 1){
        printf("%lld ", A[i]);
    }
    printf("%lld\n", A.back());
}


Measured memory_bytes: 256
lines = $stdin.read
array = lines.split("\n")
N,M = array[0].split(" ").map(&:to_i)

schedules = array[1..M].map.with_index do |str,idx|
  s,t = str.split(" ").map(&:to_i)
  [s,t]
end.sort_by do |job|
  [job.last,job.first]
end

ans,t = 0,0

for i in 0...schedules.length
  #p schedules[i]
  if t <= schedules[i].first
    ans += 1
    t = schedules[i].last
  end
end

p ans


Measured memory_bytes: 22296
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define REP(i,m,n) for(ll i=(ll)(m) ; i < (ll) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define square(x) pow(x 2.0)
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define max_queue(x) priority_queue<x>
#define min_queue(x) priority_queue<x, vector<x>, greater<x>>
#define big_sort(v) sort(all(v), [](int a, int b) { return a > b; })//大きい順にソート
using ll = long long;
using vi = vector<ll>;
using vvi = vector<vi>;
using vs = vector<string>;
#define cins(n,v) rep(i,n){cin >> v.at(i);}
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
/*
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
*/
int main() {
  ll n,k,next_town,town=1,i=0,roop=0;
  cin >> n >> k;
  vi a(n);
  vi v;
  v.push_back(1);
  cins(n,a);
  std::map<ll, ll> mp;
  mp[town]=0;
  while(true){
    next_town=a[town-1];
    i++;
    if(mp.count(next_town)){
      roop=i-mp[next_town];
      k-=i;
      k%=roop;
      cout << v[k+mp[next_town]] << endl;
      return 0;
    }else{
      mp[next_town]=i;
      town=next_town;
      v.push_back(town);
    }
    if(i==k){cout << town << endl;return 0;}
  }


}


Measured memory_bytes: 15944
import sys
n, a, b = map(int, input().split())
judge = abs(a - b)

if judge % 2 == 0:
    print(judge//2)
    sys.exit()

d1 = n - max(a, b)
d2 = min(a, b) - 1
ans = min(d1, d2) + 1 + (judge-1)//2
print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int r, g, b;
    cin >> r >> g >> b;
    if ((r * 100 + g * 10 + b) % 4 == 0) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <cstring>
#include <map>
using namespace std;
typedef long long ll;
ll a[200001];
map<ll, ll> m;
map<ll, ll> m2;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
	
	int n; cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		m[i - a[i]] += 1;
		m2[i + a[i]] += 1;
	}
	ll ans = 0;
	for (int i = 1; i <= n; i++) {
		ll x = i - a[i];
		ll y = i + a[i];
		ans += m2[x] + m[y];
		if (m[x] > 0)
			m[x] -= 1;
		if (m2[y] > 0)
			m2[y] -= 1;
	}
	cout << ans << '\n';

	





}

Measured memory_bytes: 50072
#!python3

from time import perf_counter
tick = perf_counter() + 1.80

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())
from random import randrange
from bisect import bisect

def resolve():
    it = map(int, sys.stdin.read().split())
    D = next(it)
    C = [next(it) for i in range(26)]
    S = [[next(it) for i in range(26)] for i in range(D)]
    L = [[-1] for i in range(26)]
    T = [0] * D

    def update(di, qi):
        T1, L1 = T[:], L[:]

        score = 0
        t0 = T[di]
        score += S[di][qi]-S[di][t0]
        T1[di] = qi

        L1[t0] = li = L[t0][:]
        ii = li.index(di)
        la = D if len(li)-1 == ii else li[ii+1]
        score -= C[t0] * (di-li[ii-1])*(la-di)
        li.pop(ii)

        L1[qi] = li = L[qi][:]
        ii = bisect(li, di)
        li.insert(ii, di)
        la = D if len(li)-1 == ii else li[ii+1]
        score += C[qi] * (di-li[ii-1])*(la-di)

        return score, T1, L1

    score = 0
    x = (1+D)*D//2
    for i in range(D):
        score += S[i][0]
        L[0].append(i)

    for i in range(1, 26):
        score -= C[i] * x

    while perf_counter() < tick:
        diff, T1, L1 = update(randrange(0, D), randrange(0, 26))
        if diff > 0:
            score += diff
            T, L = T1, L1

    print(*(i+1 for i in T), sep="\n")

if __name__ == "__main__":
    resolve()


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

void die() {
	puts("No");
	exit(0);
}

string s;
int len;

int main() {
	cin >> s; len = s.length();
	if (len & 1) die();
	for (int i = 0; i < len; i += 2) 
		if (s[i] != 'h' || s[i + 1] != 'i')
			die();
	puts("Yes");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll i = (m); i < (n); ++i)
#define REPN(i, m, n) for(ll i = (m); i <= (n); ++i)
#define REPR(i, m, n) for(ll i = (m)-1; i >= (n); --i)
#define REPNR(i, m, n) for(ll i = (m); i >= (n); --i)
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
// constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const double PI = acos(-1);

int main(void){
	ll x;
	cin >> x;
	if (x >= 30) puts("Yes");
	else
		puts("No");

	return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include<algorithm>
#include <stdio.h>
#include <map>
#include <random>
#include <string>
#include<vector>

using namespace std;
int main() {
	long long k, n,sum=0,tmp;
	long long ans=0;
	vector<long> v;

	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> tmp;
		v.push_back(tmp);
	}
	sort(v.begin(),v.end());

	for (int i = 0; i < n - k;i++) {
		ans += v[i];
	}
	
	printf("%lld\n", ans);

	return 0;
}

Measured memory_bytes: 2420
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    if (a == b) {
      System.out.println(c);
    } else if (b == c) {
      System.out.println(a);
    } else {
      System.out.println(b);
    }

  }
}

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

#define REP(i,a,b) for(int i=a;i<b;i++)
#define PB push_back
#define MP make_pair
#define ff first
#define ss second
#define el "\n"
#define mnl *min_element
#define mxl *max_element

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;

ll mex(ll a,ll b)
{
	if(a>b)
		return a;
	return b;
}

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

	ll a,b,c,d;
	cin>>a>>b>>c>>d;


	cout<<mex((a*c),mex((a*d),mex((b*c),(b*d))));


}

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

int set_sum(int N) {
  int sum = 0;
  while(N>0) {
    sum += N % 10;
    N /= 10;
  }
  return sum;
}

int main() {
  int N;
  cin >> N;
  bool answer = false;
  
  int sum = set_sum(N);
  if(N % sum == 0) answer = true;

  if(answer == true) cout << "Yes" << endl;
  if(answer == false) cout << "No" << endl;
}

Measured memory_bytes: 3612
N = int(input())
a = list(map(int, input().split()))

# 0:未定 1:増加　-1:減少
status = 0
ans = 1
for i in range(1, N):
    if status == 0:
        if a[i - 1] < a[i]:
            status = 1
        elif a[i] < a[i - 1]:
            status = -1
    elif status == 1:
        if a[i] < a[i - 1]:
            status = 0
            ans += 1
    elif status == -1:
        if a[i - 1] < a[i]:
            status = 0
            ans += 1

print(ans)


Measured memory_bytes: 14252
/*Author - Shubham Gupta (@shubham107)*/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<ll> vl;      typedef vector<int> vi;
typedef vector<vl> vvl;     typedef vector<vi> vvi;
typedef pair<ll, ll> pll;   typedef pair<int, int> pii;
#define forn(i,n) for(int i=0;i<n;i++)
#define rforn(i,n) for(int i=n-1;i>=0;i--)
#define forne(i,n) for(int i=1;i<=n;i++)
#define forse(i,s,e) for(int i=s;i<e;i++)
#define rforse(i,s,e) for(int i=e-1;i>=s;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define MOD 1000000007
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define fill(a,x) memset(a,x,sizeof a);
#define trav(a,x) for(auto &a:x)
#define INF ll(1e18)
#ifdef SHUBHAM107
#include "../trace.h"
#else
#define trace(args...)
#endif
void solve() {
    char c;
    cin >> c;
    if(c >= 'A' && c <= 'Z') {
        cout << 'A';
    } else {
        cout << 'a';
    }
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifdef SHUBHAM107
    freopen("inp.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("err.txt", "w", stderr);
#endif
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

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

int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };  // i<4:4way i<8:8way
int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    double a,b,h,m,c,d;
    double pi = acos(-1);
    cin >> a >> b >> h >> m;
    double angA = h * 30 + m/2;
    double angB = m * 6;
    double ang  = max(angA,angB) - min(angA,angB);
    ang = min(360 - ang,ang);
    c = a * sin(pi*ang/180);
    d = b - a * cos(pi*ang/180);
    cout << sqrt(c*c + d*d) << endl;
}


Measured memory_bytes: 4156
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define rep(i, a, b) for(int i=a; i<b; i++)
#define per(i, a, b) for(int i=b-1; i>=a; i--)
#define ifor(n) for(int i=0;i<n;i++) 
#define jfor(n) for(int j=0;j<n;j++)
#define Ifor(n) for(int i=1;i<n;i++) 
#define Jfor(n) for(int j=1;j<n;j++)
const int inf=0x3f3f3f3f;
char s[104];
int main(){
   scanf("%s",&s);
   int n=strlen(s),k;
   cin>>k;
   ll sum=0;
   if(k==1){
   	   sum=(n-1)*9;
   	   int a=s[0]-'0';
   	   sum+=a;
   	   cout<<sum<<endl;
   }
   else if(k==2){
   	  int a=s[0]-'0'-1;
   	  sum+=(n-2)*(n-1)/2*9*9;
   	  sum+=(n-1)*9*a;
   	  Ifor(n){
   	  	if(s[i]!='0'){
   	  		int q=n-i;
   	  		sum+=(q-1)*9;
   	  		a=s[i]-'0';
   	  		sum+=a;
   	  		break;
		}
	  }
	  cout<<sum<<endl;
   }
   else{
   	   int a=s[0]-'0'-1;
   	   sum+=(n-1)*(n-2)*(n-3)/6*9*9*9;
   	   sum+=a*(n-2)*(n-1)/2*9*9;
   	   Ifor(n){
   	   	   if(s[i]!='0'){
   	   	   	a=s[i]-'0'-1;
			int q=n-i;	 
			sum+=(q-2)*(q-1)/2*9*9;
   	        sum+=(q-1)*9*a;
   	          for(int j=i+1;j<n;j++){
   	          	   if(s[j]!='0'){
   	          	   	 q=n-j;
   	  		        sum+=(q-1)*9;
   	  		        a=s[j]-'0';
   	  		        sum+=a;
   	  		        break;
					}
				 }
		    break;		 
			}
		}
		cout<<sum<<endl;
   }
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import static java.lang.System.*;

class FastScanner {
  private final InputStream in = System.in;
  private final byte[] buffer = new byte[1024];
  private int ptr = 0;
  private int buflen = 0;
  private boolean hasNextByte() {
      if (ptr < buflen) {
          return true;
      }else{
          ptr = 0;
          try {
              buflen = in.read(buffer);
          } catch (IOException e) {
              e.printStackTrace();
          }
          if (buflen <= 0) {
              return false;
          }
      }
      return true;
  }
  private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
  private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
  public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
  public String next() {
      if (!hasNext()) throw new NoSuchElementException();
      StringBuilder sb = new StringBuilder();
      int b = readByte();
      while(isPrintableChar(b)) {
          sb.appendCodePoint(b);
          b = readByte();
      }
      return sb.toString();
  }
  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' || '9' < b) {
          throw new NumberFormatException();
      }
      while(true){
          if ('0' <= b && b <= '9') {
              n *= 10;
              n += b - '0';
          }else if(b == -1 || !isPrintableChar(b)){
              return minus ? -n : n;
          }else{
              throw new NumberFormatException();
          }
          b = readByte();
      }
  }
  public int nextInt() {
      long nl = nextLong();
      if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
      return (int) nl;
  }
  public double nextDouble() { return Double.parseDouble(next());}
}

class Main {
  public static final int MOD = 1000000007;
  public static final int INF = 1000000000;
  public static void main(String[] args) {
    FastScanner sc = new FastScanner();
    int n = sc.nextInt();
    int a[] = new int[n];
    for(int i=0; i<n; i++) a[i] = sc.nextInt();
    Arrays.sort(a);
    int ans = a[0];
    int min = INF;
    for(int i=0; i<n-1; i++){
      int tmp = Math.abs(a[n-1] - 2 * a[i]);
      if(tmp < min){
        ans = a[i];
        min = tmp;
      }
    }
    out.println(a[n-1] + " " + ans);
  }

  public static int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b, a%b);
  }
}

Measured memory_bytes: 25260
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;

using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  string ans = (n == m) ? "Yes" : "No";
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i >= (b); i--)
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

#define RATE 380000.0

using namespace std;

typedef long double ld;

int main(void) {
	int N;

    scanf("%d", &N);

    ld ans = 0.0;
    REP(i, 0, N) {
    	ld x;
    	char u[5];
    	scanf("%Lf %s", &x, u);
    	if ( u[0] == 'B' ) ans += x * RATE;
    	else ans += x;

    }
    
    printf("%Lf\n", ans);

	return 0;
}


Measured memory_bytes: 256
def gcd(a: int, b: int)->int:
    if a < b:
        a, b = b, a
    return a if b == 0 else gcd(b, a % b)


def lcm(a: int, b: int)->int:
    return a * b // gcd(a, b)


def div_num(n: int, a: int)->int:
    '''n 以下の整数で a で割り切れるものの数を計算します。
    '''
    return n // a


def anti_division(A: int, B: int, C: int, D: int)->int:
    A -= 1

    n1 = div_num(A, C)+div_num(A, D)-div_num(A, lcm(C, D))
    n2 = div_num(B, C)+div_num(B, D)-div_num(B, lcm(C, D))

    return (B-A) - (n2-n1)


if __name__ == "__main__":
    A, B, C, D = map(int, input().split())

    ans = anti_division(A, B, C, D)
    print(ans)


Measured memory_bytes: 3064
n, q = gets.chomp.split.map(&:to_i)
h = []
ans = Array.new(n, 0)
rel = Array.new(n) { [] }
(n-1).times do
  a, b = gets.chomp.split.map(&:to_i)
  a -= 1
  b -= 1
  rel[a].push(b)
  rel[b].push(a)
end

q.times do
  a, b = gets.chomp.split.map(&:to_i)
  ans[a-1] += b
end

fin = Array.new(n, false)
queue = [0]
while !queue.empty?
  n = queue.shift
  fin[n] = true
  rel[n].each do |t|
    next if fin[t]
    ans[t] += ans[n]
    queue.push(t)
  end
end

puts ans.join(' ')


Measured memory_bytes: 27388
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;

class Main{

	public static void main(String[] args) throws IOException{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int len = Integer.parseInt(br.readLine());
		int[] array = new int[len];
		String str = br.readLine();
		StringTokenizer st = new StringTokenizer(str, " ");

		for(int i = 0; i < len; i++){
			array[i] = Integer.parseInt(st.nextToken());
		}

		for(int i = len - 1; i >= 0; i--){
			System.out.print(array[i]);
			if(i != 0){
				System.out.print(" ");
			}else{
				System.out.print("\n");
			}
		}

	}
}

Measured memory_bytes: 24116