akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main(void){
    int n= 1,m=1,i,j,sum=0;
    int a[1001];
    
    while(n > 0){
    for(i=1;i<1001;i++){
        a[i] = 0;
    }
    cin >> n >> m;
    
    if(n == 0 || m == 0) break;
    
    for(i = 1;i<n+1;i++){
        cin >> a[i];
    }
    
    sum = 0;
    
    for(i=1;i<n;i++){
        for(j=i+1;j<n+1;j++){
            if(a[i] + a[j] > sum  && a[i] + a[j] <= m ) {
                sum = a[i] + a[j];    
            }
        }
    }
    
    if( sum == 0) cout << "NONE" << endl;
    else cout << sum << endl;
    }
}



Measured memory_bytes: 3084
A, B, C, X, Y = map(int, input().split())
ans = A*X+B*Y
C = 2 * C

for i in range(1, max(X,Y)+1):
    if X >= i:
        A_num = X-i
    else:
        A_num = 0
    if Y >= i:
        B_num = Y-i
    else:
        B_num = 0
    # print(i, C*i+A*A_num+B*B_num, A_num, B_num)
    ans = min(ans, C*i+A*A_num+B*B_num)

print(ans)


Measured memory_bytes: 3060
program abc156c
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n,i,ans
    integer(int32), allocatable:: x(:)

    read*, n
    allocate(x(n))
    read*, x(:)

    ans = 1000000000
    do i=minval(x),maxval(x)
        ans = min(ans,sum((x(:)-i)**2))
    end do
    print'(i0)', ans
end program abc156c

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


int main(){

  ll N;
  cin>>N;
  
  vector <ll> A;
  A.resize(3*N);
  rep(i,3*N)cin>>A[i];
  
  sort(A.rbegin(),A.rend());
  
  ll count=0;
  rep(i,N){

    count+=A[2*(i+1)-1];
    
  }
  
  cout<<count<<endl;

}


Measured memory_bytes: 2560
LI = lambda: list(map(int, input().split()))

N = int(input())
W = LI()


def main():
    s = sum(W)
    ans = s
    x = 0
    for w in W:
        x += w
        ans = min(ans, abs(2 * x - s))
    print(ans)


if __name__ == "__main__":
    main()


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

// ############################################################################################

#define FOREACH(i, c) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define FOR(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define FORE(i, a, n) for (i = (a); i < (int)(n); ++i)
#define Size(n) ((int)(n).size())
#define all(n) (n).begin(), (n).end()

#define ff first
#define ss second
#define ll long long
#define pb push_back
#define mp make_pair

#define pii pair<int, int>
#define pll pair<ll, ll>
#define pdd pair<double, double>

#define vi vector<int>
#define mii map<int, int>
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int> >

#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)

#define mod 1000000007
#define inf 1e18

#define ps(x, y) fixed << setprecision(y) << x
#define mk(arr, n, type) type *arr = new type[n];
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

// ############################################################################################

ll mpow(ll base, ll exp) {
    ll res = 1;
    while (exp > 0) {
        if (exp % 2) res = (res * base) % mod;
        base = (base * base) % mod;
        exp /= 2;
    }
    return res % mod;
}

void a_k_s() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
}

int main() {
    a_k_s();

    int n, m;
    char a[1005][1005];
    int dp[1005][1005];

    memset(dp, 0, sizeof dp);

    cin >> n >> m;

    FOR(i, 1, n + 1) {
        FOR(j, 1, m + 1) {
            cin >> a[i][j];
        }
    }

    FOR(i, 1, n + 1) {
        if (a[i][1] == '#')
            break;

        dp[i][1] = 1;
    }

    FOR(j, 1, m + 1) {
        if (a[1][j] == '#')
            break;

        dp[1][j] = 1;
    }

    FOR(i, 2, n + 1) {
        FOR(j, 2, m + 1) {
            if (a[i][j] == '#') {
                dp[i][j] = 0;
            } else {
                dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
            }
        }
    }

    // FOR(i, 1, n + 1) {
    //     FOR(j, 1, m + 1) {
    //         cout << dp[i][j] << ' ';
    //     }
    //     cout << endl;
    // }

    cout << dp[n][m] << endl;

    return 0;
}

Measured memory_bytes: 8572
/**
 * 2009??´ ??¢?????¢G
 * icpc??´?????????
 **/

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
//#define PI 3.14159

typedef struct {
    double x;
    double y;
} Point;

double length(Point p1, Point p2) {
    double x = p2.x - p1.x;
    double y = p2.y - p1.y;

    x = x*x;
    y = y*y;

    return sqrt(x+y);
}
double radius(double A,double B,double C,double r) {
    
    double ans = ( r*((1.0+tan(B*0.25)) *(1.0+tan(C*0.25)) ) ); //
    //printf("%lf\n",ans);
    ans /= (2.0*(1.0+tan(A*0.25) ) );
    return ans;
}
double space(double a,double b,double c) {
    double s;
    s = (a+b+c)*0.5;
    return sqrt(s*(s-a)*(s-b)*(s-c));
}
double height(double c,double S) {
    return ((S/c)*2.0);
}
double radian(double b,double h) {
    return asin(h/b);
}
double naisetu_r(double a,double b,double c,double S) {
    return (S/(a+b+c))*2.0;
}

