akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <memory.h>
#include <cstring>
#include <set>
#include <algorithm>
using namespace std;


#define CLR(a, b) memset(a, b, sizeof(a))

const int maxn = 400400;

int chd[maxn][26], tot;
int val[maxn], ed[maxn];
int fa[maxn], len[maxn];

int ins(char *s)
{
    int q = 0;
    len[q] = 0;
    for(; *s; s ++)
    {
        int p = *s - 'a';
        if(!chd[q][p])
        {
            CLR(chd[tot], 0);
            val[tot] = 0; ed[tot] = 0;
            chd[q][p] = tot ++;
        }
        len[chd[q][p]] = len[q] + 1;
        fa[chd[q][p]] = q;
        q = chd[q][p];
        val[q] ++;
    }
    ed[q] ++;
    return q;
}

char ord[30];

char ch[maxn];
int last[maxn];
string str[maxn];

int qer(int x)
{
//    cout << s << "   dkk" << endl;
    int ret = 1, q = fa[last[x]];
    while(true) {
        int l = len[q];
        char c = str[x][l];
//        printf("%c %d %d %d\n", c, ret, q, l);
        for(int i = 0; i < 26; i ++) {
            if(ord[i] != c) {
                ret += val[chd[q][ord[i] - 'a']];
            }
            else {
                ret += ed[q];
                break;
            }
        }
        if(q == 0) break;
        q = fa[q];
    }
    return ret;
}
/**
5
aa
abbaa
abbba
aaab
aaaaaba
5
4 bacdefghijklmnopqrstuvwxyz
1 abcdefghijklmnopqrstuvwxyz
2 bacdefghijklmnopqrstuvwxyz
3 abcdefghijklmnopqrstuvwxyz
5 abcdefghijklmnopqrstuvwxyz
*/

void gao() {
    for(int i = 1; i < tot; i ++) {
        for(int j = 0; j < 26; j ++) {
            int nxt = chd[i][j];
            if(nxt == 0) continue;
            if(val[nxt] == val[i]) fa[nxt] = fa[i];
        }
    }
}

int main() {
    int n;
    while(scanf("%d", &n) != EOF) {
        tot = 1;
        for(int i = 1; i <= n; i ++) {
            scanf("%s", ch);
            last[i] = ins(ch);
            str[i] = ch;
        }
        gao();
        int q; scanf("%d", &q);
        while(q --) {
            int x; scanf("%d%s", &x, ord);
            printf("%d\n", qer(x));
        }
    }
    return 0;
}



Measured memory_bytes: 51200
#include<bits/stdc++.h>
using namespace std;
string s;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin>>s;
	long long int ans=0;
	bool lastC=false;
	int cnt=0;
	for(int i=s.size()-1;i>=0;i--){
		if(s[i]=='A'){
			if(lastC){
				lastC=false;
				cnt=0;
			}
			else{
				ans+=cnt;
			}
		}
		else if(s[i]=='B'){
			if(lastC){
				lastC=false;
				cnt++;
			}
			else{
				cnt=0;
				lastC=false;
			}
		}
		else{
			if(lastC){
				cnt=0;
			}
			else{
				lastC=true;
			}
		}
	}
	cout<<ans<<endl;
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	vector<vector<int>>pma(2);
	for(int i=0;i<n;++i){
		int a; cin>>a;
		a-=i+1;
		if(a<0)pma.at(1).emplace_back(a);
		else pma.at(0).emplace_back(a);
	}
	int lar=(pma.at(0).size()>pma.at(1).size()?0:1);
	if(lar==1)sort(pma.at(lar).rbegin(),pma.at(lar).rend());
	else sort(pma.at(lar).begin(),pma.at(lar).end());
	int dif=pma.at(lar).at(pma.at(lar).size()-(n+1)/2);
	int64_t ans=0;
	for(auto&&i:pma){
		for(auto&&j:i){
			ans+=abs(j-dif);
		}
	}
	cout<<ans<<"\n"s;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) RFOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll << 60;

template<typename T>
void printv(vector<T> const& s) {
  REP(i, SZ(s)) {
    cout << s[i] << " ";
  }
  cout << endl;
}

ll n, a, b;
vll h;

bool ok(ll k) {
  ll cnt = 0;
  // cout << "k:" << k << endl;
  REP(i, n) {
    if(h[i] > b * k) cnt += (h[i] - b * k + (a-b) - 1) / (a-b);
  }
  return cnt <= k;
}

int main () {
  cin.tie(0);
  cout << setprecision(10);

  cin >> n >> a >> b;
  h.resize(n);
  REP(i, n) {
    cin >> h[i];
  }
  if(n == 1) {
    cout << (h[0] + a - 1) / a << endl;
    return 0;
  }

  ll l = -1, r = 1e9+1;
  while(r - l > 1) {
    ll mid = (l + r) / 2;
    if(ok(mid)) r = mid;
    else l = mid;
  }

  cout << r << endl;
}


Measured memory_bytes: 1024
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b = LI()
    def c(x):
        return 1 <= x <= 9
    if c(a) and c(b):
        print(a * b)
        return
    print(0)
    return

#B
def B():
    a = set()
    for i in range(10):
        for K in range(10):
            a.add(i * k)
    x = II()
    if x in a:
        print("Yes")
    else:
        print("No")
    return

