akhauriyash/Code-Regression huggingface dataset:
# # Make IO faster
# import sys
# input = sys.stdin.readline

# # get single (or) multiple str
# X = input()

# # get single int
# N = int(input())
# # get multiple int (e.g., 2)
# X, Y = map(int, input().split())
# # get multiple int (e.g., 2) for N lines
# XY = [list(map(int, input().split())) for _ in range(N)]

# from IPython import embed; embed(); exit();

# 全部入り
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

X, t = MAP()
print(max([X - t, 0]))


Measured memory_bytes: 27060
// 以下のソースを勉強する.
// zscoder氏.
// https://atcoder.jp/contests/dp/submissions/3937470
#include <bits/stdc++.h>
using namespace std;
 
double P[3333];
double dp[3333][3333];

int main(){
    
    // 1. 入力情報取得.
    int N;
    scanf("%d", &N);
    for(int i = 1; i <= N; i++) scanf("%lf", &P[i]);
    
    // 2. dp更新.
    dp[0][0]=1;
    for(int i = 1;i <= N; i++){
        for(int j = 0; j <= i; j++){
            dp[i][j] = dp[i - 1][j] * (1.00000 - P[i]);
            if(j > 0) dp[i][j] += dp[i - 1][j - 1] * P[i];
        }
    }
    // for(int i = 0; i <= N; i++){
    //     for(int j = 0; j <= i; j++) printf("%f ", dp[i][j]);
    //     printf("\n");
    // }
    
    // 3. 出力.
    double ans = 0.0;
    for(int i = 0; i <= N; i++) if(i > N - i) ans += dp[N][i];
    printf("%.12f\n", ans);
    return 0;
}

Measured memory_bytes: 78464
// abc134_f
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

template <int mod>
struct mint {
    ll x;
    mint(ll x=0):x(x%mod){}
    mint(const mint& m):x(m.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 { 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; }
    bool operator==(const mint a) const { return x == a.x;}
    bool operator==(const ll a) const { return x == a;}
    bool operator==(const int a) const { return x == a;}
    bool operator!=(const mint a) const { return x != a.x;}
    bool operator!=(const ll a) const { return x != a;}
    bool operator!=(const int a) const { return x != a;}
    explicit operator bool() const {return x>0;}

    mint pow(ll t) const {mint r=1,a=*this; do{if(t&1)r*=a;a*=a;}while(t>>=1);return r;}
    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; }
};
template <int mod> ostream& operator<<(ostream& os, const mint<mod>& m) {cout << m.x; return os;}


mint<MOD> dp[51][51][2605];

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int N, K;
    cin >> N >> K;

    dp[0][0][0] = 1;
    REP(i, N){
        REP(j, i+1){
            REP(k, K+1){
                int nj;
                // どっちも保留
                nj = j + 1;
                dp[i+1][nj][k+2*nj] += dp[i][j][k];

                // どっちもi+1同士でつなぐ
                nj = j;
                dp[i+1][nj][k+2*nj] += dp[i][j][k];

                // どっちかを保留とつなぐ
                nj = j;
                dp[i+1][nj][k+2*nj] += dp[i][j][k] * 2*j;

                // どっちも保留とつなぐ
                if (j > 0){
                    nj = j-1;
                    dp[i+1][nj][k+2*nj] += dp[i][j][k] * j * j;
                }
            }
        }
    }

    print(dp[N][0][K]);




    return 0;
}


Measured memory_bytes: 53248
from collections import deque

def bfs():
    reg = [[0] * w for _ in range(h)]    
    for i in range(h):
        for j in range(w):
            d = [[float("inf")] * w for _ in range(h)]
            que = deque([])
            res = 0
            if field[i][j] == ".":
                sx = i
                sy = j
                que.append([sx, sy])
                d[sx][sy] = 0
                
                dx = [0, 1, 0, -1]
                dy = [1, 0, -1, 0]
    
                while len(que) != 0:
                    p = que.popleft()

                    for k in range(4):
                        nx = p[0] + dx[k]
                        ny = p[1] + dy[k]

                        if 0 <= nx < h and 0 <= ny < w and field[nx][ny] != "#" and d[nx][ny] == float("inf"):
                            que.append([nx, ny])
                            d[nx][ny] = d[p[0]][p[1]] + 1
                            res = max(res, d[nx][ny])
                reg[sx][sy] = res
    global ans
    for i in range(h):
        for j in range(w):
            ans = max(ans, reg[i][j])


h, w = map(int, input().split())
field =[list(input()) for _ in range(h)]
ans = 0
bfs()

print(ans)

Measured memory_bytes: 3316
#define _USE_NATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <random>
#include <tuple>


using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
#define EPS 1e-9
const int INF = 1050000000;
const long long LINF = 1LL << 60;
const ll MOD = 1e9 + 7;
const int MINF = -1050000000;



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

	ll ans = 1;
	ll cnt = 0;
	while(1) {
		if (b - a >= 2 && k-cnt>=2 && ans >= a) {
			ans += (b - a);
			cnt += 2;
		}
		else {
			ans += 1;
			cnt++;
		}
		if (cnt == k) break;
	}


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


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#define MAX_P 20

using namespace std;

/*〜概要〜
  binary_numにより，人iが正しいかどうかをtrue_personに格納する．
  例えば，i=20回目のループを考える．
  20は2進数で00101(左から数える)であり，これは
  人1が嘘つき，人2が嘘つき，人3は正直，人4は嘘つき，人5は正直
  であることを示しており，それをi=0からi=2^N-1まで繰り返すことにより
  全パターンを探索することができる．
*/

