akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

bool dp[30009][4][1009];
int ans=0;

int main(void)
{
    //input
    int n;
    string str;
    cin >> n >>str;
    dp[0][0][0]=true;

    //calculate
    for(int i=0; i<n; i++){
        for(int j=0; j<=3; j++){
            for(int k=0; k<1000; k++){
                if(dp[i][j][k] == false) continue;

                dp[i+1][j][k] = true;
                if(j <= 2) dp[i+1][j+1][k*10 + (str[i] - '0')] = true;                
            }
        }
    }

    //output    
    for (int i = 0; i < 1000; i++) {
		if (dp[n][3][i] == true) ans++;
	}

    printf("%d\n", ans);

    return 0;
}

Measured memory_bytes: 118528
#pragma GCC optimize("O3")

#include<bits/stdc++.h>
#define sp " "
#define endl "\n"
#define MAX 10e9
#define MAXN 100001
#define mod 1000000007
#define inf_int 2e9
#define inf_ll 2e18
#define e 1e-9
#define vi vector<int>
#define vl vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpl vector<pair<ll,ll>>
#define vpc vector<pair<char,char>>
#define adj_list vector<vl>
#define umap unordered_map<ll, ll>
#define pll pair<ll,pair<ll, ll>>
#define clr(x) memset(x,0,sizeof(x))
#define cy cout << "YES" << endl
#define cn cout << "NO" << endl
#define google cout << "Case #" << ++it << ": " << ans << endl;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
typedef long long int ll;

ll it = 0, ans = 0;

ll spf[MAXN];
void sieve()
{
    spf[1] = 1;
    for (auto i=2; i<MAXN; i++)
  		spf[i] = i;
  	for (auto i=4; i<MAXN; i+=2)
        spf[i] = 2;
    for (auto i=3; i*i<MAXN; i++)
    {
        if (spf[i] == i)
        {
            for (auto j=i*i; j<MAXN; j+=i)
                if (spf[j]==j)
                    spf[j] = i;
        }
    }
	return;
}

vl getFactorization(ll x)
{
    vl ret;
    while (x != 1)
    {
        ret.push_back(spf[x]);
        x = x / spf[x];
    }
    return ret;
}


void check()
{
	string s;
	cin >> s;
	if(s[s.size()-1]=='s') {
		cout << s << "es";
	}
	else {
		cout << s << "s";
	}
    return ;
}

int32_t main()
{
    fastio
    ll t = 1;
    // cin >> t;
    while(t--)
        check();
    return 0;
}


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

public class AtCoderD
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        Tuple<long, long, long>[] works = new Tuple<long, long, long>[n];
        for (int i = 0; i < n; i++)
        {
            var line = Console.ReadLine();
            var words = line.Split(' ');
            long a = long.Parse(words[0]);
            long b = long.Parse(words[1]);
            works[i] = Tuple.Create(a, b, b - a);
        }

        works = works.OrderBy(w => w.Item2).ToArray();

        long current = 0;
        for (int i = 0; i < n; i++)
        {
            var work = works[i];
            current += work.Item1;
            if (current > work.Item2)
            {
                Console.WriteLine("No");
                return;
            }
        }

        Console.WriteLine("Yes");
    }
}

Measured memory_bytes: 36384
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 200005
#define il inline
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,n,a) for(int i=n;i>=a;i--)
#define  pi  acos(-1)
#define ld  double
#pragma GCC optimize(2)
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int main() {
    IOS
    ld r;
    cin>>r;
    printf("%.20f",2*pi*r);
    return 0;
}

Measured memory_bytes: 3796
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

template<class T> inline bool chmax(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; }

using ll = long long;

ll N;
ll a[100010];
ll mi = 1ll<<60, ma = 0;

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

  rep( i, N )
  {
    std::cin >> a[i];
    chmin( mi, a[i] );
    chmax( ma, a[i] );
  }

  ll cnt = 0;

  rep( i, N )
    cnt += a[i] == ma;

  ll A = cnt/2 + N-cnt;

  if( ma == mi && (mi == N-1 || mi == 1) )
  {
    std::cout << "Yes" << std::endl;

    return 0;
  }

  if( ma-mi > 1 || A != ma || cnt <= 1 )
  {
    std::cout << "No" << std::endl;

    return 0;
  }
  else
    std::cout << "Yes" << std::endl;

  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    double x = 0;
    double y = 0;
    int dir = 90;
    double PI = acos(-1.0);

    for(;;){
        int m, r;
        char c;
        cin >> m >> c >> r;
        if(m == 0)
            break;

        x += m * cos(dir * PI / 180);
        y += m * sin(dir * PI / 180);
        dir -= r;
    }

    cout << (int)x << endl << (int)y << endl;
}

Measured memory_bytes: 0
#include<stdio.h>
int main(){
  int a,b;
  scanf("%d %d",&a,&b);
  if(a<b){
    printf("a < b\n");
  }
  else if(a==b){
    printf("a == b\n");
  }
  else if(a>b){
    printf("a > b\n");
  }
    return (0);
}

Measured memory_bytes: 580
#include<bits/stdc++.h>
#define ll long long
#define mod (ll)1000000007
#define MAX 100005
using namespace std;
int n;
int h[MAX];
int dp[MAX];
int rec(int pos)
{
	if(pos >= n)
		return mod;

	if(pos == n-1)
		return 0;

	if(dp[pos] != -1)
		return dp[pos];

	dp[pos] = INT_MAX;
	if(pos+1 < n)
		dp[pos] = min(rec(pos+1)+abs(h[pos]-h[pos+1]),dp[pos]);

	if(pos+2 < n)
		dp[pos] = min(rec(pos+2)+abs(h[pos]-h[pos+2]),dp[pos]);

	return dp[pos];
}

