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

using ll = long long;

// 座標圧縮
map<ll, int> compress(vector<ll> &x, bool sorted = false) {
  map<ll, int> comp;
  if (!sorted) sort(x.begin(), x.end());
  x.erase(unique(x.begin(), x.end()), x.end());
  for (int i = 0; i < x.size(); i++) comp[x.at(i)] = i;
  return comp;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll n, x, d;
  cin >> n >> x >> d;
  
  if (d == 0) {
    if (x == 0) cout << 1 << '\n';
    else cout << n + 1 << '\n';
    return 0;
  }
  
  if (d < 0) {
    x *= -1;
    d *= -1;
  }
  
  vector<ll> modulo;
  for (ll i = 0; i <= n; i++) modulo.emplace_back((((x * i) % d) + d) % d);
  
  auto mp = compress(modulo);
  vector<vector<pair<ll, ll>>> v(mp.size());
  
  for (ll i = 0; i <= n; i++) {
    ll res = (((x * i) % d) + d) % d;
    int nowit = mp[res];
    ll low = ((x * i + (i - 1) * i / 2 * d) - res) / d;
    ll high = ((x * i + (2 * n - i - 1) * i / 2 * d) - res) / d;
    v[nowit].emplace_back(make_pair(low, high));
  }
  
  ll ans = 0;
  for (int i = 0; i < v.size(); i++) {
    sort(v[i].begin(), v[i].end());
    ll nowlow = v[i][0].first, nowhigh = v[i][0].second;
    for (int j = 1; j < v[i].size(); j++) {
      if (v[i][j].first > nowhigh + 1) {
        ans += nowhigh - nowlow + 1;
        nowlow = v[i][j].first;
        nowhigh = v[i][j].second;
      }
      else {
        nowhigh = max(nowhigh, v[i][j].second);
      }
    }
    ans += nowhigh - nowlow + 1;
  }
  
  cout << ans << '\n';
}

Measured memory_bytes: 28200
#define _USE_MATH_DEFINES
#include <iomanip>
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <tuple>
#include <climits>
#include <algorithm>
#include <cmath>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<double> VD;
typedef vector<LL> VLL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef vector<vector<long long>> VVLL;
typedef vector<vector<bool>> VVB;
typedef vector<vector<double>> VVD;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(a) (a).begin(),(a).end()

const int MOD = 1000000007;

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

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

void debug(VI &arr){
	int n=arr.size();
	rep(i,n){
		cout<<arr.at(i)<<endl;
	}
}

void debug(VVI &board){
	int h = board.size();
	int w = board.at(0).size();
	rep(i,h){
		rep(j,w){
			cout << board.at(i).at(j) << " ";
		}
		cout<<endl;
	}
}

void debug(VVLL &board){
	int h = board.size();
	int w = board.size();
	rep(i,h){
		rep(j,w){
			cout<<board.at(i).at(j)<<" ";
		}
		cout<<endl;
	}
}

LL gcd(LL a,LL b){
	return b==0?a:gcd(b,a%b);
}

LL lcm(LL a,LL b){
	return a*b/gcd(a,b);
}

int main(){
	//cout<<fixed;
	//cout<<setprecision(9)<<...
	int n;cin>>n;
	vector<tuple<string,int>> p(n);
	rep(i,n){
		string s;
		int t;
		cin>>s>>t;
		get<0>(p.at(i))=s;
		get<1>(p.at(i))=t;
	}
	string x;
	cin>>x;
	int ans=0;
	bool flg = false;
	rep(i,n){
		if(flg)ans+=get<1>(p.at(i));
		if(x==get<0>(p.at(i)))flg=true;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
/*input
9
*/
#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long
#define mod 1000000007
#define inf 1000000000000000001
#define all(c) c.begin(),c.end()
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define sz(a) int((a).size())
#define pb push_back
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())     
#define rep(i,j,n) for(ll i=j;i<n;i++)
#define mp make_pair
#define N 998244353
#define PI acos(-1.0)
//if (s.find('R') != std::string::npos)
//s.replace(s.find("10"), sizeof("10") - 1, "");
using namespace std;
bool comp(pair<string,ll>a,pair<string,ll>b){
  if(a.first==b.first) return a.second>b.second;
  return a.first<b.first;
}
int main()
{
  // added the two lines below 
  ios_base::sync_with_stdio (false); 
  cin.tie(NULL);
  cout.tie(0);
 
  int s;
  string o;
  cin >> s;
  int a = s/100;
  int b = s%100;
  if(0 < a && a < 13) {
    if(0 < b && b < 13) {
      o = "AMBIGUOUS";
    } else {
      o = "MMYY";
    }
  }
  else {
    if(0 < b && b < 13) {
      o = "YYMM";
    } else {  
      o = "NA";
    }
  }
  cout << o << endl;
}

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

#define int long long
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}