//引数numを2進数に直して配列true_personに左から格納する
void binary_num(int num, int N, int true_person[]){
  int i=1;
  while(num != 0){
    true_person[i] = num%2;
    i++;
    num /= 2;
  }
}


//true_person配列を参照することで，正直者の人数を返す関数
int honest_count(int true_person[], int N){
  int count = 0;
  for(int i=1; i<=N; i++)
    if(true_person[i] == 1)
      count++;
  return count;
}


int check(int x[MAX_P][MAX_P], int y[MAX_P][MAX_P], int A[],
		 int N, int true_person[]){
  int i, j;
  for(i=1; i<=N; i++){
    if(true_person[i] == 1){
      for(j=1; j<=A[i]; j++){
	if(y[i][j] != true_person[ x[i][j] ]){
	  return -1;
	}
      }
    }
  }
  int honest_num = honest_count(true_person, N);;
  return honest_num;
}


int main(void){
  int N, i, j;
  cin >> N;
  int A[N];
  int x[MAX_P][MAX_P], y[MAX_P][MAX_P];
  for(i=1; i<=N; i++){ //入力
    cin >> A[i];
    for(j=1; j<=A[i]; j++)
      cin >> x[i][j] >> y[i][j];
  }

  //人iが正しいかどうか(正しいなら1，そうでないなら0)
  int true_person[MAX_P];
  
  /*binary_numにより，人iが正しいかどうかをtrue_personに格納する．
    例えば，i=20回目のループを考える．
    20は2進数で00101(左から数える)であり，これは
    人1が嘘つき，人2が嘘つき，人3は正直，人4は嘘つき，人5は正直
    であることを示しており，それをi=0からi=2^N-1まで繰り返すことにより
    全パターンを探索することができる．
   */
  int count_max = 0;
  int count;
  for(i=0; i<pow(2, N); i++){
    binary_num(i, N, true_person);    
    count = check(x, y, A, N, true_person);
    if(count_max < count)
      count_max = count;
  }

  cout << count_max << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
		while(1){
			int x[10][10],i,j,sum1[10]={},sum2[10]={},sum3=0;
	int n;
	scanf("%d",&n);
	if(n==0) break;
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			scanf("%d",&x[i][j]);
		}}
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			sum1[i]+=x[i][j];
		}}
	for(i=0;i<n;i++){
		sum3+=sum1[i];
	}
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			sum2[j]+=x[i][j];
		}}
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			printf("%5d",x[i][j]);
		}
			printf("%5d\n",sum1[i]);
	}
		printf("%5d",sum2[0]);
			for(i=1;i<n;i++){
				printf("%5d",sum2[i]);
			}
			printf("%5d\n",sum3);
	}
		return 0;
}

Measured memory_bytes: 612
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
#include<set>
#include<vector>
#include<sstream>
#include<queue>
constexpr auto INF = 9223372036854775807;
typedef long long int ll;
typedef unsigned long long int ull;
typedef unsigned long int ul;

using namespace std;
vector<int> a;
int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n,m;
	cin >> n >> m;
	int ans = (n * (n - 1) / 2) + (m * (m - 1) / 2);
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env ruby
n = STDIN.readline.strip.to_i
v = STDIN.readline.strip.split(' ').map(&:to_i)
o = {}
e = {}
for i in 0..(n/2-1) do
  e[v[i*2]] = e[v[i*2]].nil? ? 1 : e[v[i*2]]+1
  o[v[i*2+1]] = o[v[i*2+1]].nil? ? 1 : o[v[i*2+1]]+1
end
e_s = e.sort_by{|k, _v| _v}.reverse
o_s = o.sort_by{|k, _v| _v}.reverse

def find_max(a, b)
  max_a = a[0][1]
  max_b = 0
  i = 0
  while i < a.length and a[i][1] == max_a do 
    max_i_b = a[i][0] != b[0][0] ? b[0][1] : b.length == 1 ? 0 : b[1][1]
    max_b = max_i_b if max_b < max_i_b
    i += 1
  end
  max_a + max_b
end
        
# puts "e_s: [0]: #{e_s[0]}, [1]: #{e_s[1]}"
# puts "o_s: [0]: #{o_s[0]}, [1]: #{o_s[1]}"
max_e = find_max(e_s, o_s)
max_o = find_max(o_s, e_s)
m = [max_e, max_o].max
# puts "max_e:#{max_e}, max_o:#{max_o}, m: #{m}"
puts n - m


Measured memory_bytes: 21496
S=list(input())
A=[];p=753
N=len(S)
for i in range(N-2):
  A.append(S[i]+S[i+1]+S[i+2])
#print(A)
for i in range(len(A)):
  p=min(p,abs(int(A[i])-753))
print(p)

Measured memory_bytes: 2940
import java.util.*;
public class Main{
	public static void main(String args[]){
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
       
      
      int[][] arr = new int[3][n];
      for(int i=0;i<n;i++){
          arr[0][i]=in.nextInt();
          arr[1][i]=in.nextInt();
          arr[2][i]=in.nextInt();
      }
      
      int[][] dp = new int[3][n];
      
      dp[0][0]=arr[0][0];
      dp[1][0]=arr[1][0];
      dp[2][0]=arr[2][0];
      
      for(int i=1;i<n;i++){
         
         dp[0][i]=arr[0][i] + Math.max(dp[1][i-1], dp[2][i-1]);
         dp[1][i]=arr[1][i] + Math.max(dp[0][i-1], dp[2][i-1]);
         dp[2][i]=arr[2][i] + Math.max(dp[0][i-1], dp[1][i-1]);

      }
      
      int ans = Math.max(Math.max(dp[0][n-1], dp[1][n-1]),dp[2][n-1]);
      System.out.print(ans);
      
      
	}
}

