akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<queue>
#include<deque>
#include<stdio.h>

#include<vector>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<set>
#include<map>
#include<bitset>
#include<unordered_set>
#include<unordered_map>
 
#define pi 3.141592653
#define in freopen("entrada","r",stdin);
#define out freopen("myfile.txt","w",stdout);
#define ii pair<int,int> 
#define fast_io cin.tie(0), cin.sync_with_stdio(false);
#define inf 0x3f3f3f3f
#define sup_inf 1e18
#define f first
#define s second
#define eps 1e-9

#define nl ( no << 1)
#define nr ( no << 1)|1
#define mid l+(( r-l)>>1)
 
using namespace std;
typedef  long long ll;	
typedef long double ld;
typedef unsigned long long ull;
typedef  pair< long long , pair< int,int> > iii;

 
const int MAX = 1010;
 
 

using namespace std;





int  n, m, k;

char a[MAX][MAX];
int line[MAX], col[MAX];
 
int main () {
  
  //~ in
  scanf("%d %d %d",&n,&m, &k);
  
  int tot = 0;
  for(int i = 0 ;i  < n;i++) {
    scanf("%s", a[i]);
  }
  
  for(int i = 0 ;i < n;i++) {
    for(int j = 0 ;j < m;j++) {
      tot += a[i][j] == '#';
    }
  }
  
  int ans = 0;
  
  for(int i = 0;i < (1 << n);i++) {
    for(int j = 0 ;j < ( 1 << m) ;j++) {
      
      int num = 0;
      
      for(int s = 0 ;s < n ;s++) {
        for(int y = 0 ; y < m ;y ++) {
          if ( a[s][y] == '#' ){
            bool l = ( 1 << s ) & i;
            bool c = ( 1 << y ) & j;
            
          
            if ( c||l ) {
              num++;
              
              
            }
          }
        }
      }
 
      if ( tot-num == k ) {
  
        ++ans;
      }
    }
  }
  
  printf("%d\n", ans );
  
  return 0;
}




Measured memory_bytes: 3200
// https://beta.atcoder.jp/contests/abc091/tasks/arc092_a
import std.stdio, std.algorithm, std.string, std.conv, std.array, std.range, std.math;
int readint() { return readln.chomp.to!int; }
int[] readints() { return readln.split.to!(int[]); }

void main() {
    auto bm = new BipartiteMatching();
    int X, Y, E;
    readf("%d %d %d\n", &X, &Y, &E);
    foreach (_; 0..E) {
        int x, y; readf("%d %d\n", &x, &y);
        bm.add_edge(x, X + y, 1);
    }
    int s = X + Y, t = s + 1;
    foreach (to; 0..X)
        bm.add_edge(s, to, 1);
    foreach (from; X..X + Y)
        bm.add_edge(from, t, 1);

    writeln(bm.max_flow(s, t));

    auto _ = readln(); // dbg
}

class BipartiteMatching {
    immutable int INF = 114514810;
    immutable int VMAX = 300;

    struct Edge { int to, cap, rev; }
    Edge[][] G;
    bool[] used; // dfs したか

    this() {
        used.length = G.length = VMAX;
    }

    void add_edge(int from, int to, int cap) {
        G[from] ~= Edge(to, cap, G[to].length.to!int);
        G[to]   ~= Edge(from, 0, G[from].length.to!int - 1);
    }
    // 増加パスを探す
    int dfs(int v, int t, int f) {
        if (v == t) return f;
        used[v] = true;
        foreach (ref e; G[v]) if (!used[e.to] && e.cap > 0) {
            int d = dfs(e.to, t, min(f, e.cap));
            if (d > 0) {
                e.cap -= d;
                G[e.to][e.rev].cap += d;
                return d;
            }
        }
        return 0;
    }
    int max_flow(int s, int t) {
        int flow;
        while (1) {
            fill(used, false);
            int f = dfs(s, t, INF);
            if (f == 0) return flow;
            flow += f;
        }
        assert(false);
    }
}


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

int main()
{
    vector<string> names;
      string buffer;
    long n, i;
    int flag=0,ctr=0;
    cin >> n;
    for (i = 0; i < n; i++)
    {
        cin >> buffer;
        names.push_back(buffer);
    }
    sort(names.begin(), names.end());
    for(i=0;i<n-1;i++)
    {

        if(names[i]==names[i+1])
        {
            flag=1;

        }
        else
            ctr++;

    }

    if(flag == 1)
        cout << ctr+1;
    else
        cout << ctr+1;

}


Measured memory_bytes: 11656
let rec power ( * ) one m = function
  | 0 -> one
  | n when n mod 2 = 0 ->
      power ( * ) one (m * m) (n / 2)
  | n ->
      m * power ( * ) one m (n - 1)

let rec upper_bound l r p =
  if r <= 1 + l
  then l
  else let m = (l + r) / 2 in
       if p m 
       then upper_bound m r p
       else upper_bound l m p

let () = Scanf.scanf "%d\n" @@ fun x ->
  Array.init (int_of_float (sqrt @@ float_of_int x) - 1) (( + ) 2)
  |> Array.map (fun b ->
    power ( * ) 1 b @@ upper_bound 2 9 @@ fun p -> power ( * ) 1 b p <= x)
  |> Array.fold_left max 1
  |> Printf.printf "%d\n"



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ull = uint64_t;
using ll = int64_t;
using ld = long double;

const int MAXP = 10002;
bool np[MAXP];

vector<int> primes; 

