akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int h, w;
char c[310][310];

int dp[310][310];
int f[310][310];
int idx = 0;

int calc_f(int h0, int h1) {
    if (h0 == 0 || h1 == 0) return 0;
    if (f[h0][h1] < 0) {
        f[h0][h1] = calc_f(h0-1, h1-1) + (int)(c[h0-1][idx] == c[h1-1][idx+1]);
    }
    return f[h0][h1];
}

int calc(int h0, int h1) {
    if (h0 == 0 || h1 == 0) return 0;
    if (dp[h0][h1] < 0) {
        dp[h0][h1] = min(calc(h0-1, h1), calc(h0, h1-1)) + calc_f(h0, h1);
    }
    return dp[h0][h1];
}

int solve() {
    int res = 0;
    for (int i = 0; i < w-1; i++) {
        idx = i;
        memset(dp, -1, sizeof(dp));
        memset(f, -1, sizeof(f));       
        res += calc(h, h);
    }
    return res;
}

void input() {
    cin >> h >> w;
    string s;
    for (int i = 0; i < h; i++) {
        cin >> s;
        for (int j = 0; j < w; j++)
            c[i][j] = s[j];
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);

    input();
    cout << solve() << endl;
}


Measured memory_bytes: 4416
#include<stdio.h>

int main(void){

  int A[105],n, i, j, k, x = 0;
  scanf("%d", &n);
  
  for ( i = 1; i <= n; i++ )
  scanf("%d", &A[i]);
 
  for ( i = 1; i <= n; i++ ){
    for ( j = n; j >= i+1; j-- ){
      if ( A[j] < A[j-1] ){
        k = A[j]; A[j] = A[j-1]; A[j-1] = k;
    x++;
      }
    }
  }

  for ( i = 1; i <= n; i++ ){
    if (i>1)
    printf(" ");
    printf("%d", A[i]);
  }

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

}


Measured memory_bytes: 2140
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

H, W= map(int, input().split())
h, w = map(int, input().split())

print(H * W - ((h * W) + (w * (H - h))))



Measured memory_bytes: 6420
//17571@nith.ac.in @Ankit Verma
#include <bits/stdc++.h>
using namespace std;
#define ff          first
#define ss          second
#define pb          push_back
#define MP          make_pair
#define int         long long
#define ll          long long
#define inf         0x3f3f3f3f
#define MOD         1000000007
#define ld          long double
#define eb          emplace_back
#define pii         pair<int,int>
#define ull         unsigned long long
#define all(v)      v.begin(), v.end()
#define f(i,x,n)    for(int i=x;i<n;i++)
#define fr(i,x,n)   for(int i=x;i>=n;i--)
#define fastio      ios::sync_with_stdio(false)

void IO() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int32_t main() {
	IO();
	fastio;
	cin.tie(nullptr);
	cout.tie(nullptr);
	int n, m, x; cin >> n >> m >> x;
	int ar[20][20];
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= m; j++) {
			cin >> ar[i][j];
		}
	}
	int limit = 1 << n;
	int mn = INT_MAX; bool ok = true; int skill = 0;
	vector <int> check(m + 1);
	for (int i = 0; i < limit; i++) {
		int cost = 0; ok = true; 
		for (int p = 1; p <= m; p++) {
			check[p] = 0;
		}
		for (int j = 0; j < n; j++) {
			skill = 0;
			if ((i & (1 << j)) != 0) {
				cost += ar[j][0];
				for (int k = 1; k <= m; k++) {
					check[k] += ar[j][k];
				}
				for (int z = 1; z <= m; z++) {
					if (check[z] < x) {
						ok = false;
						break;
					} else ok = true;
				}
			}
		}
		if (ok) {
			if (cost != 0) {
				mn = min(mn, cost);
			}
		}
	}
	if (mn == INT_MAX) {
		cout << -1 << endl;
	} else
		cout << mn << endl;

	return 0;
}

Measured memory_bytes: 3664
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

#define MAX_V 1000000

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	string s;
	cin >> s;
	int left[N], right[N];
	int w = 0, e = 0;
	left[0] = 0;
	if(s[0] == 'E') e++;

	rep(i, 1, N) {
		left[i] = e;
		if(s[i] == 'E') e++;
	}

	right[N - 1] = 0;
	if(s[N - 1] == 'W') w++;

	for(int i = N - 2; i >= 0; i--) {
		right[i] = w;
		if(s[i] == 'W') w++;
	}

	ll max_v = left[0] + right[0];
	int idx = 0;
	rep(i, 0, N) {
		if(max_v < left[i] + right[i]) {
			max_v = left[i] + right[i];
			idx = i;
		}
	}

	cout << N - 1 - left[idx] - right[idx] << endl;
}


Measured memory_bytes: 2964
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define ll long long

int a,b;
char z;

int main(){
  scanf("%d",&a);

  
  int ans= a+a*a+a*a*a;
  
  
  printf("%d\n",ans);
  
  return 0;
}


Measured memory_bytes: 1704
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <stack>
#include <queue>
#include <bitset>
#include <numeric>
#include <cassert>
#include <random>
#ifdef DEBUG
#include "./Lib/debug.hpp"
#include "./Lib/Timer.h"
#else
#define dump(...)
template<class T>inline auto d_val(T a, T b) { return a; }
#endif

/* (=＾o＾=) */
#define int ll