#C
def C():
    n = II()
    factlize = []
    ans = inf
    for i in range(1, int(sqrt(n)) + 1):
        if n % i == 0:
            ans = min(ans, n // i + i - 2)
    print(ans)

    return

#D
def D():
    return

#E
def E():
    def solve(m):
        a1 = a[::-1]
        f1 = f[::1]
        res = 0
        for i in range(n):
            if a1[i] * f1[i] <= m:
                continue
            k = m // f1[i]
            res += a1[i] - k
            if res > K:
                return False
        return True

    n, K = LI()
    a = LI()
    a.sort()
    f = LI()
    f.sort()
    ok = max(a) * max(f)
    ng = -1
    while ok - ng > 1:
        mid = (ok + ng) // 2
        if solve(mid):
            ok = mid
        else:
            ng = mid
    print(ok)
    return

#F
def F():
    return


#Solve
if __name__ == '__main__':
    C()


Measured memory_bytes: 39152
#include<iostream>
using namespace std;
int main()
{
    int x,a;
    cin>>x>>a;
    if(x>a)
        cout<<"10"<<endl;
    if(x<a)
        cout<<"0"<<endl;
    if(x==a)
        cout<< "10"<<endl;
    return 0;
}



Measured memory_bytes: 3640
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  string S;
  cin>>S;
  int left=0, right=0;
  for(int i=0;i<N;++i) {
    if(S[i]=='(') {
      left++;
    }
    else {
      left--;
      if(left<0) left = 0;
    }
  }
  reverse(S.begin(), S.end());
  for(int i=0;i<N;++i) {
    if(S[i]==')') {
      right++;
    }
    else {
      right--;
      if(right<0) right = 0;
    }
  }
  reverse(S.begin(), S.end());
  for(int i=0;i<right;++i) {
    cout<<'(';
  }
  cout<<S;
  for(int i=0;i<left;++i) {
    cout<<')';
  }
  cout<<endl;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pll, pii> P;
const ll INF = 1ll<<30;
const ll longINF = 1ll<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;
const bool debug = 0;
//---------------------------------//

int main() {
	int N;
	cin >> N;
	cout << N * N * N << endl;
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
using ll = long long;
using namespace std;

void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    map<int,int> a1;
    int ma=0;
    for (int i=0;i<n;i++){
        int m;
        cin >> m;
        a1[m]=a1[m]+1;
        ma = max(ma,m);
    }
    int ans = 0;
    // for (int i=0;i<n+1;i++){
    //     cout<<a1[i]<<endl;
    // }
    for (int i=0;i<ma+1;i++){
        int cnt = a1[i-1]+a1[i]+ a1[i+1];
        ans = max(ans,cnt);
    }

    // int ma = *max_element(a.begin(),a.end());
    // int ans=0;
    // for (int i=0;i<ma+1;i++){
    //     int cnt=0;
    //     int a1,a2,a3;
    //     a1 = count(a.begin(),a.end(),i);
    //     a2 = count(a.begin(),a.end(),i+1);
    //     a3 = count(a.begin(),a.end(),i-1);
    //     cnt = a1 + a2 + a3;
    //     ans = max(ans,cnt);
    // }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4992
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int a = sc.nextInt();
      int b = sc.nextInt();

      if ( a < b) {
        System.out.println("a < b");
      } else if ( a > b) {
        System.out.println("a > b");
      } else {
        System.out.println("a == b");
      }
      sc.close();
  }
}


Measured memory_bytes: 26192
# Problem C - Many Requirements

# input
N, M, Q = map(int, input().split())
q_list = []
for i in range(Q):
    a, b, c, d = map(int, input().split())
    q_list.append([a, b, c, d])

# initialization
max_ans = 0

# dfs search
def dfs_score(a_list, p, n, max_ans):
    if p==N:
        tmp_score = 0
        for q in q_list:
            if a_list[q[1]-1]-a_list[q[0]-1]==q[2]:
                tmp_score += q[3]
        max_ans = max(max_ans, tmp_score)
    else:
        for i in range(n, M+1):
            a_list[p] = i
            max_ans = dfs_score(a_list, p+1, i, max_ans)
    return max_ans

# output
a_list = [0]*N
max_ans = dfs_score(a_list, 0, 1, max_ans)
print(max_ans)


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

using namespace std;

int main() {

int n;

int  m;

cin>>n>>m;

int v[n];

int s=0;

for(int i=0;i<n;i++) {

cin>>v[i];

s+=v[i];

}

int k=(s/4*m);int c=0;

bool t=false;

for(int i=0;i<n;i++){

if(v[i]*4*m >=s) {

c++;

} 

}

if(c>=m) {

cout<<"Yes"<<endl; 

} else{

cout<<"No"<<endl;

} 

return 0;

} 



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
    int w, h;
    
    while (true) {
        cin >> h >> w;
        if (w == 0 && h == 0) break;
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3088
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

int n;
V g[610];

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

    int m, s[180010], t[180010];

    cin >> n >> m;
    REP(i, m)
    {
        cin >> s[i] >> t[i];
        g[s[i]].push_back(t[i]);
    }

    double dp[610];
    dp[n] = 0;

    for (int i = n - 1; i >= 1; i--)
    {
        dp[i] = 0;
        for (int nex : g[i])
        {
            dp[i] += (1 + dp[nex]) / g[i].size();
        }
    }

    double res = 1e9;

    for (int i = 1; i <= n; i++)
    {
        int mai = -1;
        double ma = 0;

        if (g[i].size() > 1)
            for (int nex : g[i])
            {
                if (ma < dp[nex])
                {
                    ma = dp[nex];
                    mai = nex;
                }
            }

        double dp2[610];
        dp2[n] = 0;

        for (int j = n - 1; j >= 1; j--)
        {
            dp2[j] = 0;
            for (int nex : g[j])
            {
                if (j == i && nex == mai)
                    continue;

                if (j == i && g[j].size() > 1)
                {
                    dp2[j] += (1 + dp2[nex]) / (g[j].size() - 1);
                }
                else
                {
                    dp2[j] += (1 + dp2[nex]) / (g[j].size());
                }
            }
        }

        res = min(res, dp2[1]);
    }

    cout << setprecision(30) << res << endl;

    return 0;
}

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

