akhauriyash/Code-Regression huggingface dataset:
fun main(args: Array<String>) {
    var (X,Y,A,B,C) = readLine()!!.split(" ").map { it.toInt() }
    var p = readLine()!!.split(" ").map { it.toLong() }.sortedDescending().toLongArray()
    var q = readLine()!!.split(" ").map { it.toLong() }.sortedDescending().toLongArray()
    var r = readLine()!!.split(" ").map { it.toLong() }.sortedDescending()
    var pc = X-1
    var qc = Y-1
    for(i in 0 until C){
        if (pc<0 && qc<0)break

        val pa = if(pc>=0)p[pc] else Long.MAX_VALUE
        val qa = if(qc>=0)q[qc] else Long.MAX_VALUE
        if(r[i]>pa || r[i]>qa ){
            if(pa < qa) {
                p[pc] = r[i]
                pc-=1
            }else{
                q[qc] = r[i]
                qc-=1
            }
        }
    }
    var result = 0.toLong()
    for(i in 0 until X){result+=p[i]}
    for(i in 0 until Y){result+=q[i]}
    print(result)
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);


using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using mint = map<int, int>;

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

const char sp = ' ';
const char cmm = ',';
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;

ll mod(ll a, ll b){
    return (a%b+b)%b;
}
ll gcd(ll a, ll b){
    return b ? gcd(b, a%b) : a;
}
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}
void Yes(){
    cout << "Yes" << endl;
}
void No(){
    cout << "No" << endl;
}
void Judge(bool b){
    b ? Yes() : No();
}
void YES(){
    cout << "YES" << endl;
}
void NO(){
    cout << "NO" << endl;
}
void JUDGE(bool b){
    b ? YES() : NO();
}
ll powmod(ll b, ll e){
    ll r = 1; while(e > 0) {if(e&1) r = (r%MOD)*(b%MOD)%MOD; b = (b%MOD)*(b%MOD)%MOD; e >>= 1;} return r;
}
double distance(ll x1, ll y1, ll x2, ll y2){
    return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
}

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(b < a) { a = b; return 1; } return 0;
}
template<typename T>
void ppp(T n){
    cout << n << endl;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {
    return s << "(" << p.first << ", " << p.second << ")";
}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    s << '[';
    for(int i = 0; i < len; ++i) {
        s << v[i]; if(i < len-1) s << ", ";
    }
    s << ']';
    return s;
}

struct aaa {
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); 
        cout<<fixed<<setprecision(15);
    }
} fastio;

int main(){

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    vector<int> s(n+2), t(n+2);
    partial_sum(a.begin(), a.end(), s.begin()+1,
                [](int x, int y){return max(x, y);});
    partial_sum(a.rbegin(), a.rend(), t.rbegin()+1,
                [](int x, int y){return max(x, y);});
    rep(i, n) ppp(max(s[i], t[i+2]));
    return 0;
}


Measured memory_bytes: 3968
N, L = (int(x) for x in input().split())
taste = [0] * N
FLAG = False

for i in range(N):
    taste[i] = L + i
    if taste[i]==0:
        FLAG = True

if FLAG==True:
    print(sum(taste))
if FLAG==False:
    if sum(taste)>0:
        print(sum(taste)-min(taste))
    if sum(taste)<0:
        print(sum(taste)-max(taste))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
typedef long long int lint;
using namespace std;

//素集合データ構造
// ref:https://ei1333.github.io/luzhiled/snippets/structure/union-find.html
struct union_find {
    // parent[v]==w(>=0):vの親はw
    // parent[v]==k(<0):vは根&&vの属するグループの要素数は-k
    vector<long long int> parent;
    //コンストラクタ
    union_find(long long int n) {
        parent.assign(n, -1);
    }
    // vの根を求める
    //求めると同時に親を根に置き換える(木の圧縮)
    long long int root(long long int v) {
        if (parent[v] < 0) {
            return v;
        } else {
            parent[v] = root(parent[v]);
            return parent[v];
        }
    }
    // vが属するグループの要素数を求める
    long long int size(long long int v) {
        return -parent[root(v)];
    }
    // vとwを繋げる
    void unite(long long int v, long long int w) {
        v = root(v);
        w = root(w);
        if (v == w) return;
        if (parent[v] < parent[w]) swap(v, w);
        parent[w] += parent[v];
        parent[v] = w;
    }
    // vとwが同値か判定
    bool isSame(long long int v, long long int w) {
        return root(v) == root(w);
    }
};

int main() {
    int n;
    cin >> n;
    union_find uf(n + 1);
    if (n % 2 == 0) {
        for (int i = 0; i < n / 2; i++) {
            uf.unite(i + 1, n - i);
        }
    } else {
        for (int i = 0; i < n / 2; i++) {
            uf.unite(i + 1, n - 1 - i);
        }
    }
    vector<pair<int, int>> ans;
    for (int i = 1; i <= n - 1; i++) {
        for (int j = i; j <= n; j++) {
            if (!uf.isSame(i, j)) {
                ans.push_back(make_pair(i, j));
            }
        }
    }
    cout << ans.size() << endl;
    for (int i = 0; i < ans.size(); i++) {
        cout << ans[i].first << " " << ans[i].second << endl;
    }
}

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

using namespace std;