Measured memory_bytes: 94940
from math import sin
from math import cos
from math import pi

class point():
   def __init__(self,_x,_y):
       self.x = _x
       self.y = _y

def kock (n, p1, p2):
    if n == 0:
        return
    s = point((2. * p1.x + 1. * p2.x) / 3., (2. * p1.y + 1. *p2.y) / 3.)
    t = point((1. * p1.x + 2. * p2.x) / 3., (1. * p1.y + 2. *p2.y) / 3.)
    u = point((t.x - s.x) * cos(pi / 3.) - (t.y - s.y) * sin(pi / 3.) + s.x, (t.x - s.x) * sin(pi / 3.) + (t.y - s.y) * cos(pi / 3) + s.y)

    kock(n - 1, p1, s)
    print '%s %s' % (str(s.x), str(s.y))
    kock(n - 1, s, u)
    print '%s %s' % (str(u.x), str(u.y))
    kock(n - 1, u, t)
    print '%s %s' % (str(t.x), str(t.y))
    kock(n - 1, t, p2)

n = input();

p1 = point(0., 0.)
p2 = point(100., 0.)

print '%s %s' % (str(p1.x), str(p1.y))
kock(n, p1, p2)
print '%s %s' % (str(p2.x), str(p2.y))

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

res = 0
for i in range(len(a)):
    if i %2 == 0:
        res += a[i]
    else:
        res -= a[i]

r_0 = res/2
rs = [r_0]
for i in range(1, N)[::]:
    r = a[i-1] - rs[i - 1]
    rs.append(r)

ans = ""
for r in rs:
    ans += str(int(2*r)) + " "
print(ans)

Measured memory_bytes: 14028
import Foundation

func readInts() -> [Int] {
    readLine()!.split(separator: " ").map { Int($0)! }
}

func main(){
    let av = readInts()
    let bw = readInts()
    let t = Int(readLine()!)!
    
    if abs(av[0] - bw[0]) <= t * (av[1] - bw[1]) {
        print("YES")
        return
    }
    print("NO")
        
}
main()


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

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef pair<ll,ll> pll;

const ll mod=998244353;
const int nmax=100005;

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




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

 int n;
  cin >> n;
 
 if(n%2) cout << n/2 << endl; 
 else cout << (n-1)/2 << endl;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define DB double
#define PI 3.14159265358979
#define MOD 1000000007
#define ERR 0.00000000000001
#define NUM 200010

int main(){
    LL z = 100, y = 0, x;
    scanf("%lld",&x);
    while(z<x){
        z *= 1.01; y++;
    }
    printf("%lld",y);
    return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 998244353
using namespace std;
int main() {
    string s;
    cin >> s;
    if(s.size() % 2 == 1) {
        s += '#';
    }
    for(int i = 0; i < s.size() / 2; i++) {
        if(s[2 * i] == 'h' && s[2 * i + 1] == 'i') {
            continue;
        } else {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

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

using namespace std;



class UnionFind {
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
	int num;

public:
	UnionFind(int N) : par(N, -1), num(N) { //最初は全てが根であるとして初期化
	}

	int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] < 0) return x;
		return par[x] = root(par[x]);
	}

	bool merge(int x, int y) { // xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return false; //xとyの根が同じ(=同じ木にある)時はそのまま
		if (par[ry] < par[rx]) swap(rx, ry);
		par[ry] += par[rx];
		par[rx] = ry;
		num--;
		return true; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
	}

	bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}

	int getsize(int x) { //集合のサイズを返す
		return -par[root(x)];
	}

	int getnum() { //集合の数を返す
		return num;
	}
};


int main() {
	int n, m;
	cin >> n >> m;
	UnionFind u(n);

	rep(i, m) {
		int x, y, z;
		cin >> x >> y >> z;
		u.merge(x - 1, y - 1);
	}

	cout << u.getnum() << endl;

	return 0;
}




Measured memory_bytes: 640
import java.util.Scanner;

public class Main{

    public static int Calculate(int a,String op,int b){
        int result = 0;
        switch(op){
            case "+":
                result = a + b;
                break;
            
            case "-":
                result = a - b;
                break;
            
            case "*":
                result = a * b;
                break;

            case "/":
                result = a / b;
                break;
        }
        return result;
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        String op = sc.next();
        int b = sc.nextInt();
        while(op.equals("?") == false){
            System.out.println(Calculate(a,op,b));
            a = sc.nextInt();
            op = sc.next();
            b = sc.nextInt();
        }
        //sc.close();
    }
}


Measured memory_bytes: 26360
import math
import sys
A,B=map(int, input().split())

list1=list(range(1,1001,1))

s=0
for i in list1:
    x=i//12.5
    y=i//10
    if x==A and y==B:
        print(str(i))
        s=s+1
        sys.exit()

print('-1')


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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
ll MOD = 1e9+7;
ll INF = 1e18;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }

int main(){
  ll i, j;
  ll n;
  cin >> n;
  bool judge = true;
  ll result = 0;
  ll buf = n;
  for(i = 0;buf != 0; i++){
    result += buf % 10;
    buf /= 10;
  }
  judge = (n % result == 0);

  /*
  vector<ll> a(n);
  for(i = 0; i < n; i++)
    cin >> a[i];
  //for(i = 0; i < n; i++)
    
  */
  
  
  if(judge)
    cout << "Yes" << endl;
    //cout << "YES" << endl;
    //cout << "Yay!" << endl;
  else
    cout << "No" << endl;
    //cout << "NO" << endl;
    //cout << ":(" << endl;
  
  
  //cout << result << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define f(p,n) for(ll i=p;i<n;i++)
ll exp(ll a,ll b,ll m);

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

 	
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll a1[10]={0};
	a1[a]=1,a1[b]=1;
	a1[c]=1,a1[d]=1;

	if(a1[1]==1 && a1[9]==1  && a1[7]==1 && a1[4]==1) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	
return 0;
}

ll exp(ll a,ll b,ll m)
{
	if(b==0)
	{
		return 1;
	}
	ll temp =exp(a,b/2,m);
	temp=(temp*temp)%m;
	if(b&1)
	{
		return (temp*(a%m))%m;
	}
	return temp;
}



Measured memory_bytes: 256
def resolve():
    N=int(input())
    H=list(map(int,input().split()))
    count,maxc=0,0
    for i in range(1,N):
        if H[i-1]>=H[i]:
            count+=1
        else:
            count=0
        maxc=max(count,maxc)
    print(maxc)
resolve()

Measured memory_bytes: 14252
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int m,k;
int main(){
	cin >> m >> k;
	if(k>=1<<m)cout << -1;
	else if(m==1)cout << (k==0?"0 0 1 1":"-1");
	else{
		for(int i=0;i<1<<m;i++)if(i!=k)cout << i << " ";
		cout << k << " ";
		for(int i=(1<<m)-1;i>=0;i--)if(i!=k)cout << i << " ";
		cout << k;
	}
	return 0;
}

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

int main(){
  int N;
  cin >> N;
  int n10, n1;
  n10 = N / 10;
  n1 = N % 10;
  if(n10==9) cout << "Yes";
  else if(n1==9) cout << "Yes";
  else cout << "No";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
#define for_(i, s, e) for (int i = s; i < e; i++)
#define for__(i, s, e) for (ull i = s; i < e; i++)
#define SSTR(x) static_cast<std::ostringstream&>((std::ostringstream() << std::dec << x)).str()
typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;


int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n; cin >> n;
    n += 1;
    ll ans = 0;
    for_(i, 1, n)  for_(j, 1, n) for_(k, 1, n) {
        ans += __gcd(k, __gcd(i, j));
    }
    cout << ans << endl;

    return 0;
}

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

using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define lll __int128
#define ull unsigned long long
#define fi first
#define se second
#define db double
#define ld long double
#define lld __float128

/// order_of_key, find_by_order

template<class T, class COMP>
using custom_set = tree<T, null_type, COMP, rb_tree_tag, tree_order_statistics_node_update>;

template<class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template<class T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

template<class T, class U>
using ordered_map = tree<T, U, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rnd_64(chrono::steady_clock::now().time_since_epoch().count());

int main()
{
    int n; cin >> n;
    string name[n];
    int dat[n];
    for(int i = 0; i < n; i++)
    {
        cin >> name[i] >> dat[i];
    }
    string s; cin >> s;
    int sum = 0;
    for(int i = n-1; i >= 0; i--)
    {
        if(name[i] == s)
            break;
        sum += dat[i];
    }
    cout << sum << '\n';
}






































/// shche ne vmerla Ykraina


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 1 << 21;
using pii = std::pair<int, int>;
#define SORT(v) std::sort(v.begin(), v.end())
int gcd(int M, int N) {
	if (M < N) std::swap(M, N);
	if (N == 0) return M;
	else return gcd(N, M%N);
}
int main(void) {
	int N;
	std::string s;
	
	
	std::cin >> s;
	std::stack<char> st;
	for (size_t i = 0; i < s.size(); ++i) {
		if (s[i] == 'S') {
			st.push('S');
		}
		else if(s[i]=='T'&&(st.empty()||st.top() == 'T' )){
			st.push('T');
		}
		else if(s[i] == 'T' && st.top() == 'S'){
			st.pop();
		}
	}
	std::cout << st.size() << std::endl;
	return 0;
}

Measured memory_bytes: 644
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import _collections
import string

class cin():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def mapInt():
        return [int(x) for x in cin.string().split()]
    def stringList(n):
        return [input() for i in range(n)]
    def intListList(n):
        return [cin.mapInt() for i in range(n)]

