akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <utility>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cstdio>
#include <math.h>
#include <stdio.h>
#include <deque>

using namespace std;

#define REP(i,n,m) for( long long int i = (n); i < (m); i++ )
#define REV(v) for (auto itr = v.rbegin(); itr != v.rend(); itr++)
#define ll long long
#define ALL(a) (a).begin(), (a).end()
#define SORT(v) sort( ALL(v) );
#define LAST(v) v[v.size()-1]
#define ZERO(a) memset(a,0,sizeof(a));
#define MINUS(a) memset(a,-1,sizeof(a));
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define pi pair<int, int>
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define IIN(a) int a; cin >> a;
#define LIN(a) ll a; cin >> a;
#define SIN(a) string a; cin >> a;
#define VL(v,n) vector<ll> v(n);
#define Read_VL(v,n) vector<ll> v(n);REP(i,0,n)cin>>v[i];
#define sumV(v,n) Vl(acm,n) REP(i,0,n) acm[i] = v[i] + ( i == 0 ? 0 : acm[i - 1]);
#define EPS (1e-10)
#define INF 1000000000000LL

void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}


template<class T=ll>struct Graph{
	int n;
	vector<vector<tuple<ll,T>>>edge;
	Graph(int N=1):n(N){edge.resize(n);}
	void add(ll f,ll t,T c,bool d=false){
		edge[f].emplace_back(t,c);
		if(!d)edge[t].emplace_back(f,c);
	}
	void view(){
		REP(i,0,n)for(auto&e:edge[i])
			puta(i,"=>",get<0>(e),", cost :",get<1>(e));
	}
};


bool length_cmp( string &a, string &b ){
  return a.size() < b.size();
}

ll StoLL( string s )
{
	ll num=0;
  REP( i, 0, s.size() ){
    num = num * 10 + ( s[i] ^ 48 );
  }
  return num;
}

ll CtoLL( char c )
{
	if( 'a' <= c && c <= 'z'){
		return (ll)( c ^ 96 ) ;
	}
	else if( 'A' <= c && c <= 'Z'){
		return (ll)( c ^ 64 );
	}
  return 0;
}

ll MOD=1000000007;
ll dx[4] = { 1, 0, -1, 0 };
ll dy[4] = { 0, 1, 0, -1 };
//I ASCII code: '0' = 48; 'A' = 65; 'a' = 97

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    LIN(x1)LIN(y1)LIN(x2)LIN(y2)
    ll dx = x2 - x1, dy = y2 - y1;
    ll x3 = x2 - dy, y3 = y2 + dx;
    ll x4 = x1 - dy, y4 = y1 + dx;
    puta( x3,y3,x4,y4 );
    return 0;
}


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

# define pb push_back
# define fr first
# define sc second
# define mk make_pair

using namespace std;

const int inf = 1000000000 + 7;
const int N = 1e6 + 5;

typedef long long ll;

ll n, a[N], pref[N], ans;

inline void solve()
{
    cin >> n;

    for(int i = 1; i <= n; i ++)
        cin >> a[i];

    sort(a + 1, a + n + 1);

    for(int i = 1; i <= n; i ++)
        pref[i] = a[i] + pref[i - 1];
    for(int i = n; i >= 1; i --)
    {
        if(pref[i] * 2 >= a[i + 1])
            ans ++;
        else
            break;
    }

    cout << ans << endl;
}

int tests = 1;

int main()
{
//    scanf("%d", &tests);

    while(tests --)
        solve();
}


Measured memory_bytes: 5120
#include <stdio.h>
#include <stdlib.h>

int main(void) {
    int W, H, N;
    int i, px, py, x, y, total, dx, dy, ax, ay;

    scanf("%d%d%d", &W, &H, &N);
    scanf("%d%d", &px, &py);
    for (i = 1, total = 0; i < N; i++) {
        scanf("%d%d", &x, &y);
        dx = x - px;
        dy = y - py;
        ax = abs(dx);
        ay = abs(dy);
        total += ax + ay;
        if (dx * dy > 0) {
            total -= (ax < ay ? ax: ay);
        }
        px = x;
        py = y;
    }
    printf("%d\n", total);
    return 0;
}

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

int square(int x, int y){

        int s;
        s = x*y;

        return s;
}

int length(int x, int y){

        int l;
        l = 2*x + 2*y;

        return l;
}

int main(){

        int a,b;
        cin >> a >> b;
        cout << square(a,b) << " " << length(a,b) << endl;

        return 0;
}



Measured memory_bytes: 2952
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <map>
const int MOD = 1e9+7;
using namespace std;


int main(){
	int n, maxi = 0;
	cin >> n;
	string s;
	map<string, int> mp;
	for (int i = 0; i < n; i++){
		cin >> s;
		mp[s]++;
		maxi = max(maxi, mp[s]);
	}

	for (auto itr = mp.begin(); itr != mp.end(); itr++){
		if (itr->second == maxi) cout << itr->first << endl;
	}
	return 0;
}

Measured memory_bytes: 25216
#include<bits/stdc++.h>
using namespace std;
int a,b,c;
int main()
{
    scanf("%d%d%d",&a,&b,&c);
    for(register int i=1;i<=b;++i)
    {
        if((a*i)%b==c)
		{
			printf("YES\n");
			return 0;
		}
    }
    printf("NO\n");
    return 0;
}

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

