akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    long l = sc.nextLong();
    long[][] dp1 = new long[n][n];
    long[][] dp2 = new long[n][n];
    for(int i = 0; i < n; i++) {
      for(int j = 0; j < n; j++) {
        if(i != j) {
          dp1[i][j] = (long)Math.pow(10, 16);
          dp2[i][j] = (long)Math.pow(10, 16);
        }
      }
    }
    for(int i = 0; i < m; i++) {
      int a = sc.nextInt() - 1;
      int b = sc.nextInt() - 1;
      long c = sc.nextLong();
      dp1[a][b] = c;
      dp1[b][a] = c;
    }
    for(int k = 0; k < n; k++) {
      for(int i = 0; i < n; i++) {
        for(int j = 0; j < n; j++) {
          dp1[i][j] = Math.min(dp1[i][j], dp1[i][k] + dp1[k][j]);
        }
      }
    }
    for(int i = 0; i < n; i++) {
      for(int j = 0; j < n; j++) {
        if((i != j) && (dp1[i][j] <= l)) dp2[i][j] = 1;
      }
    }
    for(int k = 0; k < n; k++) {
      for(int i = 0; i < n; i++) {
        for(int j = 0; j < n; j++) {
          dp2[i][j] = Math.min(dp2[i][j], dp2[i][k] + dp2[k][j]);
        }
      }
    }

    int q = sc.nextInt();
    for(int i = 0; i < q; i++) {
      int s = sc.nextInt() - 1;
      int t = sc.nextInt() - 1;
      long ans = -1;
      if(dp2[s][t] < 1000) ans = dp2[s][t] - 1;
      System.out.println(ans);
    }
  }
}


Measured memory_bytes: 90400
n=int(input())
a=list(map(int,input().split()))
l=0
r=1
t=a[0]
ans=0
 
while l<n:
  if r==n:
    ans+=r-l
    l+=1
    continue
  if t+a[r]==t^a[r]:
    t+=a[r]
    r+=1
  else:
    ans+=r-l
    t-=a[l]
    l+=1
print(ans)


Measured memory_bytes: 32068
import java.util.Scanner;

public class Main {

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

	Scanner sc = new Scanner(System.in);

	void run() {

		int  n = sc.nextInt();
		int  t = sc.nextInt();
		
		int min = Integer.MAX_VALUE;
		for(int i =0 ; i < n ;i++){
			int cc = sc.nextInt();
			int tt = sc.nextInt();
			if(tt <= t){
				min = Math.min(min,cc);
			}
		}
		
		if(min == Integer.MAX_VALUE){
			System.out.println("TLE");
		}else{
			System.out.println(min);
		}
	}
}


Measured memory_bytes: 21840
#include <bits/stdc++.h>
#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>
#include <vector>
#include <string>
#define rep(i,n) for(int i = 0; i< (n);i++)
#define SORT(a) sort((a).begin(),(a).end());
#define che(a,string) cout<<string<<":"<<(a)<<endl;
#define ch(a,string) cout<<string<<":"<<(a)<<" ";
using namespace std;
typedef pair<int,int> p;

	int main(){
	int x;cin>>x;
	int ans = 0;
	for(int i = 31; i>0; i--){
	int k = 2;
	bool A = true;
	while(A){
		int a = pow(i,k);
		k++;
		if(a<=x){
			ans = max(a,ans);
			if(a*i>x||i==1){
				break;
			}
		}
		else{
			A=false;
		}
	}
}
cout<<ans<<endl;
	}



Measured memory_bytes: 256
using static System.Math;
using System.Linq;
using System;

public class rmq
{
    private  readonly int INTMAX = int.MaxValue;
    private  int[] dat;
    private  static int size;

    public rmq(int n)
    {
        size = 1;
        while (size < n) size *= 2;
        dat = Enumerable.Repeat(INTMAX, 2 * size - 1).ToArray();
    }

    public  void update(int i, int a)
    {
        i += size - 1;
        dat[i] = a;
        while (i > 0)
        {
            i = (i - 1) / 2;
            dat[i] = Min(dat[i * 2 + 1], dat[i * 2 + 2]);
        }
    }

   private   int query(int a, int b, int k, int L, int r)
    {
        if (r <= a || b <= L) return INTMAX;
        if (a <= L && r <= b) return dat[k];
        else
        {
            int vL = query(a, b, k * 2 + 1, L, (L + r) / 2);
            int vr = query(a, b, k * 2 + 2, (L + r) / 2, r);
            return Min(vL, vr);
        }
    }

   public   int query(int a, int b) => query(a, b, 0, 0, size);

}

public class Hello
{
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var q = int.Parse(line[1]);
        var r = new rmq(n);
        for (int i = 0; i < q; i++)
        {
            line = Console.ReadLine().Trim().Split(' ');
            if (line[0] == "0")  r.update (int.Parse(line[1]), int.Parse(line[2]));
            else
            {
                var w = r.query(int.Parse(line[1]), int.Parse(line[2]) + 1);
                Console.WriteLine(w);
            }
        }
    }
}




