akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstring>
#define rep(i,a,b) for(register int i=a;i<=b;++i)
using namespace std;
const int N=3500,mod=1e9+7;
int n,m,ans;
int f[N][N][2];
inline void inc(int &x,int y){
	x+=y;
	if(x>=mod)
		x-=mod;
}
int main(){
	scanf("%d%d",&n,&m);
	rep(i,1,n)
		f[0][i][0]=1;
	f[0][0][1]=1;
	rep(i,1,m)
		rep(j,0,n){
			if(j){
				inc(f[i][j-1][1],f[i-1][j][1]);
				if(j==1)inc(f[i][j-1][1],f[i-1][j][0]);
				else inc(f[i][j-1][0],f[i-1][j][0]);
				
				inc(f[i][j][1],f[i-1][j][1]);
				if(j==1)inc(f[i][j][1],f[i-1][j][0]);
				else inc(f[i][j][0],f[i-1][j][0]);
			}
			if(j<n){
				inc(f[i][j+1][1],f[i-1][j][1]);
				inc(f[i][j+1][0],f[i-1][j][0]);
				
				inc(f[i][j][1],f[i-1][j][1]);
				inc(f[i][j][0],f[i-1][j][0]);
			}
		}
	rep(i,0,n)
		inc(ans,f[m][i][1]);
	printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 84096
<?php
fscanf(STDIN, "%d", $n);
$d = explode(' ', fgets(STDIN));
$count = 0;
for($i=0; $i<$n; $i++){
	for($j=$i+1; $j<$n; $j++){
		$count += $d[$i]*$d[$j];
	}
}
echo $count;

Measured memory_bytes: 4084
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#include<complex>
#include<bitset>
#include<chrono>
#include<boost/multiprecision/cpp_int.hpp>
#define int int64_t
#define uint uint64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define Min(x) *min_element(ALL(x))
#define Max(x) *max_element(ALL(x))
#define Unique(L) (L.erase(unique(ALL(L)), L.end()))
#define veccat(v1, v2) std::copy((v2).begin(),(v2).end(),std::back_inserter(v1)/*v1の後ろにv2を入れる*/)
#define intmax (std::numeric_limits<int64_t>::max() / 4)
using namespace std;
typedef boost::multiprecision::cpp_int bigint;
const double EPS = 1e-9;
const double PI = acos(-1.0);



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

	int N;
	cin >> N;
	if (N <= 999)cout << "ABC" << endl;
	else cout << "ABD" << endl;


	return 0;
}



Measured memory_bytes: 256
# Author: cr4zjh0bp
# Created: Thu Mar 12 20:28:00 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

N, A, B = na()

print(min(N * A, B))

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

int gcd(int a, int b) {
  if(a % b == 0) return b;
  else return (gcd(b, a % b));
}

int main() {
  int K;
  cin >> K;
  int S = 0;
  for(int i = 1; i < K + 1; i++) {
    for(int j = 1; j < K + 1; j++) {
      for(int k = 1; k < K + 1; k++) {
        S += gcd(gcd(i, j), k);
      }
    }
  }
  cout << S << endl;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long r,d,x;
  cin>>r>>d>>x;
  long long y=0;
  for(long long i=0;i<10;i++)
  {
    y=(r*x)-d;
    cout<<y<<endl;
    x=y;
  }
  return 0;
}

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


int main(){

    
    int w, a, b;


    cin >> w >> a >> b;


    if( a == b ) cout << 0 << endl;


    if( a < b ){

        if( b <= a + w ) cout << 0 << endl;

        else cout << b - ( a + w ) << endl;

        }

    else if( a > b ){

             if( a <= b + w ) cout << 0 << endl;

             else cout << a - ( b + w ) << endl;

             }


    return 0;

    }


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<map>
#include<queue>
#include<vector>
#include<stack>
#define inf 0x3f3f3f
#define mem(i,a) memset(i,a,sizeof(i))
using namespace std;
typedef long long ll;
typedef double db;
const int mod = 1e9;
const int maxn = 1e4+5;
int s,w;
int main(){
	scanf("%d%d",&s,&w);
	if(s > w)
		printf("safe\n");
	else
		printf("unsafe\n");
	return 0;
}


Measured memory_bytes: 3164
#include <algorithm>
#include <iostream>
#include <queue>
using namespace std;

