akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;
  
int main()
{
  int N;
  cin >> N;

  vector<int> h(N);
  REP(i, N) cin >> h[i];
  
  int sum = h.at(0);
  REP(i,N-1){
    if(h.at(i)<h.at(i+1)){
      sum+=h.at(i+1)-h.at(i);
    }
  }

  cout << sum << endl;
}

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

b = [0]*n

for i in range(n):
    c = []
    j=2
    while (n-i)*j<=n:
        c.append((n-i)*j)
        j+=1
    if len(c)==0:
        b[n-i-1]=a[n-i-1]
    else:
        d = a[n-i-1]
        for x in c:
            d+=b[x-1]
        if d%2==1:
            b[n-i-1]=1
        else:
            b[n-i-1]=0

ans = []


for i in range(n):
    if b[i]%2==1:
        ans.append(i+1)
print(len(ans))
for i in range(len(ans)):
    print(ans[i],end=' ')

Measured memory_bytes: 90216
#include <bits/stdc++.h>
using namespace std;
void optimizeIO()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
}
const int maxn = 5e5;
const int maxk = 5e5;
const int lim = 5e5 + 1;
int parent[lim];
int ancestor(int a)
{
	if (a != parent[a])
		parent[a] = ancestor(parent[a]);
	return parent[a];
}
void merge(int a, int b)
{
	a = ancestor(a);
	b = ancestor(b);
	if (a != b)
		parent[a] = b;
}
int main()
{
	optimizeIO();
	int n, k;
	cin >> n >> k;
	for (int i = 1; i <= n; i++)
		parent[i] = i;
	for (int i = 1; i <= k; i++)
	{
		int city1, city2;
		cin >> city1 >> city2;
		merge(city1, city2);
	}
	for (int i = 1; i <= n; i++)
		parent[i] = ancestor(i);
	set<int> representativeElements;
	for (int i = 1; i <= n; i++)
		representativeElements.insert(parent[i]);
	int ans = (int) representativeElements.size();
	cout << ans - 1;
	return 0;
}

Measured memory_bytes: 7960
#include <iostream>
#include <queue>
using namespace std;
int main () 
{
 string a,b,c;
 cin>>a>>b>>c;
 queue<char>q;
 queue<char>s;
 queue<char>h;
for (int i=0;i<a.size();i++){
	q.push(a[i]);
}
for (int i=0;i<b.size();i++){
	s.push(b[i]);
}
for (int i=0;i<c.size();i++){
	h.push(c[i]);
}
char turn=q.front();
q.pop();
string answer;
while (true){
	if (turn=='a'){
		if (q.empty()){
			answer="A";
			break;
		}
		turn=q.front();
		q.pop();
	}
	if (turn=='b'){
		if (s.empty()){
			answer="B";
			break;
		}
		turn=s.front();
		s.pop();
	}
	if (turn=='c'){
		if (h.empty()){
			answer="C";
			break;
		}
		turn=h.front();
		h.pop();
	}
}
cout<<answer;
}

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

int main() {
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> c(h);
  rep(i, h) cin >> c[i];

  int ans = 0;
  rep(is, 1 << h) rep(js, 1 << w) {
    int cnt = 0;
    rep(i, h) rep(j, w) {
      if ((is >> i & 1) || (js >> j & 1)) continue;
      if (c[i][j] == '#') cnt++;
    }
    if (cnt == k) ans++;
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3588
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i,n) for(int i = 0;i < n;i++)
#define NIL = -1;
#define all(x) x.begin(),x.end()
const ll INF = 1e9;
const ll mod = 1e9 + 7;

int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}

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

ll lcm(ll a,ll b){
    return ((a * b == 0)) ? 0 : (a / gcd(a,b) * b);
}

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


//////////////////////////////////////////////////////////////////////////////////////b,cl