Measured memory_bytes: 24976
#include <iostream>
#include <vector>
#include <cmath>

int main(){
 long long N;
 std::cin>>N;
 std::vector<long long> s;
 
 if(N==1){
  std::cout<<0<<std::endl;
 }else{
 while(N!=1){
  long long st=(long long)std::sqrt(N);
  if(st==1){
   if(N!=1){
    s.emplace_back(N);
   }
   break;
  }
  for(long long i=2;i<=st;i++){
   if(N%i==0){
    s.emplace_back(i);
    N=N/i;
    break;
   }
   if(st==i){
    s.emplace_back(N);
    N=1;
   }
  }
 }

 long long tmp=s[0];
 int len=1;
 int count=0;
 int ans=0;
 //std::cout<<s.size()<<std::endl;
 for(int i=0;i<s.size();i++){
  if(s[i]==tmp){
   count++;
   if(count==len){
    len++;
    count=0;
    ans++;
    //std::cout<<i<<std::endl;
   }
   if(i==s.size()-1){
    break;
   }
  }else{
   count=0;
   len=1;
   tmp=s[i];
   i--;
  }

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

Measured memory_bytes: 3728
#######################################
import numpy as np
import math
import copy
import re
import sys
#sys.exit(0)

inf = float("inf")
prime = 1

def check_print(check_flag, text, end="\n"):
  if check_flag:
    print(text, end=end)

def c2i(x):
    if str.isdecimal(x):
        return int(x)
    else:
        return x

def cout(*args):
  arglist = []
  for arg in args:
    if hasattr(arg, "__iter__"):
      arglist.extend(arg)
    else:
      arglist.append(arg)
      
  arglist = list(map(str, arglist))
  print(" ".join(arglist))
  
def count2(num):
  count=0
  while num%2==0:
    num/=2
    count+=1
  return count

def ketasum(num):
  nums = [int(s) for s in str(num)]
  return sum(nums)

#math
def gcd(a, b): #最大公約数
  while b:
    a, b = b, a % b
  return a

def lcm(a, b): #最小公倍数
  return a * b // gcd (a, b)

def gcd3(lis): #最大公約数(3over)
  ans = lis[0]
  for li in lis:
    ans = gcd(ans,li)

def lcm3(lis): #最小公倍数(3over)
  ans = lis[0]
  for li in lis:
    ans = lcm(ans,li)

def divisor(n): #nの約数を全て求める
  i = 1
  table = []
  while i * i <= n:
    if n%i == 0:
      table.append(i)
      table.append(n//i)
    i += 1
  table = list(set(table))
  return table

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table

def is_prime(n):
  for i in range(2, n + 1):
    if i * i > n:
      break
    if n % i == 0:
      return False
  return n != 1

#input stock
"""
n = int(input())

#list
a = map(int, input().split())
a,b = map(int, input().split())

d=[]
for i in range(n):
  d[i]=int(input())

#2dim-list
a = [list(map(int, input().split())) for i in range(n)]

s = input()
ss =  [int(si) for si in s]
"""

#processing stock
"""
a = sorted(a)
a = sorted(a, reverse=True)

"""

#regex
"""
pattern = ""
result = re.search(pattern, s)

result = re.fullmatch(pattern, s)

result = re.finditer(pattern, s)
for res in result:
    print res.group()   # 1回目: ca      2回目: ca   
    print res.start()   # 1回目: 0       2回目: 6      
    print res.end()     # 1回目: 2       2回目: 8      
    print res.span()    # 1回目: (0, 2)  2回目: (6, 8)
"""


#math
"""
#切り捨て
math.floor()
# 切り上げ
math.ceil()
"""

#######################################
n,d = map(int, input().split())
k = 2*d+1
print(math.ceil(n/k))


Measured memory_bytes: 12400
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int main() {
    string s;
    cin >> s;
    int n = s.length();
    rep(i, n-1) {
        if (s[i] == s[i+1]) {
            cout << i+1 << " " << i+2 << endl;
            return 0;
        }
    }
    rep(i, n-2) {
        if (s[i] == s[i+2]) {
            cout << i+1 << " " << i+3 << endl;
            return 0;
        }
    }

    puts("-1 -1");
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
// template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

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

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    string s; cin >> s;
    ll ans = 0;
    ll r = 0, g = 0, b = 0;
    rep (i, n) {
        if (s[i] == 'R') r++;
        if (s[i] == 'G') g++;
        if (s[i] == 'B') b++;
    }
    rep (i, n) {
        rep (j, i + 1, n) {
            int k;
            k = (j + i) / 2;
            if ((j - i) % 2 == 0) {
                if (s[i] != s[j] && s[j] != s[k] && s[k] != s[i]) ans++;
            }
            k = 2 * j - i;
            if (k >= 0 && k < n) {
                if (s[i] != s[j] && s[j] != s[k] && s[k] != s[i]) ans++;
            }
            k = 2 * i - j;
            if (k >= 0 && k < n) {
                if (s[i] != s[j] && s[j] != s[k] && s[k] != s[i]) ans++;
            }
        }
    }
    cout << r * g * b - ans / 3 << "\n";
    return 0;
}

Measured memory_bytes: 3652
// God put a smile upon your face <3

#include <bits/stdc++.h>

#define slld(longvalue) scanf("%lld", &longvalue)

#define ll long long
#define ull unsigned long long
#define pll pair < long long, long long >

#define fastio ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0)

#define pb push_back

#define bug printf("BUG\n")

#define mxlld LLONG_MAX
#define mnlld -LLONG_MAX

#define mxd 2e8
#define mnd -2e8

#define pi 3.14159265359

using namespace std;

bool check(ll n, ll pos)
{
	return n & (1LL << pos);
}

ll Set(ll n, ll pos)
{
	return n = n | (1LL << pos);
}

int main()
{
    ll i, j, k, l, m, n, o, r, q;
    ll testcase;
    ll input, flag, tag, ans;

//    freopen("input.txt", "r", stdin);

//    freopen("output.txt", "w", stdout);

    while(cin >> k)
    {
		ans = 1;

		for(ll i = 1; i <= 10000000; i++)
		{
			if((i * k) % 360 == 0)
			{
				ans = i;
				break;
			}
		}

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

}





Measured memory_bytes: 3612
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;

    List<Tuple<int, int>>[] es;

    void calc()
    {
        cin = new Scanner();
        int sx = cin.nextInt();
        int sy = cin.nextInt();
        int gx = cin.nextInt();
        int gy = cin.nextInt();

        int dx = gx - sx;
        int dy = gy - sy;

        string s = "";
        s += new string('R', dx);
        s += new string('U', dy);
        s += new string('L', dx);
        s += new string('D', dy);

        s += new string('D', 1);
        s += new string('R', dx + 1);
        s += new string('U', dy + 1);
        s += new string('L', 1);

        s += new string('U', 1);
        s += new string('L', dx + 1);
        s += new string('D', dy + 1);
        s += new string('R', 1);

        Console.WriteLine(s);
    }
}


class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' '};

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 11220
S = input()
K = int(input())

N = len(S)
#全て同じ文字の時
if len(set(S)) == 1:
    print(N*K//2)
    exit()

#隣合う文字列が何個等しいか
cycle = 0
tmp = S[0]
cnt = 1
for i in range(1, N):
    if tmp != S[i]:
        cycle += cnt//2
        tmp = S[i]
        cnt = 1
    else:
        cnt += 1
cycle += cnt//2

if S[0] == S[-1]:
    i = 0
    a = 0
    tmp = S[0]
    while S[i] == tmp:
        i += 1
        a += 1
    j = N-1
    b = 0
    tmp = S[-1]
    while S[j] == tmp:
        j -= 1
        b += 1
    print((cycle*K) - (a//2 + b//2 - (a+b)//2)*(K-1))
else:
    print(cycle*K)

Measured memory_bytes: 9236
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define krep(i,k,n,m) for(int i=k;i<n;i+=m)
#define erep(i,k,n) for(int i=k;i<n;i++)
#define mod 1000000007;
//最大公約数
int gcd(int s,int b){
    if(b==0)return s;
    return gcd(b,s%b);
}
signed main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    int ans=0;
    rep(i,n-1){
        if(s[i]!=s[i+1]){
            ans+=1;
        }
    }
    cout<<ans+1<<endl;
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

namespace A_ABC168
{
    class MainClass
    {

        static int[] s;

        public static void Main(string[] args)
        {
            s = Array.ConvertAll(ReadLine().Split().ToArray(), int.Parse);
            int t = s[0] % 10;
            if (t == 2 || t == 4 || t == 5 || t == 7 || t == 9)
            {
                WriteLine("hon");
            }
            else if (t == 3)
            {
                WriteLine("bon");
            }
            else
            {
                WriteLine("pon");
            }

        }
    }
}


Measured memory_bytes: 28024
N, M = map(int,input().split())

PY = [[0]*4]*M
p_dict = {}
for i in range(M):
    p, y = map(int,input().split())
    
    if p not in p_dict.keys():
        p_dict[p] = [[p, y, i]]
    else:
        p_dict[p].append([p, y, i])

ans = []
for p in p_dict.keys():
    p_dict[p].sort()
    for i in range(len(p_dict[p])):
        ans.append(p_dict[p][i] + [i+1])
 
ans.sort(key=lambda x: x[2])

for i in range(M):
    print("{:06d}{:06d}".format(ans[i][0], ans[i][3])) 
    


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

typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9+7;

#define pi pair<int,int>
#define pl pair<lld,lld>

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)
#define asort(x) sort(x.begin(),x.end())
#define dsort(x,t) sort(x.begin(),x.end(),greater<t>())
#define vuniq(x) x.erase(unique(x.begin(), x.end()), x.end())

#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)

int main() {
    string S; cin >> S;
    cout << S.substr(0,S.size()-8) << endl;
}

Measured memory_bytes: 3544
import sys
sys.setrecursionlimit(65536)

N,M=map(int, input().split())
bridge=[[int(x) for x in input().split()] for _ in range(M)]

uf=[i for i in range(N+1)]
nc=[1 for i in range(N+1)]

def find(i):
	if uf[i] == i:
		return i
	else:
		uf[i] = find(uf[i])
		return uf[i]

def union(i, j):
	gi, gj = find(i), find(j)
	if gi != gj:
		uf[gi] = gj
		diff = nc[gj] * nc[gi]
		nc[gj] += nc[gi]
		return diff
	return 0

su = N*(N-1)//2
ans = [-1]*M

for i in range(M-1, -1, -1):
	ans[i] = su
	x,y = bridge[i]
	su -= union(x, y)

print("\n".join(map(str, ans)))


Measured memory_bytes: 40544
#include <bits/stdc++.h>
using namespace std;
#define oo 1000000010
#define mod 1000000007
const int N = 300010;

int main(){
	int a, b;
	cin >> a >> b;
	if(a > 0){
		puts("Positive");
		return 0;
	}
	if(b >= 0){
		puts("Zero");
		return 0;
	}
	if((b - a + 1) & 1)
		puts("Negative");
	else
		puts("Positive");
    return 0;
} 

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep2(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,n) for(int i=(n)-1;i>=0;--i)
#define rrep2(i,a,b) for(int i=(a)-1;i>=b;--i)
// #define range(i,a,b,c) for(int i=a;\
c>0?i<b:\
i>b;\
i+=c)
#define chmax(a, b) (a = (a) < (b) ? (b) : (a))
#define chmin(a, b) (a = (a) > (b) ? (b) : (a))
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) begin(a),end(a)
#define ifnot(a) if(not (a))
#define dump(x)  cerr << #x << " = " << (x) << endl
// #define int ll
#ifdef _MSC_VER
const bool test = true;
#else 
const bool test = false;
#endif

int dx[] = { 1,0,-1,0 };
int dy[] = { 0,1,0,-1 };
const int INF = 1 << 28;
const ll INFL = (ll)1 << 58;
ll mod = (int)1e9 + 7;
const double eps = 1e-10;
typedef long double Real;
// return -1, 0, 1
int sgn(const Real& r) { return (r > eps) - (r < -eps); }
int sgn(const Real& a, const Real &b) { return sgn(a - b); }

//.....................
const int MAX = (int)2e5 + 5;

vector<string> split(const string &str, char sep) {
	vector<string> v;
	stringstream ss(str);
	string buffer;
	while (getline(ss, buffer, sep)) {
		v.push_back(buffer);
	}
	return v;
}

template<class InputIterator>
ll sum(InputIterator begin, InputIterator end) {
	return accumulate(begin, end, (ll)0);
}

int H, W;

bool ng(int y, int x) {
	return y < 0 || H <= y || x < 0 || W <= x;
}

int n;
vector<ll> a;

void solve() {
	cin >> n;
	a.resize(n);
	rep(i, n) cin >> a[i];
	cout << *min_element(all(a)) << " "
		<< *max_element(all(a)) << " "
		<< sum(all(a)) << endl;
}


























signed main() {
	int T = 100;
	cout << fixed << setprecision(15);
	rep(i, T) {
		char s[MAX];
		if (scanf("%s", s) == EOF) break;
		int n = strlen(s);
		for (int i = n - 1; i > -1; i--) {
			ungetc(s[i], stdin);
		}
		solve();
	}
	return 0;
}

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

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    vector<unsigned long> A;
    A.reserve(2 * N);
    copy_n(istream_iterator<unsigned long>(cin), N, back_inserter(A));
    copy_n(begin(A), N, back_inserter(A));
    nth_element(begin(A), end(A) - N, end(A));
    cout << accumulate(end(A) - N, end(A), -*max_element(begin(A), end(A))) << endl;
    return 0;
}

Measured memory_bytes: 6428
package main

import (
	"fmt"
	"strings"
)

func main() {
	var n int
	var s string
	fmt.Scan(&n)
	fmt.Scan(&s)

	ans := 0
	for i := 0; i < n; i++ {
		cnt := 0
		for c := 'a'; c <= 'z'; c++ {
			left, right := false, false
			if strings.Index(s[:i+1], string(c)) > -1 {
				left = true
			}
			if strings.Index(s[i+1:], string(c)) > -1 {
				right = true
			}
			if left && right {
				cnt++
			}
		}
		if ans < cnt {
			ans = cnt
		}
	}
	fmt.Println(ans)
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;

int main() {
    int n;
    ll k;
    cin >> n >> k;

    vector<int> a(n); // 全てのワープ方法
    REP(i, n) cin >> a[i];

    vector<int> road; // a[i] の中の必要なワープ方法
    vector<int> count(n + 1, -1); // 自分までの街の個数
    int loop = 1;
    int tail = 0;

    int i = 1;
    while (count[i] == -1) {
        count[i] = road.size();
        road.push_back(i);
        i = a[i - 1];
    }
    tail = count[i];
    loop = road.size() - tail;

    if (k < tail) cout << road[k] << '\n';
    else {
        k -= tail;
        k %= loop;
        cout << road[k + tail] << '\n';
    }
    return 0;
}


Measured memory_bytes: 5864
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		try(Scanner sc = new Scanner(System.in)) {

			int a1 = sc.nextInt();
			int a2 = sc.nextInt();
			int a3 = sc.nextInt();
			System.out.println(a1 + a2 + a3 >= 22 ? "bust" : "win");
		}

	}

}


Measured memory_bytes: 21972
#include <algorithm>
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

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

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

    double dp[n+1][n+1];
    fill(dp[0], dp[n]+n+1, 0.0);
    dp[0][0] = 1.0;
    for (int i = 1; i <= n; i++) {
        dp[i][0] = dp[i-1][0] * (1 - p[i-1]);
        for (int j = 1; j <= i; j++) {
            dp[i][j] = dp[i-1][j-1] * p[i-1] + dp[i-1][j] * (1.0 - p[i-1]);
        }
    }

    double ret = 0.0;
    for (int i = n/2+1; i <= n; i++) {
        ret += dp[n][i];
    }

    cout.precision(10);
    cout << ret << "\n";
    return 0;
}

