akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
constexpr char ln = '\n';

const int mx=2000010;
const ll mod=1e9+7;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint& operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; }
    mint& operator-=(const mint a) { if ((x += mod-a.x) >= mod) x -= mod; return *this; }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { mint res(*this); return res+=a; }
    mint operator-(const mint a) const { mint res(*this); return res-=a; }
    mint operator*(const mint a) const { mint res(*this); return res*=a; }
    mint pow(ll t) const { if (!t) return 1; mint a = pow(t>>1); a *= a; if (t&1) a *= *this; return a; }
    // for prime mod
    mint inv() const { return pow(mod-2); }
    mint& operator/=(const mint a) { return (*this) *= a.inv(); }
    mint operator/(const mint a) const { mint res(*this); return res/=a; }
};

vector<ll> inv,fact,invfact;
void mod_build(int n){  
  fact.resize(n+1); inv.resize(n+1); invfact.resize(n+1);
  fact[0]=inv[0]=invfact[0]=1; inv[1]=1;
  rep(i,n){
    fact[i+1]=fact[i]*(i+1)%mod;
    if(i>0)inv[i+1]=mod-inv[mod%(i+1)]*(mod/(i+1))%mod;
    invfact[i+1]=invfact[i]*inv[i+1]%mod;
  }
}
ll perm(int n,int k){ if(n<0||k<0||k>n){ return 0; } else { return fact[n]*invfact[n-k]%mod; } }
ll comb(int n,int k){ if(n<0||k<0||k>n){ return 0; } else { return (fact[n]*invfact[n-k]%mod)*invfact[k]%mod; }}
ll modpow(ll x,ll n){
  x%=mod; ll res=1;
  while(n>0){ if(n&1){res=res*x%mod;} x=x*x%mod; n>>=1; }
  return res;
}
ll modinv(ll a){ return modpow(a, mod-2); }

int main(){
  mod_build(mx);
  int k;
  string s;
  cin >> k >> s;
  int n = s.size();

  mint ans = 0;
  REP(i,n,k+n+1){ // pow (x+25),(n+k)   のうち、xの次数がn以上の係数の和を見る
    mint tmp = comb(n+k,i);
    tmp *= modpow(25,n+k-i);
    ans += tmp;
  }
  cout << ans.x << ln;
  return 0;
}

Measured memory_bytes: 52152
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace A
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var A = int.Parse(Console.ReadLine());
            var B = int.Parse(Console.ReadLine());
            var C = int.Parse(Console.ReadLine());
            var D = int.Parse(Console.ReadLine());
            Console.WriteLine(Math.Min(A, B) + Math.Min(C, D));
        }
    }
}


Measured memory_bytes: 11092
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {
	var w string
	fmt.Scan(&w)

	s := bufio.NewScanner(os.Stdin)
	cnt := 0
	for s.Scan() {
		l := s.Text()
		if l == "END_OF_TEXT" {
			break
		}
		cnt += find(l, w)
	}
	fmt.Println(cnt)
}

func find(l, w string) int {
	cnt := 0
	for _, each := range strings.Split(l, " ") {
		if strings.ToLower(each) == w {
			cnt++
		}
	}
	return cnt
}



Measured memory_bytes: 1144
#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 FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;
  
int main()
{
  int W,H,N;
  cin >> W >> H >>N;

  vector<vector<int>> A(N,vector<int>(3));
  REP(i, N){
    REP(j, 3){
      cin >> A.at(i).at(j);
    }
  }
  
  int MAX_X=W,MIN_X=0,MAX_Y=H,MIN_Y=0;

  REP(i,N){
    if(A.at(i).at(2)==1){
      MIN_X=max(MIN_X,A.at(i).at(0));
    }else if(A.at(i).at(2)==2){
      MAX_X=min(MAX_X,A.at(i).at(0));
    }else if(A.at(i).at(2)==3){
      MIN_Y=max(MIN_Y,A.at(i).at(1));
    }else if(A.at(i).at(2)==4){
      MAX_Y=min(MAX_Y,A.at(i).at(1));
    }
  }

  cout << max(0,MAX_X-MIN_X)*max(0,MAX_Y-MIN_Y) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,st,ed) for(register int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(register int i=st,i##end=ed;i>=i##end;--i)
typedef long long ll;
inline int read(){
	int x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x*f;
}
inline ll readll(){
	ll x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1ll)+(x<<3ll)+(c^'0');
	return x*f;
}
const int maxn=2e5+10;
int a[maxn],p[maxn];
int main(){
	int n=read();
	REP(i,1,n){
		int x=read();
		a[x]=i;
	}
	int tmp=0,ans=0;
	REP(i,1,n){
		if(a[i]>a[i-1]) tmp++;
		else tmp=1;
		ans=max(ans,tmp);
	}
	printf("%d\n",n-ans);
	return 0;
}


Measured memory_bytes: 1024
while True :
    n, k = map(int, input().split())
    
    if n == 0 :
        break
    else :
        A = []
        S = []
        s = 0
        cnt = 0
        
        for i in range(n) :
            A.append(int(input()))
            
        for i in range(k) :
            s += A[i]
        S.append(s)
            
        for j in range(k, n) :
            s = S[cnt] - A[j - k] + A[j]
            S.append(s)
            cnt += 1
        
        print(max(S))


Measured memory_bytes: 11524
from collections import Counter

MOD = 10**9+7
MAX_N = 50
inv = [0] * (MAX_N+1)
finv = [0] * (MAX_N+1)
fac = [0] * (MAX_N+1)
inv[1] = 1
finv[0] = 1; finv[1] = 1
fac[0] = 1; fac[1] = 1

def COM_init():
    for i in range(2, MAX_N+1):
        inv[i] = -(MOD//i)*inv[MOD%i]%MOD
        finv[i] = finv[i-1]*inv[i]%MOD
        fac[i] = fac[i-1]*i%MOD

def COM(a, b):
    if a < 0 or b < 0:return 0
    if a < b:return 0
    
    return fac[a]*finv[a-b]*finv[b]%MOD

def main():
    N, P = map(int, input().split())
    A = list(map(int, input().split()))
    B = [a%2 for a in A]
    c = Counter(B)
    
    n0 = c[0]
    n1 = c[1]
    ans = 0
    COM_init()
    for i in range(P, n1+1, 2):
        ans += pow(2, n0) * COM(n1, i)

    print(ans) 
         

if __name__ == "__main__":
    main()

Measured memory_bytes: 9460
import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int sx = in.nextInt(), sy = in.nextInt();
        int tx = in.nextInt(), ty = in.nextInt();
        int row = tx - sx;
        int col = ty - sy;

        for (int i = 0; i < col; ++i) System.out.print('U');
        for (int i = 0; i < row; ++i) System.out.print('R');

        for (int i = 0; i < col; ++i) System.out.print('D');
        for (int i = 0; i < row; ++i) System.out.print('L');

        System.out.print('L');

        for (int i = 0; i < col + 1; ++i) System.out.print('U');
        for (int i = 0; i < row + 1; ++i) System.out.print('R');

        System.out.print('D');
        System.out.print('R');

        for (int i = 0; i < col + 1; ++i) System.out.print('D');
        for (int i = 0; i < row + 1; ++i) System.out.print('L');

        System.out.print('U');
    }
}



