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

using namespace std;

using ll = long long;
const int N = 1e5 + 1;
pair<int, int> a[N];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        a[i] = {x, i};
    }
    sort(a + 1, a + n + 1);
    for (int i = 1; i <= n; i++) {
        cout << a[i].second << ' ';
    }
    return 0;
}


Measured memory_bytes: 1664
H,W,D = [int(n) for n in raw_input().split(" ")]
Location = {}
for h in range(1,H + 1):
	A = [int(n) for n in raw_input().split(" ")]
	for w, a in enumerate(A):
		Location[a] = (h, w+1)
Q = int(raw_input())
L = [None] * (Q+1)
R = [None] * (Q+1)
for q in range(1,Q+1):
	L[q], R[q] = [int(n) for n in raw_input().split(" ")]



C = {}
for d in range(1,D+1):
	C[d,d] = 0
	cur_dist = 0
	for x1 in range(d, H * W + 1, D):
		x2 = x1 + D
		if x2 > H * W: 
			break
		h1, w1 = Location[x1]
		h2, w2 = Location[x2]
		#C[(x1, x2)] = abs(h1 - h2) + abs(w1 - w2)
		cur_dist = cur_dist + abs(h1 - h2) + abs(w1 - w2)
		C[(d,x2)] = cur_dist
	
for q in range(1,Q+1):
	l, r = L[q], R[q]
	d = l % D
	if d == 0: 
		d = D
	print (C[(d,r)] - C[(d,l)])

Measured memory_bytes: 46008
# from https://twitter.com/wakuwinmail_C/status/950277218411855872

N, Y = gets.split.map(&:to_i)
x = y = 0
z = Y / 1000

y = [(z - N) / 4, z / 5].min
z -= y * 5

x = y + z - N
y -= x * 2

if y < 0
  x = y = z = -1
end

puts "#{x} #{y} #{z}"


Measured memory_bytes: 1788
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

// 0, 1, 2, ..., n の xor を求める
long f(long n) {
    if (n <= 0) return 0;

    long ans = 0;
    for (long i = n / 4 * 4; i <= n; i++) {
        ans ^= i;
    }
    return ans;
}

long calc(long a, long b) {
    return f(a - 1) ^ f(b);
}

void main() {
    auto ab = reads!long;
    long a = ab[0], b = ab[1];

    auto ans = calc(a, b);
    writeln(ans);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[10];
int main()
{
	int n;
	for (int i = 0; i < 5; ++i)
	{
		cin>>a[i];
	}
	for (int i = 0; i < 5; ++i)
	{
		if(a[i]==0)
		{
			printf("%d\n",i+1 );
			return 0;
		}
	}

	
	return 0;
}

Measured memory_bytes: 3724
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl

typedef long long ll;
typedef long double ld;
using namespace std;

const int MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<int> h(n);
    vector<int> dp(n);
    for(int i = 0; i < n; i++)
    {
        cin >> h[i];
    }
    dp[n - 1] = 0;
    for(int i = n - 2; i > -1; i--)
    {
        if(h[i + 1] <= h[i])
        {
            dp[i] = dp[i + 1] + 1;
        }
        else
        {
            dp[i] = 0;
        }
    }
    cout << *max_element(dp.begin(), dp.end());

    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main()
{

  int n,tmp,l,i,j,k;

  scanf("%d",&n);
  
  int p[n+1],m[n+1][n+1];

  scanf("%d",&p[0]);
  scanf("%d",&p[1]);

  if(n==1) {
    printf("0\n");
    return 0;
    }
  
  if(n==2) {
    scanf("%d",&tmp);
    scanf("%d",&p[2]);
    printf("%d\n",p[0]*p[1]*p[2]);
  }
  
  if(n>2){
    for(i=2;i<=n;i++){
      scanf("%d",&tmp);
      scanf("%d",&p[i]);
    }
  
  
    for(i=0;i<=n;i++) m[i][i]=0;
    
    for(l=2;l<=n;l++){
      for(i=1;i<=n-l+1;i++){
	j=i+l-1;
	m[i][j]=2147483647;
	for(k=i;k<j;k++){
	  tmp=m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j];
	  if(tmp<m[i][j])m[i][j]=tmp;
	}
      }
    }
    
    printf("%d\n",m[1][j]);

  }

  return 0;

}


Measured memory_bytes: 2108
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main{
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
    public static void main(String[] args) throws IOException {
        FastReader in = new FastReader();
        Main main = new Main();
        //Scanner sc = new Scanner(System.in);
        int n = in.nextInt();
        int[] arr = new int[n];
        for(int i = 0 ; i < n ; i++ ){
            arr[i] = in.nextInt();
        }
        Arrays.sort(arr);
        BigInteger base = BigInteger.valueOf(2L) , expo = BigInteger.valueOf((long)n/2) , mod = BigInteger.valueOf(1000000007L);
        BigInteger ans = base.modPow(expo,mod);
        if(n%2==0){
            if(!main.evenCheck(arr)){
                System.out.print(0);
            }else {
                System.out.print(ans);
            }
        }else if(!main.oddCheck(arr)){
            System.out.print(0);
        } else {
            System.out.print(ans);
        }
     }
     private boolean evenCheck(int[] arr){
        for(int i = 0 ; i < arr.length ; i+=2 ){
            if(arr[i] != i+1 || arr[i+1] != i+1){
                return false;
            }
        }
        return true;
     }
    private boolean oddCheck(int[] arr){
        if(arr[0] != 0 ){
            return false;
        }
        for(int i = 1 ; i < arr.length ; i+=2 ){
            if(arr[i] != i+1 || arr[i+1] != i+1){
                return false;
            }
        }
        return true;
    }
}