int main()
{
char c1,c2,c3,c4,c5,c6;
cin >> c1 >> c2 >> c3 >> c4 >> c5 >> c6;
if(c1 == c6 && c2 == c5 && c3 == c4){
  cout << "YES" << endl;
}else{
  cout << "NO" << endl;
}
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!
import numpy as np
import math

A,B,H,M=map(int,input().split())

time=(60*H+M)
a=360/720*time
b=360/60*M
c=math.radians(b-a)


print((A**2+B**2-2*A*B*np.cos(c))**0.5)


Measured memory_bytes: 27120
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i <(n); i++)
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using p = pair<int,int>;

int main(){
  int n;
  cin >> n;
  bool flag = 1;
  vector<int>a(n);
  
  rep(i,n) {
    cin >> a[i];
    if(a[i] == 1)flag = 0;
  }
  if(flag){
    cout << "-1" << endl;
    return 0;
  }
  
  int count = 0;
  int t = 1;
  rep(i,n){
    if(a[i] == t)t++;
    else count++;
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 1024
import math
import itertools

INF = 10**9+7
n = 0
def main():
	ans = INF
	n = int(input())
	for i in range(1,int(math.sqrt(n)) + 1):
		if(n%i==0):
			m = int(n/i)
			d = div(m)
			if(ans > d):
				ans = d

	print(ans)

def div(n):
	ans = 1
	while n >= 10:
		ans+=1
		n/=10
	return ans

main()


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int w = in.nextInt();
		Obj[] object = new Obj[n+1];
		for (int i = 1; i < object.length; i++) {
			object[i] = new Obj(in.nextInt(), in.nextInt());
		}
		int[][] value = new int[n+1][w+1];

		// 初期設定
		for (int i = 0; i < w+1; i++) {
			if (i < object[1].weight) {
				continue;
			}
			value[1][i] = value[1][i-object[1].weight] + object[1].value;
		}

		// DP
		for (int i = 2; i < n+1; i++) {
			for (int j = 0; j < w+1; j++) {
				if (j < object[i].weight) {
					value[i][j] = value[i-1][j];
					continue;
				}
				int a = value[i-1][j];
				int b = value[i][j-object[i].weight] + object[i].value;
				value[i][j] = Math.max(a, b);
			}
		}

		System.out.println(value[n][w]);


	}
	static class Obj {
		int value;
		int weight;

		public Obj(int v, int w) {
			value = v;
			weight = w;
		}
	}

}



Measured memory_bytes: 31020
#include <iostream>

using namespace std;

const int maxN = 1e5 + 5, INF = 2e9 + 5;

int dp[maxN][3] = {0}, a[maxN][3];

int rc(int in, int tp) {
    if(dp[in][tp] != 0) return dp[in][tp];
    if(in == 0) {
        return dp[0][tp] = a[0][tp];
    }
    return dp[in][tp] = max(rc(in - 1, (tp + 1) % 3), rc(in - 1, (tp + 2) % 3)) + a[in][tp];
}

int main()
{
    int n;
    cin >> n;
    for(int i = 0; i < n; i++) cin >> a[i][0] >> a[i][1] >> a[i][2];
    //for(int i = 0; i < n; i++) cout << dp[i][0] << ' ' << dp[i][1] << ' ' << dp[i][2] << endl;
    cout << max(rc(n - 1, 0), max(rc(n - 1, 1), rc(n - 1, 2)));
    //for(int i = 0; i < n; i++) cout << dp[i][0] << ' ' << dp[i][1] << ' ' << dp[i][2] << endl;
    return 0;
}


Measured memory_bytes: 10660
N=int(input())
A=list(map(int,input().split()))

Aodd=[]
Aeven=[]
sumodd=0
sumeven=0
for i in range(N):
    if i%2==0:
        Aeven.append(A[i])
        if A[i]<0:
            sumeven+=1
    else:
        Aodd.append(A[i])
        if A[i]<0:
            sumodd+=1
if sumeven%2==sumodd%2:
    ans=sum(map(abs,A))
else:
    ans=sum(map(abs,A))-min(map(abs,A))*2
print(ans)


Measured memory_bytes: 64752
//a
#include <stdio.h>
 
int main() {
	int n, k;
	scanf ("%d %d", &n, &k);
	int a[n];	
	
	for (int i = 0; i < n; i++) 
	{
		scanf("%d", &a[i]);
	}
	
	for (int i = k; i < n; i++) 
	{
		if ( a[i] > a[i - k]) 
		{
		    printf("Yes\n");
		} 
		else 
		{
			printf("No\n");
		}
	}
	
	return 0;
}

Measured memory_bytes: 2400
#![allow(non_snake_case, unused_imports)]

// Input
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} };}
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,BTreeMap,VecDeque};

// Functions

