akhauriyash/Code-Regression huggingface dataset:
unittest
{
	assert( [ "3", "2 3 4" ].solve == 13 );
	assert( [ "5", "12 12 12 12 12" ].solve == 5 );
	assert( [ "3", "1000000 999999 999998" ].solve == 996989508 );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	input.popFront;
	auto as = input.front.split.to!( long[] );
	
	// aを素因数分解したものを使って最小公倍数を計算
	const M = 10L ^^ 9 + 7;
	auto c = ModWorld!M( 1L );
	{
		auto ps = ( 10L ^^ 3 ).primes;
		long[ long ] ms;
		foreach( a; as )
		{
			foreach( g; a.primefactorize( ps ).group )
			{
				if( ms.get( g[ 0 ], 0 ) < g[ 1 ] )
				{
					c *= g[ 0 ] ^^ ( g[ 1 ] - ms.get( g[ 0 ], 0 ) );
					ms[ g[ 0 ] ] = g[ 1 ];
				}
			}
		}
	}
	
	// a*b=最小公倍数 になるbの合計を計算
	auto ans = ModWorld!M( 0L );
	foreach( a; as )
	{
		ans += c / a;
	}
	return ans;
}

// モジュラ整数型（n mod M）
struct ModWorld( long M )
{
	long n;
	
	this( long n ){ this.n = n % M; }
	void opUnary( string OP )() if( OP == "++" ){ this.n = ( this.n + 1 ) % M; }
	void opUnary( string OP )() if( OP == "--" ){ this.n = ( this.n + M - 1 ) % M; }
	void opOpAssign( string OP )( ModWorld r ) if( OP == "+"  ){ this.n = ( this.n + r.n ) % M; }
	void opOpAssign( string OP )( ModWorld r ) if( OP == "-"  ){ this.n = ( this.n + M - r.n ) % M; }
	void opOpAssign( string OP )( ModWorld r ) if( OP == "*"  ){ this.n = ( this.n * r.n ) % M; }
	void opOpAssign( string OP )( ModWorld r ) if( OP == "/"  ){ this *= r ^^ ModWorld( M - 2 ); }
	void opOpAssign( string OP )( ModWorld r ) if( OP == "^^" )
	{
		auto a = this.n;
		this.n = 1L;
		for( auto i = r.n; 0 < i; i >>= 1 )
		{
			if( i & 1 ) this.n = ( this.n * a ) % M;
			a = ( a * a ) % M;
		}
	}
	auto opBinary( string OP )( ModWorld r ){ auto l = this; l.opOpAssign!OP( r ); return l; }
	auto opEquals( ModWorld r ){ return this.n == r.n; }
	
	void opAssign( long r ){ this.n = r % M; }
	void opOpAssign( string OP )( long r ){ this.opOpAssign!OP( ModWorld( r ) ); }
	auto opBinary( string OP )( long r ){ return this.opBinary!OP( ModWorld( r ) ); }
	auto opBinaryRight( string OP )( long l ){ return ModWorld( l ).opBinary!OP( this ); }
	auto opEquals( long r ){ return this.n == r; }
	
	auto toString(){ return this.n.to!string; }
}

// 素数列
auto primes( long x )
{
	Appender!( long[] ) ps;
	if( x < 2 ) return ps.data;
	
	auto cs = new bool[]( x + 1 );
	ps ~= 2L;
	for( auto i = 3L; i * i < cs.length; i += 2 )
	{
		if( cs[ i ] ) continue;
		for( auto j = i; i * j < cs.length; j++ )
		{
			cs[ i * j ] = true;
		}
	}
	for( auto i = 3L; i < cs.length; i += 2 )
	{
		if( !cs[ i ] ) ps ~= i;
	}
	return ps.data;
}

// 素因数分解
auto primefactorize( long x, long[] ps )
{
	Appender!( long[] ) fs;
	if( x < 2 ) return fs.data;
	
	auto s = cast( long ) x ^^ 0.5L;
	foreach( p; ps )
	{
		if( s < p ) break;
		while( x % p == 0 )
		{
			x /= p;
			fs ~= p;
		}
		if( x < 2 ) break;
	}
	if( 2 <= x ) fs ~= x;
	return fs.data;
}


Measured memory_bytes: 5160
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl;
int n,bit[10001];
int sum(int i){
	int s=0;
	while(i>0){
		s+=bit[i];
		i=(i&(i-1));
	}
	return s;
}
void add(int i,int x){
	while(i<=n){
		bit[i]+=x;
		i+=(i&-i);
	}
}
int main(){
	while(true){
		int k,m;
		cin>>n>>k>>m;
		if(n==0) break;
		rep1(i,n) add(i,1);
		rep(i,n-1){
			add(m,-1);
			int kk=(k-1)%(n-1-i)+1;
			if(sum(n)-sum(m)<kk) kk-=(sum(n)-sum(m)),m=0;
			int ub=n,lb=0;
			while(ub-lb>1){
				int mid=(ub+lb)/2;
				if(sum(mid)-sum(m)>=kk) ub=mid;
				else lb=mid;
			}
			m=ub;
		}
		rep1(i,n) if(sum(i)-sum(i-1)==1){
			cout << i << endl;
			add(i,-1);
		}
	}
}

Measured memory_bytes: 1200
// 20:57 -

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <stack>

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

using namespace std;

