akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i, n) for (i = 0; i < n; i++)
#define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define ll long long
#define si(x) scanf("%d", &x)
#define sl(x) scanf("%lld", &x)
#define ss(s) scanf("%s", s)
#define pi(x) printf("%d\n", x)
#define pl(x) printf("%lld\n", x)
#define ps(s) printf("%s\n", s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for (auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
int mpow(int base, int exp);
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e6, M = N;
//=======================

vi g[N];
int a[N];

int gcd(int a, int b)
{
	if (a == 0)
	{
		return b;
	}
	return gcd(b % a, a);
}

void solve()
{
	int i, j, k,g,n;
	cin >> n;
	set<int> s;
	for (i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	g=a[0];
	for (i = 0; i < n; i++)
	{
		g = gcd(g, a[i]);
	}
	if (g != 1)
	{
		cout << "not coprime" << endl;
		return;
	}
	for (j = 0; j < n; j++)
	{
		vector<int> prime_factors;
		for (i = 2; i * i<= a[j]; i++)
		{
			if (a[j] % i == 0)
			{
				prime_factors.pb(i);
				while(a[j]%i==0){
					a[j]/=i;
				}
			}
		}
		if(a[j]!=1){
			prime_factors.pb(a[j]);
		}
		for(auto factor:prime_factors){
			if(s.find(factor)!=s.end()){
				cout<<"setwise coprime"<<endl;
				return;
			}
			s.insert(factor);
		}		
	}
	cout<<"pairwise coprime"<<endl;
}

int main()
{
	ios_base::sync_with_stdio(0);
	int i, t = 1;
	//cin>>t;
	for (i = 1; i <= t; i++)
	{
		solve();
	}
	return 0;
}

int mpow(int base, int exp)
{
	base %= mod;
	int result = 1;
	while (exp > 0)
	{
		if (exp & 1)
			result = ((ll)result * base) % mod;
		base = ((ll)base * base) % mod;
		exp >>= 1;
	}
	return result;
}

void ipgraph(int n, int m)
{
	int i, u, v;
	while (m--)
	{
		cin >> u >> v;
		g[u - 1].pb(v - 1);
		g[v - 1].pb(u - 1);
	}
}

void dfs(int u, int par)
{
	for (int v : g[u])
	{
		if (v == par)
			continue;
		dfs(v, u);
	}
}


Measured memory_bytes: 77940
n = int(input())
p = list(map(int, input().split()))
c = 0

for i in range(n - 2):
    a = []
    a.append(p[i])
    a.append(p[i + 1])
    a.append(p[i + 2])
    a.sort()
    if p[i + 1] == a[1]:
        c += 1

print(c)


Measured memory_bytes: 3064
#include<vector>
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<string.h>
#define ll long long int
#define MOD 1000000007LL
using namespace std;
int par[1000000];//親
int fukasa[1000000];//深さ
//初期化
void init(int n){
    for(int i=0;i<n;i++){
        par[i]=i;
        fukasa[i]=0;
    }
}
//木の根を求める
int find(int x){
    if(par[x]==x){
        return x;
    }else{
        return par[x]=find(par[x]);
    }
}
//xとyの集合を併合
void unite(int x,int y){
    x=find(x);
    y=find(y);
    if(x==y){
        return;
    }
    if(fukasa[x]<fukasa[y]){
        par[x]=y;
    }else{
        par[y]=x;
        if(fukasa[x]==fukasa[y]){
            fukasa[x]++;
        }
    }
}
//xとyが同じ集合に属する?
bool same(int x,int y){
    return find(x)==find(y);
}
int main() {
    int n,k,l;
    cin>>n>>k>>l;
    init(n);
    for(int i=0;i<k;i++){
        int p,q;
        cin>>p>>q;
        p--;q--;
        unite(p,q);
    }
    int a[364364]={};
    for(int i=0;i<n;i++){
        a[i]=find(i);
    }
    init(n);
    for(int i=0;i<l;i++){
        int r,s;
        cin>>r>>s;
        r--;s--;
        unite(r,s);
    }
    int b[364364]={};
    for(int i=0;i<n;i++){
        b[i]=find(i);
    }
    map<pair<int,int>,int> m;
    for(int i=0;i<n;i++){
        pair<int,int> p={a[i],b[i]};
        m[p]++;
    }
    for(int i=0;i<n;i++){
         pair<int,int> p={a[i],b[i]};
         cout<<m[p];
         if(i!=n-1){
             cout<<" ";
         }
    }
    cout<<endl;
}


Measured memory_bytes: 19840
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long n, ans=0, a[200001], i, search=1;
    cin >> n ;
    for(i=0;i<n;i++){
        cin >> a[i];
    }
    for(i=0;i<n;i++){
        if(a[i]==search) search++;
        else ans++;
    }
    if(search==1) cout << -1 <<endl;
    else cout << ans <<endl;
    return 0;
}

Measured memory_bytes: 1792
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long x = sc.nextLong();
        long sum = 0, time = 0;
        for(int t = 1; ; t++) {
            sum += t;
            if(sum >= x) {
                time = t;
                break;
            }
        }
        System.out.println(time);
    }

}


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

/* メモリ食い過ぎ注意 */
#define int long long

typedef long long ll;

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

signed main()
{
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;

    int x3 = (x1 - x2) * 0 + (y1 - y2) * (1) + x2;
    int y3 = (x1 - x2) * -1 + (y1 - y2) * 0 + y2;
    int x4 = (x2 - x1) * 0 + (y2 - y1) * -1 + x1;
    int y4 = (x2 - x1) * 1 + (y2 - y1) * 0 + y1;
    cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
}


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

