akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
#define inf 1000000007
#define double long double
using namespace std;
typedef pair<double, double>P;
bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
ll lcm(ll x, ll y) {
	return x * y / gcd(x, y);
}
ll mod_pow(ll x, ll n, ll mod) {
	ll bit = 1;
	while (n) {
		if (n & 1)bit = bit * x % mod;
		x = x * x % mod;
		n /= 2;
	}
	return bit;
}
ll C(ll a, ll b) {
	ll x = 1, y = 1;
	rep(i, b) {
		x = x * (a - i) % inf;
		y = y * (b - i) % inf;
	}
	rep(i, inf) {
		if (x == y * i % inf) {
			return i;
		}
	}
}
signed main() {
	ll n;
	string s;
	cin >> n >> s;
	if (n >= 3200)cout << s << endl;
	else cout << "red" << endl;
	ggr
}


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

using namespace std;

map<string,int>mp;

int main(){

	int N;

	scanf("%d",&N);

	int i;

	char prev;

	int ans=0;

	for(i=0;i<N;i++){
		string W;
		cin>>W;
		if(mp[W]==1 || (W[0]!=prev && i>0)){
		ans=1;
		}
		mp[W]=1;
		prev=W[W.length()-1];
	}
	if(ans==0){
	printf("Yes\n");
	}
	else{
	printf("No\n");
	}

return 0;
}

Measured memory_bytes: 256
def push(k,v):
    if k in dic:
        dic[k] = min(dic[k],v)
    else:
        dic[k] = v
n,x,y = map(int,str(input()).split(' '))
dic = {}
for i in range(0,n):
    a = list(map(int,str(input()).split(' ')))
    k,v =a[0]*y-a[1]*x,a[2]
    l = []
    for j in dic:
        l.append([j,dic[j]])
    for jj in l:
        push(jj[0]+k,jj[1]+v)
    push(k,v)
if 0 in dic:
    print(dic[0])
else:
    print('-1')

Measured memory_bytes: 40432
using System;
using System.Collections.Generic;
using System.Linq;


namespace ALDS1_2_D_Shell_Sort
{
	class Program
	{
		public static int Count = 0;
		public static List<int> SpaceList;

		static void Main ( string[] args )
		{
			//input
			int numCount = int.Parse (Console.ReadLine ());

			string[] inputStr = new string[numCount];
			for (int lp = 0; lp < numCount; lp++)
			{
				inputStr[lp] = Console.ReadLine ();
			}

			int[] numArray = inputStr.Select (input => int.Parse (input)).ToArray ();
			
			//process
			ShellSort (numArray, numCount);

			//output
			Console.WriteLine (Program.SpaceList.Count);

			for (int lp = Program.SpaceList.Count - 1; lp >= 1; lp--)
			{
				Console.Write (Program.SpaceList[lp] + " ");
			}
			Console.WriteLine (Program.SpaceList[0]);

			Console.WriteLine (Program.Count);

			foreach (var item in numArray)
			{
				Console.WriteLine (item);				
			}
			
		}

		static void InsertionSort ( int[] numArray, int arrayLength, int space )
		{
			for (int index = space; index < arrayLength; index++)
			{
				int tmp = numArray[index];
				int index2 = index - space;

				while (index2 >= 0 && numArray[index2] > tmp) 
				{
					numArray[index2 + space] = numArray[index2];
					index2 -= space;
					Program.Count++;
				}
				numArray[index2 + space] = tmp;
			}
		}

		static void ShellSort ( int[] numArray, int arrayLength )
		{
			Program.Count = 0;

			Program.SpaceList = new List<int> (5);

			int space = 1;
			while (space <= arrayLength)
			{
				Program.SpaceList.Add (space);
				space = 3 * space + 1;
			}

			for (int index = Program.SpaceList.Count - 1; index >= 0; index--)
			{
				InsertionSort (numArray, arrayLength, Program.SpaceList[index]);
			}			
		}
	}
}

Measured memory_bytes: 93400
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int pal(string s){
	// cout<<s<<"\n";
	string t=s;
	reverse(t.begin(),t.end());
	return (s==t);
}
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string s;cin>>s;
	int n=s.size();
	if(pal(s) && pal(s.substr(0,(n-1)/2)) && pal(s.substr((n+3)/2-1,n-((n+3)/2-1)+1))){
		cout<<"Yes\n";
	}else{
		cout<<"No\n";
	}
	return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let s: String = read();
    let k: usize = read();
    let mut r: char = '1';
    let mut i = 0;

    for c in s.chars() {
        if i < k {
            if c != '1' {
                r = c;
                break;
            }
        } else {
            break;
        }

        i += 1;
    }

    println!("{}", r);
}


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

