akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
int main(void){
  std::string c;
  std::cin >> c;
  if(c=="a"||c=="i"||c=="u"||c=="e"||c=="o"){
    std::cout << "vowel";
  }
  else std::cout << "consonant";
  return 0;
}

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

using namespace std;

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

#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ini(a, i) memset(a, i, sizeof(a))
#define contains(c, i) ((c).find(i) != (c).end())
#define present(i, c) (find(all(c), i) != (c).end())

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i <= n; i++)
#define repa(i, a, b) for(int i = (a); i < (b); i++)
#define repd(i, n) for(int i = (n)-1; i >= 0; i--)

#define TRACE(x...) x
#define watch(x) TRACE(cerr << #x" = " << x << endl)
#define watch_all(x) TRACE(cerr << #x" = "; for(auto __i : x) cerr << __i << " "; cerr << endl)

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

void run_test() {
	rep1(i, 5) {
		int x; cin >> x;
		if(x == 0) cout << i << endl;
	}
}

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

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	//int t = 1, _t; cin >> _t; while(t <= _t) { cout << "Case #" << t++ << ": "; run_test(); }
	// int t; cin >> t; while(t--) run_test();
	run_test();
	return 0;	
}



Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pp() pop_back()
#define V vector
#define P pair
#define V2(a,b,c) V<V<int>> a(b,V<int>(c))
#define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d))
#define incin(a) int a; cin>>a
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
//#define min min<int>
//#define max max<int>
template<class T>
 void cou(vector<vector<T>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
/*template<>
 void cou(vector<vector<char>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}*/
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 /*int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }*/
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
struct Union{
  vector<int> par;
  Union(int a){
	par= vector<int>(a,-1);
  }
  int find(int a){
    if(par[a]<0)
      return a;
    else
      return par[a]=find(par[a]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a==b)
      return;
    if(Size(b)>Size(a))
      swap<int>(a,b);
    par[a]+=par[b];
    par[b]=a;
  }
};
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
int gcm(int a,int b){
    if(b==0)
        return a;
    return gcm(b,a%b);
}
int lcm(int a,int b){
    return a/gcm(a,b)*b;
}
/*struct aa{
	vector<int> gt;
  aa(int n){
	gt= vector<int>(n, 1);
  }
	void c(V<int> d,int b){
	if(d[b]==0){
		gt[d[b]-1]++;
		gt[gt.sz-1]++;
	}
	else{
		gt[d[b]-1]++;
		c(d,d[d[b]]-1);
	}
}
void cok(int a){
	cout<<gt[a-1]<<endl;
	fo(i,a-1)
	cout<<gt[i]<<endl;
}
};
*/
/*struct dfs(){

}*/
signed main(){
	int a,b,c;
	cin>>a>>b>>c;
	int d;
	cin>>d;
	cout<<a+b+c+max<int>({a,b,c})*pow(2,d)-max<int>({a,b,c})<<endl;
}


Measured memory_bytes: 256
import math
buf = input().split(" ")
A=int(buf[0])
B=int(buf[1])
H=int(buf[2])
M=int(buf[3])


#omega_min = 360/3600
#omega_hour = 360 / (3600*12)
#theta_min = omega_min*M*60
#theta_hour = omega_hour*H*3600 + M/60/12

"""
if H*5 > M:
  rad = math.radians(theta_hour-theta_min)
else:
  rad = math.radians(theta_min-theta_hour)
"""
rad=math.pi*2 *(H / 12.0 + (M / 60.0) / 12.0 - M / 60.0)
ans = math.sqrt( A**2 + B**2 - 2*A*B*math.cos(rad))
print(ans)

Measured memory_bytes: 9512
import java.io.*;
import java.util.*;
import static java.lang.System.*;

public class Main {
	static FastScanner sc = new FastScanner(System.in);
	public static void main(String[] args) {
		int d;
		while (sc.hasNext()) {
			d = sc.nextInt();
			int ans = 0;
			for (int i=1; i<600/d; i++) {
				ans += (i*i)*(d*d)*d;
			}
			out.println(ans);
		}
	}
}



class FastScanner implements Closeable {
	private final InputStream in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	public FastScanner(InputStream in) {this.in = in;}
	private boolean hasNextByte() {
		if (ptr < buflen) {return true;}
		else{
			ptr = 0;
			try {buflen = in.read(buffer);}
			catch (IOException e) {e.printStackTrace();}
			if (buflen <= 0) {return false;}
		}
		return true;
	}
	private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
	private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
	public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
	public String next() {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while(isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	public long nextLong() {
		if (!hasNext()) throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {throw new NumberFormatException();}
		while(true){
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			}else if(b == -1 || !isPrintableChar(b)){return minus ? -n : n;}
			else{throw new NumberFormatException();}
			b = readByte();
		}
	}
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) nl;
	}
	public double nextDouble() { return Double.parseDouble(next());}
	public void close() {
		try {in.close();}
		catch (IOException e) {}
	}
}


Measured memory_bytes: 24308
n = int(input())
v = list(map(int, input().split()))

v0 = v[::2]
v1 = v[1::2]
counter0 = [0] * (10 ** 5 + 1)
counter1 = [0] * (10 ** 5 + 1)

for vi in v0:
    counter0[vi] += 1
for vi in v1:
    counter1[vi] += 1

sorted_counter0 = sorted(counter0, reverse=True)
sorted_counter1 = sorted(counter1, reverse=True)

if counter0.index(max(counter0)) == counter1.index(max(counter1)):
    print(min(len(v) - sorted_counter0[0] - sorted_counter1[1],
              len(v) - sorted_counter0[1] - sorted_counter1[0]))
else:
    print(len(v) - sorted_counter0[0] - sorted_counter1[0])

Measured memory_bytes: 14276
n,m = map(int, input().split())
S = []
C = []
for i in range(m):
    s,c = map(int, input().split())
    S.append(s)
    C.append(c)