class Util():
    def roundUp(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Util.round_up(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x
class Math():
    def gcd(a,b):
        if b == 0:
            return a
        return Math.gcd(b,a % b)

S = cin.string()
T = cin.string()

def solve():
    X = _collections.defaultdict(lambda:"-1")
    Y = _collections.defaultdict(lambda:"-1")

    for i in range(len(S)):
        s = S[i]
        t = T[i]
        if X[s] != "-1" or Y[t] != "-1":
            if X[s] != t or Y[t] != s:
                return "No"
        X[s] = t
        Y[t] = s

    return "Yes"
print(solve())

Measured memory_bytes: 42128
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define for1(i, m, n) for(int i = m;i < n;i++)
#define ll long long
#define endl '\n'
using namespace std;


int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    int h, w;
    cin >> h >> w;
    char a[9][9];
    int cnt = 0;
    rep(i, h) {
        rep(j, w) {
            cin >> a[i][j];
            if (a[i][j] == '#') {
                cnt++;
            }
        }
    }
    if(cnt == h + w - 1) {
        puts("Possible");
    } else {
        puts("Impossible");
    }
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<stdio.h>
#include<stdlib.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set; 
#define endl "\n"
#define FILEIO freopen("test1.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define LL long long 
#define mod 1000000007LL
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define pp pop_back
//#define p push
#define I insert
#define bg begin()
#define ed end()
#define sz size()
#define all(v) v.begin(),v.end()
#define ALL(v) v.rbegin(),v.rend()
typedef vector<LL> vi;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef map<LL ,LL > mii;
typedef priority_queue<int> pq;
typedef queue<int>que;
typedef stack<int>stk;
#define Inf 100000005LL
#define f first
#define s second
 

	   		    

int main()
{
    int l ,r , d;

	cin>>l>>r>>d;

	int sum=0;

	for(int i=l;i<=r;i++)
	     if(i%d==0)
		    sum++;
	cout<<sum<<endl;	

	
}

Measured memory_bytes: 3560
#include <bits/stdc++.h> 
#define int long long
#define quickie ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rep(i, a, b) for(int i=a; i<b; i++)
#define rep1(i, a, b) for(int i=a; i<=b; i++)
#define repp(i, a, b) for(int i=b-1; i>=a; i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define db double
#define mi map<int, int>
#define mc map<char, int>
#define ms map<string, int>
#define vi vector<int>
#define qi queue<int>
#define MI(x) power(x, mod-2)
#define test int t; cin >> t;
#define mod 1000000007LL
//#define mod 998244353 
using namespace std;
int power(int x, int y) ;
int gcd(int a, int b) ;

signed main() {
    quickie
    int n ;
    cin >> n ;
    int a[n], mn , cnt = 1 ;
    rep(i, 0, n) {
        cin >> a[i] ;
    }
    mn = a[0] ;
    rep(i, 1, n) {
        if(a[i] < mn) { cnt++ ; mn = a[i] ; }
    }
    cout << cnt << endl ;
}
 
int power(int x, int y) {
    int res = 1; x %= mod;
    while (y > 0) {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res%mod;
}
 
int gcd(int a,int b){
    if(a==0) return b;
    return gcd(b%a,a);
}

Measured memory_bytes: 1792
N = int(input())
S = list(map(int, input().split()))

data = [0]*N
for i, item in enumerate(S):
    data[i] = [item, i]
data.sort(reverse=True)

dp = [[0]*(N+1) for _ in range(N+1)]
# dp[i][j] i+j-1番目までの幼児がi人0から、j人N-1から並んだ時の最大値

for i in range(N):
    for j in range(N):
        if i+j >= N:
            break
        dp[i+1][j] = max(dp[i+1][j], dp[i][j]+data[i+j][0]*(data[i+j][1]-(i)))
        dp[i][j+1] = max(dp[i][j+1], dp[i][j]+data[i+j][0]*((N-1-j)-data[i+j][1]))

ans = 0
for i in range(N+1):
    ans = max(ans, dp[i][N-i])

print(ans)

Measured memory_bytes: 100104
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = readline().strip()

    r = 0
    for n in N:
        n = int(n)
        r = (r + n) % 9

    if r == 0:
        print('Yes')
    else:
        print('No')

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9296
import java.util.*;

public class Main {
	static int mod = 1000000007;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] ary = new long[n];
		long[] bits = new long[60];
		for(int i=0; i<n; i++){
			ary[i] = sc.nextLong();
			for (int j = 0; j < 60; j++) {
				if ((1 & ary[i] >> j) == 1) {
					bits[j]++;
				}
			}
		}

		long result = 0;
		for (int j = 0; j < 60; j++) {
			long now = bits[j]*(n-bits[j])%mod;
			now = now*modPow(2, j, mod);
			result += now;
			result %= mod;
		}
		System.out.println(result);
	}
	public static long modPow(long base, long exp, long mod) {
		if (exp == 0)
			return 1;
		if (exp == 1)
			return base % mod;
		if (exp % 2 == 1)
			return (base * modPow(base, exp - 1, mod) % mod);
		long tmp = modPow(base, exp / 2, mod);
		return (tmp * tmp) % mod;
	}
}


Measured memory_bytes: 98452
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector< vector<int> > Mat;
typedef tuple<int, int, int, int> T;

const int MOD = (int)1e9+7;
const int INF = (int)1e9;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

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

    int A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;

    int ans = 1e9;
    for(int i = 0; i <= 1e5; i++){
        ans = min(ans, i*2*C + max(0, X-i)*A + max(0, Y-i)*B);
    }

    cout << ans << endl;

    return 0;
}

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

const ll N = 1e6 + 10, MOD = 1e9 + 7;
ll inv[N], fac[N], inv_fac[N];

void precalc() {
	inv[1] = 1;
	FOR(n,2,N) inv[n] = (MOD - (MOD/n)*inv[MOD%n] % MOD) % MOD;

	fac[0] = 1;
	FOR(n,1,N) fac[n] = n*fac[n-1] % MOD;

	inv_fac[0] = 1;
	FOR(n,1,N) inv_fac[n] = inv[n]*inv_fac[n-1] % MOD;
}

ll binom(ll n, ll k) {
	if (k < 0 || k > n) return 0;
	return fac[n] * inv_fac[k] % MOD * inv_fac[n-k] % MOD;
}

ll solve(ll x, ll y) {
	if ((x+y)%3) return 0;
	
	ll n = (x+y)/3;
	x -= n, y -= n;

	return binom(n,x);
}

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

	ll x, y;
	cin >> x >> y;
	cout << solve(x,y) << endl;
}



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

#pragma GCC optimize("O2,no-stack-protector,unroll-loops,fast-math")