int main() {
  int N, K;
  string line;
  cin >> N >> K;
  cin >> line;
  int now = 1;
  int cnt = 0;
  vector<int> lines;
  for (int i = 0; i < N; i++) {
    if (line[i] == (char)('0' + now)) {
      cnt++;
    } else {
      lines.push_back(cnt);
      now = 1 - now;
      cnt = 1;
    }
  }
  if (cnt != 0) {
    lines.push_back(cnt);
  }
  if (lines.size() % 2 == 0) {
    lines.push_back(0); // 1-0-1-0-1-...-0-1
  }
  ///
  int add = 2*K+1;
  int ans = 0;
  for (int i = 0; i < lines.size(); i+=2) {
    int tmp = 0;
    int left = i;
    int right = min(i + add, (int)lines.size());
    for (int j = left; j < right; j++) {
      tmp += lines[j];
    }
    ans = max(tmp, ans);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1020
#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string N;
  cin >> N;
  ll L = N.size();
  ll K;
  cin >> K;
  vector<vector<ll>> dp(K + 1, vector<ll>(2, 0));
  dp.at(0).at(0) = 1;
  for (ll i = 0; i < L; ++i) {
    vector<vector<ll>> temp(K + 1, vector<ll>(2, 0));
    for (ll j = 0; j < K; ++j) {
      if (N.at(i) == '0') {
        temp.at(j).at(0) += dp.at(j).at(0);
        temp.at(j + 1).at(1) += dp.at(j).at(1) * 9;
        temp.at(j).at(1) += dp.at(j).at(1);
      }
      else {
        temp.at(j + 1).at(0) += dp.at(j).at(0);
        temp.at(j + 1).at(1) += dp.at(j).at(1) * 9 + dp.at(j).at(0) * (ll)(N.at(i) - '1');
        temp.at(j).at(1) += dp.at(j).at(1) + dp.at(j).at(0);
      }
    }
    temp.at(K).at(0) += dp.at(K).at(0);
    temp.at(K).at(1) += dp.at(K).at(1);
    dp = temp;
    // for (ll i = 0; i <= K; ++i) {
    //   for (ll j = 0; j < 2; ++j) {
    //     cout << dp.at(i).at(j) << " ";
    //   }
    //   cout << "\n";
    // }
  }
  cout << dp.at(K).at(0) + dp.at(K).at(1) << "\n";
}


Measured memory_bytes: 3592
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var A = cin.ReadInt;
            var B = cin.ReadInt;

            var ans = -1;
            if (A >= 1 && A <= 9 && B >= 1 && B <= 9)
            {
                ans = A * B;
            }

            Console.WriteLine(ans);
        }
    }


    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 13268
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define PI 3.14159265358979323846
#define int64 long long
#define uint64 unsigned long long
#define coutfix(i) cout << fixed << setprecision(i)		//coutの浮動小数出力の桁数設定
using namespace std;

int main()
{
	int64 nn, dd, tmp;
	cin >> nn >> dd;
	tmp = nn / (2 * dd + 1);
	if(nn % (2 * dd + 1) != 0)
	{
		tmp++;
	}
	cout << tmp << endl;
	return 0;
}

Measured memory_bytes: 3640
package main

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

type stack struct {
	top int
	ary []int
}

func (s *stack) push(v int) {
	s.ary[s.top] = v
	s.top++
}

func (s *stack) pop() int {
	v := s.ary[s.top-1]
	s.top--
	return v
}

// スタック
func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	inputs := strings.Split(sc.Text(), " ")
	s := stack{top: 0, ary: make([]int, len(inputs))}
	for _, v := range inputs {
		n, err := strconv.Atoi(v)
		if err == nil {
			s.push(n)
			continue
		}
		switch v {
		case "+":
			v1 := s.pop()
			v2 := s.pop()
			s.push(v2 + v1)
		case "-":
			v1 := s.pop()
			v2 := s.pop()
			s.push(v2 - v1)
		case "*":
			v1 := s.pop()
			v2 := s.pop()
			s.push(v2 * v1)
		}
	}
	fmt.Println(s.ary[0])
}



Measured memory_bytes: 1108
#j-i==a[j]+a[i]
#j-a[j]==a[i]+i

n=int(input())
a=list(map(int,input().split()))
import collections 
d=collections.defaultdict(int)
ans=0

for i in range(n):
    left=i-a[i]
    ans+=d[left]
    d[a[i]+i]+=1
    
print(ans)
    


Measured memory_bytes: 61612
#include <iostream>
#include <stdio.h>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <functional>
#include <list>
#include <utility>
#include <map>
#include <vector>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll, ll> Pll;
typedef pair<int, Pii > P1;

#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define mp1(a,b,c) P1(a,P(b,c))
#define get_arsize(a) (sizeof(a)/sizeof(a[0]))
const ll mod = 1000000007;
const double eps = 1e-10;
const int MAX = 200000;

