akhauriyash/Code-Regression huggingface dataset:
use std::cmp::*;
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let K: usize = itr.next().unwrap().parse().unwrap();
    let xy: Vec<(i64, i64)> = (0..n)
        .map(|_| {
            (
                itr.next().unwrap().parse().unwrap(),
                itr.next().unwrap().parse().unwrap(),
            )
        })
        .collect();

    let mut ans = 1i64 << 62;
    for i in 0..n {
        for j in 0..n {
            for k in 0..n {
                for l in 0..n {
                    let R = max(xy[i].0, max(xy[j].0, max(xy[k].0, xy[l].0)));
                    let L = min(xy[i].0, min(xy[j].0, min(xy[k].0, xy[l].0)));
                    let U = max(xy[i].1, max(xy[j].1, max(xy[k].1, xy[l].1)));
                    let D = min(xy[i].1, min(xy[j].1, min(xy[k].1, xy[l].1)));
                    let mut cnt = 0;

                    for a in 0..n {
                        if L <= xy[a].0 && xy[a].0 <= R && D <= xy[a].1 && xy[a].1 <= U {
                            cnt += 1;
                        }
                    }
                    if cnt >= K {
                        ans = min(ans, (R - L) * (U - D));
                    }
                }
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2148
#include <stdio.h>

int main (void)
{
	int H[1000], W[1000];
	int i,j,h,w;

	for(i=0;;i++){
		scanf("%d %d", &H[i], &W[i]);
		if(H[i]==0 && W[i]==0) break;
	}

	for(j=0;j<i;j++){
		for(w=0;w<W[j];w++){
			printf("#");
		}
		printf("\n");

		for(h=1;h<H[j]-1;h++){
			for(w=0;w<W[j];w++){
				if(w==0||w==W[j]-1){
					printf("#");
				} else {
					printf(".");
				}
			}
			printf("\n");
		}
		
		for(w=0;w<W[j];w++){
			printf("#");
		}
		printf("\n\n");

	}


	return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repr(i,a,n) for(int i=a;i>n;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (a+b > c+d) cout << "Left" << endl;
  if (a+b < c+d) cout << "Right" << endl;
  if (a+b == c+d) cout << "Balanced" << endl;
}

Measured memory_bytes: 256
def f(alp, num):
  LI = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
  return LI[LI.find(alp)+num]

N = int(input())
S = input()
ans = ""
for i in S:
  ans += f(i,N)
  
print(ans)

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

using namespace std;

int main(){
	int n,m;
	cin >> n >> m;
	int p,y;
	vector <pair<int,int> > empty;
	vector <vector <pair<int,int> > > v(n,empty);
	for (int i = 0; i < m; ++i){
		cin >> p >> y;
		v[p-1].push_back({y,i});
	}
	string x = "";
	vector <string> ids(m,x);

	for (int i = 0; i < n; ++i){
		sort(v[i].begin(),v[i].end());
		for (int j = 0; j < (int)v[i].size(); ++j){
			x = to_string(i+1);
			for (int k = 6-x.size(); k > 0; --k){
				ids[v[i][j].second] += '0';
			}
			ids[v[i][j].second] += x;
			x = to_string(j+1);
			for (int k = 6-x.size(); k > 0; --k){
				ids[v[i][j].second] += '0';
			}
			ids[v[i][j].second] += x;
		}
	}
	for (int i = 0; i < (int)ids.size(); ++i){
		cout << ids[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 12416
/*
 * Author: Dumbear
 * Created Time:  2011/8/31 12:33:48
 * File Name: A.cpp
 */
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <vector>
using namespace std;
#define out(v) cerr << #v << ": " << (v) << endl
#define SZ(v) ((int)(v).size())
const int maxint = -1u>>1;
template <class T> bool get_max(T& a, const T &b) {return b > a? a = b, 1: 0;}
template <class T> bool get_min(T& a, const T &b) {return b < a? a = b, 1: 0;}

int n, m, s[110];

bool solve();

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

bool solve() {
    scanf("%d%d", &n, &m);
    if (n == 0 && m == 0)
        return false;
    for (int i = 0; i < m; ++i)
        scanf("%d", &s[i]);
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            int c;
            scanf("%d", &c);
            s[j] -= c;
        }
    }
    for (int i = 0; i < m; ++i)
        if (s[i] < 0) {
            puts("No");
            return true;
        }
    puts("Yes");
    return true;
}

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

int main()
{
	string str;
	int cnt;
	while (cin >> str)
	{
		for (int i = 0; i < str.size(); i++)
		{
			if (str[i] =='@')
			{
				cnt = str[i + 1] - '0';		//cnt=str[i+2]を繰り返す回数
				for (int j = 0; j < cnt; j++)
				{
					cout << str[i + 2];
				}
				i+=2;	//str[i+1] , str[i+2]の分カウントを進める
			}
			else
			{
				cout << str[i];
			}
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1172
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		int[] l = new int[n];
		for(int i = 0; i < n; i++){
		    l[i] = sc.nextInt();
		}

		// 計算
	    int result = 0;
	    Arrays.sort(l);
	    for(int i = 0; i < n; i++){
		    for(int j = i + 1; j < n; j++){
		        for(int k = j + 1; k < n; k++){
		            if(l[k] - l[j] < l[i]) result++;
		        }
		    }
		}

		// 出力
		System.out.println(result);
        
	}
}


Measured memory_bytes: 27388
#include <bits/stdc++.h>
using namespace std;
int cnt[2020];
int main()
{
    int N;
    string s; cin>>N>>s;
    int ans = 0;
    for(int k=1; k<N; ++k)
    {
        int x=0;
        memset(cnt,0,sizeof cnt);
        for(int i=1; i<=k; ++i)
            cnt[s[i-1]] |= 2;
        for(int i=k+1; i<=N;++i)
            cnt[s[i-1]] |= 1;
        for(int i=0; i<=255;++i)
            x += (cnt[i] == 3);
        ans = max(ans,x);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import scala.io.StdIn

object Main {
  def main(args:Array[String]){
    val n=StdIn.readLine().split(" ").map(_.toInt)
    val (a,b,c)=(n(0),n(1),n(2))
    println(if(a<b&&b<c)"Yes" else"No")
  }
}

Measured memory_bytes: 43760
fun main(args: Array<String>) {
    val arg = readLine()!!.toLong()
    val sum : Long = (1..arg).toList()
        .asSequence()
        .filter { (it % 3L) != 0L }
        .filter { (it % 5L) != 0L }
        .sum()
    println(sum)
}

Measured memory_bytes: 78048
N, x = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
for i in range(N-1):
    n = max(0, A[i] + A[i+1] - x)
    ans += n
    A[i+1] = max(0, A[i+1]-n)

print(ans)

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

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

int main() {
  int n;
  cin >> n;
  int sum = 0;

  rep2(i, n) {
    rep2(j, n) {
      rep2(k, n) {
        sum += gcd(gcd(i, j), k);
      }
    }
  }

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <math.h>
#include <queue>

using namespace std;

typedef long long int ll;
typedef long double ld;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define vsort(a) sort(a.begin(), a.end())
#define rev(a) reverse(a.begin(), a.end())

const int MOD = 1000000007;
const int INF = INT_MAX;


// a,bの最小公倍数
ll LCM(ll a, ll b){ll lcm = a * b; ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return lcm /= b;}
// a,bの最大公約数
ll GCD(ll a, ll b){ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return b;}
// MOD
ll modadd(ll a, ll b){return (a%MOD+b%MOD+MOD)%MOD;}
ll modmul(ll a, ll b){return a%MOD*b%MOD%MOD;}
ll modexp(ll a, ll n){if(n==0)return 1; if(n%2==0){ll e=modexp(a,n/2); return modmul(e,e);} return modexp(a,n-1)*a%MOD;}
ll modinv(ll n){return modexp(n%MOD,MOD-2);}
ll modfact(ll n){ll res=1; for (int i=1; i <= n; ++i){res *= i; res %= MOD;} return res;}
ll modncr(ll n, ll r){ll numer=1;ll denom=1;for(int i=1;i<=r;++i){numer=modmul(numer,n-r+i);denom=modmul(denom,i);}return modmul(numer, modinv(denom));}


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

    if (r < 1200) cout << "ABC" << endl;
    else if (r < 2800) cout << "ARC" << endl;
    else cout << "AGC" << endl;

    
}





//              g++ -std=c++1z


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
#define INF (int)2e9

int main(){
    int n, t;
    cin >> n >> t;
    
    int a, mi = INF, dif = 0, cnt = 0;
    rep(i, n){
        cin >> a;
        if(mi > a){
            mi = a;
        }else{
            if(dif < a-mi){
                dif = a-mi;
                cnt=1;
            }else if(dif==a-mi){
                cnt++;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int N;
    cin >> N;
    set<int> S;
    rep(i, N) {
        int a;
        cin >> a;
        S.insert(a);
    }
    cout << S.size() << endl;
}


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

using namespace std;
typedef long long LL;

const int MAXN = 2E5 + 5;

LL n, x, m;
LL sum[MAXN], a[MAXN], last[MAXN], st, ed;

int main() {
    // freopen("1.in", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    cin >> n >> x >> m;
    a[1] = x, sum[1] = a[1];
    for (int i = 2; i <= n; i++) {
        a[i] = a[i - 1] * a[i - 1] % m;
        sum[i] = sum[i - 1] + a[i];
        if (a[i] == 0) {
            cout << sum[i - 1];
            return 0;
        }
        if (last[a[i]]) {
            st = last[a[i]];
            ed = i - 1;
            break;
        }
        last[a[i]] = i;
    }
    if (!ed)
        cout << sum[n];
    else {
        LL len = ed - st + 1;
        LL cyclesum = sum[ed] - sum[st - 1];
        LL ans = sum[st - 1];
        LL tot = n - st + 1;
        ans += tot / len * cyclesum;
        int rem = tot % len;
        ans += sum[st + rem - 1] - sum[st - 1];
        cout << ans;
    }
    return 0;
}


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

int main() {
  int a,b;
  cin >> a >> b;
  int wa = a + b;
  int sa = a - b;
  int zyo = a * b;
  
  if(wa > sa && wa > zyo) cout << wa;
  else if(sa > wa && sa > zyo) cout << sa;
  else if(zyo > wa && zyo > sa) cout << zyo;
  else cout << wa;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
bool judge(int x)
{
    int a=x%10,b=x/100;
    return a==b;
}
int main()
{
    int n;
    scanf("%d",&n);
    printf(judge(n)?"Yes\n":"No\n");
    return 0;
}


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

#define int long long

int n,ans;
struct vec{
	int x,y;
}a[205];

bool cmp(vec a,vec b)
{
	if(atan2(a.y,a.x)==atan2(b.y,b.x))
		return a.x<b.x;
	return atan2(a.y,a.x)<atan2(b.y,b.x);
}

signed main()
{
	cin>>n;
	for(int i=1;i<=n;cin>>a[i].x>>a[i].y,i++);
	sort(a+1,a+1+n,cmp);
	for(int i=1;i<=n;i++)
		a[n+i] = a[i];
	for(int l=1;l<=n;l++)
	{
		int x=0,y=0;
		for(int r=l;r<l+n;r++)
		{
			x += a[r].x, y += a[r].y;
			ans = max(ans,x*x+y*y);
		}
	}
	printf("%.11lf\n",sqrt(ans));
	
	return 0;
}

Measured memory_bytes: 4088
#include <iostream>
using namespace std;
int main(){
	double w;
	while(cin>>w){
		if(w<=48.00) cout<<"light fly"<<endl;
		else if(w>48.00 && w<=51.00) cout<<"fly"<<endl;
		else if(w>51.00 && w<=54.00) cout<<"bantam"<<endl;
		else if(w>54.00 && w<=57.00) cout<<"feather"<<endl;
		else if(w>57.00 && w<=60.00) cout<<"light"<<endl;
		else if(w>60.00 && w<=64.00) cout<<"light welter"<<endl;
		else if(w>64.00 && w<=69.00) cout<<"welter"<<endl;
		else if(w>69.00 && w<=75.00) cout<<"light middle"<<endl;
		else if(w>75.00 && w<=81.00) cout<<"middle"<<endl;
		else if(w>81.00 && w<=91.00) cout<<"light heavy"<<endl;
		else if(w>91.00) cout<<"heavy"<<endl;
	}
	return 0;
}

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

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  int ans=0;
  while(ans<c){if(b<a){
      break;
    }
    b-=a;
    ans++;
    
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
using namespace std;
using P = pair<int, pair<int, int>>;
int dx1[] = {-1, 0, 0, 1};
int dy1[] = {0, 1, -1, 0};
 

int main(){
    int h, w;
    cin >> h >> w;
    int ch, cw, dh, dw;
    cin >> ch >> cw;
    cin >> dh >> dw;
    vector<string> s(h);
    for(int i = 0; i < h; i++) cin >> s[i];

    vector<vector<int>> memo(h, vector<int>(w, 0));
    vector<vector<bool>> isvisit(h, vector<bool>(w, false));
    ch--;
    cw--;
    dh--;
    dw--;
    priority_queue<P, vector<P>, greater<P>> Q;
    Q.push(make_pair(0, make_pair(ch, cw)));
    
    while(Q.size()){
        int curx = Q.top().second.first;
        int cury = Q.top().second.second;
        int curcost = Q.top().first;
        Q.pop();
        if(isvisit[curx][cury]) continue;
        else isvisit[curx][cury] = true;
        //printf("(%d, %d, %d, %c) ", curcost, curx, cury, s[curx][cury]);
        memo[curx][cury] = curcost;

        for(int i = 0; i < 4; i++){
            if(curx+dx1[i] >= 0 && curx+dx1[i] < h
            && cury+dy1[i] >= 0 && cury+dy1[i] < w){
                if(s[curx+dx1[i]][cury+dy1[i]] == '.'){
                    Q.push(make_pair(curcost, make_pair(curx+dx1[i], cury+dy1[i])));
                }
            }
        }

        for(int i = -2; i <= 2; i++){
            for(int j = -2; j <= 2; j++){
                if(curx+i >= 0 && curx+i < h
                && cury+j >= 0 && cury+j < w){
                    if(s[curx+i][cury+j] == '.'){
                        Q.push(make_pair(curcost+1,
                        make_pair(curx+i, cury+j)));
                    }
                }
            }
        }
    }
    
    if(!isvisit[dh][dw]) cout << -1 << endl;
    else cout << memo[dh][dw] << endl;

    return 0;
}

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

int main() {
  int N,L;
  cin >> N >>L;
  if(L-1>=0)
    cout << (L-1)*(N-1)+(N+2)*(N-1)/2;
  else if(L+N-1<=0)
    cout << (L-1)*(N-1)+N*(N-1)/2;
  else
    cout << (L-1)*N+N*(N+1)/2;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std; 
int arrCount[200005] = { 0 }; 
bool cmp(int iNum1, int iNum2)
{ 
    return iNum1 > iNum2;
}
int main()
{
    int n, m, i, t, iSum=0,maxn(1); 
    cin >> n >> m; 
    for (i = 1; i <= n; ++i)
    { 
        cin >> t;
        ++arrCount[t]; 
        maxn=(t>maxn?t:maxn);
    }
    sort(arrCount, arrCount + maxn+1,cmp); 
    for (i = m; i<=n; ++i)
    { 
        iSum += arrCount[i]; 
    }
    cout << iSum << endl; 
    return 0; 
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
#include<set>
using namespace std;


const long long int mod=1000000007;
const long long int INF=99999999999999999;


int main() {
	cout << fixed << setprecision(18);
	long long int n;
	cin>>n;
	while(n!=0){
		long long int cou=0;
		for(int i=n+1;i<=2*n;i++){
			for(int j=2;j*j<=i;j++){
				if(i%j==0){cou--;break;}
			}
			cou++;
		}
		cout<<cou<<endl;
		cin>>n;
	}
} 


Measured memory_bytes: 3004
#include <bits/stdc++.h> 
using namespace std;
 int a,b,c,date;
  string d,e,f; 
  int main(){ 
	  cin >>date;
	   
	    if(date == 25){cout <<"Christmas"<<endl;} 
	    else if(date == 24){cout <<"Christmas Eve"<<endl;
			} else if(date == 23){cout <<"Christmas Eve Eve"<<endl;}
			 else if(date == 22){cout <<"Christmas Eve Eve Eve"<<endl;} 
			 
			 }


Measured memory_bytes: 256
#[macro_export]
macro_rules !read_value {($iter :expr ,($($t :tt ) ,*) ) =>{($(read_value !($iter ,$t ) ) ,*) } ;($iter :expr ,[$t :tt ;$len :expr ] ) =>{(0 ..$len ) .map (|_ |read_value !($iter ,$t ) ) .collect ::<Vec <_ >>() } ;($iter :expr ,{$t :tt =>$f :expr } ) =>{$f (read_value !($iter ,$t ) ) } ;($iter :expr ,chars ) =>{read_value !($iter ,String ) .chars () .collect ::<Vec <char >>() } ;($iter :expr ,usize1 ) =>{read_value !($iter ,usize ) -1 } ;($iter :expr ,$t :ty ) =>{$iter .next () .unwrap () .parse ::<$t >() .unwrap () } ;}
#[macro_export]
macro_rules !input_inner {($iter :expr ) =>{} ;($iter :expr ,) =>{} ;($iter :expr ,mut $var :ident :$t :tt $($r :tt ) *) =>{let mut $var =read_value !($iter ,$t ) ;input_inner !{$iter $($r ) *} } ;($iter :expr ,mut $var :ident $($r :tt ) *) =>{input_inner !{$iter ,mut $var :usize $($r ) *} } ;($iter :expr ,$var :ident :$t :tt $($r :tt ) *) =>{let $var =read_value !($iter ,$t ) ;input_inner !{$iter $($r ) *} } ;($iter :expr ,$var :ident $($r :tt ) *) =>{input_inner !{$iter ,$var :usize $($r ) *} } ;}
#[macro_export]
macro_rules !input {(source =$s :expr ,$($r :tt ) *) =>{let mut iter =$s .split_whitespace () ;input_inner !{iter ,$($r ) *} } ;(iter =$iter :ident ,$($r :tt ) *) =>{let s ={use std ::io ::Read ;let mut s =String ::new () ;std ::io ::stdin () .read_to_string (&mut s ) .unwrap () ;s } ;let mut $iter =s .split_whitespace () ;input_inner !{$iter ,$($r ) *} } ;($($r :tt ) *) =>{let s ={use std ::io ::Read ;let mut s =String ::new () ;std ::io ::stdin () .read_to_string (&mut s ) .unwrap () ;s } ;let mut iter =s .split_whitespace () ;input_inner !{iter ,$($r ) *} } ;}
fn main() {
    #[allow(unused_imports)]
    use std::io::Write as _;
    let __out = std::io::stdout();
    #[allow(unused_mut, unused_variables)]
    let mut __out = std::io::BufWriter::new(__out.lock());
    #[allow(unused_macros)]
    macro_rules !print {($($arg :tt ) *) =>(::std ::write !(__out ,$($arg ) *) .unwrap () ) }
    #[allow(unused_macros)]
    macro_rules !println {($($arg :tt ) *) =>(::std ::writeln !(__out ,$($arg ) *) .unwrap () ) }
    #[allow(unused_macros)]
    macro_rules! echo {
        ($iter :expr ) => {
            echo!($iter, "\n")
        };
        ($iter :expr ,$sep :expr ) => {
            let mut iter = $iter;
            if let Some(item) = iter.next() {
                print!("{}", item);
            }
            for item in iter {
                print!("{}{}", $sep, item);
            }
            println!();
        };
    }
    input!(n);
    let mut ans = 0usize;
    for i in 1..=n {
        let x = n / i;
        ans += x * (x + 1) / 2 * i;
    }
    println!("{}", ans);
}


Measured memory_bytes: 2080
#include <bits/stdc++.h>
#include <unordered_map>
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define REP(i,a,b) for(int i=a; i<=b; i++)
using namespace std;

typedef long long int ll;

int main() {
    char a;
    cin >> a;
    cout << ((a>='A'&& a<='Z')?"A":"a");
    return 0;
}


Measured memory_bytes: 3592
import math
n = int(input())
lis = list(map(int,input().split()))
lis.sort()
num = lis[0]
for nu in lis:
    num = math.gcd(num,nu)
exist = [0 for i in range(10**6+1)]
if num != 1:
    print("not coprime")
    exit()
for nu in lis:
    if nu != 1:
        for i in range(2,math.ceil(math.sqrt(nu))+1):
            if nu % i == 0:
                if exist[i] == 1:
                    print("setwise coprime")
                    exit()
                else:
                    exist[i] = 1
                    while nu % i == 0:
                        nu //= i
        if nu != 1:
            if exist[nu] == 1:
                print("setwise coprime")
                exit()
            exist[nu] = 1
print("pairwise coprime")

Measured memory_bytes: 209396
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    ll n;
    cin >> n;
    vector<string> s(n);
    vector<pair<ll, ll>> cnt(n, {0, 0}), a;
    rep(i, n)cin >> s[i];
    rep(i, n){
        rep(j, s[i].size()){
            if(s[i][j] == '(')cnt[i].first++;
            else{
                if(cnt[i].first)cnt[i].first--;
                else cnt[i].second++;
            }
        }
    }
    ll now = 0;
    rep(i, n){
        if(!cnt[i].second)now += cnt[i].first;
    }
    rep(i, n){
        if(cnt[i].first && cnt[i].second){
            a.push_back({cnt[i].second, cnt[i].first-cnt[i].second});
        }
    }
    sort(all(a));
    ll j = 0, ma = 0;
    priority_queue<pair<ll, ll>> que;
    rep(i, a.size()){
        while(j < a.size() && a[j].first <= now){
            que.push({a[j].second, j}); j++;
        }
        if(que.empty()){cout << "No" << endl; return 0;}
        if(a[que.top().second].first > now){cout << "No" << endl; return 0;}
        now += que.top().first; que.pop();
    }
    rep(i, n){
        if(!cnt[i].first)now -= cnt[i].second;
    }
    cout << (now == 0 ? "Yes" : "No") << endl;
}


Measured memory_bytes: 50172
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
int Madd(int x,int y) {return (x+y)%M;}
int Msub(int x,int y) {return (x-y+M)%M;}
int Mmul(int x,int y) {return (x*y)%M;}


void chmax(P &a,P b){
  if(a.F<b.F) a.S=max(a.F,b.S),a.F=b.F;
  else a.S=max(a.S,b.F);
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);

  int n;
  cin>>n;
  vi a(1<<n);
  vector<P> dp(1<<n);
  rep(i,(1<<n)){
    cin>>a[i];
    dp[i]={a[i],-inf};
  }

  rep(i,n){
    rep(j,(1<<n)){
      if(j&(1<<i)){
        chmax(dp[j],dp[j^(1<<i)]);
      }
    }
  }

  int ans=-inf;
  rep(i,(1<<n)){
    int tmp=dp[i].F+dp[i].S;
    ans=max(ans,tmp);
    if(i) cout<<ans<<endl;
  }


}

Measured memory_bytes: 11264
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,a,b;
    cin>>n>>a>>b;
    if(n>1&&b>=a||n==1&&a==b)
    {
        cout<<(n-2)*(b-a)+1<<endl;
    }
    else
    {
        cout<<0<<endl; 
    }
 } 

Measured memory_bytes: 256
#include<bits/stdc++.h>
  #define ll          long long
  #define pb          push_back
  #define c(P)        cout<<P<<"\n"
  #define dbg(P)      cout<<P<<" "
  #define pii         pair<ll,ll>
  #define mi          map<ll,ll>
  #define mii         map<pii,ll>
  #define F           first
  #define S           second
  #define mem(a,val)  memset(a,val,sizeof(a))
  #define fr(i,x,n)   for(ll i=x;i<n;i++)
  #define frr(i,x,n)  for(ll i=n-1;i>=x;i--)


  const ll N   =  21;
  const ll mod = 1e9 + 7;

  using namespace std;
    ll dp[(1<<N)][N],n;
    std::vector<ll> v[21];
  ll fun(ll mask,ll id)
  {

    if(mask==((1<<n)-1))
      return 1;
    if(id>=n)
      return 0;
    if(dp[mask][id]!=-1)
      return dp[mask][id];
    ll ans = 0;
    for(auto it : v[id])
    {
      if((mask & (1<<it))==0)
      {
        ans += fun((mask | (1<<it)) , id + 1);
      
        ans %=mod;
      }
    }
  return dp[mask][id] = ans;
  }
  void solve()
  {
  // string s;
    ll x;
    cin>>n;
    fr(i,0,(1<<N))fr(j,0,N)dp[i][j] = -1;
    for (ll i = 0; i < n; ++i)
    {
      fr(j,0,n)
      {
    cin>>x;
    if(x==1)
    v[i].pb(j);
      }
    }
    c(fun(0,0));
  }

  signed main(){
      
        ios_base::sync_with_stdio(false);   
        cin.tie(NULL);
        ll T=1;
        //cin>>T;
        while(T--)
        {
        solve();
        }
        return 0;
      }


Measured memory_bytes: 344320
use std::io::*;
use std::str::FromStr;

fn main() {
    let n: u32 = read();
    let a: u32 = read();

    let rem: u32 = n % 500;
    let ans = if rem <= a {"Yes"} else {"No"};
    println!("{}", ans);
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n;
    string s;
    cin>>n>>s;
    ll gcd=0,r=0,g=0,b=0;
    for(int i=0;i<n;i++)
    {
        if(s[i]=='R') r++;
        if(s[i]=='G') g++;
        if(s[i]=='B') b++;
        for(int j=i+1,k=i+2;k<n;k+=2,j++)
            if((s[i]^s[j]^s[k])==('R'^'G'^'B')) gcd++;
    }
    cout<<(r*g*b)-gcd<<endl;
}


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


Measured memory_bytes: 3160
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
long as[100000];

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

    long n;
    cin >> n;

    long a;
    long n_kind = 0;

    for (long i = 0; i < n; ++i)
    {
        cin >> a;
        a--;
        if (as[a] == 0)
        {
            ++n_kind;
        }
        ++as[a];
    }

    if (n_kind == n)
    {
        cout << n_kind << endl;
        return 0;
    }

    if (n_kind % 2 == 0)
    {
        cout << n_kind - 1 << endl;
    }
    else
    {
        cout << n_kind << endl;
    }

    return 0;
}

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

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

  if (n[0] == '7' || n[1] == '7' || n[2] == '7'){
  cout << "Yes" << endl;
  } else{
  cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;
int main(){
    int n;
    cin>>n;
    int ans=0;
    rep(i,1,n) ans += i;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
	int n; cin >> n;
	vector<int> pv;
	vector<int> sorted_pv;

	for(int i = 0; i < n; i++){
		int p; cin >> p;
		pv.push_back(p);
	}
	sorted_pv = pv;
	sort(sorted_pv.begin(), sorted_pv.end());

	if (pv == sorted_pv)
	{
		cout << "YES" << endl;
		return (0);
	}

	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			vector<int> tmp = pv;

			if(i != j){
				int t = tmp[i];
				tmp[i] = tmp[j];
				tmp[j] = t;

				if (tmp == sorted_pv)
				{
					cout << "YES" << endl;
					return (0);
				}
			}
		}
	}
	cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

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

  int cnt = 0;
  for(int i=0;i<N;i++){
    int l,r;
    cin >> l >> r;
    cnt += r - l + 1;
  }

  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, const char * argv[]) {
    char num;
    int g,n,a;
    a=0;
    g = 0;
    while(""){
        while((num = getchar()) != '0'){
            if(num == '\n'){
                printf("%d\n",g);
                g=0;
                a=0;
                continue;
            }
            a =num - '0';
            n =num - '0';
            g += n;
        }
        if(a == 0)break;
        if(num != '0'){
        printf("%d\n",g);
        g=0;
        }
    }
    return 0;
} 



Measured memory_bytes: 2084
#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>;
using Graph = vector<vector<int>>;

int main() {
    int d, g;
    cin >> d >> g;
    vector<int> p(d);
    vector<int> c(d);
    vector<int> x(d);
    rep(i,d){
        cin >> p[i] >> c[i];
        x[i]=100*(i+1)*p[i]+c[i];
    }
    int ans=1000000000, pr=0, cur=0;
    for (int bit = 0; bit < (1<<d); ++bit) {
        for (int i = 0; i < d; ++i) {
            if (!(bit & (1<<i))) {
                cur+=x[i];
                pr+=p[i];
            }
        }
        if(cur>=g){
            ans=min(ans,pr);
        }else{
            int y=g-cur;
            for(int j=d-1; j>=0; --j){
                if(!(bit & (1<<j))) continue;
                if(ans<pr) break;
                if((y-100*(j+1)*(p[j]-1))<=0){
                    while(1){
                        ++pr;
                        y-=100*(j+1);
                        if(ans<pr) break;
                        if(y<=0) {
                            ans=min(ans,pr);
                            break;
                        }
                    }
                }else{
                    y-=100*(j+1)*(p[j]-1);
                    pr+=p[j]-1;
                }
            }
        }
        cur=0; pr=0;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main(int argc, const char * argv[]) {
    using namespace std;
    int n = 100000, t ;
    cin >> t;
    for (int i=1;i<=t;i++) {
        n *= 1.05;
        if (n%1000!=0)
            n += 1000-(n%1000);
    }
    cout << (int)n << "\n";
    return 0;
}



Measured memory_bytes: 3076
#include<stdio.h>
#define	MAX 44
int fibonacci(int);
int F[MAX];
int main(){
  int n,ans;
  scanf("%d",&n);
  ans=fibonacci(n);
  printf("%d\n",ans);
  return 0;
}
int fibonacci(int n){
  int i;
  F[0]=1;
  F[1]=1;
  for(i=2;i<=n;i++){
    F[i]=F[i-2]+F[i-1];
  }
  return F[n];
}

Measured memory_bytes: 596
n = int(input())
temp = [int(s) for s in input().split()]
rarry = 0
min = 100000007
min_temp = 0
for n_ in range(100):
    for i in temp:
        min_temp += ((i - n_) ** 2)
    #print(min_temp)
    if(min > min_temp):
        min = min_temp
    min_temp = 0


print("{}".format(str(min)))

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
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; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

int main(){
    int n, m;
    cin >> n >> m;
    int a;
    int sum = 0;
    for (int i = 0; i < m; ++i) {
        cin >> a;
        sum += a;
    }
    if (sum > n) cout << -1 << endl;
    else cout << n - sum << endl;
}

Measured memory_bytes: 3588
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
string s,t,u;
int n;
int f(string tt){
    string ss=tt;
    reverse(ss.begin(),ss.end());
    for(int i=0;i<tt.size();i++){
        if(tt[i]!=ss[i])return 0;
    }
    return 1;
}
int main(void){
    cin>>s;
    n=s.size();
    t=s.substr(0,(n-1)/2);
    u=s.substr((n+3)/2-1,-1);
    //cout<<t<<" "<<u<<" "<<s<<endl;
    //if((1)&&(1))cout<<"Yes"<<endl;
    if(f(u)&&f(t)&&f(s))cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		var n = ri();
		Console.WriteLine(
			n < 1200 ? "ABC" : (n < 2800 ? "ARC" : "AGC")
		);
	}

	public Sol(){
		
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 11092
import java.util.Scanner;

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

        double[] s = new double[n];
        double sum = 0;
        double  avg = 0;
        for (int i = 0; i < n ; i++){
            s[i] = sc.nextInt();
            sum += s[i];
        }
        avg = sum / (double)n;

        double min = Math.abs(avg - s[0]);
        int idx = 0;

        for (int i = 1; i < n ; i++){
            double tmp = Math.abs(avg - s[i]);            
            if (tmp < min){
                min = tmp;
                idx = i;
            }
        }

        System.out.println(idx);
    }
}

Measured memory_bytes: 23124
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <map>

using namespace std;

typedef long long ll;
const ll mod = 1e9 + 7;

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

int main() {
    ll n,k; cin >> n >> k;
    vector<ll> v(k + 1);
    ll ans = 0;
    for (ll i = k; i > 0; i--) {
        v[i] = (mod_pow(k / i, n) + mod) % mod;
        ll cur = 2;
        while (i * cur <= k) {
            v[i] -= v[i * cur];
            cur++;
        }
        ll res = (i * v[i] + mod) % mod;
        ans = (ans + res + mod) % mod;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3996
#include <cstdio>
#include <set>

using namespace std;

int main()
{
    set< int > st;
    int n, a[100], b[100], c[100];
    int x, y, z = 0;
    scanf( "%d\n", &n );
    scanf( "%d\n", &x );
    for( int i = 0; i < x; i++ )
    {
        scanf( "%d ", &a[i] );
    }
    scanf( "%d\n", &y );
    for( int i = 0; i < y; i++ )
    {
        scanf( "%d ", &b[i] );
    }
    scanf( "%d\n", &z );
    for( int i = 0; i < z; i++ )
    {
        scanf( "%d ", &c[i] );
    }
    for( int i = 0; i < z; i++ )
    {
        bool a_include = 0;
        for( int j = 0; j < x; j++ )
        {
            if( c[i] == a[j] )
            {
                a_include = 1;
            }
        }
        if( a_include )continue;
        st.insert( c[i] );
    }
    for( int i = 0; i < z; i++ )
    {
        bool intersection = 0;
        for( int j = 0; j < y; j++ )
        {
            if( c[i] == b[j] )
            {
                intersection = 1;
            }
        }
        if( intersection )
        {
            st.insert( c[i] );
        }
    }
    printf( "%d\n", st.size() );
    return 0;
}


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

using namespace std;
int a[100005];
map<int,int>mp;
int main(){
	long long n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		mp[a[i]]++;
	}
	int ans=0;
	for(map<int,int>::iterator it=mp.begin();it!=mp.end();it++){
		if(it->first>it->second){
			ans+=it->second;
		}
		else ans+=it->second-it->first;
	}
	cout<<ans<<endl;
	return 0;
}

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

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] l = new int[m];
		for (int i = 0; i < m; i++) {
			l[i] = sc.nextInt();
		}
		int sum = 0;
		for (int i : l) {
			sum += i;
		}
		System.out.println((n - sum) < 0 ? -1 : n - sum);
		;

	}

	static int getDigit(int n, int d) {
		return n / d != 0 ? 1 + getDigit(n / d, d) : 1;
	}

	static class FastScanner {
		private BufferedReader reader;
		private StringTokenizer tokenizer;

		public FastScanner(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
			tokenizer = null;
		}

		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public String nextLine() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					return reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}

			return tokenizer.nextToken("\n");
		}

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

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

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

		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}
	}
}

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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)

typedef pair<int, int> P;
struct Order {
    bool operator()(P const& a, P const& b) const {
        return a.second < b.second || a.second == b.second && a.first < b.first;
    }
};

vector<long long int> v[110000];

int main() {

    int n, m; cin >> n >> m;

    rep(i, n) {
        int a,b; cin >> a >> b;
        v[a].push_back(b);
    }

    // m-1日後から逆に計算していく
    // お金をもらえる中で最大の料金のを選ぶ
    ll ans = 0;
    priority_queue< P, vector<P>, Order> Q;
    for(int i=1; i <= m; i++) {
        for(auto sal : v[i]) {
            P tmp = make_pair(i, sal);
            Q.push(tmp);
        }

        if(!Q.empty()) {
            ans += Q.top().second;
            Q.pop();
        }
    }

    cout << ans << endl;


    return 0;


}


Measured memory_bytes: 5888
/*
    アリナ・グレイはかわいい
*/

#include<bits/stdc++.h>
using namespace std;
#define itn int
#define ll long long

int main(void){
    string s;
    cin >> s;
    if(s[2] == s[3] && s[4] == s[5])cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){

	int a,b,c,d,e,f,g,h,i,j;
	cin>>a;
	cin>>b;
	cin>>c;
	cin>>d;
	cin>>e;
	cin>>f;
	cin>>g;
	cin>>h;
	cin>>i;
	cin>>j;

	if(a<b){swap(a,b);}
	if(b<c){swap(b,c);}
	if(c<d){swap(c,d);}
	if(d<e){swap(d,e);}
	if(e<f){swap(e,f);}
	if(f<g){swap(f,g);}
	if(g<h){swap(g,h);}
	if(h<i){swap(h,i);}
	if(i<j){swap(i,j);}

	if(a<b){swap(a,b);}
	if(b<c){swap(b,c);}
	if(c<d){swap(c,d);}
	if(d<e){swap(d,e);}
	if(e<f){swap(e,f);}
	if(f<g){swap(f,g);}
	if(g<h){swap(g,h);}
	if(h<i){swap(h,i);}

	if(a<b){swap(a,b);}
	if(b<c){swap(b,c);}
	if(c<d){swap(c,d);}
	if(d<e){swap(d,e);}
	if(e<f){swap(e,f);}
	if(f<g){swap(f,g);}
	if(g<h){swap(g,h);}

	if(a<b){swap(a,b);}
	if(b<c){swap(b,c);}
	if(c<d){swap(c,d);}
	if(d<e){swap(d,e);}
	if(e<f){swap(e,f);}
	if(f<g){swap(f,g);}

	if(a<b){swap(a,b);}
	if(b<c){swap(b,c);}
	if(c<d){swap(c,d);}
	if(d<e){swap(d,e);}
	if(e<f){swap(e,f);}

	if(a<b){swap(a,b);}
	if(b<c){swap(b,c);}
	if(c<d){swap(c,d);}
	if(d<e){swap(d,e);}
	
	if(a<b){swap(a,b);}
	if(b<c){swap(b,c);}
	if(c<d){swap(c,d);}

	if(a<b){swap(a,b);}
	if(b<c){swap(b,c);}

	if(a<b){swap(a,b);}

	cout<<a<<endl;
	cout<<b<<endl;
	cout<<c<<endl;

	return 0;
}


Measured memory_bytes: 3088
from collections import defaultdict

N = int(input())
S = input()
counter = defaultdict(int)
for s in S:
    counter[s] += 1
total = counter["R"] * counter["G"] * counter["B"]
for i in range(N):
    for j in range(i, N):
        k = j + (j - i)
        if k >= N:
            break
        if S[i] != S[j] and S[j] != S[k] and S[i] != S[k]:
            total -= 1
print(total)

Measured memory_bytes: 9492
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC
{
    class Sample
    {
        public static void Main()
        {
            var split = Console.ReadLine().Split(' ');
            int AB_long = int.Parse(split[0]);
            int BC_long = int.Parse(split[1]);
            int ABC_Area = AB_long * BC_long / 2;
            Console.WriteLine(ABC_Area);
        }
        
    }

}

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

bool is_month(int x)
{
    return 1 <= x && x <= 12;
}

bool is_year(int x)
{
    return true;
}

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

    int a = stoi(S.substr(0, 2));
    int b = stoi(S.substr(2, 2));
    bool is_YYMM = is_year(a) & is_month(b);
    bool is_MMYY = is_month(a) & is_year(b);

    if (is_YYMM && !is_MMYY)
    {
        cout << "YYMM" << endl;
    }
    if (!is_YYMM && is_MMYY)
    {
        cout << "MMYY" << endl;
    }
    if (is_YYMM && is_MMYY)
    {
        cout << "AMBIGUOUS" << endl;
    }
    if (!is_YYMM & !is_MMYY)
    {
        cout << "NA" << endl;
    }
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=500000004;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
int p[510000];
int d[510000];
long long req[510000];
int main(){
	int a,b;scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++)scanf("%d",p+i);
	int at=b;
	d[0]=at;
	for(int i=0;i<a;i++){
		at=min(at,ABS(at-p[i]));
		d[i+1]=at;
	}
	long long P=0;
	for(int i=a-1;i>=0;i--){
		if(P>=p[i]/2){
			P+=p[i];
		}
		req[i]=P;
	}
	int c;scanf("%d",&c);
	for(int i=0;i<c;i++){
		int t;scanf("%d",&t);t--;
		if(d[t]>req[t+1])printf("YES\n");
		else printf("NO\n");
	}
}

Measured memory_bytes: 9728
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			while (sc.hasNext()) {
				int d = Integer.parseInt(sc.nextLine());
				System.out.println(calculate(d));
			}
		}
	}

	public static long calculate(int d) {
		long sum = 0;
		int n = 600 / d + 1;
		for (int i = 0; i < n; i++) {
			int x = Math.min(i * d, 600);
			int w = Math.min(d, 600 - (d * i)); 
			long y = x * x;
			sum += w * y;
		}
		return sum;
	}
}

Measured memory_bytes: 25976
#include <iostream>
#include <vector>
#include<stack>
using namespace std;
static const int MAX = 100000;
static const int NIL = -1;

int n;
vector<int> G[MAX];
int color[MAX];

void dfs(int r,int c){
	stack<int> S;
	S.push(r);
	color[r] = c;
	while(!S.empty()){
		int u=S.top();
		S.pop();
		for(int i =0;i<G[u].size();i++){
			int v = G[u][i];
			if(color[v]==NIL){
				color[v] = c;
				S.push(v);
			}
		}
	}
}

void assign(){
	int id=1;
	for(int i=0;i<n;i++){
		color[i] = NIL;
	}
	for(int j=0;j<n;j++){
		if(color[j]==NIL){
			dfs(j,id++);
		}
	}
}

int main(){
	int s,t,m,q;
	
	cin>>n>>m;
	for(int i=0;i<m;i++){
		cin>>s>>t;
		G[s].push_back(t);
		G[t].push_back(s);
	}
	assign();
	cin>>q;
	for(int i=0;i<q;i++){
		cin>>s>>t;
		if(color[s]==color[t]){
			cout<<"yes"<<endl;
		}
		else cout<<"no"<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 8936
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007

#+++++

def ppp(c,d):
	while c % d != 0:
		nc = d
		nd = c % d
		c,d = nc, nd
	return d

def main():
	a, b, c, d = IN()
	cad=(c*d)//ppp(c,d)
	
	
	all_num=b-a+1
	can_c=(b//c) - ((a-1)//c)
	can_d = (b//d) - ((a-1)//d)
	can_c_and_d = (b//(cad)) - ((a-1)//(cad))
	ret = all_num-can_c-can_d+can_c_and_d
	#pa((can_c,can_d,can_c_and_d,all_num))
	print(ret)
	
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 38256
#include<bits/stdc++.h>
int MOD = 1000000007;
using namespace std;
//g++ -std=c++14
//setprecision(10)
int main(){
	int n;
	cin >> n;
	int sum = 0;
	for(int i = 0; i < n; i++){
		int l, r;
		cin >> l >> r;
		sum += r - l + 1;
	}
	cout << sum << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
#define PI 3.1415926535897932384626433832795028
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
#define max_heap priority_queue<int>
#define min_heap priority_queue<int,vector<int>,greater<int>>
using ll = long long;
#define int long long
#define endl "\n"
#define vi vector<int>
#define pb push_back
#define inp_arr(a,n) for(ll i=0;i<n;i++)cin>>a[i];
#define out_arr(a) for(ll i=0;i<a.size();i++)cout<<a[i]<<" ";
#define deb(n) cerr << #n << " = " << n << "\n";
int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}
ll mypower(ll x,ll n,ll c){
    if(n == 0)
        return 1;
    ll temp = mypower(x,n/2,c)%c;
    if(n%2)
        return (n<0)? (1/x)*temp*temp%c: ((x*temp)%c)*temp%c;
    else
        return temp*temp%c;
}
bool codejam = 0;

int solve(int n,vector<int>& dp){
	if(n<3)
		return 0;
	// cout<<"Hello"<<endl;
	if(dp[n] !=-1)
		return dp[n];
	int ans = 0;
	for(int i = 3;i<n-2;i++){
		ans += solve(n-i,dp)%MOD;
		ans %= MOD;
	}
	dp[n] = (ans+1)%MOD;
	// cout<<"dp["<<n<<"] = "<<dp[n]<<endl;
	return dp[n];
}

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif

	ll n;
	cin>>n;
	vector<int> dp(n+1,-1);
	dp[0] = dp[1] = dp[2] = 0;
	dp[3] = 1;
	int ans = solve(n,dp);
	cout<<ans<<endl;
	return 0;
}


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

int main(){
    int n;cin >> n;
    int a[n];

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

    int t = 1;
    int c = 0;

    while (c < n){
        t = a[t-1];
        if (t == 2){
            cout << c+1 << endl;
            return 0;
        }

        if (c == n-1){
            cout << -1 << endl;
            return 0;
        }
        c++;
    }
    
    return 0;
}

Measured memory_bytes: 640