Measured memory_bytes: 70656
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.PriorityQueue;
import java.util.Queue;

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");
		int V = Integer.parseInt(str[0]);
		int E = Integer.parseInt(str[1]);

		ArrayList<ArrayList<Edge>> edges = new ArrayList<>();

		for (int i = 0; i < V; i++) {
			edges.add(new ArrayList<>());
		}

		for (int i = 0; i < E; i++) {
			str = br.readLine().split(" ");
			int s = Integer.parseInt(str[0]);
			int t = Integer.parseInt(str[1]);
			int w = Integer.parseInt(str[2]);

			edges.get(s).add(new Edge(t, w));
			edges.get(t).add(new Edge(s, w));
		}

		int sum = prime(edges, V);
		System.out.println(sum);
	}

	static int prime(ArrayList<ArrayList<Edge>> edges, int n) {
		boolean[] done = new boolean[n]; // 訪問フラグ

		Queue<Edge> q = new PriorityQueue<Edge>();
		q.add(new Edge(0, 0)); // ０から(ダミー)

		int totalCost = 0; // 最小全域木の重み
		while (!q.isEmpty()) {
			Edge e = q.poll(); // 最小コストの辺を取り出す
			if (done[e.to]) {
				continue;
			}

			done[e.to] = true; // 訪問済にする
			totalCost += e.cost;
			q.addAll(edges.get(e.to)); // 隣接しているすべての辺を追加
		}

		return totalCost;
	}
}