int main(){
  string s;
  cin >> s;
  int len = s.length();
  int ans = len;
  for(int i = 1; i < len; i++){
    if(s[i] != s[i-1]){
      int a = i;
      int b = len - i;
      if(a < b) a = b;
      if(ans > a) ans = a;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 512
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) {
		// 所要時間のリスト
		int[] times = new int[5];
		input(times);

		// 0〜4の順列を生成
		List<int[]> sequences = sequence(new int[] { 0, 1, 2, 3, 4 });
//		sequences.stream().map(e -> Arrays.toString(e)).forEach(System.out::println);

		int minTime = Integer.MAX_VALUE;
		int[] order = new int[5];
		for (int[] seq : sequences) {
			for (int i = 0; i < order.length; i++) {
				order[i] = times[seq[i]];
			}
			int time = calcTime(order);
			minTime = (time < minTime) ? time : minTime;
//			System.out.printf("%s => %d\n", Arrays.toString(order), time);
		}
		System.out.println(minTime);
	}

	/**
	 * 配列で与えられた要素の順列を返す
	 * 
	 * @param members
	 * @return
	 */
	private static List<int[]> sequence(int[] members) {
		List<int[]> sequences = new ArrayList<>();
		sequence0(members, new int[members.length], 0, sequences);
		return sequences;
	}

	private static void sequence0(int[] members, int[] array, int digit, List<int[]> seq) {
		for (int m : members) {
			array[digit] = m;
			if (digit == array.length - 1) {
				seq.add(Arrays.copyOf(array, array.length));
			} else {
				sequence0(subArray(m, members), array, digit + 1, seq);
			}
		}
	}

	// memnbers の要素から m を除いた配列を返す
	private static int[] subArray(int m, int[] members) {
		int[] ret = new int[members.length - 1];
		for (int i = 0, j = 0; i < members.length; i++) {
			if (members[i] != m) {
				ret[j++] = members[i];
			}
		}
		return ret;
	}

	private static void input(int[] times) {
		try (Scanner scan = new Scanner(System.in)) {
			for (int i = 0; i < 5; i++) {
				times[i] = scan.nextInt();
			}
		}
	}

	// order は注文する料理の所要時間配列
	private static int calcTime(int[] order) {
		int t = 0;
		for (int i = 0; i < order.length; i++) {
			t += order[i]; // 完成時刻
			if ((i != order.length - 1) && (t % 10 != 0)) {
				t += (10 - (t % 10));
			}
		}
		return t;
	}
}


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

int main()
{
  int N,T,A; cin >> N >> T >> A;
  int H[N]; rep(i,N) cin >> H[i];
  int temp[N];
  rep(i,N)
  {
    temp[i] = T*1000 - H[i]*6;
  }
  int min = 1000000;
  int ans = 0;
  rep(i,N)
  {
    if(abs(temp[i] - A*1000) < min)
    {
      min = abs(temp[i] - A*1000);
      ans = i;
    }
  }
  cout << ans+1 << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int r,D,c,y,i=0 ;
    cin>>r>>D>>y ;
    while (i<10)
    {
        c=r*y-D;
        cout<<c<<endl;
        y=c;
        i+=1;
    }
    return 0;
}

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

int main(){
    ll a; cin >> a;
    string s; cin >> s;
    ll b = 0;
    for(int i = 0; i < s.size(); i++)
        if(s[i] != '.') b = b*10 + s[i] - '0';
    ll ans = a*b/100;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3628
//pragma
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

#define YOU using
#define DONT namespace
#define SAY std

YOU DONT SAY;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define REPP(i,a,b,d) for(int i=a;i<=b;i+=d)
#define REP(i,a,b) REPP(i,a,b,1)
#define REVV(i,a,b,d) for(int i=a;i>=b;i-=d)
#define REV(i,a,b) REVV(i,a,b,1)

#define FOR(i,a) for(int i=0; i<a; i++)
#define FORD(i,a) for(int i=(int)a-1; i>=0; i--)

#define pb push_back
#define F first
#define S second

const int OO = 1e9;
const ll INF = 1e18;

const int irand(int lo,int hi){
	return ((double)rand()/(RAND_MAX + 1.0)) * (hi-lo+1) + lo;
}

const ll lrand(ll lo,ll hi){
	return ((double)rand()/(RAND_MAX + 1.0)) * (hi-lo+1) + lo;
}

#define getc getchar
template<typename T>
T getnum(){
	int sign = 1;
	T ret = 0;
	char c;

	do{
		c = getc();
	}while(c == ' ' || c == '\n');
	if(c == '-')sign = -1;
	else ret = c-'0';
	while(1){
		c = getc();
		if(c < '0' || c > '9')break;
		ret = 10*ret + c-'0';
	}
	return sign * ret;
}

inline void ini(int& x){
	x = getnum<int>();
}

inline void scani(int& x){
	scanf("%d",&x);
}

//end of macro

const int N = 26;
const int D = 365;

int d;

int c[N];
int s[D][N];

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #define endl '\n'
    cout.setf(ios::fixed);
    cout.setf(ios::showpoint);
    cout.precision(10);

    cin>>d;
    FOR(i,N)cin>>c[i];
    FOR(i,d){
    	FOR(j,N){
    		cin>>s[i][j];
    	}
    }

    int curr = 0;
    REP(i,1,d){
    	cout << curr+1 << endl;
    	curr = (curr + 1) % N;
    }

    return 0;
}


Measured memory_bytes: 3692
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

class Main{
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        StringBuilder s = new StringBuilder(scanner.nextLine());

        

        long k = scanner.nextLong();

        
        int i = 0;

        long all = 0;

        //先頭からつながった数を数える
        long first = 0;
        for(i = 0; i < s.length()-1; i++){
            if(s.substring(i, i+1).equals(s.substring(i+1, i+2))){
                first++;
            }else{break;}
        }
        //繋がっていないならば
        long last = 0;
        long connected = 0;
        List<Long> middleList = new ArrayList<Long>();
        if(i != (s.length()-1)){

            //最初と最後以外でつながっている部分が無いか調べる
            long middle = 0;
            for(; i < s.length()-1; i++){
                if(s.substring(i, i+1).equals(s.substring(i+1, i+2))){
                    middle++;
                }else if(middle != 0){
                    middleList.add(middle);
                    middle = 0;
                }
            }


            //末尾からつながった数を数える
            for(i = s.length()-1; i != 0; i--){
                if(s.substring(i, i+1).equals(s.substring(i-1, i))){
                    last++;
                }else{
                    break;
                }
            }

            //繋がった際の数を数える
            if(s.substring(0, 1).equals(s.substring(s.length()-1))){
                //先頭文字がどれだけ同じか調べる
                connected += 2;
                
                for(i = 0; i < s.length()-1; i++){
                    if(s.substring(i, i+1).equals(s.substring(i+1, i+2))){
                        connected++;
                    }else{
                        break;
                    }
                }
                //最後まで到達していなければ後ろからも調べる

                for(i = s.length()-1; i != 0; i--){
                    if(s.substring(i, i+1).equals(s.substring(i-1, i))){
                        connected++;
                    }else{
                        break;
                    }
                }


            }


        }else{
            first = 0;
            all = (long)s.length();
        }

        long middleSum = 0;
        for(long sum : middleList){
            // System.out.println("middle:" + sum);
            middleSum += ((sum+1) /2 * k);
        }
        first++;
        last++;
        long firstLastSum = (connected == 0) ? (first/2 * k + last/2 * k) : (first/2 + last/2);
        // System.out.println("first:" + first + " last:" + last + " middleSum:" + middleSum + " connected:" + connected);
        System.out.println(firstLastSum + (middleSum) + (connected /2 * (k-1)) + (all * k / 2));

        
        scanner.close();
    }
}