flag = True
x = 0

for i in range(1000):
    x = i
    d = []
    flag = True
    if x == 0:
        d.append(x)
    while x != 0:
        num = x % 10
        d.append(num)
        x = x // 10
    d = d[::-1]
    if len(d) != n:
        flag = False
    for j in range(m):
        try:
            if d[S[j]-1] == C[j]:
                pass
            else:
                flag = False
        except IndexError:
            flag = False
    if flag:
        x = i
        break
print(x if flag else -1)

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <climits>
#include <vector>
#include <map>
#include <queue>
using namespace std;

#define ll long long
const int MOD = 1000000007;//10^9+7

ll max(ll a, ll b) {

	if (a > b)return a;
	else return b;

}
double max(double a, double b) {

	if (a > b)return a;
	else return b;

}
//a??¨b?????§?????????

ll min(ll a, ll b) {

	if (a < b)return a;
	else return b;

}
//a??¨b????°??????????

ll avd_i(ll a, ll b) {

	if (a > b)return a - b;
	else return b - a;

}
double avd_d(double a, double b) {

	double re;
	if (a > b)re = a - b;
	else re = b - a;
	return re;

}
//a??¨b???????????¶??????

ll powsur(ll a, ll b, ll p) {

	if (b == 0) {

		return 1;

	}
	else if (b % 2 == 0) {

		ll d = powsur(a, b / 2, p);
		return ((d%p)*(d%p)) % p;

	}
	else {

		return ((a%p)*powsur(a, b - 1, p) % p) % p;

	}

}
//p????´???°,a???b??????p??§?????£?????????

ll CMOD(ll n, ll r, ll p) {

	ll a = 1, b = 1, c = 1, re;
	for (int i = 1; i <= n; i++) {

		a *= i;
		a = a%p;

	}
	for (int i = 1; i <= r; i++) {

		b *= i;
		b = b%p;

	}
	for (int i = 1; i <= n - r; i++) {

		c *= i;
		c = c%p;

	}
	b = powsur(b, p - 2, p);
	c = powsur(c, p - 2, p);
	re = ((a%p)*(b%p)) % p;
	re = ((re%p)*c%p) % p;

	return re;

}
//p????´???°,(nCr)%p

ll gcd(ll a, ll b) {

	if (a > b) {

		ll tmp = a;
		a = b;
		b = tmp;

	}
	ll r;
	r = b%a;
	if (r == 0)return a;
	else return gcd(r, a);

}
//?????§??¬?´???°

ll lcm(ll a, ll b) {

	return (a / gcd(a, b))*b;

}
//????°???¬?????°

int main() {
	
	ll n, a[10005], sum = 0, m = 2147483647, M = -2147483647;

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

		cin >> a[i];
		sum += a[i];
		m = min(m, a[i]);
		M = max(M, a[i]);

	}

	cout << m << " " << M << " " << sum << endl;

	return 0;
}

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

# n,m = [2, 9]
# a = [1, 2, 3, 4, 5, 6, 7, 8, 9]

a.sort()
table = {1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6}

dp = ["" for i in range(max(n + 1, m+1))]
for x in a:
    dp[table[x]] = str(x)


def str_max(maxstrs):
    maxstrlen = max(map(lambda x:len(x), maxstrs))
    maxstr = max(filter(lambda x:len(x) == maxstrlen, maxstrs))
    return maxstr


for i in range(n + 1):
    for x in a:
        tmpstr = str(x)
        tmprest = i - table[x]
        if tmprest < 0:
            tmpstr = ""
        if 0 <= tmprest:
            # load dp
            tmp = dp[tmprest]
            if tmp == "":
                tmpstr = ""
            else:
                tmpstr = tmp + str(x)
        dp[i] = str_max([dp[i], tmpstr])

print(dp[n])


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

int main(){
  int n,sum=0,it=21;
  cin >> n;
  vector<int> v1(n,0),v2(n,0),v3(n-1,0);
  r(0,i,n)cin >>v1.at(i);
  r(0,i,n)cin >> v2.at(i);
  r(0,i,n-1)cin >> v3.at(i);
  r(0,i,n){
    if(v1.at(i)-it==1)sum+=v3.at(it-1);
    sum+=v2.at(i);
    it=v1.at(i);
  }
  cout << sum << endl;
}


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

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

using namespace std;

int main() {
  while(1){
    string trump;
    cin>>trump;
    if(trump=="#") break;
    int t_suit = 0;
    switch(trump[0]) {
      case 'S': t_suit = 0; break;
      case 'H': t_suit = 1; break;
      case 'D': t_suit = 2; break;
      case 'C': t_suit = 3; break;
    }
    vector<vector<pair<int,int>>> h(13,vector<pair<int,int>>(4));
    REP(i,4)REP(j,13) {
      string card;
      cin>>card;
      int num=0, suit=0;
      if('2' <= card[0] && card[0] <= '9')
        num = card[0] - '0';
      else {
        switch(card[0]) {
          case 'T': num = 10; break;
          case 'J': num = 11; break;
          case 'Q': num = 12; break;
          case 'K': num = 13; break;
          case 'A': num = 14; break;
        }
      }
      switch(card[1]) {
        case 'S': suit = 0; break;
        case 'H': suit = 1; break;
        case 'D': suit = 2; break;
        case 'C': suit = 3; break;
      }
      h[j][i] = make_pair(num, suit);
    }
    int beg = 0;
    int pt = 0;
    REP(i,13) {
      int led = h[i][beg].second;
      int nbeg = beg;
      pair<int,int> win(h[i][beg]);
      REP(j,4) {
        if (h[i][j].second == t_suit) {
          if (win.second != t_suit || win.first < h[i][j].first) {
            win = h[i][j];
            nbeg = j;
          }
        } else if (h[i][j].second == led) {
          if (win.second != t_suit && win.first < h[i][j].first) {
            win = h[i][j];
            nbeg = j;
          }
        }
      }
      if ((nbeg % 2) == 0) ++pt;
      beg = nbeg;
    }
    if (pt > 6)
      cout << "NS " << (pt - 6) << endl;
    else
      cout << "EW " << ((13 - pt) - 6) << endl;
  }
  return 0;
}