Measured memory_bytes: 34328
import itertools
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

M = [[V[i], C[i]]for i in range(N)]
#print(M)


tx = 0
R = 0
for i in range(N):
    tx = V[i] - C[i]
    if (tx > 0):
        R += tx

print(R)

Measured memory_bytes: 3060
import sys
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value

N = ii()
A = sorted([ii() for _ in range(N)])
'''
if N > 2:
    ans += A[-1] * 2 - A[0] - A[1]
    l_ind = 2
    r_ind = N-2
    while True:
        if r_ind - 2 >= l_ind:
'''
if N==2:
    print(A[1]-A[0])
elif N%2:
    '''
    ans_1 = A[N-1]*2 - A[0] - A[1]
    ans_1 += sum(A[N//2:N-1])*2 - sum(A[:N//2])*2 - A[N//2] - A[N//2-1]
    ans_2 = A[N-1] + A[N-2] - A[0]*2
    ans_2 += sum(A[N//2+1:])*2 - sum(A[1:N//2+1])*2 - A[N//2] - A[N//2+1]
    print(ans_1, ans_2)
    '''
    ans_1 = A[N-1]*2 - A[0] - A[1]
    tmp = A[0] + A[1]
    l_ind = 1
    r_ind = N-1
    while True:
        r_ind -= 2
        if r_ind < l_ind:
            break
        ans_1 += A[r_ind] + A[r_ind+1] - tmp
        tmp = A[r_ind] + A[r_ind+1]
        l_ind += 2
        if l_ind > r_ind:
            break
        ans_1 += tmp - (A[l_ind] + A[l_ind-1])
        tmp = A[l_ind] + A[l_ind-1]
    #print(ans_1)

    ans_2 = A[N-1] + A[N-2] - A[0]*2
    tmp = A[N-1] + A[N-2]
    l_ind = 0
    r_ind = N-2
    while True:
        l_ind += 2
        if l_ind > r_ind:
            break
        ans_2 += tmp - (A[l_ind] + A[l_ind-1])
        tmp = A[l_ind] + A[l_ind-1]
        r_ind -= 2
        if r_ind < l_ind:
            break
        ans_2 += A[r_ind] + A[r_ind+1] - tmp
        tmp = A[r_ind] + A[r_ind+1]

    print(max(ans_1, ans_2))

else:
    ans_1 = A[N-1]*2 - A[0] - A[1]
    tmp = A[0] + A[1]
    l_ind = 1
    r_ind = N-1
    while True:
        r_ind -= 2
        if r_ind == l_ind:
            ans_1 += A[r_ind+1] - A[r_ind-1]
            break
        ans_1 += A[r_ind] + A[r_ind+1] - tmp
        tmp = A[r_ind] + A[r_ind+1]
        l_ind += 2
        if l_ind == r_ind:
            ans_1 += A[r_ind+1] - A[r_ind-1]
            break
        ans_1 += tmp - (A[l_ind] + A[l_ind-1])
        tmp = A[l_ind] + A[l_ind-1]

    ans_2 = A[N-1] + A[N-2] - A[0]*2
    tmp = A[N-1] + A[N-2]
    l_ind = 0
    r_ind = N-2
    while True:
        l_ind += 2
        if l_ind == r_ind:
            ans_2 += A[r_ind+1] - A[r_ind-1]
            break
        ans_2 += tmp - (A[l_ind] + A[l_ind-1])
        tmp = A[l_ind] + A[l_ind-1]
        r_ind -= 2
        if r_ind == l_ind:
            ans_2 += A[r_ind+1] - A[r_ind-1]
            break
        ans_2 += A[r_ind] + A[r_ind+1] - tmp
        tmp = A[r_ind] + A[r_ind+1]

    print(max(ans_1, ans_2))

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

using namespace std;

int main(){
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++)    cin>>arr[i];
    int prev=arr[0];
    int ans=0;
    int dp[n+1];
    dp[0]=0;
    dp[1]=abs(arr[1]-arr[0]);
    for(int i=2;i<=n;i++){
        dp[i]=min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));
    }
    cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=1e5+5,LGN=20;
