akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>

struct STRUCT00 {
    struct STRUCT00 * MEMBER00 ;
    struct STRUCT00 * MEMBER01 ;
    struct STRUCT00 * MEMBER02 ;
    int MEMBER03 ;
} ;

static struct STRUCT00 * FUNC00 ( int ARG00 ) {
    struct STRUCT00 * VAR00 = malloc ( sizeof ( struct STRUCT00 ) ) ;

    VAR00 -> MEMBER00 = VAR00 -> MEMBER01 = VAR00 -> MEMBER02 = NULL ;
    VAR00 -> MEMBER03 = ARG00 ;

    return VAR00 ;
}

static void FUNC01 ( struct STRUCT00 * ARG01 ) {
    free ( ARG01 ) ;

    return ;
}

static int FUNC02 ( const int ARG02 [ ] , int ARG03 , const int ARG04 [ ] , int ARG05 , int ARG06 ) {
    int VAR01 , VAR02 ;

    for ( VAR01 = 0 ; VAR01 < ARG03 ; VAR01 ++ ) {
        for ( VAR02 = ARG05 ; VAR02 < ARG06 ; VAR02 ++ ) {
            if ( ARG02 [ VAR01 ] == ARG04 [ VAR02 ] ) {
                return ARG02 [ VAR01 ] ;
            }
        }
    }

    return -1 ;
}

static int FUNC03 ( int ARG07 , const int ARG08 [ ] , int ARG09 , int ARG10 ) {
    int VAR03 ;

    for ( VAR03 = ARG09 ; VAR03 < ARG10 ; VAR03 ++ ) {
        if ( ARG08 [ VAR03 ] == ARG07 ) {
            return VAR03 ;
        }
    }
    assert ( 0 ) ;

    return -1 ;
}

static struct STRUCT00 * FUNC04 ( struct STRUCT00 * ARG11 , const int ARG12 [ ] , int ARG13 , const int ARG14 [ ] , int ARG15 , int ARG16 ) {
    int VAR04 ;
    int VAR05 ;
    struct STRUCT00 * VAR06 ;

    if ( ARG15 >= ARG16 ) {
        return NULL ;
    }

    VAR04 = FUNC02 ( ARG12 , ARG13 , ARG14 , ARG15 , ARG16 ) ;
    VAR05 = FUNC03 ( VAR04 , ARG14 , ARG15 , ARG16 ) ;

    VAR06 = FUNC00 ( VAR04 ) ;
    VAR06 -> MEMBER00 = ARG11 ;

    VAR06 -> MEMBER01 = FUNC04 ( VAR06 , ARG12 , ARG13 , ARG14 , ARG15 , VAR05 ) ;
    VAR06 -> MEMBER02 = FUNC04 ( VAR06 , ARG12 , ARG13 , ARG14 , VAR05 + 1 , ARG16 ) ;

    return VAR06 ;
}

static void FUNC05 ( const struct STRUCT00 * ARG17 ) {

    if ( ARG17 == NULL ) {
        return ;
    }

    FUNC05 ( ARG17 -> MEMBER01 ) ;
    FUNC05 ( ARG17 -> MEMBER02 ) ;
    printf ( "%d" , ARG17 -> MEMBER03 ) ;

    if ( ARG17 -> MEMBER00 ) {
        printf ( " " ) ;
    }

    return ;
}

static void FUNC06 ( struct STRUCT00 * ARG18 ) {
    if ( ! ARG18 ) {
        return ;
    }

    FUNC06 ( ARG18 -> MEMBER01 ) ;
    FUNC06 ( ARG18 -> MEMBER02 ) ;
    FUNC01 ( ARG18 ) ;

    return ;
}

int main ( void ) {
    int VAR07 ;
    int VAR08 ;
    int * VAR09 , * VAR10 ;
    struct STRUCT00 * VAR11 ;

    scanf ( "%d\n" , & VAR07 ) ;
    VAR09 = malloc ( sizeof ( int ) * VAR07 ) ;
    VAR10 = malloc ( sizeof ( int ) * VAR07 ) ;

    for ( VAR08 = 0 ; VAR08 < VAR07 ; VAR08 ++ ) {
        int VAR12 ;
        scanf ( "%d" , & VAR12 ) ;
        VAR09 [ VAR08 ] = VAR12 ;
    }
    for ( VAR08 = 0 ; VAR08 < VAR07 ; VAR08 ++ ) {
        int VAR13 ;
        scanf ( "%d" , & VAR13 ) ;
        VAR10 [ VAR08 ] = VAR13 ;
    }

    VAR11 = FUNC04 ( NULL , VAR09 , VAR07 , VAR10 , 0 , VAR07 ) ;

    FUNC05 ( VAR11 ) ;
    printf ( "\n" ) ;

    FUNC06 ( VAR11 ) ;
    free ( VAR09 ) ;
    free ( VAR10 ) ;

    return 0 ;
}


Measured memory_bytes: 2144
#!/usr/bin/perl
use Data::Dumper;
use POSIX qw(floor ceil);

# 引数取り込み
my @a;
while ( my $line = <STDIN> ) {
    chomp($line);
    push @a, $line;
}

# 処理開始
my $AC = 0;
my $WA = 0;
my $TLE = 0;
my $RE = 0;
foreach my $str ( @a ) {
    $AC = $AC + 1 if ( $str eq "AC" );
    $WA = $WA + 1 if ( $str eq "WA" );
    $TLE = $TLE + 1 if ( $str eq "TLE" );
    $RE = $RE + 1 if ( $str eq "RE" );
}

