akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,l,r) for (int i=l;i<=r;i++)
using namespace std;
int pree[300500],prew[300500],sucw[300500],suce[300500];
int n,ans;
char s[300500];
int main(){
	scanf("%d",&n);
	scanf("%s",s+1);
	rep(i,1,n){
		prew[i]=prew[i-1]; pree[i]=pree[i-1];
		if (s[i]=='W') prew[i]++;
		if (s[i]=='E') pree[i]++;
	}
	for (int i=n;i>=1;i--) {
		sucw[i]=sucw[i+1]; suce[i]=suce[i+1];
		if (s[i]=='W') sucw[i]++;
		if (s[i]=='E') suce[i]++;
	}
	ans=n;
	rep(i,1,n) ans=min(ans,i-1-pree[i-1]+n-i-sucw[i+1]);
	printf("%d\n",ans);
	
	return 0;
}

Measured memory_bytes: 5248
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int a = cin.nextInt();
        int b = cin.nextInt();
        int c = cin.nextInt();
        int d = cin.nextInt();
        if (Math.abs(c-a) <= d || (Math.abs(b-a) <= d && Math.abs(c-b) <= d))
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}


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

using namespace std;

const int ms = 1e5 + 17;
const int mod = 1e9 + 7;

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

    string s;
    cin >> s;
    int answer = 0;

    for(int i = 0; i < s.size(); ++i)
    {
        if(s[i] == '+')
            ++answer;
        else
            --answer;
    }

    cout << answer << '\n';



}


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

main(){
  int data[5];
  int max;
  int i, j, t, p;

  while(1){
    t=0;
    if(scanf("%d %d %d %d %d", &data[0], &data[1], &data[2], &data[3], &data[4])==EOF) break;


    for(i=0;i<5;i++){
      max=INT_MIN;
      for(j=0;j<5;j++){
	if(max<data[j]){
	  max=data[j];
	  p=j;
	}
      }
      if(i!=4){
	printf("%d ", data[p]);
	data[p]=INT_MIN;
      }
      else if(i==4) printf("%d\n", data[p]);
    }
    if(t==1) break;
  }
  return 0;
}

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

int main(){
  string a;
  cin >> a;
  if(a=="SUN") cout << 7 <<endl;
  else if(a=="MON") cout << 6 << endl;
  else if(a=="TUE") cout << 5 << endl;
  else if(a=="WED") cout << 4 << endl;
  else if(a=="THU") cout << 3 << endl;
  else if(a=="FRI") cout << 2 << endl;
  else cout << 1 << endl;
}
  

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan =new Scanner(System.in);
        int gokei = Integer.parseInt(scan.nextLine());
        String[] kachiStr = scan.nextLine().split(" ");
        String[] costStr = scan.nextLine().split(" ");
        
        
        int answer = 0;
        for(int i = 0; i < gokei ; i++){
            int rieki = Integer.parseInt(kachiStr[i]) - Integer.parseInt(costStr[i]);
            if(rieki > 0 ){
                answer += rieki; 
            }
        }
        
        System.out.println(answer);

    }
    
}


Measured memory_bytes: 23764
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<string> s(N);
    for (int i = 0; i < N; ++i) {
        cin >> s[i];
    }

    bool soluble = false;
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < N; ++j) {
            if (s[i][j] != '.') {
                soluble = true;
                break;
            }
        }
    }

    if (!soluble) {
        puts("-1");
        return 0;
    }

    int num_full = 0;
    for (int col = 0; col < N; ++col) {
        bool full = true;
        for (int row = 0; row < N; ++row) {
            if (s[row][col] == '.') {
                full = false;
                break;
            }
        }
        if (full) {
            ++num_full;
        }
    }

    int best = -1;
    for (int row = 0; row < N; ++row) {
        int cnt = 0;
        bool there_is_column = false;
        for (int k = 0; k < N; ++k) {
            if (s[k][row] == '#') {
                there_is_column = true;
                break;
            }
        }
        for (int col = 0; col < N; ++col) {
            if (s[row][col] == '.') {
                ++cnt;
            }
        }
        if (!there_is_column && cnt) {
            cnt += 1;
        }
        if (best == -1 || cnt < best) {
            best = cnt;
        }
    }
    if (best != -1) {
        best += N - num_full;
    }
    cout << best << endl;

    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long   ll;
typedef unsigned long long   ull;
typedef long double ld;
typedef pair<ll, ll>    pll;
typedef pair<ull, ull>    pull;
typedef pair<ll, ll>  pii;
typedef pair<ld, ld>  pld;
ld dp[3009][3009];
ld p[3000];
ll n;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n;
    for(ll i = 1; i <= n; ++i)
        cin >> p[i];
    dp[1][0] = 1-p[1];
    dp[1][1] = p[1];
    for(ll i = 2; i <= n; ++i){
        dp[i][0] = dp[i-1][0]*(1-p[i]);
        for(ll j = 1; j <= i; ++j)
            dp[i][j] = dp[i-1][j]*(1-p[i]) + dp[i-1][j-1]*(p[i]);
    }
    ld ans = 0;
    for(ll i = n/2+1; i <= n; ++i)
        ans += dp[n][i];
    cout << fixed << setprecision(11) << ans << "\n";
}

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

int main() {
    int h,w;
    cin >> h >> w;
    char c[101][101];
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin >> c[i][j];
        }
    }
    for(int i=0;i<h;i++){
        for(int k=0;k<2;k++){
            for(int j=0;j<w;j++){
                cout << c[i][j];
            }
            cout << endl;
        }
    }
    return 0;
}

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

