akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <climits>
#include <bits/stdc++.h>
#include <cmath>
#include <stdio.h>
#include <utility>
using namespace std;
#define ll long long

int main()
{
  ll n,k,x,y;cin>>n>>k>>x>>y;
  ll sum=0;
  if(n<=k){
    sum=n*x;
  }else{
      sum=(k*x)+((n-k)*y);
  }
  cout<<sum<<endl;
return 0;
}


Measured memory_bytes: 256
<?php
$s = trim(fgets(STDIN));
$count["a"] = 0;
$count["b"] = 0;
$count["c"] = 0;
for($i = 0, $L = strlen($s); $i < $L; $i++){
  $count[$s[$i]]++;
}
echo max($count) - min($count) <= 1 ? "YES" : "NO";

Measured memory_bytes: 4728
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> tl3;



const int BIG_NUM = 1e9;
const ll INF = 1000000000000000000;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;



int main() {
	vector<pii> m(5);
	for (int i = 0; i < 5; i++) {
		int t;
		cin >> t;
		int w = (10 - t % 10) % 10;

		m[i] = make_pair(w, t);

	}

	sort(m.begin(), m.end());

	int sum = 0;
	for (int i = 0; i < 5; i++) {
		sum += m[i].first + m[i].second;
	}

	sum -= m[4].first;

	cout << sum << endl;
}


Measured memory_bytes: 3632
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VV(T, a, b, c) vector<vector<T>>(a, vector<T>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define VVV(T, a, b, c, d)                                                     \
  vector<vector<vector<T>>>(a, vector<vector<T>>(b, vector<T>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  cin >> N;
  ll po = (N + 999) / 1000;
  cout << (po * 1000) - N << endl;
  return 0;
}


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

using namespace std;

const int N = 105;
const int W = 1e5 + 5;
int n, w;
long long dp[N][W];
pair<int, int> arr[N];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    cin >> n >> w;

    for(int i = 1; i <= n; i++){
        int a, b;
        cin >> a >> b;
        arr[i] = {a, b};
    }

    dp[1][arr[1].first] = arr[1].second;

    for(int i = 2; i <= n; i++){

        for(int k = 1; k <= w; k++){
            dp[i][k] = dp[i - 1][k];
            if(k - arr[i].first >= 0){
                dp[i][k] = max(dp[i - 1][k], dp[i - 1][k - arr[i].first] + (long long) arr[i].second);
            }
            //cout << dp[i][k] << " ";
        }
        //cout << '\n';
    }

    long long fmax = -1;
    for(int i = 1; i <= w; i++){
        fmax = max(fmax, dp[n][i]);
    }

    cout << fmax << '\n';
    return 0;
}

Measured memory_bytes: 78592
#include<stdio.h>
int main(void)
{
	int N;
		scanf("%d", &N);
	if (N % 10 == 2 || N % 10 == 4 || N % 10 == 5 || N % 10 == 7 || N % 10 == 9)
	{
		printf("hon");
	}
	else if (N % 10 == 0 || N % 10 == 1 || N % 10 == 6 || N % 10 == 8)
	{
		printf("pon");
	}
	else if (N % 10 == 3)
	{
		printf("bon");
	}
	return 0;
}

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

int main(){
    double x=0,y=0;
    int degree = 90;
    double t;
    int d;
    char c;
    double pi = 3.141592;
    while(true){
       cin >> t;
       x += t*cos(degree*pi/180);
       y += t*sin(degree*pi/180);
      	cin >> c;
       cin >> d;

       degree += d;
       if(t==0&&d==0)
		break;
       
    }
    cout << -(int)x << endl;
    cout << (int)y << endl;
    x = 0,y = 0;
    
    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int h,w;
int fie[1005][1005];
int dist[1005][1005];
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};

int main(void){
	scanf("%d%d",&h,&w);
	for(int i=0;i<h;i++){
		string s;
		cin >> s;
		for(int j=0;j<w;j++){
			if(s[j]=='#'){
				fie[i][j]=1;
			}
		}
	}
	queue<P> que;
	memset(dist,-1,sizeof(dist));
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(fie[i][j]==1){
				dist[i][j]=0;
				que.push(P(i,j));
			}
		}
	}
	while(que.size()){
		P p=que.front();
		que.pop();
		for(int i=0;i<4;i++){
			int nx=p.second+dx[i];
			int ny=p.first+dy[i];
			if(nx<0 || nx>=w || ny<0 || ny>=h)continue;
			if(dist[ny][nx]==-1){
				dist[ny][nx]=dist[p.first][p.second]+1;
				que.push(P(ny,nx));
			}
		}
	}
	int ma=0;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			ma=max(ma,dist[i][j]);
		}
	}
	printf("%d\n",ma);
	return 0;
}


Measured memory_bytes: 16272
n = int(input())
data = []
for i in range(n):
    x, l = map(int, input().split())
    data.append([x, l])
data = sorted(data, key = lambda x: x[0] + x[1])
ans = 0
pre = -(10 ** 10)
for i in range(n):
    if data[i][0] - data[i][1] >= pre:
        ans += 1
        pre = data[i][0] + data[i][1]

print(ans)

