akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define fi first
#define se second
long long mo = 1000000007;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef pair<ll,Pll> PlP;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;
//using namespace atcoder;

int main(){
    ll N;
    cin >> N;
    vector<ll> P(N);
    rep(i,N){
        cin >> P[i];
    }
    vector<ll> A(N+1);
    rep(i,N){
        A[P[i]] = A[P[i]-1] + 1;
    }
    ll M = 1;
    rep(i,N){
        cmax(M, A[i+1]);
    }
    cout << N - M << endl;
}

Measured memory_bytes: 6432
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")

#include "bits/stdc++.h"
using namespace std;

#define pb push_back
#define F first
#define S second
#define f(i,a,b)  for(int i = a; i < b; i++)
#define endl '\n'

using ll = long long;
using db = long double;
using ii = pair<int, int>;
const int N = 300 * 4, MX = 2e6, LG = 19, MOD = 1e9 + 7;
const int SQ =225;
const long double EPS = 1e-7;
vector<int> solve(ll n){
  if(n == 2)
    return vector<int>({1});
  if(n&1){
    vector<int> x = solve(n-1);
    int val = *max_element(x.begin(),x.end());
    x.insert(x.begin(), val + 1);
    return x;
  } else {
    vector<int> x = solve(n>>1);
    int val = *max_element(x.begin(),x.end());
    x.pb(val + 1);
    return x;
  }
}
int32_t main(){
#ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
  ll n;
  cin >> n;
  auto out = solve(n+1);
  cout<<out.size()*2<<'\n';
  for(auto x : out)cout << x << " ";
  f(i,0,out.size())cout << i + 1 << " ";

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
 
int main(void){
    int h, w;
    cin>>h>>w;
    vector<string> v(h);
    rep(i, h) cin>>v[i];
    vector<int> s1(h);
    vector<int> s2(w);
    rep(i, h){
        bool ok = true;
        rep(j, w) if(v[i][j] == '#') {
            ok = false;
            break;
        }
        if(ok) s1[i] = 1;
    }
    rep(j, w){
        bool ok = true;
        rep(i, h) if(v[i][j] == '#') {
            ok = false;
            break;
        }
        if(ok) s2[j] = 1;
    }
    rep(i, h){
        if(s1[i] == 1) continue;
        rep(j, w){
            if(s2[j] == 1) continue;
            cout<<v[i][j];
        }
        cout<<endl;
    }
    return 0;
}

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

typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define DECIM8  fixed<<setprecision(8) 
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

using namespace std;
int main(void)
{
  for(;;){
    int n,m,a;
    cin >> n >> m >> a;
    if(!n&&!m&&!a) return 0;
    vector<tuple<int,int,int> > amida;
    vector<int> from;
    REP(i,n+1) from.PB(i);
    REP(i,m){
      int h,p,q;
      cin >> h >> p >> q;
      amida.PB(make_tuple(h,p,q));
    }
    SORT(amida);
    int l,r;
    REP(i,SZ(amida)){
      tie(ignore,l,r)=amida[i];
      swap(from[l],from[r]);
    }
    cout << from[a] << endl;
  }
}

Measured memory_bytes: 1244
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    string a,b;
    cin>>a>>b;
    int p=0;
    int k=a.size();
    for(int i=0;i<k;i++){
        if(a[i]==b[i])
            p=1;
        else
        {
            p=0;
            break;
        }
    }
    if(p)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;

}


Measured memory_bytes: 3520
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int max = 1;
    int min = 1000000000;
    int N = sc.nextInt();
    while (sc.hasNext()){ 
        int val = sc.nextInt();
        max = Math.max(max,val);
        min = Math.min(min,val);
    }
    System.out.println(Math.abs(max-min));
  }
}

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

using namespace std;

#define rep(i,n) for(int i = 0; i < (n); ++i)
 
int main()
{
    int N; cin >> N;
    vector<int> a(N + 9); rep(i, N) cin >> a[i];

    int ans = 0;
    int prev = a[0];
    for (int i = 1; i < N; ++i){
        if (prev == a[i]){
            ++ans;
            a[i] = 100 + ans;
            prev = a[0];
            i = 0;
        } else {
            prev = a[i];
        }
    }

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


Measured memory_bytes: 256
#include <cstdio>

double l[10],v1,v2;

int main(){
  while(~scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",l,l+1,l+2,l+3,l+4,l+5,l+6,l+7,l+8,l+9,&v1,&v2)){
    double p=0;
    for(int i=0; i<10; i++) p+=l[i];
    p=p*v1/(v1+v2);
    for(int i=0; i<10; i++){
      if(p>l[i]) p-=l[i];
      else{
	printf("%d\n",i+1);
	break;
      }
    }
  }
}

Measured memory_bytes: 1052
data = list(input())

count = 0
# i = 0
# while 1:
count_b = 0
for i in range(len(data)):
    # print(i)
    if data[i] == 'W':
        count += count_b
        # count += 1
        # data[i], data[i+1] = 'B', 'W'
        # break
    else:
        count_b += 1
    # else:
    #     break
print(count)


Measured memory_bytes: 4840
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int N;
    cin >> N;

    vector<int> A(N + 2);
    A[0] = 0;
    REP(i, N) cin >> A[i + 1];
    A[N + 1] = 0;

    ll ans = 0;
    REP(i, N + 1) {
        ans += abs(A[i+1] - A[i]);
    }

    FOR(i, 1, N+1) {
        bool c1 = A[i - 1] <= A[i] && A[i] <= A[i + 1];
        bool c2 = A[i + 1] <= A[i] && A[i] <= A[i - 1];
        if (c1 || c2) print(ans);
        else print(ans - 2 * min(abs(A[i] - A[i - 1]), abs(A[i] - A[i + 1])));
    }

}