print "AC x $AC\n";
print "WA x $WA\n";
print "TLE x $TLE\n";
print "RE x $RE";

1;

Measured memory_bytes: 14888
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int32_t main()
{
	FIO;
	int a, b, n; cin >> a >> b >> n;

	int xb;

	if (n >= b - 1)
		xb = b - 1;

	else
		xb = n;

	int ans = (a * xb) / b;

	cout << ans << '\n';

	return 0;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int money=700;
    char a,b,c;
    cin>>a>>b>>c;
    if(a=='o') money=money+100;
    if(b=='o') money=money+100;
    if(c=='o') money=money+100;
    cout<<money<<endl;
	return 0;
}

Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInteger = readLn :: IO Integer
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readIntegers = map ( fst . fromJust . B.readInteger ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

modifyArray a i f = writeArray a i =<< f <$> readArray a i

main = getLine >>= putStrLn . which "Yes" "No" . and . zipWith (/=) ( cycle "LR" )

Measured memory_bytes: 508
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

struct UnionFind {
	vector<int> v;
	UnionFind(int n) : v(n) { for (int i = 0; i < n; i++) v[i] = i; }
	int  find(int x) { return v[x] == x ? x : v[x] = find(v[x]); }
	void unite(int x, int y) { v[find(x)] = find(y); }
};

int main() {
	int n;
	while (cin >> n, n) {
		vector<set<int>> uf(n);
		vvi day(30);
		REP(i, n) {
			int m;
			cin >> m;
			REP(j, m) {
				int a;
				cin >> a;
				a--;
				day[a].push_back(i);
			}
			uf[i].insert(i);
		}
		
		int ans = -1;
		REP(i, 30) {
			set<int> marge;
			REP(j, day[i].size()) {
				marge.insert(uf[day[i][j]].begin(), uf[day[i][j]].end());
			}
			if (marge.size() == n) {
				ans = i + 1;
				break;
			}
			REP(j, day[i].size()) {
				uf[day[i][j]].insert(marge.begin(), marge.end());
			}
		}

		cout << ans << endl;
	}
}

Measured memory_bytes: 3204
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include<queue>
#include<functional>
#define loop(n) for(int i = 0; i < n; i++)
#define FOR(x,y,z) for(int x = y; x < z; x++)
#define REP(i,n) FOR(i,0,n)
#define INF 9999999999999
#define VEC vector<int>
#define in push_back
#define ans(x) cout<<x<<endl
#define hairetu 100003
#define seven 1000000007
typedef long long ll;
using namespace std;
priority_queue<int, vector<int>, greater<int>> small;//chiisai
priority_queue<ll>large;//ookii
int main(){
	ll n, m; cin >> n >> m;
	ll x[hairetu], y[hairetu],xgoukei=0,ygoukei=0;
	REP(i, n) {
		cin >> x[i];
	}
	REP(i, m) {
		cin >> y[i];
	}
	REP(i, n - 1) {
		x[i] = x[i + 1] - x[i];
	}
	REP(i, m - 1) {
		y[i] = y[i + 1] - y[i];
	}
	REP(i, n-1 ) {
		ll left, right;
		left = i - 0 + 1; right = n-1 - i;
		xgoukei += left*right*x[i]; xgoukei %= seven;
	}
	REP(i, m - 1) {
		ll left, right;
		left = i  + 1; right = m - 1 - i;
		ygoukei += left*right*y[i]; ygoukei %= seven;
	}
	cout << ygoukei*xgoukei % seven << endl;
	return 0;
}

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

using namespace std;

#define countof(a) (sizeof(a)/sizeof(*a))

#define vi vector<int>
#define vvi vector<vector<int> >
#define vpi vector<pi >
#define pi pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define all(n) n.begin(), n.end()

#define FROMTO(var, from, to) for (register int var = (from), var##down = ((int)(to)) < ((int)(from));var##down ? (var >= (int)(to)) : (var <= (int)(to));var##down ? var-- : var++)
#define UPTO(var, from, to)   for (register int var = (from); var <= ((int)to); var++)
#define DOWNTO(var, from, to) for (register int var = (from); var >= ((int)to); var--)
#define FOR(var, to)          UPTO(var, 0, (to)-1)
#define DOWN(var, from)       DOWNTO(var, (from)-1, 0) 

#define INIT(var, val) FOR(i,countof(var)) var[i] = val
#define INPUT(var) FOR(i,countof(var)) cin >> var[i]
#define INPUT1(var) FOR(i,countof(var)) cin >> var[i], var[i]--

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)
#define QSORT(v,b) qsort(v,countof(v),sizeof(*v),b)

#define MOD 1000000007
#define INF ((1 << 30)-1)
#define LINF ((1LL << 62)-1)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

struct Comb {
    vector<vector<s64> > data;
    Comb(int n) { // O(n^2)
        data = vector<vector<s64> >(n+1,vector<s64>(n+1,1));
        UPTO(i,1,n) {
            FOR(j,i+1) {
                if (!j || j == i) data[i][j] = 1;
                else data[i][j] = data[i-1][j-1] + data[i-1][j];
            }
        }
    }
    
    s64 ncr(int n, int r) {
        return data[n][r];
    }
};

static inline int ri() {
  int a;
  scanf("%d", &a);
  return a;
}

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