int main(){
  
  int n;
  cin >>n;
  int w[n];
  int sa,sb;
  for(int i=0; i<n; i++){
    cin >> w[i];
    sa+=w[i];
    sb+=w[i];
  }
  
  sa=w[0];
  sb-=w[0];
  int ans=abs(sa-sb);
  for(int i=1; i<n; i++){
  	sa+=w[i];
    sb-=w[i];
    ans=min(ans,abs(sa-sb));
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int main(void)
{
  int n;
  float x1, y1, x2, y2, x3, y3;
  float a1, b1, c1, a2, b2, c2;
  float x, y, r;
  float a, b, c;
  int i;

  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%f %f %f %f %f %f",
        &x1, &y1, &x2, &y2, &x3, &y3);
    
    a1 = 2 * (x2 - x1);
    b1 = 2 * (y2 - y1);
    c1 = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2;
    a2 = 2 * (x3 - x1);
    b2 = 2 * (y3 - y1);
    c2 = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3;

    x = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1);
    y = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);

    a = sqrt((x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3));
    b = sqrt((x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1));
    c = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));

    r = (a * b * c) / sqrt((a + b + c) * (b + c - a) * (c + a - b) * (a + b - c));
    
    printf("%.3f %.3f %.3f\n", x, y, r);
  }

  return 0;
}

Measured memory_bytes: 660
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc *bufio.Scanner

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func minInt(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	x := nextInt()

	for i := 1; ; i++ {
		if i*(i+1)/2 >= x {
			fmt.Println(i)
			return
		}
	}
}


Measured memory_bytes: 640
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N, K;
	cin >> N >> K;
	double anss =(double) 1 / N * (N - K);
	if (anss < 0) {
		anss = 0;
	}
	//cout << anss << endl;
	double ans = 0;
	int co = 0;
	eFOR(i,1,min(K,N)) {
		int cnt = i;
		double sum = 1;
		while (cnt < K) {
			sum *= 0.5;
			cnt *= 2;
		}
		sum *= (double)1 / N;
		//cout << sum << endl;
		ans += sum;
		co++;
	}
	int a = N;
	REP(i, co-1) {
		//N = N*a;
	}
	//ans = ans * (double)1/ N;
	//cout << ans << endl;
	printf("%.9f", anss+ans);

	return 0;
}



Measured memory_bytes: 256
# ABC 092: B – Chocolate
n = int(input())
d, x = [int(s) for s in input().split()]
a = [int(input()) for _ in range(n)]

chocorates = 0

for i in range(n):
    chocorates += (d - 1) // a[i] + 1

print(chocorates + x)

Measured memory_bytes: 3060
open Batteries
let n, lim = Scanf.scanf "%d %d" (fun x y -> x, y)
let rec solve acc = function
  | (x::y::ys) -> 
      let x' = min x lim in
      let y' = min y (lim - x') in
      let acc' = acc + max 0 (x+y-x'-y') in
      solve acc' (y'::ys)
  | _ -> acc
let a = List.init n (fun _ -> Scanf.scanf " %d" (fun x -> x))
let () = solve 0 a |> Printf.printf "%d\n"

Measured memory_bytes: 6656
package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	read  = bufio.NewReader(os.Stdin)
	write = bufio.NewWriter(os.Stdout)
)

func yesno(result bool) {
	if result {
		fmt.Fprintln(write, "Yes")
	} else {
		fmt.Fprintln(write, "No")
	}
}

func main() {
	defer write.Flush()

	var r int
	fmt.Fscan(read, &r)

	fmt.Fprintln(write, r*r)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
void ABC60(void);
void ABC61(void);
void ABC62(void);
void ABC63(void);
void ABC64(void);
void ABC65(void);
void ABC66(void);
void ABC67(void);
void ABC68(void);
void ABC69(void);

int main(void){
    ABC64();
}

void ABC64(){
    int n,a,i,min,max;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>a;
        if(i==0){
            min=a;
            max=a;
        }
        if(a>max)max=a;
        if(a<min)min=a;
    }
    cout<<max-min<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
ll sol[101][100001]={0};
int main()
{
  ll n,c;
  cin>>n>>c;
  ll w[n],p[n];
  ll i;
  for(i=0;i<n;i++)
  {
    cin>>w[i];
    cin>>p[i];
  }
  for(i=0;i<100001;i++)
  {
    if(i>=w[0])
      sol[0][i]=p[0];
    else
      sol[0][i]=0;
  }
  ll j;
  for(i=1;i<n;i++)
  {
    for(j=0;j<100001;j++)
    {
      if(j<w[i])
        sol[i][j]=sol[i-1][j];
      else if(j>=w[i])
        sol[i][j]=max(sol[i-1][j],sol[i-1][j-w[i]]+p[i]);
    }
  }
  cout<<sol[n-1][c]<<endl;
}


Measured memory_bytes: 78464
X,N = map(int,input().split())
if N == 0 :
    print(X)
else :
    P = list(map(int,input().split()))
    a = list(range(10000000))
    ab = 101
    an = []
    for i in range(N):
        a.remove(P[i])
        a = a
    for j in range(0,102):
        ab = min(ab,abs(X - a[j]))
    if X - ab in a :
        print(X - ab)
    elif X + ab in a:
        print(X + ab)

Measured memory_bytes: 404632
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a[] = new int[5];
		int sum = 0;
		for(int i = 0; i < 5; i++){
			a[i] = sc.nextInt();
			if(a[i] < 40){
				a[i] = 40;
			}
		}
		for(int i = 0; i < 5; i++){
			sum =  sum + a[i];
		}
		
		
		System.out.println(sum/5);
	}

}

