akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var inputs = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        var a = inputs[0];
        var b = inputs[1];
        var c = inputs[2];
        var k = inputs[3];

        

        if (a >= k)
        {
            Console.WriteLine(k);
            return;
        }
        else
        {
            k -= a;
        }

        if(b >= k)
        {
            Console.WriteLine(a);
            return;
        }
        else
        {
            k -= b;
        }

        Console.WriteLine(a - k);
    }
}

Measured memory_bytes: 28188
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n;
    cin >> n;
    cout << n * (n + 1) / 2 << endl;
}

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

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>

int main(){
    int n, k;
    std::cin>>n>>k;
    std::vector<int> l(n);
    for(int i = 0;i < n;i++){
        std::cin>>l[i];
    }

    std::sort(l.begin(), l.end(), std::greater<int>());
    int sum = 0;
    for(int i = 0;i < k;i++){
        sum += l[i];
    }
    std::cout<<sum<<std::endl;
    return 0;
}

Measured memory_bytes: 256
Var n,ans:Qword;
    i:Longint;
Function prime(n:Qword):Boolean;
    Var i:Longint;
        OK:Boolean;
    Begin
        OK:=n>=2;
        For i:=2 to trunc(sqrt(n)) do
            If n mod i = 0 then begin
                OK:=False; Break;
            End;
        Exit(OK);
    End;
Begin
    Readln(n);
    If prime(n) then writeln(n-1)
    Else begin
        For i:=trunc(sqrt(n)) downto 2 do
            If n mod i = 0 then begin
                ans:=(i-1)+(n div i -1); Break;
            End;
        Writeln(ans);
    End;
End.

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll p=1e9+7;
ll n,A,B,C,D,i,j,k,ans,f[2010][2010],jc[2010],ny[2010];
ll ksm(ll x,ll y){
	ll xlh=1;
	while(y){
		if(y&1)xlh=xlh*x%p;
		x=x*x%p;
		y/=2;
	}
	return xlh;
}
int main(){
	scanf("%lld%lld%lld%lld%lld",&n,&A,&B,&C,&D);
	jc[0]=ny[0]=1;
	for(i=1;i<=n;i++)jc[i]=jc[i-1]*i%p,ny[i]=ksm(jc[i],p-2)%p;
	f[0][A-1]=1;
	 for(j=A;j<=B;j++)
	  for(i=0;i<=n;i++){
	 	f[i][j]=f[i][j-1];
	 	for(k=C;k<=D&&i>=j*k;k++){
	 		f[i][j]=(f[i][j]+f[i-j*k][j-1]*jc[n-i+j*k]%p*ny[j*k]%p*ny[n-i]%p*jc[j*k]%p*ny[k]%p*ksm(ny[j],k)%p)%p;
	 	}
	 	//printf("%lld %lld %lld\n",j,i,f[i][j]);
	 }
	//for(i=A;i<=B;i++)ans=(ans+f[n][i])%p;
	printf("%lld",f[n][B]);
}

Measured memory_bytes: 16128
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define watch(x) cout << #x << " is " << x << endl;
#define print(a, l, r)          \
	for (int i = l; i < r; i++) \
		cout << a[i] << (i == (r - 1) ? endl : " ");
const long long M = 1000000007;
int main()
{

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	long long n, m;
	cin >> n >> m;

	long long c[10] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};

	long long dp[n + 10][m + 10];
	fill(&dp[0][0], &dp[0][0] + (n + 10) * (m + 10), 0);

	long long a[m + 10];
	fill(a, a + m + 10, 0);
	for (int i = 1; i <= m; i++)
	{
		cin >> a[i];
		dp[c[a[i]]][a[i]] = 1;
	}

	sort(a, a + m + 1);
	for (int i = 2; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			if (dp[i][a[j]])
			{
				for (int k = 1; k <= m; k++)
				{
					if (i + c[a[k]] <= n)
						dp[i + c[a[k]]][a[k]] = max(dp[i + c[a[k]]][a[k]], dp[i][a[j]] + 1);
				}
			}
		}
	}
	int k;
	for (int i = n; i >= 1; i -= c[a[k]])
	{
		//watch(i);
		k = 0;
		for (int j = 1; j <= m; j++)
		{
			if (dp[i][a[j]] && dp[i][a[k]] <= dp[i][a[j]])
			{
				k = j;
			}
		}
		cout << (char)(a[k] + '0');
	}

	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
#include <tuple>
#include <functional>

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define rep(i,n) for(long long  i = 0; i < n; i++)
#define rep2(i,a,n) for(long long  i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl

using namespace std;