int main (void){

	int number=0;
	int i=0;
	int j=0;
	int input_first[200]={0};
	int input_second[200]={0};
	int input_third[200]={0};
	int check_num=0;
	int result[200]={0};
	int count=0;


	scanf("%d", &number);
	while(i < number){
		
		scanf("%d",&input_first[i]);
		scanf("%d",&input_second[i]);
		scanf("%d",&input_third[i]);
		i++;

	}

	i=0;
	while(i < number){
		j=0;
			check_num = input_first[i];
			while(j < number){	
				if( i == j){
					j++;
					if(j == number){
						result[i] += input_first[i];
						break;
					}
					continue;
				}
				if(check_num == input_first[j]){
					break;
				}
				j++;
				if(j == number){
					result[i] += input_first[i];
					break;
				}
			}

			check_num = input_second[i];
			j=0;
			while(j < number){
				if( i == j){
					j++;
					if(j == number){
						result[i] += input_second[i];
						break;
					}
					continue;
				}
				if(check_num == input_second[j]){
					break;
				}
				j++;
				if(j == number){
					result[i] += input_second[i];
					break;
				}
			}

			check_num = input_third[i];
			j=0;
			while(j < number){
				if( i == j){
					j++;
					if(j == number){
						result[i] += input_third[i];
						break;
					}
					continue;
				}
				if(check_num == input_third[j]){
					break;
				}
				j++;
				if(j == number){
					result[i] += input_third[i];
					break;
				}
			}
	i++;
	}


	for ( i=0; i < number; i++){
		printf("%d\n",result[i] );
	}




	return 0;
}

Measured memory_bytes: 600
x,k,d = list(map(int,input().split()))
x = abs(x)
minA = x%d
minB = -1 * (minA-d)
step = x//d
if k <= step:
    print(x - d*k)
else:
    if (k-step)%2 == 0:
        print(minA)
    else:
        print(minB)

Measured memory_bytes: 9200
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define min(a,b) (a < b ? a : b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001

int main(void) {
  int N, K;
  scanf("%d %d", &N, &K);
  int x[MAX];
  rep(i, 0, N) scanf("%d", &x[i]);

  int ans = 2000000001;
  rep(xi, K - 1, N) {
    int right = xi;
    int left = xi - K + 1;
    ans = min(ans, x[right] - x[left] + min(abs(x[right]), abs(x[left])));
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;
 
vi adj[100001];
int out[100001];
int in[100001];
vi type[100001];
int color[100001];
bool used2 = false;
int cnt = 0;
int c[3];
ll mm = 0;
ll tote = 0;
bool dfs(int u, int col)
{
	used2|=(in[u]&&out[u]);
	cnt++; c[col]++;
	color[u] = col;
	bool res = 1;
	mm += out[u];
	tote++;
	for(int i = 0; i < adj[u].size(); i++)
	{
		int v = adj[u][i];
		int nw = (col+type[u][i])%3;
		if(color[v] == -1)
		{
			res&=dfs(v, nw);
		}
		else
		{
			if(color[v] != nw) res=false;
		}
	}
	return res;
}
 
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n, m; cin>>n>>m;
	for(int i = 0; i < m; i++)
	{
		int u, v; cin>>u>>v; u--; v--;
		adj[u].pb(v); adj[v].pb(u);
		type[u].pb(1); type[v].pb(2);
		out[u]++; in[v]++;
	}
	memset(color,-1,sizeof(color));
	ll res = 0;
	for(int i = 0; i < n; i++)
	{
		if(color[i] == -1)
		{
			used2 = false; cnt = 0;
			memset(c,0,sizeof(c));
			mm = 0; tote = 0;
			bool ans=dfs(i, 0);
			//cerr<<c[0]<<' '<<c[1]<<' '<<c[2]<<' '<<mm<<'\n';
			if(ans)
			{
				if(used2)
				{
					for(int j = 0; j < 3; j++)
					{
						res += ll(c[j])*ll(c[(j+1)%3]);
					}
				}
				else
				{
					res += mm;
				}
			}
			else
			{	
				res += ll(tote)*ll(tote);
			}
		}
	}
	cout<<res<<'\n';
}


Measured memory_bytes: 18560
import sys
from operator import mul
def 解():
    input = sys.stdin.readline
    iN = int(input())
    aA = sorted([int(_) for _ in input().split()])
    aB = sorted([int(_) for _ in input().split()])
    aC = sorted([int(_) for _ in input().split()])

    aBA =[0]*iN
    aBC = [0]*iN

    iIndex = iN-1
    for i in range(iN-1,-1,-1):
        iB = aB[i]
        while aA[iIndex] >= iB:
            iIndex -= 1
            if iIndex < 0:
                break
        if iIndex >= 0 :
            aBA[i] = iIndex + 1
        else:
            break
    iBstart = 0
    if aC[0] > aB[0]:
        for iBstart in range(iN):
            if aB[iBstart] >= aC[0]:
                break
            else:
                aBC[iBstart] = iN
    iIndex = 0
    for i in range(iBstart,iN):
        iB = aB[i]
        while aC[iIndex] <= iB:
            iIndex += 1
            if iN <= iIndex :
                break
        if iIndex < iN  :
            aBC[i] = iN - iIndex
        else:
            break
    print(sum(map(mul,aBA,aBC)))
解()


Measured memory_bytes: 24116
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <cstdlib>
#include <cmath>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

int main(){
    double n;
    cin >> n;
    double num=n/3;
    double ans=pow(num,3);
    printf("%.10f\n",ans);
    return 0;
}


Measured memory_bytes: 256
/*HOME - Volume2 - 0217 Walking in the Hospital*/
#include<stdio.h>
int main(void)
{
	int n;
	int i,s,p,d1,d2,d,max;
	1<=n && n<=10000;
	1<=p && p<=10000;
	0<=d1 && d1<=5000;
	0<=d2 && d2<=5000;
	scanf("%d",&n);
	while(n!=0) {
		max=0;
		for(i=1;i<=n;i++) {
			scanf("%d %d %d",&p,&d1,&d2);
			d=d1+d2;
			if(d > max) {
				max=d;
				s=p;
			}
		}
		printf("%d %d\n",s,max);
	scanf("%d",&n);
	}
	return 0;
}

Measured memory_bytes: 600
n = int(input())
s = [str(input()) for i in range(n)]
t = [s[0]]
alpha = s[0][-1]
a = True
for i in range(n-1):
    if s[i+1] not in t and alpha == s[i+1][0]:
        t.append(s[i+1])
        alpha = s[i+1][-1]
    else:
        a = False
        break

if a:
    print("Yes")
else:
    print("No")

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

Measured memory_bytes: 128
package main

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

func main() {
	n := getInt()
	d := getInt()

	xs := make([][]int, n)
	for i := range xs {
		xs[i] = make([]int, d)
		for j := range xs[i] {
			xs[i][j] = getInt()
		}
	}

	ans := 0
	for i := 0; i < n-1; i++ {
		for j := i + 1; j <= n-1; j++ {
			distSquare := 0
			for k := 0; k < d; k++ {
				distSquare += (xs[i][k] - xs[j][k]) * (xs[i][k] - xs[j][k])
			}

			dist := int(math.Floor(math.Sqrt(float64(distSquare))))
			if dist*dist == distSquare {
				ans++
			}
		}
	}

	fmt.Println(ans)
}

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

var scanner = wordScanner()

func wordScanner() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}

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

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


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long m = sc.nextLong();
		if(2 * n <= m) {
			System.out.println(n + (m - n * 2) / 4);
		} else {
			System.out.println(m / 2);
		}
	}
}