Measured memory_bytes: 26208
import sys

N=int(input())

x=list(map(int,input().split()))

a=[0 for i in range(N)]
for i in range(N):
    a[x[i]]+=1

if x[0]!=0 or a[0]!=1: print(0),sys.exit()
for i in range(2,N):
    if a[i-1]==0 and a[i]!=0: print(0),sys.exit()

ans=1
for i in range(1,N):
    ans=(ans*a[x[i]-1])%998244353

print(ans) 

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

int main(){
int A, B; cin >> A >> B;
int ans = 0;
for (int x = A; x <= B; x++) {
    int s1 = x % 10;
    int s2 = x / 10 % 10;
    int s4 = x / 1000 % 10;
    int s5 = x / 10000 % 10;
    if (s1 == s5 && s2 == s4) {
        ans++;
    }
}

cout << ans << endl;

}


Measured memory_bytes: 256
ai,ao,at,aj,al,ass,az = map(int,input().split())

ans = ao

if ai * aj * al > 0:
    if ai%2+aj%2+al%2 in [0,3]:
        ans += ai + aj + al
    else:
        ans += ai + aj + al - 1

else:
    ans += ai//2*2 + aj//2*2 + al//2*2

print (ans)


Measured memory_bytes: 38484
#include <iostream>

using namespace std;

