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

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; }

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(int i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;

int main(){
   int n;
   cin >> n;
   vector<ll>sum(n+1,0);
   map<ll,ll>mp;
   ll ans = 0;
   mp[0]++;
   rep(i, 1, n+1){
       ll p;
       cin >> p;
       sum[i]=sum[i-1] + p;
       mp[sum[i]]++;
   }
   for(auto i :mp){
       ll x = i.second;
       ans += x*(x-1)/2;
   }
   cout << ans << endl;
}

Measured memory_bytes: 17248
// 21:
//
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <stack>

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

using namespace std;

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

  bool flg = false;
  for(int i = 0; i < N; i++){
    cin >> S;
    if(S == 'Y') flg = true;
  }
  if(flg) cout << "Four" << endl;
  else cout << "Three" << endl;

  return 0;
}


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

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

    if((c=='a')||(c=='e')||(c=='i')||(c=='o')||(c=='u')){
        cout << "vowel" << endl;
    }
    else{
        cout << "consonant" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph= vector<vector<int>>; 
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define fi first 
#define se second
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
// ミント
const int mod = //1e9+7 ;
 998244353;

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

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
//昆布
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
  mint p(int n,int k){
    return fact[n]*ifact[n-k] ;
  }
}   c(200005);
 
mint modpow(ll a,ll b){
 if(b==0) return 1 ;
 mint c= modpow(a,b/2) ;
 if(b%2==1) return c*c*a ;
 else return c*c ;
}

mint komb(ll n,ll m){
  mint x=1 ;mint y=1 ;
  rep(i,m){
    x*= n-i ;
    y*= i+1 ;
  }
  return x/y ;
}

 
 map<ll,ll> factor(ll n){  //素因数とオーダーをマップで管理
  map <ll,ll> ord ;  
  for(ll i=2;i*i<=n;i++){
        if(n%i==0){
            int res=0;
            while(n%i==0){
                n/=i;
                res++;
            }
            ord[i]=res;
        }
    }
   if(n!=1) ord[n]++;
   return ord ;
 }

int main(){
  ll n,m,k ;cin>>n>>m>>k ;
  mint ans=0 ;
  for(ll i=0 ;i<=k ;i++){
    mint plus = mint(m) *modpow(m-1,n-1-i)*c(n-1,i) ;
    ans += plus ;
  }
  cout<<ans<<endl ;
    return 0;
  }
   



Measured memory_bytes: 6220
import math

A=[]
while True:
    n=int(input())
    if n==0:
        break
    s=input().split()
    #m=(s1+s2+...sn)/n
    #H=(s1-m)^2/n+(s2-m)^2/n+...(sn-m)^2/n
    #h=math.sqrt(H)
    i=0
    su=0
    while i<n:
        su+=int(s[i])
        i+=1
    m=su/n

    l=0
    H=0
    while l<n:
        H+=(int(s[l])-m)*(int(s[l])-m)/n
        l+=1
    h=math.sqrt(H)
    A.append(h)

for Ans in A:
    print(Ans)



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

using namespace std;
#define rep(i,n) for(int i=1;i<n;i++)
#define ll long long int

int main(){
  int N;
  cin >>N;
  rep(i,10){
    rep(j,10){
      if(i*j==N){
	cout<<"Yes"<<endl;
	return 0;
	  }
	

    }
  }
  cout<<"No"<<endl;

  return 0;
}


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

int main(){
    string S;
    cin>>S;
    map<char, int> chrmap;
    vector<char> chrarr;
    for(int i=0;i<S.size();++i){
        if(chrmap[S[i]]==0)chrarr.push_back(S[i]);
        chrmap[S[i]]++;
    }
    char tmp;
    string tmpstr, tmptmpstr;
    int ans = 10000;
    bool ok;
    if(chrarr.size()==1)cout<<0<<endl;
    else{
    for(int i=0;i<chrarr.size();++i){
        tmp = chrarr[i];
        tmpstr = S;
        while(true){
            ok = true;
            tmptmpstr = "";
            for(int j=0;j<tmpstr.size()-1;++j){
                if(tmpstr[j]==tmp | tmpstr[j+1]==tmp){
                    tmptmpstr += tmp;
                }
                else{
                    ok = false;
                    tmptmpstr += 'A';
                }
            }
            if(ok)break;
            tmpstr = tmptmpstr;
        }
        if(ans > S.size() - tmpstr.size()) ans = S.size() - tmptmpstr.size();
    }
    cout<<ans<<endl;
    }
}


Measured memory_bytes: 256
n, k = map(int, input().split())

arr = []
for _ in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    arr.append(a)

oks = [False] * n
for xs in arr:
    for x in xs:
        oks[x - 1] = True

ans = 0
for x in oks:
    if x == False:
        ans += 1

print(ans)


Measured memory_bytes: 9188
#設定
import sys
input = sys.stdin.buffer.readline

INF = float("inf")

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N, W = getlist()
	stock = []
	for i in range(N):
		w, v = getlist()
		stock.append([w, v])
	w1 = stock[0][0]
	for i in range(N):
		stock[i][0] -= w1

	DP = [[[-INF] * (N + 1) for i in range(3 * N + 1)] for j in range(N + 1)]
	DP[0][0][0] = 0
	#DP
	for i in range(N):
		for j in range(3 * N):
			for k in range(N):
				if DP[i][j][k] != -INF:
					DP[i + 1][j + stock[i][0]][k + 1] = max(DP[i + 1][j + stock[i][0]][k + 1], DP[i][j][k] + stock[i][1])
					DP[i + 1][j][k] = max(DP[i + 1][j][k], DP[i][j][k])

	#答え
	ans = 0
	for i in range(3 * N + 1):
		for j in range(N + 1):
			if DP[N][i][j] != INF and i + j * w1 <= W:
				ans = max(ans, DP[N][i][j])
	print(ans)