int main() {
  std::string a,b,c;
	cin >> a >> b >> c;
  a = a[0] - 0x20;
  b = b[0] - 0x20;
  c = c[0] - 0x20;
	cout << a << b << c << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>

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

using namespace std;

int main () {
  int i;
  long min = 1000000, max = -1000000, sum = 0, n, a;
  cin >> n;
  rep(i,n) {
    cin >> a;
    if (min > a) min = a;
    if (max < a) max = a;
    sum = sum + a;
  }
  cout << min << " " << max << " " << sum <<  endl;
}

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

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



Measured memory_bytes: 3116
#include<iostream>

using namespace std;

int main(){
	int a=0,b=0;
	for(int i=0;i<4;i++){
		int x;
		cin>>x;
		a+=x;
	}
	for(int i=0;i<4;i++){
		int x;
		cin>>x;
		b+=x;
	}
	cout<<max(a,b)<<endl;
}

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

#include <iostream>
using namespace std;
int main() {
  int k;
  cin >> k;
  string s;
  cin >> s;
  if (s.size() <= k) {
    cout << s << endl;
  } else {
    for (size_t i = 0; i < k; i++) {
      cout << s[i];
    }
    cout << "..." << endl;
  }
  return 0;
}


Measured memory_bytes: 3628
n = int(input())
s = input()
r = s.count('R')
g = s.count('G')
b = s.count('B')

cnt = r*g*b

for i in range(n):
    j = 1
    while i+2*j < n:
        if s[i] != s[i+j] and s[i+j] != s[i+2*j] and s[i+2*j] != s[i]:
            cnt -= 1
            j += 1
        else:
            j += 1
print(cnt)


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

using namespace std;

int main(){
	string s;
	string s1;
	cin>>s>>s1;
	int sum=0;
	for(int i=0;i<3;i++){
		if(s[i]==s1[i])
		sum++;
	}
	cout<<sum; 
} 

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

using namespace std;

int main() {
    int a, l;
    vector<int> series;
    while (true) {
        series.clear();
        cin >> a >> l;
        if (a == 0 && l == 0) {
            break;
        }
        for (int n=0; true; n++) {
            bool is_found = false;
            for (vector<int>::iterator iter=series.begin(); iter!=series.end(); iter++) {
                if (*iter == a) {
                    cout << iter-series.begin() << ' ' << a << ' ' << n-(int)(iter-series.begin()) << endl;
                    is_found = true;
                    break;
                }
            }
            if (is_found) {
                break;
            }
            series.push_back(a);
            vector<char> digit;
            for (int d=0, i=1; d<l; d++, i*=10) {
                digit.push_back((a/i)%10);
            }
            sort(digit.begin(), digit.end());
            int min = 0;
            int max = 0;
            for (vector<char>::iterator iter=digit.begin(); iter!=digit.end(); iter++) {
                min = min*10+(*iter);
            }
            for (vector<char>::reverse_iterator iter=digit.rbegin(); iter!=digit.rend(); iter++) {
                max = max*10+(*iter);
            }
            a = max-min;
        }
    }
    return 0;
}

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

// --------------------------------------------------------------------------------
#define fast_IO	ios_base::sync_with_stio(false),cin.tie(NULL),cout.tie(NULL);
#define ll long long 
#define mset(arr,val) memset(arr,val,sizeof(arr))
#define deb(name,value) cout <<"->>  "<<name<< "= " <<value<<" "
#define frepi(a,b,k) for(int i=a;i<=b;i+=k)
#define frepj(a,b,k) for(int j=a;j<=b;j+=k)
// --------------------------------------------------------------------------------


void solve()
{
 	int n;cin>>n;
 	bool isZero = false;
 	long long arr[n];   
 	frepi(0,n-1,1)
 	{
 		cin>>arr[i];
 		if(arr[i]==0)isZero=true;
 	}
 	if(isZero){
 		cout<<"0\n";
 		return ;
 	}
 	ll prod = 1;
 	frepi(0,n-1,1)
 	{
 		if(arr[i]<=(1000000000000000000)/(prod))
 			prod*=arr[i];
 		else
 		{
 			cout<<"-1\n";
 			return;
 		}
 	}
 	cout<<prod;
}

int main()
{
	// #ifndef ONLINE_JUDGE
 //    	freopen("/home/suryakant/input.txt","r",stdin);
 //        freopen("/home/suryakant/output.txt","w",stdout);
 //    #endif
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve();
    }
    
}

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

using namespace std;

typedef long long ll;
#define sint(a) scanf("%d",&a)
#define sint2(a,b) scanf("%d %d",&a,&b)
#define sll(a) scanf("%lld",&a)
#define sll2(a,b) scanf("%lld %lld",&a,&b)
#define mem(a,i) memset(a,i,sizeof(a))

const double pi=acos(-1);
const int maxn=1e6+10;
const int mod=1e9+7;

int main()
{
    string s;
    cin>>s;
    for(int i=0;i<s.length();i++)
        printf("x");
    return 0;
}


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

