akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<map>
#include<algorithm>
#include<cmath>

using namespace std;

void MakeConvertData(map<char, string>*);
string ConvertHexToBinary(map<char, string>&, const string&);
void Calculate(const string&);

int main(){
  int i, n;
  string str, str_;
  map<char, string> data;

  MakeConvertData(&data);

  cin >> n;
  for(i=0; i<n; ++i){
    cin >> str_;
    str = ConvertHexToBinary(data, str_);
    Calculate(str);
  }
  return 0;
}

void MakeConvertData(map<char, string>* data){
  data->insert(make_pair('0', "0000"));
  data->insert(make_pair('1', "0001"));
  data->insert(make_pair('2', "0010"));
  data->insert(make_pair('3', "0011"));
  data->insert(make_pair('4', "0100"));
  data->insert(make_pair('5', "0101"));
  data->insert(make_pair('6', "0110"));
  data->insert(make_pair('7', "0111"));
  data->insert(make_pair('8', "1000"));
  data->insert(make_pair('9', "1001"));
  data->insert(make_pair('a', "1010"));
  data->insert(make_pair('b', "1011"));
  data->insert(make_pair('c', "1100"));
  data->insert(make_pair('d', "1101"));
  data->insert(make_pair('e', "1110"));
  data->insert(make_pair('f', "1111"));
}

string ConvertHexToBinary(map<char, string>& data, const string& str_){
  string str;
  for(int i=0; i<str_.size(); ++i){
    str.append(data[str_[i]]);
  }
  return str;
}

void Calculate(const string& str){
  int i, j, k;
  double ans = 0;

  for(i=24, j=0; i>0; --i, ++j){
    if(str[i] == '1') ans += pow(2.0, j);
  }
  for(i=25, j=-1, k=1; i<32; ++i, --j){
    if(str[i] == '1'){
      ans += pow(2.0, j);
      k = -j;
    }
  }

  if(str[0] == '1') cout << "-";
  cout.setf(ios::fixed, ios::floatfield);
  cout.precision(k);
  cout << ans << endl;
}

Measured memory_bytes: 1296
import Control.Monad.State
import Control.Arrow
import Data.List

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

type PayPair = [Int]
type Price = Int
type Osatsu = Price
type Amount = Int

check :: Price -> Amount -> [Osatsu] -> PayPair
check _ _ [] = [-1]
check p a (o:[]) = if p /= a * o then [-1] else [a]
check p a (o:arr) = do
    if o * a < p then (-1):(map (\_ -> -1) arr)
    else do
        let pays = take (p `div` o + 1) [0..]
        let calcs = map tryPay pays
        let cands = filter (\x -> head x /= -1) calcs
        if length cands < 1 then head calcs else head cands
        where
            tryPay x = do
                let next = check (p - x * o) (a - x) arr
                if head next == -1 then (-1):next else x:next

main = do
    (a:p:_) <- getInts
    putStrLn $ map show >>> intercalate " " $ check p a [10000, 5000, 1000]



Measured memory_bytes: 1148
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < n; ++i)
#define FOR(i, b, n) for (ll i = b; i < n; ++i)

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

void solve(ll N) {
  ll ans = 0;
  FOR(i, 2, sqrt(N)) {
    if (N % i) continue;
    ll e = 0;
    while (N % i == 0) {
      ++e;
      N /= i;
    }
    // cout << i << " " << e <<endl;
    ll j = 1;
    while (e > 0) {
      if (e >= j)
	ans++;
      // cout << i << " " << j <<endl;
      e -= j;
      j++;
    }
  }
  if (N != 1)
    ans++;
  cout << ans << endl;
}

int main(){
  // int 3E4  long 2E9  ll 9E18
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll N;
  cin >> N;

  solve(N);

  return 0;
}


Measured memory_bytes: 3696
/********************/
                    /*user -> tushar284*/
                    /******************/
#include<bits/stdc++.h>
                                                    /*********/            
using namespace std;                             /*   __   __   */
#define  f              first                    /*   @ ) ( @   */
#define  s              second                   /*     / \     */            
#define  mp             make_pair                /*  __  -  __  */
#define  loop(i,s,e)    for(int i=s;i<e;i++)     /*    ..^..    */
#define  rev(i,s,e)     for(int i=s;i>=e;i--)     /*     |     */
#define  mod            1000000007                  /*   |   */
#define  pb             push_back                      /***/
#define  start	        int main()                     
#define  fast           ios_base::sync_with_stdio(false);cin.tie(0);
#define  test           int t; cin>>t;while(t--)
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef long long ll;

int h[100001],n,m;
vi adj[100001];