/* macro */
#define FOR(i, b, e) for(ll i = (ll)(b); i < (ll)(e); ++i)
#define RFOR(i, b, e) for(ll i = (ll)(e-1); i >= (ll)(b); --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define REPI2(it,b,e) for(auto it = (b); it != (e); ++it)
#define REPI(it,c) REPI2(it, (c).begin(), (c).end())
#define RREPI(it,c) REPI2(it, (c).rbegin(), (c).rend())
#define REPI_ERACE2(it, b, e) for(auto it = (b); it != (e);)
#define REPI_ERACE(it, c) REPI_ERACE2(it, (c).begin(), (c).end())
#define ALL(x) (x).begin(),(x).end()
#define cauto const auto&
/* macro func */
#define SORT(x) do{sort(ALL(x));}while(false)
#define RSORT(x) do{sort((x).rbegin(),(x).rend());}while(false)
#define UNIQUE(v) do{v.erase( unique(v.begin(), v.end()), v.end() );}while(false)
#define MAX(x,y) do{x = std::max(x,y);}while(false)
#define MIN(x,y) do{x = std::min(x,y);}while(false)
#define BR do{cout<<"\n";}while(false)

/* type define */
using ll = long long;
using PAIR = std::pair<ll, ll>;
using VS = std::vector<std::string>;
using VL = std::vector<long long>;
using VVL = std::vector<VL>;
using VVVL = std::vector<VVL>;
using VD = std::vector<double>;
template<class T>
using V = std::vector<T>;

/* using std */
using std::cout;
constexpr char endl = '\n';
using std::cin;
using std::sort;
using std::pair;
using std::string;
using std::stack;
using std::queue;
using std::vector;
using std::list;
using std::map;
using std::unordered_map;
using std::multimap;
using std::unordered_multimap;
using std::set;
using std::unordered_set;
using std::unordered_multiset;
using std::multiset;
using std::bitset;
using std::priority_queue;

/* constant value */
constexpr ll MOD = 1000000007;
//constexpr ll MOD = 998244353;

/* Initial processing  */
struct Preprocessing { Preprocessing() { std::cin.tie(0); std::ios::sync_with_stdio(0); }; }_Preprocessing;

/* Remove the source of the bug */
signed pow(signed, signed) { assert(false); return -1; }

/* define hash */
namespace std { template <>	class hash<std::pair<ll, ll>> { public:	size_t operator()(const std::pair<ll, ll>& x) const { return hash<ll>()(1000000000 * x.first + x.second); } }; }

/* input */
template<class T> std::istream& operator >> (std::istream& is, vector<T>& vec) { for (T& x : vec) is >> x; return is; }

//=============================================================================================

