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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

//IO accelerate
//--------------------------------------------
struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

//template
//--------------------------------------------
template<typename T>
istream& operator >>(istream& is, vector<T>& vec) {
  for(T& x: vec) is >> x;
  return is;
}
template<typename T>
ostream& operator <<(ostream& os, const vector<T>& vec) {
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : "\t" );
  }
  return os;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<vector<T>>& vv) {
	for (int i = 0; i < vv.size(); ++i) {
		s << vv[i] << endl;
	}
	return s;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<pair<T, T>>& vp) {
	for (int i = 0; i < vp.size(); ++i) {
		s << "(" << vp[i].first << "," << vp[i].second << ")" << ( i+1 == vp.size() ? "" : ",\t" );
	}
	return s;
}

// 多重vector
// auto dp=make_v<int>(4,h,w) みたいに使える
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

// 多重vectorのためのfill
// fill_v(dp,0) みたいに使える
template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

//main code

int main(int argc, char const* argv[])
{
	int a,b;
	cin >> a >> b;
	if ((a*b)%2 == 1) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<ll,double> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
// cout << fixed << setprecision(10) << ans << endl; 有効桁数指定
// *min_element(c + l, c + r) *max_element(c + l, c + r) 配列の中のmin-max
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// ~ は、-1の時だけfalse

ll dp[100010][13];

int main() {
    string s;cin>>s;
    ll ten = 1;
    dp[0][0] = 1;
    rep(i,s.size()) {
        if(s[s.size()-i-1]!='?') {
            int num = s[s.size()-i-1] - '0';
            rep(j,13) {
                dp[i+1][(j+(num*ten)%13)%13] = (dp[i+1][(j+(num*ten)%13)%13]+dp[i][j])%MOD;
            }
        } else {
            rep(j,10) {
                rep(k,13) {
                    dp[i+1][(k+(j*ten)%13)%13] = (dp[i+1][(k+(j*ten)%13)%13]+dp[i][k])%MOD;
                }
            }
        }
        ten *= 10;
        ten %= 13;
    }
    // rep(i,4) {
    //     rep(j,13) {
    //         cout<< dp[i][j] << " ";
    //     }
    //     cout<<endl;
    // }
    cout << dp[s.size()][5] <<endl;
}

Measured memory_bytes: 13852
A,B,C,D=map(int, input().split())
def gcd(a, b):
    remainder = max(a, b) % min(a, b)
    if remainder == 0:
        return min(a, b)
    return gcd(min(a, b), remainder)

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

def f(X, a, b):
    return (X - X//a - X//b + X//lcm(a, b))

sum = f(B, C, D) - f(A-1, C, D)
print(sum)


Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<queue>
#include<cstring>
#include<utility>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<bitset>
#include<deque>
#include<cctype>
using namespace std;

int main() 
{
	int a,b,c;
	cin>>a>>b>>c;
	int n;
	cin>>n;
	int ans=0;
	for(int i=0;i<=a;i++)
	for(int j=0;j<=b;j++)
	for(int k=0;k<=c;k++)
	if(i*500+j*100+k*50==n) ans++;
	cout<<ans;
    return 0; 
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
String s=sc.nextLine();
char c[]=s.toCharArray();
System.out.print(c[0]);
System.out.print(s.length()-2);
System.out.println(c[s.length()-1]);
	}
}

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

const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

typedef long long ll;

#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FORD(i, a, b) for (int i = b - 1; i >= int(a); i--)
#define WRAP(y, x, h, w) (0 <= y && y < h && 0 <= x && x < w)

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

int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };

int main()
{
    ll s;
    cin >> s;
    vector<ll> memo(s + 1, 0);
    FOR(i, 3, s + 1)
    {
        memo[i]=1;
        REP(j,i-2){
            memo[i]+=memo[i-3-j];
        memo[i]%=MOD;
        }
    }
    cout<<memo[s]<<endl;
}

Measured memory_bytes: 3632
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
//#include<unordered_map>//イテレータあるけど順序保持しないmap
//#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<valarray>//なんとなく追加
//メモ：表示桁数を大きくする　　cout << fixed << setprecision(20) << cm << endl;
using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define PI acos(-1.0)
#define answer(ans) cout<<ans<<endl;
#define input(N) cin >> N ;


signed main() {
ll A,B,C,X,Y,ans=100000000000,tmp;
cin >> A >> B >> C >> X >> Y;
if(X<Y) {
    swap(A,B);
    swap(X,Y);
}
for(int i=X;i>=0;i--){
    tmp=0;
    tmp+=i*A;
    tmp+=(X-i)*2*C;
    
    if(Y-(X-i)>=0){
       tmp+=(Y-(X-i))*B;
    }
     ans=min(ans,tmp);
}
answer(ans);
return 0;
}

Measured memory_bytes: 3552
use std::io::*;
use std::str::*;

fn read<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let s = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok()
}

fn main() {
    let n: usize = read().unwrap();
    if n % 2 == 0 {
        println!("{}", n / 2);
    } else { println!("{}", n / 2 + 1) };
}

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

int sum(int x) {
  if (x < 10) return x;
  return (x % 10) + sum(x/10);
}