int main(void) {
    Point p[3];
    int i,j;
    double a,b,c;
    double inst[3];
    int max;
    int num;
    double r[3];
    double A,B,C;
    double h;
    double S;
    double R;
    int buff;

    while(1) {
        scanf("%lf %lf %lf %lf %lf %lf",&p[0].x, &p[0].y, &p[1].x, &p[1].y, &p[2].x, &p[2].y);

        if(p[0].x==0 && p[0].y==0 && p[1].x==0 && p[1].y==0 && p[2].x==0 && p[2].y==0)
            break;

        for(i=0;i<3;i++) {
            if(i==2) inst[i] = length(p[i], p[0]);
            else {
                inst[i] = length(p[i], p[i+1]);
            }
            //printf("(%lf %lf),",p[i].x ,p[i].y);
            //printf("(%lf),",inst[i]);
        }
        //printf("\n");
        a = inst[1];
        b = inst[2];
        c = inst[0];

        //printf("(a,b,c)=(%f,%f,%f)\n",a,b,c);

        S = space(a,b,c);
        //
        if(a>=b && a>=c) {
            h = height(a,S);
            B = radian(c,h);
            C = radian(b,h);
            A = M_PI-B-C;
      }
        else if(b>=c && b>=a) {
            h = height(b,S);
            C = radian(a,h);
            A = radian(c,h);
            B = M_PI-A-C;

        }
        else {
            h = height(c,S);
            A = radian(b,h);
            B = radian(a,h);
            C = M_PI-A-B;

        }
        //
        //A = radian(b,h);
        //B = radian(a,h);
        //C = M_PI-A-B;
        R = naisetu_r(a,b,c,S);
        //printf("(S,h,A,B,C,R)=(%f,%f,%f,%f,%f,%f)\n",S,h,A,B,C,naisetu_r(a,b,c,S));
        r[0] = radius(A,C,B,R);
        r[1] = radius(B,A,C,R);
        r[2] = radius(C,B,A,R);

        printf("%0.5f %0.5f %0.5f\n",r[0],r[1],r[2]);
        //printf(" ----- \n");
    }
    return 0;
}

Measured memory_bytes: 752
import java.io.*;
public class Main{
  public static void main(String[] args) throws IOException{
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    String s = reader.readLine();
    System.out.println(solve(s));}
  public static int solve(String s){
    int i = 0;
    int res = 0;
    int j = s.length()-1;
    while(i<j){
      if(s.charAt(i)!=s.charAt(j)){
        res++;}
      i=i+1;
      j--;}
    return res;}}
      
    

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

namespace AtCoder2 {
	class Program {
		static void Main(string[] args) {
	var inputArray = retreiveStringArray();
			var inputCount = 1;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			var S = inputArray[0];

			

			//答えの出力
			var ans = "";

			switch (S) {
				case "Sunny":
					ans = "Cloudy";
					break;
				case "Cloudy":
					ans = "Rainy";
					break;
				case "Rainy":
					ans = "Sunny";
					break;
				default:
					break;
			}

			Console.WriteLine(ans);

		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}


		/// <summary>
		/// 2組みずつの入力データ(数値)からTuppleListを作成する
		/// </summary>
		/// <param name="N"></param>
		/// <returns></returns>
		private static List<Tuple<long, long>> createLongTuppleList(long N) {
			var inpList = new List<Tuple<long, long>>();

			for (int i = 0; i < N; i++) {
				var inp = retreiveLongArray();
				var item1 = inp[0];
				var item2 = inp[1];
				inpList.Add(new Tuple<long, long>(item1, item2));
			}
			return inpList;
		}
	}
}


Measured memory_bytes: 25856
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import decimal
import heapq
import collections
import itertools
from operator import mul

sys.setrecursionlimit(100001)


# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

x1, y1, x2, y2 = map(float, input().split())

ans = pow(x1-x2, 2) + pow(y1-y2, 2)
ans = math.sqrt(ans)
print(ans)


Measured memory_bytes: 6876
//C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

//Hang in there!

using namespace std;


int main() {
	vector<int>data(3);
	for (int i = 0; i < 3; i++) {
		cin >> data[i];
	}
	sort(data.begin(), data.end());
	cout << data[1] - data[0] + data[2] - data[1] << endl;
}



Measured memory_bytes: 256
// #pragma GCC optimize "trapv" Uncomment when dealing with huge numbers
/*<----------PBDS---------->

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
template <typename T>
using order_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

order_set<datatype>oset;
Kth smallest : *oset.find_by_order(k-1); // 0 based index
No of elements less than k : oset.order_of_key(k);
Erase X : oset.erase(x)
<----------PBDS---------->*/
#include<iostream>
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define pb(x) push_back(x)
#define gcd(a,b) __gcd(a,b)
#define all(v) v.begin(),v.end()
#define lcm(a,b) (a*b)/gcd(a,b)
#define bits(x) __builtin_popcountll(x)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int l = 300000, r, i, cnt = 0, n, a, b;
char s1[100010], s2[500010];
int32_t main()
{

	char c;
	
	scanf("%s", s1);
	
	r = l + strlen(s1);
	
	for (i = l; i < r; i++)
		s2[i] = s1[i - 300000];
	
	scanf("%d", &n);
	
	for (i = 0; i < n; i++)
	{
		scanf("%d", &a);
		
		if (a == 1)
			cnt = 1 - cnt;
		else
		{
			scanf("%d %c", &b, &c);
			
			if ((b == 1 && cnt == 0) || (b == 2 && cnt == 1))
			{
				s2[--l] = c;
			}
			else
			{
				s2[r++] = c;
			}
		}
	}
	
	if (cnt == 0)
	{
		for (i = l; i < r; i++)
			printf("%c", s2[i]);
	}
	else
	{
		for (i = r - 1; i >= l; i--)
			printf("%c", s2[i]);
	}
	return 0;
}




