akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
#include <cstdio>
#include <cstring>

const int m = 1046527;
const int NIL = -1;
const int L = 14;

char H[m][L];

//string to integer;
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;
    else return 0;
}

//string to integer change to key
long long getKey(char str[]){
    long long sum = 0, p = 1, i;
    for(i=0; i<strlen(str); i++){
        sum += p*(getChar(str[i]));
        p *= 5;
    }
    return sum;
}

int h1(int key){return key % m;}
int h2(int key){return 1 + (key % (m - 1));}

int find(char str[]){
    long long key , i, h;
    key = getKey(str);
    for(i=0;; i++){
        h = (h1(key) + i*h2(key)) % m;
        if(strcmp(H[h], str)==0) return 1;
        else if(strlen(H[h]) == 0) return 0;
    }
    return 0;
}
int insert(char str[]){
    long long key, i, h;
    key = getKey(str);
    for(i = 0;; i++){
        h = (h1(key) + i*h2(key)) % m;
        if(strcmp(H[h], str) == 0) return 1;
        else if(strlen(H[h]) == 0) {
            strcpy(H[h], str);
            return 0;
        }
    }
    return 0;
}

int main(){
    int i, n, h;
    char str[L], com[9];
    //for(i=0; i<m; i++) H[i][0] = '\0';
    scanf("%d", &n);
    for(i=0; i<n; i++){
        scanf("%s %s", com, str);
        if(com[0] == 'i'){
            insert(str);
        } else {
            if(find(str)){ printf("yes\n");}
            else {printf("no\n");}
        }
    }

    return 0;
}


Measured memory_bytes: 17432
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

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

ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

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

vector<int> l(N),r(N);

rep(i,N) cin>>l[i]>>r[i];

int S=0;

rep(i,N) S+=r[i]-l[i]+1;

cout<<S<<endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF = (int)2e9 + 1;
const long long LINF = (long long)9e18 + 1;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, ans = 1;
  cin >> N;
  for (int i = 0; i < 3; i++) {
    ans *= N;
  }

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


Measured memory_bytes: 256
/*
* @Author Silviase(@silviasetitech)
* For ProCon
*/

import java.util.*;
import java.lang.*;
import java.math.*;

public class Main{

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

        int n = sc.nextInt();
        int[] itr = new int[n];
        String[] s = new String[n];
        int[] p = new int[n];
        Pair[] pa = new Pair[n];
        Pair[] pa2 = new Pair[n];
        for (int i = 0; i < n; i++) {
            itr[i] = i+1;
            s[i] = sc.next();
            p[i] = sc.nextInt();
            pa[i] = new Pair(s[i],p[i]);
            pa2[i] = pa[i];
        }
        Comparator<Pair> cmp = Comparator.comparing(v -> v.x);
        Arrays.sort(pa,cmp.thenComparing(v -> -v.y));

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (pa[i].x.equals(pa2[j].x) && pa[i].y == pa2[j].y) {
                    System.out.println(j+1);
                }
            }
        }

        sc.close();
    }

    public static String make_bi_nari(int nbit, int num_to_binary) {
        String res = Integer.toBinaryString(num_to_binary);
        while(res.length() != nbit){
            res = "0" + res;
        }
        return res;
    }
    /**
     * Pair_int
     */
    public static class Pair {
        public String x;
        public int y;

        /**
         * Constructor 
         * Sample Code
         * 
         *      Pair[] pair = new Pair[5];
                for (int i = 0; i < 5; i++) {
                    pair[i] = new Pair(sc.nextInt(), sc.nextInt());
                }
                for (int i = 0; i < 5; i++) {
                    System.out.println(pair[i].x + " " + pair[i].y);
                }
         *
         */
        public Pair(String x, int y){
            this.x = x;
            this.y = y;
        }
        
        public String toString() {
            return "(" + x + ", " + y + ")";
        }

    }

}





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