int main(){
    int n;
    cin >> n;
    vector<long long> a(n),ans(n);
    long long sum = 0,s = 0;
    for (int i = 0;i < n;i++){
        cin >> a[i];
        sum += a[i];
        if (i % 2 != 0) s += a[i];
    }

    ans[0] = sum - 2 * s;

    for (int i = 1;i < n;i++){
        ans[i] = 2*a[i-1] - ans[i-1];
    }

    for (int i = 0;i < n;i++){
        cout << ans[i] << " ";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 2944
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;

struct Dice{
    int s[6];
    void roll(char c){
        int now;
        int a;
      
        if(c == 'W'){
            a = s[0];
            s[0] = s[2];
            s[2] = s[5];
            s[5] = s[3];
            s[3] = a;
            
        }else if(c == 'S'){
            a = s[0];
            s[0] = s[4];
            s[4] = s[5];
            s[5] = s[1];
            s[1] = a;
        }else if(c == 'E'){
            a = s[0];
            s[0] = s[3];
            s[3] = s[5];
            s[5] = s[2];
            s[2] = a;
        }else if(c == 'N'){
            a = s[0];
            s[0] = s[1];
            s[1] = s[5];
            s[5] = s[4];
            s[4] = a;
        }
    }
    int top(){
        return s[0];
    }
};
int main(){
    Dice d;
    for(int i=0;i<6;i++) cin >> d.s[i];
    string code; cin >> code;
    for(int i=0;i<code.size();i++) d.roll(code[i]);
    cout << d.top() << endl;
    return 0;
}




Measured memory_bytes: 3160
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <numeric>
#include <queue>
#include <string>
#include <vector>

using namespace std;
const double PI = 3.14159265358979323846;
int main() {
    int s, w;
    cin >> s >> w;
    if(s <= w) {
        cout << "unsafe" << endl;
    } else {
        cout << "safe" << endl;
    }
}


Measured memory_bytes: 3632
s = gets.chomp
A = s[0]
B = s[1]
Ci = s.index("C")
if !Ci
  puts :WA
  exit
end
Cx = s[2...Ci]
Cy = s[Ci+1..-2]
D = s[-1]
puts A == ?A &&
	 B.match("[a-z]") &&
	 Ci > 1 && 
 	 Ci < s.size && 
	 s.count("C") == 1 &&
	 Cx.match("[a-z]*") &&
	 Cy.match("[a-z]*") &&
 	 D.match("[a-z]") ? :AC: :WA

Measured memory_bytes: 14384
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

#define rep(i, n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;

int main() {
    int n;
    cin>>n;
    int l[n];
    int sum=0;
    rep(i,n){
        cin>>l[i];
        sum+=l[i];
    }
    sort(l,l+n);
    sum-=l[n-1];
    if(l[n-1]<sum){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }




    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

int main(void)
{
	double x1, y1, x2, y2;
	double l;


	cin >> x1 >> y1 >> x2 >> y2;

	l = sqrt(pow(x2-x1, 2) + pow(y2-y1, 2));

	printf("%.8f\n", l);

	return 0;
}

Measured memory_bytes: 1240
S = input()
first = S[:int((len(S)-1)/2)]
second = S[int((len(S)+3)/2-1):]
if first == ''.join(list(reversed(first))) and second == ''.join(list(reversed(second))) and first == ''.join(list(reversed(second))):
    print('Yes')
else:
    print('No')


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

using namespace std;

int n, m, q;
int a[100], b[100], c[100], d[100];
long long ans = 0;

void dfs(vector<int> &A) {
    if (A.size() == n) {
        long long now = 0;
        for (int i = 0; i < q; ++i) {
            if ((A[b[i]] - A[a[i]]) == c[i]) now += d[i];
        }
        ans = max(ans, now);
        return;
    }

    int t = A.back();
    for (int i = t; i <= m; ++i) {
        A.push_back(i);
        dfs(A);
        A.pop_back();
    }

}

int main(void) {
    cin >> n >> m >> q;
    for (int i = 0; i < q; ++i) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        a[i]--;
        b[i]--;
    }
    vector<int> v(1, 1);
    dfs(v);
    cout << ans << endl;
}

Measured memory_bytes: 3532
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define CONTEST_CNT 26

const ll mod = 1000000007;

int main() {
    int d; cin >> d;
    vector<int> cs(CONTEST_CNT);
    vector<vector<int>> ss(d, vector<int>(CONTEST_CNT));
    vector<int> ts(d);
    vector<int> lastd(CONTEST_CNT, -1);
    rep(i,CONTEST_CNT) cin >> cs.at(i);
    rep(i,d){
        int maxs = 0;
        rep(j,CONTEST_CNT){
            cin >> ss.at(i).at(j); 
            if(maxs < ss.at(i).at(j)){
                maxs = ss.at(i).at(j);
                ts.at(i) = j;
            }
        }
    }
    rep(i,d){
        cout << ts.at(i) + 1 << endl;
    }
    // ll r = 0;
    // rep(i,d){
    //     r += ss.at(i).at(ts.at(i));
    //     lastd.at(ts.at(i)) = i;
    //     rep(j,CONTEST_CNT){
    //         r -= cs.at(j) * (i - lastd.at(j));
    //     }
    //     cout << r << endl;
    // }
    return 0;
}

Measured memory_bytes: 3676
s = input()

for i in range(len(s) - 2):
    if (s[i] == s[i + 1] or s[i] == s[i + 2]):
        print("{} {}".format(i + 1, i + 3))
        break
else:
    if (s[-2] == s[-1]):
        print("{} {}".format(len(s) - 1, len(s)))
    else:
        print("-1 -1")



Measured memory_bytes: 3316
#include<cstdio>
#include<algorithm>
using namespace std;

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

    if(a>c){swap(a,c);swap(b,d);}
    for(int i=0;i<d-b;i++)
        putchar('U');
    for(int i=0;i<c-a;i++)
        putchar('R');
    for(int i=0;i<d-b;i++)
        putchar('D');
    for(int i=0;i<c-a;i++)
        putchar('L');
    putchar('L');
    for(int i=-1;i<d-b;i++)
        putchar('U');
    for(int i=-1;i<c-a;i++)
        putchar('R');
    putchar('D');
    putchar('R');
    for(int i=-1;i<d-b;i++)
        putchar('D');
    for(int i=-1;i<c-a;i++)
        putchar('L');
    putchar('U');
    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>

int isso(int a,int b) {
	int i;
	for(i=2;i<=b;i++) {
		if(a%i==0 && b%i==0)break;
	}
	if(i<=b)return 0; else return 1;
}

int main(void) {
	char moto[300];
	char dec[300];
	char henkan[26];
	int count,max;
	int a,b;
	int i;
	scanf("%d",&max);
	while(getchar()!='\n');
	for(count=0;count<max;count++) {
		fgets(moto,sizeof(moto),stdin);
		for(a=1;a<26;a++) {
			if(!isso(a,26))continue;
			for(b=0;b<26;b++) {
				for(i=0;i<26;i++) {
					henkan[(a*i+b)%26]=i+'a';
				}
				for(i=0;moto[i]!=0 && moto[i]!='\n';i++) {
					if(moto[i]>='a' && moto[i]<='z')
						dec[i]=henkan[moto[i]-'a'];
					else dec[i]=moto[i];
				}
				dec[i]=0;
				if(strstr(dec,"this") || strstr(dec,"that")) {
					printf("%s\n",dec);
					a=26;
					break;
				}
			}
		}
	}
	return 0;
}

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

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

int main(void) {
	int A,B,m;
	cin >> A >> B >> m;

	vector<int>a(A);
	vector<int>b(B);
	int ans = 1000000;

	for (int i = 0; i < A; i++) {
		cin >> a[i];
	}

	for (int i = 0; i < B; i++) {
		cin >> b[i];
	}
	
	vector<int>x(m);
	vector<int>y(m);
	vector<int>c(m);

	for (int i = 0; i < m; i++) {
		cin >> x[i]>>y[i]>>c[i];
	}

	for (int i = 0; i < m; i++) {
		ans = min(ans,a[x[i]-1]+b[y[i]-1]-c[i]);
	}

	sort(a.begin(), a.end());
	sort(b.begin(), b.end());

	ans = min(ans, a[0]+b[0]);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 5088
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
	string s;
	cin >> s;
	int size = s.size();
	if (s[size-1] == 's')
	{
		cout << s << "es" << endl;
	}
	else
	{
		cout << s << "s" << endl;
	}
}


Measured memory_bytes: 3624
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

//typedef pair<int,int> P


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

	printf("%d\n", (a+b+1)/2);


	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
 
int main(void){
  int X;
  int a,b,c;
  do{
  scanf("%d",&X);
  }while(X<=0&&X>=1000000000);
  a=X/500;
  b=X%500;
  c=b/5;
  printf("%d",a*1000+c*5);
 
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int main(){
  int n;
  cin>>n;
  vi x(n);
  REP(i,n)cin>>x[i];
  vi y = x;
  sort(ALL(y));
  int a = y[n/2-1];
  int b = y[n/2];
  REP(i,n){
    cout << (x[i]<=a ? b : a) << endl;
  }
  return 0;
}


Measured memory_bytes: 3712
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define repd(i,a,b) for (int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template
struct query{int x, y, t;};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int W, H, T;
    cin >> W >> H >> T;
    int p;
    cin >> p;
    vector<query> Q(p);
    rep(i, p){
        cin >> Q[i].x >> Q[i].y >> Q[i].t;
    }
    vector<vector<int>> A(H, vector<int>(W));
    int ret = 0;
    rep(i, H) rep(j, W) {
        cin >> A[i][j];
    }
    rep(i, p){
        int x = Q[i].x, y = Q[i].y, t = Q[i].t;
        if(t > T || A[y][x] == 0) continue;
        ret++;
    }
    
    cout << ret << endl;
    
    return 0;
}

Measured memory_bytes: 3228
// Package main provides
//
// File:  d.go
// Author: ymiyamoto
//
// Created on Thu Jan 17 10:46:05 2019
//
package main

import (
	"fmt"
	"strings"
)

func main() {
	var N int
	fmt.Scan(&N)
	var S string
	fmt.Scan(&S)

	leftNum := 0
	for i := range S {
		if S[len(S)-1-i] == ')' {
			leftNum++
		} else {
			if leftNum > 0 {
				leftNum--
			}
		}
	}

	s := strings.Repeat("(", leftNum) + S
	rightNum := 0
	for i := range s {
		if s[i] == '(' {
			rightNum++
		} else {
			if rightNum > 0 {
				rightNum--
			}

		}
	}

	fmt.Println(s + strings.Repeat(")", rightNum))
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
 
#define lli long long
#define FOR(i,a,b) for (lli i=(a);i<(b);i++)
#define REP(i,n) for (lli i=0;i<(n);i++)
#define rep(i,n) for (lli i=0;i<(n);i++)
 
#define INF INT_MAX/3
#define PB push_back
#define pb push_back
#define all(a) (a).begin(),(a),end()
#define pll pair<lli,lli>

int main(){
  int N;

  cin >> N;

  cout << pow(N,3) << endl;

  return 0;
}


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

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

  vector<int> vec(5);
  int new_num=0;
  int count=0;

  for(int i=A;i<=B;i++){
    
    vec.at(0)=i%10;
    vec.at(1)=(i/10)%10;
    vec.at(2)=(i/100)%10;
    vec.at(3)=(i/1000)%10;
    vec.at(4)=(i/10000)%10;
    
    new_num=vec.at(0)*10000+vec.at(1)*1000+vec.at(2)*100+vec.at(3)*10+vec.at(4);

    if(i==new_num){
      count++;
    }
  }

  cout << count <<endl;
}

Measured memory_bytes: 256
import sys
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
for Z in range(-100, 101):
    if X < Z <= Y and max(x) < Z and Z <= min(y):
        print('No War')
        sys.exit()
print('War')


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

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define mp make_pair
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define MOD 1000000007

string str1,str2;
int ans,rec;
int a,b;
int n;
int A[10101];

int main(){
  cin >> n;
  for(int i = 0; i < n; ++i){
    cin >> a;
    if(i==0){
      b = a;
      continue;
    }
    else if(a<=b){
      ans++;
      rec = max(ans,rec);
    }else{
      ans = 0;
    }
    b = a;
  }
  rec = max(ans,rec);
  cout << rec << endl;
  return 0;
}

Measured memory_bytes: 384
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

var a, s []int
var memo [][]int

func main() {
	N := ReadInt()
	a = ReadInts(N)
	s = make([]int, N+1)
	for i := 0; i < N; i++ {
		s[i+1] = s[i] + a[i]
	}
	memo = make([][]int, N)
	for i := 0; i < N; i++ {
		memo[i] = make([]int, N+1)
	}
	fmt.Println(f(0, N))
}

func f(l, r int) int {
	if l == r-1 {
		return 0
	}
	if memo[l][r] > 0 {
		return memo[l][r]
	}
	v := math.MaxInt64
	for c := l + 1; c < r; c++ {
		v = Min(v, f(l, c)+f(c, r)+s[r]-s[l])
	}
	memo[l][r] = v
	return v
}

func Min(xs ...int) int {
	min := xs[0]
	for _, x := range xs[1:] {
		if min > x {
			min = x
		}
	}
	return min
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int) { Scan(&i); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


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

int main() {
  int N;
  cin >> N;
  vector<int> L(N);
  for (int i{}; i < N; ++i) cin >> L[i];
  sort(L.begin(), L.end());

  int ans{};
  for (int i{}; i < N - 1; ++i) {
    for (int j{i + 1}; j < N; ++j) {
      int h = (lower_bound(L.begin(), L.end(), L[i] + L[j]) - L.begin());
      ans += max(0, h - (j + 1));
    }
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
using namespace std;
typedef long long ll;

int main()
{
  int N;
  string S[100];
  int s[100][26] = {0};
  int res[26];
  cin >> N;

  rep(i,N) {
    cin >> S[i];
  }
  rep(i,N){
    rep(j,S[i].length()){
      s[i][S[i][j]-'a']++;
    }
  }
  rep(i,26) res[i] = s[0][i];
  FOR(i,1,N-1){
    rep(j,26){
      res[j] = min(res[j], s[i][j]);
    }
  }

  rep(i,26){
    while(res[i]>0){
      char c = 'a' + i;
      cout << c;
      res[i]--;
    }
  }
  cout << endl;
}


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

ll n,k;

ll a[100001];
ll maxN=1000000000000000000;

ll f(int i)
{
    ll res=0;
    for(int j=i+1;j<=n-1;j++)
    {
        res=max(res,(a[j]-a[i])*(a[j]-a[i])+f(j+1));
    }
    return res;
}

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


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

    ll dp[n+1][n+1];

    for(int len=1;len<=n;len++)
    {
        for(int end=len-1;end<=n-1;end++)
        {
            int start=end-len+1;
            if(start==end)
            {
                dp[start][end]=0;continue;
            }

            if(start==end-1)
            {
                dp[start][end]=a[start]+a[end];
                continue;
            }

            ll res=maxN;
            for(int k=end;k>start;k--)
            {
                ll s1=0;
                if(start!=0)
                s1=sum[start-1];
                res=min(res,dp[start][k-1]+dp[k][end]+sum[end]-s1);
            }
            dp[start][end]=res;

        }
    }

    cout<<dp[0][n-1]<<"\n";




}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define eb emplace_back
#define all(v) v.begin(),v.end()
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
const ll INF=1LL<<60;
const ll MOD=998244353LL;
template<class T> void chmin(T &a,T b){a=min(a,b);}
template<class T> void chmax(T &a,T b){a=max(a,b);}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	string s;cin>>s;
	string t="hi";
	for(int i=0;i<10;i++){
		if(s==t){
			cout<<"Yes"<<endl;
			return 0;
		}
		t+="hi";
	}
	cout<<"No"<<endl;
}


Measured memory_bytes: 256
#(44)科目選択
a=[]
for i in range(4):
    n=int(input())
    a.append(n)
a.sort(reverse=True)
b=[]
for j in range(2):
    m=int(input())
    b.append(m)
b.sort(reverse=True)
sum=0
for k in range(3):
    sum+=a[k]
print(sum+b[0])


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

ans1 = 0
ans2 = 0

sum1 = 0
sum2 = 0

for i in range(n):
    sum1 += a[i]
    sum2 += a[i]
    if sum1*(-1)**i>=0:
        ans1 += abs(sum1)+1
        sum1 = -(-1)**i
    if sum2*(-1)**i<=0:
        ans2 += abs(sum2)+1
        sum2 = (-1)**i

print(min(ans1,ans2))


Measured memory_bytes: 63216
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
using namespace std;
typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pair<int,int> > vpii; typedef long long ll;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

double area(int x1, int x2, int y1, int y2) {
	if(x1 == x2) return 0;
	if(x1 > x2) return -area(x2, x1, y2, y1);
	int w = x2 - x1, h = y2 - y1;
	double s = (double)h / w;
	double res = 0;
	reu(x, x1, x2) if(x % 2 != 0) {
		double yl = y1 + s * (x - x1);
		double yr = y1 + s * (x + 1 - x1);
		res += (yl + yr) * 1 / 2.;
	}
	return res;
}

int main() {
	int N;
	scanf("%d", &N);
	vi x(N), y(N);
	rep(i, N) scanf("%d%d", &x[i], &y[i]), x[i] *= 2, y[i] *= 2;
	double ans = 0;
	rep(t, 2) {
		double a = 0;
		rep(i, N)
			a += area(x[i], x[(i+1)%N], y[i], y[(i+1)%N]);
//		cerr << t << ": " << abs(a) / 4 << endl;
		amax(ans, abs(a));

		rep(i, N)
			x[i] += 1;
	}
	ans /= 4;
	printf("%.10f\n", ans);
	return 0;
}

Measured memory_bytes: 1224
#include<bits/stdc++.h>
using namespace std;
#define num 1000000007
//#define num 998244353
#define REP(i,a,n) for(ll i=a;i<n;i++)
#define inarr(i,a,n,A) for(ll i=a;i<n;i++) { cin>>A[i]; }
#define vll vector<long long>
#define pii pair <int,int>
#define pll pair<long long, long long>
#define vpii vector< pair <int,int>>
#define vpll vector< pair<long long, long long>>
#define max(a,b) ((a>b)?a:b)
#define min(a,b) ((a>b)?b:a)
#define max3(a,b,c) ((a>b)?(a>c)?a:c:(b>c)?b:c)
#define min3(a,b,c) ((a<b)?(a<c)?a:c:(b<c)?b:c)
#define avg(a,b) ((a)+(b))/2
#define pb push_back
#define pob pop_back
#define sf int flag=0     //Remember semicolon
#define assmin(a,b) if(b<=a) { a=b; }
#define assmax(a,b) if(b>=a) { a=b; }
#define f first
#define s second
#define fix(f,n) std::fixed<<std::setprecision(n)<<f
#define all(x) x.begin(), x.end()
#define M_PI 3.14159265358979323846
typedef long long ll;
ll mod(ll a, ll b)
{
	if(a%b<0)
	{
		return a%b + b;
	}
	return a%b;
}
 
 
ll mod_exp(ll a, ll b, ll c)
{
	ll res=1;
	a=a%c;
	while(b>0)
	{
		if(b%2==1)
		{
			res=(res*a)%c;
		}
		b/=2;
		a=(a*a)%c;
	}
	return res;
}
ll mymod(ll a,ll b)
{
    return ((a%b)+b)%b;
}
bool prime[200001];
void SieveOfEratosthenes() 
{ 
    memset(prime, true, sizeof(prime)); 
    prime[1]=false;
    for (int p=2; p*p<=200000; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=200000; i += p) 
                prime[i] = false; 
        } 
    } 
    return;
}
ll powe[200005];
void power()
{
    powe[0]=1;
    REP(i,1,200005)
    {
        powe[i]=mymod(2*powe[i-1],num);
    }
}
ll gcdExtended(ll,ll,ll *,ll *);
ll modInverse(ll a, ll m) 
{ 
    ll x, y; 
    ll g = gcdExtended(a, m, &x, &y); 
        ll res = (x%m + m) % m;
        return res;
} 
ll gcdExtended(ll a, ll b, ll *x, ll *y) 
{ 
    if (a == 0) 
    { 
        *x = 0, *y = 1; 
        return b; 
    } 
    ll x1, y1; 
    ll gcd = gcdExtended(b%a, a, &x1, &y1); 
    *x = y1 - (b/a) * x1; 
    *y = x1; 
    return gcd; 
}
ll n; 
struct node
{
	vll adj;
    ll colour;
};
void dfs(node N[], bool vis[], ll i, ll parent=-1)
{
    vis[i]=true;
    if(parent!=-1)
    {
        N[i].colour = 1 - N[parent].colour;
    }
    for(auto x: N[i].adj)
    {
        if(!vis[x])
        {
            dfs(N,vis,x,i);
        }
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,k;
    cin>>n>>k;
    ll dp[k+1];
    ll tot=0;
    for(ll i=k;i>k/2;i--)
    {
        dp[i]=1;
        tot = mymod(tot + i*dp[i], num);
    }
    for(ll i=k/2;i>=1;i--)
    {
        dp[i] = mod_exp((k/i),n,num);
        for(ll j=2*i;j<=k;j+=i)
        {
            dp[i] = mymod(dp[i] - dp[j], num);
        }
        tot=mymod(tot+ i*dp[i], num);
    }
    cout<<tot<<endl;
    return 0;
}


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

const int NOUSE = -1;

int contraction(int x) {
  if (x < 10)
    return x;
  int y = x % 10;
  while (x > 9)
    x /= 10;
  return 10 * x + y;
}

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

  vector<int> v(100);
  for (int i = 0; i < v.size(); ++i) {
    if (i % 10 == 0)
      v[i] = NOUSE;
  }

  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    int x = contraction(i);
    if (v[x] == NOUSE)
      continue;
    if (x < 10) {
      ans += 1;
    } else {
      int a = x % 10;
      int b = x / 10;
      int c = 10 * a + b;
      if (a == b)
        ans += 2 * v[a] + 1;
      if (c <= n)
        ans += 2 * v[c];
    }
    v[x] += 1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int INF = 1000000005;
const long double EPS = 1e-10;

int main() {
  int n, i;
  cin >> n >> i;
  cout << n - i + 1 << endl;

  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long
#define puts(i) cout<<i<<endl
int main(){
	int a,b;
	cin>>a>>b;
	ll ans=0;
	rep(i,b-a+1){
		string s = to_string(a+i);
		bool is_pal=true;
		rep(j,s.size()/2){
			if(s[j]!=s[(int)s.size()-j-1]){is_pal=false;break;}
		}
		if(is_pal)ans++;
	}
	puts(ans);
}


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

string s;

long long solve();
bool ch(int x, int y);

int main() {
  cin >> s;
  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long cnt = 0;
  for(int i = 0; i < s.size() - 2; ++i)
    for(int j = i + 1; j < s.size() - 1; ++j)
      for(int k = j + 1; k < s.size(); ++k) {
        if(ch(0, i) && ch(i + 1, j) && ch(j + 1, k) &&
           ch(k + 1, s.size() - 1))
          ++cnt;
      }
  return cnt;
}

bool ch(int x, int y) {
  if(x > y) return 0;
  if(x != y && s[x] == '0') return 0;
  long long now = 0;
  for(int i = x; i <= y; ++i) {
    now *= 10;
    now += s[i] - '0';
  }
  return now <= 255;
}


Measured memory_bytes: 3204
#include <iostream>

using namespace std;

int main(){
    int n, x;

    while(true){
        cin >> n >> x;
        if(n == 0 && x == 0)
            break;
        int count = 0;
        for(int i = 1; i <= n; i++){
            for(int j = i+1; j <= n; j++){
                for(int k = j+1; k <= n; k++){
                    int sum = i + j + k;
                        if(sum == x)
                            count++;
                }
            }
        }
        cout << count << endl;
    }

    return 0;
}


Measured memory_bytes: 3104
import java.util.ArrayList;
import java.util.Scanner;


public class Main {
	
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		
		int m = sc.nextInt();
		String[] line = new String[m];
		sc.nextLine();
		
		for(int i = 0; i < m; i++){
			line[i] = sc.nextLine().replaceAll(" ", "");
		}
		for(int i = 0; i < m; i++){
			char[] dots = new char[line[i].length()];
			for(int j = 0; j < line[i].length(); j++){
				dots[j] = line[i].charAt(j);
			}
			ArrayList<String> trainList = new ArrayList<String>();
			String before = null;
			String rbefore;
			String after = null;
			String rafter;
			for(int j = 0; j < dots.length - 1; j++){
				before = before + dots[j];
				after = null;
				if(j == 0){
					before = before.replaceAll("null", "");
				}
				for(int k = j + 1; k < dots.length; k++){
					after = after + dots[k];
				}
				after = after.replaceAll("null", "");
				if(!trainList.contains(before + after)){
					trainList.add(before + after);
				}
				if(!trainList.contains(after + before)){
					trainList.add(after + before);
				}
				StringBuffer beforesb = new StringBuffer(before);
				StringBuffer aftersb = new StringBuffer(after);
				rbefore = beforesb.reverse().toString();
				rafter = aftersb.reverse().toString();
				if(!trainList.contains(before + rafter)){
					trainList.add(before + rafter); 
				}
				if(!trainList.contains(rafter + before)){
					trainList.add(rafter + before);
				}
				if(!trainList.contains(rbefore + after)){
					trainList.add(rbefore + after);
				}
				if(!trainList.contains(after + rbefore)){
					trainList.add(after + rbefore);
				}
				if(!trainList.contains(rbefore + rafter)){
					trainList.add(rbefore + rafter);
				}
				if(!trainList.contains(rafter + rbefore)){
					trainList.add(rafter + rbefore);
				}
			}
			System.out.println(trainList.size());
		}
		
	}

}

Measured memory_bytes: 13000
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <cmath>
#include <numeric>
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <list>
#include <unordered_map>
#include <tuple>
#include <complex>


#define FOR(i, a, b)		for(int i = (int)(a); i < (int)(b); ++i)
#define FORE(i, a, b)		for(int i = (int)(a); i <= (int)(b); ++i)
#define REP(i, n)			FOR(i, 0, n)
#define REPE(i, n)			FORE(i, 0, n)
#define ALL(x)				(x).begin(),(x).end()
#define DEBUG_DC(x)			cout << #x << ": " << x << endl
#define VEC_TYPE			int
#define INF					1e9+1

using namespace std;
typedef long long ll;
typedef vector<VEC_TYPE> vdef;
typedef vector<vdef> vvdef;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmaxE(T& a, T b) { if (a <= b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline bool chminE(T& a, T b) { if (a >= b) { a = b; return 1; } return 0; }
template<typename T> inline T mygcd(T a, T b) { return b ? mygcd(b, a%b) : a; }
template<typename T> inline T mylcm(T a, T b) { return a * b / mygcd(a, b); }

int main()
{
	int ans = 0;
	int n;
	cin >> n;
	string s;
	cin >> s;
	if (n % 2 == 0)
	{
		n /= 2;
		for (int i = 0; i < n; ++i)
		{
			if (s[i] != s[n + i])
			{
				cout << "No" << endl;
				return 0;
			}
		}
	}
	else
	{
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  string s;
  cin >> s;
  int ans = 0;
  for(int i = 0; i <= N - 3; ++i){
    if("ABC" == s.substr(i, 3)) ans++;
  }
  cout << ans << endl;
}

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

typedef long long ll;

int main(){
	int N,Y;
	cin >> N >> Y;
	int x=-1,y=-1,z=-1;
	for(int i=0; i<=N; i++){
	 for(int j=0; j+i<=N; j++){
	 	int k = N-i-j;
	 	if(Y==10000*i+5000*j+1000*k){
	 		 		x=i; y=j; z=k;
	 		 	}
	 }
	}
	printf("%d %d %d\n",x,y,z);
	return 0;
}

Measured memory_bytes: 3776
#![allow(non_snake_case, unused_imports)]

// Input
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} }; ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => { let mut $var = read_value!($next, $t); input_inner!{$next $($r)*} }; }
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, [ $t:tt ]) => { { let len = read_value!($next, usize); (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() } }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,HashMap,BTreeMap,VecDeque};

// Functions

// Main
fn main(){
    input!{
        T: f64,
        X: f64,
    }
    println!("{}",T/X);
}

Measured memory_bytes: 4352
#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() {
  string n;
  cin >> n;
  string ans = "No";
  rep(i, n.size()) {
    if (n.at(i) == '7') {
      ans = "Yes";
      break;
    }
  }

  cout << ans << endl;
}


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

using namespace std;

#define PI          3.1415926535897932384626433832795l

#define pb push_back
#define mp make_pair
#define lb lower_bound // First element which is not less than val
#define ub upper_bound // First element greater than val
#define f first
#define s second

#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
using vpii = vector<pair<int,int>>;
using vpll = vector<pair<ll,ll>>;

using pii = pair<int,int>;
using pll = pair<ll,ll>;

#define endl '\n'
#define re return

#define rep(i,a,b) for (ll i = (a); i < (b); i++)
#define repz(i, a) for (ll i = 0; i < (a); i++)
#define repd(i,a,b) for (ll i = (a); i >= b; i--)
#define repdz(i,a) for (ll i = a; i >=0; i--)
#define trav(a, x) for (auto& a : x)

#define vecin(n,v) for(ll i = 0; i < n; i++) cin>>v[i];
#define llin(a) ll a; cin>>a;
#define llin2(a,b) ll a,b; cin >>a>>b;
#define llin3(a,b,c) ll a,b,c; cin>>a>>b>>c;
#define full(v) v.begin(),v.end()

void solve()
{
    int r;
    cin >> r;
    double f = 2.0*PI*r;
    cout << f << endl;
}

int main()
{
    //ios_base::sync_with_stdio(false);
    //llin(t);
    //while (t--)
    //{
        solve();
    //}
}


Measured memory_bytes: 3784
#include<stdio.h>
int main()
{
	char s[4];
	scanf("%s",&s);
	if(s[0]==s[1]&&s[2]==s[3]&&s[0]!=s[2]||s[0]==s[2]&&s[1]==s[3]&&s[0]!=s[3]||s[0]==s[3]&&s[1]==s[2]&&s[0]!=s[1])
	printf("Yes\n");
	else
	printf("No\n");
	return 0;
}

Measured memory_bytes: 128
import java.util.*;

import java.lang.*;

import java.math.*;



public class Main {

	Scanner sc = new Scanner(System.in);

	class time{

		int h;

		int m;

		int deg;

		time(String hm){

			String ti[] = hm.split(":");

			h = Integer.parseInt(ti[0]);

			m = Integer.parseInt(ti[1]);

			deg = Math.abs((h*60+m - m*12));

			deg = Math.min(deg, 12*60-deg);

		}

		@Override

		public String toString() {

			if(deg < ((30)*(12*60)/360)){

				return "alert";

			}

			if(deg >= ((90)*(12*60)/360)){

				return "safe";

			}

			return "warning";

		}

	}

	void run(){

		int n = sc.nextInt();

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

			System.out.println(new time(sc.next()));

		}

		

	}

	public static void main(String[] args){

		Main m = new Main();

		m.run();

	}

}