if __name__ == '__main__':
	main()

Measured memory_bytes: 91100
#include<bits/stdc++.h>
using namespace std;
int main()
{
 long long int a,b,c,d;
 cin>>a>>b>>c>>d;
 if(a*c>a*d&&a*c>b*c&&a*c>b*d){
   cout<<a*c<<endl;
 } else if(a*c==a*d&&a*d==b*c&&a*c==b*d){
   cout <<a*c<<endl;
 } else if(a*d>a*c&&a*d>b*c&&a*d>b*d){
   cout<<a*d<<endl;
 } else if(b*c>a*d&&b*c>a*c&&b*c>b*d){
   cout<<b*c<<endl;
 } else {
   cout<<b*d<<endl;
 }
}

Measured memory_bytes: 3624
n,m=map(int,input().split())
es=[[] for i in range(n)]
deg=[0]*n
for i in range(n-1+m):
    a,b=map(int,input().split())
    es[a-1].append(b-1)
    deg[b-1]+=1

ans=[]
from collections import deque
que=deque([])
for i in range(n):
    if deg[i]==0:
        que.append((i,-1))

while que:
    s=que.pop()
    ans.append(s)
    for e in es[s[0]]:
        deg[e]-=1
        if deg[e]==0:
            que.append((e,s[0]))
ans=sorted(ans)
for i in range(n):
    print(ans[i][1]+1)

Measured memory_bytes: 73644
// C - City Savers
// https://atcoder.jp/contests/abc135/tasks/abc135_c
// Q.
#include <bits/stdc++.h>
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007      //10^9+7
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define Vec(K, L, N, S) vector<L> K(N, S)
#define rt sqrt
#define pb push_back
#define eb emplace_back
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using P = pair<lli, lli>;
// vector<P> vp;
// vp.emplace_back(a[i], b[i]);
using vs = vector<string>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli c, h, k, n, w, ans = 0, count = 0;
  string s, t;
  cin >> n;
  vlli a(n + 1), b(n);
  rep(i, 0, n + 1)
  {
    cin >> a[i];
  }
  rep(i, 0, n)
  {
    cin >> b[i];
  }
  rep(i, 0, n)
  {
    //   if (a[i] - b[i] <= 0)
    //   {
    //     ans += a[i];
    //     // cout << i << " " << a[i] << " " << b[i] << endl;

    //     b[i] = abs(a[i] - b[i]);
    //     a[i] = 0;
    //     if (a[i + 1] - b[i] <= 0)
    //     {
    //       // cout << a[i + 1] << "   " << b[i] << endl;
    //       ans += a[i + 1];
    //       b[i] = abs(a[i + 1] - b[i]);
    //       a[i + 1] = 0;
    //     }
    //     else
    //     {
    //       // cout << i << " " << a[i + 1] << " " << b[i] << endl;
    //       ans += b[i];
    //       a[i + 1] -= b[i];
    //       b[i] = 0;
    //     }
    //   }
    //   else
    //   {
    //     ans += b[i];
    //     a[i] -= b[i];
    //     b[i] = 0;
    //   }

    ll c = min(a[i], b[i]);
    b[i] -= c;
    a[i] -= c;
    ans += c;
    c = min(a[i + 1], b[i]);
    b[i] -= c;
    a[i + 1] -= c;
    ans += c;
  }
  cout << ans << endl;
}


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

int main() {
	int t, n, s, f, sum;
	while (1) {
		cin >> t; if (t == 0) break;
		cin >> n; sum = 0;
		for (int i = 0; i < n; i++) {
			cin >> s >> f; sum += f - s;
		}
		if (sum >= t) cout << "OK" << endl;
		else cout << t - sum << endl;
	}
	return 0;
}


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

typedef long long ll;

/* メモリ食い過ぎ注意 */
#define int ll
#define ALL(v) v.begin(), v.end()
#define _REP(i, n) for (int i = 0; i < n; i++)
#define REP(n) _REP(i, n)

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

signed main()
{
    int n;
    int a[100000], b[100000], c[100000];
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    for (int i = 0; i < n; i++)
        cin >> b[i];
    for (int i = 0; i < n; i++)
        cin >> c[i];

    sort(a, a + n);
    sort(b, b + n);
    sort(c, c + n);

    int sum = 0;
    for (int i = 0; i < n; i++)
    {
        auto itr = upper_bound(c, c + n, b[i]);
        auto itr2 = lower_bound(a, a + n, b[i]);
        sum += (itr2 - a) * (n - (itr - c));
        // cout << "=" << itr2 - a << "," << n - (itr - c) << endl;
    }
    cout << sum << endl;
}


Measured memory_bytes: 2688
/*
A0067
*/
#include <stdio.h>

char island[12][13];

char flags[12][12]; /* 1:painted */
void paint(int x,int y,int cnt)
{
  
  flags[x][y]=cnt;
  if((x > 0) && flags[x-1][y]==0 && island[x-1][y]=='1')
    paint(x-1,y,cnt);
  if((x < 11) && flags[x+1][y]==0 && island[x+1][y]=='1')
    paint(x+1,y,cnt);
  if((y > 0) && flags[x][y-1]==0 && island[x][y-1]=='1')
    paint(x,y-1,cnt);
  if((y < 11) && flags[x][y+1]==0 && island[x][y+1]=='1')
    paint(x,y+1,cnt);

}
main()
{
  int	i,j,cnt;
  do
     {
       for(i=0;i<12;i++)
         if(EOF == scanf(" %s",&(island[i][0])))
            goto END;

       cnt = 0;

       for(i=0;i<12;i++)
         for(j=0;j<12;j++)
           flags[i][j]=0;

       for(i=0;i<12;i++)
         for(j=0;j<12;j++)
           {
             if(flags[i][j] == 0 && island[i][j] == '1')
               {
            /* printf("NEXT X Y=%d,%d\n",i,j); */
                 cnt++;
                 paint(i,j,cnt);
               }
           }
       printf("%d\n",cnt);

     }
     while(1);
END:
  return(0);
}

