akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ACC ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mod 1000000007
#define MAXN 10000001
//string alpha="abcdefghijklmnopqrstuvwxyz";
//int dx[]={1,-1,0,0};
//int dy[]={0,0,1,-1};
//int dx8[]={1,-1,0,0,1,1,-1,-1};
//int dy8[]={0,0,1,-1,1,-1,1,-1};
/*int spf[MAXN];
void sieve()
{
	int i,j;
	for(i=0;i<MAXN;i++)
	spf[i]=i;
	for(i=4;i<MAXN;i+=2)
	spf[i]=2;
	for(i=3;i*i<MAXN;i++)
	{
		if(spf[i]==i)
		{
			for(j=i*i;j<MAXN;j+=i)
			{
				if(spf[j]==j)spf[j]=i;
			}
		}
	}
}*/
/*bool isvowel(char c)
{
    switch(c)
    {
        case 'a':
        case 'e':
        case 'i':
        case 'o':
        case 'u':return true;
        default : return false;
    }
}*/
/*bool isValid(int x,int y,int n,int m)
{
    if(x<0||x>n-1||y<0||y>m-1)return false;
    return true;
}*/
/*
bool comp(pair<int,int> x,pair<int,int> y)
{
    if(y.second==x.second)
        return y.first<x.first;
    return y.second<x.second;
}*/
int power(int x,int y)
{
    int ans=1;
    for(int i=1;i<=y;i++)
    {
        ans=((ans%mod)*(x%mod))%mod;
    }
    return ans;
}
int32_t main()
{
    ACC
    int T;
    T=1;
    //cin>>T;
    while(T--)
    {
        int n,i;
        cin>>n;
        int ans=power(10,n)%mod;
        ans=(ans%mod - (2* power(9,n))%mod + mod + (power(8,n)%mod))%mod;
        cout<<ans<<"\n";
    }
    return 0;
}


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

int main(){
  int h,w;
  cin >> h >> w;
  char s[h][w];
  vector<vector<int>> cost(h,vector<int>(w,-1));
  cost[0][0]=0;
  int black = 0;
  for (int i = 0; i < h; i++)
  {
    for (int j = 0; j < w; j++)
    {
      cin >> s[i][j];
      if(s[i][j]=='#') black++;
    }
  }

  queue<pair<int,int>> que;
  que.emplace(0,0);
  while(!que.empty()){
    int dx[4] = {0,0,1,-1};
    int dy[4] = {1,-1,0,0};
    pair<int,int> p=que.front();
    que.pop();
    for (int i = 0; i < 4; i++)
    {
      int nx = p.first + dx[i];
      int ny = p.second + dy[i];
      if(nx>=0 && nx<h && ny>=0 && ny<w && s[nx][ny]=='.' && cost[nx][ny]==-1){
        cost[nx][ny]=cost[p.first][p.second]+1;
        que.emplace(nx,ny);
      }
    }
  }
  if(cost[h-1][w-1]==-1) cout << -1 << endl;
  else cout << h*w-black-cost[h-1][w-1]-1 << endl;  
}

Measured memory_bytes: 256
n=int(input())
x=[0]*n
y=[0]*n
for i in range(n):
  x[i],y[i]=map(int,input().split())
  if(abs(x[i])+abs(y[i]))%2!=(abs(x[0])+abs(y[0]))%2:
    print(-1)
    exit()
D=[]
for i in reversed(range(33)):D.append(1<<i)
D+=[1,1]
if(abs(x[0])+abs(y[0]))%2==0:D.append(1)
print(len(D))
print(*D)
for i in range(n):
  X,Y=x[i],y[i]
  s=''
  for d in D:
    if abs(X)>abs(Y):
      if X>0:
        X-=d
        s+='R'
      else:
        X+=d
        s+='L'
    else:
      if Y>0:
        Y-=d
        s+='U'
      else:
        Y+=d
        s+='D'
  print(s)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  ll N;
  cin>>N;
  set<char> S;
  for(ll i=0;i<N;i++) {
    char d;
    cin>>d;
    S.insert(d);
  }
  if(S.size()==3) {
cout<<"Three"<<endl;
  }
  else {
cout<<"Four"<<endl;
  }
}


Measured memory_bytes: 3500
import bisect

n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(len(a)):
    b.append(i - a[i])
b.sort()
ans = 0
for i in range(len(a)):
    x = bisect.bisect_left(b, a[i] + i)
    y = bisect.bisect_right(b, a[i] + i)
    ans += y-x
print (ans)

Measured memory_bytes: 32392
N = int(input())
N_List = list(map(int,input().split()))
ans = 0
cans = 0
for i in range(1,N):
    if N_List[i] <= N_List[i-1]:
        cans += 1
    if cans > ans:
        ans = cans
    if N_List[i] > N_List[i-1]:
        cans = 0
    
print(ans)

Measured memory_bytes: 20568
#include <stdio.h>
#include <cmath>
using namespace std;

int main(void) {
  float a, b, c, d, e, f;
  while (scanf("%f %f %f %f %f %f", &a, &b, &c, &d, &e, &f)+1)  {
    float x = (c*e-b*f)/(a*e-b*d);
    float y = (c*d-a*f)/(b*d-a*e);
    if (abs(x) <= 1.0e-4) x = 0.0;
    if (abs(y) <= 1.0e-4) y = 0.0;
    printf("%.3f %.3f\n", x, y);
  }
  return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<long int> a(n);
    for(int i=0;i<n;i++)cin >> a[i];
    int res=-1;
    for(int i=0;;i++){
        for(int j=0;j<n;j++){
            if(a[j]%2){
                res = i;
                break;
            }
            a[j]/=2;
        }
        if(res!=-1)break;
    }
    cout << res << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#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 (1<<30)
#define LINF (1LL<<60)
#define endl "\n"
#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)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef unsigned long long int ull;
typedef long long lint;

int main(void){
    lint N,A,B;
    cin >> N >> A >> B;
    lint X[N];
    rep(i,N) cin >> X[i];
    sort(X,X+N);
    lint ans=B*(N-1);
    rep(i,N-1) ans-=max(0LL,B-(X[i+1]-X[i])*A);
    cout << ans << endl;
}


Measured memory_bytes: 1024
s = input()

for i in range(2**3):
    li = ["+","+","+"]
    for j in range(3):
        if (i >> j) & 1:
            li[j] = "-"
    if eval(s[0] + li[0] + s[1] + li[1] + s[2] + li[2] + s[3]) == 7:
        print(s[0] + li[0] + s[1] + li[1] + s[2] + li[2] + s[3] + "=7")
        exit()

Measured memory_bytes: 61660
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i < (n);i++)
using namespace std;
int main(){
    int k;
    string s;
    cin>>k;
    cin>>s;
    if(s.length()<=k){
        cout<<s;
    }else{
        rep(i,k){
            cout<<s[i];
            if(i==k-1)cout<<"...";
        }
    }
    }


Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define ll long long
#define endl '\n'
using namespace std;