#define F first
#define S second
#define pb push_back
#define SZ(x) (ll)(x.size())
#define all(x) x.begin(),x.end()
#define MP make_pair

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

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll maxn=55, maxm=5e4+10, lg=21, mod=1e9+7, inf=1e18;

ll n,a[maxn],b[maxn],ii,adj[maxn][maxn];
bool mk[maxn];
void edd(ll m,ll d){for(int i=m;i<=50;i++) adj[i][i%m]+=d;}
bool dfs(ll v){
	if(v==b[ii]) return 1;
	if(mk[v]) return 0;
	mk[v]=1;
	for(int i=0;i<v;i++)if(adj[v][i])if(dfs(i)) return 1;
	return 0;
}
bool check(){
	for(ii=0;ii<n;ii++){
		memset(mk,0,sizeof(mk));
		if(!dfs(a[ii])) return 0;
	}
	return 1;
}

int main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	
	cin>>n;
	for(int i=0;i<n;i++) cin>>a[i];
	for(int i=0;i<n;i++) cin>>b[i];
	ll ans=0,p2=1;
	for(int i=1;i<=50;i++) edd(i,+1), p2*=2;
	if(!check()) return cout<<-1,0;
	for(int i=50;i>=1;i--){
		edd(i,-1);
		if(!check()) edd(i,+1), ans+=p2;
		p2/=2;
	}
	cout<<ans;

	return 0;
}






Measured memory_bytes: 3628
# ここから
import sys
input = sys.stdin.readline

def resolve():
    n, m = map(int, input().split())
    aa = [False] * (n+1)

    for i in range(m):
        a = int(input())
        aa[a] = True

    dp = [0] * (n+1)
    dp[0] = 1
    dp[1] = 0 if aa[1] else 1

    for i in range(2, n+1):
        if aa[i]:
            dp[i] = 0
        else:
            dp[i] = (dp[i-2] + dp[i-1]) % 1000000007

    print(dp[n])



resolve()

Measured memory_bytes: 41692
#累積和
n,q=map(int,input().split())
s=input()
L=[list(map(int,input().split())) for _ in range(q)]

LL=[0]*n
for i in range(1,n):
      if s[i-1:i+1]=="AC":
            LL[i]+=LL[i-1]+1
      else:
            LL[i]+=LL[i-1]
for i in range(q):
      print(LL[L[i][1]-1]-LL[L[i][0]-1])

Measured memory_bytes: 68440
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val sp = (1..n).map {
        val x = readLine()!!.split(" ")
        Triple(it,x[0], x[1].toInt())
    }.sortedByDescending { it.third }.sortedBy { it.second }
    println( sp.joinToString("\n"){it.first.toString()} )
}


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

#include <iostream>
#include <iomanip>
#include <sstream>
#include <stdint.h>
#include <string.h>

#include <unordered_set>

#define _USE_MATH_DEFINES
#include <math.h>


#include <vector>
#include <list>

#include <set>
#include <map>

#include <unordered_map>

#include <queue>
#include <stack>

#include <string>

#include <vector>

#define sqr(x) (x) * (x)

#include <algorithm>
#include <functional>

#include <bitset>

#include <functional>

#include <chrono>

typedef unsigned int u32;
typedef int i32;

typedef unsigned long long int u64;
typedef int32_t i64;

typedef uint16_t u16;
typedef int16_t i16;

typedef uint8_t u8;
typedef int8_t i8;


using namespace std;
using namespace std::chrono;

struct less_key
{
    bool operator() (pair<i64, i64> p1, pair<i64, i64> p2)
    {
        return p1.first > p2.first || (p1.first == p2.first && p1.second < p2.second);
    }
};

struct pair_hash {
public:
    std::size_t operator()(const std::pair<u64, u64> &x) const
    {
        return std::hash<u64>()(x.first) ^ std::hash<u64>()(x.second);
    }
};
#include <random>

const i64 mod = 1000000007ll;
const i64 smod = 998244353ll;
const i64 inf = 10000000000000007ll;

const double eps = 1e-10;

// del

const i64 MAXN = 300005;

i64 n;
i64 a[MAXN];

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

    cin >> n;

    cout << (n - 2) * 180;

    return 0;
}

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

typedef long long ll;

#define int ll
#define all(v) v.begin(), v.end()
#define reps(__i, a, b) for (int __i = a; i < b; i++)
#define rep(__i, n) reps(__i, 0, n)

const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;

signed main()
{
    string s;
    cin >> s;
    bool f = false;
    for (int i = 1; i < s.length(); i++)
        if (s[i - 1] == s[i])
            f = true;

    if (f)
        cout << "Bad" << endl;
    else
        cout << "Good" << endl;
}

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

int main() {
	int K;
	int S;
	int count = 0;
	std::cin >> K >> S;

	for(int X = K; X >= 0; --X) {
		for(int Y = K; Y >= 0; --Y) {
			int temp = S - (X + Y);
			if(0 <= temp && temp <= K) {
				++count;
			}
		}
	}

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

	return EXIT_SUCCESS;
}


Measured memory_bytes: 256
N = gets.to_i
Ndigits = N.to_s.length
K = gets.to_i
C = Array.new(101) {Array.new(4, 1)}
for i in 1..100
    for j in 1..3
        C[i][j] = (1..j).inject(1){|sum, k| sum *= (i - k + 1)} / (1..j).inject(1, :*)
    end
end