int main(void){
    int n;
    cin >> n;
    vector<int> cnt(100, 0);
    for(int i=0; i<n; i++){
        int m;
        cin >> m;
        cnt.at(m-1)++;
    }
    int ans = 0;
    for(int i=0; i<100; i++){
        if(cnt.at(i) > 0){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD 1000000007
#define INF 1LL<<60
 
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>void prt(T x){cout << x << endl;}
template<class T>void prtvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} cout << a[a.size()-1] << endl;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int cnt=0;
void merge(vector<int>& A, int left, int mid, int right){
    int n1=mid-left, n2=right-mid;
    vector<int> L(n1+1), R(n2+1);
    rep(i, n1) L[i] = A[left+i];
    rep(i, n2) R[i] = A[mid+i];
    L[n1]=INT32_MAX; R[n2]=INT32_MAX;
    int li=0, ri=0;
    FOR(i, left, right){
        cnt++;
        if(L[li] <= R[ri]){
            A[i] = L[li];
            li++;
        }else{
            A[i] = R[ri];
            ri++;
        }
    }
}
void mergeSort(vector<int>& A, int left, int right){
    if(left+1<right){
        int mid = (left+right)/2;
        mergeSort(A, left, mid);
        mergeSort(A, mid, right);
        merge(A, left, mid, right);
    }
}

int main(){
    int n; cin>>n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    mergeSort(a, 0, a.size());

    prtvec(a);
    prt(cnt);
    return 0;
}


Measured memory_bytes: 6804
#include<iostream>
#include<string>
using namespace std;
int main(){


int n;
int x;
cin >> n >> x;

if((n*2-1)>x&&x>1){
cout << "Yes" << endl;
for(int i=(x+n)%(2*n-1); i < n*2; i++){
  if(i==0){
    i = (2*n-1);
  }
    cout << i << endl;
  }
  for(int i=1; i <(x+n)%(2*n-1); i++){
      cout << i << endl;
    }
    if((x+n)%(2*n-1)==0){
      for(int i=1; i <(2*n-1); i++){
          cout << i << endl;
        }
    }

}else{
    cout << "No" << endl;
}
}

Measured memory_bytes: 1536
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<cstring>
#include<utility>
#include<algorithm>
#include<functional>
#include<deque>
#include<ctype.h>
#include<time.h>
#include<stdlib.h>
using namespace std;


int main(){
   int n, ans = 0;
   cin >> n;
   int a[n];
   for (int i = 0; i < n; i++) cin >> a[i];
   sort(a, a+n);
   reverse(a, a+n);
   for (int i = 0; i < n; i++){
      ans += a[i]*(i%2==0 ? 1 : -1);
   }
   cout << ans << endl;
}


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

typedef long long ll;

#define M 1000000007

int n, m;
int dp[1001][1001];
vector<vector<char>> arr;

int solve(int i, int j) {
    if(i > n)
        return 0;
    if(j > m)
        return 0;
    if(arr[i][j] == '#')
        return 0;
    if(i == n && j == m)
        return 1;
    if(~dp[i][j])
        return dp[i][j];
    
    return dp[i][j] = (solve(i+1, j)%M + solve(i, j+1)%M)%M;
}

int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    
    memset(dp, -1, sizeof dp);
    cin >> n >> m;
    arr = vector<vector<char>>(n+1, vector<char>(m+1));
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
            cin >> arr[i][j];

    cout << solve(1, 1)%M << "\n";
    
    return 0;
}

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

using namespace std;

typedef long long ll;

int main () {
	ll n;
	string m;
	ll i, j;
	ll ret;
	
	cin >> n;
	
	map<string, ll> mp = {
		{"AC", 0},
		{"WA", 0},
		{"TLE", 0},
		{"RE", 0}
	};
	
	for ( i = 0; i < n; i++ ) {
		cin >> m;
		mp[m]++;
	}
	
	cout << "AC x " << mp["AC"] << endl;
	cout << "WA x " << mp["WA"] << endl;
	cout << "TLE x " << mp["TLE"] << endl;
	cout << "RE x " << mp["RE"] << endl;
	

	return 0;
}

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

using namespace std;

int main(){
  int tmp;
  
  for(int i=0;i<5;i++){
    cin >> tmp;
    if(tmp == 0){
      i++;
      cout << i << endl;
      return 0;
    }
  }
  
  return 0;
}

Measured memory_bytes: 3444
#include<set>
#include<map>
#include<deque>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<string>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<complex>
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;
 
const int maxn = 1e7+10;
const int maxm = 210;
 
int p[4100000],pri;
bool v[maxn];
 
void pre()
{
    for(int i=2;i<maxn;i++)
    {
        if(!v[i]) p[++pri]=i;
        for(int j=1,k=i*p[j];j<=pri;j++,k=i*p[j])
        {
            if(k>=maxn) break;
            v[k]=true;
            if(i%p[j]==0) break;
        }
    }v[1]=v[2]=true;
}
 
int n,m;
int a[maxm],b[maxm];
bool s[maxn];
int p1[maxm],p2[maxm];
int p1n,p2n;
 
bool mp[maxm][maxm],ev[maxm];
int match[maxm],bel[maxm];
bool Find(const int x)
{
    if(ev[x]) return false;
    ev[x]=true;
    for(int i=1;i<=p2n;i++) if(mp[x][i])
    {
        if(!bel[i]||Find(bel[i])) { bel[i]=x; return true; }
    }
    return false;
}
 
int main()
{
    pre();
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]),s[a[i]]=true;
    for(int i=1;i<maxn;i++)
        if(s[i]!=s[i-1]) b[++m]=i;
 
    for(int i=1;i<=m;i++)
    {
        if(b[i]&1) p1[++p1n]=b[i];
        else p2[++p2n]=b[i];
    }
    for(int i=1;i<=p1n;i++)
    {
        for(int j=1;j<=p2n;j++) if(!v[abs(p1[i]-p2[j])]) mp[i][j]=true;
    }
    int k=0;
    for(int i=1;i<=p1n;i++)
    {
        for(int j=1;j<=p1n;j++) ev[j]=false;
        if(Find(i)) k++;
    }
    p1n-=k; p2n-=k;
    int re=k;
    re+=p1n/2*2+p2n/2*2;
    re+=p1n%2*3;
     printf("%d\n",re);
    return 0;
}

Measured memory_bytes: 20864
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
using namespace std;
typedef long long ll;

