akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define FOR(i, m, n) for (ll i = m; i < (n); i++)
#define RFOR(i, m, n) for (ll i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
//#define print(ele) cout << (ele) << "\n"
#define print10(ele) cout << fixed << setprecision(10) << (ele) << "\n"

using namespace std;
typedef long long ll;
typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

void print() { cout << endl; }

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
}

int main() {
  int k, s;
  cin >> k >> s;
  int ans = 0;
  REP(x, k + 1) {
    REP(y, k + 1) {
      int z = s - x - y;
      if (z <= k && z >= 0) {
        ans++;
      }
    }
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll maxSum = 50*50+1;

int main() {
    ll N,A;
    cin >> N >>A;
    vector<ll> x(N);
    for(int i=0;i<N;i++){
        cin >> x[i];
    }
  
    static ll dp[51][51][maxSum+5]={};
    dp[0][0][0] = 1;
    for(int i=0;i<N;i++)for(int j=0;j<N;j++)for(int k=0;k<maxSum;k++){
        dp[i+1][j][k] += dp[i][j][k];
        if(x[i]<=k){
            dp[i+1][j+1][k] +=dp[i][j][k-x[i]];
        }
    }
    ll ans =0;
    for(int i=1;i<=N;i++){
        
        ans += dp[N][i][A*i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 53532
#include <bits/stdc++.h>
using namespace std;
#define rep2(i, m, n) for(int i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(int i=int(m-1); i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << " "; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int Log2(ll x) { int k; for (k = 0; x > 0; ++k) x >>= 1; return k; } // number of binary digits
const int INF  = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS   = 1e-10;
const int MOD  = int(1e9)+7;

V dx = {1, 0, -1, 0};
V dy = {0, 1, 0, -1};


int main() {
  int h, w; cin >> h >> w;
  int k; cin >> k;
  vector<string> field(h);
  rep(i, h) cin >> field[i];

  int si, sj;
  rep(i, h) rep(j, w) if (field[i][j] == 'S') si = i, sj = j;

  VV dist(h, V(w, INF));
  dist[si][sj] = 0;

  queue<P> que;
  que.emplace(si, sj);

  while (!que.empty()) {
    int i, j;
    tie(i, j) = que.front(); que.pop();
    rep(dir, dx.size()) {
      int ii = i + dx[dir];
      int jj = j + dy[dir];
      if (ii < 0 || ii >= h || jj < 0 || jj >= w) continue;
      if (field[ii][jj] == '#') continue;
      if (chmin(dist[ii][jj], dist[i][j] + 1)) {
        if (dist[ii][jj] < k) que.emplace(ii, jj);
      }
    }
  }

  ll ans = INFll;
  rep(i, h) rep(j, w) if (dist[i][j] <= k) {
    ll x = (min({i, j, h-i-1, w-j-1}) + k - 1) / k;
    chmin(ans, x);
  }
  ++ans;

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


Measured memory_bytes: 3456
#include<stdio.h>
#include<string.h>
int main()
{
    int a ;
    char name[10];
    scanf("%d",&a);
    scanf("%s",&name);
    if (a >= 3200)
    {
        printf("%s\n",name);
    }
    else
    
    
        printf("red\n");
    
    return 0;
}

Measured memory_bytes: 1660
#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<iostream>
#include<algorithm>//next_permutation
#include<complex>
#include<math.h>
using namespace std;
#define rep(i, n) for (int i = 1; i <= (int)(n); i++)

int main() {
    int N;
    cin >> N;
    long long int count = 0;
    rep(i, N) {
        if (i % 3 == 0 || i % 5 == 0 || i % 15 == 0) {
            continue;
        }
        count += i;
    }
    cout << count << endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    ll h,w,k;
    cin>>h>>w>>k;
    string s[h];
    ll tmp0=0;
    rep(0,i,h){
        cin>>s[i];
        rep(0,j,w)if(s[i][j]=='#')++tmp0;
    }
    ll ans=0;
    rep(0,bit1,1<<h){
        rep(0,bit2,1<<w){
            ll tmp=tmp0;
            rep(0,i,h){
                if(bit1&(1<<i)){
                    rep(0,j,w){
                        if(s[i][j]=='#')--tmp;
                    }
                }
            }
            rep(0,j,w){
                if(bit2&(1<<j)){
                    rep(0,i,h){
                        if(s[i][j]=='#'&&!(bit1&(1<<i)))--tmp;
                    }
                }
            }
            if(tmp==k)++ans;
        }
    }
    cout<<ans;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int (i)=(a);(i)<(int)(b);(i)++)
#define RREP(i,a,b) for(int (i)=(a);(i)>=(int)(b);(i)--)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;

vector<vector<ll>> dp_combination(int MAX_N, ll M){
    vector<vector<ll>> dp;
    dp = vector<vector<ll>>(MAX_N + 1, vector<ll>(MAX_N + 1, 0));
    dp[0][0] = 1;
    REP(i,1,MAX_N){
        dp[i][0] = 1;
        REP(j,1,MAX_N){
            dp[i][j] = (dp[i - 1][j - 1] + dp[i - 1][j]) % M;
        }
    }
    return dp;
}

int main(){
    int n, a, b;
    cin >> n >> a >> b;
    vector<ll> v(n);
    REP(i,0,n){
        cin >> v[i];
    }

    sort(v.begin(), v.end(), greater<ll>());

    ll sum = 0;
    REP(i,0,a){
        sum += v[i];
    }
    double mean = 1.0 * sum / a;

    vector<vector<ll>> dp = dp_combination(100, numeric_limits<ll>::max());
    ll ans = 0;
    if (sum == v[a - 1] * a){
        int cnt = 0;
        REP(i,0,n){
            if (v[i] == v[0]) cnt++;
        }
        REP(i,a,b + 1){
            ans += dp[cnt][i];
        }
    }else{
        int cnt1 = 0, cnt2 = 0;
        REP(i,0,n){
            if (v[i] == v[a - 1]) cnt2++;
            else if (v[i] > v[a - 1]) cnt1++;
            ans = dp[cnt2][a - cnt1];
        }
    }

    cout << fixed << setprecision(10) << mean << endl;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int N;
long long f[3005][3005],a[3005];
int main()
{
	scanf("%d",&N);
	for(int i=1;i<=N;++i)
	   scanf("%lld",&a[i]);
	for(int i=1;i<=N;++i)
	{
		int s=N-i+1; 
		for(int j=1;j<=s;++j)
		{
			if(s%2==1) f[j][j+i-1]=max(f[j+1][j+i-1]+a[j],f[j][j+i-2]+a[j+i-1]);
			else f[j][j+i-1]=min(f[j+1][j+i-1]-a[j],f[j][j+i-2]-a[j+i-1]);
		}
	}
	printf("%lld\n",f[1][N]);
	return 0;
}

Measured memory_bytes: 49852
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;

int main() {
	int N,a;
	cin >> N;
	a = N / 10;
	if (a == 9) {
		cout << "Yes";
	}
	else if ((N - a * 10) == 9) {
		cout << "Yes";
	}
	else cout << "No";
	return 0;
}


Measured memory_bytes: 256
def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

if __name__=='__main__':
    num = int(input())
    num2=num2alpha(num)
    print(num2.lower())

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

bool is_identical(string s1, string s2)
{
    return s1 == s2;
}

string s1, s2;
int main()
{
    while (true)
    {
        int cnt = 0;
        cin >> s1;
        if (s1[0] == '.')
            break;
        cin >> s2;
        int end1=0,end2 = 0;
        int start = 0;
        bool iden = false, close = false, diff = false;
        if (s1 == s2)
            iden = true;
        bool d = false;
        for (int i = 0; i < s1.size(); i++)
        {
            if (s1[i] == '"' && s2[i] == '"'){cnt = 1;d = !d;start = i;}
            else if (s1[i] != s2[i])
            {
                if (!d){diff = true;break;}
                else  {if(cnt == 1) {close = true;break;}}
            }
        }
        if(close == true){
        for(int i = start+1;i<max(s1.size(),s2.size());i++){
            if(end1!=0 && end2!=0) break;
            if(s1[i]=='"' && end1 == 0) end1 = i;
            if(s2[i]=='"' && end2 == 0) end2 = i;
        }
        }
        s1 = s1.substr(end1+1);
        s2 = s2.substr(end2+1);
        if(s1==s2) iden =true;
        else diff = true;
        
        if(iden && !close) cout << "IDENTICAL" << endl;
        else if(iden && close) cout << "CLOSE" << endl;
        else cout << "DIFFERENT" << endl;

    }

    return 0;
}


Measured memory_bytes: 3136
#include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <queue>
#define ll long long
using namespace std;

int main(){
    ll N;
    cin>>N;
    cout<<(10000-N)%1000<<endl;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, D;
  cin >> n >> D;
  vector<long long> d(n);
  for(long long i = 0; i < n; i++)
  {
    cin >> d[i];
  }
  vector<long long> pos(n + 1);
  pos[0] = D;
  for(long long i = 0; i < n; i++)
  {
    pos[i + 1] = min(pos[i], abs(pos[i] - d[i]));
  }
  vector<long long> cover(n);
  cover[n - 1] = 0;
  for(long long i = n - 1; i > 0; i--)
  {
    if(d[i] <= 2 * cover[i] + 1)
    {
      cover[i - 1] = cover[i] + d[i];
    }
    else cover[i - 1] = cover[i];
  }
  vector<long long> ans(n, 0);
  for(long long i = 0; i < n; i++)
  {
    if(pos[i] > cover[i]) ans[i] = 1;
  }
  long long q;
  cin >> q;
  while(q--)
  {
    long long qi;
    cin >> qi;
    qi--;
    if(ans[qi])
    cout << "YES";
    else cout << "NO";
    cout << "\n";
  }
  return 0;
}


Measured memory_bytes: 17536
using System;
using System.Numerics;
using System.Linq;
using System.Collections.Generic;
using System.Text;
class ProgramD
    {
        static void Main(string[] args)
        {
            
            //入力
            string s = Console.ReadLine();
            StringBuilder f = new StringBuilder();
            StringBuilder l = new StringBuilder();
            int n = int.Parse(Console.ReadLine());
            int flag = 0;

            for(int i = 0;i < n;i++)
            {
                string[] temp = Console.ReadLine().Split(' ');

                if(int.Parse(temp[0]) == 1)
                {
                    if(flag == 1)
                        flag = 0;
                    else
                        flag = 1;
                }
                else
                {
                    if(flag == 1)
                    {
                        if(int.Parse(temp[1]) == 2)
                            f.Append(temp[2]);
                        else
                            l.Append(temp[2]);

                    }
                    else
                    {
                        if(int.Parse(temp[1]) == 1)
                            f.Append(temp[2]);
                        else
                            l.Append(temp[2]);
                    }
                }

            }


            string s2 =  new string(f.ToString().Reverse().ToArray())+ s + l.ToString();
            if(flag == 1)
            {
                var t = s2.Reverse();
                s2 = string.Join("",t);
            }
            
            
            Console.WriteLine(s2);
            
        }
    }

Measured memory_bytes: 21804
#include<bits/stdc++.h>
#define pi acos(-1)
#define ll long long
#define pii pair<ll,ll>
#define debug(a) cout<<a<<'\n'
#define maxn 200009 /// I wanna be the wind
#define MOD 1000000007
#define F first
#define S second
#define rep(i, a, b) for(ll i = a; i < (b); ++i)
#define per(i, b, a) for(ll i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (ll)(x).size()
using namespace std;
const ll INF = 1e17 + 9;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin>>n;
    if(n>=30)cout<<"Yes\n";
    else cout<<"No\n";
    return 0;  
}   

Measured memory_bytes: 3604
#include<stdio.h>

int main(){
    int r, g, b;
    scanf("%d %d %d", &r, &g, &b);
    if ((r * 100 + g * 10 + b) % 4 == 0)
        printf("YES\n");
    else
        printf("NO\n");
    return 0;
}

Measured memory_bytes: 128
// #Sazaの1日1AC
#include<bits/stdc++.h>
using namespace std;
const long long mod=1000000007;
const long long INF=9e15;
const double PI=3.14159265358979323846;

//マクロ
//型エイリアス
using ll = long long;
using P=pair<long long,long long>;
using vl=vector<long long>;
using vvl=vector<vector<long long>>;
using vP=vector<pair<long long, long long>>;
//ショートカット
#define rep(i,n) for(long long i = 0; i < n; i++)
#define rep2(i,k,n) for(long long i = k; i < n; i++) //半開区間
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define mkp make_pair
//入力
#define vin(v,N) for(long long id=0;id<N;id++) cin>>v.at(id)
#define lin(n) long long n;cin>>n
#define chin(x) char x;cin>>x;
#define sin(s) string s;cin>>s;
#define vlin(v,N) vector<long long>v(N);for(long long i=0;i<N;i++)cin>>v.at(i)

#define max(a,b) max((ll)a,(ll)b)
#define min(a,b) min((ll)a,(ll)b)

//関数
//最大公約数
long long gcd(long long m, long long n){
  long long a=max(m,n);
  long long b=min(m,n);
  long long r=a%b;
  while(r!=0){
    a=b; b=r; r=a%b;
  }
  return b;
}
// 最小公倍数
long long lcd(long long m, long long n){
  return m*n/gcd(m,n);
}
//xのn乗
long long power(long long x, long long N){
  long long ret=1;
  for(long long i=0;i<N;i++)   
    ret*=x;
  return ret;
}
//繰り返し二乗法
long long repeat_squaring(long long x, long long n){
  if(n==0) return 1;
  else if(n%2==0){
    long long t=repeat_squaring(x,n/2);
    return t*t%mod;
  }
  else
    return x*repeat_squaring(x,n-1);
}
//素因数分解(mapで返す)
map<long long,long long> factor(long long p){
  ll p1=p;
  map<long long,long long>ret;
  for(long long i=2;i*i<=p1;i++){
     while(p%i==0){
      ret[i]++;
      p/=i;
    }
  }
  if(p!=1)
  ret[p]++;
  return ret;
}
//素数判定
bool is_prime(long long N){
  for(long long i=2;i*i<=N;i++){
    if(N%i==0)
      return false;
  }
  return true;
}
//最大値更新
void chmax(long long &a,long long b){
  a=max(a,b);
}
//最小値更新
void chmin(long long &a,long long b){
  a=min(a,b);
}

//構造体

/////////////////⊂('ω'⊂ )))Σ≡GO!/////////////////

//メイン関数
int main(){
  //doubleの桁数
  cout<<fixed<<setprecision(2);
  
  lin(a);
  double b; cin >> b;
  b += 0.003;
  ll c = (ll)floor(b * 100);
  ll res = a * c;

  string s = to_string(res);

  int N = s.size();

  if(N < 3){
    cout << 0 << endl;
    return 0;
  }
  for(int i = 0; i < N - 2; i++) cout << s[i];
  
  cout << endl;
  //cout << s << endl;
  //cout << s.size();

  //cout << (ll)664706138336385 * 979 << endl;
  //cout << c << endl;
}




Measured memory_bytes: 3880
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String inp = sc.nextLine();
      	char[] input = inp.toCharArray();
      	boolean flag = true;	
      for(int i = 0; i < inp.length(); i++){
        	if(i%2 == 0){
              if(input[i] != 'R' && input[i] != 'U' && input[i] != 'D'){
                flag = !flag;
                break;
              }
            }else{
              if(input[i] != 'L' && input[i] != 'U' && input[i] != 'D'){
                flag = !flag;
                break;
              }
            }      
        }
      	if(flag)
          System.out.println("Yes");
      	else
          System.out.println("No");
		
	}
}

Measured memory_bytes: 23380
def main():
    N = int(input())
    A = input()
    B = input()
    C = input()
    cnt = 0

    for i in range(N):
        if A[i] == B[i] == C[i]:
            continue
        else:
            if A[i] == B[i] or A[i] == C[i] or B[i] == C[i]:
                cnt += 1
            else:
                cnt += 2

    print(cnt)


main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

ll dp[55][55][2600];

int main(void){
  ll n, a;
  cin >> n >> a;
  vector<ll> x(n);
  REP(i, n) cin >> x[i];

  dp[0][0][0] = 1;
  REP(i, n) REP(j, n) REP(k, 2500){
    dp[i+1][j][k] += dp[i][j][k];
    dp[i+1][j+1][k+x[i]] += dp[i][j][k];
  }
  ll ans = 0;
  FORe(i, 1, n) ans += dp[n][i][i*a];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 56448
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
  	String num = input.nextLine();
    if (num.charAt(0) == '7' || num.charAt(1) == '7' || num.charAt(2) == '7') {
      System.out.println("Yes");
    }
    else {
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 35540
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
// const int dy[] = {1, 1, 0, -1, -1, -1, 0, 1},
//           dx[] = {0, -1, -1, -1, 0, 1, 1, 1};

struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    cerr << fixed << setprecision(10);
  }
} iosetup;
/*-------------------------------------------------*/
int main() {
  string s; cin >> s;
  int ans = 0;
  REP(i, s.length() / 2) ans += s[i] != s[s.length() - 1 - i];
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
import sys
n = int(input())
nums = [125,216,343,1000]
for i in range(n,0,-1):
    if i in nums:
        print(i)
        sys.exit()
    if ((i**(1/2))%1 == 0) or ((i **(1/3))%1 == 0) or  ((i **(1/5))%1 == 0) or ((i **(1/7))%1 == 0) or ((i **(1/9))%1 == 0):
        print(i)
        sys.exit()
print(1)

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            char[] odd = (Console.ReadLine()).ToCharArray();
            char[] even = (Console.ReadLine()).ToCharArray();
            string ans = null;

            for(int i = 0; i < odd.Length; i++)
            {
                ans += odd[i];

                if (i < even.Length)
                {
                    ans += even[i];
                }
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
typedef long long ll;
using namespace __gnu_pbds;
using namespace std;
typedef pair<ll, ll> pll;


ll n;
ll a[100005];
ll minm = 1e16;
ll maxm = 0;
ll b[100005];
ll s[100005];
typedef tree<
pll,
null_type,
less<pll>,
rb_tree_tag,
tree_order_statistics_node_update>
box;
const ll inf= 1e16;
ll M;
bool check(ll x)
{
        for(ll i=1;i<=n;i++) {
                if(a[i] <= x) {
                        b[i] = 1;
                }else b[i] = -1;
        }
        for(ll i=1;i<=n;i++) {
                s[i] = s[i-1] + b[i];
        }
        ll ans = 0;
        box tree;
        tree.insert(make_pair(0 , 0));
        for(ll i=1;i<=n;i++) {

                ll id = tree.order_of_key(make_pair(s[i] , -1));
                /*if(x == 20) {
                        cout << id << " " << endl;
                }*/
                ans += id;
                //if(id != tree.size() && tree.find_by_order(id) == )
                tree.insert(make_pair(s[i] , i));
        }
        /*if(x==20) {
                cout << ans << " " << (M/2) + 1 << endl;
        }*/
        return (ans >= (M/2)+1);
}
int main()
{
        ios_base::sync_with_stdio(false);
        cin.tie(NULL); cout.tie(NULL);
        cin >> n;
        M = (n*(n+1))/2;
        for(ll i=1;i<=n;i++) {
                cin >> a[i];
                maxm = max(maxm , a[i]);
                minm = min(minm, a[i]);
        }
        ll lo = minm - 1;
        ll hi = maxm;
        while(hi > lo) {

                ll mid = lo + (hi - lo ) /2;
                if(check(mid)) {
                        hi = mid;
                }else lo = mid +1;
        }
        cout << lo << endl;
        return 0;
}


Measured memory_bytes: 8832
// SeeAlso: 

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define MAX 100000
#define NIL -1
#define MOD 1000000007

typedef int _loop_int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define debug(x) cout<<#x<<": "<<x<<endl
#define debig_vec(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

// 最大公約数
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
// 最小公倍数
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

#define print2D(h, w, arr) rep(i, h) { rep(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }


int x;
ll ans = 0;



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

    rep(i, a+1) {
        rep(j, b+1) {
            rep(d, c+1) {
                ll res = i * 500 + 100 * j + 50 * d;
                if (res == x) {
                    ans++;
                }
            }
        }
    }
    print(ans);
    return 0;
}


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

int main(){
	int n, w;
	cin >> n >> w;
	vector<int> ar(w, -2000000000);
	vector<int> ar0(w, -2000000000);
	for(int i=0; i<n; i++){
		int a, b;
		cin >> a >> b;
		rep(j, w-b) ar.at(j+b) = max(ar0.at(j+b), ar0.at(j) + a);
		ar.at(b-1) = max(ar0.at(b-1), a);
		rep(i, w){
			ar0.at(i) = ar.at(i);
		}
	}
	ll ans = -2000000000;
	rep(i, w){
		if(ans < ar.at(i)) ans = ar.at(i);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3168
#include<bits/stdc++.h>
using namespace std;
#define ll         long long
#define mod        1000000007
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define inf        1e18
#define ps(x,y)    fixed<<setprecision(y)<<x

int main() {
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif

	ll n, k;
	cin >> n >> k;
	ll a[n + 1];
	a[0] = 0;
	for (ll i = 1; i <= n; ++i)
	{
		cin >> a[i];
	}
	std::vector<ll> v(n + 1, 0);

	ll start = 1;
	int l ;
	while (1)
	{
		if (v[start] == 1)
		{
			l = start;
			break;
		}

		v[start] = 1;
		start = a[start];
		k--;
		if (k == 0)
		{
			cout << start << endl;
			return 0;
		}
	}

	ll cnt = 0;
	int end = start;
	vector<int > v1;
	while (1)
	{

		v1.push_back(start);
		start = a[start];
		cnt++;
		if (start == end)
			break;
	}
	// for (auto i : v1)
	// {
	// 	cout << i << " ";
	// }
	cout << v1[k % cnt] << endl;
}

Measured memory_bytes: 6876
#include <bits/stdc++.h>
using Int = int64_t;
using UInt = uint64_t;
using C = std::complex<double>;
#define rep(i, n) for(Int i = 0; i < (Int)(n); ++i)
#define guard(x) if( not (x) ) continue;
#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif

int main() {
   Int x, y;
   std::cin >> x >> y;
   printf("%ld\n", x%y==0?-1:x);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define mod 1000000007
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

int main() {
  int n;
  cin >> n;
  map<string, int> mp;
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    mp[s] = 1;
  }

  cout << mp.size() << endl;
}

Measured memory_bytes: 19100
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val aa = readLine()!!.split(' ').map(String::toLong)
    val sum = aa.sum()
    var subsum = 0L
    val ans = aa.take(n - 1)
        .map {
            subsum += it
            Math.abs(sum - 2 * subsum)
        }
        .min()
    println(ans)
}


Measured memory_bytes: 83240
#include <iostream>
#include <vector>
#include <map>

#define PI 3.14159265359	

using namespace std;

int main(){
	int m, f, r;
	while (1){
		cin >> m >> f >> r;
		if (m == -1 && f == -1 && r == -1) break;
		if (m == -1 || f == -1) cout << "F" << endl;
		else if (m + f >= 80) cout << "A" << endl;
		else if (m + f >= 65) cout << "B" << endl;
		else if (m + f >= 50) cout << "C" << endl;
		else if (m + f >= 30){
			if (r >= 50) cout << "C" << endl;
			else cout << "D" << endl;
		}
		else cout << "F" << endl;
	}

}

Measured memory_bytes: 3072
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>

#define rep(i, j) FOR(i, 0, j)
#define FOR(i, j, k) for(int i = j; i < k; ++i)

using namespace std;

int main(){
  int n, value, f;
  while(scanf("%d", &n) && n){
    vector<pair<int, int> >v(n);
    rep(i, n){
      scanf("%d%d", &value, &f);
      v[i] = make_pair(f, value);
    }

    sort(v.begin(), v.end());
    int sum = 0, f = 0;
    rep(i, n){
      sum += v[i].second;
      if(sum > v[i].first) f = 1;
    }

    if(f) puts("No");
    else puts("Yes");
  }
  return 0;
}

Measured memory_bytes: 1016
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
    cin.tie(NULL); cout.tie(NULL);
    ios_base:: sync_with_stdio(false);
    ll n,a=0;cin>>n;
    string s;cin>>s;
    for(ll i=0;i<n;i++)if(s[i]=='R')a++;
    cout<<(a>n-a?"Yes":"No");
}




Measured memory_bytes: 256
/* https://atcoder.jp/contests/abc082/tasks/arc087_a */

#include <iostream>
#include <map>
#include <set>

/* {{{ Variables */
int N;
std::map<int, int> cnt;
/* }}} */

int main(int argc, char *argv[])
{
  /* {{{ Input */
  std::cin >> N;

  for (int i = 0; i < N; ++i) {
    int k;
    std::cin >> k;

    cnt[k]++;
  }
  /* }}} */

  /* {{{ Output */
  int rest = 0;

  for (auto p: cnt) {
    int k = p.first;
    int c = p.second;

    if (k > c) {
      rest += c;
    } else if (k < c) {
      rest += c - k;
    }
  }

  std::cout << rest << std::endl;
  /* }}} */

  return 0;
}


Measured memory_bytes: 4736
#include<bits/stdc++.h>
#define maxn 100005
using namespace std;
int arr[maxn];
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	for(int i=1;i<=n;i++)
		cin >> arr[i];
	int ans = 0;
	for(int i=1,r;i<=n;i=r+1) {
		r = i;
		while(r+1<=n && arr[r] >= arr[r+1])		r++;
		ans = max(ans,r-i);
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;

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

  int n;
  string s;
  cin >> n >> s;
  int res = 0;
  for (int i = 0; i < n-2; ) {
    if (s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C') {
      res++;
      i += 3;
    } else i++;
  }
  cout << res << endl;

	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<vector>
#include<queue>
#include<deque>
#include<string>
#include<utility>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<set>
#include<map>
#include<bitset>
#include<stack>
#include<ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<pli> vpli;

inline ll read(){
    ll Hashimoto=0;
	bool Kanna=1;
    char I_Love=getchar();
    while(I_Love<'0'||I_Love>'9'){
        if(I_Love=='-')Kanna=0;
        I_Love=getchar();
    }
    while(I_Love>='0'&&I_Love<='9'){
        Hashimoto=Hashimoto*10+I_Love-'0';
        I_Love=getchar();
    }
    return (Kanna?Hashimoto:-Hashimoto);
}
template<typename T1,typename T2> inline void Umax(T1 &a,T2 b){
	if(a<b)a=b;
}
template<typename T1,typename T2> inline void Umin(T1 &a,T2 b){
	if(a>b)a=b;
}

#define I_Love_Hashimoto_Kanna main
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define filein(s) freopen(s,"r",stdin);
#define fileout(s) freopen(s,"w",stdout);
#define file freopen("I_Love_Hashimoto_Kanna.out","w",stdout);
#define RE cout<<"I_Love_Hashimoto_Kanna"<<endl;
#define Tone(Kanna) cout<<Kanna<<endl;
#define Tall(Hashimoto,Kanna) for(int I_Love=0;I_Love<(Kanna);++I_Love)cout<<Hashimoto[I_Love]<<(I_Love==(Kanna)-1?"\n":" ");
#define FOR(I_Love,Hashimoto,Kanna) for(int I_Love=Hashimoto;I_Love<(Kanna);++I_Love)
#define MP(Hashimoto,Kanna) make_pair(Hashimoto,Kanna)
#define REV(Kanna) reverse(Kanna.begin(),Kanna.end());
#define SORT(Kanna) sort(Kanna.begin(),Kanna.end());
#define UNIQUE(Kanna) Kanna.erase(unique(Kanna.begin(),Kanna.end()),Kanna.end());
#define inf (1000000000)
#define linf (1000000000000000000ll)
#define mod (1000000007)

int n;
vector<string> s;

int I_Love_Hashimoto_Kanna() {
	//完全想清楚了再开始写。
	//写不顺、不知道怎么写、很乱的时候，停下来好好想想。
	//做得慢总比做不出好。
	fastio;
	n=read();
	FOR(i,0,n){
		char str[11];
		scanf("%s",str);
		sort(str,str+10);
		s.push_back("");
		FOR(j,0,10)s[i].push_back(str[j]);
	}
	SORT(s);
	ll cur=1;
	ll ans=0;
	FOR(i,1,n){
		if(s[i]==s[i-1])cur++;
		else {
			ans+=cur*(cur-1)/2;
			cur=1;
		}
	}
	ans+=cur*(cur-1)/2;
	Tone(ans)
	
	
	return 0;
}


Measured memory_bytes: 7284
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author GYSHGX868
 */
public class Main {
  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    OutputWriter out = new OutputWriter(outputStream);
    TaskA solver = new TaskA();
    solver.solve(1, in, out);
    out.close();
  }

  static class TaskA {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
      int a = in.nextInt();
      int b = in.nextInt();
      int h = in.nextInt();
      out.printLine((a + b) * h / 2);
    }

  }

  static class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
      writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
      this.writer = new PrintWriter(writer);
    }

    public void close() {
      writer.close();
    }

    public void printLine(int i) {
      writer.println(i);
    }

  }

  static class InputReader {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private InputReader.SpaceCharFilter filter;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public int read() {
      if (numChars == -1) {
        throw new InputMismatchException();
      }
      if (curChar >= numChars) {
        curChar = 0;
        try {
          numChars = stream.read(buf);
        } catch (IOException e) {
          throw new InputMismatchException();
        }
        if (numChars <= 0) {
          return -1;
        }
      }
      return buf[curChar++];
    }

    public int nextInt() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      int res = 0;
      do {
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        res *= 10;
        res += c - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public boolean isSpaceChar(int c) {
      if (filter != null) {
        return filter.isSpaceChar(c);
      }
      return isWhitespace(c);
    }

    public static boolean isWhitespace(int c) {
      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public interface SpaceCharFilter {
      boolean isSpaceChar(int ch);

    }

  }
}



Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
// typedef pair<ll,ll> Pair;
// ll mod=1000000007;
int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    cout.tie(NULL);
    ll t,c,i,j,k,temp,temp2,n,m,sum=0;
    string a,b,tem;
    cin >> n >>m;
    string ans="";
    for(i=0;i<n;i++){
        ans+="*";
    }
    for(i=0;i<m;i++){
        cin >> temp >> temp2;
        if((ans[temp-1]!='*'&&ans[temp-1]!=char(temp2+48))||(n>1&&temp==1&&temp2==0)){
            cout << "-1";
            return 0;
        }
        ans[temp-1] = char(temp2+48);
    }
    if(n==1&&ans[0]=='*') ans[0]='0';
    if(ans[0]=='*') ans[0]='1';
    for(i=1;i<n;i++){
        if(ans[i]=='*') ans[i]='0';
    }
    cout << ans;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#define ll long long
#define maxn 500005 
using namespace std;
char a[maxn];
int len,ans[maxn],cnt;
struct ru{
	int now,zhi,mo;
} p[maxn];
int cmp(ru s1, ru s2){
    return s1.zhi>s2.zhi;
}
int main(){
	a[0]=1;
	cin>>a+1;len=strlen(a)-1;
	int sum=0,nows=0,moo=0;
	for(int i=1;i<=len;i++){
		if (a[i]!=a[i-1]){
			p[cnt].now=nows;
			p[cnt].zhi=sum;
			p[cnt].mo=moo;
			cnt++;
			sum=1;nows=i;
			if(a[i]=='<') moo=1;
			else moo=2;
		} else sum++;
	}
		p[cnt].now=nows;
		p[cnt].zhi=sum;
		p[cnt].mo=moo;
		sort(p+1,p+cnt+1,cmp);
		memset(ans,-1,sizeof(ans));
		for(int i=1;i<=cnt;i++){
			int now1=0;
			if(p[i].mo==1)
			for(int j=p[i].now;j<=p[i].now+p[i].zhi;j++){
				if(ans[j]==-1) ans[j]=now1;
				now1++;
				
			} else{
				for(int j=p[i].now+p[i].zhi;j>=p[i].now;j--){
				if(ans[j]==-1) ans[j]=now1;
				now1++;
				}
			}
		}
		ll anss=0;
//		for(int i=1;i<=len+1;i++) cout<<ans[i]<<" ";cout<<endl;
		for(int i=1;i<=len+1;i++) anss+=(ll)ans[i];
		cout<<anss;
}

Measured memory_bytes: 8908
#include <iostream>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <map>
#include <vector>
#include <iomanip>

using namespace std;

int main(void) {
  int H, W;
  string c = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  string s;
  cin >> H >> W;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> s;
      if (s == "snuke") {
        cout << c[j] << i + 1 << endl;
        return 0;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 888
package main

import (
	"fmt"
	"sort"
	"strings"
)

func main() {
	var n, l int
	var s string

	//input
	fmt.Scan(&n, &l)
	strArr := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&s)
		strArr[i] = s
	}

	//process
	sort.Strings(strArr)
	s = strings.Join(strArr, "")
	fmt.Println(s)
}


Measured memory_bytes: 640
// {{{
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <complex>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(ll i = static_cast<ll>(a); i < static_cast<ll>(b); i++)
#define FORR(i, a, b) for(ll i = static_cast<ll>(a); i >= static_cast<ll>(b); i--)
#define REP(i, n) for(ll i = 0ll; i < static_cast<ll>(n); i++)
#define REPR(i, n) for(ll i = static_cast<ll>(n); i >= 0ll; i--)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> IP;
typedef pair<ll, LP> LLP;

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

constexpr int INF = 100000000;
constexpr ll LINF = 10000000000000000ll;
constexpr int MOD = static_cast<int>(1e9 + 7);
constexpr double EPS = 1e-9;

static inline ll mod(ll x, ll m)
{
    ll y = x % m;
    return (y >= 0 ? y : y+m);
}

// }}}

int N, K;
ll h[100000];
ll dp[100000];

void solve()
{
    REP(i, N) dp[i] = LINF;
    dp[0] = 0;
    REP(i, N) {
        FOR(j, 1, K+1) {
            if (i + j < N) dp[i+j] = min(dp[i+j], dp[i] + abs(h[i]-h[i+j]));
        }
    }
    cout << dp[N-1] << endl;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> K;
    REP(i, N) cin >> h[i];
    solve();
    return 0;
}

// vim:set foldmethod=marker:


Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = "";
            while ((line = Console.ReadLine()) != null)
            {
                String[] arg = line.Split(',');
                double o = double.Parse(arg[1]);
                double s = double.Parse(arg[2]);
                double bmi = o / (s * s);
                if (bmi >= 25) Console.WriteLine(arg[0]);
            }
        }
    }
}

Measured memory_bytes: 5716
import math
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0

for i in range(A + 1):
    Y = X - i*500

    for j in range(B + 1):
        Z = Y - j*100
        if Z >= 0 and Z/50 <= C:
            count += 1
            # print(str(i) +" " +  str(j) + " " + str(Z))

print(str(count))
    

Measured memory_bytes: 9120
import operator as op
from collections import Counter
from functools import reduce


def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer // denom


def m():
    N = int(input())
    A = [int(i) for i in input().split(' ')]
    cums = [0] * (N + 1)
    for i in range(N):
        cums[i+1] = cums[i] + A[i]

    counter = Counter(cums)

    ans = 0
    for _, v in counter.items():
        if v > 1:
            ans += ncr(v, 2)

    print(ans)


m()


Measured memory_bytes: 111920
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2e5 + 7;

int main(){
	ios::sync_with_stdio(false); cin.tie(nullptr);
	map<string, int> hs;
	string s;
	int n; cin >> n; 
	for(int i = 0; i < n; ++ i){
		cin >> s; ++ hs[s];
	}
	int ans = 0;
	for(auto it : hs){
		if(ans < it.second) ans = it.second;
	}
	for(auto it : hs){
		if(it.second == ans){
			cout << it.first << '\n';
		}
	}
	return 0;
}

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

namespace ConsoleApp18
{
    class Program
    {
        static void Main(string[] args)
        {
            var numbers = Console.ReadLine().Split(' ').Select(c => int.Parse(c)).ToArray();

            int X = numbers[0];
            int A = numbers[1];

            if (X < A)
            {
                Console.WriteLine("0");
            }
            else
            {
                Console.WriteLine("10");
            }
        }
    }
}


Measured memory_bytes: 13268
#include <stdio.h>

int main( void ) {
  int i;
  char ch[ 21 ];

  scanf( "%s", ch );

  for( i = 0; ch[ i ]; i++ ) ;

  for( i--; i >= 0; i-- )
    printf( "%c", ch[ i ] );

  printf( "\n" );

  return( 0 );
}

Measured memory_bytes: 0
def warshall_floyd(G, n):
    for k in range(n):
        for i in range(n):
            for j in range(n):
                G[i][j] = min(G[i][j], G[i][k] + G[k][j])

h, w = map(int, input().split())
c = [list(map(int, input().split())) for _ in range(10)]
a = [list(map(int, input().split())) for _ in range(h)]
warshall_floyd(c, 10)
ans = 0
for b in a:
    for i in b:
        if not i == -1:
            ans += c[i][1]
print(ans)

Measured memory_bytes: 40284
<?php
    list($N, $K) = explode(' ', trim(fgets(STDIN)));
    $fruits = array_map('intval', explode(' ', trim(fgets(STDIN))));
    $total = 0;
    
    sort($fruits, SORT_NUMERIC);
    
    for($i = 0; $i < $K; $i++){
        $total += $fruits[$i];
    }
    echo $total;
?>

Measured memory_bytes: 16284
#[allow(unused_imports)]
use std::collections::VecDeque;
#[allow(unused_imports)]
use std::cmp;
#[allow(unused_imports)]
use std::collections::HashMap;

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_variables)]
        #[allow(unused_mut)]
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
 
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("parse error")
    };
}