ans = 0
for i in K..Ndigits
    if i == Ndigits
        if K == 1
            ans += N.to_s[0].to_i
        elsif K == 2
            ans += (N.to_s[0].to_i - 1) * (9 ** (K - 1)) * C[i - 1][K - 1]
            flag = false
            for j in 1..Ndigits-1
                x = N.to_s[j].to_i
                if flag
                    ans += 9
                elsif x > 0
                    flag = true
                    ans += x
                end
            end
        elsif K == 3
            ans += (N.to_s[0].to_i - 1) * (9 ** (K - 1)) * C[i - 1][K - 1]
            flag = false
            for j in 1..Ndigits-2
                x = N.to_s[j].to_i
                if flag
                    ans += 9 * 9 * ((Ndigits - 1) - j)
                elsif x > 0
                    ans += (x - 1) * 9 * C[i - j - 1][1]
                    flag2 = false
                    for k in j+1..Ndigits-1
                        y = N.to_s[k].to_i
                        if flag2
                            ans += 9
                        elsif y > 0
                            flag2 = true
                            ans += y
                        end
                    end
                    flag = true
                end
            end
        end
    else
        ans += 9 ** K * C[i - 1][K - 1]
    end
end

p ans

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;
const int MAX_N=1<<17; //nの2倍くらい

// RSQ&RAQ
struct LazySegmentTree{
    ll node[2*MAX_N-1], lazy[2*MAX_N-1], SIZE; //SIZE:nを２べきにしたもの
    
    //初期化
    void init(int n_){
        //要素数を2べきに
        SIZE=1;
        while(SIZE<n_) SIZE*=2;
        
        //全ての値をI_MAXに
        rep(i,0,2*SIZE-1) node[i]=0;
    }
    
    //k番目のノードについて遅延評価を行う
    void eval(int k, int l, int r){
        // 遅延配列が空でない場合、自ノード及び子ノードへの値の伝播が起こる
        if(lazy[k]!=0){
            node[k]+=lazy[k];
            // 最下段かどうかのチェックをしよう
            if(r-l>1){
                lazy[2*k+1]+=lazy[k]/2;
                lazy[2*k+2]+=lazy[k]/2;
            }
            // 伝播が終わったので、自ノードの遅延配列を空にする
            lazy[k] = 0;
        }
    }
    
    void add(int a, int b, ll x, int k=0, int l=0, int r=-1){
        if(r<0) r=SIZE;
        eval(k,l,r);
        if(b <= l || r <= a) return;
        if(a <= l && r <= b) {
            lazy[k] += (r - l) * x;
            eval(k, l, r);
        }
        else{
            add(a, b, x, 2*k+1, l, (l+r)/2);
            add(a, b, x, 2*k+2, (l+r)/2, r);
            node[k]=node[2*k+1]+node[2*k+2];
        }
    }
    
    ll getsum(int a, int b, int k=0, int l=0, int r=-1){
        if(r<0) r=SIZE;
        if(b <= l || r <= a) return 0;
        eval(k,l,r);
        if(a <= l && r <= b) return node[k];
        ll vl=getsum(a, b, 2*k+1, l, (l+r)/2);
        ll vr=getsum(a, b, 2*k+2, (l+r)/2, r);
        return vl+vr;
    }
};
LazySegmentTree S;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,q;
    cin>>n>>q;
    S.init(n);
    rep(i,0,q){
        int b;
        cin>>b;
        int s,t;
        cin>>s>>t;
        if(b){
            cout <<S.getsum(s-1, t)<<"\n";
        }
        else{
            ll x;
            cin>>x;
            S.add(s-1,t,x);
        }
    }
}


Measured memory_bytes: 6860
program proba
	implicit none
    character(len=1) :: s
	read(*,*) s
    if(s == 'S') then
    	write(*,'(a)') 'Cloudy'
    else if(s == 'C') then
    	write(*,'(a)') 'Rainy'
    else
        write(*,'(a)') 'Sunny'
    end if
    
    stop
end program proba

Measured memory_bytes: 384
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1<<30;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};



int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    in a,b,c;
    cin>>a>>b>>c;
    if(c<=a+b){
        cout<<"No"<<endl;
        return 0;
    }
    in h=4ll*a*b;
    in m=(c-a-b)*(c-a-b);
    if(h<m) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, string
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**7)
inf = float('inf')
mod = 10**9+7
ans = 0 ;count = 0 ;pro = 1

n=int(input())
A=[[] for i in range(n)]
for i in range(n):
    a=int(input())
    for j in range(a):
        A[i].append(tuple(map(int,input().split())))
for i in range(2**n):
    tr=set()
    fr=set()
    f=1
    count=0
    for k in range(n):
        if i>>k & 1:
            if (k+1) in fr:
                f=0
            tr.add(k+1)
            count+=1
            for xi,yi in A[k]:
                if yi:
                    if xi in fr:
                        f=0
                    tr.add(xi)
                else:
                    if xi in tr:
                        f=0
                    fr.add(xi)
        else:
            if (k+1) in tr:
                f=0
            fr.add(k+1)
    if f:
        ans=max(ans,count)
print(ans)



Measured memory_bytes: 47452
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define PQ priority_queue
#define UM unordered_map
#define ALL(a) (a).begin(),(a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
const ll INF = (1ll << 60);
typedef pair<ll,ll> pii;
struct Edge {ll s,t,d;};
struct vector<vector<Edge>> Graph;