Measured memory_bytes: 896
#include<iostream>
using namespace std;
main()
{
	int date[3];
	for(int i=0;i<3;i++)cin>>date[i];
	if (date[0]==1){
		if (date[2]==0){
			if (date[1]==0){
				cout<<"Close"<<endl;
			}else{
				cout<<"Open"<<endl;
			}
		}
	}else if (date[0]==0){
		if (date[1]==1){
			if (date[2]==0) cout<<"Close"<<endl;
		}else{
			if (date[2]==0){
				cout<<"Close"<<endl;
			}else{
				cout<<"Open"<<endl;
			}
		}
	}
}

Measured memory_bytes: 1156
def main():
    N = int(input())
    A = list(map(int,input().split()))
    pre = A[0]
    for i in A:
        if pre > i:
            print("No")
            return
        elif pre < i:
            pre = i -1
    print("Yes")        
if __name__ == "__main__":
    main()     

Measured memory_bytes: 20644
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  // k行、l列 ボタンを押したときの黒マスの個数
  // k*(M-l) + l*(N-k)
  // N行のうち、列ボタンをおしていない数(M-l)が黒マスに変わる
  // M列のうち、行ボタンをおしていない数(N-k)が黒マスに変わる
  int N, M, K, ans;
  cin >> N >> M >> K;
  REP(i, N + 1){
    REP(j, M + 1){
      ans = i * (M-j) + j * (N-i);
      if(ans == K){
        cout << "Yes" << endl;
        return 0;
      }    
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
typedef long long   ll;
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define mem(a,h)          memset(a, (h), sizeof(a))
#define fi first
#define se second
#define por(a,b) (((a%MOD) * (b%MOD))%MOD)
#define forg(i, b, e, c)    for (ll i = (ll)b; i < (ll)e; i+=c)
#define forr(i, b, e)    for (ll i = b; i < e; i++)
 
 
using namespace std;
//using namespace __gnu_pbds;
typedef double lldb;
typedef pair<ll, ll>  ii;
typedef pair<ii, ll>  iii;
typedef vector<ll>     vi;
typedef vector<vi>     vvi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const ll INF = 1e9;
const double PI = acos(-1);
#define tam 120000
#define offset 
const ll MOD= 1e9+7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int  main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    int n,k;
    cin>>n>>k;
    set<int> s;
    forr(i,1,n+1)
    s.insert(i);
    int tipo,valor;
    forr(i,0,k)
    {
        cin>>tipo;
        forr(j,0,tipo)
        {
            cin>>valor;
            s.erase(valor);
        }
    }
    cout<<s.size()<<endl;
}
// PLUS ULTRA!
    


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int power(int num)
{
    int p=1;
    for(;1<num;num--)p*=10;
    return p;
}
int main() {
    int n,m,a[3]={15,3,5};
    string str,fb[3]={"FizzBuzz","Fizz","Buzz"};
    while(cin>>m>>n,n,m){
        bool player[1000]={};
        for(int i=1,now=0,out=m;i<=n;i++,now=(now+1)%m){
			cin>>str;
			if(out>1){
				int num=0,co=-1;
				while(player[now])now=(now+1)%m;
				for(int j=0;j<3&&co<0;j++)if(i%a[j]<1)co=j;
				for(int j=0;j<str.size()&&co<0;j++)num+=(str[j]-'0')*power(str.size()-j);
				if(co>-1&&str!=fb[co]||co<0&&i!=num)player[now]=1;
				if(player[now])out--;
			}
		}
		for(int i=0,co=0;i<m;i++){
			if(!player[i]&&co>0)cout<<" ";
			if(!player[i]){
				cout<<i+1;
				co++;
			}
		}
		cout<<endl;
	}
}

Measured memory_bytes: 1216
N = int(input())
S = input()

cand = []
black = 0
white = 0

for s in S:
    if s == '.':
        white +=1
cand.append(white)
        
for s in S:
    if s == '#':
        black += 1
    else:
        white -= 1
    cand.append(black+white)

print(min(cand))

Measured memory_bytes: 11492
<?php
fscanf(STDIN, "%d", $N);
for($i = 0; $i < $N; $i++)fscanf(STDIN, "%d%d", $a[], $b[]);
for($i = 0; $i < $N; $i++)fscanf(STDIN, "%d%d", $c[], $d[]);

array_multisort($c, SORT_ASC, $d);

$ok = 0;
for($i = 0; $i < $N; $i++){//cd
    $maxY = -100;
    $maxJ = -1;
    foreach($a as $j => $_){//ab
        if($a[$j] < $c[$i] && $b[$j] < $d[$i]){
            if($maxY < $b[$j]){
                $maxY = $b[$j];
                $maxJ = $j;
            }
        }
    }
    if($maxJ != -1){
        unset($a[$maxJ]);
        unset($b[$maxJ]);
        $ok++;
    }
}
echo $ok;

Measured memory_bytes: 4604
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String[] days = {"MON","TUE","WED","THU","FRI","SAT","SUN"};
        int today = 0;
        
        for(int i=0; i<days.length; i++){
            if(days[i].equals(s)){
                today = i;
                break;
            }
        }
        
        int ans = 0;
        for(int j=today; j<days.length; j++){
            if(days[j].equals("SUN")){
                break;
            }
            ans++;
        }
        
        System.out.println(ans==0?7:ans);
    }
}

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

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def ceil(a, b=1): return int(-(-a // b))
def round(x): return int((x*2+1) // 2)
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

S = input()
N = len(S)

if N < 3:
    if S[0] == S[1]:
        print(1, 2)
    else:
        print(-1, -1)
    exit()

for i in range(2, N):
    if len(set(S[i-2:i+1])) != 3:
        print(i-1, i+1)
        exit()
print(-1, -1)


Measured memory_bytes: 5844
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

int solve(int n)
{
  return n & 1 ? n / 2 + 1 : n / 2;
}

int main()
{
  int n;
  std::cin >> n;

  std::cout << std::setprecision(20);
  std::cout << solve(n) << std::endl;
}


Measured memory_bytes: 256
### SNIPPET
  # n = gets.split.map(&:to_i)
  # array = n.times.map { gets.split.map(&:to_i) }
  # [].all?(&:even?)
  # a = [*1..m].repeated_combination(n).to_a
  # [1,2,3,4,5].select { |num| num.even? }  # => [2, 4]
  # ["a","a","b"].group_by(&:itself).map{|k,v| [k, v.count]}.to_h #=> {"a"=>2, "b"=>1}
  # 切り捨て: .floor(2).to_f ,切り上げ： .ceil(2).to_f,四捨五入: round(2)
  # 3.upto(6) do |i|, 6.downto(3) do |i|
  # 公約数125.gcd(100)、公倍数125.lcm(100)
  # PI = Math::PI
  # 高さ = a * Math.sin(w / 180.0 * Math::PI), 底辺 = a * Math.cos(w / 180.0 * Math::PI)
  # def chmax(a, b) a > b ? a : b end
  # INF = Float::INFINITY
  # def chmin(a, b) a < b ? a : b end

s = gets.chomp

puts s[2] == s[3] && s[4] == s[5] ? "Yes" : "No"

Measured memory_bytes: 1788
x, y = map(int, input().split())
tx, ty = 0, 0
a = 1
b = 1
ans = 1
while 1:
    if (tx,ty) == (x,y): break

    b += a
    tx += b-1
    ans += 1
    #print(tx-a+1, tx, "  ", ty, ty+a-1)
    if tx-a+1<=x<=tx and ty<=y<=ty+a-1: break

    a += b
    ty += a-1
    ans += 1
    #print(tx-b+1, tx, "  ", ty-b+1, ty)
    if tx-b+1<=x<=tx and ty-b+1<=y<=ty: break

    b += a
    tx -= b-1
    ans += 1
    #print(tx, tx+a-1, "  ", ty+a+1, ty)
    if tx<=x<=tx+a-1 and ty-a+1<=y<=ty: break

    a += b
    ty -= a-1
    ans += 1
    #print(tx, tx+b-1, "  ", ty, ty+b-1)
    if tx<=x<=tx+b-1 and ty<=y<=ty+b-1: break
print(ans%3 if ans%3 else 3)


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ld> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;  // 小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;     // 大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define TS to_string
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


ll INF = 1e9;
ll NIL = -1;
ll MOD = 1000000007;
ll LINF = 1e18;
ld EPS = 1e-9;
ld PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b;}     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}

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

const ll N = 1000000;
long long power_mod(long long x, long long y, long long m){
    long long res = 1 ;
    if(y>0){
        res = power_mod(x,y/2,m) ;
        if(y%2==0){
            res = (res*res)%m ;
        }
        else{
            res = (((res*res)%m)*x)%m ;
        }
    }
    return res ;
}
//-----------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll k;
    cin >> k;

    ll tmp = 0;
    for(ll i=0;i<=N;i++){
        tmp += 7 * power_mod(10,i,k);
        tmp %= k;
        if(tmp==0){
            cout << i+1 <<endl;
            return 0;
        }
    }
    cout << -1 <<endl;




    
    return 0;
}



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