signed main(){
    int Q;cin>>Q;
    int x=0,y=0;
    while(Q--){
        int a,b;char c;
        cin>>a>>c>>b;
        if(c=='(')x+=b;
        else y+=b;
        if(x==y)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int n,m;
  cin >> n >> m;
  vector<vector<ll>> v(n, vector<ll>(3));
  REP(i,n) REP(j,3) cin >> v[i][j];
  
  ll ans = 0;
  REP(bit, (1<<3)){
    vector<ll> sum(n, 0);
    
    REP(d,3){
      if(bit & (1<<d)) REP(i,n) sum[i] += v[i][d];
      else REP(i,n) sum[i] -= v[i][d];
    } 
    sort(ALL(sum), greater<ll>());
    ll tmp = 0;
    REP(i,m) tmp += sum[i];
    ans = max(ans, tmp);
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 256
module app;

import core.bitop;

import std.algorithm;
import std.array;
import std.bigint;
import std.container.rbtree;
import std.conv;
import std.stdio;
import std.string;
import std.traits;

struct Input
{
	BigInt a, b, c;
}

void parseInput(T)(out Input input, T file)
{
	with (file) with (input)
	{
		auto ar = readln().strip().split().map!(to!ulong).array();
        a = ar[0];
        b = ar[1];
        c = ar[2];
	}
}

auto main2(Input* input)
{
	with (input)
	{
        if (a * b * 4 < (c - a - b) ^^ 2 && c - a - b >= 0)
            return "Yes";
        else
            return "No";
	}
}

alias retType = ReturnType!main2;
static if (!is(retType == void))
{
	unittest { writeln("begin unittest"); }
	auto _placeholder_ = ReturnType!main2.init;

	unittest // example1
	{
		string example =
`2 3 9`;
		if (example.empty) return;
		Input input = void;
		parseExample(input, example);
		auto result = main2(&input);
		printResult(result);
		assert(result == "No");
	}

	unittest // example2
	{
		string example =
`2 3 10`;
		if (example.empty) return;
		Input input = void;
		parseExample(input, example);
		auto result = main2(&input);
		printResult(result);
		assert(result == "Yes");
	}

	unittest // example3
	{
		string example =
``;
		if (example.empty) return;
		Input input = void;
		parseExample(input, example);
		auto result = main2(&input);
		printResult(result);
		assert(result == _placeholder_);
	}

	unittest { writeln("end unittest"); }

	void parseExample(out Input input, string example)
	{
		struct Adapter
		{
			string[] _lines;
			this(string input) { _lines = input.splitLines(); }
			string readln() { auto line = _lines[0]; _lines = _lines[1..$]; return line; }
		}
		parseInput(input, Adapter(example));
	}
}

void printResult(T)(T result)
{
	static if (isFloatingPoint!T) writefln("%f", result);
	else writeln(result);
}

void main()
{
	Input input = void;
	parseInput(input, stdin);
	static if (is(retType == void))
		main2(&input);
	else
	{
		auto result = main2(&input);
		printResult(result);
	}
}


Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#include<vector>
using namespace std;
int main()
{
   int n,l;
   cin>>n>>l;
   vector<string>v(n);
   for(int i=0;i<n;i++){
    cin>>v[i];
   }
   sort(v.begin(),v.end());
   for(int i=0;i<n;i++){
    cout<<v[i];
   }
   cout<<endl;
    return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
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; }
const long long INF = 1LL << 60;
const int inf = 1001001001;
 

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


int main(){
    ll a,b;
    cin >> a >> b;
    ll c=max(a,b);
    ll d=min(a,b);
    ll e=gcd(a,b);
    if(d==1){
        cout << a*b << endl;
    }
    else{
        cout << a*b/e << endl;
    }
}

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

int main(){
    int N;
    int A[210];
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> A[i];
    
    int count = 0;
    while(true){
        bool e_odd = false;
        for (int i = 0; i < N; ++i){
            if(A[i] % 2 == 0) A[i] = A[i] / 2;
            else {
                e_odd = true;
                break;
            }
        }
    if (e_odd) break;
    else ++count;
    }
    cout << count << endl; 
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		
		Scanner scanner = new Scanner(System.in);
		int atotal = scanner.nextInt();
		
		int[] arr = {1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51};
		
		System.out.println(arr[atotal-1]);


	}
		

	
}

Measured memory_bytes: 21716
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		
		int[] h = new int [a];
		
		for (int i = 0  ; i <a ; i++) {
			
			h[i] = sc.nextInt();
		}
		
		for (int i = a-2 ; i >=0 ; i--) {
			if (h[i] > h[i+1]) {
				h[i] -- ;
			}
		}
		
		boolean b = true;
		for (int i = 1 ; i <a ; i++) {
			
			if (h[i] - h[i-1] < 0) {
				
				b = false;
			}
			
		}
		if (b) {
			System.out.println("Yes");
			
		}else {
			System.out.println("No");
		}
		
		
	}
		
}


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

int main() {
    string s;
    cin>>s;
    string ans=s.substr(0,5)+" "+s.substr(6,7)+" "+s.substr(14,5);
    cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int[] box;
    box=new int[3];
    int[] score=new int[1];
    int m=box.length;
    for(int s=0;s<m;s++){
      box[s]=sc.nextInt();
    }
    score[0]=box[1];
    box[1]=box[0];
    box[0]=score[0];
    score[0]=box[2];
    box[2]=box[0];
    box[0]=score[0];
    System.out.println(box[0]+" "+box[1]+" "+box[2]);
  }
}


Measured memory_bytes: 39256
#include<bits/stdc++.h>
#define ll long long
#define loop(n) for(ll i = 0; i<n; i++)
#define sort(a) sort(a.begin(), a.end())
using namespace std;

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

    int x, y, z;
    cin>>x>>y>>z;
    cout<<z<<" "<<x<<" "<<y<<"\n";
    return 0;
}

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

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

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

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }

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

    int n, a, b;
    cin >> n >> a >> b;
    if ((b - a) % 2) cout << "Borys\n";
    else cout << "Alice\n";

    return 0;
}

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

int main() {
  int A, B, S, a;
  cin >> A >> B;
  S=0;
  a=A;
  
  for(int i=0;i<B-A+1;i++){
    if(a/10000==a%10 && (a%10000)/1000==(a%100)/10){
      S++;
    }
    a++;
  }
  cout << S << endl;
}

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

