akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
 
#define ff first
#define ss second
#define endl "\n"
#define loop(i,s,e) for(int i=s;i<e;i++)
#define int long long
#define mp make_pair
#define pii pair<int,pair<int,int>>
#define mset(a,f)  memset(a , f , sizeof(a))
#define pb push_back
const int N = 2e6 + 6;
const int M = 1e9 + 1;
int A[N];
int B[N];
pii C[N];
int n,m;

bool check(int V)
{
	int cnt = 0;

	loop(i,0,n)
	{
		if(A[i]*B[n-i-1] > V)
		{
			int r = V/B[n-i-1];
			cnt += (A[i]-r);
		}
	}
	return (cnt<=m);
}

int32_t main()
{
  cin >> n >> m;

  int sum = 0;

  loop(i,0,n)
  {
  	cin >> A[i];
  	sum += A[i];
  }
  loop(i,0,n)cin >> B[i];

  sort(A,A+n);
  sort(B,B+n);

  int mx = 0;

  loop(i,0,n)
  {
  	mx = max(A[i]*B[i],mx);
  }

  int s =0;
  int e = mx;

  int ans = 0;

  while(s <= e)
  {
  	int mid = (s+e)/2;
  	if(check(mid))
  	{
  		ans = mid;
  		e = mid-1;
  	}
  	else s = mid+1;
  }

  cout << ans;
}


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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define pb push_back
#define mp make_pair
#define INF 999999999
#define MOD 1000000007
#define sp ' '
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()

//typedef
typedef long long ll;
typedef pair<int, int> pint;
typedef map<int, int> mint;
typedef vector<int> vint;
typedef vector<char> vchr;
typedef vector<long long> vll;
typedef vector<string> vstr;


int mod(int a, int b){return (a%b+b)%b;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll a, ll b, ll c){ll ans=1; rep(i, b){ans=ans*a%c;} return ans;}

template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T>
void dpp(T n){cerr << n << endl;}
template<typename T>
void vpp(T a){rep(i,a.size()){cout << a[i] << endl;}}
template<typename T>
void vdp(T a){rep(i,a.size()){cerr << a[i] << endl;}}

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int ddx[8] = {1,0,-1,0,1,-1,-1,1};
const int ddy[8] = {0,1,0,-1,1,1,-1,-1};




template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}


vector<string> split(const string &str, char sep)
{
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.pb(buffer);
    }
    return v;
}


bool is_prime(ll n){
    if(n == 2) return true;
    if(n == 1 or !(n & 1)) return false;

    random_device rnd;
    ll d = (n-1) >> 1;
    while(!(d&1))
        d >>= 1;

    rep(k, 100){

        ll a = rnd() % (n-1) + 1;
        ll t = d;
        ll y = powMod(a, t, n);

        while(t != (n-1) and y != 1 and y != (n-1)){
            y = powMod(y,2,n);
            t <<= 1;
        }

        if(y != n-1 and !(t & 1)){
            return false;
        }
    }

    return true;
}



int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    ll x, y;
    cin >> x >> y;

    if(x%y == 0){
        ppp(-1);
    }
    else{
        ppp(x);
    }


    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
#define F first
#define S second
#define pb push_back
#define mp make_pair 
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define rrep(i,a,b) for(int i = a; i >=b; i--)
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define sq(a) (a)*(a)
#define nl "\n"
#define all(x) (x).begin(),(x).end()
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,
//tree_order_statistics_node_update> indexed_set;

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
using ii = pair<int, int>;
using pli = pair<ll, int>;
using vi = vector<int>;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using pil = pair<int,ll>;
using vvi = vector<vi>;
using vpi = vector<ii>;

const int N = 100100;
ll mod=1000000007;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int h, w, k;
    cin>>h>>w>>k;
    vector<vector<char>> mat(h,vector<char>(w,'#'));
    vector<vector<int>> cntrc(h+1,vector<int>(w+1,0));
    vector<int> cntr(h+1),cntc(w+1);
    int curr = 0;
    rep(i,0,h-1){
        rep(j,0,w-1){
            cin>>mat[i][j];
            if(mat[i][j] == '#'){
                cntr[i]++;
                cntc[j]++;
                cntrc[i][j]++;
                curr++;
            }
        }
    }
    if( curr < k){
        cout<<"0"<<nl;
        return 0;
    }
    int todo = curr - k, ans = 0;
    rep(i,0,((1<<(h))-1)){
        int tmp=0;
        rep(j,0,h-1){
            if(i&(1<<j)){
                tmp+=cntr[j];
            }
        }
        rep(j,0,(1<<(w)) - 1){
            int tmp1 = 0;
            rep(k,0,w-1){
                if(j&(1<<k)){
                    tmp1+=cntc[k];
                }
            }
            rep(k,0,h-1){
                rep(l,0,w-1){
                    if((i&(1<<k))&&(j&(1<<l))){
                        tmp1-=cntrc[k][l];
                    }
                }
            }
            if(tmp + tmp1==todo){
                ans++;
            }
        }        
    }
    cout<<ans<<nl;
    return 0;
}