int main() {
  int N;
  cin >> N;
  map<string, int> m;
  rep (i, N) {
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    m[s]++;
  }
  uint64_t ans = 0;
  for (auto x : m) {
    uint64_t s = x.second;
    ans += s*(s-1)/2ll;
  }
  cout << ans << endl;

}


Measured memory_bytes: 11136
import math.BigInt
object Main extends App {
  val in = new java.util.Scanner(System.in)

  def exec(n: BigInt, l: List[Char]): String = {
    if (n == 0) l.mkString
    else {
      val rem = (n - 1).mod(26)
      exec((n - rem) / 26, ('a' + rem).toChar :: l)
    }
  }

  println(exec(BigInt(in.next), Nil))
}

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

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

		const int mod = 1000000007;  // 10^9+7
		static int Mod(long x, int m) { return (int)((x % m + m) % m); }
		static long Mod(long x, long m) { return (x % m + m) % m; }

		static public void Solve()
		{
			//string s = Console.ReadLine();
			//int n = int.Parse(Console.ReadLine());
			//long x = long.Parse(Console.ReadLine());
			//int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();

			int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			int a = vs[0];
			int b = vs[1];
			int x = vs[2];
			if (a <= x && x <= a + b) {
				Console.WriteLine("YES");
			} else {
				Console.WriteLine("NO");
			}

		}
	}
}


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

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

	int sum = 0;
	for(int i = 0; i < 10; ++i){
		int s;
		cin >> s;
		sum += s; 
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 1192
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');//Splitで区切り文字を指定して複数個受け取る。
		long n = long.Parse(input[0]);
		long t = long.Parse(input[1]);
  	long[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
    long answer = 0;
    long minMemo = long.MaxValue;
    long maxGet = 0;

    for(int i = 0; i < n; i++)
    {
      if(nums[i] < minMemo) minMemo = nums[i];
      else
      {
        if(nums[i] - minMemo > maxGet)
        {
          maxGet = nums[i] - minMemo;
          answer = 1;
        }else if(nums[i] - minMemo == maxGet) answer++;
      }
    }

		Console.WriteLine(answer);//WriteLineをWriteとすると、改行なしで出力。
	}
}

Measured memory_bytes: 20832
a,b = map(int,input().split())
if a==1:
	if b==1:
		print("Draw")
	else:
		print("Alice")
elif b==1 :
	if a==1:
		print("Draw")
	else:
		print("Bob")
else:
		print("Alice" if a>b else "Bob" if a<b else "Draw")

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

using namespace std;

typedef long long ll;

int n, m, l;
ll g1[321][321], g2[321][321];
int q;

void Floyed(ll a[321][321]) {
    for (int k = 1; k <= n; ++k) {
        for (int i = 1; i <= n; ++i) {
            for (int j = 1; j <= n; ++j) {
                a[i][j] = min(a[i][j], a[i][k] + a[k][j]);
            }
        }
    }
}

int main() {
    scanf("%d%d%d", &n, &m, &l);
    memset(g1, 0x3f, sizeof(g1));
    for (int i = 1; i <= n; ++i) g1[i][i] = 0;
    for (int i = 1; i <= m; ++i) {
        int a, b, c;
        scanf("%d%d%d", &a, &b, &c);
        g1[a][b] = g1[b][a] = c;
    }
    Floyed(g1);
    memset(g2, 0x3f, sizeof(g2));
    for (int i = 1; i <= n; ++i) g2[i][i] = 0;
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) {
            if (g1[i][j] <= l) {
                g2[i][j] = 1;
            }
        }
    }
    Floyed(g2);
    scanf("%d", &q);
    while (q--) {
        int s, t;
        scanf("%d%d", &s, &t);
        --g2[s][t];
        printf("%lld\n", g2[s][t] >= 1000000000 ? -1 : g2[s][t]);
    }
    return 0;
}

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


int main(){
    long long N, ans;
    long long N_10 = 1, N_8 = 1, N_9 = 1;
    std::cin >> N;

    for(long long i = 1; i <=N; i++){
        //何個0,9があるか
        N_10 = N_10 * 10;
        N_10 = N_10%1000000007;
        N_8 = N_8 * 8;
        N_8 = N_8%1000000007;
        N_9 = N_9 * 9;
        N_9 = N_9%1000000007;
    }

    ans = (N_10 + N_8)%1000000007;
    ans = (ans - N_9)%1000000007;
    ans = (ans - N_9)%1000000007;
    if(ans < 0){
        ans = ans + 1000000007;
    }
    std::cout << ans;
}


Measured memory_bytes: 3628
#include<iostream>
#include<vector>
#include<string>

using ll = long long;

ll floar(long double t){
    return t / 1;
}

int main(){
    ll a, b, n;
    std::cin >> a >> b >> n;
    ll maxVal = 0;
    if(n / b >= 1){
        maxVal = (a * (b - 1)) / b;
    }else{
        maxVal = (a * n) / b;
    }

    std::cout << maxVal << std::endl;
    return 0;
}


Measured memory_bytes: 3672
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>

using namespace std;

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