int main(){
  ll N,M,K; cin>>N>>M>>K;
  REP(i,N+1) REP(j,M+1) {
    if(i*j+(N-i)*(M-j)==K){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
}


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

int main(){
  int x,y,ans=0;
  scanf("%d%d",&x,&y);
  if(x==y){
    puts("0");
    return 0;
  }
  else if(abs(x)<abs(y)){
    if(x<0) ans++;
    ans+=abs(y)-abs(x);
    if(y<0) ans++;
  }
  else {
    if(x>0) ans++;
    ans+=abs(x)-abs(y);
    if(y>0) ans++;
  }
  printf("%d",ans);
}

Measured memory_bytes: 128
#pragma warning(disable:4996)
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define pb push_back
#define mp make_pair
#define fill(x,y) memset(x,y,sizeof(x))
#define even(x) x % 2 == 0
#define odd(x) x % 2 != 0

const ll INF_LL = (1ll << 60);
const int INF_INT = (int)1e9;
const ll MOD_CONST = (ll)(1e9 + 7);

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

bool connected[101][101];

int bfs(int start) {
	queue<int> q;
	q.push(start);
	while (not q.empty()) {
		int current = q.front(); q.pop();
		// 次の候補に
		//int next = calcNext(current);
		//q.push(next);
	}
	return 0;
}

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

	int A, B, C; cin >> A >> B >> C;
	int t = max(A, max(B, C));
	ll ans = 0;
	ans += (t - A) / 2; A += (t-A) / 2 * 2;
	ans += (t-B) / 2; B += (t-B) / 2 * 2;
	ans += (t-C) / 2; C += (t-C) / 2 * 2;
	if (A == B and B == C) {
		;
	}
	else {
		ans += 1;
		if (A == B) {
			if (C < A) ans += 1;
		}
		if (C == B) {
			if (A < C) ans += 1;
		}
		if (A == C) {
			if (B < A) ans += 1;
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import kotlin.math.max

fun main(args: Array<String>) {
    val s = readString().reversed()
    val t = readString().reversed()

    var ans = 0
    for (i in 0..s.length - t.length) {
        var cnt = 0
        for (j in t.indices) {
            if (t[j] == s[i + j]) cnt++
        }
        ans = max(ans, cnt)
    }
    println(t.length - ans)
}

// read
fun readString() = readLine()!!

Measured memory_bytes: 37284
#include<stdio.h>
#include<math.h>
int main(){
  int unused __attribute__((unused));
  int a, b, c, d;
  unused = scanf("%d %d %d %d", &a, &b, &c, &d);

  if(fabs(c-a)<=d) printf("Yes");
  else if(fabs(b-a)<=d && fabs(c-b)<=d) printf("Yes");
  else printf("No");
  return 0;
}

Measured memory_bytes: 128
package main

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

func main() {
	sc := NewScanner(os.Stdin)
	A, B, C := sc.NextInt(), sc.NextInt(), sc.NextInt()
	fmt.Println(min(B/A, C))
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

// scanner
type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner(r io.Reader) *Scanner {
	rdr := bufio.NewReaderSize(r, 1024)
	return &Scanner{r: rdr}
}

func (s *Scanner) ReadLine() {
	s.buf = make([]byte, 0)
	for {
		line, isp, err := s.r.ReadLine()
		if err != nil {
			os.Exit(1)
		}
		s.buf = append(s.buf, line...)
		if !isp {
			break
		}
	}
}

func (s *Scanner) NextInt() int {
	i, err := strconv.Atoi(s.Next())
	if err != nil {
		os.Exit(1)
	}
	return i
}

func (s *Scanner) Next() string {
	s.Pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	next := string(s.buf[start:s.p])
	s.p++
	return next
}

func (s *Scanner) Pre() {
	if s.p >= len(s.buf) {
		s.ReadLine()
		s.p = 0
	}
}


Measured memory_bytes: 640
input = gets.chomp.split.map(&:to_f)

a, b, x = input
 
s = x / a
if (a * b / 2) <= s
  h = 2 * (a * b - s) / a
  re = Math.atan2(h, a)
else
  m = 2 * s / b
  re = Math.atan2(b, m)
end
de = re / (2 * Math::PI) * 360
puts de

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;

int x[100009];
bool vs[100009];
vector<pii> adj[100009];

void go(int now) {
    vs[now] = 1;
    for(auto& it: adj[now]) {
        if(!vs[it.first]) {
            x[it.first] = x[now] + it.second;
            go(it.first);
        }
    }
}

int main() {
    int N, M; scanf("%d%d",&N,&M);
    for(int i=0; i<M; i++) {
        int L, R, D; scanf("%d%d%d",&L,&R,&D);
        adj[L].push_back({R, D});
        adj[R].push_back({L, -D});
    }
    for(int i=1; i<=N; i++) if(!vs[i]) go(i);
    for(int i=1; i<=N; i++) {
        for(auto& it: adj[i]) {
            if(x[i] + it.second != x[it.first]) return !printf("No");
        }
    }
    puts("Yes");
    return 0;
}


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

int main(){
    int N;
    cin >> N;
    int p[N];
    for(int i = 0; i < N; i++){
        cin >> p[i];
    }

    int maximum = 0;
    for(int i = 0; i < N; i++){
        maximum = max(p[i], maximum);
    }

    int sum = 0;
    for(int j = 0; j < N; j++){
        sum += p[j];
    }

    cout << sum - maximum / 2 << endl;

    return 0;
}

Measured memory_bytes: 256
n = int(input())
s = input()

c_e = [0]
t = 0
for c in s:
    if c == 'E':
        t += 1
    c_e.append(t)

ans = n
for leader in range(n):
    ans = min(ans, (leader - c_e[leader]) + (c_e[n] - c_e[leader + 1]))
print(ans)
# 累積和のリストは、1-indexed


Measured memory_bytes: 15392