int main() {
	double N,xa,ya,ra,xb,yb,rb,i,j;
	
	for(cin>>N,i=N;i;--i){
		cin>>xa>>ya>>ra>>xb>>yb>>rb;
		
		if( ra >= rb && (ra-rb) * (ra-rb) > (xa-xb)*(xa-xb) + (ya-yb)*(ya-yb) )	
			cout << 2 << endl;
			
		else if( rb >= ra && (ra-rb) * (ra-rb) > (xa-xb)*(xa-xb) + (ya-yb)*(ya-yb))
			cout << -2 << endl;
		
		else if( (ra+rb) * (ra+rb) >= (xa-xb)*(xa-xb) + (ya-yb)*(ya-yb) )
			cout << 1 << endl;
			
		else cout << 0 << endl;
	}
}

Measured memory_bytes: 1224
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  int A,B; cin>>A>>B;
  if(A*B%2==0) cout<<"Even"<<endl;
  else cout<<"Odd"<<endl;
  }


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

using namespace std;

typedef complex<double> P;

#define EPS 1e-12

int main() {
	int N;
	while (cin >> N, N) {
		vector<P> v;
		for (int i = 0; i < N; ++i) {
			double x, y; cin >> x >> y;
			v.push_back( P(x, y) );
		}

		vector<P> c;
		for (int i = 0; i < N; ++i) {
			for (int j = i+1; j < N; ++j) {
				P r = (v[j] - v[i])/2.0;
				double l = abs(r);
				if (l > 1 + EPS) {
					continue;
				}
				else if (l >= 1 - EPS) {
					c.push_back( v[i] + r );
				}
				else {
					P t = r / l * sqrt(1 - l*l);
					c.push_back(v[i] + r + t * P(0, 1));
					c.push_back(v[i] + r + t * P(0, -1));
				}
			}
		}

		int ans = 1;
		for (int i = 0; i < c.size(); ++i) {
			int cnt = 0;
			for (int j = 0; j < v.size(); ++j) {
				P p = c[i] - v[j];
				if ( p.real()*p.real()+p.imag()*p.imag() <= 1 + EPS ) {
					++cnt;
				}
			}
			ans = max(ans, cnt);
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1916
import java.util.*;
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner stdIn = new Scanner(System.in);
		
		int n;
		while(stdIn.hasNext()){
			n = stdIn.nextInt();					
		
			int count = 0;
		
			for(int i=0; i<=9; i++){
				for(int j=0; j<=9; j++){
					for(int k=0; k<=9; k++){
						for(int l=0; l<=9; l++){
							
							if(i+j+k+l==n)
								count ++;

						}
					}				
				}			
			}
		
			System.out.println(count);

		}

		

	}

}

Measured memory_bytes: 12000
#include <stdio.h>

int main(void)
{
        int a,b;
        scanf("%d%d",&a,&b);
        if(a>=b+2)printf("%d\n",2*a-1);
        else if(a+2<=b) printf("%d\n",2*b-1);
        else if(a+1==b || b+1==a) printf("%d\n",a+b);
        else printf("%d\n",2*a);
        return 0;
}


Measured memory_bytes: 128
nums = [int(num) for num in input().split()]
n = nums[0]
T = nums[1]
ans = 10000
for i in range(n):
    ct = [int(num) for num in input().split()]
    c = ct[0]
    t = ct[1]
    if t <= T:
        ans = min(ans,c)
if ans == 10000:
    print("TLE")
else:
    print(ans)

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

#define pb push_back
#define mp make_pair
#define ll long long
#define ff first
#define ss second

using namespace std;

vector <int> g[112345];
int v[112345];
ll M = 1e9 + 7;

int main()
{
	int n,k;
	cin>>n>>k;
	for(int i = 0; i <(n-1); i++)
	{
		int a,b;
		cin>>a>>b;
		g[a].pb(b);
		g[b].pb(a);
	}

	int root = 0;
	for(int node = 1; node <=n; node++)
	{
		if(g[node].size() > k-1)
		{
			if (root)
			{
				cout<<0<<endl;
				return 0;
			}
			root = node;
		}
	}

	if (!root) root = 1; 

	ll ans = k;

	v[root] = 1;

	queue <int> q;

	for(int i = 0; i < g[root].size(); i++)
	{
		 q.push(g[root][i]);
		 ans = (ans * (k-i-1)) % M;
	}

	while(!q.empty())
	{
		int node = q.front();
		q.pop();
		v[node] = 1;
		int c = 2;
		for(int i = 0; i < g[node].size(); i++)
		{
			if (v[g[node][i]]) continue;

			q.push(g[node][i]);
			ans = (ans * (ll)(k-c)) % M; 
			c++;
		}
	}

	cout << ans << endl;

	return 0;
}

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

int n, buf;
vector<int> v, dif;

void solve() {
  sort(v.begin(), v.end());
  for(int i = 1; i < n; ++i) {
    dif.push_back(v[i] - v[i - 1]);
  }
  cout << *min_element(dif.begin(), dif.end()) << endl;
  dif.clear();
}

int main() {
  while(cin >> n && n) {
    for(int i = 0; i < n; ++i) {
      cin >> buf;
      v.push_back(buf);
    }
    solve();
    v.clear();
  }
  return 0;
}



Measured memory_bytes: 3144
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

//gcdやり直す

void swap (int *x, int *y) {
  int temp;    

  temp = *x;
  *x = *y;
  *y = temp;
}




/***
* pivotを決め、
* 全データをpivotを境目に振り分け、
* pivotの添え字を返す
***/
int partition (int array[], int left, int right) {
  int i, j, pivot;
  i = left;
  j = right + 1;
  pivot = left;   // 先頭要素をpivotとする

  do {
    do { i++; } while (array[i] < array[pivot]);
    do { j--; } while (array[pivot] < array[j]);
    // pivotより小さいものを左へ、大きいものを右へ
    if (i < j) { swap(&array[i], &array[j]); }
  } while (i < j);

  swap(&array[pivot], &array[j]);   //pivotを更新

  return j;
}

/* クイックソート */
void quick_sort (int array[], int left, int right) {
  int pivot;

  if (left < right) {
    pivot = partition(array, left, right);
    quick_sort(array, left, pivot-1);   // pivotを境に再帰的にクイックソート
    quick_sort(array, pivot+1, right);
  }
}




/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/

int main(void){
  long int n;
  scanf("%ld",&n);
  long int ans=0;
  for(int i=1;i<=n;i++){
    long int now=n/i;
    ans+=(now+1)*now/2*i;
  }
  printf("%ld\n",ans);

  return 0;
}

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

using namespace std;

int main(){
    int X,Y;
    cin >> X >> Y;
    for(int i=0;i<=X;i++){
        if(i*2+(X-i)*4==Y){
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
}

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

int n;
string s;

int main(void) {
  // Here your code !
  scanf("%d", &n);

  cin >> s;

  for (int i = 0; i < s.size(); ++i) {
    int tmp = s[i] - 'A';

    tmp += n;
    
    tmp %= 26;

    s[i] = (char)((int)('A') + tmp); 
  }
  
  cout << s << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
using namespace std;
namespace {

	void chmin(long long& x, long long y)
	{
		if (x > y || x < 0)
			x = y;
	}

	void chmax(long long& x, long long y)
	{
		if (x < y)
			x = y;
	}

	bool isSevenContained(long N)
	{
		int three = N / 100;
		if (three == 7)
			return true;
		N -= three * 100;
		int two = N / 10;
		if (two == 7)
			return true;
		N -= two * 10;
		return N == 7;
	}

	void core()
	{
		long N;
		cin >> N;

		bool ret = isSevenContained(N);
		string out = ret ? "Yes" : "No";
		cout << out;
	}
}

int main()
{
	core();

	return 0;
}

//int main()
//{
//	for (long i = 0; i < 3; ++i)
//	{
//		cout << "Input test" << endl;
//		core();
//		cout << endl;
//	}
//
//	cout << "test ended" << endl;
//
//	int ret;
//	cin >> ret;
//
//	return 0;
//}

Measured memory_bytes: 3600
#include <stdio.h>

int main(void)
{
	char str[20];
	int len;
	int i;
	
	printf("");
	scanf("%s", str);
	
	len = strlen(str);
	
	for (i = len - 1; i >= 0; i--){
		printf("%c", str[i]);
	}
	
	printf("\n");
	
	return (0);
}

Measured memory_bytes: 524
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

int main() {
    int n, k;
    string s;
    cin >> n >> k >> s;
    vector<int> Nums;
    int now = 1;
    int cnt = 0;
    rep(i, n) {
        if(s[i] == (char)('0' + now)) {
            cnt++;
        }
        else {
            Nums.push_back(cnt);
            now = 1 - now;
            cnt = 1;
        }
    }
    if(cnt != 0) {
        Nums.push_back(cnt);
    }

    if(Nums.size() % 2 == 0) {
        Nums.push_back(0);
    }

    int Add = 2*k + 1;

    vector<int> sum(Nums.size() + 1);
    for(int i = 0; i < Nums.size(); i++) {
        sum[i+1] = sum[i] + Nums[i];
    }

    int ans = 0;
    for(int i = 0; i < Nums.size(); i += 2) {

        int left = i;
        int right = min(i + Add, (int)Nums.size());
        int tmp = sum[right] - sum[left];

        ans = max(tmp, ans);
    }

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

Measured memory_bytes: 1272
from fractions import gcd

a, b, c, d = map(int, input().split())

div_c = b//c - a//c
if a%c == 0: div_c += 1
div_d = b//d - a//d
if a%d == 0: div_d += 1
lcm_cd = c*d//gcd(c, d)
div_cd = b//lcm_cd - a//lcm_cd
if a%lcm_cd == 0: div_cd += 1
print(b - a + 1 - div_c - div_d + div_cd)

Measured memory_bytes: 5044
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int n;
ll dp[3005][3005],a[3005]; 
int main(){
	cin>>n;
	for(int i=1;i<=n;++i){
		cin>>a[i];
	}
	for(int L=n;L>0;--L){
		for(int R=L;R<=n;++R){
			dp[L][R]=max(a[L]-dp[L+1][R],a[R]-dp[L][R-1]);
		}
	}
	cout<<dp[1][n]<<'\n';
	return 0;
}

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

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

    long double answer = 0.0;
    for(int i=1;i<N+1;i++){
        int num = i;
        int j=0;
        while(true){
            if(num >= K){
                answer += 1.l/ N * pow(0.5, j);
                break;
            }
            else{
                num *= 2;
                j++;
            }
        }
    }

    cout << fixed << setprecision(10);
    cout << answer << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int sum=0;
    int som=0;
    for(int i=1;i<55555;i+=10){
        sum=0;
        for(int j=1;j<i+1;j++){
            if(i%j==0){
                sum++;
            }
        }
        if(sum==2){
            cout<<i<<" ";
            som++;
        }
        if(som>=n){
            break;
        }
    }
    cout<<endl;
}

Measured memory_bytes: 256
import sys

DBG_FLAG = 0

def p_dbg(str):
    if(DBG_FLAG == 1):
        sys.stdout.flush()
        print str

# 1st. get Num

Num = int(raw_input())

p_dbg('Num : ' + str(Num))

square_max = 1

# MEMORY OVER
# for i in range(1, Num):
#     tmp = i * i
#     p_dbg(str(i) + str(square_max))
#     if(tmp <= Num):
#         square_max = tmp
#     else:
#         break

i = 1
tmp = 1
while tmp <= Num:
    p_dbg(str(i) + ':' + str(square_max))
    square_max = tmp
    tmp = i*i
    i = i+1

print square_max


Measured memory_bytes: 2568
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int x = Integer.parseInt(br.readLine());
		System.out.println(x*x*x);
	}

}

Measured memory_bytes: 17004
''' بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ '''
#codeforces546B
from collections import Counter
gi = lambda : list(map(int,input().strip().split()))
n, = gi()
l = [input().split() for _ in range(n)]
l = [(l[k][0], -int(l[k][1]), str(k+1)) for k in range(n) ]
l.sort()
print("\n".join([e[2] for e in l]))

Measured memory_bytes: 3316
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
diff = [0]*N
sumA = 0
sumB = 0
for i in range(N):
    sa = A[i] - B[i]
    diff[i] = sa
    sumA += A[i]
    sumB += B[i]
if sumA < sumB:
    print(-1)
    exit()
diff.sort(reverse= True)
fixidx = -1
usedI = False
c = 0
usedJ = []
for i in range(N):
    usedI = False
    if diff[i] > 0:
        for j in range(fixidx,-N,-1):
            #print(i,j,diff[i],diff[j])
            if diff[j] < 0:
                if not usedI:
                    usedI = True
                    c += 1
                if diff[i] + diff[j] >= 0:
                    diff[i] += diff[j]
                    diff[j] = 0
                    usedJ.append(j)
                    fixidx = j+1
                    if diff[i] == 0:
                        break
#                    print(i,j,diff[i],diff[j])
                else:
                    diff[j] += diff[i]
                    diff[i] = 0
 #                   print(diff[j])
                    usedJ.append(j)
                    fixidx = j
#                    print(i, j, diff[i], diff[j])
                    break
            elif diff[j] >= 0:
                #print(usedJ)
                print(c+len(set(usedJ)))
                exit()
    else:
        break
#print(c,usedJ)
print(c+len(set(usedJ)))





Measured memory_bytes: 102328
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rrep(i, n) for(ll i = n - 1; i > -1; i--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define fi first
#define se second
const ll INF = (1LL << 61) - 1;
const ll MOD = 1000000007 /*998244353*/;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, h, x, y, z, p, q, n, t, r, k, w, l, ans, i, j, u, v, m;
string S, T;
vl A, B;
void input() {
    cin >> n >> m >> k;
    rep(i, n) {
        cin >> x;
        A.pb(x);
    }
    rep(i, m) {
        cin >> x;
        B.pb(x);
    }
}
void solve() {
    rep(i, n) {
        if(i)
            A[i] += A[i - 1];
    }
    rep(i, m) {
        if(i)
            B[i] += B[i - 1];
    }

    ans = upper_bound(all(B), k) - B.begin();
    rep(i, n) {
        if(k >= A[i])
            a = i + 1 + upper_bound(all(B), k - A[i]) - B.begin();
        ans = max(a, ans);
    }

    cout << ans << endl;
}
int main() {
    // cout<<fixed<<setprecision(15);
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    solve();
}


Measured memory_bytes: 7936
#include<bits/stdc++.h>
#define ll long int
using namespace std;
int main()
{
    ll n; cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++) cin>>a[i];
    ll dp[n]; dp[0]=0; dp[1]=abs(a[1]-a[0]);
    for(int i=2;i<n;i++)
    {
        dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]), dp[i-2]+abs(a[i]-a[i-2]));
    }
    cout<<dp[n-1];
}