int main() {
    int a, b;
    cin >> a >> b;
    int ans = a - (b * 2);
    if (ans >= 0) cout << ans;
    else cout << 0;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
int main()
{
    int N, M, X, Y;
    std::cin >> N >> M >> X >> Y;

    std::vector<int> x(N);
    for (int i = 0; i < N; i++) {
        std::cin >> x[i];
    }

    std::vector<int> y(M);
    for (int i = 0; i < M; i++) {
        std::cin >> y[i];
    }

    std::sort(std::begin(x), std::end(x));
    std::sort(std::begin(y), std::end(y));

    for (int i = X+1; i <= Y; i++) {
        if (x[N-1] < i && i <= y[0]) {
            std::cout << "No War" << std::endl;
            return 0;
        }
    }

    std::cout << "War" << std::endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;
import java.util.TreeSet;

public class Main {

	public static void main(String[] args) {
		new Main().solve();
	}
	
	void solve(){
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		long n=s.length();
		long[]alph=new long[26];
		
		for(int i=0;i<n;i++) {
			alph[s.charAt(i)-'a']++;
		}
		
		long ans=n*(n-1)/2+1;
		for(int k=0;k<26;k++) {
			if(alph[k]>1) {
				ans-=alph[k]*(alph[k]-1)/2;
			}
		}
		System.out.println(ans);
	}
}

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

#define FOR(i, j, k) for(int i = j; i < k; i++)
#define REP(i, j) FOR(i, 0, j)
#define fst first
#define snd second
#define pb push_back
#define eb emplace_back
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;

template <class T> bool chmax(T &a, const T &b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T &a, const T &b) {
    if(b < a) {
        a = b;
        return 1;
    }
    return 0;
}

template <typename T> istream &operator>>(istream &is, vector<T> &vec) {
    for(T &x : vec)
        is >> x;
    return is;
}

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n, k;
    cin >> n >> k;

    int maxnum = (n - 1) * (n - 2) / 2;

    if (k > maxnum) {
        cout << -1 << endl;
        return 0;
    }

    vvi G(n);

    int m = 0;
    FOR(i, 1, n) {
        G[0].push_back(i);
        m++;
    }

    int x = 1, y = 1;
    for (int i = 0; i < maxnum - k; i++) {
        y++;
        if (y >= n) {
            x++;
            y = x + 1;
        }
        G[x].push_back(y);
        m++;
    }

    cout << m << endl;
    REP(i, n) for (auto e: G[i]) {
        cout << i + 1  << " " << e + 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 384
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, d = map(int, input().split())
    res = 0
    for _ in range(n):
        x, y = map(int, input().split())
        dist = pow(x, 2) + pow(y, 2)
        if dist <= pow(d, 2):
            res += 1
    print(res)


if __name__ == '__main__':
    resolve()


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

using namespace std;

int dp[100005];
vector <int> g[100005];

int solve(int v)
{
    if (dp[v]!=-1)
        return dp[v];

    int cur=0;
    for (int i:g[v])
        cur=max(cur,solve(i)+1);

    dp[v]=cur;
    return cur;
}
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);

    int n,m;
    cin >> n >> m;

    for (int i=0;i<m;i++)
    {
        int x,y;
        cin >> x >> y;
        x--,y--;
        g[x].push_back(y);
    }

    for (int i=0;i<n;i++)
        dp[i]=-1;

    int ans=0;
    for (int i=0;i<n;i++)
        ans=max(ans,solve(i));

    cout << ans;
}


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

#define MAX(x,y) (x>y?x:y)
#define MIN(x,y) (x<y?x:y)
#define ABS(x) (x>0?x:-(x))

#define INF 1000000000

int array_min_max(int* p, int n,bool f)  //f: true→min false→max
{
	int tmp;

	if (f)
		tmp = INF;
	else
		tmp = 0;

	for (int i = 0; i < n; i++)
	{
		if (f)
		{
			if (p[i] < tmp)
				tmp = p[i];
		}
		else
		{
			if (p[i] > tmp)
				tmp = p[i];
		}
	}
	return tmp;
}

void swap(long long int *a, long long int *b)
{
	long long int tmp;
	tmp = *a;
	*a = *b;
	*b = tmp;
}

//void bubble_sort(int *p, int n)
//{
//	for (int i = 0; i < n; i++)
//	{
//		for (int j = 0; j < n - i - 1; j++)
//		{
//			if (p[j] > p[j + 1])
//				swap(&p[j], &p[j + 1]);
//		}
//	}
//}

int main()
{
	int N;
	int a[200000];

	scanf("%d", &N);

	for (int i = 0; i < N; i++)
		scanf("%d", &a[i]);

	int count = 0;

	for (int i = 1; i < N; i++)
	{
		for (int j = count+i-1; j < N; j++)
		{
			if (a[j] != i)
				count++;
			else
				break;
		}
	}

	if (N == count)
		printf("-1\n");
	else
		printf("%d", count);

}

Measured memory_bytes: 896
#include<stdio.h>
int main(void)
{
	char n[12];
	int a,b,flg,cnt,i;
	scanf("%d %d",&a,&b);
	scanf("%s",n);
	flg=0; cnt=0;
	for(i=0;i<a+b+1;i++){
		if(n[a]=='-') flg=1;
		if(n[i]=='-') cnt++;
		if(cnt>=2) break;
	}
	if(cnt==1&&flg==1) printf("Yes\n");
	else printf("No\n");
	return 0;
}	

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

int main() {
	
	int k;
	cin>>k;
	int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	
	cout<<a[k-1];
	// your code goes here
	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 a = sc.nextInt();
    int b = sc.nextInt();

    if (((a % 2) == 1) && ((b % 2) == 1)) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }

  }
}

