akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[][] array = new Integer[m][m];
		String s = sc.next();
		List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		String g = "";
		for(int i=list.size()-1;i>=0;i--) {
			g = g+list.get(i);
		}
		//System.out.println(g);
		List<String> list_g= new ArrayList<String>(Arrays.asList(g.split("")));
		int count=0;
		for(int i=0;list.size()>i;i++) {
			if(!list.get(i).equals(list_g.get(i)))
				count++;
		}
		System.out.println(count/2);
	}
}

Measured memory_bytes: 23764
x = gets.to_i

if 400 <= x && x <= 599 
    puts 8
elsif 600 <= x && x <= 799 
    puts 7
elsif 800 <= x && x <= 999 
    puts 6
elsif 1000 <= x && x <= 1199 
    puts 5
elsif 1200 <= x && x <= 1399 
    puts 4
elsif 1400 <= x && x <= 1599 
    puts 3
elsif 1600 <= x && x <= 1799 
    puts 2
else
    puts 1
end


Measured memory_bytes: 14380
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<ll,ll> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const double PI=3.141592653589;
const int INF=1000000007;
const ll LMAX=1000000000000001;
int gcd(int a,int b){if(a<b)swap(a,b);int c=a%b;while(c!=0){a=b;b=c;c=a%b;}return b;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};


int main(){
  string s; cin >> s;
  if (s == "ABC")
  puts("ARC");
  else
  puts("ABC");

  return 0;
}


Measured memory_bytes: 3628
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>

typedef struct
{
	int  a;
	int  b;
	char operator;
} abc050a_t;

int abc050a (const abc050a_t const * test_data);

int main (void)
{
	// variables for `main`
	abc050a_t test_data;
	int       retval_scanf;

	// STEP.01
	// read out the given data
	retval_scanf = scanf("%d %s %d", &test_data.a, &test_data.operator, &test_data.b);

	// STEP.02
	// calculate & output the points
	printf( "%d\n", abc050a(&test_data) );

	// STEP.END
	return EXIT_SUCCESS;
}

int abc050a (const abc050a_t const * test_data)
{
	if   ( (*test_data).operator == '+' ) return (*test_data).a + (*test_data).b;
	else                                  return (*test_data).a - (*test_data).b;
}

Measured memory_bytes: 128
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
for i in range(N):
    ans += min(A[i], B[i])
    ans += min(A[i+1], B[i] - min(A[i], B[i]))
    A[i+1] -= min(A[i+1], B[i] - min(A[i], B[i]))
print(ans)

Measured memory_bytes: 18624
#include <iostream>
#include <set>
#include <string>
using namespace std;
string bufo,bufstr;

int main() {
  int n;
  set<string> dict;
  cin >> n;
  for (int i=0;i<n;++i) {
    cin >> bufo >> bufstr;
    if (bufo=="insert") {
      dict.insert(bufstr);
    }
    else {
      int yn;
      yn = dict.count(bufstr);
      if (yn==1) cout << "yes" << endl;
      else cout << "no" << endl;
    }
  }
}

Measured memory_bytes: 30624
#pragma GCC optimize ("-O3")
#include <bits/stdc++.h>
#define pb push_back
#define pll pair<ll, ll>
#define mll map<ll, ll>
#define ff first
#define oo 1000000000000000005
#define ss second
#define el "\n"
#define maxS 200005
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    // ll t;cin>>t;while(t--)
    {
        ll n, m, x;
        cin>>n>>m>>x;
        ll c[n];
        ll mat[n][m];
        
        for(ll i=0 ; i<n ; i++)
        {
            cin>>c[i];
            for(ll j=0 ;  j<m ; j++)
            cin>>mat[i][j];
        }
        
        ll ans = INT_MAX;
        for(ll i=1 ; i< (1<<n) ; i++)
        {
            ll currX[m], tmp = i, k=0, cost = 0;
            memset(currX, 0, sizeof currX);
            
            while(tmp)
            {
                ll mn = INT_MAX;
                if(tmp & 1)
                {
                    cost += c[k];
                    for(ll j=0 ; j<m ; j++)
                    {
                        currX[j] += mat[k][j];
                        mn = min(mn, currX[j]);
                    }
                    if(mn >= x)
                    {
                        ans = min(ans, cost);
                        break;
                    }
                }
                tmp >>= 1;
                k++;
            }
        }
        
        if(ans == INT_MAX)
            ans = -1;
        
        cout<<ans<<el;
    }
    
    return 0;
}