// Main
fn main(){
    input!{
        a: u64,
        b: u64,
        c: u64,
    }
    let abc = [a,b,c];
    println!("{}", 
        if abc.iter().filter(|&&x| x==5).count() == 2 &&
           abc.iter().filter(|&&x| x==7).count() == 1 {"YES"}else{"NO"});
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "
int main(){
    int n,x,y;cin>>n>>x>>y;
    vector<int> ans(n);
    for(int i=1;i<=n-1;i++){
        for(int j=i+1;j<=n;j++){
            int k = min(abs(i-j), min(1+abs(x-i)+abs(y-j), 1+abs(y-i)+abs(x-j)));
            ans[k]++;
        }
    }
    for(int i=1;i<=n-1;i++){
        co(ans[i]);
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
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 (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
int main()
{
    int X;
    cin>>X;
    if(X==3 or X==5 or X==7)
    cout<<"YES";
    else
    cout<<"NO";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int num[3];
    cin>>num[0]>>num[1]>>num[2];
    sort(num,num+3);
    cout<<num[0]<<' '<<num[1]<<' '<<num[2]<<endl;
    return 0;
}


Measured memory_bytes: 3156
count = 0
lists_list = list()

while True:
    lists = list(map(int, input().split()))
    if lists[0] == 0 and lists[1] == 0:
        break
    lists.sort()
    lists_list.append(lists)
    count += 1

for i in range(0, count):
    print(f"{lists_list[i][0]} {lists_list[i][1]}")



Measured memory_bytes: 5996
N = int(input())
b = [int(i) for i in input().split()]
a = [0 for i in range(N)]
number = []
for j in range(N):
    for i in range(len(b)-1,-1,-1):
        if(i+1==b[i] and a[i]==0):
            del a[i]
            number.append(b[i])
            del b[i]
            break
if(not a):
    for i in range(N):
        print(number.pop())
if(a):
    print(-1)

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

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n, m, i, j;
	int prev = -1;
	
	cin>>n>>m;
	
	for (i = 0; i < n; ++i)
	{
		string s;
		cin>>s;
		
		int beg = s.find('#'), fin = s.rfind('#');
		
		if (i && beg != prev)
		{
			cout<<"Impossible\n";
			return 0;
		}
		
		for (j = beg; j <= fin; ++j) if (s[j] != '#')
		{
			cout<<"Impossible\n";
			return 0;
		}
		
		prev = fin;
	}
	cout<<"Possible\n";
}


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

int main() {
  int N;
  cin >> N;
  vector<pair<int, int>> V(N);
  for (int i = 0, x, l; cin >> x >> l; i++) {
    V.at(i) = {x - l, x + l};
  }
  sort(V.begin(), V.end());
  reverse(V.begin(), V.end());
  pair<int, int> now = V.at(0);
  int rem = 0;
  for (int i = 1; i < N; i++) {
    if (V.at(i).second <= now.first) now = V.at(i);
    else {
      if (V.at(i).first > now.first) now = V.at(i);
      rem++;
    }
  }
  cout << N - rem << "\n";
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<63)-1
#define MAX 1000000000
signed main(){
    int N,K,C; cin>>N>>K>>C;
    string S; cin>>S;
    vi cp(N+1),dp(N+1);
    REP(i,1,N){
        cp[i]=cp[i-1];
        if(S[i-1]=='o') cp[i]=max(cp[i],cp[max(0ll,i-C-1)]+1);
    }
    REP(i,1,N){
        int j=N-i;
        dp[j]=dp[j+1];
        if(S[j]=='o') dp[j]=max(dp[j],dp[min(N,j+C+1)]+1);
    }
    vii A(K+1);
    rep(i,0,N){
        if(S[i]=='o'){
            //cout<<cp[i+1]<<" "<<dp[i]<<endl;
            if(cp[i+1]+dp[i]==K+1) A[cp[i+1]].pb(i+1);
        }
    }
    REP(i,1,K){
        if(A[i].size()==1) cout<<A[i][0]<<endl;
    }
}

Measured memory_bytes: 15748
#include <stdio.h>
#include <stdlib.h>
#define NIL NULL

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;

Node root;

Node find(Node u,int k){
    while(u != NIL && k != u->key){
        if(k < u->key)u = u->left;
        else u = u->right;
    }
    return u;
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!= NIL){
      y=x;
      if(z->key < x->key){
          x=x->left;
      }else{
          x=x->right;
      }
  }
  z->parent=y;

  if(y == NIL){
      root=z;
  }else if(z->key < y->key){
      y->left = z;
  }else{
      y->right = z;
  }
}

void inorder(Node u){
    if(u == NIL) return;

    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);

}
void preorder(Node u){
if(u == NIL) return;
printf(" %d",u->key);
preorder(u->left);
preorder(u->right);
}

int main(){
    int i,n,x;
    char com[20];
    Node t;

    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s",com);
        if(com[0]=='f'){
            scanf("%d",&x);
            t=find(root,x);
            if(t != NIL)printf("yes\n");
            else printf("no\n");
        }else if(com[0]=='i'){
            scanf("%d",&x);
            insert(x);
        }else if(com[0] == 'p'){
        inorder(root);
        printf("\n");
        preorder(root);
        printf("\n");
        }
    }
    return 0;
}



Measured memory_bytes: 20612
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <math.h>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	vector<ll> a(n),b(n+1);
	ll sum=0;
	ll k=0;
	for(int i=0;i<n;i++){
		cin >> a[i];
		b[i+1]=a[i]+b[i];
	}
	ll mi=1e15;
	for(int i=0;i<n;i++){
		mi=min(mi,abs(2*b[i+1]-b[n]));
	}
	cout << mi << endl;
}

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

using namespace std;
#define ll long long
int num[105];
const int N=2;
const ll mod=1e9+7;
ll tmp[N][N];
ll yuan[N][N];
ll one[N][N];
void multi(ll a[][N],ll b[][N],ll n)
{
    memset(tmp,0,sizeof(tmp));
    for(int i=0; i<n; i++)
        for(int j=0; j<n; j++)
            for(int k=0; k<n; k++)
                tmp[i][j]=(tmp[i][j]+a[i][k]*b[k][j])%mod;
    for(int i=0; i<n; i++)
        for(int j=0; j<n; j++)
            a[i][j]=tmp[i][j];
}
ll res[N][N];
void Pow(ll a[][N],ll n)
{
    memset(res,0,sizeof(res));
    for(int i=0; i<N; i++)
        res[i][i]=1;
    while(n)
    {
        if(n&1)
            multi(res,a,N);
        multi(a,a,N);
        n>>=1;
    }
}
ll ppow(ll k,ll n)
{
    ll ss=1;
    while(n)
    {
        if(n&1)
            ss=(ss*k)%mod;
        n>>=1;
        k=(k*k)%mod;
    }
    return ss;
}
int main()
{
    ll n,a,b;
    yuan[0][0]=2;
    yuan[1][0]=yuan[1][1]=1;
    yuan[0][1]=0;
    one[0][1]=1;
    one[0][0]=1;
    cin >> n >> a >> b;
    Pow(yuan,n-1);
    multi(one,res,N);
    ll ans=one[0][0];
    ll tt=1;
    for(int i=1;i<=b;i++)
    {
        ll nov=ppow(i,mod-2);
        tt=(((tt*(n-i+1))%mod)*nov)%mod;
        if(i==a || i==b)
        {
            ans=(ans-tt+mod)%mod;
        }
    }
    cout << ans;
    return 0;
}


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