int main() {
    int n = ri();
	s64 p; cin >> p;
	map<s64,int> ma;
	for (int i = 2; ((s64)i)*i <= p; i++) {
		while(!(p%i)) ma[i]++, p/= i;
	}
	if (p>1) ma[p]++;
	
	s64 res = 1;
	for (auto i : ma) {
		FOR(j,i.se/n) res *= i.fi;
	}
	
	cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <map>
#include <bitset>
#include <cmath>
#include <set>
#include <utility>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

int main(){
    int N,goukei=0;
    cin >> N;
    vector<int> s(N);
    bool fla = false;

    for(int i = 0;i < N;i++)
        cin >> s.at(i);
    
    sort(s.begin(),s.end());

    for(int i = 0;i < N;i++)
        goukei += s.at(i);

    if(goukei % 10 == 0){
        fla = true;
        for(int i = 0;i < N;i++){
            if((goukei - s.at(i)) % 10 != 0){
                goukei -= s.at(i);
                fla = false;
                break;
            }
        }
    }

    if(fla)
        cout << 0 << endl;
    else
    {
        cout << goukei << endl;
    }
    
    
    
}

Measured memory_bytes: 3604
count = 0
while True:
    try:
        flag = 1
        a = raw_input()
        if len(a) == 1:
            count += 1
        else:
            for i in range(len(a)/2):
                if a[i] != a[len(a)-1-i]:
                    flag = 0
                    break
            if flag == 1:
                count += 1    
    except:
        break
print count

Measured memory_bytes: 4208
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
	//long long N = 10;
	//cin >> N;

	string s,t;
	cin >> s >> t;

	//int A[5]
	//sort(A, A + 5);

	bool flag = false;
	for (int i = 0; i < t.length() - 1; i++)
	{
		if (s[i] != t[i])
		{
			flag = true;
			break;
		}
	}

	if (flag == false)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

}

Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <iomanip>
#include <random>
#include <functional>

#include <fstream>
#include <vector>
#include <algorithm>

#define ll long long int
#define MOD 1000000007

using namespace std;

bool isPrime(ll n)
{
    if(n == 1)
    {
        return false;
    }
    for(ll i = 2; i*i <= n; i++)
    {
        if(n % i == 0)
        {
            return false;
        }
    }
    
    return true;
}

int main(void)
{

    
    ll l, r, d;
    ll res = 0;
    
    cin >> l >> r >> d;
    
    for(ll i = l; i <= r; i++)
    {
        if(i%d == 0)
        {
            res++;
        }
    }
    
    cout << res;
    
    return 0;
}

Measured memory_bytes: 3588
A,B,M = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
min_price = min(a)+min(b)

for i in range(M):
    x,y,c = map(int,input().split())
    min_price = min(min_price,a[x-1]+b[y-1]-c)
print(min_price)

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int mod = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  ll n;
  cin >> n;
  
  vector<ll> a(n);
  REP(i, n)
    cin >> a[i];
  
  //example:abc-1 moda=a-1, modb=b-1, modc=c-1
  ll sum = 0;
  REP(i, n)
    sum += a[i]-1;
  cout << sum << "\n";
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Queue;
import java.util.Scanner;
import java.util.concurrent.ArrayBlockingQueue;

class Main {

	/*
	 * https://onlinejudge.u-aizu.ac.jp/problems/ALDS1_11_C
	 */

	public static void main(String[] args) {
		//入力
		Scanner scanner = new Scanner(System.in);
		int N = Integer.parseInt(scanner.next());
		boolean matrics[][] = new boolean[N][N];//要素の名前は0~N-1
		for(int i=0; i<N; i++) {
			for(int j=0; j<N; j++) matrics[i][j] = false;
		}
		for(int i=0; i<N; i++) {
			int index = Integer.parseInt(scanner.next())-1;
			int k = Integer.parseInt(scanner.next());
			for(int j=0; j<k; j++) {
				matrics[index][Integer.parseInt(scanner.next())-1] = true;
			}
		}
		scanner.close();

		//探索
		Queue<Integer> queue = new ArrayBlockingQueue<>(N);
		queue.add(0);//頂点１を探索対象に設定
		int depth = 0;
		String message[] = new String[N];//出力用配列
		//到達したかどうかを管理する配列
		boolean isReachable[] = new boolean[N];
		for(int i=0; i<N; i++) {
			isReachable[i] = false;
		}
		//深さごとに到達した点を覚えておく
		ArrayList<Integer> pointList = new ArrayList<>();
		//BFSをする
		for(;;) {
			int node = queue.poll();
			if(!isReachable[node]) {
				message[node] = String.format("%d %d", node+1, depth);//初めてキューから取り出される時だけ
				isReachable[node] = true;//キューから取り出した＝到達している
				pointList.add(node);//これも２行上と同じ
			}
			if(queue.isEmpty()) {
				//次の深さへ
				depth++;
				for(int j : pointList) {
					for(int i=0; i<N; i++) {
						if(matrics[j][i]) {
							if(!queue.contains(i)) {//これをしないと重複でN個を超える場合がある
								queue.add(i);
							}
						}
					}
				}
				pointList.clear();
			}
			if(queue.isEmpty()) break;
		}
		//到達したかどうかチェック
		for(int i=0; i<N; i++) {
			if(!isReachable[i]) {
				message[i] = String.format("%d %d", i+1, -1);
			}
		}

		//出力
		for(String s : message) {
			System.out.println(s);
		}

	}

}