Measured memory_bytes: 3708
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 tmp = b;
		b = a;
		a = tmp;

		tmp = c;
		c = a;
		a = tmp;

		System.out.println(a + " " + b + " " + c);
		sc.close();

	}
}

Measured memory_bytes: 21716
'use strict';
function Main(inputs) {
  // 1行目がinput[0], 2行目がinput[1], …に入る
  const input = inputs.split("\n");
  const [n, m, x] = input[0].split(' ').map(Number);
  const c = [];
  const a = [];
  for(let i = 0; i < n; i++){
    const line = input[i + 1].split(' ');
    c.push(Number(line[0]));
    a.push(line.slice(1).map(Number));
  }
  const INITIAL = 1e7;
  let minCost = INITIAL;
  for(let i = 0; i < 1 << n; i++){
    const skill = Array(m).fill(0);
    let cost = 0;
    for(let j = 0; j < n; j++){
      const bit = 1 << j;
      const exist = (bit & i) === bit;
      if(exist){
        cost += c[j];
        for(let k = 0; k < m; k++){
          skill[k] += a[j][k];
        }
      }
    }
    if(skill.every((s) => s >= x)){
      minCost = Math.min(minCost, cost);
    }
  }
  console.log(minCost === INITIAL ? -1 : minCost);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 33596
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Queue;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.Set;
 
 
 
public class Main{
	
	static int posx;
	static int posy;
	static int type;
	static int diff;
	static int INF = Integer.MAX_VALUE;
	static int[][] d;
	
	//最大公約数・最小公倍数（セットで使う）
	public static long gcm(long a, long b) {
		long result = a;
		long k = 0;
		long n = b;
		do {
			k = result % n;
			result = n;
			n = k;
		} while(k != 0);
		return result;
	}
	
	public static long lcm(long a, long b) {
		long g;
		g = gcm(a, b);
		return a/g*b;
	}
	
	static long gcd (long a, long b) {
		long temp;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return b;
	}
	
	//等差数列
	static long tousasum(int n) {
		return (long)n*((long)n+1)/2;
	}
 
 
 
	//素数判定
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2) if(n%i==0){return false;}
		return true;
	}
 
 
	//倍数判定（10進数以外のときに有用）
	static boolean isMultiple (String s, int base, int m) {
		int temp = 0;
		for (int i=0; i<s.length(); i++) {
			temp = (temp*base+Character.getNumericValue(s.charAt(i)))%m;
		}
		if (temp==0) {return true;}
		return false;
	}
 
 
	//階乗
	static long factorial (int i) {
		if (i==1) {return 1;}
		else {return i*factorial(i-1);}
	}
 
 
	//進数変換
	static String toNbase (String sm, int m, int n) {
		return Long.toString(Long.parseLong(sm,m),n);
	}
	
	public static final long gcd_n(long[] param) {
	    final int len = param.length;
	    long g = gcd(param[0], param[1]);    //gcd(a, b) は以前作ったもの
	    for (int i = 1; i < len - 1; i++) {
	        g = gcd(g, param[i + 1]);       //gcd(a, b) は以前作ったもの
	    }
	    return g;
	}
	
	public static long lcm_n(long[] numbers) {
		long l;
		l = numbers[0];
		for (int i = 1; i < numbers.length; i++) {
			l = lcm(l, numbers[i]);
		}
		return l;
	}
	
	
 public static void main(String[] args) {
	 Scanner sc=new Scanner(System.in);
	 long X=sc.nextLong();
	 long Y=sc.nextLong();
	 long Z=0;
     long result = 0;
     while(true) {
    	 
    	 Z=(long) (X*Math.pow(2, result));
    	if(Z>Y) {
    		
    		break;    	}
    	result++;
    	 
     }
     System.out.println(result);
     
	 
	 
 }
	
 
 
}

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

using namespace std;

const int MAX_N = 100000, INDEX = 1;

int n, a, b, h[MAX_N + INDEX];

bool isGood(int k) {
    long long counter = 0;
    for (int i = 1; i <= n; i++) {
        counter += (max(0ll, h[i] - (long long)(k) * (long long)(b)) + a - b - 1) / (a - b);
    }

    return counter <= k;
}

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

    cin >> n >> a >> b;

    for (int i = 1; i <= n; i++) {
        cin >> h[i];
    }

    int l = 1, r = *max_element(h + INDEX, h + INDEX + n, less<int>());
    while (r > l) {
        int m = (l + r) / 2;
        if (isGood(m)) {
            r = m;
        } else {
            l = m + 1;
        }
    }

    int ans = (l + r) / 2;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#include <string>