int main(){
    int a[3];
    rep(i, 3) cin >> a[i];
    int x = 2, y = 1;
    rep(i, 3){
        if(a[i] == 5) x--;
        if(a[i] == 7) y--;
    }
    if(x == 0 && y == 0) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define drep(i,cc,n) for(int i=(cc);i<=(n);++i)
#define rep(i,n) drep(i,0,n-1)
#define drrep(i,cc,n) for(int i=(cc);i>=(n);--i)
#define rrep(i,n) drrep(i,0,n-1)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,v.size())if(i==0)cout << v[i];else cout << " " << v[i]; cout << endl;
#define arrprint(v,n) rep(i,n)if(i==0)cout << v[i];else cout << " " << v[i]; cout << endl;
#define matprint(v,n,m) rep(i,n){rep(j,m){cout << v[i][j] << " ";}cout << endl;}
#define SORT(v) sort(v.begin(), v.end())
#define REV(v) reverse(v.begin(), v.end())
using namespace std;
const int mod=1000000007;
const int INF=1001001001;
using ll = long long;
using P = pair<int,int>;
template<typename T>
using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>; //小さいものから取り出す

int main(){
    int n;
    cin >> n;
    int ans = n % 1000;
    ans = 1000 - ans;
    if(ans == 1000) ans = 0;

    cout << ans << endl;
//  printf("%.10f\n",ans);

    return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>

int main(){
    int n,i;
    long min,max,sum,num[10000];
    scanf("%d",&n);
    for (i=0; i<n; i++) {
        scanf("%ld",&num[i]);
    }
    //????°????????????????
    min=num[0];
    for (i=0; i<n; i++) {
        if (num[i]<= min) {
            min=num[i];
        }
    }
    //?????§???????????????
    max=num[0];
    for (i=0; i<n; i++) {
        if (num[i]>=max) {
            max=num[i];
        }
    }
    //????¨????????????????
    for (i=0; i<n; i++) {
        sum+=num[i];
        }
    
    printf("%ld %ld %ld\n",min,max,sum);

return(0);
}

Measured memory_bytes: 676
import sys
input = sys.stdin.buffer.readline

def main():
    N = int(input())
    a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    
    print(a[N-1])
    
    
    
    
    
    
    
    
    
    
    
    
    

if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include<cstdio>
#include<cctype>
#include<cstring>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
typedef vector<char>V;
int a[4];
string P(V&v,int&i)
{
	int f=isdigit(v[i]);
	string s;
	s+=v[i--];
	if(!f)
	{
		s+=" "+P(v,i)+')';
		s='('+P(v,i)+' '+s;
	}
	return s;
}
int F(V v,int i,int n)
{
	if(v.size()-7)
	{
		char*p,s[9]={},f=0;
		p=s;
		if(i<4)*s=a[i]+'0';
		if(n>1)strcat(s,"+-*");
		for(p=s;*p;++p)
		{
			V t(v);
			t.push_back(*p);
			if(isdigit(*p))f=F(t,i+1,n+1);
			else f=F(t,i,n-1);
			if(f)return 1;
		}
	}
	else
	{
		int x[4],c;
		for(n=i=0;i<7;++i)
		{
			if(isdigit(c=v[i]))x[n++]=v[i]-'0';
			else
			{
				int l=x[n-2],r=x[n-1],t;
				if(c=='+')t=l+r;
				if(c=='-')t=l-r;
				if(c=='*')t=l*r;
				x[n-2]=t;
				--n;
			}
		}
		if(*x==10)
		{
			puts(P(v,i=6).c_str());
			return 1;
		}
	}
	return 0;
}
int main()
{
	for(;;)
	{
		int i,f;
		for(f=i=0;i<4;++i)if(scanf("%d",a+i),!a[i])return 0;
		sort(a,a+4);
		do
		{
			f=F(V(),0,0);
			if(f)break;
		}while(next_permutation(a,a+4));
		if(!f)puts("0");
	}
}

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

int main(){
  int n,m;
  cin>>n>>m;
  int vec[n+100]={};
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    vec[a]++;
    vec[b]++;
  }
  for(int i=1;i<=n;i++){
    if(vec[i]%2!=0){
      cout<<"NO"<<endl;
      return 0;
    }
  }
  cout<<"YES"<<endl;
}

Measured memory_bytes: 4016
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
#include<map>
#include<set>
using namespace std;
#define scai(x) scanf("%d", &x)
#define scac(x) scanf("%c", &x)
#define sca2i(x, y) scanf("%d %d", &x, &y)
#define sca2f(x, y) scanf("%lf %lf", &x, &y)
#define pri(x) printf("%d", x)
#define prc(x) printf("%c", x)
#define pri2(x,y) printf("%d %d", x, y);
#define prif(x) printf("%lf", x)
#define prif2(x, y) printf("%lf %lf", x, y)
#define mset(x, y) memset(x, y, sizeof(x))
#define fori(i, x, y) for(int i = x; i < y; i++)
#define pii pair<int, int>
#define pic pair<int, char>
#define pdd pair<double, double>
typedef long long ll;
#define INF 0x3f3f3f3f

const int MAX_N = 1e5 + 10;
int N, Q;


int par[MAX_N];
bool Marked[MAX_N];

ll Find(int x)
{
    if(Marked[x])
        return x;
    return Find(par[x]);
}
void init()
{
    for (int i = 1; i <= N; i++)
    {
        par[i] = i;
        Marked[i] = false;
    }
    Marked[1] = true;
    return ;
}

void solve()
{
    while(sca2i(N, Q), N|Q){
    init();

    for(int i = 2; i <= N; i++)
    {
        scai(par[i]);
    }
    char op;
    int n;
    getchar();
    ll sum = 0;
    while(Q--)
    {

        scanf("%c %d", &op, &n);
        getchar();
        if(op == '0') break;

        /*cout << "op n : ";
        cout << op << " " << n << endl;*/
        if(op == 'M')
        {
            Marked[n] = true;
        }
        else if(op == 'Q')
        {
            sum += Find(n);
        }
    }
    printf("%lld\n", sum);
    }
    //system("pause");
    return ;
}
int main()
{
    solve();
    return 0;
}


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

#define repd(i,a,b) for (ll i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
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; }
typedef long long ll;