int main()
{
	cin>>n;
	for(int i = 0; i < n; i++)
		cin>>h[i];
	memset(dp,-1,sizeof(dp));
	
	cout<<rec(0)<<"\n";
	return 0;
}

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

int main() {
  char c;
  cin >> c;
  
  if (c == 'a') {
    cout << "vowel" << endl;
  }
  
  else if (c == 'i') {
    cout << "vowel" << endl;
  }
  
  else if (c == 'u') {
    cout << "vowel" << endl;
  }
  
  else if (c == 'e') {
    cout << "vowel" << endl;
  }
  
  else if (c == 'o') {
    cout << "vowel" << endl;
  }
  
  else {
    cout << "consonant" << endl;
  }
}


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

int n, h[100005];
int dp[100005];
int jump(int i) {
	if (i >= n) return 0;
	if (dp[i] != -1) return dp[i];

	int p = abs(h[i] - h[i+1]) + jump(i+1);
	int q = n-i >= 2 ? abs(h[i]-h[i+2]) + jump(i+2) : INT_MAX;
	return dp[i]=min(p, q);
}

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

	cin >> n;
	for (int i = 1; i <= n; ++i) cin >> h[i];

	memset(dp, -1, sizeof dp);
	cout <<	jump(1) << endl;

    return 0;
}


Measured memory_bytes: 4224
words = lambda t : list(map(t, input().split()))
n = int(input())
xs = words(int)

ys = [0]*60
for x in xs:
    for i in range(60):
        if x == 0:
            continue
        ys[i] += x & 1
        x = x >> 1

ans = 0

for i,yi in enumerate(ys):
    ans += 2**(i) * yi * (n-yi)
    ans %= 10**9 + 7
print(ans)


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

using namespace std;

#define DUMP(x) std::cout << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++ i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define pb push_back