using namespace std;
using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()

ll ts = 1000000007;

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

  string s;
  cin >> s;

  bool can = true;
  ll ans = 0, now = 0;

  for (ll i = 0; i < s.size(); i++) {
    for (ll j = 0; j < s.size(); j++) {
      now = 0;
      for (ll k = i; k <= j; k++) {
        if (s[k] == 'A' || s[k] == 'G' || s[k] == 'C' || s[k] == 'T') {
          now++;
        } else {
          break;
        }
      }
      ans = max(ans, now);
    }
  }

  cout << ans << "\n";
}

Measured memory_bytes: 256
#include<iostream>
int n,m;
int A[2000],B[2000];
bool solve(int i,int m){
	if(m==0){
		return true;
	}
	if(i>=n){
		return false;
	}
	int res=solve(i+1,m)||solve(i+1,m-A[i]);
	return res;
}
int main(){
    std::cin>>n;
    for(int i=0;i<n;i++){
    std::cin>>A[i];
    }
    std::cin>>m;
    for(int i=0;i<m;i++){
    std::cin>>B[i];
    }
	for(int i=0;i<m;i++){
		if(solve(0,B[i])){
			std::cout<<"yes\n";
		}else{
			std::cout<<"no\n";
		}
	}
  return 0;
}



Measured memory_bytes: 3080
#include<bits/stdc++.h>
using namespace std;
int calc();
int expr();
int number();
string tmp;
int pos;
char c[]="()+-*01";
int ans=-1;
bool f=0,ff;
int calc(){
  int res=expr();
  while(1){
    if(tmp[pos]=='+') {pos++;res+=expr();}
    else if(tmp[pos]=='-') {pos++;res-=expr();}
    else break;
    if(res<0||res>=(1<<10)) ff=0;
  }
  if(res<0||res>=(1<<10)) ff=0;
  return res;
}
int expr(){
  int res=number();
  while(1){
    if(tmp[pos]=='*') {pos++;res*=number();}
    else break;
    if(res<0||res>=(1<<10)) ff=0;
  }
  if(res<0||res>=(1<<10)) ff=0;
  return res;
}
int number(){
  int res=0;
  if(tmp[pos]=='(') {
    pos++;res=calc();pos++;
  }else{
    while(pos<(int)tmp.size()&&isdigit(tmp[pos])) {
      res=res*2+tmp[pos]-'0';
      pos++;
      if(res<0||res>=(1<<10)) ff=0;
    }
  }
  if(res<0||res>=(1<<10)) ff=0;
  return res;
}
 