int jdg(int x)
{
    int g = 2;
    vector<int> ary = {4, 6, 9, 12};
    if (x == 2)
    {
        g = 0;
    }
    else
    {
        for (int i = 0; i < 4; i++)
        {
            if (ary.at(i) == x)
            {
                g = 1;
                break;
            }
        }
    }
    return g;
}

int main()
{
    int a, b;
    cin >> a >> b;
    if (jdg(a) == jdg(b))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3524
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> v(N);
  for (int i = 0; i < N; i++){
     cin >> v.at(i);
  }
 int dan = 0;
for (int i = 0; i < N; i++){
  int MAX = -5;
  for (int i = 0; i < N; i++){
    if (v.at(i) > MAX){
      MAX = v.at(i);
    }
  }
if (MAX != -1){
  dan++;
  for (int i = 0; i < N; i++){
    if (v.at(i) == MAX){
      v.at(i) = -1;
    }
  }
}
}
cout << dan << endl;
}


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

using std::acos;
using std::atan2;

const double PI=acos(-1);
int a,b,x;

inline double rad_to_deg(double x){
	return x/(2*PI)*360;
}

inline double calc_small(){
	return atan2(b,2.0*x/(a*b));
}

inline double calc_large(){
	return atan2(2*b-2.0*x/(a*a),a);
}

int main(){
	scanf("%d%d%d",&a,&b,&x);
	if(2*x==a*a*b) printf("%.7lf",rad_to_deg(atan2(b,a)));
	else if(2*x<a*a*b) printf("%.7lf",rad_to_deg(calc_small()));
	else printf("%.7lf",rad_to_deg(calc_large()));
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define scl(n) scanf("%lld", &n)
#define pcl(n) printf("%lld\n", n)
#define pcl1(n) printf("%lld ", n)
#define dev(x) cout << #x << " " << x << " ";
#define PTT pair<ll, ll>

map<ll, ll> mp, mp1;
map<ll, ll>::iterator itr;
ll rem[2019];

int main()
{
    ll l, r;
    scl(l);
    scl(r);

    for (ll i = l; i <= min(r, l + 2019); i++)
    {
        rem[i % 2019]++;
    }
    ll mn = 1e10;
    for (ll i = 0; i < 2019; i++)
    {
        for (ll j = i + 1; j < 2019; j++)
        {
            if (rem[i] && rem[j])
            {
                mn = min(mn, (i * j) % 2019);
            }
        }
    }
    cout << mn << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <numeric>

using namespace std;

using ll = long long;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

#define input(...) __VA_ARGS__; in(__VA_ARGS__)

#if __has_include("debugger.cpp")
  #include "debugger.cpp"
#else
void print() {
  std::cout << std::endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) > 0) cout << " ";
  print(std::forward<Tail>(tail)...);
}
# endif

void in() { }

template <class Head, class... Tail>
void in(Head&& head, Tail&&... tail) {
  cin >> head;
  in(std::forward<Tail>(tail)...);
}

ll MOD = 1'000'000'007;
ll powmod(ll v, ll x) {
  if (x == 0) return 1;
  if (x % 2 == 0) {
    ll tmp = powmod(v, x / 2);
    return (tmp * tmp) % MOD;
  } else {
    return (powmod(v, x - 1) * v) % MOD;
  }
}

ll mod(ll x) {
  if (x < 0) {
    x += ((-x) / MOD + 1) * MOD;
  }
  x %= MOD;
  return x;
}

int main() {
  ll input(n, k);
  vector<ll> a(n);
  REP(i, n) cin >> a[i];
  sort(a.begin(), a.end(), greater<ll>());
  if (a[0] < 0) {
    if (k % 2 == 0) {
      sort(a.begin(), a.end());
    }
    ll m = 1;
    REP(i, k) {
      m *= a[i];
      m = mod(m);
    }
    print(m);
    return 0;
  }

  if (k == n) {
    ll m = 1;
    REP(i, k) {
      m *= a[i];
      m = mod(m);
    }
    print(m);
    return 0;
  }

  ll ans = 1;
  ll left = 0;
  ll right = n - 1;

  if (k % 2 == 1) {
    ans *= a[0];
    left++;
    k--;
  }

  for(ll i = 0; i < k; i += 2) {
    ll vleft = a[left] * a[left + 1];
    ll rleft = a[right] * a[right - 1];

    if (vleft < 0) vleft = 0;
    if (rleft < 0) rleft = 0;

    if (vleft > rleft) {
      (ans *= vleft % MOD) %= MOD;
      left += 2;
    } else {
      (ans *= rleft % MOD) %= MOD;
      right -= 2;
    }
  }
  print(ans);
}


