akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#if LOCAL
    #define debug(args...)     (Debugger()) , args
 		class Debugger {
        public:
        Debugger(const std::string& _separator = ", ") :
        first(true), separator(_separator){}
 		template<typename ObjectType>
        Debugger& operator , (const ObjectType& v)
        {
            if(!first) std::cout << separator;
            std::cout << v;
            first = false;
            return *this;
        }
        ~Debugger() {  std::cout << endl;}
 		private:
        bool first;
        std::string separator;
    };
	 template <typename T1, typename T2>
    inline std::ostream& operator << (std::ostream& os, const std::pair<T1, T2>& p)
    {
        return os << "(" << p.first << ", " << p.second << ")";
    }
 	template<typename T>
    inline std::ostream &operator << (std::ostream & os,const std::vector<T>& v)
    {
        bool first = true;
        os << "[";
        for(unsigned int i = 0; i < v.size(); i++)
        {
            if(!first) os << ", ";
            os << v[i];
            first = false;
        }
        return os << "]";
    }
 	template<typename T>
    inline std::ostream &operator << (std::ostream & os,const std::set<T>& v)
    {
        bool first = true;
        os << "[";
        for (typename std::set<T>::const_iterator ii = v.begin(); ii != v.end(); ++ii)
        {
            if(!first) os << ", ";
            os << *ii;
            first = false;
        }
        return os << "]";
    }
	template<typename T1, typename T2>
    inline std::ostream &operator << (std::ostream & os,const std::map<T1, T2>& v)
    {
        bool first = true;
        os << "[";
        for (typename std::map<T1, T2>::const_iterator ii = v.begin(); ii != v.end(); ++ii)
        {
            if(!first)
                os << ", ";
            os << *ii ;
            first = false;
        }
        return os << "]";
    }
 #else
    #define debug(args...)                  // Just strip off all debug tokens
#endif

typedef long long int ll;

#define endl "\n";
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define tr(cont,it) for(decltype((cont).begin()) it = (cont).begin(); it != (cont).end(); it++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())

const ll mod = 1000000007;
const ll inf = (ll)1e15;
ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = (x*x)%m; if(b % 2) x = (x*a)%m; return x;}

const int N=1e5+5;
int a[N],n;
void solve()
{
	cin >> n;
	int ans=0;
	for(int i=1;i<=n;i++)
		{
			cin >> a[i];
			ans+=(a[i]%2);
		}
	if(!ans)
		{cout << "second" << endl;}
	else
		cout << "first" << endl;
}

int main()
{
	IOS;
	int t = 1, num = 1;   ///// change this t for number of testcase globally
#ifdef LOCAL
   cin >> t;    ///// change this t for number of testcase locally
#endif
    while (t--) 
    {
        solve();
        debug("\n");
    }
	return 0;
}


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

#define REP(i, n) for(int i = 0; i < (int) (n); i++)
#define ALL(v) (v).begin(), (v).end()
#define INF 1e9

using namespace std;

vector<int> prime;

void make_prime(){
  bool is_prime[101000];
  REP(i, 101000) is_prime[i] = true;
  REP(i, 101000){
    if(i == 0 or i == 1) is_prime[i] = false;
    if(!is_prime[i]) continue;
    REP(j, 101000){
      if(j == 0 or j == 1) continue;
      if(i * j > 101000) break;
      is_prime[i * j] = false;
    }
  }
  REP(i, 101000) if(is_prime[i]) prime.push_back(i);
}

int main(){
  int n, p;
  make_prime();
  while(cin >> n >> p and n + p != -2){
    int from = 0;
    vector<int> sums;
    REP(i, prime.size()) if(prime[i] > n) { from = i; break; }
    REP(i, 100) REP(j, i+1){
      if(from + i >= prime.size()) continue;
      sums.push_back(prime[from+i] + prime[from+j]);
    }
    sort(ALL(sums));
    cout << sums[p-1] << endl;
  }
}

Measured memory_bytes: 3208
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        
        int K = sc.nextInt();
        
        int ans;
        
        if(K<=A){
            ans = K;
        } else if(K<=A+B){
            ans = A;
        } else {
            ans = A - (K-(A+B));
        }
        
        
        System.out.println(ans);
    }
}


Measured memory_bytes: 35856
#include<iostream>
using namespace std;
long mod=1e9+7,dp[51][51][2505];
int N,K;
main()
{
	cin>>N>>K;
	dp[0][0][0]=1;
	for(int i=0;i<N;i++)for(int j=0;j<=i;j++)
	{
		for(int k=0;k<=K-2*j+2;k++)
		{
			(dp[i+1][j][k+2*j]+=dp[i][j][k]*(2*j+1)%mod)%=mod;
			if(j>0)(dp[i+1][j-1][k+2*j-2]+=dp[i][j][k]*j*j%mod)%=mod;
			(dp[i+1][j+1][k+2*j+2]+=dp[i][j][k])%=mod;
		}
	}
	cout<<dp[N][0][K]<<endl;
}

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

int main(){
  int m,k;
  cin >> m >> k;
  int n=pow(2,m);
  if(k==0){
    for(int i=0;i<n;i++){
      cout << i << " " << i << " ";
    }
    cout << endl;
  }
  else{
    if(m>=2&&k<pow(2,m)){
      cout << 0 << " ";
      for(int i=1;i<k;i++){
        cout << i << " ";
      }
      for(int i=k+1;i<n;i++){
        cout << i << " ";
      }
      cout << 0 << " " << k << " ";
      for(int i=n-1;i>=k+1;i--){
        cout << i << " ";
      }
      for(int i=k-1;i>=1;i--){
        cout << i << " ";
      }
      cout << k << endl;
    }
    else{
      cout << -1 << endl;
    }
  }
}

Measured memory_bytes: 1792
#include<stdio.h>
 