ll n,L,a[N],nxt[N][LGN];
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cin>>n;
    for(ll i=0;i<n;i++)cin>>a[i];
    cin>>L;
    for(ll i=0;i<n;i++)nxt[i][0]=lower_bound(a+i,a+n,a[i]+L+1)-(a+1);
    for(ll j=1;j<LGN;j++){
        for(ll i=0;i<n;i++)nxt[i][j]=nxt[nxt[i][j-1]][j-1];
    }
    ll q;cin>>q;
    for(ll x,y,ans=0;q>0;q--,ans=0){
        cin>>x>>y;
        x--;y--;
        if(x>y)swap(x,y);
        for(ll i=LGN-1;i>=0;i--){
            if(nxt[x][i]<y)ans|=(1ll<<i),x=nxt[x][i];
        }
        cout<<ans+1<<"\n";
    }
}

Measured memory_bytes: 17280
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

int main() {
	string s;
	cin >> s;

	if (s[2] == s[3] && s[4] == s[5])
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
/*input

*/


//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
#include<bits/stdc++.h>
using namespace std;
#define ll          long long
#define pb          push_back
#define pii         pair<ll int,ll int>
#define vpii        vector< pii >
#define vi          vector<ll int>
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			(ll)1e18
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define repr(i,a,b) for(ll int i=a;i>b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int solve()
{
	string s;cin>>s;
	ll n=sz(s);
	rep(i,0,n) cout<<"x";
	return 0;
}

int main()
{
	auto start = chrono::high_resolution_clock::now();

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

	ll test_cases=1;
	//cin>>test_cases;
	while(test_cases--)
		solve();

	auto stop = chrono::high_resolution_clock::now();
	auto duration = chrono::duration_cast<chrono::milliseconds>(stop-start);
	//cout<<"\nduration: "<<(double)duration.count()<<" milliseconds";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}

const int MAX_N = 200100;
int par[MAX_N]; // 親
int rank_[MAX_N]; // 木の深さ
int cnt_[MAX_N]; // 属する頂点の個数(親のみ正しい)

// n要素で初期化
void UFinit(){
    for(int i=0;i<MAX_N;i++){
        par[i] = i;
        rank_[i] = 0;
        cnt_[i] = 1;
    }
}

// 木の根を求める
int find(int x){
    if(par[x] == x){
        return x;
    }else{
        return par[x] = find(par[x]);
    }
}

// xとyの属する集合を併合
void unite(int x, int y){
    x = find(x);
    y = find(y);
    if(x == y) return;

    if(rank_[x] < rank_[y]){
        par[x] = y;
        cnt_[y] += cnt_[x];
    }else{
        par[y] = x;
        cnt_[x] += cnt_[y];
        if(rank_[x] == rank_[y]) rank_[x]++;
    }
}

// xとyが同じ集合に属するか否か
bool same(int x, int y){
    return find(x) == find(y);
}


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

    int ans = n-1;

    rep(i,m){
        int a, b;
        cin >> a >> b;
        if(same(a,b));
        else{
            ans--;
            unite(a,b);
        }
    }

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



Measured memory_bytes: 5984
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <list>
using namespace std;

typedef long long ll;

#define MOD 1000000007
#define p(x) cout << x << endl;
#define el cout << endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

    int a, b;
    cin >> a >> b;

    if(a <= b){
        p(a);
    }else{
        p(a - 1);
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#include <fstream>
#include <functional>
#define endl '\n'
#define ll long long
#define mod 1000000007
#define NCONS 200001
//#define NCONS 100001
//#define NCONS 1001
//#define NCONS 101
#define MCONS 2001
#define LIMIT 1000000000
#define TRUE 1
#define FALSE 0
#define toRadian(degree) ((degree) * (M_PI / 180.))
#define toDegree(radian) ((radian) * (180. / M_PI))
using namespace std;
struct Point{int x; int y;};
struct PPoint{Point x; Point y;};
ll gcd(ll a, ll b) { if(a < b) swap(a, b); if(b <= 0) return a; return gcd(b, a % b); }

int main(void)
{
    cin.tie(NULL); ios_base::sync_with_stdio(false);
    string s; cin >> s;
    int o = 0, x = 0;
    
    for(int i = 0; i < s.size(); i++)
    {
        if(s[i] == 'o')
            o += 1;
        else
            x += 1;
    }
    
    o += 15 - (int)s.size();
    
    if(o >= 8)
        cout << "YES";
    else
        cout << "NO";
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <queue>
#include <sstream>
#include <unordered_map>
#include <cstring>
#include <iomanip>

using namespace std;

typedef long long ll;

const ll INF=1e9+7;

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

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

//a=97,z=122

int main(){
    string S;
    cin>>S;
    int last=S.length()-1,countC=0,Cnum;
    for(int i=2;i<last;i++){
        if(S[i]=='C')countC++,Cnum=i;
    }
    rep(i,last+1){
        if(i!=0&&i!=Cnum){
            if(int(S[i])<97){
                cout<<"WA"<<endl;
                return 0;
            }
        }
    }
    if(S[0]=='A'&&countC==1){
        cout<<"AC"<<endl;
    }else{
        cout<<"WA"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
def examA():
    N = DI()/dec(7)
    ans = N
    print(N)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    N, Q = LI()
    S = SI()
    SS = [0]*N
    SSS = [0]*N
    for i in range(N-1):
        if S[i]=="A" and S[i+1]=="C":
            SS[i] = 1
    for i in range(N-1):
        SSS[i+1] += SSS[i]+SS[i]
    ans = [0]*Q

    for q in range(Q):
        l,r = LI()
        l -= 1; r -= 1
        ans[q] = SSS[r] - SSS[l]

    for v in ans:
        print(v)
    return

def examD():
    ans = 0
    print(ans)
    return

from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examC()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

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

int main(){
  int N,max;
  cin>>N>>max;
  int m[N];
  int left=max;
  for(int i=0;i<N;i++){
      cin>>m[i];
      left -= m[i];
  }
    sort(m,m+N);
    int ans=N+left/m[0];
    cout<<ans;

    return 0;
}

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

int main() {
int x,t; cin>>x>>t;
  if(x<=t) cout<<0<<endl;
  else cout<<x-t<<endl;
}


Measured memory_bytes: 256
/*
ID: 123feli1
TASK: test
LANG: C++
*/
#include <bits/stdc++.h>
#include <fstream>
using namespace std;

int main(){
	long long X,K,D;
	cin>>X>>K>>D;
	X=abs(X);
	if(X/D>K){
		X=X-K*D;
	}else{
		K=K-X/D;
		X=X-(X/D)*D;
		if(K%2!=0){
			X=X-D;
		}
	}
	cout<<abs(X)<<'\n';
	
    return 0;
}



Measured memory_bytes: 3568
#include<bits/stdc++.h>
using namespace std;
const int N = 405, M = 1e9 + 7;
typedef long long ll;
ll pw[N][N],dp[N][N];
int A[N],B[N];
int main()
{
    for (int j = 1; j < N; ++j) {
        pw[j][0] = 1;
        for (int i = 1; i < N; ++i)
            pw[j][i] = pw[j][i-1] * j % M;
    }
    for (int j = 1; j < N; ++j)
        for (int i = 0; i < N; ++i)
            (pw[j][i] += pw[j-1][i]) %= M;
    int n,c;
    cin >> n >> c;
    for (int i = 1; i <= n; ++i)
        cin >> A[i];
    for (int i = 1; i <= n; ++i)
        cin >> B[i];
    dp[0][0] = 1;
    for (int i = 1; i <= n; ++i) {
        int a = A[i], b = B[i];
        for (int j = 0; j <= c; ++j) {
            for (int k = 0; k <= j; ++k)
                dp[i][j] += (pw[b][k] - pw[a-1][k]) * dp[i-1][j-k] % M;
            dp[i][j] %= M;
        }
    }
    cout << (dp[n][c]%M+M)%M << endl;
}


Measured memory_bytes: 2816
a, b, h, m = gets.chomp.split(" ").map(&:to_i)
sa = ((h+m/60.0)/12.0 - m/60.0).abs
sa = 1-sa if sa>=0.5
c2 = a**2+b**2-2*a*b*Math.cos(Math::PI*sa*2.0)
c = c2**0.5
p c

Measured memory_bytes: 14884
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
int mod = 1e9 + 7;
int INF = 2e18;

signed main() {
    double a, b, x;
    cin >> a >> b >> x;
    double temp = 2 * x / (a * b);
    if (temp > a) {
        x = a * a * b - x;
        temp = 2 * x / (a * a);
        double theta = atan(temp / a) * 180 / PI;
        cout << fixed << setprecision(10) << 90 - (90 - theta) << endl;
    } else {
        double theta = atan(temp / b) * 180 / PI;
        cout << fixed << setprecision(10) << 90 - theta << endl;
    }
 }

Measured memory_bytes: 256
import Data.Char
import Data.List
import Control.Applicative

solver :: String -> [String] -> Int
solver w t = length $ filter ( == w) (map (map toLower) t)

main :: IO()
main = do
  word <- getLine
  text <- concatMap words . lines <$> getContents
  print $ solver word (text \\ ["END_OF_TEXT"])

Measured memory_bytes: 3800
#include<bits/stdc++.h>
using namespace std;
main(){string s,t,u;cin>>s>>t;long a=0,i=0,x;for(u=s;a+1&&i<t.size();i++){x=u.find_first_of(t[i]);u.erase(u.begin(),u.begin()+x+1);if(u.size()<s.size())u+=s;a=x<0?-1:a+x+1;}cout<<a;}

Measured memory_bytes: 768
N,M = map(int,input().split())
H = list(map(int,input().split()))
ans = [1]*N

for i in range(M):
    a,b = map(int,input().split())
    if H[a-1] <= H[b-1]:
        ans[a-1] -= ans[a-1]
    if H[a-1] >= H[b-1]:
        ans[b-1] -= ans[b-1]

print(sum(ans))

Measured memory_bytes: 19960
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define L 100010
#define LL long long
using namespace std;

inline int gi() {
  char cj = getchar();
  int ans = 0, f = 1;
  while (cj < '0' || cj > '9') { if (cj == '-') f = -1; cj = getchar();}
  while (cj >= '0' && cj <= '9') ans = ans * 10 + cj - '0', cj = getchar();
  return f * ans;
}

int n, a, s4, s2;

int main() {
  //freopen("4-adjacent.in", "r", stdin);
  //freopen("4-adjacent.out", "w", stdout);
  n = gi();
  for (int i = 1; i <= n; ++i) {
    a = gi();
    if (a % 4 == 0) s4++;
    else if (a % 2 == 0) s2++;
  }
  //cout << n << " " << s4 << " " << s2 << endl;
  if (s2 >= 2) n -= (s2 - 1);
  n -= (s4 + s4 + 1);
  if (n <= 0) puts("Yes");
  else puts("No");
  return 0;
}


Measured memory_bytes: 256
using System;

class Program
{
	static void Main(string[] args)
	{
		int k = int.Parse(Console.ReadLine());
		string[] strInput = Console.ReadLine().Split(' ');
		int[] intInput = Array.ConvertAll(strInput, int.Parse);

		int a, b;
		a = intInput[0];
		b = intInput[1];


		for (int i = a; i <= b; i++)
		{
			if (i%k == 0)
			{
				Console.WriteLine("OK");
				return;
			}
		}

		//出力
		Console.WriteLine("NG");
		return;
	}
}

Measured memory_bytes: 27556
N = int(input())
ans = [0]*10050
for i in range(1,105):
  for j in range(1,105):
    for k in range(1,105):
      v = i**2 + j**2 + k**2 + i*j + j*k + k*i
      if v < 10050:
        ans[v] += 1
for i in range(N):
  print(ans[i+1])

Measured memory_bytes: 9244
Scanf.scanf "%s %d" (fun s k ->
    let n = String.length s in
    let check p s =
        let rec loop i p acc =
            if i = n then acc, p else
                if s.[i] = p then loop (i + 1) '@' (acc + 1) else
                                  loop (i + 1) s.[i] acc
        in
        loop 0 p 0
    in
    let a1, p = check '@' s in
    let a2, p = check p   s in
    let a3, _ = check p   s in
    let k2 = (k - 1) / 2 in
    let k1 = (k - 1) - k2 in
    Printf.printf "%d\n" @@ a1 + a2 * k1 + a3 * k2
)

Measured memory_bytes: 2432
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
using ll=long long;
const int MAXN=100010;


vector<int> pos[30];
int main() {
    ios::sync_with_stdio(false);
    int res=0;

    string s,t;
    cin>>s>>t;
    for(int i=0;i<s.size();i++){
        pos[s[i]-'a'].push_back(i);
    }
    ll rev=0;
    int lastpos=-1;
    bool ok=1;
    for(int i=0;i<t.size();i++){
        auto it=lower_bound(pos[t[i]-'a'].begin(),pos[t[i]-'a'].end(),lastpos);
        if(it!=pos[t[i]-'a'].end()){
            lastpos=*it+1;
        }else{
            if(pos[t[i]-'a'].size()==0){
                ok=0;
                break;
            }
            rev++;
            lastpos=-1;
            i--;
        }
    }
    if(ok) {
        cout << (ll)rev * s.size() + (ll)lastpos << endl;
    }else{
        cout<<-1<<endl;
    }



    return 0;
}

Measured memory_bytes: 1148
#include<cstdio>

int main() {
  //入力
  int a,b,c;
  std::scanf("%d%d%d",&a,&b,&c);
  
  if(a < b && b < c) {
    std::printf("Yes");
  }
  else {
    std::printf("No");
  }
  std::printf("\n");
  
  return 0;
}



Measured memory_bytes: 2696
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
set<vector<int> > s;
vector<int> cal(vector<int> a){
	vector<int> b;
	b.pb((a[0]+a[1])/2);
	b.pb((a[0]+a[2])/2);
	b.pb((a[2]+a[1])/2);
	sort(All(b));
	return b;
}
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	vector<int> v;
	v.pb(a);v.pb(b);v.pb(c);sort(All(v));s.insert(v);
	for(int i=0;;i++){
		if(v[0]%2>0 || v[1]%2>0 || v[2]%2>0){
			cout<<i<<endl;return 0;
		}
		v=cal(v);
		if(s.find(v)!=s.end()){
			cout<<-1<<endl;return 0;
		}
		s.insert(v);
	}
}


Measured memory_bytes: 256
#pragma region template 1.0
#pragma region def
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> ii;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define OUT(x) cout << (x) << endl;
#define OUTA(a) \
    REP(i, (a).size()) { cout << (a[i]) << (i == (a).size() - 1 ? "\n" : " "); }
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion enddef

int main()
{
    ll N, M;
    cin >> N >> M;
    vi A(N);
    REP(i, N) { cin >> A[i]; }

    RSORT(A);
    ll s = 0;
    REP(i, N)
    {
        s += A[i];
    }
    if (A[M - 1] * 4 * M >= s)
    {
        OUT("Yes");
    }
    else
    {
        OUT("No");
    }
}
#pragma endregion template

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

int main(void){
  int a, b;
  cin >> a >> b;
  if(a==1||a==3||a==5||a==7||a==8||a==10||a==12){
    if(b==3||b==5||b==7||b==8||b==10||b==12){
      cout << "Yes\n";
    }else cout << "No\n";
  }else if(a==4||a==6||a==9||a==11){
    if(b==6||b==9||b==11) cout << "Yes\n";
    else cout << "No\n";
  }else cout << "No\n";
}

Measured memory_bytes: 764
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public final class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final int n = Integer.parseInt(in.nextLine());
        if (n % 2 == 0) {
            System.out.println(n);
        } else {
            System.out.println(2 * n);
        }
    }
}


Measured memory_bytes: 35808
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var N = Sarray()[0];
            var Ai = Sarray();
            WriteLine(Ai.Max() - Ai.Min());
        }
 
        static long Mod = 998244353;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

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

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            // Console.WriteLine("Hello World!");
            var nm = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var LR = new List<int[]>();


            for (int i = 0; i < nm[1]; i++)
            {
                LR.Add(Console.ReadLine().Split().Select(int.Parse).ToArray());
            }

            int left = LR[0][0], right = LR[0][1];


            for (int i = 1; i < nm[1]; i++)
            {
                if (LR[i][0] > left)
                {
                    left = LR[i][0];
                }
                if (LR[i][1] < right)
                {
                    right = LR[i][1];
                }
            }

            if (right >= left)
            {
                Console.WriteLine(right - left + 1);
            }
            else
            {
                Console.WriteLine(0);
            }




        }


    }
}