Measured memory_bytes: 4784
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>
#include <random>
#include <complex>
#include <functional>
#include <tuple>

//#include "All.h"

using namespace std;

#define EPS (1e-9)
#define INF (1e9)
#define PI (acos(-1))
#define REP(i,a,n) for(int i=a;i<n;i++)
#define rep(i, n) REP(i,0,n)

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")

using ll = long long int;

int gcd(int a, int b) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll beki(ll a, ll b) {
    ll tmp = 1;
    rep(i, b) tmp *= a;
    return tmp;
}

ll N, M, K;
ll A[200010], B[200010];
ll a[200010] = {}, b[200010] = {};
ll ans = 0;
ll ai = 0, bi = 0;

int main() {
    cin >> N >> M >> K;
    A[0] = 0;
    a[0] = 0;
    B[0] = 0;
    b[0] = 0;
    REP(i, 1, N + 1 + 1) {
        if (i != N + 1) {
            cin >> A[i];
            a[i] = a[i - 1] + A[i];
        }
        else a[i] = (ll)1e17;

        if (a[i] > K && a[i - 1] <= K) {
            ai = i - 1;
        }
    }
    REP(i, 1, M + 1 + 1) {
        if (i != M + 1) {
            cin >> B[i];
            b[i] = b[i - 1] + B[i];
        }
        else b[i] = (ll)1e17;

        if (b[i] > K && b[i - 1] <= K) {
            bi = i - 1;
        }
    }
    /*
    for (int i = 0; i <= N + 1; i++) {
        cout << "a:" << a[i] << endl;
    }
    for (int i = 0; i <= M + 1; i++) {
        cout << "b:" << b[i] << endl;
    }
    */
    ans = ai;
    ll bii = 0;
    int L = ai + 1;
    //if (A[1] > K && B[1] > K) {
    //    cout << 0 << endl;
    //    return 0;
    //}
    //std::cout << ai << " " << bi << endl;
    //cout << endl;
    for (int i = 0; i < L; i++) {
        //どんどん引いてく
        while (true) {
            //std::cout << ai - i << " " << bii << endl;
            //if (K < a[ai - i] + b[0]) break;
            if ((K < a[ai - i] + b[bii] || bii == bi)) {
                if (K < a[ai - i] + b[bii]) bii--;
                if (ai - i + bii > ans) {
                    ans = ai - i + bii;
                    //std::cout << a[ai - i] + b[bii] << endl;
                }
                break;
            }
            else {
                bii++;
            }
        }
    }

    std::cout << ans << endl;

}

/*
5 4 1
1000000000 1000000000 1000000000 1000000000 1000000000
1 1000000000 1000000000 1000000000

5 4 1
1 1000000000 1000000000 1000000000 1000000000
1000000000 1000000000 1000000000 1000000000
*/


Measured memory_bytes: 9832
#include<bits/stdc++.h>
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF 2000000000
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
typedef unsigned long long int ull;
using namespace std;

int LIS(int* A,int L){
  int DP[L];
  fill(DP,DP+L,INF);
  rep(i,L) *upper_bound(DP,DP+L,A[i])=A[i];
  return lower_bound(DP,DP+L,INF)-DP;
}

int main(void){
  int N,ans=0;
  cin >> N;
  int L[2*N];
  rep(i,2*N) cin >> L[i];
  sort(L,L+2*N);
  for(int i=0;i<2*N;i+=2) ans+=L[i];
  cout << ans << endl;
}

Measured memory_bytes: 256
s = list(input())
tmp = 0
ans = 0
for i in range(len(s)):
         if s[i] == "A" or s[i] == "G" or s[i] == "C" or s[i] == "T":
                  tmp += 1
                  if ans < tmp:
                           ans = tmp
         else:
                  tmp = 0
print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
 
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef tuple<ll, ll, ll> ti;
ll mod=1E9+7;
 
#define REP(a,b,c) for(ll a=(b);a<(c);a++)
#define PER(a,b,c) for(ll a=(b);a>=(c);a--)

ll ii(){ ll x; cin >> x; return x; }
string is(){ string x; cin >> x; return x; }
double id(){ double x; cin >> x; return x; }
void oi(ll x){ cout << x; }
void od(ld x){ cout << fixed << setprecision(10) << x; }
void os(string x){ cout << x; }
void oe(){ cout << endl; }
void oie(ll x){ oi(x); oe(); }
void ode(ld x){ od(x); oe(); }
void ose(string x){ os(x); oe(); }

int main(){
    ll S=ii();
    ll W=ii();
    if(W>=S){
        ose("unsafe");
    }else{
        ose("safe");
    }
 
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
typedef long long int lli;
using namespace std;
#define MOD 1000000007
#define MAX 5000005
#define endl "\n"
string in;
lli n;
lli md[55][55];
string out;
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);    
 /*   freopen("biginput.txt", "r", stdin);
    freopen("output.txt", "w", stdout);*/
    lli t;
    t = 1;
    lli pa = 0;
    while(t--){
       pa++;
       lli a,b,c,k;
       cin>>a>>b>>c>>k;
       bool flag = false;
       for(int i = 0; i<=k; i++){
           for(int j = 0; j<=k; j++){
               for(int l = 0; l<=k; l++){
                   if((i+j+l) <= k){
                        lli A = a*binpow(2,i);
                        lli B = b*binpow(2,j);
                        lli C = c*binpow(2,l);
                        if((B >A) && (C > B)){
                            //cout<<A<<" "<<B<<" "<<C<<endl;
                            flag = true;
                    }
                 }
               }
           }
       }
       if(flag){
           cout<<"Yes"<<endl;
       }
       else{
           cout<<"No"<<endl;
       }
    }
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  int n;
  cin >> n;
  vstr s(n);
  vi32 p(n);
  rep(i, n) {
    cin >> s[i] >> p[i];
  }
  vi32 o(n);
  iota(all(o), 0);
  sort(all(o), [&](int i, int j) {
    if (s[i] != s[j]) return s[i] < s[j];
    if (p[i] != p[j]) return p[i] > p[j];
    return false;
  });
  rep(i, n) {
    cout << o[i] + 1 << endl;
  }
}