int main()
{
    int s;
    scanf("%d",&s);
    if(s/100<=12&&s%100<=12&&s/100!=00&&s%100!=00)
    printf("AMBIGUOUS");
   else if(s/100<=12&&s/100!=00&&s%100!=00)
        printf("MMYY");
        else if(s/100<=12&&s/100!=00&&s%100==00)
        printf("MMYY");
    else if(s%100<=12&&s%100!=00&&s/100!=00)
        printf("YYMM");
         else if(s%100<=12&&s%100!=00&&s/100==00)
        printf("YYMM");
    else printf("NA");
    return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		int x=0;
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String[] spa = new String[a.length()];
		for(int i=a.length()-1;i>=0;i--){
			spa[i]=a.substring(0,i);
		}
		for(int j=a.length()-1;j>=0;j--){
			if(spa[j].equals(spa[j/2]+spa[j/2])){
				x = j;
				break;
			}
		}
		System.out.println(x);
	}
}

Measured memory_bytes: 21972
#include <stdio.h>
int main(void){
	int n,i;
	scanf("%d",&n);
	float a[n+1],sum=0;
	for(i=0;i<n;i++){
		scanf("%f",&a[i]);
		sum+=(1/a[i]);
	}
	printf("%f",1/sum);
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    int a,b,c,d;
    d=N%10;
    c=(N-d)%100/10;
    b=(N-d-c*10)%1000/100;
    a=(N-d-c*10-b*100)%10000/1000;

    if(((a==b)&&(b==c))||((b==c)&&(c==d))){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3592
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>

using namespace std;

typedef long long ll;

vector<ll> yakusu;

void calc_yakusu(ll A) {
	
	if (A == 1) {
		yakusu.push_back(1);
		return;
	}
	ll waru = 1;
	while (waru * waru <= A) {
		if (A % waru == 0) {
			yakusu.push_back(waru);
			if(waru * waru != A)
				yakusu.push_back(A / waru);
		}
		waru++;
	}

}

int main() {
	ll n, s;
	cin >> n >> s;
	if (s == n) {
		cout << n + 1 << endl;
		return 0;
	}
	if (s > n) {
		cout << -1 << endl;
		return 0;
	}
	for (ll shinsu = 2; shinsu * shinsu <= n; shinsu++) {
		ll cpyn = n;
		ll tmp = 0;
		while (cpyn > 0)tmp += (cpyn % shinsu), cpyn /= shinsu;
		if (tmp == s) {
			cout << shinsu << endl;
			return 0;
		}
	}
	
	//n == p * shinsu + q, p + q == s
	//->q == s - p
	//n == p * shinsu + s - p
	//n - s == p * (shinsu - 1) (shinsu > sqrt(n), p, q < shinsu, p > 0, q >= 0)
	calc_yakusu(n - s);
	sort(yakusu.begin(), yakusu.end());
	
	for (int i = 0; i < yakusu.size(); i++) {
		ll cur = yakusu[i];
		ll counter = (n - s) / yakusu[i];
		if (cur + 1 > (ll)sqrt(n) && cur + 1 > counter && cur + 1 > s - counter && s - counter >= 0) {
			cout << cur + 1 << endl;
			return 0;
		}
	}
	cout << -1 << endl;
	return 0;
}


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

int main(){
  long int N, M;
  cin >> N >> M;
  if (N > M) {
    long int temp = N;
    N = M;
    M = temp;
  }
  if (N == 1 && M == 1) cout << 1;
  else if (N == 1 && M > 1) {
    cout << M - 2;
  }
  else cout << (N-2)*(M-2) << endl;
}


Measured memory_bytes: 256
#include <cstdio>

char s[200005];
long long cnt[10005];

int main()
{
    //freopen("a.in", "r", stdin);
    int n, p;
    long long ans = 0;
    scanf("%d%d", &n, &p);
    scanf("%s", s);
    if(p == 2 || p == 5)
    {
        for(int i = 0; i < n; i++)
        if((s[i] - '0') % p == 0)
            ans += (long long) (i + 1);
    }
    else
    {
        cnt[0] = 1;
        int base = 1, r = 0;
        for(int i = n - 1; i >= 0; i--)
        {
            if(i < n - 1) base *= 10, base %= p;
            r += (s[i] - '0') * base % p;
            r %= p;
            ans += cnt[r];
            cnt[r]++;
        }
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// #define debug(a) cout << "["; rep(i,a.size()) cout << a[i] << ", "; cout<<"]"<< endl;

const ll mod = 1000000007;

int main() {
    int n; cin >> n;
    map<string, int> mp;
    int maxcnt = 0;
    rep(i,n){
        string s; cin >> s;
        mp[s]++;
        maxcnt = max(maxcnt, mp[s]);
    }
    for(pair<string, int> p: mp){
        if(p.second == maxcnt){
            cout << p.first << endl;
        }
    }
    return 0;
}

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

int main(void)
{
    const double PI=3.141592653589793238;


    int K, i = 0;
    cin >> K;
    double x = 0.0, y = 0.0;

    do
    {
        /* code */
        
        
        
        i++;

        if(i*K%360==0){
            cout << i << endl;
            return 0;
        }

    } while (1);



    cout << i << endl;
    return 0;
}

Measured memory_bytes: 3620
import itertools
n,m,r=map(int,input().split())
point=list(map(int,input().split()))
g=[[10**9]*n for i in range(n)]
for _ in range(m):
  u,v,c=map(int,input().split())
  g[u-1][v-1]=g[v-1][u-1]=c
for k in range(n):
  for i in range(n):
    for j in range(n):
      g[i][j]=min(g[i][j],g[i][k]+g[k][j])
for i in range(n):
  g[i][i]=0
ans=10**18
for v in itertools.permutations(point):
  tmp=0
  for i in range(r-1):
    tmp+=g[v[i]-1][v[i+1]-1]
  ans=min(ans,tmp)
print(ans)

Measured memory_bytes: 46840
from sys import stdin


def fetch_one_line():
    return stdin.readline().rstrip()


def fetch_int_input():
    return [int(s) for s in fetch_one_line().split()]


def fetch_inputs(times):
    return [fetch_one_line() for _ in range(times)]


def fetch_int_inputs(times):
    return [[int(s) for s in fetch_one_line()] for _ in range(times)]


def fetch_ints_inputs(times):
    return [fetch_int_input() for _ in range(times)]

fetch_one_line()
nums = fetch_int_input()
min_dist = 9999999999999999999
min_t = -1
for i in range(len(nums)):
    dist = abs(sum(nums[:i]) - sum(nums[i:]))
    if min_dist > dist:
        min_dist = dist
        min_t = i

print(min_dist)


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

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            List<double> resultList = new List<double>();

            while (true)
            {
                double x = double.Parse(Console.ReadLine());
                double h = double.Parse(Console.ReadLine());
                if (x == 0 && h == 0)
                {
                    break;
                }

                double a = Math.Sqrt(h * h + x * x / 4);
                double s = x * x + 2 * x * a;

                resultList.Add(s);
            }

            foreach (double d in resultList)
            {
                Console.WriteLine(d);
            }

        }
    }
}

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

int H, W;

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

  cin >> H >> W;
  string S[H];
  for (int i = 0; i < H; i++) {
    cin >> S[i];
  }
  for (int h = 0; h < H; h++) {
    for (int w = 0; w < W; w++) {
      if (S[h][w] == '.') {
        int i = 0;

        for (int y = -1; y <= 1; y++) {
            if ((y + h < 0) || (y + h > H - 1)) {
              continue;
            }
            for (int x = -1; x <= 1; x++) {
              if ((x + w < 0) || (x + w > W - 1)) {
                continue;
              }
              if (S[h + y][w + x] == '#') {
                i++;
              }
            }
          }

        cout << i;
      } else {
        cout << '#';
      }
    }
    cout << endl;
  }
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main{

	public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int num[]=new int[3];
int tai;


for(int i=0;i<3;i++){
	num[i]=sc.nextInt();
}

for(int i=0;i<3;i++){
	for(int j=0;j<3;j++){
		if(num[i]>num[j]){
			tai=num[i];
			num[i]=num[j];
			num[j]=tai;
			
		}
	}
}

System.out.println(num[2]+" "+num[1]+" "+num[0]);


}
}
    

