akhauriyash/Code-Regression huggingface dataset:
import numpy as np
def cumsum(x):
    return list(np.cumsum(x))

def cumsum_number(N,K,x):
    ans=[0]*(N-K+1)
    number_cumsum = cumsum(x)
    number_cumsum.insert(0,0)
    for i in range(N-K+1):
        ans[i]=number_cumsum[i+K]-number_cumsum[i]
    return ans
"""
int #整数
float #小数

#for
for name in fruits: #fruitの頭から操作
    print(name)

#リスト
list0 = [] #リスト生成
list0 = [1,2,3,4] #初期化
list0 = [0]*10 #[0,0,0,0,0,0,0,0,0,0]
list1= [i for i in range(10)] #>>> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
list1 = list(map(int, input().split()))　# 複数の入力をリストに入れる
number=[int(input()) for i in range(int(input()))] #複数行の入力をリストに
list1 = list1 + [6, 7, 8] #リストの追加
list2.append(34) #リストの追加　最後に（）内が足される
list.insert(3,10) #リストの追加　任意の位置（追加したい位置,追加したい値）
len(list4) #リストの要素数
max(sa) #list saの最小値
list5.count(2) #リスト(文字列も可）内の2の数
list1.sort() #並び替え小さい順
list1.sort(reverse=True)  #並び替え大きい順
set(list1) #list1内の重複している要素を削除し、小さい順に並べる
sum([2,3,   ,3]) #リストの合計

abs(a) #aの絶対値
max(a,b) min(a,b) #最大値　最小値
text1 = text1.replace("34","test") #text1内の"34"を"test"に書き換える(文字列内の文字を入れ替える)

exit(0) #強制終了

cumsum(リスト) #累積和をリストで返す
cumsum_number(N,K,x) #N個の数が含まれるリストx内のK個からなる部分和をリストで返す
"""
X=int(input())
Y=100
ans=0
while Y<X:
    Y=Y+Y//100
    ans += 1
print(ans)

Measured memory_bytes: 27188
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

vector<int> Zalgo(const string &S) {
  int N = (int)S.size();
  vector<int> res(N);
  res[0] = N;
  int i = 1, j = 0;
  while(i < N) {
    while(i + j < N && S[j] == S[i + j]) ++j;
    res[i] = j;
    if(j == 0) {
      ++i;
      continue;
    }
    int k = 1;
    while(i + k < N && k + res[k] < j) res[i + k] = res[k], ++k;
    i += k, j -= k;
  }
  return res;
}