Measured memory_bytes: 3640
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;

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

  if(N%2==0) ans=N/2;
  else ans=N/2+1;
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class B121 {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    string a, b;
	    in >> a >> b;
	    int num = atoi((a+b).c_str());
	    bool res = false;
	    for(int i=1; i<=1000; i++){
            if(num == i*i) res = true;
	    }

	    ans(res, out);
	}
};


int main() {
	B121 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int main()
{
        int N, A, B;
        cin >> N >> A >> B;
        int sa = B - A;
        if (sa % 2 == 0)
        {
                cout << "Alice" << endl;
        }
        else
        {
                cout << "Borys" << endl;
        }
        return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long a[] = new long[n];
        for(int i = 0 ; i < n ; i++)
            a[i] = sc.nextLong();
        long last = a[0];
        System.out.print(last);
        for(int i = 1 ; i < n ; i++){
            if(a[i] == last);
            else{
                last = a[i];
                System.out.print(" " + last);
            }
        }
        System.out.println();
        sc.close();
    }
}



Measured memory_bytes: 74636
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    int n; cin>>n;
    int sum=1,maxi=1;
    for(int i=2;i<=n;i++){
        if(sum<n&&n<=sum+i){
            sum+=i;
            maxi=i;
            break;
        }
        sum+=i;
    }
    rep(i,maxi){
        if(sum-n==i+1) continue;
        cout<<i+1<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
	long long a, b, c, d = 0, e = 0, f = 0;
	string s;
	cin >> s;
	for (int h = 0; h < s.size(); h++) {
		if (s[h] == '9' && h>=1) {
			d++;
		}
		e += (s[h] - '0');
	}
	if (d == s.size() - 1) {
		cout << e << endl;
	}
	else {
		f += (s[0] - '0') - 1;
		for (int j = 1; j <= s.size() - 1; j++) {
			f += 9;
		}
		cout << f << endl;
	}
	cin >> e;
}

Measured memory_bytes: 256
package main 

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

var r = bufio.NewReader(os.Stdin)

func main(){
    var a,b int
    fmt.Fscan(r, &a)
    fmt.Fscan(r, &b)
    
    ans:=a*b
    ans2:=a*2+b*2
    fmt.Println(ans ,ans2)
}



Measured memory_bytes: 1140
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long k = sc.nextLong();
		Integer[] a = new Integer[n];
		int mod = 1000000000+7;
//		int[] b = new int[n*k];
		
		long count;
		long counta = 0;
		long countb = 0;
		
		for (int i = 0; i < a.length; i++) {
			a[i] = sc.nextInt();
		}
		
		for (int i = 0; i < a.length-1; i++) {
			for (int j = i+1; j < a.length; j++) {
				if (a[i]>a[j]) {
					counta++;
				}
			}
		}
		
		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < a.length; j++) {
				if (a[i]>a[j]) {
					countb++;
				}
			}
		}
		
		long ans = ((countb % mod) * ((((long)k * (long)(k-1))/2) % mod));
		ans = (ans + (counta*k)%mod)%mod;
		System.out.println(ans);
		
//		count = ((counta * k)%mod + countb * (k * (k -1) / 2)%mod)%mod;
//		count %= mod;
//		System.out.println(count);
		
		sc.close();
	}
}

Measured memory_bytes: 26164
import sys
import heapq

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)