template<typename T> T DUP(T x, T y) { return (x + y - 1) / y; };
template <typename A, size_t N, typename T>
void arrayFill(A(&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using setint = unordered_set<int32_t>;
using setstr = unordered_set<string>;
using qint = queue<int32_t>;

constexpr std::int32_t INF = 1001001001;

vvint G;
int color[21000];

// 頂点を1と-1で塗っていく
bool dfs(int v, int c) {
    color[v] = c;   // 頂点vをcで塗る
    rep(i, G[v].size()) {
        // 隣接している頂点が同じ色ならfalse
        if (color[G[v][i]] == c) return false;
        // 隣接している頂点がまだ塗られていないなら-cで塗る
        if (color[G[v][i]] == 0 && !dfs(G[v][i], -c)) return false;
    }
    return true;
}

void Main() {
    int n;
    cin >> n;
    G.resize(n);
    rep(i, n) {
        string s;
        cin >> s;
        rep(j, n) {
            if (s[j] == '1') {
                G[i].push_back(j);
            }
        }
    }
    if (!dfs(0, 1)) {
        puts("-1");
        return;
    }

    int ans = 0;
    rep(i, n) {
        vint dist(n, -1);
        qint q;
        dist[i] = 0;
        q.push(i);

        while (!q.empty()) {
            int v = q.front(); q.pop();

            for (int nv : G[v]) {
                if (dist[nv] != -1)continue;

                dist[nv] = dist[v] + 1;
                ans = max(dist[nv], ans);
                q.push(nv);
            }
        }
    }
    cout << ans + 1 << endl;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <tuple>
#include <queue>
#include <cmath>
#include <cfloat>
#include <set>
#include <map>

// statics
using namespace std;
using int64 = int_fast64_t;
using PAIR = pair<int64, int64>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 3e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<endl;
#define zero(n) cout<<setfill('0')<<right<<setw(n)
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

signed main() {
  INIT;
	VAR(int, n);
	VAR(string, s, t);
	int ans = 2 * n;
	REP(si, s.size()){
		REP(ti, t.size()){
			if (s.substr(s.size()-si-1, si+1) == t.substr(0, ti+1)) {
				ans = min(ans, 2 * n - ti-1);
			}
		}
	}
	OUT(ans)BR;
  
  return 0;
}


Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    int[] a;
    foreach (_; 0..5) a ~= readint;
    int k = readint;

    // 両端の差が k 以下か調べるだけでよい
    bool ans = a[$-1] - a[0] <= k;
    writeln(ans ? "Yay!" : ":(");
}


Measured memory_bytes: 256
#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() {
  char c;
  cin >> c;
  cout << (char)(++c) << endl;
  return 0;
}

Measured memory_bytes: 3608
#include <stdio.h>

int main()
{
    long S;
    scanf("%ld", &S);
    
    long w = S;
    int h = (int)(w / (60 * 60));
    w = w % (60 * 60);
    int m = (int)(w / 60);
    w = w % 60;
    int s = (int)w;
    printf("%d:%d:%d\n", h, m, s);
    return 0;
}


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

int main() {
	ios_base::sync_with_stdio( false );

	string s;
	cin >> s;

	int a = 0;
	int z = s.size()-1;

	for( int i = 0; i <= z; ++i ) {
		if( s[i] == 'A' ) {
			a = i;
			break;
		}
	}

	for( int i = z; i >= a; --i ) {
		if( s[i] == 'Z' ) {
			z = i+1;
			break;
		}
	}

	cout << z-a << endl;
}


Measured memory_bytes: 720
import sys
input = sys.stdin.readline

K, Q = map(int, input().split())
D = list(map(int, input().split()))
Query = [list(map(int, input().split())) for _ in range(Q)]

for n, x, mod in Query:
    Td = []
    for d in D:
        Td.append(d%mod)
    Init = [0]
    zero_count = 0
    zero_tmp = 0
    for i, d in enumerate(Td):
        Init.append(Init[-1]+d)
        if d == 0:
            zero_count += 1
            if i < (n-1)%K:
                zero_tmp += 1
    c = Init.pop()
    last = x + c*((n-1)//K) + Init[(n-1)%K]
    over_count = last//mod - x//mod
    print((n-1)-over_count-zero_count*((n-1)//K)-zero_tmp)
        

Measured memory_bytes: 90716
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

int main() {
    int n,max=0;
    cin>>n;
    n=n*2;
    vector<int> vec(n);
    for (int i=0;i<n;i++){
        cin>>vec.at(i);
    }
    sort(vec.begin(),vec.end());
    for(int j=0;j<n;j+=2){
        max+=vec.at(j);
    }
        
    
    cout<<max<<"\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
map < int, int > a;
int n;
int main() {
    ios_base::sync_with_stdio(false);
    cin >> n;
    int x;
    int curans = 0;
    for (int i = 1; i <= n; i++) {
        cin >> x;
        a[x]++;
        if (a[x] == x) curans -= (x - 1);
        else if (a[x] > x) {
            curans++;
        }
        else if (a[x] < x) {
            curans++;
        }
    }
    cout << curans;
    return 0;
}


Measured memory_bytes: 4736
import java.util.Scanner;

public class Main {

	private static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int a = sc.nextInt(), b = sc.nextInt();
		if (a < 0 && b >= 0 || a == 0) {
			System.out.println("Zero");
		} else if (b < 0 && (b - a) % 2 != 0 || a > 0) {
			System.out.println("Positive");
		} else {
			System.out.println("Negative");
		}
	}
}

Measured memory_bytes: 21844
#include<iostream>
using namespace std;
int main(){
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	if(k<=a){
		cout<<k<<endl;
	}else if(k<=a+b){
		cout<<a<<endl;
	}else{
		cout<<a-(k-a-b)<<endl;
	}
	return 0;
}

Measured memory_bytes: 3612
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] a = new long[n + 1];
		for(int i = 1 ; i <= n ; i++) {
			a[i] = sc.nextLong();
		}
		boolean katteru = false;
		long sum = 1000;
		long kabusuu = 0;
		for(int i = 2 ; i <= n ; i++) {
			if(!katteru) {
				if(a[i] > a[i - 1] && sum >= a[i - 1]) {
					katteru = true;
					kabusuu = sum / a[i - 1];
					sum -= kabusuu * a[i - 1];
				}
			}
			else {
				if(a[i] < a[i - 1]) {
					katteru = false;
                  sum += kabusuu * a[i - 1];
					kabusuu = 0;
				}
			}
		}
		if(kabusuu != 0)
			sum += kabusuu * a[n];


		sc.close();
		System.out.println(sum);

	}
}



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

using namespace std;
const int N = 1e5 + 3, MOD = 1e9 + 7;
int n, a[N], b[N];
int main() {
#ifndef ONLINE_JUDGE
//	freopen("input.in", "r", stdin);
#endif
	scanf("%d", &n);
	for (int i = 1; i < n; ++i)
		scanf("%d", b + i);
	a[1] = b[1];
	a[2] = b[1];
	for (int i = 2; i < n; ++i) {
		if (b[i] < a[i])
			a[i] = b[i];
		a[i + 1] = b[i];
	}
	int res = 0;
	for (int i = 1; i <= n; ++i)
		res += a[i];
	printf("%d\n", res);
	return 0;
}


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

int main(void)
{
	char s[201];
	scanf("%s",s);
	int len=strlen(s);

	fprintf(stderr,"%s\nlen=%d\n",s,len);
	int ans=0,i;
	while(ans==0)
		{
		len-=2;
		{fprintf(stderr,"\n%d",len); }
		ans=len;
		for(i=0;i<=len/2-1;i++)
			{
			if(s[i]!=s[len/2+i])
				{ans=0; break;}
			}
		if(len<0){fprintf(stderr,"\nstop len<0\n"); break;}
		}
	printf("\n%d\n",ans);
	return 0;
}


Measured memory_bytes: 128
package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	A := strings.Repeat(strconv.Itoa(a), b)
	B := strings.Repeat(strconv.Itoa(b), a)

	if strings.Compare(A, B) == 1 {
		fmt.Println(B)
	} else {
		fmt.Println(A)
	}
}


Measured memory_bytes: 640
#include <cstdio>
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include <cmath>
#include <iomanip>
#include <regex>
#include <queue>
#include <set>
#include <cassert>
using namespace std;
using ll = long long;
using plong = pair<ll,ll>;

const long MOD = 1000000007;


int main(){
    ll N;
    cin>>N;
    vector<ll> A(N,0),B(N,0);
    map<ll,ll>mp;
    for(ll i=0;i<N;i++){
        ll a;
        cin>>a;
        A[i] = a;
        B[i] = a-i;
        mp[B[i]]++;
    }

    ll res=0;
    for(ll i=0;i<N;i++){
        ll a = B[i] - 2*A[i];
        res+=mp[a];
    }
    cout<<res<<endl;
    

}