Measured memory_bytes: 35644
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
using ll = long long;
using namespace std;
const int INF32       = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7        = 1'000'000'007;
const int MOD9        = 1'000'000'009;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}

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

    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;

    int dx = tx - sx;
    int dy = ty - sy;

    string ans = string(dy, 'U') + string(dx, 'R');
    ans += string(dy, 'D') + string(dx, 'L');
    ans += 'L' + string(dy + 1, 'U') + string(dx + 1, 'R') + 'D';
    ans += 'R' + string(dy + 1, 'D') + string(dx + 1, 'L') + 'U';
    print(ans);

    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;



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

    int n, x;
    cin >> n >> x;

    vector<int> A(n);
    for (int i = 0; i < n; ++i) {
        cin >> A[i];
    }
    sort(A.begin(), A.end());

    auto gcd = [&](long long a, long long b) {
        while (a != 0) {
            b %= a;
            swap(a, b);
        }
        return b;
    };

    long long g = 0;
    for (int i = 1; i < n; ++i) {
        g = gcd(g, A[i] - A[i - 1]);
    }

    long long res = 1;
    for (int i = 0; i < n; ++i) {
        long long d = abs(A[i] - x);
        long long ans = gcd(g, d);
        res = max(res, ans);
    }

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

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <utility>
#include <functional>
#include <queue>
#include <cmath>
#include <numeric>
#include <map>
#define REP(i, N) for(int i=0; i<N; i++)
using namespace std;

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

int main() {
	int N;

	cin >> N;
  
  vector<int> A(N);
  int mx = 0, sn = 0;
  priority_queue<int> que;
  for (auto& i : A) {
    cin >> i;
    que.push(i);
  }
  mx = que.top(); que.pop();
  sn = que.top();

  for (auto& i : A)
	cout << ((i == mx) ? sn : mx) << endl;

	return 0;
}


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

using namespace std;

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int flag=0;
    while(1){
        if(flag==0){
            c-=b;
            flag=1;
        }
        else{
            a-=d;
            flag=0;
        }
        if(c<=0){
            cout << "Yes" << endl;
            return 0;
        }
        else if(a<=0){
            cout << "No" << endl;
            return 0;
        }
    }
	return 0;
}


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

int a, b, c, k;

int main() {
	scanf("%d%d%d%d", &a, &b, &c, &k);
	while (k > 0 && b <= a) {
		b *= 2;
		k--;
	}
	while (k > 0 && c <= b) {
		c *= 2;
		k--;
	}
	if (c > b && b > a) printf("Yes\n");
	else printf("No\n");
	return 0;
}


Measured memory_bytes: 3760
#include<bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef tuple<int,int,int,int>T;
typedef vector<T>VT;
int main(void){
	string s;
	int box[100000]={0};
	VT v;
	int i;
	int flg;
	int r,l;
	int x,y,z;
	int rsum,lsum;
	int MAX;
	cin>>s;
	flg=0;
	r=0;
	l=0;
	for(i=0;i<(int)s.size();i++){
		if(s[i]=='R'){
			if(flg==1){
				flg=0;
				v.push_back(T(r,l,x,y));
				r=0;
				l=0;
			}
			r++;
		}
		else{
			if(s[i-1]=='R'){
				x=i-1;
				y=i;
			}
			l++;
			flg=1;
		}
	}
	v.push_back(T(r,l,x,y));
	//for(i=0;i<(int)v.size();i++)	cout<<get<0>(v[i])<<" "<<get<1>(v[i])<<" "<<get<2>(v[i])<<" "<<get<3>(v[i])<<endl;
	for(i=0;i<(int)v.size();i++){
		x=get<2>(v[i]);
		y=get<3>(v[i]);
		MAX=max(MAX,max(x,y));
	}
	for(i=0;i<(int)v.size();i++){
		x=get<0>(v[i]);
		y=get<1>(v[i]);
		r=get<2>(v[i]);
		l=get<3>(v[i]);
		rsum=x/2+y/2;
		lsum=x/2+y/2;
		if(x%2!=0)	rsum++;
		if(y%2!=0)	lsum++;
		box[r]=rsum;
		box[l]=lsum;
	}
	for(i=0;i<(int)s.size();i++){
		if(i)	cout<<" ";
		cout<<box[i];
	}
	cout<<endl;
	return 0;
}
		

Measured memory_bytes: 1912
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx")
//#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define fi first
#define se second
#define pb push_back
#define sz(x)  ((int)x.size ())
#define all(x) (x).begin(), (x).end()
#define re return
#define mp make_pair
#define sqrt(x) sqrt (abs(x))
#define y0 y3451
#define y1 y4562
#define j0 j25624
#define j1 j45624
#define makeunique(x) sort(all(x)), (x).resize (unique(all(x)) - (x).begin())

typedef pair <int, int> ii;
typedef long long ll;
typedef unsigned long long ull;
typedef double D;
typedef long double ld;
typedef unsigned int uint;
typedef vector <string> vs;
typedef vector <int> vi;
typedef vector <ii> vii;
typedef vector <vi> vvi;

template <class T> using _tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <class T> T abs (T x) { re x > 0 ? x : -x; }
template <class T> T sqr (T x) { re x * x; }
template <class T> T gcd (T a, T b) { re a ? gcd (b % a, a) : b; }
template <class T> int sgn (T x) { re x > 0 ? 1 : (x < 0 ? -1 : 0); }

#define filename ""

const D pi = acos(-1.);
const int N = 2e5 + 20;
const int inf = 1e9 + 7;

int n, m;
int a[N];
int dp[N];

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) scanf("%d", a + i);
	dp[0] = 0;
	dp[1] = abs(a[1] - a[0]);
	for (int i = 2; i < n; i++)
		dp[i] = min(dp[i - 1] + abs(a[i] - a[i - 1]), dp[i - 2] + abs(a[i] - a[i - 2]));
	cout << dp[n - 1];
	return 0;
}


Measured memory_bytes: 1024
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001;
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    ll N; cin >> N;
    int ans = 0;
    FOR(i, 2, 1000010) {
        int cur = 0;
        while (N % i == 0) {
            cur++;
            N /= i;
        }
        FOR(j, 1, 10000) {
            if (cur < j) break;
            ans++; cur -= j;
        }
    }
    if (N > 1) ans++;
    cout << ans << nl;
	
	return 0;
}
 