int main() 
{
    int n; cin >> n; 
    string s; cin >> s;
    int ans = -1;
    
    //rep(i,n) {
    for(int i = 1; i < n; i++) {
        int tmp = 0;
        string l = s.substr(0, i);
        string r = s.substr(i, n-i);
        
        map<char, int> l_char;
        map<char, int> r_char;
        
        rep(j, l.size()) { l_char[l[j]]++; }
        rep(k, r.size()) { r_char[r[k]]++; }

        for(auto l : l_char) {
            auto r = r_char.find(l.first);
            if(r != r_char.end()) { tmp++; }
        }
        ans = max(tmp, ans);
    }

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



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;


int main(){
  for(;;){
  int n;
  cin >> n;
  if(n==0) break;
  vector<int> num(n,0);
  char c[105];
  for(int i=0;i<100;++i) cin >> c[i];
  int ba=0;
  for(int i=0;i<100;++i){
    if(c[i]=='S') {
      ba+=num[i%n]+1;
      num[i%n]=0;
    }else if(c[i]=='L'){
      num[i%n]+=(ba+1);
      ba=0;
    }else {
      num[i%n]++;
    }
  }

  sort(num.begin(),num.end());

  for(int i=0;i<n;++i)cout << num[i] << " ";
  cout << ba <<endl;
  
 }
  return 0;
}



Measured memory_bytes: 3164
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

//const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
inline LL add(LL x,LL y)
{
    return (x + y)%MOD;
}

inline LL sub(LL x,LL y)
{
    return (x+MOD-y)%MOD;
}


signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    COMinit();
    LL H,W,A,B; cin >>H>>W>>A>>B;
    LL sum = COM(H+W-2,H-1);
    LL msum = 0;
    for(int i = 0; i < A; i++){
        LL base1 = COM(B-1+H-1-i,B-1);
        LL base2 = COM(W-B-1+i,i);
        msum = add((base1 * base2) % MOD, msum);
    }

    if(msum < 0) msum += MOD;
    LL ans = sum - msum;
    if(ans < 0) ans += MOD;
    cout << ans << endl;




}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    long long a[n], b[n];
    for(int i = 0; i < n; i++){
        cin >> a[i] >> b[i];
    }
    long long ans = 0;
    for(int i = n-1; i >= 0; i--){
        if((a[i]+ans)%b[i] == 0) continue;
        if((a[i]+ans) < b[i]) ans += b[i] - (a[i]+ans);
        else ans += (((a[i]+ans)/b[i])+1)*b[i] - (a[i]+ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
import java.util.*;
public class Main
{public static void main(String args[])
   { Scanner sc=new Scanner(System.in);
     String s=sc.next();
     if((s.charAt(2)==s.charAt(3)) && (s.charAt(4)==s.charAt(5)))
       System.out.println("Yes");
    else
       System.out.println("No");
   }
}

Measured memory_bytes: 25172
while True:
    a,op,b = input().split()
    if op == '+':
        print(int(a)+int(b))
    elif op == '-':
        print(int(a)-int(b))
    elif op == '*':
        print(int(a)*int(b))
    elif op == '/':
        print(int(a)//int(b))
    else:
        exit()



Measured memory_bytes: 5596
def dfs(i,num_str):
    global ans_list
    if i==len(str(n)):
        ans_list.append(int(num_str))
        if len(num_list)==1:
            ans_list.append(int(num_list[0]+num_str))
        else:
            if num_list[0]=='0':
                ans_list.append(int(num_list[1]+num_str))
            else:    
                ans_list.append(int(num_list[0]+num_str))
        return
    else:
        for j in num_list:
            dfs(i+1,num_str+j)

n,k = map(int,input().split())
d = list(map(int,input().split()))

ans_list = []
num_list = []
for i in range(10):
    if i not in d:
        num_list.append(str(i))
        
#print(num_list)

dfs(0,'')
sort_list = sorted(ans_list)
#print(sort_list[10:])

for i in sort_list:
    if n<=i:
        print(int(i))
        break

Measured memory_bytes: 9384
#include <bits/stdc++.h>
#include <map> // pair
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<long long int>a(N);
  for(int i=0;i<N;i++){
    cin>>a.at(i);
  }
  long long int ans=0;

    for(int i=0;i<N;i++){
      while(1){
        if(a.at(i)%2==1)break;
        else{
          ans++;
          a.at(i)/=2;
        }
      }
    }

  cout<<ans<<endl;
}


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

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

  int ans = 1;
  for (int i = 1; i * i <= M; ++i) {
    if (M % i) continue;

    int j = M / i;
    if (1L * i * N <= M) ans = max(ans, i);
    if (1L * j * N <= M) ans = max(ans, j);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
// atcoder/abc054/C/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n, m;
  while (cin >> n >> m) {
    bool g[n][n];
    fill(&g[0][0], &g[n - 1][n - 1] + 1, false);
    for (int i = 0; i < m; ++i) {
      int a, b;
      cin >> a >> b;
      --a;
      --b;
      g[a][b] = g[b][a] = true;
    }
    vector<int> v;
    for (int i = 0; i < n; ++i) {
      v.push_back(i);
    }
    int cnt = 0;
    sort(v.begin(), v.end());
    do {
      bool f = (v.front() == 0);
      for (int i = 0; i + 1 < v.size(); ++i) {
        f = f && g[v[i]][v[i + 1]];
      }
      cnt += f;
    } while (next_permutation(v.begin(), v.end()));
    cout << cnt << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<algorithm>

using namespace std;
const int MAXN = 1e5+7;
typedef long long ll;

struct node{
        ll a,b;
}z[MAXN];

bool cmp(node x,node y) {
        return x.a<y.a;
}

int main() {
        int n,m;
        while(cin>>n>>m) {
                for(int i=0;i<n;++i)
                        cin>>z[i].a>>z[i].b;
                sort(z,z+n,cmp);
                ll ans = 0;
                int id = 0;
                priority_queue<ll> que;
                for(int i=1;i<=m;++i) {
                        while(z[id].a<=i && id<n) {
                                que.push(z[id].b);
                                id++;
                        }
                        if(que.empty()) continue;
                        ans += que.top();
                        que.pop();
                }
                cout<<ans<<endl;
        }
        return 0;
}

Measured memory_bytes: 2936
from math import atan2, hypot

def solve():
    N = int(input())
    engines = [tuple(map(int, input().split())) for _ in range(N)]

    engines.sort(key=lambda x: atan2(x[1], x[0]))

    ans = 0
    for L in range(N):
        for R in range(L, L+N):
            x, y = 0, 0
            for i in range(L, R+1):
                i %= N
                dx, dy = engines[i]
                x, y = x+dx, y+dy
            dist = hypot(x, y)
            if dist > ans:
                ans = dist

    print(ans)


solve()


Measured memory_bytes: 3316
#include<iostream>
#include<cstring>
using namespace std;
int num_v[4];

int order(char c){
  char a[13] = {'2', '3', '4', '5', '6', '7', '8',
                '9', 'T', 'J', 'Q', 'K', 'A'};
  for (int i = 0; i < 13; i++) {
    if(c == a[i])return i+1;
  }
  return 0;
}

int winner(string suit, char mark, string card[4], int& pos){
  int match_suit[4];
  int Max = 0, tpos = -1;
  char m = 0;
  for (int i = pos; i < pos + 4; i++) {
    int p = i%4;
    if(suit[0] == card[p][1])match_suit[p] = 2;
    else if(mark == card[p][1])match_suit[p] = 1;
    else match_suit[p] = 0;
  }
  for (int i = pos; i < pos + 4; i++) {
    int p = i%4;
    //    std::cout << match_suit[p] << " ";
    if(Max < match_suit[p])Max = match_suit[p];
  }
  //  std::cout << std::endl;
  for (int i = pos; i < pos + 4; i++) {
    int p = i%4;
    if(match_suit[p] == Max && order(m) < order(card[p][0])){
      m = card[p][0];
      tpos = p;
    }
  }
  //  std::cout << tpos << std::endl;
  return pos = tpos;
}


int main(){
  string suit;
  while(cin >> suit){
    if(suit == "#")break;
    string card[4][13];//N, E, S, W
    for (int i = 0; i < 4; i++) {
      for (int j = 0; j < 13; j++) {
        cin >> card[i][j];
      }
    }
    memset(num_v, 0, sizeof(num_v));
    int pos = 0;
    for (int i = 0; i < 13; i++) {
      string tmp[4] = {card[0][i],
                       card[1][i],
                       card[2][i],
                       card[3][i]};
      //std::cout << card[pos][i] << std::endl;
      num_v[winner(suit, card[pos][i][1], tmp, pos)]++;
    //   for (int i = 0; i < 4; i++) {
    //     char t[4] = {'N', 'E', 'S', 'W'};
    //     std::cout << t[i] << " " << num_v[i] << "/";
    //   }
    //   std::cout << std::endl;
    }

    if(num_v[0] + num_v[2] < num_v[1] + num_v[3]){
      std::cout << "EW " << num_v[1] + num_v[3] - 6 << std::endl;
    }else{
      std::cout << "NS " << num_v[0] + num_v[2] - 6 << std::endl;
    }
  }
  return 0;
}

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

int main() {
	long long n, x, a[100010];
	cin >> n >> x;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	long long ans = 0;
	for (int i = 0; i < n - 1; i++) {
		if (a[i] + a[i + 1] > x) {
			if (a[i + 1] >= a[i] + a[i + 1] - x) {
				ans += a[i] + a[i + 1] - x;
				a[i + 1] -= a[i] + a[i + 1] - x;
			}
			else {
				ans += a[i] + a[i + 1] - x - a[i + 1];
				ans += a[i + 1];
				a[i] -= a[i] + a[i + 1]-x - a[i + 1];
				a[i + 1] = 0;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>

#define                           int                         long long
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<int,int>
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);




using namespace std;

const int inf=1e18;
const int mod=1e9+7;
const int M=100009;
inline int bigmod(int B,int P){int R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}


 main()

{
    fast
    int ses=0;
    int x;
    cin>>x;
    int cur=100;
    while(1)
    {
        cur=(cur)+(cur/100);
        ses++;
        if(cur>=x)break;
    }
    cout<<ses<<endl;
    return 0;

}













Measured memory_bytes: 3676
ma = lambda :map(int,input().split())
x,n = ma()
P = list(ma())
import collections
co = collections.Counter(P)
mi = -1
ab = 10**9
for i in range(-1,102):
    if abs(x-i) <ab:
        if co[i] >0:
            continue
        ab = abs(x-i)
        mi = i
print(mi)

Measured memory_bytes: 64952
import fractions

def main():
    a, b, c, d = map(int, input().split())
    print(solve(a, b, c, d))

def solve(a, b, c, d):
    cd = c * d // fractions.gcd(c, d)

    x = num_factors(c, a, b)
    y = num_factors(d, a, b)
    z = num_factors(cd, a, b)

    return b - a + 1 - x - y + z

def num_factors(x, a, b):
    return b // x - (a - 1) // x

main()


Measured memory_bytes: 5048
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC147A
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = Cin.IArr();
            Console.WriteLine(a.Sum() > 21 ? "bust" : "win");
        }
    }

    class Solver
    {
        public Solver()
        {

        }

        public IConvertible Solve()
        {
            return 0;
        }
    }

    internal static class Cin
    {
        public static string String()
        {
            return Console.ReadLine();
        }

        public static int Int()
        {
            return int.Parse(String());
        }

        public static int[] IArr()
        {
            return Split().Select(int.Parse).ToArray();
        }

        public static long Long()
        {
            return long.Parse(String());
        }

        public static long[] LArr()
        {
            return Split().Select(long.Parse).ToArray();
        }

        public static double Double()
        {
            return double.Parse(String());
        }

        public static double[] DArr()
        {
            return Split().Select(double.Parse).ToArray();
        }

        private static IEnumerable<String> Split()
        {
            return String().Split(' ');
        }
    }
}

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

#define DEBUG(x) cerr << #x << ": " << (double)x << endl;

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

    const double noudo = ((double)e / (100.0+e));

    vector<int> water;
    vector<int> suger;
    for (int i = 0; i <= f; i++) {
        for (int j = 0; j <= f; j++) {
            int w= (a * 100 * i) + (b * 100 * j);
            int s= (c * i) + (d * j);
            //int sw = w + s;
            /*
            if (w == 0) {
                continue;
            }
            double curNoud = (double)s / sw;

            if (sw <= f) {
                if ()
            }
            */
            if (w <= f && w != 0) {
                water.push_back(w);
            }
            if (s <= f) {
                suger.push_back(s);
            }
        }
    }

    int l1 = water.size();
    int l2 = suger.size();
    double maxNoudo = -1.0;
    int maxSw = 0;
    int maxS = 0;
    for (int i = 0; i < l1; i++) {
        for (int j = 0; j < l2; j++) {
            int w = water[i];
            if (w == 0) continue;
            int s = suger[j];
            int sw = w + s;
            double curNoudo = ((double)s / sw);
            if ( (sw <= f) && (curNoudo <= noudo) ) {
                if ( (sw == 200) && (s == 100) ) {
                    //cout << "------------------------" << endl;
                }
                if ( maxNoudo < curNoudo ) {
                    maxNoudo = curNoudo;
                    maxSw = sw;
                    maxS = s;
                }
            }
        }
    }

    cout << maxSw << " " << maxS << endl;


    return 0;
}

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

using namespace std;
using ll = long long;
const int F = 26;
const int def = 1e6;


int n;
vector<int> c(F);
vector<vector<int>> a;


void init() {
    cin >> n;
    a.resize(n, vector<int>(F));
    for(int i = 0; i < F; i++)cin >> c[i];
    for(int i = 0; i < n; i++)for(int j = 0; j < F; j++)cin >> a[i][j];
}


vector<int> calc(int rng) {
    vector<int> last(F, -1);
    vector<int> ans;
    for(int i = 0; i < n; i++){ 
        vector<int> cur = a[i];
        for(int j = 0; j < F; j++)cur[j] += (i - last[j]) * (c[j] + rng);
        int ind =  max_element(cur.begin(), cur.end()) - cur.begin();
        last[ind] = i;
        ans.emplace_back(ind);
    }
    return ans;
}

int chack(vector<int> p) {
    int sum = 0;
    vector<int> last(F, -1);
    for(int i = 0; i < n; i++) {
        sum += a[i][p[i]];
        last[p[i]] = i;
        for(int j = 0; j < F; j++)sum -= (i - last[j]) * c[j];
    }
    return sum;
}


int main()
{
    srand((unsigned)time(NULL));   
    init();


    vector<int> ans;
    int M = 4 * 1e4, nax = -1e9;
    for(int I = 1; I <= M; I++) {
        int sed = rand() % (rand() % (M/80) + 1) * ((rand() % 2)? 1 : -1);
        vector<int> cur = calc(sed);
        int k = chack(cur);
        if(k > nax) {
            nax = k;
            ans = cur;
        }
    }

    for(auto i : ans)cout << i + 1 << endl;
}

/*
satisfaction: 424801
score: 1424801
*/

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

using namespace std;

void disp(vector<int> a, int n){
    for(int i = 0;i < n;i++){
        if(i == n-1) cout << a[i];
        else cout << a[i] << " ";
    }
    cout << endl;
}

int bubble(vector<int> a, int n){
    int count = 0;
    int temp = 0;
    for(int i = 0;i < n;i++){
        for(int j = 0;j < n-1;j++){
            if(a[j] > a[j+1]){
                temp = a[j];
                a[j] = a[j+1];
                a[j+1] = temp;
                count++;
            }
        }
    }

    disp(a, n);
    return count;
}

int main(void){

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

    cout << bubble(a, n) << endl;

    return 0;
}


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

int n, m, q;
vector<int> a, b, c, d;
int ans;

void dfs(vector<int> A) {
  if (A.size() == n + 1) {
    int now = 0;
    for (int i = 0; i < q; i++) {
      if (A.at(b.at(i)) - A.at(a.at(i)) == c.at(i)) now += d.at(i);
    }
    ans = max(ans, now);
    return;
  }

  A.push_back(A.back());
  while (A.back() <= m) {
    dfs(A);
    A.back()++;
  }
}

int main() {
  cin >> n >> m >> q;
  a = b = c = d = vector<int>(q);
  for (int i = 0; i < q; i++) {
    cin >> a.at(i) >> b.at(i) >> c.at(i) >> d.at(i);
  }
  dfs(vector<int>(1, 1));
  cout << ans << endl;
}

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

using namespace std;

#define int long long
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    {                                                                          \
        FOREACH(x, v) { cout << x << " "; }                                    \
        cout << "\n";                                                          \
    }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}

typedef long long ll;
typedef unsigned long long ul;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, VL, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18 + 1;
const ll dx[] = {1, -1, 0, 0};
const ll dy[] = {0, 0, 1, -1};

ll N;
vector<VL> G(10000);
VL c, d(10000), tree;
map<ll, ll> sel;
vector<bool> used(10000, false);

void dfs(ll now) {
    used[now] = true;
    FOREACH(to, G[now]) {
        if(!used[to]) {
            tree.emplace_back(to);
            dfs(to);
        }
    }
}

signed main() {
    cin >> N;
    cout << 180 * (N - 2) << "\n";
}


Measured memory_bytes: 512
n = int(input())

base = 1
odd = False

ans = 0

while  n >= base:
    if odd:
        pass
    else:
        if n >= (base * 10):
            ans += (base * 10 - base)
        else:
            ans += n - base + 1
    base *= 10
    odd = not odd

print(ans)

Measured memory_bytes: 38384
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;

fn main() {
    input!{
      n: usize,
      x: i64,
      aa: [i64; n],
    }

    let mut aa = aa;
    let sum: i64 = aa.iter().sum();
    if sum == x {
        return println!("{}", n);
    }
    if sum < x {
        return println!("{}", n-1);
    }

    let mut ans = 0;
    aa.sort();
    let mut x = x;
    for i in 0..n {
        if x < aa[i] {
            break;
        }
        if x == aa[i] {
            ans += 1;
            break;
        }

        ans += 1;
        x -= aa[i];
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static MyUtil;

class MyUtil
{
    public static int[] ReadIntArray()
    {
	return ReadLine().Split().Select(x => int.Parse(x)).ToArray();
    }
}

class Program
{
    public static void Main()
    {
	var tmp = ReadIntArray();
	int n = tmp[0], k = tmp[1];
	int ans = ((n-1) + (k-1) - 1) / (k-1);
	WriteLine(ans);
    }
}


Measured memory_bytes: 13268
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <iomanip>
#include <typeinfo>
#include <iterator>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <set>
#include <numeric>
using namespace std;

#define all(container) container.begin(), container.end()
#define sortall(container) (sort(container.begin(), container.end()))
#define yn(cond) ((cond) ? (cout << "Yes" << endl) : (cout << "No" << endl))
#define YN(cond) ((cond) ? (cout << "YES" << endl) : (cout << "NO" << endl))
#define LLONG_MAX numeric_limits<long long>::max()
#define INT_MAX numeric_limits<int>::max()

typedef long long       ll;
typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<string>  vs;
typedef vector<char>    vc;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;
typedef vector<vll>		vvll;
typedef vector<vi>		vvi;
typedef vector<vb>		vvb;
typedef vector<vs>		vvs;
typedef vector<vc>		vvc;

typedef struct edge_ {
	ll to;
	ll cost;
} edge;

typedef struct point_ {
	ll x, y;
	point_(ll x = 0, ll y = 0) : x(x), y(y) {}
} point;

template <typename T>
class mat2D {
private:
	vector<vector<T>> data;
public:
	mat2D(int rows, int cols) : data(vector<vector<T>>(rows, vector<T>(cols))) {}
	T operator () (int row, int col) { return data[row][col]; }

	friend istream& operator >> (istream& is, mat2D<T>& m) { return is >> m.data; }
	friend ostream& operator << (ostream& os, const mat2D<T>& m) {
		for (const vector<T>& row : m.data) os << row << endl;
		return os;
	}
};

constexpr double	PI = 3.14159265358979323846;
constexpr ll		INF = 1 << 15;
constexpr ll		MOD = (ll)1e9 + 7;
constexpr double	EPS = 1e-7;
constexpr int		dy4[4] = { 0, 1, 0, -1 };
constexpr int		dx4[4] = { 1, 0, -1, 0 };
constexpr int		dy8[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };
constexpr int		dx8[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };

template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
	for (const T& x : vec) os << x << " ";
	return os;
}

template<typename S, typename T>
istream& operator >> (istream& is, pair<S, T>& p) {
	is >> p.first >> p.second;
	return is;
}

istream& operator >> (istream& is, point& p) {
	is >> p.x >> p.y;
	return is;
}

template<typename S, typename T>
ostream& operator << (ostream& os, const pair<S, T>& p) {
	os << "{" << p.first << " " << p.second << "}";
	return os;
}

ostream& operator << (ostream& os, const point& p) {
	os << "(" << p.x << " " << p.y << ")";
	return os;
}

/******************************************************************************/
/**********************         Don't make WA !!         **********************/
/******************************************************************************/


int main()
{
	vi N(4);
	cin >> N;
	sortall(N);
	vi n = { 1, 4, 7, 9 };
	YN(n == N);

	return 0;
}

Measured memory_bytes: 256
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

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

def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)
n = int(input())
T = [int(input()) for i in range(n)]
a = T[0]
for i in range(1,n):
    a = lcm(a,T[i])
print(a)

Measured memory_bytes: 3316
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;


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

  if(s[2] == s[3] && s[4] == s[5]) Yes;
  else No;

  return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));       
		try {
			String line;
			while((line=r.readLine())!=null){
				/* input from here */
				int n = Integer.parseInt(line);
				String[] in = r.readLine().split(" ");
				boolean[][] b = new boolean[7][7];
				boolean res = false;
				for(int i=0;i<7;i++){
					Arrays.fill(b[i], false);
				}
				for(String s : in){
					b[Math.min(Integer.parseInt(s.substring(0,1)),Integer.parseInt(s.substring(1)))][Math.max(Integer.parseInt(s.substring(0,1)),Integer.parseInt(s.substring(1)))] = true;
				}
				int count = in.length;
				/* input till here */

				boolean[][] temp = new boolean[7][7];        					
				for(int i=0;i<7;i++){
					for(int j=i;j<7;j++){
						temp[i][j] = b[i][j];
					}
				}
				/* processing from here */
				for(int i=0;i<7;i++){
					for(int j=i;j<7;j++){
						if(b[i][j]){
							temp[i][j] = false;
							if(res = solve(temp,i,j,count,i)){
								break;
							} else if(res = solve(temp,i,j,count,j)){
								break;
							}
							temp[i][j] = true;
						}
					}
					if(res){
						break;
					}
				}
				/* processing till here */
				/* output */
				if(res){
					System.out.println("Yes");
				} else {
					System.out.println("No");
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public static boolean solve(boolean[][] b, int sr,int sc, int count,int open){
		boolean res = false;
		//System.out.println("current: " + sr + " " + sc + " count:" + count + " open: " + open);
		if(count==1){
			//System.out.println(s);
			return true;
		} else {			
			for(int column=0;column<7;column++){
				if(column==sc){
					continue;
				}
				if(b[open][column]){
					b[open][column] = false;
					res = solve(b,open,column,count-1,column);
					b[open][column] = true;
				}
				if(res){
					break;
				}
			}
			for(int row=0;row<=6;row++){
				if(row==sr){
					continue;
				}
				if(res){
					break;
				}
				if(b[row][open]){
					b[row][open] = false;
					res = solve(b,row,open,count-1,row);
					b[row][open] = true;
				}
			}
			//System.out.println("FAIL");
			if(res){
				return true;
			} else {
				return false;
			}
		}
	}
}

Measured memory_bytes: 21940
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
typedef long long ll;

    ll prex[1001];


int main(){
    ll N,ans=1;cin>>N;
    rep(i,2,N+1){
        ll II=i;
        rep(j,2,i+1){
            while(II%j==0){
                II/=j;
                prex[j]++;
            }
        }
    }
    rep(i,1,N+1){
        ans=(ans*((prex[i]+1)%1000000007))%1000000007;
    }
    cout<<ans<<endl;
}







Measured memory_bytes: 256
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;



int main(){
    ll x;
    cin>>x;
    if(x==7 || x==5 || x==3){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
    
    
    
    return 0;
}


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

int main()
{
	int n,d=0,m,c=0;
	
	cin>>n;
	
	m=n;
	
	while(m>0){
		d++;
		m=m/10;
	}
	if(d==6){
		c=c+90000;
		d=d-2;
		n=9999;
	}
	if(d==5){
		c=c+(n-9999);
		d--;
		n=9999;
	}
	if(d==4){
		c=c+900;
		d=d-2;
		n=99;
	}
	if(d==3){
		c=c+(n-99);
		d--;
		n=99;
	}
	if(d==2){
		c=c+9;
	}
	if(d==1){
		c=c+n;
	}
	cout<<c<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int H, W;
  cin >> H >> W;
  for(int i = 0; i < W + 2; i++){
    cout << '#';
  }
  cout << endl;
  string str;
  for(int i = 0; i < H; i++){
    cin >> str;
    cout << '#' << str << '#' << endl;
  }
  for(int i = 0; i < W + 2; i++){
    cout << '#';
  }
  cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
#define fb(i,a,b) for(int (i) = (a); (i) >= (b); --(i))
#define mod 998244353
#define xx first
#define yy second
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define ll long long
#define pii pair<int,int>


using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;/// find_by_order(x)(x+1th) , order_of_key() (strictly less)
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

int n;
ll k;
int slika[5005];
ll cost[5005];
bool bio[5005];
vector<ll> tr;


int main()
{

    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> n >> k;
    ff(i,1,n){
        cin >> slika[i];
    }
    ff(i,1,n){
        cin >> cost[i];
    }
    ll ans = -2e9;
    ff(i,1,n){
        if(bio[i])continue;
        int pom = i;
        bio[i] = 1;
        tr.clear();
        while(1){
            tr.pb(cost[pom]);
            pom = slika[pom];
            if(bio[pom])break;
            bio[pom] = 1;
        }
        ll tmp = tr[0];
        ll m = tr.size();
        ff(j,0,m - 1){
            ll sum = 0;
            ff(r,j + 1, j + min(m,k)){
                sum += tr[r%m];
                tmp = max(tmp, sum);
            }
        }
        ll s1 = 0;
        ff(j,0,m - 1)s1 += tr[j];
        ll novok = k%m;
        ll sta = k/m;
        ll s2 = s1 * sta;
        ff(j,0,m - 1){
            ll sum = 0;
            ff(r,j+1, j + min(m-1,novok)){
                sum += tr[r%m];
                tmp = max(tmp, sum + s2);
            }
            if(k >= m)ans = max(ans, s2);
        }
        if(sta)s2 = (s1 * (sta - 1));
        if(sta)novok += m;
        ff(j,0,m - 1){
            ll sum = 0;
            ff(r,j+1, j + min(m,novok)){
                sum += tr[r%m];
                tmp = max(tmp, sum + s2);
            }
            if(k >= 2*m)ans = max(ans, s2);
        }
        ans = max(ans, tmp);
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3836
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)

def main():
    n = I()
    aa = LLI()
    e = collections.defaultdict(set)
    for a,b in aa:
        e[a].add(b)
        e[b].add(a)


    def search(s):
        d = collections.defaultdict(lambda: inf)
        d[s] = 0
        q = []
        heapq.heappush(q, (0, s))
        v = collections.defaultdict(bool)
        while len(q):
            k, u = heapq.heappop(q)
            if v[u]:
                continue
            v[u] = True

            for uv in e[u]:
                if v[uv]:
                    continue
                vd = k + 1
                if d[uv] > vd:
                    d[uv] = vd
                    heapq.heappush(q, (vd, uv))

        return d

    d1 = search(1)
    mv = -1
    mk = 1
    for k,v in d1.items():
        if mv < v:
            mv = v
            mk = k
    d2 = search(mk)
    mv = max(d2.values())

    if (mv + 1) % 3 == 2:
        return 'Second'

    return 'First'


print(main())




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

int main(){
    int A,B,C;

    cin >> A >> B >> C;

    if(A==B || A==C || B==C){
        if(A==B && A==C && B==C) cout << "No";
        else cout << "Yes";
    }
    else cout << "No";
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""042-c"""

import sys


def solve(dislike_digits_table, first_like_digit, N):
    """Solve."""
    for i, _ in enumerate(N):
        c = N[i]
        while dislike_digits_table[int(c)]:
            if c == '9':
                if i == 0:
                    return solve(dislike_digits_table,
                                 first_like_digit,
                                 '1' + '0' * len(N))
                else:
                    return solve(dislike_digits_table,
                                 first_like_digit,
                                 str(int(N[0:i+1]) + 1)
                                    + '0' * len(N[i+1:]))
            else:
                c = chr(ord(c) + 1)
            N = N[0:i] + c + '0' * len(N[i+1:])

    return N


def main():
    """Main function."""
    dislike_digits_table = [False for _ in range(10)]

    N, _ = sys.stdin.readline().split(' ')
    digits = map(int, sys.stdin.readline().split(' '))

    for digit in digits:
        dislike_digits_table[digit] = True

    first_like_digit = str(next(i for i, v
                                in enumerate(dislike_digits_table)
                                if not v))

    print(solve(dislike_digits_table, first_like_digit, N))


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

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

int main(){
    double x1,x2,y1,y2;
    cin>>x1>>x2>>y1>>y2;
    double a,b;
    a=(y1-x1)*(y1-x1);
    b=(y2-x2)*(y2-x2);
    cout<<fixed<<setprecision(7)<<sqrt(a+b)<<'\n';
}


Measured memory_bytes: 3296
import java.util.*;

public class Main{
  static int[] ans;
  static Map<Integer, Integer> map;
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int[] num = new int[5];
    for(int i = 0; i < 5; i++){
      num[i] = sc.nextInt();
    }
    int k = sc.nextInt();
    
    String ans = "Yay!";
    a : for(int i = 0; i < 4; i++){
      for(int j = i+1; j < 5; j++){
        if(Math.abs(num[i] - num[j]) > k){
          ans = ":(";
          break a;
        }
      }
    }
    System.out.println(ans);
  }
}

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



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

    ll a,b,x; cin >> a >> b >> x;
    if(a%x == 0) cout << b/x - a/x + 1 << endl;
    else cout << b/x - a/x << endl;
}

Measured memory_bytes: 256
// { Driver Code Starts
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  int x;
  cin >> x;
//   cout << ((x>=30) ? (cout << "Yes"; ) : (cout << "No";));	
if (x >= 30)
cout << "Yes";
else 
cout << "No";
	return 0;
}


Measured memory_bytes: 3648
import sys
import collections
input = sys.stdin.readline

def main():
    S = input().strip()

    a = [[] for _ in range(26)]

    for i, s in enumerate(S):
        a[ord(s) - ord('a')].append(i)

    ans = []
    f = False
    for i in range(26):
        for j in range(len(a[i]) - 1):
            if (a[i][j + 1] - a[i][j] + 1) < 4:
                ans.append(a[i][j])
                ans.append(a[i][j + 1])
                f = True
                break
        if f:
            break

    if f:
        print(ans[0] + 1, ans[1] + 1)
    else:
        print(-1, -1)







    

if __name__ == '__main__':
    main()




Measured memory_bytes: 7668