start
{   
    cin>>n>>m;
    loop(i,1,n+1)cin>>h[i];
    loop(i,0,m){
        int a,b;
        cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    int cnt=0;
    loop(i,1,n+1){
        bool ok = true;
        for(auto it:adj[i]){
            if(h[it] >= h[i]){
                ok=false;break;
            }
        }
        if(ok)cnt++;
    }
    cout<<cnt;
    
	return 0;
}


Measured memory_bytes: 9148
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int n,pos;
vector<int> pre,in,post;

void rec(int l,int r){
//	printf("	l=%d r=%d\n",l,r);
	if(l>=r)return;
	int root = pre[pos++];//visit in Preorder
	int m = distance(in.begin(),find(in.begin(),in.end(),root));//return distance between two iterators
//	printf("l = %d root = %d m = %d r = %d\n",l,root,m,r);

	rec(l,m);	
	rec(m+1,r);
	post.push_back(root);//left-right-root,if inOrder,put this above
//	printf("push %d\n\n",root);
}
int main()
{
	int n,k;
	scanf("%d",&n);
	for(int i=0;i<n;++i){
		scanf("%d",&k);
		pre.push_back(k);
	}
	for(int i=0;i<n;++i){
		scanf("%d",&k);
		in.push_back(k);
	}
 	pos = 0;
 	rec(0,pre.size());
 	for(int i=0;i<n;++i){
	 	if(i)printf(" ");
	 	printf("%d",post[i]);
 	}
    printf("\n");
 
	return 0;
}

Measured memory_bytes: 3244
from collections import deque

n=int(input())
list=deque()
for i in range(n):
  command=input()
  if command == "deleteFirst":
    list.popleft()
  elif command == "deleteLast":
    list.pop()
  else:
    s,n=command.split()
    if s == "insert":
      list.appendleft(n)
    elif s == "delete":
      try:
        list.remove(n)
      except:
        pass
print(" ".join(list))


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

int main() {
    // 4の倍数があれば奇数をその個数だけ回収でき、
    // 2の倍数同士を並べれば条件を満たせる
    map<int, int> by_div;
    by_div[1] = 0; by_div[2] = 0; by_div[4] = 0;

    int n; cin >> n;
    for (int i = 0; i < n; i++) {
        int a; cin >> a;
        if (a % 4 == 0) by_div[4]++;
        else if (a % 2 == 0) by_div[2]++;
        else by_div[1]++;
    }

    bool possible = by_div[2] > 0 ? by_div[4] >= by_div[1] : by_div[4] >= by_div[1] - 1;
    cout << (possible ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;


public class C
{
	public static void Main()
	{
		int N = Int32.Parse(Console.ReadLine());
		int[] num = new int[100000];
		string[] args = Console.ReadLine().Split(' ');
		for(int i = 0; i < N; i++)
		{
			int a = Int32.Parse(args[i]);
			num[a]++;
		}

		int tmp = num[0] + num[1] + num[2];		
		int ans = tmp;
		for(int i = 3; i < 100000; i++)
		{
			tmp -= num[i - 3];
			tmp += num[i];
			ans = Math.Max(ans, tmp);
		}
		
		Console.WriteLine(ans);
	}
}





Measured memory_bytes: 16864
#Problem B
N = int(input())
lst = [0,0,0,0] 
#AC, WA, TLE, RE

for i in range(N):
    S = input()
    if S == "AC":
        lst[0] += 1
    elif S == "WA":
        lst[1] += 1
    elif S == "TLE":
        lst[2] += 1
    elif S == "RE":
        lst[3] += 1

print("AC x",lst[0])
print("WA x",lst[1])
print("TLE x",lst[2])
print("RE x",lst[3])

Measured memory_bytes: 69868
#include <iostream>
#include <fstream>
#include <iomanip>
#include <math.h>
#include <limits.h>
#include <algorithm>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <string>
#include <string.h>
#include <sstream>
#include <ctime>

using namespace std;

#define eps 1e-12
#define pi 3.14159265358979323846
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define bgn begin
#define ll long long
#define ld long double
#define ull unsigned long long
#define ii pair<ll,ll>










double r;




void solve()
{
	cin >> r;
	cout << 2 * pi*r << "\n";
}

int main()
{
	std::ios::sync_with_stdio(0);
	cin.tie(0);
#ifdef localProject
	freopen("in.txt","r",stdin);
#endif
	solve();
	return 0;
}

Measured memory_bytes: 3804
#include <iostream>
using namespace std;
int main(void){
    int N; //ゲームを行う回数
    int K[1000], P[1000]; //Kは石の個数、Pは参加人数

    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> K[i] >> P[i];
    }

    for(int i = 0; i < N; i++){
        int winner;
        /*if(K[i] == P[i]){
            winner = K[i];
        }*/
        //else{
            if(K[i] % P[i] != 0) winner = K[i] % P[i];
            else winner = P[i];
        //}
        cout << winner << endl;
    }
}


Measured memory_bytes: 3124
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include <cstdlib>

using namespace std;

int main(){

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

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define INF 1000000000000
#define MOD 1000000007
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cout << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3)                                                 \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
         << x3 << endl
#define debug_4(x1, x2, x3, x4)                                             \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
         << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5)                                         \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
         << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#ifdef _DEBUG
#define debug(...)                                                        \
    CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) \
    (__VA_ARGS__)
#else
#define debug(...)
#endif

using namespace std;
using ll = long long;