Measured memory_bytes: 24892
require 'pp'

def gets; ARGF.gets; end

class Solver

  def initialize
  end

  def main
    n = gets.chomp.to_i
    s = gets.chomp

    if n.odd?
      puts "No"
      return
    end

    l = s[0, n/2]
    r = s[n/2..-1]

    # puts l
    # puts r

    if l == r
      puts "Yes"
    else
      puts "No"
    end
  end
end

if __FILE__ == $0
  Solver.new.main
end


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

int main(){
  int k, a, b;
  cin >> k;
  cin >> a >> b;
  if (a % k == 0){
    cout<<"OK"<<endl;
  }else if(b % k == 0){
    cout<<"OK"<<endl;
  }else{
    if (b-a >= k){
      cout<<"OK"<<endl;
    }else{
      int amari = a%k;
      int nokori = k-amari;
      if (a+nokori<=b){
       cout<<"OK"<<endl;
      }else{
       cout<<"NG"<<endl;
      }
      
    }
  }
return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); 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 FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define PRINTALL(V)                                                            \
  for (auto v : (V)) {                                                         \
    cout << v << " ";                                                          \
  }                                                                            \
  cout << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
using namespace std;
template < class T > bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template < class T > bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template < class T > using vec = std::vector< T >;
template < class T > void print(const T &x) { cout << x << "\n"; }
const int MOD = 1000000007, INF = 1061109567;
const double EPS = 1e-10, PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int N;
  cin >> N;
  vec< int > x(N);
  REP(i, N) { cin >> x[i]; }
  vec< int > y(x);
  sort(ALL(x));
  // 0123 4567
  int mid0 = x[N / 2 - 1];
  int mid1 = x[N / 2];
  REP(i, N) {
    if (y[i] <= mid0) {
      cout << mid1 << "\n";
    } else {
      cout << mid0 << "\n";
    }
  }
}

