akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
    int n;
    cin >> n;
    int k;
    cin >> k;
    k--;
    rep(i,n-1){
        int h;
        cin >> h;
        if(k > h){
            cout << "No" << endl;
            return 0;
        }
        else k = max(k, h-1);
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 3544
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<cmath>
using namespace std;

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    int k;
    cin>>k;
    string ans="No";
    for(int i=0;i<=k;++i){
        for(int j=0;i+j<=k;++j){
            int ta=a;
            int tb=b*pow(2,i);
            int tc=c*pow(2,j);
            if(ta<tb&&tb<tc) ans="Yes";
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 3940
#include <stdio.h>


int main() 
{
    int a, b, c, x, i, t, min, max, d, sum = 0, bb;
    
	scanf("%d%d%d%d", &a, &b, &c, &x);
	
	x /= 50, bb = b << 1;
	if(x & 1){
		if((c & 1) == 0) c--;	
	}
	else{
		if(c & 1) c--;
	}
    for(i = t = 0; i <= a && t <= x; t += 10, i++){
    	d = x - t;
    	if(bb + c < d) continue;
    	if(d > c) min = (d - c) >> 1;		
		else min = 0;
		if(d - bb >= 0) max = b;
		else max = d >> 1;
		sum += max - min + 1;
	}
	printf("%d\n", sum);
	
    return 0;
}

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

int main(){
  string S;
  cin >> S;
  
  int c;
  cin >> c;
  for(int i=0;i<3;i++){
    if(S.at(i)==S.at(i+1)){
      c++;
      break;
    }
  }
  if(c==1){
    cout << "Bad" << endl;;
  }
  else{
    cout << "Good" << endl;
  }
}

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

int gcd(int x, int y);

int main(){
  int A,B,C;
  bool jdg;

  cin >> A >> B >> C;

  if(C % gcd(A,B) == 0) cout << "YES" << endl;
  else                  cout << "NO"  << endl;

  //C % gcd(A,B)==0ならOK

  return 0;
}

int gcd(int x, int y){
  int a,b,r;
  if(x>=y){ a=x; b=y;
  }else{ b=x; a=y;}



  while(true){
    r = a % b;
    if(r==0){
      break;
    }else{
      a=b;
      b=r;
    }
  }

  return b;

}


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

ans = [1] * N

for i in range(M):
    A, B = list(map(int, input().split()))
    A -= 1
    B -= 1
    if H[A] > H[B]:
        ans[B] = 0
    elif H[A] < H[B]:
        ans[A] = 0
    else:
        ans[A] = 0
        ans[B] = 0
print(ans.count(1))

Measured memory_bytes: 20104
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


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

    res = N % K

    while True:
        temp = abs(res - K)
        if res > temp:
            res = temp
        else:
            break

    print(res)



main()


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

int main(){
    string s;
    cin>>s;
    if(s[0]==s[1]&&s[1]==s[2]) cout<<"Yes"<<endl;
    else if(s[1]==s[2]&&s[2]==s[3])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <math.h>
using namespace std;

int main() {
    long long A, B, K;
    cin >> A >> B >> K;

    if (A - K < 0) {
        cout << 0 << " ";
        K -= A;
    } else {
        cout << A - K << " ";
        K = 0;
    }
    if (B - K < 0) {
        cout << 0 << endl;
    } else {
        cout << B - K << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import sys
def main():
    input = sys.stdin.readline
    H,W = map(int, input().split())
    s = [list(input().rstrip()) for _ in range(H)]

    def check(i, j):
        for di, dj in [(0,1),(0,-1),(1,0),(-1,0)]:
            ni, nj = i+di, j+dj
            if ni < 0 or ni >= H or nj < 0 or nj >= W: continue
            if s[ni][nj] == '#': return True
        return False

    for i in range(H):
        for j in range(W):
            if s[i][j] == '#':
                if check(i,j) == False: return False
    return True

if __name__ == '__main__':
    print('Yes' if main() else 'No')

Measured memory_bytes: 39280
#include<stdio.h>
int main()
{
    int A[5],s=0,t=0,i=0;
    for(i=0;i<3;i++)
    {
        scanf("%d",&A[i]);
        if(A[i]==5)
        {
            s++;

        }
        if(A[i]==7)
        {
            t++;
        }
    }
    if((s==2)&&(t==1))
    {
        printf("YES\n");
    }
    else
    {
         printf("NO\n");
    }
}


Measured memory_bytes: 128
import sys,queue,copy
sys.setrecursionlimit(10**8)
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
INF = float('inf')


A,B = inpl()

if 0 < A <10 and 0<B<10:
    print(A*B)
else:
    print(-1)

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

int main() {
	long long int A[3];
	cin >> A[0] >> A[1] >> A[2];
	sort(A, A + 3);
	cout << ((A[0] * A[1] * A[2]) % 2) * A[0] * A[1] << endl;
}

Measured memory_bytes: 256
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
ans = 0
for i in range(N):
    A = list(map(int, input().split()))
    t = 0
    for m in range(M):
        t += A[m]*B[m]
    if t + C > 0:
        ans += 1
print(ans)

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ld> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;  // 小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;     // 大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define TS to_string
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


ll INF = 1e9;
ll NIL = -1;
ll MOD = 1000000007;
ll LINF = 1e18;
ld EPS = 1e-9;
ld PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b;}     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}

//-----------------------------------------

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

    ll x;
    cin >> x;

    cout << 10 - x/200 <<endl;

    
    return 0;
}



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

typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define ALL(obj) (obj).begin(), (obj).end()
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 dy[]={0, 0, 1, -1, 1, -1, -1, 1};
int dx[]={1, -1, 0, 0, 1, 1, -1, -1};


int main() {
    cout<<fixed<<setprecision(10);

    ll h,w,k; cin>>h>>w>>k;
    vector<vector<char>> a(h, vector<char>(w)); rep(i,h)rep(j,w) cin>>a[i][j];

    using P = pair<ll,ll>;
    auto isOutside = [&](P &p){
        ll r,c;
        tie(r,c) = p;
        return r < 0 or r >= h or c < 0 or c >= w;
    };

    auto getDist = [&](P &p){
        ll r,c;
        tie(r,c) = p;
        return min({r, h-1-r, c, w-1-c});
    };

    auto isWall = [&](P &p){
        ll r,c;
        tie(r,c) = p;
        return a[r][c] == '#';
    };

    P st;

    rep(i,h){
        rep(j,w){
            if(a[i][j] == 'S') st = mp(i,j);
        }
    }

    queue<P> q;
    q.push(st);
    map<P,ll> dist;

    ll d = LLONG_MAX;
    dist[st] = 0;

    while(!q.empty()){
        P cur = q.front();
        q.pop();
        // if(dist.count(cur)) continue;

        rep(i,4){
            P nxt = cur;
            nxt.first += dx[i];
            nxt.second += dy[i];
            if(isOutside(nxt)) continue;
            if(dist.count(nxt)) continue;
            if(isWall(nxt)) continue;
            dist[nxt] = dist[cur]+1;
            q.push(nxt);
        }
    }

    for(auto tmp:dist){
        P pos; ll ds;
        tie(pos, ds) = tmp;
        if(ds>k) continue;
        chmin(d, getDist(pos));
    }
    // cout<<d<<endl;
    cout<<1+(d+k-1)/k<<endl;


    return 0;

}

Measured memory_bytes: 40448
import sys

def read_int():
    l = sys.stdin.readline().rstrip('\n').split(' ')
    return int(l[0])

def read_int_list():
    l = sys.stdin.readline().rstrip('\n').split(' ')                                                  
    return [int(i) for i in l]


S = sys.stdin.readline()                                                                              
T = sys.stdin.readline()                                                                              

ans = 0

for s, t in zip(S, T):                                                                                
    if s != t:                                                                                        
        ans += 1
print(ans)                                                                                            



Measured memory_bytes: 9476
<?php
$templete = array(
    '(%d %s %d %s %d) %s %d',
    '((%d %s %d) %s %d) %s %d',
    '(%d %s (%d %s %d)) %s %d',
    '(%d %s %d) %s %d %s %d',
    '(%d %s %d) %s (%d %s %d)',
    '%d %s (%d %s %d %s %d)',
    '%d %s ((%d %s %d) %s %d)',
    '%d %s (%d %s %d) %s %d',
    '%d %s %d %s (%d %s %d)',
    '%d %s %d %s %d %s %d',
);
$operators = array(
    '+ + +',
    '+ + -',
    '+ + *',
    '+ - +',
    '+ - -',
    '+ - *',
    '+ * +',
    '+ * -',
    '+ * *',
    '- + +',
    '- + -',
    '- + *',
    '- - +',
    '- - -',
    '- - *',
    '- * +',
    '- * -',
    '- * *',
    '* + +',
    '* + -',
    '* + *',
    '* - +',
    '* - -',
    '* - *',
    '* * +',
    '* * -',
    '* * *',
);
while($line = trim(fgets(STDIN))){
    if($line == '0 0 0 0'){
        break;
    }
    $data_ary = explode(" ",$line);
    foreach($templete as $temp){
        $flg = false;
        if(getAnswer($data_ary,$operators,$temp)){
            $flg = true;
            break;
        }
    }
    if(!$flg){
        echo "0\n";
    }
}
function getAnswer($data_ary,$opes,$temp){
    for($a = 0;$a < 4;$a++){
        for($b = 0;$b < 4;$b++){
            if($a != $b){
                for($c = 0;$c < 4;$c++){
                    if($a != $b && $b != $c && $a != $c){
                        for($d = 0;$d < 4 ;$d++){
                            if($a != $b && $b != $c && $c != $d && $a != $c && $a != $d && $b != $d){
                                foreach($opes as $ope){
                                    $op = explode(" ",$ope);
                                    $math = sprintf($temp,$data_ary[$d],$op[0],$data_ary[$c],$op[1],$data_ary[$b],$op[2],$data_ary[$a]);
                                    eval('$ans = '.$math.';');
                                    if($ans == 10){
                                        echo "(".$math.")\n";
                                        return true;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return false;
}


Measured memory_bytes: 9680
import sys

K,N = map(int, sys.stdin.readline().strip().split())
A = list(map(int, sys.stdin.readline().strip().split()))
# K = 20
# N = 3
# A =[0, 5, 15]
# A =[5, 10, 15]

distance = []
# 家間距離
for i,a in enumerate(A):
    if i == len(A) - 1:
        distance.append(K - A[i] + A[0])
    else:
        distance.append(A[i+1] - A[i])

# print(distance)
print(sum(distance) - max(distance))


Measured memory_bytes: 25836
#define REP(i, a, b) for(int i = a; i < b; i++)

int compare(const void* a, const void* b) {
    return *(int*)a - *(int*)b;
}

int main(void){
    int n;
    scanf("%d",&n);
    int a[n];
    REP(i, 0, n) {
        scanf("%d",&a[i]);
    }
    qsort(a, n, sizeof(int), compare);
    printf("%d\n",a[n - 1] - a[0]);
    return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		Double r = sc.nextDouble();

		if (r > 0 && r < 10000) {
			double length = 2 * r * Math.PI;
			double area = r * r * Math.PI;

			System.out.printf("%.5f %.5f", area, length);
		}

	}
}


Measured memory_bytes: 28244
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>

using namespace std;
typedef long long ll;

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

int kaijo(int n){
    int fact = 1;
    if(n == 0) return 1;
    else{for(int i = 1; i <= n; i++){
        fact*=i;
    }
    }
    return fact;
}


/*迷路
const int INF = 50;

typedef pair<int,int> P;
char field[52][52];
int d[51][51];
int r,c;
int sx,sy;
int gx,gy;

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

int bfs(){
    queue<P> que;
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            d[i+1][j+1] = INF;
        }
    }
    que.push(P(sy,sx));
    d[sy][sx]=0;
while(que.size()){
    P p=que.front();
    que.pop();
    if(p.second==gx&&p.first==gy) break;
    for(int i=0;i<4;i++){
        int nx=p.second+dx[i];
        int ny=p.first+dy[i];

        if(1<=nx&&nx<=c&&1<=ny&&ny<=r&&field[ny][nx]!='#'&&d[ny][nx]==INF){
            que.push(P(ny,nx));
            d[ny][nx] = d[p.first][p.second] + 1;
        }
    }
}
return d[gy][gx];
}
*/

int main(){
    int s;
    int a[100001];
    cin>>s;
    int d = 0;
    for(int i = 0; i<100001; i++) a[i] = 0;
    a[s]=1;
    for(int i=1; i<=100000;i++){
        if(s%2==0) s=s/2;
        else s=3*s+1;
        a[s]++;
        if(a[s]==2) {
            d = i+1; 
            break;
        }
    }
    cout<<d<<endl;
    return 0;
}

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

int main() {
  int n; cin >> n;
  vector<int> a(n+1);
  int ans = 0;
  rep(i,n) cin >> a[i+1];
  rep(i,n+1) {
    if (i == 0) continue;
    if (i % 2 == 1 && a[i] % 2 == 1) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3628
a,b,c,d=map(int,input().split())
m=10**9+7
def f(r,c):
 s=t=1
 for i in range(c):s=s*(r+c-i)%m;t=t*-~i%m
 return s*pow(t,m-2,m)
print((f(a,b)-f(c+1,b)-f(a,d+1)+f(c+1,d+1))%m)

Measured memory_bytes: 63192
#include<stdio.h>

int main()

{
    int a,b,c,d,e;
    scanf("%d%d%d",&a,&b,&c);

    if(a==b && a==c )
        printf("1");

    else if(a==b && a!=c)
        printf("2");

    else if(a==c && a!=b)
        printf("2");

    else if(b==c && b!=a)
        printf("2");

    else if(a!=b && a!=c)
        printf("3");

    return 0;

}

Measured memory_bytes: 128
#include<bits/stdc++.h>				//Written by ThiDaiLoc
using namespace std;				//Team Three Wolves
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> trp;
typedef vector<ll> vi;
typedef vector<pll> vp;

#define fu(i,a,b)   for(ll i=a;i<=b;i++)
#define f1(i,n)     for(ll i=1;i<=n;i++)
#define fs(i,s)     for(ll i=0;i+1<=s.length();i++)
#define fd(i,b,a)   for(ll i=b;i>=a;i--)
#define fuv(i,a)    for(ll i=0;i<a.size();i++)
#define fdv(i,a)    for(ll i=(ll)a.size()-1;i>=0;i--)
#define ms(a,x)     memset(a, x, sizeof a)
#define prec(n)     fixed<<setprecision(n)
#define uni(a)      (a).erase(unique(all(a)), (a).end())
#define pb(i)       push_back(i)
#define pob         pop_back()
#define sc(a)       cin>>a
#define sc2(a,b)    cin>>a>>b
#define sc3(a,b,c)  cin>>a>>b>>c
#define pr(a)       cout<<a<<endl
#define pr2(a,b)    cout<<a<<" "<<b<<endl
#define rpr(a)      return cout<<a<<endl,0
#define prY         cout<<"Yes"<<endl
#define prN         cout<<"No"<<endl
#define bit(n,i)    (((n)>>(i))&1)
#define lowb(a,n,x) lower_bound(a,a+n,x) -a
#define lowb2(a,x)  lower_bound(all(a),x) -a.begin()
#define all(x)      (x).begin(), (x).end()
#define sz(a)       (ll)a.size()
#define le(s)       (ll)s.length()		
#define re          return 	
#define	mp(a,b)     make_pair(a,b)
#define	mp3(a,b,c)  make_pair(a,make_pair(b,c))
#define se          second
#define fi          first 
#define sse         second.second
#define sfi         second.first
#define soA         sort(A+1,A+1+n)
#define so(A,n)     sort(A+1,A+1+n)
#define sov(v)      sort(all(v))
#define sovr(v)     sort(all(v),greater<ll>())
#define debug(x)    cerr << #x << " = " << x << endl
#define INPUT       freopen("locin.txt", "r", stdin)
#define OUTPUT      freopen("locout.txt", "w", stdout)
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline ll mnz(ll& a,ll b){return a=(a>b?b:a);}
inline ll mxz(ll& a,ll b){return a=(a<b?b:a);}
inline string toString(ll n) {stringstream ss; ss << n;return ss.str();}
double const eps = 1e-6;
ll const Base=1e9+7,oo=1e17,MAXN=1e6;


ll A[MAXN+5];

ll Solves(){
	
	ll n,m,k,cnt=0,ans=0,x,y,q,c,sum=0,v,t;
	// PROCESS IN HERE
	sc(n); ll X,Y;sc2(X,Y);
	f1(i,n-1){
		fu(j,i+1,n){
			A[min(j-i,abs(i-X)+1+abs(j-Y))]++;
			//if(i==4 and j==5)debug(min(j-i+1,abs(i-X)+1+abs(j-Y)));
		}
	}
	f1(i,n-1)pr(A[i]);
	
	re 0;
	// Hack it if you can :)
}

int main(){
	//INPUT;
	if(fopen("locin.txt", "r"))INPUT;
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll test=1;
//	sc(test);
	fu(T,1,test){
//		cout<<"Case #"<<T<<": ";
		Solves();
	} 		
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define REP(X, Y, Z) for (ll(X) = (Y); (X) < (Z); (X)++)

using namespace std;
using ll = long long;
using dll = deque<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using usll = unordered_set<ll>;
using umll = unordered_map<ll, ll>;
using sll = stack<int>;
using vll = vector<ll>;
using vvll = vector<vll>;

constexpr ll kMod = 1e9 + 7;

ll gcd(ll a, ll b) {
  if (a < b) {
    return gcd(b, a);
  }
  ll c = a % b;
  while (c != 0) {
    a = b;
    b = c;
    c = a % b;
  }
  return b;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

int main() {
  init();

  ll A, B, C;
  cin >> A >> B >> C;

  ll newA = A;
  ll newB = B;
  ll newC = C;
  ll count = 0;
  for (;;) {
    if (newA % 2 != 0 || newB % 2 != 0 || newC % 2 != 0) {
      break;
    }
    count++;

    ll ca = newA;
    ll cb = newB;
    ll cc = newC;
    newA = cb / 2 + cc / 2;
    newB = ca / 2 + cc / 2;
    newC = ca / 2 + cb / 2;
    if (newA == newB && newB == newC) {
      cout << "-1" << endl;
      return 0;
    }
  }
  cout << count << endl;

  return 0;
}


Measured memory_bytes: 256
// --------------
// Tejas Pandey  |
// 28 - 03 - 20  |
// Atcoder BC 160|
// --------------

#include <bits/stdc++.h>
using namespace std;

#define mod 998244353
#define vi vector<int>
typedef long long int ll;

int main (void)
{
  //freopen("in.txt","r",stdin);
  //freopen("out.txt","w",stdout);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s;
  cin >> s;
  cout << ((s[2] == s[3] && s[4] == s[5])?"Yes":"No");
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0); 
	long long N; cin >> N; 
	int C[45] = {0,1,1,2,2,2,3,3,3,3,4,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8};
	vector<pair<long long, int>> P; 
	long long tmp = N; 
	for(long long i = 2; i * i <= N; i++){
		int cnt = 0; 
		while(tmp % i == 0){
			cnt ++; tmp /= i; 
		}
		if(cnt > 0){
			P.emplace_back(i, cnt); 
		}
	}
	if(tmp > 1){
		P.emplace_back(tmp, 1); 
	}
	int ans = 0; 
	for(auto p : P) ans += C[p.second]; 
	cout << ans << "\n"; 
}

Measured memory_bytes: 3656
# Aizu Problem ITP_1_5_A: Print a Rectangle
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


while True:
    H, W = [int(_) for _ in input().split()]
    if H == W == 0:
        break
    for _ in range(H):
        print('#' * W)
    print()

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

// return the prime factors of n
std::map<int64_t, int64_t> primeFactor(int64_t n) noexcept {
    std::map<int64_t, int64_t> ret;
    for (int64_t i = 2; i * i <= n; ++i) {
        while (n % i == 0) {
            ++ret[i];
            n /= i;
        }
    }

    if (n != 1) {
        ret[n] = 1;
    }

    return ret;
}


int main() {
    int64_t N;
    std::cin >> N;

    const auto m = primeFactor(N);

    int64_t ans = 0;
    for (const auto& p : m) {
        int64_t num = p.second;

        for (int64_t i = 1; i <= num; ++i) {
            num -= i;
            ++ans;
        }
    }

    std::cout << ans << std::endl;

    return 0;
}


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

using namespace std;

int main()
{
    int N, M;
    cin >> N >> M;
    char c[N][M];
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < M; j++) {
            cin >> c[i][j];            
        }
    }

    int res = (1<<29);
    for (int i = 1; i < N; i++) {
        for (int j = i+1; j < N; j++) {
            int cost = 0;
            for (int k = 0; k < N; k++) {                
                for (int m = 0; m < M; m++) {
                    if (k < i) {
                        cost += (c[k][m] != 'W');
                    } else if (k < j) {
                        cost += (c[k][m] != 'B');
                    } else {
                        cost += (c[k][m] != 'R');
                    }
                }
            }
            res = min(res, cost);
        }
    }
    cout << res << endl;
    return 0;
}

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

using namespace std;

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

int main() {
  int n, a, b, c, cal[100], res, s;
  cin >> n >> a >> b >> c;
  rep (i, n) cin >> cal[i];
  sort(cal, cal + n, greater<int>());
  s = c;
  res = s / a;
  rep (i, n) {
    s += cal[i];
    res = max(res, s / (a + b * (i + 1)));
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 1176
//素数判定
//O(√X)
#include<iostream>
#include<math.h>
using namespace std;

bool isPrime(int x){
    if(x==2){
        return true;
    }else if(x<2 || x%2==0){
        return false;
    }else{
        int i=3;
        while(i<=sqrt(x)){
            if(x%i==0){
                return false;
            }
            i+=2;
        }
        return true;
    }

}

int main(){
    int x;
    cin >> x;
    while(1){
        if(isPrime(x)){
            cout << x << endl;
            return 0;
        }
        x++;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define REP(i,n) for(ll i=0;i<n;i++)
#define REPP(i,m,n) for(ll i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())
#define de cout << "debug" << endl;
#define pb push_back
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 N,K;

const ll MAX = 510000;
const ll MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main() {
    cin.tie(0);    
	ios::sync_with_stdio(false);
    COMinit();
    cin >> N >> K;
    ll ao = K;
    ll aka = N-K;
    cout << N-K+1 << endl;
    REPP(i,2,K+1){
        ll ans;
      ll ka = 1+N-K;
      ll ki = i+1;
        ans = (COM(K-1,i-1) * COM(ka,N-K-i+1))%MOD;
        cout << ans << endl;
    }
}

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

int main(){

  string a,b,c;
  cin >> a >> b >> c;
  
  cout << a[0]<< b[0] << c[0] << endl;
    
    return 0;
}

Measured memory_bytes: 256
import math
n = int(input())
if n==1:
    print(0)
    quit()
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
def sigma(n):
    s=0
    for i in range(1,n+1):
         s+=i
    return s
ans = 0
for f in factorization(n):
    index = f[1]
    num=1
    while True:
        num+=1
        if index<sigma(num):
            ans+=num-1
            break
print(ans)

Measured memory_bytes: 9508
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <map>

using namespace std;

typedef long long ll;

ll A[100005];
map<ll,ll>mp;

int main() {

	int N;
	ll M;

	scanf("%d %lld",&N,&M);

	int i;

	for(i=0;i<N;i++){
		scanf(" %lld",&A[i]);
	}
	A[N-1]%=M;
	for(i=N-2;i>=0;i--){
		A[i]+=A[i+1];
		A[i]%=M;
	}
	for(i=0;i<N;i++){
		mp[A[i]]+=1ll;
	}
	ll ans=mp[0ll];

	for(i=N-2;i>=0;i--){
		mp[A[i+1]]-=1ll;
		ans+=mp[A[i+1]%M];
	}

	printf("%lld\n",ans);


	return 0;
}

Measured memory_bytes: 4992
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int area = a*b;
        int length=(a+b)*2;
        System.out.println(area+" "+length);
        sc.close();
    }
}


Measured memory_bytes: 25940
//
// Created by kashi on 20-06-2020.
//
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define Endl endl
#define int long long
int gcd(int a,int b){
    return b?gcd(b,a%b):a;
}
bool cmp(pair<int,int> a, pair<int,int>b) {
    return a.second<b.second;
}
int32_t main() {
    int n;
    cin >> n;
    map<int,int>m;
    int sum = 0;
    for (int i = 0; i < n; i++) {
        int x;cin>>x;
        m[x]++;
        sum += x;
    }
    int q;
    cin >> q;
    while (q--) {
        int x, y;
        cin >> x >> y;
        int num=m[x];
        sum+=num*(y-x);
        cout << sum << endl;
        m[x]=0;
        m[y]+=num;
    }
    return 0;
}

Measured memory_bytes: 9540
#include <iostream>

#define Nmax int(1e5 + 1)
using namespace std;

char s[Nmax];
int N,Q,L,R,M;
int a[Nmax],b[Nmax];

int main() {
    ios_base::sync_with_stdio(0);
    cin >> N >> Q;
    cin >> (s + 1);
    for(int i = 1; s[i]; ++i)
        if(s[i] == 'C' && s[i - 1] == 'A')
            a[i] = a[i - 1] + 1;
        else
            a[i] = a[i - 1];
    for(; Q; --Q) {
        cin >> L >> R;
        b[++M] = a[R] - a[L];
    }
    for(int i = 1; i <= M; ++i)
        cout << b[i] << '\n';
    return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>

// min
int main(void){
  int n = 0;
  int d[101];
  int sum = 0;

  scanf("%d", &n);

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

  for(int i = 1; i < n; i++){
    for(int j = i + 1; j <= n; j++){
      sum += d[i] * d[j];
    }
  }

  printf("%d\n", sum);
  
  return 0;

}


Measured memory_bytes: 128
import math


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


def main():
    n = int(input())
    d = {}
    ans = 0
    
    for _ in range(n):
        ss = ''.join(sorted(input()))
        d[ss] = d.get(ss, 0) + 1
        
    for k, v in d.items():
        if v != 1:
            ans += combinations_count(v, 2)
         
    print(ans)
       
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 17848
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define time_taken_start int begtime = clock();
#define time_taken_end int endtime = clock(); \
cerr << "\n\n" << "Time elapsed: " << \
(endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
return 0;
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod 1000000007
#define inf 1000000000000000007
#define eps 0.0000000001
#define pi acosl(-1)
#define pdd pair<ld,ld>
#define pll pair<ll,ll>
#define ff first
#define ss second
#define vpl vector<pll>
#define vll vector<ll>
#define mseti multiset <ll>
#define msetd multiset <ll,greater<ll>>
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound 
#define stp fixed<<setprecision(20)
#define endl '\n'
bool q[82][82][13001];
ll a[82][82],b[82][82];
ll n,m;
int main()
{
	FAST
	#ifdef ayk_16
	freopen("input.txt","rt",stdin);
	freopen("output.txt","wt",stdout);
	#endif
	cin>>n>>m;
	for(ll i=1;i<=n;i++)
	{
		for(ll j=1;j<=m;j++)
			cin>>a[i][j];
	}
	for(ll i=1;i<=n;i++)
	{
		for(ll j=1;j<=m;j++)
		{
			cin>>b[i][j];
		}
	}
	ll x;
	q[0][1][6500]=1;
	for(ll i=1;i<=n;i++)
	{
		for(ll j=1;j<=m;j++)
		{
			x=abs(a[i][j]-b[i][j]);
			for(ll k=x;k<=13000;k++)
			{
				if(q[i-1][j][k-x]==1||q[i][j-1][k-x]==1)
					q[i][j][k]=1;
			}
			for(ll k=0;k<=13000-x;k++)
			{
				if(q[i-1][j][k+x]==1||q[i][j-1][k+x]==1)
					q[i][j][k]=1;
			}
		}
	}
	ll ans=inf;
	for(ll i=0;i<=13000;i++)
	{
		if(q[n][m][i]==1)
		{
			ans=min(ans,abs(6500-i));
		}
	}
	cout<<ans;
}

Measured memory_bytes: 83456
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
    int n;
    cin >> n;

    int r = 0, p = 0;
    for (int i = 0; i < n; i++) {
        int h;
        cin >> h;

        r += h - min(p, h);
        p = h;
    }

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vp;
typedef vector<vi> vv;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define OUT(x) cout << (x) << endl;
#define OUTA(a, n) \
    REP(i, n) { cout << (a[i]) << (i == n - 1 ? "\n" : " "); }
const ll INF = 1e18;
const ll MOD = 1e9 + 7;

#define CEIL(a, b) ((a) + (b)-1) / (b)

ll H, W, N;

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

    ll ans = CEIL(N, max(H, W));

    OUT(ans);
}

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
ll INF = LLONG_MAX;
 
using vc = vector<char>;
using vi = vector<int>;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int N; cin >> N;
    vi arr (N);
    F0R(i, N) cin >> arr[i];

    multiset<int> seqs;
    R0F(i, N) {
        auto it = seqs.upper_bound(arr[i]);
        if (it != seqs.end()) {
            seqs.erase(it);  
        } 
        seqs.insert(arr[i]);
    }
    cout << seqs.size() << endl;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef map<int, int> mii;
typedef map<ll, ll> mll;
typedef set<ii> sii;
typedef set<int> si;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef multiset<ll> ssll;
typedef pair<ll, ll> pll;
typedef set<ll> sll;

const int INF = 1000000000;
const ll MOD = 1000000007;

void dfs(vvi &gf, vi &vis, int n) {
	vis[n] = 1;
	for (int i = 0; i < (int)gf[n].size(); i++) {
		if (vis[gf[n][i]] == 0)
			dfs(gf, vis, gf[n][i]);
	}
}

int main() {FIN
	
	int n, m, i, u, v, g = 0;
	cin >> n >> m;
	vvi gf(n+1);
	vi vis(n+1);
	for (i = 0; i < m; i++) {
		cin >> u >> v;
		gf[u].push_back(v);
		gf[v].push_back(u);
	}
	
	for (i = 1; i <= n; i++) {
		if (vis[i] == 0) {
			dfs(gf, vis, i);
			g++;
		}
	}
	
	cout << (g-1) << "\n";
	
	return 0;
}

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

//#define errOut(s) { std::cerr << "LINE:" << __LINE__ << " " << #s << " = " << s << std::endl; }
#define errOut(s)

std::array<uint32_t, 200000> as;
std::array<uint32_t, 200000> bs;
int n;

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

    if (n == 1) {
        std::cout << as[0] + bs[0] << std::endl;
        return 0;
    }
    errOut(n);

    std::sort(as.begin(), as.begin() + n);
    std::sort(bs.begin(), bs.begin() + n);
    const uint32_t aMax = as[n - 1];
    const uint32_t bMax = bs[n - 1];

    uint32_t msb = 1;
    for (;aMax >= msb || bMax >= msb; msb <<= 1)  {
    }
    uint32_t mask = msb - 1;
    msb >>= 1;
    if (msb == 0) {
        std::cout << 0 << std::endl;
        return 0;
    }

    errOut(msb);
    errOut(mask);
    uint32_t ret = 0;
    for (; msb; msb >>= 1) {
        errOut(msb);
        errOut(mask);

        int j = n;
        for (int i = 0; i < n; ++i) {
            auto a = as[i];
            for (; j > 0 && a + bs[j - 1] > mask; --j) {
            }
            ret ^= ((n - j) % 2) * (msb << 1);
        }
        errOut(ret);

        if (n % 2) {
            size_t msbIdxA = std::lower_bound(as.begin(), as.begin() + n, msb) - as.begin();
            size_t msbIdxB = std::lower_bound(bs.begin(), bs.begin() + n, msb) - bs.begin();
            ret ^= ((msbIdxA * (n - msbIdxB) + (n - msbIdxA) * msbIdxB) % 2) * msb;
            errOut(((msbIdxA * (n - msbIdxB) + (n - msbIdxA) * msbIdxB) % 2) * msb);
            errOut(ret);
        }

        mask >>= 1;
        for (int i = 0; i < n; ++i) {
            as[i] &= mask;
            bs[i] &= mask;
        }
        std::sort(as.begin(), as.begin() + n);
        std::sort(bs.begin(), bs.begin() + n);
    }
    std::cout << ret << std::endl;
    return 0;
}


Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(long long i=(long long)(a);i<(long long)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
//重み付きグラフの場合
//隣接リストを格納する構造体
struct listc{
	int to;
	int cost;
};
vector<bool> Visited(100000, false);   //頂点が訪問済みか否かを格納
vector<vector<listc>> LC(100000);
//深さ優先探索(現在位置をiとする)
void DFS(int i)
{
	Visited[i]=true;
	//cout<<i<<endl;

	for(int j=0; j<(int)LC[i].size(); j++){
		if(Visited[LC[i][j].to]) continue;
		DFS(LC[i][j].to);
	}
}

//頂点数n, 枝数mのグラフの入力(重み付き)
void Graph_Input_cost(int n, int m)
{
	for(int i=0; i<m; i++){
		int from, to, cost;
		cin>>from>>to>>cost;
		from--; to--;
		listc e;
		e.to=to; e.cost=cost;
		LC[from].push_back(e);
		//無向グラフの場合以下も追加
		e.to=from; e.cost=cost;
		LC[to].push_back(e);
	}
}
int main(void)
{
	int n, m, ans=0;

	cin>>n>>m;

	Graph_Input_cost(n, m);

	rep(i, n){
		if(!Visited[i]){
			//cout<<"DFS"<<i<<endl;
			ans++;
			DFS(i);
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 8832
#include <bits/stdc++.h>
#define int long long
#define uint unsigned int
#define pii pair<int, int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORR(i,a,b) for(int i=(a);i>=(b);--i)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) FORR(i,n,0)
#define ALL(c) ((c).begin(),(c).end())
#define PB(a) push_back(a)
#define EMPB(...) emplace_back(__VA_ARGS__)
#define EMP(...) emplace(__VA_ARGS__)
#define MP(a,b) make_pair(a,b)
#define MT(...) make_tuple(__VA_ARGS__)
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define PW(n) (1LL<<(n))
using namespace std;
template <class T> inline bool CHMIN(T& a, T b) { if(a>b) { a=b; return 1; } return 0; }
template <class T> inline bool CHMAX(T& a, T b) { if(a<b) { a=b; return 1; } return 0; }
template <class T> inline void SORT(T& a) { sort(ALL(a)); }
template <class T> inline void REV(T& a) { reverse(ALL(a)); }
template <class T> inline void UNI(T& a) { SORT(a); a.erase(unique(ALL(a)),a.end()); }
template <class S, class T> ostream& operator<<(ostream& os, const pair<S,T> a) {
  return os << a.first << ' ' << a.second;
}
const int MOD = 1000000007;
// const int INF = 0x3f3f3f3f3f3f3f3f;
// const double EPS = 1e-10;
/* ---------------------------------------------------------------------------------------------------- */

/* 基本要素 */
using D = double; // 座標値の型 doubleかlong double
using P = complex<D>; // Point
using L = pair<P,P>;  // Line
using VP = vector<P>;
const double EPS = 1e-8;  // 許容誤差
const double INF = 1e12;
#define X real()
#define Y imag()
#define LT(n,m) ((n)+EPS<(m)) // n < m ?
#define LE(n,m) ((n)-EPS<(m)) // n <= m ?
#define GT(n,m) LT(m,n) // n > m ?
#define GE(n,m) LE(m,n) // n >= m ?
#define EQ(n,m) (abs((n)-(m))<EPS)
#define NE(n,m) !EQ(n,m)
#define rep(i,n) for (int i=0;i<(n);++i)

namespace std {
  istream& operator >> (istream& is, P& p) {
    int F, S;
    is >> F >> S;
    p = P(F,S);
    return is;
  }
}

// 内積
D dot(P a, P b) {
  return (conj(a)*b).X;
}
// 外積
D cross(P a, P b) {
  return (conj(a)*b).Y;
}
// 点aから見た、点bから点cへの方向
int ccw(P a, P b, P c) {
  b -= a; c -= a;
  if (GT(cross(b,c),0)) return +1;  // counter clockwise
  if (LT(cross(b,c),0)) return -1;  // clockwise
  if (LT(dot(b,c),0)) return +2;  // c--a--b on line
  if (LT(norm(b),norm(c))) return -2; // a--b--c on line or a==b
  return 0;                     // a--c--b on line or a==c or b==c
}

// 多角形の符号付き面積
D area(const VP& ps) {
  D a = 0;
  rep (i,ps.size()) a += cross(ps[i],ps[(i+1)%ps.size()]);
  return a/2;
}

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(1);

  int n;
  cin >> n;
  VP ps(n);
  REP(i,n) cin >> ps[i];
  cout << abs(area(ps)) << endl;

  return 0;
}


Measured memory_bytes: 3292
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int cmp(const void*p,const void*q)
{
	return (*(int*)p-*(int*)q);
}
int a[300000],b[300000],c[300000],d[300000];
int main()
{
	int n,m,i,j,k,l,r,z;
	scanf("%d%d",&n,&m);
	for(k=j=i=0;i<m;i++)
	{
		scanf("%d%d",&a[i],&b[i]);
		if(a[i]==1)
			c[j++]=b[i];
		if(b[i]==n)
			d[k++]=a[i];
	}
	z=0;
	if(c[0]!=0&&d[0]!=0)
	{
	    qsort(c,j,sizeof(c[0]),cmp);//因为每次都要求数组c和d按从小到大排,所以一次排序就可以了
        qsort(d,k,sizeof(d[0]),cmp);//d数组是k个,你写的j。。。
		for(z=i=0;i<j;i++)
		{
            
			l=0;r=k-1;
			while(l<=r)
			{
				int m=(l+r)/2;
				if(d[m]<c[i])
					l=m+1;
				else if(d[m]>c[i])
					r=m-1;
				else
				{
					z=1;
					break;
				}
			}
		}
	}
	if(z)
		printf("POSSIBLE\n");
	else
		printf("IMPOSSIBLE\n");
	return 0;
}


Measured memory_bytes: 3580
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		for(int i=1;i<=9;i++){
			for(int j=1;j<=9;j++){
				System.out.println(i + "x" + j + "=" + i*j);
			}
		}
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
using namespace std;
int main(void){
    string s,t1="maerd",t2="remaerd",t3="esare",t4="resare";
    cin>>s;
    reverse(s.begin(),s.end());
    int p=0;
    while(p<s.size()){
        string a=s.substr(p,5),b=s.substr(p,6),c=s.substr(p,7);
        if(a==t1||a==t3)p+=5;
        else if(b==t4)p+=6;
        else if(c==t2)p+=7;
        else{
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}


Measured memory_bytes: 512
N = int(input())
xy = []
for i in range(N):
    xy.append(list(map(int, input().split())))


def f(x, y):
    return [x - y, x + y]


XY = []
for x, y in xy:
    XY.append(f(x, y))

large, small = [-float('inf'), -float('inf')], [float('inf'), float('inf')]
for i in range(2):
    for j in XY:
        large[i] = max(j[i], large[i])
        small[i] = min(j[i], small[i])

ans = max(large[0] - small[0], large[1] - small[1])
print(ans)

Measured memory_bytes: 75680
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  unordered_map<string,int> things;
  for(int i=0;i<n;i++)
  {
    string s;
    cin>>s;
    things[s]++;
  }
  cout<<things.size();
  return 0;
}

Measured memory_bytes: 17788
#include <stdio.h>

int main(){
    int n;
    scanf("%d", &n);
    long dum[n];
    for(int i = 0; i < n; i++){
        scanf("%ld", &dum[i]);
    }
    long rain[n] = {};
    int sign = 1;
    for(int i = 0; i < n; i++){
        rain[0] += dum[i] * sign;
        sign *= -1;
    }
    for(int i = 1; i < n; i++){
        rain[i] = -rain[i - 1] + dum[(i - 1)%n] * 2;
    }
    for(int i = 0; i < n; i++){
        printf("%ld ", rain[i]);
    }
}

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

#define llint long long int
#define MOD 998244353L

using namespace std;

int main(){
    int A, B, C, D;

    cin >> A >> B >> C >> D;

    vector<vector<llint>> ans(C + 1, vector<llint>(D + 1, 0));

    ans[A][B] = 1;

    for(int d = 1; d <= 6000; d ++){
        for(int i = 0; i <= d; i ++){
            int x = B + d - i;
            int y = A + i;

            if(x <= D && y <= C){
                ans[y][x] += (ans[y][x - 1] * y) % MOD;
                ans[y][x] += (ans[y - 1][x] * x) % MOD;

                llint temp = ((y - 1) * (x - 1) * ans[y - 1][x - 1]) % MOD;
                ans[y][x] += (MOD - temp) % MOD;

                ans[y][x] %= MOD;
            }
        }
    }
    cout << ans[C][D] << endl;
}

Measured memory_bytes: 73740
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>


using namespace std;

typedef long long LL;



int main()
{
    int n;
    cin >>n;
    cout<<"Christmas";

    while (n<25)
    {
        n++;
        cout<<" Eve";

    }
    cout<<endl;




#ifdef VSCode
    system("pause");
#endif
    return 0;
}

Measured memory_bytes: 256
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, K, *P = map(int, read().split())
    P.sort()
    print(sum(P[:K]))
    
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9236
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;


typedef long long i64;
const int inf = (int)1.05e9;


int main()
{
	i64 sum = 0;
	int n;
	vector<pair<int,int>> xs;

	scanf("%d", &n);
	xs.resize(n);
	for(int i = 0; i < n; ++i) {
		scanf("%d%d", &xs[i].first, &xs[i].second);
		sum += xs[i].first;
		sum += xs[i].second;
	}

	i64 ans = 0;

	for(int i = 0; i < n; ++i) {
		int a = xs[i].first;
		int b = xs[i].second;
		if(a > b)
			ans = max(ans, sum / 2 - b);
	}

	printf("%lld\n", ans);

	return 0;
}

/* waffle */


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
#include <limits>
using namespace std;
// 素因数分解
typedef pair<long long, long long> P;
vector<P> prime_factorize(long long n)
{
vector<P> res;
for (long long p = 2; p * p <= n; ++p)
{
if (n % p != 0)
continue;
int num = 0;
while (n % p == 0)
{
++num;
n /= p;
}
res.push_back(make_pair(p, num));
}
if (n != 1)
res.push_back(make_pair(n, 1));
return res;
}
// 因数分解
long long gcd(long long x, long long y)
{
  if (y == 0)
  {
    return x;
  }
  else
  {
    return gcd(y, x % y);
  }
}
const int MOD = 1000000007;
typedef long long unsigned int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < (n); i++)

int main()
{
    string s, t;
    cin >> s >> t;
    int a, b;
    cin >> a >> b;
    string u;
    cin >> u;
    if(s==u){
        cout << a - 1 << " " << b << endl;
    }else{
        cout << a << " " << b - 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 3572
N = int(input())
a = list(int(i) for i in input().split()) 

a.sort(reverse = True) ##sortとreveseの一括操作

A = 0
B = 0

for i in range(N):
	if i % 2 == 0:
		A += a[i]
	else:
		B += a[i]

print(A-B)

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


int main(void){
  int N;
  int i;
  char S[100010];
  scanf("%d", &N);
  scanf("%s", S);
  int ans = 1;
  

  for (i = 0; i < N-1; i++) {
    if (S[i] != S[i+1]) {
      ans++;
    }
  }

  printf("%d\n", ans);
}


Measured memory_bytes: 256
import numpy as np

def test():
    c = np.array([list(map(int,input().split())) for i in range(3)])
    a = c - np.min(c,axis=0)
    if a[0][0]==a[0][1]==a[0][2] and a[1][0]==a[1][1]==a[1][2] and a[2][0]==a[2][1]==a[2][2]:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    test()


Measured memory_bytes: 12400
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>

using namespace std;

#define mod 1000000007

int main()
{
	int n;
	cin >> n;
	int t[101];
	int sum = 0;
	for(int i = 0; i < n; i++){
		cin >> t[i];
		sum += t[i];
	}
	int m;
	cin >> m;
	for(int i = 0; i < m; i++){
		int p, x;
		cin >> p >> x;
		p--;
		cout << sum - t[p] + x << endl;
	}
	return 0;
}

Measured memory_bytes: 256