Measured memory_bytes: 29076
N,K,Q = [int(x) for x in input().split()]
a = K-Q
ans = [a]*(N+1)
for i in range(Q):
  b = int(input())
  ans[b] += 1
for i in range(1,N+1):
  if ans[i]>0:
    print("Yes")
  else:
    print("No")

Measured memory_bytes: 6580
#include<bits/stdc++.h>
 
using namespace std;
const int maxn=1e5+500;
double b[maxn];
 
int main()
{
	int n;
	cin>>n;
	double h,a;
	cin>>h>>a;
	int flag=0;
	for(int i=0;i<n;i++){
		cin>>b[i];
		b[i]=h-b[i]*0.006;
		b[i]=fabs(b[i]-a);
	}
	cout<<(min_element(b,b+n)-b)+1;
} 

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	N, A, B := readInt(), readInt(), readInt()
	var Total, AllA int

	op := (N / (A + B)) + 1
	AllA = op * A
	Total = op*A + op*B
	Over := Total - N

	if Over <= B {
		fmt.Println(AllA)
	} else {
		fmt.Println(AllA - (Over - B))
	}
}

func readInt() int {
	var v int
	fmt.Scan(&v)
	return v
}

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

int main() {
    int n,m;
    cin >> n >> m ;
    int a[n][m];
    int b[m];
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
            cin >> a[i][j];
    for(int j=0;j<m;j++)
        cin >> b[j];
    int c=0;
    for(int i=0;i<n;i++){
        c=0;
        for(int j=0;j<m;j++){
            c=c+a[i][j]*b[j];
        }
        cout << c << endl;
    }
    return 0;
}


Measured memory_bytes: 3112
#coding: utf-8
N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
mod = 10**9 + 7
jun = [0 for _ in range(N)]
inv = [0 for _ in range(N)]
for i in range(N):
    for j in range(N):
        if j < i:
            if A[i] < A[j]:
                jun[i] += 1
        else:
            if A[i] < A[j]:
                inv[i] += 1
for i in range(N):
    ans += K * (jun[i] * (K+1) + inv[i] * (K-1)) // 2
    ans %= mod

print(ans)

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

int n, k;
vector<int> a;
const int M = 1e9 + 7;

int con(int x) {
    return x < 0 ? M + x : x;  
}

int main() {
    while (scanf("%d %d", &n, &k) == 2) {
        a.assign(n, 0);
        for (auto &x : a) scanf("%d", &x);
        sort(a.begin(), a.end(), [](const int &a, const int &b) -> bool {
            return abs(a) > abs(b);
        });
        
        int res = 1;
        if (k == n) for (int i = 0; i < k; i++) res = 1ll * res * con(a[i]) % M;
        else {
            int nNeg = 0;
            for (int i = 0; i < k; i++) nNeg += a[i] < 0;
            if (nNeg % 2 == 0) for (int i = 0; i < k; i++) res = 1ll * res * con(a[i]) % M;
            else {
                int hasNonNeg = 0;
                for (auto &x : a) hasNonNeg |= x >= 0;
                if (!hasNonNeg) for (int i = 0; i < k; i++) res = 1ll * res * con(a[n - 1 - i]) % M;
                else {
                    int lp = k - 1, rp = k, ln = k - 1, rn = k;
                    while (lp >= 0 && a[lp] < 0) lp--;
                    while (ln >= 0 && a[ln] > 0) ln--;
                    while (rp < n && a[rp] < 0) rp++;
                    while (rn < n && a[rn] > 0) rn++;

                    int l, r;
                    if (lp == -1 || rn == n) l = ln, r = rp;
                    else if (ln == -1 || rp == n) l = lp, r = rn;
                    else if (1ll * abs(a[rp]) * abs(a[lp]) > 1ll * abs(a[rn]) * abs(a[ln])) l = ln, r = rp;
                    else l = lp, r = rn;

                    res *= con(a[r]);
                    for (int i = 0; i < k; i++) {
                        if (i == l) continue;
                        res = 1ll * res * con(a[i]) % M;
                    }
                }
            }
        }
        printf("%d\n", res);
    }
}


Measured memory_bytes: 4044
#include <iostream>
#include <vector>
#include <string>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

int main(){

    int x1, y1, x2, y2,x3,y3,x4,y4;
    cin >> x1 >> y1 >> x2 >> y2;

    x3 = x2 - (y2 - y1);
    y3 = y2 + (x2 - x1);
    x4 = x3 - (x2 - x1);
    y4 = y3 - (y2 - y1);

    cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
    return 0;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int X,Y; cin>>X>>Y;
  int ans=X;
  if(X%Y==0)
    ans=-1;
  cout<<ans<<endl;
  }


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

using namespace std;
#define X first
#define Y second
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define debug(x) cerr << #x << " = " << (x) << endl;
template<typename T>
ostream& operator<<(ostream& o, vector<T>& v) {
    for (auto& x : v) o << x << ' ';
    return o;
}

string words[] = {"dream", "dreamer", "erase", "eraser"};
string str;
int n;
int memo[100100];
int f(int id){
    int &res = memo[id];
    if (res != -1) return res;
    if (id == n) return res = 1;
    res = 0;
    for (int k = 0; k < 4; k++){
        if (id + (int)words[k].size() <= n) {
            bool flag = true;
            for (int i = 0; i < (int)words[k].size(); i++)
                if (str[id + i] != words[k][i]) flag = false;
            if (flag) res |= f(id + (int)words[k].size());
        }
    }
    return res;
}