Measured memory_bytes: 21844
/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
using namespace std;
const int N=500;
struct ANS{
	int a,b,c,d;
	ANS(int x,int y,int z,int w):a(x),b(y),c(z),d(w){};
};
vector<ANS> ans;
int r,c;
int val[N+5][N+5];
bool vis[N+5][N+5];
int main(){
	scanf("%d%d",&r,&c);
	for(int i=0;i<r;i++)
		for(int j=0;j<c;j++)
			scanf("%d",&val[i][j]),
			val[i][j]&=1;
	for(int i=0;i<r;i++)
		for(int j=0;j<c-1;j++)
			if(val[i][j])
				val[i][j+1]^=val[i][j],
				ans.push_back(ANS(i+1,j+1,i+1,j+2));
	for(int i=0;i<r-1;i++)
		if(val[i][c-1])
			val[i+1][c-1]^=val[i][c-1],
			ans.push_back(ANS(i+1,c,i+2,c));
	printf("%d\n",ans.size());
	for(int i=0;i<ans.size();i++)
		printf("%d %d %d %d\n",ans[i].a,ans[i].b,ans[i].c,ans[i].d);
	return 0;
}

Measured memory_bytes: 5232
N = int(input())
S = input().replace('o', '0').replace('x', '1')
S = list(map(int, S))

for pattern in [[0, 0], [0, 1], [1, 0], [1, 1]]:
    for s in S[1:]:
        if pattern[-2] ^ pattern[-1] ^ s == 0:
            pattern.append(0)
        else:
            pattern.append(1)

    pattern = pattern[:-1]
    for i, s in enumerate(S):
        if pattern[i - 1] ^ pattern[(i + 1) % N] ^ s != pattern[i]:
            break
    else:
        pattern = ''.join(map(str, pattern)).replace('0', 'S').replace('1', 'W')
        print(*pattern, sep='')
        break
else:
    print(-1)


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

int main()
{
    int n;
    string s;
    cin >> n >> s;
    int a[5003];
    int ans = 0;
    for(int i = 0; i < n; i++){
        int j = i + 1, k = 0;
        while(j < n){
            while(j + k < n && s[i + k] == s[j + k]) k++;
            a[j] = k;
            ans = max(ans, min(a[j], j - i));
            if(k == 0){
                j++;
                continue;
            }
            int l = 1;
            while(j + l < n && l + a[i + l] < k){
                a[j + l] = a[i + l];
                l++;
            }
            j += l;
            k -= l;
        }
    }
    cout << ans << endl;
}

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

bool isOdd(ll t){
	ll ans=0;
	while(t){
		ans++;
		t/=10;
	}
  	return ans%2;
}

int main(){
	ll t,ans=0;
  	cin>>t;
  	for(ll i=1; i<=t; i++) ans+=isOdd(i);
  	cout<<ans;
}

Measured memory_bytes: 256
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>
 
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep(i,j,n) for(int i=(j);i<(n);i++)
 
using namespace std;
 
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
 
const int INF=1<<29;
const double EPS=1e-9;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int main(){
	int n,k,x,y;
	cin >> n >> k >> x >> y;
	if(n > k) cout << k * x + (n - k) * y << endl;
	else cout << n * x << endl;
	return 0;
}

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