Measured memory_bytes: 256
n=int(input())
s=input()
y=[]
for i in range(1,n):
    x=0
    m=list(dict.fromkeys(s[0:i]))
    for j in range(len(m)):
        if m[j] in s[i:n]:
            x+=1
    y.append(x)

y=sorted(y)
print(y[-1])

Measured memory_bytes: 39664
digits = [0] + [int(c) for c in input()]

dp = [0, 1]
for digit in reversed(digits):
    dp0, dp1 = dp
    dp[0] = min(dp0, dp1 + 1) + digit
    dp[1] = min(dp0, dp1 - 1) + 10 - digit

print(min(dp))

Measured memory_bytes: 20460
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int N = sc.nextInt();
			int[] T = new int[N];
			int total = 0;
			for (int i = 0; i < N; i++) {
				T[i] = sc.nextInt();
				total += T[i];
			}
			int M = sc.nextInt();
			for (int i = 0; i < M; i++) {
				int P = sc.nextInt();
				int X = sc.nextInt();
				System.out.println(total - T[P - 1] + X);
			}
		}
	}
}


Measured memory_bytes: 10320
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int,  int>;
using pll = pair<ll, ll>;
using edge = pair<int, ll>;
using Graph = vector<vector<int>>; 
using WeightedGraph = vector<vector<edge>>;
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  cout << min(a,b)+min(c,d) << endl;
}


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

namespace ConsoleApp16
{
    class Program
    {
        static void Main(string[] args)
        {
            long nini = long.Parse(Console.ReadLine());
            string[] str = Console.ReadLine().Split(' ');
            long oioi = 0;
            double count = 0;
            double test;
            long kai = 0;
            foreach (string ts in str)
            {
                oioi += long.Parse(ts);
                test = (double)oioi / (double)str.Count();
                count = Math.Round(test);
            }
            foreach (string tss in str)
            {
                kai += (long.Parse(tss) - (long)count) * (long.Parse(tss) - (long)count);
            }
            Console.WriteLine(kai);
        }
    }
}


Measured memory_bytes: 11220
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const N = Number(input[0][0]);

  for (let i = 0; i <= N; i += 4) {
    if ((N - i) % 7 === 0) {
      return "Yes";
    }
  }

  return "No";
};

console.log(main(read()));


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

int main(){
    int N, Y;
    int a = -1, b = -1, c = -1;
    cin >> N >> Y;
    for(int i=0; i<=N; i++){
        for(int j=0; i+j<=N; j++){
            int k = N - i - j;
            int total = 10000*i + 5000*j + 1000*k;
            if(total == Y){
                a = i;
                b = j;
                c = k;
            }
        }
    }
    cout << a << " " << b << " " << c << endl;
}

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

ll n, k, mx, a, s[200005];
int main() {
	ll i;
	cin >> n >> k;
	for(i=1; i<=n; i++) {
		scanf("%lld", &a);
		s[i] = s[i-1] + a;
		if(i>=k) mx = max(mx, s[i] - s[i-k]);
	}
	printf("%.9f", (mx + k) / 2.0);
	return 0;
}

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

using ull = unsigned long long;
inline int trail(ull s) {
  return (s ? __builtin_ctzll(s) : 64);
}
// O(3^(n/3)) ? reference:
// https://sites.google.com/site/indy256/algo/bron_kerbosh
template <typename T>
T BronKerbosch(const vector<ull> &g, ull cur, ull allowed,
               ull forbidden, const vector<T> &w) {
  if(allowed == 0 && forbidden == 0) {
    T res = 0;
    for(int u = trail(cur); u < g.size();
        u += trail(cur >> (u + 1)) + 1)
      res += w[u];
    return res;
  }
  if(allowed == 0) return -1;
  T res = -1;
  int piv = trail(allowed | forbidden);
  ull z = allowed & ~g[piv];
  for(int u = trail(z); u < g.size();
      u += trail(z >> (u + 1)) + 1) {
    res = max(res, BronKerbosch(g, cur | (1ULL << u),
                                allowed & g[u],
                                forbidden & g[u], w));
    allowed ^= 1ULL << u;
    forbidden |= 1ULL << u;
  }
  return res;
}

template <typename T>
T maxmum_clique(const vector<vector<int>> G,
                const vector<T> &w) {
  int n = G.size();
  assert(n < 64);
  vector<ull> g(n, 0);
  for(int i = 0; i < n; ++i)
    for(int j : G[i]) g[i] ^= 1ULL << j;
  return BronKerbosch<T>(g, 0, (1ULL << n) - 1, 0, w);
}

template <typename T>
T maximal_independent_set(const vector<vector<int>> &G,
                          const vector<T> &w) {
  int n = G.size();
  assert(n < 64);
  vector<ull> g(n, (1ULL << n) - 1);
  for(int i = 0; i < n; ++i) {
    g[i] ^= 1ULL << i;
    for(int j : G[i]) g[i] ^= 1ULL << j;
  }
  return BronKerbosch<T>(g, 0, (1ULL << n) - 1, 0, w);
}