int main(){
    std::ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> str;
    n = (int)str.size();
    memset(memo, -1, sizeof memo);
    if (f(0)) cout << "YES" << endl;
    else cout << "NO" << endl;

}


Measured memory_bytes: 2256
/*
─────────────────────
───────────████████──
──────────███▄███████
──────────███████████
──────────███████████
──────────██████─────
──────────█████████──
█───────███████──────
██────████████████───
███──██████████──█───
███████████████──────
███████████████──────
─█████████████───────
──███████████────────
────████████─────────
─────███──██─────────
─────██────█─────────
─────█─────█─────────
─────██────██────────
─────────────────────
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define int long long
#define read(a) int a; cin >> a;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define reads(s) string s; cin >> s;
#define readarr(a, n) int a[(n) + 1] = {}; fori (i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; fori (i, 1, n) {fori (j, 1, m) cin >> a[i][j];}

#define print(a) cout << a << endl;
#define printarr(a, n) fori (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) fori (i, 1, n) {fori (j, 1, m) cout << a[i][j] << " "; cout << endl;}
#define all(v) v.begin(), v.end()
#define sz(s) (int)(s.size())
#define pb push_back
#define fi first
#define se second
#define rz resize
#define fori(i, a, b) for (int i = (a); i <= (b); i++)
#define ford(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
#define setprec(x) cout << fixed << setprecision(x);
 
using namespace std;
using namespace __gnu_pbds; 
 
typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair <int, int>> vpi;
typedef vector < vector <int> > vvi;
 
const int INF = 4e18;
const int mod = 1e9+7;

vector < vector <pii> > adj(2e5);
vi vis(2e5), color(2e5);

void bfs (int s)
{
    vis[s] = 1; 
    queue <int> q; q.push(1);

    while(!q.empty())
    {
        auto cur = q.front();
        q.pop();

        for (auto i : adj[cur])
        {
            int node = i.fi;
            int w = i.se;
            if(vis[node]) continue;

            if(w % 2) color[node] = !color[cur];
            else color[node] = color[cur];
            vis[node] = 1; q.push(node);
        }
    }
} 

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


    //start from here

    read(n) 
    int x, y, w;

    fori (i, 1, n-1)
    {
        cin >> x >> y >> w;
        adj[x].pb({y, w}); adj[y].pb({x, w});
    }

    bfs(1);

    fori (i, 1, n) print(color[i])

    return 0;
}


Measured memory_bytes: 13312
#include<bits/stdc++.h>
    #define int ll
    #define M 1000000007
    #define hell 998244353
    #define big 1e18
    #define pb push_back
    #define pi 3.1415926536
    #define mp make_pair
    #define ub upper_bound
    #define lb lower_bound
    #define mem0(a) memset(a,0,sizeof(a))
    #define memf(a) memset(a,false,sizeof(a))
    #define mem1(a) memset(a,1,sizeof(a))
    #define all(a) a.begin(),a.end()
    #define ll long long
    #define vec vector <int>
    #define pii pair<int,int>
    #define endl "\n"
    #define gcd __gcd
    using namespace std;
    int power(int x, unsigned int y, unsigned int m) 
	{ 
    	if (y == 0) 
        	return 1; 
    	int p = power(x, y/2, m) % m; 
    	p = (p * p) % m; 
  
 	   return (y%2 == 0)? p : (x * p) % m; 
	} 
	int modInverse(int a, int m) 
	{   
    	return power(a, m-2, m);
	}
    signed main()
    {
    	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    	ll t=1;
    	// cin >> t;
    	/*SAARE INPUTS LENA*/
    	/*VARIABLES KI RANGE DEKHLENA*/
    	while(t-->0)
    	{
    		ll k=0;
    		cin>>k;
    		string s;
    		cin>>s;
    		if(s.length()<=k)
    			cout<<s;
    		else
    			cout<<s.substr(0,k)<<"...";
    	}
    	return 0;
    }

Measured memory_bytes: 3660
#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;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = (ll)a;i < (ll)b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = (ll)b-1LL;i >= (ll)a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;
typedef long double ld;
typedef pair<ld,ld> pdd;

const ll INF=(1LL<<61);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  a=abs(a);
  b=abs(b);
  if(a==0)return b;
  if(b==0)return a;
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif
template<class T>
bool chmax(T& a,const T& b){
  if(a<b){
    a=b;
    return true;
  }
  return false;
}
template<class T>
bool chmin(T& a,const T& b){
  if(a>b){
    a=b;
    return true;
  }
  return false;
}
template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}


ll divide(ll x,ll y,ll w,ll D){
  if(x%y!=0){
    abort();
  }
  if(x/y*(y-1)>=w)return w;
  return min(x/y*(y-1)*D,w);
}
ll dd(ll x,ll y){
  return x/y+(x%y>0?1:0);
}
ll A,B,C,D;
map<ll,ll> cache;
ll solve(ll N){
  if(N==0)return 0;
  if(N==1)return D;
  if(cache.count(N)){
    return cache[N];
  }
  ll ret=N*D;
  if(ret<0)ret=LLONG_MAX;
  ret = min(ret,solve(N/2)+A+N%2*D);
  if(N%2)ret = min(ret,solve(N/2+1)+A+(2-N%2)*D);
  ret = min(ret,solve(N/3)+B+N%3*D);
  if(N%3)ret = min(ret,solve(N/3+1)+B+(3-N%3)*D);
  ret = min(ret,solve(N/5)+C+N%5*D);
  if(N%5)ret = min(ret,solve(N/5+1)+C+(5-N%5)*D);
  return cache[N]=ret;
}
int main(){
  cout<<setprecision(1000);
  ll T;
  cin>>T;
  For(times,T){
    ll N;
    cin>>N>>A>>B>>C>>D;
    cache.clear();
    cout<<solve(N)<<endl;
  }
  return 0;
}