const long long INF = 1LL << 60;

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

    ll ansx, ansy, ansh;

    vector<ll> x(N), y(N), h(N);
    rep(i, N) {
        cin >> x[i] >> y[i] >> h[i];
    }

    rep(ix, 101) {
        rep(iy, 101) {
            ll H;
            bool flag = true;
            rep(n, N) {
                if (h[n] > 0) {
                    H = h[n] + abs(x[n] - ix) + abs(y[n] - iy);
                    break;
                }
            }
            rep(n, N) {
                if (h[n] > 0 && H - h[n] != abs(x[n] - ix) + abs(y[n] - iy)) {
                    flag = false;
                    break;
                }
                else if (h[n] == 0 && H > abs(x[n] - ix) + abs(y[n] - iy)) {
                    flag = false;
                    break;
                }
            }
            if (flag) {
                ansx = ix;
                ansy = iy;
                ansh = H;
            }
        }
    }

    cout << ansx << " " << ansy << " " << ansh << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:102400000,102400000")
#define rep(i,a,b) for (int i=a;i<=b;i++)
#define per(i,b,a) for (int i=b;i>=a;i--)
#define mes(a,b)  memset(a,b,sizeof(a))
#define INF 0x3f3f3f3f
#define MP make_pair
#define PB push_back
#define fi  first
#define se  second
typedef long long ll;
const int N = 200005;

ll n, p, a[100], dp[100][2];
int main()
{
    scanf("%lld %lld", &n, &p);
    rep(i,1,n) scanf("%lld", &a[i]);
    dp[0][1]=0, dp[0][0]=1;
    rep(i,1,n)
    {
        if(a[i]%2==0)
        {
            dp[i][0]=dp[i-1][0]*2;
            dp[i][1]=dp[i-1][1]*2;
        }
        else
        {
            dp[i][0]=dp[i-1][1] + dp[i-1][0]; //cout<<dp[n][1]<<"=----"<<endl;
            dp[i][1]=dp[i-1][0] + dp[i-1][1];
        }
    }
    if(p==0) printf("%lld\n", dp[n][0]);
    else printf("%lld\n", dp[n][1]);

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Stack;

public class Main {

	public static void main(String[] args) {
		Stack<Integer> stk = new Stack<Integer>();
		Scanner in = new Scanner(System.in);
		
		while (in.hasNext()) {
			if (in.hasNextInt()) {
				stk.push(in.nextInt());
			} else {
				int y = (int) stk.pop();
				int x = (int) stk.pop();
				int result = 0;
				String operator = in.next();
				if (operator.equals("+")) {
					result = x + y;
				} else if (operator.equals("-")) {
					result = x - y;
				} else if (operator.equals("*")) {
					result = x * y;
				} else if (operator.equals("/")) {
					result = x / y;
				}
				
				stk.push(result);
				
			}
		}
		
		System.out.println(stk.pop());
		
	}

}


Measured memory_bytes: 26800
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String str1 = sc.nextLine();
		String str2 = sc.nextLine();

		int len = str1.length() + str2.length();
		int j = 0,k = 0;

		for(int i = 0;i < len;i++){
			if(i % 2 == 0){
				System.out.print(str1.charAt(j));
				j++;
			}else{
				System.out.print(str2.charAt(k));
				k++;
			}
		}
		System.out.println();

		sc.close();
	}

}


Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll i,j,k;

int main(){
    ll n;cin>>n;
    
    ll ans=0;
    for(i=1;i<=n;i++){
        if(!(i%3==0 || i%5==0)){ans+=i;}
    }

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

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#include<stdint.h>
#define ii pair<int,int>
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define int long long int
using namespace std;

int32_t main(){
	int a,b,c;
	cin>>a>>b>>c;
	cout<<max((int)0,(b+c)-a);
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
  ll N;
  cin >> N;
  ll a,b,r,t;
  cin >>a;
  ll i;
  for(i=0;i<N-1;i++){
    cin >> b;
    if(a>b){
      t=b;
      b=a;
      a=t;
    }
    while(b%a!=0){
      r=b%a;
      b=a;
      a=r;
    }
  }
  cout << a;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	ll n,x,y;
	cin>>n>>x>>y;
	vector<vector<ll>> dist(n+4,vector<ll>(n+4,INF));
	FOR(i,1,n+1){
		dist[i][i]=0;
		queue<int> que;
		que.push(i);
		while(!que.empty()){
			int v=que.front();
			que.pop();
			if(v+1<=n && dist[i][v+1]==INF){
				dist[i][v+1]=dist[i][v]+1;
				que.push(v+1);
			}
			if(1<=v-1 && dist[i][v-1]==INF){
				dist[i][v-1]=dist[i][v]+1;
				que.push(v-1);
			}
			if(v==x){
				if(dist[i][y]==INF){
					dist[i][y]=dist[i][x]+1;
					que.push(y);
				}
			}
			if(v==y){
				if(dist[i][x]==INF){
					dist[i][x]=dist[i][y]+1;
					que.push(x);
				}
			}
		}
	}
	vector<ll> ans(n+10,0);
	FOR(i,1,n+1)FOR(j,i+1,n+1){
		ans[dist[i][j]]++;
	}
	FOR(k,1,n){
		cout<<ans[k]<<endl;
	}
}

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

constexpr int MOD = 1000000007;
// constexpr int MOD = 998244353;
constexpr int MAX = 510000;
vector<long> fact(MAX), finv(MAX), inve(MAX);

void init() {
  fact.at(0) = fact.at(1) = 1;
  finv.at(0) = finv.at(1) = 1;
  inve.at(1) = 1;
  for (int i = 2; i < MAX; i++) {
    fact.at(i) = fact.at(i - 1) * i % MOD;
    inve.at(i) = MOD - inve.at(MOD % i) * (MOD / i) % MOD;
    finv.at(i) = finv.at(i - 1) * inve.at(i) % MOD;
  }
}

long com(long n, long r) {
  if (n < r || n < 0 || r < 0) return 0;
  return fact.at(n) * (finv.at(r) * finv.at(n - r) % MOD) % MOD;
}

long mpow(long a, long b) {
  long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % MOD;
    a = a * a % MOD;
    b >>= 1;
  }
  return res;
}