int main() {
	// your code goes here
	int x,n;//a+b=x;2*a + 4*b=y;
	cin>>x>>n;
    int a[n];
    for(int i=0;i<n;i++)
      cin>>a[i];
    sort(a,a+n);
    set<int> st;
    for(int i=0;i<n;i++)
       st.insert(a[i]);
    int dif=0;
    while(1)
    {
      if(st.find(x-dif)==st.end())
      {cout<<x-dif<<endl;break;}
      if(st.find(x+dif)==st.end())
      {cout<<x+dif<<endl;break;}
      dif++;
    }  
	return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
# define ll int64_t
# define str string
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007
# define PI 3.141592653589793
# define vec vector
#define dump(x) cerr<<#x<<"="<<x<<endl
using namespace std;

#define INF 2000000000
#define MAX_V 10



bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll modpow(ll a,ll n,ll mod1) {
    ll res=1;
    while(n>0){
        if(n&1) res=res*a%mod1;
        a = a*a%mod1;
        n >>= 1;
    }
    return res;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) (x*=i)%=mod;
    return x;
}

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

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n,m,sum=0;
    cin>>n>>m;
    if(m>=n*2){
        sum+=n;
        m-=(n*2);
        sum+=m/4;
    }else{
        sum=m/2;
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
// oh, the less I know the better
// corner cases // int vs ll // cin vs scanf // clear structures // statement // doublesz
#include <bits/stdc++.h>
#define endl '\n'
#define pb push_back
#define sz(x) int(x.size())
#define REP(i,n) for(int i = 0; i < int(n); ++i)
#define trace(x) cout << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;

int main(){

	fastio;
	int n;
	cin >> n;
	vector<int> a,b;
	for(int i = 0; i < n; ++i){
		int x;
		cin >> x;
		if(i&1) a.pb(x);
		else b.pb(x);
	}

	vector< pair<int,int> > besta, bestb;
	map<int,int> mpa,mpb;
	mpa[1e6]; mpb[1e6+1];
	for(int x : a) mpa[x]++;
	for(auto p : mpa){
		besta.pb(make_pair(p.second,p.first));
	}
	for(int x : b) mpb[x]++;
	for(auto p : mpb){
		bestb.pb(make_pair(p.second,p.first));
	}

	sort(besta.rbegin(),besta.rend());
	sort(bestb.rbegin(),bestb.rend());

	int ans = 1e9;
	for(int i = 0; i < min(sz(besta),10); ++i){
		for(int j = 0; j < min(sz(bestb),10); ++j){
			if(besta[i].second == bestb[j].second) continue;
			ans = min(ans, n - besta[i].first - bestb[j].first);
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 9224
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,a,b) for(int i =(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPm(i,n) for(int i=(n)-1;i>=0;i--)
#define REP1(i,n) for(int i=1;i<=(n);i++)
#define mp make_pair
typedef long long ll;
int main(){
    ll X,Y;
    cin >> X >> Y;
    if(X%Y == 0) cout << -1 << endl;
    else cout << X*(Y-1) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int arr[N], ans[N];
int main()
{
    int n; cin >> n;
    for (int i=0 ; i<n ; cin >> arr[i++]);
    ans[0]=0;
    ans[1]=abs(arr[1]-arr[0]);
    for (int i=2 ; i<n ; i++)
        ans[i]=min(abs(arr[i]-arr[i-2])+ans[i-2], abs(arr[i]-arr[i-1])+ans[i-1]);
    cout << ans[n-1];
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
 
using namespace std;
using namespace __gnu_pbds;
 
template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using MinPriorityQueue = priority_queue <T, vector <T>, greater <T>>;
 
#ifdef HOME
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
    cout << name << " : " << arg1 << std :: endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    int len = comma - names;
    for (int i = 0; i < len; ++i) {
        cout << names[i];
    }
    cout <<  " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
#else
#define trace(...)
#endif
 
typedef double db;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef complex<double> com;
 
#define eb emplace_back
#define pb push_back
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define unique_sort(x) (sort(x.begin(), x.end()), x.resize(distance(x.begin(), unique(x.begin(), x.end()))))
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)
 
const ll LINF = LLONG_MAX, SZ = 1e3, MOD = 1e9 + 7, N = 1e5 + 5, M = 1e3 + 5, LG = 21;
const int INF = INT_MAX;
const db PI = acos(-1), EPS = 1e-6;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count()); 
void test() {
    int n,k;
    cin >> n >> k;
    int prefix[n+1] = {0};
    int a[n],sum = 0;
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++)
    {
        sum += a[i];
        prefix[i] = sum;
    }
    int ans = prefix[k-1];
    // cout << ans << "\n";
    for(int i = 1; i < n; i++)
    {
        if(i+k-1 < n)
        {
            ans = max(ans,prefix[i+k-1]-prefix[i-1]);
        }
    }
    //cout << ans << "\n";
    db kk = k;
    db anss = ans;
    db res = (kk+anss)/2;
    cout << fixed << setprecision(10) << res << "\n";
}
 
int main() {
    fast_io();
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
    cout << fixed << setprecision(15);
    int t = 1;
    // cin >> t;
    for (int i = 0; i < t; ++i) {
        test();
    }
    #ifdef HOME
        cout << "Time: " << (int)(clock() * 1000. / CLOCKS_PER_SEC) << "ms";
    #endif
    return 0;
}

Measured memory_bytes: 1792
#!/usr/bin/env python
#-*- coding:utf-8 -*-

ARRY_SIZE = 1000003

def hash1(key):
	return key % (ARRY_SIZE)

def hash2(key):
	return 1 + (key % (ARRY_SIZE - 1))

def hash_combo(key, i):
	return (hash1(key) + i * hash2(key)) % ARRY_SIZE

def insert(arr,key):
	i = 0

	while True:
		j = hash_combo(key, i)
		if arr[j] == "":
			arr[j] = key
			return True
		else:
			i +=  1

def find(arr, key):
	i = 0
	while True:
		j = hash_combo(key,i)
		if arr[j] == key:
			return True
		elif arr[j] == "" or i >= ARRY_SIZE:
			return False
		else:
			i += 1

def getKey(pre_key):
	key =[]
	for pk in pre_key:
		if pk == "A":
			key.append(1)
		elif pk == "C":
			key.append(2)
		elif pk == "G":
			key.append(3)
		else:
			key.append(4)
	return int("".join(map(str,key)))
		
	


def main():
	N = int(raw_input())
	cmd = [raw_input().split() for _ in range(N)]
	dic = [""] * ARRY_SIZE

	for i in range(N):
		if cmd[i][0] == "insert":
			insert(dic, getKey(cmd[i][1]))
		elif cmd[i][0] == "find":
			if find(dic, getKey(cmd[i][1])):
				print "yes"
			else:
				print "no"



#def test():

if __name__ == '__main__':
	main()
	#test()

Measured memory_bytes: 343440
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# 下げていいなら下げる

N,*H = map(int,read().split())

prev = 0
bl = True
for i in range(N):
    if H[i] - 1 >= prev:
        H[i] -= 1
    if H[i] < prev:
        bl = False
        break
    prev = H[i]

answer = 'Yes' if bl else 'No'
print(answer)

Measured memory_bytes: 12528
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MM 1000000000
#define MOD MM+7
#define MAX 10000
#define MAP 110
#define Pair pair<int,int>

int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};
int main(){
    ll N; cin >> N;
    ll a[N],b[N],c[N];
    ll dp[N][3];
    for(ll i = 0; i < N; i++){
        cin >> a[i] >> b[i] >> c[i];
        dp[i][0] = 0;
        dp[i][1] = 0;
        dp[i][2] = 0;
    }
    dp[0][0] = a[0], dp[0][1] = b[0], dp[0][2] = c[0];
    for(ll i = 1; i < N; i++){
        dp[i][0] = a[i] + max(dp[i-1][1], dp[i-1][2]);
        dp[i][1] = b[i] + max(dp[i-1][0], dp[i-1][2]);
        dp[i][2] = c[i] + max(dp[i-1][0], dp[i-1][1]);
    }
    ll ans;
    ans = max(dp[N-1][0], max(dp[N-1][1], dp[N-1][2]));
    cout << ans << endl;
}


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

int main()
{
	int n,ba,scor[10];
	char yama[101];

	while(scanf("%d",&n) && n != 0){
		for(int i = 0; i < 10; i++){
			scor[i] = 0;
		}
		ba = 0;

		scanf("%s",yama);

		for(int i = 0; i < 100; i++){
			if(yama[i] == 'M'){
				scor[i%n]++;
			}
			else if(yama[i] == 'S'){
				ba += scor[i%n]+1;
				scor[i%n] = 0;
			}
			else if(yama[i] == 'L'){
				scor[i%n] += ba+1;
				ba = 0;
			}
		}

		for(int i = 0; i < n-1; i++){
			for(int j = i+1; j < n; j++){
				if(scor[i] > scor[j]){
					int temp = scor[i];
					scor[i] = scor[j];
					scor[j] = temp;
				}
			}
		}

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

	return 0;
}

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

int main(void) {
  int N, L, sum=0, min=100000, a;
  cin >> N >> L;
  int t[N];
  
  for(int i=0; i<N; i++){
    t[i] = L+i;
    sum += t[i];
  }
  for(int i=0; i<N; i++){
    a = sum - t[i];
    if(abs(sum-a) < min)
       min = abs(sum-a);
  }
  
  if(sum < 0)
    cout << sum + min << endl;
  else
    cout << sum - min << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>

#define lowbit(X) ((X)&(-(X)))
using namespace std;
struct Query
{
	int l,r,id;
	bool operator < (const Query& rhs)const
	{
		return r<rhs.r;
	}
};
const int N=505050;
int n,q,sum[N],last[N * 10],ans[N],a[N];
Query Q[N];
void modify(int pos,int ope)
{
	if(ope) for(int i=pos;i<=n;i+=lowbit(i)) sum[i]+=1;
	else for(int i=pos;i<=n;i+=lowbit(i)) sum[i]-=1;
}
int query(int pos)
{
	int res=0;
	for(int i=pos;i>0;i-=lowbit(i)) res+=sum[i];
	return res;
}
void init() {
	scanf("%d",&n);
	scanf("%d",&q);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=0;i<q;i++)
		scanf("%d%d",&Q[i].l,&Q[i].r),Q[i].id=i;
	sort(Q,Q+q);
}
int main()
{
	init();
	for(int i=1,k=0;i<=n;i++)
	{
		if(last[a[i]]) modify(last[a[i]],0);
		modify(i,1);
		last[a[i]]=i;
		while(Q[k].r==i)
			ans[Q[k].id]=query(i)-query(Q[k].l-1),k++;
	}
	for(int i=0;i<q;i++)printf("%d\n",ans[i]);
	return 0;
}


Measured memory_bytes: 17344
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

int main() {
	int x;
	cin >> x;

	int y = x % 100;

	int n = 0;
	for (int i = 5; i >= 1; i--) {
		int tmp = y / i;
		n += tmp;
		y -= tmp * i;
	}

	int ans = (n <= x / 100 ? 1 : 0);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<array>
#include<cmath>
#include<iostream>
#include<iomanip>
#include<iso646.h>
#include<queue>
#include<stack>
#include<string>
#include<vector>

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

#define FOR(counter,initial_value,condition) for(int counter = initial_value; counter < condition;counter++)

int digitSum(int n,int digit=8) {
	// digit > 2
	int x = 1;
	FOR(i,0,digit){
		x *= 10;
	}
	int sum = 0;
	FOR(i, 0, digit) {
		sum += n / x;
		n %= x;
		x /= 10;
	}
	sum += n;
	return sum;
}

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


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
        int n = stdIn.nextInt();
        
        for(int i = 0; i < n; i++){
            System.out.println((int)(Math.random() * 25 + 1));
        }
        
        
        //System.out.println("XXXXXXXX");
    }
}


Measured memory_bytes: 36380
#include <iostream>

auto main () -> int {
  std::string instr;
  std::cin >> instr;
  auto st = 0;
  auto len = instr.length ();
  for (auto && elem : instr) {
    if (elem == 'S') {
      ++ st;
    }
    else if (elem == 'T') {
      if (st == 0) {
        ; // nop
      }
      else {
        len -= 2;
        -- st;
      }
    }
  }
  std::cout << len << std::endl;
}


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

using namespace std;

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

#define INF 		2000000007
#define MOD			10e9+7
#define MAX 		100005

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

map<pair<int,int>,int> ls;
int main(){
	int N;cin>>N;
	vector<pair<int,int>> D(N);
	
	REP(i,N){int a,b;cin>>a>>b;
		D[i] = make_pair(a,b);
	}
	int cost = 0;
	sort(D.begin(),D.end());

	REP(i,N-1){
		REPS(j,i+1,N){
			int xd = D[j].first - D[i].first;
			int yd = D[j].second - D[i].second;
			auto t = make_pair(xd,yd);
			if(ls[t]==0)ls[t] = 1;
			else ls[t]++;
		}
	}
	int maxl = 0;
	for(auto itr=ls.begin();itr!=ls.end();++itr){
		maxl = max(maxl,itr->second);
	}

	cout << (N-maxl) << endl;

	return 0;
}



Measured memory_bytes: 384
def Add(numa, numb):
	longer = (numa if len(numa) >= len(numb) else numb)
	shorter = (numa if len(numa) < len(numb) else numb)
	carry = 0
	result = ''
	for s in range(-1, -len(shorter) - 1, -1):
		ans = int(longer[s]) + int(shorter[s]) + carry
		if ans >= 10:
			result = str(ans % 10) + result
			carry = 1
		else:
			result = str(ans) + result
			carry = 0
	for l in range(-len(shorter) - 1, -len(longer) - 1, -1):
		ans = int(longer[l]) + carry
		if ans >= 10:
			result = str(ans % 10) + result
			carry = 1
		else:
			result = str(ans) + result
			carry = 0
	return (result if carry == 0 else '1' + result)

N = eval(input())
for _ in range(N):
	a = input()
	b = input()
	ans = Add(a, b)
	print('overflow' if len(ans) > 80 else ans)

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

using namespace std;

typedef long long ll;

const int INF = 1e9;

int main()
{
  int a = 0, b = 0;
  fscanf(stdin, "%d %d", &a, &b);
  if (a < b) {
    printf("a < b");
  }
  else if (a > b) {
    printf("a > b");
  }
  else {
    printf("a == b");
  }
  fprintf(stdout, "\n");
  return 0;
}

Measured memory_bytes: 1180
import java.io.*;
import java.util.*;

/**
 * Created by Ayushi on 13 Jun 2020.
 * Problem:
 * Round:
 */

public class Main {
    public static void main(String[] args) throws IOException {
        StringTokenizer st;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        st = new StringTokenizer(br.readLine(), " ");
        long a = Integer.parseInt(st.nextToken());
        long v = Integer.parseInt(st.nextToken());
        st = new StringTokenizer(br.readLine(), " ");
        long b = Integer.parseInt(st.nextToken());
        long w = Integer.parseInt(st.nextToken());
        long t = Integer.parseInt(br.readLine());
        br.close();

        if ((v*t) >= (w*t)+Math.abs(a-b)) {
            System.out.println("YES");
        }
        else {
            System.out.println("NO");
        }
    }
}


Measured memory_bytes: 32556
/*
    Written by Nitrogens
    Desire for getting accepted!!
*/
#include <cstdio>
#include <ctime>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#include <bitset>
#include <stack>
#include <set>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

const int maxn = 1e5+5;
const int Mod = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double e = exp(1);
const db PI = acos(-1);
const db ERR = 1e-10;

#define Se second
#define Fi first
#define pb push_back
#define dbg(x) cout<<#x<<" = "<< (x)<< endl
#define dbg2(x1,x2) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<endl
#define dbg3(x1,x2,x3) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<" "<<#x3<<" = "<<x3<<endl

int r, c;
vector<pii> ve[4];
bool check(int x, int y) {
    if (x == 0 || x == r) return true;
    if (y == 0 || y == c) return true;
    return false;
}

void insert(int x, int y, int i) {
    if (x == 0) ve[0].pb(pii(y, i));
    else if (x == r) ve[2].pb(pii(y, i));
    else if (y == 0) ve[3].pb(pii(x, i));
    else if (y == c) ve[1].pb(pii(x, i));
}
vector<int> border;
stack<int> st;

int main()
{
    //ios::sync_with_stdio(false);
    //freopen("a.txt","r",stdin);
    //freopen("b.txt","w",stdout);

    int n;
    scanf("%d%d%d", &r, &c, &n);
    for (int i = 1; i <= n; i++) {
        int x1, y1;
        int x2, y2;
        scanf("%d%d", &x1, &y1);
        scanf("%d%d", &x2, &y2);
        if (check(x1, y1) && check(x2, y2)) {
            insert(x1, y1, i);
            insert(x2, y2, i);
        }
    }
    for (int i = 0; i < 4; i++) {
        sort(ve[i].begin(), ve[i].end());
        if (i >= 2) reverse(ve[i].begin(), ve[i].end());
    }
    for (int i = 0; i < 4; i++) {
        for (auto x: ve[i]) {
            border.pb(x.second);
        }
    }
    for (auto x: border) {
        if (st.empty()) st.push(x);
        else {
            if (st.top() == x) st.pop();
            else st.push(x);
        }
    }
    if (st.empty()) puts("YES");
    else puts("NO");

    //cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
    return 0;
}


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

#ifdef ENABLE_DEBUG
template <typename T>
void debug(T value) {
  cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  cerr << value << ", ";
  debug(args...);
}
#define DEBUG(...)                              \
  do {                                          \
    cerr << " \033[33m (L" << __LINE__ << ") "; \
    cerr << #__VA_ARGS__ << ":\033[0m ";        \
    debug(__VA_ARGS__);                         \
    cerr << endl;                               \
  } while (0)
#else
#define debug(...)
#define DEBUG(...)
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  vector<vector<int>> A(N, vector<int>(N - 1));
  REP(i, N) REP(j, N - 1) {
    int x;
    cin >> x;
    A[i][j] = x - 1;
  }
  vector<int> counter(N);
  vector<tuple<int, int>> pairs;
  REP(i, N) {
    int opponent = A[i][0];
    if (i < opponent && A[opponent][0] == i) {
      pairs.emplace_back(i, opponent);
    }
  }
  auto solve = [&]() -> int {
    int days = 0;
    int rem_count = N * (N - 1);
    vector<tuple<int, int>> tmp;
    for (; rem_count > 0; ++days) {
      if (pairs.empty()) return -1;
      tmp.clear();
      swap(tmp, pairs);
      for (auto [x1, x2] : tmp) {
        counter[x1]++;
        counter[x2]++;
        rem_count -= 2;
        for (int i : {x1, x2}) {
          if (counter[i] >= N - 1) continue;
          int opponent = A[i][counter[i]];
          int k = counter[opponent];
          assert(k < N - 1);
          if (A[opponent][k] == i) {
            pairs.emplace_back(min(i, opponent), max(i, opponent));
          }
        }
      }
    }
    return days;
  };
  cout << solve() << endl;
}


Measured memory_bytes: 7552
#include <bits/stdc++.h>
using namespace std;
const int maxi = 1e5 + 10;
int M[maxi][3];
long long dp[maxi][4];
long long f(int n, int hacer){
	if(n < 0) return 0;
	if(dp[n][hacer] != -1) return dp[n][hacer];
	long long ans = 0;
	for(int i=0;i<3;i++){
		if(i == hacer) continue;
		ans = max(ans, M[n][hacer] + f(n - 1, i));
	}
	return dp[n][hacer] = ans;
}
int main() {
	int n;
	cin >> n;
	for(int i=0;i<n;i++)
		for(int j=0;j<3;j++)
			cin >> M[i][j];
	memset(dp, -1, sizeof(dp));
	long long ans = 0;
	for(int i=0;i<3;i++)
		ans = max(ans,f(n - 1, i));
	cout << ans;
	return 0;
}

Measured memory_bytes: 12288
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);in(name)
#define vv(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define VV(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__));in(name)
#define vvv(type,name,h,w,...) vector<vector<vector<type>>>name(h,vector<vector<type>>(w,vector<type>(__VA_ARGS__)))
#define SYOU(x) fixed<<setprecision(x) //小数点桁数を指定する
inline int scan(){ return getchar(); }
inline void scan(int &a){ scanf("%d", &a); }
inline void scan(unsigned &a){ scanf("%u", &a); }
inline void scan(long &a){ scanf("%ld", &a); }
inline void scan(long long &a){ scanf("%lld", &a); }
inline void scan(unsigned long long &a){ scanf("%llu", &a); }
inline void scan(char &a){ cin >> a; }
inline void scan(float &a){ scanf("%f", &a); }
inline void scan(double &a){ scanf("%lf", &a); }
inline void scan(long double &a){ scanf("%Lf", &a); }
inline void scan(vector<bool> &vec){ for(unsigned i = 0; i < vec.size(); i++) { int a; scan(a); vec[i] = a; } }
inline void scan(string &a){ cin >> a; }
template<class T> inline void scan(vector<T> &vec);
template<class T, size_t size> inline void scan(array<T, size> &vec);
template<class T, class L> inline void scan(pair<T, L> &p);
template<class T, size_t size> inline void scan(T (&vec)[size]);
template<class T> inline void scan(vector<T> &vec){ for(auto &i : vec) scan(i); }
template<class T, size_t size> inline void scan(array<T, size> &vec){ for(auto &i : vec) scan(i); }
template<class T, class L> inline void scan(pair<T, L> &p){ scan(p.first); scan(p.second); }
template<class T, size_t size> inline void scan(T (&vec)[size]){ for(auto &i : vec) scan(i); }
template<class T> inline void scan(T &a){ cin>>a; }
inline void in(){}
template <class Head, class... Tail> inline void in(Head &head, Tail&... tail){ scan(head); in(tail...); }
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
/* 4方向への隣接頂点への移動を表すベクトル */
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

const long long INF = 1LL << 60;
int main(){
    INT(N);
    VEC(int,point,N);
    int Alice_point = 0;
    int Bob_point = 0;
    int ans = 0;

    sort(point.begin(),point.end(),greater<int>());

    for(int i = 0; i < N; ++i){
        if(i%2==0){
            Alice_point += point[i];
        } else {
            Bob_point += point[i];
        }
    }

    ans = Alice_point - Bob_point;

    cout << ans << endl;

    
   
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string.h>
#include<math.h>
#include<cstring>
using namespace std;


int main(){
	int n,i,j,k,x=0;
	char a[10];
	for(i=0;i<10;i++)a[i]='\0';
	cin>>a;
	n=strlen(a);
	if(n%2==1){
		if(a[(n-1)/2]!=' '&&a[(n-1)/2]!='i'&&a[(n-1)/2]!='w')x++;
		for(i=0;i<((n-1)/2);i++){
			switch(a[i]){
			case 'i':
				if(a[n-1-i]!='i')x++;
				break;
			case 'w':
				if(a[n-1-i]!='w')x++;
				break;
			case'(':
				if(a[n-1-i]!=')')x++;
				break;
			case ')':
				if(a[n-1-i]!='(')x++;
				break;
			default:
				break;
			}
		}
	}else{
		for(i=0;i<n/2;i++){
			switch(a[i]){
			case 'i':
				if(a[n-1-i]!='i')x++;
				break;
			case 'w':
				if(a[n-1-i]!='w')x++;
				break;
			case'(':
				if(a[n-1-i]!=')')x++;
				break;
			case ')':
				if(a[n-1-i]!='(')x++;
				break;
			default:
				break;
			}
		}
	}
	cout<<x<<endl;
    return 0;
}

Measured memory_bytes: 1140
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1000000000;
const double PI = acos(-1);

int main() {
	int n;
	cin >> n;
	cout << 32 * n << endl;
}

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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORd(i, a, b) for (int i = (a) ; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;

void TimeExecution() {
    cout << "\n\n===>> Time Execution: " << clock() / (double)1000 << " sec(s).";
}
int n, q;
vector <int> a[200005];
bool Free[200005];
int add[200005];
int ans[200005];
void dfs(int u)
{
    Free[u] = 1;
    ans[u] += add[u];
   // cout << u << endl;
    FOR(v, 0, a[u].size() - 1)
    {
        if(!Free[a[u][v]])
        {
            add[a[u][v]] += add[u];
            dfs(a[u][v]);
        }
    }
}
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    /*
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    */
    cin >> n >> q;
    FOR(i, 1, n - 1)
    {
        int x, y;
        cin >> x >> y;
        a[x].pb(y);
        a[y].pb(x);
    }
    FOR(i, 1 ,q)
    {
        int p, x;
        cin >> p >> x;
        add[p] += x;
    }
    dfs(1);
    FOR(i, 1, n)
        cout << ans[i] << " ";
    return 0;
}


Measured memory_bytes: 24448
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
typedef long long ll;
using namespace std;
int r, g, b;
void Shiritori() {
	string a, b, c;
	cin >> a >> b >> c;
	if (a.back() == b.front() && b.back() == c.front()) {
		cout << "YES" << endl;
	}
	else cout << "NO" << endl;
}

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



Measured memory_bytes: 256
import java.util.*;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner stdIn = new Scanner(System.in);
		
		while(stdIn.hasNext()){
			double a,b,c,d,e,f;
			a = stdIn.nextDouble();
			b = stdIn.nextDouble();
			c = stdIn.nextDouble();
			d = stdIn.nextDouble();
			e = stdIn.nextDouble();
			f = stdIn.nextDouble();
			
			double det = a*e-b*d;
			
			double x = (c*e-b*f)/det;
			double y = (a*f-c*d)/det;
			
			if(x==-0)
				x = 0;
			if(y==-0)
				y = 0;
			
			System.out.printf("%.3f %.3f\n",x,y);
			
			
		}

	}


}