int main(){
    int N;
    cin >> N;
    ll a[N];
    ll sum[N + 1];
    sum[0] = 0;
    for(int i = 0; i < N; i++){
        cin >> a[i];
        sum[i + 1] = sum[i] + a[i];
    }

    int l[N]; //真ん中の切れ込みがiのときの最適な左の切れ込みの位置
    int r[N]; //真ん中の切れ込みがiのろきの最適な右の切れ込みの位置

    l[2] = 1;
    for(int i = 3; i < N - 1; i++){
        l[i] = l[i - 1];
        while(true){
            if(l[i] == i - 1) break;
            else {
                if(abs(sum[i] - 2 * sum[l[i]]) > abs(sum[i] - 2 * sum[l[i] + 1])){
                    l[i]++;
                } else {
                    break;
                }
            }
        }
    }

    r[N - 2] = N - 1;
    for(int i = N - 3; i >= 2; i--){
        r[i] = r[i + 1];
        while(true){
            if(r[i] == i + 1) break;
            else {
                ll x = abs((sum[N] - sum[r[i]]) - (sum[r[i]] - sum[i]));
                ll y = abs((sum[N]) - sum[r[i] - 1]) - (sum[r[i] - 1] - sum[i]);
                if(y < x) r[i]--;
                else break;
            }
        }
    }

    /*
    for(int i = 0; i < N; i++){
        cout << i << " " << l[i] << " " << r[i] << endl;
    }*/

    ll ans = (1LL << 60);
    for(int i = 2; i < N - 1; i++){
        vector<ll> v;
        v.push_back(sum[l[i]]);
        v.push_back(sum[i] - sum[l[i]]);
        v.push_back(sum[r[i]] - sum[i]);
        v.push_back(sum[N] - sum[r[i]]);

        ll d = *max_element(v.begin(), v.end()) - *min_element(v.begin(), v.end());
        ans = min(ans, d);
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;

int gcd(int x, int y) {
    if (x > y) { swap(x, y); }
    if (y % x == 0) { return x; }
    return gcd(y % x, x);
}

int main() {
    int x, y;
    cin >> x >> y;
    cout << gcd(x, y) << endl;
}

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

int main() {
  int N;
  cin>>N;
  vector<int> v(N);
  for(int i=0;i<N;i++){
    cin>>v.at(i);
  }
  sort(v.begin(),v.end());
  int m=0;
  for(int i=0;i<N-1;i++){
    if(v.at(i)-v.at(i+1)==0)m++;
  }
  cout<<N-m<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 1000000007; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;


signed main() {
  string s;
  cin >> s;

  int ans = s.size();

  int cnt1 = 0, cnt2 = 0;
  bool flag = false;
  REP(i, s.size()){
    if(s[i] == 'S' || i == s.size()-1){
      if(s[i] == 'T'){
        cnt2++;
        flag = true;
      }
      if(flag){
        ans -= min(cnt1, cnt2)*2;
        cnt1 -= min(cnt1, cnt2); cnt2 = 0;
      }
      cnt1++;
      flag = false;
    }else if(s[i] == 'T'){
      cnt2++;
      flag = true;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 640
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class ABC102_A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();

            if (n % 2 == 0) {
                out.print(n);
            } else {
                out.print(n * 2);
            }
        }

    }
}



Measured memory_bytes: 22612
#include<bits/stdc++.h>
using namespace std;
long long arr[1000000];
int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);   
    long long i,n,sum,x;
    cin>>n;
    sum=0;
    x=0;
    i=1;
    while (i<=n)
    {
    	if (i%3!=0 && i%5!=0)
    	{
    		sum+=i;
		}
		i++;
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 3648
N = int(input())
A = [None]*N
says = [None]*N

def be_honset(man, honests):
    for i in range(N):
        #正直者だけで考える
        if i+1 in honests:
            for j in range(A[i]):
                if says[i][j][1] == 0 and says[i][j][0] in honests:
                    return False 
                if says[i][j][1] == 1 and says[i][j][0] not in honests:
                    return False
                
    return True

for i in range(N):
    A[i] = int(input())
    say = []
    for j in range(A[i]):
        say.append([int(i) for i in input().split()])
    says[i] = say
    
max_num = 0

for i in range(1 << N):
    honests = []
    exist = True
    for j in range(N):
        if ((i>>j) & 1) == 1:
            honests.append(j+1)
    
    #　存在しないならFalse
    for h in honests:
        if not be_honset(h, honests): 
            exist = False
            break
        
    if not exist: continue
    num = len(honests)
    if num > max_num: max_num = num
    
print(max_num)



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

int main() {
    int n,a,x;
    x=1;
    cin>>n;
    
    vector<int> vec(n);
    
   for(int i=0;i<n;i++){
       //cout<<vec.size()<<endl;
       cin>>a;
       if(x==a){
           vec.at(x-1)=a;
           x++;
       }
   }
   
    if(x==1){
        cout<<-1<<endl;
    }else{
        cout<<n-x+1<<endl;
    }
    
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(ll i = n;i >= 0;--i)
#define FOR(i,m,n) for(ll i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;
 
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main(void)
{
    ll rc = 0;
    string s;
    cin >> s;
    string ma = "";
    string se = "";
    ll q;
    cin >> q;
    REP(i,q){
        ll t;
        cin >> t;
        if(t == 1){
            rc++;
        }
        else{
            ll f;
            string c;
            cin >> f >> c;
            if(f == 1){
                if(rc % 2 == 0){
                    se += c;
                }
                else{
                    ma += c;
                }
            }
            else{
                if(rc % 2 == 0){
                    ma += c;
                }
                else{
                    se += c;
                }
            }
        }
    }

    reverse(all(se));
    s = se + s + ma;

    if(rc % 2 == 1){
        reverse(all(s));
    }

    cout << s << endl;

    return 0;
}

Measured memory_bytes: 1436
#include <bits/stdc++.h>
#include <boost/range/adaptor/reversed.hpp>
#include <boost/range/algorithm/sort.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using boost::irange;
using boost::sort;
using boost::adaptors::reversed;

struct mint {
    static constexpr long MOD = 1000000007;
    long value;

    constexpr mint(long value = 0) noexcept : value((value % MOD + MOD) % MOD) {}
    constexpr mint operator-() const noexcept {
        return mint(-value);
    }
    constexpr mint& operator+=(const mint& rhs) noexcept {
        if ((value += rhs.value) >= MOD) value -= MOD;
        return *this;
    }
    constexpr mint& operator-=(const mint& rhs) noexcept {
        if ((value += MOD - rhs.value) >= MOD) value -= MOD;
        return *this;
    }
    constexpr mint& operator*=(const mint& rhs) noexcept {
        (value *= rhs.value) %= MOD;
        return *this;
    }
    constexpr mint operator+(const mint& rhs) const noexcept {
        mint res(*this);
        return res += rhs;
    }
    constexpr mint operator-(const mint& rhs) const noexcept {
        mint res(*this);
        return res -= rhs;
    }
    constexpr mint operator*(const mint& rhs) const noexcept {
        mint res(*this);
        return res *= rhs;
    }
    constexpr mint pow(long e) const noexcept {
        if (e == 0) return 1;
        mint a = pow(e >> 1);
        a *= a;
        if (e % 2 == 1) a *= *this;
        return a;
    }
    constexpr mint inv() const noexcept {
        return pow(MOD - 2);
    }
    constexpr mint& operator/=(const mint& rhs) noexcept {
        return *this *= rhs.inv();
    }
    constexpr mint operator/(const mint& rhs) const noexcept {
        mint res(*this);
        return res /= rhs;
    }
    friend constexpr mint pow(const mint& a, const long& b) noexcept {
        return a.pow(b);
    }
    friend ostream& operator<<(ostream& os, const mint& n) noexcept {
        os << n.value;
        return os;
    }
};

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


Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int x = scan.nextInt();
		int[] place=new int[m];
		for(int i=0;i<m;i++){
			place[i]=scan.nextInt();
		}
		int num1=0;
		for(int i=0;i<m;i++){
			if(place[i]<x){
				num1++;
			}
		}
		int num2=0;
		for(int i=0;i<m;i++){
			if(place[i]>x){
				num2++;
			}
		}
		if(num1<num2){
			System.out.println(num1);
		} else {
			System.out.println(num2);
		}
	}
}


Measured memory_bytes: 21844
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef int64_t LL;
typedef uint64_t ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
template<class T, class... U> void DEBUG(const T &head, const U &... tail) { 
#ifdef HOME
    _W('#'); _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...);
#endif
}
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
void NO(){
    puts("No");
    exit(0);
}
int main(){
    int A,B;
    R(A,B);
    string s;
    R(s);
    if(SZ(s)!=A+B+1)NO();
    if(s[A]!='-')NO();
    REP(i,A+B+1){
        if(i==A)continue;
        if(s[i]<'0'||s[i]>'9')NO();
    }
    puts("Yes");
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<math.h>
using namespace std;


int main(){

    int N;
    string S;
    
    cin>>N>>S;
    int data1[26]={};
    int data2[26]={};
    int cut[N]={};
    int cutdata=N/2;
    for (int i =0;i<N/2;i++){
        data1[S[i]%0x61]=1;
    }
    for (int i =N/2;i<N;i++){
        data2[S[i]%0x61]=1;
    }

    int sum=0;
    for (int l=0;l<26;l++){
        if (data1[l]==1 && data2[l]==1){
            sum+=1;
    }}


    int data3[26]={};
    int data4[26]={};
    int add=0;
    for(int i=N/2;i<N;i++ ){
        for(int j=0;j<i;j++){
        data3[S[j]%0x61]=1;}
        for(int j=i;j<N;j++){
           // cout<<j<<endl;
        data4[S[j]%0x61]=1;}

        for (int l=0;l<26;l++){
        if (data3[l]==1 && data4[l]==1){
            add+=1;
    }}

    //cout<<"add "<<add<<endl;

    if(add>=sum){
      // cout<<"ddddd "<<i<<endl;
        sum=add;
    }

    add=0;
        for (int l=0;l<26;l++){
            data3[l]=0;
            data4[l]=0;
    }




    }

 for(int i=N/2;i>0;i-- ){
        for(int j=0;j<i;j++){
        data3[S[j]%0x61]=1;}
        for(int j=i;j<N;j++){
           // cout<<j<<endl;
        data4[S[j]%0x61]=1;}

        for (int l=0;l<26;l++){
        if (data3[l]==1 && data4[l]==1){
            add+=1;
    }}

    //cout<<"add "<<add<<endl;

    if(add>=sum){
      // cout<<"ddddd "<<i<<endl;
        sum=add;
    }

    add=0;
        for (int l=0;l<26;l++){
            data3[l]=0;
            data4[l]=0;
    }




    }



    cout<<sum<<endl;
  





    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>

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

int main(){
    vector<int> num(3);
    cin >> num[0] >> num[1] >> num[2];
    sort(num.begin(), num.end());
    if ( (num[0]&1) == (num[1]&1) && (num[1]&1) == (num[2]&1) && (num[2]&1) == (num[0]&1) ) {
        cout << ( num[2] - num[0] + num[2] - num[1] ) / 2 << endl;
    }
    else if ( (num[0]&1) != (num[1]&1) && (num[1]&1) == (num[2]&1) && (num[2]&1) != (num[0]&1) ) {
        cout << ( num[2] - num[1] ) / 2 + ( num[2] + 1 - num[0] ) / 2 + 1 << endl;  
    }
    else if ( (num[0]&1) == (num[1]&1) && (num[1]&1) != (num[2]&1) && (num[2]&1) != (num[0]&1) ) {
        cout << ( num[1] - num[0] ) / 2 + 1 << endl;  
    }
    else if ( (num[0]&1) != (num[1]&1) && (num[1]&1) != (num[2]&1) && (num[2]&1) == (num[0]&1) ) {
        cout << ( num[2] + 1 - num[1] ) / 2 + 1 + ( num[2] - num[0] ) / 2 << endl;  
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define N_MAX 50

int deck[N_MAX];

void initDeck(int n)
{
  int i;
  for (i = 0; i < n; i++) {
    deck[i] = n - i;
  }
}

void shuffle(int p, int c)
{
  static int buf[N_MAX];
  int i;
  for (i = 0; i < p - 1; i++) {
    buf[i] = deck[i];
  }
  for (i = 0; i < c; i++) {
    deck[i] = deck[p - 1 + i];
  }
  for (i = 0; i < p - 1; i++) {
    deck[c + i] = buf[i];
  }
}

int main()
{
  int n, r, i, p, c;
  for (;;) {
    scanf("%d%d", &n, &r);
    if (n == 0 && r == 0) break;
    initDeck(n);
    for (i = 0; i < r; i++) {
      scanf("%d%d", &p, &c);
      shuffle(p, c);
    }
    printf("%d\n", deck[0]);
  }
  return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <algorithm>
#include <cstring>

using namespace std;
#define MAX_X 5001
#define MAX_Y 5001

bool exists[MAX_Y][MAX_X];

struct Point {
	int x, y;
	Point(int x = 0, int y = 0) : x(x), y(y) {}
	Point operator+(const Point &o) const {
		return Point(x + o.x, y + o.y);
	}
	Point operator-(const Point &o) const {
		return Point(x - o.x, y - o.y);
	}
};

Point rotate_right(const Point &a) {
	return Point(a.y, -a.x);
}

Point rotate_left(const Point &a) {
	return Point(-a.y, a.x);
}

int main() {
	int n;
	while (cin >> n) {
		if (n == 0) break;
		Point pole[n];
		memset(exists, 0, sizeof(exists));
		for (int i = 0; i < n; i++) {
			int x, y;
			cin >> x >> y;
			exists[y][x] = true;
			pole[i] = Point(x, y);
		}
		int max_area = 0;
		for (int i = 0; i < n; i++) {
//			cout << "i: " << i << endl;
			for (int j = 0; j < i; j++) {
				Point p = pole[j] + rotate_right(pole[i] - pole[j]);
				if (0 <= p.y && p.y < MAX_Y &&
				    0 <= p.x && p.x < MAX_X && exists[p.y][p.x]) {
					Point q = p + rotate_right(pole[j] - p);
					if (0 <= q.y && q.y < MAX_Y && 
					    0 <= q.x && q.x < MAX_X && exists[q.y][q.x]) {
						max_area = max((p.x-q.x)*(p.x-q.x) + (p.y-q.y)*(p.y-q.y) , max_area);
					}
				}
				
				p = rotate_left(pole[i] - pole[j]);
				if (0 <= p.y && p.y < MAX_Y &&
				    0 <= p.x && p.x < MAX_X && exists[p.y][p.x]) {
					Point q = p + rotate_left(pole[j] - p);
					if (0 <= q.y && q.y < MAX_Y &&
					    0 <= q.x && q.x < MAX_X && exists[q.y][q.x]) {
						max_area = max((p.x-q.x)*(p.x-q.x) + (p.y-q.y)*(p.y-q.y) , max_area);
					}
				}
			}
		}
		cout << max_area << endl;
	}			
	return 0;
}

Measured memory_bytes: 24000
#include<bits/stdc++.h>
using namespace std;
long long int mylcm(long long int x, long long int y)
{
    long long int lcm=(x*y)/__gcd(x,y);
    return lcm;
}
long long int check(long long int x,long long int c,long long int d)
{
  long long cCount = x/c;
  long long dCount = x/d;
  long long l = x/mylcm(c,d);
  return cCount + dCount - l;
}
int main()
{
    long long int a,b,i,c,d,counter=0,x;
    scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
    x=b-a+1;
    counter=x-(check(b,c,d)-check(a-1,c,d));
    printf("%lld",counter);
    return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

BB = A[:]

BB_P = []
BB_M = []


for b in BB:
    if b < 0:
        BB_M.append(b)
    else:
        BB_P.append(b)

        
ope = []
if not BB_M:
    BB_P = sorted(BB_P)
    p = BB_P[-1]
    m = BB_P[0]
    for b in BB_P[1:-1]:
        ope.append((m,b))
        m = m-b
    ope.append((p,m))
    ans = p - m
elif not BB_P:
    BB_M = sorted(BB_M)
    p = BB_M[-1]
    for b in BB_M[:-1]:
        ope.append((p, b))
        p = p-b
    ans = p
else:
    p = BB_P.pop()
    m = BB_M.pop()
    for b in BB_P:
        ope.append((m ,b))
        m = m-b
    for b in BB_M:
        ope.append((p ,b))
        p = p-b
    ope.append((p,m))
    ans = p-m
    
print(ans)
for x,y in ope:
    print(x, y)


Measured memory_bytes: 64748
#include <bits/stdc++.h>
#define  pb push_back
#define nl "\n"
#define fastScan ios_base::sync_with_stdio(0); cin.tie(NULL);
#define int long long int
using namespace std;
int dp1[123456];
int dp2[123456];
int dp3[123456];
signed main()
{
	fastScan;
	int n;cin>>n;
	for(int i=1;i<=n;i++)
	{
		int a,b,c;cin>>a>>b>>c;
		if(i==1)
		{
			dp1[i]=a;
			dp2[i]=b;
			dp3[i]=c;
		}
		else
		{
			dp1[i]=max(dp2[i-1]+a,dp3[i-1]+a);
			dp2[i]=max(dp1[i-1]+b,dp3[i-1]+b);
			dp3[i]=max(dp1[i-1]+c,dp2[i-1]+c);
		}
	}
	cout<<max(dp1[n],max(dp2[n],dp3[n]))<<nl;
}


Measured memory_bytes: 2560
n = gets.to_i
s = []
t = []
n.times do
  _s, _t = gets.chomp.split(" ")
  s.push(_s)
  t.push(_t.to_i)
end
x = gets.chomp

idx = s.index(x)
puts idx == n - 1 ? 0 : t[(idx + 1)..-1].inject(&:+)

Measured memory_bytes: 1788
use proconio::fastout;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

#[fastout]
fn main() {
    input! {
        mut n: usize,
        m: usize,
        h: [usize; n],
    }
    let mut g = vec![true; n];
    for _ in 0..m {
        input! {
            a: Usize1,
            b: Usize1,
        }
        if h[a] <= h[b] && g[a] {
            g[a] = false;
            n -= 1;
        }
        if h[a] >= h[b] && g[b] {
            g[b] = false;
            n -= 1;
        }
    }

    println!("{}", n);
}


Measured memory_bytes: 5068
def main():
    n, l = map(int, input().split())
    a = list(map(int, input().split()))
    f = False
    idx = -1
    for i in range(n-1):
        if a[i] + a[i+1] >= l:
            f = True
            idx = i+1
            break
    if f:
        print("Possible")
        for i in range(1, idx):
            print(i)
        for i in reversed(range(idx+1, n)):
            print(i)
        print(idx)
    else:
        print("Impossible")

if __name__ == "__main__":
    main()

Measured memory_bytes: 14304
S = input()
N = len(S)
ans = num_a = 0

pre_is_a = True
i = 0
while i < N:
    s = S[i]
    if s == 'A':
        pre_is_a = True
        num_a += 1
    elif s == 'B' and pre_is_a:
        num_bc = 0
        flag = True
        for j in range(i, N-1, 2):
            if S[j:j+2] == 'BC':
                num_bc += 1
            else:
                flag = False
                break
        if num_bc:
            ans += num_a * num_bc
            if flag:
                i = N
            else:
                i = j - 1
        else:
            pre_a = False
            num_a = 0
    else:
        pre_a = False
        num_a = 0

    i += 1

print(ans)

Measured memory_bytes: 9392
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define bFor(i,a,b) for(i=a;i>=b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define pb push_back
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
const ll inf=1LL<<60;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 

double distance(ddatas& x,ddatas& y){
  double a=x.first-y.first,b=x.second-y.second;
  return sqrt(a*a+b*b);
}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

vec modncrlistp,modncrlistm;

ll modncr(ll n,ll r){
  ll i,size=modncrlistp.size();
  if(size<=n){
    modncrlistp.resize(n+1);
    modncrlistm.resize(n+1);
    if(!size){
      modncrlistp[0]=modncrlistm[0]=1;
      size++;
    }
    For(i,size,n+1){
      modncrlistp[i]=modncrlistp[i-1]*i%mod;
      modncrlistm[i]=modinv(modncrlistp[i]);
    }
  }
  return modncrlistp[n]*modncrlistm[r]%mod*modncrlistm[n-r]%mod;
}

ll modpow(ll a,ll n){
  ll res=1;
  while(n){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

vec eratosthenes(ll N){
  ll i;
  vec ch(N+1,1),p;
  ch[0]=ch[1]=0;
  rep(i,N+1){
    if(ch[i]){
      p.pb(i);
      for(ll j=2;i*j<=N;j++){
        ch[i*j]=0;
      }
    }
  }
  return ch;
}
vec primefactorization(ll N){
  ll i=2;
  vec res;
  while(i*i<=N){
    while(!(N%i)){
      res.pb(i);
      N/=i;
    }
    i++;
  }
  if(N-1)res.pb(N);
  return res;
}
vec diviserlist(ll N){
  ll i;
  vec res;
  for(i=1;i*i<N;i++){
    if(N%i==0){
      res.pb(i);res.pb(N/i);
    }
  }
  if(i*i==N)res.pb(i);
  vsort(res);
  return res;
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N,M,ans=1;
  cin>>M>>N;
  vec v=primefactorization(N);
  map<ll,ll> mp;
  for(auto i:v){
    mp[i]++;
    if(mp[i]%M==0)ans*=i;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())

# 何回2をかけると超えるか。
def func1(i, k):
    ans = 0
    num = i
    end = False
    if num >= k:
        return 0
    while(not end):
        ans += 1
        num *= 2
        if num >= k:
            end = True
            break
    return ans


ans = 0
for initial_score in range(1, N+1):
    ans += (1/N) * (1/2) ** func1(initial_score, K)
print(ans)

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

int main(){
     int a,b,c;
     cin >> a>>b>>c;
     if(b-a==c-b) cout << "YES" <<endl;
     else cout << "NO" <<endl; 
          
 }

Measured memory_bytes: 256