akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {

  int N;
  cin >> N;

  vector<int> A(N + 1);

  for(int i = 0; i < N; i++){
    cin >> A[i];
  }

  A[N] = 0;

  long long kane = 1000;
  long long kabu = 0;

  for(int i = 0; i < N; i++){
    if(A[i] < A[i + 1]){
      if(kabu == 0){
        kabu = kane / A[i];
        kane = kane % A[i];
      }
    }else if(A[i] > A[i + 1]){
      kane += kabu * A[i];
      kabu = 0;
    }
  }
  cout << kane << endl;
}

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

using namespace std;

using int64 = long long;
const int mod = 998244353;

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

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


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

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

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

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

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

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

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

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

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

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

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

int main() {
  int N;
  cin >> N;
  vector< int > A(N);
  cin >> A;
  reverse(begin(A), end(A));
  vector< int > tap(N + 1, inf);
  for(int i = 0; i < N; i++) {
    *upper_bound(begin(tap), end(tap), A[i]) = A[i];
  }
  int q = lower_bound(begin(tap), end(tap), inf) - begin(tap);
  cout << q << endl;
}







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

using namespace std; 
typedef long long ll;

int n;
ll W, w[110], v[110];
vector<ll> V[4];

int main(void) {
  cin >> n >> W;
  for (int i = 0; i < n; i++) {
    cin >> w[i] >> v[i];
    V[w[i] - w[0]].push_back(v[i]);
  }

  for (int i = 0; i < 4; i++) {
    sort(V[i].begin(), V[i].end(), greater<ll>());
    for (int j = 1; j < V[i].size(); j++) {
      V[i][j] += V[i][j - 1];
    }
  }

  ll ans = 0;
  for (int i = 0; i <= V[0].size(); i++) {
    for (int j = 0; j <= V[1].size(); j++) {
      for (int k = 0; k <= V[2].size(); k++) {
        ll rem = W - w[0] * i - (w[0] + 1) * j - (w[0] + 2) * k;
        if (rem < 0) continue;
        ll l = rem / (w[0] + 3);
        ll sum = 0;
        if (i) sum += V[0][i - 1];
        if (j) sum += V[1][j - 1];
        if (k) sum += V[2][k - 1];
        if (l && l < V[3].size()) sum += V[3][l - 1];
        ans = max(ans, sum);
      }
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;

int main(){
    ll a,b;
    cin>>a>>b;
    ll ans=0;
    ans+=max(a,b);
    if(a>=b){
        ans+=max(a-1,b);
    }else{
        ans+=max(a,b-1);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}


int main() {
  int A,B;
  char op;
  cin>>A>>op>>B;
  if(op=='+'){cout<<A+B<<endl;}
  else{cout<<A-B<<endl;}
  return 0;
}

Measured memory_bytes: 3608
n = int(input())
a = list(map(int, input().split())) # list()でリスト化、それを変数liに代入。
b = list(map(int, input().split())) # list()でリスト化、それを変数liに代入。
c = list(map(int, input().split())) # list()でリスト化、それを変数liに代入。
m = 0

for i in range(n):
    m = m + b[a[i]-1]
    if(i > 0 and a[i] == a[i-1] + 1):
        m = m + c[a[i-1]-1]

print(m)


Measured memory_bytes: 3060
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>

using namespace std;


void solve() {
    vector<vector<int>> A(3, vector<int>(3));
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> A[i][j];
        }
    }

    vector<vector<int>> bingo(3, vector<int>(3, false));

    int N; cin >> N;

    vector<int> b(N);
    for (int n = 0; n < N; n++) {
        int b; cin >> b;
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (A[i][j] == b) bingo[i][j] = true;
            }
        }
    }

    bool flag = false;

    for (int i = 0; i < 3; i++) {
        if (bingo[i][0] && bingo[i][1] && bingo[i][2]) flag = true;
    }

    for (int i = 0; i < 3; i++) {
        if (bingo[0][i] && bingo[1][i] && bingo[2][i]) flag = true;
    }

    if (bingo[0][0] && bingo[1][1] && bingo[2][2]) flag = true;
    if (bingo[0][2] && bingo[1][1] && bingo[2][0]) flag = true;

    cout << (flag ? "Yes" : "No") << endl;

}


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

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    
    if(x>=1 && x<=1000){
      if (x == 1) {
        System.out.println(1);
        return;
      }
      int max = 1;
      for(int i = 2; i <= x; i++){
        for(int k = 2; Math.pow(i,k) <=x; k++){
          max = Math.max(max,(int)Math.pow(i,k));
         }
      }
        
        System.out.println(max);
      
    }else{
      System.out.println("入力条件が誤っています");
    } 
  }  
}

Measured memory_bytes: 35632
using System;

public class hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        var s = Console.ReadLine().Trim();
        getAns(s, n);
    }
    static void getAns(string s, int n)
    {
        var count = 0;
        var p = 0;
        while (p < n - 1)
        {
            if ((s[p] == 'O' && s[p + 1] == 'X') | (s[p] == 'X' && s[p + 1] == 'O'))
            {
                count++;
                p += 2;
            }
            else p++;
        }
        Console.WriteLine(count);
    }
}


Measured memory_bytes: 17968
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <sstream>
#include <istream>

using namespace std;

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