Measured memory_bytes: 29572
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    int n,i;
    cin>>n;
    int v[n];
    set<int> s;
    map<int,int> f1,f2;
    for (i=0;i<n;i++)
    {
        cin>>v[i];
        s.insert(v[i]);
    }
    if (s.size()==1)
        cout<<n/2<<endl;
    else
    {
        for (i=0;i<n;i+=2)
        {
            f1[v[i]]++;
            f2[v[i+1]]++;
        }
        vector<pair<int,int>> w1,w2;
        //int mx1=0,mx2=0;
        for (auto e: f1)
            w1.pb(mp(e.ss,e.ff));
        for (auto e: f2)
            w2.pb(mp(e.ss,e.ff));
        sort(w1.begin(),w1.end(),greater<pair<int,int>>());
        sort(w2.begin(),w2.end(),greater<pair<int,int>>());
        int ans=n;
        if (w1[0].ss!=w2[0].ss)
            ans=n-w1[0].ff-w2[0].ff;
        else
        {
            if (w1.size()>1 && w1[1].ss!=w2[0].ss)
                ans=min(ans,n-w1[1].ff-w2[0].ff);
            if (w2.size()>1 && w1[0].ss!=w2[1].ss)
                ans=min(ans,n-w1[0].ff-w2[1].ff);
            ans=min(ans,n-max(w1[0].ff,w2[0].ff));
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 11128
using System;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
 
class DandA {
    static void Main(string[] args) {
        int[] aaa = ReadLineIntArray();
        if (aaa[0] + aaa[1] + aaa[2] <= 21) {
            Console.WriteLine("win");
        } else {
            Console.WriteLine("bust");
        }
    }
  
    static private string ReadLineStr() {return Console.ReadLine();}
    static private int ReadLineInt() {return int.Parse(Console.ReadLine());}
    static private string[] ReadLineStrArray() {return Console.ReadLine().Trim().Split();}
    static private int[] ReadLineIntArray() {return Console.ReadLine().Trim().Split().Select(a => int.Parse(a)).ToArray();}
    static private long[] ReadLineLongArray() {return Console.ReadLine().Trim().Split().Select(a => long.Parse(a)).ToArray();}
    static private string[][] ReadMLineStrArray(int arg) { return new int[arg].Select(_ => Console.ReadLine().Split()).ToArray();}
    static private int[][] ReadMLineIntArray(int arg) { return new int[arg].Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).ToArray();}

    static private bool IsPrime(int num) {
        if (num < 2) return false;
        if (num == 2) return true;
        else if (num % 2 == 0) return false;
        double sqrtNum = Math.Sqrt(num);
        for (int i = 3; i <= sqrtNum; i += 2) {
            if (num % i == 0) return false;
        }
        return true;
    }
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1000+5;
queue<int>q[MAXN];
bool biaoji[MAXN];
int n;
bool pan()
{
	for(int i = 1;i <= n;i++){
		if(!q[i].empty()) return false;
	}
	return true;
}
int main()
{
	cin >> n;
	for(int i = 1;i <= n;i++){
		for(int j = 1;j <= n-1;j++){
			int t;
			scanf("%d",&t);
			q[i].push(t);
		}
	}
	for(int i = 1;;i++){
		memset(biaoji,true,sizeof(biaoji));
		if(pan()){
			cout << i - 1 << endl;
			break;
		}
			
		int flag = 0;
		for(int j = 1;j <= n;j++){
			if(biaoji[j] && !q[j].empty()){
				int t = q[j].front();
				if(biaoji[t] && !q[t].empty() && q[t].front() == j){
					biaoji[j] = false;
					biaoji[t] = false;
					flag = 1;
					q[j].pop();
					q[t].pop();
				}
			}
		}
		if(!flag){
			printf("-1\n");
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 6784
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll const mod=1e9+7;
double const pi=acos(-1);
int a[100500];
int s[100500];
int main()
{
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	int sum=0;
	while(m--)
	{
		int x,y;
		cin>>x>>y;
		if(a[x]==a[y])
		{
			s[x]=1;
			s[y]=1;
		}else if(a[x]>a[y]){
			s[y]=1;
		}else if(a[x]<a[y]){
			s[x]=1;
		}	
	}
	for(int i=1;i<=n;i++)
	{
		if(s[i]==0)
		{
			sum++;
		}
	}
	
	cout<<sum<<endl;
    return 0;
}


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

/*
*****************code written By**********************
..................Marajul islam.......................
...................BSMRSTU,CSE........................
*/

int sc1()
{
    int x;
    scanf("%d", &x);
    return x;
}

long long sc2()
{
    long long x;
    scanf("%lld", &x);
    return x;
}



#define  gcd(a,b)         __gcd(a,b)
#define  lcm(a,b)         (a*b)/gcd(a,b)
#define  Int              sc1()
#define  LL               sc2()
#define  For(n)           for(int i=0;i<n;i++)
#define  Forj(n)          for(int j=0;j<n;j++)
#define  Fork(n)          for(int k=0;k<n;k++)
#define  For1(n)          for(int i=1;i<=n;i++)
#define  ll               long long
#define  vi               std::vector<int>
#define  vll              std::vector<ll>
#define  qui              qu
#define  pb               push_back
#define  mpsi             std::map<string, int>


const int mod           = 1e9 + 7;
const int inf           = (int)2e9 + 5;
const ll  Inf           = (ll)1e18 + 5;
const int N             = 5e6 + 5;

inline int add(int a, int b)
{
    a += b;
    return a >= mod ? a - mod : a;
}
inline int sub(int a, int b)
{
    a -= b;
    return a < 0 ? a + mod : a;
}
inline int mul(int a, int b)
{
    return (ll)a * b % mod;
}


int ac[100005];
int pena[100005];
int solve()
{

    int n,m,k;
    cin>>n>>m;
    ll cnt=0,pel=0;
    for(int i=0; i<m; i++)
    {
        int a;
        string s;
        cin>>a>>s;
        if(!ac[a])
        {
            if(s=="AC")
            {
                cnt++;
                pel+=pena[a];
                ac[a]=1;
            }
            else{
                pena[a]++;
            }
        }
    }
    cout<<cnt<<" "<<pel<<endl;


    return 0;
}




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

    int test = 1, tc = 0;
    //scanf("%d", &test);
    //cin >> test;
    while (test--)
    {
        //printf("Case %d: ", ++tc);
        solve();
    }

    return 0;




}




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

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))


int d[10];

bool ok(int x){
    while (x) {
        if (d[x%10]) return false;
        x /= 10;
    }
    return true;
}
int solve(int N){
    for (int x=N; x<=999999; ++x) {
        if (ok(x)) return x;
    }
}

int main() {
    int n,k; cin>>n>>k;
    mset(d, 0);
    rep(i,k) {
        int di; cin >> di;
        d[di] = 1;
    }
    cout<<solve(n)<<endl;
    return 0;
}


Measured memory_bytes: 256
n,k,q=map(int,input().split())
l=[0]*n
for i in range(q):
    a=int(input())
    l[a-1]+=1
for j in range(n):
    l[j]+=(k-q)
for x in range(n):
    if l[x]>0:
        print("Yes")
    else:
        print("No")

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

int main() {
  int a,b,d,o;
  cin >> a >> b;
  double c,n = 1.0000000,m = 1.0000000,k = 0.000001;
  d = a / b;
  o = a % b;
  
  c = (a * n) / (b * m) * k;
  cout << fixed << setprecision(5) << d << " " << o << " " << c * 1000000 << endl;
}


Measured memory_bytes: 3284
from heapq import heappush, heappop
import re
from collections import deque
import sys
import math
input = sys.stdin.readline


def int_raw():
    return int(input())


def ss_raw():
    return input().split()


def ints_raw():
    return tuple(map(int, ss_raw()))


DIV = 10**9+7


def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)


def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b


def ncr(n, r, mod=DIV):
	r = min(r, n-r)
	ret = 1
	for i in range(1, r+1):
		ret = ret * (n-i+1) % mod
		ret = ret * mod_inv(i, mod) % mod
	return ret


def main():
    K,X = ints_raw()
    return " ".join([str(i) for i in range(X-K+1,X+K)])
    
print(main())


Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less 
using namespace __gnu_pbds; 
#define mod 998244353 
#define int long long
#define ll long long
#define pb push_back
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define inp(n) for(i=0;i<n;i++) cin>>A[i];
#define inz(A) memset(A,0,sizeof(A))
#define lb lower_bound
#define ub upper_bound
#define all(v) v.begin(),v.end()
#define T 1000005
#define F first
#define S second
#define pi pair<int,int>
#define vi vector<int>
#define mii map<int,int>
#define vp vector<pair< int,int> >
#define mpi map<pair<int,int> ,int>
#define PI M_PI
#define lower(s) transform(all(s),s.begin(),::tolower)
#define endl "\n"
typedef tree<int, null_type, less<int>, rb_tree_tag, 
         tree_order_statistics_node_update> pbds;
int add(int a, int b) {a=(a%mod + b%mod)%mod;return a;}
int sub(int a, int b) {a =(a%mod - b%mod + mod)%mod ;return a;}
int mul(int a, int b) {return (a%mod * b%mod) % mod;}


void solve()
{   
   int n;cin >> n;
   int A[n+5],ans[n+5],x=0;
   for(int i=0;i<n;i++)
   {
     cin >> A[i];
     x=x^A[i];
   }
   for(int i=0;i<n;i++)
   {
      cout << (x ^ A[i]) << " ";
   }
}

signed main()
{ boost
  int test=0,t;
    //cin >> t ;
    t=1;
   while(test++ <t){
	  //cout<<"Case #"<<test<<": ";
	   solve();}
  
}

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

int main(){
    ll n, i = 1;
    cin >> n;
    string ans = "";
    if (n == 0) ans = "0";
    while (n != 0){
        if (n % (-2) == 1){
            ans = '1' + ans;
            n /= -2;
        }
        else if (n % (-2) == -1){
            ans = '1' + ans;
            n /= -2;
            n ++;
        }
        else{
            ans = '0' + ans;
            n /= -2;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
module Main where

import Control.Applicative
import Numeric
import Data.List (transpose) 

main :: IO ()
main = do
  {[r, c] <- getInts
  ; mat <- loop r 
  ; mapM_  putInts (autoSum mat)
  }

loop :: Int -> IO [[Int]]
loop 0 = return []
loop r = do
  { xs <- getInts
  ; xss <- loop (r-1)
  ; return (xs : xss)
  }

autoSum :: [[Int]] -> [[Int]]
autoSum = transpose  .  map addSum . transpose . map addSum

addSum :: [Int] -> [Int]
addSum xs = xs ++ [sum xs]


--
getInts :: IO [Int]
getInts = map read . words <$> getLine

putInts :: [Int] -> IO ()
putInts = putStrLn .  unwords . map show

getDoubles :: IO [Double]
getDoubles = map read . words <$> getLine

putDoubles :: [Double] -> IO ()
putDoubles = putStrLn . unwords . map showDouble

showDouble :: Double -> String
showDouble d = showFFloat Nothing d ""



Measured memory_bytes: 8252
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n+1); i++)
const long long INF = 1LL << 60;
int main(){
  ll N;
  cin>>N;
  for(ll i=1; i<100000; i++){
      if(N<=i*i){
          if(i*i==N){
              cout<<i*i<<endl;
            	break;
          }
          else{
              cout<<(i-1)*(i-1)<<endl;
            break;
          }
      }
  }
}

Measured memory_bytes: 3564
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using vi = vector<int>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define eb(val) emplace_back(val)
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1e9+7;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
signed main(){
  int a[3];
  REP(i,3) cin >> a[i];
  sort(a,a+3);
  cout << a[0]*a[1]/2 << endl;
}

Measured memory_bytes: 768
import Control.Monad
import Data.List

main = do
  li <- getLine
  let n = read li :: Int
  as <- forM [1..n] (\_ -> do
    li <- getLine
    return $ read li
    )
  let ans = compute as
  sequence_ $ map print ans

compute :: [Int] -> [Int]
compute as = [ if a == m1 then m2 else m1 | a <- as ]
  where (m1:m2:_) = reverse $ sort as


Measured memory_bytes: 107132
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

    ans = 0
    for i in range(N - 1):
        ans += B[A[i] - 1]

        if A[i] + 1 == A[i+1]:
            ans += C[A[i] - 1]

    ans += B[A[-1] -1]

    print(ans)



if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);

    ll n;
    cin >> n;
    ll a[n];
    ll b[n];
    for (ll i=0;i<=n-1;i++)
    {
        cin >> a[i] >> b[i];
    }

    sort(a,a+n);
    sort(b,b+n);

    if (n%2==0)
    {
        // n is even
        ll alpha=(a[(n/2)-1]+a[n/2]);
        ll beta=(b[(n/2)-1]+b[n/2]);
        cout << (beta-alpha)+1 << endl;
    }
    else
    {
        // n is odd
        ll alpha=a[(n-1)/2];
        ll beta=b[(n-1)/2];
        cout << beta-alpha+1 << endl;
    }

    return 0;
}