Measured memory_bytes: 1792
#include<iostream>
#include<string>
#define ll long long
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d;
    ll t;
    cin>>t;
    a =0;
    b = 0;
    c = 0;
    d = 0;
    while(t--){
        
        string s,s1,s2,s3;
        cin>>s;
        s1 = "AC";
        s2 = "WA";
        s3 = "TLE";
        if(( s.compare(s1)) == 0)
            a++;
        else if(( s.compare(s2)) == 0)
            b++;
        else if(( s.compare(s3)) == 0)
            c++;
        else
            d++;
    }
    cout<<"AC x "<<a<<endl;
    cout<<"WA x "<<b<<endl;
    cout<<"TLE x "<<c<<endl;
    cout<<"RE x "<<d<<endl;
    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
int main(){
string S;
cin>>S;
int count=0;
int answer=0;
bool a=true;
for(int i=0; i<3; i++){
    if(S.at(i)=='R'){
        count++;
    }
    else{
    answer=max(answer,count);
    count=0;
    }
}
cout<<max(answer,count)<<endl;

}


Measured memory_bytes: 3624
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Map<String, Integer> map = new HashMap<>();
		Scanner s = new Scanner(System.in);
		int N = s.nextInt();
		for (int i = 0; i < N; i++) {
			String word = s.next();
			Integer count = map.get(word);
			map.put(word, count == null ? 1 :count + 1);
		}
		
		int M = s.nextInt();
		for (int i = 0; i < M; i++) {
			String word = s.next();
			Integer count = map.get(word);
			map.put(word, count == null ? - 1 :count - 1);
		}
		int max = 0;
		for (String key : map.keySet()) {
			int i = map.get(key);
			if(i > max){
				max = i;
			}
		}
		System.out.println(max);
	}
}	