signed main() {
	string str;
	cin >> str;

	VL v(3);
	REPC(c, str) { ++v[c - 'a']; }
	SORT(v);

	if (v[2] - v[0] < 2) {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 512
while True:
    H,W = map(int,input().split())
    if H == 0 and W == 0:
        break
    for i in range(H):
        if (i+1)%2 != 0:
            for j in range(W):
                if (j+1)%2 != 0:
                    print("#",end="")
                elif (j+1)%2 == 0:
                    print(".",end="")
            print()
        elif (i+1)%2 == 0:
            for j in range(W):
                if (j+1)%2 != 0:
                    print(".",end="")
                elif (j+1)%2 == 0:
                    print("#",end="")    
            print()
    print()


Measured memory_bytes: 7008
package main

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

func solve() {
	n := getInt()
	s := make([][]int, 3)
	for i := range s {
		s[i] = make([]int, n)
	}
	for i := 0; i < n; i++ {
		s[0][i] = getInt()
		s[1][i] = getInt()
		s[2][i] = getInt()
	}

	dp := make([][]int, 3)
	for i := range dp {
		dp[i] = make([]int, n+1)
	}

	for i := 1; i <= n; i++ {
		for a := 0; a < 3; a++ {
			for b := 0; b < 3; b++ {
				if a == b {
					continue
				}

				dp[a][i] = max(dp[a][i], dp[b][i-1]+s[a][i-1])
			}
		}
	}

	ans := max(dp[0][n], dp[1][n], dp[2][n])
	fmt.Fprintln(wr, ans)
}

func max(ns ...int) int {
	max := ns[0]
	for i := 1; i < len(ns); i++ {
		if max < ns[i] {
			max = ns[i]
		}
	}
	return max
}

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

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}


Measured memory_bytes: 6272
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List
import Data.Char

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    n <- getLine
    let t = foldl' f 0 n
    let m = t `mod` 9
    putStrLn $ if m == 0 then "Yes" else "No"

f s c = s + (digitToInt c)

Measured memory_bytes: 11840
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
int main()
{
  int N;
  cin >> N;
  vector<int> B(N - 1);
  rep(i, N - 1)
  {
    cin >> B[i];
  }
  vector<int> A(N, 1e12); // infで初期化
  rep(i, N - 1)
  {
    A[i] = min(A[i], B[i]);
    A[i + 1] = min(A[i + 1], B[i]);
  }

  int ans = 0;
  rep(i, N)
  {
    ans += A[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
int main() {
 long N,zyouken;
 cin >> N;
 zyouken=modpow(10, N, 1000000007)-(2*modpow(9, N, 1000000007))+modpow(8, N, 1000000007);
 while(zyouken<0){
   zyouken=zyouken+1000000007;
 }
 zyouken=zyouken%1000000007;
cout << zyouken;
}

Measured memory_bytes: 3632
using System;

public class Test
{
	public static void Main()
	{
		string[] str = Console.ReadLine().Split(' ');
		int a = Array.IndexOf(str, "7");
		if(a == -1){
			Console.WriteLine("NO");
		}
		else if(a == 0 && str[1].Equals("5") && str[2].Equals("5")){
			Console.WriteLine("YES");
		}
        else if(a == 1 && str[0].Equals("5") && str[2].Equals("5")){
			Console.WriteLine("YES");
		}
		else if(a == 2 && str[1].Equals("5") && str[0].Equals("5")){
			Console.WriteLine("YES");
		}
		else{
			Console.WriteLine("NO");
		}
	}
}

Measured memory_bytes: 2776
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<iostream>
#define mmod 1000000007
#define N 22
#define M (1<<20)+10
#define lowbit(x) (x&(-x))
using namespace std;
int n,m,lim[N][N],f[M],g[M],ans;
void init()
{
	int k;scanf("%d%d%d",&n,&m,&k);
	n--;
	memset(lim,-1,sizeof(lim));
	while(k--)
	{
		int a,b,c;scanf("%d%d%d",&a,&b,&c);
		lim[a][b]=c;
	}
}
void upd(int &x,int y)
{
	x=(x+y)%mmod;
}
void solve()
{
	int ss=(1<<n)-1;
	f[0]=1;
	for(int i=1;i<=m;i++)
		for(int j=1;j<=n;j++)
		{
			for(int k=0;k<=ss;k++) g[k]=0;
			for(int k=0;k<=ss;k++)
			{
				if(f[k]==0) continue;
				if(lim[i][j]==0 && (k&(1<<(j-1)))) continue;
				if(lim[i][j]!=1 && (k&(1<<(j-1)))==0) {int s=k;upd(g[s],f[k]);}
				if(lim[i][j]!=0)
				{
					int s=k;
					if((k&(1<<(j-1)))==0) 
					{
						int t=s&((1<<j)-1);
						t|=1<<(j-1);
						s>>=j;
						s-=lowbit(s);
						s<<=j;
						s+=t;
					}
					upd(g[s],f[k]);
				}
			}
			for(int k=0;k<=ss;k++) f[k]=g[k];
		}
	for(int i=0;i<=ss;i++) upd(ans,f[i]);
	printf("%d\n",ans);
}
int main()
{
	init();
	solve();
	return 0;
}

Measured memory_bytes: 8576
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static String Y = "Yes";
	public static String N = "No";
	public static long MOD = (long) (Math.pow(10, 9) + 7);
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		out(ni() >= 1000 ? "ABD" : "ABC");

	}

	/*
	 * 以下メソッド集
	 */
	static int[] sort(int[] n) {
		Arrays.sort(n);
		return n;
	}

	static void debug() {
		out("---");
	}

	static void debug(long a) {
		out("-------");
		out(a);
		out("-------");
	}

	static void debug(String a) {
		out("-------");
		out(a);
		out("-------");
	}

	static long[] sort(long[] n) {
		Arrays.sort(n);
		return n;
	}

	static int ketasuu(int n) {
		String str = "" + n;
		return str.length();
	}

	static int account(String str) {
		String target = "AC";
		int count = 0;
		int len = str.length();
		for (int i = 0; i < len - 1; i++) {
			if (target.equals(str.substring(i, i + target.length()))) {
				count++;
			}
		}
		return count;
	}

	static int ni() {
		return sc.nextInt();
	}

	static long nl() {
		return sc.nextLong();
	}

	static double nd() {
		return sc.nextDouble();
	}

	static String n() {
		return sc.next();
	}

	static char[] nc() {
		return sc.next().toCharArray();
	}

	static int kaijo(int n) {
		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	}

	static int fib(int n) {
		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	}

	static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	}

	static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	}

	static long gcd(long a, long b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static int gcd(int a, int b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static void out(String info) {
		System.out.println(info);
	}

	static void out(int info) {
		System.out.println(info);
	}

	static void out(double info) {
		System.out.println(info);
	}

	static void out(long info) {
		System.out.println(info);
	}

	static void out(char info) {
		System.out.println(info);
	}

	static void out(Object obj) {
		System.out.println(obj.toString());
	}

	static void outn(String info) {
		System.out.print(info);
	}

	static void outn(int info) {
		System.out.print(info);
	}

	static void outn(double info) {
		System.out.print(info);
	}

	static void outn(long info) {
		System.out.print(info);
	}

	static void outn(char info) {
		System.out.print(info);
	}

	static double max(double d, double e) {
		return Math.max(d, e);
	}

	static long max(long a, long b) {
		return Math.max(a, b);
	}

	static long min(long d, long e) {
		return Math.min(d, e);
	}

	static int min(int a, int b) {
		return (int) Math.min(a, b);
	}
}

class XY {
	int h;
	int c;

	XY(int h, int c) {
		this.h = h;
		this.c = c;
	}
}


Measured memory_bytes: 35692
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[100];
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	cout<<a[n-1]-a[0]<<endl;
	return 0;
}

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

M = [0 for _ in range(N)]
M[0] = sum(A[0:N:2]) - sum(A[1:N:2])
for i in range(1, N):
    M[i] = 2*A[i-1] - M[i-1]

print(*M)

Measured memory_bytes: 14092
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define sz(a) int(a.size())
#define clr(a) memset(a,0,sizeof(a))
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
const int inf=1e9;
const ll Inf=1e18;
const int N=1e5+10;
const int mod=0;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
template<typename T> bool chkmax(T &a,T b) { return a<b?a=b,1:0; };
template<typename T> bool chkmin(T &a,T b) { return a>b?a=b,1:0; };
int add(int a,int b) { return a+b>=mod?a+b-mod:a+b; }
int sub(int a,int b) { return a-b<0?a-b+mod:a-b; }
void inc(int &a,int b) { a=(a+b>=mod?a+b-mod:a+b); }
void dec(int &a,int b) { a=(a-b<0?a-b+mod:a-b); }
int n;
ll a[510][510];
ll lcm(ll a,ll b) {
    return a/__gcd(a,b)*b;
}
int pri[N],tot=0;
bool vis[N];
void init() {
    const int n=1e5;
    for(int i=2;i<=n;i++) {
        if(!vis[i]) pri[++tot]=i;
        for(int j=1;j<=tot&&i*pri[j]<=n;j++) {
            vis[i*pri[j]]=1;
            if(i%pri[j]==0) break;
        }
    }
}
int main() {
    n=gi();
    if(n==2) return puts("4 7"),puts("23 10"),0;
    for(int i=0;i<=n+1;i++)
        for(int j=0;j<=n+1;j++) a[i][j]=1;
    init();
    for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
            if((i+j-1)&1) a[i][j]=1ll*pri[(i+j)/2]*pri[(i+n-j+1)/2+n];
    for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
            if((i+j)&1) a[i][j]=lcm(a[i-1][j],lcm(a[i+1][j],lcm(a[i][j-1],a[i][j+1])))+1;
    for(int i=1;i<=n;i++,puts(""))
        for(int j=1;j<=n;j++) printf("%lld ",a[i][j]);
    return 0;
}


Measured memory_bytes: 5248
#include <cstdio>
#include <algorithm>

using namespace std;

long long n, k, ans;

int main()
{
    scanf("%lld%lld", &n, &k);
    if (!k) {printf("%lld\n", n * n); return 0;}
    for(int i = k + 1; i <= n; ++i)
        ans += n / i * (i - k) + max(n % i - k + 1, 0LL);
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<cctype>
using namespace std;


int main() {
	string s;
	cin >> s;
	int c = s.size();
	for (int i = 0; i < c - 8; i++) {
		cout << s[i];
	}
	cout << endl;
}

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

int main() {
  string str;   //今回は15文字入力と予めわかっている

  cin >> str;
  int N = str.size();
  vector<int64_t> vec(N);

    for (int i = 0; i < N; ++i) {

        vec.at(i) = (int64_t)(str[i] - '0');  //str[i]　はchar型なのでchar→intへ変換

        }
  if(N == 1) {
    cout << vec.at(0);
  }
  else {
    int64_t sum = 0;
    for (int tmp = 0; tmp < (1 << N-1); tmp++) {
      bitset<9> s(tmp);
      int64_t a = vec.at(0);
      // cout << tmp << endl; //
      for(int i = 0; i < N-1; i++) {
        if(s[i]) {
          sum += a;
          a = vec.at(i+1);
        }
        else {
          a = 10*a + vec.at(i+1);
        }
        if(i == N-2) {
            sum += a;
          }
         // cout << "i = " << i << " a = " << a << ' ' << "sum =" << sum << endl; // 
      }
    }
    cout << sum;
}


}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

int main(){
  int n,k;
  cin>>n>>k;
  ll ans=k;
  rep(i,n-1)ans*=(k-1);
  cout<<ans<<endl;
  return(0);
}

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

using namespace std;
typedef long long lint;

#define RPT(i, b, e) for (int i = (b); i <= (e); i++)
#define RPT0(i, n) RPT(i, 0, n - 1)
#define RPT1(i, n) RPT(i, 1, n)
#define ALL(v) v.begin(), v.end()

void resolve()
{
    int X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;
    vector<int> p(A), q(B), r(C);
    RPT0(i, A) cin >> p[i];
    RPT0(i, B) cin >> q[i];
    RPT0(i, C) cin >> r[i];

    sort(ALL(p), greater<int>());
    sort(ALL(q), greater<int>());

    vector<int> z;
    RPT0(i, X) z.push_back(p[i]);
    RPT0(i, Y) z.push_back(q[i]);
    RPT0(i, C) z.push_back(r[i]);
    sort(ALL(z), greater<int>());

    lint ans = 0;
    RPT0(i, X + Y) ans += z[i];
    cout << ans << endl;
}

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


Measured memory_bytes: 3572
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

a = sorted(a)
sum_a = 0
ans = 0
for i in range(n-1, -1, -1):
    if sum_a+a[i] < k:
        sum_a += a[i]
        ans += 1
    else:
        ans = 0
    # print(ans)
print(ans)

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ll N;
    cin >> N;
    vector<ll> vec(N);
    rep(i,N){
        cin >> vec[i];
    }
    ll left = 0;
    ll right = 0;
    ll xor_cnt = 0;
    ll sum_cnt = 0;
    ll ans = 0;
    xor_cnt = vec[0];
    sum_cnt = vec[0];
    while(right < N){
        if (right == N - 1){
            if (xor_cnt == sum_cnt){
                ans += (right - left + 1);
                right++;
            }
            else{
                xor_cnt = (xor_cnt ^ vec[left]);
                sum_cnt = (sum_cnt - vec[left]);
                left++;
            }
        }
        else if (xor_cnt == sum_cnt){
            ans += (right - left + 1);
            right++;
            xor_cnt = (xor_cnt ^ vec[right]);
            sum_cnt = sum_cnt + vec[right];
        }
        else{
            xor_cnt = (xor_cnt ^ vec[left]);
            sum_cnt = (sum_cnt - vec[left]);
            left++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4820
#include<stdio.h>

int main()
{
	int x, y;
	int num = 1;
	
	while (1)
	{
	    scanf("%d%d", &x, &y);
		if (x==0 && y==0)
		{
			break;
		}
		if (x <= y)
		{
			printf("%d %d\n", x, y);
		}
		else if (x > y)
		{
			printf("%d %d\n", y, x);
		}

	}

	
	return 0;
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll i = (m); i < (n); ++i)
#define REPN(i, m, n) for(ll i = (m); i <= (n); ++i)
#define REPR(i, m, n) for(ll i = (m)-1; i >= (n); --i)
#define REPNR(i, m, n) for(ll i = (m); i >= (n); --i)
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
// constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const double PI = acos(-1);

int main(void){
	ll a, b, c;
	cin >> a >> b >> c;
	ll x, y;
	cin >> x >> y;

	ll ans = LINF;
	rep(i, max(x, y) + 1) {
		chmin(ans, i * c * 2 + a * max(x - i, 0LL) + b * max(y - i, 0LL));
	}
	co(ans);

	return 0;
}


Measured memory_bytes: 3608
# https://atcoder.jp/contests/abc080/tasks/abc080_c
# C - Shopping Street
import itertools
N = int(input().split()[0])
f_list_list = []

for _ in range(N):
    f_list_list.append(list(map(int, input().split())))

p_list_list = []

for _ in range(N):
    p_list_list.append(list(map(int, input().split())))

p_gen = itertools.product([0, 1], repeat=10)
max_p = -float('inf')

for pattern in p_gen:  # 1024
    if sum(pattern) == 0:
        continue
    counter = {k: 0 for k in range(N)}
    for t_i, is_open in enumerate(pattern):  # 10
        if is_open == 0:
            continue
        for n_i in range(N):  # 100
            if f_list_list[n_i][t_i] == 1:
                counter[n_i] += 1
    total_p = 0
    for k, c in counter.items():  # 100
        total_p += p_list_list[k][c]
    max_p = max(total_p, max_p)

print(max_p)


Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(){
  int n,m;
  int ph[394],br[394],mo[394];
  cin >>n;
  for(int i=1; i<=n; i++){
    cin >>ph[i]>>br[i]>>mo[i];
    br[i]-=ph[i];
  }
  vector<int> ans;
  int dp[394]={0};
  for(int i=1; i<=n; i++){
    for(int j=0; j<=393; j++){
      for(int k=0; k<=br[i]; k++){
	if(j-k-ph[i]>=0){
	  if(j-k-ph[i] == 0 || dp[j-k-ph[i]]!=0){
	    dp[j] = max(dp[j],dp[j-k-ph[i]]+mo[i]);
	  }
	}
      }
    }
  }
  cin >>m;
  for(int i=0,x; i<m; i++){
    cin >>x;
    if(dp[x] != 0) ans.push_back(dp[x]);
    else{cout <<"-1"<<endl;goto jump;}
  }
  for(int i=0; i<ans.size(); i++){
    cout <<ans[i]<<endl;
  }
 jump:
  return 0;
}

Measured memory_bytes: 1228
n = int(input())
a = [-1]
a.extend(list(map(int, input().split())))
cnt = 0
ansID = []
ans = [-1]*(n+1)

for i in reversed(range(1, len(a))):
  tmp = a[i]
  j = i*2
  while j < len(ans):
    tmp += ans[j]
    j += i
  ans[i] = tmp%2
  cnt += tmp%2
  if tmp%2 == 1:
    ansID.append(i)
  
print(cnt)
for ans in ansID:
  print(ans, end=" ")


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



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

    lint n, k;
    cin >> n >> k;
    vector<int> a(n);
   
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        --a[i];
    }
    
    stack<int> st;
    st.push(0);
    vector<int> perm;
    unordered_map<int,int> vis;
    int beforeLoop = 0;
    while (!st.empty()) {
        int cur = st.top(); st.pop(); 
        //cout << cur+1 << endl;

        if (perm.size() > 1 && vis.count(cur)) {
            beforeLoop = vis[cur];
            break;
        }
        vis.emplace(cur, perm.size());
        perm.push_back(cur);
        
        if (k == perm.size()-1)
        {
            cout << cur+1 << endl;
            return 0;
        }
        
        st.push(a[cur]);
    }
    
    lint l = perm.size();
    k = k - beforeLoop;
    int loopSz = l - beforeLoop;
    k = k%loopSz;
    int pos = beforeLoop + k;
    cout << perm[pos]+1 << endl;

    return 0;
}

Measured memory_bytes: 11512
#include <iostream>
#include<vector>
//#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
using namespace std;
int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];

    rep(i, N) {
        if (A[i] % 2 == 0) {
            if (A[i] % 3 != 0) {
                if (A[i] % 5 != 0) {
                    cout << "DENIED" << endl;
                    return 0;
                }
                continue;
            }
            continue;
        }
        continue;
    }
    cout << "APPROVED" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char s[4];

    while(scanf("%s",s)!=EOF)
    {
        int num[3]={0};
        for(int i=0;i<3;i++)
        {
            num[s[i]-'a']++;
        }
        if(num[0]&&num[1]&&num[2])
            printf("Yes\n");
        else
            printf("No\n");
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(a) a.begin(),a.end()
#define lb(s,x) lower_bound(all(s),x)-s.begin()

int main(void){
    int n,m,x;
    cin>>n>>m>>x;
    vector<int> a(m);
    rep(i,m)cin>>a[i];
    int pos = lb(a,x);
    cout<<min(pos, m-pos)<<endl;
    return 0;
}


Measured memory_bytes: 256
// Dice01.cc
// 次の展開図から得られるサイコロを転がすシミュレーションを行うプログラムを作成してください。
// サイコロの各面には図のとおりに 1 から 6 のラベルが割りあてられています。
// 入力としてサイコロの各面のラベルに対応する整数と、転がす命令の列が与えられるので、
// サイコロの上面の整数を出力してください。
// シミュレーションの初期状態は、図のとおりのラベルの位置でサイコロが置かれているものとします。
// 【入力】
// １行目に各面の整数が、図に示すラベルの順番に空白区切りで与えられます。
// ２行目に命令を表す１つの文字列が与えられます。命令はそれぞれ図に示す４方向を表す文字 E、N、S、W を含む文字列です。
// 【出力】
// すべての命令を実行した後のサイコロの上面の数を１行に出力してください。
// 【制約】
// ・0 ≤ 入力されるサイコロの面の数字 ≤100
// ・0 ≤ 命令を表す文字列の長さ ≤100
// 【例】
// 入力１：
// 1 2 4 8 16 32
// SE
// 出力１：
// 8
// 各面に 1, 2, 4, 8, 16, 32 と書かれたサイコロを S の方向に転がした後、E の方向に転がすと、上面の整数が 8 になります。
// 入力２：
// 1 2 4 8 16 32
// EESWN
// 出力２：
// 32
#include<iostream>
#include<string>
using namespace std;

class Dice {
public:
  int Top, Bottom, North, South, East, West;

  Dice( int num[]) {
    Top = num[0];
    Bottom = num[5];
    North = num[4];
    South = num[1];
    East = num[2];
    West = num[3];
  }
    
  void move_n( void) {
    int buf_t, buf_b, buf_n, buf_s;

    buf_t = Top;
    buf_b = Bottom;
    buf_n = North;
    buf_s = South;

    Top = buf_s;
    Bottom = buf_n;
    North = buf_t;
    South = buf_b;
  }

  void move_s( void) {
    int buf_t, buf_b, buf_n, buf_s;

    buf_t = Top;
    buf_b = Bottom;
    buf_n = North;
    buf_s = South;

    Top = buf_n;
    Bottom = buf_s;
    North = buf_b;
    South = buf_t;
  }

  void move_e( void) {
    int buf_t, buf_b, buf_e, buf_w;

    buf_t = Top;
    buf_b = Bottom;
    buf_e = East;
    buf_w = West;

    Top = buf_w;
    Bottom = buf_e;
    East = buf_t;
    West = buf_b;
  }

  void move_w( void) {
    int buf_t, buf_b, buf_e, buf_w;

    buf_t = Top;
    buf_b = Bottom;
    buf_e = East;
    buf_w = West;

    Top = buf_e;
    Bottom = buf_w;
    East = buf_b;
    West = buf_t;
  }

  void print_top( void) {
    cout << Top << endl;
  }
};

int main( void) {
  int num[6];
  string order;

  cin >> num[0] >> num[1] >> num[2] >> num[3] >> num[4] >> num[5];
  cin >> order;

  Dice d1( num);

  for ( int i = 0; i < order.size(); i++) {
    if ( order[i] == 'N') d1.move_n();
    else if ( order[i] == 'S') d1.move_s();
    else if ( order[i] == 'E') d1.move_e();
    else if ( order[i] == 'W') d1.move_w();
  }

  d1.print_top();

  return 0;
}



Measured memory_bytes: 3228
import numpy as np

n=int(input())
A=np.array(list(map(int,input().split())))
mod=10**9+7

ans=0
for i in range(62):
    cnt=np.count_nonzero(A&1) #1とのANDで一番右の桁を抽出
    ans+=cnt*(n-cnt)*(2**i)%mod
    ans%=mod
    A=A>>1 #ビットシフト
print(ans)

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

typedef unsigned int U4;
#define TRUE 1
#define FALSE 0

#define ACUTE_TRIANGLE 0
#define RIGHT_TRIANGLE 1
#define OBTUSE_TRIANGLE 2

U4 TrinagleNum = 0;
U4 AcuteTriangleNum = 0;
U4 RightTriangleNum = 0;
U4 ObtuseTriangleNum = 0;

U4 U4_TriangleCheck(U4,U4,U4);
U4 U4_TypeCheck(U4,U4,U4);
void V_LengthSort(U4*,U4*,U4*);
int main(void){

U4 a;
U4 b;
U4 c;

  while(1){
    cin >> a >> b >> c;
    if(U4_TriangleCheck(a,b,c) == TRUE){
      TrinagleNum++;
      if(U4_TypeCheck(a,b,c) == ACUTE_TRIANGLE){
        AcuteTriangleNum++;
      }else if(U4_TypeCheck(a,b,c) == OBTUSE_TRIANGLE){
        ObtuseTriangleNum++;
      }else{
        RightTriangleNum++;
      }
    }else{
      break;
    }
  }

  cout << TrinagleNum << " " << RightTriangleNum << " " << AcuteTriangleNum << " " << ObtuseTriangleNum << endl;
}

U4 U4_TriangleCheck(U4 a,U4 b,U4 c){
  if((a + b > c) && (b + c > a) && (c + a > b)){
    return TRUE;
  }else{
    return FALSE;
  }
}

U4 U4_TypeCheck(U4 a,U4 b,U4 c){
  U4 LongLength;
  U4 MiddleLength;
  U4 ShortLength;
  U4 LongLengthSquare;
  U4 MiddleLengthSquare;
  U4 ShortLengthSquare;

  LongLength   = a;
  MiddleLength = b;
  ShortLength  = c;

  V_LengthSort(&LongLength,&MiddleLength,&ShortLength);

  LongLengthSquare   = LongLength * LongLength;
  MiddleLengthSquare = MiddleLength * MiddleLength;
  ShortLengthSquare  = ShortLength * ShortLength;

  if(MiddleLengthSquare + ShortLengthSquare > LongLengthSquare){
    return ACUTE_TRIANGLE;
  }else if(MiddleLengthSquare + ShortLengthSquare < LongLengthSquare){
    return OBTUSE_TRIANGLE;
  }else{
    return RIGHT_TRIANGLE;
  }
}

void V_LengthSort(U4* Long,U4 *Middle,U4 *Short){
  U4 buff;

  if((*Long >= *Middle) && (*Long >= *Short)){
    // Do Nothing
  }else if(*Middle >= *Short){
    buff = *Long;
    *Long = *Middle;
    *Middle = buff;
  }else{
    buff = *Long;
    *Long = *Short;
    *Short = buff;
  }
}



Measured memory_bytes: 3060
#include <iostream>
#include<vector>
#include<algorithm>
#include <queue>
#include <string>
#include <set>
#include <bitset>

using namespace std;
#define ff(i,n,m) for(int i=n;i<m;i++)
#define i64 int64_t
#define tos(x) to_string(x)


int main() {
	int x, y;
	cin >> x >> y;
	int ans = 0;
	if (x == 1) {
		ans += 300000;
	}
	if (x == 2) {
		ans += 200000;
	}
	if (x ==3) {
		ans += 100000;
	}
	if (y== 1) {
		ans += 300000;
	}
	if (y== 2) {
		ans += 200000;
	}
	if (y==3) {
		ans += 100000;
	}
	if (x ==1&&y==1) {
		ans += 400000;
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
	int array[10];
	for(int i = 0; i < 10; i++) {
		cin >> array[i];
	}
	sort(array, array + 10);
	cout << array[9] << endl;
	cout << array[8] << endl;
	cout << array[7] << endl;

	return 0;
}

Measured memory_bytes: 1176
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while(x->left!=NIL)x=x->left;
  return x;
}

Node treeMaximum(Node x){
  while(x->right!=NIL)x=x->right;
  return x;
}

Node treeSearch(Node u, int k){
  if (u == NIL || k == u->key)return u;
  if (k < u->key)return treeSearch(u->left, k);
  else return treeSearch(u->right, k);
}

Node treeSuccessor(Node x){
  Node y;
  if(x->right != NIL)return treeMinimum(x->right); // case 1
  y = x->parent;
  while(y != NIL && x == y->right){
    x=y;
    y = y->parent;
  }
  return y; // case 2
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
  if(z->left == NIL || z->right == NIL)y=z;
  else y=treeSuccessor(z);

  if(y->left!=NIL)x=y->left;
  else x=y->right;

  if(x!=NIL)x->parent=y->parent;

  if(y->parent==NIL)root=x;
  else if(y==y->parent->left)y->parent->left=x;
  else y->parent->right=x;

  if(y != z)z->key=y->key;
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL){
    y=x;
    if(z->key < x->key)x=x->left;
    else x=x->right;
  }
  z->parent=y;
  if(y==NIL)root=z;
  else if(z->key < y->key)y->left=z;
  else y->right = z;
}

void inorder(Node u){
  if(u==NIL)return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
void preorder(Node u){
  if(u==NIL)return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}



Measured memory_bytes: 25156
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#define _rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define SF scanf
#define PF printf
using namespace std;
int n,ans;
int work(){
	if(n<600)return 8;
	if(n<800)return 7;
	if(n<1000)return 6;
	if(n<1200)return 5;
	if(n<1400)return 4;
	if(n<1600)return 3;
	if(n<1800)return 2;
	return 1; 
}
int main(){
	SF("%d",&n);
	PF("%d",work());
	return 0;
}

Measured memory_bytes: 3808
#include<stdio.h>
#include<string.h>
int main(){
	int i,flag=1;
	char a[101];
	char *m=a;
	scanf("%s",a);
	for(i=0;i<strlen(a);i++){
		m=&a[i]; 
		if((i+1)%2==1){
			if(*m=='U'||*m=='R'||*m=='D'){
			}
			else{
				flag=0;
				break;
			} 
		}else if((i+1)%2==0){
			if(*m=='U'||*m=='L'||*m=='D'){
			}
				else{
				flag=0;
				break;
			} 
		}
	}
	if(flag){
		printf("Yes");
	}else{
		printf("No");
	}
	return 0;
}

Measured memory_bytes: 128
import java.util.*;
 
public class Main {
    public static void main(String args[] ) throws Exception {
        Scanner sc = new Scanner(System.in);
        //入力1行目の指定回数を取得
        int N = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();
        int total = N - A;
        if(total == 0){
            System.out.println(0);
        }else{
            int kosuu = total / B;
            int kai = total - kosuu * B;
            System.out.println(kai);
        }
         
        
    }
}

Measured memory_bytes: 22228
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a;
    for(int i = 0; i < 5; i++)
    {
        scanf("%d\n",&a);
        if(a==0)
        {
            printf("%d\n",i+1);
            break;
        }
    }
}


Measured memory_bytes: 3760
N = int(input())
A = list(map(int, input().split()))
n_minus = 0
has_zero = False
for i, a in enumerate(A):
    if a < 0:
        n_minus += 1
    if a == 0:
        has_zero = True
    A[i] = abs(a)

if has_zero:
    print(sum(A))
else:
    if n_minus % 2 == 0:
        print(sum(A))
    else:
        print(sum(A) - 2*min(A))


Measured memory_bytes: 14412
#include <bits/stdc++.h>
#define fast_io()                \
    ios::sync_with_stdio(false); \
    std::cin.tie(0);
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> two;

int main() {
    fast_io();
    ll n;
    cin >> n;
    ll need{}, tmp = n;
    while (tmp != 0) {
        ++need;
        tmp /= 2;
    }
    cout << ll(pow(2, need) - 1);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
 
using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int mod = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2> 
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
 
 
 
VI dice(const VI& cr, int z){
	auto nc = cr;
	if(z==0){  //right
		nc[0] = 7 - cr[1]; nc[1] = cr[0];
	}else if(z==1){ //down
		nc[0] = 7 - cr[2];  nc[2] = cr[0];
	}else if(z==2){ //left
		nc[0] = cr[1]; nc[1] = 7 - cr[0];
	}else if(z==3){  //up
		nc[0] = cr[2]; nc[2] = 7 - cr[0];
	}else {  //上下固定時計回り
		nc[1] = 7 - cr[2]; nc[2] = cr[1];
	}
	return nc;
}
 
 
int main(){
	VI ds1(6), ds2(6);
	rep(i,6) cin >>ds1[i];
	rep(i,6) cin >>ds2[i];
	 
	vector<int> cr = {1,3,2};
	set<VI> st, sd1, sd2;
	rep(g, 7){
		rep(i,4){
			cr = dice(cr, 7);
			st.insert(cr);
		}
		cr = dice(cr, g<3? 1: 2);
	}
	for(auto x: st){
		VI w1 = {ds1[x[0]-1], ds1[x[1]-1],ds1[x[2]-1]};
		sd1.insert(w1);
		VI w2 = {ds2[x[0]-1], ds2[x[1]-1],ds2[x[2]-1]};
		sd2.insert(w2);
		//dbg(x[0],x[1],x[2],w1[0],w1[1],w1[2],w2[0],w2[1],w2[2]);
	}
	cout <<(sd1==sd2? "Yes": "No") <<"\n";
	return 0;
}


Measured memory_bytes: 3176
#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int (i)=(a);(i)<(int)(b);(i)++)
#define RREP(i,a,b) for(int (i)=(a);(i)>=(int)(b);(i)--)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;



int main(){
    ll n, k;
    cin >> n >> k;
    vector<pair<int, int>> v;
    REP(i,0,n){
        int a, b;
        cin >> a >> b;
        v.push_back(make_pair(a, b));
    }
    sort(v.begin(), v.end());

    vector<int> a(n), b(n);
    REP(i,0,n){
        a[i] = v[i].first;
        b[i] = v[i].second;
    }

    REP(i,0,n){
        if (b[i] >= k){
            cout << a[i] << endl;
            return 0;
        }else{
            k -= b[i];
        }
    }
    
    return 0;
}

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

int main(){
    ll A,B,K; cin>>A>>B>>K;
    if(K>=A+B){
        cout<<0<<" "<<0<<endl;
    }else{
        if(A>=K){
            cout<<A-K<<" "<<B<<endl;
        }else{
            cout<<0<<" "<<B-(K-A)<<endl;
        }
    }
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>

using namespace std;

struct Data {
  int s;
  int e;
  int channel;
};
int main() {
  int C, N;
  cin >> N >> C;
  vector<Data> data(N);
  for (int i = 0; i < N; i++) {
    cin >> data[i].s >> data[i].e >> data[i].channel;
  }

  vector<vector<pair<int, int>>> clean_ranges(C + 1);
  for (int c = 1; c <= C; c++) {
    vector<pair<int, int>> ranges;
    for (int n = 0; n < N; n++) {
      if (data[n].channel == c) {
        ranges.emplace_back(data[n].s, data[n].e);
      }
    }
    int st = 0;
    int ed = 0;
    for (const auto& p : ranges) {
      if (st == 0) {
        st = p.first;
        ed = p.second;
        continue;
      }
      if (p.first == ed) {
        ed = p.second;
        continue;
      }
      clean_ranges[c].emplace_back(st - 1, ed);
      st = p.first;
      ed = p.second;
    }
    if (st != 0) {
      clean_ranges[c].emplace_back(st - 1, ed);
    }
  }
  vector<vector<bool>> rec(C + 1, vector<bool>(100001));
  for (int c = 1; c <= C; c++) {
    for (const auto& p : clean_ranges[c]) {
      for (int i = p.first; i < p.second; i++) {
        rec[c][i] = true;
      }
    }
  }

  int max_count = 0;
  for (int i = 0; i < 100001; i++) {
    int count = 0;
    for (int c = 1; c <= C; c++) {
      if (rec[c][i]) {
        count++;
      }
    }
    if (count > max_count) {
      max_count = count;
    }
  }
  cout << max_count << endl;
}


Measured memory_bytes: 3700
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <numeric>




typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define _GLIBCXX_DEBAC
/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;*/
//copy(v1.begin(), v1.end(), back_inserter(v2));
using namespace std;

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

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

int sort_greater(int m,int n) {
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(),greater<int>());
	for (int i = 0; i < n; i++) {
		cout << a[i];
	}
		return 0;
}

int bubblesort(int a[], int n) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				flag = 1;
				sw += 1;
			}
		}
	}
	return sw;
}