// 解説より
int main() {
    int k;
    cin >> k;
    int x = 7 % k;
    set<int> s;
    int i = 1;
    while (s.count(x) == 0) {
        if (x == 0) {
            cout << i << endl;
            return 0;
        }
        s.insert(x);
        x = (x * 10 + 7) % k;
        i++;
    }

    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 49996
# coding: utf-8

N, L = map(int, input().split())
app_list = []
sum1, sum2, num, ans, min_ans = 0, 0, 0, 0, 1000000000000000000

for i in range(N):
    app_list.append(L + i)

for j in range(N):
    sum1 = sum(app_list)
    sum2 = sum(app_list) - app_list[j]
    ans = abs(sum1 - sum2)
    if ans < min_ans:
        num = j
        min_ans = ans

print(sum(app_list) - app_list[num])


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


int main(){

 long long int A,B,H,M;
  scanf("%lld %lld %lld %lld",&A,&B,&H,&M);

/*
  char A[];
  scanf("%s",A);
  */

  /*
  long long int A[N+1];
  long long int i;
  for(i=1;i<=N;i++){
   scanf("%lld",&A[i]);
   }
  */
  int min;
  double lrad,srad,rad;
  double ans;
  min = (double)(H)*60.0 + (double)(M);
  
  lrad = (360.0/(12.0*60.0))*(double)(min);
  srad = (360.0/60.0)*(double)(M);
 
  rad = lrad - srad;
  double a,b;
  a = (double)(A);
  b = (double)(B);

  ans = sqrt(a*a+b*b-2*a*b*cos(((rad)/360)*2*3.141592653589));

  printf("%10.10lf\n",ans);


  







 return(0);
 }


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

using namespace std;

using ll = long long;

#define ALL(A) A.begin(),A.end()

int main()
{
    ll A,B,C;
    cin >> A >> B >> C;

    ll AB4 = A*B*4;

    if(sqrtl(AB4) < C - A - B)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    //cout << tgdb(A,B,C) << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
 
#define ll long long
#define ld long double
 
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
 
#define err() cout<<"=================================="<<endl;
#define errA(A) for(auto i:A)   cout<<i<<" ";cout<<endl;
#define err1(a) cout<<#a<<" "<<a<<endl
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl
 
#define pb push_back
#define all(A)  A.begin(),A.end()
#define allr(A)    A.rbegin(),A.rend()
#define ft first
#define sd second
 
#define pll pair<ll,ll>
#define V vector<ll>
#define S set<ll>
#define VV vector<V>
#define Vpll vector<pll>
 
#define endl "\n"
 
const ll logN = 20;
const ll N=100005;
const ll M = 1000000007;
const ll INF = 1e12;
#define PI 3.14159265
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
ll pow1(ll a,ll b){
    ll res=1;
    while(b>0){
        if(b&1){
        	res=(res*a)%M;
		}
        a=(a*a)%M;
        b>>=1;
    }
    return res%M;
}

// struct segtree{
//     ll x,y;
//     ll tree[4*N];

//     void build_tree(vector<ll>&v , ll ind,ll l, ll r)
//     {
//         if(l==r)
//         {
//             tree[ind]=v[l];
//             return;
//         }
//         ll mid=(l+r)/2;
//         build_tree(v,2*ind,l,mid);
//         build_tree(v,2*ind+1,mid+1,r);
//         tree[ind]=max(tree[2*ind],tree[2*ind+1]);
//     }

//     ll query(ll ind, ll l, ll r)
//     {
//         // cout<<l<<" "<<r<<" "<<endl;
//         if(x>r || y<l)return -LLONG_MAX;
//         if(l>=x && r<=y)return tree[ind];
//         ll mid=(l+r)/2;
//         return max(query(2*ind,l,mid),query(2*ind+1,mid+1,r));
//     }
// }obj;

int main()
{
    fast;

    #ifndef ONLINE_JUDGE
    freopen("../input.txt", "r", stdin);
    freopen("../output.txt", "w", stdout);
    #endif
    
    ll T=1;
//     cin>>T;
    while(T--)
    {
        ll n,x,t;
        cin>>n>>x>>t;
        ll num=n/x;
        if(n%x!=0)num++;
        num*=t;
        cout<<num<<endl;
    }

}

Measured memory_bytes: 3636
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_VTX_MAX		50										// 最大座標数

// 内部構造体 - 頂点情報
typedef struct Vtx {
	int miX;													// 座標Ⅹ
	int miY;													// 座標Ｙ
} Vtx;

// 内部変数
static Vtx sz1Vtx[D_VTX_MAX];									// 頂点情報
static int siVCnt;												// 頂点情報数
static int siNCnt;												// 必要頂点数
static long long slMin;											// 最小面積

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpT, *szpFpA;
#endif

// ソート関数 - Ｘ座標昇順
int
fSortFncX(
	const void *pzpVal1			// <I> 値１
	, const void *pzpVal2		// <I> 値２
)
{
	Vtx *lzpVal1 = (Vtx *)pzpVal1;
	Vtx *lzpVal2 = (Vtx *)pzpVal2;

	// Ｘ座標昇順
	if (lzpVal1->miX > lzpVal2->miX) {
		return(1);
	}
	else if (lzpVal1->miX < lzpVal2->miX) {
		return(-1);
	}

	return 0;
}

// ソート関数 - int昇順
int
fSortFncI(
	const void *pzpVal1			// <I> 値１
	, const void *pzpVal2		// <I> 値２
)
{
	int *lipVal1 = (int *)pzpVal1;
	int *lipVal2 = (int *)pzpVal2;

	// 昇順
	if (*lipVal1 >  *lipVal2) {
		return(1);
	}
	else if (*lipVal1 < *lipVal2) {
		return(-1);
	}

	return 0;
}

// 実行メイン
int
fMain(
	int piTNo					// <I> テスト番号 1～
)
{
	int i, j, k;
	char lc1Buf[1024], lc1Out[1024];

	// データ初期化
	slMin = LLONG_MAX;											// 最小面積

	// テストファイルオープン
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", piTNo);
	szpFpT = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", piTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#endif

	// 頂点情報数・必要頂点数取得
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
	fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
	sscanf(lc1Buf, "%d%d", &siVCnt, &siNCnt);

	// 頂点情報取得
	for (i = 0; i < siVCnt; i++) {
#ifdef D_TEST
		fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
		fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
		sscanf(lc1Buf, "%d%d", &sz1Vtx[i].miX, &sz1Vtx[i].miY);
	}

	// Ｘ座標でソート
	qsort(sz1Vtx, siVCnt, sizeof(Vtx), fSortFncX);

	// Ｘ座標範囲
	for (i = 0; i < siVCnt - siNCnt + 1; i++) {
		for (j = i + siNCnt - 1; j < siVCnt; j++) {

			// Ｙ座標リスト
			int liYCnt = j - i + 1;
			int li1Y[D_VTX_MAX];
			for (k = 0; k < liYCnt; k++) {
				li1Y[k] = sz1Vtx[i + k].miY;
			}

			// Ｙ座標でソート
			qsort(li1Y, liYCnt, sizeof(int), fSortFncI);
			
			// Ｙ座標範囲
			for (k = 0; k < liYCnt - siNCnt + 1; k++) {

				// 面積
				long long llArea = (long long)(sz1Vtx[j].miX - sz1Vtx[i].miX) * (long long)(li1Y[k + siNCnt - 1] - li1Y[k]);
				if (slMin > llArea) {
					slMin = llArea;
				}
			}
		}
	}

	// 結果セット
	sprintf(lc1Out, "%lld\n", slMin);

	// 結果表示
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, lc1Out)) {
		siRes = -1;
	}
#else
	printf("%s", lc1Out);
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpT);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", piTNo);
	}
	else {
		printf("NG %d\n", piTNo);
	}