Measured memory_bytes: 3664
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <queue>
#include <vector>
#include <functional>
#include <map>
#include <set>
#include <cmath>
#include <string>
#define SIZE 200005
#define INF 1000000005LL

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

int n;
ll K;

int main()
{
	ll a,b,c,d,n,x;
	scanf("%lld %lld",&d,&n);
	c = n / 99;
	if(n%99!=0)x = c*100 + (n%99);
	else x = c*100 - 1;

	if(d==1)x *= 100;
	else if(d==2)x *= 10000;
	printf("%lld\n",x);
	return 0;
}


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

int main() {
  int a,b;
  cin>>a>>b;
  if(a<=5){
    cout<<0<<endl;
  }
  else if(a<13){
    cout<<b/2<<endl;
  }
  else{
    cout<<b<<endl;
  }
  
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            solve(sc);
        }
    }

    public static void solve(Scanner sc) {
        char[] o = sc.nextLine().toCharArray();
        char[] e = sc.nextLine().toCharArray();
        for (int i = 0; i < e.length; i++) {
            System.out.print(o[i]);
            System.out.print(e[i]);
        }
        if (e.length != o.length) {
            System.out.print(o[o.length - 1]);
        }
        System.out.println();
    }
}

Measured memory_bytes: 23252
#include <iostream>
#include <map>
#include <stdio.h>
#include <algorithm>
#include <queue>
#include <vector>
#include <stack>
#include <cmath>
#include <memory.h>
#include <iomanip>
#include <cassert>
using namespace std;

#define maxn
#define FOR(i, l, r) for (int i=l; i<=r; ++i)
#define FORD(i, r, l) for (int i=r; i>=l; --i)
#define REP(i, r) for (int i=0; i<(int)r; ++i)
#define REPD(i, r) for (int i=(int)r-1; i>=0; --i)
#define fi first
#define se second
#define mk make_pair
#define nil NULL
#define y0 y902
#define y1 y232
#define x0 x92
#define x1 x899
#define next asdfa
#define sz size
#define Debug(X) {cerr << #X << " = " << X << '\n';}
#define PR(A, n) {cerr << #A << " = "; FOR(i, 1, n) cerr << A[i] << ' '; cerr << '\n';}
#define PR0(A, n) {cerr << #A << " = "; REP(i, n) cerr << A[i] << ' '; cerr << '\n';}
typedef long long ll;
typedef double db;
typedef pair<db, db> dd;
typedef pair<int, int> ii;
typedef vector<int> vi;
const int inf = 1e9;
template<class T> int getbit(T x, int pos) {return (x>>(pos-1)) & 1;}
template<class T> void turn_on(T &x, int pos) {x = x | ((T)1<<(pos-1));}
template<class T> void turn_off(T &x, int pos) {x = x & ~((T)1<<(pos-1));}
template<class T> T sqr(T a) {return a*a;}

int n;
map<int, int> hist;

int main() {
    //freopen("maxarea.inp", "r", stdin);
    //freopen("", "w", stdout);
    ios::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    FOR(i, 1, n) {
        int x; cin >> x;
        hist[x]++;
    }
    int MAX1 = -inf, MAX2 = -inf;
    for (map<int, int>::iterator it=hist.begin(); it!=hist.end(); ++it) {
        if (it->se>1 && it->fi>=MAX1) {
            MAX2 = MAX1;
            MAX1 = it->fi;
        }
        else if (it->se>1 && it->fi>MAX2) MAX2 = it->fi;
        if (it->se>3) {
            MAX1 = max(MAX1, it->fi);
            MAX2 = max(MAX2, it->fi);
        }
    }
    if (MAX2==-inf) cout << 0;
    else cout << 1LL*MAX1*MAX2;
}



Measured memory_bytes: 4992
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    h, w, k = rli()
    grid = []
    ans = [[-1 for _ in range(w)] for _ in range(h)]
    empty = [True for _ in range(h)]
    for i in range(h):
        ls = input()
        grid.append(ls)
        empty[i] = not('#' in ls)
    b = 1
    ft = {}
    le = []
    ne = -1
    for i in range(h):
        first = True
        if empty[i]:
            le.append(i)
            continue
        if len(le) > 0:
            ft[i] = le
            le = []
        ne = i
        for j in range(w):
            c = grid[i][j]
            if c == '#':
                if not first:
                    b += 1
                first = False
            ans[i][j] = b
        b += 1
    if len(le) > 0:
        ft.setdefault(ne, [])
        ft[ne].extend(le)
    for f, le in ft.items():
        for e in le:
            ans[e] = ans[f]
    # print(empty)
    # print(ft)
    for l in ans:
        print(" ".join(map(str, l)))



if __name__ == '__main__':
    main()


Measured memory_bytes: 7284
a = [int(input()) for i in range(5)]

a.sort(key = lambda x:(x-1)%10)
ans = a[0]