Measured memory_bytes: 26200
N = int(input())
a = list(map(int, input().split()))
min_ = 10 ** 9
for i in range(-100, 101):
    scr = 0
    for j in range(N):
        scr += (i - a[j])**2
    #min_ = min(min_, scr)
    if min_ > scr:
        min_ = scr
print(min_)

Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

ll a,b,c,d;
int main(){
	scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
	c-=a;
	d-=b;
	rep(i,0,c)putchar('R');
	rep(i,0,d)putchar('U');
	rep(i,0,c)putchar('L');
	rep(i,0,d)putchar('D');
	putchar('D');
	rep(i,0,c+1)putchar('R');
	rep(i,0,d+1)putchar('U');
	putchar('L');
	putchar('U');
	rep(i,0,c+1)putchar('L');
	rep(i,0,d+1)putchar('D');
	putchar('R');
	putchar(10);
}

Measured memory_bytes: 128
N, K = map(int,input().split())
t = ((N-1)*(N-2))//2

if t < K:
    print(-1)
    exit(0)

A = []
for k in range(2,N+1):
    A.append([1,k])

f = 0
for k in range(2,N):
    for l in range(k+1,N+1):
        if f == t-K:
            print(N-1+f)
            for e in A:
                print(*e)
            exit(0)
        else:
            A.append([k,l])
            f += 1
print(N-1+f)
for e in A:
    print(*e)


Measured memory_bytes: 4120
import bisect
A,B,Q=map(int,input().split())
INF=10**18
S=[-INF]+[int(input()) for i in range(A)]+[INF]
T=[-INF]+[int(input()) for i in range(B)]+[INF]
for q in range(Q):
    x=int(input())
    i=bisect.bisect_right(S,x)
    j=bisect.bisect_right(T,x)
    d=INF
    for s in [S[i-1],S[i]]:
        for t in [T[j-1],T[j]]:
            d1=abs(s-x)+abs(s-t)
            d2=abs(t-x)+abs(s-t)
            d=min(d,d1,d2)
    print(d)

Measured memory_bytes: 13836
fun main(args: Array<String>) {
    var S = readLine()!!.toCharArray()
    var map = mutableMapOf<Char, Int>()
    S.forEach {
        val n = map.get(it) ?: 0
        map.put(it, n + 1)
    }
    println(if (map.count { it.component2() == 2 } == 2) "Yes" else "No")
}


Measured memory_bytes: 31868
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout.setf(ios::fixed);
    cout.precision(10);
    int h, w;
    cin >> h >> w;
    vvi b(h, vi(w));
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> b[i][j];
        }
    }

    vvi dp(h, vi(w, -1));
    for (int i = 0; i < h; i++) {
        dp[i][0] = b[i][0] == 0;
    }
    for (int i = 0; i < w; i++) {
        dp[0][i] = b[0][i] == 0;
    }

    for (int i = 1; i < h; i++) {
        for (int j = 1; j < w; j++) {
            if (b[i][j] == 0) {
                dp[i][j] = min({dp[i - 1][j - 1], dp[i - 1][j], dp[i][j - 1]}) + 1;
            } else {
                dp[i][j] = 0;
            }
        }
    }

    i64 ans = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            ans = max(ans, dp[i][j]);
        }
    }
    cout << ans * ans << endl;
}


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