#endif

	return 0;
}

int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		fMain(i);
	}
#else
	fMain(0);
#endif

	return 0;
}



Measured memory_bytes: 128
fun main(args : Array<String>) {
    val (a, b) = readLine()!!.split(" ").map { it.toLong() }
    println(lcm(a, b))
}

fun gcd(a : Long, b : Long) : Long {
    return if (a % b == 0L) b else gcd(b, a % b)
}

fun lcm(a : Long, b : Long) : Long {
    return (a * b) / gcd(a, b)
}


Measured memory_bytes: 37928
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

K, N = list(map(int, sys.stdin.buffer.readline().split()))
A = list(map(int, sys.stdin.buffer.readline().split()))

ans = K - (A[0] + K - A[-1])
for a, b in zip(A, A[1:]):
    ans = min(K - (b - a), ans)
print(ans)


Measured memory_bytes: 20424
import java.util.Scanner;


public class Main{

	static Scanner sc = new Scanner(System.in);
	
	static int n, max;
	static int a[], best[];
	public static void main(String[] args) {
		
		while(read()){
			solve();
		}
	}
	
	public static boolean read(){
		
		n = sc.nextInt();
		
		if(n == 0) return false;
		
		a = new int[n+1];
		best = new int[n+1];
		
		for(int i=1; i < n+1; i++){
			a[i] = sc.nextInt();
		}
		
		return true;
	}
	
	public static void solve(){

		max = Integer.MIN_VALUE;
		
		for(int i=1; i < n+1; i++){
			best[i] = Math.max(a[i], a[i] + best[i-1]);
			max = Math.max(max, best[i]);
		}
		
		System.out.println(max);
	}

}

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

// GNU C Compiler
//template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

// type
using ll = int_fast64_t;
using ull = uint_fast64_t;
using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
//using pair<T1, T2> = p12;

//container
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
#define ALL(v) v.begin(),v.end()

//repetition
#define REP(n) for(ll i=0; i<(n); i++)
#define REPj(n) for(ll j=0; j<(n); j++)
#define REPinit(i,a,n) for(ll i=(a); i<(n); i++)
#define REPinitj(j,a,n) for(ll j=(a); j<(n); j++)

//algorithm
#define SORT(c) sort((c).begin(),(c).end())
#define CONTAINER_ALL(a) a.begin(),a.end()