Measured memory_bytes: 12000
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
#include<bitset>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(18);
}
#define MOD 1000000007
signed main(){
  init_io();
  ll n,ans=0,v=1;
  cin >> n;
  vector<ll> a(n);
  ll btc[64][2]={};
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  for(ll i=0;i<63;i++){
    for(int j=0;j<n;j++){
      ll x = (a[j]&v);
      /*
      cout << bitset<64>(a[j])<<endl;
      cout << bitset<64>(v)<<" "<<v<<endl;
      cout << bitset<64>(x)<<"res"<<endl;
      */
      btc[i][(bool)x]++;
    }
    ans += (((btc[i][0]*btc[i][1])%MOD)* (v % MOD))%MOD;
    ans %= MOD;
    v *= 2;
  }
  cout << ans << endl;
}


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

int main(){
  int D;
  cin >> D;
  if(D==25){
    cout << "Christmas" << endl;
  }else if(D==24){
    cout << "Christmas Eve" << endl;
  }else if(D==23){
    cout << "Christmas Eve Eve" << endl;
  }else if(D==22){
    cout << "Christmas Eve Eve Eve" << endl;
  }
}


Measured memory_bytes: 256
N = int(input())
a = [list(map(int, input().split())) for i in range(N)]
MOD = 10 ** 9 + 7
M = pow(2, N)