Measured memory_bytes: 0
a, b, c, d = gets.split(" ").map(&:to_i)
flag = true
 
200.times do
  if flag == true
    c -= b
    if c < 1
      puts "Yes"
      exit
    end
    flag = !flag
  else
    a -= d
    if a < 1
      puts "No"
      exit
    end
    flag = !flag
  end
end

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

typedef long long ll;
typedef pair<int, int> P;

int MOD = 1e9 + 7;
ll INF = 1e18;

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

int main(){
    int n; cin>>n;
    int sum=0;
    vector<int> cnt(100010, 0);
    for(int i=0; i<n; i++){
        int a; cin>>a;
        if(a > 1e5) sum++;
        else cnt[a]++;
    }

    for(int i=1; i<=1e5; i++){
        if(cnt[i] < i) sum += cnt[i];
        else if(cnt[i] > i) sum += (cnt[i] - i);
    }
    cout << sum << endl;
}

Measured memory_bytes: 768
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>

using namespace std;

#define FOR(i, start, end) for(int i = (start); i < (end); ++i)
#define REP(i, n) FOR(i, 0, n)


vector<int> read_rs()
{
    int n;
    scanf("%d", &n);

    vector<int> rs(n);
    REP(i, n) {
        scanf("%d", &rs[i]);
    }

    return rs;
}

int solve(const vector<int>& rs)
{
    int rmin = rs[0];
    int dmax = rs[1] - rs[0];

    FOR(i, 1, rs.size()) {
        int r = rs[i];
        int d = r - rmin;
        if(r < rmin)
            rmin = r;
        if(d > dmax)
            dmax = d;
    }

    return dmax;
}

int main()
{
    vector<int> rs = read_rs();
#if 0
    REP(i, rs.size()) {
        printf("%d\n", rs[i]);
    }
#endif

    int answer = solve(rs);
    printf("%d\n", answer);

    return 0;
}

Measured memory_bytes: 3192
#include <iostream>

using namespace std;

int main() {
	long long int n,i,k,j;
	cin >>n>>k;
	long long int h[10000000];
	long long int ht[1000000];
	for(i=0;i<n+2;i++)
	   { cin>>h[i];
	    ht[i]=1000000000000;}
	ht[0]=0;
	for(i=0;i<n;i++)
	{
	    for(j=1;j<=k;j++)
	    {
	        ht[i+j]=min(ht[i+j],ht[i]+abs(h[i+j]-h[i]));
	    }
	}
// 	for(i=0;i<n;i++)
// 	    cout<<ht[i];
// 	cout<<endl;
	cout<<ht[n-1]<<endl;

}


Measured memory_bytes: 6656
#include<iostream>
#include<vector>
int main(){
  int c;
  int n,m;
  int ans=0;
  int cnt=0;
  std::cin >> n >> m >> c;
  std::vector<int> v(m);//a
  std::vector<int> u(m);//b

  for(int i=0; i<m; i++){
    std::cin >> u.at(i);
  }


  for(int i=0; i<n; i++){
    for(int j=0; j<m; j++){
      std::cin >> v.at(j);
      int temp = 0;
      if(j == 0){
        ans = c;
      }
      temp = v.at(j)*u.at(j);
      ans += temp;
      if(j == m-1){
        if(ans > 0){
          cnt ++;
        }
      }
    }
  }
  std::cout << cnt << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < n; i++)