int main() {
  long long X, K, D;
  cin >> X >> K >> D;

  if (K < abs(X) / D) {
    cout << abs(X) - D * K;
    return 0;
  } else if ((K - abs(X) / D) % 2 == 0) {
    cout << abs(abs(X) % D) << endl;
  } else {
    cout << abs(abs(X) % D - D) << endl;
  }
}

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

#define dump(x) cout << (x) << endl
#define Int int64_t
#define fi first
#define se second

Int INF = 1e18;
Int mod = 1e9+7;

int main() {
    double a, b, x;
    cin >> a >> b >> x;
    if (2.0 * x >= b * a * a) {
        double res = 90.0 - atan2(a / 2.0, b - (x / (a * a))) * 180.0 / M_PI;
        printf("%.12lf\n", res);
    }
    else {
        double ok = atan2(a, b);
        double ng = 90.0;
        double mid;
        for (Int i = 0; i < 1000; i++) {
            mid = (ng + ok) / 2.0;
            if (x * 2.0 * tan(mid * M_PI / 180.0) <= a * b * b) {
                ok = mid;
            }
            else {
                ng = mid;
            }
        }
        printf("%.12lf\n", ok);
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll                      long long
#define pb                      push_back
#define rep(i,a,b,c)            for(ll i=(a);i<=(b);i+=(c))
#define repb(i,a,b,c)           for(ll i=(a);i>=(b);i-=(c))
#define MOD                     1000000007
#define inf                     3e18
#define ld                      long double
#define mp                      make_pair
#define vpll                    vector<pair<ll,ll> >
#define vll                     vector<ll>
#define vld                     vector<ld>
#define vvll                    vector<vector<ll>>
#define vvld                    vector<vector<ld>>
#define pll                     pair<ll,ll>
#define vvpll                   vector<vector<pair<ll,ll>>>
#define pqll                    priority_queue<ll>
#define mll                     map<ll,ll>
#define mlc                     map<ll,char>
#define um                      unordered_map
#define umll                    um<ll,ll>
#define umlc                    um<ll,char>
#define all(x)                  x.begin(),x.end()
#define fi                      first
#define se                      second
#define ln                      cout<<"\n";
#define endl                    "\n"
#define test                    ll T;cin>>T;while(T--)
#define isvowel(a)              (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define fastIO                  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define show(w,size)            for(ll i=0;i<size;i++) cout<<w[i]<<" ";
#define prll(a)                 cout<<a<<"\n";
#define mset(dp,no)             memset(dp,no,sizeof(dp))
#define input(a,n)              rep(i,0,n-1,1) cin>>a[i];
#define countbit                __builtin_popcount                                           //Number of setbits in decimal notation
#define lb(v,cur)               lower_bound(all(v),cur)-v.begin()
#define ub(v,cur)               upper_bound(all(v),cur)-v.begin()
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
long long pows(long long a, long long b) {
  long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
ll powm(ll x,ll y,ll m=MOD){x=x%m;ll res=1;while(y){if(y&1)res=res*x;res%=m;y=y>>1;x=x*x;x%=m;}return res;}
ll modInverse(ll a, ll m=MOD){if(m == 1)return 0;ll m0=m,y=0,x=1;while(a>1){ll q=a/m,t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0) x+=m0;return x;}
int main()
{
fastIO
ll n,m,i,j,k,x,y,z,t,e,f,p,q,g,l,r,w,h,count1=0,prod=1,a,b,c,d,index,diff,ans=0,sum=0,sum1=0,sum2=0,flag=0,flag1=0,flag2=0;
string s,s1,s2;
char ch;
cin>>ch;
if(isupper(ch))
{
  cout<<"A";
}
else
{
  cout<<"a";
}
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
//const int INF = 1e8;
using namespace std;

int main(){
	double a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;

	set<double> w, s;
	rep(i,31){
		rep(j,31){
			double tmp = 100.0 * a * i + 100.0 * b * j;
			if(tmp <= f) w.emplace(tmp);
		}
	}

	rep(i,3001){
		rep(j,3001){
			double tmp = c * i + d * j;
			if(tmp <= f) s.emplace(tmp);
		}
	}

	double answ = a * 100, anss = 0, k = -1;
	for(auto i : w){
		if(i == 0) continue;
		for(auto j : s){
			if(i + j > f || i * e < 100.0 * j) continue;
			if(k < j / (i + j)){
				k = j / (i + j);
				answ = i;
				anss = j;
			}
		}
	}
	cout << answ + anss << ' ' << anss << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
mt19937 rnd;
#define F first
#define S second
#define pb push_back
#define pii pair<int,int>
#define go_precise cout << fixed << setprecision(18);
const ll mod = 1e9 + 7;

const int maxn = 100 + 5, maxk = 1e5 + 5;

ll dp[maxn][maxk];
ll pref[maxn][maxk];
ll a[maxn];
ll pref2[maxn];


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);  cout.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif

    int n;
    cin >> n;
    ll k;
    cin >> k;
    for (int i=1; i<=n; i++) cin >> a[i];
    for (int i=1; i<=n; i++) pref2[i] = pref2[i-1] + a[i];

    for (int i=0; i<=a[1]; i++) dp[1][i] = 1;
    pref[1][0] = 1;
    for (int i=1; i<=k; i++) pref[1][i] = pref[1][i-1] + dp[1][i];

    for (int i=2; i<=n; i++) {
        dp[i][0] = 1;
        for (int j=1; j<=a[i]; j++) {
            dp[i][j] = pref[i-1][j] % mod;
        }
        for (int j=a[i]+1; j<=min(k, pref2[i]); j++) {
            dp[i][j] = (pref[i-1][j] - pref[i-1][j-a[i]-1]) % mod;
        }
        pref[i][0] = dp[i][0] % mod;
        for (int j=1; j<=k; j++) pref[i][j] = (pref[i][j-1] + dp[i][j]) % mod;
    }
    cout << (dp[n][k] % mod + mod) % mod << '\n';

#ifdef LOCAL
    cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif // LOCAL
    return 0;
}


Measured memory_bytes: 159232
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1000000007;
const ll MOD = 1000000000000000001;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);


ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b){
  ll r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return b;
}


ll LCM(ll a,ll b){
  ll c=a,d=b,r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return c/b*d;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

vector<pair<char,ll>> runlength(string s,vector<pair<char,ll>> p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
    return p;
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
  return p;
}



/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll n,x,ans;
  cin>>n>>x;
  vector<ll> v(n);
  rep(i,n) cin>>v[i];
  ans=Svec(v);
  if(v[0]>x) v[0]=x;
  rep(i,n-1){
    if(v[i]+v[i+1]>x){
      v[i+1]=x-v[i];
    }
  }
  cout<<ans-Svec(v)<<endl;
}

Measured memory_bytes: 1804
//     **********            ***       ***         ************     ***    ***
//     **********          *     *   *     *       ************     ***   ***
//        ***             *        *        *          ***          ***  ***
//        ***            *                   *         ***          *** ***
//        ***            *                   *         ***          ******
//        ***            *                   *         ***          ******
//        ***             *                 *          ***          *** ***
//        ***              *               *           ***          ***  ***
//     **********           *             *            ***          ***   ***
//     **********             *          *             ***          ***    ***
//                              *       *
//                                *   *
//                                  *
//
#include <iostream>
using namespace std;
#include<bits/stdc++.h> 
#define ll long long int
#define read(a) long long int a; cin>>a;
#define readstr(s) string s; cin>>s;
#define readarr(a,l) long long int a[l]={0}; for(ll i=0;i<l;i++) cin>>a[i];
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define ff first
#define ss second
#define readmtrx(i,j,a,b) ll arr[a][b]={0};for(ll i=0;i<a;i++)for(ll j=0;j<b;j++) cin>>arr[i][j];
#define v(pi) vector<ll>pi
#define vp(pi) vector<pair<ll,ll>>pi
#define fast ios_base::sync_with_stdio(false);cin.tie(0);
#define pb(p) push_back(p)
#define mp make_pair
#include <cmath>
int main() {
	fast;read(a) 
	readstr(s);
	if(a<3200) cout<<"red"<<endl;
	else cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<complex>
#include<vector>
#include<math.h>
using namespace std;
const double EPS = 1e-8;
const double INF = 1e12;
typedef complex<double> P;
namespace std {
  bool operator < (const P& a, const P& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}
double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}

struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
};
int ccw(P a, P b, P c) {
  b -= a; c -= a;
  if (cross(b, c) > 0)   return +1;       // counter clockwise
  if (cross(b, c) < 0)   return -1;       // clockwise
  if (dot(b, c) < 0)     return +2;       // c--a--b on line
  if (norm(b) < norm(c)) return -2;       // a--b--c on line
  return 0;
}
bool intersectSS(const L &s, const L &t) {
  return ccw(s[0],s[1],t[0])*ccw(s[0],s[1],t[1]) <= 0 &&
         ccw(t[0],t[1],s[0])*ccw(t[0],t[1],s[1]) <= 0;
}
P projection(const L &l, const P &p) {
  double t = dot(p-l[0], l[0]-l[1]) / norm(l[0]-l[1]);
  return l[0] + t*(l[0]-l[1]);
}
bool intersectSP(const L &s, const P &p) {
  return abs(s[0]-p)+abs(s[1]-p)-abs(s[1]-s[0]) < EPS; // triangle inequality
}
double distanceSP(const L &s, const P &p) {
  const P r = projection(s, p);
  if (intersectSP(s, r)) return abs(r - p);
  return min(abs(s[0] - p), abs(s[1] - p));
}
double distanceSS(const L &s, const L &t) {
  if (intersectSS(s, t)) return 0;
  return min(min(distanceSP(s, t[0]), distanceSP(s, t[1])),
             min(distanceSP(t, s[0]), distanceSP(t, s[1])));
}
P start,end;
P wolf[50][4];
double h[50];
int main(){
	int a;
	while(scanf("%d",&a),a){
		int W,Z,X,Y;
		scanf("%d%d",&X,&Y);
		start=P(X,Y);
		scanf("%d%d",&X,&Y);
		end=P(X,Y);
		double left=0;
		double right=1000;
		for(int i=0;i<a;i++){
			scanf("%d%d%d%d%lf",&X,&Y,&W,&Z,h+i);
			if((real(start)-X)*(real(start)-W)<=0&&(imag(start)-Y)*(imag(start)-Z)<=0)right=0;
			wolf[i][0]=P(X,Y);
			wolf[i][1]=P(X,Z);
			wolf[i][2]=P(W,Z);
			wolf[i][3]=P(W,Y);
		}
		for(int i=0;i<100;i++){
			double M=(left+right)/2;
			bool ok=true;
			for(int j=0;j<a;j++){
				double V=M;
				if(h[j]<M)V=sqrt(M*M-(M-h[j])*(M-h[j]));
				for(int k=0;k<4;k++){
					if(distanceSS(L(start,end),L(wolf[j][k],wolf[j][(k+1)%4]))<V)ok=false;
				}
			}
			if(ok)left=M;
			else right=M;
		}
		printf("%f\n",left);
	}
}

Measured memory_bytes: 1108
import re
S = input()
flag_1 = False
flag_2 = False
flag_3 = False

if S[0] == 'A': flag_1 = True
if S[2:-1].count('C') == 1: flag_2 = True

if flag_1 == True and flag_2 == True:
   if len(re.findall('[A-Z]', S)) == 2:
       flag_3 = True

if flag_1 == True and flag_2 == True and flag_3 == True:
    print('AC')
else:
    print('WA')

Measured memory_bytes: 38292
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		while(true) {
			String str1=in.next();
			if(str1.equals("."))break;
			String[] ss1=str1.split("\"",-1);
			String str2=in.next();
			String[] ss2=str2.split("\"", -1);
			
			if(ss1.length==ss2.length) {
				int def=0;
				for(int i=0;i<ss1.length;i++) {
					if(i%2==0 && !ss1[i].equals(ss2[i]))def+=2;
					else if(i%2==1 && !ss1[i].equals(ss2[i]))def++;
				}
				if(def==0)System.out.println("IDENTICAL");
				else if(def==1)System.out.println("CLOSE");
				else System.out.println("DIFFERENT");
			}
			else System.out.println("DIFFERENT");
		}
	}

}