Measured memory_bytes: 4408
#include <bits/stdc++.h>
class SegmentTreeUpdMin {
  int n;
  const int inf = 1000000000;
  std::vector<int> node;
public:
  SegmentTreeUpdMin(std::vector<int> v) {
    int sz = v.size();
    n = 1; while(n < sz) n *= 2;
    node.resize(2*n, inf);
    for(int i=0;i<sz;++i) node[i+n-1] = v[i];
    for(int i=n-2;i>=0;--i) node[i] = std::min(node[2*i+1], node[2*i+2]);
  }
  void update(int idx, int val) {
    assert(0 <= idx && idx < n);
    node[idx + n - 1] = val;
    while(idx > 0) {
      idx = (idx - 1) / 2;
      node[idx] = std::min(node[2*idx + 1], node[2*idx + 2]);
    }
  }
  int query(int a, int b, int k, int l, int r) {
    if(r <= a || b <= l) return inf;
    if(a <= l && r <= b) return node[k];
    int vl = query(a, b, k*2+1, l, (l+r)/2);
    int vr = query(a, b, k*2+2, (l+r)/2, r);
    return std::min(vl, vr);
  }
  int query(int a, int b) {
    return query(a, b, 0, 0, n);
  }
};
class SegmentTreeUpdMax {
    int n;
    const int inf = 1000000000;
    std::vector<int> node;
public:
    SegmentTreeUpdMax(std::vector<int> v) {
        int sz = v.size();
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n, -inf);
        for(int i=0;i<sz;++i) node[i+n-1] = v[i];
        for(int i=n-2;i>=0;--i) node[i] = std::max(node[2*i+1], node[2*i+2]);
    }
    void update(int idx, int val) {
        assert(0 <= idx && idx < n);
        node[idx + n - 1] = val;
        while(idx > 0) {
            idx = (idx - 1) / 2;
            node[idx] = std::max(node[2*idx + 1], node[2 * idx + 2]);
        }
    }
    int query(int a, int b, int k, int l, int r) {
        if(r <= a || b <= l) return -inf;
        if(a <= l && r <= b) return node[k];
        int vl = query(a, b, k*2+1, l, ((l+r)/2));
        int vr = query(a, b, k*2+2, (l+r)/2, r);
        return std::max(vl, vr);
    }
    int query(int a, int b) {
        return query(a, b, 0, 0, n);
    }
};
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int main() {
  cin.tie(0);
  cout << fixed << setprecision(10);
  int n, k; cin >> n >> k;
  vector<int> p(n);
  for(int i=0;i<n;++i) {
    cin >> p[i];
  }
  SegmentTreeUpdMax sgmax(p);
  SegmentTreeUpdMin sgmin(p);
  vector<int> up(n);
  for(int i=0;i<n-1;++i) {
    up[i+1] = up[i] + (p[i] > p[i+1]);
  }
  int ans = 1;
  bool incl = up[k-1] - up[0] == 0;
  for(int i=1;i<=n-k;++i) {
    int mi = sgmin.query(i-1, i+k);
    int ma = sgmax.query(i-1, i+k);
    if(!incl && up[i+k-1] - up[i] == 0) {
      incl = true;
      ans++;
      continue;
    } else if(up[i+k-1] - up[i] == 0) {
      continue;
    }
    if(mi != p[i-1] || ma != p[i+k-1]) {
      ans++;
    }
  }
  cout << ans << endl;
}


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

int main(void) {
  int N;
	cin >> N;
  int A[N];
  REP(i,N) { cin >> A[i]; }
  sort(A, A+N);
  
  int count = 0;
  ll sum = A[0];
  bool failed[N] = {};
  for(int i=1;i<N;i++) {
    if (A[i] > sum*2) failed[i-1] = true;
    sum += A[i];
  }
  int j = N-1;
  while(!failed[j] && j >= 0) {
    count++; j--;
  }
  cout << count << '\n';
}


Measured memory_bytes: 768
#!/usr/bin/env ruby
n = STDIN.readline().strip.to_i
cs = []
while (lines = STDIN.gets) do
  cs << lines.strip.split(' ').map(&:to_i)
end
cs[0][n], cs[1][n] = 0, 0
def make_max_path(cs, n)
  mp = [[], []]
  mp[0][n], mp[1][n] = 0, 0
  (n-1).downto(0) do |i|
    mp[1][i] = cs[1][i] + mp[1][i+1]
    mp[0][i] = cs[0][i] + [mp[0][i+1], mp[1][i]].max
 end
  mp
end
puts "#{make_max_path(cs, n)[0][0]}"


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

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<string> vs;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll MOD = 1e9+7;