int main(){
	int N;
	string s[10000];

	cin >> N;
	for(int i=0;i<N;i++) cin >> s[i];

	int num = 0;
	bool a[N];
	bool b[N];
	for(int i=0;i<N;i++){
		if(s[i][0] == 'B') b[i] = true;
		else b[i] = false;
		if(s[i][s[i].length()-1] == 'A') a[i] = true;
		else a[i] = false;
		for(int j=1;j<s[i].length();j++){
			if (s[i][j-1] == 'A' && s[i][j]=='B') num++;
		}
	}
	int onlya = 0;
	int onlyb = 0;
	int both = 0;
	for (int i = 0; i < N; i++){
		if(a[i]&&!b[i]) onlya++;
		if(!a[i]&&b[i]) onlyb++;
		if(a[i]&&b[i]) both++;
	}
	int ans = num;
	ans += min(onlya,onlyb);

	if(onlya==0&&onlyb==0 && both>0){
		ans += both-1;
	}else{
		ans += both;
	}

	cout << ans << endl;

	return 0;

}


Measured memory_bytes: 896
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;

char s[201010];

int main()
{
    int n;
    int a,b,c,d;
    int res=0;
    scanf("%d",&n);
    scanf("%d%d%d%d",&a,&b,&c,&d);
    scanf("%s",s);
    for(int i=a-1; i<max(c,d); i++)
    {
        if(s[i]=='#'&&s[i-1]=='#')
        {
            printf("No\n");
            return 0;
        }
    }
    int  flag=0;
    for(int i=b-1; i<min(c,d); i++)
    {
        if(s[i]=='.'&&s[i-1]=='.')
        {
                if(s[i+1]=='.')
                    flag=1;
        }
    }
    if(c>d)
    {
        if(flag)
            printf("Yes\n");
        else
            printf("No\n");
    }
    else
        printf("Yes\n");
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<math.h>
using namespace std;

void a(){
    string arc = "ARC";
    string abc = "ABC";
    string s;
    cin >> s;
    if(s.compare(arc)){
        cout<<arc;
    }else{
        cout<<abc;
    }
    return;
}

void b(){
    int n,k;
    cin >> n >> k;
    vector<int>vec(n,0);
    for(int i=0;i<k;i++)
    {
        int d;
        cin >>d;
        for(int j=0;j<d;j++)
        {
            int a;
            cin >>a;
            vec[a-1]++;
        }
    }
    int count = 0;
    for(int i=0;i<n;i++)
    {
        if(vec[i]==0)count++;
    }
    cout<<count;
    return;
}

void c(){
   int n,m;
   cin>>n>>m;
   vector<int>h;
   for(int i=0;i<n;i++)
   {
       int t;
       cin >> t;
       h.push_back(t);
   }
   vector<int>f(n,0);
   for(int j=0;j<m;j++)
   {
       int a,b;
       cin >> a>>b;
       if(h[a-1]>h[b-1])
       {
           f[b-1]=1;
       }
       else if(h[a-1]<h[b-1])
       {
           f[a-1]=1;
       }
       else
       {
           f[a-1]=1;
           f[b-1]=1;
       }
   }
   int count=0;
   for(int i=0;i<n;i++)
   {
       if(f[i]==0)count++;
   }
   cout<<count;
   return;
}

void d(){
    int x;
    cin >>x;

    
}
void e(){
    int n;
    cin >>n;
    vector<int>a;
    a.push_back(0);
    map<int,int>c;
    int vmin = INT32_MAX;
    int vmax = INT32_MIN;
    for(int i=0;i<n;i++)
    {
        int ai;
        cin >>ai;
        a.push_back(ai);
    }
    long long int pcount=0;
    
    for(int i=n-1;i>0;i--)
    {
        if(c.count(-(a[i+1]-(i+1)))==0){
            c[-(a[i+1]-(i+1))]=1;
        }
        else{
            c[-(a[i+1]-(i+1))]=c[-(a[i+1]-(i+1))]+1;
        }
        if(c.count(i+a[i])!=0)
        pcount+= c[i+a[i]];
    }
    cout << pcount;
    return;

}
int main(void){
    //a();
    //b();
    //c();
    //d();
    e();

}

Measured memory_bytes: 12488
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>; 
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
    int n, x, t; cin >> n >> x >> t;
    int res = 0, cnt = 0;
    while(cnt < n){
        res += t;
        cnt += x;
    }
    cout << res << ln;
}
    


Measured memory_bytes: 3632
let classify (acc: int array) =
    function
    | "AC" ->
        acc.[0] <- acc.[0] + 1
        acc
    | "WA" ->
        acc.[1] <- acc.[1] + 1
        acc
    | "TLE" ->
        acc.[2] <- acc.[2] + 1
        acc
    | _ ->
        acc.[3] <- acc.[3] + 1
        acc

let rec solve (acc: int array) s =
    match s with
    | [] -> acc
    | x :: xs ->
        let accNew = classify acc x
        solve accNew xs

[<EntryPoint>]
let main argv =
    let n = stdin.ReadLine() |> int

    let s =
        seq {
            for i in 1 .. n do
                stdin.ReadLine()
        }
        |> List.ofSeq

    let acc = solve [| 0; 0; 0; 0 |] s
    printfn "AC x %d" acc.[0]
    printfn "WA x %d" acc.[1]
    printfn "TLE x %d" acc.[2]
    printfn "RE x %d" acc.[3]
    0