int b[110];
int main() {
	int n, m, c;
	int a;
	cin >> n >> m >> c;
	long long sum;
	int cnt = 0;
	for (int i = 1; i <= m; i++) {
		cin >> b[i];
	}
	for (int i = 0; i < n; i++) {
		sum = 0;
		for (int i = 1; i <= m;i++) {
			cin >> a;
			sum += a * b[i];
		}
		sum += c;
		if (sum > 0)cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#include <cassert>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define Cout(x) cout << x << endl;
#define check(v) rep(i,v.size()) cout << v[i] << endl;
#define vint(x) vector<int> x
#define vll(x) vector<long long> x
#define vstr(x) vector<string> x
const long long LLINF = 1LL<<60;
const int INF = 1e9;
const long long MOD = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
#define pint pair<int,int>
#define pll pair<ll,ll>
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, k; cin >> n >> k;
    int ans = 0;
    while(n!=0) {
        n /= k;
        ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    double a, b, x;
    cin >> a >> b >> x;
    x /= a;
    double h = (a * b) / 2;
    double ans;
    if (x <= h)
        ans = atan((b * b) / (2 * x));
    else
    {
        x = a * b - x;
        ans = atan((2 * x) / (a * a));
    }
    ans = ans * 180.0 / (4.0 * atan(1.0));
    printf("%.10lf\n", ans);
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include<cmath>
#include<algorithm>
using namespace std;

int main(){
    int n;
    cin >> n;
    if(n == 0){
        cout << 0 << endl;
        return 0;
    }
    vector<int> ans;
    int i = (-2);
    //cout << (-9)%(-2) << endl;
    while(n !=0){
        //cout << n << endl;
        if(abs(n)%2 ==1){
            ans.push_back(1);
            n = (n-1)/i;
        }
        else if(n%2 ==0){
            ans.push_back(0);
            n = n/i;
        }
    }
    reverse(ans.begin(),ans.end());
    for(int i=0;i<ans.size();i++){
        cout << ans[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
/*+lmake
 * STD = c++14
 * DEFINE += WAAUTOMATON
 */
#include <bits/stdc++.h>
using namespace std;
using LL=long long;
using ULL=unsigned long long;
#ifdef WAAUTOMATON
     #define debug(args...)            {dbg,args; cerr<<endl;}
#else
    #define debug(args...)              // Just strip off all debug tokens
#endif

struct debugger
{
    template<typename T> debugger& operator , (const T& v)
    {    
        cerr<<v<<" ";    
        return *this;    
    }
} dbg;

void solve(long long N, long long K, vector<long long> a){
	LL sum1=0,sum2=0;
	for(int i=K; i<N; ++i) {
		sum1+=max(a[i],0LL);
	}
	for(int i=0; i<K; ++i) {
		sum2+=a[i];
	}
	LL ans=sum1+max(sum2,0LL);
	for(int i=K; i<N; ++i) {
		sum1+=max(a[i-K],0LL);
		sum1-=max(a[i],0LL);
		sum2-=a[i-K];
		sum2+=a[i];
		ans=max(ans,sum1+max(sum2,0LL));
	}
	cout<<ans<<endl;
}

int main(){	
#ifdef WAAUTOMATON
	//freopen("in.txt","r",stdin);
#endif
	long long K;
	long long N;
	scanf("%lld",&N);
	vector<long long> a(N-1+1);
	scanf("%lld",&K);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&a[i]);
	}
	solve(N, K, a);
	return 0;
}



Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
using namespace std;
long long int fn[45] = {2};
int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		fn[i] = fn[i - 1] * 2 + 2;
	}
	cout << fn[n] << endl;
 	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
 
typedef long long ll;
 
ll e, m, x, min_;
 
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
 
    while (cin >> e, e) {
        min_ = m = (int)(1e9 + 7);
 
        for (int y = 0; y <= sqrt((double)e); y++) {
            for (int z = 0; z <= cbrt((double)e) + 1; z++) {
                x = e - y * y - z * z * z;
                if (x < 0) break;
                else {
                    m = x + y + z;
                    //cout << "x, m = " << x << " " << m << endl;
                    if (min_ > m) min_ = m;
                }
            }
        }
 
        cout << min_ << endl;
    }
 
    return 0;
}

Measured memory_bytes: 3344
#include<stdio.h>
#include<stdlib.h>
typedef long long int lli;
int cmp(const void *a, const void *b){
	return *(int*)a - *(int*)b;
}
int main(){
	typedef long long int lli;
	int n,k,h[100000],i;
	lli ans = 100000000000;
	scanf("%d %d",&n,&k);
	for (i=0;i<n;i++){
		scanf("%d",&h[i]);
	}
	qsort(h,n,sizeof(int),cmp);
	for (i=0;i<=n-k;i++){
		if (ans>h[i+k-1]-h[i]){
			ans = h[i+k-1]-h[i];
		}
	}
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

signed main() {
    cin >> X;
    if (X >= 30)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>   //PBDS
#include <ext/pb_ds/tree_policy.hpp>       //PBDS
#define int long long int
#define vi vector<int>
#define vii vector<pair<int,int>>
#define pi pair<int,int>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define mi map<int,int>
#define PI   3.141592653589
#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define f(i,x,n) for(int i=x;i<n;i++)
#define rf(i,x,n) for(int i=n-1;i>=x;i--)
#define check(x)   cerr<<#x<<" : "<<x<<endl;
#define ordered_set tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>
#define fbo find_by_order                    //return iterator PBDS
#define ook order_of_key                     //return number :)) PBDS
#define baar exit(0)
#define INF 1000000000000000000
using namespace __gnu_pbds;
using namespace std;
int powmod(int base,int exponent,int mod)
{
	int ans=1;
	while(exponent){
		if(exponent&1)ans=(ans*base)%mod;
		base=(base*base)%mod;
		exponent/=2;
	}
	return ans;
}
vi v[100005];
vi level(100005),vis(100005);
void dfs(int node)
{
	vis[node]=1;
	for(int x:v[node])
	{
		if(!vis[x])
		{
			dfs(x);
		}
		level[node]=max(level[node],1+level[x]);
	}
}
signed main()
{
	fast
	int n,m;
	cin>>n>>m;
	f(i,0,m)
	{
		int x,y;
		cin>>x>>y;
		v[x].pb(y);
	}
	f(i,1,n+1)
	{
		if(!vis[i])
		{
			dfs(i);
		}
	}
	int ans=0;
	f(i,1,n+1) ans=max(ans,level[i]);
	cout<<ans;
	return 0;
}


Measured memory_bytes: 12300
#include <stdio.h>
#include <stdlib.h>
int top=0;
int S[1000];
void push(int a){
  S[++top]=a;
}
int pop(){
  top--;
  return S[top+1];
}
int isEmpty(char *a);
int isFull(char *a);
int main(){
  char a[100];
  int len,aa,b;
  while(scanf("%s",a)!=EOF){
    if(a[0] == '+'){
      aa=pop();
      b=pop();
      push(aa+b);
    }
    else if(a[0]== '-'){
      b=pop();
      aa=pop();
      push(aa-b);
    }
    else if(a[0] == '*'){
      aa=pop();
      b=pop();
      push(aa*b);
    }
    else {
      push(atoi(a));
    }
  }
printf("%d\n",pop());
return 0;
}

Measured memory_bytes: 548
#include "bits/stdc++.h"
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP0(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)

typedef long long LL;
typedef pair<int, int> pii;

const int INTINF = int(1e9) + 1;
const LL LLINF   = LL(1e18) + 1;
#define pow10(n) int(1e##n + n)

void solve()
{
    string S;
    cin >> S;

    if (S == "Sunny")
    {
        cout << "Cloudy" << endl;
    }
    else if (S == "Cloudy")
    {
        cout << "Rainy" << endl;
    }
    else
    {
        cout << "Sunny" << endl;
    }
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(10);
    solve();
    return 0;
}


Measured memory_bytes: 256
x = input().split()
y = input().split()



a = [int(i) for i in x]
b = [int(i) for i in y]

M = a[1]
s = sum(b)
c = 0
f = False

for i in b:
    if i >= ((1/(4*M)*s)):
        c += 1
    if c == M:
        print("Yes")
        f = True
        break

if not f:
    print("No")


Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
#include<bitset>
#include<regex>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define dup(x,y) (((x)+(y)-1) / (y)) //整数型のまま切り上げ演算する
#define PI 3.14159265359
typedef long long LL;
template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> inline T gcd(T x, T y) { if (y == 0) { return x; } else if (x == 0) { return y; }return gcd(y, x % y); }
template<class T> inline T lcm(T x, T y) { return (x * y) / gcd(x, y); }
template<class T> inline void print_vector(vector<T> vec) { for (int i = 0; i < vec.size(); i++) { cout << vec[i] << " "; } cout << endl; }
const LL MOD = 1e9 + 7;
const LL LLINF = 1LL << 60;
const int INF = 1 << 30;


int main(void) {
	LL N, K;
	string S;
	cin >> N >> K >> S;

	//幸福な人数は増えることはあれど減ることはないということに気づくべし

	LL score = 0;
	for (LL i = 1; i < S.size(); i++) {
		if (S[i - 1] == S[i]) score++;
	}

	LL ans = min(score + 2 * K, N - 1);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

#define N 44

int main()
{

  int n, i;
  int F[N];

  scanf("%d", &n);

  F[0] = 1;
  F[1] = 1;

  for(i=2; i<(n+2); i++){

    F[i] = F[i-2] + F[i-1];

  }

  printf("%d\n", F[n]);

  return 0;

}

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

using namespace std;

#define pb push_back
#define UN unsigned
#define ll long long

int main(void) {
	ios::sync_with_stdio(0);
	int n;
	cin >> n;

	vector<int> a(n), b;

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

	b = a;
	sort(b.begin(), b.end());

	for (int i = 0; i < n; i++) {
		if (a[i] != b[n - 1])
			cout << b[n - 1] << endl;
		else
			cout << b[n - 2] << endl;
	}
	

	return 0;
}

Measured memory_bytes: 3200
def f(n):
    rtn = ((n + 1) // 2) % 2
    for i in range(1, 40):
        if (n >> i) & 1 != 0:
            rtn |= ((n % (1 << i) + 1) % 2) << i
    return rtn


a, b = map(int, input().split())
ans = f(b)
if 0 < a:
    ans ^= f(a - 1)
print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<utility>

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++) 
#define ALL(x) x.begin(), w.end()

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

    cout << a * b << "\n";
}

Measured memory_bytes: 3596
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = System.Console.ReadLine().Trim().Split(' ');
            int iN = int.Parse(sS[0]);
            int iD = int.Parse(sS[1]);
            List<List<int>> lstInp = new List<List<int>>();
            for (int i = 0; i < iN; i++)
            {
                sS = System.Console.ReadLine().Trim().Split(' ');
                List<int> lstRow = new List<int>();
                for (int j = 0; j < sS.Length; j++)
                {
                    lstRow.Add(int.Parse(sS[j]));
                }
                lstInp.Add(lstRow);
            }

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            int iOut = 0;
            for (int i = 0; i < lstInp.Count; i++)                          // A点
            {
                for (int j = i + 1; j < lstInp.Count; j++)                  // B点   A点-B点で全ての組合せ
                {
                    decimal iDis = GetDis(lstInp[i], lstInp[j]);            // A点-B点間距離
                    if (iDis - Math.Truncate(iDis) == 0) { iOut += 1; }     // 整数なら加算
                }
            }

            // 出力
            System.Console.WriteLine("{0}", iOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

        private static decimal GetDis(List<int> lstA, List<int> lstB)
        {
            decimal iRet = 0;
            for (int i = 0; i < lstA.Count; i++)
            {
                iRet += (decimal)Math.Pow(Math.Abs(lstA[i] - lstB[i]), 2);      // A点-B点間距離
            }
            iRet = (decimal)Math.Sqrt((double)iRet);
            return iRet;
        }

}


Measured memory_bytes: 13396
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define MOD          1000000007
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define VV(T,h,w)    move(vector<vector<T>>(h,move(vector<T>(w))))
#define VVI(T,h,w,i) move(vector<vector<T>>(h,move(vector<T>(w,i))))
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

int main()
{
	int a = in(), b = in(), h = in();
	cout << (a + b) * h / 2 << endl;
}

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

int main(){
    int sx, sy, tx, ty;cin>>sx>>sy>>tx>>ty;

    vector<int> actions;
    for (int i=0;i<abs(tx - sx);i++){
        actions.push_back((tx - sx) / abs(sx - tx));
    }
    for (int i=0;i<abs(ty - sy);i++){
        actions.push_back(2 * ((ty - sy) / abs(sy - ty)));
    }
    for (int i=0;i<abs(sx - tx);i++){
        actions.push_back((sx - tx) / abs(sx - tx));
    }
    for (int i=0;i<abs(sy - ty);i++){
        actions.push_back(2 * ((sy - ty) / abs(sy - ty)));
    }
    actions.push_back(2 * (((ty - sy) / abs(ty - sy)) * -1));
    for (int i=0;i<abs(tx - sx) + 1;i++){
        actions.push_back((tx - sx) / abs(tx - sx));
    }
    for (int i=0;i<abs(ty - sy) + 1;i++){
        actions.push_back(2 * ((ty - sy) / abs(ty - sy)));
    }
    actions.push_back((sx - tx) / abs(sx - tx));
    actions.push_back(2 * ((ty - sy) / abs(ty - sy)));
    for (int i=0;i<abs(sx - tx) + 1;i++){
        actions.push_back((sx - tx) / abs(sx - tx));
    }
    for (int i=0;i<abs(sy - ty) + 1;i++){
        actions.push_back(2 * ((sy - ty) / abs(sy - ty)));
    }
    actions.push_back((tx - sx) / abs(tx - sx));
    

    for (auto a : actions){
        if (a == 1){
            cout << "R";
        } else if (a == -1){
            cout << "L";
        } else if (a == 2){
            cout << "U";
        } else {
            cout << "D";
        }
    }
    cout << endl;
    return 0;

}

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;
using ld = long double;
const int MOD = 1e9+7;
const ll INF = 1LL << 60;


int main() {
    int x, y; cin >> x >> y;
    if(x + y == 2) cout << 1000000 << endl;
    else if(x + y == 3) cout << 500000 << endl;
    else if(x + y == 4) cout << 400000 << endl;
    else if(x + y == 5) cout << 300000 << endl;
    else if(x + y == 6) cout << 200000 << endl;
    else if(x == 3 || y == 3) cout << 100000 << endl;
    else cout << 0 << endl;

    return 0;
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	unordered_map<string,int>m;
	for(int i=0;i<n;++i){
		string s; cin>>s;
		sort(s.begin(),s.end());
		++m[s];
	}
	cout<<accumulate(m.begin(),m.end(),0L,[](auto&&ans,auto&&a){return ans+1L*a.second*(a.second-1)/2;})<<"\n"s;
}

Measured memory_bytes: 10280
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int main(){
	while(1){
		int n, field=0, p[10]={0};
		char a;
		
		cin >> n;
		if(n==0) break;
		
		for(int i=0; i<100; ++i){
			scanf(" %c", &a);
			
			if(a=='M'){
				++p[i%n];
			}else if(a=='S'){
				field += p[i%n]+1;
				p[i%n]=0;
			}else if(a=='L'){
				p[i%n] += field+1;
				field=0;
			}	
		}
			
		sort(p, p+n);
		
		for(int i=0; i<n; ++i)
			printf("%d ", p[i]);
		printf("%d\n", field);
	
	}

	return 0;
}

Measured memory_bytes: 1192
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
#define double long double
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
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; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
#define eps 1e-12 
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int x[5];
	REP(i, 5)cin >> x[i];
	REP(i, 5) {
		if (x[i] == 0) {
			cout << i + 1 << endl;
			return 0;
		}
	}








	return 0;
}



Measured memory_bytes: 3608
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>

using namespace std;

int main(){

    
    int a,b,c,d;
    cin >> a >> b >> c >> d;

    int x=0,y=0;

    if(c%b==0)x=c/b;
    else x=c/b+1;

    if(a%d==0)y=a/d;
    else y=a/d+1;

    if(x<=y)cout << "Yes" << endl;
    else cout << "No" << endl;


}

Measured memory_bytes: 3636
using System;
using System.Linq;
using System.Collections.Generic;

namespace ConsoleApp1 {
    public class Class {
        static void Main(string[] args) {
            var N = long.Parse(Console.ReadLine());
            var A = new long[N];
            var B = new long[N];
            for(var i = 0; i < N; i++) {
                var AB = RL<long>();
                A[i] = AB[0];
                B[i] = AB[1];
            }
            Array.Sort(A);
            Array.Sort(B);

            if(N % 2 == 0) {
                var a = A[N / 2] + A[(N / 2) - 1];
                var b = B[N / 2] + B[(N / 2) - 1];
                var ans = b - a + 1;
                Console.Write(ans);
            } else {
                var ans = B[(N + 1) / 2　- 1] - A[(N + 1) / 2 - 1] + 1;
                Console.Write(ans);
            }
        }

        static T[] RL<T>() where T : IComparable {
            if (typeof(T) == typeof(int)) {
                return (T[])(object)Console.ReadLine().Trim().Split().Select(int.Parse).ToArray();
            }
            if (typeof(T) == typeof(long)) {
                return (T[])(object)Console.ReadLine().Trim().Split().Select(long.Parse).ToArray();
            }
            if (typeof(T) == typeof(double)) {
                return (T[])(object)Console.ReadLine().Trim().Split().Select(double.Parse).ToArray();
            }
            if (typeof(T) == typeof(decimal)) {
                return (T[])(object)Console.ReadLine().Trim().Split().Select(decimal.Parse).ToArray();
            }
            return (T[])(object)Console.ReadLine().Trim().Split().ToArray();
        }
    }
}


Measured memory_bytes: 44580
using System;
using System.Collections.Generic;


public class C
{
	public static void Main()
	{
		long N = Int64.Parse(Console.ReadLine());
		long neck = Int64.MaxValue;
		for(int i = 0; i < 5; i++)
			neck = Math.Min(neck, Int64.Parse(Console.ReadLine()));
		
		Console.WriteLine(4 + (N + neck - 1)/neck);
	}
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,d=0,mi=0,i;
  string s;
  cin>>n>>s;
  for(i=0;i<n;i++){
    if(s.at(i)=='(') d++;
    else if(s.at(i)==')'){
      d--;
      mi=min(mi,d);
    }
  }
  if(mi<0){
    for(i=0;i<-mi;i++) s='('+s;
    d-=mi;
  }
  if(d>0) for(i=0;i<d;i++) s+=')';
  cout<<s<<endl;
}

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

int main(){
    int A, B, C;
    cin >> A >> B >> C;
    set<int> S;
    int D = A % B;
    int n = -1;
    while (true){
        n ++;
        if (S.count((D * n) % B)){
            cout << "NO" << endl;
            return 0;
        }
        if ((D * n) % B == C){
            cout << "YES" << endl;
            return 0;
        }
        else{
            S.insert((D * n) % B );
        }
    }
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define gep(i,g,j) for(int i = g.head[j]; i != -1; i = g.e[i].next)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcount
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define df(x) int x = in()
#define dame { puts("0"); return 0;}
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,vector<T>,greater<T> >
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
inline void priv(vi a) { rep(i,sz(a)) printf("%d%c",a[i],i==sz(a)-1?'\n':' ');}
template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(vector<T>&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,vector<T>&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;



int main() {
  df(n);
  n -= 3;
  df(o); df(p); o -= p;
  vi a(n);
  rep(i,n) a[i] = in();
  int s = 0;
  rep(i,n) s += a[i];
  vi d(s+1);
  rep(i,s+1) d[i] = s-i;
  rep(i,n) {
    int b = sz(d)-1;
    for (int j = 1; j <= a[i]; ++j) d.pb(d[b-j]);
  }
  reverse(rng(d));
  // rep(i,sz(d)) printf("%d ", d[i]); puts("");
  df(m);
  rep(i,m) {
    ll x;
    scanf("%lld", &x);
    ll ans = 0;
    if (x < sz(d)) ans = d[x];
    else ans = x-s;
    ans += o;
    printf("%lld\n", ans);
  }
  return 0;
}







Measured memory_bytes: 10812
import collections

n = int(input())
graph = [[] for i in range(n + 1)]
for i in range(n - 1):
    a, b = map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)
flag = [False for i in range(n + 1)]
flag2 = [False for i in range(n + 1)]
dis_f = [0 for i in range(n + 1)]
dis_s = [0 for i in range(n + 1)]
queue = collections.deque([1])
while queue:
    test = queue.popleft()
    flag[test] = True
    for i in graph[test]:
        if flag[i] == False:
            queue.append(i)
            dis_f[i] = dis_f[test] + 1
queue2 = collections.deque([n])
while queue2:
    test = queue2.popleft()
    flag2[test] = True
    for i in graph[test]:
        if flag2[i] == False:
            queue2.append(i)
            dis_s[i] = dis_s[test] + 1
count_f = 0
count_s = 0
for i in range(n):
    if dis_f[i + 1] <= dis_s[i + 1]:
        count_f += 1
    else:
        count_s += 1
if count_f > count_s:
    print("Fennec")
else:
    print("Snuke")

Measured memory_bytes: 35364
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define ff first
#define ss second
#define ll long long
#define vi vector<int>
#define vii vector<vi>
#define vs vector<string>
#define vss vector<vs>
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define repr(i, a, n) for (int i = (n); i >= (a); --i)
using namespace std;
const int INF(1 << 30);
const ll LLINF(1LL << 55LL);
const int pi = 3.1415926536;
const int MOD = 1000000007;
const int MAX = 510000;

void Main() {
  char s[100001];
  cin >> s;
  int n = strlen(s);
  string ans;
  for (int i = 0; i < n; i += 2) {
    ans += s[i];
  }
  cout << ans << endl;
}

int main() {
  std::cin.tie(nullptr);                  // 標準入出力高速化
  std::ios_base::sync_with_stdio(false);  // SとS++の入出力出力を非同期
  std::cout << std::fixed << std::setprecision(15);  // 小数を10進数表示
  Main();
}

Measured memory_bytes: 512
count = 0
input_a = ""
input_m = ""
STDIN.each_line {|line|
  if count == 0 || count == 2
    count += 1
    next
  end

  if count == 1
    input_a = line
  end

  if count == 3
    input_m = line
  end
  count += 1
}


$input_a_list = input_a.split(" ")
$n = $input_a_list.length
input_m_list = input_m.split(" ")
$check = {}
$memo = {}
def solve i, m
  if i == $n
    return m == 0
  end

  if !$memo.has_key? (i + 1)
    $memo[i + 1] = {}
  end

  res1 = false
  if $memo[i + 1].has_key? (m)
    res1 = $memo[i + 1][m]
  else
    res1 = solve i + 1, m
    $memo[i + 1][m] = res1
  end

  input_a = $input_a_list[i].to_i
  res2 = false
  if (m - input_a) < 0
    return (res1 | res2)
  end

  if $memo[i + 1].has_key? (m - input_a)
    res2 = $memo[i + 1][m - input_a]
  else
    res2 = solve i + 1, m - input_a
    $memo[i + 1][m - input_a] = res2
  end

  return (res1 | res2)
end

input_m_list.each  {|num|
  if solve 0, num.to_i
    puts "yes"
  else
    puts "no"
  end
}



Measured memory_bytes: 7960
#include <bits/stdc++.h>
#define int long long
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int sum1[100009];
int sum2[100009];
main(){
	int n;
	cin>>n;
	int a[n*3];
	r(i,n*3)cin>>a[i];
	priority_queue<int>q1;
	priority_queue<int,vector<int>,greater<int> >q2;
	int sum=0;
	r(i,n)sum+=a[i],q2.push(a[i]);
	sum1[0]=sum;
	for(int i=n;i<n*2;i++){
		sum+=a[i];
		q2.push(a[i]);
		sum-=q2.top();q2.pop();
		sum1[i-n+1]=sum;
	}
	sum=0;
	r(i,n)sum+=a[n*2+i],q1.push(a[i+n*2]);
	sum2[n]=sum;
	for(int i=n*2-1,j=0;i>=n;j++,i--){
		sum+=a[n*2-j-1];
		q1.push(a[n*2-j-1]);
		sum-=q1.top();q1.pop();
		sum2[n-1-j]=sum;
	}
	int ans=-1e15;
	for(int i=0;i<=n;i++){
		//cout<<sum1[i]<<' '<<sum2[i]<<endl;
		ans=max(ans,sum1[i]-sum2[i]);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 5876
program jiji
implicit none
integer :: n, i, j, nstat, c
integer,allocatable :: a(:)

read(*,*) n
allocate(a(n))
read(*,*) a
j = 1

do while ( a(j) == a(j+1) )
	j = j + 1
end do

if ( a(j) > a(j+1) ) then
	nstat = -1
else
    nstat = 1
end if

c = 1
do i = j+1, n-1
	if ( nstat == -1 ) then
		if ( a(i) < a(i+1) ) then
        	c = c + 1
    		nstat = 0
        end if
    else if ( nstat == 1 ) then
    	if ( a(i) > a(i+1) ) then
        	c = c + 1
            nstat = 0
        end if
    else if ( nstat == 0 ) then
    	if ( a(i) > a(i+1) ) then
			nstat = -1
		else if ( a(i) < a(i+1) ) then
 		   nstat = 1
		end if
    end if
end do

write(*,*) c
stop
end program jiji

Measured memory_bytes: 3236
use std::io::*;
use std::str::FromStr;
   
fn read<T: FromStr>() -> T {
	let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// greatest common divisior
fn gcd(n: i64, m: i64) -> i64 {
	let mut x = 0;
	let mut y = 0;
	if n >= m {
		x = n;
		y = m;
	} else {
		x = m;
		y = n;
	}

	// x > y
	let mut r = x % y;
	if r == 0 {
		return y;
	} else {
		return gcd(y, r);
	}
}
     
fn main() {
	let a: i64 = read();
    let b: i64 = read();

	let gcd_input= gcd(a, b);
	let lcm = (a * b) / gcd_input;
	println!("{}", lcm);
}


Measured memory_bytes: 4352
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
const ll INF = (ll)1000000007*1000000007;
typedef pair<int, int> P;
typedef unsigned int ui;
int main(){
	int h, w, d,A;
	cin >> h >> w >> d;
	P p[90001];
	for (int i = 0; i <= 90000; i++) {
		p[i] = { 0,0 };
	}
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> A;
			p[A] = { i,j };
		}
	}
	ll cost[90001] = {};
	for (int i = 1; i <= h*w; i++) {
		if (i + d <= h*w) {
			cost[i+d] = cost[i]+(ll)abs(p[i].first - p[i + d].first) + (ll)abs(p[i].second - p[i + d].second);
		}
	}
	int q, s, g;
	cin >> q;
	for (int i = 0; i < q; i++) {
		cin >> s >> g;
		cout << cost[g]-cost[s] << endl;
	}
	char nyaa;
	cin >> nyaa;
	return 0;
}


Measured memory_bytes: 2560
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));

console.log(main());
function main(){
  var n = o.a();
  var w = o.a();
  var v = o.m(n);
  var dp = Array(w+1).fill(0);
  for(var i = 0; i < n; i++){
    for(var j = w; j >= v[i][0]; j--){
      dp[j] = Math.max(dp[j], dp[j-v[i][0]] + v[i][1]);
    }
  }
  return dp[w];
}

Measured memory_bytes: 21956
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define all(v)    (v).begin(), (v).end()
#define in        ([]{lint n; cin>>n; return n;}())
using namespace std;
using lint = int64_t;

//  累積和
//  条件 : T が群(単位元・逆元・結合則)
template<class T>struct Cusum {
    T identity;
    function<T(T)> inverse;
    function<T(T,T)> operate;
    vector<T> cu;

    Cusum( T e, function<T(T)> inv, function<T(T,T)> op, vector<T> v )
    :identity(e), inverse(inv), operate(op) {
        cu = vector<T>( v.size() +1 );
        cu[0] = e;
        rep( i, v.size() ) cu[i+1] = op( cu[i], v[i] );
    }

    T sum( int L, int R ) {
        return operate( inverse(cu[L]), cu[R] );
    }
};

//  尺取り法
//  条件 : N ≦ L ≦ l < r ≦ R ≦ M に対し
//        C(L, R) ⇒ C(l, R) が成り立つ
struct TwoPointers {
    lint count = 0, maxLen = 0;
    TwoPointers( int N, int M, function<bool(int,int)> C ) {
        for( lint L=N, R=N; L<M; L++ ) {
            for ( ; R<M && C(L,R+1); ++R );
            count += R-L;
            maxLen = max( maxLen, R-L );
            if( L==R ) ++R;
        }
    }
};


int main() { cin.tie(0); ios::sync_with_stdio(false);
    int N = in, Q = in;
    vector<lint> A(N); rep( i, N ) A[i] = in;
    
    Cusum<lint> cusum( 0, [](lint n){return -n;}, [](lint x, lint y){return x+y;}, A);

    rep( _, Q ) {
        lint X = in;
        lint ans = TwoPointers( 0, N, [&](int l, int r){
            return cusum.sum(l,r) <= X;
        } ) . count;
        cout << ans << "\n";
    }

}



Measured memory_bytes: 5092
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部変数
static FILE *szpFpI;											// 入力

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// １行出力
int
fOutLine(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// 実行メイン
int
fMain(
)
{
	int i;
	char lc1Buf[1024];

	// 人数 - 取得
	int liHCnt;
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d", &liHCnt);

	// 身長 - 取得
	long long llSum = 0;
	int liPre = 0;
	for (i = 0; i < liHCnt; i++) {
		int liH;
		fscanf(szpFpI, "%d", &liH);

		// 差
		int liDF = liPre - liH;
		if (liDF > 0) {
			llSum += liDF;
		}
		else {
			liPre = liH;
		}
	}
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);

	// 出力
	sprintf(lc1Buf, "%lld\n", llSum);
	fOutLine(lc1Buf);

	return 0;
}

// １回実行
int
fOne(
)
{
	int liRet;
	char lc1Buf[1024];

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	liRet = fMain();

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



Measured memory_bytes: 1744
import Control.Applicative
import Control.Monad
import Data.List
import Data.Array
import Data.Char

main = do
  [a, b] <- map (read::String -> Int) . words <$> getLine
  putStrLn $ if a `mod` 3 == 0 
    then "Possible" 
    else if b `mod` 3 == 0 
      then "Possible" 
      else if (a + b) `mod` 3 == 0 
        then "Possible" 
        else "Impossible"


Measured memory_bytes: 508
#include <iostream>
using namespace std;
int main()
{
    int n,a,b,c,x,sum,ans=0;
    cin>>n>>a>>b;
    for(int i=1;i<=n;i++)
    {
        c=i;

        sum=0;
        for(x=0;x<5;x++)
        {
            sum+=c%10;
            c/=10;
        }
        if(sum>=a&&sum<=b)
            ans+=i;



    }
    cout<<ans<<endl;




    return 0;
}

Measured memory_bytes: 256
#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 mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  string A, B, C;
  cin>>A>>B>>C;
  if(A[A.size()-1]==B[0] && B[B.size()-1]==C[0]) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}


Measured memory_bytes: 3612
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	a, b := intScanner(), intScanner()
	if a+b == 3 {
		fmt.Println(3)
	} else if a+b == 4 {
		fmt.Println(2)
	} else {
		fmt.Println(1)
	}
}


Measured memory_bytes: 1776
#include <cstdio>
#include <algorithm>

typedef long long LL;
const int MN = 100005, MQ = 100005;

int N, Q, tp;
LL A[MQ], t[MQ], Ans[MN];

int main() {
	scanf("%d%d", &N, &Q);
	if (!Q) {
		for (int i = 1; i <= N; ++i) puts("1");
		return 0;
	}
	A[tp = 1] = N;
	for (int i = 1; i <= Q; ++i) {
		LL x;
		scanf("%lld", &x);
		while (tp && A[tp] >= x) --tp;
		A[++tp] = x;
	}
	t[tp] = 1;
	for (int i = tp; i >= 2; --i) {
		LL k = A[i];
		t[i - 1] += k / A[i - 1] * t[i], k %= A[i - 1];
		while (k >= A[1]) {
			int p = std::upper_bound(A + 1, A + tp + 1, k) - A - 1;
			t[p] += k / A[p] * t[i], k %= A[p];
		}
		Ans[k] += t[i];
	}
	Ans[A[1]] += t[1];
	for (int i = N; i >= 1; --i) Ans[i] += Ans[i + 1];
	for (int i = 1; i <= N; ++i) printf("%lld\n", Ans[i]);
	return 0;
}

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

int main()
{
  int moji;
  bool match;
  std::string S, result;
  std::cin >> S;
  
  for(int i = 97; i <= 122; i++)
  {
    match = false;
    moji = i;

    for(int k = 0; S[k] != NULL; k++)
    {
      if((int)S[k] == i)
      {
        match = true;
        break;
      }
    }
    
    if(match == false)
    {
      break;
    }
  }

  if(moji == 122 && match == true)
  {
    result = "None";
  }
  else
  {
    result = moji;
  }
  
  std::cout << result;
  return 0;
}

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

A = []
b = []

for _ in range(N):
    A.append([int(i) for i in input().split()])
    
for _ in range(M):
    b.append(int(input()))
    
for i in range(N):
    print(sum([A[i][j] * b[j] for j in range(M)]))
    
    


Measured memory_bytes: 6012
class UnionFindVerSize():
    def __init__(self, N):
        """ N個のノードのUnion-Find木を作成する """
        # 親の番号を格納する。自分が親だった場合は、自分の番号になり、それがそのグループの番号になる
        self._parent = [n for n in range(0, N)]
        # グループのサイズ（個数）
        self._size = [1] * N
        self._even = [i%2 for i in range(0,N)]
        self._odd =[(i+1)%2 for i in range(0,N)]

    def find_root(self, x):
        """ xの木の根(xがどのグループか)を求める """
        if self._parent[x] == x: return x
        self._parent[x] = self.find_root(self._parent[x]) # 縮約
        return self._parent[x]

    def unite(self, x, y):
        """ xとyの属するグループを併合する """
        gx = self.find_root(x)
        gy = self.find_root(y)
        if gx == gy: return

        # 小さい方を大きい方に併合させる（木の偏りが減るので）
        if self._size[gx] < self._size[gy]:
            self._parent[gx] = gy
            self._size[gy] += self._size[gx]
            self._even[gy] += self._even[gx]
            self._odd[gy] += self._odd[gx]
        else:
            self._parent[gy] = gx
            self._size[gx] += self._size[gy]
            self._even[gx] += self._even[gy]
            self._odd[gx] += self._odd[gy]

    def get_size(self, x):
        """ xが属するグループのサイズ（個数）を返す """
        return self._size[self.find_root(x)]

    def is_same_group(self, x, y):
        """ xとyが同じ集合に属するか否か """
        return self.find_root(x) == self.find_root(y)

    def calc_group_num(self):
        """ グループ数を計算して返す """
        N = len(self._parent)
        ans = 0
        for i in range(N):
            if self.find_root(i) == i:
                ans += 1
        return ans

    def calc_comb(self):
        N=len(self._parent)
        ans=0
        for i in range(N):
            if self.find_root(i) ==i:
                ans+=self._even[i]*self._odd[i]
        return ans


import sys

input=sys.stdin.readline

N,M=map(int,input().split())
uf=UnionFindVerSize(2*N)
for i in range(M):
    a,b=map(int,input().split())
    uf.unite(2*a-2,2*b-1)
    uf.unite(2*b-2,2*a-1)

ans=uf.calc_comb()
for i in range(N):
    if uf.is_same_group(2*i,2*i+1):
        ans-=1

ans//=2
print(ans-M)


Measured memory_bytes: 128892