for i in range(1,len(a)):
    if a[i]%10 == 0:
        ans += a[i]
    else:
        ans += (a[i]//10+1)*10

print(ans)


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

int cnt = 0;

int solve(int A, int B, int C, int X) {
    //std::cout << "called: " << ++cnt << std::endl;
    if (A < 0 || B < 0 || C < 0 || X < 0) {
        return 0;
    } else if (X == 0) {
        return 1;
    } else {
        return solve(A-1, B, C, X-500) + solve(0, B-1, C, X-100) + solve(0, 0, C-1, X-50);
    }
}

int main() {
    int A, B, C, X;
    std::cin >> A >> B >> C >> X;
    
    std::cout << solve(A, B, C, X) << std::endl;
}

Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
 
int main() {
    int N; cin >> N;
    map<string, int> mp;
    for(int i=0; i<N; i++) {
        string s; cin >> s;
        mp[s]++;
    }

    printf("AC x %d\n", mp["AC"]);
    printf("WA x %d\n", mp["WA"]);
    printf("TLE x %d\n", mp["TLE"]);
    printf("RE x %d\n", mp["RE"]);
    return 0;
}


Measured memory_bytes: 3732
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<unordered_map>
#include<functional>
#include<set>
#include<numeric>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define SUM(a) accumulate(all(a),0LL)
#define pb push_back
#define endl '\n'
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 2222222222222222222LL;
const ll mod = 1000000007LL;

ll n = 0, m = 0, ans = 0, cnt = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok = true, flag = false;
ll dx[5] = { 1,-1,0,0,0 }, dy[5] = { 0,0,1,-1,0 };
ll ddx[9] = { 1,-1,0,0,1,1,-1,-1,0 }, ddy[9] = { 0,0,1,-1,1,-1,1,-1,0 };
#pragma endregion
#define MAX 222222




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


	cin >> n;
	vll a;

	a.pb(0);
	rep(i, n) {
		cin >> tmp;
		a.pb(tmp);
	}
	sort(all(a));

	if (n % 2) {
		FOR(i, 1, n / 2 + 1) ans -= 2 * a[i];
		FOR(i, n / 2 + 1, n + 1) ans += 2 * a[i];
		ans -= a[n / 2 + 1];
		ans -= a[n / 2 + 2];

		FOR(i, 1, n / 2 + 2) m -= 2 * a[i];
		m += a[n / 2];
		m += a[n / 2 + 1];
		FOR(i, n / 2 + 2, n + 1) m += 2 * a[i];
		ans = max(ans, m);
	}
	else {
		FOR(i, 1, n / 2 + 1) ans -= 2 * a[i];
		FOR(i, n / 2 + 1, n + 1) ans += 2 * a[i];
		ans += a[n / 2];
		ans -= a[n / 2 + 1];
	}

	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define c(n) cin>>n
#define co(n) cout<<n<<endl
using namespace std;

int main(){
  long a,b,c=0,d=1,e,f,g,h,n,m,mx=0,x,y;
  char s;
  rep(i,0,3){
    cin>>s;
    if(s=='1') c++;
  }
  co(c);
    
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int m,f,r;
    while(1){
        scanf("%d %d %d",&m,&f,&r);
        if(m==-1&&f==-1&&r==-1)break;
        if(m==-1||f==-1){
            printf("F\n");
        }else if(m+f>=80){
            printf("A\n");
        }else if(m+f>=65){
            printf("B\n");
        }else if(m+f>=50){
            printf("C\n");
        }else if(m+f>=30&&r<50){
            printf("D\n");
        }else if(m+f>=30&&r>=50){
            printf("C\n");
        }else if(m+f<30){
            printf("F\n");
        }
    }
    return 0;
}


Measured memory_bytes: 2128
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define int64 long long
#define uint64 unsigned long long
using namespace std;

int main()
{
	int64 nn, aa, bb;
	cin >> nn >> aa >> bb;
	cout << (aa * (nn / (aa + bb))) + min(aa, (nn % (aa + bb))) << endl;
	return 0;
}


Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int n = sc.NextInt();
        int x = sc.NextInt();
        int[] a = sc.IntArray();

        long answer = 0;

        int before = a[0];
        for (int i = 1; i < n; i++)
        {
            int sum = before + a[i];
            if (sum > x)
            {
                answer += sum - x;
                a[i] = Math.Max(0, a[i] - (sum - x));
            }
            before = a[i];
        }

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 39664
#include<cstdio>
#define van 100010
inline int abs(int a){return a<0? -a:a;}
int ans[van],d[van],a,n;
main(){
    scanf("%d",&n);
    d[0]=d[n+1]=0;
    for(int i=1;i<=n;i++) scanf("%d",&d[i]),a+=abs(d[i-1]-d[i]);
    ans[1]=a=a+abs(d[n])-abs(d[1])+abs(d[2])-abs(d[1]-d[2]);
    int cache=0;
    for(int i=2;i<=n;i++)
		ans[i]=a=a+abs(d[i-2]-d[i-1])+abs(d[i+1]-d[i-1])-abs(d[i-2]-d[i])-abs(d[i+1]-d[i]);
    for(int i=1;i<=n;i++) printf("%d\n",ans[i]);
}

Measured memory_bytes: 1920
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define REP(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
const ll MOD = 1000000007;
using namespace std;

vector<ll> lucas(88, -1);

ll luca(int n){
    if(lucas[n] == -1) lucas[n] = luca(n-2) + luca(n-1);
    return lucas[n];
}

int main(){
    lucas[0] = 2; lucas[1] = 1;
    int n; cin >> n;
    cout << luca(n) << endl;
    return 0;
}

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

int main(){
  vector<pair<int,int>> cnt(101);

  for(int i=1; i<=100; i++) cnt[i] = make_pair(0, i);

  int x;
  while(cin >> x) cnt[x].first++;

  sort(cnt.begin()+1, cnt.end());

  int maximum = cnt[100].first;
  for(int i=1; i<=100; i++){
    if(cnt[i].first == maximum){
      cout << cnt[i].second << endl;
    }
  }
}
  
  


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

int main(){
    ll n;
    cin >> n;
    vector <ll> ko(n+1,0),aa(n),bb(n);
    vector <vector <ll>> koa(n+1,vector<ll>(2,0));
    vector <vector <ll>> kob(n+1,vector<ll>(2,0));
    vector <vector <ll>> koc(n+1,vector<ll>(2,0));
    
    rep(i,n+1){
        koa[i][1]=i;
        kob[i][1]=i;
        koc[i][1]=i;
        
        
    }

    ll a,b;
    rep(i,n){
        cin >> aa[i];
        ++ko[aa[i]];
        ++koa[aa[i]][0];
        ++koc[aa[i]][0];
        
    }
    rep(i,n){
        cin >> bb[i];
        ++ko[bb[i]];
        ++kob[bb[i]][0];
        ++koc[bb[i]][0];
        
    }

    int k=0;

    rep(i,n+1){
        if(ko[i]>n){
            cout << "No" << endl;
            break;

        }
        else if(i==n){
            cout << "Yes" << endl;
            k=1;
        }
    }

    if(k==1){
        ll k2=0;
        vector <vector <ll>> z(n*2,vector <ll> (2,0));
        sort(koc.rbegin(),koc.rend());
        rep(i,n+1){
            rep(j,koa[koc[i][1]][0]){
                z[k2][0]=koc[i][1];
                z[k2][1]=0;
                
                ++k2;
            }
            rep(j,kob[koc[i][1]][0]){
                z[k2][0]=koc[i][1];
                z[k2][1]=1;
                ++k2;
            }
        }

        vector <vector <ll>> ma(n,vector<ll>(2,-1));
        vector <ll> ama,amb;
        ll l;
        rep(i,2*n){
            if(i<n){
                if(z[i][1]==0){
                    ma[i][0]=z[i][0];
                }
                else{
                    ma[i][1]=z[i][0];
                }
            }
            else{
                if(z[i][1]==0){
                    ama.push_back(z[i][0]);

                }
                else{
                    amb.push_back(z[i][0]);
                }
            }
        }

        ll kaa=0,kbb=0;
        rep(i,n){
            if(ma[i][0]==-1){
                ma[i][0]=ama[kaa];
                ++kaa;
            }
            else{
                ma[i][1]=amb[kbb];
                ++kbb;
            }
        }

        sort(ma.begin(),ma.end());
        rep(i,n){
            cout << ma[i][1] << endl;
        }

        /*rep(i,2*n){
            cout << z[i][0] << " " << z[i][1] << endl;
        }*/

    }
    
    

    return 0;
}

Measured memory_bytes: 76184
fn main() {
    let (A, B) = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let mut iter = s.split_whitespace().map(|i| i.parse::<i32>().unwrap());
        (iter.next().unwrap(), iter.next().unwrap())
    };

    println!("{}", A * B);
}

Measured memory_bytes: 2144
/*
    Created by 10_months
    Tag:
    Link:
*/

#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
                
using namespace std;

const long long inf = 1e17;
const int INF = 1e9;
const int N = 1234567;
const int M = 123456;

vector <int> e[N];
int n, m, ans, visit[N];

inline void dfs(int u, int k) {
    int sz = e[u].size();
    if (k == n) {
        ans++;
    }
    for (int i = 0; i < sz; i++) {
        int to = e[u][i];
        if (!visit[to]) {
            visit[to] = 1;
            dfs(to, k + 1);
            visit[to] = 0;
        }
    }
}
                         
int main() {
    #ifdef home
        freopen("in", "r", stdin);
        freopen("out", "w", stdout);
    #endif
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        e[u].push_back(v);
        e[v].push_back(u);
    }
    visit[1] = 1; dfs(1, 1);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 29952
using System.Collections.Generic;
using System.Linq;
using static System.Console;

namespace AtCorder
{
	public class Program
	{
		public static void Main()
		{
			var n = int.Parse(ReadLine());
			var result = "Yes";
			string lastWord = null;
			var dic = new HashSet<string>();
			for (int i = 0; i < n; i++)
			{
				var word = ReadLine();
				var add = dic.Add(word);
				if(!add)
				{
					result = "No";
					continue;
				}
				if (lastWord != null && lastWord != word.First().ToString())
				{
					result = "No";
					continue;
				}
				lastWord = word.Last().ToString();
			}
			WriteLine(result);
		}
	}
}


Measured memory_bytes: 13280
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim();}
function myout(t){console.log(t);}//standard output
//[no]param
//0:何もしない  1:数値へ変換  2:半角SPで分割  3:改行で分割  4:半角SPで分割し、数値配列へ
//5:改行で分割し、数値配列へ  6:1文字に分割  7:1文字に分割し、数値配列へ
function myconv(i,no){switch(no){case 0:return i;case 1:return parseInt(i);case 2:return i.split(" ");case 3:return i.split("\n");case 4:return i.split(" ").map((a)=>Number(a));case 5:return i.split("\n").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));}}