Measured memory_bytes: 36436
D_N = [int(i) for i in input().split()]
t = 0
q = 100 ** D_N[0]
i = 0


while(D_N[1]):
    i = i+1
    t = t+q
    
    if i == 100:
        print(t + q)
        break

    if i == D_N[1]:
        print(t)
        
        break


Measured memory_bytes: 2940
N,M = map(int,input().split())
AB = [0]*N
for i in range(N):
    AB[i] = list(map(int,input().split()))

AB = sorted(AB,key = lambda k:k[0])
yen =0
num =0
for j in range(N):
    num += AB[j][1]
    if num >= M:
        yen += (M - (num - AB[j][1])) * AB[j][0]
        break
    else:
        yen += AB[j][1]*AB[j][0]

print(yen)
    

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

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public  static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // int d[]=new int[n];
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}

        int n=sc.nextInt();
        P d[]=new P[n];
        for (int i = 0; i < d.length; i++) {
			d[i] = new P(sc.nextInt(), sc.nextInt());
		}
        sort(d);
        long c=0;
        for (int i = 0; i < d.length; i++) {
        	if(i%2==0)c+=d[n-i-1].a;
        	else c-=d[n-i-1].b;
		}
 
        out.println(c);
        out.flush();
    }
    
    
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
}

//class P {
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//}

class P implements Comparable<P>{
    int a,b;
    P(int a, int b) {
        this.a=a;
        this.b=b;
    }
    public int compareTo(P p){
    	int A=a-p.b,B=b-p.a;
    	if(abs(A)>abs(B)) {return A<0 ?-1:1;}
        return B<0 ?-1:1; //des
    }
}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
    	int r[] = new int[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextInt(); 
		}
    	return r;
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 46324
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#include<cmath>
#include<numeric>
using namespace std;


int main(void) {

  string s;
  while(cin >> s){
    if( s == "0" ) break;
    int tmp = 0;
    for(int i=0; i<s.size(); i++){
      tmp += s[i]-'0';
    }
    cout << tmp << endl;

  }

  return 0;
}

Measured memory_bytes: 3156
#include <iostream>
#include <cmath>
#include <cstring>
#include <string>
#include <iomanip>
#define maxn 1005
using namespace std;
int main()
{
	int n,odd=0;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		if(i%2)
		{
			odd++;
		}
	}
	cout<<fixed<<setprecision(10)<<1.0*odd/n<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <math.h>
#define ll long long
using namespace std;
#define N 100009

int main(){
    ll n;
    cin>>n;
    int data[n+1];
    ll count=0;
    int num[n+1];
    vector<ll> ans;
    for (ll i=1; i<=n; i++) cin>>data[i];
    for (ll i=n; i>=1; i--){
        ll k=2;
        ll sum=0;
        while(i*k<=n){
            sum+=num[i*k];
            k++;
        }
        int p=sum%2;
        if (p==data[i]) num[i]=0;
        else{
            num[i]=1;
            count+=1;
            ans.push_back(i);
        }
    }
    cout<<count<<endl;
    for (int i=0; i<count; i++) cout<<ans[i]<<" ";
    cout<<endl;
}

Measured memory_bytes: 3572
#include<bits/stdc++.h>
#include<string>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))//memset only use to initialize 0 or -1 no other number.
#define pii pair<int,int>
#define pll pair<ll,ll>
#define INF 1e9
#define INFL 1e18
//#define mod 1000000007
#define mod 998244353
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> os;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> os_pair;