Measured memory_bytes: 29024
a,b = map(int,input().split(" "))
if a == 2 or b == 2:
  print("No")
elif a == 1 or a == 3 or a == 5 or a == 7 or a == 8 or a == 10 or a == 12:
  if b == 1 or b == 3 or b == 5 or b == 7 or b == 8 or b == 10 or b == 12:
    print("Yes")
  else:
    print("No")
elif a == 4 or a == 6 or a == 9 or a == 11:
  if b == 4 or b == 6 or b == 9 or b == 11:
    print("Yes")
  else:
    print("No")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll n;
  cin>>n;
  if(n%11==0)
    cout<<n/11*2;
  else if(n%11<7)
    cout<<n/11*2+1;
  else
    cout<<n/11*2+2;
}

Measured memory_bytes: 256
n = int(input())
s = [input() for _ in range(n)]
l = [0]*26
for i,w in enumerate('abcdefghijklmnopqrstuvwxyz'):
    k = [0]*n
    for j in range(n):
        k[j] += s[j].count(w)
    l[i] += min(k)
ans = ''
for i,w in enumerate('abcdefghijklmnopqrstuvwxyz'):
    ans += w*l[i]
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int n,sum=0;
  cin>>n;
  int l[n];
  for(int i=0; i<n; i++)
    cin>>l[i];
  sort(l,l+n);
  for(int j=0; j<n-1; j++)
    sum+=l[j];
  if(sum>l[n-1]) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