Measured memory_bytes: 1188
(let* ((s (string (read)))
    (n (length s))
    (ans 0))
    (dotimes (i (floor (/ n 2)))
        (if (not (equal (subseq s i (+ i 1)) (subseq s (- n i 1) (- n i))))
        (incf ans)
    )
    )
    (princ ans)
)

Measured memory_bytes: 24476
#include <cstdio>
#include <cstdint>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>

int main() {
  size_t n;
  scanf("%zu", &n);

  int t, a;
  scanf("%d %d", &t, &a);
  t *= 1000;
  a *= 1000;

  std::vector<int> h(n);
  for (int& h_i: h) scanf("%d", &h_i);

  int err=2e9;
  size_t res=0;
  for (size_t i=0; i<n; ++i) {
    double p=t-h[i]*6;
    double e=abs(p-a);
    if (err > e) {
      res = i+1;
      err = e;
    }
  }
  printf("%zu\n", res);
}


Measured memory_bytes: 256
/*
 * test.cpp
 *
 *
 *      Author: Fireworks
 */

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<map>
#include<cmath>
#include<bitset>
#include<set>
#include<iomanip>
#include<fstream>
#include<bitset>
#include<cstring>
#include<cstdlib>
#include<complex>
#include<list>
#include<sstream>

using namespace std;

typedef pair<int,int> ii;
typedef pair<int,long long> il;
typedef pair<long long,long long> ll;
typedef pair<ll,int> lli;
typedef pair<long long,int> li;
typedef pair<double,double> dd;
typedef pair<ii,int> iii;
typedef pair<double,int> di;
long long mod = 1000000007LL;
long long base = 37;
long long large = 1000000000000000000LL;