Measured memory_bytes: 6764
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1);
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; }

int main() {
    int n; cin >> n;
    vector<string> s(n);
    rep(i, n) cin >> s[i];
    int ac = 0, wa = 0, tle = 0, re = 0;
    rep(i, n) {
        if (s[i] == "AC") ac++;
        if (s[i] == "WA") wa++;
        if (s[i] == "TLE") tle++;
        if (s[i] == "RE") re++;
    }
    printf("AC x %d\n", ac);
    printf("WA x %d\n", wa);
    printf("TLE x %d\n", tle);
    printf("RE x %d\n", re);
}


Measured memory_bytes: 6424
#include<bits/stdc++.h>
#define faster  ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ull unsigned long long
#define pb push_back
const double PI = acos(-1.0);
using namespace std;

int main()
{
    faster

    int n;
    cin>>n;

    string s;

    int a=0,w=0,t=0,r=0;

    while(n--)
    {
        cin>>s;

        if(s=="AC")
            a++;
        else if(s=="WA")
            w++;
        else if(s=="TLE")
            t++;
        else
            r++;


    }

    cout<<"AC x "<<a<<endl;
    cout<<"WA x "<<w<<endl;
    cout<<"TLE x "<<t<<endl;
    cout<<"RE x "<<r<<endl;





    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

template<class T> vector<T> divisors(T x) {
  vector<T> ret;
  int p = 1;
  while((ll)p * p <= x) {
    if(x % p == 0) {
      ret.push_back(p);
      ret.push_back(x/p);
    }
    p ++;
  }
  return ret;
}

int main() {

  int N; cin >> N;
  vector<int> S(N); rep(i, N) { cin >> S[i]; }
  auto d = divisors(N);
  sort(all(d));
  for(auto T: d) {
    bool ok = 1;
    rep(i, N/T) {
      rep(j, T) { ok &= S[j] == S[i*T+j]; }
    }
    if(ok) {
      cout << N / T << endl;
      return 0;
    }
  }

  return 0;
}

Measured memory_bytes: 3616
#include <iostream>

using namespace std;


int a, b, c;
int n;
int main()
{
	cin >> a >> b >> c;
	for (int i = 1; i < b; i++) {
		n = a*i % b;
		if (n == c) {
			cout << "YES\n";
			return 0;
		}
		else if (n == 0) {
			break;
		}
	}
	cout << "NO\n";

	return 0;
}

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

struct Node {
  int key;
  Node *parent, *left, *right;
};

Node *NIL, *root;

void preorder(Node *node) {
  cout << " " << node->key;
  if (node->left != NIL) preorder(node->left);
  if (node->right != NIL) preorder(node->right);
}

void inorder(Node *node) {
  if (node->left != NIL) inorder(node->left);
  cout << " " << node->key;
  if (node->right != NIL) inorder(node->right);
}

void print() {
  inorder(root);
  cout << endl;
  preorder(root);
  cout << endl;  
}

void insert(int key) {
  Node *x, *y, *z;
  y = NIL;
  x = root;
  z = new Node;
  
  while (x != NIL) {
    y = x;
    if (key < x->key) x = x->left;
    else x = x->right;
  }
  
  z->parent = y;
  if (y == NIL) root = z;
  else if (key < y->key) y->left = z;
  else y->right = z;
  z->key = key;
  z->left = NIL;
  z->right = NIL;
}

int main() {
  int m, key;
  string com;
  // init
  NIL = new Node;
  root = NIL;

  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> com;
    if (com[0] == 'i') {
      cin >> key;
      insert(key);
    } else {
      print();
    }
  }

  return 0;
}



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