class Edge implements Comparable<Edge> {

	int to;
	int cost;

	public Edge(int to, int cost) {
		this.to = to;
		this.cost = cost;
	}

	@Override
	public int compareTo(Edge e) {
		return this.cost - e.cost;
	}
}


Measured memory_bytes: 68088
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        new Main().solve();
    }

    private void solve() throws IOException {
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);

        StringTokenizer tokenizer = new StringTokenizer(f.readLine());
        int d = Integer.parseInt(tokenizer.nextToken());
        int t = Integer.parseInt(tokenizer.nextToken());
        int s = Integer.parseInt(tokenizer.nextToken());

        if (((long) t * s) >= d) {
            out.println("Yes");
        } else {
            out.println("No");
        }

        out.close();
    }
}

Measured memory_bytes: 32748
#include <stdio.h>

int main(void)
{
	int a, b, d, r;
	double f;

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

	d = a / b;
	r = a % b;
	f = 1.0000000 * a / b;
	
	printf("%d %d %lf\n", d, r, f);

	return 0;
}


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

using namespace std;

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

#define print(a) {for(auto xxxxx : (a)) cout << xxxxx << ' '; cout << '\n';}
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

ll next(){ll x; cin >> x;return x;}
const int maxn = 3e5 + 2, intf = 2e9;
const ll inf = 2e18, mod = 998244353;
const ld eps = 1e-9;