int main()
{
    int a , b , time = 0 , ans = 0;
    double t;
    cin >> a >> b >> t;
    while (time <= t + 0.5){
        if (time + a > t + 0.5){
            break;
        }
        ans += b;
        time += a;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3668
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<set>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int A, B;
	set<int> s;
	
	
	s.insert(1);
	s.insert(2);
	s.insert(3);
	
	cin>>A>>B;
	
	s.erase(A);
	s.erase(B);
	
	
	cout<<*s.begin()<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<functional>
#include<cmath>
#include<ctime>
#include<string>
#include<stack>
using namespace std;
stack<char>c;
string str;
int main()
{
	cin>>str;
	int l=str.size();
	for(int i=0;i<l;i++)
	{
		for(int j=i;j<l;j++)
		{
			if(str[i]=='C'&&str[j]=='F')
			{
				cout<<"Yes\n";
				return 0;
			}
		}
	}
	cout<<"No\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
  int n,m,x,y;
  std::vector<int> X;
  std::vector<int> Y;
  int tmp;
  scanf("%d %d %d %d\n",&n,&m,&x,&y);
  for (size_t i = 0; i < n; i++) {
    scanf("%d ",&tmp );
    X.push_back(tmp);
  }
  for (size_t i = 0; i < m; i++) {
    scanf("%d ",&tmp );
    Y.push_back(tmp);
  }
  std::sort(X.begin(),X.end());
  std::sort(Y.begin(),Y.end());
  
  if (x>=y) {
    printf("War\n" );
    return 0;
  }
  if (X[n-1]>=Y[0]) {

    printf("War\n" );
    return 0;
  }else if(x<Y[0]&&X[n-1]<y){
    printf("No War\n" );
    return 0;
  }
  printf("War\n" );
  return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

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

    if(c - a - b < 0){
        Out("No");
    }else{
        if(4 * a * b < (c - a - b) * (c - a - b)) Out("Yes");
        else Out("No");
    }

    return 0;
}


Measured memory_bytes: 256
# include <bits/stdc++.h>
using namespace std;
# define fi cin
# define fo cout
# define x first
# define y second
# define ll long long
# define db long double
# define IOS ios_base :: sync_with_stdio(0)
# define halt(...) {fo << (__VA_ARGS__) << '\n';exit(0);}
# define pp(n) cerr << #n << " = " << n << '\n'
# define ppp(v) for (auto it : v) cerr << it << ' ';cerr << '\n'
int f[1 << 20];
int c[1 << 20];
const int mod = 1e9 + 7;
int pow(int a,int b,int mod)
{
    int ans = 1;
    while (b)
    {
        if (b&1) ans = (1ll * ans * a) % mod;
        a = (1ll * a * a) % mod;
        b /= 2;
    }
    return ans;
}
int main(void)
{
    #ifdef CF
    freopen("input","r",stdin);
    #endif // CF
    srand(time(0));
    fo << fixed << setprecision(7);
    cerr << fixed << setprecision(7);
    int n,m,h,w;
    fi>>n>>m>>h>>w;
    f[0] = c[0] = 1;
    for (int i = 1;i <= 5e5;++i)
    {
        f[i] = (1ll * f[i-1] * i) % mod;
        c[i] = (1ll * c[i-1] * pow(i,mod - 2,mod)) % mod;
    }
    auto C = [&](int n,int k)
    {
        int ans = (1ll * f[n] * c[k]) % mod;
        ans = (1ll * ans * c[n - k]) % mod;
        return ans;
    };
    auto get = [&](int x,int y)
    {
        return C(x + y - 2,x - 1);
    };
    h = n - h + 1;
    int ans = get(n,m);
    for (int i = h;i <= n;++i)
        ans = (ans + 1ll * mod * mod - 1ll * get(i,w) * get(n - i + 1,m - w)) % mod;
    fo << ans << '\n';
    return 0;
}

Measured memory_bytes: 4096
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int x[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int k; cin>>k;
	cout<<x[k-1]<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map> 
#include <map> 
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
#include <bitset>
#include <memory>
using namespace std;
typedef long long LL;

int main() {
    int c = 0, b = 0;
    string s;
    cin >> s;
    if (s[0] == 'A') {
        if (s[1] <= 91) {
            cout << "WA" << endl;
            return 0;
        }
        if (s[s.size() - 1] <= 91) {
            cout << "WA" << endl;
            return 0;
        }
        for (int i = 2; i < s.size() - 1; i++) {
            if (s[i] == 'C')c++;
            if (s[i] <= 91)b++;
        }
        if (c == 1 && b == 1) {
            cout << "AC" << endl;
            return 0;
        }
    }
    cout << "WA" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <tuple>
#include <cmath>
using namespace std;


int main(int argc, const char * argv[]) {
  int64_t a, b, c, d;
  cin >> a >> b >> c >> d;
  int64_t x = max(c,d);
  int64_t y = min(c,d);
  int64_t r = x % y;
  while(r != 0){
    x = y;
    y = r;
    r = x % y;
  }
  int64_t m = c*d/y;
  int64_t result = 0;
  
  int64_t ax = (a-1)/c + (a-1)/d - (a-1) / m;
  int64_t bx = b/c + b/d - b / m;

  cout << b - a + 1 - (bx - ax) << endl;;

  return 0;
}


Measured memory_bytes: 256
from collections import defaultdict


def factorize(n):
    f = defaultdict(int)
    tmp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        while tmp % i == 0:
            f[i] += 1
            tmp //= i
    if tmp != 1:
        f[tmp] += 1
    if not f:
        f[n] += 1
    return f


def distance(s, d):
    a, b = 1, 1
    for i, si in enumerate(s):
        if si == "0":
            a *= factors[i]
            if a > d:
                return inf
        else:
            b *= factors[i]
            if b > d:
                return inf
    return a + b - 2


def answer(f, d):
    a = 1
    for i in f:
        a *= i
        if a > d:
            return inf
    return a + N // a - 2


def sa(f):
    d = inf
    for fi in f:
        d = min(d, answer(fi, d))
    return d


def comb(f):
    c = [[]]
    for k in f:
        ct = [[k] * i for i in range(1, f[k] + 1)]
        ci = c.copy()
        for cti in ct:
            for cii in ci:
                c.append(cii + cti)
    return [[1]] + c[1:]


# CONST = 1099511627776
N = int(input())
inf = 999999999999
factors = factorize(N)
print(sa(comb(factors)))

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

int main(){
    int A, B, C, K; cin >> A >> B >> C >> K;
    int sum = 0;
    while(A > 0){
        sum++;
        K--;
        A--;
        if(K == 0){
            cout << sum << endl;
            return 0;
        }
    }
    while(B > 0){
        K--;
        B--;
        if(K == 0){
            cout << sum << endl;
            return 0;
        }  
    }
    while(C>0){
        sum--;
        K--;
        C--;
        if(K == 0){
            cout << sum << endl;
            return 0;
        }
    }
}

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

int main() {
	int a, b;
	cin >> a >> b;
	int ans;
	if ((a + b) % 2 == 0) {
		ans = (a + b) / 2;
	} else {
		ans = (a + b) / 2 + 1;
	}
	cout << ans << endl;
	return 0;
}

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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"
*/

const int INF = pow(10, 4);

int main()
{
    int N, X, Y; cin >> N >> X >> Y;
    int d[N][N];
    int dis[N];
    // 初期化
    rep(i,N){
        rep(j,N){
            d[i][j] = INF;
        }
    }
    rep(i, N) dis[i] = 0;
    for(int i=0; i<N; i++){
        for(int j=i+1; j<N; j++){
            d[i][j] = min(abs(j-i), abs(X-1-i)+1+abs(Y-1-j));
        }
    }
    for(int i=0; i<N; i++){
        for(int j=i+1; j<N; j++){
            // if(d[i][j] == 5) cout << i << "," << j << endl;
            dis[d[i][j]]++;
        }
    }
    rep(i, N){
        if(i != 0) printf("%d\n", dis[i]);
    }       
}

Measured memory_bytes: 15872
import java.util.*;

public class Main {
    public static void main(String[] args) {
        try(Scanner scn = new Scanner(System.in)) {
            String ptn = scn.next();
            int cnt = 0;
            for(int n = scn.nextInt(); n > 0; n--) {
                String ring = scn.next();
                if(ring.concat(ring).indexOf(ptn) != -1) {
                    cnt++;
                }
            }
            System.out.println(cnt);
        }
    }
}

Measured memory_bytes: 26172
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define MAX 1e18
#define MIN -1e18
#define MOD 1000000007
#define mod2 20071027
//#define mod 1000074259
#define base 139
#define base2 31
#define memz(a) memset(a, 0, sizeof(a))
#define memn(a) memset(a, -1, sizeof(a))
#define in1(a) scanf("%lld", &a)
#define in2(a, b) scanf("%lld%lld", &a, &b)
#define TC(c) printf("Case %lld: ", ++c)
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
const ll N=300010;
ll h, n, a, f=0, sum;
int main()
{
    in2(h, n);
    for(int i=0;i<n;i++)
    {
        in1(a);
        sum+=a;
    }
    if(h>sum)
        printf("No\n");
    else printf("Yes\n");

    return 0;
}

/*

*/


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        Main m = new Main();
        m.solve(sc);
    }
    int[] gp;
    void solve(Scanner sc){
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[][] arr = new int[m][2];
        gp = new int[n+1];
        Arrays.fill(gp,-1);
        for(int i=0;i<m;i++){
            arr[i] = new int[]{sc.nextInt(),sc.nextInt()};
        }
        for(int i=0;i<m;i++){
            g(arr[i][0],arr[i][1]);
        }
        int ans = 0;
        for(int i=1;i<=n;i++){
            ans = Math.min(ans,gp[i]);
        }
        System.out.println(-ans);
    }
    int find(int v){
        if(gp[v]<0) return v;
        //System.out.println(v);
        return gp[v] = find(gp[v]);
    }

    void g(int a, int b){
        int pa = find(a);
        int pb = find(b);
        if(pa==pb) return;
        if(gp[pa]<gp[pb]){
            gp[pa]+=gp[pb];
            gp[pb] = pa;
        }else{
            gp[pb]+=gp[pa];
            gp[pa] =pb;
        }
    }
    static long cmp(int[] a, int[] b){
        return (long)Math.abs(a[0]-b[0])+(long)Math.abs(a[1]-b[1]);
    }
}

Measured memory_bytes: 70680
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define int long long 
int F[2100010];

int Mul(int a, int b) {
	return ((a % mod) * (b % mod)) % mod;
}

void fact(void) {
	F[0] = 1;
	F[1] = 1;
	for (int i = 2; i <= 2100000; i++) {
		F[i] = Mul(i, F[i - 1]);
	}
}
int square(int x) {
	return (x * x) % mod;
}

int power(int x, int y) {
	if (y == 0) return 1;
	else if (y == 1) return x % mod;
	else if (y % 2 == 0) return square(power(x, y / 2)) % mod;
	else return square(power(x, y / 2)) * x % mod;
}

int Div(int a, int b) {
	return Mul(a, power(b, mod - 2));
}
int P(int n, int r) {
	if (n < r || n < 0 || r < 0) return 0;
	return Div(F[n], F[n - r]);
}

int C(int n, int r) {
	if (n < r || n < 0 || r < 0) return 0;
	int ret;
	ret = Div(F[n], Mul(F[n - r], F[r]));
	return ret;
}
int H(int n, int r) {
	if (n == 0 && r == 0) return 1;
	return C(n + r - 1, r);
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    fact();
    cin >> n >> k;
    k = min(k, n);
    int ans = 1;
    REP(i, 1, k) {
        ans = (ans + Mul(C(n, i), Div(F[n - 1], Mul(F[n - i - 1], F[i])))) %mod;
        //cout << ans << endl;
    }
    cout << ans << endl;

    return 0;
}
// 1 1 1



Measured memory_bytes: 16640
#include <iostream>

using namespace std;

int main() {
    int N;//問題数
    cin >> N;
    int Ti[110];//問題を解くのにかかる時間
    int coTi[110];
    for (int i = 0; i < N; i++) {
        cin >> Ti[i];
        coTi[i] = Ti[i];
    }
    int M;
    cin >> M;//ドリンク
    int Pi[110];//番号
    int Xi[110];//時間変更
    for (int i = 0; i < M; i++) {
        cin >> Pi[i];
        cin >> Xi[i];
        Pi[i]--;
    }//入力終了

    for (int i = 0; i < M; i++) {
        coTi[Pi[i]] = Xi[i];
        int sum = 0;
        for (int j = 0; j < N; j++) {
            sum += coTi[j];
        }
        cout << sum << endl;
        coTi[Pi[i]] = Ti[Pi[i]];
    }
}

Measured memory_bytes: 256
from heapq import *
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    n, d, a = MI()
    hp = []
    for _ in range(n):
        x, h = MI()
        heappush(hp, (x, 1, h))
    p = 0
    ans = 0
    while hp:
        x, op, h = heappop(hp)
        if op:
            h -= p
            if h > 0:
                ad = (h + a - 1) // a
                ans += ad
                p += ad * a
                heappush(hp, (x + 2 * d + 1, 0, ad * a))
        else:
            p -= h

    print(ans)

main()


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

class Cake
{
public:
	int w,h,sz;
	Cake(int w, int h)
		:w(w),h(h)
	{
		sz=w*h;
	}

	bool operator<(const Cake& c) const
	{
		return sz<c.sz;
	}
};

int main()
{
	int N,W,H;
	while(cin >> N >> W >> H, (N||W||H))
	{
		vector<Cake> cakes;
		cakes.push_back(Cake(W,H));
		while(N--)
		{
			int id,p;
			cin >> id >> p;
			id--;

			int w=cakes[id].w, h=cakes[id].h;
			p%=(w+h);

			if(p<w) 
			{
				cakes.erase(cakes.begin()+id);
				Cake n1=Cake(p,h);
				Cake n2=Cake(w-p, h);

				if(n2<n1) swap(n1,n2);
				cakes.push_back(n1);
				cakes.push_back(n2);
			}
			else 
			{
				p-=w;
				cakes.erase(cakes.begin()+id);
				Cake n1=Cake(w, p);
				Cake n2=Cake(w, h-p);

				if(n2<n1) swap(n1,n2);
				cakes.push_back(n1);
				cakes.push_back(n2);
			}

		}

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

		for(int i=0; i<cakes.size(); i++)
		{
			if(i!=0) cout << " ";
			cout << cakes[i].sz;
		}

		cout << endl;
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
ll mod=1000000007;

int main(){
    std::ios::sync_with_stdio(false);
    int a,b;
    cin>>a>>b;
    if(b%a==0)cout<<a+b;
    else cout<<b-a;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define uint unsigned int
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(a) (a).begin(), (a).end()
#define ALLR(a) (a).rbegin(), (a).rend()
#define SZ(a) ((int)(a).size())
#define PB(a) push_back(a)
#define EMP emplace
#define EMPB(...) emplace_back(__VA_ARGS__)
#define MP(a, b) make_pair(a, b)
#define MT(...) make_tuple(__VA_ARGS__)
#define Bit(n) (1LL << (n))
using namespace std;
using pii = pair<int, int>;
template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
const int MOD = 1000000007;
const int INF = 1LL << 30;
const double EPS = 1e-10;

int K, A, B;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> K >> A >> B;
  if (K < A-1) {
    cout << K+1 << endl;
    return 0;
  }
  int d = B - A - 2;
  if (d < 0) {
    cout << K+1 << endl;
    return 0;
  }
  int ans = K + 1;
  int y = (K - A + 1) / 2;
  chmax(ans, K + 1 + d*y);
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long h[100005],dp[100005],k,n;
int main(){
	cin>>n;
	for(k=1;k<=n;k++){
		cin>>h[k];
	}
	dp[1]=0;
	dp[0]=1e8;
	for(k=2;k<=n;k++){
	int h1=abs(h[k]-h[k-1]);
	int h2=abs(h[k]-h[k-2]);
		dp[k]=min(dp[k-1]+h1,dp[k-2]+h2);
	//	cout<<dp[k-1]+h1<<" "<<dp[k-2]+h2<<endl;
	}
	cout<<dp[n];
}

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

ll lev[100010], vis[100010], dis[100010], st=-1, en=-1, n, m, x;

void dfs(ll src, ll d)
{
	lev[d]=src;
	vis[src]=1;
	dis[src]=d;
	ll a=(src*src)%m;
	if(vis[a]==1)
	{
		st=dis[a];
		en=d;
		return;
	}
	dfs(a, d+1);
}

int main()
{
	ll i, j;

	scanf("%lld %lld %lld", &n, &x, &m);

	dfs(x, 1);

	if(n<=en)
	{
		ll res=0;
		for(i=1; i<=n; i++) res+=lev[i];
		printf("%lld\n", res);
		return 0;
	}

	ll res=0;

	for(i=1; i<st; i++) res+=lev[i];

	n-=(st-1);

	ll unit=en-st+1, per=0;
	
	for(i=st; i<=en; i++) per+=lev[i];

	res+=per*(n/unit);
	
	n=n%unit;

	for(i=st; i<st+n; i++) res+=lev[i];

	printf("%lld\n", res);




	return 0;
}

Measured memory_bytes: 5744
N = int(input())
seqB = [int(x) for x in input().split()]

ai = aj = seqB[0]
seqA = [ai,aj]
for i in range(1, len(seqB)):
  aj = max(aj, seqB[i])
  if aj > seqB[i]: 
    aj = seqA[i] = seqB[i]
  seqA.append(aj)

print(sum(seqA))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define ll long long int
#define MOD 1e9+7
#define start int t;cin>>t;while(t--)
#define debug(x) cout<<"#"<<x<<"\n"
#define en "\n"
#define vi vector<int>
#define vli vector<long long int>
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define print_all(x) for(auto t:x) cout<<t<<" "; cout<<en
#define F first
#define S second
using namespace std;

vector<ll> printDivisors(ll n) 
{ 
    vector<ll> v;
    for (ll i=1; i<=sqrt(n); i++) 
    { 
        if (n%i == 0) 
        { 
            if (n/i == i) 
                v.pb(i);
  
            else {
                v.pb(i);
                v.pb(n/i);
            } 
        }
    }
    return v;
} 

bool isEven(string s){
    int len=s.size();
    for(int i=0;i<len/2;i++){
        if(s[i]!=s[i+len/2]){
            return false;
        }
    }
    return true;
}
void solve(){
   string s;
   cin>>s;
   int len=s.size();
   int dec=2;
   int ans;
   while(s.size()>=2){
       s=s.substr(0,len-dec);
       if(isEven(s)){
           ans=s.size();
           break;
       }
       dec+=2;
   }
   cout<<ans;
}


int main(){
    fast;
    //start{
        solve();
    //}
    return 0;

}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;

const ll INF = 5e15;
const ll MOD = 1e9 + 7;

vector<ll> dp(1 << 20, -INF);
vector<ll> group(1 << 20, 0);
vector<vector<ll>> A;

int main(){
    ll N;
    cin >> N;
    for(ll i = 0; i < N; i++){
        vector<ll> tmp(N);
        for(ll &t : tmp) cin >> t;
        A.push_back(tmp);
    }
    for(ll i = 0; i < (1 << N); i++) for(ll j = 0; j < N; j++) for(ll k = j + 1; k < N; k++) if((i & (1 << j)) && (i & (1 << k))) group[i] += A[j][k];
    dp[0] = 0;
    for(ll i = 0; i < N; i++){
        ll upper = 1;
        for(ll j = 0; j < i; j++) upper *= 3;
        for(ll S = 0; S < upper; S++){
            ll sa = 0, sb = 0;
            ll cpy = S;
            for(ll k = 0; k < i; k++){
                if(cpy % 3 == 1) sa += (1 << k);
                else if(cpy % 3 == 2) sb += (1 << k);
                cpy /= 3;
            }
            dp[sa | sb | (1 << i)] = max(dp[sa | sb | (1 << i)], group[sa | (1 << i)] + dp[sb]);
        }
    }
    cout << dp[(1 << N) - 1] << endl;
    return 0;
}


Measured memory_bytes: 16640
#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;
};


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



int main() {
	
	ll N, A, B;
	cin >> N >> A >> B;

	ll x = 0;
	ll y = 0;
	ll z = 0;

	repn(i, N) {
		ll p;
		cin >> p;

		if (p <= A) { x++; }
		else if (p <= B) { y++; }
		else { z++; }
	}

	cout << min(x, min(y, z));


	system("PAUSE");
}


Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;

const int CAP = 100000;
bool primes[CAP + 10];
int cumSum[CAP + 10];

int main(void) {
    // Sieve of Eratosthenes
    for (int i = 2; i <= CAP; i++)
        if (!primes[i]) {
            for (int j = i + i; j <= CAP; j += i)
                primes[j] = true;
        }

    // Is it "2017-like Number"?
    for (int i = 3; i <= CAP; i += 2)
        if (!primes[i] && !primes[(i + 1) / 2]) {
            cumSum[i]++;
        }

    // Cumulative sum
    for (int i = 3; i <= CAP; i++) {
        cumSum[i] += cumSum[i - 1];
    }

    int N;
    cin >> N;
    for (int i = 0; i < N; i++) {
        int L, R;
        cin >> L >> R;
        cout << cumSum[R] - cumSum[L - 1] << endl;
    }

    return 0;
}


Measured memory_bytes: 1152
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		Console.WriteLine(L.OrderByDescending(v => v).Take(K).Sum());
		
	}
	int N,K;
	int[] L;
	public Sol(){
		var d = ria();
		N = d[0]; K = d[1];
		L = ria();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 13396
#pragma region Macros
#include <bits/stdc++.h>
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll;
#pragma endregion
int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);

	string S, T;
	cin >> S >> T;
	int ans = 0;
	rep(i, 3)
	{
		if (S[i] == T[i])
			ans++;
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    string s;
    cin >> s;
    int len = s.length();
    int left = 0;
    int right = 0;
    vector<int> ans(len);
    for(int i = 0; i < len; i++){
        ans[i] = 0;
    }
    for(int i = 0; i < len-1; i++){
        if(s[i] == 'L' && s[i+1] =='R'){
            right = i;
            for(int j = left; j <= right; j++){
                if(s[j] == 'R' && s[j+1] == 'L'){
                    ans[j] ++;
                    ans[j+1] ++;
                    for(int k = left; k <= right; k++){
                        if(k != j && k != j+1){
                            if(abs(k-j)%2 == 0){
                                ans[j] ++;
                            }else if(abs(k-j)%2 == 1){
                                ans[j+1] ++;
                            }
                        }
                    }
                }
            }
            left = i+1;
        }
    }
    right = len-1;
    for(int j = left; j <= right; j++){
        if(s[j] == 'R' && s[j+1] == 'L'){
            ans[j] ++;
            ans[j+1] ++;
            for(int k = left; k <= right; k++){
                if(k != j && k != j+1){
                    if(abs(k-j)%2 == 0){
                        ans[j] ++;
                    }else if(abs(k-j)%2 == 1){
                        ans[j+1] ++;
                    }
                }
            }
        }
    }
    for(int i = 0; i < len; i++){
        cout << ans[i] << " ";
    }       
    cout << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <cmath>
#include <iomanip>
#include <deque>
#include <queue>
#include <unordered_map>
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;
ll pow(ll N, ll P){
    if(P==0) return 1;
    if(P%2==0){
        ll t = pow(N, P/2);
        return t*t;
    }
    return N * pow(N, P-1);
}
ll modpow(ll N, ll P,ll k){
    if(P==0) return 1;
    if(P%2==0){
        ll t = modpow(N, P/2,k)%k;
        return t*t%k;
    }
    return N * modpow(N, P-1,k)%k;
}
ll modkai(ll n,ll m,ll k){//n*(n-1)*(n-2)*...(m+1)%k
    if(n == m)return 1;
    return modkai(n-1,m,k)*n%k;
}
ll mod_cnb(ll n,ll m,ll k){//nCm%k,kは十分大きい素数
  int m_=modkai(m,0,k);
  return modkai(n,n-m,k)*modpow(m_,k-2,k)%k;
}
ll gcd(ll n,ll m){
    ll n_ = max(n,m);
    ll m_ = min(n,m);
    if(n_%m_ == 0)return m_;
    return gcd(m_,n_%m_);
}
ll lcm(ll n,ll m){
    return n*m/gcd(n,m);
}

int main(){
    int n;cin>>n;
    vector<ll>a(n);
    rep(i,n)cin>>a[i];
    ll dp[100000][3];
    ////even///
    if(n%2==0){
        ll d[100000][2];
      d[0][0]=a[0];
      d[0][1]=a[1];
      rep(i,n/2-1){
        d[i+1][0]=d[i][0]+a[(i+1)*2];
        d[i+1][1]=max(d[i][1]+a[(i+1)*2+1],d[i][0]+a[(i+1)*2+1]);
    }
        cout<< max(d[n/2-1][0],d[n/2-1][1])<<endl;
        return 0;
    }
    ////odd/////
    ll t=n/2-1;
    dp[0][0]=a[0];
    dp[0][1]=a[1];
    dp[0][2]=a[2];
    rep(i,t){
        dp[i+1][0]=dp[i][0]+a[(i+1)*2];
        dp[i+1][1]=max(dp[i][1]+a[(i+1)*2+1],dp[i][0]+a[(i+1)*2+1]);
        dp[i+1][2]=max(dp[i][0]+a[(i+1)*2+2],max(dp[i][2]+a[(i+1)*2+2],dp[i][1]+a[(i+1)*2+2]));
    }
    ll ans=max(dp[t][2],dp[t][1]);
  ans=max(ans,dp[t][0]);
    cout <<ans<<endl;
}

Measured memory_bytes: 7164
from collections import deque

s = deque(input())
bef = s.popleft()
ans = 1
while (s):
    now = s.popleft()
    if now == bef:
        if s:
            s.popleft()
        else:
            break
        bef = ""
    else:
        bef = now
    ans += 1

print(ans)


Measured memory_bytes: 5096
import java.util.Scanner;

public class Main {

	static Scanner scanner;
	public static void main(String[] args) {
	    scanner = new Scanner(System.in);

	    long x=gl();
	    long y=gl();

	    long n=0;
	    if(x>y) {
	    	if(x*y>0) {
	    		n=x-y+2;
	    	} else if(x*y<=0) {
	    		n=1+Math.abs(Math.abs(x)-Math.abs(y));
	    	}
	    } else {
	    	if(x*y>0) {
	    		n=y-x;
	    	} else if(x*y<0) {
	    		n=1+Math.abs(Math.abs(x)-Math.abs(y));
	    	} else {
	    		n=Math.abs(x-y);
	    	}
	    }

        System.out.println(n);

		//System.out.println();
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}


Measured memory_bytes: 35544
#!/usr/bin/env python3
# CGL_7_A: Circles - Intersection

from enum import Enum
from math import sqrt


class Relation(Enum):
    INCLUDED = 0
    INSCRIBED = 1
    INTERSECT = 2
    CIRCUMSCRIBED = 3
    NO_CROSS = 4


def circle_intersection(c1, c2):
    x1, y1, r1 = c1
    x2, y2, r2 = c2
    d = distance((x1, y1), (x2, y2))

    if d - (r1 + r2) > 1e-10:
        return Relation.NO_CROSS
    elif abs(d - (r1 + r2)) < 1e-10:
        return Relation.CIRCUMSCRIBED
    elif d - (r2 - r1) > 1e-10:
        return Relation.INTERSECT
    elif abs(d - (r2 - r1)) < 1e-10:
        return Relation.INSCRIBED
    else:
        return Relation.INCLUDED


def distance(p1, p2):
    x1, y1 = p1
    x2, y2 = p2
    return sqrt((x2-x1)**2 + (y2-y1)**2)


def run():
    c1 = [int(i) for i in input().split()]
    c2 = [int(i) for i in input().split()]

    if c1[2] > c2[2]:
        c1, c2 = c2, c1

    print(circle_intersection(c1, c2).value)


if __name__ == '__main__':
    run()



Measured memory_bytes: 6400
#include<bits/stdc++.h>
using namespace std;
int main() {
  int x, y;
  cin >> x >> y;
  
  if(x == y) cout << 0;
  else if(y <= 0) {
    if(x < 0) {
      if(abs(x) < abs(y)) {
	cout << abs(y) - abs(x) + 2 << endl;
      } else {
	cout << abs(x) - abs(y) << endl;
      }
    } else {
      if(x > abs(y)) {
	cout << x - abs(y) + 1 << endl;
      } else {
	cout << abs(y) - x + 1 << endl;
      }
    }
  } else {
    if(x < 0) {
      if(abs(x) > y) {
	cout << abs(x) - y + 1 << endl;
      } else {
	cout << y - abs(x) + 1 << endl;
      }
    } else {
      if(x < y) {
	cout << y - x << endl;
      } else {
	cout << x - y + 2 << endl;
      }
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	string S;
	cin >> S;
	vector<pair<int, int>> charPair(26);
	for (int i = 0; i < 26; ++i){
		charPair[i].first = 0;
		charPair[i].second = 101;
	}
	for (int i = 0; i < S.length(); ++i){
		charPair[S[i] - 'a'].second = (S.length() - 1) - i;
		int prevCharNum = i;
		for (int j = 0; j < i; ++j){
			if (S[i] == S[j]){
				prevCharNum = i - j - 1;
			}
		}
		charPair[S[i] - 'a'].first = max(prevCharNum, charPair[S[i] - 'a'].first);
	}
	int ans = 101;
	for (int i = 0; i < 26; ++i){
		ans = min(ans, max(charPair[i].first, charPair[i].second));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
s=[]

while 1:
    l1=input()
    if l1==".":
        break
    l2=input()

    sp1=l1.split('"')
    sp2=l2.split('"')
    
    t=0
    if len(sp1)==len(sp2):
        for i in range(len(sp1)):
            if i%2==1 and sp1[i]!=sp2[i]:
                t+=1
            elif i%2!=1 and sp1[i]!=sp2[i]:
                t+=2


    if sp1==sp2:
        s+=["IDENTICAL"]
    elif t==1:
        s+=["CLOSE"]
    else:
        s+=["DIFFERENT"]

for x in s:
    print(x)


Measured memory_bytes: 5588