void sieve() {
    for (int i = 2; i < MAXP; ++i) {
        if (!np[i]) {
            primes.push_back(i);

            for (ll j = i * i; j < MAXP; j += i) {
                np[j] = true;
            }
        }
    }
}

ll gcd(ll a, ll b) {
    while (b) {
        ll c = a % b;
        a = b;
        b = c;
    }

    return a;
}

const ll MAXV = 1e15 - 2;

ll lcm(ll a, ll b) {
    ll ans = a / gcd(a, b) * b;
    assert(ans <= MAXV);
    return ans;
}

ll a[502][502];

int mx[] = { -1, 0, 1, 0 };
int my[] = { 0, -1, 0, 1 };

void precalc() {
    sieve();
    int n = 500;

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            if ((i + j) % 2 == 0) {
                int x = (i + j) / 2;
                int y = (i - j) / 2 + n / 2 + n;
                a[i][j] = primes[x] * primes[y];
            }
        }
    }

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            if ((i + j) % 2 == 1) {
                a[i][j] = 1;
                if (i > 0) {
                    a[i][j] = lcm(a[i][j], a[i - 1][j]);
                }

                if (i + 1 < n) {
                    a[i][j] = lcm(a[i][j], a[i + 1][j]);
                }

                if (j > 0) {
                    a[i][j] = lcm(a[i][j], a[i][j - 1]);
                }

                if (j + 1 < n) {
                    a[i][j] = lcm(a[i][j], a[i][j + 1]);
                }

                ++a[i][j];
            }
        }
    }
}

int main() {
#ifdef BZ
    freopen("input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cout.setf(ios::fixed); cout.precision(20);
    precalc();
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            cout << a[i][j];
            cout << " ";
        }
        cout << "\n";
    }
}



Measured memory_bytes: 5120
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <deque>
using namespace std;
using P = pair<int,int>;
typedef long long int ll;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)

int main(){
    string s;
    cin >> s;
    int slen = s.size();
    slen /= 2;
    while(1){
        bool isans = true;
        slen --;
        for(int i=0; i<slen; i++){
            if(s[i]!=s[i+slen])isans = false;
        }
        if(isans){
            cout << slen*2 << endl;
            return 0;
        }
    }
    return 0;
}




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

int main() {
  
  ll a;
  double b;
  cin >> a >> b;
  
  ll c = b*100+0.5;
  a *= c;
  a /= 100;
  cout << a << endl;
}

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

long long pow(long long x, long long n) {
    long long res = 1LL;
    while(n > 0) {
        if(n & 1) res = res * x;
        x = x * x;
        n = n >> 1;
    }
    return res;
}

int main() {
    int64 H; cin >> H;
    int64 n = 0, ans = 0;
    while(H > 1) {
        H /= 2;
        ++n;
        ans += pow(2, n);
    }
    cout << ans + 1 << '\n';
    return 0;
}

// overflow
// corner cases


Measured memory_bytes: 512
//#include "stdafx.h"
#include<bits/stdc++.h> 
#include<iostream>
#include<queue>
#include<string>
#include<algorithm>
using namespace std;
int a,b,c,q[101],countt;
int main()
{
	cin>>a>>b>>c;
	q[a]++;
	q[b]++;
	q[c]++;
	for(int i=0;i<=100;i++)
		if(q[i]!=0)
			countt++;
	cout<<countt<<"\n";

	
	


	
	
    return 0;
 
}



Measured memory_bytes: 3552
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {


    public static void main(String[] args) throws IOException {
        Scanner s = new Scanner(System.in);
        int a = s.nextInt();
        String word = s.next();
        if(a>=3200) System.out.println(word);
        else System.out.println("red");

    }




}


class Scanner
{
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