long com2(long n, long r) {
  long x = 1, y = 1;
  for (int i = 1; i <= r; i++) {
    x = x * (n - i + 1) % MOD;
    y = y * i % MOD;
  }
  return x * mpow(y, MOD - 2) % MOD;
}

long inv(long a) {
  long b = MOD, u = 1, v = 0;
  while (b) {
    long t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= MOD; 
  if (u < 0) u += MOD;
  return u;
}

int main() {
  ios::sync_with_stdio(false);
  init();
  int N, K;
  cin >> N >> K;
  for (int i = 1; i <= K; i++) {
    cout << com(K - 1, i - 1) * com(N - K + 1, i) % MOD << "\n";
  }
}

Measured memory_bytes: 12288
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int h, w;
  cin >> h >> w;
  vector<string> a(h);
  rep(snip_i, h) cin >> a.at(snip_i);
  int co = 0;
  rep(i, h){
    rep(j, w){
      if(a.at(i).at(j) == '#') co++;
    }
  }
  if(co == h+w-1) cout << "Possible" << endl;
  else cout << "Impossible" << endl;
  return 0;
}

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

using namespace std;

int main(){
	int n; cin >> n;
	vector<int> a(n);
	map<int,int> mp;
	for(int i=0;i<n;i++){
		cin >> a[i];
		mp[a[i]]++;
	}
	int ans=0;
	
	for(auto it=mp.rbegin();it!=mp.rend();it++){
		auto x = it->first, y=it->second;
		
		int nx = log2(x);
		if((1<<nx)==x){
			ans+=y/2;
		}
		else{
			nx++;
			int req = (1<<nx)-x;
			if(mp.find(req)!=mp.end()){
				int avail = min(mp[req], y);
				ans+= avail;
				mp[req]-= avail;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 10624
while True:
    n=[int(e) for e in input().split()]

    if(n[0]==0)and(n[1]==0):
        break

    m=[[0 for i in range(n[0])] for j in range(n[1]+1)]
    
    for j in range(n[1]):
        m[j]=[int(e) for e in input().split()]

    for k in range(n[0]):
        score=0
        for j in range(n[1]):
            score=m[j][k]+score
        m[(n[1])][k]=score
    
    max_=m[(n[1])][0]
    for k in range(n[0]):
        if max_<m[(n[1])][k]:
            max_=m[(n[1])][k]

    print(max_)



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

int main() {
  ll n, k, q;
  cin >> n >> k >> q;
  vector<int> v(n);
  for(int i = 0; i<q; i++) {
    int winner;
    cin >> winner;
    --winner;
    v[winner]++;
  }
  for(int i = 0; i<n; i++) {
    if(k-(q-v[i]) > 0) {
      cout << "Yes" << endl;
    }
    else { 
      cout << "No" << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 1024
main :: IO()
main = do
  _ <- getLine 
  str <- getLine
  putStrLn $ solve str

solve :: String -> String
solve str = show.snd $ foldl f (0,0) str
  where
    f :: (Int, Int) -> Char -> (Int, Int)
    f (x,m) 'I' = (x+1, max m (x+1))
    f (x,m) 'D' = (x-1,  m)
    f (x,m) _ = (x,m)


Measured memory_bytes: 508
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;

int main(int argc, char* argv[])
{
    while( 1 ) {
        int a,b;
        char str[5]={0};
        scanf("%d%s%d", &a, str, &b);
        int c;
        if(str[0]=='+') {
            c=a+b;
        }
        else if(str[0]=='-') {
            c=a-b;
        }
        else if(str[0]=='*') {
            c=a*b;
        }
        else if(str[0]=='/') {
            c=a/b;
        }
        else {
            break;
        }
        printf("%d\n", c);
    }
    return 0;
}



Measured memory_bytes: 2664
import sys
input=sys.stdin.readline


def solve():
    N = int(input())
    d = {i:-1 for i in range(1, N+1)}
    *l, = map(int, input().split())

    MOD = 10**9+7
    n = N+1
    fac = [1]*(n+1)
    rev = [1]*(n+1)
    
    for i in range(1,n+1):
        fac[i] = i*fac[i-1]%MOD
        rev[i] = pow(fac[i], MOD-2, MOD)
    
    comb = lambda a,b:(fac[a]*rev[a-b]*rev[b])%MOD if a>=b else 0

    for i, j in enumerate(l):
        if d[j] != -1:
            break
        d[j] = i

    v = d[j]+N-i
    for i in range(1, N+2):
        print((comb(N+1, i)-comb(v, i-1))%MOD)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 29552
#include<stdio.h>
int main()
{
   int a,b,c,d,m,n;
   scanf("%d %d %d %d",&a,&b,&c,&d);
   m=a*b;
   n=c*d;

   if(m>n)
   {
       printf("%d\n",m);

   }

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

    return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
 
int main(void){
  int x;
  scanf("%d",&x);
  
  if(x>= 400 && x<=599){
    printf("%d",8);
  }
  else if(x>=600 && x<=799){
    printf("%d",7);
  }
    else if(x>=800 && x<=999){
    printf("%d",6);
  }
    else if(x>=1000 && x<=1199){
    printf("%d",5);
  }
    else if(x>=1200 && x<=1399){
    printf("%d",4);
  }
    else if(x>=1400 && x<=1599){
    printf("%d",3);
  }
  else if(x>=1600 && x<=1799){
    printf("%d",2);
  }
     else if(x>=1800 && x<=1999){
    printf("%d",1);
  }
  
  return 0;
}

Measured memory_bytes: 1728
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <string>
#include <cctype>
#include <cstdio>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define SORT(x) sort(x.begin(),x.end())
#define REVE(x) reverse(x.begin(),x.end())
#define all(x) (x).begin(),(x).end()
#define fst first
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define sw swap
#define UP(x) transform(x.begin(),x.end(),x.begin() ,::toupper);
using LL = long long;
using ULL = unsigned long long;
#define FOR(i, m, n) for(int i = m;i < n;i++)
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
int main(){
    string n,a,b,c;
    cin >> a >> b >> c;
  UP(a);UP(b);UP(c);
  cout <<a[0]<<b[0]<<c[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()
{
    ll n;
    cin >> n;
    vector<pair<ll, int>> fs;
    for(ll i=2; i*i <=n; i++){
        int x = 0;
        while(n%i==0){
            n/=i;
            ++x;
        }
        fs.emplace_back(i, x);
    }
    if(n!=1) fs.emplace_back(n, 1);

    int ans = 0;
    for(auto p : fs){
        int x = p.second;
        int b = 1;
        while(b<=x){
            x -=b;
            b++;
            ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main() {
    int c[3][3];
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> c[i][j];
        }
    }
    vector<int> a = {0, c[1][0] - c[0][0], c[2][0] - c[0][0]};
    vector<int> b = {c[0][0], c[0][1], c[0][2]};
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            if (c[i][j] != a[i] + b[j]) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int h[] = new int[10];
		int n = 0;
		for(int i = 0; i < 10; i++){
			h[i] = sc.nextInt();
		}
		for(int i = 0; i < 3; i++){
			for(int j = i + 1; j < 10; j++){
				if(h[i] < h[j]){
					n = h[j];
					h[j] = h[i];
					h[i] = n;
				}
			}
		}
		for(int i = 0; i < 3; i++){
			System.out.println(h[i]);
		}
	}
}

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

void change_Small_Word(string &s, int N){
    
    for(int i = 0; i < N; i++){
        bool b = isupper(s[i]);
        if(b){
            s[i] = tolower(s[i]);
        }
    }
    
}


int main(void){
    
    string str, word;
    cin >> str;
    change_Small_Word(str, str.size());
    
    int ans = 0;
    while(true){
        cin >> word;
        if(word == "END_OF_TEXT") { break; }
        change_Small_Word(word, word.size());
        if(str == word){ ans++; }
    }
    
    cout << ans << endl;
    
}



Measured memory_bytes: 3176
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007 // 10^9+7
#define INF 99999999999 //10^12-1
#define dev 998244353 //tenka1
#define P pair<int,int>
#define F first
#define S second
int l,r,a=0;
int ans=INF;
signed main(){
    cin>>l>>r;
    if(r-l>2019)a+=2019;
    l%=2019;
    r%=2019;
    r+=a;
    for(int i=l;i<r;i++){
        for(int j=i+1;j<=r;j++){
            int x=(i*j)%2019;
            ans=min(ans,x);
        }
    }
    cout<<ans<<endl;
    return 0;
}



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

int main() {
	
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	
	int A, V, B, W, T; cin >> A >> V >> B >> W >> T;
	if (A <= B) {
		long long a = (long long)A + (long long)V * T;
		long long b = (long long)B + (long long)W * T;
		cout << ((a >= b) ? "YES" : "NO") << "\n";
	} else {
		long long a = (long long)A - (long long)V * T;
		long long b = (long long)B - (long long)W * T;
		cout << ((a <= b) ? "YES" : "NO") << "\n";
	}
	
	return 0;
}


Measured memory_bytes: 3640
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>

int main (int argc, char **argv)
{
  char test[26] = {0};
  char s[12] = {0};
  int i = 0;
  int slen = 0;
  int len = 0;
  int max = 0;

  test[0] = 1;
  test[2] = 1;
  test[6] = 1;
  test[19] = 1;

  scanf("%s", s);

  slen = strlen(s);

  for(i = 0; i < slen; i++)
  {
    if(test[s[i] - 'A'])
    {
      len++;
    }
    else
    {
      max = len > max ? len : max;
      len = 0;
    }
  }
  max = len > max ? len : max;

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

  return 0;
}



Measured memory_bytes: 128
import Control.Applicative
import Control.Monad
import Data.List

main = do
    [k, t] <- fmap read . words <$> getLine :: IO [Int]
    as <- sortBy (flip compare) . fmap read . words <$> getLine :: IO [Int]
    case as of
        (b:[]) -> print $ b - 1
        (b:bs) | b <= sum bs -> print 0
               | otherwise   -> print $ b - sum bs - 1

Measured memory_bytes: 892
#include <iostream>
#include <algorithm>

#define MOD (1000 * 1000 * 1000 + 7)
#define MAX_INT (201)

long long fact[MAX_INT];
long long com[MAX_INT][MAX_INT];
int memo[MAX_INT][100 * 1000 + 1];

void init() {

    fact[0] = 1;
    for( int i = 1; i < MAX_INT; ++i ) {
        fact[i] = fact[i - 1] * i % MOD;
    }

    for( int i = 0; i < MAX_INT; ++i ) {
        com[i][0] = com[i][i] = 1;
        for( int j = 1; j < i; ++ j ) {
            com[i][j] = (com[i - 1][j - 1] + com[i - 1][j]) % MOD;
        }
    }

    for( int i = 0; i < MAX_INT; ++i ) {
        for( int j = 0; j <= 100 * 1000; ++j ) {
            memo[i][j] = -1;
        }
    }

}

int solve(int current, int X, int *set) {

    if( memo[current][X] >= 0 ) { 
        return memo[current][X];
    }

    if( current == 0 ) { return memo[current][X] = X; }

    int sum = 0;

    for( int i = 0; i < current; ++i ) {
        int skip = current - i - 1;
        sum = (sum + solve(i, X % set[i], set) * fact[skip] % MOD * com[current - 1][skip]) % MOD;
    }

    return memo[current][X] = sum;

}

int main() {

    init();

    int N, X;
    std::cin >> N >> X;
    int *set = new int[N];

    for( int i = 0; i < N; ++i ) {
        std::cin >> set[i];
    }

    std::sort(set, set + N);
    int memo[MAX_INT][MAX_INT];
    for( int i = 0; i < N; ++i ) {
        for( int j = 0; j <= N; ++j ) {
            memo[i][j] = -1;
        }
    }

    std::cout << solve(N, X, set) << std::endl;

    return 0;

}


Measured memory_bytes: 79104
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 105

struct Info{

	double limit,t;
};

struct Data{
	void set(int arg_left,int arg_right,int arg_limit){
		left = arg_left;
		right = arg_right;
		limit = arg_limit;
	}
	double left,right,limit;
};

int N;
double from_L[NUM],from_R[NUM],ans[NUM];
Info info[NUM];
Data data[NUM];

int main(){

	scanf("%d",&N);

	info[0].t = 0;
	for(int i = 1; i <= N; i++){

		scanf("%lf",&info[i].t);
		info[i].t += info[i-1].t;
	}
	info[N+1].t = info[N].t;


	info[0].limit = 0;
	for(int i = 1; i <= N; i++){

		scanf("%lf",&info[i].limit);
	}
	info[N+1].limit = 0;

	data[0].set(0,0,0);
	for(int i = 1; i <= N; i++){

		data[i].set(info[i-1].t,info[i].t,info[i].limit);
	}
	data[N+1].set(info[N].t,info[N].t,0);


	double ans = 0,pre = 0,minimum;
	int index;

	//1秒ごとに求める
	for(double current = 0; current < info[N+1].t || fabs(info[N+1].t-current) < EPS; current += 0.5){

		//printf("current]%.1lf\n",current);

		minimum = BIG_NUM;

		for(index = 0; current-data[index].right >= EPS; index++){ //左側

			minimum = min(minimum,data[index].limit+(current-data[index].right)*1);
		}
		minimum = min(minimum,data[index].limit); //currentをleft-rightに含む区間

		for(++index; index <= N+1; index++){

			minimum = min(minimum,data[index].limit+(data[index].left-current)*1); //右側
		}

		ans += (pre+minimum); //台形の面積

		pre = minimum;
	}

	printf("%.10lf\n",ans/4);

	return 0;
}


Measured memory_bytes: 256
const MOD: usize = 1e9 as usize + 7;
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };

    let n = sc.read();
    let c: usize = sc.read();
    let a: Vec<usize> = sc.vec(n);
    let b: Vec<usize> = sc.vec(n);
    let max_b: usize = *b.iter().max().unwrap();

    let mut pow = vec![vec![0; c + 1]; max_b + 1];
    for x in 0..(max_b + 1) {
        pow[x][0] = 1;
        for i in 0..c {
            pow[x][i + 1] = (pow[x][i] * x) % MOD;
        }
    }

    let mut sum_pow = vec![vec![0; c + 1]; max_b + 2];
    for i in 0..(c + 1) {
        for x in 0..(max_b + 1) {
            sum_pow[x + 1][i] = (sum_pow[x][i] + pow[x][i]) % MOD;
        }
    }

    let mut dp = vec![0; c + 1];
    dp[0] = 1;
    for i in 0..n {
        let (a, b) = (a[i], b[i]);
        let mut next = vec![0; c + 1];
        for cur in 0..(c + 1) {
            if dp[cur] == 0 {
                continue;
            }
            for add in 0..(c + 1) {
                if cur + add > c {
                    break;
                }

                next[cur + add] += dp[cur] * (sum_pow[b + 1][add] + MOD - sum_pow[a][add]);
                next[cur + add] %= MOD;
            }
        }
        dp = next;
    }
    println!("{}", dp[c]);
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 6396