Measured memory_bytes: 29232
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;

int main(){
    string s;cin>>s;
    int n=s.size();
    int ans=0;
    REP(i,n/2){
        if(s[i]!=s[n-i-1]) ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	int x, y, a = 0;cin >> x >> y;
	a += max((4 - x) * 100000, 0) + max((4 - y) * 100000, 0);if (a == 600000)a = 1000000;
	cout << a << endl;
}

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    a,b = LI()
    if a == b:
        print(2*a)
    else:
        print(2*max(a,b)-1)
    return

#B
def B():
    n = I()

    return

#C
def C():
    n = I()

    return

#D
def D():
    n = I()

    return

#Solve
if __name__ == "__main__":
    A()


Measured memory_bytes: 39408
from collections import defaultdict
from itertools import permutations

n, c = map(int, input().split())
d = [list(map(int, input().split())) for _ in range(c)]
cmat = [list(map(int, input().split())) for _ in range(n)]

dcnt = [defaultdict(int) for _ in range(3)]
for i, ci in enumerate(cmat):
    for j, cij in enumerate(ci):
        mod = (i + j) % 3
        dcnt[mod][cij - 1] += 1

ans = 10 ** 9
for color in permutations(range(c), 3):
    tmp = 0
    for tgt, cnt in zip(color, dcnt):
        tmp += sum(d[k][tgt] * cnt[k] for k in cnt)
    ans = min(ans, tmp)
print(ans)


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

int main(void){
  long long x, y;
  cin >> x >> y;
  long long ans = 0;
  while(x <= y){
    x *= 2;
    ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O2")
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<unordered_map>
#include<set>
#include<cmath>
#include<climits>
#include<random>
#include <iomanip>
#include <bitset>
#include <iomanip>
using namespace std;
 
#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define fast ios::sync_with_stdio(false); cin.tie(NULL);
 
/////////////////////////////////////////////
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
///////////////////////////////
#define int long long

void solve(){
	
	int x;
	cin>>x;
	cout<<!x<<endl;
}

signed main(){
 
	fast;
	int t = 1;
	//cin>>t;
	while(t--)
		solve();
}

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

#define REP(i, n) for(int (i) = 0; (i) < (n); ++(i))
#define REPR(i, n) for(int (i) = (n); (i) >= 0; --(i))
#define FOR(i, n, m) for(int (i) = (n); (i) < (m); ++(i))

constexpr int INF = 1e9;
// constexpr ll INF = 1LL<<61;
constexpr ll mod = 1e9+7;

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  REP(i, N){
    cin >> A[i];
  }
  vector<ll> sum(N+1, 0);
  map<ll, int> mp;
  REP(i, N){
    sum[i+1] = A[i] + sum[i];
    mp[sum[i+1]]++;
  }
  mp[0]++;
  ll ans = 0;
  for(auto m : mp){
    ans += (ll)m.second * (m.second-1)/2;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 15104
n,x = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
ans = 0
for i in a:
    if x >= 0:
        x -= i
        ans += 1
    else:
        break
if x > 0:
    ans -= 1
if x < 0:
    ans -= 1
print(ans)

Measured memory_bytes: 3068
/*
このコード、と～おれ!
Be accepted!
  ∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#pragma GCC optimize("Ofast")
#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; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printfin(a) printf(a ? "possible\n" : "inposible\n")
#define all(x) (x).begin(), (x).end()
using ll = long long;

const int INF = 2147483647;
//const ll LINF = ll();今度書く

//マクロとかここまで

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>

using namespace std;

int main() {

	int n, d, x, a;
	scanf("%d%d%d", &n, &d, &x);
	rep(i, n) {
		scanf("%d", &a);
		for (int j = 0; a * j + 1 <= d; ++j) {
			++x;
		}
	}
	printf("%d\n", x);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
template<unsigned int mod_>
struct ModInt{
	using uint = unsigned int;
	using ll = long long;
	using ull = unsigned long long;

	constexpr static uint mod = mod_;

	uint v;
	ModInt():v(0){}
	ModInt(ll v):v(normS(v%mod+mod)){}
	explicit operator bool() const {return v!=0;}
	static uint normS(const uint &x){return (x<mod)?x:x-mod;}		// [0 , 2*mod-1] -> [0 , mod-1]
	static ModInt make(const uint &x){ModInt m; m.v=x; return m;}
	ModInt operator+(const ModInt& b) const { return make(normS(v+b.v));}
	ModInt operator-(const ModInt& b) const { return make(normS(v+mod-b.v));}
	ModInt operator-() const { return make(normS(mod-v)); }
	ModInt operator*(const ModInt& b) const { return make((ull)v*b.v%mod);}
	ModInt operator/(const ModInt& b) const { return *this*b.inv();}
	ModInt& operator+=(const ModInt& b){ return *this=*this+b;}
	ModInt& operator-=(const ModInt& b){ return *this=*this-b;}
	ModInt& operator*=(const ModInt& b){ return *this=*this*b;}
	ModInt& operator/=(const ModInt& b){ return *this=*this/b;}
	ll extgcd(ll a,ll b,ll &x,ll &y) const{
		ll u[]={a,1,0},v[]={b,0,1};
		while(*v){
			ll t=*u/ *v;
			rep(i,3) swap(u[i]-=t*v[i],v[i]);
		}
		if(u[0]<0) rep(i,3) u[i]=-u[i];
		x=u[1],y=u[2];
		return u[0];
	}
	ModInt inv() const{
		ll x,y;
		extgcd(v,mod,x,y);
		return make(normS(x+mod));
	}
	bool operator==(const ModInt& b) const { return v==b.v;}
	bool operator!=(const ModInt& b) const { return v!=b.v;}
	friend istream& operator>>(istream &o,ModInt& x){
		ll tmp;
		o>>tmp;
		x=ModInt(tmp);
		return o;
	}
	friend ostream& operator<<(ostream &o,const ModInt& x){ return o<<x.v;}
};
using mint = ModInt<1000000007>;
int N;
VV<int> G;
const int MN = 100010;
mint memo[MN][2];
bool done[MN][2];
mint dfs(int v,int p,int pcol){
	if(done[v][pcol]) return memo[v][pcol];
	done[v][pcol] = true;
	mint& res = memo[v][pcol];
	res = 0;
	rep(t,2){
		if(t==1 && pcol==1) continue;
		mint a = 1;
		for(int u:G[v]) if(u!=p){
			a *= dfs(u,v,t);
		}
		res += a;
	}
	return res;
}

int main(){
	cin>>N;
	G.resize(N);
	rep(i,N-1){
		int x,y;
		cin>>x>>y;
		x--,y--;
		G[x].pb(y);
		G[y].pb(x);
	}
	cout<<dfs(0,-1,0)<<endl;
}

Measured memory_bytes: 17792
#include <bits/stdc++.h>
using namespace std;
#define int long long

int32_t main()
{
	int a, b, c;
	cin >> a >> b >> c;
	
    int m = min(a, c);
    c -= m;
    a -= m;
    
    m = min(b, c);
    
    b -= m;
    
    cout << a << ' ' << b << '\n';
	
	
	return 0;
}

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

int main(){
  ll n,a,b; cin >> n >> a >>b;
  if(n==1 && a!=b){
    cout << 0 << endl;
    return 0;
  }
  else if(n==1 && a==b){
    cout << 1 << endl;
    return 0;
  }
  else{
  n-=2;
  if(a>b){
    cout << 0 << endl;
    return 0;
  }
  ll ans=b*n-a*n+1;

  cout << ans << endl;
 }
}


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

#define all_of(x) std::begin(x), std::end(x)
#ifdef _GLIBCXX_DEBUG
    #define debug(x) cerr << #x << ": " << x << endl
#else
    #define debug(x) 
#endif

using namespace std;

using LL = long long;

template<typename T>
ostream& operator << (ostream& out, const vector<T>& v) {
    out << "[";
    for(const auto& x : v) {
        out << x << ", ";
    }
    return out << "]";
}
template<typename T>
istream& operator >> (istream& in, vector<T>& v) {
    for(auto& x : v) {
        in >> x;
    }
    return in;
}

template<typename S, typename T>
ostream& operator << (ostream& out, const pair<S, T>& p) {
    return out << "{" << p.first << ", " << p.second << "}";
}

constexpr int MOD = 1e9 + 7;


int binom[5000][5000];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    int S;
    cin >> S;
    
    for(int n = 0; n < 5000; ++n) {
        for(int k = 0; k < 5000; ++k) {
            if(k == 0) {
                binom[n][k] = 1;
            } else if(n > 0) {
                binom[n][k] = (binom[n - 1][k] + binom[n - 1][k - 1]) % MOD;
            }
        }
    }
    
    LL ans = 0;
    for(int k = 1; ; ++k) {
        int s = S - 3 * k;
        if(s < 0) {
            break;
        }
        ans = (ans + binom[s + k - 1][k - 1]) % MOD;
    }
    
    cout << ans << "\n";
    
    
    return 0;
}


Measured memory_bytes: 101288
#include<iostream>
#include <algorithm>
#include <string>
using namespace std;
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(int)(n); i++)
typedef long long ll;
const int INF = numeric_limits<int>::max();
const int MOD = (1e9 + 7);


 int main(){
   string S, T;
   cin >> S >> T;
   string K = "";
   int N = S.size();
   rep(i, T.size()){
     K.push_back(S[i]);
     K.push_back(T[i]);
   }
   if(N != T.size())
     K.push_back(S[N-1]);
   cout << K << endl;
   
}

Measured memory_bytes: 256
#include <stdio.h>

int a,b;

int main(void)
{
	scanf("%d %d",&a,&b);
	int c,d;
	double e;
	c=(int)a/b;
	d=a-b*c;
	e=(double) a/ (double) b;
	printf("%d %d %.8f\n",c,d,e);
	return 0;
}

Measured memory_bytes: 640
use proconio::marker::Usize1;
fn main() {
    proconio::input! {
        n: usize,
        m: usize,
        p: [Usize1;n],
        xy: [(Usize1,Usize1);m],
    }
    let mut uf=petgraph::unionfind::UnionFind::new(n);
    for (x,y) in xy {
        uf.union(x, y);
    }
    let mut c=0;
    for (i,p) in p.into_iter().enumerate() {
        if uf.equiv(i, p) {
            c+=1;
        }
    }
    println!("{}",c);
}

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


int main() {
int N;
cin >> N;
int count1 = 0;
int max = 1;
int i;
for (i = 1;i <N+1; i++) {
    int j = i;
    int count2 = 0;
    while (j % 2 == 0) {
        j /= 2;
        count2++;
    }
if (count1 < count2) {
    max = i;
    count1 = count2;
}
}
cout << max << endl;
return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int f(int n, int k, int x, int y) {
    if (n <= k) {
        return n * x;
    }
    return k * x + (n - k) * y;
}

int main() {

    int n, k, x, y;
    cin >> n >> k >> x >> y;

    int result = f(n, k, x, y);
    cout << result << endl;

    return 0;
}


Measured memory_bytes: 256
N = int(input())
S = input()

MOD = 2 ** 61 - 1
root = 10000

rhs = [0]
for h in map(ord, S):
    rhs.append((root * rhs[-1] + h) % MOD)

pws = [1]
for i in range(N):
    pws.append(pws[-1] * root % MOD)

ok = 0
ng = N
while ng - ok > 1:
    mid = (ok + ng) // 2
    hashes = dict()
    flg = False
    for i in range(N - mid + 1):
        hashofsub = (rhs[i+mid] - rhs[i] * pws[mid]) % MOD
        if hashofsub in hashes:
            if i >= hashes[hashofsub] + mid:
                flg = True
                break
        else:
            hashes[hashofsub] = i
    
    if flg:
        ok = mid
    else:
        ng = mid

print(ok)

Measured memory_bytes: 75820
#include <iostream>
#include <map>

using namespace std;

int main(){
	int n;
	int m, a, b;
	bool f;

	while(cin >> n, n){
		map<int, int> q;
		f = true;
		for(int i = 0;i < n;++i){
			cin >> m >> a >> b;
			q[a] += m;
			q[b] -= m;
		}

		m = 0;
		for(auto&& e : q){
			m += e.second;
			if(m > 150){
				f = false;
				break;
			}
		}

		cout << (f ? "OK" : "NG") << endl;
	}
	return 0;
}

Measured memory_bytes: 3044
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int main(){
	
	string c = "                                                                                                                                                       ";
	
	bool checker;
	
	while(true){
		
		getline(cin, c);
		
		if(cin.eof()){
			break;
		}
		
		for(int i = 0; i < 26; i++){
			for(int j = 0; j < 2000; j++){
				if(c[j] == '\0'){
					break;
				}else if(c[j] == 'z'){
					c[j] = 'a';
				}else if(c[j] == ' '){
					c[j] = ' ';
				}else if(c[j] == '.'){
					c[j] = '.';
				}else{
					c[j]++;
				}
			}
			
			checker = false;
			
			for(int j = 0; j < 2000; j++){
				if(c[j] == '\0'){
					break;
				}
				if(c[j] == 't' && c[j + 1] == 'h'){
					if(c[j + 2] == 'e'){
						checker = true;
						break;
					}else if(c[j + 2] == 'i' && c[j + 3] == 's'){
						checker = true;
						break;
					}else if(c[j + 2] == 'a' && c[j + 3] == 't'){
						checker = true;
						break;
					}
				}
			}
			
			if(checker){
				break;
			}
		}
		
		for(int i = 0; i < 2000; i++){
			if(c[i] == '\0'){
				break;
			}
			cout << c[i];
		}
		cout << endl;
	}
	
	return 0;
}

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

using namespace std;

int main()
{
    int n, x, t, sum1 = 0, sum2 = 0;
    cin >> n >> x >> t;
    while (sum1 < n)
    {
        sum1 += x;
        sum2 += t;
    }
    cout << sum2;

    return 0;
}


Measured memory_bytes: 3612
n = gets.chomp
s = n.size

ans = true
for i in 0..(s-3)/2
  ans = false if n[i] != n[-i-2]
end
ans = false if n[-1] == "1" || n[0] == "0"

if ans
  puts "1 2"
  l = 2
  for i in 1..s-2
    if n[i] == "0"
      puts "#{l} #{i+2}"
    else
      puts "#{l} #{i+2}"
      l = i+2
    end
  end
else
  puts -1
end

Measured memory_bytes: 3068
#include<stdio.h>
#define M 100
#define INFTY 1000000
#define WHITE 0
#define GRAY 1
#define BLACK 2

void Sss(void);

int n,D[M][M];

int main() {

  int i,j;
  int k,c,v,u;

  scanf("%d",&n);

  for(i=0;i<n;i++) {
    for(j=0;j<n;j++) {
      D[i][j] = INFTY;
    }
  }

  for(i=0;i<n;i++) {
    scanf("%d %d",&u,&k);
    for(j=0;j<k;j++) {
      scanf("%d %d",&v,&c);
      D[u][v] = c;
    }
  }

  Sss();

  return 0;

}

void Sss() {

  int minv;
  int d[M],color[M];
  int i,j,u,v;

  for(i=0;i<n;i++) {
    d[i] = INFTY;
    color[i] = WHITE;
  }

  d[0] = 0;
  color[0] = GRAY;

  while(1) {
    
    minv = INFTY;
    u = -1;

    for(i=0;i<n;i++) {
      if(minv > d[i] && color[i] != BLACK) {
	u = i;
	minv = d[i];
      }
    }

    if(u == -1) break;
    
    color[u] = BLACK;

    for(v=0;v<n;v++) {
      if(color[v] != BLACK && D[u][v] != INFTY) {
	if(d[v] > d[u]+D[u][v]) {
	  d[v] = d[u]+D[u][v];
	  color[v] = GRAY;
	}
      }
    }
  }

  for(i=0;i<n;i++) {
    printf("%d",i);
    if(d[i] == INFTY) printf(" %d\n",-1);
    else printf(" %d\n",d[i]);
  }

}



Measured memory_bytes: 2052
import java.util.*;

class Main
{
	public static void main (String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int sec = scan.nextInt();
		int h, m, s;
		h = sec / 3600;
		sec %= 3600;
		m = sec / 60;
		sec %= 60;
		s = sec;
		
		System.out.println(h + ":" + m + ":" + s);
	}
}

Measured memory_bytes: 26332
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int const MAX = 1e2 + 50;
ll arr[MAX];
ll cost[MAX];
ll memo[MAX][int(1e5 + 50)];
ll n, k;

ll dp(ll i, ll rem)
{
	if(i == n || !rem) return 0;

	ll & ret = memo[i][rem];
	if(ret != -1) return ret;
	if(arr[i] > rem)
        return ret = dp(i + 1, rem);
	ll n1 = cost[i] + dp(i + 1, rem - arr[i]);
	ll n2 = dp(i + 1, rem);
	return ret = max(n1, n2);
}


int main()
{
    memset(memo, -1, sizeof(memo));
    scanf("%lld %lld", &n, &k);
    for(int i = 0; i < n; i++)
    {
    	scanf("%lld %lld", &arr[i], &cost[i]);
    }
    printf("%lld", dp(0, k));

	return 0;
}


Measured memory_bytes: 117504
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include<algorithm>

using namespace std;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(long long i=(a),i##Len_=(b);i<i##Len_;i++)
typedef long long ll;

int main()
{
    ll N,res;
    cin >> N;
    vector <ll> v(N + 1);
    vector <ll> iSum(N + 1);

    iSum[0] = 0;
    for(ll j = 1; j <= N; j++)
    {
        cin >> v[j];
        iSum[j] = iSum[j - 1] + v[j];
    }

    ll sa = 10000000;
    //全探索
    for(ll j = 1; j <= N; j++)
    {
        sa = min(sa, abs(iSum[j] + iSum[j] - iSum[N]));
    }

    cout << sa << endl;

}



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

int main(){
  std::string str;
  std::cin>>str;
  int count1 = 0;
  int count2 = 0;
    
  for(int i = 0 ; i < (int)str.length() ; i++){
    if(i%2==0){
      if(str[i]!='0') count1++;
      if(str[i]!='1') count2++;
    }else{
      if(str[i]!='1') count1++;
      if(str[i]!='0') count2++;
    }
  }

  if(count1<count2){
    std::cout<<count1<<std::endl;
  }else{
    std::cout<<count2<<std::endl;
  }
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <numeric>
#include <bitset>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
#define FOR(i,a,b)   for(ll i = (a); i < (b); i++ )
#define REP(i, n)    FOR(i,0,n)
typedef pair< ll, ll >   cp2;
typedef pair< ll, cp2 >   cp3;
#define fi first
#define se second
#define sec  se.fi
#define thr  se.se
const ll mod = 1000000007;
//              123456789

 
///////////////////////////////////////////////
//
//
///////////////////////////////////////////////

////////////////////////////////////////////////
////////////////////////////////////////////////

string A;
string B;
int ans = 0;

int main(){
	
	cin>>A>>B;
	
	if( A.size() > B.size() ) ans = 1;
	
	if( A.size() == B.size() ){
		REP( i, A.size() ){
			if( A[i] > B[i] ){
				ans = 1;
				break;
			}
			if( A[i] < B[i] ) break;
		}
	}
	
	if( A == B ) ans = 2;
	
	if( ans == 1 ) puts("GREATER");
	else if( ans == 2 ){ puts("EQUAL");}
	else{     puts("LESS");}
	
	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <complex>
#include <map>
#include<unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include<bitset>
#include<deque>
#include<string>
#include<list>
#include<iterator>
#include<sstream>
#include <algorithm>
#include <numeric>
#include <math.h>

#define user spaesk
#define lli long long int
#define ld long double
#define ff first
#define ss second
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower);

using namespace std;

const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long cmod = 998244353 ;
const long long inf = 1LL << 61;
const int M = 1e6 + 500;
const lli ths = 1LL << 40;
const int NN = 5e3 + 6;

void solve()
{
    lli n, k;
    cin>>n>>k;
    n = n % k;
    if(abs(n - k) < n) {
        n = abs(n - k);
    }
    cout<<n;
    cout<<'\n';
    return ;
}

/*
*/

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

    int t = 1;
//    cin>>t;
    while(t --)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        String S = sc.next();
        String ans;

        StringBuilder sb = new StringBuilder(N);
        for(int i = 0; i < N; i++){
            if(i == K - 1){
                sb.append(S.substring(i, i + 1).toLowerCase());
            }else{
                sb.append(S.substring(i, i + 1));
            }
        }
        ans = sb.toString();
        System.out.println(ans);
    }
}

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

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

    if(s==0) cout << 0 << endl;
    else if(s==111) cout << 3 << endl;
    else if(s==10 || s==1 || s==100) cout << 1 << endl;
    else if(s==11 || s==110 || s==101) cout << 2 <<endl;

}

Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <new>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef int64_t i64;

static i64 f(i64 *a, int n, int sgn, i64 sum, i64 ret) {
	if(n <= 0) return ret;
	if(sgn * (*a + sum) > 0) return f(a + 1, n - 1, -sgn, sum, ret);
	auto delta = sgn - (*a + sum);
	return f(a + 1, n - 1, -sgn, sum + delta, ret + abs(delta));
}

int main() {
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	auto a = new i64[n];
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		if(i != 0) a[i] += a[i - 1];
	}
	cout << min(f(a, n, +1, 0, 0), f(a, n, -1, 0, 0)) << endl;
	return 0;
}

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