int main()
{
	int t=1;
	//cin>>t;
	
	while(t--)
	{

		string s,t;
		cin>>s;
		cin>>t;
		
		int n=s.length();
		int m=t.length();
		
		string lcs="";
		
		int **dp=new int*[n+1];
		for(int i=0;i<=n;i++)
		{
			dp[i]=new int[m+1];
		}
		
		for(int i=0;i<=n;i++)
		{
			dp[i][0]=0;
		}
		
		for(int i=0;i<=m;i++)
		{
			dp[0][i]=0;
		}
		
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=m;j++)
			{
				if(s[i-1]==t[j-1])
				{
					dp[i][j]=1+dp[i-1][j-1];
				}else
				{
					dp[i][j]=max(dp[i][j-1],dp[i-1][j]);
				}
			}
		}
		
		int i=n,j=m;
		while(j>0&&i>0)
		{
			if(s[i-1]==t[j-1])
			{
				lcs+=s[i-1];
				i--;
				j--;
			}
			
			else if(dp[i-1][j]>dp[i][j-1])
			{
				i--;
			}else
			{
				j--;
			}
		}
		
		reverse(lcs.begin(),lcs.end());
		cout<<lcs<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 38868
//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
#include <bitset>
#include <iomanip>
using namespace std;
//namespace mp = boost::multiprecision;
//using llll = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
//using Real = mp::number<mp::cpp_dec_float<1024>>;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main(){
  //cout<<fixed<<setprecision(10);
  ll n,ans=0;
  cin>>n;
  vector<ll>a(n,0);
  for(ll i=0;i<n;i++){
    cin>>a[i];
  }
  map<ll,ll> s1;
  for(ll i=0;i<n;i++){
    s1[i-a[i]]++;
  }
  for(ll i=0;i<n;i++){
    ans+=s1[a[i]+i];
    if(s1[i-a[i]]>0)s1[i-a[i]]--;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 27368
n,m = map(int,input().split())
a=[]
b=[]
for i in range(m):
    a1,b1 = map(int,input().split())
    a.append(a1)
    b.append(b1)
road = [0]*n
for i in range(m):
    road[a[i]-1]+=1
    road[b[i]-1]+=1
for i in range(n):
    print(road[i])


Measured memory_bytes: 3064
// package app;
import java.util.*;

public class Main {
    public static void main(String[] args) {    
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        sc.close();
        
        if (str.contains("A") && str.contains("B")){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        System.exit(0);
    }
}

Measured memory_bytes: 21844
r, g, b, n = map(int, input().split())
l = [r, g, b]
l.sort()

N1 = n // l[2]
N2 = n // l[1]
N3 = n // l[0]

cnt = 0

for i in range(N1+1):
    N2 = n-i*l[2] // l[1]
    for j in range(N2+1):
        if ((n-i*l[2]-j*l[1]) % l[0] == 0) and ((n-i*l[2]-j*l[1]) // l[0] >= 0):
            cnt += 1
            # print(i, j, (n-i*l[2]-j*l[1]) // l[0])
print(cnt)


Measured memory_bytes: 40556
import java.util.Scanner;

/**
 * Buffet
 */
public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();
            int[] A = new int[N];
            int[] B = new int[N];
            int[] C = new int[N - 1];

            for (int i = 0; i < N; i++) {
                A[i] = sc.nextInt() - 1;
            }
            for (int i = 0; i < N; i++) {
                B[i] = sc.nextInt();
            }
            for (int i = 0; i < N - 1; i++) {
                C[i] = sc.nextInt();
            }

            int S = B[A[0]];
            for (int i = 1; i < N; i++) {
                S += B[A[i]];
                if (A[i] == A[i - 1] + 1) {
                    S += C[A[i - 1]];
                }
            }

            System.out.println(S);
        }
    }
}


Measured memory_bytes: 21972
#include <cstdio>

/*
g(L, R) := \prod_{i=L}^{R} (1 + q^{A_i})
f(L, R) = [q^S] g(L, R)
\sum_{1<=L<=R<=N} f(L, R)
p[i] := \sum_{1<=L<=i} g(L, i)
p[i] = (p[i-1] + 1) * (1 + q^{A_i})
*/

constexpr unsigned mod = 998244353;

int n, s;
unsigned long long dp[3001];

int main(){
  scanf("%d%d", &n, &s);

  int ans = 0;
  for(int i = 0; i < n; i++){
    int a;
    scanf("%d", &a);
    dp[0]++;
    for(int j = s; j >= a; j--){
      dp[j] += dp[j - a];
    }
    if((i & 0x0F) == 0x0F){
      for(int j = 0; j <= s; j++)
        dp[j] %= mod;
    }
    ans = (ans + dp[s]) % mod;
  }
  printf("%d\n", ans);
  return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n),b(n),c(n-1);
  rep(i,n){cin >> a[i];}
  rep(i,n){cin >> b[i];}
  rep(i,n-1){cin >> c[i];}
  
  int ans = b[a[0]-1];
  for(int i=1; i<n; i++){
    ans += b[a[i]-1];
    if (a[i]==a[i-1]+1) ans += c[a[i-1]-1];
  }

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


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