fn main() {
    input!{
        n: usize,
        m: usize,
        g: [(usize, usize); m]
    }
    let mut graph: Vec<Vec<usize>> = vec![vec![]; n];
    let mut in_degree: Vec<usize> = vec![0; n];
    for (f, t) in g {
        graph[f-1].push(t-1);
        in_degree[t-1] += 1;
    }
    let mut graph_len: Vec<usize> = vec![0; n];
    let mut queue: VecDeque<usize> = VecDeque::new();
    for i in 0..n {
        if in_degree[i] == 0 {queue.push_front(i);}
    }
    let mut path_len = 0;
    while let Some(p) = queue.pop_back() {
        let nx_len = graph_len[p] + 1;
        path_len = cmp::max(path_len, graph_len[p]);
        for &i in &graph[p] {
            graph_len[i] = cmp::max(graph_len[i], nx_len);
            in_degree[i] -= 1;
            if in_degree[i] == 0 {queue.push_front(i);}
        }
    }
    println!("{}", path_len);
}


Measured memory_bytes: 12540
# coding:utf-8

import sys
from collections import deque

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


s = SI()

ans = 0
q = deque()
for c in s:
    if not q:
        q.append(c)
        continue
    if q[-1] != c:
        ans += 1
        q.popleft()
        continue
    q.append(c)