ll fact(int n){
    ll ans = 1;
    for (int i = 1; i <= n; i++){
        ans = (ans * i)%MOD;
    }
    return ans;
}

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

    ll n, m;
    cin >> n >> m;

    if (abs(n - m) >= 2){
        cout << 0 << endl;
    } else {
        if (abs(n - m) == 1){
            cout << (fact(n) * fact(m)) % MOD << endl;
        } else {
            cout << (2 * fact(n) * fact(m)) % MOD << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    /* 変数宣言，ちゃんと初期化しよう */
    int N = 0;
    int ans = 0;
    
    /* 変数宣言終わり */
    
    /* 入力を受け付ける部分*/
    
    // %dはdecimalの略．つまり，入力を10進数として扱うよという意味．
    scanf("%d", &N);
    
    /* 入力を受け付ける部分終わり*/
    
    
    /* 何か処理*/
    ans = N;
    // if(ans % 111 == 0){
    // }else{
    // ans = ((ans-1) / 111 +1) *111;
    // }
    
    
    ans = ((ans-1) / 111 +1) *111;
    
    for(int i = 0; i < 10; i++){ 
      // i = 0,1,2,3,4,5,6,7,8,9のとき処理される
      
    }
    
    /* 何か処理終わり*/
    
    
    /* 出力する部分*/
 // %dの部分にansの値が表示される
    
    /* 出力する部分*/
    printf("%d",ans);
    
    
    return 0;
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s;
  cin >> s;
  
  for(int i = 0; i < 4; i++) cout << s.at(i);
  cout << " ";
  for(int i = 4; i < 12; i++) cout << s.at(i);
  cout << '\n';
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

static int D, N;

int solve();

int solve() {
  int x = 1;
  for (int i = 0; i < D; i++) {
    x *= 100;
  }
  if (N == 100) {
    x *= (N + 1);
  } else {
    x *= N;
  }
  return x;
}

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


Measured memory_bytes: 504
#include "algorithm"
#include "iostream"
#include "map"
#include "numeric"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define all(vec) vec.begin(), vec.end()
using namespace std;
typedef long long ll;

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

  ll N;
  cin >> N;

  vector<pair<string, ll>> ms(N);
  rep(i, N) {
    string t;
    ll s;
    cin >> t >> s;
    ms[i] = {t, s};
  }

  string X;
  cin >> X;

  ll sum = 0;
  bool ok = false;
  rep(i, N) {
    if (ok) sum += ms[i].second;
    if (ms[i].first == X) {
      ok = true;
    }
  }

  cout << sum << endl;
  return 0;
}


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

/*#define mod      1e9+7;
#define INF      1e9+9;
#define ps(x,y)  fixed<<setprecision(y)<<x
# define PI 3.14159265358979323846264338327950 L  */
typedef long long ll;
typedef unsigned long long ull;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	ll n,d;
	cin>>n>>d;
	d*=d;
	int count=0;
	for(int i=0;i<n;i++){
		ll val,x,y;
		cin>>x>>y;
		val=x*x+y*y;
		if(val<=d)
			count++;
	}
	cout<<count<<endl;
	return 0;
}


Measured memory_bytes: 3156
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();
		int C = sc.nextInt();
		int able = B/A;
		if(able > C) {
			System.out.println(C);
		}
		else {
			System.out.println(able);
		}
	}
}

Measured memory_bytes: 23892
#include <stdio.h>
#include <iostream>
// #include <math.h>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <map>

//#include <bits/stdc++.h>
using namespace std;
#define print(x) cout<<(x)<<endl
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long int
#define pb push_back

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if(a <= c && c <= b) print("Yes");
  else print("No");
}


Measured memory_bytes: 384
N = int(input())

ans = [0] * (N+1)
for a in range(1, 105):
  if a*a > N :
    break
  for b in range(1, 105):
    if a*a + b*b > N:
      break      
    for c in range(1, 105):
      if a*a + b*b + c*c + a*b + b*c + c*a > N:
        break
      ans[a*a + b*b + c*c + a*b + b*c + c*a] += 1

for i in range(1, N+1):
  print(ans[i])


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

int main(){
	int n, l, r;
	cin >> n;
	int ans = 0;
	for(int i = 1; i <= n; i ++) {
		cin >> l >> r;
		ans += (r-l+1);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(n);++i)
const int INF =1001001001;
using ll=long long;
using P = pair<int,int>;
using Graph =vector<string>;
Graph field;
queue<P> q;

int main() {
  string a;
  cin>>a;
  ll ab;
  ab=a.size();
  if(a[ab-1]=='s'){
    a=a+"es";
  }else{
    a=a+"s";
  }
  cout<<a<<endl;
}



Measured memory_bytes: 3604
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		scanner.close();
		
		for ( int i = 1; i <= n; ++i ) {
			int x = i;
			if ( x % 3 == 0 ) {
				System.out.print(" " + i);
			} else {
				for (; x != 0; x /= 10) {
					if ( x % 10 == 3 ) {
						System.out.print(" " +i);
						break;
					}
				}
			}
		}
		System.out.println();
	}
}



Measured memory_bytes: 28748
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string c;
	cin >> c;
	for(int i=0;i<c.size()-1;i++)
	{
		if(c[i]+'0' == c[i+1]+'0')
		{
			puts("Bad");
			return 0; 
		}
	}
	puts("Good");
	return 0;
} 


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;

typedef long long Int;
typedef pair<Int,Int> P;
#define print(x) cout<<(x)<<endl

#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10
#define MOD 1000000007


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

	for (int i = 0; i < b; i++) {
		if (a%b == c) {
			print("YES");
			return 0;
		}
		a += adder;

	}
	print("NO");




	return 0;
}

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