void solve(){
	ll n , k; cin >> n >> k;
	cout << min(n % k , (k - (n % k)) % k);
}

signed main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.precision(20);
    
    for (int t = 1; t--;) solve();

	return 0;
}
/*


*/



Measured memory_bytes: 256
n = int(input())
t_L = list(map(int,input().split()))
m = int(input())

p_L,x_L = [],[]
max_num = 0

goukei = sum(t_L)

ans_L = []
for _ in range(m):
    p,x = map(int,input().split())
    #p_L.append(p)
    #x_L.append(x)
    tmp = t_L[p-1] - x
    ans = goukei-tmp
    ans_L.append(ans)
    #max_num = max(x - t_L[p-1])

for i in ans_L:
    print(i)

Measured memory_bytes: 38256
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {//221
	int a,b;
	string s;
	cin>>a>>b>>s;
	REP(i,0,a-1){
		if(s[i]<'0'||s[i]>'9') {
			cout<<"No";
			return;
		}
	}
	if(s[a]!='-') {
		cout<<"No";
		return;
	}
	REP(i,a+1,a+b){
		if(s[i]<'0'||s[i]>'9') {
			cout<<"No";
			return;
		}
	}
	cout<<"Yes";
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  for(int i = 0;i < 3;i++){
    if(s[i] == '9')s[i] = '1';
    else if(s[i] == '1')s[i] = '9';
  }
  cout << s << endl;
}

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<int,int> P;
typedef vector<vector<int> > Graph;
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; }


// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

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



const ll INF = 1e16;

int main(){
    int n,m;
    cin >> n >> m;
    vector<int>a(m);
    rep(i,m){
        cin >> a[i];
    }
    int dp[100010];
    rep(i,100010){
        dp[i]=-1;
    }
    dp[0]=1;
    rep(i,m){
        int now = a[i];
        dp[now]=0;
    }
    if(dp[1]!=0)dp[1]=1;
    for(int i = 2;i<=n;i++){
        if(dp[i]==0)continue;
        int now =dp[i-1]+dp[i-2];
        dp[i]=now%mod;
    }
    cout << dp[n] << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>		/*TeraPadÉÄ"ÒW"¨"«·¦Ö~"*/
#include <math.h>
#define A 0
#define B 1
#define C 2
#define X 0
#define Y 1

void syori1(double a,double b,double c,double d,double e,double f,double *x,double *y){		/*x + y= (ªÓ½Â) Ìûö®ðð­B*/
	*x=( c*(e/b)-f )/( a*(e/b)-d );
	*y=( ( c-(a * *x) )/b );
}

int syori2(double n){	/*	¬_æ4ÊðlÌÜü	yg¢ûzn+=syori2(n) */
	n*=1000;
	n = n - (double)(int)n;
	if(n>=0.5){
		return (0.001);
	}else{
		return 0.;
	}
}

int main(){
	double	xy[3][2],
			xp,yp,r,
			a,b,c,
			cosA,
			as[2],at[2],uhen[2],
			t,s,
			AO[2];					/*AOxNg{x,y}*/
	int n,							/*f[^Zbg*/
		i;
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%lf %lf %lf %lf %lf %lf",&xy[A][X],&xy[A][Y],&xy[B][X],&xy[B][Y],&xy[C][X],&xy[C][Y]);
		
		c=sqrt( pow( xy[A][X] - xy[B][X] ,2) + pow( xy[A][Y] - xy[B][Y] ,2) );	/*	|AB|	(xNgÌå«³)	*/
		a=sqrt( pow( xy[B][X] - xy[C][X] ,2) + pow( xy[B][Y] - xy[C][Y] ,2) );	/*	|BC|						*/
		b=sqrt( pow( xy[C][X] - xy[A][X] ,2) + pow( xy[C][Y] - xy[A][Y] ,2) );	/*	|AC|						*/
			
		cosA	= ( pow(b,2) + pow(c,2) - pow(a,2) ) / (2*b*c);				/*	]·èæè		*/
		
		as[0]	= pow(c,2);													/*	|AB|^2				*/
		at[0]	= c*b*cosA;													/*	|AB|*|AC|*cos (A)	*/
		uhen[0]	= as[0]/2;													/*	sÌWÌQ		*/
		as[1]	= c*b*cosA;													/*	at[0]É¯¶			*/
		at[1]	= pow(b,2);													/*	|AC|^2				*/
		uhen[1]	= at[1]/2;													/*	tÌWÌQ		*/
		
		syori1(at[0],as[0],uhen[0],at[1],as[1],uhen[1],&t,&s);				/*y¨mç¹zsÆtªoÜµ½B()t+s=ÌA§ûö®*/
		
		AO[X]= s*( xy[B][X] - xy[A][X] ) + t*( xy[C][X] - xy[A][X] );		/*	AO = s*AB + t*AC	*/
		AO[Y]= s*( xy[B][Y] - xy[A][Y] ) + t*( xy[C][Y] - xy[A][Y] );
		
		
		r	= a*b*c/sqrt((a+b+c)*(-a+b+c)*(a-b+c)*(a+b-c));
		xp	= AO[X] + xy[A][X];
		yp	= AO[Y] + xy[A][Y];
		
		r+=0.	;
		xp+=0.	;
		yp+=0.	;
		
		r	+= syori2(r);
		xp	+= syori2(xp);
		yp	+= syori2(yp);
		
		printf("%.3lf %.3lf %.3lf\n",xp,yp,r);
	}
	
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
#include<stdio.h>
#include<cmath>
#include<limits>
#include<iomanip>

using namespace std;

template <class T> using V = vector<T>;

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

const long long INF = 1LL << 60;

using ll = long long;
using db = long double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
using graph = V<V<int>>;
using pq = priority_queue<ll>;



#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>=(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define pb(a) push_back(a);




ll Sum(ll n) {
ll m=0;
  while(n){
    m+=n%10;
    n/=10;
  }
  return m;
}



const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}


#define comuse Comuse()

ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll perm(int n,int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] % MOD) % MOD;
}


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


vll div(ll n){
  vll ret;
  for(ll i=1;i*i<=n;i++){
    if(n%i==0){
      ret.push_back(i);
      if(i*i!=n){
        ret.push_back(n/i);
      }
    }
  }
  SORT(ret);
  return (ret);
}