Measured memory_bytes: 5376
n = int(input())

if n % 10 == 2 or n % 10 == 4 or n % 10 == 5 or n % 10 == 7 or n % 10 == 9:
    print('hon')
elif n % 10 == 0 or n % 10 == 1 or n % 10 == 6 or n % 10 == 8:
    print('pon')
else:
    print('bon')

Measured memory_bytes: 9176
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;
typedef complex<double> xy_t;
const lint mod = 1e9 + 7;

int main(){
    int n;
    scanf("%d", &n);
    lint a[n];
    rep(i, n) scanf("%lld", &a[i]);
    lint dp[n+1][5];
    rep(i, n+1)rep(j, 5) dp[i][j] = 1e9;
    dp[0][0] = 0;
    rep(i, n)rep(j, 5)if(dp[i][j] < 1e9){
        For(k, j, 5){
            lint tmp = 0;
            if(k == 0 || k == 4) tmp = a[i];
            if((k == 1 || k == 3) && a[i] % 2 == 1) tmp = 1;
            if((k == 1 || k == 3) && a[i] == 0) tmp = 2;
            if(k == 2 && a[i] % 2 == 0) tmp = 1;
            dp[i+1][k] = min(dp[i+1][k], dp[i][j] + tmp);
        }
    }
    lint ans = 1e9;
    rep(i, 5) ans = min(ans, dp[n][i]);
    printf("%lld\n", ans);
}