int main() {
    string s, t;
    cin >> s >> t;
    int n = s.size();
    bool ans = false;
    for (int i=0; i<n; ++i) {
        string s1, s2;
        s1 = s.substr(i);
        s2 = s.substr(0, i);
        string rotated_s = s1 + s2;
        if (rotated_s == t) ans = true;
    }
    cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2000000000;//10^9
ll MOD  = 998244353;

int main() {
    int N,K;
    cin >> N >> K;
    vector<ll> x(N);
    for(int i = 0; i < N; i++) cin >> x.at(i);
    
    ll ANS = INFL;
    for(int i = 0; i <= N - K; i++){
        int left = i, right = i + K - 1;
        ll ans;
        if(x.at(right) < 0){
            ans = -x.at(left);
        }else if(x.at(left) > 0){
            ans = x.at(right);
        }else{
            ll l = -x.at(left), r = x.at(right);
            ans = min(2 * l + r, l + 2 * r);
        }
        ANS = min(ans, ANS);
    }
    cout << ANS << endl;
    
}

Measured memory_bytes: 1024
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

fn main() {
    let cin = stdin();
    let mut scan = Scanner::new(cin.lock());
    let n = scan.read::<u8>();
    let s = scan.chars();
    let mut t = vec![];
    for i in 0..s.len() {
        t.push( ((s[i] as u8 - b'A' + n) % 26 + b'A') as char);
    }
    println!("{}", t.into_iter().collect::<String>());
}

// region template
#[allow(dead_code)]
fn iu(i: i64) -> usize { i as usize }

#[allow(dead_code)]
fn ui(i: usize) -> i64 { i as i64 }

#[allow(dead_code, deprecated)]
fn join<T: std::fmt::Display>(slice: &[T], sep: &str) -> String {
    let strings = slice.iter().map(|t| format!("{}", t)).collect::<Vec<_>>();
    strings.connect(sep)
}

#[allow(dead_code)]
fn arr<'a, S, T>(n: usize, mut f: S) -> Vec<T> where S: FnMut(usize) -> T + 'a {
    (0..n).map(|i| f(i)).collect::<Vec<T>>()
}

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }

    fn readn<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect()
    }

    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}
// endregion

Measured memory_bytes: 4352
#include <algorithm>
#include <cmath>
#include <iostream>
#include <limits>
#include <numeric>
#include <string>
#include <vector>

using namespace std;
int main() {
    int A1, A2, A3;
    cin >> A1 >> A2 >> A3;
    if(A1 + A2 + A3 > 21) {
        cout << "bust" << endl;
    } else {
        cout << "win" << endl;
    }
}

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

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//const ll mod = 1e10;
typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;

// https://algo-logic.info/binary-indexed-tree/
template<typename T>
struct BIT {
    int n;             // 要素数
    vector<T> bit[2];  // データの格納先
    BIT(int n_) { init(n_); }

    void init(int n_) {
        n = n_ + 1;
        for (int p = 0; p < 2; p++) bit[p].assign(n, 0);
    }

    void add_sub(int p, int i, T x) {
        for (int idx = i; idx < n; idx += (idx & -idx)) {
            bit[p][idx] += x;
        }
    }

    void add(int l, int r, T x) {  // [l,r) に加算
        add_sub(0, l, -x * (l - 1));
        add_sub(0, r, x * (r - 1));
        add_sub(1, l, x);
        add_sub(1, r, -x);
    }

    T sum_sub(int p, int i) {
        T s(0);
        for (int idx = i; idx > 0; idx -= (idx & -idx)) {
            s += bit[p][idx];
        }
        return s;
    }

    T sum(int i) { return sum_sub(0, i) + sum_sub(1, i) * i; }
};

int main() {

    int n, m;
    cin >> n >> m;

    vector<P> v(n);
    for (P &p : v) cin >> p.first >> p.second;

    // 小さい順
    // 含むを減らしていく
    // 飛ぶを増やしていく

    map<int, vector<P>> g;
    for (P p : v) g[p.second - p.first + 1].push_back(p);

    int a = n;

    BIT<ll> bit(m + 2);


    for (int k = 1; k <= m; k++) {

        a -= g[k - 1].size();

        for (P p : g[k - 1]) {
            bit.add(p.first, p.second + 1, 1);
        }


        int b = 0;

        for (int j = 0; j <= m; j += k) {
            b += bit.sum(j) - bit.sum(j - 1);
        }

        cout << a + b << endl;

    }

}


Measured memory_bytes: 22160
# N  個の正整数 a1,a2,...,aN が与えられます。
# 非負整数 m に対して、f(m)=(m mod a1)+(m mod a2)+...+(m mod aN) とします。
# ここで、X mod Y は X を Y で割った余りを表します。
# f の最大値を求めてください。

n = gets.to_i
input_a = gets.chomp.split

a = Array.new
n.times do |i|
    a << input_a[i].to_i
end

sum = 0
n.times do |i|
    sum += a[i] - 1
end

puts sum

Measured memory_bytes: 1916
//I_F_A
//
#include "bits/stdc++.h"
using namespace std;
int main(){
	long long a,b;
	cin >> a;
	char ch;
	cin >> ch;
	cin >> b;

	if(ch == '+'){

		cout << a + b << endl;
	}
	else{

		cout << a - b << endl;
	}
}

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

public class Main {
	private static List<Integer>[] children;
	private static long[] count;
	private static boolean[] visited;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Q = sc.nextInt();

		children = new List[N];
		count = new long[N];
		visited = new boolean[N];
		for (int i=0; i<N; i++) {
			children[i] = new ArrayList<Integer>();
			count[i] = 0;
		}
		
		for (int i=0; i<N - 1; i++) {
			int a = sc.nextInt() - 1;
			int b = sc.nextInt() - 1;
			children[a].add(b);
			children[b].add(a);
		}
		
		for (int i=0; i<Q; i++) {
			count[sc.nextInt()-1] += sc.nextInt();
		}
		