#define debug(x) cerr << #x << " = " << x << endl;
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define FOR(it, b, e) for (typeof(b) it = (b); it != (e); ++it)
#define MSET(c, v) memset(c, v, sizeof(c))

const int INF = 0x3F3F3F3F; 
const int NEGINF = 0xC0C0C0C0;
const int NULO = -1;
const ll mod = 998244353;
const double EPS = 1e-10;

const int maxn = 1e6 + 100;

ll exp(ll a, ll b)
{
  ll ans = 1;
  while(b)
  {
    if(b & 1)
      ans = (ans * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return ans;
}



int main()
{
  ios::sync_with_stdio(0);
  int n,k;
  cin >> n >> k;
  string s;
  cin >> s;

  int cnt = 0;
  if(s[0] == '0')
    cnt++;

  int ans = 0;
  int j = 0;
  for(int i = 0 ; i + 1 < n ; i++)
  {
    if(s[i] == '1' && s[i + 1] == '0')
      cnt++;
    while(j + 1 < n && cnt > k)
    {
      if(s[j] == '0' && s[j + 1] == '1')
        cnt--;
      j++;
    }
    ans = max(ans, i - j + 1);
  }

  cout << ans + 1 << endl;

  return 0;
}

Measured memory_bytes: 3744
/*
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
*/
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD 1000000007
#define MOD2 998244353
#define MOD3 1000000009
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
//ifstream cinn("in.in");ofstream coutt("out.out");
int poww(const int &a,int b,const int &m=MOD){if(b==0)return 1;int x=poww(a,b/2,m);x=x*x%m;if(b&1)x=x*a%m;return x;}
int ceil(const int &a,const int &b){return (a+b-1)/b;}
////Read:
//Check corner cases, n==1;
//
////Some function:
//__builtin_popcountll(), is_sorted(),


signed main(){
    FASTER;
    string s;cin>>s;
    int ans=0;
    for(int i=0;i<3;i++){
        if(s[i]=='S')continue;
        int cnt=0;
        while(i<3 && s[i]=='R')i++,cnt++;
        ans=max(ans,cnt);
    }
    cout<<ans;
}






Measured memory_bytes: 3644
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int c = sc.nextInt();
        int k = sc.nextInt();
        long[] li = new long[n];
        for(int i = 0; i < n; i++){
            li[i] = sc.nextLong();
        }
        Arrays.sort(li);
        long firstT = 0;
        long pass = 0;
        int ans = 1;
        for(int i = 0; i < n; i++){
            long t = li[i];
            if(pass == 0){
                firstT = t;
                pass++;
            }else if(firstT + k < t){
                ans++;
                firstT = t;
                pass = 1;
            }else{
                pass++;
            }
            if(pass == c){
                pass = 0;
                if(i != n-1) ans++;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 55576
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main (void){
    string N ;
    cin >> N;
    char c = N.at(N.size()-1);
    if (c == '3') {
        cout << "bon" << endl;
    } else if (c == '0' || c == '1' || c == '6' || c == '8') {
        cout << "pon" << endl;
    } else {
        cout << "hon" << endl;
    }
}


Measured memory_bytes: 3620
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<vector>
using namespace std;
int main() {
	int n, y;
	cin >> n >> y;
	for (int i = 0; i <= n && i <= y / 10000; i++) {
		int f = y - i * 10000;
		int g = n - i;
		int h = f - g * 1000;
		if (h < 0)continue;
		if (g - (h / 4000) < 0)continue;
		if (h % 4000 == 0) {
			cout << i << " " << h / 4000 << " " << g - (h / 4000) << endl;
			getchar();
			getchar();
			return 0;
		}
	}
	cout << -1 << " " << -1 << " " << -1 << endl;
	return 0;
}

Measured memory_bytes: 256
/*
 * Ankit Raj, NIT Agartala
 */
#include<bits/stdc++.h>
using namespace std;
#define lld long long int
#define MAX_RANGE 10000007
#define BOOST ios_base::sync_with_stdio(0) 
#define NITRO cin.tie(NULL)
#define pb push_back
#define mp make_pair
#define F first
#define S second
int main()
{
	BOOST;
	NITRO;
	clock_t t1,t2;
	t1 = clock();
	/*
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	*/ 
	//Main Code
	int a,b,k;
	cin>>a>>b>>k;
	int hcf = __gcd(a,b);
	vector<int>arr;
	for(int i=1;i<=hcf;i++)
	{
		if(hcf%i==0)
		{
			arr.pb(i);
		}
	}
	reverse(arr.begin(),arr.end());
	cout<<arr[k-1]<<"\n";

	t2 = clock();
	float diff = (float)t2 - (float)t1;
	float execution_time = diff/CLOCKS_PER_SEC;
	//cout<<"\n"<<execution_time;
	//system("pause");
}


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

int n;
int a[10005];
int main()
{
	int i,j,k;
	scanf("%d",&n);
	for(i=1;i<=100;i++)
	{
		for(j=1;j<=100;j++)
		{
			int t=i*i+i*j+j*j;
			if(t>10000) break;
			for(k=1;k<=100;k++)
			{
				int s=t+k*k+k*i+k*j;
				if(s>10000) break;
				a[s]++;
			}
		}
	}
	for(i=1;i<=n;i++)
	printf("%d\n",a[i]);
	return 0;
}

Measured memory_bytes: 3756
#include<iostream>
using namespace std;
int main(){
  int N;
  cin >> N;
  double ans = 0.0;
  for(int i=0; i<N; i++){
    double x;
    string u;
    cin >> x >> u;
    if(u=="JPY"){
      ans += x;
    }else{
      ans += 380000.0*x;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main ()
{
  set < string > s;
  string x;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++)
    {
      cin >> x;
      s.insert (x);
    }
  cout << s.size ();
}


Measured memory_bytes: 19176
#include <iostream>
#include <vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<map>
#include<math.h>
#include<queue>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int MOD = 1000000007;
const int mod = 1000000007;
const int INF = 1000000000;
const long long LINF = 1e18;
const int MAX = 510000;
int main() {
	int n, m;
	cin >> n >> m;
	vector<int> a(n);

	for (int i = 0; i < m; i++) {
		int c, b;
		cin >> c >> b;
		a.at(c-1)++;
		a.at(b-1)++;
	}
	for (int i = 0; i < n; i++) {
		cout << a.at(i) << endl;
	}
	return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<string>

using namespace std;

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

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

int main() {
    int r, c;
    int sheet[101][101];
    for(int i=0; i<100; i++){
        for(int j=0; j<100; j++){
            sheet[i][j]=0;
        }
    }
    
    cin >> r >> c;
    for(int i=0; i<r; i++){
        for(int j=0; j<c; j++){
            cin >> sheet[i][j];
        }
    }
    int sum_r, sum_c, sum;
    for(int i=0; i<r; i++){
        sum_r=0;
        for(int j=0; j<c; j++){
            sum_r += sheet[i][j];
            cout << sheet[i][j] << " ";
        }
        cout << sum_r << endl;
    }
    sum=0;
    for(int i=0; i<c; i++){
        sum_c=0;
        for(int j=0; j<r; j++){
            sum_c += sheet[j][i];
        }
        sum += sum_c;
        cout << sum_c << " ";
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 1200
a = input()
columns = a.split(' ')          #??\??????????????????????????§??????
num_of_student = int(columns[0])   #???????????°
Baton = int(columns[1])            #??????????????°

student_bib = []
for i in range(num_of_student):
    student_bib.append(int(input()))   #???????????????????????\???

for Baton_num in range(Baton + 1):   #??????????????????
    if Baton_num == 0:          #????????????????????????
        continue
    m = 0
    for j in range(num_of_student):     #???????????°?????????????????????
        if num_of_student - 1 == m:
            break
        if (student_bib[m] % Baton_num) > (student_bib[m + 1] % Baton_num):
            student_bib_tmp = student_bib[m]
            student_bib[m] = student_bib[m + 1]
            student_bib[m + 1] = student_bib_tmp  #??????????????????
        m += 1


for student_bib_ in student_bib:
    print(student_bib_)

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

#define int long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define all(c) (c).begin(),(c).end()
#define F first
#define S second
#define fast ios:: sync_with_stdio(false),cin.tie(nullptr);
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;

const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = inf + 7;
const ld PI = acos(-1.0);

int32_t main(){
	fast;
	int ans = 0;
	int n,a;
	cin >> n;
	f(i,0,n)
	{
		cin >> a;
		ans = __gcd(ans,a);
	}
	cout << ans;
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int n, h[11];
	double a;
	for (int i = 1; i <= 9; i++) {
		h[i] = 0;
	}
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a;
		if (a < 165) {
			h[1] += 1;
		}
		else {
			if (a < 170) {
				h[2] += 1;
			}
			else {
				if (a < 175) {
					h[3] += 1;
				}
				else {
					if (a < 180) {
						h[4] += 1;
					}
					else {
						if (a < 185) {
							h[5] += 1;
						}
						else {
							h[6] += 1;
						}
					}
				}
			}
		}
	}
	for (int i = 1; i <= 6; i++) {
		cout << i << ":";
		for (int z = 1; z <= h[i]; z++) {
			cout << "*";
		}
		cout << endl;
	}
}


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

#define ll long long
#define ar array
#define vi vector<int>
#define INF 1000000000

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int N, M;
	cin >> N >> M;
	int work = 0;	
	while(M--){
		int days; cin >> days;
		work += days;
		if(work > N){
			cout << -1 << endl;
			break;
		}
	}
	if(work <= N) cout << N - work << endl;

	return 0;
}


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

mt19937_64 llrand((int) chrono::steady_clock::now().time_since_epoch().count());

#define st first
#define nd second
#define pb push_back

#ifndef ONLINE_JUDGE
  #define db(x) cerr << #x << " == " << x << endl
  #define dbs(x) cerr << x << endl
  #define _ << ", " <<
#else
  #define db(x) ((void)0)
  #define dbs(x) ((void)0)
#endif

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;

const int INF = 0x3f3f3f3f, MOD = 1e9+7;
const int N = 2e5+5;

int n, a, cnt[N];

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> n;
  for(int i = 1; i < n; i++) cin >> a, cnt[a]++;

  for(int i = 1; i <= n; i++) cout << cnt[i] << "\n";

}


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

class UnionFind {
public:
    vector<int> par;  // 各頂点の親
    vector<int> rank;  // 各頂点の深さ
    vector<int> sz;  // 各頂点の属する頂点の個数
    int sum_sz;  // 独立集合の個数

    // コンストラクタ
    UnionFind(int n) {
        for (int i = 0; i < n; ++i) {
            par.push_back(i);
            rank.push_back(0);
            sz.push_back(1);
        }
        sum_sz = n;
    }

    // 木の根を求める
    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 (rank[x] < rank[y]) par[x] = y;
        else if (rank[x] > rank[y]) par[y] = x;
        else {
            par[y] = x;
            ++rank[x];
        }
        --sum_sz;
        sz[x] = sz[y] = sz[x] + sz[y];
    }

    // x と y が同じ木に属するかの判定
    bool is_same(int x, int y) {
        return find(x) == find(y);
    }

    // 頂点 x が属する集合の頂点数
    int size(int x) {
        return sz[find(x)];
    }

    // 独立した集合の個数
    int size() {
        return sum_sz;
    }
};

int main() {
    int N, M;  cin >> N >> M;
    UnionFind uf(N);
    for (int i = 0; i < M; ++i) {
        int a, b;  cin >> a >> b;  --a;  --b;
        uf.unite(a, b);
    }
    int ans = 0;
    for (int i = 0; i < N; ++i) {
        ans = max(ans, uf.size(i));
    }
    cout << ans << endl;
}


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

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        int c = 0;
        for (int x = 1; x <= sqrt(i); x++)
        {
            for (int y = 1; y <= sqrt(i); y++)
            {
                // cout << (y + x) * (y + x) - 4 * (-i + x * x + y * y + x * y) << "\n";
                int tmp = pow(x + y, 2) - 4 * (pow(x, 2) + pow(y, 2) + x * y - i);
                if (tmp == 0)
                {
                    int z = (-1 * (x + y) + sqrt(tmp)) / 2;
                    if (z >= 1 && pow(x, 2) + pow(y, 2) + pow(z, 2) + x * y + y * z + z * x == i)
                    {
                        c++;
                    }
                }
                else if (tmp > 0)
                {
                    int z = (-1 * (x + y) + sqrt(tmp)) / 2;
                    if (z >= 1 && pow(x, 2) + pow(y, 2) + pow(z, 2) + x * y + y * z + z * x == i)
                    {
                        c++;
                    }
                    z = (-1 * (x + y) - sqrt(tmp)) / 2;
                    if (z >= 1 && pow(x, 2) + pow(y, 2) + pow(z, 2) + x * y + y * z + z * x == i)
                    {
                        c++;
                    }
                }
            }
        }
        cout << c << " \n";
    }
}

Measured memory_bytes: 3152
a,b,c,x,y = map(int,input().split())

if a+b <= 2*c :
    print(x*a+y*b)
else :
    if x <= y :
        print(min(2*x*c+(y-x)*b,2*y*c))
    else:
        print(min(2*y*c+(x-y)*a,2*x*c))


Measured memory_bytes: 8952
import std.stdio, std.string, std.array, std.conv;

void main() {
    int n = readln.chomp.to!int;
    int[] a = readln.chomp.split.to!(int[]);
    a[] -= 1;
    int[] b = readln.chomp.split.to!(int[]);
    int[] c = readln.chomp.split.to!(int[]);
    int prev = int.min, sum;
    foreach (x; a) {
        sum += b[x];
        if (prev == x - 1) sum += c[prev];
        prev = x;
    }
    sum.writeln;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define endl "\n"
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
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;};



signed main() {
	//cin.tie(0);
	//cout.tie(0);
	//ios::sync_with_stdio(false);
	
	int n, m, x;
	cin >> n >> m >> x;
	int c[n], a[n][m];
	rep(i, n) {
		cin >> c[i];
		rep(j, m) cin >> a[i][j];
	}
	int ans = LLONG_MAX;

	for(int bit = 0; bit < (1 << n); bit++) {
		vector<int> sep;
		rep(i, n) {
			if((bit >> i) & 1) sep.push_back(i);
		}
		int ri[m] = {};
		int cost = 0;
		rep(i, sep.size()) {
			rep(j, m) {
				ri[j] += a[sep[i]][j];
			}
			cost += c[sep[i]];
		}
		bool f = 1;
		rep(i, m) {
			if(ri[i] < x) f = 0;
		}
		//cout << cost << endl;
		if(f) chmin(ans, cost);
		//cout << f << endl;
		//rep(i, m) cout << ri[i] << " ";
		//cout << endl;
	}
	if(ans != LLONG_MAX) cout << ans << endl;
	else puts("-1");
	return 0;
}

Measured memory_bytes: 3632
import math
a,b,x = [int(x) for x in input().split()]
ans = 0
if x<=a*b/2*a:
  ans = 2*x/(a*b)
  print(90-math.degrees(math.atan(ans/b)))
else:
  x = a**2*b-x
  ans = 2*x/(a*a)
  print(math.degrees(math.atan(ans/a)))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
int n,m;
int arr[200001];
long long num[200001];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    for (int i=1;i<=n;i++){
        cin>>arr[i];
        num[arr[i]]++;
    }
    long long tot=0;
    for (int i=1;i<=n;i++){
        tot+=(num[i]*(num[i]-1))/2;
    }
    for (int i=1;i<=n;i++){
        long long cur=num[arr[i]];
        long long ans=tot;
        ans-=(cur*(cur-1))/2;
        ans+=((cur-2)*(cur-1))/2;
        cout<<ans<<'\n';
    }
}

Measured memory_bytes: 3968
n,m = map(int,input().split())
a = [list(map(int,input().split())) for i in range(n)]
b = [list(map(int,input().split())) for i in range(m)]
for i in range(n):
    c = float("inf")
    e = 0
    g = 0
    for j in range(m):
        d = abs(a[i][0]-b[j][0])+abs(a[i][1]-b[j][1])
        g+=1
        if d <c:
            c,e=d,g
    print(e)

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

void ABC136B()
{
	int N;
	cin >> N;
	string S = to_string(N);
	size_t m = S.size();
	if (m <= 2)
	{
		cout << min(N,9) << endl;
		return;
	}
	if (m == 3)
	{
		int x = 10 + N - 100;
		cout << x << endl;
	}
	if (m == 4)
	{
		int x = 909;
		cout << x << endl;
		return;
	}
	if (m == 5)
	{
		int x = 910;
		x += N - 10000;
		cout << x << endl;
	}
	if (m == 6)
	{
		cout << 90909 << endl;
	}
}
int main()
{
	ABC136B();
	return 0;
}

Measured memory_bytes: 256
let calc (x, y, z) = x * x + y * y + z * z + x * y + y * z + z * x

let count (x, y, z) = 
  if x = y && x = z then 
    1
  else if x <> y && y <> z && z <> x then
    6
  else 
    3

let n = stdin.ReadLine() |> int

seq {
    for x in 1 .. n do
      if calc (x, 1, 1) <= n then
        for y in 1 .. x do
          if calc (x, y, 1) <= n then
            for z in 1 .. y do
              if calc (x, y, z) <= n then yield (calc (x, y, z), count (x, y, z))
} 
|> Seq.append (seq {for k in 1 .. n -> (k, 0)})
|> Seq.groupBy (fun (calc, _) -> calc)
|> Seq.sortBy (fun (i, _)-> i)
|> Seq.map (fun (_, items) -> Seq.fold (fun sum (_, num) -> sum + num) 0 items)
|> Seq.iter (printfn "%d")


Measured memory_bytes: 48984
#include<iostream>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>

using namespace std;

int N;
int Volume[50];
bool WaterIn[50], Tmp[50];


bool calculation(int id, int volumeOfCurrent) {
	//cout << "rest:" << volumeOfCurrent << "      :id" << id << endl;

	if (id < -1) {
		return false;
	}
	if (volumeOfCurrent == 0) {
		return true;
	}
	
	if (!Tmp[id]) {
		return calculation(id - 1, volumeOfCurrent);
	}

	if (Volume[id] <= volumeOfCurrent) {
		Tmp[id] = false;
		if (calculation(id - 1, volumeOfCurrent - Volume[id])) {
			return true;
		}
		Tmp[id] = true;
	}
	
	return calculation(id - 1, volumeOfCurrent);
}

bool solve(int beakerId, int rest) {
	
	if (rest == 0) {
		//judge
		copy(WaterIn, WaterIn + N, Tmp);
		/*for (int i = 0; i < N; ++i) {
			Tmp[i] = WaterIn[i];
		}*/
		for (int i = 0; i < N; ++i) {
			if (Tmp[i]) {
				continue;
			}
			if (!calculation(i-1, Volume[i])) {
				return false;
			}
			Tmp[i] = true;
		}
		return true;
	}

	if (Volume[beakerId] > rest) {
		return false;
	}

	WaterIn[beakerId] = true;
	if (solve(beakerId + 1, rest - Volume[beakerId])) {
		return true;
	}
	WaterIn[beakerId] = false;
	return (solve(beakerId + 1, rest));
}

int main() {

	while (cin >> N, N) {
		memset(Volume, 0, sizeof(Volume));
		memset(WaterIn, false, sizeof(WaterIn));
		for (int i = 0; i < N; ++i) {
			cin >> Volume[i];
		}
		sort(Volume, Volume + N);
		WaterIn[0] = true;
	
		if (solve(1, Volume[N - 1] - Volume[0])) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}

	return 0;
}




Measured memory_bytes: 3020
#include<iostream>
#include<deque>
#include<map>
using namespace std;
typedef long long int LL;
typedef pair<LL,int> P;
LL t[100005];
LL dp[100005];
deque<P> d1;
int main(){
	int m,n,p;
	LL i,j,k;
	LL a,b,c;
	LL s=0;
	cin>>n>>m>>p;
	for(i=0;i<n;i++){
		cin>>t[i];
		dp[i+1]=t[i];
	}
	for(i=2;i<=p;i++){
		for(j=0;j<n;j++){
			while(!d1.empty()){
				a=d1.front().first,b=d1.front().second;
				if(j<=b+m)break;
				else d1.pop_front();
			}
			if(d1.empty() || a==0)c=0;
			else c=a+t[j]*i;
			while(!d1.empty() && d1.back().first<dp[j+1])d1.pop_back();
			d1.push_back(make_pair(dp[j+1],j));
			dp[j+1]=c;
		}
		d1.clear();
		//for(j=0;j<=n;j++){
			//cout<<dp[j]<<" ";
		//}
		//cout<<endl;
	}
	for(i=0;i<=n;i++){
		if(s<dp[i])s=dp[i];
	}
	cout<<s<<endl;
	return 0;
}



Measured memory_bytes: 1792
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>

using namespace std;

#define DIGIT_MAX 100010
#define MOD 1000000007

long long int modpow(int p,long long int base)
{
	if (0 == p){
		return 1;
	}

	long long int ret = modpow(p / 2, base);
	if (0 == p % 2){
		return (ret*ret) % MOD;
	}
	else{
		return (((ret*ret) % MOD) * base) % MOD;
	}
}

int main()
{
	FILE *fin = NULL, *fout = NULL;
	//fin = freopen("input.txt", "r", stdin);
	//fout = freopen("output.txt", "w", stdout);

	//while (true){
		char str[DIGIT_MAX]; scanf("%s", str);
		int digit = strlen(str);

		long long int ret = modpow(digit,3);
		long long int part = 1;
		for (int i = 0; i < digit; i++){
			if ('1' == str[i]){
				part = (part * 2) % MOD;
			}
			if ('0' == str[i]){
				ret = ((ret+MOD) - ((((part * 2) % MOD) * modpow(digit - i - 1, 3))%MOD)) % MOD;
			}
		}

		printf("%lld\n", ret);

	//	int val = 0;
	//	for (int i = 0; i < digit; i++){
	//		if('1'==str[i]) val += pow(2, digit - i - 1);
	//	}
	//	int cnt = 0;
	//	for (int a = 0; a <= val; a++){
	//		for (int b = 0; b <= val; b++){
	//			if (a + b == (a^b) && a+b<=val){
	//				cnt++;
	//			}
	//		}
	//	}
	//	printf("%d\n", cnt);
	//}


	//finalize
	if (NULL != fin) fclose(fin);
	if (NULL != fout) fclose(fout);

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <bitset>

const int N = 400 + 10;

int n, m;
int x[N * N], y[N * N];

std::bitset<N> mask[N];

std::bitset<N> solve(int s) {
  std::bitset<N> res;
  res[s] = 1;
  for (int i = m; i > 0; --i) {
    int a = x[i], b = y[i];
    if (res[a] && res[b]) {
      res.set();
      return res;
    }
    if (res[b]) std::swap(a, b);
    if (res[a]) res[b] = 1;
  }
  return res;
}

int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; ++i) scanf("%d%d", &x[i], &y[i]);
  for (int i = 1; i <= n; ++i) mask[i] = solve(i);
  int ans = 0;
  for (int i = 1; i <= n; ++i)
      for (int j = 1; j < i; ++j)
        ans += !mask[i].all() && !mask[j].all() && (mask[i] & mask[j]).none();
  printf("%d\n", ans);
  return 0;
}


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

int main() {
    int n;
    bool shingi = false;
    cin >> n;
    while (n) {
        if (n % 10 == 7) shingi = true;
        n /= 10;
    }
    if (shingi) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0; 
}

Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define fi first
#define se second
#define ll long long
//priority_queue<int, vector<int>, greater<int> > pq;
#define _CRT_SECURE_NO_DEPRECATE
const int N = 330030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =  1e9+7;
using namespace std;

int main() {
ll n,k;
cin>>n>>k;
cout<<3*(n-__gcd(n,k));

}


Measured memory_bytes: 256
module Main where
import qualified Control.Monad as C
import qualified Data.Char as C
import qualified Data.List as L
import qualified Data.Map as M
import qualified Data.Array as A

int = read :: String -> Int
getWord :: IO String
getWord = do
  c <- getChar
  if C.isSpace c
  then
    return []
  else do
    ws <- getWord
    return (c:ws)
getInt = fmap int getWord
replace pred a = map (\x -> if pred x then a else x)

main = interact $ printer . solver . parser
parser = map int . words
printer = unlines . (:[]) . show

solver (k:n:a0:as) = k - mx
  where
    bs = as ++ [ a0 + k ]
    cs = zipWith (-) bs (a0:as) 
    mx = maximum cs

Measured memory_bytes: 2428
#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(v, n) sort(v, v+n)
#define VSORT(v) sort(v.begin(), v.end())
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 999999999
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(){

    int A,P;
    cin >> A >> P;
    int b = A*3;
    b+=P;
    cout << b/2 << endl;

    return 0;
}

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

namespace ABC147D
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = Cin.Long();
            var A = Cin.LArr();
            var solver = new Solver(N, A);

            Console.WriteLine(solver.Solve());
        }
    }

    class Solver
    {
        private long N;
        private long[] A;
        public Solver(long n, long[] a)
        {
            N = n;
            A = a;
        }

        public IConvertible Solve()
        {
            long MOD = 1000000007;

            long ans = 0;
            long n = 1;
            for (int i = 0; i < 61; i++)
            {
                long cx = 0;
                long cy = 0;
                for (int j = 0; j < N; j++)
                {
                    cx += (A[j] >> i) % 2;
                    cy += ((A[j] >> i) % 2) == 0 ? 1 : 0;
                }
                ans = (ans + (cx * cy % MOD) * n) % MOD;
                n *= 2;
                n %= MOD;
            }
            return ans;
        }
    }

    internal static class Cin
    {
        public static string String()
        {
            return Console.ReadLine();
        }

        public static int Int()
        {
            return int.Parse(String());
        }

        public static int[] IArr()
        {
            return Split().Select(int.Parse).ToArray();
        }

        public static long Long()
        {
            return long.Parse(String());
        }

        public static long[] LArr()
        {
            return Split().Select(long.Parse).ToArray();
        }

        public static double Double()
        {
            return double.Parse(String());
        }

        public static double[] DArr()
        {
            return Split().Select(double.Parse).ToArray();
        }

        private static IEnumerable<String> Split()
        {
            return String().Split(' ');
        }
    }
}