Measured memory_bytes: 9600
#include <iostream>

using namespace std;

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
int mypower(int a, int b)
{
    int ans = 1;
    while(b)
    {
        if(b%2)
            ans = ans*a%mod;
        b=b/2;
        a=a*a%mod;
    }
    return ans;
}
signed main() {
    int n;
    cin >> n;
    int a = mypower(10, n);
    int b = mypower(9, n)*2%mod;
    int c = mypower(8, n);
    a = (a - b + c)%mod;
    a = (a+mod)%mod;
    cout << a;
}

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

int main(){
    ll n; cin>>n;
    vector<ll> a(n);
    map<ll,ll> mp;
    ll ans = 0;
    rep(i,n){
        cin>>a[i];
        ans += mp[i - a[i]];
        mp[i + a[i]]++;
    }
    cout << ans << endl;
    return 0;
}

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

N = int(input())
S = [input() for _ in range(N)]
MARCHcnt = [0]*5
ans = 0

for i in S:
    if i[0] == 'M':
        MARCHcnt[0] += 1
    elif i[0] == 'A':
        MARCHcnt[1] += 1
    elif i[0] == 'R':
        MARCHcnt[2] += 1
    elif i[0] == 'C':
        MARCHcnt[3] += 1
    elif i[0] == 'H':
        MARCHcnt[4] += 1