using namespace std;

//= AOJ GRL_1_A


const int V_constraint=1000,E_constraint=2000, D_constraint=10000;
int V, E, R,S[E_constraint+10], T[E_constraint+10], D[E_constraint+10],C[V_constraint+10];
const int inf=V_constraint*D_constraint+100;
// int parent[100000];

int main() {
	
	
	//= prompt user for input
	cin >> V >> E >> R;
if (E>E_constraint)
	cout<< "E violates constraints";
for (int i=0; i<E; ++i){
	cin >> S[i] >> T[i] >> D[i];
	if (D[i] >D_constraint || D[i]<D_constraint*-1)
	cout<< "D violates constraints";
}
// set distance from source to source as zero, other as infinite
for (int i=0;i<V;i++) C[i]=inf;
C[R]=0;


//= bellman-ford algo
for (int v=0;v<V-1;v++)
{
	bool update = false;

	for (int i=0;i<E;++i){
		if(C[S[i]]+D[i]<C[T[i]] && C[S[i]]<inf ){
		C[T[i]]=C[S[i]]+D[i];
		update = true; 
		
	
		}
}
if (!update) break; 
	}


//= for negative cycle
int neg_cyc =0;
for (int i=0;i<E;i++){
	if (C[S[i]] != inf && D[i]!= inf)
		if(C[S[i]] + D[i] < C[T[i]])
			neg_cyc=1;
}

if (neg_cyc==1)
	cout <<"NEGATIVE CYCLE"<<endl;
else {
for (int i=0; i<V; i++)
	if (C[i]!=inf)
	cout << C[i] <<endl;
	else
	cout <<"INF"<<endl;
}	

	return 0;
}

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