DP = [0] * M
for i in range(N):
  DP[1 << i] = a[0][i]

for i in range(2, N + 1):
  n = (1 << i) - 1
  while n < (1 << N):
    x = n
    cnt = 0
    while x != 0:
      if x & 1 == 1:
        if a[i - 1][cnt] == 1:
          DP[n] = (DP[n] + DP[n & ~(1 << (cnt))]) % MOD
      x >>= 1
      cnt += 1

    x = n & -n
    y = n + x
    n = ((n & ~y) // x >> 1) | y

print(DP[-1])

Measured memory_bytes: 60908
x1, y1, x2, y2 = map(int, input().split())

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

print(x3, y3, x4, y4)

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

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    
	int m,n;
  	cin >> m >> n;
  	if(m==n) cout << "Yes";
  else cout << "No";
	return 0;
}

Measured memory_bytes: 256
/*
 * Created By : pash123
 * 2020-08-29-17.20
*/


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;

const int M=1e9+7;

int main()
{
    int d,s,t;
    cin>>d>>s>>t;
    double actualTime=(d*1.0)/s;
    if(actualTime<=t)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
 
int main() {
  string s, t, u;
  int a, b;
  cin >> s >> t >> a >> b >> u;
  if (s == u)
  {
    a--;
  }
  else
  {
    b--;
  }
  cout << a << " " << b << endl;
}


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

template <
    typename TYPE,
    std::size_t SIZE>
std::size_t a_len(const TYPE (&array)[SIZE])
{
    return SIZE;
}

using namespace std;
using ll = long long int;
using vii = vector<ll>;

#define REPS(a, i, n) for (ll(i) = a; (i) < (n); ++(i))
#define REP(i, n) REPS(0, i, n)
#define ALL(x) (x).begin(), (x).end()

const int INF = 100001;

int a, b;

int main()
{
    cin >> a >> b;
    if (a % 2 && b % 2)
    {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
#define DIV 1000000007

int main()
{
    int n, m;
    cin >> n >> m;

    vector<long long int> v(n);
    for(int i = 0; i < m; ++i)
    {
        int t;
        cin >> t;
        --t;
        v[t] = -1;
    }

    if(v[0] >= 0)
    {
        v[0] = 1;
    }
    if(v[1] >= 0)
    {
        v[1] = 1;
    }

    for(int i = 0; i < n; ++i)
    {
        if(v[i] < 0)
        {
            continue;
        }
        if(i+1 < n
        && v[i+1] >= 0)
        {
            v[i+1] += v[i];
            v[i+1] = v[i+1] % DIV;
        }
        if(i+2 < n
        && v[i+2] >= 0)
        {
            v[i+2] += v[i];
            v[i+2] = v[i+2] % DIV;
        }
    }

    cout << v[n-1] << endl;
}

Measured memory_bytes: 1024