ll power(ll x,ll n){ll res =1;while(n>0){if(n%2==1){res=res*x;}x=x*x;n=n/2;}return res;}
ll powm(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

//cout<< fixed << setprecision(10)
vector<int> foo(vector<int>v)
{
	
	int n=v.size();
	int a[n+3]={0},i;
	vector<int>p;
	for(i=0;i<v.size();i++)
	{
		int l=max(i+1-v[i],1);
		int r=min(i+1+v[i],n);
		a[l]++;
		r++;
		a[r]--;
	}
	for(i=1;i<n+2;i++)
	{
		a[i]+=a[i-1];
	}
	for(i=1;i<=n;i++)
	{
		p.pb(a[i]);
	}
	return p;
}


int main(){

    fast
    int T;
    T=1;
    //cin>>T;
    while(T--){
    	int n,k,i,j;
    	cin>>n>>k;
    	vector<int>v(n);
    	for(i=0;i<n;i++)
    	{
    		cin>>v[i];
		}
		
	
		for(i=0;i<k;i++)
		{
			if(v==foo(v))
			{
				break;
			}
			else
			{
				v=foo(v);
			}
		}
		for(i=0;i<n;i++)
		{
			cout<<v[i]<<" ";
		}
    
    }

}

Measured memory_bytes: 7524
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <sstream>
#define mod 1000000007
#define eps 1e-6
#define ll long long
#define INF 0x3f3f3f3f
#define ME0(x) memset(x,0,sizeof(x))
using namespace std;
struct node
{
    int parent;
    int left,right;
};
node a[100005];
int D[100005];
void getDepth(int u,int p)
{
    D[u]=p;
    if(a[u].right!=-1)
        getDepth(a[u].right,p);
    if(a[u].left!=-1)
        getDepth(a[u].left,p+1);
}
void print(int u)
{
    cout<<"node "<<u<<": parent = "<<a[u].parent<<", depth = "<<D[u]<<", ";
    if(a[u].parent==-1)
        cout<<"root, [";
    else if(a[u].left==-1)
        cout<<"leaf, [";
    else
        cout<<"internal node, [";
    for(int i=0,c=a[u].left; c!=-1; ++i,c=a[c].right)
    {
        if(i)
            cout<<", ";
        cout<<c;
    }
    cout<<"]"<<endl;

}
int main()
{
    int n;
    cin>>n;
    for(int i=0; i<n; ++i)
        a[i].left=a[i].parent=a[i].right=-1;
    for(int i=0; i<n; ++i)
    {
        int id,k;
        cin>>id>>k;
        for(int j=0; j<k; ++j)
        {
            int c,l;
            cin>>c;
            if(j)
                a[l].right=c;
            else
                a[id].left=c;
            l=c;
            a[c].parent=id;
        }
    }
    int root;
    for(int i=0; i<n; ++i)
        if(a[i].parent==-1)
            root=i;
    getDepth(root,0);
    for(int i=0; i<n; ++i)
        print(i);
}



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

using ll = long long;

constexpr ll MOD = 1e9+7;
constexpr ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

int main(int argc, char **argv)
{
	ll N; cin >> N;
	string S; cin >> S;

	ll cl, cr;
	cl = cr = 0;

	for (auto &e : S)
	{
		if (e == '(')
		{
			++cr;
		}
		else
		{
			if (cr > 0) --cr;
			else ++cl;
		}
	}

	string res;
	REP(i, cl) res += '(';
	res += S;
	REP(i, cr) res += ')';
	std::cout << res << std::endl;
}

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

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

  if(n < 2 || 200000 < n){
    exit(0);
  }

  int Rt[n];

  scanf("%d%d",&Rt[0],&Rt[1]);
  
  if(Rt[0] > Rt[1]){
    mini = Rt[1];
  }
  else
    mini = Rt[0];
  
  out = Rt[1] - Rt[0];
  
  for(int i=2; i<n; i++){
    
    scanf("%d",&Rt[i]);

    if(Rt[i] < 1 || 1000000000 < Rt[i]){
      exit(1);
    }
    
     if(Rt[i] < mini){
       if(out < Rt[i] - mini)
	 out = Rt[i] - mini;
      mini = Rt[i];
     } else if(out < Rt[i] - mini){
       out = Rt[i] - mini;
     }
  }
  printf("%d\n",out);
  return 0;
}



Measured memory_bytes: 2564
def main(n,h):
    count = 1
    height = h[0]
    for i in range(1,len(h)):
        if height <= h[i]:
            count += 1
        height = max(height, h[i])
    print(count)

def resolve():
    n = int(input())
    h = list(map(int, input().split()))
    main(n,h)

resolve()

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

using namespace std;

inline void read() {}
template <class S>
inline void read(S &arg) {
  cin >> arg;
}
template <class S>
inline void readA(S Lptr, S Rptr) {
  while (Lptr != Rptr) {
    read(*Lptr);
    Lptr++;
  }
}
template <class S, class... T>
inline void read(S &arg, T &... rest) {
  read(arg);
  read(rest...);
}

inline void write() {}
template <class S>
inline void write(S arg) {
  cout << arg;
}
template <class S>
inline void writeA(S Lptr, S Rptr) {
  if (Lptr != Rptr) {
    write(*Lptr);
    Lptr++;
  }
  while (Lptr != Rptr) {
    write(' ');
    write(*Lptr);
    Lptr++;
  }
}
template <class S, class... T>
inline void write(S arg, T... rest) {
  write(arg);
  write(' ');
  write(rest...);
}

#define rep(i, j, k) for (int i = j; i < (int)k; i++)
#define pb push_back
#define mt make_tuple
#define all(x) x.begin(), x.end()

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

template <class T, class S>
inline bool smin(T &a, S b) {
  return (T)b < a ? a = b, 1 : 0;
}
template <class T, class S>
inline bool smax(T &a, S b) {
  return a < (T)b ? a = b, 1 : 0;
}

constexpr int MOD = 1e9 + 7;
constexpr int N = 1e6 + 10;

template <typename T>
inline T mod(T &v) {
  return v = (v % MOD + MOD) % MOD;
}
template <typename S, typename T>
inline S add(S &l, T r) {
  return mod(l += r);
}

ll po(ll v, ll u) {
  return u ? po(v * v % MOD, u >> 1) * (u & 1 ? v : 1) % MOD : 1;
}

ll n, A[N], B[N];

int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);

  ll res = 0;

  read(n);
  rep(i, 0, n) {
    read(A[i], B[i]);
    res += A[i];
    A[i] += B[i];
  }
  sort(A, A + n, greater<ll>());

  for (int i = 1; i < n; i += 2) res -= A[i];
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 5120
/*
shakespere said: 

I always feel happy, you know why? Because I don’t expect anything from anyone; expectations always hurt. Life is short. So love your life. Be happy. And keep smiling.

Just live for yourself and always remember:

Before you speak… Listen
Before you write… Think
Before you spend… Earn
Before you pray… Forgive
Before you hurt… Feel
Before you hate… Love
Before you quit… Try
Before you die… Live
/**********************************************
#code by --> @ { shadat </> sk40 [ o_o  ^_^ ] } }
-----------------------------------------------
# The Quick Brown Fox Jumps over the Lazy Dog. 
**********************************************/
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
 