int main(){
	string s;
	cin>>s;
	int n = (int)s.length();
	vector<int> a(n,0);
	for(int i=0;i<n;i++){
		a[i] = (int)(s[i]-'a');
	}

	int ans = 1000000;
	for(int x=0;x<26;x++){
		vector<int> b=a;
		bool have = false;
		for(int i=0;i<n;i++){
			if(b[i]==x) have = true;
		}
		if(!have) continue;
		bool need = false;
		for(int i=0;i<n;i++){
			if(b[i]!=x) need=true;
		}
		int cnt = 0;
		while(need){
			cnt++;
			need = false;
			vector<int> c((int)b.size()-1,0);
			for(int i=0;i+1<(int)b.size();i++){
				if(b[i]==x||b[i+1]==x){
					c[i]=x;
				}else{
					c[i]=-1;
				}
			}
			b=c;
			for(int i=0;i<(int)b.size();i++){
				if(b[i]!=x) need = true;
			}
		}
		ans=min(ans,cnt);
	}
	cout<<ans<<endl;

	/*int totalcase;
	int testcase=0;
	cin>>totalcase;
	ofstream out;
	out.open("result.txt");

	while(totalcase--){
		testcase++;
		out<<"Case #"<<testcase<<": ";
		cout<<testcase<<": "<<endl;

		//GOGOGO


		//END
	}
	out.close();*/

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
struct edge{
	int u,v;
	long long w;
	edge(int a,int b,long long c):u(a),v(b),w(c){}
};
long long lazy[N],res[N];
int n,p[N];
vector<vector<int> > sets;
vector<edge> E;
bool cmp(edge &a,edge &b){
	return a.w<b.w;
}
void dsu(int i,int j,long long w){
	for(int k=0;k<sets[i].size();k++){
		res[sets[i][k]]+=lazy[i]-lazy[j]+w*sets[j].size();
		p[sets[i][k]]=j;
	}
	for(int k=0;k<sets[i].size();k++){
		sets[j].push_back(sets[i][k]);
	}
	sets[i].clear();
}
int main(){
	scanf("%d",&n);
	sets.assign(n+1,vector<int>());
	for(int i=1;i<=n;i++){
		p[i]=i;
		sets[i].push_back(i);
	}
	for(int i=1;i<n;i++){
		int u,v;
		long long w;
		cin>>u>>v>>w;
		E.push_back(edge(u,v,w));
	}
	sort(E.begin(),E.end(),cmp);
	reverse(E.begin(),E.end());
	for(int i=0;i<E.size();i++){
		int u=p[E[i].u];
		int v=p[E[i].v];
		int w=E[i].w;
		if(sets[u].size()>sets[v].size()){
			swap(u,v);
		}
		lazy[v]+=w*sets[u].size();
		dsu(u,v,w);
	}
	for(int i=1;i<=n;i++){
		cout<<res[i]+lazy[p[i]]<<"\n";
	}
}

Measured memory_bytes: 14448
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<queue>
#define int long long
#define mod (int)(1000000007)
using namespace std;
int test[213456]; string uiop[213456];
signed main() {
	int n, a = 0, ans = 0; string s; cin >> n;
	for (int h = 0; h < n; h++) {
		cin >> s;
		for (int i = 0; i < s.size(); i++) {
			for (int j = i + 1; j < s.size(); j++) {
				if (s[i] > s[j]) {
					swap(s[i], s[j]);
				}
			}
		}
		uiop[h] = s;
	}
	sort(uiop, uiop + n);
	for (int h = 1; h < n; h++) {
		if (uiop[h - 1] == uiop[h]) {
			a++;
		}
		else {
			ans += a * (a + 1) / 2; a = 0;
		}
	}
	ans += a * (a + 1) / 2;
	cout << ans << endl;
}

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

vector<ll> a(1000000);

int main(){
    int n; cin >> n;
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    ll ans = 0;
    for(int i=1; i<n; i++){
        if(a[i] < a[i-1]){
            ll tmp = a[i-1] - a[i];
            ans += tmp;
            a[i] += tmp;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 11024
import java.util.Scanner;

class Main {
    public static void main(final String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int k = scan.nextInt();
        String s = scan.next();
        char c = s.charAt(k-1);
        c += 32;
        String a = s.substring(0 ,k-1) + c + s.substring(k ,s.length());
        System.out.println(a);
    }
}


Measured memory_bytes: 20948
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>
#include<utility>
#include<numeric>

#define PB push_back
#define all(a)  (a).begin(),(a).end()
#define ALL(v) begin(v), end(v)
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)
#define V vector<int>
#define VV vector<V>
#define VVV vector<VV>

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int inf = (int)1e9;
const ll INF = (ll)1e18;
const ll MOD{ (ll)1e9 + 7 };
const long double EPS = 1e-10;

int main() {
	int n, c, k;
	cin >> n >> c >> k;
	vector<int> t(n);
	rep(i, n) cin >> t[i];

	sort(t.begin(), t.end());

	ll ans = 0;
	int l = 0, r = 0;
	while (r < n) {
		while (r < n && r - l + 1 <= c && t[r] - t[l] <= k) {
			r++;
		}
		ans++;
		l = r;
	}

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

Measured memory_bytes: 640
#include<stdio.h>
int main(void){
	int n,i,j,ans=0;
	int d[50];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&d[i]);
	}
	for(i=0;i<n;i++){
		for(j=i+1;j<n;j++){
			ans+=d[i]*d[j];
		}
	}
	printf("%d",ans);
	return 0;
}


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

N = int(input())

AList = list(map(int, input().split()))

AList.sort()

dp = [0] *  (AList[-1] + 1)

for i in AList:
    dp[i] += 1
    
    if dp[i] == 1:
        for p in range(2 * i, len(dp), i):
            dp[p] += 2

print(dp.count(1))

Measured memory_bytes: 31456
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double db;
#define fi first
#define se second
#define pi pair<ll,ll>
#define pii pair<ll,pi>
#define pb push_back
#define mk make_pair
const ll mod = 1000000007;
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin >> n;
	string s1, s2;
	cin >> s1 >> s2;
	ll ans = 1;
	for (int i = 0; i < n; ) {
		if (i == 0) {
			if (s1[i] == s2[i]) {
				ans = ans * 3;
				i++;
			}
			else {
				ans = ans * 6;
				i = i + 2;
			}
		}
		else
		{
			if (s1[i] == s2[i]) {
				if (s1[i - 1] == s2[i - 1]) {
					ans = ans * 2;
					ans %= mod;
					i++;
				}
				else {
					ans = ans * 1;
					i++;
				}
			}
			else {
				if (s1[i - 1] == s2[i - 1]) {
					ans = ans * 2;
					ans %= mod;
					i += 2;
				}
				else {
					ans = ans * 3;
					ans %= mod;
					i += 2;
				}
			}
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 3604
import math
n,a,b=[int(a) for a in input().split()]
dif=abs(a-b)
if dif%2==0:
    print(dif//2)
else:
    ans=min(min(a-1,b-1)+(dif+1)//2,min(n-a,n-b)+(dif+1)//2)
    print(ans)


Measured memory_bytes: 3060
'use strict';
function Main(input) {
    input = input.split("\n");
    let tmp = input[0].split("");

    let A = tmp.reduce((a, x) => {
        if (x == "A" || x == "C" || x == "G" || x == "T") {
            a[a.length-1]++;
            return a;
        }
        a.push(0);
        return a;
    },[0]);
    console.log(A.reduce((a,b)=>a>b?a:b));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int INF = 1000000000;
const int mod = 1e9+7;
const int maxn = 2e5+5;
int main() {
	ll n,k;
	cin>>n>>k;
	int cnt = 0;
	for(int i=1;i<=n;i++){
		ll x,y;
		cin>>x>>y;
		if((x*x+y*y)<=k*k) cnt++;
	}
	cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>
#define MAX 100000

int A[MAX], n;

int partition(int A[], int p, int r)
{
	int x, i, j, temp;
	x = A[r];
	i = p - 1;
	for(j = p; j < r; j++)
	{
		if(A[j] <= x)
		{
			i++;
			temp = A[i];
			A[i] = A[j];
			A[j] = temp;
		}
	}
	
	temp = A[i+1];
	A[i+1] = A[r];
	A[r] = temp;
	
	return i+1;
}

int main(void)
{
	int i, a;
	
	scanf("%d", &n);
	for(i = 0; i < n; i++)
	{
		scanf("%d", &A[i]);
	}
	
	a = partition(A, 0, n-1);
	
	for(i = 0; i < n; i++)
	{
		if(i != 0)
		{
			printf(" ");
		}
		if(i == a)
		{
			printf("[");
		}
		printf("%d", A[i]);
		if(i == a)
		{
			printf("]");
		}
	}
	printf("\n");
	
	return 0;
}


Measured memory_bytes: 2108
from itertools import permutations
from math import factorial


class Point:
    def __init__(self, y, x):
        self.y = y
        self.x = x


def main():
    N = int(input())
    xy = []
    for i in range(N):
        xi, yi = map(int, input().split())
        xy.append(Point(yi, xi))
    ans = 0
    for i in permutations(xy):
        for j in range(N - 1):
            ans += ((i[j + 1].y - i[j].y) ** 2 +
                    (i[j + 1].x - i[j].x) ** 2) ** 0.5
    print('{:.10f}'.format(ans / factorial(N)))
    return


main()


Measured memory_bytes: 3188
const
	modd=998244353;
var
	n,a,b,k,sum,max,w:int64;
	x,y,i:longint;
	f:array[0..300000] of int64;

function pow(q,w:int64):int64;
var
	res:int64;
begin
	res:=1;
	while w>0 do begin
		if w mod 2=1 then res:=res*q mod modd;
		q:=q*q mod modd;
		w:=w shr 1;
	end;
	exit(res);
end;

function comb(q,w:int64):int64;
begin
	if q<w then exit(0)	else if w=q then exit(1)
	else exit(f[q]*pow(f[w],modd-2) mod modd*pow(f[q-w],modd-2) mod modd);
end;

begin
	readln(n,a,b,k);
	f[0]:=1;
	for i:=1 to 300000 do
		f[i]:=f[i-1]*i mod modd;
	max:=k div a;
	sum:=0;
	for x:=0 to max do begin
		w:=k-a*x;
		if (w mod b=0)and(w div b<=n) then begin
			y:=w div b;
			inc(sum,(comb(n,x)*comb(n,y)) mod modd);
		end;
	end;
	writeln(sum mod modd);
end.

Measured memory_bytes: 2432
#include <cstdio>
#include <cstring>
#include <algorithm>
#define MAXN 2010
using namespace std;

int n,m;
int a[MAXN][MAXN],b[MAXN],s[MAXN];
int p[MAXN][2];

void sort(){
	static int cnt[MAXN];
	memset(cnt,0,sizeof cnt);
	for(int i=1;i<=m;i++) cnt[b[i]]++;
	for(int i=1;i<=n+1;i++) cnt[i]+=cnt[i-1];
	for(int i=m;i>=1;i--) s[cnt[b[i]]--]=i;
}

int gao(int l){
	for(int i=1;i<=m;i++)
		if(a[l][i]) b[i]=l+1;
	sort();
	memset(p,0,sizeof p);
	int res=0;
	for(int i=1;i<=m;i++){
		int x=s[i];
		p[x][0]=p[x][1]=x;
		if(p[x-1][0]){
			p[p[x-1][0]][1]=p[x][1];
			p[x][0]=p[p[x][1]][0]=p[x-1][0];
		}
		if(p[x+1][1]){
			p[p[x+1][1]][0]=p[x][0];
			p[x][1]=p[p[x][0]][1]=p[x+1][1];
		}
		res=max(res,(l-b[x]+2)*(p[x][1]-p[x][0]+2));
	}
	return res;
}

int main(){
#ifdef DEBUG
	freopen("F.in","r",stdin);
#endif
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++){
		static char str[MAXN];
		scanf("%s",str+1);
		for(int j=1;j<=m;j++)
			if(str[j]=='#')
				a[i][j]=1;
	}
	for(int i=1;i<n;i++)
		for(int j=1;j<m;j++)
			a[i][j]=a[i][j]^a[i+1][j]^a[i][j+1]^a[i+1][j+1];
	int ans=max(n,m);
	n--; m--;
	for(int i=1;i<=m;i++) b[i]=1;
	for(int i=1;i<=n;i++) 
		ans=max(ans,gao(i));
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 15872
#include<stdio.h>
#include<math.h>
int main()
{
	long long  a,b,i;
	int count=0;
	scanf("%lld%lld",&a,&b);
    while(a<=b)
	{
		count++;
		a*=2;
	}
	printf("%d",count);
	return 0;
}


Measured memory_bytes: 128
# coding: utf-8
n = gets.to_i
h = gets.split(" ").map{|e| e.to_i}

ans = "Yes"
min = 0
# 全ての要素に対して、前の要素以上となっていることを保証する
h.each_with_index do |e, i|
  break if i == n - 1
  
  if h[i] <= h[i + 1]
    # ok
    next
  elsif h[i] - 1 <= h[i + 1] and h[i] - 1 >= min
    h[i] -= 1
    min = h[i]
    # ok
    next
  else
    ans = "No"
    break
  end
end
puts ans


Measured memory_bytes: 8844
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define rep1(i,n)for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=(int)(n)-1;0<=i;i--)
#define rrep1(i,n) for(int i=(int)(n);1<=i;i--)

#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 

#define pcount __builtin_popcount
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())

#define dump(x)  cerr << #x << " = " << (x) << endl;

#define endl "\n"

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

typedef long long lint;

using namespace std;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	lint n,m,sum=0;
	cin>>n>>m;
	vector<int>a(m);
	rep(i,m)cin>>a[i];
	rep(i,m)sum+=a[i];
	cout<<(n-sum<0?-1:n-sum)<<endl;
}

Measured memory_bytes: 3700
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <sstream>
#include <vector>
using namespace std;

#define REP2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define REP(i, n) REP2(i, 0, n)
#define ALL(c) (c).begin(), (c).end()
#define FOREACH(i, c) for(auto i = (c).begin(); i != (c).end(); ++i)
#define BIT(n, m) (((n) >> (m)) & 1)

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

const ll inf = 1e15;
const ll mod = 1000 * 1000 * 1000 + 7;
const double eps = 1e-9;

template <typename S, typename T> ostream &operator<<(ostream &out, const pair<S, T> &p) {
  out << "(" << p.first << ", " << p.second << ")";
  return out;
}

template <typename T> ostream &operator<<(ostream &out, const vector<T> &v) {
  out << "[";
  REP(i, v.size()){
    if (i > 0) out << ", ";
    out << v[i];
  }
  out << "]";
  return out;
}

double memo[1 << 20];
double prob;
double rec(int mask, const vector<vector<int> > &G){
  if (mask == 0){
    return 1;
  } else if (memo[mask] > -eps){
    return memo[mask];
  } else {
    double &res = memo[mask] = 1.0;
    for (int submask = mask; submask > 0;){
      submask = (submask - 1) & mask;
      double p = 1.0;
      // cout << submask << " " << mask << endl;
      REP(i, G.size()) if ((submask & (1 << i)) || i + 1 == int(G.size())){
        REP(j, G.size()) if ((mask ^ submask) & (1 << j)){
          if (G[i][j]) p *= prob;
          // cout <<"POYO: " <<  i << " " << j << " " << mask << " " << submask << endl;
        }
      }
      // cout << mask << " "<< submask << " " << p << " " << rec(submask, G) << " " << endl;
      // cout << p << endl;
      res -= p * rec(submask, G);
      // cout << res << endl;
    }
    // cout << mask << " " << res << endl;
    return res;
  }
}


int main(){
  int N, M;
  double P;
  while (cin >> N >> M >> P){
    vector<vector<int> > G(N, vector<int>(N));
    REP(i, M){
      int a, b;
      cin >> a >> b; a--, b--;
      G[a][b] = G[b][a] = 1;
    }
    memset(memo, 0xff, sizeof(memo));
    prob = P * 0.01;
    cout << fixed << setprecision(20) << rec((1 << (N - 1)) - 1, G) << endl;
  }
  return 0;
}

Measured memory_bytes: 9500
#include <iostream>
#include <string>
#include <unordered_map>

using namespace std;


class Solution{

private:
    unordered_map<long long, int> dp;

public:
    int maxscore(const string& s){

        int n = s.size();
        int g = n - n / 2;

        int res = 0;
        for(int i = 0; i < g; i ++)
            res -= s[i] == 'p';

        for(int i = g; i < n; i ++)
            res += s[i] == 'g';

        return res;
    }
};

int main() {

//    cout << Solution().maxscore("gpg") << endl;
//    // 0
//
//    cout << Solution().maxscore("ggppgggpgg") << endl;
//    // 2

    string s;
    cin >> s;
    printf("%d\n", Solution().maxscore(s));

    return 0;
}


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

int main()
{
int k;
  char string[105];
  scanf("%d", &k);
  scanf("%s", string);
  int len = strlen(string);
  
  for (int i = 0; i < k && i < len; i++)
  {
    printf("%c", string[i]);
  }
  
  if (len > k)
  {
     printf("...\n");
  }
	
	
	return 0;
}

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

int main(){
    int x[10000];
    int i = 0;
    
    while(true){
        cin >> x[i];
        
        
        
        if(x[i] == 0){
            break;
        }
        
        
        ++i;
    }
    
    for(int j = 0; j < i; ++j){
        cout << "Case " << 1+j << ": " << x[j] << endl;

    }
    
    
    return 0;
}


Measured memory_bytes: 3124
#include<iostream>

using namespace std;

int main(){
  int n,tou,kai,ban,ninzu;
  cin >> n;

  int info[4][3][10] = {{{}}};

  for(int i=0;i<n;i++){
    cin >> tou >> kai >> ban >> ninzu;
    info[tou-1][kai-1][ban-1] += ninzu;
  }

  for(int i=0;i<4;i++){
    for(int j=0;j<3;j++){
      for(int k=0;k<10;k++){
        cout << " " << info[i][j][k];
      }
      cout << endl;
    }
    if(i!=3) cout << "####################" << endl;
  }

  //cout << endl;

  return 0;
}

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

int main() {
 string s; cin>>s;
  ll k; cin>>k;
  ll not1=99999;
  ll a=0;
  for(int i=0;i<s.size();i++){
    if(s[i]!='1') {not1=i+1; a=s[i]-'0'; break;}
}
  if(not1>k)cout<<1<<endl;
  else cout<<a<<endl;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String B = sc.nextLine();
		int max = 0;
		int count = 0;
		for(int i=0; i<B.length(); i++) {
			if(B.charAt(i) == 'A' || B.charAt(i) == 'C' || B.charAt(i) == 'G' || B.charAt(i) == 'T') {
				count++;
			} else {
				max = Math.max(max, count);
				count = 0;
			}
			max = Math.max(max, count);
		}
		System.out.println(max);
	}

}


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

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

	long long ans = 0;
	if(A & 1){
		ans ^= A;
		++A;
	}
	if((B & 1) == 0){
		ans ^= B;
		--B;
	}
	if((B - A + 1)/2 % 2 == 1) ans ^= 1;

	cout << ans << endl;
}


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

using namespace std;

int main(void) {
	string S;
	cin >> S;
	int red = 0;
	int blue = 0;
	int ans = 0;
	for(int i = 0; i < S.length(); ++i) {
		if(S[i] == '0') ++red;
		if(S[i] == '1') ++blue;
		if(red > 0 && blue > 0) {
			ans += 2;
			--red;
			--blue;
		}
	}
	cout << ans << '\n';
	return 0;
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <cstdlib>
#include <iostream>
#include <cstdlib>
using namespace std;
using ll = long long;
#define mod 1000000007
 
int main()
{
    float r, circum;
	cin>>r;
	circum=2*3.141592653589793238462643383*r;
	printf("%.7f\n",circum);
    return 0;
}

Measured memory_bytes: 3788
#include <iostream>
#include <string>
#include <functional>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <math.h>
#include <iomanip>
#include <map>

using namespace std;
using ll = long long;

int main()
{
	ll n, k;
	cin >> n >> k;

	if (n == 1)
	{
		if (k == 0)
			cout << 0 <<  " " << 0 << " " << 1 << " " << 1 << endl;
		else
			cout << -1 << endl;
	}
	else if (k >= pow(2, n))
		cout << -1 << endl;
	else
	{
		for (ll i = 0; i < pow(2, n); i++)
		{
			if (i != k)
				cout << i << " ";
		}
		cout << k << " ";
		for (ll i = pow(2, n) - 1; i >= 0; i--)
		{
			if (i != k)
				cout << i << " ";
		}
		cout << k << " ";
	}


	return 0;
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#define int long long

template <class T>
bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
template <class T>
bool chmax(T &a, const T &b) {if (a < b){ a = b; return 1;} return 0;}
template <class T>
bool chmin(T &a, const T &b) {if (a > b){ a = b; return 1;}return 0;}
template <class T>
void printv(vector<T> v) {for (T t : v) {cout << t << " ";}cout << '\n';}

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    cout << max(c-(a-b),0) << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
R = lambda:map(int,raw_input().split())

n = int(raw_input())
for i in xrange(n):
    train = ['-1' for i in xrange(60)]
    num = 30
    s = raw_input()
    for j in xrange(len(s)):
        if s[j] == '-': pass
        elif s[j] == '>': num += 1
        elif s[j] == '<': num -= 1
        else:
            if train[num] != s[j]:
                train[num] = s[j]
    while '-1' in train: train.remove('-1')

    print "".join(train)

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

int main(){
    int K, N; cin >> K >> N;
    int s; cin >> s;
    int s0 = s;
    int Max = 0;
    for (int i = 1; i < N; i++)
    {
        int e; cin >> e;
        Max = max(Max, e-s);
        s = e;
    }
    Max = max(K - s + s0, Max);
    cout << K - Max << endl;
}

Measured memory_bytes: 256
def makeFibonacci(n):
    F = [0] * (n+1)
    if n == 0:
        F[0] = 1
    else:
        F[0] = 1
        F[1] = 1
        for i in range(2, n+1):
            F[i] = F[i-2]+F[i-1]
    return F

n = int(input())
Ans = makeFibonacci(n)
print(Ans[n])


Measured memory_bytes: 5600
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define sort(s) sort(s.begin(),s.end())
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind
#define rt (a); return (a); 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 1000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
int gcd(int a, int b) {
	if (b > a)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
int ans = 0;
int s[10][10];
int k[10];
int p[10];
void bit(int m, int n, int d) {
	stack<string> st;
	st.push("");
	while (!st.empty()) {
		string now = st.top();
		st.pop();
		if (now.size() == n) {
			bool w = true;
			rep(i, 0, d) {
				int x = 0;
				rep(j, 0, k[i])if (now[s[i][j] - 1] == '1')x++;
				if (x % 2 != p[i])w = false;
			}
			if (w)ans += 1;
		}
		else {
			for (int i = m - 1; i >= 0; i--) {
				string next = now + to_string(i);
				st.push(next);
			}
		}
	}
}
;
int main() {
	int a, b;
	cin >> a >> b;
	int ans;
	if (a >= 13)ans = b;
	else {
		if (12 >= a && a >= 6)ans = b / 2;
		else ans = 0;
	}
	cout << ans << endl;
	return 0;

}


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

ans = -1
dif = 10 ** 20

for i in range(n):
    if dif > abs(t - h[i] * 0.006 - a):
        ans = i
        dif = abs(t - h[i] * 0.006 - a)

print(ans + 1)

Measured memory_bytes: 3060
def dfs(i,s,res):
    if i==3:
        if res == 7:
            print(s+"=7")
            exit()
        return
    dfs(i+1,s+'+'+S[i+1],res+int(S[i+1]))
    dfs(i+1,s+'-'+S[i+1],res-int(S[i+1]))
 
S=input()
dfs(0,S[0],int(S[0]))

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

int gcd(int x,int y){
    if(y==0)return x;
    x=x%y;
    gcd(y,x);
}

int digitPoor(int n)
{
    if (n < 10)         return 1;
    else if (n < 100)        return 2;
    else if (n < 1000)       return 3;
    else if (n < 10000)      return 4;
    else if (n < 100000)     return 5;
    else if (n < 1000000)    return 6;
    else if (n < 10000000)   return 7;
    else if (n < 100000000)  return 8;
    else if (n < 1000000000) return 9;
    else if (n < 10000000000) return 10;
    else if (n < 100000000000) return 11;
    else if (n < 1000000000000) return 12;
    else if (n < 10000000000000) return 13;
    else if (n < 100000000000000) return 14;
    else if (n < 1000000000000000) return 15;
    else if (n < 10000000000000000) return 16;
    else if (n < 100000000000000000) return 17;
    else if (n < 1000000000000000000) return 18;
}

main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(d==1){
        cout<<1<<endl;
    }else{
        cout<<0<<endl;
    }
    
}

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

int main (void){
  int n;
  cin >> n;
  vector<int> a;
  for(int i = 0; i < n; i++){
    int x;
    cin >> x;
    a.push_back(x);
  }
  
  vector<int> idx(a.size());
  iota(idx.begin(), idx.end(), 0);
  std::sort(idx.begin(), idx.end(), [&a](int i1, int i2) {
        return a[i1] < a[i2];});
  for (int i : idx)
        cout << i + 1 << " ";
  return 0;
}

Measured memory_bytes: 1784
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

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

pair<vector<int>,int> insertion_sort(const vector<int> &v,int g = 1) {
    int sz = v.size();
    vector<int> ret;
    for(const auto &it: v) ret.push_back(it);

    int cnt = 0;
    REP(i,sz) {
        auto el = ret[i];
        auto j = i - g;
        while ( j>=0 && ret[j] > el) {
            ret[j+g] = ret[j];
            j = j - g;
            cnt++;
        }
        ret[j+g] = el;
    }
    return make_pair(ret,cnt);
}

void shell_sort(vector<int> &v) {
    vector<int> G;
    int k = 1;
    while(k <= v.size()) {
        G.push_back(k);
        k*=3;
        k++;
    }
    reverse(ALL(G));
    cout << G.size() << endl;
    REP(i,G.size()-1) cout << G[i] << " ";
    cout << G[G.size()-1] << endl;

    int ans = 0;
    for(const auto g: G) {
        auto p = insertion_sort(v,g);
        v = p.first;
        ans+=p.second;
    }
    cout << ans << endl;
    for(const auto &it: v) cout << it << endl;
}

void solve() {
    int N;
    cin >> N;
    vector<int> v(N);
    REP(i,N) cin >> v[i];
    shell_sort(v);
}

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


Measured memory_bytes: 14616
def solve():

    H, W = map(int, input().split())
    alist = [input() for i in range(H)]

    cols = [False] * H
    rows = [False] * W

    for i in range(H):
        for j in range(W):
            if alist[i][j] == '#':
                cols[i] = True
                rows[j] = True

    for i in range(H):
        if cols[i]:
            for j in range(W):
                if rows[j]:
                    print(alist[i][j], end="")

            print()


if __name__ == "__main__":
    solve()


Measured memory_bytes: 42584
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {

	static final String regex = "([0-9]+)";
	
	public static void main(String[] args) throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String buf;
		int sum = 0;
		while((buf = br.readLine()) != null){
			sum += getSumOfNumbersInSentence(buf);
		}
		System.out.println(sum);
	}
	public static int getSumOfNumbersInSentence(String str){
		int sum = 0;
		Pattern p = Pattern.compile(regex);
		Matcher m = p.matcher(str);
		while(m.find()){
			sum += Integer.parseInt(m.group(1));
		}
		return sum;
	}
}

Measured memory_bytes: 16996
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import random
input = sys.stdin.readline

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

def main():

	#S = int(input())
	#S = list(input())
	A,B,C,D = map(int, input().split(" "))
	#L = list(map(int, input().split(" ")))

	E = lcm(C, D)
	if A == B:
		if A % C == 0 or A % D == 0:
			print(0)
			sys.exit()
		else:
			print(1)
			sys.exit()

	if C == D or C % D == 0 or D % C == 0:
		tmp_C2 = B // C
		tmp_C2ama = B % C

		tmp_C1 = A // C
		tmp_C1ama = A % C

		tmp = (tmp_C2-tmp_C1)

		tmp2 = 0
		if tmp_C1ama == 0:
			tmp2 -=1

		ans = B-A-tmp+1+tmp2
		print(ans)
		sys.exit()

	tmp_C2 = B // C
	tmp_C2ama = B % C
	tmp_D2 = B // D
	tmp_D2ama = B % D
	tmp_C1 = A // C
	tmp_C1ama = A % C
	tmp_D1 = A // D
	tmp_D1ama = A % D

	tmp_E2 = B // E
	tmp_E2ama = B % E
	tmp_E1 = A // E
	tmp_E1ama = A % E

	tmp = (tmp_C2+tmp_D2)-(tmp_C1+tmp_D1)

	tmp2 = 0
	if tmp_C1ama == 0:
		tmp2 -=1
	if tmp_D1ama == 0:
		tmp2 -=1
	if tmp_E1ama == 0:
		tmp2 += 1

	#print(E)

	ans = B-A-tmp+1+(tmp_E2-tmp_E1)+tmp2

	print(ans)

def gcd(a, b):
	if a > b:
		a, b = b, a
		
	while a > 0:
		a, b = b % a, a
	return b

def lcm(a, b):
	g = gcd(a, b)
	return a // g * b

if __name__ == "__main__":
	main()

Measured memory_bytes: 4716
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<unistd.h>
#include<string>
#include<cstring>
#include<stack>
#include<queue>
#include<utility>
#include<cmath>
#include<set>
#include<unordered_map>
#include<cstdio>
#include<map>
#include<numeric>
using namespace std;
#define F first
#define S second
#define mk(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define gc getchar_unlocked
typedef long long ll;
const int MAXN = 1e5 + 10;
const int MAX = 4*1e6 + 100;
double pi = 3.1415926535897932384626433832795;
const ll inf=1e10 ;
vector<int> adj[MAXN] ;
bool v[MAXN] ;
int main(){
    int N,X;
    cin >>N>>X ;
    int a[N] ,mn=100005,sum=0;
    for(int i=1;i<=N;i++){
        cin>>a[i] ;
        mn=min(a[i],mn);
        sum+=a[i] ;
    }
    X-=sum ;
    cout<<N+X/mn<<endl;
    return 0;
}


Measured memory_bytes: 2688
n = int(input())
AS = list(map(int,input().split()))
AS.sort()
BS = list(map(int,input().split()))
CS = list(map(int,input().split()))
CS.sort()
import bisect
  
ans = 0
for b in range(n):
  ans += bisect.bisect_left(AS,BS[b])*(n-bisect.bisect_right(CS,BS[b]))

print(ans)
    



Measured memory_bytes: 23248
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
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; }

int main(void){
    string S;
    cin>>S;
    bool ok=true;
    for(int i=0;i<3;i++){
        if(S[i]==S[i+1]) ok=false;
    }
    if(ok) cout<<"Good"<<endl;
    else cout<<"Bad"<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int X = scan.nextInt();
		int result = 0;
		int count = 1;
		for(int i = 1;i <= X;i++) {
			for(int j = 2;;j++) {
				if(i == 1) {
					result = 1;
					break;
				}
				if((int)Math.pow(i,j) > X) {
					break;
				}else {
					if((int)Math.pow(i,j) >= result) {
						result = (int)Math.pow(i,j);
					}
				}
				count = (int)Math.pow(i,j);
			}
		}
		System.out.println(result);
	}
}

Measured memory_bytes: 22868
package main

import (
        "fmt"
)

func solution(s string) string {
        for i, r := range s {
                if (i-1)%2 == 0 {
                        if r == 'R' {
                                return "No"
                        }
                } else {
                        if r == 'L' {
                                return "No"
                        }
                }
        }
        return "Yes"
}

func main() {
        var s string
        fmt.Scan(&s)
        fmt.Println(solution(s))
}

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

int main()
{
	int n, m, p;
	int array[200];
	
	while (scanf("%d %d %d", &n, &m, &p), n + m + p){
		int sum = 0;
		for (int i = 0; i < n; i++){
			scanf("%d", &array[i]);
			sum += array[i];
		}
		
		if (array[m - 1] > 0){
			printf("%d\n", sum * (100 - p) / array[m - 1]);
		}
		else {
			puts("0");
		}
	}
	
	return 0;
}

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

int main() {
  string c,ans="vowel";
  cin >> c;
  for (int i=0;i<c.size();i++) {
    if (c.at(i)!='a' and c.at(i)!='i' and c.at(i)!='u' and c.at(i)!='e' and c.at(i)!='o'){
      ans="consonant";
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256