Measured memory_bytes: 50632
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD=1000000007;

int main() {
  ll N;
  cin>>N;
  vector<ll> a(N);
  for(int i=0;i<N;i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  if(N%3==0&&a[0]==a[N/3-1]&&a[N/3]==a[N*2/3-1]&&a[N*2/3]==a[N-1]&&(a[0]|a[N/3])-(a[0]&a[N/3])==a[N*2/3]){
    cout<<"Yes";
  }
  else if(a[0]==a[N-1]&&a[0]==0){
    cout<<"Yes";
  }
  else{
    cout<<"No";
  }
  
}

Measured memory_bytes: 1024
n = int(input())
a = ["" for i in range(n)]
for i in range(n):
	a[i] = int(input())

a_sort = sorted(a)
max = a_sort[-1]
second = a_sort[-2]

for i in range(n):
	if a[i] == max:
		print(second)
	else:
		print(max)


Measured memory_bytes: 15100
import java.util.*;
public class Main {
  
  public static int gcd2(int i, int j){
    if(i == 0){
      return j;
    }
    else
    {
      return gcd2(j%i, i);
    }
  }
  
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
    int sum = 0;
    for(int i = 1; i <= n; i++){
      	for(int j = i+1; j <= n; j++){
          	int gcd2tmp = gcd2(i, j);
          	for(int k = j+1; k <= n; k++){
            	//3 items
      			sum += gcd2(gcd2tmp, k) * 6;
          	}
          	//2 items
          	sum += gcd2tmp * 6;
          	//System.out.println(gcd2tmp);
    	}
      //1 item
      sum += i;
    }
    
    System.out.println(sum);
  }
}