    public String next() throws IOException
    {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

    public int nextInt() throws IOException {return Integer.parseInt(next());}

    public long nextLong() throws IOException {return Long.parseLong(next());}

    public String nextLine() throws IOException {return br.readLine();}

    public double nextDouble() throws IOException
    {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if(x.charAt(0) == '-')
        {
            neg = true;
            start++;
        }
        for(int i = start; i < x.length(); i++)
            if(x.charAt(i) == '.')
            {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            }
            else
            {
                sb.append(x.charAt(i));
                if(dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg?-1:1);
    }

    public boolean ready() throws IOException {return br.ready();}


}

Measured memory_bytes: 25300
#include<cstdio>
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
using namespace std;
typedef pair< int, int > Pi;
const int INF = 1 << 30;
struct edge: vector< Pi > {
  void add_edge(int to, int cost){
    push_back(Pi(to,cost));
  }
} info[100000];
int hoge[100000];

void bfs(const int& st, const int& V){
  fill_n( hoge, V, INF);
  queue< int > que;
  que.push(st);
  hoge[st] = 0;
  while(!que.empty()){
    int p = que.front();
    que.pop();
    for(int i = 0 ; i < info[p].size() ; i++){
      int cost = info[p][i].second;
      int to = info[p][i].first;
      if( cost + hoge[p] < hoge[to]){
        que.push(to);
        hoge[to] = cost + hoge[p];
      }
    }
  }
}

int main(){
  int N;
  scanf("%d", &N);
  for(int i = 0; i < N; i++){
    int u, k;
    scanf("%d %d", &u, &k);
    while(k--){
      int v, c;
      scanf("%d %d", &v, &c);
      info[u].add_edge( v, c);
    }
  }
  bfs(0, N);
  for(int i = 0 ; i < N ; i++ ){
    printf("%d %d\n", i, hoge[i]);
  }
}

Measured memory_bytes: 3436
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<long long,long long>
#define mod 1000000007
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);

ll power(ll a,ll b){
	ll ans=1;
	while(b>0){
		if(b%2!=0){
			ans=(ans*a)%mod;
		}
		a=(a*a)%mod;
		b>>=1;
	}
	return ans;
}

int main() {
	IOS;
	int t=1;
	//cin>>t;
	while(t--){
		string s;
      cin>>s;
      for(int i=0;i<s.size();i++)
        s[i]='x';
      cout<<s;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
using namespace std;
int J[10001][1001], O[10001][1001], I[10001][1001];
int j[1001], o[1001], ai[1001];
int main() {
	long long n, w, k, b, c, d, e; char a; cin >> n >> w >> k;
	for (int h = 1; h <= n; h++) {
		int s = 0, t = 0, u = 0;
		for (int i = 1; i <= w; i++) {
			cin >> a;
			if (a == 'J') { s++; J[h][i] = j[i] + s; }
			else { J[h][i] = j[i] + s; }
			if (a == 'O') { t++; O[h][i] = o[i] + t; }
			else { O[h][i] = o[i] + t; }
			if (a == 'I') { u++; I[h][i] = ai[i] + u; }
			else { I[h][i] = ai[i] + u; }
			j[i] += s; o[i] += t; ai[i] += u;
		}
	}
	for (int h = 1; h <= k; h++) {
		cin >> b >> c >> d >> e;
		cout << J[d][e] - J[d][c - 1] - J[b - 1][e] + J[b - 1][c - 1] << ' ';
		cout << O[d][e] - O[d][c - 1] - O[b - 1][e] + O[b - 1][c - 1] << ' ';
		cout << I[d][e] - I[d][c - 1] - I[b - 1][e] + I[b - 1][c - 1] << endl;
	}
	cin >> n;
}


Measured memory_bytes: 14640
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <cstdlib>
#include <cmath>
#include <bitset>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
const 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;}

int main(){
    int k;
    cin >> k;
    int rem=7%k;
    int cnt=1;
    set<int> st;
    while(st.count(rem)==0){
        st.insert(rem);
        if(rem==0){
            cout << cnt << endl;
            return 0;
        }
        rem=(rem*10+7)%k;
        cnt++;
    }
    cout << -1 << endl;
}

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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  vector<int> a(3); rep(i,3) cin >> a[i];

  int cost = INF;
  cost = min(cost,abs(a[1]-a[0])+abs(a[2]-a[1]));
  cost = min(cost,abs(a[2]-a[0])+abs(a[1]-a[2]));
  cost = min(cost,abs(a[0]-a[1])+abs(a[2]-a[0]));

  cout << cost << endl;
  
  return 0;
}


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

int main(){
    int n,m,sum=0;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int k;
        cin>>k;
        sum+=k;
    }
    if(n>=sum)cout<<n-sum;
    else cout<<"-1";

}

Measured memory_bytes: 3636
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 10e16
#define MOD 1000000007
#define  mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    string s;cin>>s;
    int l=0,r=0;
    for(int i=0;i<s.length();i++){
        if(s[i]=='A'){
            l=i;
            break;
        }
    }
    for(int i=s.length()-1;i>0;i--){
        if(s[i]=='Z'){
            r=i;
            break;
        }
    }
    cout<<r-l+1<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------






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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;

#define REP(i, n, m) for(ll i=n; i<(ll)m; ++i)
#define IREP(i, n, m) for(ll i=n-1; i>=m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()
#define vprint(v) for(auto e:v){cout<<e<<" ";};cout<<endl;
#define vvprint(vv) for(auto v:vv)vprint(v);

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20);

    ll N;
    cin >> N;
    vll A(N);
    rep(i, N) cin >> A[i];

    unordered_map<ll, ll> s1, s2;
    ll count = 0;
    rep(i, N){
        ll k1 = A[i] + i;
        ll k2 = i - A[i];
        ll n1 = i - A[i];
        ll n2 = i + A[i];
        if(s1.find(k1)!=s1.end()) count += s1[k1];
        if(s2.find(k2)!=s2.end()) count += s2[k2];
        if(s1.find(n1)==s1.end()) s1[n1] = 1;
        else ++s1[n1];
        if(s2.find(n2)==s2.end()) s2[n2] = 1;
        else ++s2[n2];
    }
    cout << count << endl;
}


Measured memory_bytes: 20168
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
  int N;
  cin >> N;
  ll A[N];
  for(int i=0; i<N; ++i) cin >> A[i];
  sort(A, A+N);
  cout << A[N-1] - A[0] << endl;
}

Measured memory_bytes: 3592
#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<math.h>
#include<iomanip>
#include<functional>
using namespace std;

#define ll long long
using vt = ll; //ここで数値の型を変えられる
#define rep(i, n) for (vt i = 0; i < (vt)(n); i++)
#define reps(i, s, n) for(vt i = (vt) (s); i < (vt) (n); i++) 
#define all(v) v.begin(), v.end()
#define P pair<int, int>
const ll  MOD = 1000000007;