bool check(string s){
  int o=0;
  bool op[100]={};
  for(int i=0;i<(int)s.size();i++){
    if(s[i]=='(') {
      o++;
      op[o]=1;
      if(i+1>=(int)s.size()) return 0;
      if(!isdigit(s[i+1])&&s[i+1]!='(') return 0;
    }    
    if(s[i]==')') {
      if(op[o]) return 0;
      o--;
      if(i-1<0) return 0;
      if(!isdigit(s[i-1])&&s[i-1]!=')') return 0;
    }
    if(s[i]=='+'||s[i]=='-'||s[i]=='*') {
      op[o]=0;
      if(i-1<0||i+1>=(int)s.size()) return 0;
      if((!isdigit(s[i-1])&&s[i-1]!=')')||(!isdigit(s[i+1])&&s[i+1]!='(')) return 0;
    }
    if(o<0) return 0;
  }
  if(o) return 0;
  return 1;
}
void rec(string s){
  for(int i=0;i<(int)s.size();i++){
    if(s[i]!='.') continue;
    for(int j=0;j<8;j++){
      s[i]=c[j];
      rec(s);
    }
    return;
  }
  if(!check(s)) return;
  tmp=s;pos=0;ff=1;
  int k=calc();
  //cout<<k<<":"<<tmp<<endl;
  if(pos==(int)tmp.size()&&ff) ans=max(ans,k);
}
int main(){
  string s;
  cin>>s;
  rec(s);
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3176
#include  <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 1000000007
//vector<vector<int>> vec(縦, vector<int>(横));
#define REP(i,N) for(int i=0;i<N;i++)
int gcd(int a, int b) {
    if(a>b){
        swap(a,b);
        }
    while(b%a!=0){
        b%=a;
        swap(a,b);
    }
    return a;
}

//cout << setprecision(123)<<ans;
//a=atoi(S.c_str());
//S=to_string(a);
int main(){
  int N;
  string S;
  cin>>N>>S;
  if(N%2==1){
      cout<<"No"<<endl;
      return 0;
    }
  
  REP(i,N/2){
    if(S[i]!=S[N/2+i]){
      cout<<"No"<<endl;
      return 0;
    }
  }
    cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> namespace mp = boost::multiprecision; //mp::cpp_intで宣言
using namespace std;
typedef long long ll;
//#define i_7 (ll)(1E9+7)
#define i_7 998244353
//#define i_5 (ll)(1E9+5)
#define i_5 998244351
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;//10^12
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll * pos,ll val){*pos=max(*pos,val);}//Max(&dp[i][j],dp[i-1][j]);
void Min(ll * pos,ll val){*pos=min(*pos,val);}
void Add(ll * pos,ll val){*pos=mod(*pos+val);}
const long double EPS=1E-8;
////////////////////////////////////////

int main(){

    ll n,a,b;cin>>n>>a>>b;
    if((b-a)%2==0){
        cout<<"Alice"<<endl;
    }else{
        cout<<"Borys"<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define f first
#define s second
#define pii pair<int,int>
#define forn(a,b,c) for(int a=b;a<=c;a++)
#define ford(a,b,c) for(int a=b;a>=c;a--)
const int N=2e5+5;
int n,t;
char a[N];
pair<char,char>q[N];
int main()
{
    scanf("%d%d",&n,&t);
    forn(i,1,n){
        scanf(" %c",&a[i]);
    }
    forn(i,1,t){
        scanf(" %c %c",&q[i].f,&q[i].s);
    }
    int l=1,r=n;
    ford(i,t,1){
        if(q[i].f==a[l]&&q[i].s=='L'){
            l++;
        }
        else if(q[i].f==a[l-1]&&q[i].s=='R'){
            l--;
        }
        if(q[i].f==a[r]&&q[i].s=='R'){
            r--;
        }
        else if(q[i].f==a[r+1]&&q[i].s=='L'){
            r++;
        }
    }
    printf("%d\n",max(0,r-l+1));
    return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, const char * argv[]) {

    int n, k;
    cin >> n >> k;
    int x;
    int c = 0;
    for (int i=0; i<n; i++){
        cin >> x;
        if(x <= k-x) {
            c += 2 * x;
        } else {
            c += 2 * (k - x);
        }
    }
    cout << c << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    String s=sc.next();
    sc.close();
    for(int i=0;i<s.length();i+=2){
      if(s.charAt(i)=='L'){
            System.out.println("No");
            return;
      }
    }
        for(int i=1;i<s.length();i+=2){
      if(s.charAt(i)=='R'){
            System.out.println("No");
            return;
      }
    }
    System.out.println("Yes");
  }
}

Measured memory_bytes: 23124
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
const ll N=1007,mod=1e9+7;
ll a[N],vis[N]={0};
int main()
{
    vis[1]=1;
    int k=0;
    for(int i=2;i<=1000;i++)
    {
        if(!vis[i])
        {
            for(int j=2*i;j<=1000;j+=i)
            {
                vis[j]=1;
            }
            a[k++]=i;
        }
    }
    ll n;
    cin>>n;
    ll sum=1;
    for(int i=0;i<k&&a[i]<=n;i++)
    {
        ll num=n;
        ll cnt=0;
        ll t=a[i];
        while(1)
        {
            if(t>num) break;
            cnt+=num/t;
            t*=a[i];
        }
        cnt++;
        sum*=cnt;
        sum%=mod;
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
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 ll=long long;
using namespace std;
int main(){
    int n;
    string s;
    cin>>n>>s;
    int counter=0;
    for(int i=0;i<=n-3;i++){
        if(s.at(i)=='A' && s.at(i+1)=='B' &&s.at(i+2)=='C') counter++;
        
    }
    cout<<counter<<endl;
}


Measured memory_bytes: 3588
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define MOD  998244353 
#define ll long long
#define int long long
# define INF 9999999
#define ar array
#define MAX 1000004
# define fr first
# define sc second
#define wt(x) int x;cin>>x;while(x--)
#define watch(x) cerr << "\n" << (#x) << " is " << (x) << endl
//#define cerr if(false)cerr
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> pbds;
const int N=6e5+6;
void  c_p_c(){
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
 
#ifndef ONLINE_JUDGE
  freopen("input1.txt","r",stdin);
  freopen("output1.txt","w",stdout);
#endif
 }
 
int power(int a,int b,int mod){
    a=a%mod;
    if(a==0){
        return 1;
    }
    int res=1;
    while(b){
        if(b&1){
            res=(res*a)%mod;
        }
        b>>=1;
        a=(a*a)%mod;
    }
    return res;
 }
 
int  MMI(int p){
    return power(p,MOD-2,MOD);
}
 
 
 
int32_t main()
{
    c_p_c();
    int x,n;
    cin>>x>>n;
    if(n==0){
        cout<<x;
        return 0;
    }
   set<int>s;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        s.insert(x);
    }
    int diff=INT_MAX;
    int ans=INT_MAX;
    for(int i=-1000;i<=1000;i++){
        if(s.count(i))continue;
        int di=abs(x-i);
        if(di<diff){
            diff=di;
            ans=i;
 
        }
    }
    cout<<ans;
    
 
        
 
        
}

Measured memory_bytes: 3632
import sys
input = sys.stdin.readline
import numpy as np
from scipy.sparse.csgraph import csgraph_from_dense, dijkstra

xs,ys,xt,yt = map(int,input().split())
N = int(input())
XYR = np.empty((3,N+2),dtype=np.float64)
XYR[:,:2] = [[xs,xt],[ys,yt],[0,0]]

XYR[:,2:] = np.array([input().split() for _ in range(N)], dtype=np.float64).T

X,Y,R = XYR

dist = np.sqrt(np.square(X[:,None] - X[None,:]) + np.square(Y[:,None] - Y[None,:])) # euclid
dist -= R[:,None] + R[None,:]
np.maximum(dist, 0, out = dist)
dist[range(N+2), range(N+2)] = np.inf

graph = csgraph_from_dense(dist, null_value = np.inf)

answer = dijkstra(graph, indices = 0)[1]

print(answer)


Measured memory_bytes: 51384
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+10;
int dp[maxn][2];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin>>s;
    dp[0][0]=1;
    dp[1][1]=1;
    for(int i=0;s[i];++i){
        if(i-1>=0){
            if(s[i]!=s[i-1])dp[i][0]=max(dp[i][0],dp[i-1][0]+1);
            dp[i][0]=max(dp[i][0],dp[i-1][1]+1);
        }
        if(i-2>=0){
            if(s[i]!=s[i-2]&&s[i-1]!=s[i-3])dp[i][1]=max(dp[i][1],dp[i-2][1]+1);
            dp[i][1]=max(dp[i][1],dp[i-2][0]+1);
        }
    }
    int len=s.length();
    cout<<max(dp[len-1][0],dp[len-1][1])<<endl;
}


Measured memory_bytes: 2196
#include<cstdio>
#include<algorithm>
#include<cstring>
#define rep(i, s, t) for(i = s; i <= t; ++i)

using namespace std;

const int K = 1010;
int n, k, ans;
int a[K][K], b[K][K];

int doa(int x1, int y1, int x2, int y2) {
	return a[x2][y2] - a[x1-1][y2] - a[x2][y1-1] + a[x1-1][y1-1];
}

int dob(int x1, int y1, int x2, int y2) {
	return b[x2][y2] - b[x1-1][y2] - b[x2][y1-1] + b[x1-1][y1-1];
}

int main() {
	int i, j, x, y, t, o; char c[5];
	scanf("%d %d", &n, &k);
	rep(i, 1, n) {
		scanf("%d %d %s", &x, &y, c);
		if(c[0] == 'B') o = 1; else o = 0;
		x = (x+k+k-1) % (k+k) + 1; y = (y+k+k-1) % (k+k) + 1;
		if(x > k) x -= k, o ^= 1;
		if(y > k) y -= k, o ^= 1;
		//printf("%d %d\n", x, y);
		if(o) ++a[x][y]; else ++b[x][y];
	}
	rep(i, 1, k)
		rep(j, 1, k) {
			a[i][j] += a[i-1][j] + a[i][j-1] - a[i-1][j-1];
			b[i][j] += b[i-1][j] + b[i][j-1] - b[i-1][j-1];
		}
		
	rep(i, 1, k)
		rep(j, 1, k) {
			t = 0;
			t += doa(1, 1, i, j) + doa(i+1, j+1, k, k);
			t += dob(1, j+1, i, k) + dob(i+1, 1, k, j);
			ans = max(ans, t);
			
			
			t = 0;
			t += dob(1, 1, i, j) + dob(i+1, j+1, k, k);
			t += doa(1, j+1, i, k) + doa(i+1, 1, k, j);
			ans = max(ans, t);
		}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    int n,k;
    cin>>n>>k;
    int a[200001];
    for(int i=1; i<=n; i++)
        cin>>a[i];
    bool z=0;
    while(k--)
    {
        int r[200001]= {0};
        int l[200001]= {0};
        for(int i=1; i<=n; i++)
        {
            r[max(i-a[i],1)]++;
            l[min(n,i+a[i])]++;
        }
        if(r[1]==n&&l[n]==n)
        {
            z=1;
            break;
        }
        int j=0;
        for(int i=1; i<=n; i++)
        {
            j+=r[i];
            a[i]=j;
            j-=l[i];
        }
    }
    if(z)
    {
        for(int i=1; i<=n; i++)
            cout<<n<<' ';
    }
    else
    {
        for(int i=1; i<=n; i++)
            cout<<a[i]<<' ';
    }
    cout<<'\n';
    return 0;
}


Measured memory_bytes: 5992
//==========================================
// ABC132c Divide the Problem
//
// 2019/08/16
//==========================================

#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

int main(int argc, char* argv[])
{
  int n;
  cin >> n;

  vector<int> d(n);
  for(int i=0; i<n; i++) cin >> d[i];

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

  int ans;
  ans= d[n/2] - d[n/2 -1];
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 640
N = int(input())
L = input()
L = L.split()
sum_N = 0
max_N = 0
for i, val in enumerate(L):
    L[i] = int(val)
    sum_N += L[i]
    if L[i] > max_N:
        max_N = L[i]
if max_N >= (sum_N - max_N):
    print('No')
else:
    print('Yes')




Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;


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

    if (N >= M) {
        dif = 0;
    }else{
        dif = X[M - 1] - X[0];
    
        vector <int> Y(M - 1);
        for(int i = 0; i < M - 1; i++){
            Y[i] = X[i + 1] - X[i];
        }

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

        for(int i = 0; i < N - 1; i++){
            dif -= Y[i];
        }
    }
    
    cout << dif << endl;
    return 0;
}

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

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

typedef long long ll;
typedef pair<int, int> ii;
const int mod = 1e9+7;
const ll INF = 1e18;
const int inf = 1e9;

void solve()
{
  int n; cin>>n;
  vector<int> w(n, 0);
  for (int i=0; i<n; i++) {
    cin >> w[i];
  }
  vector<int> sl(n+1, 0);
  vector<int> sr(n+1, 0);
  for (int i=0; i<n; i++) {
    sl[i+1] = sl[i]+w[i];
    sr[n-i-1] = sr[n-i]+w[n-i-1];
  }
  int ans = inf;
  for (int i=0; i<n; i++) {
    ans = min(ans, abs(sl[i+1]-sr[i+1]));
  }
  cout << ans << endl;
}

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


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <map>
#include<set>
#include <vector>
#include <string>
#include <utility>
#include <stack>
#include <queue>
using namespace std;
const int mod=1e9+7;

int main()
{
	int n,d;
	cin>>n>>d;
	//vector<vector<int>> x(200);
	//for (int i = 0; i <n; i++)
      //  x[i].resize(n);
vector <vector<int> > x;
vector<int> temp(d+1);
x.resize(n+1,temp);
	for(int i=0;i<n;i++)
		for(int j=0;j<d;j++)
			scanf("%d",&x[i][j]);
	int cnt=0;
	for(int i=0;i<n-1;i++)
		for(int j=i+1;j<n;j++)
		{
			if(i==j)
				break;
			int s=0;
			for(int z=0;z<d;z++)
			{
				s+=(x[i][z]-x[j][z])*(x[i][z]-x[j][z]);
			}
			double ans=(double)sqrt(s);
			int c=ans;
			double d=c;
			if(d==ans)
				cnt++;

		}
		cout<<cnt<<endl;
 	return 0;
}

Measured memory_bytes: 256
x,k,d = map(int,input().split()) #x 最初の座標 k 移動回数　D移動距離
dum2 = 10000000
if x < 0:
    x = -x
div,mod = divmod(x,d)
if div >= k:
    print(x-(k*d))
else:
    dum1 = mod
    dum2 = abs(mod-d)
    if (k-div)%2 == 1:
        print(dum2)
    else:
        print(dum1)

Measured memory_bytes: 9184
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int i = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int MOD = 1e9 + 7;

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

    return 0;
}

Measured memory_bytes: 256
x1, y1, x2, y2 = map(int, input().split())
x3 = x2 - y2 + y1
y3 = y2 + x2 - x1
x4 = x3 - y3 + y2
y4 = y3 + x3 - x2
print(x3, y3, x4, y4)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);
#define int long long int
using namespace std;
const int MAXN = 100, MOD = 1e9 + 7;
int n, k, base[MAXN][MAXN];
struct matrix
{
     int n, m;
     int v[MAXN][MAXN];
     matrix(int n = 0, int m = 0)  : n(n), m(m)
     {
          memset(v, 0, sizeof(v));
     }
     matrix operator * (matrix a)  const
     {
          matrix ans(n, a.m);
          for(int i = 0; i < n; i++)
               for(int j = 0; j < a.m; j++)
                    for(int k = 0; k < m; k++)
                    {
                         ans.v[i][j] += v[i][k] * a.v[k][j];
                         ans.v[i][j] %= MOD;
                    }     
          return ans;
     }
};
main()
{
     fastio;
     cin >> n >> k;
     matrix b(n, n);
     for(int i = 0; i < n; i++)
          for(int j = 0; j < n; j++)
               cin >> b.v[i][j];
     matrix ans(n, n);
     for(int i = 0; i < n; i++)     ans.v[i][i] = 1;
     for(int i = 62; i >= 0; i--)
     {
          ans = ans * ans;
          if(k & 1LL << i) ans = ans * b;
     }
     int resp = 0;
     for(int i = 0; i < n; i++)
          for(int j = 0; j < n; j++){
               ans.v[i][j] %= MOD;
               resp += ans.v[i][j];
               resp %= MOD;
          }
     cout << resp << endl;
}