		count(0, 0);
		
		StringBuilder sb = new StringBuilder();
		sb.append(count[0]);
		for (int i=1; i<N; i++) {
			sb.append(" " + count[i]);
		}
		System.out.println(sb);
	}
	
	static void count(int nodeIdx, long cnt) {
		count[nodeIdx] += cnt;
		visited[nodeIdx] = true;
		for (Integer c : children[nodeIdx]) {
			if (!visited[c]) {
				count(c, count[nodeIdx]);
			}
		}
	}
}

Measured memory_bytes: 231952
module Math: sig
    val floor_sum: int -> int -> int -> int -> int
end = struct
    let rec floor_sum n m a b =
        let a, ans = if a >= m then a mod m,       (n - 1) * n * (a / m) / 2 else a, 0 in
        let b, ans = if b >= m then b mod m, ans +           n * (b / m)     else b, ans in
        let y_max = (a * n + b) / m in
        let x_max = y_max * m - b in
        if y_max = 0 then ans else
            let ans = ans + (n - (x_max + a - 1) / a) * y_max in
            ans + floor_sum y_max a m ((a - x_max mod a) mod a)
end ;;
Scanf.scanf "%d" (fun t ->
    for i = 1 to t do
        Scanf.scanf " %d %d %d %d" (fun n m a b ->
            Printf.printf "%d\n" @@ Math.floor_sum n m a b
        )
    done
)

Measured memory_bytes: 5940
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std; 
void solve()
{
	ll n;cin>>n;
	//ll a=n;
	cout<<(n+(n*n)+(n*n*n));
}
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
        solve();
    return 0;
}

Measured memory_bytes: 3648
import math
A, B, H, M = map(int, input().split())

day_min = 12 * 60
now_min = H * 60 + M
# print(day_min, now_min)
a_ang = now_min * 360 / day_min
b_ang = M * 6
# print(a_ang, b_ang)
tri_ang = min(abs(a_ang - b_ang), abs(a_ang - b_ang + 360), abs(a_ang - b_ang - 360))
# print(tri_ang)
# print(math.cos(tri_ang * 2 * math.pi / 360))
ans = A**2 + B**2 - 2 * A * B * math.cos(tri_ang * math.pi / 180)
print(ans ** 0.5)

Measured memory_bytes: 62396
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <math.h>

const long long MOD = 1000000007;

using namespace std;



int main(void) {

    long long i, j;
    long long n, m;
    long long sum = 0;
    long long temp, temp_b;
    long long min, max;
    string s;
    long long a, b;

    cin >> n;

    for (i = -120; i < 121; i++) {
        a = pow(i, 5);
        for(j = -120; j < 121; j++) {
            b = pow(j, 5);
            if(a - b == n) {
                cout << i << " " << j << endl;
                return 0;
            }
        }
    }

    

    return 0;
}

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> g(n);
  for (int i = 0; i < m; ++i) {
    int s, t;
    cin >> s >> t;
    s--, t--;
    g[s].push_back(t);
  }
  vector<double> ex(n);
  for (int i = n - 2; i >= 0; --i) {
    ex[i] = 1.0;
    double cf = 1.0 / g[i].size();
    for (int u : g[i]) ex[i] += cf * ex[u];
  }
  // vector<double> ex2(n, 1e9);
  // for (int i = n - 2; i >= 0; --i) {
    // double cf = 1.0 / g[i].size();
    // double sum = 0.0;
    // ex2[i] = ex[i];
    // if (g[i].empty
    // for (int u : g[i]) sum += ex[u];
    // for (int u : g[i]) {
      // if (ex2[u] > 1e8) continue;
      // ex2[i] = min(ex2[i], (sum - ex[u] + ex2[u]) * cf + 1);
    // }
    // if (g[i].size() > 1) {
      // double sum = 0.0;
      // for (int u : g[i]) sum += ex[u];
      // for (int u : g[i]) ex2[i] = min(ex2[i], (sum - ex[u]) / (g[i].size() - 1) + 1.0);
    // }
  // }
  double ans = ex[0];
  for (int i = 0; i < n; ++i) {
    double k = 0.0;
    int nxt = -1;
    for (int u : g[i]) {
      if (ex[u] > k) {
        k = ex[u];
        nxt = u;
      }
    }
    if (nxt == -1) continue;
    auto it = find(g[i].begin(), g[i].end(), nxt);
    g[i].erase(it);
    vector<double> ex(n);
    for (int i = n - 2; i >= 0; --i) {
      if (g[i].empty()) {
        ex[i] = 1e9;
        continue;
      }
      ex[i] = 1.0;
      double cf = 1.0 / g[i].size();
      for (int u : g[i]) {
        if (ex[u] > 1e8) {
          ex[i] = 1e9;
          break;
        }
        ex[i] += cf * ex[u];
      }
    }
    ans = min(ans, ex[0]);
    g[i].push_back(nxt);
  }
  cout << fixed << setprecision(20) << ans << "\n";
}


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

class Main {

    public static void main(String[] args) {

	final Scanner stdin = new Scanner(System.in);

	while ( true ) {
	    final int n = stdin.nextInt();
	    final int s = stdin.nextInt();
	    if ( n == 0 && s == 0 ) {
		break;
	    }
	    System.out.println( solve( n, s ) );
	}
    }

    static long solve( final int n, final int s ) {

	final int MAX_N = Math.min( s, 100 );
	
	long[][][] cache = new long[n + 1][MAX_N + 1][s + 1];
	for ( int i = 0; i <= MAX_N; i++ ) {
	    cache[1][i][i] = 1L;
	}
	
	for ( int depth = 1; depth < n; depth++ ) {
	    for ( int sum = 0; sum <= s; sum++ ) {
		final int lim = Math.min( MAX_N, s - sum );
		for ( int maxNum = 0; maxNum <= lim; maxNum++ ) {
		    for ( int to = maxNum + 1; to <= lim; to++ ) {
			cache[depth + 1][to][sum + to] += cache[depth][maxNum][sum];
		    }
		}
	    }
	}
	
	long sum = 0;
	for ( int maxNum = 0; maxNum <= MAX_N; maxNum++ ) {
	    sum += cache[n][maxNum][s];
	}
	return sum;	     
    }
    
}