#include <iostream>

using namespace std;

int main(void){
    string s;
    cin >> s;
    int a_place, z_place;
    for(int i=0;i<s.length();i++){
        if(s.at(i) == 'A'){
            a_place = i;
            break;
        }
        
    }
    for(int i=0;i<s.length();i++){
        if(s.at(i) == 'Z'){
            z_place = i;
        }
        
    }
    cout << z_place - a_place + 1 << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
using namespace std;
const int tINF = (int)INT_MAX;
const long long lINF = (long long)LLONG_MAX;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	#ifdef DEBUG
			assert(freopen("inp", "r", stdin));
			assert(freopen("out", "w",stdout));
	#else
			#define cerr if(false)cerr
	#endif
    int n, k;
    cin >> n >> k;
    int ans = 0;
    while(n){
        ++ans;
        n /= k;
    }
    cout << ans << '\n';
   cerr << "Time execute: " << (double)clock() / (double)CLOCKS_PER_SEC 
    << " sec" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 1000000007
#define mp make_pair
#define pi acos(-1)
#define line cout<<"------------------"<<endl
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
#define filein freopen("input.txt","r",stdin)
#define fileout freopen("output.txt","w",stdout)
#define mod 1000000007
#define inf (int)1e9+7
using namespace std;
ll  dp[10009][101][2][2];
string k; int d;
ll call(ll ind,ll m,bool check,bool suru)
{
    if(ind==-1) return m%d==0 and suru;
    ll limit=check?k[ind]-'0': 9;
    ll ans=0;
    ll &ret=dp[ind][m][check][suru];
    if(ret!=-1 ) return ret;
    for(ll i=0;i<=limit;i++)
    {
        bool ck=(i==k[ind]-'0')? check: false;
        int mm=(m+i)%d;
        ans+=call(ind-1,mm,ck,suru|i);
    }
    return ret=ans%mod;
}
int   main()
{
    memset(dp,-1,sizeof dp);
    cin>>k>>d;
    reverse(k.begin(),k.end());
    ll e=call(k.size()-1,0,1,0)%mod;
    cout<<e<<endl;
}


Measured memory_bytes: 32768
q,h,s,d = map(int,input().split())
n = int(input())
a=min(q*8,h*4,s*2,d)
b=min(q*4,h*2,s)
ans = 0
if n%2==1:
    ans += b
    ans += min(b*(n-1),a*(n//2))
else:
    ans += min(b*n,a*(n//2))
print(ans)

Measured memory_bytes: 38256
import sys

debug_mode = True if len(sys.argv) > 1 and sys.argv[1] == "-d" else False
if debug_mode:
    import os
    inf = open(os.path.basename(__file__).replace(".py", ".in"))

    def input():
        return inf.readline()
else:
    inf = sys.stdin

# ==============================================================

def main():
    n, l = [int(x) for x in input().split()]
    s = []
    for _ in range(n):
        s.append(input())

    s.sort()
    print("".join(s))


main()

# ==============================================================

if debug_mode:
    inf.close()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
//map<key,value>

int main(){
  int a,b,c,d,e,k;
  cin >> a;
  cin >> b;
  cin >> c;
  cin >> d;
  cin >> e;
  cin >> k;
  if(e-a<=k)cout << "Yay!";
  else cout << ":(";
}


Measured memory_bytes: 256
// This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
template<typename T> void get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'; t=getchar());
	if(t=='-')neg=true,t=getchar();
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) get1(a),get1(b)
#define get3(a,b,c) get1(a),get2(b,c)
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

int h,w,k,q[1300111],fr,rr,sx,sy,dist[888][888];
char s[888][888];
void check(int x,int y,int d)
{
	if((s[x][y]=='.'||s[x][y]=='S')&&dist[x][y]==-1)
	{
		dist[x][y]=d+1;
		q[rr++]=x;q[rr++]=y;
	}
}
void bfs()
{
	memset(dist,-1,sizeof(dist));
	q[rr++]=sx;q[rr++]=sy;dist[sx][sy]=0;
	for(fr=0;fr<rr;fr+=2)
	{
		int&x=q[fr],&y=q[fr+1];
		check(x-1,y,dist[x][y]);
		check(x+1,y,dist[x][y]);
		check(x,y-1,dist[x][y]);
		check(x,y+1,dist[x][y]);
	}
}
int main()
{
	get3(h,w,k);
	for(int i=1;i<=h;i++)
	{
		scanf("%s",s[i]+1);
		for(int j=1;j<=w;j++)
			if(s[i][j]=='S')
			{
				sx=i;
				sy=j;
			}
	}
	bfs();
	int ans=inf;
	for(int i=1;i<=h;i++)for(int j=1;j<=w;j++)if(dist[i][j]>=0&&dist[i][j]<=k)
	{
		int l=min(min(i-1,j-1),min(h-i,w-j));
//		printf("%d %d l= %d\n",i,j,l);
		ans=min(ans,(l+k-1)/k+1);
	}
	printendl(ans);
	return 0;
}

Measured memory_bytes: 8960
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <map>  
using namespace std;

int main() {
  
int n;
 
cin >> n;
  
//cout << n << endl;
  
int a[n];
  
map<int, int> mp;
  
for(int i = 0;i<n;i++){
     
   cin >> a[i];
  
}
  
for(int i = 0;i<n;i++){
  
  int ans = 0;
  
    for(int j = 0;j<n;j++){ 

       if(a[i]==a[j]){
         
         ans += 1;
       }
  
    }
  
  mp[a[i]] = ans;
  
}
  
  cout << mp.size() << endl;
  
 // for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
 //       std::cout << "key = " << itr->first           // キーを表示
  //                      << ", val = " << itr->second << "\n";    // 値を表示
  //  }
  
  
  return 0;
}

Measured memory_bytes: 256
fun <T> permutationIndexOf(sortedList: List<T>, predicate: (List<T>, Int) -> Boolean): Pair<List<T>, Int> {
    val queue = mutableListOf<List<T>>()
    queue.add(arrayListOf<T>())
    var index = 0
    while (queue.isNotEmpty()) {
        val p = queue.removeAt(0)

        if (p.size == sortedList.size) {
            index++

            if (predicate(p, index)) {
                return Pair(p, index)
            }

            continue
        }

        for (item in (sortedList - p)) {
            queue.add(p + item)
        }
    }

    return Pair(emptyList(), -1)
}

fun main(args: Array<String>) {
    val n = readInteger()
    val p = readIntegerList()
    val q = readIntegerList()

    val (a, pc) = permutationIndexOf((1..n).toList()) { pp, c -> p == pp }
    val (b, qc) = permutationIndexOf((1..n).toList()) { qp, d -> q == qp }
    Math.abs(pc - qc).let(::println)
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)


Measured memory_bytes: 83560
#include <algorithm>
#include <iostream>
#include <cstring>
#include <string>
#include <bitset> 
#include <vector>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
 
#define int long long
#define ll long long 
#define F first
#define sqr(x) ((x) * (x))
#define S second
#define make make_pair
#define pb push_back
#define sz(x) (ll)(x.size()) 
#define all(x) x.begin (), x.end ()

using namespace std;
                        
typedef unsigned long long ull;
typedef long double ld;

const int MOD = (int)1e9 + 7;
const int N = (int)2e6+ 222;
const ll INF = (ll)1e18;
const double eps = (double)1e-6;

int n, a[N], pref[N], sum;

void solve () {
	cin >> n;
	for (int i = 1; i <= n; ++i) cin >> a[i];
	for (int i = 1; i <= n; ++i) sum += a[i];
	for (int i = 1; i <= n; ++i) pref[i] = pref[i - 1] + a[i];
	int mn = INF;
	for (int i =1; i < n; ++i) {
		mn = min(mn ,abs((sum - pref[i]) - pref[i]));	
	}	
	cout << mn;
}



signed main () {
    #ifdef Maga
        //freopen("input.txt", "r", stdin);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);                                              
    int t = 1;
    while (t --) {
    	solve ();
    }
    return 0;
}





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

#define watch(x) cerr << (#x) << ": " << (x) << endl

int q[400000];
int ind = 0, ed = 0;

void ins(int x) {
    q[ed++] = x;
}

int qsz() {
    return ed-ind;
}

int get() {
    return q[ind++];
}

int32_t main() {

    int n, m; cin >> n >> m;
    vector<vector<int>> graph(n+1);
    for(int i = 0; i < m; ++i) {
        int u, v; cin >> u >> v;
        graph[u].push_back(v);
    }
    int s, t; cin >> s >> t;

    vector<vector<bool>> seen(n+1, vector<bool>(3, false));

    ins(s);
    seen[s][0] = true;

    int ans = 0;
    while(ind != ed) {
        int sz = qsz();
        int rem = ans%3;
        while(sz--) {
            int cur = get();
            if(cur == t && rem == 0) {
                cout << ans/3 << endl;
                return 0;
            }
            int next = (rem+1)%3;
            for(int edge : graph[cur]) {
                if(!seen[edge][next]) {
                    seen[edge][next] = true;
                    ins(edge);
                }
            }
        }
        ans++;
    }

    cout << -1 << endl;
    
    return 0;
}


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

using namespace std;

int k, t;

priority_queue<int> pq;

int main()
{
	cin >> k >> t;
	for (int i = 0; i < t; i++)
	{
		int x;
		cin >> x;
		pq.push(x);
	}
	int ans = 0;
	int hold = 0;
	for (int i = 0; i < k; i++)
	{
		if (pq.empty()) ans++;
		else
		{
			int x = pq.top();
			pq.pop();
			if (hold) pq.push(hold);
			hold = x - 1;
		}
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
parseInt(x)=parse(Int,x)
parseMap(x::Array{SubString{String},1})=map(parseInt,x)

function main()
	n = readline() |> parseInt
	a = readline() |> split |> parseMap
	count = 1
	flg = 0
	for i in 2:n
		if a[i] > a[i-1] && flg == -1
			count += 1
			flg = 0
		elseif a[i] < a[i-1] && flg == 1
			count += 1
			flg = 0
		elseif a[i] > a[i-1]
			flg = 1
		elseif a[i] < a[i-1]
			flg = -1
		end
	end
	println(count)
end
main()

Measured memory_bytes: 119228
import sys

def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

S = [0] + LS2()
n = len(S)
mod = 10**9+7

a,c,d = [0]*n,[0]*n,[0]*n  # a[i],c[i],d[i] = S1~SiにあるA,C,?の個数
for i in range(1,n):
    a[i] = a[i-1]
    c[i] = c[i-1]
    d[i] = d[i-1]
    if S[i] == 'A':
        a[i] += 1
    elif S[i] == 'C':
        c[i] += 1
    elif S[i] == '?':
        d[i] += 1

X = [1]  # X[i] = 3**i
for _ in range(n):
    X.append((X[-1]*3) % mod)

hatena = d[n-1]  # Sにある?の個数

ans = 0
for i in range(1,n):
    if S[i] == 'B':
        ans += a[i-1]*(c[n-1]-c[i])*X[max(hatena,0)]
        ans %= mod
        ans += a[i-1]*(d[n-1]-d[i])*X[max(hatena-1,0)]
        ans %= mod
        ans += d[i-1]*(c[n-1]-c[i])*X[max(hatena-1,0)]
        ans %= mod
        ans += d[i-1]*(d[n-1]-d[i])*X[max(hatena-2,0)]
        ans %= mod
    elif S[i] == '?':
        ans += a[i-1]*(c[n-1]-c[i])*X[max(hatena-1,0)]
        ans %= mod
        ans += a[i-1]*(d[n-1]-d[i])*X[max(hatena-2,0)]
        ans %= mod
        ans += d[i-1]*(c[n-1]-c[i])*X[max(hatena-2,0)]
        ans %= mod
        ans += d[i-1]*(d[n-1]-d[i])*X[max(hatena-3,0)]
        ans %= mod

print(ans)


Measured memory_bytes: 100236
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define ll long long
int main(){
  ll h;
  scanf("%lld", &h);
  ll a = 0, b = 1;
  while(h){
    a += b;
    h /= 2;
    b *= 2;
  }
  printf("%lld\n", a);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do{cout << "\033[32;1m" << #x << "->" ; err(x);} while(0)
void err(){cout << "\033[39;0m" << endl;}
template<template<typename...> class T,typename t,typename... A>
void err(T<t> a,A... x){for (auto v:a) cout << v << ' '; err(x...);}
template<typename T,typename... A>
void err(T a,A... x){cout << a << ' '; err(x...);}
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
        print(v[i],i==(int)(v.size())-1?suc:2);
}
const int INF=0x3f3f3f3f;
const int mod=1e9+7;
const int maxn=1e6+7;
ll dp[maxn];
ll pre[maxn];
int main()
{
	int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        dp[i]=dp[i-1];
        if(i!=2) dp[i]++;
        if(i>=3) dp[i]=(dp[i]+pre[i-3])%mod;
        pre[i]=(pre[i-1]+dp[i])%mod;
        //dbg(i,dp[i]);
    }
    ll ans=(pre[n-1]*(n-1)%mod+pre[n-2]*(n-1)%mod*(n-1)%mod+1LL*(n-1)*(n-1)%mod+n)%mod;
    cout<<ans<<'\n';
}

Measured memory_bytes: 15872
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}
macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let m: usize = sc.cin();
    let mut a = vec![0; n];
    for _ in 0..m {
        let k: usize = sc.cin();
        for __ in 0..k {
            let i: usize = sc.cin();
            a[i - 1] += 1;
        }
    }
    put!((0..n).filter(|&i| a[i]==0).count());
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> { self.cin::<String>().chars().collect() }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> { (0..n).map(|_| self.cin()).collect() }
}


Measured memory_bytes: 2116
#include<bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
using ll = long long;
using ld =long double;
//#define int ll
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<int,pii> piii;
signed main(){
    string s;cin>>s;
    int n=(int)s.length();
    map<char,int>mp;
    rep(i,n)mp[s[i]]++;
    int ans=INF;
    for(auto itr:mp){
        string t=s;
        char key=itr.first;
        int cnt=0;
        string lt=s;
        while(true){
            string temp;
            bool flag=true;
            rep(i,t.size())if(t[i]!=key)flag=false;
            if(flag){
                cmin(ans,cnt);
                break;
            }
            rep(j,t.size()-1){
                if(t[j]==key)temp.push_back(key);
                else if(t[j]!=key&&j+1<t.size()&&t[j+1]==key)temp.push_back(key);
                else
                    temp.push_back(t[j]);
            }
            lt=t;
            t=temp;
            cnt++;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
using System;

namespace Vanila
{
    public class Program
    {
        static void Main(string[] args)
        {
            string[] T = Console.ReadLine().Split(' ');
            int count5 = 0;
            int count7 = 0;
            for (int i = 0; i < 3; i++)
            {
                if (T[i] == "5")
                {
                    count5++;
                }
                if (T[i] == "7")
                {
                    count7++;
                }
            }
            if (count5 == 2 && count7 == 1)
            {
                Console.WriteLine("YES");
            }
            else {
                Console.WriteLine("NO");
            }

        }
        public static long Max(long a, long b)
        {
            if (a <= b) return b;
            else return a;
        }
        public static long Min(long a, long b)
        {
            if (a == Max(a, b)) return b;
            else return a;
        }
        public static long GCD(long a, long b)
        {
            while (Max(a, b) % Min(a, b) != 0)
            {
                if (a < b) b %= a;
                else a %= b;
            }
            return Min(a, b);
        }
        public static long LCM(long a, long b)
        {
            return a * b / GCD(a, b);
        }
    }
}


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

int main()
{
  vector<int> data;
  for (int i=0; i < 3; i++) {
    int ai, bi;
	cin >> ai >> bi;
    data.push_back(ai);
    data.push_back(bi);
  }
  
  int c1, c2, c3, c4;
  c1 = c2 = c3 = c4 = 0;
  for (int i=0; i < data.size(); i++) {
    if (data[i] == 1) {
      c1++;
    } else if (data[i] == 2) {
      c2++;
    } else if (data[i] == 3) {
      c3++;
    } else {
      c4++;
    }
  }
  if (c1 > 2 || c2 > 2 || c3 > 2 || c4 > 2) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << 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 n = scan.nextInt();
        int k = scan.nextInt();

        System.out.println(pow(k - 1, n - 1) * k);
    }

    static long pow(long x, long n) {
        if (x == 0) return 0;
        if (n == 0) return 1;
        long total = 1;
        while (n > 0) {
            if ((n & 1) == 1) {
                total *= x;
            }
            x = x * x;
            n = n >> 1;
        }
        return total;
    }
}


Measured memory_bytes: 22992
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<set>
#include<map>
#include<queue>
using namespace std;
typedef int LL;
#define sqr(x) ((x)*(x))
#define mp make_pair
inline int read(){
	int x = 0; char ch = getchar(); bool positive = 1;
	for (; !isdigit(ch); ch = getchar())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = getchar())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(int a){
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
	write(a); puts("");
}
const int N=500005;
int n,a[N],dp[N],last;
char ch[N];
int main(){
    n=read();
    scanf("%s",ch);
    if(n==1||n==2){
    	puts("0"); return 0;
	}
	for(int i=1;i<=n;i++)a[i]=ch[i-1]-'0';
    for(int i=3;i<=n;i++){
    	dp[i]=dp[i-1];
    	if(a[i]==1&&a[i-1]==0&&a[i-2]==1){last=i;for(int j=i-2;a[j];j--){
    		dp[i]=max(dp[i],dp[j-1]+i-j-1);
		}}
		if(!a[i])last=0;
		if(last)dp[i]=max(dp[i],i-last+1+dp[last-3]);
	}
	writeln(dp[n]);
}

Measured memory_bytes: 4608
#include<iostream>
using namespace std;
int nm[1501],mm[1501];
int nc[1500001]={};
int c=0;
int k=0,l=0;
void lsnn(int);
void lsnm(int);
int main(){
  int n,m;
  int np,mp;
  while(1){
    //syoki
    for(int i=0;i<1501;i++){
      nm[i]=mm[i]=0;
    }
    for(int i=0;i<1500001;i++){
      for(int j=0;j<2;j++){
	nc[i]=0;
      }
    }
    c=0;
    k=0;
    l=0;
    //
    cin >> n >> m;
    if(n==0&&m==0)break;
    for(int i=0;i<n;i++){
      cin >> nm[i];
    }
    for(int i=0;i<m;i++){
      cin >> mm[i];
    }
    //n
    for(int i=0;i<n;i++){
      lsnn(nm[i]);
      np=nm[i];
      if(i!=n-1){
	for(int j=i+1;j<n;j++){
	  np+=nm[j];
	  lsnn(np);
	}
      }
    }
    //m
    for(int i=0;i<m;i++){
      mp=mm[i];
      if(nc[mp]!=0)c+=nc[mp];
      if(i!=m-1){
	for(int j=i+1;j<m;j++){
	  mp+=mm[j];
	  if(nc[mp]!=0)c+=nc[mp];
	}
      }
    }
    //out
    cout << c << endl;
  }
  return 0;
}
///////////////////////////////////////////
void lsnn(int n){
  nc[n]++;
}

Measured memory_bytes: 7032
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String []args) throws IOException {
    	FastScanner in  = new FastScanner(System.in);
    	PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);
    	solve(in, out);
    	in.close();
    	out.close();
    }
    static long gcd(long a, long b){ return (b==0) ? a : gcd(b, a%b); }
    static int gcd(int a, int b){ return (b==0) ? a : gcd(b, a%b); }
    static class FastScanner{
	BufferedReader reader;
	StringTokenizer st;
	FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}
	String next(){while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}
	     st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}
	String nextLine()  {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}
	int    nextInt()   {return Integer.parseInt(next());}
	long   nextLong()  {return Long.parseLong(next());}
	double nextDouble(){return Double.parseDouble(next());}
	char   nextChar()  {return next().charAt(0);}
	int[]  nextIntArray(int n)         {int[] arr= new int[n];   int i=0;while(i<n){arr[i++]=nextInt();}  return arr;}
	long[] nextLongArray(int n)        {long[]arr= new long[n];  int i=0;while(i<n){arr[i++]=nextLong();} return arr;}
	int[]  nextIntArrayOneBased(int n) {int[] arr= new int[n+1]; int i=1;while(i<=n){arr[i++]=nextInt();} return arr;}
	long[] nextLongArrayOneBased(int n){long[]arr= new long[n+1];int i=1;while(i<=n){arr[i++]=nextLong();}return arr;}
	void   close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}
    }
    
    /********* SOLUTION STARTS HERE ************/
    
    private static void solve(FastScanner in, PrintWriter out){
        String s = in.next();
        String t = in.next();
        out.println(t+""+s);
    }
    
    /************* SOLUTION ENDS HERE **********/
}

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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i) os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1) printEoln();
  if (suc == 2) printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U>
