akhauriyash/Code-Regression huggingface dataset:
def hand(card):
    m = 0
    n = [0]*13
    val = 0
    for i in range(13):
        n[i] = card.count(str(i+1))
    for i in range(13):
        if n[i] == 4:
            return 'four card'
    for i in range(13):
        if n[i] == 3:
            for j in range(13):
                if n[j] == 2:
                    return 'full house'
            return 'three card'

    for i in range(13):
        if n[i] == 2:
            for j in range(i+1,13):
                if n[j] == 2:
                    return 'two pair'
            return 'one pair'
    for i in range(len(card)):
        card[i] = int(card[i])
    card.sort()
    
    if card == [1,10,11,12,13]:
        return 'straight'
    for i in range(4):
        if card[4-i] - card[4-i-1] != 1:
            return 'null'
    return 'straight'

while True:
    try:
        card = input().split(',')
        print(hand(card))
            
    except:
        break

Measured memory_bytes: 7660
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func swap(a int64, b int64) (int64, int64) {
	return b, a
}

func GCD(a int64, b int64) int64 {
	if b > a {
		a, b = swap(a, b)
	}
	if b == 0 {
		return a
	} else {
		return GCD(a%b, b)
	}
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextLong() int64 {
	sc.Scan()
	i, e := strconv.ParseInt(sc.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func nextString() string {
	sc.Scan()
	s := sc.Text()
	return s
}

func main() {
	sc.Split(bufio.ScanWords)
	//ans := 1
	N := nextInt()
	S := nextString()
	R := int64(0)
	G := int64(0)
	B := int64(0)
	for i := 0; i < N; i++ {
		if S[i] == 'R' {
			R++
		}
		if S[i] == 'G' {
			G++
		}
		if S[i] == 'B' {
			B++
		}
	}
	ans := R * G * B
	for i := 0; i < N; i++ {
		for j := i + 1; j < N; j++ {
			k := (j + (j - i))
			//fmt.Printf("%d %d %d\n", i, j, k)
			if k >= N {
				continue
			}
			if S[i] != S[j] && S[j] != S[k] && S[i] != S[k] {
				ans--
			}
		}
	}
	//fmt.Printf("%d %d %d\n", R, G, B)
	fmt.Printf("%d\n", ans)
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>

int main()
{
	int m[50], f[50], r[50], i, I, n;
	for(i = 0 ;  ; i++)
	{
		scanf("%d%d%d", &m[i], &f[i], &r[i]);
		if(m[i] == -1 && f[i] == -1 && r[i] == -1)
		{
			n = i;
			break;
		}
	}
	for(i = 0 ; i < n ; i++)
	{
		if(m[i] == -1 || f[i] == -1)
		{
			printf("F\n");
		}
		else if(m[i] + f[i] >= 80)
		{
			printf("A\n");
		}
		else if(m[i] + f[i] >= 65 && m[i] + f[i] < 80)
		{
			printf("B\n");
		}
		else if(m[i] + f[i] >= 50 && m[i] + f[i] < 65)
		{
			printf("C\n");
		}
		else if(m[i] + f[i] >= 30 && m[i] + f[i] < 50)
		{
			if(r[i] >= 50)
			{
				printf("C\n");
			}
			else
			{
				printf("D\n");
			}
		}
		else if(m[i] + f[i] < 30)
		{
			printf("F\n");
		}
	}
	return 0;
}



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

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

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  __MAKE_TIME__  Problem: __PROBLEM__ / Link: __CONTEST_URL__  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */



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

	LL N; cin>>N;
	LL K; cin >> K;
	VL a(N);
	FOR(i, 0, N) {
		cin >> a[i];
	}

	LL ans = 0;
	FOR(i, 0, N) {
		ans += 2*min(abs(0-a[i]),abs(a[i]-K));
	}
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
def main():
    n = int(input())
    A = list(map(int, input().split()))
    M = max(A)
    dig = len(bin(M)) - 2
    MOD = 10 ** 9 + 7
    ans = 0
    d = {i: [0, 0] for i in range(dig)}
    for a in A:
        a = bin(a)[2:].zfill(dig)
        for i in range(len(a)):
            if a[-(i+1)] == '0':
                d[i][0] += 1
            else:
                d[i][1] += 1
    for i in range(dig):
        ans += d[i][0] * d[i][1] * pow(2, i, MOD)
        ans %= MOD
    print(ans)
main()


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

int main() {
  string s;
  cin >> s;
  string t = "ACGT";
  int ans=0;
  for(int i=0;i<s.size();i++){ //部分文字列の先頭
    int len = 0;
    for(int j=i;j<s.size();j++){ //部分文字列の要素
      bool flag = false;
      for(int k=0;k<4;k++){
        if( s.at(j) == t.at(k) ){ //ACGTとの比較
          len++;
          flag = true;
          break;
        }
      }
      if( !flag ){ // ACGTでなければ次のiループ
        ans = max( ans,len );
        break; 
      }else if( j == s.size()-1 ){ //これ忘れてた
        ans = max( ans,len );
      }
    }
  }
  cout << ans << 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();
        sc.close();
        System.out.println(gcd(a,b));
        
    }

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


Measured memory_bytes: 26236
//https://atcoder.jp/contests/abc134/tasks/abc134_a
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
#define FOR(i,a,b) for(int64_t i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
int main() {
    ll r; cin>>r;
    cout<<3*r*r<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cstring>

using namespace std;
int n,c,k,a[100010],ans,cnt;
int main()
{
	scanf("%d%d%d",&n,&c,&k);
	int node=1;
	for(int i=1;i<=n;i++) scanf("%d",a+i);
	sort(a+1,a+1+n);
	for(int i=1;i<=n;i++)
	{
		if(a[i]>a[node]+k)
		{
			ans++;
			node=i;
			cnt=0;
		}
		if(cnt==c)
		{
			node=i; ans++;
			cnt=0;
		}
		cnt++;
	}
	if(cnt) ans++;
	printf("%d",ans);
	return 0;
}
/*

7 2 3
1
2
4
8
8
10
11


*/

Measured memory_bytes: 512
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;

int main(void){
	          int i;

	          cin.tie(0);  ios_base::sync_with_stdio(false);

	          ll N,A,B;
	          cin >> N >> A >> B;

	          if((B-A-1LL)%2LL==1LL){
	        	  cout << (B-A)/2LL << endl;
	        	  return 0;
	          }

	          if(A==1LL){
	        	  cout << 1LL+(B-A)/2LL << endl;
	        	  return 0;
	          }
	          if(B==N){
	        	  cout << 1LL+(B-A)/2LL << endl;
	        	  return 0;
	          }

	          cout << min(N-B+1LL+(B-A)/2LL,A+(B-A)/2LL) << endl;




	          return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define int long long int
#define FILEIO  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); 
#define maxn 1000000
 

using namespace std;

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

signed main() {
//FILEIO;
ios::sync_with_stdio(false);
cin.tie(0);
cout.precision(10);
cout << fixed;
int n;
cin>>n;
int arr[n];
map<int , int>mp;
int su = 0;
for (int i = 0; i < n; ++i)
{
	/* code */
	cin>>arr[i];
	mp[arr[i]]++;
	su += arr[i];
}
int q;
cin>>q;
while(q--)
{
	int b , c;
	cin>>b>>c;
	if(mp[b]!= 0)
	{
		int temp = mp[b];
		mp[b] = 0;
		mp[c] += temp;
		su += (c - b)*temp;
	}
	cout<<su<<endl;
}











    return 0;
}



Measured memory_bytes: 10012
#include <iostream>
#include <vector>

using namespace std;

void func_a() {
    int x, y, z;
    cin >> x;
    cin >> y;
    cin >> z;

    cout << z << " " << x << " " << y << "\n";

}

void func_b() {
    double n, m;
    cin >> n;
    cin >> m;

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

    int count = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] >= sum / (4 * m) ) {
            ++count;
            if (count == m) break;
        }
    }

    //cout << "sum:" << sum << "\n";
    //cout << "border:" << sum / (4*m) << "\n";
    //cout << "count:" << count << "\n";
    if (count >= m) cout << "Yes";
    else cout << "No";


}

void func_c() {
    long long  n, k;
    cin >> n;
    cin >> k;

    // cout << n << " " << k << "\n";
    n = n % k;
    long long temp = (n - k > 0) ? n - k : k - n;
    if (n > temp) n = temp;

    cout << n;
}

void func_d()
{

}

int main()
{
    //func_a();
    func_b();
    //func_c();
    //func_d();
    return 0;
}

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

const int MOD = 1e9 + 7;
const int N = 200 + 5;

int h, w;
int a[N][N];
int dp[2 * N][N][N];

int main() {
    ios::sync_with_stdio(false);
    cin >> h >> w;
    for (int i = 1; i <= h; i++) {
        for (int j = 1; j <= w; j++) {
            cin >> a[i][j];
        }
    }
    memset(dp, -1, sizeof dp);
    dp[0][1][1] = a[1][1];
    for (int i = 1; i <= h + w - 2; i++) {
        int bound = min(i, h);
        for (int x1 = 1; x1 <= bound; x1++) {
            for (int x2 = 1; x2 <= bound; x2++) {
                if (dp[i - 1][x1][x2] == -1) continue;
                int base = dp[i - 1][x1][x2];
                int y1 = i + 1 - x1;
                int y2 = i + 1 - x2;
                if (x1 < h && x2 < h) dp[i][x1 + 1][x2 + 1] = max(dp[i][x1 + 1][x2 + 1], base + ((x1 == x2 && y1 == y2) ? a[x1 + 1][y1] : a[x1 + 1][y1] + a[x2 + 1][y2]));
                if (x1 < h && y2 < w) dp[i][x1 + 1][x2] = max(dp[i][x1 + 1][x2], base + ((x1 + 1 == x2 && y1 == y2 + 1) ? a[x2][y2 + 1] : a[x1 + 1][y1] + a[x2][y2 + 1]));
                if (y1 < w && x2 < h) dp[i][x1][x2 + 1] = max(dp[i][x1][x2 + 1], base + ((x1 == x2 + 1 && y1 + 1 == y2) ? a[x1][y1 + 1] : a[x1][y1 + 1] + a[x2 + 1][y2]));
                if (y1 < w && y2 < w) dp[i][x1][x2] = max(dp[i][x1][x2], base + ((x1 == x2 && y1 == y2) ? a[x1][y1 + 1] : a[x1][y1 + 1] + a[x2][y2 + 1]));
            }
        }
    }
    cout << dp[h + w - 2][h][h] << endl;
    return 0;
}

Measured memory_bytes: 67712
#include <bits/stdc++.h>
#define fin ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ii pair<int,int>
#define F first
#define S second
#define pb push_back
#define pf push_front
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a) for(int i = a; i >= 0; i--)
#define fori(i,m) for(auto i = m.begin(); i != m.end(); i++) 
#define w(t) while(t--)
#define sz(s) int(s.size())
#define cls(a,car) memset(a,car,sizeof (a))
#define db(x) cerr << #x << " is " << x << '\n'
#define FL freopen("in", "r", stdin),freopen("out", "w", stdout);
#define time cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
#define angle(x) double(x * acos(-1) / 180.0)
using namespace std;
typedef unsigned long long ll;
typedef vector<int> vi;
typedef vector<ii> vii;
const int N = 1 * 1e6 + 5;
const ll mod = 1e9 + 7;
const int INF = INT_MAX;
const ll INFCAD  = ll(INT_MAX) * 2 + 1;
const double E = 1e-9;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
// fflush(stdout)
// cout << flush
// a + b = a ^ b + 2 * (a & b)
int main(){
    //FL;
    fin;
    int n;
    cin >> n;
    cout << (n + 1) / 2 << '\n';
    time;
    return 0;
}       


Measured memory_bytes: 512
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <deque>

long long mod = 1e9+7;
class Mint {
public:
  long long x;
  Mint(){}; // 引数なしでも定義できるように引数なしコンストラクタも用意しておく
  Mint(long long a){
    x = a%mod;
    while(x<0){
      x += mod;
    }
  };
  Mint& operator += (const Mint &a){
    x+=a.x;
    x%=mod;
    return *this;
  }
  Mint& operator -= (const Mint &a){
    x += (mod - a.x);
    x%=mod;
    return *this;
  }
  Mint& operator *= (const Mint &a){
    x*=a.x;
    x%=mod;
    return *this;
  }

  // a^n mod を計算する
  // Useaeg: Mint z = y.pow(y, n);
  Mint pow(Mint a, long long n) const {
    Mint y(1);
    Mint b(a);
    while (n > 0) {
      if (n & 1) y *= b;
      b *= b;
      n >>= 1;
    }
    return y;
  }

  // a^{-1} mod を計算する
  Mint modinv(const Mint &a) const {
    return pow(a, mod-2);
  }

  Mint& operator /= (const Mint &a) {
    x *= modinv(a).x;
    x %= mod;
    return *this;
  }

  Mint operator + (Mint &a) const {
    Mint y(*this);
    y += a;
    return y;
  }

  Mint operator - (Mint &a) const {
    Mint y(*this);
    y -= a;
    return y;
  }

  Mint operator * (Mint &a) const {
    Mint y(*this);
    y *= a;
    return y;
  }

  Mint operator / (Mint &a) const {
    Mint y(*this);
    y/=a;
    return y.x;
  }

  // nCk @mod を計算する
  Mint nCk(Mint &n, const long long k) const {
    Mint y = Mint(1);
    for (Mint i(0); (i.x)<k; i.x++){
      y *= (n-i);
      y /= i;
    }
    return y;
  }

  // nPk @mod を計算する
  Mint nPk(Mint &n, long long k) const {
    Mint y(1);
    for (Mint i(0); (i.x)<k; i.x++){
      y *= (n-i);
    }
    return y;
  }
};

int main(){
  int N;
  std::cin >> N;
  std::vector<int > a(N);
  int ans = 0;
  for (int i=0; i<N; i++){
    std::cin >> a[i];
    if (i%2==0 && a[i]%2==1) ans++;
  }
  std::cout << ans << std::endl;
  
  return 0;
}

Measured memory_bytes: 3180
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<iomanip>
using namespace std;
typedef long long ll;
const int INF=1000000000;
const int MOD=1000000007;

int main()
{
 int n;
 cin >> n;
 cout<< (n+1)/2;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;

int main(){
    int h,w; cin >> h >> w;
    vector<string> map(h);
    rep(i, h) cin >> map[i];
    rep(i, h) {
        rep(j, w) {
            if(map[i][j] == '#') {
                bool isOK = false;
                if(j+1 < w && map[i][j+1] == '#') {
                    isOK = true;
                }
                if(j-1 >=0 && map[i][j-1] == '#') {
                    isOK = true;
                }
                if(i+1 < h && map[i+1][j] == '#') {
                    isOK = true;
                }
                if(i-1 >=0 && map[i-1][j] == '#') {
                    isOK = true;
                }
                if(!isOK){
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "Yes" << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main() {
  string s, t, u;
  int a, b;
  cin >> s >> t;
  cin >> a >> b;
  cin >> u;
  if (s == u)
    --a;
  else
    --b;
  cout << a << ' ' << b << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <list>
#include <string>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip> // setprecisionを使用するのに必要 cout << fixed << setprecision(15) << p でpを小数点以下15桁表示
using namespace std;
#define REPD(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) REPD(i, 0, n)
typedef long long ll;
#define fin(ans) cout << (ans) << '\n'
/*

*/
int main()
{
    string T;
    cin >> T;
    int ans = 0;
    REP(i,T.length()){
        if(T[i] == '?'){
            cout << 'D';
        }else{
            cout << T[i];
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3380
//#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=2e5+5;
const int mod=1e9+7;
int k,a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main()
{
    cin>>k;
    cout<<a[k-1]<<endl;
    return 0;
}

Measured memory_bytes: 256
import bisect

n = int(input())
al = sorted(list(map(int, input().split())))
bl = sorted(list(map(int, input().split())))
cl = sorted(list(map(int, input().split())))
ans = 0

for b in bl:
    i = bisect.bisect_left(al, b)
    j = bisect.bisect_right(cl, b)
    ans += i*(n-j)

print(ans)

Measured memory_bytes: 28988
#include<stdio.h>
#include<string.h>

void Print(char *);
void Reverse(char *);
void Replace(char *);

int main(){
  int i,n;
  char str[1001],c[10];

  scanf("%s",str);
  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%s",c);
    if(strcmp(c,"print")==0)Print(str);
    else if(strcmp(c,"reverse")==0)Reverse(str);
    else Replace(str);
  }

  return 0;
}

void Print(char *str){
  int i,a,b;

  scanf("%d %d",&a,&b);
  for(i=a;i<=b;i++)
    printf("%c",str[i]);

  printf("\n");
}

void Reverse(char *str){
  int i,a,b;
  char tmp[1001];

  scanf("%d %d",&a,&b);

  while(a<b){
    char ch=str[a];
    str[a]=str[b];
    str[b]=ch;
    a++;
    b--;
  }
  /*
  for(i=a;i<=b;i++)
    tmp[i]=str[i];

  for(i=a;i<=b;i++)
    str[i]=tmp[i];
  */
}

void Replace(char *str){
  int i,a,b;
  char q[1001];

  scanf("%d %d",&a,&b);
  scanf("%s",q);

  for(i=a;i<=b;i++)
    str[i]=q[i-a];
}

Measured memory_bytes: 576
Scanf.scanf "%d" (fun x ->
    let check x i =
        let rec loop c =
            if c < -1000 then None else
                if c * c * c * c * c - (c - i) * (c - i) * (c - i) * (c - i) * (c - i) = x then Some (c, c - i)
                else loop (c - 1)
        in
        loop 1000
    in
    let rec loop i =
        if x mod i = 0 then (
            match check x i with
            | Some (a, b) -> Printf.printf "%d %d\n" a b
            | None -> loop (i + 1)
        ) else loop (i + 1)
    in
    loop 1
)

Measured memory_bytes: 3848
import std.algorithm;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main() {
  long n, k;
  readf (" %d %d", &n, &k);
  //x := abs (x - k)
  n %= k;
  n = min (n, abs (n - k));
  writeln (n);
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
string s;
int bg,en;
int main(){
    cin >> s;
    for(int i = 0; i < s.size(); ++i){
        if(s[i] == 'A'){
            bg = i;
            break;
        } 
    }
    
    for(int i = 0; i < s.size(); ++i){
        if(s[s.size()-1-i] == 'Z'){
            en = s.size()-1-i;
            break;
        } 
    }
    
    cout << en-bg+1 << endl;
}



Measured memory_bytes: 640
import math
S = int(input())

hoge = math.sqrt(S)
hoge = math.ceil(hoge)
onon = hoge ** 2 - S
hogehoge = onon
hogehoge2 = 1
for i in range(2, 10*9):
    if onon % i == 0:
        hogehoge = onon // i
        hogehoge2 = i
        break

print("0 0 " + str(hogehoge) + " " + str(hoge) + " " + str(hoge) + " " + str(hogehoge2))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <numeric>
#include <queue>
#include <stack>
#define mod 1000000007
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define srep(i,s,t) for (ll i = s; i < t; i++)
#define drep(i,n) for(ll i = (n)-1; i >= 0; i--)
using namespace std;
typedef long long ll;
typedef vector<vector<char>> field_t;
typedef unsigned long long ull;
typedef pair<ll, ll> point_t;


int main()
{
    ll a;
    cin >> a;
    if(a==1){
        cout << 3<< endl;
        return 0;
    }
    ull ans=a*(a*a*a-1)/(a-1);
    cout << ans<< endl;
    return 0;
}

Measured memory_bytes: 3544
//Love and Freedom.
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#define ll long long
#define inf 20021225
#define N 1000100
using namespace std;
int read()
{
	int s=0,t=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')	t=-1; ch=getchar();}
	while(ch>='0' && ch<='9')	s=s*10+ch-'0',ch=getchar();
	return s*t;
}
char ch[N]; int a[N],n;
int C(int n,int m){return n>=m?1:0;}
int lucas(int n,int m){if(!n||!m) return C(n&1,m&1); if(!C(n&1,m&1))	return 0; return lucas(n>>1,m>>1);}
int main()
{
	n=read(); scanf("%s",ch+1);
	for(int i=1;i<=n;i++)	a[i]=ch[i]-'1';
	int tot=0,wei=0;
	for(int i=1;i<=n;i++)	if(a[i]==1)	tot^=lucas(n-1,i-1),wei=1;
	if(tot)	return puts("1"),0;
	if(wei)	return puts("0"),0;
	for(int i=1;i<=n;i++)	a[i]>>=1;
	for(int i=1;i<=n;i++)	if(a[i]==1)	tot^=lucas(n-1,i-1),wei=1;
	if(tot)	return puts("2"),0;
	puts("0");
	return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
typedef long long lint;
const int N=1e5+5;
int n,m;
struct data{
	int c,t;
	friend bool operator < (const data &a,const data &b){
		return a.t<b.t;
	}
}dp[N][11];

namespace utils{
	template <class T> inline void apn(T &x,const T y){x=x<y?x:y;}
	template <class T> inline void apx(T &x,const T y){x=y<x?x:y;}
	inline int nxi(){
		int x=0;
		char c;
		while(((c=getchar())>'9'||c<'0')&&c!='-');
		const bool f=(c=='-')&&(c=getchar());
		while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
		return f?-x:x;
	}
}
using namespace utils;

namespace G{
	int cnt,fir[N];
	struct edge{
		int to,nx;
	}eg[N<<1];

	inline void add(const int a,const int b){
		eg[++cnt]=(edge){b,fir[a]};
		fir[a]=cnt;
	}

	void solve(){
		for(int d=10; d; --d){
			for(int i=1; i<=n; ++i){
				const data cur=dp[i][d];
				for(int j=fir[i]; j; j=eg[j].nx){
					const int y=eg[j].to;
					apx(dp[y][d-1],cur);
				}
			}
		}
	}
}

int main(){
#ifdef LOCAL
	freopen("paint.in","r",stdin);
	freopen("paint.out","w",stdout);
#endif
	n=nxi(),m=nxi();
	for(int i=1; i<=m; ++i){
		const int a=nxi(),b=nxi();
		G::add(a,b);
		G::add(b,a);
	}
	for(int q=nxi(),i=1; i<=q; ++i){
		const int x=nxi(),d=nxi(),c=nxi();
		apx(dp[x][d],(data){c,i});
	}
	G::solve();
	for(int i=1; i<=n; ++i){
		data res=(data){0,0};
		for(int j=0; j<=10; ++j){
			apx(res,dp[i][j]);
		}
		printf("%d\n",res.c);
	}
	return 0;
}


Measured memory_bytes: 11136
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// ここまで

fn run() {
    input! {
        n: usize,
        s: String,
    }
    if n >= 3200 {
        println!("{}", s);
    } else {
        println!("red");
    }
}

fn main() {
    run();
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define MAX 1000001
#define M 1000000007
#define ll long long
#define ld long double

// #define left (2*i+1)
// #define right (2*i+2)
// #define mid ((l+r)>>1)

using namespace std;

int val;
int cn;

int getVal(int x) {
	cn++;
	// cout << cn << endl;
	cout << x << endl;
	fflush(stdout);
	string s;
	cin >> s;
	if (s=="Male") val = 0;
	else if (s=="Female") val = 1;
	else val = 2;
	return 0;
}

int bs(int l, int r, int gl, int gr) {
	// cout << l << " " << r << endl;
	// if (l==r) return l;
	if (r-l==2) return l+1;
	int mid = (l+r)>>1;
	if (mid&1) mid--;
	
	getVal(mid);
	if (val==2) return -1;

	if (val==gl) return bs(mid, r, val, gr);
	else return bs(l, mid, gl, val);
}

int main() {
	int n;
	cin >> n;
	int l = 0, r = n-1;
	getVal(l);
	int gl = val;
	if (gl==2) {
		return 0;
	}
	getVal(r);
	int gr = val;
	if (gr==2) {
		return 0;
	}

	int res = bs(0, n-1, gl, gr);
	if (res!=-1) {
		getVal(res);
	}
	return 0;
}

Measured memory_bytes: 852
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int x = Integer.parseInt(sc.next());
        List<Integer[]> a = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            Integer[] array = new Integer[m + 1];
            array[0] = Integer.parseInt(sc.next());
            for (int j = 1; j <= m; j++) {
                array[j] = Integer.parseInt(sc.next());
            }
            a.add(array);
        }
        sc.close();

        // 主処理
        List<List<Integer>> combinationList = new ArrayList<>();
        for (int i = 0; i < Math.pow(2, n); i++) {
            List<Integer> list = new ArrayList<>();
            for (int j = 0; j < n; j++) {
                if ((1 & i >> j) == 1) {
                    list.add(j);
                }
            }
            combinationList.add(list);
        }

        int min = Integer.MAX_VALUE;
        for (List<Integer> comb : combinationList) {
            int amount = 0;
            int[] score = new int[m];
            for (int index : comb) {
                amount += a.get(index)[0];
                for (int i = 0; i < m; i++) {
                    score[i] += a.get(index)[i + 1];
                }
            }
            int size = Arrays.stream(score).filter(i -> x <= i).toArray().length;
            if (m == size) {
                min = Math.min(min, amount);
            }
        }

        int result = min == Integer.MAX_VALUE ? -1 : min;

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


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

using namespace std;
const double inf = 1e100;

int n, m;
bool G[600][600];
int C[600];
double P[600];
double E[600];
int main() {
  scanf("%d %d", &n, &m);
  for (int j = 0; j < m; ++j) {
    int a, b;
    scanf("%d %d", &a, &b);
    --a; --b;
    G[a][b] = true;
    ++C[a];
  }
  
  P[0] = 1;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      if (!G[i][j]) continue;
      P[j] += P[i] / C[i];
    }
  }
  
  for (int i = n - 2; i >= 0; --i) {
    double sum = 0;
    for (int j = i + 1; j < n; ++j) {
      if (!G[i][j]) continue;
      sum += E[j];
    }
    E[i] = sum / C[i] + 1;
  }
  
  double mn = 0;
  for (int i = 0; i < n; ++i) {
    if (C[i] <= 1) continue;
    for (int j = i + 1; j < n; ++j) {
      if (!G[i][j]) continue;
      double ans = P[i] * (E[i] - E[j] - 1) / (C[i] - 1);
      mn = min(mn, ans);
    }
  }
  printf("%.16f", E[0] + mn);
}


Measured memory_bytes: 640
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val a = sc.nextInt()
    val b = sc.nextInt()
    val c = sc.nextInt()
    val k = sc.nextLong()

    var ans = a - b
    if (k % 2 != 0L) {
        ans *= -1
    }
    println(ans)
}


Measured memory_bytes: 29604
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);


int main() {
    int n, k;
    cin >> n >> k;
    int ans = 0;
    for (int i = 1; i <= n; i += 2) ans++;
    if (ans >= k || k == 1) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
 
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  rep(i,n) a[i]--;
  vector<int> b(n);
  rep(i,n) cin >> b[i];
  vector<int> c(n-1);
  rep(i,n-1) cin >> c[i];
  
  int man = 0;
  rep(i,n){
    man += b[i];
  }
  rep(i,n-1){
    if(a[i]+1==a[i+1]) man += c[a[i]];
  }
  cout << man << endl;
}

Measured memory_bytes: 256
/*
勉強させて頂いた解説
https://scrapbox.io/pocala-kyopro/B_-_Kleene_Inversion
*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;

const ll LongINF=1e13+7;
const ll INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
template<class T,class Y>T LCM(T a,Y b){return (a*b)/GCD(a,b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

using vi=vector<int>;
using vii=vector<vi>;

#define REP(i,a,b) for(ll i=(a);i<(b);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define rv reverse
#define ALL(a) (a).begin(),(a).end()
#define decimal(x) fixed<<setprecision(x)

//modのとり方には注意

int main(){
    ll n,k;
    cin>>n>>k;
    vi a(n);
    rep(i,n)cin>>a[i];
    ll sum=0;
    rep(i,n){
        ll cnt1=0,cnt2=0;
        REP(j,i,n){
            if(a[i]>a[j])cnt2++;
        }
        rep(j,n){
            if(a[i]>a[j])cnt1++;
        }
        //cout<<"cnt:"<<cnt<<endl;
        sum+=(k*(k-1)/2)%INF*cnt1%INF;
        sum%=INF;
        sum+=cnt2*k%INF;
        sum%=INF;
    }
    cout<<sum<<endl;
    return 0;
}

//a=97,z=122

Measured memory_bytes: 3620
H, W = map(int, input().split())
board = [list(input()) for i in range(H)]

skip_col = [False] * W
for i in range(len(board[0])):
    for j in range(H):
        if board[j][i] == '#':
            break
    else:
        skip_col[i] = True

for i in range(H):
    if all([c == '.' for c in board[i]]):
        continue
    for j in range(W):
        if skip_col[j]:
            continue
        print(board[i][j], end='')
    print('')

Measured memory_bytes: 4596
N = gets.to_i
ts = gets.split.map(&:to_i)
M = gets.to_i

pxs = readlines.map { |l| l.split.map(&:to_i) }
pxs.each do |p, x|
  copy = ts.dup
  copy[p - 1] = x
  puts copy.inject(:+)
end

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

int main() {

    int N;
    cin >> N;
    ll ans = 0;
    for(int i = 1; i<N; i++){
        ans += i;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,a,b,sum=0,total=0;
	cin>>n>>a>>b;
	sum+=a*n;
	total+=b;
	if(sum<=total)
	  cout<<sum;
	else
	  cout<<total;
	return 0;
} 

Measured memory_bytes: 384
#ifndef LOCAL
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#else
#include <iostream>
#include <iomanip> 
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <memory>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; } sim > auto dud(c* x) -> decltype(cerr << *x, 0); sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; } eni(!=) cerr << boolalpha << i; ris; } eni(==) ris << range(begin(i), end(i)); } sim, class b dor(pair < b, c > d) { ris << "(" << d.first << ", " << d.second << ")"; } sim dor(rge<c> d) { *this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]"; }
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

template<typename T> void setmax(T& x, T y) {x = max(x, y);}
template<typename T> void setmin(T& x, T y) {x = min(x, y);}
#define fix(a) fixed << setprecision(a)
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'


void solve(){ 
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  forn(i,n) cin >> a[i];
  sort(all(a));
  vector<pair<int,int>> b(m);
  ll cnt = 0;
  forn(i,m){
    int x, y;
    cin >> x >> y;
    b[i] = {y,x};
    cnt += (ll) x;
  }
  sort(rall(b));
  int j = 0;
  int i = 0;
  while (i < n){
    if (j < m and a[i] < b[j].ff){
      a[i] = b[j].ff;
      b[j].ss--;
      if (!b[j].ss) j++;
    }
    i++;
  }

  ll ans = 0;
  forn(i,n) ans += (ll) a[i];

  cout << ans << endl;

}

int main() {
  ios::sync_with_stdio(false);
  int t = 1;
  // cin >> t;
  forn(i, t){
    solve();
  }
}

/* 



*/

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main(){
  vector<int> a(3);
  for(int i=0;i<3;i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  if(a[0]==a[1]){
    if(a[0]==a[2])cout<<1<<endl;
    else cout<<2<<endl;
  }else{
    if(a[1]==a[2])cout<<2<<endl;
    else cout<<3<<endl;
  }
}
  

Measured memory_bytes: 256
#include <iostream>
#include <string>

int main(){
    std::string s, t;
    std::cin >> s >> t;
    int count = 0;

    if (s[0] == t[0])
    {
        count++;
    }
    if (s[1] == t[1])
    {
        count++;
    }
    if (s[2] == t[2])
    {
        count++;
    }

    std::cout << count << std::endl;

    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
typedef long long ll;
const ll MOD=1e+9+7;
struct mint{
  ll x;
  mint(ll x=0):x(x%MOD){}
  mint& operator+=(const mint a){
    if((x+=a.x)>=MOD) x-=MOD;
    return *this;
  }
  mint& operator-=(const mint a){
    if((x += MOD-a.x)>=MOD) x-=MOD;
    return *this;
  }
  mint& operator*=(const mint a){
    (x*=a.x)%=MOD;
    return *this;
  }
  mint operator+(const mint a) const{
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const{
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const{
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const{
    if(!t) return 1;
    mint a = pow(t>>1);
    a*=a;
    if(t&1) a*=*this;
    return a;
  }
  
  //for prime mod
  mint inv() const{
    return pow(MOD-2);
  }
  mint& operator/=(const mint a){
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const{
    mint res(*this);
    return res/=a;
  }
};

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

ll lcm(ll a,ll b){
  return a*b/gcd(a,b);
}

template <typename X>
struct Number{
  X n;
  vector<bool> prime;
  
  Number(X _n)
  {
    n = _n;
  }
  
  //nの約数を全列挙
  vector<X> divisor()
  {
    vector<X> res(0);
    for(X i=1;i*i<=n;++i){
      if(n%i==0){
	res.push_back(i);
	if(i != n/i) res.push_back(n/i);
      }
    }
    sort(res.begin(), res.end());
    return res;
  }
  
  //nを素因数分解
  map<X,int> prime_factor()
  {
    int nn = n;
    map<X,int> res;
    for(X i=2;i*i<=nn;++i){
      while(nn%i==0){
	res[i]++;
	nn /= i;
      }
    }
    if(nn!=1) res[nn] = 1;
    return res;
  }

  //n以下の素数を全列挙
  vector<X> sieve()
  {
    prime.assign(n+1,true);
    vector<X> res(0);
    if(n<=1) return res;
    prime[0] = prime[1] = false;
    for(X i = 2;i<=n;++i){
      if(prime[i]){
	res.push_back(i);
	X b = i*2;
	while(b<=n){
	  prime[b] = false;
	  b += i;
	}
      }
    }
    return res;
  }
  
};



int main()
{
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n){
    cin >> a[i];
  }

  map<ll,int> mp;
  rep(i,n){
    Number<ll> nb(a[i]);
    map<ll,int> pf = nb.prime_factor();
    for(auto it=pf.begin();it!=pf.end();++it){
      if(mp[it->first]<=it->second){
	mp[it->first] = it->second;
      }
    }
  }

  mint g(1);
  for(auto it=mp.begin();it!=mp.end();++it){
    rep(i,it->second){
      g *= (mint)it->first;
    }	
  }
  
  mint res;
  rep(i,n){
    mint tmp = g;
    tmp /= (mint)a[i];
    res += tmp;
  }

  cout << res.x << "\n";
  
  return 0;
}


Measured memory_bytes: 896
program main
  implicit none

1 format(i0)
  
  integer dish(1:5),tmp1,tmp2,tmp3, i, j,k
  
  read(*,*) dish(1)
  read(*,*) dish(2)
  read(*,*) dish(3)
  read(*,*) dish(4)
  read(*,*) dish(5)
  
  tmp1 = 10
  k = 0
  do i=1,5
     tmp2 = mod(dish(i),10)
     if (tmp2 /= 0 .and. tmp2 < tmp1) then
        tmp1 = tmp2
        k = i
     end if
  end do
  
  tmp2 = 0
  if (tmp1 == 10) then
     do i=1,5
        tmp2 = tmp2 + dish(i)        
     end do
  else
     do i=1,5
        if (i==k) cycle
        if (mod(dish(i),10) == 0) then
           tmp2 = tmp2 + dish(i)
        else
           tmp2 = tmp2 + (dish(i) / 10 + 1) * 10 
        end if
     end do
     tmp2 = tmp2 + dish(k)
  end if
  
  write(*,1) tmp2
  
end program main
  
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <bits/stdc++.h>
#define ll          long long
#define vl          vector<ll>
#define vi          vector<int>
#define pi          pair<int,int>
#define pl          pair<ll,ll>
#define all(a)      a.begin(),a.end()
#define mem(a,x)    memset(a,x,sizeof(a))
#define pb          push_back
#define mp          make_pair
#define F           first
#define S           second
#define trace(x)     cerr<<#x<<":"<<x<<endl;
#define trace2(x,y) cerr<<#x<<":"<<x<<"|"<<#y<<":"<<y<<endl;
#define trace3(x,y,z) cerr<<#x<<":"<<x<<"|"<<#y<<":"<<y<<"|"<<#z<<":"<<z<<endl;
#define fast_io     std::ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)

int main() {
	fast_io;
	ll a,b,c;
	cin>>a>>b>>c;
	ll d = (c-b-a);
	// trace(d)
	if(d<=0){cout<<"No";return 0;}
	ll ds = d*d;
	ll ab = a*b;
	ab*=4;
	if(ds>ab){
		cout<<"Yes";
	}else cout<<"No";
    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)

readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))


class UnionFind:
    # 初期化
    def __init__(self, n):
        # 根なら-size, 子なら親の頂点
        self.par = [-1] * n
        # 木の高さ
        self.rank = [0] * n

    # 検索
    def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        # 異なる集合に属する場合のみ併合
        if x != y:
            # 高い方をxとする。
            if self.rank[x] < self.rank[y]:
                x,y = y,x
            # 同じ高さの時は高さ+1
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            # yの親をxとし、xのサイズにyのサイズを加える
            self.par[x] += self.par[y]
            self.par[y] = x

    # 同集合判定
    def same(self, x, y):
        return self.find(x) == self.find(y)

    # 集合の大きさ
    def size(self, x):
        return -self.par[self.find(x)]

n,m = readints()

a = readints()

u = UnionFind(n)
for i in range(m):
    x,y = readints()
    u.unite(x,y)

for i in range(n):
    u.find(i)

b = {}
for i in range(n):
    if u.par[i]<0:
        b[i] = (a[i],i)

for i,p in enumerate(u.par):    
    if p>=0 and b[p][0]>a[i]:
        b[p] = (a[i],i)

for v in b.values():
    a[v[1]]=10**10

a.sort()
if len(b)==1:
    print(0)
elif n < len(b)*2-2:
    print('Impossible')
else:
    print(sum([x[0] for x in b.values()]) + sum(a[:len(b)-2]))


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

using namespace std;
using ll = long long;

#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define REP(i,n) FOR(i, 0, n)
#define FORD(i,a,n) for(int i=(a); i>=(n); i--)
#define REPD(i,n) FOR(i, n, 0)

#define ALL(o) (o).begin(), (o).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T, vector<T>, greater<T> >;

const int mod = 1000000007;
// typedef long long ll;

struct mint {
	ll x;
	mint(ll x = 0): x( (x % mod + mod) % mod) {}
	mint operator-() const { return mint(-x); }
	mint& operator+=(const mint a) {
		if((x += a.x) > mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if((x += mod-a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod; 
		return *this;
	}
	mint operator+(const mint a) const { return mint(*this) += a; }
	mint operator-(const mint a) const { return mint(*this) -= a; }
	mint operator*(const mint a) const { return mint(*this) *= a; }
	mint pow(ll t) const {
		if(!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if(t&1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const { return pow(mod-2); }
	mint& operator/=(const mint a) { return *this *= a.inv(); }
	mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(istream& os, const mint& a) { return os << a.x; }


mint choose(int n, int a) {
	mint x = 1, y = 1;
	REP(i, a) {
		x *= (n-i);
		y *= i+1;
	}
	return x / y;
}

int main() {
	ll n,a,b;
	cin >> n >> a >> b;

	mint ans = mint(2).pow(n) - 1;
	ans -= choose(n, a);
	ans -= choose(n, b);
	cout << ans.x << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;

const int INF = 1001001001;

int main(){
    int N;
    int A[1000] = {0};
    cin >> N;
    rep(i,N){
        cin >> A[i];
    }

    bool b = true;
    rep(i,N){
        if(A[i] % 2 == 0){
            if(!(A[i] % 3 == 0 || A[i] % 5 == 0)){
                b = false;
            }
        }
    }
    if(b){
        cout << "APPROVED" << endl;
    }else{
        cout << "DENIED" << endl;
    }
}

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

long long int n,d,k,sa,res=9999,l,r;
long long int used[100005]={},x[11][11];
queue<long long int> qu[100005];

int main() {
    const long long int mod = 1000000007,INF=99999999999999;
	map<long long int, long long int>mp;
    string str[2005],tmp;
	cout << fixed << setprecision(10);
    cin>>l>>r;
    
    for(long long int i=l;i<=r;i++){
        if(i%2019==0){
            cout<<0;
            return 0;
        }
    }

    for(long long int i=l;i<=r;i++){
        for(long long int j=i+1;j<=r;j++ ){
            res=min(res,((i%2019)*(j%2019))%2019);
        }
    }
    cout<<res;
} 


Measured memory_bytes: 67968
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define endl "\n"

int main ()
{
	
	ios_base::sync_with_stdio(false);
 	cin.tie(NULL);
 	#define int ll
 	   
	int n;
	cin >> n;
	
	vector <int> a(n), b(n);
	for (int i=0; i<n; i++){
	    cin >> a[i] >> b[i];
	}
	
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	
	if (n&1) cout << b[n/2] - a[n/2] + 1<< endl;
	else{
	    int median1 = (a[n/2-1] + a[n/2]);
	    int median2 = (b[n/2-1] + b[n/2]);
	    cout << (median2 - median1) + 1 << endl;
	}
     
     
	return 0;
	
}


Measured memory_bytes: 6368
#include<iostream>
#include <iomanip>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cstdlib>

using namespace std;
int main(){

  int n;
  cin >> n;

  int taro_sum=0,hana_sum=0;

  for(int i=0;i<n;i++){
    string taro,hana;

    cin >> taro >> hana;

    int mini =  min(taro.size(),hana.size());

    bool eq = true;
    for(int j=0;j<mini;j++){
      if((int)taro[j] > (int)hana[j]){
        taro_sum += 3;
        eq = false;
        break;
      }else if((int)taro[j] < (int)hana[j]){
        hana_sum+=3;
        eq = false;
        break;
      }
    }
    if(eq == true){
      if(taro.size() < hana.size()){
        hana_sum+=3;
      }else if(taro.size() > hana.size()){
        taro_sum += 3;
      }else{
        taro_sum += 1;
        hana_sum += 1;
      }

    }
  }
  cout << taro_sum << " " << hana_sum << endl;
}


Measured memory_bytes: 3164
from sys import stdin


def main():
    _ = int(stdin.readline().rstrip())
    As = [int(x) for x in stdin.readline().rstrip().split()]
    Bs = [int(x) for x in stdin.readline().rstrip().split()]
    Cs = [int(x) for x in stdin.readline().rstrip().split()]
    result = 0
    tmp = -1
    for A in As:
        result += Bs[A - 1]
        if tmp + 1 == A:
            result += Cs[tmp - 1]
        tmp = A
    print(result)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
from heapq import heappush,heappop
import queue
import re
import math
import functools
import numpy

def int_raw():
    return int(input())

def ss_raw():
    return input().split()

def ints_raw():
    return list(map(int, ss_raw()))

INF = 1<<29

def make1d_arr(n,val=INF):
    return [val for i in range(n)]

def make2d_arr(h,w,val =INF):
    return [[val for i in range(w)]for i in range(h)]

def gcd (a,b):
    if(b==0):
        return a
    return gcd(b,a%b)


N = int_raw()
As = ints_raw()


def main():
    f_gcds = [As[0]]
    for i in range(1,N):
        f_gcds.append(gcd(As[i],f_gcds[-1]))
    b_gcds = [0]*(N-1)+[As[-1]]
    for i in range(N-2,-1,-1):
        b_gcds[i] = gcd(As[i],b_gcds[i+1])
    ans = max(b_gcds[1],f_gcds[-2])
    for i in range(1,N-1):
        ans = max(ans,gcd(f_gcds[i-1],b_gcds[i+1]))
    return ans

print(main())


Measured memory_bytes: 23160