def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    MOD = 10 ** 9 + 7

    pos = []
    neg = []
    for a in A:
        if a >= 0:
            pos.append(a)
        else:
            neg.append(a)

    flag = False  # 積を正にできるか

    if N == K:
        ans = 1
        for a in A:
            ans *= a
            ans %= MOD
        print(ans % MOD)
        exit()

    if len(pos) > 0:
        flag = True
    else:
        if K % 2 == 0:
            flag = True

    ans = 1
    if not flag:
        # 積を正にできないとき
        # 絶対値の小さい方からK個とる
        h = [abs(x) for x in A]
        heapq.heapify(h)

        for i in range(K):
            ans *= heapq.heappop(h)
            ans %= MOD
        ans *= -1
    else:
        hpos = [-x for x in pos]
        heapq.heapify(hpos)
        hneg = neg[:]
        heapq.heapify(hneg)
        if K % 2 == 1:
            # Kが奇数の時
            # 一番大きい偶数を1つとる。
            ans *= -heapq.heappop(hpos)
            ans %= MOD

        # pos, neg sort -> 2個ずつペア -> 降順sort -> 上から K//2 個とる
        pairs = []
        while len(hpos) >= 2:
            x = -heapq.heappop(hpos)
            x *= -heapq.heappop(hpos)
            heapq.heappush(pairs, -x)
        while len(hneg) >= 2:
            x = heapq.heappop(hneg)
            x *= heapq.heappop(hneg)
            heapq.heappush(pairs, -x)
        if len(pairs):
            for i in range(K // 2):
                ans *= -heapq.heappop(pairs)
                ans %= MOD

    print(ans % MOD)


if __name__ == "__main__":
    main()


Measured memory_bytes: 31464
import std.stdio;
import std.algorithm;
import std.array;
import std.conv;
import std.string;
import std.uni;
import std.range;
import std.algorithm;

void main()
{
    size_t k = 0;
    auto c = readln.strip.toLower;
    while (!stdin.eof)
    {
        auto a = readln.strip.toLower;
        if (a == "END_OF_TEXT")
            break;
        k += a.split(' ').count(c);
    }
    writeln(k);
}



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

int main(void){
    int n;
    cin >> n;
    if(n < 1200){
        cout << "ABC" << endl;
    }else if(n < 2800){
        cout << "ARC" << endl;
    }else{
        cout << "AGC" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
n = int(input())
data = [list(map(int, input().split())) for _ in range(n)]
for c_x in range(101):
    for c_y in range(101):
        valid = True
        H = None
        # h==0でも情報はあって、これを逃さない
        for i in range(n):
            x, y, h = data[i]
            if h >= 1:
                H = h + abs(x-c_x) + abs(y-c_y)
                break
        for i in range(n):
            x, y, h = data[i]
            if h != max(H - abs(x-c_x) - abs(y-c_y), 0):
                valid = False
                break
        if valid:
            print(c_x, c_y, H)


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

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

ll f(ll a){
  ll res = 0;
  while (a%2 == 0) {
    a /= 2;
    res++;
  }
  return res;
}

int main()
{
  ll N;
  cin >> N;
  ll M;
  cin >> M;
  vector<ll> a(N);
  for (int i=0; i<N; i++){
    cin >> a[i];
    a[i] /= 2;
  }

  ll t = f(a[0]);
  for (int i=0; i<N; i++) {
    if (t != f(a[i])) {
      cout << 0 << endl;
      return 0;
    }
    a[i] >>= t;
  }
  M >>= t;

  ll l = 1;
  for (int i=0; i<N; i++) {
    if (M < l) {
      cout << 0 << endl;
      return 0;
    }
    l = lcm(l, a[i]);
  }
  cout << (M/l+1)/2 << endl;

  return 0;
}


Measured memory_bytes: 1024
nk = input().split()
n = int(nk[0])
k = int(nk[1])

dtlist = []
for i in range(n):
    td = input().split()
    t = int(td[0])
    d = int(td[1])
    dtlist.append((d, t))
dtlist.sort(reverse=True)


t_to_maxidx = {}
for idx, dt in enumerate(dtlist):
    d, t = dt
    if t not in t_to_maxidx:
        t_to_maxidx[t] = idx


selected = []
count = 0
tcount = {}

candidate = [(dtlist[idx][0], idx) for t, idx in t_to_maxidx.items()]
candidate.sort(reverse=True)
for d, idx in candidate:
    if count >= k:
        break
    d, t = dtlist[idx]
    selected.append(dtlist[idx])
    count += 1
    tcount[t] = 1 if t not in tcount else tcount[t] + 1
    dtlist[idx] = None

new_dtlist = []
for dt in dtlist:
    if dt is not None:
        new_dtlist.append(dt)
dtlist = new_dtlist


if k - count > 0:
    for i in range(k - count):
        dt = dtlist.pop(0)
        selected.append(dt)
        d, t = dt
        tcount[t] = 1 if t not in tcount else tcount[t] + 1

selected.sort()

score = 0
for d, t in selected:
    score += d

len_tcount = len(tcount)
score += len_tcount * len_tcount

for i in range(0, 2**32):
    next_score = score
    try:
        d_new, t_new = dtlist.pop(0)
        d_old, t_old = selected.pop(0)
    except IndexError:
        print(score)
        break
    next_score += d_new
    next_score -= d_old

    tcount[t_old] -= 1
    if tcount[t_old] <= 1:
        next_score -= len_tcount * len_tcount
        len_tcount -= 1
        next_score += len_tcount * len_tcount
        del tcount[t_old]

    if t_new not in tcount:
        next_score -= len_tcount * len_tcount
        len_tcount += 1
        next_score += len_tcount * len_tcount
        tcount[t_new] = 1
    else:
        tcount[t_new] += 1

    if next_score <= score:
        print(score)
        break
    score = next_score


Measured memory_bytes: 39092
popcnt=->n{n==0?0:popcnt[n/2]+n%2}
N=gets.to_i
F=N.times.map{gets.tr(' ','').to_i(2)}
P=N.times.map{gets.split.map &:to_i}
r=-Float::INFINITY
1.upto(1023){|i|
	c=0
	N.times{|j|c+=P[j][popcnt[i&F[j]]]}
	r=[r,c].max
}
p r

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

int solve(int a, int b, int c, int x, int y) {
  long ans = 1e18;
  for (int i = 0; i <= max(x, y); i++) {
    long sum = 2 * i * c + max(x - i, 0) * a + max(y - i, 0) * b;
    ans = min(ans, sum);
  }
  return ans;
}
int main() {
  int a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;
  cout << solve(a, b, c, x, y) << endl;
}


Measured memory_bytes: 3540
from sys import stdin
N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
ans = 1
f = True

if 0 in A:
    print(0)
else:
    for i in A:
        ans *= i
        if ans > 10**18:
            f = False
            break
    if f:
        print(ans)
    else:
        print(-1)

Measured memory_bytes: 21656
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    int ans = 0;
    int len = 0;
    rep(i, 3) {
        if (S[i] == 'R') len++;
        else len = 0;
        ans = max(ans, len);
    }
    cout << ans << endl;

    return 0;
}


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

int main()
{
    // 整数の入力
    int i,N,maxA,minA,a;
    maxA = -1;
    minA = 1001;
    cin >> N;
    for (i=0;i<N;i++){
        cin >> a;
        if (a < minA){
            minA = a;
        }
        if (a > maxA){
            maxA = a;
        }
    }
    cout << maxA - minA << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int a[100010];
string s;
int main(){
    int n;
    while(cin>>s){
        ll ans=0, cnt=0;
        n=s.length();
        for(int i=0; i<n; ++i){
            if(s[i]=='A'){
                ++cnt;
            }
            else if(s[i]=='B'&&s[i+1]=='C'){
                ans+=cnt;
                ++i;
            }
            else{
                cnt=0;
            }
        }
        cout<<ans<<endl;
    }
  return 0;
}




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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  int a = A % B;
  for (int i = 2; i < 1000000; i++){
    int b = (A * i) % B;
    if (b == C){
      cout << "YES" << endl;
      return 0;
    }
    if (b == a){
      cout << "NO" << endl;
      return 0;
    }
  }
  
  cout << "NO" << endl;
      return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define FOR(i,a,b) for(LL i=(a);i<(LL)(b);i++)
#define REP(i,b) FOR(i,0,b)
using namespace std;
typedef long long LL;
typedef LL ut;
typedef pair<ut,ut> pr;
map<pr,LL> maps;
int main(){
	LL H,W,N,a,b;
	cin >> H >> W >> N;
	LL ans[10]={};
	ans[0]=(H-2)*(W-2);
	cin.tie(0);
	REP(i,N){
		cin >> a >> b;
		FOR(i,a-1,a+2) FOR(j,b-1,b+2){
			if(2<=i && i<=H-1 && 2<=j && j<=W-1)
				maps[pr(i,j)]=maps[pr(i,j)]+1;
		}
	}
	for(auto it=maps.begin();it!=maps.end();++it){
		ans[(*it).second]++;
		ans[0]--;
	}
	REP(i,10) cout << ans[i] << endl;
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    if(N >= 30)
    cout << "Yes" << "\n";
    else
    cout << "No" << "\n";
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int INT_INF = 2147483647;
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; }
typedef pair<int,int> P;

int main(){
  int n,k;
  cin >> n >> k;
  int a[n];
  rep(i,n)cin >> a[i];
  int ans = INT_INF;
  rep(i,n-k+1){
    ll l = a[i];
    ll r = a[i+k-1];
    int res;
    if(l*r<0LL)res=min(abs(l),r)*2+max(abs(l),r);
    else res = max(abs(l),abs(r));
    chmin(ans,res);
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void solve() {
	int x, n; cin >> x >> n;
    vector<int> p(n);
    set<int> se;
    rep(i, n) {
        cin >> p[i];
        se.insert(p[i]);
    }
    int ans = -200, res = 500;
    for(int i = -200; i <= 200; ++ i) {
        if(se.find(i) != se.end()) continue;
        int sa = abs(x - i);
        if(chmin(res, sa)) {
            ans = i;
        }
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip> // std::std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()

typedef long long ll;

int main (void) {

  int N; std::cin >> N;
  std::unordered_map<std::string, bool> past;

  char last = ' ';
  for(int i=0; i<N; i++) {
    std::string S; std::cin >> S;
    if ( i != 0 && S[0] != last ) {
      std::cout << "No" << std::endl;
      return 0;
    }
    last = S.back();

    if ( past.count(S) != 0 ) {
      std::cout << "No" << std::endl;
      return 0;
    }
    past[S] = true;
  }

  std::cout << "Yes" << std::endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
 
class Program{
    static void Main(){
        string s = Console.ReadLine();
        bool flag = false;
        if(s.IndexOf('C') != -1){
            if(s.IndexOf('F', s.IndexOf('C')) != -1){
                flag = true;
            }
        }
        Console.WriteLine(flag ? "Yes" : "No");
    }
}


Measured memory_bytes: 2648
N = gets.chomp.to_i
S = gets.chomp
f = 0
answer = 0
for i in 0...N do
    if f == 0
        if S[i] == "A"
            f += 1
        else
            f = 0
        end
    elsif f == 1
        if S[i] == "B"
            f += 1
        elsif S[i] == "A"
            f = 1
        else
            f = 0
        end
    elsif f == 2
        if S[i] == "A"
            f = 1
        else
            f = 0
        end
        if S[i] == "C"
            answer += 1
        end
    end
end
puts answer

Measured memory_bytes: 1788
x,y,a,b,c = map(int, input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
r += sorted(p)[-x:]
r += sorted(q)[-y:]
ans = sum(sorted(r)[-(x+y):])
print(ans)

Measured memory_bytes: 23328
#include <bits/stdc++.h>
     
    using namespace std;
     
    #define REPI(x) for(int i=0;i<x;i++)
    #define REPJ(x) for(int j=0;j<x;j++)
    #define SCANFD(x) scanf("%d",&x)
     
    int main()
    {
        int N,A,B;
        
        scanf("%d%d%d",&N,&A,&B);
     
        if(A*N>B)
            printf("%d\n",B);
        else
            printf("%d\n",A*N);            
        
        return 0;
    }

Measured memory_bytes: 256
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;
//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end()
#define SIZE(x) ll(x.size())
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define PI 3.14159265358979323846264338327950L

#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

#define FIND(v,key) std::find(v.begin(), v.end(), key) != v.end() //FIND(vector,key) :v contains key

#define int long long
#define Graph vector<vector<int> >
#define PII pair<int,int>
#define VI vector<int>
#define VVI vecotor<vector<int> >
#define VPII vector<pair<int,int> >

template<typename A, size_t N, typename T>

void Fill(A (&array)[N], const T &val) {
	std::fill( (T*)array, (T*)(array + N), val );
}


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//ここにグローバル変数宣言
int H, W, sh, sw, gh, gw;
int dh[4] = {1, 0, -1, 0};
int dw[4] = {0, 1, 0, -1};//BFS関連




//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//ここに関数宣言
int ctoi(char c) {
	switch (c) {
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return 0;
	}
}





//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
signed main() {
	//入力の高速化用のコード
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	int X, Y;
	cin >> X >> Y;

	int ans = 0;
	int A=X;

	while (A <= Y) {
		ans++;
		A*=2;
	}

	cout<<ans<<endl;



}







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

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

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<P> k(m);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    int t = 0;
    rep(j, b) {
      int c;
      cin >> c;
      --c;
      t |= 1 << c;
    }
    k[i] = P(a, t);
  }

  const int INF = 1001001001;
  int dp[m + 1][1 << n];
  rep(i, m + 1) rep(j, 1 << n) dp[i][j] = INF;
  dp[0][0] = 0;
  rep(i, m) rep(j, 1 << n) {
    int nj = j;
    nj |= k[i].second;
    dp[i + 1][nj] = min(dp[i + 1][nj], dp[i][j] + k[i].first);
    dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
  }

  int ans = dp[m][(1 << n) - 1];
  if (ans == INF) ans = -1;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 16256
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <stdio.h>
#include <vector>

using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

int main() {

    ll N;
    cin >> N;
    string S[N];
    rep(i,N){
        string s;
        cin >> s;
        sort(s.begin(),s.end());
        S[i] = s;
    }
    sort(S,S+N);
    ll out = 0;
    ll cnt = 0;
    rep(i,N-1){
        if(S[i]==S[i+1]) cnt++;
        if((S[i]!=S[i+1]||i==N-2)&&cnt>0){
            out += cnt*(cnt+1)/2;
            cnt = 0;
        }
    }
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 5760
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(10)

using namespace std;

typedef pair<int, int> P;

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

    int A, B, C;
     cin >> A >> B >> C;
     cout << min(C, B / A) << endl;
    return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>

using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[])
{
    string s;
    cin >> s;
    vector<ll> v(26, 0);
    for (ll i = 0; i < s.size(); i++)
    {
        v[s[i] - 'a']++;
    }
    for (ll i = 0; i < 26; i++)
    {
        if (v[i] % 2 != 0)
        {
            cout << "No" << endl;
            exit(0);
        }
    }

    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
const int MAXN = 2e5+4;
int a[MAXN];//保存输入数据
const int MAXM = 1e6;
bool flag[MAXM+4];//倍数标志
 
int main() {
	int n;
	scanf("%d", &n);
	for (int i=1; i<=n; i++) {
		scanf("%d", &a[i]);
	}
 
	sort(a+1, a+n+1);
 
	int ans = 0;
	for (int i=1; i<=n; i++) {
		if (false==flag[a[i]]) {
			if (a[i]!=a[i+1]) {
                //参考样例2
				ans++;
			}
 
			for (int j=1; a[i]*j<=MAXM; j++) {
				flag[a[i]*j] = true;
			}
		}
	}
 
	printf("%d\n", ans);
 
	return 0;
}


Measured memory_bytes: 5532
input = gets
a = input.split(" ")[0].to_i
b = input.split(" ")[1].to_i
c=  a-1
if c%2 == 0 then
   if c%4 == 0 then
    kari = c
   else kari = 1 ^ c
   end
elsif c%4 == 1 then
    kari = 1
else
    kari = 0
end

if b%2 == 0 then
    if b%4 == 0 then
     b2 = b
    else b2 = 1 ^ b
    end
 elsif b%4 == 1 then
     b2 = 1
 else
     b2 = 0
 end

 print kari ^ b2

Measured memory_bytes: 3836
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int i = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    using pii = pair<ll, ll>;
    vector<pii> AB(N);
    rep(i, N) {
        ll a, b;
        cin >> a >> b;
        AB[i] = MP(a, b);
    }
    sort(All(AB), [](const pii &a, const pii &b) {
        return a.first + a.second > b.first + b.second;
    });
    ll T = 0, A = 0;
    rep(i, N) {
        if(i % 2 == 0)
            T += AB[i].first;
        else
            A += AB[i].second;
    }
    cout << T - A << endl;
    return 0;
}

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

int g[100][100];

int main(){
	int h, w, n;
	scanf("%d%d%d", &h, &w, &n);
	bool z = false;
	int x = 0, y = 0;
	f(i, 1, n + 1){
		int t;
		scanf("%d", &t);
		while (t){
			g[x][y] = i;
			if (z) { if (--y == -1)++x, y = 0, z = false; }
			else if (++y == w)++x, y = w - 1, z = true;
			--t;
		}
	}
	f(i, 0, h){
		printf("%d", g[i][0]);
		f(j, 1, w)printf(" %d", g[i][j]);
		printf("\n");
	}
}

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

#ifndef errOut
#define errOut(s)
#endif

int64_t calc(int64_t n, int64_t k) {
    errOut(n);
    errOut(k);
    int64_t ret = 0;
    for (int64_t b = k + 1; b <= n; ++b) {
        ret += (n / b) * (b - k);
        if (n % b) {
            ret += std::max(INT64_C(0), n % b - std::max(k, INT64_C(1)) + INT64_C(1));
        }
    }
    return ret;
}

int main() {
    int n, k;
    std::cin >> n >> k;
    std::cout << calc(n, k) << std::endl;
    return 0;
}


Measured memory_bytes: 256
import Control.Monad
import Text.Read

newtype Pair = Pair { getPair :: (Int, Int) }

instance Read (Pair) where
  readPrec = Pair .: (,) <$> readPrec <* get <*> readPrec

infixr 8 .:
(.:) :: (c -> d) -> (a -> b -> c) -> a -> b -> d
(.:) = ((.).(.))

main :: IO ()
main = do
  (a, b) <- getPair <$> readLn
  print $ solve a b

solve :: Int -> Int -> Int
solve = (*)


Measured memory_bytes: 3912
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> P;
static const int INF=1<<24;

string s[15];

int main(){
	s[1]=".,!? ";
	s[2]="abc";
	s[3]="def";
	s[4]="ghi";
	s[5]="jkl";
	s[6]="mno";
	s[7]="pqrs";
	s[8]="tuv";
	s[9]="wxyz";
	
	string st;
	int n;
	cin>>n;
	rep(k,n){
		cin>>st;
		P res(0,0);
		//cout<<"size "<<st.size()<<endl;
		rep(i,st.size()){
			if(st[i]!='0'){
				res.F++;
				res.S=st[i]-'0';
			}
			else if(res.S!=0){
				int t;
				if(res.S==1) t=5;
				else if(res.S==7||res.S==9) t=4;
				else t=3;
				cout<<s[res.S][(res.F-1)%t];
				res.F=0;res.S=0;
			}
		}
		if(res.S!=0){
			int t;
			if(res.S==1) t=5;
			else if(res.S==7||res.S==9) t=4;
			else t=3;
			cout<<s[res.S][(res.F-1)%t];
		}
		cout<<endl;
	}
	
	
	return 0;
}

Measured memory_bytes: 1208
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
int main(){
ll t,m,k=0;
//cin>>t;
//while(t--){
//ll j,k=-1;
ll n;
cin>>n;
ll a[n];
for(ll i=0;i<n;i++)
cin>>a[i];
for(ll i=1;i<n-1;i++)
if((a[i]>a[i+1]&&a[i]<a[i-1])||(a[i]>a[i-1]&&a[i]<a[i+1]))k++;

cout<<k<<endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
int main(){
  long long a;
  double b;
  cin >> a >> b;
  if(a==0 || b==0){
    cout << 0 << endl;
    return 0;
  }
  long long num=b*100 + 0.1; //この0.99なに？
  long long ans=num*a;
  ans/=100;
  cout << ans << endl;
}


Measured memory_bytes: 3692
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        Scanner scanner = new Scanner(System.in);
        long A = scanner.nextLong();
        long B = scanner.nextLong();
        long C = scanner.nextLong();
        long D = scanner.nextLong();

        long lcm = lcm(C, D);

        long ac = (A - 1) / C;
        long ad = (A - 1) / D;
        long acd = (A - 1) / lcm;

//        long a = ac + ad - acd;

        long bc = (B / C) - ac;
        long bd = (B / D) - ad;
        long bcd = (B / lcm) - acd;

        long b = bc + bd - bcd;

        long num = B - (A - 1);
        long sum = num - b;

        System.out.println(sum);
    }

    static long lcm (long a, long b) {
        long temp;
        long c = a;
        c *= b;
        while((temp = a%b)!=0) {
            a = b;
            b = temp;
        }
        return (long)(c/b);
    }

}

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

#define FOR(i, m, n) for(int (i) = (m); (i) < (n); (i)++)
#define FORN(i, m, n) for(int (i) = (m); (i) <= (n); (i)++)
#define FORR(i, m, n) for(int (i) = (m); (i) >= (n); (i)--)
#define rep(i, n) FOR(i, 0, n)
#define repn(i, n) FORN(i, 1, n)
#define repr(i, n) FORR(i, n, 0)
#define repnr(i, n) FORR(i, n, 1)
#define co(n) cout << (n) << endl
#define cosp(n) cout << (n) << ' '
#define setp(n) cout << fixed << setprecision(n);
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> Vec;

const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const double PI = acos(-1);
const double EPS = 1e-9;

int main(void){
	ll n, m;
	cin >> n >> m;
	string s;
	cin >> s;

	ll cnt = 0;
	rep(i, n){
		if(s[i] == '1') cnt++;
		else cnt = 0;
		if(cnt >= m){
			co(-1);
			return 0;
		}
	}

	Vec ans;
	repnr(i, n){
		repnr(j, m){
			if(j >= i){
				ans.pb(i);
				i = 0;
				break;
			}else if(s[i-j] == '0'){
				ans.pb(j);
				i = i-j+1;
				break;
			}
		}
	}

	ll si = ans.size();
	rep(i, si){
		cosp(ans[si-1-i]);
	}
	cout << endl;

	return 0;
}


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

using namespace std;
int n,l,minn;
int main()
{
    int ans=1;
    minn=500;
    scanf("%d%d",&n,&l);
    ans=ans+l-1;
    minn=min(minn,abs(ans));
    int sum=ans;
    for(int i=2;i<=n;i++)
    {
        ans+=1;
        sum+=ans;
        minn=min(minn,abs(ans));
    }
    if(ans<minn)
        minn=-minn;
    printf("%d\n",sum-minn);
    return 0;
}


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

#define mod 1e9+7
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define vll vector<long long>
#define ll long long
#define lli long long int
#define el '\n'
#define mem(a,b) memset(a, b, sizeof(a) )

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
/**/
int main()
{
  optimize();
  ll t,n,x,y,k,z,m,a,b,c,d;
  cin>>n;
  ll cnt=1,mx=0;
  for(ll i=0;i<n;i++)
  {
      cin>>a>>b;
       if(i>0&&a==b&&c==d)
       {
          cnt++;
       }
       else
        cnt=1;

      c=a;
      d=b;
     // cout<<cnt<<el;

      mx=max(mx,cnt);
  }
 // cout<<mx<<el;
  if(mx>=3)
    cout<<"Yes"<<el;
  else
    cout<<"No"<<el;

return 0;
}
/**/



Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>


using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 1999999999999999999
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007

ll ans = 0, now = 0;
string s;

int main() {
	cin >> s;
	REP(i, s.size()) {
		if (s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T')now++;
		else {
			ans = max(ans, now);
			now = 0;
		}
	}
	ans = max(ans, now);
	cout << ans << endl;
}


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

int main()
{
  string s,t,ans="No";
  cin>>s>>t;
  int n=s.length();
  for(int i=0;i<n+1;i++){
    if(s==t)ans="Yes";
    s=s[n-1]+s.substr(0,n-1);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
from collections import Counter

N = int(input())
A = [int(i) for i in input().split()]

sumA = sum([v - 1 for v in Counter(A).values() if v > 1])

if sumA % 2 == 0:
    print(len(set(A)))
else:
    print(len(set(A)) - 1)

Measured memory_bytes: 18656
#include <stdio.h>
#include <vector>
#include <algorithm> // sort
#include <map> // pair
using namespace std;

int main() {
  long long n, i, A[200005], B[200005], t, S, p;
  scanf("%lld", &n);
  for (i=0; i<n; i++) {
      scanf("%lld %lld", &B[i], &A[i]);
  }
  vector<pair<long long, long long> > pairs(n);
  
  for (int i = 0; i < n; i++) {
    pairs[i] = make_pair(A[i], B[i]);
  }

  // firstが小さい順、secondが小さい順にソート
  sort(pairs.begin(), pairs.end());
  
  for (int i = 0; i < n; i++) {
    t=pairs[i].first;
    pairs[i].first=pairs[i].second;
    pairs[i].second=t;
  }
  
  S=0; p=1;
  for (int i = 0; i < n; i++) {
    S+=pairs[i].first;
    if (S>pairs[i].second) p=0;
    // printf("%lld, %lld\n", S, pairs[i].second);
  }
  /*
  for (int i = 0; i < n; i++) {
    printf("(%lld,%lld) ", pairs[i].first, pairs[i].second);
  }
  puts(""); // => (0,0) (1,1) (1,9) (4,2) (4,8) (5,5) (6,4) (6,6) (9,3) (9,7)
  */
  if (p==0) printf("No");
  else printf("Yes");
  
  return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (b) - 1; i >= (a); i--)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define ALL(i) (i).begin(),(i).end()
#define RALL(i) (i).begin(),(i).end(),greater<int>()

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second

typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 100005
#define TENFIVE2 200005
// #define int long long
const int INF = 999999999;
const int MOD = 1e9 + 7;
const double EPS = 1e9 + 7;
const double PI = acos(-1);
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

inline int in(){int x;std::cin>>x;return x;}

using lint = long long;
using pint = pair<int, int>;
using vi = vector<int>;
using vii = vector<vector<int> >;
using vl = vector<long long>;
using vp = vector<pint>;

template <typename T> void print(T x) { std::cout << x << '\n'; }
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
  std::fill((T*)array, (T*)(array + N), val);
}

int N_contain_primes(int N,int prime){
  int ans= 0;
  int tmp = prime;
  while(N>=tmp){
    ans += N/tmp;
    tmp*=prime;
  }
  return ans;
}

signed main(){
  int N;
  cin>>N;
  const int NUM = 101;
  bool primes[NUM]= {false};
  
  for(int i=2;i<=NUM;i++)primes[i]= true;

  for(int i=2;i<=sqrt(NUM) ;i++ ){
      if(primes[i]){
          for(int j = i*2;j<=NUM;j+= i ){
              primes[j]=false;
          }
      }
  }
  
  vi num_primes;
  vi num_contain_primes;
  rep1(i,NUM+1){
    if(primes[i]){
      num_primes.pb(i);
      num_contain_primes.pb(N_contain_primes(N,i));
      // print(i);
    }
      

  }
  
  int ans =0;
  rep(i,num_primes.size()){
    int prime = num_primes[i];
    if(num_contain_primes[i] >=4){
      FOR(j,i+1,num_primes.size()){
        
        int prime2 = num_primes[j]; 
        // cout<<prime<<" "<<prime2<<" "<<endl;
        if(num_contain_primes[j] >=4 ){
          rep(k,num_primes.size()){
            int prime3 = num_primes[k];
            if(num_contain_primes[k] >=2 && (prime!= prime3 )&& prime2 != prime3){
              // print("hoge");
              ans++;
            }
          }
        }
      }
    }
  
    if(num_contain_primes[i] >=24){
      rep(j,num_primes.size()){
        int prime2 = num_primes[j]; 
        if(num_contain_primes[j] >=2  && prime != prime2){
            ans++;
            // print("hoge");
          }
        }
      }
    
    if(num_contain_primes[i] >=14){
      rep(j,num_primes.size()){
        int prime2 = num_primes[j]; 
        if(num_contain_primes[j] >=4  && prime != prime2){
          ans++; 
          // print("hoge"); 
        }        
      }
    }
    if(num_contain_primes[i] >=74 )ans++;  
  
  }
  print(ans);

  return 0;
}


Measured memory_bytes: 256
S = str(input())

if S[0]==S[1] and S[0]==S[2] and S[0]==S[3]:
    print("No")
elif S[0]==S[1] and S[2]==S[3]:
    print("Yes")
elif S[0]==S[2] and S[1]==S[3]:
    print("Yes")
elif S[0]==S[3] and S[1]==S[2]:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
suicide = 0
while True:
    try:
        sentence = raw_input()
        start = None
        last = None
        for index, char in enumerate(sentence):
            if char.isdigit():
                if start == None:
                    start = index
            elif not start == None and not char.isdigit():
                last = index
                suicide += int(sentence[start:last])
                start = None
                last = None
        else:
            if not start == None:
                suicide += int(sentence[start:])
    except EOFError:
        print suicide
        break

Measured memory_bytes: 4220