Measured memory_bytes: 3696
#include<bits/stdc++.h>
#define to edge[i].v
#define mp make_pair
#define rint register int
#define debug(x) cerr<<#x<<"="<<x<<endl
#define fgx cerr<<"-------------"<<endl
#define N 1000000
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
char a[N],b[N];
int main()
{	int n,m,g; cin>>n>>m; g=__gcd(n,m); scanf("%s%s",a+1,b+1); ll lcm=(ll)n*m/g;
	for(rint i=1,j=1;i<=n&&j<=m;)
	{//	cerr<<i<<" "<<j<<endl;
		if(a[i]!=b[j]) return !printf("-1");
		i+=lcm/m,j+=lcm/n;
	}
	cout<<lcm;
	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<algorithm>
#define ll long long
using namespace std;
bool cmp(int a,int b){
	return a>b;
}
int main(){
	ll n,k,sum=0;
	ll i;
	cin>>n>>k;
	ll num[n];
	for(i=0;i<n;i++)
	cin>>num[i];
	sort(num,num+n,cmp);
	for(i=0;i<k;i++)
	{
		sum+=num[i];
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
//AUTHOR:BlackBox Inc.//
#include<bits/stdc++.h>
#include<unordered_map>
#include<tr1/unordered_map>
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define vlli vector<long long int>
#define vvi vector<vector<int>>
#define endl "\n"
#define vpii vector<pair<int,int>>
#define vs vector<string>
#define lin1(x) ll int x; x = scan();
#define lin2(x,y) ll int x, y; x = scan(), y = scan();
#define lin3(x,y,z) ll int x, y, z; x = scan(), y = scan(), z = scan();
#define pb(x) push_back(x)
#define makep(x,y) make_pair(x,y)
#define mx(a,b) (a)>(b)?(a):(b)
#define mn(a,b) (a)<(b)?(a):(b)
#define fori(s,e) for(i=s;i<=e;i++)
#define forj(s,e) for(j=s;j<=e;j++)
#define fork(s,e) for(k=s;k<=e;k++)
#define rep(i,s,e) for(int i=s;i<=e;i++)
#define brep(i,s,e) for(int i=s;i>=e;i--)
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x));
#define bits1(x) __builtin_popcount(x)
#define pi 3.14159265358979323846264338327950
#define MOD7 1000000007
#define MOD9 1000000009
#define cn cin>>
#define co cout<<
#define fast std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
using namespace std::tr1;

int main()
{

long long a,b,c,d,e,f,g,h;

cin>>a>>b;

int round=(a+b+1)/2;
{
	/* code */
}
cout<<round;
return 0;
}

Measured memory_bytes: 3440
import math
N,D=map(int,input().split())
X=[list(map(int,input().split())) for _ in range(N)]
count=0
for i in range(N):
  for j in range(i+1,N,1):
    r2=0
    for k in range(D):
      r2+=(X[i][k]-X[j][k])*(X[i][k]-X[j][k])
    r=math.sqrt(r2)
    if r.is_integer()==True:
      count+=1
print(count)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
//using System.Text;
//using System.Text.RegularExpressions;
//using System.Globalization;
//using System.Diagnostics;
using static System.Console;
//using System.Numerics;
//using static System.Math;
//using pair = Pair<int, int>;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;
    void chmax<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? b : a; }
    void chmin<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? a : b; }

    void solve()
    {
        string S = "N" + cin.next;
        int N = S.Length - 1;
        if (S[1] != '1' | S[N] != '0')
        {
            WriteLine("-1");
            return;
        }
        for (int i = 1; i <= N - 1; i++)
        {
            if (S[i] != S[N - i])
            {
                WriteLine(-1);
                return;
            }
        }
        WriteLine($"{N} {N - 1}");
        int now = N - 1;
        for (int i = N - 2; i > 0; i--)
        {
            WriteLine($"{i} {now}");
            if (S[i] == '1')
            {
                now = i;
            }
        }

    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

Measured memory_bytes: 17104
/*********************************************JMD**********************************************/
//                                  |\  |     | |   |   /\                                   //
    //                              | \ |     | |---|  /--\                              //
        //                          |  \| |___| |   | /    \1999                     //
/*******************************************************************************************/
#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;

#define mp make_pair
#define pb push_back
#define pf push_front
#define ss second
#define ff first
#define mem(x,val) memset(x,val,sizeof(x))
#define forr(i,a,b) for(ll i=a;i<b;i++)
#define f(i,n) forr(i,0,n)
#define sz(x) ll((x).size())
#define all(x) ((x).begin(),(x).end())
#define asc(x) ((int)(x))
#define precision(x) cout<<fixed<<setprecision((x));

const ll mod=1e9 + 7;

/*******************************************************************************************/

void solve()
{
    string s;
    cin>>s;

    ll n=s.size();

    ll ans=0;

    f(i,n)
    {
        if(s[i]!=s[n-1-i])
        {
            ans++;
            s[i]=s[n-1-i];
        }
    }
    cout<<ans<<endl;

    return;
}

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

    ll t=1;
    //cin>>t;
    clock_t launch=clock();

    while(t--)
    {
        solve();
    }

    clog<<((long double)(clock()-launch)/CLOCKS_PER_SEC)<<"\n";
}