int main() {
	ll p, q, r;
	cin >> p >> q >> r;
	ll s = p + q + r;
	cout << s - max(p, max(q, r));
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
static const int NMAX = 100;

void PrintArray(const int* A, int N);
void InsertionSort(int* A, int N);

int main() {
    int A[NMAX], n;

    std::cin >> n;

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

    PrintArray(A, n);
    InsertionSort(A, n);

    return 0;
}

void PrintArray(const int* A, int N) {
    for (int i = 0; i < N; i++) {
        if (i > 0) {
            std::cout << " ";
        }
        std::cout << A[i];
    }
    std::cout << std::endl;
}

void InsertionSort(int* A, int N) {
    for (int i = 1; i < N; i++) {
        int tmp = A[i];
        int j = i - 1;

        while (j >= 0 && A[j] > tmp) {
            A[j + 1] = A[j];
            j--;
        }
        A[j + 1] = tmp;

        PrintArray(A, N);
    }
}


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

#ifdef LOCAL
        #include "debug.h"
        #define input freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
        #else
        #define debug(...) 4
        #define input ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#endif

using ll = long long;
const int N = 2e5 + 5;
const int mod = 1e9 + 7;

int main() {
    input;
        
    int n, m, k;
    cin >> n >> m >> k;
    cout << (k + max(n, m) - 1) / max(n, m);
    
}   

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

typedef long long ll;
typedef char keytype;

void quicksort_des(keytype a[], int first, int last)
{
    int i, j;
    keytype x, t;

    x = a[(first + last) / 2];
    i = first;  j = last;
    for ( ; ; ) {
        while (a[i] > x) i++;
        while (x > a[j]) j--;
        if (i >= j) break;
        t = a[i];  a[i] = a[j];  a[j] = t;
        i++;  j--;
    }
    if (first  < i - 1) quicksort_des(a, first , i - 1);
    if (j + 1 < last) quicksort_des(a, j + 1, last);
}

int main(){
    int n;
    int p[100];

    scanf("%d", &n);
    for(int i = 0; i < n; ++i){
        scanf("%d", &p[i]);
    }

    int cnt = 0;
    for(int i = 0; i + 2 < n; ++i){
        if(p[i] < p[i+1] && p[i+1] < p[i+2]) cnt++;
        if(p[i] > p[i+1] && p[i+1] > p[i+2]) cnt++;
    }

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

    return 0;
}


Measured memory_bytes: 1672
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#define M 1000000007
#define pi 3.141592653589793
using namespace std;
int main()
{
    int n,D;
    scanf("%d%d",&n,&D);
    if(n%(2*D+1)==0)
        printf("%d\n",n/(2*D+1));
    else
        printf("%d\n",n/(2*D+1)+1);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <map>
typedef long long ll;

using namespace std;

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

    tmp = 0;

    tmp = a;
    a = c;
    c = b;
    b = tmp;

    cout << a << " " << b << " " << c << endl;

    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
ans = 1
if 0 in a:
	ans = 0
else:
	for i in range(n-1,-1,-1):
		ans *= a[i]
		if(ans>10**18):
			break
if(ans>10**18):
	print(-1)
else:
	print(ans)

Measured memory_bytes: 21796
/* imports all std modules {{{*/
import
  std.algorithm,
  std.array,
  std.ascii,
  std.base64,
  std.bigint,
  std.bitmanip,
  std.compiler,
  std.complex,
  std.concurrency,
  std.container,
  std.conv,
  std.csv,
  std.datetime,
  std.demangle,
  std.encoding,
  std.exception,
  std.file,
  std.format,
  std.functional,
  std.getopt,
  std.json,
  std.math,
  std.mathspecial,
  std.meta,
  std.mmfile,
  std.net.curl,
  std.net.isemail,
  std.numeric,
  std.parallelism,
  std.path,
  std.process,
  std.random,
  std.range,
  std.regex,
  std.signals,
  std.socket,
  std.stdint,
  std.stdio,
  std.string,
  std.system,
  std.traits,
  std.typecons,
  std.uni,
  std.uri,
  std.utf,
  std.uuid,
  std.variant,
  std.zip,
  std.zlib;
/*}}}*/

/* libnum {{{*/
void amax(N, Args...)(ref N x, Args y) {
  x = x.max(y);
}
void amin(N, Args...)(ref N x, Args y) {
  x = x.min(y);
}
auto maxE(R)(R r) if (isInputRange!R) {
  ElementType!R x = r.front;
  r.popFront();
  foreach (y; r) x.amax(y);
  return x;
}
auto minE(R)(R r) if (isInputRange!R) {
  ElementType!R x = r.front;
  r.popFront();
  foreach (y; r) x.amin(y);
  return x;
}
/*}}}*/

/+---test
5
4 2 5 1 3
---+/

/+---test
4
4 3 2 1
---+/
/+---test
6
1 2 3 4 5 6
---+/
/+---test
8
5 7 4 2 6 8 1 3
---+/
/+---test
1
1
---+/

void main(string[] args) {
  const N = readln.chomp.to!long;

  const P = readln.split.map!(to!long).array;

  long m = long.max, ans;
  foreach (p; P) {
    if (p <= m) ++ans;
    m.amin(p);
  }
  ans.writeln;
}


Measured memory_bytes: 11408
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

pub struct Sieve {
    primes: Vec<u64>,
    tbl: Vec<u64>,
}
impl Sieve {
    pub fn new(n: u64) -> Sieve {
        let sz: usize = (n + 1) as usize;
        let mut primes = Vec::new();
        let mut tbl = vec![0; sz];
        tbl[0] = 0;
        tbl[1] = 0;
        for i in 2..sz {
            if tbl[i] != 0 {
                continue;
            }
            primes.push(i as u64);
            tbl[i] = i as u64;
            let mut j = i * i;
            while j < sz {
                if tbl[j] == 0 {
                    tbl[j] = i as u64;
                }
                j += i;
            }
        }
        Sieve {
            primes: primes,
            tbl: tbl,
        }
    }
    pub fn primes(&self) -> &Vec<u64> {
        &self.primes
    }
    pub fn is_prime(&self, x: u64) -> bool {
        x > 1 && self.tbl[x as usize] == x
    }
    pub fn factorization(&self, x: u64) -> Vec<(u64, u64)> {
        let mut mx = x;
        let mut fl = Vec::new();
        while mx > 1 {
            let fx = self.tbl[mx as usize];
            fl.push(fx);
            mx /= fx;
        }
        if fl.is_empty() {
            return Vec::new();
        }
        let mut res = vec![(fl[0], 0)];
        for p in &fl {
            let l = res.len() - 1;
            let last = res[l];
            if last.0 == *p {
                res[l].1 += 1;
            } else {
                res.push((*p, 1));
            }
        }
        res
    }
}

fn main() {
    input! {
        q: usize,
        lrs: [(usize,usize);q]
    }
    let sieve = Sieve::new(100000);
    let s = (0..100000).scan(0, |acc, x| {
        *acc += if x % 2 != 0 &&
           sieve.is_prime(x) &&
           sieve.is_prime((x+1) / 2) {
            1
        } else { 0 };
        Some(*acc)
    }).collect::<Vec<_>>();
    for (l,r) in lrs {
        println!("{}", s[r] - s[l-1]);
    }
}


Measured memory_bytes: 8828
#include<stdio.h>

int main(void){
    int X, a, b;//a=500円硬貨の数、b=50円硬貨の数

    scanf("%d",&X);

    while(X >= 5){
        if(X >= 500){
            a = X / 500;
            X -= a*500; 
        }
        else if(X >= 5){
            b = X / 5;
            X -= b*5;
        }
    }
    printf("%d\n",a*1000+b*5);
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#include<iomanip>

using namespace std;
using ll = long long;

const int MOD = 1e9 + 7;
const int MAX = 1e9;
const ll LLMAX = 1e18;
const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const double PI = acos(-1.0);

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

int main() {
    int X; cin >> X;
    int A, B; cin >> A >> B;

    int rest = X - A;    

    cout << rest % B << endl;
    return 0;
}


Measured memory_bytes: 256
n,m = map(int,input().split())
lis = [0]*m
li = [0]*m
ans = [0]*n
for i in range(m):
    lis[i],li[i] = map(int,input().split())
for i in range(m):
    ans[lis[i]-1] += 1
    ans[li[i]-1] += 1
for t in range(n):print(ans[t])

Measured memory_bytes: 3064
#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, m;
  cin >> n >> m;
  vector<int> a(n);
  int sum = 0;
  rep(i, n){
    cin >> a[i];
    sum += a[i];
  }
  
  int threshold = ceil((double) sum /(4 * m));
  //cout << (double)sum/(4*m) << "," << threshold << endl;
  int count = 0;
  sort(a.begin(), a.end(), greater<int>());
  
  rep(i, n){
    if(a[i] >= threshold){
      ++count;
    }else{
      break;
    }
  }
  if(count >= m){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

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

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

typedef long double ld; 

using namespace std;

int N, K;
vector<int> V1, V2;

int main(void) {
	scanf("%d %d", &N, &K);

	int x = 1;
	V1.push_back(x);
	do {
		x *= 2;
		V1.push_back(x);
	} while ( x <= K );
	
	
	REP(i, 0, V1.size()) V2.push_back(ceil(K / (ld)V1[i]));

	/*
	REP (i, 0, V1.size()) {
		if (i > 0) printf(" ");
		printf("%5d", V1[i]);
	}
	printf("\n");

	REP (i, 0, V2.size()) {
		if (i > 0) printf(" ");
		printf("%5d", V2[i]);
	}
	printf("\n");
	*/
	int idx = 0;
	for ( int i = 0; V2[idx] > N; i++ ) idx = i;
	

	ld ans = 0.0;
	ld x1 = N, x2 = V2[idx];
	//printf("(%d - %d + 1) / %d * 1 / %d\n", (int)x1, (int)x2, N, V1[idx]);
	ans += ((x1 - x2 + 1) / N) / V1[idx];

	while ( ++idx < V2.size() ) {
		x1 = x2;
		x2 = V2[idx];
		//printf("(%d - %d) / %d * 1 / %d\n", (int)x1, (int)x2, N, V1[idx]);
		ans += ((x1 - x2) / N) / V1[idx];
		
	} 

	printf("%.12Lf\n", ans);


	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
#include <functional>

using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main()
{
	int r;
	cin>>r;
	cout<<3*r*r<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, K;
	cin >> N >> K;
	vector<int> A(N);
	vector<int> B(N);
	vector<int> C(N, 0);
	int res = 0;
	int t;
	for (int i = 0; i < N; i++) {
		cin >> A[i] >> B[i];
	}
	int a = 1 << 30;
	bool f = false;
	while(a > 0){
		if ((K&a) == 0) {
			t = 0;
			for (int i = 0; i < N; i++) {
				if ((A[i] & a) != 0) {
					C[i] = 1;
				}
				if (C[i] == 0) {
					t += B[i];
				}
			}
		}
		else {
			t = 0;
			for (int i = 0; i < N; i++) {
				if (C[i] == 0 && (A[i] & a) == 0) {
					t += B[i];
				}
			}
			res = max(res, t);
		}
		a /= 2;
	}
	t = 0;
	for (int i = 0; i < N; i++) {
		if (C[i] == 0) {
			t += B[i];
		}
	}
	res = max(res, t);
	cout << res << endl;
}

Measured memory_bytes: 2560
$mod = 998244353

n = gets.to_i
d = gets.split.map(&:to_i)

h = Array.new(n+1, 0)
d.each {|e| h[e.to_i] += 1}

if d[0] != 0 || h[0] != 1
    puts 0
else
    ans = 1
    max = d.max
    
    1.upto(max) {|i| ans = ans * h[i-1] ** h[i] % $mod}
    puts ans
end



Measured memory_bytes: 9604
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<pair<ll, ll>>> vvpll;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

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

    ll cnt1 = 0, cnt2 = 0, cnt3 = 0;
    rep(i, n) {
        ll p;
        cin >> p;
        if(p <= a) {
            cnt1++;
        }
        else if(p <= b) {
            cnt2++;
        }
        else {
            cnt3++;
        }
    }
    
    out(min({cnt1, cnt2, cnt3}));
    re0;
}

Measured memory_bytes: 256
from collections import defaultdict
from collections import deque
n = int(input())
tree = defaultdict(list)
for i in range(n-1):
    a, b, c = map(int, input().split())
    tree[a].append([b, c])
    tree[b].append([a, c])

def distance(k):
    seen = set()
    dis_l = {}
    d = 0
    stack = deque([[tree[k], d]])
    flag = True
    while stack:
        connect, d = stack.popleft()
        for i in connect:
            if i[0] not in seen:
                seen.add(i[0])
                d += i[1]
                dis_l[i[0]] = d
                stack.append([tree[i[0]], d])
                d -= i[1]
    return dis_l

q, k = map(int, input().split())
dis_l = distance(k)
for i in range(q):
    x, y = map(int, input().split())
    print(dis_l[x] + dis_l[y])

Measured memory_bytes: 75272
#include <bits/stdc++.h>
#define rep(i , n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9;
using namespace std;
using ll = long long;
#include <bits/stdc++.h>
int main() {
    int a , b , c;
    cin >> a >> b >> c;
    if((a * 100 + b * 10 + c) % 4 == 0){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
}


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

int main() {
    int N, M, C;
    cin >> N >> M >> C;
    vector<int> B(M);
    vector<int> A(M);
    
    for (int i=0; i<M; i++) {
        cin >> B[i];
    }
    int ans = 0;
    for (int i=0; i<N; i++) {

        int sum = C;
        for (int j=0; j<M; j++) {
            cin >> A[j];
            sum += A[j] * B[j];
        }
        if (sum > 0)
            ans++;
    }
    cout << ans << "\n";
}


Measured memory_bytes: 256
N = int(input())
even_A = list(range(1, N+1))
dic = {}
for a in even_A:
  x = a
  cnt = 0
  while x%2 == 0:
    x /= 2
    cnt += 1
  dic[a] = cnt

ans = sorted(dic.items(), key=lambda x:x[1])[-1]

print(ans[0])

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

int main()
{ 
  string s ;
  cin >> s ;
  int count = 0 ;
  for(int i = 0 ; i < s.size() ; i++)
  {
    if(s.at(i) == '2')
    {
      count++ ;
    }
  }
cout << count << endl ;
}


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

const int MAXN = 105;

int a[MAXN], n;

int main()
{
	scanf("%d", &n);
	for (register int i = 1; i <= n*2; i++) scanf("%d", &a[i]);
	sort(a+1, a+n*2+1);
	int ans = 0;
	for (register int i = 1; i <= n*2; i+=2) ans += a[i];
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
function Zalgo(s)
	N=length(s)
	ret=zeros(Int,N)
	ret[1]=N
	i=1
	j=0
	while i<N
		while i+j<N&&s[j+1]==s[i+j+1]
			j+=1
		end
		ret[i+1]=j
		if j==0
			i+=1
			continue
		end
		k=1
		while i+k<N&&k+ret[k+1]<j
			ret[i+k+1]=ret[k+1]
			k+=1
		end
		i+=k
		j-=k
	end
	ret
end
const s=chomp(readline())
const t=chomp(readline())
const N=length(s)
const M=length(t)
function make()
	repeat(s,cld(M,N))
end
const now=make()
const AA=Zalgo(t*now*now)
const memo=-ones(Int,N)
const ok=[AA[i+M]>=M for i=1:N]
function dfs(u)
	if memo[u]>=0
		return memo[u]
	elseif memo[u]==-2
		return memo[u]=10^9
	end
	if ok[u]
		memo[u]=-2
		return memo[u]=dfs(mod1(u+M,N))+1
	else
		return memo[u]=0
	end
end
ans=0
for i=1:N
	global ans=max(ans,dfs(i))
end
println(ans<10^9?ans:-1)


Measured memory_bytes: 174796
while True:
  a, op, b = input().split()
  a = int(a)
  b = int(b)
  if op == "?":
    break
  if op == "+":
    c = a + b
  elif op == "-":
    c = a - b
  elif op == "/":
    c = a // b
  elif op == "*":
    c = a * b
  print(c)


Measured memory_bytes: 5592
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;

int N;
int x[10],y[10];

double dist(int i, int j){
    double dx = x[i] - x[j];
    double dy = y[i] - y[j];
    return pow(dx * dx + dy * dy, 0.5);
}

void solve(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin >> N;
    Rep(i, 1, N) cin >> x[i] >> y[i];
    double sum = 0.0;
    Vl v(N);
    rep(i, 0, N) v[i] = i+1;
    do {
        rep(i, 0, N-1) sum += dist(v[i], v[i+1]);
    }while(next_permutation(ALL(v)));
    // next_permutation で辞書順で１つ進めることができる
    int Factorial = 1; //階乗
    Rep(i, 2, N) Factorial *= i;
    cout << fixed << setprecision(10) << sum/Factorial << "\n";
    // fixed は小数点以下を固定する
}


int main() {
    solve();
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define call(var) cout<<#var<<"="<<var<<endl;
#define dup(x,y) (((x)+(y)-1)/(y))
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
const int INTMAX = 2147483647;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

vi Topological_Sort(const Graph &G,vi h){
    stack<int> sta;
    vi ans;
    rep(i,G.size()) if(h[i]==0) sta.push(i);
    while(sta.size()){
        int t = sta.top();sta.pop();
        ans.push_back(t);
        for(auto v : G[t]){
            h[v]--;
            if(h[v]==0) sta.push(v);
        }
    }
    return ans;
}

int main(){
    int n,m;
    cin >> n >> m;
    Graph G(n);
    vi h(n);
    rep(i,m){
        int a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        h[b]++;
    }
    auto v = Topological_Sort(G, h);
    
    vi dp(n+10, 0);
    int ans = 0;
    for(int i : v){
        for(auto e : G[i]){
            dp[e] = max(dp[e], dp[i] + 1);
            chmax(ans, dp[e]);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 7164
import math
n,m = map(int,input().split())

if 2 <= abs(n-m):
    print (0)
elif 1 == abs(n-m):
    print ((math.factorial(n)*math.factorial(m))%((10**9)+7))
elif n == m:
    print ((2*(math.factorial(n)*math.factorial(m)))%((10**9)+7))


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

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

using namespace std;

const int MAX_N=1e5;

int N;
vector<int> G[MAX_N+1];

set<int> leaf;
int dp[MAX_N];

int dfs(int v,int p){
	if (v==N){
		return 1;
	}
	if (dp[v]!=-1){
		return dp[v];
	}
	if (leaf.find(v)!=leaf.end()){
		return dp[v]=0;
	}
	int c=0;
	REP(i,(int)G[v].size()){
		if (G[v][i]!=p){
			if (!dfs(G[v][i],v)){
				c++;
			}
		}
	}
	if (c>=2 || c==0){
		return dp[v]=0;
	}
	int flg=1;
	REP(i,(int)G[v].size()){
		if (G[v][i]!=p){
			if (!dp[G[v][i]]){
				int v2=G[v][i];
				REP(j,(int)G[v2].size()){
					if (G[v2][j]!=v){
						if (!dfs(G[v2][j],v2)){
							flg=0;
						}
					}
				}
			}
		}
	}
	return dp[v]=flg;
}

int main(){
	cin>>N;
	fill(dp,dp+N,-1);
	REP(i,N-1){
		int a,b;
		cin>>a>>b;
		a--;
		b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	FOR(i,1,N){
		if (G[i].size()==1){
			leaf.insert(i);
			G[i].push_back(N);
		}
	}
	if (dfs(0,-1)){
		cout<<"Second"<<endl;
	}else{
		cout<<"First"<<endl;
	}
	return 0;
}


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

int main()
{
	int k;
	int a[1000];
	cin >> k;
	for (int i = 0; i < k; i++){
		cin >> a[i];
	}
	for (int i = 0; i < k; i++){
		for (int j = 0; j<i; j++){
			int h = a[i];
			if (a[i] < a[j]){
				for (int s = i; s > j; s--){
					a[s] = a[s - 1];
				}
				a[j] = h;
				break;
			}
		}
		bool t = false;
		for (int z = 0; z < k; z++){
			if (t)cout << ' ';
			cout << a[z];
			t = true;
		}cout << endl;
	}
	return 0;
}




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

const int INF = 1e9+5;

void print(std::vector<std::vector<int> > A){
	for(int i = 0; i<A.size(); i++){
		for(int j = 0; j<A[i].size(); j++){
			cout<<A[i][j]<<" ";
		}
		cout<<endl;
	}
	cout<<endl;
}

int max_points(std::vector<std::vector<int> > A){
	// int maxm = *max_element(A[0].begin(), A[0].end());
	// int overall_maxm = 0;
	// int idx;
	// std::vector<std::vector<bool> > visited(A.size(), std::vector<bool>(3, 0));
	// for (int i = 0; i < A[0].size(); ++i)
	// {
	// 	/* code */
	// 	if(A[0][i] = maxm)
	// 		idx = i;
	// }
	// visited[0][idx] = 1;
	// for(int i = 1; i<A.size(); i++){
	// 	for(int j = 0; j<A[i].size(); j++){
	// 		if(visited[i-1][j] == 0){
	// 			maxm = max(maxm, A[i][j]);
	// 			visited[i][j] = 1;
	// 			cout<<i<<" "<<j<<" maxm:"<<maxm<<endl;
				
	// 		}
	// 	}
	// 	cout<<i<<" maxm: "<<maxm<<" overall_maxm: "<<overall_maxm<<endl;
	// 	overall_maxm += maxm; 
	// }
	
	// return overall_maxm;

	std::vector<std::vector<int> > ans(A.size(), std::vector<int> (3, 0));

	for(int i = 0; i<A[0].size(); i++){
		ans[0][i] = A[0][i];
	}

	for(int i = 1; i<A.size(); i++){
		for(int j = 0; j<A[i].size(); j++){
			ans[i][j] = A[i][j]+max(ans[i-1][(j+1)%3], ans[i-1][(j+2)%3]);
			// cout<<ans[i][j]<<endl;
		}
	}
	// cout<<endl;
	// print(ans);
	return *max_element(ans[A.size()-1].begin(), ans[A.size()-1].end());
}

int main(){
	int n;
	cin>>n;
	std::vector<std::vector<int> > v(n, std::vector<int>(3, 0));
	for(int i = 0; i<n; i++){
		for(int j = 0; j<3; j++){
			int val;
			cin>>val;
			v[i][j] = val;
		}
	}

	int ans = max_points(v);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 16640
function Main(input) {
	var inputArr = input.split("\n");

    var intArr = inputArr.map( str => parseInt(str, 10) );
    var n = intArr[0];
  　intArr.shift();
    intArr.pop();
    var max = 0;
    var next = 0;
  　for(var v of intArr) {
      if (max <= v) {
         next = max;
         max = v;
      } else if (next <= v) {
         next = v;
      }
    }
  　for(var v of intArr) {
        console.log(max === v ? next : max);
    }
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 38240
#include<stdio.h>

int main(void)

{

int a,b,d,r;

double f;

scanf("%d",&a);

scanf("%d",&b);

d=a/b;

r=a%b;

f=(double)a/(double)b;

printf("%d %d %lf\n",d,r,f);

return 0;
}

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

int main() {
    int n;
    cin >> n;
    map<string, int> mp;
    rep(i, n) {
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        mp[s]++;
    }
    ll ans = 0;
    for (auto& p : mp) {
        int sec;
        sec = p.second;
        ans += (ll)sec*(sec - 1) / 2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (((a)%mod) * ((b)%mod)) % mod
#define rollcall cout << "I'm Sucu." << endl;
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// debug
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p){
  os << "(" << p.first << "," << p.second << ")";return os;
}
template <typename T, typename U, typename V>
ostream &operator<<(ostream &os, const tuple<T, U, V> &t){
  os << "(" << get<0>(t) << "," << get<1>(t) << "," << get<2>(t) << ")";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for (auto it = v.begin();it != v.end();++it){
    if(it != v.begin())os << " ";os << *it;
  }return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp){
  for(auto x: mp)os << "(" << x.first << "," << x.second << ")" << endl;
  return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void PRINTF(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void PRINTF(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}
string substr(const string &str, int S1, int S2 = -1){
  if(S2 == -1)return str.substr(S1);
  return str.substr(S1, S2-S1);
}
// typedef
typedef complex<double> Point;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef tuple<int, int, int> TT;
typedef pair<int, TT> PT;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;
// int sum = accumulate(a, a+n, 0LL);
// int mx = max_element(a, a+n);
// int mn = min_element(a, a+n);
// int cnt = count(a, a+n, k);



signed main(){
  int a, b;cin >> a >> b;
  cout << (a*3 + b) / 2;
  return 0;
}






Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string.h>
#include <stdio.h>
using namespace std;
#define ll long long
int main(int argc, char const *argv[])
{
    char str[5];
    scanf("%s", str);
    int sum = 0;
    for (int i = 0; i < 4; i++) {
        if (str[i] == '+') 
            sum++;
        else
            sum--;
    }
    printf("%d\n", sum);


    return 0;
}

Measured memory_bytes: 256
//-- Araz Jabrayilov --
//-- araz17---zuna#1041 --

#include <bits/stdc++.h>

#define ll long long
#define endl '\n'
#define F first
#define S second

using namespace std;



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

    int a = 0, b = 0;
    int x = 0;

    cin >> k >> a >> b;

    for(int i = a ; i <= b; i++){
        if(i % k == 0){
            cout << "OK" << endl;
            return 0;
        }
    }

    cout << "NG" << endl;

    return 0;
}



Measured memory_bytes: 3668
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long A,B,K;
    cin>>A>>B>>K;
    if(K>=A+B)cout<<0<<" "<<0;
    else if(K>=A)cout<<0<<" "<<B-K+A;
    else cout<<A-K<<" "<<B;
    cout<<endl;

}

Measured memory_bytes: 256
#include<stdio.h>

int main() {

  char S[100], T[100];
  int i = 0;
  int result = 0;
  scanf("%s", S);
  scanf("%s", T);

  while(S[i] != '\0'){
    if(S[i] != T[i]){
      printf("No");
      result = 1;
      break;
    }
    i++;
  }

  if(result == 0){
    printf("Yes");
  }

  return 0;
}

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

using namespace std;

//#define int long long
#define ll long long
//#define int unsigned long long

const int mod = 1e9 + 7;





signed main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //------<<<<>>>>-----//
  // freopen ("C:\\Users\\Andrey\\CLionProjects\\untitled1\\input.txt","r",stdin);
    //freopen ("C:\\Users\\Andrey\\CLionProjects\\untitled1\\output.txt","w",stdout);
    int a,b;
    cin>> a>> b;
    if(a >=10 || b >= 10){
        cout << -1;
        return 0;
    }
    int ans = a * b;
    cout << ans;
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  if (A <= B) {
    cout << A * C << endl;
  } else {
    cout << B * C + (A - B) * D << endl;
  }
}

Measured memory_bytes: 256