Measured memory_bytes: 35724
#include <stdio.h>

/*  選択ソート(0オリジン) */
int selectionSort(int A[], int N) {
    int i, j, t, sw =0, minj;
    for(i=0;i<N-1;i++) {
        minj = i;
        for(j=i;j<N;j++) {
            if(A[j]<A[minj]) minj = j;
        }
        t=A[i]; A[i]=A[minj]; A[minj]=t;
        if(i!=minj) sw++;
    }
    return sw;
}

int main(void) {
    int A[100], N, i, sw;

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

    sw = selectionSort(A,N);

    for(i=0;i<N;i++) {
        if(i>0) printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
    printf("%d\n",sw);

    return 0;
}




Measured memory_bytes: 2100
#include<stdio.h>
int main(){
	int i,j,t;
	int two=0;
	int five=0;
	long long int n;
	for(;scanf("%lld",&n)&& n;two=0,five=0){
		for(i=1;i<=n;i++){
			if(!(i%2)){
				t=i;
				for(;1;){
					if(t%2==0)two++;
					else break;
					t/=2;
				}
			}
			if(!(i%5)){
				t=i;
				for(;1;){
					if(t%5==0)five++;
					else break;
					t/=5;
				}
			}
		}
		if(two!=0&&five!=0&&five>two)printf("%d\n",two);
		else if(two!=0&&five!=0&&five<=two)printf("%d\n",five);
		else printf("0\n");
	}
	return 0;
}

Measured memory_bytes: 0
t=["0","3","5","7"]
s=["3","5","7"]
n=int(input())
ans=chk=0
for a in t:
    for b in t:
        for c in t:
            for d in t:
                for e in t:
                    for f in t:
                        for g in s:
                            for h in s:
                                for i in s:
                                    x=str(int(a+b+c+d+e+f+g+h+i))
                                    y=set(list(x))
                                    if ("0" not in y) and (len(y)==3) and (int(x)<=n):
                                        ans+=1
print(ans)

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

int main() {
  int A,B;
  cin >> A >> B;
  int ans= A+B;
  if ((A-B)>ans){
    ans= A-B;
  }
  if (A*B>ans){
    ans = A*B;
  }
  cout << ans <<endl;
  
  
}

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

int main()
{
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  bool conti = true;
  bool taka;
  
  while (conti) {
    c -= b;
    if (c <= 0) {
      conti = false;
      taka = true;
      break;
    }
    a -= d;
    if (a <= 0) {
      conti = false;
      taka = false;
      break;
    }
  }
  if (taka) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

typedef long long LL;
typedef pair<int, int> II;

const int N = (int) 5e5 + 10;
int n, q, a[N], pos[N], b[N];

int main() {
#ifdef LOCAL
    freopen("inp", "r", stdin);
    freopen("out", "w", stdout);
#endif
    scanf("%d%d", &n, &pos[0]);
    for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);

    for (int i = 1; i <= n; ++i) {
        if (pos[i - 1] >= a[i]) pos[i] = pos[i - 1] - a[i]; else
        if (pos[i - 1] - a[i] > -pos[i - 1]) pos[i] = a[i] - pos[i - 1];
        else pos[i] = pos[i - 1];
    }
    b[n + 1] = 1;
    for (int i = n; i >= 1; --i) b[i] = (b[i + 1] <= a[i] / 2) ? b[i + 1] : (b[i + 1] + a[i]);

    scanf("%d", &q);
    while (q--) {
        int i; scanf("%d", &i);
        puts(pos[i - 1] >= b[i + 1] ? "YES" : "NO");
    }
    return 0;
}


Measured memory_bytes: 7808
s = raw_input()

m = [i for i in xrange(1,13)]
y = [i for i in xrange(100)]
f2 = int(s[:2])
l2 = int(s[2:])
if (f2 in m and f2 in y) and (l2 in m and l2 in y):
    print "AMBIGUOUS"
elif f2 in m and l2 in y   :
    print "MMYY"
elif f2 in y and l2 in m:
    print "YYMM"
else:
    print "NA"

Measured memory_bytes: 2568
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

S = list(s())
S[3] = '8'
print(''.join(S))


Measured memory_bytes: 9920
/*
    C - Prison
    https://atcoder.jp/contests/abc127/tasks/abc127_c

    1 <= ans <= 10^5
*/
#include <bits/stdc++.h>
using namespace std;

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

    int n, m;
    cin >> n >> m;
    int low = -100000, high = 100000;

    for (int i = 0; i < m; i++) {
        int l, r;
        cin >> l >> r;
        low = max(low, l);
        high = min(high, r);
    }

    // cerr << "low, high = " << low << ", " << high << endl;

    if (low > high)
        cout << 0 << endl;
    else
        cout << (high - low + 1) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
	int a;
	cin >> a;
	if (a >= 400 && a <= 599)cout << 8;
	else if (a >= 600 && a <= 799)cout << 7;
	else if (a >= 800 && a <= 999)cout << 6;
	else if (a >= 1000 && a <= 1199)cout << 5;
	else if (a >= 1200 && a<= 1399)cout << 4;
	else if (a >= 1400 && a <= 1599)cout << 3;
	else if (a >= 1600 && a <= 1799)cout << 2;
	else if (a >= 1800 && a <= 1999)cout << 1;

    return 0;
}



Measured memory_bytes: 3628