Measured memory_bytes: 62252
#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("sse4.2")

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <bitset>
#include <sstream>
#include <deque>
#include <queue>
#include <complex>
#include <random>
#include <cassert>
#include <chrono>

using namespace std;

#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define FIXED cout << fixed << setprecision(12)
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define graph vector<vector<int>>
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define f first
#define s second
#define hashmap unordered_map
#define hashset unordered_set
#define eps 1e-9
#define mod 1000000007
#define inf 3000000000000000007ll
#define sz(a) signed(a.size())
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

#ifdef DEBUG
	mt19937 gen(857204);
#else
	mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif

#ifdef DEBUG
    template<class T> T to_dbg(T x) { return x; }
    template<class T, class U> string to_dbg(pair<T, U> p) {
        stringstream ss;
        ss << '{' << p.f << ',' << p.s << '}';
        return ss.str();
    }
    string to_dbg(string s) { return "\"" + s + "\""; }
    template<class T> string to_dbg(vector<T> a) {
        stringstream ss;
        ss << '{';
        if (sz(a)) ss << to_dbg(a[0]);
        for (int i = 1; i < sz(a); ++i)
            ss << "," << to_dbg(a[i]);
        ss << '}';
        return ss.str();
    }
    template<class T>
    void dbgout(T x) { cout << to_dbg(x) << endl; }
    template<class T, class... U>
    void dbgout(T t, U... u) {
        cout << to_dbg(t) << ", ";
        dbgout(u...);
    }
    #define dbg(...) cout << "[" << #__VA_ARGS__ << "] = ", dbgout(__VA_ARGS__);
#else
    #define dbg(...) 0
#endif

template<class T, class U> inline void checkmin(T &x, U y) { if (y < x) x = y; }
template<class T, class U> inline void checkmax(T &x, U y) { if (y > x) x = y; }
template<class T, class U> inline bool ifmax(T &x, U y) { if (y > x) return x = y, true; return false; }
template<class T, class U> inline bool ifmin(T &x, U y) { if (y < x) return x = y, true; return false; }
template<class T> inline void sort(T &a) { sort(all(a)); }
template<class T> inline void rsort(T &a) { sort(rall(a)); }
template<class T> inline void reverse(T &a) { reverse(all(a)); }
template<class T, class U> inline istream& operator>>(istream& str, pair<T, U> &p) { return str >> p.f >> p.s; }
template<class T> inline istream& operator>>(istream& str, vector<T> &a) { for (auto &i : a) str >> i; return str; }
template<class T> inline T sorted(T a) { sort(a); return a; }

signed main() {
	FAST; FIXED;
	int n;
	cin >> n;
	map<ll, ll> st;
	ll ans = 0;
	for (int i = 0; i < n; ++i) {
		ll a;
		cin >> a;
		ans += st[i - a];
		st[a + i]++;
	}
	cout << ans;
	#ifdef DEBUG
		cerr << "Runtime is: " << clock() * 1.0 / CLOCKS_PER_SEC << endl;
	#endif
	return 0;
}

Measured memory_bytes: 26264
{-# LANGUAGE BangPatterns #-}
import Control.Arrow
import Control.Monad.Fix
import Data.Char
import Data.Int
import Data.Foldable
import Data.List
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import qualified Data.ByteString.Char8 as B
import Debug.Trace

solve :: Int -> Int
solve !n =
  let d = length $ show n
      k = 10 ^ (d - 1)
  in  if even d
        then sum $ map (\n -> 10 ^ n - 10 ^ (n - 1)) [1, 3 .. d]
        else (+ (n - k + 1)) $ sum $ map (\n -> 10 ^ n - 10 ^ (n - 1))
                                         [1, 3 .. d - 1]

main = do
  let readInt :: Integral a => B.ByteString -> Maybe (a, B.ByteString)
      readInt = fmap (first fromIntegral . second B.tail) . B.readInt

  n <- (\vec -> (vec VU.! 0)) . VU.unfoldrN 1 readInt <$> B.getLine
  print $ solve n


Measured memory_bytes: 380
#include <iostream>
#include <cmath>

int table[1000000];

using namespace std;

void init() {
	for (int i = 0; i < 1000000; i++)
		table[i] = 0;
	for (int i = 2; i < 1000000; i++) {
		if (table[i] != -1) {
			table[i] = table[i-1]+1;
			for (int j = i+i; j < 1000000; j+=i)
				table[j] = -1;
		} else {
			table[i] = table[i-1];
		}
	}
}

int main(void) {
	int n;
	init();
	while (cin >> n) {
		cout << table[n] << endl;
	}
	return 0;
}

Measured memory_bytes: 0
fun main(args: Array<String>) {
    val line1 = readLine()!!.trim()
    val (k: Int, n: Int) = line1.split(" ").map {it.toInt()}
    val line2 = readLine()!!.trim()
    val homes: List<Int> = line2.split(" ").map {it.toInt()}
    var maxDistance: Int = homes[0] + k - homes[n - 1]

    var i = 0
    while (i < n - 1) {
        val distance = homes[i + 1] - homes[i]
        if (maxDistance < distance) {
            maxDistance = distance
        }

        i += 1
    }

    val result = k - maxDistance

    println(result)
}


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

int main(void) {
    int N;
    cin >> N;
    vector< int > X(N);
    for (int i = 0; i < N; i++) {
        cin >> X[i];
    }
    int sum = 0;
    for (int i = 0; i < N; i++) {
        sum += X[i];
    }
    int t = sum / N;
    if ((sum % N) * 2 >= N) {
        ++t;
    }
    int ans = 0;
    for (int i = 0; i < N; i++) {
        ans += (X[i] - t) * (X[i] - t);
    }
    printf("%d\n", ans);
    return 0;
}


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

#define infile "../test/sample-1.in"
#define int long long
// #define INF 2147483647
#define INF 1000000000000000000LL
#define MOD 1000000007LL

// {{{ define basic macro
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) repi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)