Measured memory_bytes: 21844
#include<stdio.h>
#define M 100000
#define NIL -1

typedef struct Node{
  int parent;
  int leaf;
  int root;
} Node;

Node T[M];
Node d[M];
int n;

int depth(int);
void print(int); 
int main(){
  int i;
  int j;
  int n;
  int id;
  int k;
  int c;
  int m;
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    T[i].parent = NIL;
    T[i].leaf = NIL;
    T[i].root = NIL;
  }

  for(i=0;i<n;i++){
    scanf(" %d %d",&id,&k);
    for(j=0;j<k;j++){
      scanf("%d",&c);
      T[c].parent = id;
      if(j == 0) T[id].leaf = c;
      else T[m].root = c;
      m = c;
    }
  }

  for(i=0;i<n;i++){
    printf("node %d: parent = %d, depth = %d, ",i,T[i].parent,depth(i));
    if(T[i].parent == NIL) printf("root, [");
    else if(T[i].leaf == NIL) printf("leaf, [");
    else printf("internal node, [");
    print(T[i].leaf);
    printf("]\n");
  }
  return 0;
}

int depth(int x){
  int y;
  if(T[x].parent == NIL) return 0;
  else{
    y = depth(T[x].parent) + 1;
    return y;
  }
}

void print(int x){
  if(x == NIL) return;
  else{
    if(T[x].root == NIL) printf("%d",x);
    else{
      printf("%d, ",x);
      print(T[x].root);
    }
  }
}



Measured memory_bytes: 3028
#include <bits/stdc++.h>
#include <math.h>
#define ll long long
using namespace std;