const ll inf = 1e18;
const int N = 1 * 1e5 + 10;
 
ll res;
std::vector<ll> v[N];
std::map<ll, ll> mp;
std::vector<pair<ll, ll>> vv;
std::vector<ll> x, xx;
bool isprime(ll n){
    if(n<=1) return false;
    if(n==2 || n==3) return true;
    if(n%2==0 || n%3==0) return false;
    for(ll i=5;i*i<=n;i+=6){
        if(n%i==0 || n%(i+2)==0) return false;
    }
    return true;
} 

int mss() {    
        	ll n;
    	cin >> n;
    	vv.push_back({0, 0});
    	for (int i = 1; i <= n; ++i){
    		ll len;
    		ll mx = 0, mn = inf;
    		cin >> len;
    		for (int j = 0; j < len; ++j){
    			cin >> res;
    			mx = max(res, mx);
    			mn = min(res, mn);
    			v[i].push_back(res);
    		}
    		vv.push_back({mn, mx});
    	}
    	for (int i = 1; i <= n; ++i){
    		std::map<ll, ll> mpp;
    		mpp[0]++;
    		for(auto j : v[i]){
    			mpp[j]++;
    		}
    		bool flag = 0;
    		for(auto j : v[i]){
    			mpp[j]--;
    			if(!mpp[j])mpp.erase(j);
    			auto itr = mpp.rbegin();
    			if(itr->first > j) {flag = 1; break;}
    		}
    		if(!flag){mp[i]++;}
    		mpp.clear();
    	}
    	ll ans = (n - mp.size()) * n + mp.size() * (n - mp.size());
     
    	for(auto i : mp){
    		x.push_back(vv[i.first].first);
    		xx.push_back(vv[i.first].second);
    	}
    	sort(x.begin(), x.end());
    	sort(xx.begin(), xx.end());
     
    	for (int i = 0; i < x.size(); ++i){
    		auto idx = upper_bound(xx.begin(), xx.end(), x[i]) - xx.begin();
    		ans += xx.size() - idx;
    	}
    	cout << ans;

	return 0;
}
struct record{
	short bit;
	short up;
	short down;
	short vrtx;
}; 
int main(){
   int a,b;
   cin>>a>>b;
   if(a==b && a!=0){
       cout<<"Yes\n";
   }
   else{
       cout<<"No\n";
   }
    
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define ll          long long int
#define uu          first
#define vv          second
#define pii         pair<int,int>
#define pll         pair<ll,ll>
#define INF         1e18
#define fastRead    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;

const ll MOD = 1e9 + 7;
ll dp[30][(1<<22)];

int ara[30][30];

int main()
{
    fastRead;
    int n;
    cin>>n;
    
    for(int i =1 ; i <=n ; i++ ) {
        for(int j =1 ; j <=n ; j++ ) {
            cin>>ara[i][j];
        }
    }
    dp[0][0] = 1;
    for(int i =1 ; i <=n ; i++ ) {
        
        for(int j = 1; j< (1<<n) ; j++ ) {
            
            if(__builtin_popcount(j) != i) continue;
            for(int k =1 ; k <= n ;k++ ) {
                if(ara[i][k] == 0 || ( j &(1<<(k-1)) ) == 0 ) continue;
                
                dp[i][j] = (dp[i][j] + dp[i-1][ ( j ^(1<<(k-1)) ) ] ) % MOD;
            }
        }
    }
    cout<<dp[n][(1<<n)-1]<<'\n';
    return 0;
}

Measured memory_bytes: 166896
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;

int main(){
    string S,T;
    int count=0;
    cin>>S>>T;
    const char* cS=S.c_str();
    const char* cT=T.c_str();
    
    for(int i=0;i<(S.size()-T.size()+1);i++){
        int a=0;
        for(int j=0;j<T.size();j++){
            if(*(cS+i+j)==*(cT+j))  a++;
        }
        
        if (count<a)    count=a;
        
    }

    cout<<T.size()-count<<endl;
    return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int n;
vector<int> a;
bool solve(int time,int data){
    if(data==0) return true;
    if(time == n||data<0) return false;
    return solve(time+1,data-a[time])||solve(time+1,data);
}
int main(){
    cin >> n;
    a.resize(n);
    for(auto &i:a) cin >> i;
    int q;cin >> q;
    for(int i=0;i<q;i++){
        int data;cin >> data;
        cout << (solve(0,data)?"yes":"no") << endl;
    }
}


Measured memory_bytes: 3120
#include "algorithm"
#include "iostream"
#include "cmath"
#include "string"
#include "map"
#include "set"
#include "iomanip"
using namespace std;

#define TEST 0
#if TEST
FILE *in = freopen("./Q/question.txt", "r", stdin);
FILE *out = freopen("./A/answer.txt", "w", stdout);
#endif


int main(){
  int n,m;
  while(true){
    int sa=0,ans=201,idxi=-1,idxj=-1;
    cin >> n >>m;
    set<int> tarous,hanakos;
    if(!n&&!m)break;
    for(int i=0;i<n+m;++i){
      int a;
      cin >> a;
      if(i<n){
        tarous.insert(a);
        sa+=a;
      }else{
        hanakos.insert(a);
        sa-=a;
      }
    }
    // cout <<sa<<endl;
    // cout <<tarousum <<" "<<hanakosum <<endl;
    if(!(sa&1)){
      bool FLAG=false;
      for(auto&& itr1=tarous.begin();itr1!=tarous.end();++itr1){
        for(auto&& itr2=hanakos.begin();itr2!=hanakos.end();++itr2){
          if(*itr1-*itr2==sa/2){
            if(ans>*itr1+*itr2){
              ans=*itr1+*itr2;
              idxi=*itr1;
              idxj=*itr2;
              FLAG=true;
              break;
            }
          }
        }
        if(FLAG)break;
      }
    }
    if(ans==201)cout <<-1<<endl;
    else cout <<idxi<<" "<<idxj<<endl;
    tarous.clear();
    hanakos.clear();
  }
  #if TEST
  fclose(in);
  fclose(out);
  #endif
  return 0;
}

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

int main(){
	string s,t;
	cin>>s>>t;
	for(int i=0;i<s.length();i++){
		if(s[i]==t[i]) continue;
		else{
			cout<<"No";
			return 0;
		}
	}
	
	cout<<"Yes";
	
	return 0;
}

Measured memory_bytes: 3592
#include<stdio.h>

int main()
{
	char str[21];
	int i;
	int count=0;
	
	scanf("%s",str);

	while(str[count]!='\0') count++;
	for(i=count-1;i>=0;i--) printf("%c",str[i]);
	printf("\n");
	
	return 0;
}

Measured memory_bytes: 0
# coding: utf-8

def gcd(a,b):
    while b:
        a,b = b,a%b
    return a
def lcm(a,b):
    return a*b//gcd(a,b)

N,M = map(int,input().split())
S = list(input())
T = list(input())

l = lcm(N,M)

if S[::l//M] == T[::l//N]:
    print(l)
else:
    print(-1)

Measured memory_bytes: 4824
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
using namespace std;
#define all(x) x.begin(), x.end()
typedef vector <int> vi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
const int mod = 1e9 + 7;
const ll inf = 3e18 + 5;
int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }

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

	int n;
	cin >> n;
	vi v(n);
	for(int i = 0; i < n; i++) cin >> v[i];
	bool okk = 1;
	for(int k = 0; k < n - 1; k++) if(v[k] >= v[k + 1]) okk = 0;
	if(okk) return cout << "YES", 0;
	for(int i = 0; i < n; i++){
		for(int j = i + 1; j < n; j++){
			vi x = v;
			swap(x[i], x[j]);
			bool ok = 1;
			for(int k = 0; k < n - 1; k++) if(x[k] >= x[k + 1]) ok = 0;
			if(ok) return cout << "YES", 0;
		}
	}
	cout << "NO";
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
typedef long long ll;

int main(){
    int n;
    cin>>n;
    vector<int> person(n);
    int num;
    REP(i,n){
        cin>>num;
        person[num-1]=i+1;
    }
    REP(i,n){
        cout<<person[i];
        if(i!=SIZE(person)-1){
            cout<<" ";
        }
    }
    return 0;
}


Measured memory_bytes: 1152
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int progA[] = new int[n];
		for(int i = 0; i < n; i++) {
			progA[i] = sc.nextInt();
		}
		int q = sc.nextInt();
		int temp;

		for(int i = 0; i < q; i++) {
			int b = sc.nextInt();
			int e = sc.nextInt();
			for(int j = b; j < b + (e - b) / 2; j++) {
				temp = progA[j];
				progA[j] = progA[e + b - 1 - j];
				progA[e + b - 1 - j] = temp;
			}
		}

		for(int j = 0; j < progA.length; j++) {
			if(j != 0) System.out.print(" ");
			System.out.print(progA[j]);
		}
		System.out.println();
	}

}



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