int main(){
    ll n, m, k;
    cin >> n >> m >> k;



    rep(i, n+1){
        rep(j, m+1){
            ll s = (m*i) + (n*j) - 2*i*j;
            if(s == k){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;


    return 0;
}


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

using namespace std;

int main () {

    // S = A + 2A + 3A + 4A + 5A ... n(A)

    int t, a, b;
    int s = 0;
    cin >> a >> b >> t;

    int A = a;

    while (A <= t) {
        s += b;
        A += a;
    }
    
    cout << s << endl;

    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Big Integers - Multiplication of Big Integers II
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_2_F&lang=jp

"""
import sys


def main(args):
    A, B = map(int, input().split())
    print(A * B)


if __name__ == '__main__':
    main(sys.argv[1:])



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

bool is_prime(int x) {
    if (x  == 2) return true;
    if (x % 2 == 0) return false;
    int i = 3;
    while(i * i <= x) {
        if (x % i == 0) return false;
        i++;
    }
    return true;
}

int main() {
    int n, x, cnt;
    cin >> n;
    
    cnt = 0;
    for (int i = 0; i < n; i++) {
        cin >> x;
        if(is_prime(x)) cnt++;
    }
    cout << cnt << endl;
}



Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int A,B;

int main(){
	cin>>A>>B;
	cout<<A+B/2<<endl;
}

Measured memory_bytes: 256
-module('Main').
-export([main/1]).

main(_) ->
    {ok, [S]} = io:fread("", "~s"),
    Char = lists:nth(1, S),
    case lists:member(Char, lists:seq($A, $Z)) of
        true ->
            io:format("A~n");
        false ->
            io:format("a~n")
    end,
    halt().

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

int main()
{ 
    string s1,s2;
    cin>>s1>>s2;
    int c=0;
    for(int i=0;i<s1.length();i++)
    {
        if(s1[i]==s2[i])
        continue;
        else
        c++;
    }
    cout<<c;

}
 

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

using namespace std;

string s0 = "CODEFESTIVAL2016";
string s;

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> s;

    int ans = 0;

    for (int i = 0; i < 16; ++i) {
        if (s[i] != s0[i]) {
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}



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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin>>s;
    vi p;
    int cnt=0;
    rep(i, s.size()-1){
        cnt++;
        if (s[i]!=s[i+1]){
            p.pb(cnt);
            cnt = 0;
        }
    }
    p.pb(++cnt);

    vi ans(s.size(), 0);
    int idx = 0;
    for(int i=0; i<p.size()/2; i++){
        idx+=p[2*i];
        ans[idx-1] += (p[2*i]+1)/2 + p[2*i+1]/2;
        ans[idx]   += (p[2*i+1]+1)/2 + p[2*i]/2;
        idx+=p[2*i+1];
    }
    for(auto e:ans){cout << e << " ";}
    cout<<"\n";
    return 0;
}

//R RL LLL,  RL,  R RL L


Measured memory_bytes: 1480
import copy
H,W,K = map(int,input().split())
A = [list(map(int,list(input()))) for _ in range(H)]
scrmax = 0
for i in range(1,H):
    for j in range(W):
        cnt = 0
        scr = 0
        B = copy.deepcopy(A)
        B[i][j] = 0
        for k in range(i,0,-1):
            B[k][j] = B[k-1][j]
            B[k-1][j] = 0
        while True:
            flg = 0
            for i1 in range(H):
                C = []
                while True:
                    flg1 = 0
                    cur = 0
                    m = 0
                    b = -1
                    ind = -1
                    for j1 in range(1,W):
                        if B[i1][j1]>0 and B[i1][j1]==B[i1][j1-1]:continue
                        else:
                            if B[i1][cur]>0 and j1-cur>m:
                                m = j1-cur
                                b = B[i1][cur]
                                ind = cur
                            cur = j1
                    if B[i1][cur]>0 and W-cur>m:
                        m = W-cur
                        b = B[i1][cur]
                        ind = cur
                    if m>=K:
                        flg = 1
                        flg1 = 1
                        scr += 2**cnt*b*m
                        B[i1][ind:ind+m] = [0 for _ in range(m)]
                        C.append([ind,m])
                    if flg1==0:break
                for ind,m in C:
                    for j1 in range(ind,ind+m):
                        for k in range(i1,0,-1):
                            B[k][j1] = B[k-1][j1]
                            B[k-1][j1] = 0
            if flg==0:break
            cnt += 1
        scrmax = max(scrmax,scr)     
print(scrmax)

Measured memory_bytes: 57564
#![allow(dead_code)]
use crate::scanner::Scanner;
fn main() {
    let mut scan = Scanner::new();
    let a = scan.read::<i64>();
    let mut b = scan.read::<String>();
    b.retain(|c| c != '.');
    println!("{}", a * b.parse::<i64>().unwrap() / 100);
}
mod scanner {
    use std::io::{stdin, BufReader, Bytes, Read, Stdin};
    use std::str::FromStr;
    pub struct Scanner {
        buf: Bytes<BufReader<Stdin>>,
    }
    impl Scanner {
        pub fn new() -> Scanner {
            Scanner {
                buf: BufReader::new(stdin()).bytes(),
            }
        }
        pub fn read_next<T: FromStr>(&mut self) -> Option<T> {
            let token = self
                .buf
                .by_ref()
                .map(|c| c.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect::<String>();
            token.parse::<T>().ok()
        }
        pub fn read<T: FromStr>(&mut self) -> T {
            self.read_next().unwrap()
        }
        pub fn readn<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.read::<T>()).collect()
        }
        pub fn chars(&mut self) -> Vec<char> {
            self.read::<String>().chars().collect()
        }
    }
}



Measured memory_bytes: 2168
#define rep(i, a, b) for(int i = a; i < (int)(b); i++)
#include <bits/stdc++.h>

typedef long long ll;
using namespace std;
template<class T> inline void chmax(T &a, const T &b) {if(a < b) a = b;}
template<class T> inline void chmin(T &a, const T &b) {if(a > b) a = b;}
const long long INF = 1LL<<60;
const long long MOD = (ll)1e9+7;
const long long MAX = (ll)170 * 80;


int main(void) {
   ll N;
   cin>>N;
   cout<<180*N-360<<endl;

   


   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i ,n) for(int i = 0 ; i < (n) ; i ++ )
#define all(x) (x).begin(),(x).end()
using ll = long long;
using namespace std;
bool is_ok(int x){
  int cnt;
  for(int j = 1 ; j <= x ; j ++ ){
    if(j==1) cnt=0;
    if(x%j==0){
      cnt++;
    }
    
  // if(j==x)cout<<cnt<<endl;
  }
  if(cnt==8&& x%2==1) return true;
  else return false;
}

int main() {
  int n;
  cin>>n;
  int ans=0;
  
  for(int i=1;i<=n;i++){
    if(is_ok(i)){
      ans++;
    }
   //cout<<ans<<endl;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int INF=1e9+5;

int main(){
    int n;
    cin>>n;
    vector<int> dp(3,0);
    for(int days=0;days<n;days++){
        vector<int> c(3);
        vector<int>new_dp(3,0);
        for(int i=0;i<3;i++) cin>>c[i];
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                if(i!=j){
                    new_dp[j]=max(new_dp[j],dp[i]+c[j]);
                }
            }
        }
        dp=new_dp;
    }
    cout<<max({dp[0],dp[1],dp[2]});
    return 0;
}

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

int main() {
    
    //青
    int N;
    cin >> N;
    vector<string> s(N);
    for (int i = 0; i < N; i++) {
        cin >> s.at(i);
    }

    //赤
    int M;
    cin >> M;
    vector<string> t(M);
    for (int i = 0; i < M; i++) {
        cin >> t.at(i);
    }
    
    int max = 0;

    //青でforル
    for (int i = 0; i < N; i++) {
        int count = 0;

        for (int j = 0; j < N; j++) {
            if (s.at(i) == s.at(j)) 
               count++;
        }

        for (int j = 0; j < M; j++ ) {
            if (s.at(i) == t.at(j))
               count--;
        }

        if (max < count)
           max = count;
    }

    cout << max << endl;
}

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

#define LL long long
using namespace std;

struct DATA{
    LL price,value;
    DATA(LL inPrice, LL inValue){
        price = inPrice;
        value = inValue;
    }
};

bool cmp(const DATA &a, const DATA &b){
    return a.price < b.price;
}

int main(void){
    LL N, M, sum = 0;
    vector<DATA> data;
    cin >> N >> M;

    for(LL i = 0; i < N; i++){
        LL tmpPrice, tmpValue;
        cin >> tmpPrice >> tmpValue;
        data.push_back(DATA(tmpPrice, tmpValue));
    }

    std::sort(data.begin(),data.end(), cmp);

    for(LL i = 0; i < N; i++){
        if(data[i].value > M){
            sum += data[i].price * M;
        }else{
            sum += data[i].price * data[i].value;
        }
        M -= data[i].value;
        if(M <= 0){
            break;
        }
    }

    cout << sum << endl;
    return 0;
}


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

int main(){
    int n;
    cin >> n;
    int a,b,c,d,op1,op2,op3;
    a=n/1000;
    b=n/100-a*10;
    c=n/10-a*100-b*10;
    d=n-a*1000-b*100-c*10;
    bool h=true;
    rep(i,2){
        rep(j,2){
            rep(k,2){
                int sum=a;
                if(i)sum+=b;
                else sum-=b;
                if(j)sum+=c;
                else sum-=c;
                if(k)sum+=d;
                else sum-=d;
                if(sum==7&&h){
                    cout<<a;
                    if(i)cout<<'+';
                    else cout<<'-';
                    cout<<b;
                    if(j)cout<<'+';
                    else cout<<'-';
                    cout<<c;
                    if(k)cout<<'+';
                    else cout<<'-';
                    cout<<d<<"=7"<<endl;
                    h=false;
                }
            }
        }
    }

    return 0;
}

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

int main(){
    int r,D,x_2000;
    cin >> r>>D>>x_2000;
    int x_i,x_i1;
    x_i=x_2000;
    for(int i=0;i<10;i++){
        x_i1=r*x_i-D;
        cout<<x_i1<<endl;
        x_i=x_i1;
        }
    return 0;}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<string.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int solve(int n,vector<int> table){
	if(table[n]!=-1){
		return table[n];
	}else{
		int min=n+1;
		int k=1;
		while(k<=n){
			if(solve(n-k,table)<min) min=solve(n-k,table);
			k*=6;
		}
		k=9;
		while(k<=n){
			if(solve(n-k,table)<min) min=solve(n-k,table);
			k*=9;
		}
		table[n]=min+1;
		return min+1;
	}
}
int solve2(vector<int> q,int step){
	cout<<step<<endl;
	vector<int> next_q;
	rep(i,q.size()){
		if(q[i]==0){
			return step;
		}else{
			int k=1;
			while(k<=q[i]){
				next_q.push_back(q[i]-k);
				k*=6;
			}
			k=9;
			while(k<=q[i]){
				next_q.push_back(q[i]-k);
				k*=9;
			}
		}
	}
	return solve2(next_q,step+1);
}
	

	

	
	

int main(){
	int n;
	cin>>n;
	int min=n;
	rep(i,n+1){
		int sum=0;
		int t=i;
		while(t>0)sum+=t%6,t=t/6;
		t=n-i;
		while(t>0)sum+=t%9,t=t/9;
		if(sum<min) min=sum;
	}


	cout<<min<<endl;

	return 0;
}

Measured memory_bytes: 256
function parseInt(x) parse(Int, x) end

function isPrime(x)
	if x <= 1
		return(0)
	elseif x == 2
		return(1)
	elseif x%2 == 0
		return(0)
	else
		i = 3
		flg = 0
		while i <= floor(sqrt(x))
			if x%i == 0
				return(0)
				flg = 1
				break
			else
				i += 2
			end
		end
		if flg == 0
			return(1)
		end
	end
end

function isBPrime(x)
  if isPrime(x) == 1 && isPrime(div(x+1,2)) == 1
    return(1)
  else
    return(0)
  end
end

function main()
  x = Array{Int}(100000)
  x[1] = 0
  for i in 2:100000
  	x[i] = x[i-1]+isBPrime(i)
  end
  q = parseInt(readline())
  for i in 1:q
    l, r = map(parseInt, split(readline()))
    if l == 1
    	println(x[r])
    else
	    println(x[r]-x[l-1])
	end
  end
end

main()

Measured memory_bytes: 153732
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  int k;
  cin>>k;
  vector<ll> A(k);
  rep(i,k)cin>>A[i];
  vector<ll> L(k+1);
  vector<ll> R(k+1);
  L[k]=2;
  R[k]=2;
  revrep(i,k) {
    ll X=A[i]*((L[i+1]+A[i]-1)/A[i]);
    ll Y=A[i]*(R[i+1]/A[i]);
    if(Y<X) {
      cout << "-1" << endl;
      return 0;
    }
    L[i]=X;
    R[i]=Y+A[i]-1;
  }
  cout << L[0] << " " << R[0] << endl;
  return 0;
}


Measured memory_bytes: 2560
IDENTIFICATION DIVISION.
PROGRAM-ID. A-BEGINNER.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 INP     PIC X(401).
01 IN-DATA.
   03 DT-X1 PIC X(10).
   03 DT-X2 PIC X(10).
01 IN-LEN.
   03 DT-L1 PIC 9(2).
   03 DT-L2 PIC 9(2).
01 IN-N     PIC 9(3).
01 IN-X-ALL.
   03 IN-X     PIC 9(3) OCCURS 100.
01 I        PIC 9(3).
01 P1       PIC 9(3).
01 P2       PIC 9(3).
01 XP       PIC 9(5).
01 AVG      PIC 9(3).
01 X-P2     PIC 9(7).
01 OUT-P    PIC ZZZZZZ9.

PROCEDURE DIVISION.
MAIN-001.
  ACCEPT INP.
  UNSTRING INP DELIMITED BY ALL ' '
      INTO DT-X1 COUNT IN DT-L1.
  MOVE DT-X1(1:DT-L1) TO IN-N.

  ACCEPT INP.
  MOVE 0 TO I XP.
  MOVE 1 TO P1.
  PERFORM UNTIL I >= IN-N
    MOVE P1 TO P2
    PERFORM UNTIL INP(P1:1) < '0' OR INP(P1:1) > '9'
      ADD 1 TO P1
    END-PERFORM

    ADD 1 TO I
    MOVE INP(P2:P1 - P2) TO IN-X(I)
    ADD  IN-X(I)         TO XP
    ADD 1 TO P1
  END-PERFORM.

  COMPUTE AVG = XP / IN-N + 0.5.

  MOVE 0 TO X-P2.
  PERFORM VARYING I FROM 1 BY 1 UNTIL I > IN-N
    COMPUTE X-P2 = X-P2 + (IN-X(I) - AVG) ** 2
  END-PERFORM.
  MOVE X-P2 TO OUT-P
  DISPLAY OUT-P.

MAIN-EXIT.
  STOP RUN.


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

using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second

#ifdef OJ
#define debug(x)  do{cerr<<#x<<": "<<x<<"\n";}while(0)
#define debugv(x) do{cerr<<#x<<": ";for(auto&e: (x))cerr<<e<<" ";cerr<<"\n";}while(0)
#else
#define debug(x)
#define debugv(x)
#endif

#define all(x) (x).begin(), (x).end()
#define rsort(x) sort((x).rbegin(), (x).rend())
#define fori(i, n) for (int i = 0; i < (int)(n); ++i)
#define ford(i, n, e) for (int i = (int)(n); i >= (int)(e); --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
template<typename T> bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
#define RETURN(x) do{cout << (x) << '\n'; return 0;}while(0)

const int MOD = 998244353; //1e9+7;
const int MAXN = 2e5+3;
const int INF = 1e9;

int main(int argc, char **argv) {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    //int ntest; cin >> ntest; while(ntest--) 
    {
        int a,b; cin >> a >> b;
        cout << a*b << endl;
    }

    return 0;
}


Measured memory_bytes: 3648
N = int(input())
a = list(map(int, input().split()))
res = 0
for i in range(1, N):
    res += a[i]
diff = a[0]-res
abs_ = abs(diff)
for i in range(1, N-1):
    diff += 2*a[i]
    abs_ = min(abs_, abs(diff))

print(abs_)


Measured memory_bytes: 24832
import sys
from collections import namedtuple
from itertools import starmap
readline = sys.stdin.readline
Segment = namedtuple('Segment', ('fi', 'se'))
EPS = 1e-9
def cross(a, b):
    return a.real * b.imag - a.imag * b.real
def dot(a, b):
    return a.real * b.real + a.imag * b.imag
def norm(base):
    return abs(base) ** 2
def project(s, p2):
    base = s.fi - s.se
    r = dot(p2 - s.fi, base) / norm(base)
    return s.fi + base * r
def reflect(s, p):
    return p + (project(s, p) - p) * 2.0
def ccw(p1, p2, p3):
    a = p2 - p1
    b = p3 - p1
    if cross(a, b) > EPS: return 1
    if cross(a, b) < -EPS: return -1
    if dot(a, b) < -EPS: return 2
    if norm(a) < norm(b): return -2
    return 0
def intersect4(p1, p2, p3, p4):
    return (ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0 and
			ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0)
def intersect2(s1, s2):
    return intersect4(s1.fi, s1.se, s2.fi, s2.se)
def getDistance(a, b):  return abs(a - b)
def getDistanceLP(l, p):
    return abs(cross(l.se - l.fi, p - l.fi) / abs(l.se - l.fi))
def getDistanceSP(s, p):
    if dot(s.se - s.fi, p - s.fi) < 0.0: return abs(p - s.fi)
    if dot(s.fi - s.se, p - s.se) < 0.0: return abs(p - s.se)
    return getDistanceLP(s, p)
def getDistances(s1, s2):
    if intersect2(s1, s2): return 0.0
    return min(getDistanceSP(s1, s2.fi), getDistanceSP(s1, s2.se),
               getDistanceSP(s2, s1.fi), getDistanceSP(s2, s1.se))
n = int(readline())
for _ in [0] * n:
    p0, p1, p2, p3 = starmap(complex, zip(*[map(int, input().split())] * 2))
    s1 = Segment(p0, p1)
    s2 = Segment(p2, p3)
    print("{0:.10f}".format(getDistances(s1, s2)))

Measured memory_bytes: 8192
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <random>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(g);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef deque<ll> dll;
ll mod = 1e9 + 7;


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

	int n, a;
	cin >> n >> a;
	cout << (n*n - a) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N; cin >> N; vector<int>a(N);
    for(int i=0; i<N; ++i) cin >> a[i];
    sort(a.rbegin(), a.rend());
    int x[2] = {0, 0};
    for(int i=0; i<a.size(); ++i)
        x[i&1] += a[i];
    cout << x[0] - x[1] <<endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
	int x[5],i;
	for (i=0;i<5;i++){
		cin>>x[i];
		if (x[i]==0){
			cout<<i+1<<endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 3184
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);
		long n = in.nextLong();
		long c = in.nextLong();
		long k = in.nextLong();
		ArrayList<Long> t = new ArrayList<>();

		for(int i=0; i<n; i++){
			t.add(in.nextLong());
		}
		Collections.sort(t);

		long count = 0;
		int i = 0;

		while(t.size()>0){
			while(i<t.size() &&t.get(0)>=t.get(i)-k && i<c){
				i++;
			}
			count++;
			for(int j=0; j<i; j++){
				t.remove(0);
			}
			i = 0;
		}
		System.out.println(count);
	}

}


Measured memory_bytes: 59272