int a_z()
{
	for (int i = 0; i <= ('Z' - 'A'); i++) {
		cout << (char)('A' + i);
	}
	return 0;
}

int selecttionsort(int a[], int n) {
	int t,sw = 0, minj;
	for (int i = 0; i < n - 1; i++) {
		minj = i;
		for (int j = 0; j < n - 1; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		t = a[i]; a[i] = a[minj]; a[minj] = t;
		if (i != minj) sw += 1;

	}
	return sw;
}

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

const ll mod = 1000000007;
struct mint {
	ll x;
	mint(ll x = 0):x(x%mod){}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		res -= a;
	}
	mint operator*(const mint a)const {
		mint res(*this);
		return res *= a;
	}
};

map<string, int> memo;

using P=pair<int, int>;

struct Clock {
	int hour, minute, second;
	void set(int h, int m, int s) {
		hour = h; minute = m; second = s;
	}
	string to_str() {
		string h, m, s;
		h = to_string(hour);
		m= to_string(minute);
		s= to_string(second);
		if (h.size() < 2) h = "0" + h;
		if (m.size() < 2) m = "0" + m;
		if (s.size() < 2) s = "0" + s;
		return h + ":" + m + ":" + s;
	}
	void shift(int diff_second) {
		int h, m;
		h = diff_second / 3600;
		m = diff_second / 60;
		diff_second %= 60;
		second += diff_second;
		
	}
};