Measured memory_bytes: 12000
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 m = sc.NextInt();
        int x = sc.NextInt();
        int y = sc.NextInt();

        int[] xs = sc.IntArray();
        int[] ys = sc.IntArray();

        string answer = xs.Max() < ys.Min() && xs.Max() < y && ys.Min() > x ? "No War" : "War";

        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: 13396
#include <iostream>

int main()
{
	int N, K, d, * A, buf = 0, T = 0;
	std::cin >> N >> K;
	A = new int[N];
	for (int i = 0; K > i; i++) {
		std::cin >> d;
		for (int i = 0; i < d; i++) {
			std::cin >> buf;
			A[buf - 1] += 1;
		}
	}
	for (int i = 0; i < N; i++) {
		if (A[i] == 0)T++;
	}
	std::cout << T;
	delete[] A;
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <chrono>

using namespace std;

int main()
{
    string s;
    cin >> s;
    int n = s.size();
    reverse(s.begin(), s.end());
    vector<int> cnt(2019);
    int ans = 0, total = 0, x = 1;

    for (int i = 0; i < n; i++)
    {
        cnt[total]++;
        total += (s[i] - '0') * x;
        total %= 2019;
        ans += cnt[total];
        x = x * 10 % 2019;
    }

    cout << ans << endl;
    return 0;
}

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

int main(){
  int N, M;
  cin >> N >> M;
  vector<vector<int>> data(M, vector<int> (2));
  for(int i = 0; i < M; i++){
    for(int j = 0; j < 2; j++){
      cin >> data.at(i).at(j);
    }
  }
  vector<int> data2(200);
  for(int i = 0; i < M; i++){
    for(int j = 0; j < 2; j++){
      data2.at(data.at(i).at(j))++;
    }
  }
  for(int i = 0; i < N; i++){
    cout << data2.at(i+1) << endl;
  }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n)for(int i=0;i<(int)(n);i++)
#define PI 3.141592653589793
//vector < vector<int>>a(0, vector<int>(0));二次元配列宣言


int main()
{
	int n;
	cin >> n;
	if (n / 10 == 9 || n % 10 == 9)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

} 

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

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

    long long int ans = 0;
    long long int count = 0;
    for(int i=0; i<s.length(); i++){
        if(s[i] == 'B') count += 1;
        if(s[i] == 'W') ans += count;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3752
#include<iostream>
using namespace std;
int main()
{
 
	int t;
	int i,j,n,m=0;
	cin>>t;
   cin>>i>>j;
   for(int k=i;k<=j;k++)
   {
   	if(k%t==0)
   	{
   		cout<<"OK\n";
   		return 0;
	   }
   }
   cout<<"NG\n";
	return 0;
}

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

// 10
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] x = new int[N];
        for(int i = 0; i < N; i++)
            x[i] = sc.nextInt();
        
        Arrays.sort(x);
        int alice = 0;
        int bob = 0;
        if(N % 2 == 0) {
        	for(int i = N - 1; i >= 0; i -= 2) {
        		alice += x[i];
        		bob += x[i - 1];
        	}
        }
        if(N % 2 != 0) {
        	if(N == 1) alice += x[0];
        	else {
				for(int i = 0; i < N; i += 2)
					alice += x[i];
				for(int i = 1; i < N; i += 2)
					bob += x[i];
			}
        }
        
        System.out.println(alice - bob);
	}

}