long long n, m;
vector<int> w;
vector<vector<int>> a, g;

long long solve();
bool ch(int x, int y);

int main() {
  while(1) {
    cin >> n >> m;
    if(n + m == 0) break;
    g.assign(m, vector<int>(0));
    a.assign(n, vector<int>(m, 0));
    w.assign(m, 1);
    for(int i = 0; i < n; ++i) {
      for(int j = 0; j < m; ++j) cin >> a[i][j];
    }
    cout << solve() << endl;
  }
  return 0;
}

long long solve() {
  for(int i = 0; i < m; ++i)
    for(int j = i + 1; j < m; ++j)
      if(ch(i, j)) {
        g[i].push_back(j);
        g[j].push_back(i);
      }
  return maxmum_clique(g, w);
}

bool ch(int x, int y) {
  vector<pair<int, int>> v;
  for(int i = 0; i < n; ++i)
    v.push_back({a[i][x], a[i][y]});
  sort(v.begin(), v.end());
  for(int i = 1; i < n; ++i)
    if(v[i - 1].second > v[i].second) return 0;
  return 1;
}


Measured memory_bytes: 3196
#include <iostream>
#include <cassert>
#include <iomanip>
#include <utility>
#include <cmath>
#include <numeric>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <queue>
#include <string>

using namespace std;

typedef long long ll;
typedef pair<int, int> p_i;

#define rep(i, n) for (int i = 0; i < n; i++)
#define repext(i, a, b) for (int i = a; i < b; i++)
#define reprev(i, n) for (int i = n - 1; i >= 0; i--)
#define repextrev(i, a, b) for (int i = b - 1; i >= a; i--)
#define vec_all(vec) vec.begin(), vec.end()
#define sum(vec) accumulate(vec_all(vec), 0)

// vectorデバッグ
template <typename T>
void dump_vec(vector<T> vec)
{
    rep(i, vec.size())
    {
        cout << i << ": " << vec[i] << endl;
    }
}

// --- notice ---
// intの和はllにしろ

int main()
{
    int n, m;
    cin >> n >> m;
    vector<vector<p_i>> cities(n, vector<p_i>());

    int tmp_pre;
    int tmp_year;
    rep(i, m) {
        cin >> tmp_pre >> tmp_year;
        cities[tmp_pre - 1].push_back(p_i(i, tmp_year));
    }

    rep(i, n) {
        sort(vec_all(cities[i]), [](p_i p1, p_i p2) {
            return p1.second < p2.second;
        });
    }

    vector<p_i> numbers(m);
    rep(i, n) {
        rep(j, cities[i].size()) {
            int city = cities[i][j].first;
            numbers[city] = p_i(i + 1, j + 1);
        }
    }

    rep(i, m) {
        cout << setfill('0') << right << setw(6) << numbers[i].first;
        cout << setfill('0') << right << setw(6) << numbers[i].second << endl;
    }

    return 0;
}

Measured memory_bytes: 7808
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<queue>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<cmath>
#include<cctype>
#include<ctime>

using namespace std;

int main()
{
    int flag=0;
    char s[100005];
    scanf("%s",s);
    for(int i=0;i<strlen(s);i++)
    {
        if(s[i]==s[i+1])
        {
            printf("%d %d\n",i+1,i+2);
            flag=1;
            break;
        }
        else if(i<strlen(s)-1&&s[i]==s[i+2])
        {
            printf("%d %d\n",i+1,i+3);
            flag=1;
            break;
        }
    }
    if(!flag) printf("-1 -1\n");
    return 0;    
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b,c,d,i,j,k,l;
  int a1[3][3];
  int mx=0;
  for(i=0;i<3;i++)
  {
    for(j=0;j<3;j++)
   { cin>>a1[i][j];
    mx=max(mx,a1[i][j]);
   }
  }
  for(i=0;i<=mx;i++)
  {
    for(j=0;j<=mx;j++)
    {
      for(k=0;k<=mx;k++)
      {
        int i1=a1[0][0]-i;
        int j1=a1[1][1]-j;
        int k1=a1[2][2]-k;
        if(a1[0][0]==i+i1 && a1[0][1]==i+j1 && a1[0][2]==i+k1 && a1[1][0]==j+i1 && a1[1][1]==j+j1 && a1[1][2]==j+k1 && a1[2][0]==k+i1 && a1[2][1]==k+j1 && a1[2][2]==k+k1)
        {
          cout<<"Yes";
          return 0;
        }
      }
    }
  }
  cout<<"No";
}


Measured memory_bytes: 256
/* Manish Pant - insider_pants */

#include <bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
    #include "debug.h"
#endif

#define F first
#define S second
#define endl "\n"
#define pb push_back
typedef long long ll;
typedef long double ldob;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

int main()
{
    fast();
    string a, b; cin >> a >> b;

    b.pop_back();
    if(a == b) cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
// #define int ll
using PII = pair<int, int>;
 
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
 
template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
 
template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) { 
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }
 
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) {is >> x;} return is;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'['; for(T i: a) {out<<i<<',';} out<<']'; return out;
}
 
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
ll MOD = 1000000007;

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

  ll n, t, a;
  cin >> n >> t >> a;
  vector<ll> h(n);
  REP(i, n) cin >> h[i];

  double mi = INF;
  ll idx = -1;
  REP(i, n) {
    if(abs(t-h[i]*0.006-a) < mi) {
      mi = abs(t-h[i]*0.006-a);
      idx = i;
    }
  }

  cout << idx+1 << endl;

  return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iomanip>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <sstream>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif

ll cross(ll a, ll b, ll c, ll d) {
    return a*d - b*c;
}

int main() {
    ll a[6];
    while(cin) {
        rep(i,6) cin>>a[i];
        if(!cin) break;
        ll d =  cross(a[0], a[1], a[3], a[4]);
        ll x1 = cross(a[2], a[1], a[5], a[4]);
        ll x2 = cross(a[0], a[2], a[3], a[5]);
        cout << setprecision(3) << fixed;
        cout << 1. * x1 / d + 1e-9 << " ";
        cout << 1. * x2 / d + 1e-9 << endl;
    }
}

Measured memory_bytes: 1228
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  string s;
  cin>>s;
  Int n=s.size();
  Int ans=0;
  for(Int i=0;i<n;i++){
    for(Int j=i+1;j<=n;j++){
      Int res=j-i;
      for(Int k=i;k<j;k++)
        if(s[k]!='A'&&s[k]!='C'&&s[k]!='G'&&s[k]!='T') res=0;
      chmax(ans,res);
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int n;cin>>n;
  int a[n+2];
  a[0]=0;
  long long sm = 0;
  for(int i = 1; n >= i; i++){
    cin>>a[i];
    sm += abs(a[i-1]-a[i]);
  }
  a[n+1]=0;sm += abs(a[n]-a[n+1]);
  for(int i = 0; n > i; i++){
    if((a[i] <= a[i+1] && a[i+1] <= a[i+2])||(a[i] >= a[i+1] && a[i+1] >= a[i+2])){
      cout << sm << endl;
    }else{
      cout << sm - (abs(a[i]-a[i+1])+abs(a[i+1]-a[i+2])-abs(a[i]-a[i+2])) << endl;
    }
  }
}
       
       

Measured memory_bytes: 1664
#include "bits/stdc++.h"
using namespace std;

#define rep(i,N) for(int i=0;i<(int)N;++i)
#define rep1(i,N) for(int i=1;i<=(int)N;++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()

using int64 = long long;
using i64 = long long;

const int inf = 1 << 30;
const i64 inf64 = 1ll << 60;

const int mod = 1e9 + 7;

template<typename T>
vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
   return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

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

template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
   os << "[";
   for (auto& e : v) os << e << ", ";
   return os << "]";
}

template <typename Monoid>
struct SegmentTree {
   using F = function<Monoid(Monoid, Monoid)>;

   int sz;
   vector<Monoid> seg;

   const F f;
   const Monoid M;

   SegmentTree(int n, const F& f, const Monoid& M) : f(f), M(M) {
      sz = 1;
      while (sz < n) sz <<= 1;
      seg.assign(2 * sz, M);
   }

   void set(int k, const Monoid& x) {
      seg[sz + k] = x;
   }

   void build() {
      for (int k = sz - 1; k > 0; --k) {
         seg[k] = f(seg[2 * k], seg[2 * k + 1]);
      }
   }

   void update(int k, const Monoid& x) {
      k += sz;
      seg[k] = x;
      while (k >>= 1) seg[k] = f(seg[2 * k], seg[2 * k + 1]);
   }

   Monoid query(int l, int r) {
      Monoid L = M, R = M;
      for (l += sz, r += sz; l < r; l >>= 1, r >>= 1) {
         if (l & 1) L = f(L, seg[l++]);
         if (r & 1) R = f(R, seg[--r]);
      }
      return f(L, R);
   }

   Monoid operator[](const int& k) const {
      return seg[sz + k];
   }
};

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

   int n, q; cin >> n >> q;
   SegmentTree<int> seg(n, [](int l, int r) {return min(l, r); }, INT_MAX);
   seg.build();
   rep(i, q) {
      int com; cin >> com;
      int x, y; cin >> x >> y;
      if (com == 0) seg.update(x, y);
      else cout << seg.query(x, y + 1) << endl;
   }
}


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

int main() {
  string d;
  cin >> d;
  if (d == "SUN") {
    cout << 7 << endl;
  }
  if (d == "MON") {
    cout << 6 << endl;
  }
  if (d == "TUE") {
    cout << 5 << endl;
  }
  if (d == "WED") {
    cout << 4 << endl;
  }
  if (d == "THU") {
    cout << 3 << endl;
  }
  if (d == "FRI") {
    cout << 2 << endl;
  }
  if (d == "SAT") {
    cout << 1 << endl;
  }
}


Measured memory_bytes: 256
from math import ceil


def solve(string):
    n, *a = map(int, string.split())
    t = [0] * n
    ans = []
    for i, _a in zip(range(n, 0, -1), a[::-1]):
        if t[i - 1] % 2 == _a:
            continue
        ans.append(str(i))
        for j in range(1, ceil((i + 1)**0.5)):
            if i % j == 0:
                t[j - 1] += 1
                if j != i // j:
                    t[i // j - 1] += 1
    return "0" if len(ans) == 0 else "{}\n{}".format(len(ans), " ".join(ans[::-1]))

  
if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))


Measured memory_bytes: 86120
N = int(input())
d = len(str(N))
s = [0 for k in range(100)]

for k in range(1,N+1):
    l = len(str(k))
    s[10*(k//(10**(l-1)))+k%10] += 1

ans = 0
for k in range(1,10):
    ans += s[k]**2

for x in range(1,10):
    for y in range(1,10):
        ans += s[x*10+y]*s[y*10+x]

print(ans)


Measured memory_bytes: 40300