Measured memory_bytes: 24964
#include <iostream>
#include<string>
#include<algorithm>
#include<stdio.h>

using namespace std;

int main(){
    char c;
    cin>>c;

    char v[]="aoeiu";
    for(int i=0; i<5; i++){
        if(v[i]==c){
            cout<<"vowel"<<endl;
            return 0;
        }
    }
    cout<<"consonant"<<endl;
    return 0;
}

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


int main() {
    int n;
    std::cin >> n;
    std::vector<int> l(n);
    std::vector<int> r(n);
    long long ans = 0;
    for (int i = 0; i < n; i++)
    {
        std::cin >> l[i] >> r[i];
        ans += r[i] - l[i] + 1;
    }

    std::cout << ans << "\n";
}

Measured memory_bytes: 3604
#include <unordered_map>
#include <iostream>
using namespace std;
int main() {
    int n; cin >> n;
    unordered_map<int, int> a;
    long long ans = 0;
    for (int i = 0; i < n; i++) {
        int x; cin >> x;
        ans += a[i+1-x];
        a[x+i+1]++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 18596
#!/usr/bin/env python3

#import
#import math
#import numpy as np
#= int(input())
S = input()
T = input()

ls = len(S)
lt = len(T)

dp = [[0] * (lt + 1) for _ in range(ls + 1)]

for i in range(1, ls + 1):
    for j in range(1, lt + 1):
        if S[i - 1] == T[j - 1]:
            dp[i][j] = dp[i - 1][j - 1] + 1
            
        else:
            dp[i][j] = max(dp[i - 1][j], dp[i][j - 1])
            
i = ls
j = lt
ans = ""

while i > 0 and j > 0:
    if dp[i][j] == dp[i - 1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j - 1]:
        j -= 1
    else:
        ans = S[i - 1] + ans
        i -= 1
        j -= 1

print(ans)




Measured memory_bytes: 144592
package main

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

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a > 0 {
		return a
	}
	return -a
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

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

func main() {
	x := readInt()
	a := readInt()
	if x < a {
		fmt.Println(0)
	} else {
		fmt.Println(10)
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main()
  {int n, c{}; cin >> n;
  int P[n]; for (int &p : P) cin >> p;
  for (int i{1}; i < n - 1; ++i) c += P[i] == P[i - 1] + P[i] + P[i + 1] - min({P[i - 1], P[i], P[i + 1]}) - max({P[i - 1], P[i], P[i + 1]});
  cout << c;}

Measured memory_bytes: 3604
#include<iostream>
using namespace std;
int n,s;
int main()
{
	cin>>n;
	if(n<10)
	{
		s=n;
	}
	else
	{
		n=n%10;
		s=n;
	}
	if((s==5)or(s==2)or(s==4)or(s==7)or(s==9)){cout<<"hon";}
	else if((s==0)or(s==1)or(s==6)or(s==8)){cout<<"pon";}
	else{cout<<"bon";}
	return  0;
}

Measured memory_bytes: 3620
#include<iostream>
#define _USE_MATH_DEFINES
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vec;
typedef vector<vector<ll>> mat;
typedef pair<ll,ll> P;
typedef map<ll,ll> MP;
typedef priority_queue<ll> PQ;
typedef stack<ll> ST;
typedef queue<ll> QUE;
#define pb push_back
#define st first
#define nd second
#define SZ(x) ((int)(x).size())
#define FOR(i,s,n) for(int i=(int)(s); i< (int)(n); i++)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define each(x,c) for(auto x: (c))
#define LB(x,a) lower_bound(all(x), a)
#define UB(x,a) upper_bound(all(x), a)
const ll mod=1e9+7;
const ll INF=1e18;
const double EPS=1.0e-10;
const double PI=M_PI;

int main(){
    ll N,K; cin>>N>>K;
    cout<<min(N%K, K-N%K)<<endl;
}

Measured memory_bytes: 256
import sys

input = sys.stdin.readline


def main():
    N, M = map(int, input().split())
    G = [[] for _ in range(N)]
    for i in range(M):
        a, b = map(lambda x: int(x) - 1, input().split())
        G[a].append(b)
        G[b].append(a)

    ans = "IMPOSSIBLE"
    for v in G[0]:
        if N - 1 in G[v]:
            ans = "POSSIBLE"

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 38320
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;
const int kmax = 510000;

long long fact[kmax], fact_inv[kmax], inv[kmax];

int gcd(int a, int b)
{
    if (!b) {
        return a;
    }

    return gcd(b, a % b);
}

void init_comb()
{
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < kmax; i++) {
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
    }
}

long long comb(int n, int r)
{
    if (n < r) {
        return 0;
    }

    if (n < 0 || r < 0) {
        return 0;
    }

    return fact[n] * (fact_inv[r] * fact_inv[n - r] % mod) % mod;
}

template <typename T, T N>
class UnionFind {
    T parent_[N];
    T rank_[N];
    T size_[N];

public:
    UnionFind();
    T Root(T idx);
    bool IsSame(T x, T y);
    void Unite(T x, T y);
    T GetSize(T idx);
};

template <typename T, T N>
UnionFind<T, N>::UnionFind()
{
    for (T i = 0; i < N; i++) {
        parent_[i] = i;
        rank_[i] = 0;
        size_[i] = 1;
    }
}

template <typename T, T N>
T UnionFind<T, N>::Root(T idx)
{
    return parent_[idx] == idx ? idx : parent_[idx] = Root(parent_[idx]);
}

template <typename T, T N>
bool UnionFind<T, N>::IsSame(T x, T y)
{
    return Root(x) == Root(y);
}

template <typename T, T N>
void UnionFind<T, N>::Unite(T x, T y)
{
    x = Root(x);
    y = Root(y);
    if (x == y) {
        return;
    }

    if (rank_[x] < rank_[y]) {
        parent_[x] = y;
        size_[y] += size_[x];
    } else {
        parent_[y] = x;
        size_[x] += size_[y];
        if (rank_[x] == rank_[y]) {
            rank_[x]++;
        }
    }
}

template <typename T, T N>
T UnionFind<T, N>::GetSize(T idx)
{
    return size_[Root(idx)];
}

long long pow_mod(long long n, long long p, long long m)
{
    if (p == 0) {
        return 1;
    }

    if (p % 2 == 0) {
        long long t = pow_mod(n, p / 2, m);
        return t * t % m;
    }
    return n * pow_mod(n, p - 1, m) % mod;
}

long long nCr_mod(long long n, long long r)
{
    long long x = 1;
    for (long long i = n - r + 1; i <= n; i++) {
        x *= i;
        x %= mod;
    }

    long long a = 1;
    for (long long i = 1; i <= r; i++) {
        a *= i;
        a %= mod;
    }

    long long y = pow_mod(a, mod - 2, mod) % mod;

    return x * y % mod;
}

int main()
{
    long long n, a, b;
    std::cin >> n >> a >> b;

    long long ans = pow_mod(2, n, mod) - nCr_mod(n, a) - nCr_mod(n, b) - 1;
    ans %= mod;

    if (ans < 0) {
        ans += mod;
    }

    std::cout << ans << std::endl;
}


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

int main(){
    
    //入力要素数を受け取る
    int n;
    scanf("%d", &n);

    //答えを格納しておく変数を定義
    int AC = 0, WA = 0, TLE = 0, RE = 0;

    for (int i = 0; i < n;i++){
        
        //文字列を受け取る
        char c[5];
        scanf("%s", c);

        //場合分け

        //こう書けそうだけど、書けない
        /*
        if(c == "AC"){
            AC++;
        }*/

        //どう書くかというと、こう書く
        //一致してるときの戻り値が0なのちょっとわかりにくいよね
        if(!strcmp(c,"AC")){
            AC++;
        }
        else if(!strcmp(c,"WA")){
            WA++;
        }
        else if (!strcmp(c, "TLE"))
        {
            TLE++;
        }
        else{
            RE++;
        }
    }

    //出力例に沿った出力を行う
    printf("AC x %d\n", AC);
    printf("WA x %d\n", WA);
    printf("TLE x %d\n", TLE);
    printf("RE x %d\n", RE);
}

Measured memory_bytes: 1732
import collections
n=int(input())
s=[]
for i in range(n):
  s.append(input())
s_cnt=collections.Counter(s)
m=max(s_cnt.values())
ans=[]
cnt=0
for i,v in s_cnt.items():
  if v==m:
    ans.append(i)
    cnt+=1
ans.sort()
for i in range(cnt):
  print(ans[i])

Measured memory_bytes: 38880
r,g,b,n=map(int,input().split())
R=n//r
ans=0
for i in range(R+1):
  for j in range(((n-i*r)//g)+2):
    if 0<=n-i*r-j*g and (n-i*r-j*g)%b==0:
      ans+=1
print(ans)

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

template <typename T>
void print(const T &v);

int main()
{
    int n, W;
    cin >> n >> W;
    vector<ll> weight(n), value(n);

    rep(i, n)
    {
        cin >> weight[i] >> value[i];
    }
    vector<vector<ll>> dp(n + 1, vector<ll>(W + 1, 0));
    for (int i = 0; i < n; ++i)
    {
        for (int w = 0; w <= W; ++w)
        {
            if (w >= weight[i])
            {
                dp[i + 1][w] = max(dp[i][w - weight[i]] + value[i], dp[i][w]);
            }
            else
            {
                dp[i + 1][w] = dp[i][w];
            }
        }
    }
    cout << dp[n][W] << endl;
    return 0;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << " ";
        cout << v[i];
    }
    cout << endl;
}


Measured memory_bytes: 80256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iterator>
#include <fstream>
#include <cstddef>
#include <cstring>
//#include <chrono> //正確な時間計測のため
using namespace std;

typedef pair<int, int> P;
typedef long long ll;
#define PB push_back
#define rep(i, a) for(int i = 0; i < a; i++)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define mp make_pair
#define INT int_64
#define MOD 998244353
const ll INF = (1<<30);
const ll NEGA=-INF*10000; 

//階乗
ll Kaijou(ll a) {
if (a < 2) return 1;
return a * Kaijou(a - 1)%MOD;
}

//逆元の計算用(pは素数のときb=p-2で逆元)
ll calc(ll a, ll b, ll p) {
	if (b == 0) return 1;
	if (b % 2 == 0) {
		ll d = calc(a, b / 2, p);
		return (d*d) % p;
	}
	else {
		return (a*calc(a, b - 1, p)) % p;
	}
}


//ユークリッドの互除法
ll gcd(ll x, ll y) {
	if (x < y) swap(x, y);
	if (y == 0) return x;
	return gcd(y, x%y);
}

ll CCC(ll all,ll a,ll b,ll c){
  all=Kaijou(all)%MOD;
  a=Kaijou(a);
  b=Kaijou(b);
  c=Kaijou(c);
  ll sita=((a*b)%MOD*c)%MOD;
  return all*calc(sita,MOD-2,MOD)%MOD;
}

 ll ans=INF;

 ll cc[501][501];
 ll D[31][31];
 
 ll pdmin[3];

//再帰なし累乗
ll iPOW(ll x, ll p){
  ll result;
	for(result=1;p!=0;p>>=1)
	{
    if(p&1) result*=x;
	  x*=x;
  }
  return result;
}


int main(){  
 int a,b;
 cin>>a>>b;
 if(a<=8&&b<=8) cout<<"Yay!"<<endl;
 else cout<<":("<<endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[100005];
int main()
{
	int n;
	cin>>n;
	while(n--)
	{
		int l,r;
		cin>>l>>r;
		a[l]++;
		a[r+1]--;
	}
	int cur=0;
	int ans=0;
	for(int i=1;i<=100000;++i)
	{
		cur+=a[i];
		if(cur)
			ans++;
	}
	cout<<ans;
	return 0;
 } 

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

template<class T> inline void read(T &x) {
    x = 0;
    char ch = getchar(), w = 0;
    while (!isdigit(ch)) w = (ch == '-'), ch = getchar();
    while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
    x = w ? -x : x;
    return;
}

int main() {
    int n;
    read(n);
    for (int i = 1; i <= 9; ++i) {
        for (int j = 1; j <= 9; ++j) {
            if (i * j == n) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    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;
using ll = long long;
 
 int main() {
    int N;cin>>N;
	vector<tuple<string,int,int>> vec;
    rep(i,N){
      string st="";cin>>st;
      int a=0;cin>>a;
      tuple<string,int,int> tup(st,(-1)*a,i+1);
      vec.push_back(tup);
    }
   
   sort(vec.begin(),vec.end());
   
   rep(i,N){
     int ans;
     tie(ignore,ignore,ans)=(vec[i]);
     cout << ans << endl;
   }
 }

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,D;
  cin >>N >>D;
  int ans;
  if(N%(2*D+1)==0){
    ans= N/(2*D+1);
  }else{
    ans = N/(2*D+1)+1;
  }
  cout <<ans <<endl;
}

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

const int N = 100010;
using pii = std::pair <int, int>;

int x[N], l[N];
pii p[N];

int main(){
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; ++ i){
        scanf("%d%d", &x[i], &l[i]);
        p[i] = {x[i] + l[i], x[i] - l[i]};
    }
    std::sort(p, p + n);
    std::map <int, int> dp;
    dp[INT_MIN] = 0;
    for (int i = 0; i < n; ++ i){
        auto u = dp.upper_bound(p[i].second);
        -- u;
        int now = u -> second + 1;
        now = std::max(now, std::prev(dp.end()) -> second);
        dp[p[i].first] = now;
    }
    printf("%d\n", std::prev(dp.end()) -> second);
    return 0;
}


Measured memory_bytes: 6528
#include<bits/stdc++.h>
#define N (100009)
using namespace std;

int n,l,q,a,b,ans,x[N],f[N][21];

int main()
{
	cin>>n;
	for (int i=1; i<=n; ++i) cin>>x[i];
	cin>>l>>q;
	for (int i=1; i<=n; ++i)
		f[i][0]=upper_bound(x+1,x+n+1,x[i]+l)-x-1;
	for (int i=1; i<=20; ++i)
		for (int j=1; j<=n; ++j)
			f[j][i]=f[f[j][i-1]][i-1];
	for (int i=1; i<=q; ++i)
	{
		cin>>a>>b; ans=0;
		if (a>b) swap(a,b);
		for (int i=20; i>=0; --i)
			if (f[a][i]<b) a=f[a][i], ans+=1<<i;
		ans++;
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 9472
#include <iostream>
#define ffor(a, b, c) for (int a=b; a<=c; a++)
using namespace std;

int n, act[3][100001], dp[3][100001];

int main() {
	cin>>n;
	ffor (i, 1, n) cin>>act[0][i]>>act[1][i]>>act[2][i];
	ffor (i, 1, n) {
		ffor (j, 0, 2) {
			ffor (k, 0, 2) {
				if (j!=k) dp[k][i] = max(dp[j][i-1]+act[k][i], dp[k][i]);
			}
		}
	}
	cout<<max(dp[0][n],max(dp[1][n], dp[2][n]))<<endl;
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> pipii;
typedef pair<pii, pii> piipii;

#define mp make_pair
#define fi first
#define se second
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define eb emplace_back
int x[100005];
int par[17][100005];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;  
    for(int i=1;i<=n;i++) cin >> x[i];
    int l;
    cin >> l;
    for(int i=1;i<n;i++){
        int lo = i+1, hi = n;
        while(lo <= hi){
            int mid = (lo+hi)/2;
            if(x[mid]-x[i] <= l) par[0][i] = mid, lo = mid+1;
            else hi = mid-1;
        }
    }
    for(int j=1;j<17;j++){
        for(int i=1;i<=n;i++){
            if(par[j-1][i] != 0) par[j][i] = par[j-1][par[j-1][i]];
        }
    }
    int q;
    cin >> q;
    for(int i=1;i<=q;i++){
        int a, b;
        cin >> a >> b;
        if(a > b) swap(a, b);
        int cur = a, ans = 0;
        for(int j=16;j>=0;j--){
            if(par[j][cur] != 0 && par[j][cur] <= b){
                cur = par[j][cur];
                ans += (1<<j);
            }
        }
        if(cur != b) ans++;
        printf("%d\n", ans);
    }
}

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

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

    while(1)
    {
        if(S.empty()) break;
        if(S.substr(S.size()-5, 5)=="dream")
        {
            S.erase(S.size()-5, 5);
        }else if(S.substr(S.size()-5, 5)=="erase")
        {
            S.erase(S.size()-5, 5);
        }else if(S.substr(S.size()-6, 6)=="eraser")
        {
            S.erase(S.size()-6, 6);
        }else if(S.substr(S.size()-7, 7)=="dreamer")
        {
            S.erase(S.size()-7, 7);
        }
        else
        {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 3744
#include<stdio.h>

int main(void){
  int ans,a,b,c;
  char d,e;
  scanf("%d%c%d%c%d",&a,&d,&b,&e,&c);
  if(a<2019){
    printf("Heisei\n");
  }else if(a==2019){
    if(b<4){
      printf("Heisei\n");
    }else if(b==4){
      if(c<=30){
        printf("Heisei\n");
      }else{
        printf("TBD");
      }
    }else{
      printf("TBD");
    }
  }else{
    printf("TBD");
  }
  return 0;
}


Measured memory_bytes: 128
M, D = map(int, input().split())

cnt = 0
for m in range(1, M + 1):
    for d in range(21, D + 1):
        a = d // 10
        b = d % 10
        if b < 2:
            continue

        if a * b == m:
            cnt += 1

print(cnt)


Measured memory_bytes: 38640
# -*- coding: utf-8 -*-


def main():
    """Function."""
    s = str(input())
    check = set()

    for i in range(len(s)):
        check.add(s[i])

    if len(s) != len(check):
        print("no")
    else:
        print("yes")


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n, k = MAP()
x = LIST()

ans = inf
for i in range(n - k + 1):
    ans = min(ans, min(abs(x[i]),abs(x[i+k-1])) + x[i+k-1] - x[i])

print(ans)

Measured memory_bytes: 21680
#include <bits/stdc++.h>
   
using namespace std;
     
#define PB(x) push_back(x)
#define ALL(x) (x).begin(), (x).end()
#define ALLR(x) (x).rbegin(), (x).rend()
#define MP(x) make_pair(x);
    
#define debug(x) cerr << #x << '=' << x << endl;
#define debug2(x, y) cerr << #x << '=' << x << ' ' << #y << '=' << y << endl;
#define debugn(a) for (int x: a) cerr << x << ' '; cerr << endl;
#define debugm(a, n, m) for (int i = 0; i < n; i++, cout << endl)           \
						for (int j = 0; j < m; j++) cout << a[i][j] << ' ';

#define int long long
     
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<pair<int, int>> vii;
typedef vector<string> vs;
typedef unsigned long long ull;

const int INF = LONG_LONG_MAX;
const int NINF = LONG_LONG_MIN;
const int mmod = 1000000007;

int32_t main()
{	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int a, b;
	cin >> a >> b;
	
	int socket = 1;
	int i = 0;
	while (socket < b) {
		socket -= 1;
		socket += a;
		i++;
	}
	cout << i << endl;
}


Measured memory_bytes: 256
from scipy.sparse import*
f=csgraph.johnson
n,m,l,*t=map(int,open(0).read().split())
m*=3
[*map(print,f(f(csr_matrix((t[2:m:3],(t[:m:3],t[1:m:3])),[n+1]*2),0)<=l)[t[m+1::2],t[m+2::2]].clip(0,n)%n-1)]

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

using namespace std;

int main(){
	int n, ans = 0;
	string s;
	cin >> s;
	bool f = true;
	n = s.size();
	s = "0" + s;
	if(s[1] == '0' || s[n] == '1') f = false;
	for(int i = 1; i <= n / 2; i++){
		if(s[i] != s[n - i]){
			f = false;
			break;
		}
	}
	if(f){
		int p1 = 1, p2;
		for(int i = 1; i <= n; i++){
			if(s[i] == '1'){
				p2 = i;
				for(; p1 < p2; p1++){
					cout << p1 << " " << p2 << endl;
				}
			}else if(i == n){
				for(int i = p1 + 1; i <= n; i++){
					cout << p1 << " " << i << endl;
				}
			}

		}
	}else{
		cout << "-1" << endl;
	}
	return 0;
}

Measured memory_bytes: 1660
N = int(input())

P = tuple(map(int,input().split()))
Q = tuple(map(int,input().split()))

from itertools import permutations
Perm = permutations(range(1,N+1),N)
a = 0
b = 0
for i,p in enumerate(Perm):
    if P == p: a = i
    if Q == p: b = i
print(abs(a-b))

Measured memory_bytes: 3064
import sys
S = input()

string = ''
if S[0] == 'A':
    for i in range(len(S)):
        if (i > 1) and (i < (len(S) - 1)):
            string += S[i]
        #print(string)
    if string.count('C') == 1:
        #index = string.index('C')
        #newS = S.strip('C')
        newS = S.replace("C", "")
        #print(newS)

        if newS[1:].islower():
            print('AC')
            sys.exit()

print('WA')      

Measured memory_bytes: 3060
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

	static int nmax = 8;
	static boolean graph[][] = new boolean[nmax][nmax];
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		Integer N = Integer.parseInt(sc.next());
		Integer M = Integer.parseInt(sc.next());
		for(int i=0;i<M;i++) {
			int a = Integer.parseInt(sc.next());
			int b = Integer.parseInt(sc.next());
			graph[a-1][b-1] = true;
			graph[b-1][a-1] = true;
		}
		boolean visited[] = new boolean[nmax];
		for(int i=0;i<N;i++) {
			visited[i] = false;
		}
		visited[0] = true;
		int result = dfs(0,N,visited);
		out.println(result);
		
		
		out.flush();
	}

	public static int dfs(int v,int N,boolean visited[]) {
		boolean all_visited = true;

		for(int i=0;i<N;i++) {
			if(visited[i]==false) {
				all_visited = false;
			}
		}

		if(all_visited) {
			return 1;
		}
		int ret = 0;

		for(int i=0;i<N;i++) {
			if(graph[v][i] == false) {
				continue;
			}
			if(visited[i]) {
				continue;
			}

			visited[i] = true;
			ret += dfs(i,N,visited);
			visited[i] = false;
		}
		return ret;
	}
}

Measured memory_bytes: 22228
N = gets.to_i
ans = 1
max_count = 0

def countup(n)
    count = 0
    while(n.even?) do
        n /= 2
        count += 1
    end
    count
end

(1..N).each do |i|
    count = countup(i)
    if count > max_count
        max_count = count
        ans = i
    end
end
puts ans


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

using namespace std;
int n,i,j,k,dp[(1<<21)+5],c,m,x,y;
bool a[25][25];
const int mod=1e9+7;
int calc(int x)
{
    int nr=0;
    for(int i=0;i<=n;i++)
     if((1<<i)&x)nr++;
    return nr;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>n;
    for(i=1;i<=n;i++)
        for(j=1;j<=n;j++)
        cin>>a[i][j];
    dp[0]=1;
    for(i=0;i<(1<<n)-1;i++)
    {
        x=calc(i)+1;
        for(j=1;j<=n;j++)
            if(a[x][j]&&!((1<<(j-1))&i))
        {
            int new_mask=i|(1<<(j-1));
            dp[new_mask]+=dp[i];
            if(dp[new_mask]>=mod)dp[new_mask]-=mod;
        }
    }
    cout<<dp[(1<<n)-1];
    return 0;
}


Measured memory_bytes: 8448
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
using vd= vector<double>;
using vvd= vector<vd>;
using vc= vector<char>;
using vb= vector<bool>;
#define rep(i,x,n) for(int i=x; i<n; i++)
#define all(x) x.begin(), x.end()


int main(){
  int n,cnt=0;
  string s;
  cin >> n >> s;

  for(int i=0; i<n-2; i++){
    if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C'){
      cnt++;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  string array[4],name[4];
  int i=0,j;
  cin>>array[0]>>array[1]>>array[2];
  name[0]="A";
  name[1]="B";
  name[2]="C";
  for( ; ; ){
    if(array[i].size()==0){
      cout<<name[i]<<endl;
      return 0;
    }
    if(array[i].at(0)=='a'){
      j=0;
    }else if(array[i].at(0)=='b'){
      j=1;
    }else if(array[i].at(0)=='c'){
      j=2;
    }
    array[i].erase(array[i].begin());
    i=j;
  }
}

Measured memory_bytes: 256
#include <stdio.h>

int n, m;
int k;
int a;
int dat[35];

int main()
{
	int ans = 0;

	scanf("%d %d", &n, &m);

	for (int i = 0; i < n; i++) {
		scanf("%d", &k);

		for (int j = 0; j < k; j++) {
			scanf("%d", &a);
			dat[a]++;
		}
	}

	for (int i = 0; i <= m; i++) {
		if (dat[i] == n) {
			ans++;
		}
	}

	printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main(void)
{
	int N,min,tmp;
	
	scanf("%d",&N);
	
	int a[N];
	
	for(int i=0; i<N;i++)
	{
		if(i==N-1)
		{
			scanf("%d",&a[i]);
		}
		else { scanf("%d ",&a[i]);}
	}
	
	int count = 0;
	for(int i=0;i<N;i++)
	{
		min = i;
		for(int j=i;j<N;j++)
		{
			if(a[j] < a[min])
			{
				min = j;
			}
		}
		
		
			tmp =a[i];
			a[i]=a[min];
			a[min]=tmp;
			
		if (a[i] != a[min])
		{
			count++;
		}
		
	}
	
	for(int i=0;i<N;i++)
	{
		if(i==N-1)
		{
			printf("%d\n",a[i]);
		}
		
		else { printf("%d ",a[i]);}
	}
	
	printf("%d\n",count);
	
	return 0;
}
		


Measured memory_bytes: 2100
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using p = pair<int, int>;
typedef vector<int> vi;
using Graph = vector<vector<int>>;

int main() {
  int N;
  string S;
  cin >> N >> S;

  int len = S.size();

  rep (i, len) {
    int x = S[i] - 'A';
    x = (x + N) % 26;
    putchar('A' + x);
  }
  cout << endl;

  return 0;
}

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

using namespace std;

int main()
{
	int n;
	cin >> n;
	if (n == 1) {
		cout << "Hello World" << endl;
	} else if (n == 2) {
		int a, b;
		cin >> a >> b;
		cout << a + b << endl;
	}
	return 0;
}


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

#define ll long long 
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin(),(x).end()
#define f(i, a, b) for (int i=a; i<(signed)(b); ++i)
#define pc __builtin_popcount // counts number of 1's in bin(num)
#define pb push_back
#define mp make_pair

const double pi = 2*acos(0.0);
//__gcd(n1, n2);
//cout << fixed;
//cout << setprecision(6); //fixes # of dp
//tgamma(i+1) is 1!

void solve(){
    int r;
    cin >> r;
    cout << fixed << setprecision(3) << 2*pi*r;
}


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








Measured memory_bytes: 3804
#include<stdio.h>
#define N 100
int bubbleSort(int *,int);
int main(){
  int A[N];
  int i,n,c=0;
  scanf("%d",&n);
  for(i=0;i<n;i++) {
    scanf("%d",&A[i]);
  }
  c = bubbleSort(A,n);
  for(i=0;i<n;i++) {
    if(i > 0) printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
  printf("%d\n",c);

  return 0;
}

int bubbleSort(int *A,int n){
  int i,j,tmp,c=0;
  for(i = 0;i < n-1;i++) {
    for(j = n-1;j > i;j--) {
      if(A[j]<A[j-1]) {
	tmp = A[j];
	A[j] = A[j-1];
	A[j-1] = tmp;
	c++;
      }
    }
  }
  return c;
}

Measured memory_bytes: 604
#include <map>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
typedef long long ll ;
#define rep(i, a, b) for (int i = a; i <= b; ++ i) 
const int N = 100005, M = 2155, V = 100000 ;
using namespace std ;

map <ll, vector <pair <ll, int> > > S ;
map <ll, bool> is_square ;
map <vector <pair <ll, int> >, int> last, times ;
bool vis[N] ; int n ; 
vector <pair <ll, int> > p[N] ;

void pre() {
	rep(i, 1, V) {
		is_square[(ll) i * i] = true ;
		int x = i ;
		vector <pair <ll, int> > it ;
		rep(j, 2, i) {
			if (j * j > i) break ;
			if (x % j) continue ;
			it.push_back(make_pair(j, 0)) ;
			int pos = (int) it.size() - 1 ;
			for ( ; x % j == 0 ; x /= j) it[pos].second += 2 ;
			it[pos].second %= 3 ;
			if (!it[pos].second) it.pop_back() ;
		}
		if (x > 1) it.push_back(make_pair(x, 2)) ;
		S[(ll) i * i] = it ;
	}
}

bool cmp(pair <ll, int> a, pair <ll, int> b) {
	return a.first < b.first ;
}

vector <pair <ll, int> > getvec(ll x) {
	vector <pair <ll, int> > ret ;
	pair <ll, int> d[105] ;
	int d0 = 0 ;
	rep(i, 2, M) {
		if (x % i) continue ;
		d[++ d0] = make_pair(i, 0) ;
		for ( ; x % i == 0LL ; x /= i) d[d0].second += 1 ;
	}
	if (is_square[x]) {
		rep(i, 0, (int) S[x].size() - 1) d[++ d0] = S[x][i] ;
	} else {
		d[++ d0] = make_pair(x, 1) ;
	}
	sort(d + 1, d + d0 + 1, cmp) ;
	for (int i = 1, j; i <= d0; i = j) {
		ret.push_back(d[i]) ;
		int pos = (int) ret.size() - 1 ;
		for (j = i + 1; j <= d0 && d[i].first == d[j].first; ++ j) ret[pos].second += d[j].second ;
		ret[pos].second %= 3 ;
		if (!ret[pos].second) ret.pop_back() ;
	}
	return ret ;
}

vector <pair <ll, int> > getrev(vector <pair <ll, int> > a) {
	vector <pair <ll, int> > b ;
	rep(i, 0, (int) a.size() - 1) {
		b.push_back(make_pair(a[i].first, 3 - a[i].second)) ;
	}
	return b ;
}

int main() {
	scanf("%d", &n) ;
	pre() ;
	rep(i, 1, n) {
		ll x ;
		scanf("%lld", &x) ;
		p[i] = getvec(x) ;
//		rep(j, 0, (int) p[i].size() - 1) printf(" (%lld, %d) ", p[i][j].first, p[i][j].second) ; printf("\n") ;
		++ times[p[i]], last[p[i]] = i ;
	}
	memset(vis, true, sizeof(vis)) ;
	int ans = 0 ;
	rep(i, 1, n) if (last[p[i]] == i && vis[i]) {
		if (!p[i].size()) {
			ans ++ ;
			continue ;
		}
		vector <pair <ll, int> > q = getrev(p[i]) ;
		if (!times[q]) {
			ans += times[p[i]] ;
			continue ;
		}
		vis[last[q]] = false ;
		ans += max(times[p[i]], times[q]) ;
	}
	printf("%d\n", ans) ;
	return 0 ;
}

Measured memory_bytes: 77696
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);

		int mod=1000000007;

		int N = sc.nextInt();

		Map<Integer,Integer> data=new HashMap<Integer,Integer>();

		for (int i	 = 0; i < N; i++) {
			Integer buf=sc.nextInt();

			if(data.containsKey(buf)) {
				data.put(buf,data.get(buf)+1);
			}else {
				data.put(buf,1);
			}

		}

		int ans=1;
		if(N%2==1) {
			for (int i = 0; i < N; i+=2) {

				if(i==0) {
					if(!(data.containsKey(i) && data.get(i).equals(1))) {
						System.out.println(0);
						return;
					}

					continue;
				}

				if(!(data.containsKey(i) && data.get(i).equals(2))){
					System.out.println(0);
					return;
				}

			}


			for (int i = 0; i < N/2; i++) {
				ans=(ans*2)%mod;

			}

			System.out.println(ans);

		}else {
			for (int i = 1; i < N; i+=2) {

				if(!(data.containsKey(i) && data.get(i).equals(2))){
					System.out.println(0);
					return;
				}

			}


			for (int i = 0; i < N/2; i++) {
				ans=(ans*2)%mod;

			}

			System.out.println(ans);


		}
}

	//以下テンプレート

	public static int[] extgcd(int a, int b) {

		int x0 = 1;
		int x1 = 0;

		int y0 = 0;
		int y1 = 1;

		while (b != 0) {
			int q = a / b;
			int r = a % b;

			int x2 = x0 - q * x1;
			int y2 = y0 - q * y1;

			a = b;
			b = r;

			x0 = x1;
			x1 = x2;

			y0 = y1;
			y1 = y2;
		}

		return new int[] { a, x0, y0 };

	}

	static int gcd(int a, int b) {

		if (b == 0)
			return a;

		if (a < b) {
			int t = a;
			a = b;
			b = t;
		}

		return gcd(b, a % b);

	}

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

	static void swap(int[] a) {
		int t;

		t = a[0];
		a[0] = a[1];
		a[1] = t;

		return;
	}

	static <T> void output(List<T> list) {

		for (int i = 0; i < list.size(); i++) {
			System.out.print(list.get(i));

			if (i != list.size() - 1) {
				System.out.print(" ");
			} else {
				nl();
			}
		}

	}

	static void output(String[][] str) {

		for (int i = 0; i < str.length; i++) {
			for (int j = 0; j < str[i].length; j++) {
				print(str[i][j]);
			}

			nl();
		}

	}

	static void output(boolean flg, String Yes, String No) {

		if (flg) {
			pln(Yes);
		} else {
			pln(No);
		}

	}

	static void output(String[][] str, int digit) {

		String dig = "%" + String.valueOf(digit) + "s";

		for (int i = 0; i < str.length; i++) {
			for (int j = 0; j < str[i].length; j++) {
				System.out.printf(dig, str[i][j]);
			}
			nl();
		}

	}

	static void pln(String str) {
		System.out.println(str);
	}

	static void pln(int x) {
		System.out.println(x);
	}

	static void print(String str) {
		System.out.print(str);
	}

	static void print(int x) {
		System.out.print(x);
	}

	static void print(String str, int times) {
		for (int i = 0; i < times; i++) {
			print(str);
		}
	}

	static void print(int x, int times) {
		for (int i = 0; i < times; i++) {
			print(x);
		}
	}

	static void nl() {
		System.out.println();
	}

}


Measured memory_bytes: 61948
# -*- coding: utf-8 -*-


# 入力を整数に変換して受け取る
def input_int():
    return int(input())


# マイナス1した値を返却
def int1(x):
    return int(x) - 1


# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
    return map(int, input().split())


# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
    return tuple(map(int, input().split()))


# 半角スペース区切り入力をIntに変換してマイナス1した値を受け取る
def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


def main():
    a, b, c, d = input_to_int_map()

    print(max(a * c,
    a * d,
    b * c,
    b * d))


if __name__ == "__main__":
    main()


Measured memory_bytes: 9176
N = int(input())
S = [input() for _ in range(N)]
M = int(input())
T = [input() for _ in range(M)]

from collections import Counter
Sc = Counter(S)
Tc = Counter(T)
ans = 0
for s in set(S):
    tmp = Sc[s] - Tc[s]
    ans = max(ans, tmp)
print(ans)

Measured memory_bytes: 38384
/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2020.05.16 19:23:39
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

int main() {
    string s, t;
    cin >> s >> t;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] != t[i]) {
            puts("No");
            return 0;
        }
    }
    puts("Yes");
    return 0;
}

Measured memory_bytes: 3520
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<map>

using namespace std;

template<typename A, typename B> bool chmin(A &a, const B &b){ return b < a && (a = b, true); }
template<typename A, typename B> bool chmax(A &a, const B &b){ return a < b && (a = b, true); }

int main(){
  string s;
  cin >> s;
  sort (s.begin(),s.end());
  if (s == "abc"){
    cout << "Yes\n";
  }
  else{
    cout << "No\n";
  }
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<iostream>
using namespace std;
#define ll long long 
ll n;
ll ans=10000000000010;
bool is_prime(ll n){
    for(ll i=2;i<=sqrt(n)+1;++i){
        if(n%i==0) return false;
    }
    return true;
}
void Find(ll n){
    for(ll i=2;i<=sqrt(n)+1;++i){
        if(n%i==0){
            ll k=n/i;
            ans=min(ans,k+i-2);
        }
    }
}
int main(){
    cin>>n;
    if(n==1){
        cout<<0;
        return 0;
    }
    if(is_prime(n)){
        cout<<n-1;
        return 0;
    }
    Find(n); 
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
n, k = map(int,input().split())
h = [int(i) for i in input().split()]

if k >= n:
    ans = 0
else:
    h.sort()
    tmp = 0
    for i in range(n-k, n):
        tmp += h[i]
    ans = (sum(h) - tmp)
print(ans)


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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(condition) if(condition){cout << "POSSIBLE" << endl;}else{cout << "IMPOSSIBLE" << endl;}
#define Possible(condition) if(condition){cout << "Possible" << endl;}else{cout << "Impossible" << endl;}
#define possible(condition) if(condition){cout << "possible" << endl;}else{cout << "impossible" << endl;}
#define Size(n) (n).size()

typedef long long ll;


using namespace std;

const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;


long long int n,cnt=0,ans=0,a,b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true,graph[10][10];
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

      
      cin>>n>>m;
      rep(i,m){
        cin>>a>>b;
        graph[a][b]=true;
        graph[b][a]=true;
      }
      vector<ll> p(n-1);
      rep(i,n){
        if(i!=0){
          p[i-1]=i+1;
        }
      }
      //rep(i,n-1)Cout(p[i]);
      do{
        map<ll,ll> mp;
        fl=true;
        if(!graph[1][p[0]])continue;
        rep(i,n-2){
          if(!graph[p[i]][p[i+1]])fl=false;
        }
        if(!fl)continue;
        fl=true;
        rep(i,n-1)mp[p[i]]++;
        mp[1]++;
        rep(i,n){
          if(mp[i+1]!=1)fl=false;
        }
        if(!fl)continue;
        ans++;
      }while(next_permutation(all(p)));
     Cout(ans);

       
return 0;
}


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

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

  string S; cin >> S;
  int ans = 0;
  for (int i = 0; i < 4; i++) {
    ans += S[i] == '+' ? 1 : -1;
  }
  cout << ans << "\n";
}

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

int main(){
  int N,X;
  cin >>N>>X;
  int m[N];
  
  int ans=0;
  
  for(int i=0;i<N;i++){
    cin>>m[i];
    ans+=m[i];
  }
  X=X-ans;
  
  int min=100000;
  for(int i=0;i<N;i++){
    if(min>m[i])
      min=m[i];
  }
  
  cout<<N+X/min<<endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int r;
  cin>>r;
  cout<<r*r<<endl;
  
	  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define int long long
#define mod 1000000007
#define INF LLONG_MAX/5
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
signed main(){
	int a,ans=INF;
	cin>>a;
	for(int i=1;i*i<=a;i++){
		if(a%i==0){
			ans=min(ans,a/i-1+i-1);
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
const int MAX_L = 3010;
int dp[MAX_L][MAX_L] = {};
 
int main() {
  string s, t; cin >> s >> t;
  int ls = s.size(), lt = t.size();
  for(int i = 1; i <= ls; i++) {
    for(int j = 1; j <= lt; j++) {
      if(s[i-1] == t[j-1]) dp[i][j] = dp[i-1][j-1]+1;
      else dp[i][j] = max(dp[i][j-1], dp[i-1][j]);
    }
  }
 
  string ans = "";
  int res = dp[ls][lt];
  for(int i = ls; i >= 1; i--) {
    for(int j = lt; j >= 1; j--) {
      if(res-1 == dp[i-1][j-1] && s[i-1] == t[j-1]) {
        ans = s[i-1] + ans;
        res--;
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 35584
# -*- coding: utf-8 -*-


def main():
    s = input()
    n = len(s)

    if s == s[::-1]:
        t = s[:(n - 1) // 2]
        u = s[(n + 3) // 2 - 1:]

        if t == t[::-1] and u == u[::-1]:
            print('Yes')
        else:
            print('No')
    else:
        print('No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
template<class t> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}




int n,m;


signed main(){
	read(n);read(m);
	write(n*(n-1)/2+m*(m-1)/2);
}

Measured memory_bytes: 256