int main() {
  int n, a, b, result;
  cin >> n >> a >> b;
  for (int i = 1; i <= n; i++) {
    if (a <= sum(i) && sum(i) <= b) result += i;
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <typeinfo>
#include <set>
#include <bitset>
#include <string>
#include <map>
#include <algorithm>
using namespace std;
typedef long long ll;



int main(){
  string s;
  cin >> s;
  for(int i=0; i<s.size(); i++){
    cout << "x";
  }
  cout << endl;
}

Measured memory_bytes: 256
import math

N = int(input())

for i in range(1, math.ceil(math.sqrt(N)) + 1):
    if N % i == 0:
        factor1 = N / i
        factor2 = i

factor1 = int(factor1)

if factor1 < factor2:
    print(len(str(factor2)))
else:
    print(len(str(factor1)))


Measured memory_bytes: 3060
import           Control.Exception (assert)

main :: IO ()
main = do
  n <- readLn
  as <- map read . words <$> getLine
  assert (length as == n) $
    print $ solve n as

solve :: Int -> [Int] -> Int
solve n bricks =
  let
    l = increasing bricks
  in
    if l == 0 then -1 else n - l

increasing :: [Int] -> Int
increasing = increasing' 1 0

increasing' :: Int -> Int -> [Int] -> Int
increasing' _ len [] = len
increasing' i len (x:xs)
  | x == i    = increasing' (i + 1) (len + 1) xs
  | otherwise = increasing' i len xs


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

using namespace std;

int n, x, ans = 1;

int main() {
	cin >> n >> x;
	while (n--) {
		int l;
		cin >> l;
		if (x >= l) x -= l;
		else break;
		++ans;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
N,M=map(int,input().split())
AB=[list(map(int,input().split())) for _ in range(N)]

D=[float('inf') for _ in range(N)]
ans=[0]*N
for i in range(M):
    c,d=map(int,input().split())
    for j in range(N):
        a,b=AB[j][0],AB[j][1]
        res=abs(c-a)+abs(d-b)
        if D[j]>res:
            D[j]=res
            ans[j]=i+1
for a in ans:
    print(a)


Measured memory_bytes: 3064
def main():
    N, A, B = map(int, input().split())
    if N < A:
        print(-1)
        return
    x = -(-N//A)
    if B < x or (N-A+1) < B:
        print(-1)
        return
    lst = list(range(1, N+1))
    seq = [lst[:A]]
    idx = A
    for i in range(B-1):
        rem = B-1-i
        nidx = idx - (-(N-idx)//rem)
        seq.append(lst[idx:nidx])
        idx = nidx
    ans = []
    for s in reversed(seq):
        ans += s
    print(*ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 89168
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include <ctime>
#define inf 0x3f3f3f3f
#define esp 1e-7
using namespace std;
long long read(){
    long long x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

long long n,k,m;
long long num[100];

int main(){
	k=read();
	n=50;
	for (int i=1;i<=50;i++)	num[i]=i-1;
	for (int i=1;i<=50;i++)	num[i]+=k/n;
	for (int i=50,j=1;j<=k%n;i--,j++)	num[i]+=1;
	cout<<50<<endl;
	for (int i=1;i<=n;i++){
		cout<<num[i];
		printf(" ");
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
        static Scanner sc = new Scanner(System.in);
        static void myout(Object t){System.out.println(t);}
        static String getStr(){return sc.next();}
        static int getInt(){return sc.nextInt();}
        static Long getLong(){return sc.nextLong();}
        static boolean isNext(){return sc.hasNext();}
        public static void main(String[] args){
          int x = getInt();
          int y = getInt();
          int mod = 1000000007;
          
          if(x > y){
            int t = y;
            y = x;
            x = t;
          }
          
          if(y > 2 * x){
            myout(0);
       		return;
          }
          if((x+y) % 3 != 0){
            myout(0);
      		return;
          }
          
          
	int tmpX = x;
	int tmpY = y;
	//原点に向かうべく、境界線のところ（y = 2x,またはy = x/2の座標）に帰れるか。帰れなかったら0
	int xLineCount = 0;
  int yLineCount = 0;
  while(true){
      if(tmpY / 2 == tmpX){
         break;
      }else if(tmpX < 0 || tmpY < 0){
               myout(0);
        return;
       }
    tmpX -= 2;
      tmpY -= 1;
      yLineCount++;
    }
   tmpX = x;
	 tmpY = y;
	while(true){
      if(tmpX / 2 == tmpY){
         break;
      }else if(tmpX < 0 || tmpY < 0){
            myout(0);
        return;
       }
      tmpX -= 1;
      tmpY -= 2;
      xLineCount++;
    }
          
          myout(originComb(xLineCount+yLineCount,xLineCount,mod));
        }
        //便利メソッド追加枠ここから

static long originComb(int n, int k, int m){
  long ret = 1;
  for(int i = 0; i < k; i++){
    ret = (ret * (n - i)) % m;
    ret = (ret * originPow(i + 1, m - 2, m)) % m;
  }
  return ret;
}
  
static long originPow(long x, int n){
  return originPow(x,n,1000000007);
}
static long originPow(long x, int n,int m) {
	long ans = 1;
	while (n > 0) {
		if ((n & 1) == 1)ans = ans * x % m;
		x = x * x % m;
		n >>= 1;
	}
	return ans;
}

  
        //便利メソッド追加枠ここまで
}


Measured memory_bytes: 23252
#include<iostream>
#include<cmath>
#include<string>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#define P pair<long long, long long>


using namespace std;
const long long int MOD=1e9+7;

int main(){
  long long n, a, b;
  cin >> n >> a >> b;
  cout << n/(a+b)*a + min(n%(a+b), a) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,q;cin>>n>>q;
  string s;cin>>s;
  vector<int>ans(n+3,0);
  for(int i=1;i<n;i++){
    if(s.at(i-1)=='A'&&s.at(i)=='C'){
      ans.at(i+1)=ans.at(i)+1;
    }
    else ans.at(i+1)=ans.at(i);
  }
  int l,r;
  int tmp;
  for(int i=0;i<q;i++){
    cin>>l>>r;
    tmp=ans.at(r)-ans.at(l-1);
    if(l>=2&&(s.at(l-2)=='A'&&s.at(l-1)=='C'))tmp--;
    cout <<tmp<<endl;
  }
}

Measured memory_bytes: 3840
def main():
    money = 1000
    kabu = 0
    n = int(input())
    kabu_price = [0] + list(map(int,input().split()))
    up = False
    for i in range(1,n):

        if  kabu_price[i+1] > kabu_price[i] and not up:#株価が次の日上がり、上がり調子でないのならば。
            buy_kabu = money // kabu_price[i]
            kabu += buy_kabu
            money -= buy_kabu * kabu_price[i]
            up = True

        if kabu_price[i+1] < kabu_price[i] and up:#株価が次の日下がり、上がり調子なら
            sell_kabu = kabu
            money += sell_kabu * kabu_price[i]
            kabu -= sell_kabu
            up = False
        #print("money:",money)
        #print("kabu:",kabu)
    money += kabu * kabu_price[n]
    print(money)





if __name__ == '__main__':
    main()


Measured memory_bytes: 61824
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

long long INF = 100000000000000000LL;
static const int MAX_SIZE =
    1 << 18; // segment tree のサイズ。この実装では2べきにする必要がある。
             // 2^17 ≒ 1.3 * 10^5

typedef long long ll;
ll segMin[2 * MAX_SIZE - 1] = {0}, segAdd[2 * MAX_SIZE - 1] = {0};

//区間[a, b)に値xを加算する.
void add(int a, int b, ll x, int k = 0, int l = 0, int r = MAX_SIZE) {
  if (r <= a || b <= l)
    return; //もし交差しない区間であれば終える.

  if (a <= l &&
      r <= b) { //もし今みている区間[l, r)が[a, b)に完全に内包されていれば
    segAdd[k] += x; //区間[l, r)にkを加算する.
    return;
  }

  add(a, b, x, k * 2 + 1, l,
      (l + r) / 2); //子の区間に(必要があれば)xを加算する.
  add(a, b, x, k * 2 + 2, (l + r) / 2, r); //〃

  //親の区間の最小値は, 子の区間の最小値 + 自分に一様に加算されている値
  //である.一様に加算される値は更新しなくて良い.
  segMin[k] = min(segMin[k * 2 + 1] + segAdd[k * 2 + 1],
                  segMin[k * 2 + 2] + segAdd[k * 2 + 2]);
}

ll getMin(int a, int b, int k = 0, int l = 0, int r = MAX_SIZE) {
  if (r <= a || b <= l)
    return (INF);

  if (a <= l && r <= b)
    return (segMin[k] +
            segAdd[k]); //完全に内包されていれば,その区間の最小値を返す.

  ll left = getMin(a, b, k * 2 + 1, l, (l + r) / 2); //子の区間の最小値を求める.
  ll right = getMin(a, b, k * 2 + 2, (l + r) / 2, r); //子の区間の最小値を求める

  return (min(left, right) + segAdd[k]); //親の区間の最小値は, 子の区間の最小値
                                         //+ 自分に一様に加算されている値 である
                                         //(大切なので2回書きました!!)
}
// ref: http://kagamiz.hatenablog.com/entry/2012/12/18/220849

struct N {
  int l, r;
  long long a;
};

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

  vector<N> ns(n);
  for (int i = 0; i < n; i++)
    cin >> ns[i].l >> ns[i].r >> ns[i].a;
  map<int, vector<N>> rmp, lmp;
  for (int i = 0; i < n; i++) {
    rmp[ns[i].r].push_back(ns[i]);
    lmp[ns[i].l].push_back(ns[i]);
    add(ns[i].l, ns[i].r + 1, ns[i].a);
  }
  long long ans = 0;
  long long sum = 0;
  long long tmp;
  for (int i = 1; i <= m; i++) {
    if (lmp.find(i) != lmp.end()) {
      for (auto &s : lmp[i])
        sum += s.a;
    }
    tmp = -getMin(0, i) + sum;
    ans = max(ans, tmp);
    add(i, i + 1, -tmp);
    if (rmp.find(i) != rmp.end()) {
      for (auto &s : rmp[i]) {
        sum -= s.a;
        add(s.l, s.r + 1, -s.a);
      }
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 51200
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const ll MOD = (ll) (1e9 + 7);
const double PI = acos(-1.0);

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

//------------------------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int p, q, r;
    cin >> p >> q >> r;
    cout << min({p + q, q + r, r + p}) << endl;
    return 0;
}



Measured memory_bytes: 256
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define ll long long

using namespace std;

const int maxn = 2e5 + 5;
int n, m;
int par[maxn], siz[maxn];
int get_par(int x) { return x == par[x] ? x : par[x] = get_par(par[x]); }
inline void Union(int x, int y) {
	int tmp1 = get_par(x);
	int tmp2 = get_par(y);
	if(tmp1 != tmp2) 
		par[tmp2] = tmp1,
		siz[tmp1] += siz[tmp2];
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
	cin >> n >> m;
	for(int i = 1; i <= n; ++i)	par[i] = i, siz[i] = 1;
	for(int i = 1; i <= m; ++i) {
		int u, v;
		cin >> u >> v;
		Union(u, v);
	}
	vector<int> ans;
	for(int i = 1; i <= n; ++i)
		if(par[i] == i) ans.push_back(siz[i]);
	sort(ans.begin(), ans.end(), greater<int>());
	cout << ans[0] << endl;
	return 0;
}

Measured memory_bytes: 5856
#include <stdio.h>
#include <algorithm>
#pragma warning(disable : 4996)
using namespace std;
int N, A, B, v[100], r[100], G[100][199];
int rec(int pos) {
	int ret = 0; v[pos] = 1;
	for (int i = 0; i < r[pos]; i++) {
		if (!v[G[pos][i]]) ret = max(ret, rec(G[pos][i]));
	}
	v[pos] = 0;
	return ret + 1;
}
int main() {
	while (scanf("%d", &N), N) {
		for (int i = 0; i < 100; i++) r[i] = 0;
		for (int i = 0; i < N; i++) {
			scanf("%d%d", &A, &B), A--, B--;
			G[A][r[A]++] = B, G[B][r[B]++] = A;
		}
		int ret = 0;
		for (int i = 0; i < 100; i++) ret = max(ret, rec(i));
		printf("%d\n", ret);
	}
	return 0;
}

Measured memory_bytes: 2648
#include <bits/stdc++.h>
#include <vector>
#include <cstdlib>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define RANGE(n) for(int _=0; _<n ; _++)
#define FOR(i, m, n) for(int i = m; i < n; i++)

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

const long long INF = 1LL << 60;
const int MAX = 110;
const int MAX_WEIGHT = 100010;
long long w[MAX], v[MAX], dp[MAX][MAX_WEIGHT];

void solve() {
  int N,W;
  cin >> N >> W ;
  REP(i,N){
    cin >> w[i] >> v[i];
  }
  REP(w,W+1) dp[0][w]=0;
  dp[0][0] = 0;
  REP(i,N){
    REP(j,W+1){
      if(j-w[i]>=0) chmax(dp[i+1][j], dp[i][j-w[i]]+v[i]);
      chmax(dp[i+1][j], dp[i][j]);
    }
  }
  
  cout << dp[N][W] << endl;
  
  return;
}
 
int main() {
    solve();
    return 0;
}

Measured memory_bytes: 82496
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const long double PI = (acos(-1));
#define rep(i, x, n) for (int i = x; i < (int)(n); i++)
#define sc(x) scanf("%d",&x)
#define scll(x) scanf("%lld",&x)

double cal(int x){
    return (double) (x+1) / 2.0;
}

int main(){
    int n, k; sc(n), sc(k);
    vector<int> p(n);
    rep(i, 0, n) sc(p[i]);
    int left = 0;
    double cnt = 0.0, ans = 0.0;
    rep(i, 0, n){
        cnt += cal(p[i]);
        while (i-left >= k){
            cnt -= cal(p[left]);
            left++;
        }
        if (ans < cnt) ans = cnt;
    }
    cout << fixed << setprecision(15) << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

int main(){
  int registered_num,enter_num;
  while(~scanf("%d",&registered_num)){
    map<string,bool> table;
    for(int i=0;i<registered_num;i++){
      string key;
      cin >> key;
      table[key] = true;
    }
    scanf("%d",&enter_num);
    int count = 0;
    for(int i=0;i<enter_num;i++){
      string key;
      cin >> key;
      if(table.find(key) == table.end()){
	// Unknown abcc
	printf("%s %s\n","Unknown",key.c_str());
      }
      else{
	// Opened by abcd
	// Closed by efgh	
	printf("%s by %s\n",(count % 2 == 0) ? "Opened" : "Closed",key.c_str());
	count++;
      }
    }
  }
}

Measured memory_bytes: 1272
#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.
// insert #if<tab> by my emacs. #if DEBUG == 1 ... #end

typedef long long ll;

// const int dx[4] = {1, 0, -1, 0};
// const int dy[4] = {0, 1, 0, -1};

// const int C = 1e6+10;
// const ll M = 1000000007;

int main () {
  int A, B, C, D, E, F;
  cin >> A >> B >> C >> D >> E >> F;
  double nodo = 0;
  int sitsuryo = -1;
  int anssato = -1;
  for (auto i = 0; i <= 30; ++i) {
    for (auto j = 0; j <= 30; ++j) {
      int mizu = A * 100 * i + B * 100 * j;
      if (mizu > F) continue;
      int sato = F - mizu;
      sato = min(sato, mizu / 100 * E);
      for (auto k = 0; k * C <= sato; ++k) {
        int nokori = sato - k * C;
        int realsato = k * C + (nokori/D) * D;
        double nownodo = ((double)realsato) / (realsato + mizu);
        if (nodo <= nownodo) {
          nodo = nownodo;
          sitsuryo = realsato + mizu;
          anssato = realsato;
        }
      }
    }
  }
  cout << sitsuryo << " " << anssato << endl;
}

Measured memory_bytes: 256
def include(a):
    while True:
        a = a // 10
        if a == 0:
            return False
        if a % 10 == 3:
            return True
n = int(input())
print('', ' '.join([str(i) for i in range(1, n + 1) if i % 3 == 0 or i % 10 == 3 or include(i)]))


Measured memory_bytes: 5908
use proconio::*;
use proconio::marker::*;
use std::cmp::*;

pub trait MoOperator {
    type Value;
    type Query;
    type Answer;
    fn init(&mut self);
    fn insert(&mut self, v: &Self::Value);
    fn delete(&mut self, v: &Self::Value);
    fn answer(&mut self, q: Self::Query) -> Self::Answer;
}

struct MoSolver;
impl MoSolver {
    fn solve<S: MoOperator>(mut state: S, array: &[S::Value], mut query: Vec<(usize, usize, S::Query)>, answer: &mut [S::Answer]) {
        let size = array.len();
        assert!(query.len() <= answer.len());
        assert!(query.iter().all(|p| p.0 < p.1 && p.1 <= size));
        if query.is_empty() {
            return;
        }
        let batch = (size as f64 / (query.len() as f64).sqrt()).ceil() as usize;
        let mut q = vec![];
        std::mem::swap(&mut q, &mut query);
        let mut query = (0..(size / batch + 1)).map(|_| vec![]).collect::<Vec<_>>();
        for (i, (l, r, op)) in q.into_iter().enumerate() {
            query[l / batch].push((r, l, i, op));
        }
        state.init();
        let mut x = 0;
        let mut y = 0;
        for (i, mut query) in query.into_iter().enumerate() {
            query.sort_unstable_by_key(|p| p.0);
            if i & 1 == 1 {
                query.reverse();
            }
            for (r, l, k, op) in query.into_iter() {
                for v in array[min(x, l)..x].iter().rev() {
                    state.insert(v);
                    x = l;
                }
                for v in array[min(y, r)..r].iter() {
                    state.insert(v);
                    y = r;
                }
                for v in array[min(x, l)..l].iter() {
                    state.delete(v);
                    x = l;
                }
                for v in array[min(y, r)..y].iter().rev() {
                    state.delete(v);
                    y = r;
                }
                answer[k] = state.answer(op);
            }
        }
    }
}

struct State {
    cnt: Vec<u32>,
    ans: usize,
}

impl MoOperator for State {
    type Value = usize;
    type Query = ();
    type Answer = usize;
    fn init(&mut self) {
        for c in self.cnt.iter_mut() {
            *c = 0;
        }
        self.ans = 0;
    }
    fn insert(&mut self, x: &Self::Value) {
        let c = &mut self.cnt[*x];
        if *c == 0 {
            self.ans += 1;
        }
        *c += 1;
    }
    fn delete(&mut self, x: &Self::Value) {
        let c = &mut self.cnt[*x];
        if *c == 1 {
            self.ans -= 1;
        }
        *c -= 1;
    }
    fn answer(&mut self, _q: Self::Query) -> usize {
        self.ans
    }
}

#[fastout]
fn run() {
    input! {
        n: usize,
        q: usize,
        c: [Usize1; n],
        ask: [(Usize1, usize); q],
    }
    let state = State {
        cnt: vec![0; n],
        ans: 0,
    };
    let ask: Vec<_> = ask.into_iter().map(|(l, r)| (l, r, ())).collect();
    let mut ans = vec![0; q];
    MoSolver::solve(state, &c, ask, &mut ans);
    for a in ans {
        println!("{}", a);
    }
}

fn main() {
    run();
}


Measured memory_bytes: 41648
n = int(input())
t = []
for i in range(n):
    t.append(int(input()))

least_common = t[0]

for i in range(1, n):
    a = least_common
    b = t[i]
    while a % b != 0:
        temp = b
        b = a % b
        a = temp
    least_common = least_common * t[i] // b

print(least_common)


Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include <numeric>
#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 99999999

using namespace std;


int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };


ll m = 1000000007;

ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}

ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}


int main() {
	int N;
	string S1, S2;
	cin >> N;
	cin >> S1;
	cin >> S2;
	ll ans = 3;
	bool tate = false;
	REP(i, N - 1) {
		if (i == 0) {
			if (S1[1] != S1[0]) {
				ans = 3;
				tate = true;
				if (N == 2) {
					ans = 6;
					break;
				}
				if (N == 3) {
					if (S1[2] == S1[1])ans = 6;
					else ans = 12;
					break;
				}
			}
			else {
				ans=6;
				i++;
				if (N <= 3)break;
			}
		}
		else if (i == N - 3) {
			if (S1[i + 1] == S1[i]) {
				if (tate)ans = (ans * 2) % m;
				else ans = (ans * 3) % m;
				break;
			}
			else {
				if (tate)ans = (ans * 2) % m;
				else ans = (ans * 1) % m;
				tate = true;
				continue;
			}
		}
		else if (i == N - 2) {
			if (tate) {
				if (S1[i + 1] == S1[i])ans = (ans * 2) % m;
				else ans = (ans * 4) % m;
			}
			else {
				if (S1[i + 1] == S1[i])ans = (ans * 3) % m;
				else ans = (ans * 2) % m;
			}
			break;
		}
		else if (S1[i + 1] == S1[i]) {
			if (tate)ans = (ans * 2) % m;
			else ans = (ans * 3) % m;
			tate = false;
			i++;
		}
		else {
			if (tate)ans = (ans * 2) % m;
			else ans = (ans * 1) % m;
			tate = true;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
function Main( input ){
	input = input.split( '\n' )
  var str = input[0]

  var book = {}
  var flg = true
  for( var i=0; i<str.length; i++ ){
    if( book[str[i]] === undefined ) book[str[i]] = true
    else {
      flg = false
      break
    }
  }

  console.log( flg ? 'yes' : 'no' )
}

Main( require( 'fs' ).readFileSync( '/dev/stdin', 'utf8' ) )


Measured memory_bytes: 21064
#include<iostream>
#include<vector>
#include<algorithm>
#define ll long long 

using namespace std;

int main()
{
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a.begin(),a.end());
    int count=0;
    
    for(int i=0;i<a.size()-2;i++)
    {
    	//cout<<"\n\n***i="<<i<<"\ta[i]="<<a[i]<<"\n"; 
        for(int j=i+1;j<a.size()-1;j++)
        {
        	//cout<<"**j="<<j<<"\ta[j]="<<a[j]<<"\n"; 
            int target=a[i]+a[j];
            //cout<<"target="<<target<<"\n"; 
            
            auto itr = lower_bound(a.begin(), a.end(), target);
            ll dis = distance(a.begin()+j, itr);
            //if(itr== a.end()) 
            dis--; 
            //cout<<"dis="<<dis<<"\n"; 
            
            //cout<<"~~count barbe:"<<dis<<"\n"; 
            count+=dis;
        }
        //cout<<"~~~~count="<<count<<"\n"; 
    }
    cout<<count;
}

Measured memory_bytes: 256
from collections import deque
n,m=map(int,input().split())
A=[set() for _ in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  A[a-1].add(b)
  A[b-1].add(a)
visit=[0]*n
visit[0]=n+1
stack=deque()
stack.append(1)
while stack:
  now=stack.popleft()
  for j in A[now-1]:
    if visit[j-1]==0:
      visit[j-1]=now
      stack.append(j)
if min(visit)>0:
  print('Yes')
  for j in range(1,n):
    print(visit[j])
else:
  print('No')
    


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

int main() {
    //aとbの計算結果を求めるとき、
    /* 和 : a + b , 差 : a - b , 積 : a * b , 商 : a / b , 剰余 : a % b
        と表すことができ、こうやって計算できるのですよ. */
    int a; cin >> a;
    //入力にはcinを使い、cin >> __のように表す.__には格納の対象となる変数名が入る.
    cout << a * a * a << endl;
}


Measured memory_bytes: 3092
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <set>
#include <bitset>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <cassert>
#include <ctime>
#define rep(i,m,n) for(i=m;i<=n;i++)
#define mod 1000000009
#define inf 0x3f3f3f3f
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long
#define pi acos(-1.0)
#define pii pair<int,int>
#define sys system("pause")
const int maxn=2e5+10;
const int N=2e5+10;
using namespace std;
ll gcd(ll p,ll q){return q==0?p:gcd(q,p%q);}
ll qpow(ll p,ll q){ll f=1;while(q){if(q&1)f=f*p%mod;p=p*p%mod;q>>=1;}return f;}
int n,m,k,t,a[maxn],b[maxn],id[maxn],ama,bma,ami=1e9,bmi=1e9,dma,dmi=1e9;
bool cmp(int x,int y){return a[x]<a[y];}
int main()
{
    int i,j;
    scanf("%d",&n);
    rep(i,1,n)
    {
        scanf("%d%d",&a[i],&b[i]);
        if(a[i]>b[i])swap(a[i],b[i]);
        id[i]=i;
        ama=max(ama,a[i]);
        ami=min(ami,a[i]);
        bma=max(bma,b[i]);
        bmi=min(bmi,b[i]);
    }
    ll ret=(ll)(ama-ami)*(bma-bmi);
    sort(id+1,id+n+1,cmp);
    rep(i,1,n)
    {
        dma=max(dma,b[id[i]]);
        dmi=min(dmi,b[id[i]]);
        ret=min(ret,(ll)(max(dma,a[id[n]])-min(dmi,a[id[i+1]]))*(bma-ami));
    }
    printf("%lld\n",ret);
    return 0;
}

Measured memory_bytes: 2560
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader input =new BufferedReader(new InputStreamReader(System.in));
        if (Integer.parseInt(input.readLine()) < 1200) {
            System.out.println("ABC");
        } else {
            System.out.println("ARC");
        }
    }
}


Measured memory_bytes: 22868
/*
　　　　　　 ＿＿
　　　　　／＞　　 フ
　　　　　|   _　 _l  
　 　　　／` ミ＿x ノ   Zzz..
　　 　 /　 　 　 |   コード見ちゃだめ！！
　　　 /　 ヽ　　  ﾉ
　 　 │　　|　|  |   
　／￣|　　 |　|  |
　| (￣ヽ＿_ヽ_)_ _)
　＼二つ
*/

#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) reverse((a).begin(),(a).end())

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a+b+c>=22) cout<<"bust"<<endl;
    else cout<<"win"<<endl;


}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <set>
#include <cmath>
#include <map>

class dice{
	int _Top;
	int _South;
	int _East;
public:
	dice() : _Top(1),_South(2),_East(3) {}
	const int Top() const { return _Top; }
	void North() { std::swap(_Top,_South); _South = 7-_South; }
	void East() { std::swap(_Top,_East); _Top = 7-_Top; }
	void South() { std::swap(_Top,_South); _Top = 7-_Top; }
	void West() { std::swap(_Top,_East); _East = 7-_East; }
	void Right() { std::swap(_East,_South); _East = 7-_East; }
	void Left() { std::swap(_East,_South); _South = 7-_South; }
};

std::string North("North"), East("East"), South("South"), West("West"),
		Right("Right"), Left("Left");

int main(int,char**){
	int n;
	std::string que;
	while(std::cin >> n){
		if(!n) break;
		dice die;
		int sum(1);
		while(n--){
			std::cin >>que;
			if(que==North) die.North();
			if(que==East) die.East();
			if(que==South) die.South();
			if(que==West) die.West();
			if(que==Right) die.Right();
			if(que==Left) die.Left();
			sum += die.Top();
		}
		std::cout << sum <<std::endl;
	}
	return 0;
}

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

#define FOR(i, a, b) for(int i = a; i < b; i ++)
#define FORS(i, a, b, c) for(int i = a; i < b; i += c)
#define FORN(i, a, b) for(int i = a; i <= b; i ++)
#define FORD(i, a, b) for(int i = a-1; i >= b; i --)
#define FORE(i, b) for(auto &i:b)
#define REP(i, b) FOR(i, 0, b)
#define REPN(i, b) FORN(i, 0, b)
#define SQ(i) (i*i)
#define ALL(a) a.begin(), a.end()
#define ALLA(a,n) a, a+n
#define SORT(a) sort(ALL(a))
#define SORTA(a, n) sort(ALLA(a, n))
#define REV(a) reverse(ALL(a))
#define REVA(a, n) reverse(ALLA(a, n))
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define IN(a, b) (a.find(b) != a.end())
#define BACK(a) a.back(); a.RB()
#define QBACK(a) a.top(); a.pop()
#define PRINT(a) FORE(i, a) cout << i << " "; cout << endl

#define PB  push_back
#define RB  pop_back
#define RF  pop_front
#define INS insert
#define F   first
#define S   second
#define UM  unordered_map
#define US  unordered_set
#define PQ  priority_queue

#define IO ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<ll,ll> pll;
typedef queue<int> qi;
typedef queue<double> qd;
typedef queue<ll> qll;
typedef US<int> si;
typedef US<double> sd;
typedef US<ll> sll;
typedef vector<vi> mi;
typedef vector<vd> md;
typedef vector<vll> mll;
typedef vector<pi> vpi;
typedef vector<pd> vpd;
typedef vector<pll> vpll;


int main(){
  IO; int K, A, B; cin >> K >> A >> B;
  int ok = 0;
  FORN(i,A,B) if(i%K==0) ok = 1;
  cout << (ok ? "OK" : "NG") << endl;
}


Measured memory_bytes: 3652
#include <cstdio>
#include <iostream>
using namespace std;
const int maxn = 20;
int main()
{
   long long l,r;
   scanf("%lld%lld",&l,&r);
   int ans = 1;
   long long t = l;
   for (int i = 0; i <= 100; i++)
   {
        if (t * 2 > r) break;
        else {
            ans++; t *= 2;
        }
   }
   printf("%d\n",ans);
}

Measured memory_bytes: 256
import sys
from numba import njit, i8


@njit((i8, i8, i8, i8), cache=True)
def floor_sum(n, m, a, b):
    ans = n*(b//m)
    b %= m
    while True:
        ans += (n-1)*n*(a//m)//2
        a %= m
        if a*n+b < m:
            return ans
        y_max = (a*n + b)//m
        b -= y_max*m  # now we have x_max = -(b//a)
        ans += (n + b//a)*y_max
        b %= a
        m, a, n = a, m, y_max


def main():
    t = int(sys.stdin.buffer.readline())
    for x in sys.stdin.buffer.readlines():
        n, m, a, b = map(int, x.split())
        res = floor_sum(n, m, a, b)
        print(res)


if __name__ == "__main__":
    main()


Measured memory_bytes: 110068
from decimal import Decimal

a, b, c = [Decimal(x) for x in input().split()]

# math.sqrt(x: SupportsFloat) -> float
# param x: SupportsFloat

# sqrt(context: Optional[Context]=...) -> Decimal

if a.sqrt() + b.sqrt() < c.sqrt():
    print('Yes')
else:
    print('No')

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

int main() {
    int H, W, M;
    cin >> H >> W >> M;
    vector<pair<int, int>> A(M);
    vector<int> cnth(H), cntw(W);
    rep(i, M) {
        int h, w;
        cin >> h >> w;
        h--, w--;
        A[i] = make_pair(h, w);
        cnth[h]++;
        cntw[w]++;
    }
    int mh = *max_element(cnth.begin(), cnth.end());
    int mw = *max_element(cntw.begin(), cntw.end());
    int h = 0, w = 0, m = 0;
    rep(i, H) if(cnth[i] == mh) h++;
    rep(i, W) if(cntw[i] == mw) w++;
    for(auto &[y, x] : A) if(cnth[y] == mh && cntw[x] == mw) m++;
    int ans = mh + mw;
    if((int64_t)h * w == m) ans--;
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 7956
import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        int[] A = new int[N];

        for (int i = 0; i < N; i++)
            A[i] = sc.nextInt();

        insertionSort(A, N);
    }
    private static void insertionSort(int[] a, int n) {
        p(a);
        for (int i = 1; i < n; i++) {
            int v = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > v) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = v;
            p(a);
        }
    }
    private static void p(int[] a) {
        for (int i = 0; i < a.length; i++)
            System.out.print((i == 0) ? a[i] : " " + a[i]);
        System.out.println();
    }
}



Measured memory_bytes: 31564
h,w,a,b = [int(i) for i in input().split()]

lists = [[0]*w for _ in range(h)]
for i in range(b):
    for j in range(a):
        lists[i][j]=1
for i in range(h-b):
    for j in range(w-a):
        lists[b+i][a+j]=1

for i in range(h):
    for j in range(w):
        print(lists[i][j], end="")
    print()

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

int main(){
	int N;
	int count=0;

	cin >> N;

	vector<int> a(N);

	for (int i=0;i<N;i++)
		cin >> a.at(i);

	for (int j=0;j<N;j++) {
		while((a.at(j)%2)==0) {
			a.at(j) = a.at(j) / 2;
			count++;
		}
	}

	cout << count << endl;
}

Measured memory_bytes: 256
# 入力が10**5とかになったときに100ms程度早い
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


import numpy as np
from itertools import permutations
from math import factorial
N = read_a_int()
zahyou = []
for _ in range(N):
    zahyou.append(read_ints())

zahyou = np.array(zahyou)
toori = factorial(N)
# print(toori)


def get_length(zahyou, keiro: list):
    zahyou1 = zahyou[keiro[:-1], :]
    zahyou2 = zahyou[keiro[1:], :]
    ret = np.linalg.norm(zahyou1 - zahyou2, axis=1).sum()
    return ret


ans = 0
for keiro in permutations(list(range(N))):
    ans += get_length(zahyou, keiro) / toori

print(ans)


Measured memory_bytes: 14428
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>
#include <iomanip>
#include <tuple>

using namespace std;


int main(){
   int a,b,c;
   cin>>a>>b>>c;
   string ans;
   if(a+b==c || b+c==a || c+a==b)ans="Yes";
   else ans="No";
   cout<<ans<<endl;
}

   


Measured memory_bytes: 504
#include<stdio.h>
using namespace std;
bool f[100001];
int c[100002],N,L,R;

int main(){
	for(int i=2;i<=100000;++i)
		if(!f[i])
			for (int j=i+i;j<=100000;j+=i)
				f[j]=true;
	for (int i=3;i<=100000;i+=2)
		if(!f[i]&&!f[(i+1)/2])
			++c[i];
	for(int i=3;i<=100000;++i)
		c[i]+=c[i-1];
	scanf("%d",&N);
    while(N--){
        scanf("%d%d",&L,&R);
        printf("%d\n",c[R]-c[L-1]);
    }
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <climits>
#include <iomanip>
#include <string.h>
#define endl "\n"
#define debug(x) cout << #x << " : " << x << endl;
#define debug2(x, y) cout << #x << " : " << x  << ", " << #y << " : " << y << endl;
#define FASTIO ios_base::sync_with_stdio(false),cin.tie(0);
typedef long long ll;
using namespace std;

int main()
{
	FASTIO

	int n;
	cin >> n;
	
	int ans = 1000 - n % 1000;
	if(ans == 1000)
		ans = 0;
	cout << ans << endl;
}

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

int main() {
  ll n; cin>> n;
  ll m=n-1, ans=0;
  vector<ll> v(n);
  rep(i,n){cin>>v[i];}
  sort(v.begin(), v.end(), greater<ll>());
  int i=0,c=0;
  while(v[i]==v[0]){c++; i++;}
  if(m-c*2-1>=0){
    m-=c*2-1;ans+=v[0]*(c*2-1);
    while(i<n){
      c=0; int  j=i;
      while(v[i]==v[j]){c++; i++;}
      if(m-c*2>=0){m-=c*2;ans+=v[j]*c*2;}
      else{ans+=v[j]*m; break;}
    }
  }
  else{ans+=v[0]*m;}
  cout<<ans;
}

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

int main() {
  int n;
  cin >> n;
  
  vector<int64_t> l(3);
  l.at(0) = 2;
  l.at(1) = 1;
  for (int i = 2; i <= n; i++){
    l.at(i%3) = l.at((i-1)%3) + l.at((i-2)%3);
  }
  
  cout << l.at(n%3) << endl;
}

Measured memory_bytes: 3592
#include<stdio.h>
int main(){
	int room[10][3][4] = {0};
	int n,b,f,r,v;
	scanf("%d",&n);
	for (int i = 0; i < n; ++i)
	{
		scanf("%d %d %d %d",&b,&f,&r,&v);
		room[--r][--f][--b] += v;
	}
	for (int i = 0; i < 4; ++i)
	{
		for (int  j= 0; j < 3; ++j)
		{
			for (int k= 0; k < 10; ++k)
			{
				printf(" %d", room[k][j][i]);
			}
			printf("\n");
		}
		if (i == 3)break;
		printf("####################\n");
	}
	return 0;
}


Measured memory_bytes: 2672
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>

typedef long long ll;
using namespace std;

int main() {
  int K;
  string S;
  cin >> K >> S;
  if ((int)S.size() <= K) {
    cout << S << endl;
  } else {
    cout << S.substr(0, K) << "..." << endl;
    return 0;
  }
}

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

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

	int mozisu = s.length();

	for (int i = 0; i < mozisu; i++) {
		if (i % 2 == 0) {
			cout << s[i];
		}
	}
	cout << endl;

    return 0; 
}

Measured memory_bytes: 512
package main

import (
	"fmt"
)

func main() {
	var n int
	_, _ = fmt.Scan(&n)
	
	fmt.Println(answer162A(n))
}

func answer162A(n int) string {
	d100, d10, d1 := n/100%100, n/10%10, n%10

	if d100 == 7 || d10 == 7 || d1 == 7 {
		return "Yes"
	}

	return "No"
}


Measured memory_bytes: 1768
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

const int inf=1000000000;
int n,head[100005],k,len;
int dis1[100005],disn[100005];
bool vis[100005];
struct edge
{
    int v,next;
}e[200010];

void add(int u,int v)
{
    e[k].v=v;
    e[k].next=head[u];
    head[u]=k++;
    e[k].v=u;
    e[k].next=head[v];
    head[v]=k++;
}

void dfs1(int u)
{
    for(int i=head[u];i!=-1;i=e[i].next)
    {
        int v=e[i].v;
        if(dis1[v]==inf)
        {
            dis1[v]=dis1[u]+1;
            dfs1(v);
        }
    }
}

void dfsn(int u)
{
    for(int i=head[u];i!=-1;i=e[i].next)
    {
        int v=e[i].v;
        if(disn[v]==inf)
        {
            disn[v]=disn[u]+1;
            dfsn(v);
        }
    }
}

int get_ans(int u)
{
    vis[u]=1;
    int tmp_ans=1;
    for(int i=head[u];i!=-1;i=e[i].next)
    {
        int v=e[i].v;
        if(vis[v])continue;
        if(dis1[v]+disn[v]==dis1[n]&&dis1[v]>len)continue;
        tmp_ans+=get_ans(v);
    }
    return tmp_ans;
}

int main()
{
    //freopen("in.txt","r",stdin);
    scanf("%d",&n);
    int uu,vv;
    for(int i=1;i<=n;i++)head[i]=-1;
    for(int i=1;i<n;i++)
    {
        scanf("%d%d",&uu,&vv);
        add(uu,vv);
    }
    for(int i=1;i<=n;i++)dis1[i]=disn[i]=inf;
    dis1[1]=0;disn[n]=0;
    dfs1(1);
    dfsn(n);
    len=dis1[n]/2;
    int ans=get_ans(1);
    int res=n-ans;
    if(ans>res)printf("Fennec");
    else printf("Snuke");
    return 0;
}


Measured memory_bytes: 6144