function Main(input) {
  input = myconv(input,1);
  myout(input*input);
}

Main(myin());


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

int main(){
  int N,count = 0;
  cin>>N;
    
  long long p[1000];
  for (size_t i = 0; i < N; i++)
  {
    int a[3];
    for (size_t j = 0; j < 3; j++)
    {
        cin >> a[j] ;
    } 
    sort(a,a+3);
    p[i] = a[0]*10000*10000+a[1]*10000+a[2];
    
  }
  
  sort(p,p+N);
  

  for (size_t i = 0; i < N-1; i++)
  {
     count+=(p[i]==p[i+1]);
  }
    cout << count << endl;
}


Measured memory_bytes: 3172
import java.util.Scanner;


public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

       int[] array;
       array=new int[n];

       for(int i=0;i<n;i++){
    	   array[i]=sc.nextInt();
       }
       for(int i=n-1;i>=0;i--){
    	   if(i==0){System.out.println(array[i]);
       }else{
    	   System.out.print(array[i]+" ");
       }

        //System.out.println();
    }
}
}



Measured memory_bytes: 26088
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define PI 3.14159265358979323846
inline void rd(double &x){
  scanf("%lf",&x);
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(double x){
  printf("%.15f",x);
}
double A;
double B;
double X;
int main(){
  double res;
  rd(A);
  rd(B);
  rd(X);
  X /= A;
  if(X >= A*B/2){
    res = atan2(A*B-X,A*A/2);
  }
  else{
    res = PI/2 - atan2(X,B*B/2);
  }
  res *= 180 / PI;
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20191027-1

// --- original code ---
// double A, B, X;
// {
//   double res;
//   rd(A,B,X);
//   X /= A;
// 
//   if(X >= A*B/2){
//     res = atan2(A*B-X,A*A/2);
//   } else {
//     res = PI/2 - atan2(X,B*B/2);
//   }
// 
//   res *= 180 / PI;
//   wt(res);
// }


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstring>
#include<map>
#include<queue>
#include<vector>
#include<set>
#include<sstream>
using namespace std;
typedef long long ll;
const ll maxn=1e4+10;
const ll inf=0x3f3f3f3f3f3f3f3f;
const ll mod=998244353;
void io(){ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
ll a[maxn],dp[maxn];
int main()
{
	io();
	ll n,k;
	cin>>n>>k;
	for(int i=1;i<=n;i++) cin>>a[i]; 
	ll ans=0; 
	for(int i=1;i<=n;i++)
	{
		dp[0]+=1;//[2,i]、[3，i]、[4，i]、...、[i，i]
		for(int j=k;j>=a[i];j--)
			dp[j]=(dp[j]+dp[j-a[i]])%mod;
		ans=(ans+dp[k])%mod;//前i个数的和为K的数量
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
//問題URL
//

//解き方メモ
//
    
#include<iostream>
#include<vector>
#include<climits>
using namespace std;

#define MAX_SHOP_NUM 100
#define TZ_NUM 10

int main(){
  int n;
  vector<int> f;
  vector< vector<int> > p;
  long long max_sum = LLONG_MIN;

  //input
  cin >> n;

  f.resize(n);
  p.resize(n);

  //Fは２進数表記とする
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < TZ_NUM; j++) {
      int tmp;
      cin >> tmp;

      f[i] <<= 1; //左シフト
      if(tmp == 1){
	f[i] += 0x1;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    p[i].resize(TZ_NUM+1);
    for (int j = 0; j < TZ_NUM+1; j++) {
      cin >> p[i][j];
    }
  }

  //proc
  int tz = 1;
  while (tz < 0x400) { //11111111までループ

    long long tmp_sum = 0;
    for (int i = 0; i < (int)f.size(); i++) {
      //cout << i << ")";
      int tz_diff = f[i] & tz; //tz_diff:時間帯が重なるビットが1
      int cnt = 0;
      while(tz_diff>0){
	cnt += tz_diff & 0x1;
	tz_diff >>= 1;
	//cout << cnt << ",";
      }
      tmp_sum += p[i][cnt];
    }
    //cout << tz << "," << ","<< tmp_sum << endl;
    max_sum = max(max_sum,tmp_sum);
    tz += 0x1;
  }
  //cout << p[1][0] << endl;;

  cout << max_sum << endl;
  
  return 0;
}


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

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

int main(void){
   int n,ans=0;
   long int a[100001];
   long int *l = calloc(100001,sizeof(long int)),*r = calloc(100001,sizeof(long int));
   
   scanf("%d",&n);
   for(int i=1;i<=n;i++){
       scanf("%ld",&a[i]);
   }
   
   for(int i=0;i<n;i++){
       l[i+1]=gcd(l[i],a[i+1]);
   }
   for(int i=n;i>0;i--){
       r[i]=gcd(r[i+1],a[i]);
   }
   
   for(int i=1;i<=n;i++){
       if(ans<gcd(l[i-1],r[i+1])){
           ans=gcd(l[i-1],r[i+1]);
       }
   }
   printf("%d",ans);
   
}


Measured memory_bytes: 4056
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
const int N =200000+5;
int a[N];
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i];
    int maxv=-2e9;
    int minv=a[0];
    for(int i=1;i<n;i++)
    {
        maxv=max(maxv,a[i]-minv);
        minv=min(minv,a[i]);
    }
    cout<<maxv<<endl;
    return 0;
}

Measured memory_bytes: 3856
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cassert>
typedef long long lint;
const int N=131080;
int n;
class pair{
	public:
		lint x,y;
		friend bool operator < (const pair &a,const pair &b);
};

bool operator < (const pair &a,const pair &b){
	return a.x==b.x?a.y<b.y:a.x<b.x;
}

inline int nxi(){
	int x=0;
	char c;
	while((c=getchar())>'9'||c<'0');
	while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
	return x;
}

inline int x_bound(std::vector <pair> &vt,const lint _lim){
	int l=0,r=vt.size()-1,mid;
	while(l!=r){
		mid=(l+r+1)>>1;
		if(vt[mid].x>_lim) r=mid-1;
		else l=mid;
	}
	return l;
}

inline int y_bound(std::vector <pair> &vt,const lint _lim){
	int l=0,r=vt.size()-1,mid;
	while(l!=r){
		mid=(l+r)>>1;
		if(vt[mid].y>_lim) l=mid+1;
		else r=mid;
	}
	return l;
}

inline void sanitize_seq(std::vector <pair> &vt){
	const int sz=vt.size();
	int p1=1,p2=1;
	for(; p1<sz; ++p1){
		if(vt[p1].x!=vt[p1-1].x) vt[p2++]=vt[p1];
	}
	while((int)vt.size()>p2) vt.pop_back();
}

namespace G{
	int cnt,nxt[N][2],wt[N][2];
	lint lim_w;
	std::vector <pair> vt[N];

	inline void add(const int a,const int b,const int v){
		bool f=nxt[a][0]>0;
		nxt[a][f]=b,wt[a][f]=v;
	}

	void dfs(const int x){
		if(!nxt[x][0]){
			vt[x].push_back((pair){0,0});
			return;
		}
		dfs(nxt[x][0]);
		dfs(nxt[x][1]);
		if(vt[nxt[x][0]].size()>vt[nxt[x][1]].size()){
			std::swap(nxt[x][0],nxt[x][1]);
			std::swap(wt[x][0],wt[x][1]);
		}

		const int c0=nxt[x][0],c1=nxt[x][1];
		const lint v0=wt[x][0],v1=wt[x][1];
		const int lim_l=vt[c0].size();
		const int lim_r=vt[c1].size();

		for(int i=0,j,lst_j=-1; i<lim_l; ++i){
			const lint _lim=lim_w-vt[c0][i].y-v0-v1;
			j=x_bound(vt[c1],_lim);
			assert(j<lim_r);
			if(vt[c1][j].x>_lim) continue;
			if(j!=lst_j){
				lst_j=j;
				vt[x].push_back((pair){vt[c0][i].x+v0,vt[c1][j].y+v1});
			}
			//vt[x].push_back((pair){vt[c0][i].x+v0,vt[c1][j].y+v1});
		}
		for(int i=lim_l-1,j,lst_j=-1; i>=0; --i){
			const lint _lim=lim_w-vt[c0][i].x-v0-v1;
			j=y_bound(vt[c1],_lim);
			assert(j<lim_r);
			if(vt[c1][j].y>_lim) continue;
			if(j!=lst_j){
				lst_j=j;
				vt[x].push_back((pair){vt[c1][j].x+v1,vt[c0][i].y+v0});
			}
			//vt[x].push_back((pair){vt[c1][j].x+v1,vt[c0][i].y+v0});
		}
		std::sort(vt[x].begin(),vt[x].end());
		sanitize_seq(vt[x]);
	}

	bool jdg(const lint tgt){
		lim_w=tgt;
		for(int i=1; i<=n; ++i){
			vt[i].clear();
		}
		dfs(1);
		return !vt[1].empty();
	}
}

inline lint solve(){
	lint l=0,r=2e10,mid;
	while(l!=r){
		mid=(l+r)>>1;
		if(G::jdg(mid)) r=mid;
		else l=mid+1;
	}
	return l;
}

int main(){
	n=nxi();
	for(int i=2; i<=n; ++i){
		int fr=nxi();
		G::add(fr,i,nxi());
	}
	printf("%lld\n",solve());
	//printf("%d\n",G::jdg(25));
	return 0;
}

Measured memory_bytes: 27892
#include <stdio.h>
#include <iostream>
#include <algorithm>

using namespace std;

#define REP(a, i, n) for (int i = a; i < n; ++i)

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

    int p[N];
    REP(0, i, N) {
        cin >> p[i];
    }

    sort(p, p + N);

    int ans = p[N - 1] / 2;
    REP(0, i, N - 1) {
        ans += p[i];
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<map>
#include<set>
#include<algorithm>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<cstdio>
#include<cassert>
#include<sstream>
#include<set>

#define int long long int

using namespace std;

signed main(){
    int a, b, k; cin >> k >> a >> b;
    int cnt = (a + k - 1) / k;
    bool ok = 0;
    for(int i = cnt; i < 1000; i++){
        int x = i * k;
        if(x >= a && x <= b)ok = 1;
    }
    if(ok)cout << "OK\n";
    else cout << "NG\n";
    return 0;
}


Measured memory_bytes: 3096
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

class Line {
    private:
        stack<int> F, B;
    public:
        void insert(int x) {B.push(x);}
        void move(int d) {
            if(d > 0) {
                rep(i, d) {
                    F.push(B.top());
                    B.pop();
                }
            } else {
                rep(i, -d) {
                    B.push(F.top());
                    F.pop();
                }
            }
        }
        void erase() {B.pop();}
        void print() {
            vi vec(F.size() + B.size());
            int f = F.size();
            while(!F.empty()) {
                vec[F.size()-1] = F.top();
                F.pop();
            }
            int c = 0;
            while(!B.empty()) {
                vec[f+c++] = B.top();
                B.pop();
            }
            rep(i, vec.size()) {
                cout << vec[i] << '\n';
            }
        }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    Line l;
    int q;
    cin >> q;
    while(q--) {
        int i;
        cin >> i;
        if(i == 0) {
            int x;
            cin >> x;
            l.insert(x);
        } else if(i == 1) {
            int d;
            cin >> d;
            l.move(d);
        } else {
            l.erase();
        }
    }
    l.print();
}


Measured memory_bytes: 6852