for i in range(3):
    for j in range(i+1, 4):
        for k in range(j+1, 5):
            ans += MARCHcnt[i]*MARCHcnt[j]*MARCHcnt[k]

print(ans)

Measured memory_bytes: 9900
import sys
from sys import exit
from collections import deque
from copy import deepcopy
from bisect import bisect_left, bisect_right, insort_left, insort_right
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod=MOD):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
    def list(self):
        l = []
        for k in self:
            l.extend([k]*self[k])
        return l
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        if k<0 or n<k:
            return 0
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]
def pf(x,mode='counter'):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    if mode=='counter':
        return C
    S = set([1])
    for k in C:
        T = deepcopy(S)
        for x in T:
            for i in range(1,C[k]+1):
                S.add(x*(k**i))
    if mode=='set':
        return S
    if mode=='list':
        return sorted(list(S))

######################################################

N,K=mint()
C1=comb(K-1,MOD)
C2=comb(N-K+1,MOD)
for i in range(1,K+1):
    print((C1.get(i-1)*C2.get(i))%MOD)

Measured memory_bytes: 74508
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   main.cpp                                           :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: monoue <marvin@student.42.fr>              +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/22 12:30:15 by monoue            #+#    #+#             */
/*   Updated: 2020/04/24 14:20:03 by monoue           ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include <bits/stdc++.h>

/* #include <boost/multi_array.hpp> */
/* #include <boost/optional.hpp> */
/* #include <boost/range/irange.hpp> */
/* #include <boost/range/algorithm.hpp> */
/* #include <boost/range/adaptors.hpp> */
/* #include <boost/multiprecision/cpp_int.hpp> */
/* #include <boost/algorithm/string/classification.hpp> // is_any_of */
/* #include <boost/algorithm/string/split.hpp> */
/* #include <boost/algorithm/string/join.hpp> */
/* #include <boost/algorithm/string/replace.hpp> */
/* #include <boost/math/tools/minima.hpp> */
/* namespace adaptor = boost::adaptors; */
/* using boost::math::tools::brent_find_minima; */
/* using boost::irange; */
/* using boost::algorithm::join; */
/* using boost::algorithm::split; */
/* using boost::algorithm::replace_all; */
/* using boost::multiprecision::cpp_int; */

#define MOD 1e9+7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = (n); i >= 0; --i)

using namespace std;
using ll = long long;
using P = pair<int, int>;

// TOP
void	Main()
{
	ll	n, a, b, c, d;
	string	s;
	cin >> n >> a >> b >> c >> d >> s;

	for (int i = a - 1; i < max(c, d) - 2; i++)
	{
		if (s.substr(i, 2) == "##")
		{
			cout << "No" << endl;
			return ;
		}
	}
	if (d < c)
	{
		bool	flag;
		flag = false;
		for (int i = b - 2; i < d - 1; i++)
		{
			if (s.substr(i, 3) == "...")
			{
				flag = true;
				break ;
			}
		}
		if (flag == false)
		{
			cout << "No" << endl;
			return ;
		}
	}
	cout << "Yes" << endl;
}
// END

int		main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k;
	cin>>n>>k;
	long long mul=1;
	vector<int> a(n);
	for(int i=0;i<n;i++)
	{cin>>a[i];}
	int j=0;
	for(int i=k;i<n;i++)
	{
	if(a[i]>a[j])
	cout<<"Yes"<<"\n";
	else
	cout<<"No"<<"\n";
	j++;
	}
	return 0;
}

Measured memory_bytes: 4028
n=int(input())
word=[]
flag=0

for i in range(n):
  word.append(list(input()))
  