Measured memory_bytes: 23764
#include <cstdio>
#include <algorithm>
using namespace std;
const int Max = 1e4 + 5;
int n, x, y, ans[Max];

int main() {
    scanf("%d %d %d", &n, &x, &y);
    for (int i = 1; i <= n - 1; i++) {
        for (int j = i + 1; j <= n; j++) {
            int dis = j - i;
            dis = min(dis, abs(i - x) + abs(j - y) + 1);
     
            ans[dis]++;
        }
    }
    for (int i = 1; i <= n - 1; i++)
        printf("%d\n", ans[i]);
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#pragma GCC optimize ("O3")
#define endl '\n'
using namespace std;
typedef long long int ll ;
const ll mod =1000000007;
ll pre[200005];
int main()
{
   ll n;
   cin>>n;
   ll arr[n+2];
   for(int i=1;i<=n;i++) cin>>arr[i];
   for(int i=n-1;i>=1;i--){
      if(arr[i]>arr[i+1]) arr[i]--; 
   }
   for(int i=1;i<=n-1;i++){
       if(arr[i]>arr[i+1]){ cout<<"No"; return 0 ; }
   }
   cout<<"Yes";
    
    
    
}

Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <complex>
using namespace std;
int main(){
    int i,j,k,l;
    int a,b,c,d;
    int dif,rec;
    int num,max;
    vector<int> res(100,0);
    a = 0;
    while(1){
        cin >> num >> max;
        if(num==0&&max==0){
            break;
        }
        vector<int> res1(max,0);
        for(i=0;i<num;i++){
            cin >> dif >> rec;
            if(res1[dif-1]<rec){
                res1[dif-1] = rec;
            }
        }
        for(i=0;i<max;i++){
            res[a] += res1[i];
        }
        a++;
    }
    for(i=0;i<a;i++){
        cout << res[i] << endl;
    }
    
}


Measured memory_bytes: 3088
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;

const int N = 100 + 10;
int a[N][N];
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  int x = 0, y = 0, dir = 1;
  for (int i = 0; i < k; ++i) {
    int cnt;
    scanf("%d", &cnt);
    while (cnt--) {
      a[x][y] = i + 1;
      y += dir;
      if (dir > 0 && y == m) {
        ++x;
        y = m - 1;
        dir = -dir;
      }
      if (dir < 0 && y < 0) {
        ++x;
        y = 0;
        dir = -dir;
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      printf("%d%c", a[i][j], " \n"[j + 1 == m]);
    }
  }
  return 0;
}


Measured memory_bytes: 384
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define all(x) x.begin(),x.end()
#define ln '\n'
const long long MOD = 1000000007LL;
//const long long MOD = 998244353LL;
typedef long long ll;
typedef unsigned long long ull; 
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
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; }
///////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N; cin >> N;
    vector<ll> A(N);
    rep(i,N) cin >> A[i];
    
    ll X = 0;
    rep(i,N) X ^= A[i];
    set<ll> dic;
    rep(i,N) {
        A[i] = A[i]^(A[i]-1);
        dic.emplace(A[i]);
    }
    int ans = 0;
    for(int i = 32; i >= 0; --i) {
        if ((X>>i)&1) {
            if (dic.count((1LL<<(i+1))-1)) {
                ans++;
                X ^= (1LL<<(i+1))-1;
            } else {
                cout << -1 << ln;
                return 0;
            }
        }
    }

    cout << ans << ln;
}