int main() {
    long long w, h, x, y;
    cin >> w >> h >> x >> y;
    cout << fixed << setprecision(9) << (w * h) / 2.0 << " ";
    if(w % 2 == 0 && h % 2 == 0 && x == w / 2 && y == h / 2)
    cout << 1;
    else
    cout << 0;
    return 0;
}

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

int a[1000001];

void bubble(int *a,int n,int count){
  int ans = count;
  for(int i = 1; i < n; i++){
    if(a[i] < a[i-1]){
      swap(a[i],a[i-1]); count++;
    }
  }
  if(ans != count) bubble(a,n,count);
  else if (ans == count){
    cout << ans << endl;
    return;
  }
}

int main(){
  while(1){
    int n;
    cin >> n; if(n == 0)break;

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

    int count = 0;
    bubble(a,n,count);

    }
    return 0;
}



Measured memory_bytes: 3084
#include <stdio.h>

int main(){
  int n,q,s[100000],t[50000],right,left,mid,count=0,i;
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&s[i]);
  scanf("%d",&q);
  for(i=0;i<q;i++) scanf("%d",&t[i]);
  for(i=0;i<q;i++){
    left=0;
    right=n;
    while(left<right){
      mid=(left+right)/2;
      if(s[mid]==t[i]){
	count++;
	break;
      }else if(t[i]<s[mid]) right=mid;
      else left=mid+1;
    }
  }
  printf("%d\n",count);
  return 0;
}
 



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

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

string M[110];
int main()
{
    int H, W;
    cin >> H >> W;
    REP(i, H)
    {
        cin >> M[i + 1];
    }
    REP(i, H + 2)
    {
        REP(j, W + 2)
        {
            if (i == 0 || i == H + 1 || j == 0 || j == W + 1)
                cout << "#";
            else
                cout << M[i][j - 1];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
def main():
    n = int(input())
    cards = list(map(int,input().split()))
    ruisekiwa = [0] + [0] * n

    for i in range(0,n):
        ruisekiwa[i+1] = ruisekiwa[i] + cards[i]
    #print(cards)
    #print(ruisekiwa)
    mn = 100000000000000000000000000
    for sunuke_take in range(1,n):
        #print()
        araiguma_take = n - sunuke_take
        sunuke_sum = ruisekiwa[sunuke_take] - ruisekiwa[0]
        araiguma_sum = ruisekiwa[n] - ruisekiwa[sunuke_take]
        mn = min(mn,abs(sunuke_sum-araiguma_sum))
        #print(sunuke_take,araiguma_take)
        #print(sunuke_sum,araiguma_sum)
    print(mn)




if __name__ == '__main__':
    main()


Measured memory_bytes: 24836
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
//#define DEBUG 
template<class T> inline bool chmax(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 T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
typedef long long ll;

  int next_combination(int sub) {
    int x = sub & -sub, y = sub + x;
    return (((sub & ~y) / x) >> 1) | y;
}
    bool is_prime(int n){
        bool flag=true;
        for (int i = 2; i*i <= n; i++)
        {
            if(n%i==0 && i>=2){
                flag=false;
                break;
            }
        }
        if(flag){
            return true;
        }
        else{
            return false;
        }
        
    }


 

int main() {
    int n;
    cin>>n;
    vector<int>v;
    for (int i = 2; i <=55555; i++)
    {
        if(is_prime(i)){
            v.push_back(i);
        }
    }
    sort(v.begin(),v.end());
#ifdef DEBUG
 cerr<<v.size()<<endl;
#endif // DEBUG 
    int cnt=0;
    for (int i = 0; i < v.size(); i++)
    {   if(v[i]%5==1){
        cout<<v[i]<<" ";
        cnt++;
        }
        if(cnt==n) break;

    }
    cout<<endl;
    //cout<<cnt<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T> inline T &chmin(T &x, const T &y){ return x = min(x, y); }
template <class T> inline T &chmax(T &x, const T &y){ return x = max(x, y); }
template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8

VV(int) input(int h, int w){
	VV(int) as;
	initvv(as, h, w);
	for(int i = 0; i < h; ++i)
	for(int j = 0; j < w; ++j){
		cin >> as[i][j];
	}
	return as;
}

void mainmain(){
	const int LIM = 162 * 162;
	const int cent = LIM / 2;
	typedef bitset<LIM> bs;

	int h, w;
	cin >> h >> w;
	VV(int) ia = input(h, w);
	VV(int) ib = input(h, w);

	VV(bs) dp;
	initvv(dp, h, w);
	for(int i = 0; i < h; ++i)
	for(int j = 0; j < w; ++j){
		auto &b = dp[i][j];
		int d = abs(ia[i][j] - ib[i][j]);
		if(i == 0 && j == 0){
			b.set(cent - d);
			b.set(cent + d);
		}
		else{
			if(i > 0){
				auto &c = dp[i - 1][j];
				b |= c >> d;
				b |= c << d;
			}
			if(j > 0){
				auto &c = dp[i][j - 1];
				b |= c >> d;
				b |= c << d;
			}
		}
	}

	int ans = INT_MAX;
	for(int i = 0; i < LIM; ++i){
		if(dp[h - 1][w - 1][i]){
			chmin(ans, abs(i - cent));
		}
	}
	cout << ans << endl;
}



}
int main() try{
//	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(...){
	throw;
}


Measured memory_bytes: 21376