Measured memory_bytes: 3960
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int A = in.nextInt();
            int B = in.nextInt();
            int C = in.nextInt();
            int X = in.nextInt();
            int count = 0;
            for (int a500 = 0; a500 <= A; a500++) {
                for (int b100 = 0; b100 <= B; b100++) {
                    for (int c50 = 0; c50 <= C; c50++) {
                        if (500 * a500 + 100 * b100 + 50 * c50 == X) {
                            count++;
                        }
                    }
                }
            }
            System.out.println(count);
        }
    }
}


Measured memory_bytes: 21844
N = int(input())
A = [int(n) for n in input().split()]

ans = 0

def func(array):
    for i in range(len(array)):
        if array[i]%2 != 0:
            return False
        else:
            array[i] = array[i]//2
    return True


while True:
    if len(A) == A.count(0):
        break
    if func(A):
        ans += 1
    else:
        break

print(ans)

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

using namespace std; 

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

	vector< vector<int>> h( n, vector<int> (2) );
	int sum=0;
	for( int i=0 ; i<n ; i++ )
	{
		cin>>h[i][0]>>h[i][1];

		sum += h[i][1];
	}

	vector<long> dp( sum+1 , INT_MAX);
	dp[0]=0;

	for( int i=0 ; i<n ; i++ )
	{
		for( int j= sum-h[i][1] ; j>=0 ; j-- )
		{
			dp[ j+h[i][1] ] = min( dp[ j+h[i][1] ] , dp[j]+h[i][0] );
		}
	}

	long result = 0;
	for( long i=0 ; i<= sum ; i++ )
		if( dp[i] <= w )
			result = max(result , i);

	cout<<result;
	return 0; 
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cassert>
#include <memory>
#include <stack>
#include <set>