int main()
{
	int a[3][3];
	int b[6];
	int s = 0;
	
	for (int i = 0; i < 3; i++)
		for (int j = 0; j < 3; j++)
			cin >> a[i][j];

	b[0] = a[0][0] + a[1][1] + a[2][2];
	b[1] = a[1][0] + a[2][1] + a[0][2];
	b[2] = a[2][0] + a[0][1] + a[1][2];
	b[3] = a[0][2] + a[1][1] + a[2][0];
	b[4] = a[0][0] + a[1][2] + a[2][1];
	b[5] = a[0][1] + a[1][0] + a[2][2];

	s = b[0];

	for(int i = 1; i < 6; i++)
		if (b[i] != s) {
			cout << "No" << endl;
			s = -1;
			break;
		}

	if(s != -1)
		cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;
 
public class Main {
 
	public Main() {
		// TODO 自動生成されたコンストラクター・スタブ
	}
 
	public static void main(String[] args){
		Map <Integer,Integer> mapD = new TreeMap<Integer,Integer> ();
 
		Scanner sc = new Scanner(System.in);
			// 整数の入力
			int n,a,b;
			
			n = sc.nextInt();
			a = sc.nextInt();
			b = sc.nextInt();
			sc.close();
			if(n*a>b) {
				System.out.println(b);
			}
			else {
				System.out.println(n*a);
			}

			
 
			// 出力
 
	}
}

Measured memory_bytes: 21844
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a[ohara], b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> n;
  rep(i, n) {
    cin >> a[i];
    a[i]--;
  }
  rep(i, n) {
    if (a[i] == i) {
      swap(a[i], a[i + 1]);
      ans++;
    }
  }
  Cout(ans);
  return 0;
}