void chmax(T &a, U b) {
  if (a < b) a = b;
}

template <class T, class U>
void chmin(T &a, U b) {
  if (b < a) a = b;
}

template <class T>
T Sq(const T &t) {
  return t * t;
}

signed main() {
  int R = read();
  if (R < 1200)
    cout << "ABC" << endl;
  else if (R < 2800)
    cout << "ARC" << endl;
  else
    cout << "AGC" << endl;
}


Measured memory_bytes: 256
// Lets go to the next level 
// AIM CM at CF *__* asap 
// Hit A,B,C and D faster and reach Candidate Master
// Remember you were also a novice when you started, 
// hence never be rude to anyone who wants to learn something
// Never open a ranklist untill and unless you are done with solving problems, wastes 3/4 minuts 
// Donot treat CP as a placement thing, love it and enjoy it, you will succeed for sure.  


#include <bits/stdc++.h>
using namespace std;
#define mod (int)1000000007
#define MOD (int)10000000007
// Big two primes 
#define X 1001100011100001111ll
#define M 26388279066623ll
#define all(a) a.begin(),a.end()
#define for0(i, n) for (int i = 0; i < n; i++)
#define for0e(i, n) for (int i = 0; i <= n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
#define int long long 
#define ll long long
#define pb emplace_back
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define in(x) scanf("%d", &x)
#define rr return 0
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define inf (int)(1e18)
#define ini(a, i) memset(a, i, sizeof(a))
#define vi vector<int> 
#define F first
#define S second
#define pi pair<int, int>
#define ppi pair<pair<int,int> , int >
#define vii vector<pi>
const int MAXN = (int)((1e5) + 100);
int gcd(int a,int b) { if (a == 0) return b; return gcd(b%a, a);}
int max(int a,int b){if(a>b) return a; else return b;}
int min(int a,int b){if(a<b) return a; else return b;}  
int cbrt(int x){ int lo=1,hi=min(2000000ll,x);while(hi-lo>1){int mid=(lo+hi)/2;if(mid*mid*mid<x){lo=mid;}else hi=mid;}if(hi*hi*hi<=x) return hi;else return lo;} 
const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
const int N =  (int)(1e6+5); 