using namespace std;
int n,k;
vector<int> v;
// dp[turn][stones] 
vector<vector<int>> dp;

// 1 is if the  starting player can win playing optimally
int solve(int turn, int stones){
	if(stones < v[0]){
		if(turn) return 0;
		else return 1;
	}
	if(dp[turn][stones] != 5) return dp[turn][stones];
	int ret;
	if(turn) ret = 0;
	else ret = 1;
	for(int i = 0 ; i < n ; i++){
		if(stones < v[i]) break;
		if(turn){
			ret = max(ret,solve(1-turn,stones-v[i]));
		}
		else{
			ret = min(ret,solve(1-turn,stones-v[i]));
		}
	}
	dp[turn][stones] = ret;
	return ret;
}

int main(){
	cin >> n >> k;
	v.resize(n);
	dp.resize(2);
	for(int i = 0 ; i < 2 ; i++) dp[i].resize(k+1,5);
	for(int i = 0 ; i  < n ; i++){
		cin >> v[i];
	}
	sort(v.begin(),v.end());
	//cout << solve(1,k) << endl;
	if(solve(1,k)) cout << "First" << endl;
	else cout << "Second" << endl;
	
	return 0;
}

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

int main()
{
    int n; cin>>n;
    vector<int> p(n+1);
    for(int i=0; i<n; ++i) {
        int a; cin>>a;
        p[a]=i;
    }

    long res=0;
    set<int> s={-1, n};
    for(int i=1; i<=n; ++i) {
        int k=p[i];
        auto it=s.upper_bound(k);
        long R=*it;
        long L=*--it;
        res+=(k-L)*(R-k)*i;
        s.insert(k);
    }
    cout<<res<<endl;
}