Measured memory_bytes: 1024
import sys
import numpy as np
import math
import collections
from collections import deque 
from functools import reduce

# input = sys.stdin.readline
n = int(input())
rs = list(input() for i in range(n))

cn = collections.Counter(rs)

print("AC x {0}".format(cn["AC"]))
print("WA x {0}".format(cn["WA"]))
print("TLE x {0}".format(cn["TLE"]))
print("RE x {0}".format(cn["RE"]))









Measured memory_bytes: 34056
N=int(input())
num=[int(input()) for i in range(N)]
num.sort()

if N%2!=0: #kisu
  manaka=int(N/2)  
  sum_a=abs(num[manaka]-num[N-1])
  sum_a+=abs(num[N-1]-num[0])
  for i in range(int((N-1)/2)-1):
    sum_a+=abs(num[N-2-i]-num[i])
    sum_a+=abs(num[i+1]-num[N-2-i])
  sum_b=abs(num[manaka]-num[0])
  sum_b+=abs(num[0]-num[N-1])
  for i in range(int((N-1)/2)-1):
    sum_b+=abs(num[i+1]-num[N-1-i])
    sum_b+=abs(num[i+1]-num[N-2-i])
  print(max(sum_a,sum_b))
else:
  manaka=int(N/2)
  sum=abs(num[manaka]-num[0])
  for i in range(manaka-1):
    sum+=abs(num[i]-num[N-1-i])
    sum+=abs(num[i+1]-num[N-1-i])
  print(sum)

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

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

int main () {
  int a, b;
  cin >> a >> b;
  cout << gcd(a, b) << endl;
  return 0;
}



Measured memory_bytes: 3092
#include<stdio.h>
#include<stdlib.h>
int asc(const void* a, const void* b)
{
	return *(int*)b - *(int*)a;
}
int main()
{
	int n;
	int i, j;
	int count[30];
	int a[30];
	char c[102];
	int x;
	int max;
	for (;;)
	{
		scanf("%d", &n);
		if (n == 0)
			return 0;
		for (i = 0; i < n; i++)
		{
			scanf("%c", &c[i]);
			if (c[i]<'A' || c[i]>'Z')
				i--;
		}
		for (i = 0; i < 30; i++)
			count[i] = 0;
		for (i = 0; i < n; i++)
		{
			x = 0;
			count[c[i] - 'A']++;
			for (j = 0; j < 30; j++)
				a[j] = count[j];
			qsort(a, 30, sizeof(int), asc);
			if (a[0] > a[1] + n - i - 1)
			{
				int max = 0;
				for (j = 0; j < 30; j++)
					if (count[max] < count[j])
						max = j;
				printf("%c %d\n", 'A' + max, i + 1);
				x++;
				break;
			}
		}
		if (x == 0)
			printf("TIE\n");
	}
}


Measured memory_bytes: 2104
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<tuple>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int H,W;
	string a[100];
	int kinsigyo[100]={0};
	int kinsiretu[100]={0};
	scan(H);scan(W);
	rep(i,H){
		scan(a[i]);
	}
	rep(i,H){
		int flag=0;
		rep(j,W){
			if(a[i][j]=='#'){
				flag=1;
				break;
			}
		}
		if(flag==0) kinsigyo[i]=1;
	}
	rep(j,W){
		int flag=0;
		rep(i,H){
			if(a[i][j]=='#'){
				flag=1;
				break;
			}
		}
		if(flag==0) kinsiretu[j]=1;
	}
	rep(i,H){
		if(kinsigyo[i]) continue;
		rep(j,W){
			if(kinsiretu[j]) continue;
			printf("%c",a[i][j]);
		}
		kaigyo;
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=3.14159265359;

int main() {
    double a, b, x;
    cin>>a>>b>>x;
    double tan, theta;
    if(x >= a*a*b/2){
        tan = pow(a, 3)/(2*(a*a*b - x));
        theta = atan(tan);
    }
    else{
        tan = 2*x/(a*b*b);
        theta = atan(tan);
    }
    cout<<setprecision(20)<<90 - theta * 180/PI<<endl;
}



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



Measured memory_bytes: 1804
#include<iostream>
#include<string>
int main(){
 std::string x,y,z,c;
 std::cin>>x;
 if(x.find("a")!=std::string::npos&&x.find("b")!=std::string::npos&&x.find("c")!=std::string::npos)printf("Yes");
 else printf("No");
 return 0;
}

Measured memory_bytes: 256
N = int(input())
NN = [int(i) for i in input().split()]
NN_sort = sorted(NN, reverse=True)
A_score = sum([NN_sort[i] for i in range(0, N, 2)])
B_score = sum([NN_sort[i] for i in range(1, N, 2)])
print(A_score-B_score)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define pb push_back
#define all(v) v.begin(), v.end()
#define _GLIBCXX_DEBUG
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    string s,t,u;
    cin>>s>>t>>u;
    int ss=s.size();
    int st=t.size();
    char ls=s[ss-1];
    char lt=t[st-1];
    if(ls==t[0]&&lt==u[0]) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
typedef pair<double,int> P;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)