#define MAX_SIZE 100000000
typedef unsigned long long ull;
using namespace std;

int sum(const string& s) {
  int sum = 0;
  for(auto c : s) {
    sum += c - '0';
  }
  return sum;
}

int main() {
  string s; cin >> s;
  int is = stoi(s);
  string ans = "Yes";
  if(is % sum(s) == 0) ans = "Yes";
  else ans = "No";

  cout << ans << endl;
}


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

using namespace std;
typedef long long llong;

#define MAX 200001
const llong mod = 1000000000 + 7;

int main()
{
  int N, flag = 1, ans = 0;
  char S[11];
  vector<string> v;

  scanf("%d", &N);
  for (int i = 0; i < N; i++)
  {
    scanf("%s", &S);
    v.push_back(S);
  }

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

  string a = "";
  for (auto str : v)
  {
    if (str.compare(a))
      ans++;
    a = str;
  }

  printf("%d\n", ans);

  return 0;
}

Measured memory_bytes: 11108
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef pair<ll,ll> p;
const int inf=(1<<30);
#define rep(i,a,n)	for(int i=a;i<n;i++)
#define rrep(i,a,n) for(int i=(a-1);i>=n;i--)
	
bool pairComparesecond(const p& firstElof, const p& secondElof)
{
    return firstElof.second > secondElof.second;
}
 