Measured memory_bytes: 1024
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashMap;


public class Main {
	
	public static void main(String[] args) throws IOException {
		Main m = new Main();
		m.input();
		m.solve();
		m.output();
	}
	/*
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	/*/
	InputUtil in = new InputUtil();
	PrintWriter out = new PrintWriter(System.out);
	//*/
	int N = 0;
	long ans = 0;
	
	public void input() throws IOException {
		/*
		S = br.readLine();
		/*/
		N = in.nextInt();
		//*/
	}

	public void solve() throws IOException {
		long [] L = new long[N+1];
		L[0] = 2;
		L[1] = 1;
		for(int i=2; i<=N; i++){
			L[i] = L[i-1] + L[i-2];
		}
		ans = L[N];
	}
	
	public void output() {
		out.println(ans);
		out.flush();
	}
}

//*
class InputUtil {
	//Static Fields
	private static final int BUFSIZ = 100000;
	
	//Fields
	protected InputStream in;
	private byte[] buf = null;
	private int ptr = 0;
	private int max = -1;
	private DataInputStream dis = null;
	//Constructors
	public InputUtil() {this(System.in,BUFSIZ);}
	public InputUtil(InputStream in, int bufsiz) {
		initBuf(bufsiz);
		initIn(in);
	}
	
	//Methods
	//Initializer
	protected void initIn(InputStream in) {dis = new DataInputStream(this.in = in);}
	protected void initBuf(int bufsiz) {buf = new byte[bufsiz];}
	
	//buffer operation
	private void next() throws IOException {ptr++; readBuf();}
	private void readBuf() throws IOException {
		if(ptr >= max && dis.available()>0) {
			if(max>0) Arrays.fill(buf,0,max,(byte)0);
			max = dis.read(buf);
			ptr = 0;
		}
	}
	
	//Number Input Reader/Parser
	private boolean isNum(byte b) {return '0' <= b && b <= '9'; }
	private boolean isMinus(byte b) {return b=='-'; }

	private int _nextInt() throws IOException {
		int sign = 1;
		int res = 0;
		byte c;
		while (!isNum(c=buf[ptr]) && !isMinus(c)) 
			next();
		if (isMinus(buf[ptr])) {
			sign = -1;
			next();
		}
		while (isNum(c=buf[ptr])) {
			res *= 10;
			res += c - '0' ;
			next();
		}
		next();
		return sign * res;
	}
	
	public int nextInt() throws IOException {
		readBuf();
		return _nextInt();
	}

	public int[] nextInt(int[] result) throws IOException {
		readBuf();
		for(int i=0; i<result.length; i++) {
			result[i] = _nextInt();
		}
		return result;
	}
	
	//Close 
	public void close() throws IOException {
		if(!this.in.equals(System.in)) 
			this.in.close();
	}
}
//*/


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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

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

    ll l=0,r=0;

    while(q--)
    {
        int p,n;
        char c;
        scanf(" %d %c %d", &p, &c, &n);

        if(c=='(') l+=n;
        else r+=n;

        if(l==r) printf("Yes\n");
        else printf("No\n");
    }

    return 0;
}

Measured memory_bytes: 3168
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
typedef long long ll;
int num[3];
inline int count(int n);
int main(void)
{
	int N;
	scanf("%d", &N);
	for (int i = 0; i < N; i++)
	{
		int t;
		scanf("%d", &t);
		num[count(t)]++;
	}
	num[1] %= 2;
	if (num[2] >= num[0] + num[1] - 1)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}
inline int count(int n)
{
	if (n % 4 == 0)return 2;
	if (n % 2 == 0)return 1;
	return 0;
}

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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  int64_t h,w;
  while(true){
    cin >> h >> w;
    if(h==0&&w==0) break;
    for(int y=0;y<h;y++){
        for(int x=0;x<w;x++){
            if(y==0||y==h-1 || x==0 || x== w-1){
                cout << "#";
            }
            else {
                cout << ".";
            }
        }
        cout << endl;
    }
    cout << endl;
  }
 
  return 0;
}