ll modpow(ll a,ll n,ll mod){
  ll ans=1;
  while(n>0){
    if(n&1){
      ans=ans*a%mod;
    }

    a=a*a%mod;
    
    n>>=1;
  }

  return ans;
}

void Solve();


const int MAX_N = 131072;
//segment tree 
int NN;
int seg[MAX_N*2-1];
void seguse(){
  for(int i=0;i<2*NN-1;i++){
    seg[i]=INT_MAX;
  }
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(20)<<fixed;
  Solve();
}




/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
//segtreeの葉の先頭の添え字はn-1
void Solve(){
  //vll segtree(524287);
  //ll N=262144;
  ll n,k;
    cin>>n>>k;
  vll A(n);
  FOR(i,0,n){
    cin>>A[i];
  }

  SORT(A);
  ll ans=0;
  FOR(i,0,n-k){
    ans+=A[i];
  }

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

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

using namespace std;

#define ll long long
#define ld long double
#define pll pair <ll , ll>

#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mp make_pair

#define X first
#define Y second

#define LB(x) ((x) & -(x))
#define BIT(a , b) (((a)>>(b)) & 1)

ll solve(ll x , ll y)
{
    if (y == 0)
    {
        return -x;
    }

    return solve(y , x % y) + (x / y) * 2 * y;
}

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

	ll n , x;
	cin >> n >> x;
	cout << n + solve(n - x , x);
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm> 
#include <queue>
#include <functional>
#include <map>
#include <string>
using namespace std;
int w, h;
char field[25][25];
bool used[25][25];
int vx[] = { 1, 0, -1, 0 };
int vy[] = { 0, 1, 0, -1 };

int dfs(int x,int y){
    
    int ret = 1;
    used[x][y] = true;

    for (int i = 0; i < 4; i++){
        int nx, ny;
        nx = x + vx[i]; ny = y + vy[i];
        if (nx != 0 && nx != w + 1 && ny != 0 && ny != h + 1 && field[nx][ny] != '#'&&
            !used[nx][ny]){
            ret += dfs(nx, ny);
        }
    }

    return ret;
}

int main(void){

    while (true){
        cin >> w >> h;
        if (w == 0 && h == 0)break;
        for (int i = 1; i <= w; i++){
            for (int j = 1; j <= h; j++){
                used[i][j] = false;
            }
        }
        int sx, sy;
        for (int i = 1; i <= h; i++){
            for (int j = 1; j <= w; j++){
                cin >> field[j][i];
                if (field[j][i] == '@'){
                    sx = j; sy = i;
                }
            }
        }

        int ans;
        ans = dfs(sx, sy);
        cout << ans << endl;
        
    }
    

}

Measured memory_bytes: 3104
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

int main(void)
{
    int n, m;
    cin >> n >> m;
    int a[100][100];
    REP(i, n)
    {
        REP(j, m)
        {
            a[i][j] = 0;
        }
    }

    REP(i, n)
    {
        int k;
        cin >> k;
        REP(j, k)
        {
            int t;
            cin >> t;
            a[i][t - 1] = 1;
        }
    }

    int ans = 0;
    REP(j, m)
    {
        bool flag = true;
        REP(i, n)
        {
            if (a[i][j] == 0)
            {
                flag = false;
                break;
            }
        }
        if (flag)
        {
            ans++;
        }
    }
    cout << ans << endl;
}


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

using namespace std;

#define MAX 1046527

string Hash[MAX];

int getChar(char ch)
{
    if (ch == 'A')
    {
        return 1;
    }
    else if (ch == 'C')
    {
        return 2;
    }
    else if (ch == 'G')
    {
        return 3;
    }
    else if (ch == 'T')
    {
        return 4;
    }
    
    return 0;
}

long long int getKey(string str)
{
    long long int sum = 0;
    long long int p = 1;
    long long int i = 0;
    
    for (i = 0; i < str.size(); i++)
    {
        sum += p * (getChar(str[i]));
        p *= 5;
    }
    
    return sum;
}

long long int h1(long long int key)
{
    return key % MAX;
}

long long int h2(long long int key)
{
    return 1 + (key % (MAX - 1));
}

int find(string str)
{
    long long int key;
    long long int i;
    long long int h;
    
    key = getKey(str);
    for (i = 0; ; i++)
    {
        h = (h1(key) + i * h2(key)) % MAX;
        if (Hash[h] == str)
            return 1;
        else if (Hash[h].size() == 0)
            return 0;
    }
    
    return 0;
}

void insert(string str)
{
    long long int key;
    long long int i;
    long long int h;
    
    key = getKey(str);
    for (i = 0; ; i++)
    {
        h = (h1(key) + i * h2(key)) % MAX;
        if (Hash[h].size() == 0)
        {
            Hash[h] = str;
            return ;
        }
        else if (Hash[h] == str)
            return ;
    }
    
    return ;
}

int main(int argc, const char * argv[]) {
    int cmd_num;
    string cmd;
    string str;
    
    cin >> cmd_num;
    for (int i = 0; i < cmd_num; i++)
    {
        cin >> cmd >> str;
        if ('i' == cmd[0])
        {
            insert(str);
        }
        else if ('f' == cmd[0])
        {
            if (find(str))
            {
                cout << "yes" << endl;
            }
            else
            {
                cout << "no" << endl;
            }
        }
    }
    
    return 0;
}



Measured memory_bytes: 27784
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <map>
#include <functional>
#include <cstring>
#include <queue>
#include <cmath>
#include <deque>
#include <list>
#include <iomanip>
#include <fstream>
#include <string>
#include <iterator>
#include <set>
#include <bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
#define mp make_pair
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, N) FOR(i, 0, N)
#define SZ(x) ((int)(x).size())