int main(){
    ll n,m,ans=0;
    cin>>n>>m;
    vector<pair<ll,ll>> pr(n);
    for (int i = 0; i < n; ++i) {
        ll price,ma;
        cin>>price>>ma;
        pr[i]=make_pair(price,ma);
    }
    sort(pr.begin(),pr.end());
    int now=0;
    while(m>0){
        if(pr[now].second>m)ans+=pr[now].first*m;
        else ans+=pr[now].first*pr[now].second;
        m-=pr[now].second;
        now++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll fact[100005];

ll extgcd(ll a,ll b,ll& x,ll& y){
	ll d=a;
	if(b!=0LL){
		d=extgcd(b,a%b,y,x);
		y-=(a/b)*x;
	}else{
		x=1;
		y=0;
	}
	return d;
}

ll mod_inverse(ll a,ll m){
	ll x,y;
	extgcd(a,m,x,y);
	return (m+x%m)%m;
}

ll mod_fact(ll n,ll p,ll& e){
	e=0;
	if(n==0)return 1;
	ll res=mod_fact(n/p,p,e);
	e+=n/p;
	if(n/p%2!=0){
		return res*(p-fact[n%p])%p;
	}
	return res*fact[n%p]%p;
}

ll mod_comb(ll n,ll k,ll p){
	if(n<0 || k<0 || n<k)return 0;
	ll e1,e2,e3;
	ll a1=mod_fact(n,p,e1),a2=mod_fact(k,p,e2),a3=mod_fact(n-k,p,e3);
	if(e1>e2+e3)return 0;
	return a1*mod_inverse(a2*a3%p,p)%p;
}

int n,k;
vector<int> G[100005];
ll ans=1;

void dfs(int v,int p){
	if(p==-1){
		ans=k;
		if(G[v].size()>=k){
			ans=0;
		}else{
			ll val=fact[k-1]*mod_inverse(fact[k-1-G[v].size()],MOD)%MOD;
			ans=ans*val%MOD;
		}
	}else{
		if(G[v].size()>=k){
			ans=0;
		}else{
			ll val=fact[k-2]*mod_inverse(fact[k-2-(G[v].size()-1)],MOD)%MOD;
			ans=ans*val%MOD;
		}
	}
	for(int i=0;i<G[v].size();i++){
		if(G[v][i]!=p){
			dfs(G[v][i],v);
		}
	}
}

int main(void){
	fact[0]=1;
	for(ll i=1;i<=100000;i++){
		fact[i]=fact[i-1]*i%MOD;
	}
	scanf("%d%d",&n,&k);
	for(int i=0;i<n-1;i++){
		int a,b;
		scanf("%d%d",&a,&b);
		a--;
		b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	dfs(0,-1);
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 12416
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class ALucky7 {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      string s; cin >> s;
      rep(i, 3) {
        if (s[i] == '7') {
          cout << "Yes" << endl;
          return;
        }
      }
      cout << "No" << endl;
    }
};

signed main() {
  ALucky7 solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 3656
# -*- coding: utf-8 -*-

import numpy as np

EDPC = "https://atcoder.jp/contests/dp/"
TDPC = "https://atcoder.jp/contests/tdpc/tasks"

################ DANGER ################
test = ""
#test = \
"""
5 3
10 30 40 50 20
ans 30
0 20 30 40 30
"""

"""
3 1
10 20 10
ans 20
"""

"""
2 100
10 10
ans 0
"""

"""
10 4
40 10 20 70 80 10 20 70 80 60
ans 40
0 30 20 30 40 30 20 30 40 40
"""
########################################
test = list(reversed(test.strip().splitlines()))
if test:
    def input2():
        return test.pop()
else:
    def input2():
        return input()
########################################  

n, k = map(int, input2().split())
a = list(map(int, input2().split()))
k = min(n-1, k)

def main(n, k, a):
    aa = np.concatenate([a])
    dp = np.concatenate([np.abs(aa - aa[0])[:k+1], 
                                np.zeros(n-k-1, dtype="int")])
    for i in range(k+1, n):
        dp[i] = np.min(dp[i-k:i] + np.abs(aa[i-k:i] - aa[i]))
    
    return dp[-1]


if __name__ == "__main__":
    print(main(n, k, a))


Measured memory_bytes: 22836
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N = 105;

int n, x, ans = 0;
int l[N];

int32_t main()
{
	IOS;
	cin >> n >> x;
	int d = 0;
	ans++;
	for(int i = 1; i <= n; i++)
	{
		cin >> l[i];
		d += l[i];
		if(d <= x)
			ans++;
	}
	cout << ans;
	return 0;
}

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

int main(void)
{
  int a,b;
  
  while(1){
    cin>>a>>b;
    if(a==0&&b==0)
    break;
    if(a<b){
      cout<<a<<" "<<b<<endl;
    }else{
      cout<<b<<" "<<a<<endl;
    }
  }
  return 0;
}



Measured memory_bytes: 2984
#include <iostream>
#include <string>
#include <stack>
using namespace std;

int main(){
	string s;
	while(getline(cin, s), s != ".") {
    stack<char> st;
    st.push('$');
    bool valid = true;
    for (int i = 0; i < s.size() && valid; i++) {
      if (s[i] == '(' || s[i] == '[') {
        st.push(s[i]);
      } else if (s[i] == ')') {
        valid = st.top() == '(';
        st.pop();
      } else if (s[i] == ']') {
        valid = st.top() == '[';
        st.pop();
      }
    }
    valid = valid && st.top() == '$';
    
    cout << (valid ? "yes" : "no") << endl;
    }
    return 0;
}

Measured memory_bytes: 900
#include <bits/stdc++.h>
using namespace std;
int main(){
  int H, N, x;
  int t=0;
  cin >> H >> N;
  
  for (int i=0; i<N; i++) {
    cin >> x;
    t += x;
  }
  if (H<=t) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long 
#define inf 1e17
#define f(i,a,b) for(ll i=a;i<b;i++)
//ll m = 1e9+7;
using namespace std;
//cout<<setprecision(9)<<m/(1<<q);
//__builtin_popcount();
//next_permutation(abc.begin(), abc.end());
//(string(n, abc[0]);
//str.find(s);
//ll a[1000001];
ll umax(ll a,ll b)
{
  if(a>b)
    return a;return b;
}
/*string toBinary(ll n)
{
    string r;
    while(n!=0) {r=(n%2==0 ?"0":"1")+r; n/=2;}
    return r;
}*/
int main()
{
	ll n;cin >> n;ll ans =0;
	ll a[n+1];ll b[n];
	f(i,0,n+1)cin >> a[i];
	f(i,0,n)cin >> b[i];
	f(i,0,n)
	{
		if(a[i]>=b[i])
		{
			a[i]-=b[i];ans+=b[i];
		}
		else
		{
			b[i]-=a[i];
			ans+=(a[i]+a[i+1]);
			a[i+1]=umax(0,a[i+1]-b[i]);
			ans-=a[i+1];
		}
	}
	cout << ans;

	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define time_taken_start int begtime = clock();
#define time_taken_end int endtime = clock(); \
cerr << "\n\n" << "Time elapsed: " << \
(endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
return 0;
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod 998244353
#define inf 100000000000000007
#define eps 0.000000000001
#define pi acosl(-1)
#define pdd pair<ld,ld>
#define pll pair<ll,ll>
#define ff first
#define ss second
#define vpl vector<pll>
#define vll vector<ll>
#define mseti multiset <ll>
#define msetd multiset <ll,greater<ll>>
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound 
#define stp fixed<<setprecision(20)
#define endl '\n'
ll tree[1000009];
bool t[200009],t1[200009];
void update(ll v,ll tl,ll tr,ll pos,ll val)
{
    if(tl==tr)
        tree[v]=min(tree[v],val);
    else
    {
        ll tm=(tl+tr)/2;
        if (pos<=tm)
            update((2*v),tl,tm,pos,val);
        else
            update((2*v)+1,tm+1,tr,pos,val);
        tree[v]=min(tree[(2*v)],tree[(2*v)+1]);
    }
}
ll query(ll v,ll tl,ll tr,ll l,ll r)
{
    if (l>r) 
        return inf;
    if((l==tl)&&(r==tr))
        return tree[v];
    ll tm=(tl+tr)/2;
    return min(query(2*v,tl,tm,l,min(r,tm)),query((2*v)+1,tm+1,tr,max(l,tm+1),r));
}
ll tree1[1000009];
void update1(ll v,ll tl,ll tr,ll pos,ll val)
{
    if(tl==tr)
        tree1[v]=min(tree1[v],val);
    else
    {
        ll tm=(tl+tr)/2;
        if (pos<=tm)
            update1((2*v),tl,tm,pos,val);
        else
            update1((2*v)+1,tm+1,tr,pos,val);
        tree1[v]=min(tree1[(2*v)],tree1[(2*v)+1]);
    }
}
ll query1(ll v,ll tl,ll tr,ll l,ll r)
{
    if (l>r) 
        return inf;
    if((l==tl)&&(r==tr))
        return tree1[v];
    ll tm=(tl+tr)/2;
    return min(query1(2*v,tl,tm,l,min(r,tm)),query1((2*v)+1,tm+1,tr,max(l,tm+1),r));
}
void solve()
{
	ll n;
	cin>>n;
	ll cnt=(n-2)*(n-2);
	ll x,y;
	for(ll i=0;i<=1000000;i++)
	{
		tree[i]=n;
		tree1[i]=n;
	}
	ll q;
	cin>>q;
	for(ll i=0;i<q;i++)
	{
		cin>>x>>y;
		if(x==1)
		{
			if(t[y]==1)
				continue;
			t[y]=1;
			ll q=query1(1,1,n,y,n);
			cnt-=q-2;
			update(1,1,n,q,y);
			//cout<<x<<' '<<q<<' '<<y<<' '<<endl;
		}
		else
		{
			if(t1[y]==1)
				continue;
			t1[y]=1;
			ll q=query(1,1,n,y,n);
			cnt-=q-2;
			update1(1,1,n,q,y);
			//cout<<x<<' '<<q<<' '<<y<<' '<<endl;
		}
	}
	cout<<cnt<<endl;
}
int main()
{
    FAST
    #ifdef ayk_16
    freopen("input.txt","rt",stdin);
    freopen("output.txt","wt",stdout);
    #endif
    time_taken_start
    ll t=1;
    //cin>>t;
    for(ll i=0;i<t;i++)
    {
        //cout<<"Case #"<<i+1<<": ";
        solve();
    }
    time_taken_end
}

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


#define lld long long 
//lld a[1000000][4];

lld max(lld x,lld y)
{
	if(x>y)
		return x;
	return y;
}		
lld min(lld x,lld y)
{

	if(x<y)
		return x;
	return y;
}




void solve()
{
	lld n;
	cin>>n;
	lld a[n+1][4];
	memset(a,0,sizeof(a));
	lld dp[n+1][4];
	memset(dp,0,sizeof(dp));
	for(lld i=1;i<=n;i++)
	{
		for(lld j=1;j<=3;j++)
		{

			cin>>a[i][j];
		}
	}
	for(lld i=1;i<=n;i++)
	{
		for(lld j=1;j<=3;j++)
		{
			for(lld k=1;k<=3;k++)
			{
				if(k==j)
					continue;
				else
				{
					if((a[i][j]+dp[i-1][k]) > dp[i][j])
					{
						dp[i][j]=a[i][j]+dp[i-1][k];
					}
				}
			}
		}
	}
	cout<<max(dp[n][1],max(dp[n][2],dp[n][3]))<<"\n";
}
	
	



int main()
{
	solve();
}

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

int main() {
  long long int N, K;
  cin >> N >> K;
  if (K % 2 == 1) {
    cout << (N / K) * (N / K) * (N / K) << endl;
  }
  else {
    long long int X = N / K;
    long long int Y = N / (K / 2) - N / K;
    cout << X * X * X + Y * Y * Y << endl;
  }
}

Measured memory_bytes: 256
package main

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

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

func main() {
	/*/TODO:!!!!!!!テスト用!!!!!!!!!
	sc = bufio.NewScanner(strings.NewReader(`

										`))
	//TODO:!!!!!!!テスト用!!!!!!!!!*/

	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!caution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */
	//fmt.Fprintln(out, "[DEBUG]", time.Now())

	n := nextInt()
	b := nextInts(n)

	var f func([]int) bool
	f = func(b []int) bool {
		if len(b) == 0 {
			return true
		}
		for i := len(b) - 1; i >= 0; i-- {
			if b[i] == i+1 {
				nb := append([]int{}, b[:i]...)
				nb = append(nb, b[i+1:]...)
				r := f(nb)
				if r {
					ans := b[i]
					fmt.Fprintln(out, ans)
					return r
				}
				break
			}
		}
		return false
	}
	if !f(b) {
		ans := -1
		fmt.Fprintln(out, ans)
	}

	//fmt.Fprintln(out, "[DEBUG]", a)
	//fmt.Fprintln(out, ans)
}

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

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func chars(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}

func absInt(x int) int {
	return int(math.Abs(float64(x)))
}
func minInt(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func maxInt(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func log10(x int) float64 {
	return math.Log10(float64(x))
}


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

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

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod 1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> v(h);
  int ans[h][w] = {};
  rep(i, 0, h) cin >> v[i];

  rep(i, 0, h) {
    rep(j, 0, w) {
      if(v[i][j] == '#') {
        if(i > 0) ans[i - 1][j]++;
        if(j > 0) ans[i][j - 1]++;
        if(j > 0 && i > 0) ans[i - 1][j - 1]++;
        if(i < h - 1) ans[i + 1][j]++;
        if(j < w - 1) ans[i][j + 1]++;
        if(i < h - 1 && j < w - 1) ans[i + 1][j + 1]++;
        if(i > 0 && j < w - 1) ans[i - 1][j + 1]++;
        if(j > 0 && i < h - 1) ans[i + 1][j - 1]++;
      }
    }
  }

  rep(i, 0, h) {
    rep(j, 0, w) {
      if(v[i][j] == '#') cout << '#';
      else cout << ans[i][j];
    }
    cout << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>

int main(int argc, char const* argv[])
{
    std::string in_str;
    std::cin >> in_str;

    bool find_a = false;
    bool find_b = false;
    bool find_c = false;
    for(auto c: in_str)
    {
        if (c == 'a')
        {
            find_a = true;
        }
        if( c == 'b' )
        {
            find_b = true;
        }
        if (c == 'c')
        {
            find_c = true;
        }
    }
    if( find_a && find_b && find_c )
    {
        std::cout << "Yes" << std::endl;
    }
    else
    {
        std::cout << "No" << std::endl;
    }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long N = sc.nextLong();
    long A = sc.nextLong();
    long B = sc.nextLong();
    long ans = 0;
    if(N == 1) {
      if(A == B) ans = 1;
    } else {
      if(A <= B) ans = A + (N - 1) * B - ((N - 1) * A + B - 1); 
    }
    System.out.println(ans);
  }
}

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

ll i,j,z;
static ll C,N,K,H,W,M;
ll A[1000][1000];
ll B[1000];
ll ans=0;
string S,T;

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

	for(i=0;i<M;i++){
		cin>>B[i];
	}

	for(i=0;i<N;i++){
		for(j=0;j<M;j++){
			cin>>A[i][j];
		}
	}

	for(i=0;i<N;i++){
		for(j=0;j<M;j++){
			K+=A[i][j]*B[j];
		}
		K+=C;
		if(K>0) ans++;
		K=0;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define REV(x) reverse(ALL(x))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ld = long double;
using ll = long long;
using ui = unsigned int;
using ull = unsigned long long;
using Pi_i = pair<int, int>;
using Pll_ll = pair<ll, ll>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;
using VULL = vector<ull>;

const int MOD = 1000000007;
const int INF = 1000000000;
const int NIL = -1;
const double EPS = 1E-10;

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


int main(){
    int N; cin >> N;
    map<int, int> mp;
    VI A(N);
    REP(i, N){
        cin >> A[i];
        ++mp[A[i]];
    }
    ll sum(0);
    for(auto itr = mp.begin(); itr != mp.end(); ++itr){
        ll n = itr->second;
        sum += n * (n - 1) / 2;
    }
    REP(i, N){
        ll a = mp[A[i]];
        cout << sum - a*(a-1)/2 + (a-1)*(a-2)/2 << "\n";
    }
    return 0;
}


Measured memory_bytes: 8320
import java.util.*;
public class Main {
	
	static int mod = (int)1e9+7;
	
	public static void main(String[] args) {		
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Integer A[] = new Integer[N];
		for(int i=0;i<N;i++)A[i]=sc.nextInt();
		sc.close();
		
		Integer B[] = A.clone();
		Arrays.sort(A,(a1,a2)->a2-a1);
		int max = A[0];
		int max2 = A[1];
		
		StringBuilder sb = new StringBuilder();
		for(int i=0;i<N;i++) {
			int tmax = max;
			if(B[i]==max) tmax = max2;
			sb.append(tmax + "\n");
		}
		System.out.println(sb.toString());
	}
}

Measured memory_bytes: 96648
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def exit(*argv, **kwarg):
    print(*argv, **kwarg)
    sys.exit()


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと


def a_int(): return int(read())


def ints(): return list(map(int, read().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_matrix(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter, xor, add
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right
from functools import reduce

X, K, D = ints()
# 全部正からスタートで考えてok
if X < 0:
    X = -X

# 反復横跳びしない場合
if X >= K * D:
    exit(X - K * D)

# 反復横跳びする場合
XX = X % D  # 一番0に近い右側
K -= X // D  # 残りの回数
# print(XX, K)

print(XX if K & 1 == 0 else -(XX - D))


Measured memory_bytes: 67972
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll> ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define tr1(x) cerr << #x << ": " << x << endl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define tr4(x,y,z,w) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#w<<": "<<w<<endl
#define trv(a) cerr<<#a<<": ";for(ll zz=0;zz<a.size();zz++) cerr<<a[zz]<<" ";cerr<<endl
#define trset(s) cerr<<#s<<": ";for(auto &i:s) cerr<<i<<" ";cerr<<"\n"
#define mod 1000000007ll
#define inf 9999999999999999ll
#define nl endl
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m;
    cin>>n>>m;
    cout<<n*(n-1)/2 + m*(m-1)/2<<nl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long 
using namespace std;
signed main(){
  int n,b=0;
  cin>>n;
  for(int i=1;i<10;i++){
    for(int j=1;j<10;j++){
      if(i*j==n){
	b++;
      }
    }
  }
  if(b!=0){
    cout<<"Yes\n";
  }else{
    cout<<"No\n";
  }
}


Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, char const *argv[]) {
  int n;
  scanf("%d\n", &n);
  int h[n];
  for (int i = 0; i < n; i++) {
    scanf("%d ", &h[i]);
  }
  int max = h[0];
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (h[i] >= max) {
      count++;
      max = h[i];
    }
  }
  printf("%d\n", count);
  return 0;
}


Measured memory_bytes: 128
package main

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

var (
	sc = bufio.NewReader(os.Stdin)
)

func main() {
	N := scanInt()
	L := make([]int, N)
	for i := 0; i < N; i++ {
		L[i] = scanInt()
	}
	c := 0
	for i := 0; i < N; i++ {
		for j := i + 1; j < N; j++ {
			if L[i] == L[j] {
				continue
			}
			for k := j + 1; k < N; k++ {
				if L[i] == L[k] || L[j] == L[k] {
					continue
				}
				if L[i]+L[j] > L[k] && L[j]+L[k] > L[i] && L[k]+L[i] > L[j] {
					c++
				}
			}
		}
	}
	fmt.Println(c)
}

func absInt(a int) int      { return int(math.Abs(float64(a))) }
func scan(a ...interface{}) { _, err := fmt.Fscan(sc, a...); pnc(err) }
func scanStr() (s string)   { scan(&s); return }
func scanInt() int          { i, err := strconv.Atoi(scanStr()); pnc(err); return i }
func scanFloat() float64    { f, err := strconv.ParseFloat(scanStr(), 64); pnc(err); return f }
func pnc(err error) {
	if err != nil {
		panic(err)
	}
}


Measured memory_bytes: 1848
#include<iostream>
#include<vector>
#include<bitset>
#include<utility>
using namespace std;
int N;
vector<int>G[1000];
int X[1000];
bool ans;
pair<int,int>dfs(int u)
{
	bitset<5001>now;
	now[0]=1;
	int sum=0;
	for(int i=0;i<G[u].size();i++)
	{
		pair<int,int>p=dfs(G[u][i]);
		sum+=p.first+p.second;
		now=now<<p.first|now<<p.second;
	}
	int id=X[u];
	while(id>=0&&!now[id])id--;
	if(id<0)ans=1;
	return{X[u],sum-id};
}
main()
{
	cin>>N;
	for(int i=1;i<N;i++)
	{
		int p;cin>>p;
		G[p-1].push_back(i);
	}
	for(int i=0;i<N;i++)cin>>X[i];
	dfs(0);
	cout<<(ans?"IM":"")<<"POSSIBLE"<<endl;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
/* clang-format off */
#define MOD 1000000007
#define INF 1000000000
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
#define __DEBUG__
#ifdef __DEBUG__
#define CH_P(a) cout <<"check_point("<<#a<<")" << "\n";
#define DEBUG(x) cout<<#x<<":"<<x<<"\n"
#define DEBUGS(v) cout << #v << ":";for(auto x:v){cout<<x<<" ";}cout<<"\n"
#endif
#ifndef __DEBUG__
#define CH_P(a) 
#define DEBUG(x) 
#define DEBUGS(v) 
#endif
#define TIMER_S(start) chrono::system_clock::time_point start = chrono::system_clock::now();
#define TIMER_E(end) chrono::system_clock::time_point end = chrono::system_clock::now();
#define TIME(start, end) cout << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count()) << "ms" << "\n";
/* clang-format on */

int main() {
  char a;
  cin >> a;
  if('a'<=a&&a<='z')cout << "a\n";
  else cout  << "A\n";
  return 0;
}


Measured memory_bytes: 3632
MODULE divisorMod
! 約数列挙のためのモジュール
      IMPLICIT NONE
      
      integer,parameter,private :: prec = 8
      
      contains
! 引数Nの約数全て(1-N)を割り付け配列で返す関数．
! N>=1のみ．
! O( sqrt(N) )
      function allDivisor( N ) result( resArray )
        implicit none
        integer(prec),intent(in) :: N
        integer(prec),allocatable :: resArray(:),buffer(:)
        integer(prec) :: i,c
        
        if( N<=0 )then !error
          resArray = [0]
          return
        end if
        
        
        allocate( buffer(floor(sqrt(real(N)))*2) )
        
        !c : counter
        c = 1
        do i = 1,floor(sqrt(real(N+1)))
          if( mod(N,i)==0 )then
            buffer(c) = i
            c = c + 1
          end if
        end do
        
        !c is allways over 1
        c = c - 1
        
        
        if( buffer(c)*buffer(c)==N )then
          !n is Square number
          buffer(c:2*c-1) = N / buffer(c:1:-1)
          c = 2*c - 1
        else
          buffer(c+1:2*c) = N / buffer(c:1:-1)
          c = 2*c
        end if
        
        !c is now number of divisor
        allocate( resArray(1:c) )
        resArray(1:c) = buffer(1:c)
      end function allDivisor
      END MODULE divisorMod
      
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

      PROGRAM NotDivisible
      use divisorMod
      IMPLICIT NONE
      INTEGER,PARAMETER :: prec = 8
      integer(prec) :: n, ans=0
      integer(prec), allocatable :: a(:)
      integer(prec) :: i,j
      integer(prec) :: list(10**6) = 0
      integer(prec) ,allocatable :: div(:)
      
      
      read*,n
      allocate( a(n) )
      read*,a(1:n)
      
      
      do i = 1,n
        list( a(i) ) = list( a(i) ) + 1
      end do
      
      
      
      outer:&
      do i = 1,n
        div = allDivisor( a(i) )
       ! print'(*(x,i0))',div(:)
        
        do j = 1,size(div)-1
          if( list(div(j))/=0 )then
            cycle outer
          end if
        end do
        
        if( list(a(i))>=2 )then
          cycle outer
        end if
        
        ans = ans + 1
        deallocate( div )
      end do outer
      
      print*,ans
      
      
     ! stop
      !debugg
      
      
      
      END PROGRAM

Measured memory_bytes: 12452
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

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

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

const int INF = 1001001001;

void func(int a, int n)
{
	int num[8];
	rep(i, n){
		num[i] = a%2;
		a /= 2;
	}
	rep(i, n)
		printf("%d", num[n-1-i]);
}

int main()
{
	char tmp[128];
	while(scanf("%s", tmp)){
		int a, b=0;
		sscanf(tmp, "%d", &a);
		if(a < 0)
			break;
		
		string str = tmp;
		int id = str.find('.');
		if(id != string::npos){
			string sub = str.substr(id+1);
			while(sub.size() < 4) sub += '0';
			b = atoi(sub.c_str());
		}
		
		if(a>=256 || b%625!=0)
			puts("NA");
		else{
			func(a, 8);
			putchar('.');
			func(b/625, 4);
			puts("");
		}
	}
	return 0;
}

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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] dataline = Console.ReadLine().Split(' ');
            int n = int.Parse(dataline[0]);
            int maxweights = int.Parse(dataline[1]);

            List<int>[] vp = new List<int>[4];
            for (int i = 0; i < 4; i++)
            {
                vp[i] = new List<int>();
            }

            dataline = dataline = Console.ReadLine().Split(' ');
            int w0 = int.Parse(dataline[0]);
            vp[0].Add(int.Parse(dataline[1]));

            for (int i = 0; i < n-1; i++)
            {
                dataline = Console.ReadLine().Split(' ');
                int wi = int.Parse(dataline[0]);
                int vi = int.Parse(dataline[1]);
                if (wi == w0)
                {
                    vp[0].Add(vi);
                }
                else if (wi == (w0 + 1))
                {
                    vp[1].Add(vi);
                }
                else if (wi == (w0 + 2))
                {
                    vp[2].Add(vi);
                }
                else
                {
                    vp[3].Add(vi);
                }
            }
            foreach (var list in vp)
            {
                list.Sort();
                list.Reverse();
            }

            long[,] valuemap = new long[4, n + 1];
            for (int i = 0; i < 4; i++)
            {
                for (int j = 1; j < vp[i].Count+1; j++)
                {
                    valuemap[i, j] = valuemap[i, j - 1] + vp[i][j - 1];
                }
            }


            long ans = 0;
            for (int i = 0; i <= vp[0].Count; i++)
            {
                for (int j = 0; j <= vp[1].Count; j++)
                {
                    for (int k = 0; k <= vp[2].Count; k++)
                    {
                        for (int l = 0; l <= vp[3].Count; l++)
                        {
                            if ((long)w0 * i + (long)(w0 + 1) * j + (long)(w0 + 2) * k + (long)(w0 + 3) * l <= maxweights)  
                            {
                                long sum = valuemap[0, i] + valuemap[1, j] + valuemap[2, k] + valuemap[3, l];
                                if (ans < sum)
                                {
                                    ans = sum;
                                }
                            }
                        }
                    }
                }
            }
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 11220
#include<stdio.h>

int main(void)
{
 int a,b,c;
 scanf("%d %d %d",&a,&b,&c);
 
 if (a < b&&b < c)
 {
   printf("Yes\n");
 }
 else
 {
   printf("No\n");
 }

 return 0;
}


Measured memory_bytes: 2080
n,k = map(int,input().split())
point = list(map(int,input().split()))
t = str(input())
janken = ["s","p","r"]
ans = 0
iziwaru = [False for i in range(n)]
for i in range(n):
    if not iziwaru[i]:
        ans += point[janken.index(t[i])]
        if i + k < n:
            if t[i] == t[i+k]:iziwaru[i+k] = True
print(ans)

Measured memory_bytes: 4212
#include <cstdio>

char s[100005];
int N;
char spe[100005];
char start[4][3] = {"SS", "SW", "WW", "WS"};

int main(){
	scanf("%d %s", &N, s);
	s[N] = s[0];
	for(int j=0; j<4; ++j){
		spe[0] = start[j][0];
		spe[1] = start[j][1];
		for(int i=1; i<=N; ++i){
			if(spe[i] == 'S' && s[i] == 'o')
				spe[i+1] = spe[i-1];
			else if(spe[i] == 'W' && s[i] == 'x')
				spe[i+1] = spe[i-1];
			else
				spe[i+1] = (char)('W' - spe[i-1] + 'S');
		}
		if(spe[N] == spe[0] && spe[N+1] == spe[1]){
			spe[N] = '\0';
			printf("%s\n", spe);
			return 0;
		}
	}
	printf("-1\n");
}


Measured memory_bytes: 512
# import bisect
# from collections import Counter, defaultdict, deque
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
# import math

import sys

# import numpy as np

ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

def main():
    s = input()
    l = len(s)

    if l < 4:
        print('No')
    elif s[:4] == "YAKI":
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
#include<stdio.h>
#include<math.h>

int main(){
	int data[1000];
	double M,L;
	int N;
	int A;
	while(1){
		scanf("%d",&N);
		if(N==0)
			break;
		M=0;
		for(A=0;A<N;A++){
			scanf("%d",data+A);
			M+=data[A];
		}
		M/=N;
		L=0;
		for(A=0;A<N;A++){
			L+=((data[A]-M)*(data[A]-M));
		}
		L/=N;
		printf("%.4f\n",sqrt(L));
	}
	return 0;
}

Measured memory_bytes: 640
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
    public static void main(String args[] ) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int P = sc.nextInt();
        int Ec = 0;
        for (int i = 0; i < N; i++) {
            int num = sc.nextInt();
            if(num % 2 == 0)
                Ec++;
        }
        int Oc = N - Ec;
        BigInteger ans = BigInteger.ONE;
        if(P == 1) {
            BigInteger temp = new BigInteger("2").pow(Oc).divide(new BigInteger("2"));
            ans = ans.max(temp);
            if(Oc == 0)
                ans = BigInteger.ZERO;
            temp = ans.multiply(new BigInteger("2").pow(Ec));
            ans = ans.max(temp);
        }
        else {
            BigInteger temp = new BigInteger("2").pow(Oc).divide(new BigInteger("2"));
            ans = ans.max(temp);
            temp = ans.multiply(new BigInteger("2").pow(Ec));
            ans = ans.max(temp);
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 21332