int main() {
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  rep(i, n) {
    string t = s.substr(i, n - i);
    vi z = Zalgo(t);
    rep(j, z.size()) {
      int mn = min(j, int(z.size()) - j);
      ans = max(ans, min(mn, z[j]));
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<ll,ll>;
using PP=pair<ll,P>;
using vp=vector<P>;
using vpp=vector<PP>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
int main(){
    int n,a,b;
    cin>>n>>a>>b;
    cout<<min(a,b)<<" "<<max(0,a+b-n)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
#include <tuple>

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define co(x) cout << (x) << "\n"
#define pb push_back
#define Never
#define To

using namespace std;

int main(){

	cin.tie(0);
	ios::sync_with_stdio(false);

	long long A, B, K;

	cin >> A >> B >> K;

	cout << max(0LL, A - K ) << " " << min(B, max(0LL, A + B - K )) << endl;

	Never To return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <bitset>

using namespace std;
typedef long long ll;

ll f(ll a, ll b) {
	if (a >= b) {
		return (a + b) % 2;
	}
	return b - a;
}

int main() {
	int N; cin >> N;
	ll* A = new ll[N];
	ll inf = 0;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		inf += A[i]; inf++;
	}

	ll* D1 = new ll[N];
	ll* D2 = new ll[N];
	ll* D3 = new ll[N];
	ll* D4 = new ll[N];
	ll* D5 = new ll[N];
	for (int i = 0; i < N; i++) { D1[i] = inf; }
	for (int i = 0; i < N; i++) { D2[i] = inf; }
	for (int i = 0; i < N; i++) { D3[i] = inf; }
	for (int i = 0; i < N; i++) { D4[i] = inf; }
	for (int i = 0; i < N; i++) { D5[i] = inf; }

	D1[0] = A[0];
	for (int i = 1; i < N; i++) {
		D1[i] = D1[i - 1] + A[i];
	}

	D2[0] = min(D1[0], f(A[0], 2));
	for (int i = 1; i < N; i++) {
		D2[i] = min(D1[i], D2[i - 1] + f(A[i], 2));
	}

	D3[0] = min(D2[0], f(A[0], 1));
	for (int i = 1; i < N; i++) {
		D3[i] = min(D2[i], D3[i - 1] + f(A[i], 1));
	}

	D4[0] = min(D3[0], f(A[0], 2));
	for (int i = 1; i < N; i++) {
		D4[i] = min(D3[i], D4[i - 1] + f(A[i], 2));
	}

	D5[N - 1] = A[N - 1];
	for (int i = N - 2; i >= 0; i--) {
		D5[i] = D5[i + 1] + A[i];
	}

	ll m = inf * N;
	for (int i = 0; i <= N; i++) {
		ll x = 0;
		if (i > 0) { x += D4[i - 1]; }
		if (i < N) { x += D5[i]; }
		m = min(m, x);
	}

	cout << m << endl;

	return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
const int max_n = 1000;
ll t[max_n];
ll gcd(ll a, ll b){
  if(b == 0) return a;
  return gcd(b, a%b);
}
void solve(){
  ll lcm = t[0];
  for(int i=1 ; i<n ; i++){
    ll lcmn = gcd(lcm, t[i]);
    lcm = (lcm/lcmn)*t[i];
  }
  cout << lcm << endl;
}
int main(){
  cin >> n;
  for(int i=0 ; i<n ; i++){
    cin >> t[i];
  }
  sort(t, t+n);
  reverse(t, t+n);
  solve();
  return 0;
}


Measured memory_bytes: 256
N = int(input())

p = N % 10

if p == 0:
    print("pon")
elif p == 1:
    print("pon")
elif p == 2:
    print("hon")
elif p == 3:
    print("bon")
elif p == 4:
    print("hon")
elif p == 5:
    print("hon")
elif p == 6:
    print("pon")
elif p == 7:
    print("hon")
elif p == 8:
    print("pon")
elif p == 9:
    print("hon")

Measured memory_bytes: 9080
import numpy as np

N, M, C = map(int, input().split())
M=[int(x) for x in input().split()]
nlist=[]

for i in range(N):
    nlist.append([int(x) for x in input().split()])

nlist=np.array(nlist)
M= np.array(M)
ans=(nlist*M).sum(axis=1)+C
print((ans>0).sum())

Measured memory_bytes: 12448
n,x=map(int,input().split())
if x==1 or x==2*n-1:
    print("No")
else:
    print("Yes")
    if n==2:
        b=[1,2,3]
    else:
        if x==2:
            b=[i for i in range(2*n-1,n,-1)]+[i for i in range(1,n+1)]
        elif x==2*n-2:
            b=[i for i in range(n,2*n)]+[i for i in range(n-1,0,-1)]
        else:
            a=[i for i in range(1,2*n)]
            temp=[x+1,x-1,x,x+2,x-2]
            for t in temp:
                a.remove(t)
            b=a[:n-2]+temp+a[n-2:]
    for i in b:
        print(i)

Measured memory_bytes: 14584
"""
あなたは、X 円を持ってケーキとドーナツを買いに出かけました。
あなたはまずケーキ屋で 1 個 A 円のケーキを 1 個買いました。 次に、ドーナツ屋で 1 個 B 円のドーナツをできるだけたくさん買いました。
これらの買い物のあと手元に残っている金額は何円ですか。
"""

def buying_sweets(money,p_cake,p_dounuts):
    t_money  = money - p_cake
    c_dounuts = t_money // p_dounuts
    p_after_money = t_money - (c_dounuts * p_dounuts)
    return p_after_money

money = int(input())
p_cake = int(input())
p_dounuts = int(input())
print(buying_sweets(money,p_cake,p_dounuts))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    ll a, b, x;
    cin >> a >> b >> x;
    ll ans = b/x - a/x + (a%x==0); 
    cout << ans << endl;
    //printf("%.12f", ans);
}

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

int N,K;

int main() {
    cin >> N >> K;
    if(K > (N-1)*(N-2)/2){
        cout << -1 << endl;
        return 0;
    }
    cout << N-1 + (N-1)*(N-2)/2 - K << endl;
    for(int i=0; i<N-1; i++) cout << 1 << " " << i+2 << endl;
    int nokori = (N-1)*(N-2)/2 - K;
    for(int i=1; i<N; i++){
        for(int j=i+1; j<N; j++){
            if(nokori == 0) break;
            cout << i+1 << " " << j+1 << endl;
            nokori--;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>

using namespace std;

int main() {

    int N;
    cin >> N;
    string S,T;
    cin >> S >> T;
    string out = "";
    for(int i=0;i<N;i++){
        out = out+S[i]+T[i];
    }
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 256
List = [int(input()) for _ in range(5)]

counter = 0

sub_List = [(List[i] - 1) % 10 for i in range(5)]

sub_List = sorted(enumerate(sub_List), key=lambda x: x[1])

for i in range(5):
  if i != sub_List[0][0]:
    counter += ((List[i]-1)//10+1)*10

counter += List[sub_List[0][0]]

print(counter)

Measured memory_bytes: 3064
S=set(input())
A={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"}
D=sorted(list(A-S))
if len(D)==0:
  print("None")
else:
  print(D[0])

Measured memory_bytes: 3188
#![allow(unused_imports)]
// use itertools::Itertools;
use proconio::{input, marker::*};

fn main() {
    input! {
        n: usize,
        aa: [Usize1; n]
    };
    let mut v = vec![false; n];
    v[0] = true;
    let mut a = aa[0];
    let mut count = 1;
    loop {
        if a == 1 {
            println!("{}", count);
            return;
        }
        if v[a] {
            println!("-1");
            return;
        }
        v[a] = true;
        a = aa[a];
        count += 1;
    }
}


Measured memory_bytes: 3556
#include <iostream>
#include <vector>

using namespace std;

int partition(vector<int>& A, int p, int r) {
	int x = A[r];
	int ind = p-1;
	for (int i = p; i < r; ++i) {
		if (A[i] <= x) {
			++ind;
			swap(A[i],A[ind]);
		}
	}
	swap(A[r],A[ind+1]);
	return (ind+1);
}

int main(void) {
	int n;
	cin >> n;
	vector<int> A(n);
	for (int i = 0; i < n; ++i) {
		cin >> A[i];
	}
	int ind = partition(A,0,n-1);
	for (int i = 0; i < n; ++i) {
		if (i == ind) {
			cout << "[";
			cout << A[i];
			cout << "]";
		}
		else {
		cout << A[i];
		}
		if (i < n-1) {
			cout << " ";
		}
	}
	cout << endl;

	return 0;
}



Measured memory_bytes: 3104
N, M = map(int, input().split())
t = 100 * N + 1800 * M
total = 0
i = 1
p = 1 / 2**M
while True:
    d = i * (1-p)**(i-1) * p * t
    total += d
    if d < 0.001:
        break
    i += 1
print(round(total))

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define lli long long int 
int main()
{lli n,k,i,val,wt,j;
 cin>>n>>k;
 lli ar[n][2];
 for(i=0;i<n;i++)
 {cin>>val>>wt;
 ar[i][0]=val;
 ar[i][1]=wt;
 }
 lli dp[n][k+1];
 for(i=0;i<n;i++)
 {dp[i][0]=0;
 }
 for(j=0;j<=k;j++)
 { if(ar[0][0]>j)
 {dp[0][j]=0;
 }
  else
  {dp[0][j]=ar[0][1];
  }
 }
 for(i=1;i<n;i++)
 {for(j=1;j<=k;j++)
 { if(j<ar[i][0])
 {dp[i][j]=dp[i-1][j];
 }
  else
  {dp[i][j]=max(dp[i-1][j],ar[i][1]+dp[i-1][j-ar[i][0]]);
  }
 }
 }
cout<<dp[n-1][k]<<"\n";
return 0;
}
 

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


int main(){
  string S ; 
  cin >> S ; 
  int N = S.size() ; 
  int cnt = 0 ; 
  
  for(int i = 0 ; i < N ; i++){
    if(S.at(i) == '+'){
      cnt++ ; 
    }
    else{
      cnt-- ; 
    }
  }
  
  cout << cnt << endl;
  
}

Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;


const int MAX_N = 100010;


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int x; cin >> x;
	if (x < 100) {
		cout << 0 << endl;
	}
	else {
		string tmp = to_string(x);
		int now = (tmp[tmp.size() - 2]-'0')*10 + (tmp[tmp.size() - 1]-'0');
		int now2 = (x - now) / 100;
		if (now <= now2 * 5) {
			cout << 1 << endl;
		}
		else cout << 0 << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    long long n,m=0,a,b;
    cin>>n>>b;
    if(b>0){
        cout<<-1<<endl;
        return 0;
    }
    for(int i=0;i<n-1;i++){
        cin>>a;
        if(a>b+1){
            cout<<-1<<endl;
            return 0;
        }else if(a<=b){
            m+=b;
        }
        if(i==n-2){
            m+=a;
        }
        b=a;
    }
    cout<<m<<endl;
    return 0;
}


Measured memory_bytes: 256
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
ans = 0
for i in range(1, n+1):
    temp = i
    cnt = 0
    while temp > 0:
        temp //= 10
        cnt += 1

    if cnt % 2:
        ans += 1

print(ans)

Measured memory_bytes: 3064
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<deque>
#include<cstdio>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 1000000;
const int mod = 998244353;
const int INF = 1 << 30;
#define rep(i,n) for(ll i=(ll)0;i<(ll)n;++i)
#define ALL(x) x.begin(),x.end()
#define pp pair<ll,ll>
#define fi first
#define se second
#define pb push_back
#define fix(n) fixed<<setprecision(n)
#define itr vector<ll>::iterator
ll a, b, ans;
int main() {
	cin >> a >> b;
	rep(i, a+1)rep(j, a+1) {
		if (b - i - j <= a&&b-i-j>=0) { ++ans;  }
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
s = ''
for a in A:
    s += str(a) + ' '
print(s.rstrip())

for i in range(1, N):
    for j in range(0, i):
        if A[i] < A[j]:
            A.insert(j, A.pop(i))
            break
    s = ''
    for a in A:
        s += str(a) + ' '
    print(s.rstrip())



Measured memory_bytes: 5596
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

void b_string_rotation(void) {
	string s, t;
	string msg = "No";
	cin >> s >> t;

	for (int i = 0; i < s.size(); i++) {
		s = s[s.size() - 1] + s.substr(0, s.size()-1);
		//cout << s << endl;
		if (s == t) {
			msg = "Yes";
			break;
		}
	}

	cout << msg << endl;
}

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

Measured memory_bytes: 3620
N, M, X, Y = map(int, input().split())
lst_x = list(map(int, input().split()))
lst_y = list(map(int, input().split()))

if min(lst_y)<=max(lst_x):
    print('War')
else:
    if Y<=max(lst_x) or min(lst_y)<=X:
        print('War')
    else:
        print('No War')

Measured memory_bytes: 3060
#include<stdio.h>
#include<string.h>
int main()
{
	int c[8],i,j,k,t;
	for(i=0;~scanf("%d",&c[i++]);)
	{
		if(i==8)
		{
			int m[8]={1,4,1,4,1,2,1,2},r[8]={9},w=1<<30;
			for(j=0;j<8;j++)
			{
				t=m[0];
				memmove(m,m+1,7*4);
				m[7]=t;
				for(k=t=0;k<8;k++)
					t+=c[k]-m[k]<=0?0:c[k]-m[k];
				if(w>t||(w==t&&memcmp(m,r,32)<0))
					w=t,memcpy(r,m,32);
			}
			for(j=0;j<8;j++)
				printf("%d%s",r[j],j==7?"\n":" ");
			i=0;
		}
	}
	return 0;
}

Measured memory_bytes: 632
n,k=map(int,input().split())
s=input()
t=s[0]
c=[-1,1][s[0]=="R"]
d=[]
k*=2
for i in s[1:]:
    if t!=i and k==0:
        d.append(c)
        c=0
    elif t!=i:
        k-=1
        c*=-1
    t=i
    c+=[-1,1][i=="R"]
d.append(c)
c=len(d)
chk=0
ans=0
for i in d:
    if (i>0 and chk>0) or (i<0 and chk<0):
        chk+=i
    else:
        if chk!=0: ans+=abs(chk)-1
        chk=i
print(ans+(abs(chk)-1))

Measured memory_bytes: 45936
#include <iostream>
  #include <complex>
  #include <vector>
  #include <string>
  #include <algorithm>
  #include <cstdio>
  #include <numeric>
  #include <cstring>
  #include <ctime>
  #include <cstdlib>
  #include <set>
  #include <map>
  #include <unordered_map>
  #include <unordered_set>
  #include <list>
  #include <cmath>
  #include <bitset>
  #include <cassert>
  #include <queue>
  #include <stack>
  #include <deque>
 #include <iomanip>
 
  using namespace std;
   

//abcdefghijklmnopqrstuvwxyz
//ABCDEFGHIJKLMNOPQRSTUVWXYZ
  typedef long long ll;
  typedef long double lld;
//   typedef string str;
//   typedef unsigned long long ull;
  ll INF = INT_MAX;
  ll mod = 1000000007;
  // lld PI = 3.141592653;

// const int N = 2e5 + 5;

// int a[N];
// int n,k;
  
 

  int main()
  {
      ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
      int n;
      cin>>n;
      ll r=0,g=0,b=0;
      string s;
      cin>>s;
      for (int i = 0;i<n;i++){
        if (s[i]=='R'){
          r++;
        }else if (s[i]=='G'){
          g++;
        }else{
          b++;
        }

      }
      ll no = 0;
      for (int i = 0;i<n;i++){
        for (int j = i;j<n;j++){
          int k = j+ j-i;
          if (k<n && s[i]!=s[j] && s[i]!=s[k] && s[j]!=s[k]){ no++;}
        }
      }

      no = r*g*b-no;
      cout<<no<<"\n";
}
  

Measured memory_bytes: 3200
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF (LLONG_MAX - 1e5)

using namespace std;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    string A;
    cin >> A;
    map<char, int> cnt;
    REP(i, A.size()) {
        char c = A[i];
        cnt[c]++;
    }

    int ans = A.size() * (A.size() - 1) / 2 + 1;
    for (auto kv: cnt) {
        if (kv.second == 1) continue;
        ans -= kv.second * (kv.second - 1) / 2;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 720
#include<bits/stdc++.h>
 
using namespace std;
 
long long arr[10000007] ;
 
int main()
{
    long long n , sum = 0 , i , j  ;
    cin>>n;
    for ( i=1 ; i<=n ; i++)
    {
                 for ( j = i ; j<=n ; j+= i )
                 {
                              arr[j]++;
                 }
    }

    for (i=1 ; i<=n ; i++)
    {
                 sum += (arr[i])*i ;
    }
   cout<<sum;
    return 0;
}

Measured memory_bytes: 81680
#include <iostream>
//#include <iomanip>
#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <math.h>
#include <vector>
//#include <string>
//typedef long long LL;
using namespace std;

int main(){
    int n;
    vector<int> l;
    int tmp_l;
    int ans=0;
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> tmp_l;
        l.push_back(tmp_l);
    }
    sort(l.begin(),l.end());
    for(int i=n-1; i>=2; i--){
        for(int j=i-1; j>=1; j--){
            for(int k=j-1; k>=0; k--){
                if(l[i]<l[j]+l[k]){
                    ans++;
                }else{
                    break;
                }
            }
        }
    }
    cout << ans << endl;
}


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

using namespace std;


using int64 = long long;
const int mod = 1e9 + 7;
// const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


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

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
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< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int A, B, M;
  cin >> A >> B >> M;
  vector< int > x(A), y(B);
  cin >> x >> y;
  int ret = *min_element(begin(x), end(x)) + *min_element(begin(y), end(y));
  for(int i = 0; i < M; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    --a, --b;
    chmin(ret, x[a] + y[b] - c);
  }
  cout << ret << endl;
}

Measured memory_bytes: 1024
#include <iostream>

int main() {
	int N, M;
	std::cin >> N >> M;
	int gcd = M / N;
	for (; gcd > 1&&M%gcd; --gcd) {
		if (M > gcd*N) {
			if ((M - gcd * N) % gcd == 0)break;
		}
	}
	printf("%d", gcd);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1e5+5;

string ans, s[sz];

int main()
{
    int n, a, b, c;
    cin >> n >> a >> b >> c;

    bool yes = 1;
    for(int i=0; i<n; i++) cin >> s[i];
    for(int i=0; i<n; i++) {
        if(s[i] == "AB") {
            if(a < b) ans += 'A', a++, b--;
            else if(a > b) ans += 'B', b++, a--;
            else if(!c && s[i+1] == "AC") ans += 'A', a++, b--;
            else ans += 'B', b++, a--;
        }
        else if(s[i] == "BC") {
            if(b < c) ans += 'B', b++, c--;
            else if(b > c) ans += 'C', c++, b--;
            else if(!a && s[i+1] == "AB") ans += 'B', b++, c--;
            else ans += 'C', c++, b--;
        }
        else {
            if(c < a) ans += 'C', c++, a--;
            else if(c > a) ans += 'A', a++, c--;
            else if(!b && s[i+1] == "BC") ans += 'C', c++, a--;
            else ans += 'A', a++, c--;
        }
        if(a < 0 || b < 0 || c < 0) yes = 0;
    }

    if(yes) {
        puts("Yes");
        for(char x : ans) printf("%c\n", x);
    }
    else puts("No");
}


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

int main() {
  ll n, d;
  cin >> n >> d;
  ll cnt = 0;
  for (ll i = 0; i < n; i++) {
    ll x, y;
    cin >> x >> y;
    if (x * x + y * y <= d * d) cnt++;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>


using namespace std;

int main(){

	long N, K;

	cin >> N >> K;
	vector<long> p;
	vector<long> m;

	for(long i=0;i<N;i++){
		long x;
		cin >> x;
		if(x == 0){
			K--;
		} else if( x > 0){
			p.push_back(x);
		} else {
			m.push_back(-x);
		}
	}

	sort(m.begin(), m.end());
	sort(p.begin(), p.end());
	long ans, minv = 0;

	for(long i = 0; i <= K; i++){
		long j = K - i;
		if(! ( i <= p.size() && j <= m.size())){
			continue;
		}
		long pv, mv;
		if(i > 0){
			pv = p[i-1];
		} else {
			pv = 0;
		}
		if(j > 0){
			mv = m[j-1];
		} else {
			mv = 0;
		}
		ans = 2 * 	min(pv, mv);
		ans += 			max(pv, mv);

		if( minv == 0 || minv > ans){
			minv = ans;
		}
	}

	cout << minv << endl;

	return 0;
}



Measured memory_bytes: 1656
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


///////////////////////////

ll N,K;

vector<vector<ll>> g;

vector<ll> num;

vector<ll> inf;
vector<ll> sup;
vector<ll> see;

bool dfs(ll v) {
	see[v] = 1;

	vector<ll> I;
	vector<ll> S;
	for (ll w : g[v]) {
		if (see[w] == 1) { continue; }
		if (dfs(w) == 0) { return 0; };

		if (inf[w] != -INF) { I.push_back(inf[w] - 1); }
		if (sup[w] != INF) { S.push_back(sup[w] + 1); }
	}

	if (num[v] != -1) {
		I.push_back(num[v]);
		S.push_back(num[v]);
	}

	rep(i, I.size()) {
		if (I[0] % 2 != I[i] % 2) { return 0; }
		inf[v] = max(inf[v], I[i]);
	}

	rep(i, S.size()) {
		if (S[0] % 2 != S[i] % 2) { return 0; }
		sup[v] = min(sup[v], S[i]);
	}

	if (inf[v] > sup[v]) { return 0; }

	return 1;

}

int main() {

	cin >> N;

	g.resize(N + 1);
	
	repn(i,N-1){
		ll a, b;
		cin >> a >> b;
		g[a].push_back(b);
		g[b].push_back(a);
	}

	cin >> K;
	num.assign(N + 1, -1);

	repn(i, K) {
		ll v, p;
		cin >> v >> p;
		num[v] = p;
	}

	inf.assign(N + 1, - INF);
	sup.assign(N + 1, INF);
	see.assign(N + 1, 0);
	
	if (dfs(1) == 0) { cout << "No"; }

	else {

		cout << "Yes" << endl;

		queue<ll> q;

		vector<ll> ans(N + 1,-1);

		ans[1] = inf[1];

		q.push(1);

		while (!q.empty()) {
			ll v = q.front();
			q.pop();

			for (ll w : g[v]) {
				if (ans[w] != -1) { continue; }
				
				if (inf[w] <= ans[v] + 1 && ans[v] + 1 <= sup[w]) { ans[w] = ans[v] + 1; }
				else { ans[w] = ans[v] - 1; }

				q.push(w);
			}
		}

		repn(i, N) cout << ans[i]<<endl;

	}
	system("PAUSE");

}





Measured memory_bytes: 25984
n = int(input())
l = list(map(int,input().split()))
cou = 0
for i in l:
  if '-' in str(i):
    cou += 1
if cou%2==0:
  c =0 
  for i in l:
    c += abs(i)
else:
  l = [abs(i) for i in l]
  c = sum(l)-2*min(l)
print(c)

Measured memory_bytes: 14208
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};

ll ans = INF;
int main() {
    ll N,A,B,C;
    cin >>N>>A>>B>>C;
    vector<ll>l(N);

    rep(i,N)cin>>l[i];

    rep(i,(1<<(N*2))){
        vector<ll> S(N);
        ll tmp = i;
        rep(j,N){
            S[j]=tmp%4;
            tmp /= 4;
        }
        ll a=0,b=0,c=0;
        ll now = -30;
        rep(j,N){
            if(S[j] == 0){
                a+=l[j];
                now +=10;
            }else if(S[j] == 1){
                b+=l[j];
                now +=10;
            }else if(S[j] == 2){
                c+=l[j];
                now +=10;
            }
        }
    //cout<<a<<" "<<b<<" "<<c<<endl;
        if(a==0 || b==0 || c== 0)continue;
        now += abs(A-a)+abs(B-b)+abs(C-c);
        chmin(ans,now);
        
        
    }
    cout << ans << endl;


    return 0;
    

}

Measured memory_bytes: 3608
#include <cstdio>

int main()
{
    char s[1000];

    while (true)
    {
        scanf("%s", s);
        if (s[0] == '0')
            break;
        int sum = 0;

        for (int i = 0; s[i] != '\0'; i++)
        {
            sum += s[i] - '0';
        }
        printf("%d\n", sum);
    }

    return 0;
}


Measured memory_bytes: 2752
#include <iostream>
#include <map>
#include <stack>
#include <set>
#include <string>
#include <cstring>
#include <queue>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <sstream>
using namespace std;

int a,b;
int main(){
    cin>>a>>b;
    if(a%3==0||b%3==0||(a+b)%3==0) cout <<"Possible"<<endl;
    else cout <<"Impossible"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<cstring>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<algorithm>
#include<vector>
#define ll long long
#define maxn 105
#define p 1000000007
#define inf 0x3f3f3f3f
using namespace std;
int n,h[maxn],root,tot=1;
int si[maxn],a[maxn];
ll f[maxn][2];// f[maxn][0]è¡¨ç¤ºéžé»‘ç™½ç›¸é—´
vector<int> c[maxn];

inline int read()
{
	int num,sign=1;
	char c;
	while((c=getchar())<'0'||c>'9')
		if(c=='-')sign=-1;
	num=c-'0';
	while((c=getchar())>='0'&&c<='9')
		num=(num<<1)+(num<<3)+c-'0';
	return num*sign;
}

void build(int l,int r,int id)
{
	int minheight=inf,top=0;
	int st[maxn];
	si[id]=r-l+1;
	for(register int i=l;i<=r;++i)
	{
		if(h[i]<=minheight)
		{
			if(h[i]<minheight)
			{
				top=0;
				minheight=h[i];
				st[++top]=i;
			}
			else
				st[++top]=i;
		}
	}
	st[++top]=r+1,a[id]=minheight;
	int lastgo=l;
	for(register int i=1;i<=top;++i)
	{
		if(st[i]==lastgo)
		{
			++lastgo;
			continue;
		}
		++tot;
		c[id].push_back(tot);
		build(lastgo,st[i]-1,tot);
		lastgo=st[i]+1;
	}
}

inline ll ksm(ll a,ll b)
{
	ll res=1;
	while(b)
	{
		if(b&1)res=(res*a)%p;
		b>>=1;
		a=(a*a)%p;
	}
	return res;
}

void dfs(int u,int lasth)
{
	int sum=si[u];
	int H=a[u]-lasth;
	f[u][1]=2,f[u][0]=1;
	for(register int i=0;i<c[u].size();++i)
	{
		int v=c[u][i];
		dfs(v,a[u]);
		f[u][0]=(f[u][0]*((f[v][1]+f[v][0])%p)%p+(f[u][0]*f[v][1])%p)%p;
		f[u][1]=(f[v][1]*f[u][1])%p;
		sum-=si[v];
	}
	f[u][0]=((f[u][0]*ksm(2,sum))%p+(p-f[u][1])%p)%p;
	f[u][1]=(f[u][1]*ksm(2,H-1))%p;
}

int main()
{
	n=read();
	for(register int i=1;i<=n;++i)h[i]=read();
	build(1,n,1);
	dfs(1,0);
	printf("%lld\n",(f[1][0]+f[1][1])%p);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
  
int N;
int ans = 0;
  
// 3, 5, 7を組み合わせて作れる数値を全探索
void dfs(ll x, bool flag3, bool flag5, bool flag7) {
  if (x > N) return;
  // 3, 5, 7をすべて含むならansに+1
  if (flag3 && flag5 && flag7) ans++;
  
  dfs(10 * x + 3, true, flag5, flag7);
  dfs(10 * x + 5, flag3, true, flag7);
  dfs(10 * x + 7, flag3, flag5, true);
}
  
int main() {
  // 入力
  cin >> N;
  
  // 深さ優先探索
  dfs(0, 0, 0, 0);
  
  // 出力
  cout << ans << endl;
}

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

int main() {
  int n;
  cin >> n;
  int s[n] = {0};
  for (int i = 0; i < n - 1; i++) {
    int a;
    cin >> a;
    s[a-1]++;
  }
  for (int i = 0; i < n; i++) {
    cout << s[i] << '\n';
  }
}

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

int solve(int n,int x){
    int res=0;
    for(int i=1;i<=n;i++){
        for(int j=i+1;j<=n;j++){
            for(int k=j+1;k<=n;k++){
                if(i+j+k==x) res++;
            }
        }
    }
    return res;
}
int main(){
    int n,x;
    cin>>n>>x;
    while(n!=0||x!=0){
        cout<<solve(n,x)<<endl;
        cin>>n>>x;
    }
    return 0;
}


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

public class Main {


	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		String s = sc.next();
		String t = sc.next();
		int a = sc.nextInt();
		int b = sc.nextInt();
		String u = sc.next();
		
		if(s.equals(u))a--;
		else b--;
		pw.print(a + " " + b);
		pw.close();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public Scanner(String file) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

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

		public String nextLine() throws IOException {
			return br.readLine();
		}

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

		public boolean ready() throws IOException {
			return br.ready();
		}

	}
}


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

using namespace std;

const int N=1e6+3;

#define pb push_back
#define all(x) (x).begin(),(x).end()
typedef long long ll;

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

const int inf=1e9;

int n,m,a[N],k,q,u,v,x,y,tc,c,l,r,ans,cnt,root[N],sz[N];

char s[N];

pair<int,int> p[N];

int main(){
	
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++)
		scanf("%d %d",&p[i].first,&p[i].second);
	sort(p,p+n);
	ll ans=0;
	for(int i=0;i<n;i++){
		ll add = min(m,p[i].second);
		ans+= add * p[i].first;
		m-=add;
	}
	printf("%lld\n",ans);
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define sc(n) scanf("%d",&n)
#define scl(n) scanf("%lld",&n)
#define pr(n) printf("%d",n)
#define prl(n) printf("%lld",n)
#define nl printf("\n")
#define fr(i,n) for(i=0;i<n;i++)
#define rep(i,st,en) for(i=st;i<=en;i++)
#define repv(i,en,st) for(i=en;i>=st;i--)
#define fout cout<<fixed<<setprecision(7)
#define bi(n) __builtin_popcount(n)
#define bil(n) __builtin_popcountll(n)


typedef long long ll;
typedef pair<int,int> pii;
const int N = 100010;
ll mod = 1e9+7;
ll fmod(ll b,ll exp){
    ll res =1;
    while(exp){if(exp&1ll)res=(res*b)%mod;
    b =(b*b)%mod;exp/=2ll;
    }
    return res;
}



int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //ios_base::sync_with_stdio(false);cin.tie(NULL);
    int n,m,i,j,k,x,q;
    int t=1;
    cin>>n;
    cout<<1ll*180*1ll*(n-2)<<"\n";

    
    return 0;
}


Measured memory_bytes: 256
//CODING ME ACCHHA KARNEKA HAI TERKO TO BAS PRACTICE KARTE REH
#include <bits/stdc++.h>
#define pragma
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define aisort sort(a,a+n)
#define adsort sort(a,a+n,greater<ll>())
#define PI 2 * acos(0)

typedef pair<ll, ll> pii;
typedef pair<ll, pii> piii;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<piii> viii;
typedef set<ll> Set;

const ll maxs = 1e5+3;
const ll maxs1 = 1e3+4;
const ll mod = 1e9 + 7;

//MODULO OPEARTIONS
    inline ll add(ll a, ll b) { return (mod + a + b) % mod; }
    inline ll sub(ll a, ll b) { return (a - b + mod) % mod; }
    inline ll mul(ll a, ll b) { return (1ll * a * b) % mod; }

//POWER
    ll fastpow(ll x,ll y)
    {ll res = 1;x = x % mod;while (y > 0){ if (y & 1)res = (res * x) % mod; y = y >> 1 ; x = (x * x) % mod; } return res;}

//MODULAR INVERSE
    ll inv(ll x){ return fastpow(x , mod - 2);}
    
//PRIME
    bool isPrime(ll n) { if (n <= 1)  return false; if (n <= 3)  return true;if (n%2 == 0 || n%3 == 0) return false; for (int i=5; i*i<=n; i=i+6) if (n%i == 0 || n%(i+2) == 0) return false; return true; } 

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s,t;
    cin>>s>>t;
    ll cnt=0,i;
    for(i=0;i<s.size();i++)
    {
        if(s[i]!=t[i])
        cnt++;
    }
    cout<<cnt;
}




Measured memory_bytes: 3796
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <iomanip>
#include <cmath>
using namespace std;
using ll = long long;
#define rep(i, j, n) for(size_t i = (j); i < (n); ++i)
#define rrep(i, j, n) for(size_t i = (n) - 1; (j) <= i; --i)
constexpr ll MOD = 1000000007;
constexpr ll INF = 1LL << 60;
constexpr ll MAX = 800000;


int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n; cin >> n;
	vector<pair<ll, ll>> a;
	rep(i, 0, n) {
		ll b;
		cin >> b;
		a.emplace_back(b, i + 1);
	}
	sort(a.begin(), a.end());

	// 自分C
	// 自分よりデカい奴がいる左L
	// 自分よりデカい奴がいる右R
	// (R - C) * (C - L)回コイツは選ばれる
	ll ans = 0;
	set<ll> ids;
	ids.insert(0);
	ids.insert((ll)n + 1);
	rep(i, 0, n) {
		ll val = a[i].first;
		ll idx = a[i].second;
		// この時、自分よりデカい奴のインデックスが保存されてる
		ids.insert(idx);
		auto itr = ids.find(idx);
		int L = *--itr;
		int R = *++++itr;
		ans += (R - idx) * (idx - L) * val;
	}
	cout << ans << endl;
	return 0;

}


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

int main()
{
    int a, b;
    cin >> a >> b;
    if (a < b) {
        cout << "a < b" << endl;
    } else if (a > b) {
        cout << "a > b" << endl;
    } else {
        cout << "a == b" << endl;
    }
    return 0;
}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,b) FOR(i,0,b)
#define reps FOR
#define eb emplace_back
#define pb eb

template<class T> inline bool chmax(T &l, const T &r) { return l<r?l=r,1:0;}
template<class T> inline bool chmin(T &l, const T &r) { return l>r?l=r,1:0;}

using vint=vector<int>;
using pint=pair<int,int>;


typedef vector<vector<int>>Graph;
struct Scc{
  stack<int>S;
  vector<int>inS,low,num;
  int time=0;

  Graph dag;
  vector<int>inv;
  vector<vector<int>>scc;
  void visit(const Graph &g,int v){
    low[v]=num[v]=++time;
    S.push(v);inS[v]=1;
    for(const int &w:g[v]){
      if(!num[w]){
        visit(g,w);
        low[v]=min(low[v],low[w]);
      }
     else if(inS[w])low[v]=min(low[v],num[w]);
    }
    if(low[v]==num[v]){
      scc.eb();
      while(1){
        int w=S.top();S.pop();inS[w]=0;
        scc.back().pb(w);
        if(v==w)break;
      }
    }
  }
  Scc(const Graph &g){
    const int n=g.size();
    num.resize(n);low.resize(n);inS.resize(n);
    rep(u,n)if(!num[u])visit(g,u);
    reverse(all(scc));
    inv.resize(n);
    rep(i,scc.size())for(auto v:scc[i])inv[v]=i;
  }   
};

int N,X,A,O;


int po(int a){
  if((a^X)>a)return a;
  return a^X;
}

int ne(int a){
  return po(a)^X;
}

signed main(){
   cin>>N>>X>>A>>O;
   if(X==0){
    cout<<"No"<<endl;return 0;
   }

  int m=1<<(N+1);
  
  Graph g(m);
  g[A].pb(A^X);
  g[O].pb(O^X);

  rep(i,m){
   if((i&A)!=A)continue;
   int b=(1<<(N+1))-1-i;
   int bs=b;
   while(true){
    int uku=A|bs;
    if(i!=uku){
      g[i].pb(uku^X);
    }
    if(bs==0)break;
    bs=(bs-1)&b;
   }
  }


  rep(i,m){
    if((i&O)!=i)continue;
    int b=i;
    int bs=b;
    while(true){
      int uku=(O-i)+bs;
      if(i!=uku){
        g[i].pb(uku^X);
      }
      if(bs==0)break;
      bs=(bs-1)&b;
    }
  }


  Scc S(g);

  vint ans;
  rep(i,m){
    if(S.inv[i]==S.inv[i^X]){
      cout<<"No"<<endl;
      return 0;
    }
    if(S.inv[i]>S.inv[i^X])ans.pb(i);
  }
  cout<<"Yes"<<endl;
  rep(i,ans.size()){
    if(i)cout<<" ";
    cout<<ans[i];
  }
  cout<<endl;
}



Measured memory_bytes: 67740
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ll n,i,tem=0,temp=0,s;
    cin>>n;
ll a[n];
for(i=0;i<n;i++)
    cin>>a[i];
    for(i=0;i<n;i++)
    {
        if(a[i]%2==0)
        {
               tem=1;
            if(a[i]%3==0||a[i]%5==0)
    s=0;
            else
             {
                 temp=2;
             }

        }
    }
    if(tem==1&&temp==2)
        cout<<"DENIED"<<endl;
    else
        cout<<"APPROVED"<<endl;

    return 0;
}


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

typedef long long ll;
typedef pair<int, int> pii;
int R, C, N;
struct Point {
    int x, y, id;
};
vector<Point> P;
Point st;

ll cross(pii a, pii b) {
    return 1LL*a.first*b.second - 1LL*a.second*b.first;
}
ll ccw(Point a, Point b, Point c) {
    pii p = pii(b.x - a.x, b.y - a.y);
    pii q = pii(c.x - a.x, c.y - a.y);
    return cross(p, q);
}
bool cmp(Point a, Point b) {
    if(ccw(st, a, b)) return ccw(st, a, b) > 0;
    else return abs(a.x - st.x) + abs(a.y - st.y) < abs(b.x - st.x) + abs(b.y - st.y);
}

int main() {
    scanf("%d %d %d", &R, &C, &N);
    st = {(int)2e9, (int)2e9, (int)2e9};
    for(int i = 0; i < N; i++) {
        int x1, y1, x2, y2; scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
        if((x1 == 0 || x1 == R || y1 == 0 || y1 == C) && (x2 == 0 || x2 == R || y2 == 0 || y2 == C)) {
            P.push_back({x1, y1, i});
            P.push_back({x2, y2, i});
        }
    }

    if(P.size() == 0) {
        printf("YES");
        return 0;
    }

    for(int i = 0; i < P.size(); i++) {
        if(st.y > P[i].y || (st.y == P[i].y && st.x > P[i].x)) {
            st = P[i];
        }
    }

    sort(P.begin(), P.end(), cmp);

    stack<int> stk;

    for(int i = 0; i < P.size(); i++) {
        if(!stk.empty() && stk.top() == P[i].id) stk.pop();
        else stk.push(P[i].id);
    }

    if(stk.empty()) printf("YES");
    else printf("NO");
}


Measured memory_bytes: 4980
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<int, int>
#define debug(x) cout << #x << ": " << x << ", "
#define debugln(x) cout << #x << ": " << x << '\n'

using namespace std;
using ll = long long;
const int mod = 1e9+7;

vector<P> ans;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n; cin >> n;
  vector<ll> vec(n);
  unordered_map<ll, int> mp;

  rep(i, n) {
    cin >> vec.at(i);
    mp[vec.at(i)] = i+1;
  }

  vector<int> used(n);
  rep(i, n) {
    used.at(i) = 1;
  }
  vector<int> graph[n+1];

  sort(vec.rbegin(), vec.rend());
  rep(i, n) {
    ll a = vec.at(i);
    int s = mp[a];
    int d = n-(2*used.at(s-1));

    if (d > 0 && mp[a-d] > 0) {
      int t = mp[a-d];
      used.at(t-1) += used.at(s-1);
      ans.push_back(P(s,t));
      graph[s].push_back(t);
      graph[t].push_back(s);
    }
  }

  vector<int> distance(n);
  rep(i, n) {
    distance.at(i) = INT_MAX;
  }
  queue<P> que;
  que.push(P(0, 1));
  while (!que.empty()) {
    P pa = que.front(); que.pop();
    int pos = pa.second;
    int d = pa.first;
    distance.at(pos-1) = d;
    for(auto e : graph[pos]) {
      if (distance.at(e-1) == INT_MAX) {
        que.push(P(d+1, e));
      }
    }
  }

  ll sum = 0;
  rep(i, n) {
    if (distance.at(i) == INT_MAX) {
      cout << -1 << endl;
      return 0;
    }
    sum += distance.at(i);
  }
  if (mp[sum] != 1) {
    cout << -1 << endl;
    return 0;
  }

  for(auto e: ans) {
    cout << e.first << ' ' << e.second << '\n';
  }
}

Measured memory_bytes: 13472
#include <stdio.h>

int main()
{
    int a, b, c;


    scanf("%d %d", &a, &b);

    if(a==1 && b==2)
        printf("3\n");
    if(a==2 && b==1)
        printf("3\n");
    if(a==2 && b==3)
        printf("1\n");
    if(a==3 && b==2)
        printf("1\n");
    if(a==1 && b==3)
        printf("2\n");
    if(a==3 && b==1)
        printf("2\n");




    return 0;
}



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

int main(){
	int n, m, l, i, j, k;
	long long t;
	cin >> n >> m >> l;
	int A[n][m], B[m][l];
	for(i = 0; i < n; i++){
		for(j = 0; j < m; j++){
			cin >> A[i][j];
		}
	}
	for(i = 0; i < m; i++){
		for(j = 0; j < l; j++){
			cin >> B[i][j];
		}
	}
	for(i = 0; i < n; i++){
		for(j = 0; j < l; j++){
			t = 0;
			for(k = 0; k < m; k++){
				t += A[i][k]*B[k][j];
			}
			if(j == 0) cout << t;
			else cout << " " << t;
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3168
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repeq(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define rep1(i,x,n) for(int (i)=(x);(i)<(int)(n);(i)++)
#define rep1eq(i,x,n) for(int (i)=(x);(i)<=(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using Int = long long;

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
typedef pair<int,int> P;
typedef std::priority_queue<int> IntPrioQueue;
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue;

//少数点表示
//cout << std::fixed << std::setprecision(14) << 値

int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );
    double r;
    cin >> r;
    cout << std::fixed << std::setprecision(5) << r*2*3.141592;

}

Measured memory_bytes: 3808