int main(){
	ll n,m;
	ll a[100010];
	cin>>n>>m;
	rep(i,0,m)cin>>a[i];
	sort(a,a+m);
	ll b[100010];
	rep(i,1,m){
		b[i]=abs(a[i]-a[i-1]);
	}
	sort(b,b+m);
	ll ans=0;
	rep(i,1,m-n+1){
		ans+=b[i];
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include<stdio.h>
int main(void)
{
	int m,f,b,a;
	scanf("%d %d %d",&m,&f,&b);
	a=0;
	if(m<b){
		m=b-m;
		if(f<m){
			printf("NA\n");
		}
		else{
			printf("%d\n",m);
		}
	}
	else{
		printf("%d\n",a);
	}
	return 0;
}


Measured memory_bytes: 2096
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] a_b_c = sc.nextLine().split(" ");
        int a = Integer.parseInt(a_b_c[0]);
        int b = Integer.parseInt(a_b_c[1]);
        int c = Integer.parseInt(a_b_c[2]);
        if (a < b && b < c) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 26048
#include <bits/stdc++.h>
using namespace std;;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
   string s;cin >> s;
   if(s=="ABC")cout << "ARC" << endl;
   else cout <<"ABC" << endl;
}

Measured memory_bytes: 3612
def main():
    import sys
    input = sys.stdin.readline
    while True:
        N, W, D = map(int, input().split())
        if N == W == D == 0:
            break

        piece = [(W, D)]
        for _ in [0]*N:
            p, s = map(int, input().split())
            w, d = piece.pop(p-1)
            s %= w+d
            if s < w:
                w1 = min(s, w-s)
                w2 = w-w1
                piece.append((w1, d))
                piece.append((w2, d))
            else:
                s -= w
                d1 = min(s, d-s)
                d2 = d-d1
                piece.append((w, d1))
                piece.append((w, d2))

        piece.sort(key=lambda x: x[0]*x[1])
        print(*map(lambda x: x[0]*x[1], piece))


if __name__ == '__main__':
    main()



Measured memory_bytes: 6244