Measured memory_bytes: 35772
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>

using namespace std;
#define loop(i,n) for(int i = 0; i < (n); i++)
#define loops(i,f,n) for(int i = (f); i < (n); i++)
#define INF 9999999

int main()
{
	vector<char> ans;
	string s;
	cin >> s;
	loop(i, s.size())
	{
		if (s[i] == '0')ans.push_back('0');
		else if (s[i] == '1')ans.push_back('1');
		else
		{
			if (ans.size())ans.pop_back();
			else continue;
		}
	}
	loop(i, ans.size())
	{
		cout << ans[i];
	}
	cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
void yes(bool expr) {
  cout << (expr ? "Yes" : "No") << "\n";
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int A, B, K;
    cin >> K >> A >> B;
    FOR(i, A, B+1) {
        if(i%K == 0) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
}

Measured memory_bytes: 3648
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define endl "\n"
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define int long long
const int MOD=1e9+7;
const int N=3e5+10;
int a[N],b[N];
int32_t main()
{
	IOS;
	int n,m,k;
	cin>>n>>m>>k;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	for(int i=1;i<=m;i++)
	{
		cin>>b[i];
	}
	int sum=0;
	int idx=0;
	while(idx<=m)
	{
		sum+=b[idx];
		if(sum>k)
		{
			sum-=b[idx];
			idx--;
			break;
		}
		idx++;
		if(idx>m)
		{
			idx--;
			break;
		}
	}
	int sum1=0;
	int mx=0;
	for(int i=0;i<=n;i++)
	{
		sum1+=a[i];
		int p=k-sum1;
		if(p<0)
			break;
		while(idx>0&&sum>p)
		{
			sum-=b[idx];
			idx--;
			if(sum<=p)
			{
				break;
			}
			
		}
	//	cout<<idx<<endl;
		mx=max(mx,i+idx);
	}
	cout<<mx<<endl;




















}

Measured memory_bytes: 6772
#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() {

  int A, B;
  cin >> A >> B;

  int C;
  if (A * B == 3){
    C = 2;
  }
  else if (A * B == 6) {
    C = 1;
  }
  else {
    C = 3;
  }

  cout << C << endl;

  return 0;
}



Measured memory_bytes: 256
#include<iostream>
main(){int c[99],t[99],n,a,i,j;for(i=99;i-->0;t[i]=i*(i+1)*(i+2)/6)c[i]=i*i*i;for(;std::cin>>n,n;printf("%d\n",a))for(i=a=0;i<60;i++)for(j=0;c[i]+t[j]<=n;j++)a=a>c[i]+t[j]?a:c[i]+t[j];}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<algorithm>
#include<string.h>
#include <iomanip>
#include <sstream>
using namespace std;

int main() {
  int N, D;
  int ans = 0;
  string s;
  int sum=0;
  int clc=0;
  int dbl=0;
  double sq;
  

  cin >> N >> D;

  vector<vector<int>> X(N+1, vector<int>(D+1));
  for(int i = 1; i <= N; i++){
    for(int j = 1; j <= D; j++){
      cin >> X[i][j];
    }
  }

  for(int i = 1; i <= N; i++){
    for(int j = 1; j < i; j++){
      //各組み合わせについて距離計算
      //D次元分
      for(int k = 1; k <= D; k++){
        clc = X[i][k] - X[j][k];
        dbl = clc*clc;
        sum += abs(dbl);
      }
      sq = sqrt(sum);
      if(ceil(sq)==floor(sq)){
        ans++;
      }
      sum=0;
      
    }
  }

  cout << ans << endl;

}


Measured memory_bytes: 256