for i in range(n-1):
  if word[i][-1]!=word[i+1][0]:
    flag+=1
  word[i]=''.join(word[i])
word[-1]=''.join(word[-1])

for i in range(n):
  count=0
  for k in range(n):
    if word[i]==word[k]:
      count+=1
  if count>=2:
    flag+=1
    
if flag==0:
  print('Yes')
else:
  print('No')  

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

int main()
{
    int n; cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i]; a[i] -= (i + 1);
    }
    sort(a.begin(), a.end());
    ll b = (n % 2 ? a[n/2] : (a[n/2 - 1] + a[n/2]) / 2);

    ll ans = 0;
    for (int i = 0; i < n; i++) {
        ans += abs(a[i] - b);
    }
    cout << ans << endl;
    return 0;
}

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


class Main {
    static final long I=1L<<50;
    static long f(long b,long n){
        long s=0;
        while(n>0){
            s+=n%b;
            n/=b;
        }
        return s;
    }
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        long n=sc.nextLong();
        long s=sc.nextLong();
        // hitoketa
        if(n==s){
            out.println(n+1);
            out.close();
            return;
        }
        if(n<s){
            out.println(-1);
            out.close();
            return;
        }
        long min=I;
        for(long b=1;b*b<=n-s;++b){
            if((n-s)%b!=0)continue;
            if(f(b+1,n)==s)
                min=Math.min((long)b+1,min);
            if(f((n-s)/b+1,n)==s)
                min=Math.min(min,(n-s)/b+1);
        }
        if(min==I){
            out.println(-1);
            out.close();
            return;
        }
        out.println(min);
        out.close();
    }
    // http://codeforces.com/blog/entry/7018
    //-----------PrintWriter for faster output---------------------------------
    public static PrintWriter out;
    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;
        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 23380
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *

N = INT()
dp = [0]*(N+1)
dp[1] = 1

for i in range(2, N+1):
	L = [6**x for x in range(int(log2(i)/log2(6))+1)] + [9**x for x in range(1, int(log2(i)/log2(9))+1)]
	dp[i] = min([dp[i-y] for y in L]) + 1

print(dp[N])


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

bool has_key(unordered_map<string, ll> &m, string s){
    if (m.find(s) == m.end()){
        return false;
    }
    else{
        return true;
    }
}


bool vector_find(std::vector<ll> vec, ll number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) {
    return true;
  }
  else {
    return false;
  }
}


void recursive_comb(int *indexes, int s, int rest, std::function<void(int *)> f) {
  if (rest == 0) {
    f(indexes);
  } else {
    if (s < 0) return;
    recursive_comb(indexes, s - 1, rest, f);
    indexes[rest - 1] = s;
    recursive_comb(indexes, s - 1, rest - 1, f);
  }
}


void foreach_comb(int n, int k, std::function<void(int *)> f) {
  int indexes[k];
  recursive_comb(indexes, n - 1, k, f);
}

ll N, M, X;
ll vec_index;
vector<ll> C;
vector<ll> D;
vector<vector<ll>> A;


int main() {
    
    cin >> N >> M >> X;

    vector<ll> C_(N);
    vector<vector<ll>> A_(N, vector<ll>(M));


    for (ll i = 0; i < N; i++) {
        cin >> C_.at(i);
        for (ll j = 0; j < M; j++) {
            cin >> A_.at(i).at(j);
        }
    }

    C = C_;
    A = A_;


    ll ans = 0;

    // for (ll i = 1; i <= N; i++) {
    //     foreach_comb(N, i, [](int *indexes) {
    //         std::cout << indexes[0] << ',' << indexes[1] << ',' << indexes[2] << std::endl;
    //     });
    // }
    
    

    for (ll i = 1; i <= N; i++) {
        
        vec_index = i;

        foreach_comb(N, i, [](int *indexes) {
            vector<ll> vec(M,0);
            ll money = 0;

            for (ll j = 0; j < vec_index; j++) {
                // cout << indexes[j] << " ";

                for (ll k = 0; k < M; k++) {
                    vec.at(k) += A.at(indexes[j]).at(k);
                }
                money += C.at(indexes[j]);
                
            }
            // cout << endl;

            bool is_ok = true;

            for (ll j = 0; j < M; j++) {
                if (vec.at(j) < X) {
                    is_ok = false;
                }
            }

            if (is_ok) {
                // cout << "push: " << money << endl;
                D.push_back(money);
            }
            
        });
    }
    sort(D.begin(), D.end());

    if (D.size() > 0) {
        cout << D.at(0) << endl;
    } else {
        cout << -1 << endl;
    }
    
    


    return 0;
}

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

int main(){
  std::vector<int> v(4,0);
  int org[]={1,4,7,9};
  std::vector<int> ans(org,org+4);
  for(int i = 0; i < 4; i++) std::cin >> v[i];
  std::sort(v.begin(),v.end());
  if (v==ans) {
    std::cout << "YES" << std::endl;
  }else{
    std::cout << "NO" << std::endl;
  }
  return 0;
}


Measured memory_bytes: 256