#define foreach(x,a) for(auto& (x) : (a) )
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)

#define all(x) (x).begin(),(x).end()
#define sum(v) accumulate(all(v), 0)
#define sz(x) ((int)(x).size())
template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }
// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
#define fill(x,y) memset(x,y,sizeof(x))
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ten(n) ((int)1e##n)

template <class T = int>
T in() {T x; cin>>x; return (x);}

struct Fast {
  Fast(){
    std::cin.tie(0);
    ios::sync_with_stdio(false);
  }
} fast;
// }}}
//{{{ dump macro
#ifdef PCM
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}
//{{{ others
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;

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


int d[100][100];

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

  rep(i, 100) rep(j, 100){
    if(i==j) d[i][j]=0;
    else d[i][j]=INF;
  }

  int a,b,c;
  vector<iii> e;
  rep(i, m){
    cin>>a>>b>>c;
    a--;b--;
    d[a][b]=c; d[b][a]=c;
    e.pb(iii(a,b,c));
  }

  rep(k, n){
    rep(i, n){
      rep(j, n){
        chmin(d[i][j], d[i][k]+d[k][j]);
      }
    }
  }
  dump_2d(d, n, n);

  int ans=0;
  foreach(x, e){
    a = get<0>(x);
    b = get<1>(x);
    c = get<2>(x);
    dump(a,b,c,d[a][b]);
    if (d[a][b]<c) { ans++; }
  }

  cout << ans << endl;

  return 0;
}

int test(){ //{{{
  return 0;
}
//}}}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
#ifdef PCM
  test();
#endif
  solve();
  return 0;
} //}}}


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

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

using namespace std;

int main(){
	int n,m; scanf("%d%d",&n,&m);
	vector<set<pair<int,int>>> f(n);
	vector<int> p(m);
	rep(i,m){
		int y; scanf("%d%d",&p[i],&y); p[i]--;
		f[p[i]].emplace(y,i);
	}

	vector<int> ans(m);
	rep(q,n){
		int i=0;
		for(auto x:f[q]) ans[x.second]=i++;
	}
	rep(i,m) printf("%06d%06d\n",p[i]+1,ans[i]+1);

	return 0;
}


Measured memory_bytes: 11648
const main = (input) => {
  const [_a, _b] = input.trim().split(' ')
  const a = BigInt(_a)
  const b = BigInt(_b.split('.').join(''))

  return console.log(`${a*b / 100n}`.split('n').join(''))
}

process.env.MYTEST
  ? (process.env.MYTEST === 'test' ? test() : main(require('fs').readFileSync('dev/stdin', 'utf8')))
  : main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 29496
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include<set>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int i=(m);(i)<(n);(i)++)
typedef long long ll;

