akhauriyash/Code-Regression huggingface dataset:
def rev(val, v1, v2):
    for i in range((v2-v1)//2 +1):
        val[v1+i], val[v2-i] = val[v2-i], val[v1+i]
    return val

def rep(val1, val2, v1, v2):
    for i in range(v2-v1):
        val1[v1+i] = val2[i]
    return val1

st = input()
lst = [i for i in st]
q = int(input())
for i in range(q):
    f = list(map(str, input().split()))
    if f[0] == 'print':
        s = ''.join(lst[int(f[1]):int(f[2])+1])
        print(s)
    elif f[0] == 'reverse':
        lst = rev(lst, int(f[1]), int(f[2]))
    elif f[0] == 'replace':
        x = [i for i in f[3]]
        lst = rep(lst, x, int(f[1]), int(f[2])+1)


Measured memory_bytes: 5636
def check(s, ans, i) :
    return s[i-1] ^ ans[i-1] ^ ans[i-2] ^ ans[i]

def solve(first, second, s) :
    n = len(s)
    ans = [0] * (n)
    ans[-2] = first;
    ans[-1] = second;



    for i in range(0, n-2) :
        nsame = 0
        nsame ^= s[i-1]
        nsame ^= ans[i-1]
        ans[i] = ans[i-2] ^ nsame
    if check( s, ans, n-2 ) == 0 and check(s, ans, n-1) == 0 :
        ans.append(1)
#    print(ans)
    return ans

N = int(input())
s = input()

data = [0] * N
for i in range(N) :
    data[i] = 1 if s[i] == 'x' else 0
ok = 0

for i in range(2) :
    if ok == 1 :
        break
    for j in range(2) :
        if ok == 1 :
            break
        ans = solve(i, j, data)
        ok = len(ans) - N
if ok == 0 :
    print("-1")
else :
    for i in range(N) :
        print('W' if ans[i] == 1 else 'S', end = "")
    print()



Measured memory_bytes: 6632
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 99999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m;i>n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(20) << S << endl
#define Vecpr(K,L1,L2,N) vector<pair<L1,L2>> K(N)
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,R) vector<vector<L>> K(N, vector<L>(M,R))
#define mod 1000000007
#define MAX 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  lli A,B,C=0,D=0,E=0,F=INF,G=INF,H=0,N,M,K,sum=0;
  cin >> N >> M;
  Vec(P,int,M,0);rep(i,0,M)cin>>P[i];
  Sort(P);
  Vec(Q,int,M-1,0);
  rep(i,0,M-1)Q[i]=labs(P[i]-P[i+1]);
  Sort(Q);Rev(Q);
  rep(i,0,min(N-1,M-1))sum+=Q[i];
  Out(P[M-1]-P[0]-sum);
}

Measured memory_bytes: 1024
import java.util.Scanner;

class Main{

    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int A = stdIn.nextInt();
        int B = stdIn.nextInt();
        int C = stdIn.nextInt();

        int x = 0;

        if(A==B && A != C)
            x = 1;
        if(A==C && A != B)
            x = 1;
        if(B==C && C != A)
            x = 1;
        

        if(x == 1) {
            System.out.println("Yes");
        }else{
            System.out.println("No"); 
        }
    }
}

Measured memory_bytes: 21844
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<cmath>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define FOR(i, j, limit) for(int i=j; i< limit; ++i)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ECHO(x) cout<<x<<endl;
#define MEMSET(a, n, x) REP(i, n) a[i]=x;
#define ARRIN(a, n) REP(i, n) cin>>a[i];
#define LL long long
int INF = 2147483647;
LL LINF = 9223372036854775807;
LL MOD = 1000000007;
typedef pair<int, int>P;
typedef pair<LL, LL>PL;
typedef vector<int> vi;
typedef vector<LL> vl;


int main(){
  int n;
  cin>>n;

  int d[n];
  ARRIN(d, n);
  sort(d, d+n);
  int ans=d[n/2]-d[n/2-1];
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 640
/*;

THE BEST IS YET TO COME
*/
#include <bits/stdc++.h>
using namespace std;
#define r(i, s, l) for (int i = s; i < l; i++)
#define rr(i,s,l) for(int i=s;i>=l;i--)
#define mod 1000000007
#define int long long
#define INT_BITS 32
#define ld long double
#define pp pair<int,int>
#define ss second
#define ff first
#define INF 1e18
#define N 2000005
#define all(a) a.begin(), a.end()
#define pb push_back
#define endl "\n"
using namespace std;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}

signed main()
{


    int n,l;
    cin>>n>>l;

    int sum = 0;
    int diff = INT_MAX;

    vector<int> a(n);
    r(i,0,n)
    {
        a[i] = i+1;
        a[i] = l+i;
        sum += a[i];

    }

    int ans;
    r(i,0,n)
    {
          int sum2 = 0;
          r(j,0,n)
          {
              if(i!=j)
              sum2 += a[j];
          }

          if(abs(sum2-sum)<diff)
          {
              diff = abs(sum2 - sum);
              ans = sum2;
          }

    }

    cout<<ans;





	return 0;
}



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

using namespace std;