const int MAXN = 507, MAXK = 12, MOD = 100000000;

int main()
{
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	a = max(a, c); b = min(b, d);
	cout << max(b - a, 0);
	//cout << endl; system("pause");//please
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include <cassert>
#include<string>
#include<vector>
#include <utility>
#include <math.h>
#define INF 1000000000;
using namespace std;
char mas[200500];
int main() {
	int a = 0, b = 0, c = 0;
	cin >> a >> b >> c;
	int B[108];
	int counto = 0;
	int match = 0;
	int d = 0;
	for (int i = 0; i < b; i++) {
		cin >> B[i];
	}
	for (int i = 0; i < a; i++) {
		for (int j = 0; j < b; j++) {
			cin >> d;
			counto += B[j] * d;
		}
		if ((counto + c) > 0) {
			match++;
		}
		counto = 0;
	}
	cout << match << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;
 
int dp[1145][11451];

int main(){
	int H,N;
	cin>>H>>N;
	vector<int>A(N),B(N);
	for(int i=0;i<N;i++)cin>>A[i]>>B[i];
	for(int i=0;i<1145;i++)for(int j=0;j<=11451;j++)dp[i][j]=1e9;
	dp[0][0]=0;
	for(int i=0;i<N;i++){
		for(int j=0;j<=H;j++){
			dp[i+1][j]=min(dp[i][j],dp[i+1][j]);
			dp[i+1][min(j+A[i],H)]=min(dp[i+1][min(j+A[i],H)],dp[i+1][j]+B[i]);	
		}
	}
	cout<<dp[N][H]<<endl;
}


Measured memory_bytes: 51584
def solve(n):
    if n < 3:
        print('No')
        return
    d, m = divmod(n, 4)
    l = d * 4
    if m == 3:
        d += 1
        l += 4
    ans = ['{} {}'.format(x, y) for x, y in ((1, 2), (2, 3), (3, 1 + n), (1 + n, 2 + n), (2 + n, 3 + n))]

    if bin(l).count('1') == 1:
        if m == 0:
            print('No')
            return
        if m < 3:
            ans.extend('{} {}'.format(x, y) for x, y in ((1, l), (l, l + 1), (1, l + n + 1), (l + n + 1, l + n)))
            if m == 2:
                ans.extend('{} {}'.format(x, y) for x, y in ((2, l + 2), (l + n + 1, l + n + 2)))
            m = 3

    for i in range(4, l, 4):
        ans.extend('{} {}'.format(x, y) for x, y in (
            (i, i + 1), (i + 1, i + 2), (i + 2, i + 3), (i + 3, i + n),
            (i + n, i + n + 1), (i + n + 1, i + n + 2), (i + n + 2, i + n + 3)))

    if m == 3:
        for i in range(4, l, 4):
            ans.append('{} {}'.format(1, i))
        print('Yes')
        print('\n'.join(ans))
        return

    min_k = k = l & -l
    prev = 1
    connected = set()
    while k < l:
        if k & l:
            ans.append('{} {}'.format(prev, k))
            connected.add(k)
            prev = k
        k <<= 1

    for i in range(4, l, 4):
        if i in connected:
            continue
        ans.append('{} {}'.format(1, i))

    # print(*ans, sep='\n')
    # print('--')

    ans.append('{} {}'.format(l, min_k))
    ans.append('{} {}'.format(l + n, prev))

    if m >= 1:
        ans.append('{} {}'.format(l + 1, 1))
        ans.append('{} {}'.format(l + 1 + n, prev))
    if m >= 2:
        ans.append('{} {}'.format(l + 2, 1))
        ans.append('{} {}'.format(l + 2 + n, prev + 2))

    assert len(ans) == 2 * n - 1

    print('Yes')
    print('\n'.join(ans))


n = int(input())
solve(n)


Measured memory_bytes: 24436
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<ctime>

using namespace std;
using ll = long long;
using ld = long double;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int ti = clock();
  // start-----------------------------------------------
  ld a, b, c;
  cin >> a >> b >> c;
  if(a + b + sqrt(a)*sqrt(b)*2 < c) cout << "Yes" << endl;
  else cout << "No" << endl;

  // end-----------------------------------------------
  // cerr << 1.0 * (clock() - ti) / CLOCKS_PER_SEC << endl;
}


Measured memory_bytes: 256