print(ans * 2)


Measured memory_bytes: 4212
S = int(input())
a = [0 for _ in range(S+1)]
if S < 3:
  print(a[S])
  exit()
a[3] = 1


for n in range(4, S+1):
  sm = 0
  for i in range(3, S):
    sm += a[n-i]
  a[n] = sm+1

print(a[S] % ((10**9) + 7))

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

using namespace std;
using ll = long long;

#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define REP(i,n) FOR(i, 0, n)
#define FORD(i,a,n) for(int i=(a); i>=(n); i--)
#define REPD(i,n) FOR(i, n, 0)

#define ALL(o) (o).begin(), (o).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T, vector<T>, greater<T> >;

ll c2(ll n) {
	if(n <= 1) {
		return 0;
	}
	return n*(n-1)/2;
}


int main() {
	ll n, t;
	map<ll, ll> hm;
	V<ll> v;
	cin >> n;
	REP(i,n) {
		cin >> t;
		v.push_back(t);
		hm[t]+=1;
	}

	map<ll, ll> hcnt;
	ll total = 0;
	for(auto itr = hm.begin(); itr != hm.end(); ++itr) {
	 	// cout << itr->first << ": " << itr->second << endl;
		hcnt[itr->second] = c2(itr->second);
		hcnt[itr->second-1] = c2(itr->second-1);
		total += hcnt[itr->second];
	}
	REP(i,n) {
		cout << total - c2(hm[v[i]]) + c2(hm[v[i]]-1) << endl;
	}

	return 0;
}




Measured memory_bytes: 12784