int main() {
	int N, Q; cin >> N >> Q;
	string str; cin >> str;
	int count[100000] = { 0 };
	int a = 0;
	int r, s;

	for (int i = 1; i < str.length(); i++) {
		if (str[i - 1] == 'A' && str[i] == 'C') {
			a++;
		}
		count[i + 1] = a;
	}
	for (int i = 0; i < Q; i++) {
		cin >> r >> s;
		cout << count[s] - count[r]<<endl;
	}
	


	return 0;
}

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

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            for (int i = 0; i < n; i++)
            {
                var a = Console.ReadLine();
                var b = Console.ReadLine();
                string result = isLarger(a, b) ? getSum(a, b) : getSum(b, a);
                if (result.Length > 80) result = "overflow";
                Console.WriteLine(result);
            }
        }

        static bool isLarger(string a, string b)
        {
            return a.Length > b.Length;
        }

        //a.Length is Larger than b.Length
        static string getSum(string a, string b)
        {
            string result = "";
            // i is index of b
            // j is index of a
            int carry = 0;
            for (int i = b.Length - 1, j = a.Length - 1; j >= 0; i--, j--)
            {
                var ca = a[j];
                var cb = i >= 0 ? b[i] : '0';
                int value = (ca - '0') + (cb - '0') + carry;
                result = (char)('0'+(value%10)) + result;
                carry = value / 10;
            }
            if (carry != 0) result = (char)('0' + carry) + result;
            return result;
        }
    }
}

Measured memory_bytes: 5480
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include<map>
#include<tuple>
using namespace std;
#define INF 1100000000000
#define MAX 1100000
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<pair<int,int>,int> p;
typedef pair< pair<int,int>, int> p; 
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)

ll dp[3100][3100],a[3100];
bool flag[3100][3100];

ll f(int l,int r){
    if(flag[l][r]) return dp[l][r];
    flag[l][r]=true;
    if(l==r) return dp[l][r]=a[l];
    return dp[l][r]=max(a[l]-f(l+1,r),a[r]-f(l,r-1));
}

int main(){
    int N; cin>>N;
    for(int i=0;i<3100;i++){
        for(int j=0;j<3100;j++){
            flag[i][j]=false;
        }
    }
    for(int i=0;i<N;i++) cin>>a[i];
    ll ans=f(0,N-1);
    cout<<ans<<endl;
}



Measured memory_bytes: 84352
#include<iostream>
#include<cstring>
#include<string>
using namespace std;
string s;
int main()
{
	cin >> s;
	int a = (s[0] == 'R')+(s[1] == 'R')+(s[2] == 'R');
	if(a != 2) cout << a << endl;
	else cout << (s[1] == 'R' ? 2 : 1) << endl;
	return 0;
}


Measured memory_bytes: 3592
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
	long long n, m;
	cin >> n >> m;
	if(m < 2 * n) cout << (long long)(m / 2.0) << endl;
	else cout << n + (long long)((m - 2 * n)/ 4.0) << endl;
	return 0;
}

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

int n,pos=1,len=0,maxv=-1;
string a[200005],ori="";

int cmp(string s1,string s2)
{
	return s1<s2;
}

struct node
{
	string s;
	int tim;
}q[200005];

signed main()
{
	cin>>n;
	for (int i=1;i<=n;i++)  cin>>a[i];
	sort(a+1,a+n+1,cmp);
	
	ori=a[1];
	for (int i=2;i<=n;i++)
	{
		if (a[i]!=ori&&i!=n)
		{
			len++;
			q[len].s=a[i-1];
			q[len].tim=pos;
			pos=0;
			ori=a[i];
		}
		else if (i==n&&a[i]==ori)
		{
			len++;
			q[len].s=a[i-1];
			q[len].tim=pos+1;
			break;
		}
		else if (i==n&&a[i]!=ori)
		{
			len++;
			q[len].s=a[i-1];
			q[len].tim=1;
			len++;
			q[len].s=a[i];
			q[len].tim=pos;
			break;
		}
		pos++;
	}
	
	for (int i=1;i<=len;i++)  maxv=max(maxv,q[i].tim);
	for (int i=1;i<=len;i++)
	{
		if (q[i].tim==maxv)  cout<<q[i].s<<endl;
	}
	return 0;
}

Measured memory_bytes: 17408
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>

//#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long int
#define pb push_back

const double PI=3.14159265358979323846;

int main() {
  int N;
  cin >> N;
  
  cout << N*PI*2 << endl;

}


Measured memory_bytes: 3788
import numpy as np

N = int(raw_input())
l = np.array(map(int, raw_input().split()))

mod_4 = len(np.where((l % 4 == 0))[0])
mod_2 = len(np.where(l % 4 == 2)[0])

if N <= 2 and mod_4 == 0 and mod_2 <= 1:
    print 'No'
elif N <= mod_4 * 2 + 1:
    print 'Yes'
elif N <= mod_4 * 2 + mod_2 and mod_2 >= 2:
    print 'Yes'
elif N <= mod_4 * 2 + mod_2:
    print 'Yes'
else:
    print 'No'


Measured memory_bytes: 19304
import math
a = []
while True:
    try:
        a.append(list(input().split()))

    except:
        break
for i in range(len(a)):
    if a[i][1] == '+':
        print(int(a[i][0])+int(a[i][2]))
    elif a[i][1] == '-':
        print(int(a[i][0])-int(a[i][2]))
    elif a[i][1] == '*':
        print(int(a[i][0])*int(a[i][2]))
    elif a[i][1] == '/':
        print(math.floor(int(a[i][0])/int(a[i][2])))
    else:
        break


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