Measured memory_bytes: 10368
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder_20190707_1
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());

            if(a >= 3200)
            {
                Console.WriteLine(Console.ReadLine());
            }
            else
            {
                Console.WriteLine("red");
            }
        }
    }
}


Measured memory_bytes: 11092
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
using namespace std;
#define     loop(n,i,a)     for(int i=a;i<n;i++)
#define     loopR(n,i,a)    for(int i=n-1;i>=a;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define		vii 			vector<pair<ll,ll>>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
#define     test(i)        cout<<i<<endl
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=3e2+10,oo=0x3f3f3f3f,mod=998244353;
const double PI = 3.14159265358979323846;

void solve(){
    int x;
    cin>>x;
    if(x>=400&&x<=599)
        cout<<8<<Endl;
    else if(x>=600&&x<=799)
        cout<<7<<endl;
    else if(x>=800&&x<=999)
        cout<<6<<endl;
    else if(x>=1000&&x<=1199)
        cout<<5<<endl;
    else if(x>=1200&&x<=1399)
        cout<<4<<endl;
    else if(x>=1400&&x<=1599)
        cout<<3<<endl;
    else if(x>=1600&&x<=1799)
        cout<<2<<endl;
    else
        cout<<1<<endl;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;
const int INF = INT_MAX;

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

	int sum = a + b + c;

	if (sum >= 22) cout << "bust" << endl;
	else cout << "win" << endl;
}

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



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


Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from copy import deepcopy
from math import factorial, ceil, floor, gamma, log
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = float('INF')
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


n, k = LI()
H = sorted(LI())
if k >= n:
    print(0)
else:
    print(sum(H[:n - k]))


Measured memory_bytes: 68540