int main(void){
  vector<P> d1;
  vector<P> d2;
  REP(i,8){
    double a;int b;
    cin>>b>>a;
    d1.push_back(P(a,b));
  }
  sort(d1.begin(),d1.end());
  REP(i,8){
    if(i<2){
      printf("%d %.2lf\n",d1[i].second,d1[i].first); 
    }else{
      d2.push_back(d1[i]);
    }
  }
  d1.clear();
  REP(i,8){
    double a;int b;
    cin>>b>>a;
    d1.push_back(P(a,b));
  }
  sort(d1.begin(),d1.end());
  REP(i,8){
    if(i<2){
      printf("%d %.2lf\n",d1[i].second,d1[i].first); 
    }else{
      d2.push_back(d1[i]);
    }
  }
  d1.clear();
  REP(i,8){
    double a;int b;
    cin>>b>>a;
    d1.push_back(P(a,b));
  }
  sort(d1.begin(),d1.end());
  REP(i,8){
    if(i<2){
      printf("%d %.2lf\n",d1[i].second,d1[i].first); 
    }else{
      d2.push_back(d1[i]);
    }
  }
  sort(d2.begin(),d2.end());
  REP(i,2){
    printf("%d %.2lf\n",d2[i].second,d2[i].first); 
  }
  return 0;
}

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

typedef long long ll;

#define MOD 1000000007
#define INF LLONG_MAX
#define decimDigits(n) fixed << setprecision(n)
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define irep(it, arr) for(auto it = begin(arr); it != end(arr); it++)

ll gcd(ll a, ll b){return b ? gcd(b, a % b) : a;}

int main(){

    string ans, S;

    cin >> S;

    irep(it, S){
        switch(*it){
            case '0':
            case '1':
                ans.push_back(*it);
                break;
            default:
                if(!ans.empty())    ans.pop_back();
                break;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include"stdio.h"
#include"string.h"
#include"algorithm"
    using namespace std;
int main()
{
    int a,b,c;
    while(~scanf("%d%d%d",&a,&b,&c))
    {
        if(b/a>c)
        {
            printf("%d\n",c);
        }
        else
        {
            printf("%d\n",b/a);
        }
    }
}


Measured memory_bytes: 128
n = int(input())

dic = {}
maxn = 1
for _ in range(n):
    s = input()
    if s in dic:
        dic[s] += 1
        maxn = max(maxn, dic[s])
    else:
        dic[s] = 1

dic = sorted(dic.items(), key=lambda x: x[0])
# print(dic)

for k, v in dic:
    if v == maxn:
        print(k)


Measured memory_bytes: 44764
n, m = map(int, input().split())
ab_lis = []
for i in range(m):
    ab_lis.append(list(map(int, input().split())))
ab_lis_s = sorted(ab_lis, key = lambda x: x[1])
cnt = 0
endtime = 0
for i in range(m):
    if ab_lis_s[i][0] >= endtime:
        endtime = ab_lis_s[i][1]
        cnt += 1
print(cnt)

Measured memory_bytes: 30828
# coding: utf-8
import sys

def merge(A, left, mid, right):
    global count
    L = A[left:mid]
    R = A[mid:right]
    L.append(sys.maxsize)
    R.append(sys.maxsize)
    i = 0
    j = 0
    for k in range(left,right):
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1
        count += 1

def mergeSort(A, left, right):
    if left+1 < right:
        mid = int((left + right)/2);
        mergeSort(A, left, mid)
        mergeSort(A, mid, right)
        merge(A, left, mid, right)

n = int(input().rstrip())
A = list(map(int,input().rstrip().split()))
count = 0
mergeSort(A, 0, n)
print(" ".join(map(str,A)))
print(count)



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

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

Measured memory_bytes: 256
{-# LANGUAGE RecursiveDo        #-}
{-# LANGUAGE OverloadedStrings  #-}
{-# LANGUAGE NumericUnderscores #-}

import qualified Data.ByteString.Char8 as C8
import Data.List
import Data.Char

f :: Int -> [Int] -> [Int]
f k hs@(h:_) = map (abs . subtract h) (take k hs)

g :: Int -> [Int] -> [Int] -> [Int] -> Int
g _ costs _      []                  = head costs
g k costs starts dists@(dist:dists') = g k costs' starts' dists'
  where cost    = minimum $ zipWith (\ c s -> c + abs (dist - s)) (costs) (starts)
        costs'  = take k $ cost : costs
        starts' = take k $ dist : starts

solve :: Int -> Int -> [Int] -> Int
solve n k h
    | n > k     = g k (reverse $ f k h) (reverse $ take k h) (drop k h)
    | otherwise = last $ f n h

main = do
  [n, k] <- unfoldr (C8.readInt . C8.dropWhile isSpace) <$> C8.getLine
  h      <- unfoldr (C8.readInt . C8.dropWhile isSpace) <$> C8.getLine
  print $ solve n k h


Measured memory_bytes: 77288
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

constexpr double PI = 3.14159265358979323846;
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

class AABarricade {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n, a, b; cin >> n >> a >> b;
      set<int> st;
      int ans = 0;
      rep(i, n) {
        int t; cin >> t;
        if (t<a || b<=t) {
          if (st.find(t) == st.end()) {
            ans++;
            st.insert(t);
          }
        }
      }
      cout << ans << endl;
    }
};

signed main() {
  AABarricade solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 256