int main(){
    bool ans = 0;
    int n;
    cin >> n;
    vector<int> q(n);
    int count = 0;
    for(int i = 0;i < n;i++){
        cin >> q.at(i);
        if(q.at(i) != i + 1){
            count++;
        }
    }

    if(count == 0||count == 2){
        ans = 1;
    }
    
    if(ans){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
   
   return 0;
}

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

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

int main(){
    string s,c;
    cin >> s;
    bool ok=true;
    for(int i=0;i<s.size();i++){
        if(s.at(i)!=s.at(s.size()-1-i))ok=false;
    }
    c=s;
    for(int i=0;i<s.size()/2+1;i++){
        c.pop_back();
    }
    for(int i=0;i<c.size();i++){
        if(c.at(i)!=c.at(c.size()-1-i))ok=false;
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
using P = pair<ll,ll>;
 
int n, t, a, b, e[2], ans;
long long dp[35], ac, INF = 1e9+7;
P s[2][200005];
 
int main(){
	scanf("%d%d", &n, &t); t++;
	rep(i,n){
		scanf("%d%d", &a, &b);
		s[!a][e[!a]++] = {a+1,b+1};
	}
	sort(s[0], s[0]+e[0], [](P &a, P &b){
		return a.second * (b.first-1) < b.second * (a.first-1);
	});
	sort(s[1], s[1]+e[1]);
	fill(dp,dp+30, INF);
	dp[0] = 1;
	rep(i,e[0]) for(int j=29; j>0; j--){
		dp[j] = min(dp[j], dp[j-1] * s[0][i].first + s[0][i].second);
	}
	rep(i,e[1]+1){
		ans = max(ans,(int)(i+upper_bound(dp, dp+30, t-ac)-dp-1));
		if(i<e[1]){
			ac += s[1][i].second;
			if(t <= ac) break;
		}
	}
	printf("%d\n", ans);
}

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

int main() {
	int n; cin >> n;
	vector<string> b(n);
	for (int i = 0; i < n; i++) {
		cin >> b[i];
	}
	int m; cin >> m;
	vector<string> r(m);
	for (int i = 0; i < m; i++) {
		cin >> r[i];
	}
	int ans = 0;
	auto clc = [&](string s) {
		int tmp = 0;
		for (auto x : b) if (s == x) tmp++;
		for (auto x : r) if (s == x) tmp--;
		return tmp;
	};
	for (auto x : b) ans = max(ans, clc(x));
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cmath>
#include <string>
#define SIZE 305
#define INF 1000000000

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

char mp[SIZE][SIZE];
int dp[SIZE][SIZE];
int rt[SIZE][SIZE];
int h,w;

int solve(string s,string t)
{
	for(int i=0;i<=h;i++)
	{
		for(int j=0;j<=h;j++)
		{
			if(i==0||j==0) rt[i][j]=0;
			else
			{
				rt[i][j]=rt[i-1][j-1];
				if(s[h-i]==t[h-j]) rt[i][j]++;
			}
		}
	}
	for(int i=h;i>=0;i--)
	{
		for(int j=h;j>=0;j--)
		{
			dp[i][j]=INF;
		}
	}
	dp[h][h]=0;
	for(int i=h;i>=0;i--)
	{
		for(int j=h;j>=0;j--)
		{
			if(i>=1) dp[i-1][j]=min(dp[i-1][j],dp[i][j]+rt[i][j]);
			if(j>=1) dp[i][j-1]=min(dp[i][j-1],dp[i][j]+rt[i][j]);
		}
	}
	return dp[0][0];
}
int main()
{
	scanf("%d %d",&h,&w);
	for(int i=0;i<h;i++) scanf("%s",&mp[i]);
	ll ret=0;
	for(int i=0;i+1<w;i++)
	{
		string s="",t="";
		for(int j=h-1;j>=0;j--)
		{
			s+=mp[j][i];
			t+=mp[j][i+1];
		}
		//printf("%s %s : %d\n",s.c_str(),t.c_str(),solve(s,t));
		ret+=solve(s,t);
	}
	printf("%lld\n",ret);
	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include <algorithm>
#include <string>
#include <utility>
#include <set>
#include <map>
#include<cmath>

//using lli = long long int;
int inf = 1000000007;
using namespace std;
#define sort(X) sort(X.begin(),X.end())

int N, K;

int main()
{
	cin >> N >> K;

	double ans = 0;

	for (int i = 1; i <= N; i++) {
		//iの目が出る
		int x = i;
		double y = 1;
		while (x < K) {
			x *= 2;
			y *= 0.5;
		}
		ans += y / (N + .0);
	}
	printf("%.10f\n", ans);
	//cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using Graph = vector<vector<int>>;


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;
}
ll modinv(ll a, ll m){
    ll b = m, u = 1, v = 0;
    while(b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if(u < 0) u += m;
    cout << u << endl;
    return u;
}

ll paty_counter(ll level, ll x){
    ll size = pow(2, level+2) - 3;
    ll pmi = pow(2, level) - 1;
    if(x == 0){
        return 0;
    }else if(level == 0){    
        return 1;
    }else{
        if(x <= (size - 1)/2){
            return paty_counter(level-1, x-1);
        }else{
            return pmi + 1 + paty_counter(level-1, x - pow(2, level+1) + 3 - 2);
        }
    }

}
 
int main() {
    string s;
    cin >> s;
    if(s=="Sunny"){
        cout << "Cloudy" << endl;
    } else if (s=="Cloudy"){
        cout << "Rainy" << endl;
    } else {
        cout << "Sunny" << endl;
    }
}



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

ll dp[3002][3002] = {};
ll a[3001];

int main(){
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++)  cin >> a[i];
    for(int i = n; i >= 1; i--){
        for(int j = i; j <= n; j++){
            int taken = n-i-j-1;
            if(taken%2){
                // Jiro
                dp[i][j] = min(dp[i+1][j]-a[i], dp[i][j-1]-a[j]);
            }else{
                // Taro
                dp[i][j] = max(dp[i+1][j]+a[i], dp[i][j-1]+a[j]);
            }
        }
    }
    cout << dp[1][n] << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const double PI2 = 8.0 * atan(1.0);

#define REP(i,n)	for(int i=0;i<(int)n;++i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define FOR(i,s,n)	for(int i=s;i<(int)n;++i)

int main(int argc, char **argv) {
	ll x;
	cin >> x;
	ll res = x / 11 * 2;
	x %= 11;
	if (x > 0) {
		++res;
		x -= 6;
	}
	if (x > 0) ++res;
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 764
function Main(input) {
  input = input.replace(/\n/g, ' ').split(" ");
  var A = Number(input[0]);
  var B = Number(input[1]);
  input = input.slice(2);
  for(var i=0;i<A-B;i++){
    if(Number(input[i])<Number(input[i+B])){
      console.log("Yes");
    }else{
      console.log("No");
    }
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 80704
/*⠄⢰⣧⣼⣯⠄⣸⣠⣶⣶⣦⣾⠄⠄⠄⠄⡀⠄⢀⣿⣿⠄⠄⠄⢸⡇⠄⠄
⠄⠄⠄⣾⣿⠿⠿⠶⠿⢿⣿⣿⣿⣿⣦⣤⣄⢀⡅⢠⣾⣛⡉⠄⠄⠄⠸⢀⣿⠄
⠄⠄⢀⡋⣡⣴⣶⣶⡀⠄⠄⠙⢿⣿⣿⣿⣿⣿⣴⣿⣿⣿⢃⣤⣄⣀⣥⣿⣿⠄
⠄⠄⢸⣇⠻⣿⣿⣿⣧⣀⢀⣠⡌⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⠿⣿⣿⣿⠄
⠄⢀⢸⣿⣷⣤⣤⣤⣬⣙⣛⢿⣿⣿⣿⣿⣿⣿⡿⣿⣿⡍⠄⠄⢀⣤⣄⠉⠋⣰
⠄⣼⣖⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿⣿⣿⣿⣿⢇⣿⣿⡷⠶⠶⢿⣿⣿⠇⢀⣤
⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣽⣿⣿⣿⡇⣿⣿⣿⣿⣿⣿⣷⣶⣥⣴⣿⡗
⢀⠈⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠄
⢸⣿⣦⣌⣛⣻⣿⣿⣧⠙⠛⠛⡭⠅⠒⠦⠭⣭⡻⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⠄
⠘⣿⣿⣿⣿⣿⣿⣿⣿⡆⠄⠄⠄⠄⠄⠄⠄⠄⠹⠈⢋⣽⣿⣿⣿⣿⣵⣾⠃⠄
⠄⠘⣿⣿⣿⣿⣿⣿⣿⣿⠄⣴⣿⣶⣄⠄⣴⣶⠄⢀⣾⣿⣿⣿⣿⣿⣿⠃⠄⠄
⠄⠄⠈⠻⣿⣿⣿⣿⣿⣿⡄⢻⣿⣿⣿⠄⣿⣿⡀⣾⣿⣿⣿⣿⣛⠛⠁⠄⠄⠄
⠄⠄⠄⠄⠈⠛⢿⣿⣿⣿⠁⠞⢿⣿⣿⡄⢿⣿⡇⣸⣿⣿⠿⠛⠁⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠉⠻⣿⣿⣾⣦⡙⠻⣷⣾⣿⠃⠿⠋⠁⠄⠄⠄⠄⠄⢀⣠⣴
⣿⣿⣿⣶⣶⣮⣥⣒⠲⢮⣝⡿⣿⣿⡆⣿⡿⠃⠄⠄⠄⠄⠄⠄⠄⣠⣴⣿*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl;

#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

ll MAX(ll a){return a;}
ll MIN(ll a){return a;}
template<typename... Args>
ll MAX(ll a,Args... args){return max(a,MAX(args...));}
template<typename... Args>
ll MIN(ll a,Args... args){return min(a,MIN(args...));}

#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	int n;
	
	cin>>n;
	
	int ans=0;
	int curr=0;
	
	do{
		ans++;
		curr=(curr+n)%360;
	} while (curr);
	
	cout<<ans<<endl;
}


Measured memory_bytes: 3652
import java.util.Scanner;

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

        while(true){
            int n = sc.nextInt();
            int x = sc.nextInt();

            if(n == 0 && x == 0){
                break;
            }
            int count = 0;
            for(int i = 1; i <= n; i++){
                for(int j = i + 1; j <= n; j++){
                    for(int m = j + 1; m <= n; m++){
                        if(i + j + m == x){
                            count++;
                        }
                    }
                }
            }
            System.out.println(count);
        }
    }
}


Measured memory_bytes: 26440
import java.util.*;

  class Main{
    public static void main(String args[]){
      Scanner sc = new Scanner(System.in);
  
      int n = sc.nextInt();
      int count = 0;
   
      for(int i=1;i<=n;i++){
        count += i;
      }
    
      System.out.println(count);
  }
      
  
}

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

using namespace std;

#define fo(i,n) for(int i=0; i<n; i++)
#define Fo(i,k,n) for(int i=k; i<n; i++)
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define clr(x) memset(x, 0, sizeof(x))
#define tr(it, a) for(auto it=a.begin(); it!=a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vl> vvl;

int n,W;
vvl wi;
vl dp;

void printt(){
    Fo(i,1,n+1){
        ll currW = wi[i][0], currVal = wi[i][1];
        for(int j=W;j>=0;j--){
            if(currW<=j){
                if(dp[j-currW]!=-1){
                    dp[j] = max(dp[j-currW]+currVal, dp[j]);
                }
            }
        }
    // fo(i,W+1){
    //     cout<<dp[i]<<" ";
    // }
    // cout<<endl;
    }
    ll maxi=-1;
    Fo(i,0,W+1){
        if(dp[i]>maxi){
            maxi = dp[i];
        }
    }
    cout<<maxi<<endl;
}

void take_inp() {
    cin>>n>>W;
    wi.resize(n+1, vl(2));
    dp.resize(W+1);
    dp[0] = 0;
    Fo(i,1,W+1){
        dp[i] = -1;
    }
    Fo(i,1,n+1){
        ll a,b;
        cin>>a>>b;
        wi[i][0] = a;
        wi[i][1] = b;
    }
}

int main() {
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    take_inp();
    printt();
    return 0;
}

Measured memory_bytes: 1024
//abc145_a.cpp
//Sat Nov 16 20:53:07 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	int r;
	cin >> r;

	cout << r*r << endl;
//	printf("%.4f\n",ans);
}

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

int main(){
    int n, h, m, s;
    cin >> n;
    h = n / (60 * 60);
    m = (n % (60 * 60)) / 60;
    s = (n % (60 * 60)) % 60;
    cout << h << ':' << m << ':' << s << endl;
    return 0;
}


Measured memory_bytes: 3116
n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
D = []
Sum = sum(B)
for i in range(n-1):
	if A[i+1] == A[i] + 1:
		p = A[i] - 1
		D.append(C[p])
Add = sum(D)
print(Sum+Add)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
    int n;
    cin >> n;
    vector<double> p(n);
    for(int i = 0; i < n; i++){
        cin >> p[i];
    }

    vector<vector<double> > dp(n,vector<double>(n,0));

    dp[0][0] = p[0];
    for(int i = 1; i < n; i++){
        dp[i][0] = p[i];
        for(int j = 0; j < i; j++){
            dp[i][0] *= (1-p[j]);
        }
        dp[i][0] += (1-p[i])*dp[i-1][0];
    }

    for(int i = 1; i < n; i++){
        for(int j = 1; j < n; j++){
            dp[i][j] = p[i]*dp[i-1][j-1] + (1-p[i])*dp[i-1][j];
        }
    }


    // for(int i = 0; i < n; i++){
    //     for(int j = 0; j < n; j++){
    //         cout << dp[i][j] << " ";
    //     }printf("\n");
    // }
    double ans = 0;
    for(int i = n/2; i < n ; i++){
        ans += dp[n-1][i];
    }
    printf("%.15f\n", ans);

    return 0;
}

Measured memory_bytes: 70656
n = int(input())
s = input()

turn_east = [0 for x in range(n)]
turn_west = [0 for x in range(n)]
total = [0 for x in range(n)]

for i in range(n):
  if i > 0:
    if s[i-1] == 'W':
      turn_east[i] = turn_east[i-1]+1
    else:
      turn_east[i] = turn_east[i-1]

    if s[n-i] == 'E':
      turn_west[n-1-i] = turn_west[n-i]+1
    else:
      turn_west[n-1-i] = turn_west[n-i]

for j in range(n):
  total[j] = turn_east[j] + turn_west[j]

print(min(total))


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

public class Main {
    private static final int MP_CONSUMPTION_COMPOSITION_MAGIC = 10;
    private static final int IMPOSSIBLE = 10_000_000;

    public static int process(TestCase testCase) {
        return dfs(testCase, 0, 0, 0, 0);
    }

    private static int dfs(TestCase testCase, int curr, int a, int b, int c) {
        int N = testCase.N;
        int A = testCase.A;
        int B = testCase.B;
        int C = testCase.C;

        if (curr == N) {
            if (a > 0 && b > 0 && c > 0) {
                return diff(a, A) + diff(b, B) + diff(c, C) - 3 * MP_CONSUMPTION_COMPOSITION_MAGIC;
            } else {
                return IMPOSSIBLE;
            }
        } else {
            List<Integer> l = testCase.l;
            final int value = l.get(curr);
            int v0 = dfs(testCase, curr + 1, a, b, c);
            int v1 = dfs(testCase, curr + 1, a + value, b, c) + MP_CONSUMPTION_COMPOSITION_MAGIC;
            int v2 = dfs(testCase, curr + 1, a, b + value, c) + MP_CONSUMPTION_COMPOSITION_MAGIC;
            int v3 = dfs(testCase, curr + 1, a, b, c + value) + MP_CONSUMPTION_COMPOSITION_MAGIC;

            return Math.min(Math.min(Math.min(v0, v1), v2), v3);
        }
    }

    private static int diff(int actual, int target) {
        return Math.abs(actual - target);
    }

    // Util func

    public static void main(String[] args) {
        TestCase testCase = readFromInput();

        final int result = process(testCase);

        output(result);
    }

    private static TestCase readFromInput() {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        List<Integer> l = new ArrayList<>();
        for (int i = 0; i < N; ++i) {
            l.add(sc.nextInt());
        }

        sc.close();
        return new TestCase(N, A, B, C, l);
    }

    private static void output(int result) {
        System.out.println(result);
    }

    public static class TestCase {
        final int N;
        final int A;
        final int B;
        final int C;
        final List<Integer> l;

        public TestCase(int N, int A, int B, int C, final List<Integer> l) {
            this.N = N;
            this.A = A;
            this.B = B;
            this.C = C;
            this.l = l;
        }
    }
}


Measured memory_bytes: 24880
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef unsigned long long int ull;
typedef long long lint;

int main(void){
    lint N,K;
    cin >> N >> K;
    lint A[N];
    rep(i,N) cin >> A[i];
    lint sum[N+1]={};
    rep(i,N) sum[i+1]=sum[i]+A[i];
    lint all=(N*(N+1))/2;
    lint sub[all];
    lint now=0;
    for(int i=0;i<N;i++) for(int j=i+1;j<=N;j++) sub[now]=sum[j]-sum[i],now++;
    lint ans=0;
    for(int i=50;i>=0;i--){
        int count=0;
        rep(j,all) if(((ans+(1LL<<i))&sub[j])==(ans+(1LL<<i))) count++;
        if(count>=K) ans+=1LL<<i;
    }
    cout << ans << endl;
}

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

int main() {
  int n;
  string s;
  cin >> n >> s;
  for (int i = 0; i < s.size(); i++) {
    s[i] = (s[i] - 'A' + n) % 26 + 'A';
  }
  cout << s << endl;
}

Measured memory_bytes: 256
N = gets.chomp.to_i

flag = true

h = Hash.new(false)
w = []
N.times do |i|
  w << gets.chomp

  if h[w[i]]
    flag = false
  end

  h[w[i]] = true

  next if i == 0

  if w[i-1][-1] != w[i][0]
    flag = false
  end
end

puts flag ? 'Yes' : 'No'


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL<<60;
#define REP(i,n) for(int i=0; i<(n);++i)
#define FOR(i,k,n) for(int i=(k);i<(n);++i)

int main(){
    int x,y;cin>>x>>y;
    if(x>0 && y>0){
        if(x<=y)cout<<y-x<<endl;
        else{
            cout<<x-y+2<<endl;
        }
    }else if((x>0 && y<0)||(x<0 && y>0)){
        cout<<abs(abs(x)-abs(y))+1<<endl;
    }else if(x<0 && y<0){
        if(x<=y)cout<<y-x<<endl;
        else{
            cout<<x-y+2<<endl;
        }
    }else{
    	if(x==0 && y<0)cout<<1-y<<endl;
      	else if(x==0 && y>0)cout<<y<<endl;
      	else if(x<0 && y==0)cout<<-x<<endl;
      	else cout<<x+1<<endl;
      	
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <queue>
#include <algorithm>
#include <cmath>
#include <list>
#include <cstring>
using namespace std;

int main()
{
    list <int> l;
    list <int> :: iterator it;
    char op[10];
    int v, q;
    scanf("%d", &q);

    while (q--)
    {
        scanf("%s", op);
        if (op[0] == 'i')
            {
                scanf("%d", &v);
                l.push_front(v);
            }
        else if (strlen(op) == 10)   //deleteLast
            l.pop_back();
        else if (strlen(op) == 11)   //deleteFirst
            l.pop_front();
        else
        {
            scanf("%d", &v);

            for (it = l.begin(); it != l.end(); it++)
            {
                if (*it == v)
                {
                    l.erase(it);
                    break;
                }
            }
        }
    }

    it = l.begin();
    printf("%d", *it);
    it++;
    for (; it != l.end(); it++)
        printf(" %d", *it);
    printf("\n");
    return 0;
}


Measured memory_bytes: 34436
# -*- coding: utf-8 -*-

#整数値龍力　複数の入力
def input_multiple_number():
    return map(int, input().split())

N_given,A_given,B_given = input_multiple_number()

cnt = 0
while True:
    if (B_given - A_given)%2 == 0:
        print(cnt + (B_given-A_given)//2)
        exit(0)
    else:
        if (N_given - B_given) > (A_given-1):
            cnt += (A_given-1)
            cnt += 1
            A_given = 1
            B_given -= cnt
        else:
            cnt += (N_given - B_given)
            cnt += 1
            B_given = N_given
            A_given += cnt




Measured memory_bytes: 3060
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n; cin >> n;
    vi a(n); for(auto& e : a) cin >> e;
    a.emplace_back(inf);

    int res = 0;
    int cur = 0;
    rep(i, 1, n+1){
        if(a[i] <= a[i-1]){
            cur++;
        }
        else {
            chmax(res, cur);
            cur = 0;
        }
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;

ll calc(ll A, ll B)
{

    if (A>B) swap(A, B);
    ll ans;
    if ((B-A)%2==0) ans = (B-A)/2;
    else
    {
        A = -A+1;
        ans = (B-A)/2;
    }
    return ans;
}

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

    ll ans = calc(A, B);
    // cout << ans << endl;
    A = N-A+1;
    B = N-B+1;
    ans = min(ans, calc(A, B));
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#pragma GCC optimize("O3,Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("avx,avx2,sse")
using namespace std;

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

    int x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;
    vector<pair<int, int>> apples;
    for (int i = 0; i < a; i++) {
        int x;
        cin >> x;
        apples.push_back({x, 0});
    }
    for (int i = 0; i < b; i++) {
        int x;
        cin >> x;
        apples.push_back({x, 1});
    }
    for (int i = 0; i < c; i++) {
        int x;
        cin >> x;
        apples.push_back({x, 2});
    }
    sort(apples.begin(), apples.end());
    int tot = 0;
    int sp = 0;
    for (int i = apples.size() - 1; i >= 0; i--) {
        if (x + y - sp == 0) break;
        if (apples[i].second == 0) {
            if (x > 0) {
                x--;
                tot += apples[i].first;
            }
        } else if (apples[i].second == 1) {
            if (y > 0) {
                y--;
                tot += apples[i].first;
            }
        } else {
            sp++;
            tot += apples[i].first;
        }
    }
    cout << tot << '\n';

    fflush(stdout);
    return 0;
}


Measured memory_bytes: 11600
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <iomanip>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,ans=0;
	cin>>n;
	vector<int> a(n);
	for(int i=0;i<n;i++) cin>>a[i];
	for(int i=1;i<n-1;i++){
		if(a[i-1]<a[i] && a[i]<a[i+1]){
			ans++;
		}else if(a[i-1]>a[i] && a[i]>a[i+1]){
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout <<(#x)<<" is "<<(x)<<endl
#define debug cout <<"hi"<<endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MOD=1e9+7;
const int INF32=1<<30;
const ll INF64=1LL<<60;

void solve(){
  int p,q,r; cin >>p >>q >>r;
  cout <<p+q+r-max({p,q,r});
}

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  solve();
return 0;}

Measured memory_bytes: 3644
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		if (n==2) {
			System.out.println("4 7");
			System.out.println("23 10");
			return;
		}
		
		int snt[] = new int[n * 2];

		int cn = 0;
		int x = 2;
		while (cn < n * 2) {
			if (isSNT(x)) {
				snt[cn] = x;
				cn++;
			}
			x++;
		}

		long[][] a = new long[n][n];
		for (int i = 0; i < n; i++) {
			for (int j = i % 2; j < n; j += 2) {
				int a1 = (i + j) / 2;
				int a2 = (j - i + n - 1) / 2 + n;
				a[i][j] = snt[a1] * snt[a2];
			}
		}



		int dx[] = { -1, 0, 1, 0 };
		int dy[] = { 0, 1, 0, -1 };
		for (int i = 0; i < n; i++) {
			for (int j = (i + 1) % 2; j < n; j += 2) {
				long gcd = 0;
				long tich = 1;
				for (int k = 0; k < 4; k++) {
					if (i + dx[k] < 0 || i + dx[k] >= n)
						continue;
					if (j + dy[k] < 0 || j + dy[k] >= n)
						continue;
					if (gcd == 0) {
						gcd = a[i + dx[k]][j + dy[k]];
						tich = gcd;
					} else {
						gcd = gcd(tich, a[i + dx[k]][j + dy[k]]);
						tich = tich / gcd * a[i + dx[k]][j + dy[k]];
					}
				}
				a[i][j] = tich+1;

			}
		}
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				System.out.print(a[i][j] + " ");
			}
			System.out.println();
		}
	}

	private static boolean isSNT(int x) {
		for (int i = 2; i * i <= x; i++)
			if (x % i == 0)
				return false;
		return true;
	}

	private static long gcd(long a, long b) {
		return (b == 0) ? a : gcd(b, a % b);
	}
}


Measured memory_bytes: 48568
# D - Water Bottle
a, b, x = map(int, input().split())

import math
if x / (a**2) > b / 2:
    tmp = ((2 * (a**2) * b) - (2 * x)) / (a**3)
    angle = math.degrees(math.atan(tmp))
else:
    tmp = (a * (b**2)) / (x * 2)
    angle = math.degrees(math.atan(tmp))

print(angle)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{

     long long int n,i,j=1,c=0,f=0000000000,l,k,x,y,z,m,b,a;
     string s="",s1;
     char o;
     set <int, greater <int> > st;
     stack<char>sta;
     //int a[5];
    //long long  int arr[n+2][n+2];
     vector<char>ch(27);
     vector<string>str;
     vector<int>vect,vect3;
     map<int,int>mp;
     cin>>n>>k>>l;
     x=abs(n)/l;
     if(k<=x)
        cout<<abs(n)-l*k<<endl;
     else
     {
         if((x-k)%2)
            cout<<abs(abs(n)-(x+1)*l)<<endl;
         else
            cout<<abs(abs(n)-x*l)<<endl;
     }
}



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

int main(void){
  double r;
  double area,length;

  scanf("%lf",&r);

  length = 2.0*r*M_PI;
  area = r*r*M_PI;

  printf("%f %f\n",area,length);
  
  return 0;
}

Measured memory_bytes: 648
#include <iostream>
#include <iomanip>

void swap(int* a, int* b)
{
    int tmp = *a;
    *a = *b;
    *b = tmp;
}

int main()
{
    int a, b;
    std::cin >> a >> b;
    std::cout << a / b << ' ';
    std::cout << a % b << ' ';
    std::cout << std::fixed;
    std::cout << std::setprecision(8) << (double) a / b << std::endl;
    return 0;
}



Measured memory_bytes: 3268
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cstring>

using namespace std;

int main(){
    double w,h,x,y;
    cin >> w >> h >> x >> y;
    double ans = (w * h) / 2;
    int num;
    if(2 * x == w && 2 * y == h){
        num = 1;
    }else {
        num = 0;
    }

    printf("%.10f %d\n", ans , num);
    
}

Measured memory_bytes: 256
X, Y, Z, K = map( int, input().split())
A = list( map( int, input().split()))
B = list( map( int, input().split()))
C = list( map( int, input().split()))
A.sort( key=None, reverse = True)
B.sort( key=None, reverse = True)
C.sort( key=None, reverse = True)
AB = [0]*(X*Y)
for i in range(X):
    for j in range(Y):
        AB[i*Y+j] = A[i]+B[j]
AB.sort( key=None, reverse = True)
ABC = [0]*3000000
for i in range( min(X*Y, 3000)):
    for j in range(Z):
        ABC[i*Z + j] = AB[i]+C[j]
ABC.sort( key=None, reverse = True)
for i in range(K):
    print( ABC[i])

Measured memory_bytes: 98684
# include <bits/stdc++.h>
using namespace std;
 
typedef long long LL;
const int maxn = 1e5;
int n, a, b, m[maxn+3];
 
bool judge(LL x)
{
    LL sum = 0;
    for(int i=0; i<n; ++i)
    {
        LL t = (LL)m[i]-x*b;
        if(t>0)
        {
            sum += (int)ceil(t*1.0/(a-b));
            if(sum > x || sum < 0)
                return false;
        }
    }
    return true;
}
int main()
{
    while(~scanf("%d%d%d",&n,&a,&b))
    {
        int imax = 0;
        for(int i=0; i<n; ++i) scanf("%d",&m[i]), imax = max(imax, m[i]);
        LL l=0, r=imax;
        while(l<r)
        {
            LL mid = l+r>>1;
            if(judge(mid)) r=mid;
            else l=mid+1;
        }
        printf("%lld\n",r);
    }
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
map <string,int> mp;
string s;
long long ans=0;
int main(){
	int n;cin>>n;
	while (n--){
		cin>>s;
		sort (s.begin(),s.end());
		ans+=mp[s]++;
	}
	cout<<ans;
}

Measured memory_bytes: 11136
import java.util.Scanner;

public class Main {

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

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int res = 0;
//		String s = sc.next();
//		String res = "";


		System.out.printf("%d %d %d", c,a,b);
		//System.out.println(res);
	}
}


Measured memory_bytes: 21460
#include<bits/stdc++.h>
#include<boost/algorithm/string/replace.hpp>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::algorithm;
using namespace boost::multiprecision;
 
#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
 
const int INF = 1e9;
const int MOD = 1e9+7;

template<typename T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//C++17以上
template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}

template<typename T>//文字列の置換/Boost:replace_all()
T replace_str(T str, string target, string str_to) {
    string::size_type pos = 0;
    while (pos = str.find(target, pos), pos != string::npos) {
        str.replace(pos, target.length(), str_to);
        pos += str_to.length();
    }
    return str;
}

int main(){
    int n,k;cin >> n >> k;
    ll ans = 0;
    ll ans_half = 0;
    if(k%2==1){
        for(int i=1;i<=n;i++){
            if(i%k==0)ans++;
        }
    }else{
        for(int i=1;i<=n;i++){
            if(i%k==0)ans++;
            if(i%k==k/2)ans_half++;
        }
    }
    cout << ans*ans*ans + ans_half*ans_half*ans_half << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);

        int line = scan.nextInt();
        int D = line % 10;
        line /= 10;
        int C = line % 10;
        line /= 10;
        int B = line % 10;
        line /= 10;
        int A = line % 10;

        if(A + B + C + D == 7) System.out.println(A+ "+" +B+ "+" +C+ "+" + D + "=7");
        else if(A - B + C + D == 7) System.out.println(A+ "-" +B+ "+" +C+ "+" + D + "=7");
        else if(A + B - C + D == 7) System.out.println(A+ "+" +B+ "-" +C+ "+" + D + "=7");
        else if(A - B - C + D == 7) System.out.println(A+ "-" +B+ "-" +C+ "+" + D + "=7");
        else if(A + B + C - D == 7) System.out.println(A+ "+" +B+ "+" +C+ "-" + D + "=7");
        else if(A - B + C - D == 7) System.out.println(A+ "-" +B+ "+" +C+ "-" + D + "=7");
        else if(A + B - C - D == 7) System.out.println(A+ "+" +B+ "-" +C+ "-" + D + "=7");
        else if(A - B - C - D == 7) System.out.println(A+ "-" +B+ "-" +C+ "-" + D + "=7");
    }
}


Measured memory_bytes: 23636
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

public class Main {

	static long[] length;
	static long[] pArray;

	public static void main(String[] args) {
		Scanner sc = new Scanner();
		int n = sc.nextInt();
		long x = sc.nextLong();
		length = new long[n+1];
		pArray = new long[n+1];

		for(int i = 0; i < n; i++){
			if(i == 0) {
				length[i] = 1;
				pArray[i] = 1;
			}else {
				length[i] = length[i - 1] + (long) Math.pow(2, i+1);
				pArray[i] = pArray[i-1] + (long)Math.pow(2, i);
			}
		}


		System.out.println(calc(n, x));
	}

	static Map<Integer, Long> map = new HashMap<>();


	static long calc(int n, long x){
		if(n == 0)
			return 1;

		if(n == x && map.containsKey(n))
			return map.get(n);

		long sum = 0;
		x--;
		long beforeLength = length[n-1];
		if(x > 0) {
			if(beforeLength <= x){
				sum += pArray[n-1];
			}else{
				sum += calc(n - 1, Math.min(x, beforeLength));
			}
			x -= beforeLength;
		}
		if(x > 0){
			x--;
			sum += 1;
		}
		if(x > 0){
			if(beforeLength <= x){
				sum += pArray[n-1];
			}else{
				sum += calc(n - 1, Math.min(x, beforeLength));
			}
			x -= beforeLength;
		}
		if(n == x){
			map.put(n, sum);
		}

		return sum;
	}
}

class Scanner {
	private static final int SPACE = (int)' ';
	private static final int LINE_END_0 = 13;
	private static final int LINE_END_1 = 10;
	private static final int BEFORE = -1;
	private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	
	public String next(){
		StringBuilder sb = new StringBuilder();
		
		int length = BEFORE;
		readLoop: while(true) {
			try {
				int value = br.read();
				switch(value) {
				case LINE_END_1:
					if(length == BEFORE)
						break;
					
					if((int)sb.charAt(length) == LINE_END_0)
						sb.deleteCharAt(length);
				case SPACE:
					break readLoop;
				}
				sb.append((char)value);
				length++;

			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return sb.toString();
	}
	
	public String[] nextArray(int length) {
		String[] array = new String[length];
		for(int i = 0; i < length; i++)
			array[i] = next();
		return array;
	}
	
	public double nextDouble() {
		return Double.parseDouble(next());
	}
	
	public double[] nextDoubleArray(int length) {
		double[] array = new double[length];
		for(int i = 0; i < length; i++)
			array[i] = nextDouble();
		return array;
	}
	
	public int nextInt() {
		return Integer.parseInt(next());
	}
	
	public int[] nextIntArray(int length) {
		int[] array = new int[length];
		for(int i = 0; i < length; i++)
			array[i] = nextInt();
		return array;
	}
	
	public long nextLong() {
		return Long.parseLong(next());
	}
	
	public long[] nextLongArray(int length) {
		long[] array = new long[length];
		for(int i = 0; i < length; i++)
			array[i] = nextLong();
		return array;
	}
	
	public boolean ready() {
		try {
			return br.ready();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return false;
	}
}


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

int main(int argc, char *argv[]) {
  int A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;
  long ans = 1e5 * 2 * 5000 + 1;
  for(int i = 0; i <= 2 * max(X, Y); i+= 2) {
    long tmp = 0;
    tmp += C * i;
    if(X - i / 2 >= 0) {
      tmp += (X - i / 2) * A;
    }
    if(Y - i / 2 >= 0) {
      tmp += (Y - i / 2) * B;
    }
    if(tmp < ans) {
      ans = tmp;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256