inline long long mod(long long a, long long m)
{
    return (a % m + m) % m;
}
inline long long mul(long long a, long long b, long long m)
{
    a = mod(a, m);
    b = mod(b, m);
    if (b == 0)
        return 0;
    long long res = mul(mod(a + a, m), b >> 1, m);
    if (b & 1)
        res = mod(res + a, m);
    return res;
}

int main(){
    const ll c = 1e9 + 7;
    ll A[2010];
    ll N, K;
    cin >> N >> K;
    for (int i = 0; i < N; ++i)
    {
        cin >> A[i];
    }

    ll n = 0;
    for (int i = 1; i < N;++i){
        for (int j = 0; j < i; ++j)
        {
            if(A[j]>A[i])
                ++n;
        }
    }
    ll n_ = 0;
    for (int i = 0; i < N; ++i)
    {
        for (int j = 0; j < N; ++j)
        {
            if (A[j] > A[i])
                ++n_;
        }
    }
    ll x = K * (K - 1) / 2;
    ll a = (mul(x, n_, c) + mul(n, K, c)) % c;
    // ll a = (x * n_ + n * K) % c;
    cout << a << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

int main() {
  int n;
  cin >> n;
  vector<int> d(n);
  for (int i = 0; i < n; i++) {
    cin >> d[i];
  }
  sort(all(d));
  ll ans = d[n / 2] - d[n / 2 - 1];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug" << x << endl;
using namespace std;

int main(){
    int n,m;
    while(cin >> n >> m){
        int A[100][100], ans[1000] = {0};
        rep(i,n){
            rep(j,m){
                cin >> A[i][j];
            }
        }
        rep(i,m){
            int inp;
            cin >> inp;
            rep(j,n){
                ans[j] += A[j][i] * inp;
            }
        }
        rep(i,n) cout << ans[i] << endl;
    }
}

Measured memory_bytes: 1204
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define mm(arr) memset(arr, 0, sizeof(arr))
#define scanArray(a,n) for(int i = 0; i < n; i++){cin >> a[i];}
#define pb push_back
#define PI 3.141592653589793
#define MOD 1000000007

using namespace std;
int main(){
    FAST
    int n; cin >> n;
    int a[n];
    scanArray(a,n);
    sort(a,a+n);
    ll sum=0;
    sum+=a[n-1]/2;
    for(int i=0;i<n-1;i++){
        sum+=a[i];
    }
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 3488
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;

int main()
{
    int num;

    cin >> num;

    int x[num], y[num];
    double d1 = 0, d2 = 0, d3 = 0, df = 0;

    for( int i = 0; i < num; i++ )
        cin >> x[i];
    for( int i = 0; i < num; i++ )
        cin >> y[i];

    for( int i = 0; i < num; i++ )
        d1 += fabs( x[i] - y[i] );

    for( int i = 0; i < num; i++ )
        d2 += pow( fabs( ( x[i] - y[i] ) ), 2 );
    d2 = sqrt(d2);
    
    for( int i = 0; i < num; i++ )
        d3 += pow( fabs( x[i] - y[i] ), 3 );
    d3  = pow( d3, 1.0 / 3.0 );

    for( int i = 0; i < num; i++ )
    {
        if( df < fabs( x[i] - y[i] ) )
            df = fabs( x[i] - y[i] );
    }

    cout << fixed;
    cout << setprecision(10) << d1 << endl;
    cout << d2 << endl;
    cout << d3 << endl;
    cout << df << endl;

    return 0;
}


Measured memory_bytes: 3440
// =====================================================
//   File    :   main.cpp
//   Author  :   eezyl
//   Synopsis:   codeforces/atcoder template v2
//   Address :
//   Date    :   2020/09/12
// =====================================================
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef double db;

typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef pair<db,db> pd;

typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<ll> vll;
typedef vector<db> vdb;
typedef vector<string> vs;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<pd> vpd;
typedef vector<vi> vvi;

#define mp make_pair
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sor(x) sort(all(x))
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

const ll INF = 1e18;
const ld PI = acos((ld)-1);
const int d4i[4]={-1, 0, 1, 0}, d4j[4]={0, 1, 0, -1};
const int d8i[8]={-1, -1, 0, 1, 1, 1, 0, -1}, d8j[8]={0, 1, 1, 1, 0, -1, -1, -1};

// TO_STRING
#define ts to_string
string ts(char c) { return string(1,c); }
string ts(const char* s) { return (string)s; }
string ts(string s) { return s; }
string ts(bool b) { return b ? "true" : "false"; }
string ts(vector<bool> v) { string res; F0R(i,sz(v)) res += char('0'+v[i]); return res; }
template<size_t SZ> string ts(bitset<SZ> b) { string res; F0R(i,SZ) res += char('0'+b[i]); return res; }

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
constexpr int pct(int x) { return __builtin_popcount(x); }
constexpr int bits(int x) { return 31-__builtin_clz(x); } // floor(log2(x))

const ll MOD = 1e9+7; // 998244353;
const int MX = 1e5+5;

// BIT
int tree[1];
int sum(int k, int a = 0) {
    while (k >= 1) { a += tree[k]; k -= k&-k; }
    return a; }
void add(int k, int x) {
    while (k <= MX) { tree[k] += x; k += k&-k; }
}

int find(vi& ds, int i) {
    return ds[i] < 0 ? i : ds[i] = find(ds, ds[i]);
}


void solve()
{
    ll a, b, c, d;
    cin >> a >> b;
    cin >> c >> d;
    ll ans = a*c;
    ckmax(ans, a*d);
    ckmax(ans, b*c);
    ckmax(ans, b*d);
    cout << ans << endl;

}


int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//#define LOCAL
#ifdef LOCAL
freopen("data.in", "r", stdin);
while (!feof(stdin)) {
#endif // LOCAL

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

#ifdef LOCAL
}
printf("Time used = %.2lf\n", (double)clock() / CLOCKS_PER_SEC);
#endif // LOCAL
    return 0;
}


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

int main(){
  int p, q, r;
  cin >> p >> q >> r;
  
  int a,b,c;
  a=p+q;
  b=q+r;
  c=r+p;
  
  cout << min({a,b,c}) << endl;
}

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

int main() {
	int N;
	cin >> N;
	
	vector<int> pi;
	rep(i,N){
		int tmp_pi;
		cin >> tmp_pi;
		pi.push_back(tmp_pi);
	}

	bool ans = false;
	int miscnt = 0;

	rep(i,N){
		if(pi.at(i) != (i + 1)) miscnt++;
	}
	
	if(miscnt > 2){
		ans = false;
	}else{
		ans = true;
	}



	if(ans){
  	cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        String ans = "No";
        for(int c=1; c<=3; c++){
            if((a*b*c)%2 == 1){
                ans = "Yes";
                break;
            }
        }
        System.out.println(ans);
    }
}

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define MOD         (1000000007LL)

using LL  = long long;
// }}}

// 最大公約数
LL gcd(LL x, LL y) {
    return y ? gcd(y, x%y) : x;
}

int dp[41][401][401];

int main() {
    std::ios::sync_with_stdio(false);
    int n, ma, mb;cin >> n >> ma >> mb;
    vector<int> a(n), b(n), c(n);
    for(int i=0;i<n;i++){
        cin >> a[i] >> b[i] >> c[i];
    }
    for(int i=0;i<n+1;i++){
        for(int j=0;j<401;j++){
            for(int k=0;k<401;k++){
                dp[i][j][k] = INF;
            }
        }
        dp[i][0][0] = 0;
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<401;j++){
            for(int k=0;k<401;k++){
                if(dp[i][j][k] != INF){
                    dp[i+1][j+a[i]][k+b[i]] = min(dp[i+1][j+a[i]][k+b[i]], dp[i][j][k]+c[i]);
                    dp[i+1][j][k] = min(dp[i+1][j][k], dp[i][j][k]);
                }
            }
        }
    }
    int ans = INF;
    for(int i=1;i<401;i++){
        for(int j=1;j<401;j++){
            int g = gcd(i, j);
            if(i/g == ma && j/g == mb){
                //cout << dp[n][i][j] << endl;
                ans = min(ans, dp[n][i][j]);
            }
        }
    }
    cout << (ans==INF?-1:ans) << endl;
    return 0;
}


Measured memory_bytes: 25984
import math

def isPrime(n):
    for i in range(math.floor(n ** (1/2))):
        i += 1
        if i == 1:
            pass
        elif n % i == 0:
            return False
            break
    else:
        return True
      
n = int(input())

while True:
    
    if isPrime(n):
        print(n)
        break
    
    n += 1

Measured memory_bytes: 3188
N = int(input())
a = N//4 +1
b = N//7 +1
     
judge = False
for i in range(a):
  for j in range(b):
    if 4*i+7*j == N:
      judge =True
      break
    if 4*i+7*j > N:
      break
  if judge:
    break
     
if judge:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3060
#!/usr/bin/env python

n, y = map(int, input().split())

for i in range(n+1):
    for j in range(n-i+1):
        if 10000*i+5000*j+1000*(n-i-j) == y:
            print('{} {} {}'.format(i, j, n-i-j))
            exit(0)
print('-1 -1 -1')


Measured memory_bytes: 9084
#include<bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

int main()
{
  lint n;
  cin >> n;
  vector<lint> a(n);
  REP(i,n) cin >> a[i];

  lint max=0, maxe=-1;
  REP(i,n) if(a[i]>max){
    max = a[i];
    maxe = i;
  }

  sort(a.begin(),a.end());
  REP(i,n){
    if(i != maxe) cout << a[n-1] << endl;
    else cout << a[n-2] << endl;
  }
  return 0;
}


Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
 
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define f0(i,a,b) for(int i=a;i<b;i++)
#define f1(i,a,b) for(int i=a;i<=b;i++)
#define f2(i,a,b) for(int i=a;i>b;i--)
#define f3(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define int long long
#define fi first
#define se second
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test int t;cin>>t;while(t--)
int vis[500000];
int ma(int a,int b)
{
    if(a>b)return a;
    return b;
}
int mi(int a,int b)
{
    if(a<b)return a;
    return b;
}vector<int>adj[500000];
void dfs(int a)
{if(vis[a]==1)return;
    vis[a]=1;
    f0(i,0,adj[a].size())
    {
        dfs(adj[a][i]);
    }
    
}
signed main(){
    fast
   

int n,m;
cin>>n>>m;
f0(i,0,m)
{int a,b;
cin>>a>>b;
adj[a].pb(b);
adj[b].pb(a);
}int c=0;
f0(i,1,n+1)
{
  if(vis[i]==0)
  {
      c++;
      dfs(i);
  }
}cout<<c-1;
}

Measured memory_bytes: 20476
#include <iostream>
#include <fstream>
#include <utility>
#include <queue>
#include <vector>
#include <array>
#include <stack>
#include <list>
#include <map>
#include <unordered_set>
#include <set>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstdint>
#include <cstring>
#include <cmath>

using namespace std;

typedef long long ll;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define bs(n) (1ul<<(n))
int n, m, a[1000], b, c[1000];

template<class node_t,class cost_t>
class djikstra {
private:
	map<node_t, multiset<pair<node_t, cost_t>>> g;
	priority_queue<pair<cost_t, node_t>,deque<pair<cost_t, node_t>>,greater<>> q;
	map<node_t, cost_t> d;
	set<node_t> v;
	node_t s = -1;
	void compute(node_t start) {
		s = start;
		v.clear();
		d.clear();
		d[s] = 0;
		q.push(make_pair(0,s));
		while (!q.empty()) {
			node_t c = q.top().second;
			q.pop();
			if (v.find(c) != v.end()) continue;
			v.insert(c);
			for (auto& e : g[c]) {
				if (d.find(e.first) == d.end()) d[e.first] = d[c] + e.second;
				else d[e.first] = min(d[e.first], d[c] + e.second);
				q.push(make_pair(d[e.first], e.first));
			}
		}
	}
public:
	cost_t get_dist(node_t start, node_t end) {
		if (start != s) compute(start);
		if (d.find(end) != d.end()) return d[end];
		else return cost_t(-1);
	}
	void add_path(node_t src, node_t dst,cost_t cost) {
		g[src].insert(make_pair(dst, cost));
	}
};

int main() {
	int v, e, r, s, t, d;
	cin >> v >> e >> r;
	djikstra<int, int> w;
	rep(i, e) {
		cin >> s >> t >> d;
		w.add_path(s, t, d);
	}
	rep(i, v) {
		if (w.get_dist(r, i) == -1) cout << "INF";
		else cout << w.get_dist(r,i);
		cout << "\n";
	}
}

/*
int main() {
	cin >> n >> m;
	rep(i, m) {
		cin >> a[i] >> b;
		rep(j, b) {
			int k;
			cin >> k;
			c[i] |= bs(k-1);
		}
	}
}
*/


Measured memory_bytes: 44192
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
using namespace std;
int MOD = 1000000007;
    
signed main(){
    int n;
    cin >> n;
    vector<pair<pair<string,int>,int>> p(n);
    rep(i,n){
        string s;
        int po;
        cin >> s >> po;
        p[i] = MP(MP(s,-po),i+1);
    }
    SORT(p);
    rep(i,n)cout << p[i].se << endl;

    
    return 0;
}

// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://cf17-final-open.contest.atcoder.jp/tasks/cf17_final_a
// rm -r -f test;oj dl http://abc128.contest.atcoder.jp/tasks/abc128_a

Measured memory_bytes: 256
#include<iostream>

using namespace std;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int N;
    cin >> N;
    int d[N];
    rep(i,N) cin >> d[i];
    int ans=0;
    rep(i,N-1){
        for(int j=i+1;j<N;j++){
            ans+=d[i]*d[j];
        }
    }
    cout << ans << endl;



}


Measured memory_bytes: 256
s = input()
if s == "SUN":
    print(7)
elif s == "MON":
    print(6)
elif s == "TUE":
    print(5)
elif s == "WED":
    print(4)
elif s == "THU":
    print(3)
elif s == "FRI":
    print(2)
elif s == "SAT":
    print(1)

Measured memory_bytes: 9112
import heapq


N = int(input())
V = [int(x) for x in input().split()]

heapq.heapify(V)

for i in range(N-1):
    a= heapq.heappop(V)
    b= heapq.heappop(V)
    c=(a+b)/2
    heapq.heappush(V,c)

ans = heapq.heappop(V)
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back 
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define ld long double
#define int long long int 
#define F first 
#define S second
signed main()
{
    fast;
    int n;
    cin>>n;
    string s;
    cin>>s;
    int ans =1;
    char pre = s[0];
    for(int i=1;i<n;i++)
    {
        if(s[i]!=pre)
        {
            pre = s[i];
            ans++;
        }
    }
    cout<<ans;
}   

Measured memory_bytes: 512