int main() {
  int N;
  cin >> N;
  vector<ll> A;
  rep(i, N) {
    int a;
    cin >> a;
    A.push_back(a * 2);
  }

  ll sum = 0;
  rep(i, N) {
    if (i % 2 == 0) {
      sum += A[i];
    } else {
      sum -= A[i];
    }
  }
  int X = sum / 2;
  cout << X;

  rep(i, N - 1) {
    cout << " ";
    X = A[i] - X;
    cout << X;
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 2164
using System;

namespace Test
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var a = int.Parse(input[0]);
            var b = int.Parse(input[1]);
            var c = int.Parse(input[2]);

            if ((a < b) && (b < c))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

Measured memory_bytes: 5296
#include<stdio.h>
int main(){
    int i=0,n,cnt=0;
    scanf("%d",&n);
    char c[n];
    scanf("%s",c);
    while (i+2<n)
    { 
        if(c[i]=='A' && c[i+1]=='B' && c[i+2]=='C'){
            cnt++;
        }
        i++;
    }
    printf("%d",cnt);
    return 0;   
}

Measured memory_bytes: 128
#include<stdio.h>
#include<stdlib.h>

long long cnt;
int l,A[1000000],n,G[1000000],j=0;

void insertionsort(int A[],int n,int g){
  int i,v,j;
  for(i=g;i<n;i++){
    v=A[i];
    j=i-g;
    while(j>=0 && A[j]>v){
      A[j+g]=A[j];
      j-=g;
      cnt++;
      }
    A[j+g]=v;
  }
}

void shellsort(int A[],int n){
  int h,i;
  for(h=1;;){
    if(h>n)break;
    G[j++]=h;
    h=3*h+1;
  }
  for(i=j;i>=0;i--)insertionsort(A,n,G[i]);
}

int main(){
  int i;

  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&A[i]);
  cnt=0;

  shellsort(A,n);

  printf("%d\n",j);
  for(i=j-1;i>=0;i--){
    printf("%d",G[i]);
    if(i)printf(" ");
  }
  printf("\n");
  printf("%d\n",cnt);
  for(i=0;i<n;i++)printf("%d\n",A[i]);

  return 0;
}


Measured memory_bytes: 5768
def main():
    n = int(input())
    A = list(map(int, input().split()))
    lis = []
    for i, num in enumerate(A):
        lis.append([i + 1, num])
    #print(lis)

    B = sorted(lis, key=lambda x: x[1])
    #print(B)

    for x, _ in B:
        print(x, end=" ")

if __name__ == "__main__":
    main()


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

int main() {
    char c;
    bool vc=false;
    cin >> c;

    if (c == 'a') {
        vc = true;
    }
    else if (c == 'e') {
        vc = true;
    }
    else if (c == 'i') {
        vc = true;
    }
    else if (c == 'o') {
        vc = true;
    }
    else if (c == 'u') {
        vc = true;
    }
    if (vc) {
        cout << "vowel" << endl;
    }
    else {
        cout << "consonant" << endl;
    }
}

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

int main() {
    string s;
    cin >> s;
    if((s[0]==s[s.size()-1]&&s.size()%2==0)||(s[0]!=s[s.size()-1]&&s.size()%2!=0)) cout << "First" << endl;
    else cout << "Second" << endl;
    return 0;
}

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

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

int main() {
    int a, b;
    while(cin >> a >> b, a+b) {
        cout << min(a,b) << " " << max(a,b) << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <cstring>
using namespace std;
inline int read(int f = 1, int x = 0, char ch = ' ')
{
    while(!isdigit(ch = getchar())) if(ch == '-') f = -1;
    while(isdigit(ch)) x = x*10+ch-'0', ch = getchar();
    return f*x;
}
const int N = 3e5+5, ch[8][2] = {{2, 1}, {4, 3}, {6, 5}, {3, 3}, {7, 1}, {2, 1}, {2, 2}, {4, 4}}, P = 1e9+7;
int n, f[8][N]; char s[N];
int main()
{
    scanf("%s", s+1), n = strlen(s+1);
    f[0][0] = 1;
    for(int i = 1; i <= n; ++i)
        for(int j = 0; j < 8; ++j)
        {
            if(s[i] != '1') f[ch[j][0]][i] = (f[ch[j][0]][i]+f[j][i-1])%P;
            if(s[i] != '0') f[ch[j][1]][i] = (f[ch[j][1]][i]+f[j][i-1])%P;
        }
    printf("%d\n", (f[1][n]+f[3][n])%P);
    return 0;
}

Measured memory_bytes: 8704
def resolve():
    N = int(input())
    C = list(input())
    idx_a, idx_d = 0, N - 1
    cnt = 0
    while idx_a < idx_d:
        if C[idx_a] != "W":
            idx_a += 1
            continue
        if C[idx_d] != "R":
            idx_d -= 1
            continue
        cnt += 1
        idx_a += 1
        idx_d -= 1
    print(cnt)

resolve()


Measured memory_bytes: 10764
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0

for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      sum = 500 * a + 100 * b + 50 * c
      if sum == X:
        ans += 1

print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include<iomanip>
#include <cmath>
#include <climits>
#include <algorithm>
#include <stdio.h>
#include <vector>
#include <queue>
#include <tuple>
#include <map>
#include <list>
#include <string>
#include <numeric>
#include <utility>
using namespace std;

//long long a[100000];
//long long b[100000];


long long A[100000];
long long B[100000];
long long C[100000];
long long c_options[100001];
int main(){
    int N;
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    for(int i = 0; i < N; i++){
        cin >> B[i];
    }
    for(int i = 0; i < N; i++){
        cin >> C[i];
    }

    sort(A, A + N);
    sort(B, B + N);
    sort(C, C + N);

    c_options[N] = 0;
    for(int i = N - 1; i >= 0; i--){
        c_options[i] = C + N - upper_bound(C, C + N, B[i]) + c_options[i + 1];
    }

    long long ans = 0;
    for(int i = 0; i < N; i++){
        ans += c_options[upper_bound(B, B + N, A[i]) - B];
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
        const int LS = 5;
        int N;
        cin >> N;
        vector<int> T(N+1, 0);
        int t1, t2, g1, g2;
        int M = N*(N-1)/2;

        rep(m, M) {
                cin >> t1 >> t2 >> g1 >> g2;
                if (g1 == g2) {
                        T.at(t1) += 1;
                        T.at(t2) += 1;
                } else {
                        if (g1 > g2) {
                                T.at(t1) += 3;
                        } else {
                                T.at(t2) += 3;
                        }
                }
        }
        auto TS = T;
        sort(TS.begin(), TS.end(), greater<int>());

        for (int i = 1; i <= N; i++) {
                rep(n ,N) {
                        if (T.at(i) == TS.at(n)) {
                                cout << n + 1 << endl;
                                break;
                        }
                }
        }
        return 0;
}


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

int main() {
  int n, ashi;
  cin >> n >> ashi;
  for(int i = 0; i <= n; i++)
  {
    int kame = i;
    int turu = n - i;
    if(kame * 4 + turu * 2 == ashi)
    {
      cout << "Yes" << endl;
      return (0);
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 3612
<?php
// 入力
fscanf(STDIN, "%d %d %d", $A, $B, $C);

$list[$A] = ($list[$A] ?? 0) + 1;
$list[$B] = ($list[$B] ?? 0) + 1;
$list[$C] = ($list[$C] ?? 0) + 1;

if(count($list) == 2) {
	echo "Yes\n";
}
else {
	echo "No\n";
}


Measured memory_bytes: 4856
#include <bits/stdc++.h>
using namespace std;
using ll=long long int;
using ld=long double;
using VI=vector<ll>;
using VD=vector<ld>;
using VVI=vector<VI>;
using VC=vector<char>;
using VVC=vector<VC>;
using VS=vector<string>;
using PLL =pair<ll,ll>;
using PLD=pair<ld,ld>;
using VPLL=vector<PLL>;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element((x).begin(),(x).end())
#define MIN(x) *min_element((x).begin(),(x).end())
#define SORTR(x) sort((x).rbegin(),(x).rend())
#define SORT(x) sort((x).begin(),(x).end())
#define SUM(x) accumulate((x).begin(),(x).end(), 0)
#define FILL(x,a) fill(x.begin(),x.end(),a)
#define EACH(i,x) for(typeof((x).begin()) i=(x).begin(); i!=(x).end(); ++i)

const long long  int INF = 1e18;
const ld EPS   = 1e-10;
const int MOD  = int(1e9)+7;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template <class BidirectionalIterator>
bool next_partial_permutation(BidirectionalIterator first, BidirectionalIterator middle,BidirectionalIterator last){reverse(middle, last); return next_permutation(first , last);}
#define COUT(x) cout<<x<<"\n"

void Main()
{
	ll w,h,x,y;
	ll result=0;
	cin>>w>>h>>x>>y;
	printf("%lf %d\n",double(w)*double(h) / 2,x+x==w&&y+y==h);

	return;
}

int main()
{
	std::cin.tie(0);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
#define vall(x) (x).begin(), (x).end()
using namespace std;
using lli = long long int;
void YESNO(bool), YesNo(bool);
template <class T1, class T2> bool chmin(T1 &l, const T2 &r);
template <class T1, class T2> bool chmax(T1 &l, const T2 &r);
template <class T1, class T2> void vadd(vector<T1> &v, T2 x);

#define int long long int

void solve(std::string S, std::string T) {
  YesNo(T.substr(0, T.size() - 1) == S);
}

signed main() {
  std::string S;
  std::cin >> S;
  std::string T;
  std::cin >> T;
  solve(S, T);
  return 0;
}

// -- lib
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }

template <class T1, class T2> bool chmin(T1 &l, const T2 &r) {
  return (l > r) ? (l = r, true) : false;
}

template <class T1, class T2> bool chmax(T1 &l, const T2 &r) {
  return (l < r) ? (l = r, true) : false;
}

template <class T1, class T2> void vadd(vector<T1> &v, T2 x) {
  for (auto &s : v)
    s += T2(x);
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define PI acos(-1.0)
using namespace std;
const int mod=1e9+7;
ll dp[2][100010];
vector<int>v[100010];
ll DP(int papa,int cur, int type)
{
    //0->black, 1->red
    if(dp[type][cur]) return dp[type][cur];
    ll ans=1;
    for(int i=0; i<v[cur].size(); i++)
    {
        if(papa==v[cur][i]) continue;
        ans=(ans*DP(cur, v[cur][i], 1))%mod;
    }
    if(type==0)
    {
        return dp[type][cur]=ans;
    }
    ans=1;
    for(int i=0; i<v[cur].size(); i++)
    {
        if(papa==v[cur][i]) continue;
        ll temp=DP(cur, v[cur][i], 1)+DP(cur, v[cur][i], 0)%mod;
        ans=(ans*temp)%mod;
    }
    return dp[type][cur]=ans;
}
int main()
{
    int n;
    cin>>n;
    for(int i=1; i<n; i++)
    {
        int x, y;
        scanf("%d%d", &x, &y);
        v[x].pb(y);
        v[y].pb(x);
    }

    ll ans=(DP(-1, 1, 0)+DP(-1, 1, 1))%mod;
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 15616
#include <iostream>
#include <string>    
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll n, a, b;

int main() {
	cin >> n >> a >> b;
	cout << min(a, b) <<  " " << max(a+b-n, (ll) 0) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <cstdlib>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
#include <memory.h>

// pi = atan(1)*4;

#define MAX 2100000000
#define PI 3.14159265358979323846
const int Mod = 100000007;

using namespace std;

int main(void)
{
	int c[10][10];
	int h, w;
	int a;
	long long int res = 0;

	cin >> h >> w;
	for (int i = 0; i < 10; i++)
	{
		for (int j = 0; j < 10; j++)
		{
			cin >> c[i][j];
		}
	}

	//Floyd-Warshall
	for (int k = 0; k < 10; k++)
	{
		for (int i = 0; i < 10; i++)
		{
			for (int j = 0; j < 10; j++)
			{
				if (c[i][j] > (c[i][k] + c[k][j]))
				{
					c[i][j] = c[i][k] + c[k][j];
				}
			}
		}
	}

	for (int i = 0; i < h; i++)
	{
		for (int j = 0; j < w; j++)
		{
			cin >> a;
			if (a != -1)
			{
				res += c[a][1];
			}
		}
	}

	cout << res << endl;

	return 0;
}

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

using namespace std;

int main(){
  ll N,ans=0;
  cin>>N;
  vector<ll> v(5,0);
  vector<string> S(N);
  for(ll i=0;i<N;i++){
    string s;
    cin>>s;
    char c=s[0];
    if(c=='M') v[0]++;
    else if(c=='A') v[1]++;
    else if(c=='R') v[2]++;
    else if(c=='C') v[3]++;
    else if(c=='H') v[4]++;
  }
  for(ll i=0;i<5;i++){
    for(ll j=i+1;j<5;j++){
      for(ll k=j+1;k<5;k++) ans+=v[i]*v[j]*v[k];
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1024
import sys
fin = sys.stdin.readline
from copy import deepcopy


def warshall_floyd(w):
    num_vertices = len(w)
    dp = deepcopy(w)
    for k in range(num_vertices):
        for i in range(num_vertices):
            for j in range(num_vertices):
                dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j])
    return dp


H, W = [int(elem) for elem in fin().split()]
c_list = [[int(elem) for elem in fin().split()] for _ in range(10)]
assert len(c_list[0]) == 10

A_list = [[int(elem) for elem in fin().split()] for _ in range(H)]
assert len(A_list[0]) == W

total_cost = 0
min_costs = warshall_floyd(c_list)
for A_row in A_list:
    for A in A_row:
        if A != -1 and A != 1:
            total_cost += min_costs[A][1]

print(total_cost)


Measured memory_bytes: 41052
INT_MAX=10**18+7
x=10**9+7
def INPUT():return list(int(i) for i in input().split())
def LIST_1D_ARRAY(n):return [0 for _ in range(n)]
def LIST_2D_ARRAY(m,n):return [[0 for _ in range(n)]for _ in range(m)]
GETA=123
###############################################################################
n,r=INPUT()
if n>=10:
    print(r)
else:
    print(r+100*(10-n))


Measured memory_bytes: 3060
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
using namespace std;
typedef long long int ll;
const int N = 1000000;
const int INF = 1 << 30;
#define rep(i,n) for(int i=(ll)0;i<(ll)n;++i)
#define ALL(x) x.begin(),x.end()
int main() {
	int a,b,c,e,d,ans=0;
	string s,ss,sss;
	cin>> a>>b;
	cout<< ((a*b)%2==0?"Even":"Odd")  <<endl;
	return 0;
}

Measured memory_bytes: 764
/*! path:atcoder/abc154/d */!function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};e.__esModule=!0;var o=n(r(1)),u=r(2);o.default.readFile("/dev/stdin","utf8",(function(t,e){!function(t){var e=new u.Solver,r=e.parse(t),n=e.solve(r);e.print(n)}(e)}))},function(t,e){t.exports=require("fs")},function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});e.__esModule=!0;var u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.solve=function(t){for(var e=t.dice,r=t.K,n=0,o=0,u=0;u<e.length;u++)if(n+=e[u],u>=r-1){var i=(r+n)/2;o=Math.max(i,o),n-=e[u-(r-1)]}return{answer:o}},e.prototype.parse=function(t){for(var e=t.split(/\s+/).map((function(t){return parseInt(t)})),r=e[0],n=e[1],o=[],u=0;u<r;u++)o.push(e[2+u]);return{K:n,dice:o}},e.prototype.print=function(t){console.log(t.answer)},e}(r(3).SolverBase);e.Solver=u},function(t,e,r){"use strict";e.__esModule=!0;var n=function(){};e.SolverBase=n}]);
//# sourceMappingURL=main.js.map

Measured memory_bytes: 37568
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
#define int long long int

signed main(){
    int n, k;
    cin >> n >> k;
    int a[n];
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    if(k >= n){
        cout << 0 << endl;
        return 0;
    }
    sort(a,a+n);
    int r = 0;
    for(int i=0;i<n-k;i++){
        r += a[i];
    }
    cout << r << endl;
}

Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int main(void){
    // Here your code !
    int a,b,c,d,sum=0;
    cin>>a>>b>>c>>d;
    for(int i=0;i<a;i++){
        if(i<b)sum+=c;
        else sum+=d;
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
<?php
$stdins = array();
while(true){
    $stdin = trim(fgets(STDIN));
    if($stdin === '') break;
    $stdins[] = $stdin;
}

$A = $stdins[0];
$B = $stdins[1];
$C = $stdins[2];
$D = $stdins[3];

$total = min($A, $B) + min($C, $D);
print($total);


Measured memory_bytes: 3956
/***********************
*  Author: xuziyuan    * 
***********************/

#include <bits/stdc++.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define replet(c) for(char c='a';c<='z';c++)
#define LL long long
#define pii pair <int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))

using namespace std;

const LL MOD=1e9+7;

LL n,a[100010],b[100010],c[100010],dp[100010][5];

int main()
{
	cin>>n;
	repn(i,n) scanf("%I64d%I64d%I64d",&a[i],&b[i],&c[i]);
	dp[1][0]=a[1];
	dp[1][1]=b[1];
	dp[1][2]=c[1];
	for(int i=2;i<=n;i++)
	{
		dp[i][0]=max(dp[i-1][1]+a[i],dp[i-1][2]+a[i]);
		dp[i][1]=max(dp[i-1][0]+b[i],dp[i-1][2]+b[i]);
		dp[i][2]=max(dp[i-1][0]+c[i],dp[i-1][1]+c[i]);
	}
	cout<<max(dp[n][0],max(dp[n][1],dp[n][2]))<<endl;
	rt0;
}

Measured memory_bytes: 6528
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int N; cin >> N;
    vector<int> a(N);
    for (int i=0; i<N; i++) cin >> a[i];
    sort(a.begin(), a.end());
    
    cout << (a[N-1] - a[0]) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
using namespace std; using P=pair<int,int>; using ll=long long;
struct tp {int x,y,i; bool operator<(const tp tt) const {if (x==tt.x) return y<tt.y; else return x<tt.x;}};
int gcd(int a,int b){
  if (a<0) a*=-1; if (b<0) b*=-1;
  while(b>0) {
    int temp=a%b; a=b; b=temp;
  } return a;
}
int main() {
  int n,k; cin>>n>>k;
  int x[n],y[n];
  for(int i=0;i<n;i++) {
    cin>>x[i]>>y[i];
  }
  bool ok=true;
  
  for(int i=0;i<n;i++) {
    map<P,int> mp;
    for(int j=0;j<n;j++) {
      if (i==j) continue;
      int dx=x[j]-x[i], dy=y[j]-y[i];
      if (dx==0) dy=1;
      if (dy==0) dx=1;
      else {
        int gc = gcd(dx,dy);
        dx /= gc, dy /= gc;
      }
      mp[{dx,dy}]++; if (mp[{dx,dy}] >= k-1) ok=false;
    }
    /*
    for(pair<P,int> x:mp) {
      cout<<x.first.first<<" "<<x.first.second<<" "<<x.second<<endl;
    } cout<<endl;*/
  }
  cout<<!ok<<endl;
}


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

int main() {
  char c;
  cin>>c;
  if(c=='a'){
    cout<<"vowel"<<endl;
  }
  else if(c=='e'){
    cout<<"vowel"<<endl;
  }
  else if(c=='i'){
    cout<<"vowel"<<endl;
  }
  else if(c=='o'){
    cout<<"vowel"<<endl;
  }
  else if(c=='u'){
    cout<<"vowel"<<endl;
  }
  else{
    cout<<"consonant"<<endl;
  }
  
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int i,j,k;
    int p,q,r;
    int array[6];
   
    scanf("%d %d %d",&p,&q,&r);
    
    array[0] = p + q;
    array[1] = p + r;
    array[2] = q + r;
    
    if(array[0] <= array[1] && array[0] <= array[2]){
        printf("%d\n",array[0]);
    }else if(array[1] <= array[0] && array[1] <= array[2]){
        printf("%d\n",array[1]);
    }else{
        printf("%d\n",array[2]);
    }
    
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>
#include <vector>
#include <string>
#define rep(i,n) for(int i = 0; i < (n);i++)
#define SORT(a) sort((a).begin(),(a).end());
using namespace std;
#define INF 2000000000
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; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;

int main(){
	int a , b , k ;
	cin >> a >> b >> k;
	for(int i = a; i<= b; i++){
		if(i <= a+k-1 ||i >= b-k+1){
			cout << i << endl; 
		}
	}
}


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

int main() {
  int K, N;
  cin >> K >> N;
  vector<int> vi;
  for (int i = 0; i < N; i++) {
    int tmp;
    cin >> tmp;
    vi.push_back(tmp);
  }
  sort(vi.begin(), vi.end());
  
  int max = vi[0] + K - vi[N-1];
  for(int i = 0; i < N-1; i++) {
    int tmp = vi[i+1] - vi[i];
    if (max < tmp) max = tmp;
  }
  
  cout << (K - max) << "\n";
  return 0;
}


Measured memory_bytes: 1400
#include<iostream>
#include<stack>
#define MAX 1400
using namespace std;
int H, W, hSum[MAX+1][MAX+2];

int main(){
  cin >> H >> W;

  for ( int j = 1; j <= W; j++){hSum[0][j] = 0;}
  for ( int j = 1; j <= H;j++){hSum[j][0] = hSum[j][W+1] = 0;}

  int a;
  for ( int i = 1; i <= H; i++){
    for ( int j = 1; j <= W; j++){
      cin >> a;
      if ( a == 1){ hSum[i][j] = 0;}
      else { hSum[i][j] = hSum[i-1][j] + 1;}
    }
  }

  int maxV = 0;
  stack<pair<int, int> > S;
  for ( int i = 1; i <= H; i++){
    for ( int j = 1; j <= W+1; j++){
      if ( j == 1 || hSum[i][j-1] <= hSum[i][j]) S.push(make_pair(j, hSum[i][j]));
      else {
        int pos = j;
        while ( !S.empty() && S.top().second >= hSum[i][j]){
          pair<int, int> top = S.top(); S.pop();
          int area = top.second * ( j - top.first);
          maxV = max(maxV, area);
          pos = top.first;
        }
        S.push(make_pair(pos, hSum[i][j]));
      }
    }
  }

  cout << maxV << endl;

  return 0;
}


Measured memory_bytes: 20352
#include<bits/stdc++.h>
using namespace std;
int n,a[200001],ans=1;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)
		if(a[i]==ans)
			ans++;
	if(ans==1) 
		printf("-1");
	else
		printf("%d",n-ans+1);
	return 0;
}

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

#define debug(args...) \
cout << "#" << __LINE__ << ": "; \
__dbg(split(#args, ',').begin(), args);
vector<string> split(const string& s, char c) {
	vector<string> v;
	stringstream ss(s);
	string x;
	while (getline(ss, x, c))
		v.emplace_back(x);
	return move(v);
}
template<typename T, typename... Args>
inline string to_str(T x) {
	stringstream ss; ss << "[";
	for (auto it = x.begin(); it != x.end(); it++) {
		if (it != x.begin()) ss << " ";
		ss << (*it);
	}
	ss << "]";
	return ss.str();
}
template<typename T, typename... Args>
inline string to_str(stack<T> x) {
	stringstream ss; ss << "[";
	bool first = 1;
	while (!x.empty()) {
		if (!first)
			ss << " ";
		ss << x.top();
		x.pop();
		first = 0;
	}
	ss << "]";
	return ss.str();
}
template<typename T> inline void __dbg_var(vector<T> x) { cout << to_str(x); }
template<typename T> inline void __dbg_var(list<T> x) { cout << to_str(x); }
template<typename T> inline void __dbg_var(set<T> x) { cout << to_str(x); }
template<typename T> inline void __dbg_var(unordered_set<T> x) { cout << to_str(x); }
template<typename T> inline void __dbg_var(stack<T> x) { cout << to_str(x); }
template<typename T> inline void __dbg_var(T val) { cout << val; }
inline void __dbg(vector<string>::iterator it) { cout << endl; }
template<typename T, typename... Args>
inline void __dbg(vector<string>::iterator it, T a, Args... args) {
	cout << it->substr((*it)[0] == ' ', it->length()) << "=";
	__dbg_var(a);
	cout << " ";
	__dbg(++it, args...);
}

const int N = 1e5;
const int M = 1e9;
vector<int> adj[N];
vector<int> elevation;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int n, m, e, a, b, ans = 0;;
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> e;
		elevation.push_back(e);
	}
	for (int i = 0; i < m; i++) {
		cin >> a >> b;
		a--; b--;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	for (int i = 0; i < n; i++) {
		int ob = i;
		for (auto x : adj[i])
			if (elevation[x] >= elevation[ob])
				ob = x;
		if (ob == i) {
			//debug(ob);
			ans++;
		}
	}
	cout << ans << "\n";
	return 0;
}



Measured memory_bytes: 8732
#include <stdio.h>

int main(void)
{
	int City,Rord,i,j;
	int Count;
	int a[101] ={ 0 };
	
	
	scanf("%d %d", &City, &Rord);
	
	for(i=1;i<=Rord*2;i++){
		scanf("%d\b",&a[i]);
		i++;
		scanf("%d",&a[i]);
	}
	
	
	for(i=1;i<=City;i++){
		Count = 0;
		for(j=1;j<=Rord*2;j++){
			if(i == a[j]){
				Count += 1;
			}
		}
		printf("%d\n",Count);
	}
	
	return 0;
}

Measured memory_bytes: 128
#文字列の入力
S = input()
 
#listを一文字ずつのlistに
S_list = list(S)
 
AorB = S_list[0]
counter = 0
for i in range(len(S_list)):
  if(AorB == S_list[i]):
    counter = counter + 1
 
if(counter == len(S_list)):
  print("No")
else:
  print("Yes")

Measured memory_bytes: 2940
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC128A
{
    class Program
    {
        static void Main(string[] args)
        {
            var nums = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToList();

            var p = nums[1] + nums[0] * 3;

            var pie = p / 2;

            Console.WriteLine(pie);
        }
    }
}


Measured memory_bytes: 11220
// </> : towhid1zaman

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;typedef vector<ll> vll;
#define fill(a) memset(a, 0, sizeof (a))
#define all(v) (v).begin(),(v).end()
#define sp(k) cout<<setprecision(k)<<fixed;
#define rep(i,a) for(int i=0; i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define each(it,s) for(auto it = s.begin(); it != s.end(); ++it)
#define unq(v) sort(all(v)),(v).erase(unique((v).begin(),(v).end()),(v).end())
#define _ios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define sqr(a) ((a)*(a))
#define sz(a) int(a.size())
#define ff first
#define ss second
#define pb push_back

const double pi = acos(-1.0);
const int mod = 1000000007; // (int)1e9+7
const int maxn = 2000100;

int main(){
        _ios;

        int k; cin >> k;
        ll ans = 0;
        int gcd = 0;
        for(int i = 1; i<=k; i++){
            for(int j = 1; j<=k; j++){
                for(int l = 1; l<=k; l++){
                    gcd = __gcd(l,__gcd(i,j));
                    ans+=gcd;
                }
            }
        }
        cout<<ans<<endl;



return 0;
}



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

#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define pb push_back

const long double PI = acos(-1);
 
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll GetDigit(ll num) {return log10(num)+1;}

int main(){
    ll h, a;
    cin >> h >> a;
    cout << ceil((double) h / a) << endl;
    return 0;
}

Measured memory_bytes: 256
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_5_A&lang=jp
#include<bits/stdc++.h>
using namespace std;
int H,W,i,j;
int main(void){
  while(cin>>H>>W){
    if(H==0&&W==0)break;
    for(i=0;i<H;i++){
      for(j=0;j<W;j++){
        cout<<"#";
      }
      cout<<endl;
    }
    cout<<endl;
  }
  return 0;
}



Measured memory_bytes: 3096
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e5 + 10;
int a[N];
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	vector<int> ans;
	for (int i = 1; i <= n; i++) cin >> a[i];
	for (int i = n; i >= 1; i--)
	{
		for (int j = i + i; j <= n; j += i)
		{
			a[i] ^= a[j];
		}
		if (a[i])
			ans.push_back(i);
	}
	printf("%d\n", ans.size());
	for (int i = 0; i < ans.size(); i++)
		printf("%d%c", ans[i], " \n"[i + 1 == ans.size()]);
	return 0;
}

Measured memory_bytes: 2424
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()

class SparseTable(object):
    def __init__(self,A):
        n=len(A)
        logn=max(0,(n-1).bit_length())
        maxtable=[[0]*n for _ in range(logn)]
        maxtable[0]=A[:]
        mintable=[[0]*n for _ in range(logn)]
        mintable[0]=A[:]
        from itertools import product
        for i,k in product(range(1,logn),range(n)):
            if(k+(1<<(i-1))>=n):
                maxtable[i][k]=maxtable[i-1][k]
                mintable[i][k]=mintable[i-1][k]
            else:
                maxtable[i][k]=max(maxtable[i-1][k],maxtable[i-1][k+(1<<(i-1))])
                mintable[i][k]=min(mintable[i-1][k],mintable[i-1][k+(1<<(i-1))])
        self.__n=n
        self.__maxtable=maxtable
        self.__mintable=mintable

    def max(self,l,r):
        n=self.__n
        assert 0<=l<r<=n
        i=max(0,(r-l-1).bit_length()-1)
        maxtable=self.__maxtable
        return max(maxtable[i][l],maxtable[i][r-(1<<i)])

    def min(self,l,r):
        n=self.__n
        assert 0<=l<r<=n
        i=max(0,(r-l-1).bit_length()-1)
        mintable=self.__mintable
        return min(mintable[i][l],mintable[i][r-(1<<i)])

def resolve():
    n,k=map(int,input().split())
    P=list(map(int,input().split()))
    table=SparseTable(P)
    ans=n-k+1
    for i in range(n-k):
        m=table.min(i,i+k)
        M=table.max(i+1,i+1+k)
        if(m==P[i] and M==P[i+k]):
            ans-=1

    cnt=0
    num=0
    P.append(-1) # 番兵
    for i in range(n):
        if(P[i+1]>P[i]):
            cnt+=1
        else:
            num+=(cnt>=k-1)
            cnt=0
    ans-=max(num-1,0)
    print(ans)
resolve()

Measured memory_bytes: 122500