/*void dfs(int v, int p = -1) {
	for (int u : to[v]) {
		if (u == p) continue;
		ans[u] += ans[v];
		dfs(u, v);
	}
}*/
int main() {
	int n,ans=0;
	cin >> n;
	vector<int> v(n), c(n),x(n);
	rep(i, n) cin >> v[i];
	rep(i, n) cin >> c[i];
	rep(i, n) x[i] = v[i] - c[i];
	rep(i, n) {
		if (x[i] > 0) ans += x[i];
	}
	cout << ans;
	return 0;
}










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

int n,h,d[405],f[405],a[405],b[405];

int find(int x){return f[x]==x?x:f[x]=find(f[x]);}

void work()
{
	scanf("%d %d",&n,&h);
	for (int i=1; i<=2*h; i++)  f[i]=i;
	for (int i=1,A,B,C,D; i<=n; i++)
		{
			scanf("%d %d %d %d",&A,&B,&C,&D);
			A=C?C+h:A,B=D?D:B+h;
			d[A]++,d[B]--,f[find(A)]=find(B),b[find(A)]=1;
		}
	for (int i=1; i<=h; i++)  if (d[i]<0)  puts("NO"),exit(0);
	for (int i=1; i<=h; i++)  if (d[i+h]>0)  puts("NO"),exit(0);
	for (int i=1; i<=h; i++)  if (d[i]>0)  a[find(i)]=1;
	for (int i=1; i<=2*h; i++)  if ((find(i)==i)&&(!a[i])&&(b[i]))  puts("NO"),exit(0);
	puts("YES");
}

int main()
{
	work();
	return 0;
}


Measured memory_bytes: 384