signed main(){
//   #ifndef ONLINE_JUDGE
//   freopen("input.txt", "r", stdin);
//   freopen("output.txt", "w", stdout);
//   #endif
  fio;
    int a,b,c;

    cin>>a>>b>>c;
    // Transferring water from b to a
    int total_water  = b + c;

    if(total_water < a){
        cout<<0;
    }
    else{
        cout<<abs(total_water - a);
    }
  rr;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 10000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

signed main() {
	double a, b, x;
	cin >> a >> b >> x;
	if (a <= b) {
		if (x >= a * a * b / 2) {
			double y = (a * a * b - x) / a * 2 / a;
			printf("%.12lf\n", (atan(y / a) * 180.0 / M_PI));
		}
		else {
			double y = x / a * 2 / b;
			printf("%.12lf\n", 90.0 - (atan(y / b) * 180.0 / M_PI));
		}
	}
	else {
		if (x <= (a * a * b / 2)) {
			double y = x / a * 2 / b;
			printf("%.12lf\n", 90.0 - (atan(y / b) * 180.0 / M_PI));
		}
		else {
			double y = (a * a * b - x) / a * 2 / a;
			printf("%.12lf\n", (atan(y / a) * 180.0 / M_PI));
		}
	}

	return 0;
}


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

int main(){
	string t("");
	string h("");
	int tscore = 0;
	int hscore = 0;
	int n;
	int x;
	int y;
	cin >> n;
	for (int i = 0 ;i<n ;i++ ) {
		cin >> t;
		cin >> h;
		x = t.size();
		y = h.size();
		for(int j = 0;true ;j++ ) {
			if ( x == j || y == j ) {
				if ( x > y ) {
					tscore+=3;
					break;
				}else if ( x < y ) {
					hscore+=3;
					break;
				}
				tscore+=1;
				hscore+=1;
				break;
			}
			if ( t[j] > h[j] ) {
				tscore+=3;
				break;
			}else if ( t[j] < h[j] ) {
				hscore+=3;
				break;
			}
		}
	}
	cout << tscore << " " << hscore << endl;
	return 0;
}

Measured memory_bytes: 1208
def judacgt(c):
    return c=="A" or c=="G" or c=="C" or c=="T"


s = input()

max = 0

for i in range(len(s)):
    if judacgt(s[i]):
        if max==0:
            max=1
        for j in range(i+1,len(s)):
            # print(s[i:j])
            if judacgt(s[j])==False:
                break
            elif j-i+1 > max:
                max=j-i+1
print(max)


Measured memory_bytes: 3060
import sys

# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")

N = II()

ans = 0
for i in range(1, N+1):
    if i%3==0 or i%5==0:
        pass
    else:
        ans+=i
print(ans)


Measured memory_bytes: 9220
#include<iostream>
using namespace std;
int main(){
  int n;
  cin>>n;
  int *a=new int[n];
  int *b=new int[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(int i=0;i<n;i++){
    cin>>b[i];
  }
  int ans=a[0]+b[0];
  int max=0;
  int temp=0;
  for(int i=1;i<n;i++){
    ans+=b[i];
    temp+=(a[i]-b[i-1]);
    if(max<temp)max=temp;
  }
  ans+=max;
  cout<<ans;
}
    

Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[25];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int cnt=1;
    for(int i=1;i<n;i++)
    {
        int flag=1;
        for(int j=0;j<i;j++){
            if(a[j]>a[i]){
               flag=0;
            }
        }
        if(flag==1){cnt++;}
    }
    cout<<cnt;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main(){
    long long int A,B;
    cin >> A >> B;
    long long int x = A*B;
 
    long long int tmp;
    if(A<B){
        tmp = A;
        A = B;
        B = tmp;
    }
    
    /* ユークリッドの互除法 */
    long long int r = A % B;
    while(r!=0){
        A = B;
        B = r;
        r = A % B;
    }
    cout << x/B << endl;    
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
char appreciation(int mid,int last,int re) {
    int sum = 0;
    if ((mid == -1) || (last == -1)) return 'F';
    sum = mid + last;
    if (sum >= 80) {
        return 'A';
    } else if (sum < 80 && sum >= 65) {
        return 'B';
    } else if (sum < 65 && sum >= 50) {
        return 'C';
    } else if (sum < 50 && sum >= 30) {
        if(re >= 50) {
            return 'C';
        }
        return 'D';
    } else {
        return 'F';
    }
    
}
int main(){
    int m,f,r;
    char grade;
    
    
    while(1) {
        cin >> m >> f >> r;
        if ((m == -1) && (f == -1) && (r == -1)) break;
        grade = appreciation(m,f,r);   
        cout << grade << endl;
    }
    return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define ll long long
int main() 
{
    ll n, ans = 1, nasi = 1, nasiz = 1;
    cin >> n;
    if(n == 1)
        cout << 0;
    else if(n == 2)
        cout << 2;
    else {
        for(ll i = 0; i < n; i++) {
            ans = ((ans * 10) % 1000000007);
        }
        for(ll i = 0; i < n; i++) {
            nasi = ((nasi * 8) % 1000000007);
        }
        for(ll i = 0; i < n; i++) {
            nasiz = ((nasiz * 9) % 1000000007);
        }
        ans = (ans - nasiz * 2 + nasi + 2000000014) % 1000000007;        
        cout << ans;
    }
    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp setprecision
#define pb(x) push_back(x)
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ld, ld> pdd;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e8;
const ll INF = 1e16;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

const int MAX_V = 1e6;

struct binary_indexed_tree{
    ll n, bit[MAX_V+1];
    //要素数N(0〜N-1)の初期化されたBITを構築
    binary_indexed_tree(int N){
        n = 1;
        while(n < N) n *= 2;
        fill_n(bit, n+1, 0);
    }
    //i番目(0から数える)の要素にx加える
    void add(int i, ll x){
        i++;
        while(i <= n){
            bit[i] += x;
            i += (i & -i);
        }
    }
    //sum(i)で[0,i)の和を取得
    ll sum(int i){
        ll s = 0;
        while(i > 0){
            s += bit[i];
            i -= (i & -i);
        }
        return s;
    }
    //query(l,r)で[l,r)の和を取得
    ll query(int l, int r){
        return sum(r) - sum(l);
    }
};

int main(){
    ll N, K;
    cin >> N >> K;
    ll a[N];
    rep(i, N) cin >> a[i];
    ll sum[N+1];
    sum[0] = 0;
    map<ll, int> mp;
    mp[0] = 0;
    rep2(i, 1, N){
        sum[i] = sum[i-1]+a[i-1]-K;
        mp[sum[i]] = 0;
    }
    int num = 0;
    for(auto &e: mp){
        mp[e.first] = num;
        num++;
    }
    binary_indexed_tree bit(num);
    ll ans = 0;
    rep(i, N+1){
        ans += bit.query(0, mp[sum[i]]+1);
        bit.add(mp[sum[i]], 1);
    }
    cout << ans << endl;
}

Measured memory_bytes: 19456