Measured memory_bytes: 3056
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}
ll dist[2010][2010] = {};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,X,Y;
    cin >> N >> X >> Y;
    X--; Y--;
    rep(i,0,N){
        rep(j,i+1,N){
            dist[i][j] = abs(i - j);
        }
        ll dx = min(abs(i - X), abs(i - Y)+1);
        rep(j,i+1,N){
            dist[i][j] = min(dist[i][j], dx + abs(X - j));
        }
        ll dy = min(abs(i - Y), abs(i - X) + 1);
        
        rep(j,i+1,N){
            dist[i][j] = min(dist[i][j], dy + abs(Y - j));
        }
    }
    ll ans[2010] = {};
    rep(i,0,N){
        rep(j,i+1,N){
            ans[dist[i][j]]++;
            // print(i,j,dist[i][j]);
        }
    }
    rep(i,1,N) print(ans[i]);
    

}

Measured memory_bytes: 31232
#include<stdio.h>

int main(void){
    int i,j,h,w;
    while(1){
    scanf("%d %d",&h,&w);
    if(h == 0 && w == 0)
        break;
    for(i = 0;i < w;i++)
        printf("#");
    printf("\n");
    for(i = 2;i <= h - 1;i++){
        printf("#");
        for(j = 2;j <= w- 1;j++)
            printf(".");
        printf("#\n");
    }
    for(i = 0;i < w;i++)
        printf("#");
    printf("\n\n");
    }
    return 0;
}

Measured memory_bytes: 588
#include<bits/stdc++.h>
typedef long long ll;

using namespace std;
int main()
{
 ll a,b,c,d,m,n,res=0;
 cin>>a>>b>>c>>d;
 cout<<max(max(a*c,b*d),max(a*d,b*c))<<endl;
return 0;
}


Measured memory_bytes: 3632
n,a,b=map(int,input().split())
mod=10**9+7

def power(x,n): #x**n(mod)を二分累乗法で求める
    T=[x]
    while 2**(len(T))<n+1: #a**1,a**2.a**4,a**8,...を計算しておく
        T.append(T[-1]**2%mod)
    b=bin(n) #mod-2を2進数表記にする
    ans=1
    for i in range(len(b)-2):
        if int(b[-i-1])==1:
            ans=ans*T[i]%mod
    return ans

#n!とその逆元を求めておく
N=2*10**5+10
g1=[1,1] #n!
g2=[1,1] #n!の逆元
inverse=[0,1]
for i in range(2,N+1):
    g1.append((g1[-1]*i)%mod)
    inverse.append((-inverse[mod%i]*(mod//i))%mod)
    g2.append((g2[-1]*inverse[-1])%mod)

nCa=1
for i in range(a):
    nCa=nCa*(n-i)%mod
nCa=nCa*g2[a]%mod
    
nCb=1
for i in range(b):
    nCb=nCb*(n-i)%mod
nCb=nCb*g2[b]%mod

ans=power(2,n)-1
ans=(ans-nCa)%mod
ans=(ans-nCb)%mod

print(ans)

Measured memory_bytes: 27120
import math
from fractions import Fraction
N = int(input())
tmin = 1
amin = 1
for i in range(N):
    t, a = map(int, input().split())
    multiple = math.ceil(max(Fraction(tmin, t), Fraction(amin, a)))
    tmin = t * multiple
    amin = a * multiple
print(tmin + amin)

Measured memory_bytes: 5088
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int K,N;
  cin >> K >> N;
  vector<int> A(N); 
  for (int i = 0; i < N; i++){
    cin >> A.at(i);
  }
  
  int max = K + A.at(0) - A.at(N - 1);
  for (int i = 0; i < N - 1; i++){
    if (A.at(i + 1) - A.at(i) > max){
      max = A.at(i + 1) - A.at(i);
    }
  }
  
  cout << K - max << endl;
}

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

using namespace std;

#define sp(x) cout<<setprecision(x);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define print(s) cout<<(s)<<endl
#define lint long long
#define yes "Yes"
#define no "No"

typedef pair<int, int> P;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int d, n; cin>>d>>n;
    lint ans;
    if(n==100) n++;
    
    if(d==0) ans = n;
    else if(d==1) ans = n*100;
    else if(d==2) ans = n*10000;
    print(ans);
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include<time.h>
void printarray(int arr[], int n);
int partition(int arr[], int i, int j, int pivot)
{
    int l, r, k, t;
    l = i;
    r = j;
    while (l <= r)
    {
        while (l <= r && arr[l] <= pivot)
            {l++;}
        while (l <= r && arr[r] >= pivot)
            {r--;}
        if (l <= r)
        {
            t = arr[l];
            arr[l] = arr[r];
            arr[r] = t;
            l++;r--;
        }
    }
    k = l - 1;
    arr[i - 1] = arr[k];
    arr[k] = pivot;
    // printf("Pivot index : %d\n",k);
    // printarray(arr,n);
    return k;
}
void RQS(int arr[], int i, int j)
{
    int t, p, k;
    if (i < j)
    {   srand(time(0));
        p = (rand()%(j-i+1)) + i;
        // p = 1;
        t = arr[i];
        arr[i] = arr[p];
        arr[p] = t;
        k = partition(arr,i+1,j, arr[i]);
        RQS(arr, i,k - 1);
        RQS(arr, k + 1, j);
        // printarray(arr,n);
    }
}
void printarray(int arr[], int n)
{
    int i;
    for (i = 0; i < n; i++)
    {
        printf("%d ", arr[i]);
    }
    printf("\n");
}
int main()
{
    int ans,n,i,k;
    scanf("%d%d",&k,&n);
    int arr[n];
    for(i=0;i<n;i++)
    {
        scanf("%d",&arr[i]);
    }
    ans = k;
    int  j;
    i = 0;
    j = n-1;
    RQS(arr,i, j);
    for(i=0;i<n-1;i++)
    {
        if(ans > k - (arr[i+1]-arr[i]))
        {
            ans = k - (arr[i+1]-arr[i]);
        }
    }
    if(arr[n-1]-arr[0]<ans)
    {
        ans = arr[n-1]-arr[0];
    }
    printf("%d",ans);
    return 0;
}


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

/* using */
using namespace std;

/* main constructor */
struct Fast
{
    Fast()
    {
        std::cin.tie(0);
        ios::sync_with_stdio(0);
        //cout << fixed << setprecision(12);
    }
} fast;

/* template */
template <class T>
bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0; }
template <class T>
bool chmin(T &a, const T &b) { return (b < a) ? (a = b, 1) : 0; }

/* define */
#define REP(i, x, n) for (int i = x; i < (int)(n); ++i)
#define RREP(i, x, n) for (int i = x - 1; i >= (int)(n); --i)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) REP(i, 1, n + 1)
#define rrep(i, n) RREP(i, n, 0)
#define each(i, n) for (auto &i : n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define eunique(x) \
    sort(all(x));  \
    (x).erase(unique(all(x)), (x).end())
#define int long long
#define mp make_pair

/* function */
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }

/* const */
const int inf = 1e9 + 7;
const int dxl[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dyl[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dxs[4] = {1, 0, -1, 0};
const int dys[4] = {0, 1, 0, -1};

/* main */
signed main(void)
{
    string s, t;
    cin >> s >> t;
    sort(all(s));
    sort(rall(t));
    cout << ((s < t) ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

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

using ll = long long;
using ull = unsigned long long;
using vb = vector<bool>;
using vi = vector<int>;
using vll = vector<ll>;
using vs = vector<string>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vvll = vector<vll>;

template<typename A, typename T>void assign2d(A&arr, ll H, ll W, T t) { arr.resize(H); REP(i, H) arr[i].assign(W, t); }
template<class T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); REP(i, n)os << v[i] << (i == n - 1 ? "" : " "); return os; }
template <class T = int> inline T IN() { T x; cin >> x; return x; }
template<class T> inline void OUT(const T &x) { cout << x << "\n"; }
void YESNO(bool c) { OUT(c ? "YES" : "NO"); };
void YesNo(bool c) { OUT(c ? "Yes" : "No"); };
void yesno(bool c) { OUT(c ? "yes" : "no"); };
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); /*cout << fixed << setprecision(6);*/ } } pre__;

ull A, B, X;

ull f(ull n) {
	if (n == -1)return 0;
	else return n / X + 1;
}

int main() {
	cin >> A >> B >> X;
	OUT(f(B) - f(A - 1));
	return 0;
}

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

using namespace std;

int main () {
  double a, b, x;
  cin >> a >> b >> x;

  double V0 = a * a * b;
  double theta;

  if (x >= V0 / 2)
    theta = atan(2 * (a * a * b - x) / (a * a * a));
  else
    theta = atan(a * b * b / (2 * x));

  cout << setprecision(16) << theta * 180 / M_PI << "\n";
}


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

int main()
{
	double s,num,sum1=0,sum2=0,ave=0,cnt=0;
	

	while (scanf("%lf,%lf", &s,&num) != EOF)
	{
		sum1 += s*num;
		sum2 += num;
		++cnt;	
	}
	
	ave = round(sum2 / cnt);
	printf("%.0f\n%.0f\n", sum1, ave);

	return 0;
}


Measured memory_bytes: 656
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
using indx = size_t;
#define endl '\n'

int main() {
    int n, l;
    cin >> n >> l;
    vector<string> s(n);
    for (auto& x : s) cin >> x;
    sort(s.begin(), s.end());
    for (auto x : s) cout << x;
    cout << endl;
}


Measured memory_bytes: 256
var Point = function(x,y) {
	this.x = x;
	this.y = y;
};

Point.prototype = {
	vec:function(p) {
		return new Point(this.x-p.x,this.y-p.y);
	},
	norm:function(){
		return this.x*this.x+this.y*this.y;
	},
	len:function() {
		return Math.sqrt(this.norm());
	},
};

var Line = function(a,b) {
	this.a = a;
	this.b = b;
};

Line.prototype = {
	vec:function() {return this.b.vec(this.a);}
};

var Geo = {
	P:function(x,y) {
		return new Point(x,y);
	},
	L:function(a,b) {
		return new Line(a,b);
	},
	FRONT:1,
	RIGHT:2,
	BACK:4,
	LEFT:8,
	ON:16,
	eps:1e-9,
	cross:function(a,b) {
		return a.x*b.y-a.y*b.x;
	},
	dot:function(a,b) {
		return a.x*b.x+a.y*b.y;
	},
	eq:function(a,b) {
		return Math.abs(a-b)<Geo.eps;
	},
	sig:function(a) {
		return a<-Geo.eps ? -1 : (a>Geo.eps) ? 1 : 0;
	},
	ccw:function(s,p) {
		var a = s.vec();
		//console.log(a);
		p = p.vec(s.a);
		var cr = Geo.cross(a,p);
		if( Geo.eq(cr,0) ) {
			if(Geo.sig(Geo.dot(a,p)) < 0) return Geo.BACK;
			if(Geo.sig(a.norm()-p.norm()) < 0) return Geo.FRONT;
			return Geo.ON;
		}
		return (cr > 0) ? Geo.LEFT : Geo.RIGHT;
	},
	iI2_1:function(a,b) {
		return ((Geo.ccw(a,b.a)|Geo.ccw(a,b.b))&(ccw(b,a.a)|ccw(b,a.b))) == (Geo.LFET|Geo.RIGHT);
	},
	iI2_2:function(a,b) {
		var cwa = Geo.ccw(a,b.a) | Geo.ccw(a,b.b);
		var cwb = Geo.ccw(b,a.a) | Geo.ccw(b,a.b);
		return ((cwa | cwb) & Geo.ON) || ((cwa & cwb) == (Geo.LEFT | Geo.RIGHT));
	},
	iPoL2:function(a,b) {
		return a.a.vec(b).len()+b.vec(a.b).len() < a.a.vec(a.b).len() + Geo.eps;
	},
};

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (chunk)
{
	var sc = chunk.trim().split("\n");
	//console.log(sc);
	var q = parseInt(sc.shift());
	//console.log(q);
	while( q-- > 0 ) {
		var d = sc.shift().trim().split(" ");
		for( var i in d ) d[i] = parseInt(d[i]);
		var l1 = Geo.L(Geo.P(d[0],d[1]),Geo.P(d[2],d[3]));
		var l2 = Geo.L(Geo.P(d[4],d[5]),Geo.P(d[6],d[7]));
		console.log(Geo.iI2_2(l1,l2)?1:0);
	}
});