int main(){
    ll n,m;
    cin >> n >> m;
    vector<ll> a(n);
    rep(i,n){
        cin >> a[i];
    }
    map<ll,ll> nums;
    ll sum = 0;
    nums[sum]++;
    for(int i=0;i<n;i++){
        sum+=a[i];
        nums[sum%m]++;
    }
    ll res=0;
    for(map<ll,ll>::iterator it = nums.begin();it!=nums.end();it++){
        res+=it->second*(it->second-1)/2;
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 4992
S = input()
C = [S.count("S"),S.count("N"),S.count("W"),S.count("E")]

if C[0]*C[1]*C[2]*C[3] > 0:
    print("Yes")
elif C[0] == C[1] == 0 and C[2]*C[3] > 0:
    print("Yes")
elif C[2] == C[3] == 0 and C[0]*C[1] > 0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(long i=(long)(a);i<=(long)(b);i++)
#define MM 1e9

long N,K;
double ret=0.0;

void input() {
    cin >> N >> K;
}

void solve(){
    double tmp;
    long now;
    rep (i,1,N) {
        now = i;
        tmp = 1.0/N;
        while (now < K) {
            now *= 2;
            tmp /= 2;
        }
        ret += tmp;
    }
    cout << setprecision(12) << ret << endl;
}

int main(){
    input();
    solve();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  
  vector<int> cont(n-1);
  for(int i = 0 ; i < n-1 ; i++){
    cin >> cont.at(i);
  }
  
  int ans = 0;
  ans += cont.at(0);
  ans += cont.at(n-2);
  
  for(int i = 1 ; i < n-1 ; i++){
    ans += min(cont.at(i-1) , cont.at(i));
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>

int main(){
    int N,Ans=0;
    scanf("%d",&N);
    for(int i=1;i<=N;i+=2){
        int cnt=0;
        for(int j=1;j<=i;j++)
            cnt+=i%j==0;
        Ans+=cnt==8;
    }
    printf("%d",Ans);
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <cmath>
#define P 100003
#define N 100000
using namespace std;

int main(){
    string s,t,u;
    int a,b;
    cin >> s >> t;
    cin >> a >> b;
    cin >>u;
    
    if(s == u){
        cout << a-1 << " " << b;
    } else{
                cout << a << " " << b-1;

    }


    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


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


int main(){
    string S;
    ll K;
    cin>>K;
    cin>>S;
    if(S.size() > K){
        rep(i,0,K)cout<<S[i];
        cout<<"...";
    }
    else cout<<S;
    return 0;
}

Measured memory_bytes: 3620
fun main(args:Array<String>) {
    var n = readLine()!!.toInt()

    var acCount = 0
    var waCount = 0
    var tleCount = 0
    var reCount = 0
    for (i in 0 until n) {
        when (readLine()!!) {
            "AC" -> {
                acCount++
            }
            "WA" -> {
                waCount++
            }
            "TLE" -> {
                tleCount++
            }
            "RE" -> {
                reCount++
            }
        }
    }
    
    println("AC x $acCount")
    println("WA x $waCount")
    println("TLE x $tleCount")
    println("RE x $reCount")
}

Measured memory_bytes: 56492
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
 
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("-ffloat-store")
 
#define int  long long
#define rep(i,begin,end) for(__typeof(end)i=(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
#define F first
#define S second
#define sz(x) ((int)x.size())
#define pb push_back
#define pf push_front
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define mod 1000000007
#define what_is(x) cerr << #x << " is " << x <<"\n";
#define sortA(v) sort(v.begin(), v.end())
#define sortD(v) sort(v.rbegin(), v.rend())
#define PI 3.14159265358979323846
#define vout(a) for(auto x:a) cout<<x<<" ";
#define INF 10000000000000000 //1e16
 
// #define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
 
 
// using namespace __gnu_pbds;
using namespace std;
 
using ll  = long long;
using vi  = vector<int>;
using pii = pair<int,int>;
using vii = vector<pii>;
using mi  = multiset<int>;
using mii = multiset<pii>;
 
int lcm(int a,int b) {return (a*(b/__gcd(a,b)));}



void solve()
{
    int n,m,t,i,k,r,l,u,v,w,j,s,sum=0,pos,flag=0,count=0;
    string S,T,U; 
    int a,b;
    cin>>n>>a>>b;
    u=n/(a+b);
    v=n%(a+b);
    int ans=u*a;
    if(v) ans+=min(a,v);
    cout<<ans;

}
 
 
signed main()
{

    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve();
        if(t)cout<<"\n";
    }
    return 0;
}

Measured memory_bytes: 3616
n = int(input())
l = [int(input()) for i in range(n)]
a = [0]
ma = 0
for i,j in enumerate(l):
    if j > ma:
        ma = j
    a.append(ma)
a.append(0)
b = [0]
ma = 0
for i,j in enumerate(reversed(l)):
    if j > ma:
        ma = j
    b.append(ma)
b.append(0)
#print(a,b)
for i in range(n):
    print(max(a[i],b[-i-3]))


Measured memory_bytes: 77524
N, A, B = map(int,input().split())
S = input()

temp_num_people = 0
temp_overseas = 0
for s,i in zip(S,range(len(S))):
    if s == 'a':
        if temp_num_people < A+B:
            print('Yes')
            temp_num_people+=1
        else:
            print('No')

    if s == 'b':
        if (temp_num_people < A+B) and (temp_overseas < B):
            print('Yes')
            temp_num_people+=1
            temp_overseas+=1
        else:
            print('No')

    if s == 'c':
        print('No')


Measured memory_bytes: 4016
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
using namespace std;
int main()
{
	long long int k, a, b;
	long long int ans = 0,n;
	cin >> k >> a >> b;
	
	//cout << (k + 1) / (a + 2) << endl;
	//cout << (k + 1) / (a + 2)*(b) << endl;
	if (b - a > 2 && (a - 1) + 2 < k+1 ) {
		//if((a - 1) + 2<)
		//ans = (k + 1) / (a + 2)*(b)+(k + 1) % (a + 2);
		k -= (a - 1) + 2;
		ans = b;
		n = k / 2;
		ans += ((b - a)*n);
		ans += k & 1;
	}
	else
		ans = 1+k;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
N=int(input())
a=[int(i)-1 for i in list(input())]
def solve(seq):
    if {0}==set(seq):
        return 0
    res=0
    for k in range(N):
        tmp=0
        if ((N-1)&k)==k:
            tmp=1
        #print(tmp)
        res+=tmp*seq[k]
        res%=2
    #print("#"*30)
    if res%2==1:
        return 1
    if 1 in set(seq):
        return 0
    seq2=[seq[i]//2 for i in range(N)]
    return solve(seq2)*2
print(solve(a))


Measured memory_bytes: 141656
#include<bits/stdc++.h>
using namespace std;
#define sqr(x) 1ll*x*(x+1)>>1ll
typedef long long ll;
int n,col[200100],sz[200100];
map<int,int>f[200100];
vector<int>v[200100],res[200100];
void dfs(int x,int fa){
	sz[x]=1;
	for(int y:v[x]){
		if(y==fa)continue;
		dfs(y,x),sz[x]+=sz[y];
		int cc=sz[y];
		if(f[y].find(col[x])!=f[y].end())cc-=f[y][col[x]];
		res[col[x]].push_back(cc);
		if(f[x].size()<f[y].size())swap(f[x],f[y]);
		for(auto i:f[y])f[x][i.first]+=i.second; 
	}
	f[x][col[x]]=sz[x];
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&col[i]);
	for(int i=1,x,y;i<n;i++)scanf("%d%d",&x,&y),v[x].push_back(y),v[y].push_back(x);
	dfs(1,0);
	for(int i=1;i<=n;i++)res[i].push_back(n-f[1][i]);
	for(int i=1;i<=n;i++){
		ll ans=sqr(n);
		for(auto j:res[i])ans-=sqr(j);
		printf("%lld\n",ans);
	}
	return 0;
}

Measured memory_bytes: 79324
import sys
input = sys.stdin.readline
X,Y,A,B,C = map(int,input().split())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
R = list(map(int,input().split()))
PQ = [(p,0) for p in P] + [(q,1) for q in Q]
PQ.sort(key=lambda x:x[0])
R.sort()
ans = x = y = z = 0
while x+y+z < X+Y:
    if x==X:
        while PQ[-1][1]==0:
            PQ.pop()
    if y==Y:
        while PQ[-1][1]==1:
            PQ.pop()
    if R and R[-1] > PQ[-1][0]:
        a = R.pop()
        z += 1
    else:
        a,k = PQ.pop()
        if k:
            y += 1
        else:
            x += 1
    ans += a
print(ans)

Measured memory_bytes: 35084
H, W, K = [int(x) for x in input().split()]
A = []
for i in range(H):
  A.append([str(x) for x in list(input())])
ans = 0
for il in range(1<<H):
  for jl in range(1<<W):
    black = 0
    for i in range(H):
      for j in range(W):
        if ((((il>>i) & 1)==0) and (((jl>>j) & 1)==0) and (A[i][j] == '#')):
            black += 1
    if(black == K):
            ans += 1
print(ans)

Measured memory_bytes: 9160
N,x = map(int,input().split())
a = list(map(int,input().split()))

res = 0
if a[0]>x:
    res = a[0]-x
    a[0] = x
for i in range(1,N):
    tmp = a[i]+a[i-1]-x
    if tmp > 0:
        a[i] -= tmp
        res += tmp
print(res)




Measured memory_bytes: 14152
#include <bits/stdc++.h>
using namespace std;
using ll=long long;using ull=unsigned ll;
using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;
using P=pair<int,int>;using PL=pair<ll,ll>;
const int INF=1<<30,MOD=1000000007;const ll LINF=1ll<<60;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...) _overload3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define REPARR(i,v) for(int i=0;i<v.size();++i)
#define all(v) (v).begin(),(v).end()
#define uniq(v) sort(all(v));v.erase(unique(all(v)),v.end())
#define bit(n) (1ll<<(n))
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;}
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"":"im")<<"possible"<<endl
#define Poss(n) cout<<((n)?"P":"Imp")<<"ossible"<<endl
template<typename T>ostream&operator<<(ostream&o,const vector<T>&v){for(T i:v)o<<i<<' ';return o;}
template<typename T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<typename T>ostream&operator<<(ostream&o,const set<T>&v){for(T i:v)o<<i<<' ';return o;}
template<typename T,typename U>ostream&operator<<(ostream&o,const pair<T,U>&v){o<<v.first<<' '<<v.second;return o;}

int main(){
    int n;
    cin>>n;
    int ma=0,su=0;
    REP(i,n){
        int l;
        cin>>l;
        su+=l;
        chmax(ma,l);
    }
    cerr<<su<<' '<<ma<<endl;
    Yes(su-ma>ma);

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#define MAX_W 20
#define MAX_H 20

using namespace std;

char field[MAX_H][MAX_W];
int W, H, count;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

void dfs(int x, int y)
{
  for(int i = 0; i < 4; i++)
    {
      int nx, ny;
      nx = x + dx[i], ny = y + dy[i];
      if(nx >= 0 && nx < H && ny >= 0 && ny < W && field[nx][ny] == '.')
	{
	  field[nx][ny] = '#';
	  count++;
	  dfs(nx, ny);
	}
    }
  return;
}

void solve()
{
  int sx, sy;
  count = 0;
  //????§????????????¢???
  for(int i = 0; i < H; i++)
    for(int j = 0; j < W; j++)
      if(field[i][j] == '@')
      {
	sx = i; sy = j;
	break;
      }
  //???????????¨?????????'#'??????????????????
  field[sx][sy] = '#';
  count++;

  //??±???????????¢?´¢??§????§??????????????§??????§????????????????????°?????°??????
  dfs(sx, sy);
}

int main()
{
  while(1)
  {
    scanf("%d %d\n", &W, &H);
    if( W == 0 && H == 0) break;
    //??°?????????????????°field????????????
    for(int i = 0; i < MAX_H; i++)
      for(int j = 0; j < MAX_W; j++)
	field[i][j] = 'X';
    for(int i = 0; i < H; i++)
    {
      scanf("%s",field[i]);
    }
    solve();
    printf("%d\n", count);
  }
  return 0;
}

Measured memory_bytes: 2620
#include<stdio.h>

int main(void)
{
  int n;
  scanf("%d",&n);
  int l[n];
  int sum=0;
  for(int i=0;i<n;i++){
    scanf("%d",&l[i]);
  }
  for(int i=0;i<n-1;i++){
    if(l[i]>l[i+1]){
      int tmp=l[i];
      l[i]=l[i+1];
      l[i+1]=tmp;
    }
  }

  for(int i=0;i<n-1;i++){
    sum+=l[i];
  }
  if(l[n-1]<sum){
    puts("Yes");
  }else{
    puts("No");
  }
  return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main()
{
    int a,b,c,d,sum=0;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    if(a>=b)
    {
       sum=sum+b*c;
       sum=sum+(a-b)*d;
       printf("%d\n",sum);
    }
    else
    {
        sum=sum+a*c;
        printf("%d\n",sum);
    }return 0;
}


Measured memory_bytes: 1656
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)

int n, m, d;

int main() {

	scanf("%d%d%d", &n, &m, &d);

	double p = (m - 1) * 2.0 / n / n;

	if (d) printf("%f\n", p * (n - d ));
	else printf("%f\n", p * n / 2.0);

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int W,H,x,y,r,a,b,c,d;
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
    a=x-r;
    b=x+r;
    c=y-r;
    d=y+r;
    if(a<0){
        printf("No\n");
    }
    else if(b>W){
        printf("No\n");
    }
    else if(c<0){
        printf("No\n");
    }
    else if(d>H){
        printf("No\n");
    }
    else{
        printf("Yes\n");
    }
    return 0;
}


Measured memory_bytes: 2100
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<string>
#include <iomanip>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<complex>
#include<ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

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; }

using Graph=vector<vector<ll>>;

#define ketasitei setprecision(15) //15桁表示

const ll MOD = 1000000007;


int main(void)

{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << ketasitei;
	
	ll n, x, y;
	cin >> n >> x >> y;

	vector<vector<ll>> g(n, vector<ll>(n, INF));

	g[x - 1][y - 1] = 1;

	vector<ll> ans(n, 0);
	ll tmp = 0;


	for (ll i = 1; i <= n-1; i++)
	{
		for (ll j = i + 1; j <= n; j++)
		{
			if (i <= x && y <= j)
			{
				tmp = (x - i) + 1 + (j - y);
			}
			else if (x <= i && y <= j)
			{
				tmp = min((i - x) + 1 + j - y, j - i);
			}
			else if (i <= x && j <= y)
			{
				tmp = min(y - j + 1 + x - i, j - i);
			}
			else if (x <= i && j <= y)
			{
				tmp = min(i - x + 1 + y - j, j - i);
			}
			else
				tmp = j - i;
			ans[tmp]++;
		}
	}

	for (int i = 1; i < n; i++)
	{
		cout << ans[i] << endl;
	}

	
	return 0;
}

Measured memory_bytes: 31616