//constant

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//Optimizer
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


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

    
    int N;
    cin >> N;

    vector<ull> L(N, 0);
    REPinit(i, 0, N) {
        cin >> L[i];
    }

    sort(CONTAINER_ALL(L));

    ull ans = 0;
    REPinit(i, 0, N - 2) {
        REPinit(j, i + 1, N - 1) {
            REPinit(k, j + 1, N) {
                if (L[i] != L[j] && L[j] != L[k] && L[k] != L[i]) {
                    //printf_s("%ld %ld %ld\n", L[i], L[j], L[k]);
                    if (L[k] < (L[j] + L[i])) {
                        ans++;
                    }
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}


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

#define MP make_pair
#define PB push_back
#define ALL(x)  (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define RANGEBOX(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define RANGE(x, l, r) ((l) <= (x) && (x) <= (r))
#define rep(i, N)  for (int i = 0; i < (int)(N); i++)
#define rrep(i, N) for (int i = N - 1; i >= 0; i--)
#define REP(i, init, N)  for (int i = (init); i < (int)(N); i++)
#define RREP(i, N, last) for (int i = (init - 1); i >= last; i--)
#define PB push_back

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVi;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int    INF  = 0x3f3f3f3f;
const LL     INFL = 0x3f3f3f3f3f3f3f3fLL;
const double DINF = 0x3f3f3f3f;

int main(){
	ios::sync_with_stdio(false);
    int n;
    int cnt=0;
    cin>>n;
    VI l(n*2);
    rep(i,n*2){
        cin>>l[i];
    }
    sort(l.begin(),l.end());
    for(int i=0;i<n*2;i+=2){
        cnt+=l[i];
    }
    cout<<cnt<<endl;

    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

ll mod(ll a){
  return (a % 1000000007);
}

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


int main(){
  ll x; cin >> x; ll cnt = 0;
  
  rep(i,3){
    if(x % 10 == 1) cnt++;
    x /= 10;
  }
  
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    int a,b,c,k,sum = 0,m;
    cin >> a >> b >> c;
    cin >> k;
    
    sum += (a+b+c);
    m = max({a,b,c});
    for(int i = 0;i < k;i++){
        m *= 2;
    }
    sum += m;
    sum -= max({a,b,c});
    cout << sum <<endl;
    return 0;
}

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

using namespace std;

#define REP(i, n) for(int i = 0; i < (n); i++)
#define SREP(i, s) for(int i = 0; i < (s.length()); i++)
#define SORT(v, n) sort(v, v+n);
#define GSORT(v, n) sort(v, v+n, greater<int>())
#define REV(a) reverse(begin(a),end(a));

int main(){
	ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////
	int a;
	cin >> a;
	int ans = 0;
	REP(i,a){
		ans+=i+1;
	}
	cout << ans << endl;

	
//////////////////////////////////////////////
}


Measured memory_bytes: 256
//#pragma GCC optimize("O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
//#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>
 
using namespace std;
 
using ll = long long;
using ld = long double;

const int N = 1e5 + 5;

vector<int> g[N];
int used[N];

void dfs(int v) {
    used[v] = 1;
    for (int u : g[v]) {
        if (!used[u]) {
            dfs(u);
        }
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int u, v, w;
        cin >> u >> v >> w;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        if (!used[i]) {
            ans++;
            dfs(i);
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 9216
#include <iostream>
#include <math.h>
using namespace std;
int n;
void func(int x, int y) {
    if (y == n) return;
    bool jud = true;
    for (int i = 2; i <= sqrt(x); i++) {
        if (x % i == 0) jud = false;
    }
    if (jud && x % 5 == 1) {
        cout << x << ' ';
        func(x + 1, y + 1);
    } else {
        func(x + 1, y);
    }
}

int main(void){
    // Your code here!
    cin >> n;
    func(3, 0);
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl


int main(){
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    vector<ll> candidates;
    for(int i = 0; i < n; i++){
        ll sum = a[i];
        candidates.push_back(sum);
        for(int j = i+1; j < n; j++){
            sum += a[j];
            candidates.push_back(sum);
        }
    }

    ll bitnum = 44;
    vector<ll> num(bitnum,0);
    for(int i = 0; i < candidates.size(); i++){
        for(int j = 0; j < bitnum; j++){
            if(candidates[i] & (1LL<<j)){num[j]++;}
        }
    }
    vector<bool> available(candidates.size(),true);
    ll ans = 0;
    for(int i = bitnum-1; i >= 0; i--){
        if(num[i]>=k){
            ans += 1LL<<i;
            for(int j = 0; j < candidates.size(); j++){
                if(!available[j]){continue;}
                if(available[j] && (candidates[j] & (1LL<<i))){;}
                else{
                    available[j] = false;
                    for(int x = 0; x < bitnum; x++){
                        if(candidates[j] & (1LL<<x)){num[x]--;}
                    }
                }
            }
        }


    }
    cout << ans << endl;

    return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef vector<vector<int>> Graph;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int main() {
    int N; cin >> N;
    vector<int> a(N);
    int XOR = 0;
    for(int i = 0; i < N; i++) {
        cin >> a[i];
        XOR = XOR ^ a[i];
    }
    for(int i = 0; i < N; i++) {
        cout << (XOR ^ a[i]) << endl;
    }
    return 0;
}

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

int main(){
    int a, b, k;
    vector<int> num;
    cin >> a >> b >> k;
    for(int i=1;i<=min(a, b);i++){
        if(a%i==0&&b%i==0) num.push_back(i);
    }
    cout << num[num.size()-k] << endl;
    return 0;
}

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

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

  vector<ll> A(5); for (ll i = 0; i < 5; i++) cin >> A[i];
  ll ans = 0;
  for (ll i = 0; i < 5; i++) {
    if(A[i] == 0) ans = i + 1;
  }
  cout << ans << '\n';
  return 0;
}

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

using namespace std;

int bubble_Sort(int A[], int N){
    int res = 0;
    for(int i = 0; i < N -1; ++i){
        for(int j = N-1; j > i; --j){
            if(A[j] < A[j-1]){
                swap(A[j], A[j-1]);
                ++res;
            }
        }
    }
    return res;
}

int main(){
    int N;
    cin >> N;
    int A[110];
    for(int i = 0; i < N; ++i) cin >> A[i];
    int res = bubble_Sort(A, N);
    for(int i = 0; i < N-1; ++i) cout << A[i] << " ";
    cout << A[N-1] << endl;
    cout << res << endl;
    return 0;

}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define U 998244353
#define N 1000005
#define int long long
#define sz(c) (int)c.size()
#define fr first
#define ll long long 
#define sc second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a ; i<n ; i++)
#define r0 return 0;
#define endl '\n'
#define INF (int)1e15
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
int vis[N];
vector<int> g[N];
int dp[N];
int dfs(int u){
	if(vis[u]) return dp[u];
	vis[u] = 1;
	int ans = 0;
	for(auto j:g[u]){
		ans = max(ans, 1+dfs(j));
	}
	dp[u] = ans;
	return dp[u];
}
signed main()
{
	ios_base::sync_with_stdio(0);
	int TESTS=1;
	// cin>>TESTS;
	while(TESTS--)
	{   
		int n,m;
		cin >> n >> m;
		rep(i,0,m){
			int a,b;
			cin >> a >> b;
			g[a].pb(b);
		}
		int ans=0;
		rep(i,1,n+1){
			ans = max(ans, dfs(i));
		}
		cout<<ans;
	}
}

Measured memory_bytes: 32896
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <string>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <map>
using namespace std;
#define ms(a, x) memset(a, x, sizeof(a))
#define fore(i, a, n) for (long long i = a; i < n; i++)
#define ford(i, a, n) for (long long i = n - 1; i >= a; i--)
#define si(a) scanf("%d", &a)
#define sl(a) scanf("%lld", &a)
#define sii(a, b) scanf("%d%d", &a, &b)
#define siii(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define sll(a, b) scanf("%lld%lld", &a, &b)
#define slll(a, b, c) scanf("%lld%lld%lld", &a, &b, &c)
#define debug(a) cout << a << endl
#define pr(a) printf("%d ",a)
#define endl '\n'
#define pi acos(-1.0)
#define tr t[root]
#define lson t[root << 1]
#define rson t[root << 1 | 1]
#define IO ios::sync_with_stdio(false), cin.tie(0)
#define ull unsigned long long
const double eps = 1e-8;
inline int sgn(const double &x) { return x < -eps ? -1 : x > eps; }
typedef long long ll;
const int inf=0x3f3f3f3f;
const int MAXN = 1e5 + 10;
int n,W;
ll w[105],v[105];
ll dp[MAXN];
int main()
{
	sii(n,W);
	for(int i=1;i<=n;++i)
	{
		sll(w[i],v[i]);
	}
	for(int i=1;i<=n;++i)
	for(int j=W;j>=w[i];j--)
	{
		dp[j]=max(dp[j],dp[j-w[i]]+v[i]);
		
	}
	printf("%lld\n",dp[W]);
 } 

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

typedef long long ll;

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

// const int C ;
// const int M = 1000000007;

int N;
ll a[100010];
ll x;

int main () {
  cin >> N >> x;
  for (auto i = 0; i < N; i++) {
    cin >> a[i];
  }
  ll ans = 0;
  for (auto i = 1; i < N; i++) {
    if (x > a[i] + a[i-1]) {
      continue;
    }
    if (a[i] >= a[i] + a[i-1] - x) {
      ans += a[i] + a[i-1] - x;
      a[i] -= a[i] + a[i-1] - x;
    } else {
      ans += a[i] + a[i-1] - x;
      a[i] = 0;
      a[i-1] = x;
    }
  }
  for (auto i = 0; i < N; i++) {
    // cerr << a[i] << " ";
  }
  // cerr << endl;
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1000000007;


int main(int argc, char **argv)
{
	map<string, int> m;
	ll N; cin >> N;
	for (ll i = 0; i < N; ++i)
	{
		string s; cin >> s;
		m[s]++;
	}
	std::cout << m.size() << std::endl;
		
}

Measured memory_bytes: 19252
N = int(input())
S = [int(input()) for _ in range(N)]
S.sort()
total = sum(S)
T = [s for s in S if s % 10 != 0]
if total % 10 != 0:
    print(total)
elif len(T) > 0:
    print(total - T[0])
else:
    print(0)

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

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

    static class BGoToJail {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int cnt = 0;
            int rencnt = 0;
            for (int i = 0; i < n; i++) {
                int d1 = Integer.parseInt(in.next());
                int d2 = Integer.parseInt(in.next());
                if (d1 == d2) {
                    cnt++;
                    rencnt++;
                } else {
                    if (rencnt < 3) rencnt = 0;
                }
            }

            boolean ok = false;
            if (rencnt >= 3 && cnt >= 3) ok = true;
            out.println(ok ? "Yes" : "No");

        }

    }
}



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

int main() {
  int n,ans=0;
  string s;
  cin >> n >> s;
  int x[n+1]; x[0] = 0;
  REP(i,n) {
    x[i+1] = x[i];
    if (s[i] == 'I') x[i+1]++;
    else if (s[i] == 'D') x[i+1]--;
  }
  REP(i,n+1) ans = max(ans,x[i]);
  cout << ans << endl;
}

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

using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
template <typename T> constexpr T inf = numeric_limits<T>::has_infinity ? numeric_limits<T>::infinity() : numeric_limits<T>::max() / 4;

#define REP(i, stop) FOR(i, 0, stop)
#define FOR(i, start, stop) for (int i = start, i##_len = stop; i < i##_len; ++i)

struct InitCpp { InitCpp() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } initCpp;

struct Fragment {
  i64 from;
  i64 to;
  i64 id;
};

signed main() {
  while (true) {
    i64 n;
    cin >> n;
    if (n == 0) break;
    list<Fragment> mem;
    mem.push_back({0, inf<i64>, -1});
    REP(_, n) {
      char c;
      cin >> c;
      if (c == 'W') {
        i64 i, s;
        cin >> i >> s;
        for (auto iter = mem.begin(); iter != mem.end(); ++iter) {
          Fragment f = *iter;
          if (f.id == -1) {
            if (f.to - f.from > s) {
              Fragment g = *mem.insert(iter, {f.from, f.from + s, i});
              iter->from = g.to;
              // f.from = g.to;
              // *iter = f;
              break;
            } else {
              s -= f.to - f.from;
              iter->id = i;
              // f.id = i;
              // *iter = f;
              if (s == 0) break;
            }
          }
        }
      }
      if (c == 'D') {
        i64 i;
        cin >> i;
        for (auto& f : mem) {
          if (f.id == i) {
            f.id = -1;
          }
        }
      }
      if (c == 'R') {
        i64 p;
        cin >> p;
        for (auto f : mem) {
          if (f.from <= p && p < f.to) {
            cout << f.id << endl;
            goto read;
          }
        }
        cout << -1 << endl;
        read:;
        // for (auto f : mem) {
        //   cerr << f.from << " " << f.to << " " << f.id << "; ";
        // }
        // cerr << endl;
      }
    }
    cout << endl;
  }
}



Measured memory_bytes: 3252
import java.util.Scanner;

public class Main {
	
	public static void A() {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		if(n == 0) {
			System.out.println(0);
			return;
		}
		int[] height = new int[n];
		for(int i = 0; i < n; i++) {
			height[i] = s.nextInt();
		}
		int[] dp = new int[n];
		dp[dp.length - 1] = 0;
		for(int i = dp.length - 2; i >= 0; i--) {
			dp[i] = Integer.MAX_VALUE;
			for(int j = 1; j <= 2; j++) {
				if(j + i < n) {
					dp[i] = Math.min(dp[i + j] + Math.abs(height[i] - height[i + j]), dp[i]);
				}
			}
		}
		System.out.println(dp[0]);
	}
	
	public static void B() {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		if(n == 0) {
			System.out.println(0);
			return;
		}
		int k = s.nextInt();
		int[] height = new int[n];
		for(int i = 0; i < n; i++) {
			height[i] = s.nextInt();
		}
		int[] dp = new int[n];
		dp[dp.length - 1] = 0;
		for(int i = dp.length - 2; i >= 0; i--) {
			dp[i] = Integer.MAX_VALUE;
			for(int j = 1; j <= k; j++) {
				if(j + i < n) {
					dp[i] = Math.min(dp[i + j] + Math.abs(height[i] - height[i + j]), dp[i]);
				}
			}
		}
		System.out.println(dp[0]);
	}
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		B();
	}

}


Measured memory_bytes: 51240
def examC():
    N = I()
    S = [I() for _ in range(N)]
    S1 = []
    for s in S:
        if s%10==0:
            continue
        S1.append(s)
    if S1==[]:
        print(0)
        return
    S1.sort()
    ans = sum(S)
    if ans%10==0:
        ans -= S1[0]
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math,random
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examC()

"""

"""

Measured memory_bytes: 39024
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <cassert>
#include <fstream>
#include <iomanip>
#include <stack>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

const ll mod = 1e9 + 7;
const ll mmod = 998244353;

vector<ll> dx = {1, -1, 0, 0};
vector<ll> dy = {0, 0, 1, -1};

vector<vector<ll>> g;
vector<vector<ll>> par;
vector<vector<ll>> dp;
vector<ll> d;


int main() {
    
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    
    ll a, v, b, w, t;
    cin >> a >> v >> b >> w >> t;
    
    ll d = abs(a - b);
    ll can = (v - w) * t;
    if (d <= can)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3656
s = gets.chomp
result = 'AC'
# 1
result = 'WA' if s[0] != 'A'
# 2
c_index = s.index('C')
result = 'WA' if c_index.nil? || c_index < 2 || c_index > s.length - 2
result = 'WA' if s.count('C') > 1
# 3
s[c_index] = "c" if !c_index.nil?
s[0] = "a"
result = 'WA' if !(/[A-Z]/ =~ s).nil?

puts result

Measured memory_bytes: 1788
using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            double a = double.Parse(s[0]);
            double b = double.Parse(s[1]);
            double c = a / b;
            Console.WriteLine((int)(a / b) + " " + (int)(a % b) + " " + c.ToString("F6"));
        }
    }
}

Measured memory_bytes: 9404
#! python3
# shuffle.py

def shuffle(text, n):
    return text[n:] + text[:n]

while True:
    sent = input()
    if sent == '-': break
    m = int(input())

    h = 0
    for i in range(m):
        h += int(input())
    h = h % len(sent)

    sent = shuffle(sent, h)
    print(sent)



Measured memory_bytes: 5600
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
	cin.tie(0);
    ios::sync_with_stdio(false);
    int a[5],ans=0,ma;
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    if(a[2]%2==(a[0]+a[1]+a[2])%2){
        ma=a[2];
    }
    else{
        ma=a[2]+1;
    }
    int ans1=0;
    for(int i=0;i<3;i++){
        if(ma%2!=a[i]%2){
            a[i]++;
            ans1++;
        }
        ans+=(ma-a[i])/2;
    }
    cout<<ans+ans1/2<<endl;

    return(0);
}

Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;
string n;
int main() {
  cin >> n;
  for(char c:n)
    if(c == '9'){
      cout << 1;
    } else {
      cout << 9;
    }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if (A + B > C + D)
    cout << "Left" << endl;
  else if (A + B == C + D)
    cout << "Balanced" << endl;
  else
    cout << "Right" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

    int N;
    cin >> N;
    map<int, int> mp;
    REP(i, N) {
        int a;
        cin >> a;
        mp[a]++;
    }
    int res = 0;
    int odd = 0;
    for (auto &p : mp) {
        if (p.second % 2) {
            ++res;
        } else {
            ++odd;
        }
    }
    res += odd / 2 * 2;
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
int main(){
  while (1){
    int n, m, a;
    cin >> n >> m >> a;
    if (n == 0 && m == 0 && a == 0){
      break;
    }
    a--;
    vector<tuple<int, int, int>> H(m);
    for (int i = 0; i < m; i++){
      int h, p, q;
      cin >> h >> p >> q;
      p--;
      q--;
      H[i] = make_tuple(h, p, q);
    }
    sort(H.begin(), H.end());
    vector<int> P(n);
    for (int i = 0; i < n; i++){
      P[i] = i;
    }
    for (int i = 0; i < m; i++){
      int p = get<1>(H[i]);
      int q = get<2>(H[i]);
      swap(P[p], P[q]);
    }
    cout << P[a] + 1 << endl;
  }
}


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

int main() {
    int N,K;
    cin >> N >> K;
    vector<int> L(N);
    for(int i = 0; i < N; i++){
        cin >> L[i];
    }
    int sum = 0;
    sort(L.begin(),L.end());
    for(int i = N - 1; i >= 0; i--){
        if(L[i] >= K){
            sum++;
        }
    }
    cout << sum << endl;

}

Measured memory_bytes: 640
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
#include<assert.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MOD2 998244353
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")
#define PN printf("\n")
#define charsize 100005 //10^5+5

void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a= c;}
// void fill(ll n, ll a[n], ll value){ rep(i,0,n) a[i] = value; }
void cin(ll *n){ scanf("%lld",&(*n)); }
void cin2(ll *a, ll *b){ scanf("%lld%lld",&(*a),&(*b)); }
void cin3(ll *a, ll *b, ll *c){ scanf("%lld%lld%lld",&(*a),&(*b),&(*c)); }
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}
ll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
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;}
ll mod_MOD1(ll n){n+= n<0?((-n)/MOD1+1)*MOD1:0; return n%=MOD1;}
ll mod_p(ll n ,ll p){n+= n<0?((-n)/p+1)*p:0; return n%=p;}
ll change_into_num(char s[] , ll len, ll p){ return !p ? 0 : POW(10,p-1)*(s[len-p]-'0') + change_into_num(s,len,p-1); }

int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
// int int_sort( const void * a , const void * b ) {
//   return strcmp(( char * )a , ( char * )b );
// }
//     qsort((void*)s,n,sizeof(s[0]),int_sort );

typedef struct{ ll a , b;}fr;
int cmp1( const void *p, const void *q ) { return ((fr*)p) ->a - ((fr*)q)->a;}
int cmp2( const void *p, const void *q ) { return ((fr*)q) ->a - ((fr*)p)->a;}
void strsortup(fr*a,int n){qsort(a,n,sizeof(fr),cmp1);}
void strsortdown(fr*a,int n){qsort(a,n,sizeof(fr),cmp2);}

ll n,m,q;
ll ans=0;
ll num[10];
ll a[50],b[55],c[55],d[55];

void dfs(ll low, ll dig){

    num[dig-1] = low;

    if(dig==n){
        ll tmp=0;
        rep(i,0,q){
            if( num[b[i]-1] - num[a[i]-1] == c[i] ){
                tmp+=d[i];
            }
        }
        ans = max2(ans,tmp);
    }else{
        rep(i,low,m+1){
            dfs(i,dig+1);
        }
    }
}

int main(void){
    // char ;
    cin(&n);
    cin(&m);
    cin(&q);
    // cin3(&,&,&);
    rep(i,0,q){
        cin2(&a[i],&b[i]);
        cin2(&c[i],&d[i]);
    }

    dfs(1,1);
    
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1692
import sys

def main():
    n, y = map(int, (input().split()))
    y //= 1000

    for n1000 in range(n + 1):
        for n5000 in range(n - n1000 + 1):
            if (1*n1000 + 5*n5000 + 10*(n-n1000-n5000)) == y:
                print(n-n1000-n5000, n5000, n1000)
                sys.exit(0)
    print(-1, -1, -1)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
def gcd(a : int, b: int):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

a, b = map(int, input().split())
g = gcd(a, b)
ans = set([1])
for i in range(2, 1000000):
    while g % i == 0:
        g = g // i
        ans.add(i)
if g > 1:
    ans.add(g)

print(len(ans))

Measured memory_bytes: 3064
H,W,M=map(int,input().split())
countH=[0]*(H+1)
countW=[0]*(W+1)
S={}
i=0
for _ in range(M):
    h,w=map(int,input().split())
    countH[h]+=1
    countW[w]+=1
    S[str(h)+','+str(w)]=1

mh=max(countH)
mw=max(countW)
ans=mh+mw-1

c_mh=[]
i=0
while i<=H:
    if countH[i]==mh:
        c_mh.append(i)
    i+=1

c_mw=[]
i=0
while i<=W:
    if countW[i]==mw:
        c_mw.append(i)
    i+=1

ok=0
ok1=0
ok2=0
for h in c_mh:
    for w in c_mw:
        S.setdefault(str(h)+','+str(w))
        if S[str(h)+','+str(w)]==1:
            continue
        else:
            ans+=1
            ok=1
        if ok:
            break
    if ok:
        break

print(ans)

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

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

    cout<<c-(d-b)<<" "<<d+(c-a)<<" "<<c-(d-b)-(c-a)<<" "<<d+(c-a)-(d-b);
}


Measured memory_bytes: 256