Measured memory_bytes: 10736
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <math.h>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <string.h>
#include <bitset>
#define REP(i,a,n) for(int i=a;i<=n;++i)
#define PER(i,a,n) for(int i=n;i>=a;--i)
#define hr putchar(10)
#define pb push_back
#define lc (o<<1)
#define rc (lc|1)
#define mid ((l+r)>>1)
#define ls lc,l,mid
#define rs rc,mid+1,r
#define x first
#define y second
#define io std::ios::sync_with_stdio(false)
#define endl '\n'
#define DB(a) ({REP(__i,1,n) cout<<a[__i]<<' ';hr;})
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int P = 1e9+7, INF = 0x3f3f3f3f;
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll qpow(ll a,ll n) {ll r=1%P;for (a%=P;n;a=a*a%P,n>>=1)if(n&1)r=r*a%P;return r;}
ll inv(ll x){return x<=1?1:inv(P%x)*(P-P/x)%P;}
inline int rd() {int x=0;char p=getchar();while(p<'0'||p>'9')p=getchar();while(p>='0'&&p<='9')x=x*10+p-'0',p=getchar();return x;}
//head



const int N = 1e4+10;
int d, n;
char s[N];
int dp[N][111];

int solve(int x,int sum,bool z,bool lim) {
	if (x==n) return !sum;
	if (!lim&&!z&&~dp[x][sum]) return dp[x][sum];
	int ans = 0, mx=lim?s[x]-'0':9;
	REP(i,0,mx) (ans+=solve(x+1,(sum+i)%d,z&&!i,lim&&i==mx))%=P;
	return !lim&&!z?dp[x][sum]=ans:ans;
}

int main() {
	cin>>s>>d;
	memset(dp,-1,sizeof dp);
	n = strlen(s);
	int ans = solve(0,0,1,1)-1;
	if (ans<0) ans+=P;
	printf("%d\n", ans);
}









Measured memory_bytes: 5376
#ifndef LOCAL
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#endif
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
#define sim template < class c
#define int long long
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << '\n'; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef tree< pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef long long ll;
const ll MOD = 1e9 + 7 ;
const ll N = 2e5 + 10 ;
const ll INF = 1e18 + 10 ;
int POW(int a, int b){
    int ans = 1 ;
    for(int i = 0; i < b; i++){
        ans *= a ;
    }
    return ans ;
}
signed main(){
    fastio
    int n , p ;
    cin >> n >> p ;
    if ( n == 1 ) {
        cout << p << endl;
        return 0 ;
    }
    int ans = 1 ;
    for(int i = 2; i <= (int)1e6; i++){
        int val = pow(i, n) ;
        if ( val > p ) break ;
        if ( val <= p && p % val == 0 ) {
            debug() << imie(val) imie(p) ;
            ans = i ;
        }
    }
    cout << ans << endl;
    return 0; 
}

Measured memory_bytes: 4080
#include <cstdio>
#include <queue>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
typedef pair<int,int> _P;
typedef pair<int,_P> P;
int main() {
	int c,n,m,s,d;
	int a,b,f;
	int i,ans;
	int cost1[100][100],cost2[100][11];
	priority_queue<P,vector<P>,greater<P> > que;
	while(scanf("%d%d%d%d%d",&c,&n,&m,&s,&d),c) {
		fill(cost1[0],cost1[0]+100*100,1<<27);
		fill(cost2[0],cost2[0]+100*11,1<<27);
		for(i=0;i<m;i++) {
			scanf("%d%d%d",&a,&b,&f);
			cost1[a-1][b-1]=cost1[b-1][a-1]=min(cost1[a-1][b-1],f);
		}
		while(!que.empty()) que.pop();
		que.push(P(0,_P(s-1,0)));
		cost2[s-1][0]=0;
		while(!que.empty()) {
			P p=que.top();que.pop();
			if(cost2[p.second.first][p.second.second]<p.first) continue;
			for(i=0;i<n;i++) {
				if((p.first+cost1[p.second.first][i])<cost2[i][p.second.second]) {
					cost2[i][p.second.second]=p.first+cost1[p.second.first][i];
					que.push(P(cost2[i][p.second.second],_P(i,p.second.second)));
				}
				if(p.second.second+1<=c&&(p.first+cost1[p.second.first][i]/2)<cost2[i][p.second.second+1]) {
					cost2[i][p.second.second+1]=p.first+cost1[p.second.first][i]/2;
					que.push(P(cost2[i][p.second.second+1],_P(i,p.second.second+1)));
				}
			}
		}
		ans=(1<<27);
		for(i=0;i<=c;i++)ans=min(ans,cost2[d-1][i]);
		printf("%d\n",ans);
	}
}

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

 
int main() {
    int n;
    cin>>n;
    map<char,int> arare;

    rep(i,n){
        char s;
        cin>>s;
        arare[s]=1;
    }

    if(arare.size()==4)cout<<"Four"<<endl;
    else cout<<"Three"<<endl;

}

Measured memory_bytes: 256