Measured memory_bytes: 256
n = int(input())
A = list(map(int,input().split()))
if n%2 == 0:
    dmax = 0
    ans = sum(A[::2])
    d = [0]*(n//2 + 1)
    for i in range(n//2):
        d[i+1] = d[i] + A[-2*i-1] - A[-2*i-2]
        dmax = max(dmax, d[i+1])
    print(ans + dmax)
else:
    d1 = [0]*(n//2 + 1)
    d1max = [0]*(n//2 + 1)
    d2 = [0]*(n//2 + 1)
    d2max = 0
    ans = sum(A[:-2:2])
    for i in range(n//2):
      d1[i+1] = d1[i] + A[-2*i-1] - A[-2*i-2]
      d1max[i+1] = max(d1max[i], d1[i+1])
      d2[i+1] = d2[i] + A[-2*i-2] - A[-2*i-3]
      d2max = max(d2max, d2[i+1] + d1max[i+1])
    print(ans + d2max)


Measured memory_bytes: 31620
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    r = float(input())
    print(2*math.pi*r)
    return

#Solve
if __name__ == "__main__":
    solve()


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

int n,ans;
map<ll,int> cnt;

ll read(){
	ll x=0,f=1;char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-')  f=-f;
	for (;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	return x*f;
}

int main(){
	int n=read();
	for (int i=1;i<=n;i++){
		ll t=read(),x=1,y=1;
		for (ll i=2;i*i*i<=t;i++){
			int k=0;while (t%i==0) t/=i,k++;
			if (k%3==1) x*=i,y*=i*i;
			if (k%3==2) x*=i*i,y*=i;
		}
		x*=t;
		if ((ll)sqrt(t)*(ll)sqrt(t)==t)
		y*=(ll)sqrt(t); else y*=t*t;
		if (x==1) ans+=(++cnt[1]==1);
		else ans+=(++cnt[x]>cnt[y]);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 14208
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

int N;

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

    ll ans = 0LL;
    if (N % 2 == 0)
    {
        for (int i = 0; i < N; i++)
        {
            if (i < N / 2)
                ans -= 2 * A[i];
            else
                ans += 2 * A[i];
        }
        ans += A[N / 2 - 1] - A[N / 2];
    }
    else
    {
        ll a = 0LL;
        for (int i = 0; i < N; i++)
        {
            if (i < N / 2)
                ans -= 2 * A[i];
            else if (i > N / 2)
                ans += 2 * A[i];
        }
        ans = ans + max(A[N / 2] - A[N / 2 + 1], A[N / 2 - 1] - A[N / 2]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
num = input("").split()

W =int(num[0])
H =int(num[1])
x =int(num[2])
y =int(num[3])
r =int(num[4])

if x >= r and (x + r) <= W and y >= r and (y + r) <= H:
    print("Yes")
    
else:
    print("No")


Measured memory_bytes: 5596
from collections import defaultdict
import sys
h, w, n = map(int,sys.stdin.readline().split())

m3x3 =defaultdict(list)
for _ in range(n):
    a, b = map(int,sys.stdin.readline().split())
    for i in range(max(0, a - 3),min(h - 2, a)):
        for j in range(max(0, b - 3),min(w - 2, b)):
            if (i,j) in  m3x3:
                m3x3[(i,j)] +=1
            else:
                m3x3[(i,j)] =1
v = list(m3x3.values())
k = m3x3.keys()
print((w-2)*(h-2)-len(k))
for j in range(1,10):
    print(v.count(j))


Measured memory_bytes: 155484
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <string>
#include <math.h>
#include <map>
#include <numeric>
#include <stack>
#include <queue>
#include <functional>
#include <stdio.h>
#define ll long long
#define pl pair<ll,ll>
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vvvl vector<vector<vector<ll> > >
#define vd vector<double>
#define vvd vector<vector<double> >
#define vvvd vector<vector<vector<double> > >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define vvvb vector<vector<vector<bool> > >
#define rep(i,a) for(ll i = 0;i<a;++i)
#define rep1(i,a) for(ll i = 1;i<a;++i)
#define rrep(i,a) for(ll i = a;i>=0;--i)
#define mod 1000000007
#define inf 10010010010
using namespace std;

int main(){
	string s; cin >> s;
	ll q; cin >> q;
	ll count = 0;
	vl qs(q);
	vl t(q);
	vl f(q,-1);
	vector<char> c(q,'a');
	string lef = "", ri = "";
	rep(i, q){
		cin >> t[i];
		if (t[i] == 1){
			count++;
		}
		else{
			cin >> f[i];
			cin >> c[i];
			if (f[i] == 1){
				if(count%2 == 0)lef += c[i];
				else ri += c[i];
			}
			else{
				if (count % 2 == 0) ri += c[i];
				else lef += c[i];
			}
		}
	}
	reverse(lef.begin(), lef.end());
	s = lef + s + ri;
	if (count % 2) reverse(s.begin(), s.end());
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 6300
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(int argc,char **argv)
{
	int a = 0,b = 0;
	int e = 0;

	scanf("%d %d",&a,&b);

	if((a >= 1)&&(b <= 10000))
	{
		e = a * b;
		if (e % 2 == 0)
		{
			printf("Even\n");
		}
		else
		{
			printf("Odd\n");
		}
	}

	
}

Measured memory_bytes: 128
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
using namespace std;
int main(){
  long long X;
  cin>>X;
  int ans,wer;
  for(long long b=-10000;b<=10000;b++){
    int a=(X+b)%10;
    for(int i=0;i<10001;i++){
      long long A=i*10+a;
      if(A*A*A*A*A-b*b*b*b*b==X){
        ans=A;
        wer=b;
        i+=100000;
        b+=100000;
      }
    }
  }
  cout<<ans<<' '<<wer<<endl;
  
  return 0;
}

Measured memory_bytes: 3496
#include <iostream>

using namespace std;

static const int MAX = 100;

void trace(int A[], int N){
    for (int i = 0; i < N; i++){
        if (i) cout << " ";
        cout << A[i];
    }
    cout << endl;
}

int bubbleSort(int A[], int N){
    bool flag = true;
    int sw = 0;
    while (flag){
        flag = false;
        for (int j = N - 1; j > 0; j--){
            if (A[j] < A[j - 1]){
                int tmp = A[j];
                A[j] = A[j - 1];
                A[j - 1] = tmp;
                flag = true;
                sw++;
            }
        }
    }
    return sw;
}

int main(){
    int num;
    int A[MAX];

    cin >> num;
    for (int i = 0; i < num; i++) cin >> A[i];

    int count = bubbleSort(A, num);

    trace(A, num);
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 3084
import sys
import math
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix
import itertools
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
S = []
for i in range(N):
    tmp = input()
    S.append(tmp)

c = Counter(S)
print(len(c))


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

using namespace std;

int main(void) {
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    vector<int> dp(n);
    for (int i = 0; i < n; i++) cin >> h[i];
    dp[0] = 0;
    for (int i = 1; i < n; i++) dp[i] = INT32_MAX;

    for (int i = 0; i < n; i++)
        for (int j = i; j < min(n, i + k + 1); j++)
            dp[j] = min(dp[j], dp[i] + abs(h[j] - h[i]));


    cout << dp[n - 1] << endl;

    return 0;
}


Measured memory_bytes: 1024
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val t = (1..n).map { sc.nextInt() }
    var min = Int.MAX_VALUE
    var ans = 0
    repeat(n) {
        if (t[it] < min) {
            ans++
        }
        min = Math.min(min, t[it])
    }
    println(ans)
}

Measured memory_bytes: 77364
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
  int a[5],ans=0,k=1000,c=0;
  cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4];
  rep(i,5) if(a[i]%10!=0&&a[i]%10<k) k=a[i]%10,c=i;
  rep(i,5){
    if(a[i]%10==0||i==c) ans+=a[i];
    else ans+=(a[i]/10+1)*10;
  }
  cout<<ans;
}

Measured memory_bytes: 256
using System;
using System.IO;

public class Program
{
    static void Main(string[] args)
    {
        string s = Console.ReadLine();

        if ((s[0] == s[1]) && (s[0] == s[2]) && (s[0] == s[3])) Console.WriteLine("No");
        else if (((s[0] == s[1]) && (s[2] == s[3])) 
            || ((s[0] == s[2]) && (s[1] == s[3]))
            || ((s[0] == s[3]) && (s[1] == s[2]))) Console.WriteLine("Yes");
        else Console.WriteLine("No");
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long

using namespace std;

const ll MOD = 1e9 + 7;

ll lgput(ll b, int p) {
    ll ans = 1;
    while(p) {
        if(p % 2)
            ans = (ans * b) % MOD;
        b = (b * b) % MOD;

        p /= 2;
    }

    return ans;
}

ll invmod(ll x) {
    return lgput(x, MOD - 2);
}

int main() {
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    string l;
    cin >> l;
    int n = l.size();
    l = " " + l;

    ll ans = lgput(3, n - 1);
    ll aux = 1;
    for(int i = 1; i <= n; i ++) {
        if(l[i] == '1')
            aux = (aux * 2) % MOD;
        if(i < n && l[i + 1] == '1')
            ans = (ans + aux * lgput(3, (n - i - 1))) % MOD;
    }
    ans = (ans + aux) % MOD;
    cout << ans;

    return 0;
}


Measured memory_bytes: 512
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); } bool DEBUG = 0; 
void log(A ...)(lazy A a){ if(DEBUG) print(a); }
void print(){ writeln(""); } void print(T)(T t){ writeln(t); } void print(T, A ...)(T t, A a){ write(t, " "), print(a); }
string unsplit(T)(T xs){ return xs.array.to!(string[]).join(" "); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; } T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
T lowerTo(T)(ref T x, T y){ if(x > y) x = y; return x; } T raiseTo(T)(ref T x, T y){ if(x < y) x = y; return x; }

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

void solve(){
  int n = scan!int;
  long[] as = scan!long(n);
  
  long tmp = as[0];
  foreach(a; as) tmp = gcd(tmp, a);
  if(tmp > 1){
    "not coprime".writeln;
    return;
  }
  
  long[] ps = primesTo(1_000_009);
  bool[] us = new bool[1_000_009];
  foreach(a; as){
    foreach(p; ps) if(a % p == 0){
      long q = a / p;
      if(us[p] || us[q]){
        "setwise coprime".writeln;
        return;
      }
      us[p] = 1, us[q] = 1;
    }
    else if(p * p <= a) continue;
    else{
      if(a > p && us[a]){
        "setwise coprime".writeln;
        return;
      }
      us[a] = 1;
      break;
    }
    
  }
  
  "pairwise coprime".writeln;
  
}


/// 最大公約数。最大の公約数。
/// 例 gcd(12, -18) = 6, gcd(-12, -18) = 6, gcd(12, 0) = 12, gcd(0, 0) = 0
/// ※本当は gcd(0, 0) は存在しないが便宜上 0 を返している
long gcd(long a, long b){
	if(a < 0) a = -a;
	if(b == 0) return a;
	if(b < 0) return gcd(a, -b);
	if(a % b == 0) return b;
	if(a < b) return gcd(b, a);
	else return gcd(b, a % b);
}

/// a 以下の素数の集合
/// 例 primesTo(48) = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]
/// 時間O(N f(N))、空間O(N) ただしf(N)は素数の個数(=O(log N))
/// 都度計算なのでコストは都度かかる
long[] primesTo(long a){
	bool[] isNg = new bool[](a + 1);
	isNg[0] = 1, isNg[1] = 1;
	foreach(i; 2 .. a + 1){
		if(isNg[i]) continue;
		foreach(k; 2 .. a / i + 1) isNg[i * k] = 1;
	}
	long[] res;
	foreach(i; 0 .. a + 1) if(! isNg[i]) res ~= i;
	return res;
}

/// 約数の集合
/// 1とその数自身も含む、正の約数の集合。
/// 例 divisors(48) = [1, 2, 3, 4, 6, 8, 12, 16, 24, 48]
/// O(√N)
long[] divisors(long a){
	long[] res, res2;
	for(long d = 1; d * d <= a; d ++){
		if(a % d == 0) res ~= d, res2 ~=  a / d;
	}
	foreach_reverse(d; res2) if(res[$ - 1] < d) res ~= d;
	return res;
}


Measured memory_bytes: 50072
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL num[5]={0},n,ans=0;
int main(){
	LL i,j,k;
	cin>>n;
	char s[50];
	while(n--){
		scanf("%s",s);
		if(s[0]=='M')num[0]++;
		if(s[0]=='A')num[1]++;
		if(s[0]=='R')num[2]++;
		if(s[0]=='C')num[3]++;
		if(s[0]=='H')num[4]++;
	}
	n=0;
	for(i=0;i<5;i++){
		for(j=i+1;j<5;j++){
			for(k=j+1;k<5;k++){
				ans+=(num[i]*num[j]*num[k]);
				n++;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<sstream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cctype>
#include<climits>
using namespace std;
#define rep(i, j) for(int i = 0; i < j; i++)
#define f(i, k, j) for(int i = k; i < j; i++)
#define P pair<int, int>
const int INF = 1000010;

int n, dp[INF], dp2[INF];
vector<int> c, ctmp;

void solve(){
    for(int i = 2; ; i++){
        int tmp = (i * (i + 1) * (i + 2)) / 6;
        if(tmp >= INF) break;
        else{
            c.push_back(tmp);
            if(tmp % 2 == 1) ctmp.push_back(tmp);
        }
    }
    rep(i, INF){
        dp[i] = i;
        dp2[i] = i;
    }

    rep(i, c.size()){
        for(int j = c[i]; j < INF; j++){
            dp[j] = min(dp[j], dp[j - c[i]] + 1);
        }
    }
    rep(i, ctmp.size()){
        for(int j = ctmp[i]; j < INF; j++){
            dp2[j] = min(dp2[j], dp2[j - ctmp[i]] + 1);
        }
    }
}

int main(){
    solve();
    while(cin >>n && n){
        cout <<dp[n] <<" " <<dp2[n] <<endl;
    }
    return 0;
}

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

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

  ll l = 4 * a * b;
  ll r = c - (a + b);
  if (0 < r && l < r * r) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3616
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int a = input.nextInt();
		int b = input.nextInt();
		
		int largestDenominator = 1;
		
		for (int i = 1; i < Math.sqrt((double) Math.max(a,  b)); i++) {
			if (a % i == 0) {
				if (b % (a / i) == 0) {
					largestDenominator = Math.max(largestDenominator, (a / i));
break;
				} else if (b % i == 0) {
					largestDenominator = Math.max(largestDenominator, i);
				}
			}
		}
		
		System.out.println(largestDenominator);
	}
}


Measured memory_bytes: 26356
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include<math.h>
#define rep(i,a) for(int i=0;i<a;i++)
#define nrep(i,a,b) for(int i=a;i<b;i++)
#define mrep(i,a) for(int i=a;i>=0;i--)
#define ll long long
#define INF 11451419191810
using namespace std;


int main(){

	ll n, w; cin >> n >> w;
	ll w1, v1; cin >> w1 >> v1;
	vector<vector<ll> > v(4);
	v[0].push_back(v1);
	nrep(i, 1, n){
		ll a, b; cin >> a >> b;
		v[a - w1].push_back(b);
	}rep(i, 4){
		sort(v[i].begin(), v[i].end());
		v[i].push_back(0);
		reverse(v[i].begin(), v[i].end());
		nrep(j, 1, v[i].size()) v[i][j] += v[i][j - 1];
	}
	ll ans = 0;
	rep(a, v[0].size()) rep(b, v[1].size()) rep(c, v[2].size()) rep(d, v[3].size()){
		if (a*w1 + b*(w1 + 1) + c*(w1 + 2) + d*(w1 + 3) <= w){
			ans = max(ans, v[0][a] + v[1][b] + v[2][c] + v[3][d]);
		}
	}cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF = 1e18+18;
const ll MAX = 200005;
const ll MOD = 1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
  	COMinit();
    ll n, a, b;
    cin>>n>>a>>b;
    ll Ans=1;
    vector<int> Two(0);
    ll nn=n;
    while(nn>0){
        Two.push_back(nn%2);
        nn/=2;
    }
    int ns=Two.size();
    ll V=2;
    rep(i, ns){
        if(Two[i]){
            Ans*=V;
            Ans%=MOD;
        }
        V=V*V;
        V%=MOD;   
    }
    Ans--;
    ll CA=1;
    ll CB=1;
    rep(i, a){
        CA*=n-i;
        CA%=MOD;
        CA*=inv[i+1];
        CA%=MOD;
    }
    rep(i, b){
        CB*=n-i;
        CB%=MOD;
        CB*=inv[i+1];
        CB%=MOD;
    }
    Ans+=2*MOD-CA-CB;
  	Ans%=MOD;
    cout<<Ans<<endl;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
#define rep1(i,n) for(int i=1;i<=n;i++)

using namespace std;
typedef long long ll;
const ll maxn=100005;
int n;
int l[maxn],r[maxn],a[maxn];
int main()
{
    while(cin>>n)
    {
        l[0]=r[0]=l[n+1]=r[n+1]=0;
        rep1(i,n)
        {
            cin>>a[i];
            l[i]=__gcd(a[i],l[i-1]);
            //cout<<i<<" "<<l[i]<<"\n";
        }
        for(int i=n;i>0;i--)
        {
            r[i]=__gcd(a[i],r[i+1]);
            //cout<<i<<" "<<r[i]<<"\n";
        }
        int ans=0;
        rep1(i,n) ans=max(ans,__gcd(l[i-1],r[i+1]));
        cout<<ans<<"\n";
    }

}

Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>
#include <bitset>
#include <iomanip>
#include <set>
#include <map>

using namespace std;

#define PI (3.14159265358979323846)
#define INF (2147483647)
#define INF_LL (9223372036854775807)
#define DIV_NUM (1000000007)



int main() {

	int N, M;
	cin >> N;
	//宣言
	map<string, int> blue;
	map<string, int> red;
	for (int i = 0; i < N; i++) {
		string tmp1;
		int tmp2 = 1;
		cin >> tmp1;

		//要素の検索
		map<string, int>::iterator ite;
		ite = blue.find(tmp1);
		if (ite != blue.end()) {
			//値の取得
			int value = ite->second;
			//要素の削除
			blue.erase(tmp1);
			//要素の代入
			blue.insert(make_pair(tmp1, value + tmp2));
		}
		else {
			//要素の代入
			blue[tmp1] = tmp2;
		}
	}
	cin >> M;
	for (int i = 0; i < M; i++) {
		string tmp1;
		int tmp2 = 1;
		cin >> tmp1;

		//要素の検索
		map<string, int>::iterator ite;
		ite = red.find(tmp1);
		if (ite != red.end()) {
			//値の取得
			int value = ite->second;
			//要素の削除
			red.erase(tmp1);
			//要素の代入
			red.insert(make_pair(tmp1, value + tmp2));
		}
		else {
			//要素の代入の別の書式
			red[tmp1] = tmp2;
		}
	}

	int ans = 0;
	//要素の全探索
	for (map<string, int>::iterator ite = blue.begin(); ite != blue.end(); ite++) {
		//値の取得
		int blue_point = ite->second;
		int red_point = 0;
		//値の存在確認
		if (red.count(ite->first)!=0) {
			//値の取得
			red_point = red[ite->first];
		}
		ans = max(ans, blue_point - red_point);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{

 int n;
 cin>>n;
 long long int arr[n];
 int i,j;
 for(i=0;i<n;i++)
 {
     cin>>arr[i];
 }
 sort(arr,arr+n);
 reverse(arr,arr+n);
 
 long long int sum=arr[0],c=0;
 i=2,j=1;
 while(i<n)
 {
   if(c<2)
    { sum=sum+arr[j];
      c++; 
      i++;
    }
   else
     {
        c=0;
        j++;
     }
  }
  cout<<sum;
}


Measured memory_bytes: 5140
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.buffer.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

a, b, c = rm()
print(min(a*b, c))

















Measured memory_bytes: 27092
def cut!(cards,k)
  n = cards.length
  sub_cards = cards.slice(0,k)
  j = n-k
  0.upto(j) do |i|
    cards[i] = cards[k+i]
  end
  j.upto(n-1) do |i|
    cards[i] = sub_cards[i-j]
  end
end

def shaffle!(cards)
  n = cards.length
  half = n/2
  sub_a = cards.slice(0,half)
  sub_b = cards.slice(half,half)
  0.upto(n-1) do |i|
    cards[i] = i.even? ? sub_a[i/2] : sub_b[i/2]
  end
end

n = gets.to_i * 2 # カードの枚数をnとする
m = gets.to_i
ops = Array.new(m) {gets.to_i}
cards = Array.new(n) {|i| i+1} # 上からi番目にカードa[i]がある

ops.each do |i|
  if i == 0
    shaffle!(cards)
  else
    cut!(cards,i)
  end
end

puts cards

Measured memory_bytes: 10284
import std.stdio, std.string, std.conv, std.array, std.regex, std.algorithm;

void main(){
	auto ip = readln.chomp;
	switch(ip){
		case "a", "i", "u", "e", "o":
			writeln("vowel");
			break;
		default:
			writeln("consonant");
			break;
	}
}

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

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[MAX],x;
int head, tail, n,d;
int min(int,int);
void enqueue(P x);
P dequeue(void);


int main(){
  int elaps = 0, c;
  int i,q;
  P u;
  scanf("%d %d", &n,&q);

  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }

  head = 1;
  tail = n+1;

  while(head != tail){
    u = dequeue();
    c = min(q,u.t);
    u.t -= c;
    elaps += c;
    if(u.t > 0){
      enqueue(u);
    }
    else{
      printf("%s %d\n",u.name,elaps);
    }
  }

  return 0;
}


int min(int a, int b){
  d = a<b ? a:b;
  return d;
}

void enqueue(P x){  
    Q[tail] = x;
    tail = (tail+1) % MAX;
    

}

P dequeue(){
  P x = Q[head];
  head = (head+1) % MAX;

  return x;

}





Measured memory_bytes: 11840
import java.io.*;
import java.util.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();main.solve(args);
    }

    List<Integer> list = new ArrayList<>();
    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();
        int A = scanner.nextInt();
        int ans = 0;
        list.add(0);
        list.add(1);
        int a = 0;
        {
            int i = 1;
            do {
                a = (int)Math.pow(6, i++);
                if (a>100000) break;
                list.add(a);
            } while (a<100000);
            i = 1;
            do {
                a = (int)Math.pow(9, i++);
                if (a>100000) break;
                list.add(a);
            } while (a<100000);
            Collections.sort(list);
        }
        int dp[] = new int[100001];
        for (int i = 1; i < dp.length; i++) {
            dp[i] = Integer.MAX_VALUE;
        }

        for (int i = 1; i <= 12; i++) {
            for (int j = 0; j + list.get(i) <= A; j++) {
                dp[j + list.get(i)] = Math.min(dp[j + list.get(i)], dp[j] + 1);
            }
        }
        System.out.println(dp[A]);
    }

    private class MyScanner {
        String[] s;int i;BufferedReader br;String reg = " ";
        MyScanner () { s = new String[0];i = 0;br = new BufferedReader(new InputStreamReader(System.in)); }
        public String next() {
            try {
                if (i < s.length) return s[i++]; String line = br.readLine();
                while (line.equals("")) {line = br.readLine();}
                s = line.split(reg, 0); i = 0;return s[i++];
            } catch (Exception e) {e.printStackTrace();}
            return null;
        }
        public int nextInt() {
            try {return Integer.parseInt(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public double nextDouble() {
            try {return Double.parseDouble(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public long nextLong()  {
            try {return Long.parseLong(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
    }
}


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

typedef pair<long long int,long long int>pa;
#define pb push_back 

long long int MAX= 200005;
long long int MOD=1e9+7;
long long int INF=1e18;


    
int main()
{
       ios_base::sync_with_stdio(false); 
       cin.tie(NULL);
       cout.tie(NULL);
     
       long long int i,j,k=0,l=0,r=0,m=0,n,p=0,cnt=0,cnt1=0,x=0,y,z,low,mid,high,ans=0,maxi=0,mini=INF,t;
      string s,s1;
    cin>>x>>y>>z;
    for(i=1;i<=10;i++)
    {
        z=z*x-y;
        cout<<z<<endl;
    }
   
         
    
    
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A , B;
  cin >> A >> B ;
  
  if ((A*B)>(A-B)&&(A*B)>(A+B)) {
    cout << A*B << endl;
  }
  else if ((A-B)>(A*B)&&(A-B)>(A+B)) {
    cout << A-B << endl;
  }
  else cout << A+B << 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 a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		int tmp = 0;

		while(a <= b){

			if(c%a ==0){
				tmp++;
			}
			a++;
		}
		scan.close();
		System.out.println(tmp);
	}

}

Measured memory_bytes: 17352
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  ll n,k;
  cin >> n >>k;
  ll ans = 0;
  while(n!=0){
    n/=k;
    ans++;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
	
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		
		int n = sc.nextInt();
		long x = sc.nextInt();
		
		int[] a = new int[n];
		int[][] b = new int[n][n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			b[0][i] = a[i];
		}
		
		for (int k = 1; k < n; k++) {
			for (int i = 0; i < n; i++) {
				b[k][i] = Math.min(b[k - 1][i], a[(i - k + n) % n]);
			}
		}
		
		long min = Long.MAX_VALUE;
		for (int k = 0; k < n; k++) {
			long tmp = x * k;
			for (int i = 0; i < n; i++) {
				tmp += b[k][i];
			}
			min = Math.min(min, tmp);
		}
		
		out.println(min);
		out.flush();
	}
	
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	
	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 byte readByte() {
		if (hasNextByte()) {
			return buffer[ptr++];
		} else {
			return -1;
		}
	}
	
	private boolean isPrintableChar(int c) {
		return '!' <= c && c <= '~';
	}
	
	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
	}
	
	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}
	
	public int nextInt() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		int n = 0;
		boolean minus = false;
		byte 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();
		}
	}
}

Measured memory_bytes: 32824
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int mod=998244353,N=1e7+5;
int fac[N],inv[N],pw2[N];
int ksm(int b,int n){
	int res=1;
	while(n){
		if(n&1) res=res*b%mod;
		b=b*b%mod; n>>=1;
	}
	return res;
}
void init(int n){
	fac[0]=1;
	for(int i=1;i<=n;++i)
		fac[i]=fac[i-1]*i%mod;
	inv[n]=ksm(fac[n],mod-2);
	for(int i=n-1;i>=0;--i)
		inv[i]=inv[i+1]*(i+1)%mod;
	pw2[0]=1;
	for(int i=1;i<=n;++i)
		pw2[i]=pw2[i-1]*2%mod;
} 
int C(int n,int m){
	if(n<m) return 0;
	return fac[n]*inv[m]%mod*inv[n-m]%mod;
}
void add(int &x,int y){
	x=(x+y)%mod;
}
signed main(){
	int n,ans=0;
	cin>>n;
	init(n);
	for(int i=n/2+1;i<=n;++i)
		add(ans,2*C(n,i)*pw2[n-i]%mod);
	int res=1;
	for(int i=1;i<=n;++i)
		res=res*3%mod;
	add(res,(mod-ans)%mod);
	cout<<res;
	return 0;
}

Measured memory_bytes: 237912
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>

using namespace std;

int main() {
	string s;
	cin >> s;
	cout << s.substr(0, 4) << ' ' << s.substr(4) << endl;
	return 0;
}

Measured memory_bytes: 256
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    String str;
    char[] ch;
    int i, n, m;

    n = 'a' - 'A';
    str = sc.nextLine();
    m = str.length();
    ch = new char[m];
    for(i = 0;i < m;i++){
      ch[i] = str.charAt(i);
      if(ch[i] >= 'a' && ch[i] <= 'z'){
        ch[i] -= n;
      }else if(ch[i] >= 'A' && ch[i] <= 'Z'){
        ch[i] += n;
      }
    }

    for(i = 0;i < m;i++){
      System.out.print(ch[i]);
    }
    System.out.println();



    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

Measured memory_bytes: 17252
#include<iostream>
using namespace std;
int main(){
	long long W,H,x,y;
	cin>>W>>H>>x>>y;
	printf("%.6lf ",W*H*1.0/2);
	if(2*x==W&&2*y==H){
		cout<<"1"<<endl;
	}else{
		cout<<"0"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

int main() {
	int A, B, C;
	cin >> A >> B >> C;
	if ((A == B && B == C) || (A != B && B != C && C != A))
		cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
 
#define  pb push_back
#define  mp make_pair
#define ll long long
#define vi vector<ll>
#define ff first
#define ss second
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define FORR(i,a,b) for(ll i=a-1;i>b;i--)
#define MOD 10e9+7
#define fastScan ios_base::sync_with_stdio(0); cin.tie(NULL)
#define s(v) sort(v.begin(),v.end())

 
using namespace std;
 
//vector<bool> s(1000000,true);

//vector<ll> a;
 
/*void prime(){
    FORor(ll i=2;i<1000000;i++){
        if(s[i] == true) a.pb((ll)i);
        ll j=2*i;
        while(j<1000000){
            if(s[j]!=FORalse) s[j]=FORalse;
            j+=i;
        }
    }
}
ll bs(ll s, ll l,ll h){
    ll m;
    while(l<=h){
        m = (l+h)>>1;
        if(a[m] < s) l= m+1;
        else h = m-1;
    }
    return l;
}
 
bool isprime(ll s, ll l,ll h){
    ll m;
    while(l<=h){
        m = (l+h)>>1;
        if(a[m]==s)return true;
        if(a[m] < s) l= m+1;
        else h = m-1;
    }
    return FORalse;
}
 
bool comp(pair<ll,ll> a, pair<ll,ll> b) {
    if(a.FORirst == b.FORirst)  return a.second<b.second;
    else return a.FORirst < b.FORirst;
}
 
ll FORact(ll n){
    if(n==1) return 1;
    else return n*FORact(n-1);
}

ll gcd(ll a,ll b){
    if(a==0)return b;
    return (b%a,a);
}*/

void knp(ll w, ll we[],ll v[],ll n){
        ll dp[n+1][w+1];
    
    for(ll i=0;i<=n;i++){
        for(ll j=0;j<=w;j++){
            if(i==0 || j==0) dp[i][j] = 0;
            else{
                if(j < we[i]){
                    dp[i][j] = dp[i-1][j];
                }else{
                    dp[i][j] = max(dp[i-1][j] , v[i] + dp[i-1][j-we[i]]);
                }
            }
        }
    }
    
    cout << dp[n][w] << endl;
}

void solve(){
   ll n,w;
   cin >> n >> w;
    ll we[n+1],v[n+1];
    we[0] = 0;
    v[0] = 0;
    for(ll i=1;i<=n;i++) cin>> we[i] >> v[i];
    knp(w,we,v,n);
   
    return;
}
 
int main(){
    fastScan;
    ll T=1;
    //cin >> T;
    while(T--){
        solve();
    }
    
    return 0;
}  
 

Measured memory_bytes: 79232
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <b; i++)
typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int,int> pi;
#define trace(x) cout<<#x<<"="<<x<<"\n";
#define sz(x) (int)(x.size())
#define mod 1000000007

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

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

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



int32_t main(){
    ios::sync_with_stdio(false);
    int n, k;
    cin>>n>>k;
    vi a(n);
    int ans=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(a[i]>=k){
            ans++;
        }
    }
    cout<<ans<<"\n";



    return 0;
}

Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <deque>
#include <queue>
#include <set>
#include <functional>
#include <cmath>
#include <set>
#include <map>
 
 
//マクロ
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define REPS(i,n) for(int i=1; i<=(int)(n); ++i)
#define RREP(i,n) for(int i=(int)(n)-1; i>=0; --i)
#define RREPS(i,n) for(int i=(int)(n); i>0; --i)
#define FOR(i,s,e) for(int i=(int)(s); i<(int)(e); ++i)
#define RFOR(i,s,e) for(int i=(int)(e)-1; i>=(int)(s); --i)
#define All(a) (a).begin(),(a).end()
#define RAll(a) (a).rbegin(),(a).rend()
#define dump(x)  cerr << #x << " = " << (x) << endl;
 
//定数
#define INF 1e9
#define INFL 1e18
#define MOD (int)(1e9+7)
 
typedef long long ll;
typedef unsigned long long ull;
/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
//*/
using namespace std;
using Graph = vector<vector<int>>;
 
//とりあえず書いておく変数
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };
 
//今回の変数
 
//使用する関数
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;
}
 
 
 
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin >> s;
 
	REP(i, 3) {
		if (s[i] == '7') {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 3672