akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
int gcd(int P, int Q); 
 
int main() {
    int N;
    cin >> N;
    N++;
 
    vector<int> A(N);
    for (int i=0; i<N; i++) {
        cin >> A.at(i);
    }
 
    sort (A.begin(), A.end());
  
    if (N == 2) {
      cout << A.at(1)-A.at(0) << endl;
      exit(0);
    }
 
    int D=gcd( (A.at(1)-A.at(0)) , (A.at(2)-A.at(1)) );
    int C;
 
    for (int i=3; i<N; i++) {
        C = gcd( (A.at(i-1)-A.at(i-2)) , (A.at(i)-A.at(i-1)) );
        if (C < D) {
            D = C;
        }
    }
 
    cout << D << endl;
 
 
}
 
int gcd(int P, int Q) {
    int r = P%Q;
    if (r == 0) {
        return Q;
    }
 
    int rr = Q%r;
    if (rr == 0) {
        return r;
    }
 
    while ((r != 0) || (rr != 0)) {
        r = r % rr;
        if (r == 0) {
            return rr; 
        }
 
        rr = rr % r;
        if (rr == 0) {
            return r;
        }
    }
}

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

class Main
{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] A = new int[N];
    int[] freq = new int[(int)1e5 + 1];
    //10^5 = 100,000
    //~2e9
    for (int i = 0; i < N; i++)
    {
      A[i] = sc.nextInt();
    }
    for (int i = 0; i < N; i++)
    {
      freq[A[i]] += 1; //case do nothing:
      if (A[i] - 1 >= 0) freq[A[i] - 1] += 1;
      freq[A[i] + 1] += 1;
    }
    int count = 0;
    for (int i = 0; i< 1e5 + 1; i++)
    {
      count = Math.max(count, freq[i]);
    }
    System.out.println(count);
  }
}


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

int main(){
    int n, m, l;
    cin >> n >> m >> l;
    int arr1[100][100], arr2[100][100];
    long res[100][100];
    for(int i=0; i<n; i++){
        for(int j=0; j<m; j++){
            cin >> arr1[i][j];
        }
    }
    for(int i=0; i<m; i++){
        for(int j=0; j<l; j++){
            cin >> arr2[i][j];
        }
    }
    
    for(int i=0; i<n; i++){
        for(int j=0; j<l; j++){
            for(int k=0; k<m ;k++){
                if(k==0){
                    res[i][j] = arr1[i][k] * arr2[k][j];
                }else{
                    res[i][j] += arr1[i][k] * arr2[k][j];
                }
                
            }
        }
    }
    
    for(int i = 0; i < n; i++){
        for(int k = 0; k < l - 1; k++){
            cout << res[i][k] << " ";
        }
        cout << res[i][l - 1] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3196
#include<stdio.h>
#include<string.h>

int main() {
	
	char S[100];
	int N;
	int ans = 0;

	scanf("%s", S);
	N = strlen(S);

	for (int i = 0; i < N; i++) {
		if (i % 2 == 0) {
			if (S[i] != 'R' & S[i] != 'U' & S[i] != 'D') {
				ans = 1;
				break;
			}
		}
		else {
			if (S[i] != 'L' & S[i] != 'U' & S[i] != 'D') {
				ans = 1;
				break;
			}
		}
	}

	if (ans == 0) {
		printf("Yes");
	}
	else {
		printf("No");
	}

	return 0;
}



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

using namespace std;


int main(){
    int N;
    cin>>N;
    vector<int> C(N);
    vector<int> S(N);
    vector<int> F(N);

    for(int i=0;i<N;i++) cin>>C[i]>>S[i]>>F[i];

    for(int i=0;i<N-1;i++){
        int time = C[i] + S[i];
        for(int j = i+1;j<N-1;j++){
            if(time < S[j]) time = S[j];
            else if(time % F[j] != 0){
                time = time + (F[j]-time%F[j]); 
            }
            
            time += C[j];
        }
        cout<<time<<endl;
    }

    cout<<"0\n";

}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
	"unsafe"
)

func main() {
	NK := sc.nextInts()
	N := NK[0]
	K := NK[1]
	Hn := sc.nextInts()
	var cnt int
	for i := 0; i < N; i++ {
		if Hn[i] >= K {
			cnt++
		}
	}
	fmt.Println(cnt)
}

var (
	sc scanner
)

func init() {
	sc = scanner{
		buf: make([]string, 0, 0),
		cur: 0,
		r:   bufio.NewReader(os.Stdin),
	}
}

type scanner struct {
	buf []string
	cur int
	r   *bufio.Reader
}

func (s *scanner) readln() {
	rbuf := make([]byte, 0, 0)
	for {
		line, prefix, err := s.r.ReadLine()
		if err != nil {
			panic(err)
		}
		rbuf = append(rbuf, line...)
		if prefix == false {
			break
		}
	}
	s.cur = 0
	s.buf = strings.Split(*(*string)(unsafe.Pointer(&rbuf)), " ")
}
func (s *scanner) isFull() bool {
	if s.cur == len(s.buf) {
		return true
	}
	return false
}
func (s *scanner) resetCur() {
	s.cur = 0
}
func (s *scanner) next() string {
	if s.cur == 0 {
		s.readln()
	}
	res := s.buf[s.cur]
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nexts() []string {
	s.readln()
	s.resetCur()
	return s.buf
}
func (s *scanner) nextInt() int {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.Atoi(s.buf[s.cur])
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nextInts() []int {
	s.readln()
	res := make([]int, len(s.buf))
	for i := range s.buf {
		res[i], _ = strconv.Atoi(s.buf[i])
	}
	s.resetCur()
	return res
}
func (s *scanner) nextFloat() float64 {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.ParseFloat(s.buf[s.cur],
		64)
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nextFloats() []float64 {
	s.readln()
	res := make([]float64, len(s.buf))
	for i := range s.buf {
		res[i], _ = strconv.ParseFloat(s.buf[i],
			64)
	}
	s.resetCur()
	return res
}
func digits(x int) int {
	return len(strconv.Itoa(x))
}
func powInt(x, p int) (result int) {
	result = 1
	for i := 0; i < p; i++ {
		result *= x
	}
	return
}
func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}
func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}
func abs(x int) int {
	return int(math.Abs(float64(x)))
}
func varDump(value ...interface{}) {
	for _, v := range value {
		fmt.Fprintf(os.Stderr, "%#v\n", v)
	}
}
func yes() {
	fmt.Println("Yes")
}
func no() {
	fmt.Println("No")
}

// Pair a
type Pair struct {
	first  int
	second int
}

// Queue a
type Queue struct {
	v []Pair
}

// Push for queue
func (q *Queue) Push(v Pair) {
	q.v = append(q.v, v)
}

// Pop for queue
func (q *Queue) Pop() Pair {
	r := q.v[0]
	q.v = q.v[1:]
	return r
}

// Front for queue
func (q Queue) Front() Pair {
	return q.v[0]
}

// Empty return true if empty
func (q Queue) Empty() bool {
	return len(q.v) == 0
}


Measured memory_bytes: 4864
#define _GLIBCXX_DEBUG
#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 ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
  int A, B, C;
  cin >> A >> B >> C;
  vector<int> vec = {A, B, C};
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  int S = vec[2];
  int M = vec[0]*10 + vec[1];
  cout << S + M << endl;
  
  return 0;
  
}

Measured memory_bytes: 256
object Main extends App {
  val inputs: Seq[String] = scala.io.Source.stdin.getLines().toList
  val userStrMap = scala.collection.mutable.HashMap(('a', inputs(0)),('b', inputs(1)),('c', inputs(2)))

  println(solve(userStrMap))

  def solve(map: scala.collection.mutable.HashMap[Char, String]): Char = {
    var current = 'a'

    while(map(current).size != 0) {
      val next = map(current).head
      map.update(current, map(current).tail)
      current = next
    }

    current.toUpper
  }
}

Measured memory_bytes: 25532
n = int(input())
a = list(map(int, input().split()))

aa = [i for i in a if i%2 == 0]

flag = 0
for i in aa:
    if i%3 != 0 and i%5 != 0:
        print('DENIED')
        flag = 1
        break

if flag == 0:
    print('APPROVED')

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

template<class T>inline bool chmax(T &a, const T &b) { if (b > a) { a = b; return true; } return false; }
template<class T>inline bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

void solve() {
    int N, M, K;
    cin >> N >> M >> K;
    vector<ll> a(N+1), b(M+1);
    for (int i=1; i<N+1; ++i) cin >> a[i];
    for (int i=1; i<M+1; ++i) cin >> b[i];

    for (int i=1; i<N+1; ++i) a[i] += a[i-1];
    for (int i=1; i<M+1; ++i) b[i] += b[i-1];
    int res = 0;
    for (int i=0; i<N+1; ++i) {
        if (K < a[i]) break;
        int j = upper_bound(b.begin(), b.end(), K-a[i]) - b.begin();
        chmax(res, i+j-1);
    }
    cout << res << '\n';
}

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

    solve();

    return 0;
}


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


int main() {
    string s;
    cin >> s;
    for (int bit = 0; bit < (1 << 3); bit++){
        int tmp = s.at(0) - '0';
        string ans = "";
        ans += s.at(0);
        rep(i, 3){
        if (bit & (1 << i)){
            tmp += s.at(i + 1) - '0';
            ans += '+';
            ans += s.at(i + 1);
        }
        else{
            tmp -= s.at(i + 1) - '0';
            ans += '-';
            ans += s.at(i + 1);
        }
        }
        if (tmp == 7) {
            cout << ans << "=7" << endl;
            return 0;
    }
    }
}


Measured memory_bytes: 3584
w,h=map(int,input().split())
e=[]
for _ in range(w):
  c=int(input())
  e.append((c,0))
for _ in range(h):
  c=int(input())
  e.append((c,1))
e=sorted(e,key=lambda x:x[0])
a=w+1
b=h+1
ans=0
for val,flag in e:
  if flag==0:
    ans+=val*b
    a-=1
  else:
    ans+=val*a
    b-=1
print(ans)    

Measured memory_bytes: 28664
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std;

int main() {
  
  int a,b,c,d,x;
  long long la,lb,lc,lx;
  double da,db,dc;
  string s,ss,sss;
  
  int ans = 0;
  string anss = "";
  
  cin >> s;
  //int ab [] = {0 , 1 , 3 , 1 , 2 , 1 , 2 , 1 , 1 , 2 , 1 , 2 , 1};
  //int result3 = std::max({a, b, c});
//--------------------------------------------------------------------------------
anss = "Yes";
  rep(i,0,s.size()){
    if((i+1)%2 == 0 && s[i] == 'R' || (i+1)%2 == 1 && s[i] == 'L') {
      anss = "No";
      break;
    }
  }

  cout << anss << endl;

}

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

int main(){
    int a, b;
    cin >> a >> b;
    if (a>1 && b>1){
        if (a>b){
            cout << "Alice" << endl;
        }
        else if (b>a){
            cout << "Bob" << endl;
        }
        else cout << "Draw" << endl;
    }
    if (a == 1 || b == 1){
        if (b!=1){
            cout << "Alice" << endl;
        }
        else if (a!=1){
            cout << "Bob" << endl;
        }
        else cout << "Draw" << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __print(const pair<T, V> &x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T &x) {
    int f = 0;
    cerr << '{';
    for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}
#ifdef LOCAL
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif

#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    vector<int> d(N);
    rep(i, N) { cin >> d[i]; }
    sort(d.begin(), d.end());
    if (d[N / 2] == d[N / 2 - 1]) {
        cout << 0 << endl;
    } else {
        cout << d[N / 2] - d[N / 2 - 1] << endl;
    }
    debug(d, d[N / 2], d[N / 2 - 1]);

    return 0;
}


Measured memory_bytes: 640
#include <stdio.h>

int main(void) {
	int N;
	int *a;
	int i, check = -1, num = 2, x, ans = 0;
	int *c;

	scanf("%d", &N);
	a = (int*)malloc(sizeof(int)*N);
	c = (int*)malloc(sizeof(int)*N);
	for (i = 0; i < N; i++) {
		scanf("%d", &a[i]);
		if (a[i] == 2) check = 1;
		c[i] = 0;
	}
	if (check!=1) {
		printf("%d\n", check);
		return 0;
	}
	i = 0;
	while (c[i] == 0) {
		num = a[i];
		c[i] = 1;
		i = num - 1;
		ans++;
		if (num == 2) {
			printf("%d\n", ans);
			return 0;
		}
	}
	printf("-1\n");

	return 0;
}

Measured memory_bytes: 896
char *t[]={"',.!?","abcABC","defDEF","ghiGHI","jklJKL","mnoMNO","pqrsPQRS","tuvTUV","wxyzWXYZ"};
main(x,c,d){
  for(d=-1,x=-1;~(c=getchar());)
    if(c=='\n'){
      if(d)put();puts(""),d=-1,x=-1;
    }else if(c-=48){
      if(c==d)x++;
      else if(~x)put(),x=0;
      if(d==-1)x=0;
      d=c;
    }else{
      if(~d&&d)put(),x=-1;
      else putchar(' ');
      d=-1;
    }
  return 0;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
ll A[101010],B[101010];
ll tot;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N) cin>>A[i]>>B[i];
	for(i=N-1;i>=0;i--) {
		ll nex=(A[i]+tot+B[i]-1)/B[i]*B[i];
		ll add=nex-(A[i]+tot);
		tot+=add;
	}
	cout<<tot<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


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

int main(){
	int i = 1, j = 1;
	
	for(i = 1 ; i < 10 ; i++){
		for(j = 1 ; j < 10 ; j++){
			cout << i << "x" << j << "=" << i*j << endl;
		}
	}
	
    return 0;
}

Measured memory_bytes: 3036
#include<iostream>
#include<cmath>
#include<numeric>
#include<functional>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define ll long long
#define modbig (10*10*10*10*10*10*10*10*10+7)
using namespace std;

int main(){
  int n; double d;
  cin>>n>>d;
  cout<<ceil(n/(2*d+1));
}


Measured memory_bytes: 256
n,k = map(int, input().split())

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


import collections

c = collections.Counter(al)

l = len(c)
cc = sorted(c.items(), key=lambda x:x[1])

res = 0

if l <= k:
    pass

else:
    for i in range(l-k):
       res += cc[i][1] 

print(res)

Measured memory_bytes: 39348
#include <stdio.h>
#include <algorithm>
using namespace std;
long long a[100005],b[100005],c[100005];
int main()
{
	long long  n,i,j,l,k,sum;
	while(scanf("%lld",&n)!=EOF)
	{
		sum=0;
		for(i=0;i<n;i++)
		scanf("%d",&a[i]);
		for(i=0;i<n;i++)
		scanf("%d",&b[i]);
		for(i=0;i<n;i++)
		scanf("%d",&c[i]);
		sort(a,a+n);
		sort(b,b+n);
		sort(c,c+n);
		j=0;k=0;				
		for(i=0;i<n;i++)
		{
			while(a[j]<b[i]&&j<n){
				j++;
			}
			while(b[i]>=c[k]&&k<n){
				k++;
			}
			sum+=j*(n-k);
		}			
		printf("%lld\n",sum);
	}
}

Measured memory_bytes: 2560
import sys
import numpy as np
from numba import jit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, K, *A = map(int, read().split())
 
@jit
def imos(A):
  B = np.zeros_like(A)
  for i,x in enumerate(A):
    a = max(0,i-x)
    b = min(N-1,i+x)
    B[a] += 1
    if b+1 <= N-1:
      B[b+1] -= 1
  B = np.cumsum(B)
  return B
 
for i in range(K):
  if i >= 50:
    break
  A = imos(A)
print(*A)

Measured memory_bytes: 129368
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define INF 1000000000000
using namespace std;
using ll=long long;
using ld=long double;
using vs=vector<string>;


int main() {
    ll n;
    ll ans=0;
    cin>>n;
    vector<ll> a(n);
    rep(i,n){
        cin>>a[i];
        if((a[i]%2!=0)&&((i+1)%2!=0))ans++;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3588
hw = list(map(int, input().split()))
s = []
for i in range(hw[0]):
    s1 = input()
    s2 = []
    for j in range(len(s1)):
        s2.append(s1[j])
    s.append(s2)

flag = True
if s[0][0] == "#" and (s[1][0] == "." and s[0][1] == "."):
    flag = False
if s[0][hw[1] - 1] == "#" and (s[1][hw[1] - 1] == "." and s[0][hw[1] - 2] == "."):
    flag = False
if s[hw[0] - 1][0] == "#" and (s[hw[0] - 2][0] == "." and s[hw[0] - 1][1] == "."):
    flag = False
if s[hw[0] - 1][hw[1] - 1] == "#" and (s[hw[0] - 1][hw[1] - 2] == "." and s[hw[0] - 2][hw[1] - 1] == "."):
    flag = False
if hw[0] >= 2:
    for i in range(hw[0] - 2):
        if s[i + 1][0] == "#" and (s[i][0] == "." and s[i + 2][0] == "." and s[i + 1][1] == "."):
            flag = False
            break
        if s[i + 1][hw[1] - 1] == "#" and (s[i][hw[1] - 1] == "." and s[i + 2][hw[1] - 1] == "." and s[i + 1][hw[1] - 2] == "."):
            flag = False
            break
if hw[1] >= 2:
    for i in range(hw[1] - 2):
        if s[0][i + 1] == "#" and (s[0][i] == "." and s[0][i + 2] == "." and s[1][i + 1] == "."):
            flag = False
            break
        if s[hw[0] - 1][i + 1] == "#" and (s[hw[0] - 1][i] == "." and s[hw[0] - 1][i + 2] == "." and s[hw[0] - 2][i + 1] == "."):
            flag = False
            break
if hw[0] >= 2 and hw[1] >= 2:
    for i in range(hw[0] - 2):
        for j in range(hw[1] - 2):
            if s[i + 1][j + 1] == "#" and (s[i][j + 1] == "." and s[i + 2][j + 1] == "." and s[i + 1][j] == "." and s[i + 1][j + 2] == "."):
                flag = False
                break
if flag == False:
    print("No")
else:
    print("Yes")

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

public class MainClass
{

	public static void Main(string[] args)
	{
		int n = int.Parse(Console.ReadLine());
	
		string[] s = Console.ReadLine().Split(' ');
		List<int> ws = new List<int>(n);
		int nmax = -999999;
		for(int i = 0; i < n; i++)
		{
			int c = int.Parse(s[i]);
			ws.Add(c);
			nmax = Math.Max(c, nmax);
		}
		
		int min = nmax;
		for(int j = 0; j <=n;j++)
		{
			int g1=0;
			int g2=0;
			for(int i = 0; i < n; i++)
			{
				if(i<=j)
					g1+=ws[i];
				else
					g2+=ws[i];
			}
			min = Math.Min(min, Math.Abs(g1-g2));
		}
		Console.WriteLine(min);
	
		
	}

	public static int Clamp(int val, int max, int min = 0)
	{
		return Math.Min(max, Math.Max(min, val));
	}

	
}



Measured memory_bytes: 13140
#include <iostream>
#include <algorithm>

#define int long long

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
 
using namespace std;
 
int N, A[200005];
 
signed main() { 
    cin >> N;
    REP(i, N) {
        cin >> A[i];
        A[i] -= i + 1;
    }
    sort(A, A + N);
 
    int b = A[N / 2];
 
    int ans = 0;
    REP(i, N) { ans += abs(A[i] - b); }
    cout << ans << endl;
 
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<queue>
#include <climits>
#include <map>
#include <set>
const int mod = 1e9 + 7;
const int INF = 1 << 20;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main()
{
    int n; cin >> n;
    ll v[n][3];
    ll dp[n+1][3];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < 3; j++){
            cin >> v[i][j];
            dp[i+1][j] = 0;
        }
    }
    dp[1][0] = v[0][0];
    dp[1][1] = v[0][1];
    dp[1][2] = v[0][2];
    for(int i = 1; i < n; i++){
        for(int j = 0; j < 3; j++){
            for(int k = 0; k < 3; k++){
                if(j==k) continue; 
                dp[i+1][k] = max(dp[i+1][k], dp[i][j] + v[i][k]);
            }
        }
    }
    cout << max({dp[n][0],dp[n][1],dp[n][2]});
}

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

#define ll long long 
#define sz(x) (int)x.size()

using namespace std;

int main(){
	int n,cnt=0;
	cin>>n;
	vector<int> a(n);
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=1;i<n-1;i++){
		int x=a[i];
		vector<int> v={a[i-1],a[i],a[i+1]};
		sort(v.begin(), v.end());
		if(v[1]==x)cnt++;
	}
	cout<<cnt;
}

Measured memory_bytes: 3568
#include "bits/stdc++.h"
using namespace std;

int main() {
    // input
    int N, W; cin >> N >> W;
    int weight[110], value[110];
    int dp[110][10010];

    // input
    for (int i = 0; i < N; i++) cin >> value[i] >> weight[i];

    // dpテーブルを初期化
    for (int i = 0; i < W; i++) dp[0][i] = 0;

    for (int i = 0; i < N; i++) {
        for (int w = 0; w <= W; w++) {
            if (w >= weight[i]) {
                // i番目の荷物を選んだ時の i+1番目の荷物の価値(w = 0 ~ Wについて、wを超えない場合のみi+1番目の価値を追加)
                dp[i+1][w] = max(dp[i][w - weight[i]] + value[i], dp[i][w]);
                // cout << "(" << i+1 << ", " << w << ")"<< dp[i+1][w] << endl;
            }
            else {
                // i 番目の荷物を選ばなかった時
                dp[i+1][w] = dp[i][w];
            }
        }
    }

    cout << dp[N][W] << endl;

    return 0;
}


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

int64_t lcm(int64_t a, int64_t b)
{
    return a / __gcd(a, b) * b;
}

int main()
{
    int N;
    cin >> N;
    int64_t ans = 1;
    for (int i = 0; i < N; i++)
    {
        int64_t tmp;
        cin >> tmp;
        ans = lcm(ans, tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1e9+7;
const int N=2e5+9;
int main()
{
    FASTINOUT;
    ll x,sum=0;
    cin>>x;
    for (ll i=1;i<=x;i++){
        if (i%3==0||i%5==0){
            continue;
        }
        else
            sum+=i;
    }
    cout<<sum;
    return 0;
}


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

int main() {
    ios::sync_with_stdio(false);
    int n; cin >> n;
    int a[n];
    for (int i = 0; i < n; i++)
        cin >> a[i];
    int ans = 0;
    for (int i = 1; i < n; i++) {
        bool flag = true;
        for (int j = i; j >= 0; j--) {
            if (a[i] < a[j]) {
                flag = false;
                break;
            }
        }
        if (flag)
            ans++;
    }
    cout << ans+1 << endl;


    return 0;
}

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

typedef long long ll;
int a[9];
int main() {
  int N; cin >> N;

  for ( int i = 0; i < N; i++ ) {
    int tmp; cin >> tmp;
    if ( 1 <= tmp && tmp <= 399 ) a[0]++;
    else if ( 400 <= tmp && tmp <= 799 ) a[1]++;
    else if ( 800 <= tmp && tmp <= 1199 ) a[2]++;
    else if ( 1200 <= tmp && tmp <= 1599 ) a[3]++;
    else if ( 1600 <= tmp && tmp <= 1999 ) a[4]++;
    else if ( 2000 <= tmp && tmp <= 2399 ) a[5]++;
    else if ( 2400 <= tmp && tmp <= 2799 ) a[6]++;
    else if ( 2800 <= tmp && tmp <= 3199 ) a[7]++;
    else  a[8]++;
  }

  int cnt = 0;
  for ( int i = 0; i < 8; i++ ) {
    if ( a[i] > 0 ) cnt++;
  }

  int maxans,minans;
  if ( cnt == 0 ) {
    minans = 1;
    maxans = a[8];
  }else {
    minans = cnt;
    maxans = cnt+a[8];    
  }

  cout << minans << " " << maxans << endl;
  return 0;
}


Measured memory_bytes: 256
import sys

def swap(a, i, j):
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp

def list_to_string(a):
    s = ""
    for n in a:
        s += str(n) + " "
    return s.strip()

num = int(sys.stdin.readline().strip())

array = map(lambda x: int(x), sys.stdin.readline().strip().split(" "))

swap_num = 0

for start_index in range(0, len(array)):
    min_index = start_index
    for index in range(start_index, len(array)):
        if array[min_index] > array[index]:
            min_index = index
    if min_index != start_index:
        swap(array, min_index, start_index)
        swap_num += 1
        

print list_to_string(array)
print str(swap_num)

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

int main() {
    int h,k;
    cin >> h >> k;
    int ans = 0;
    while (h > 0){
        h-=k;
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  char c[2][3], d[2][3];
  for(int i = 0; i < 2; i++){
    scanf("%s", c[i]);
    for(int j = 0; j < 3; j++){
      d[(1 + i) % 2][j] = c[i][2 - j]; 
    }
  }
  int flag = 0;
  for(int i = 0; i < 2; i++){
    for(int j = 0; j < 3; j++){
      if(c[i][j] != d[i][j]) flag = 1;
    }
  }
  if(flag == 0) printf("YES\n");
  else printf("NO\n");
}
  

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

#define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define I insert
#define endl '\n'
#define all(x) x.begin(), x.end()

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


using vvll = vector< vector<ll> >;
using vll = vector<ll> ;

const ll maxs = 1e6+5;
const ll lmaxs = 20;
ll mod = 1e9+7;
ll oo = 1e15;

ll fast(ll x,ll y){
    ll res=1;
    while(y){
        if(y&1)
            res = (res*x)%mod;
        x = (x*x)%mod;
        y >>= 1;
    }
    return res;
}

ll inv(ll n){
    return fast(n,mod-2);
}

void pre(){


}

ll f[maxs];

void solve(){

    ll n;
    cin >> n;
    ll a[n+1];
    set<ll> S;
    for(ll i=1;i<n+1;i++){
        cin >> a[i];
        S.I(a[i]);
        f[a[i]]++;
    }

    sort(a+1,a+n+1);
    vll tmp;
    vll b;
    for(auto it : S){
        tmp.pb(it);
    }
    for(auto it : tmp){
        for(ll j=2*it;j<=a[n];j+=it){
            if(f[j]){
                b.pb(j);
            }
        }
    }

    map<ll,ll> MAP;
    for(auto it : b){
        //cout << it << " ";
        MAP[it]++;
    }
    ll ans=0;
    for(ll i=1;i<=n;i++){
        if(f[a[i]] == 1 and MAP.count(a[i]) == 0){
            ans++;
        }
    }

    cout << ans  << endl;


}

int main(){
    // #ifndef ONLINE_JUDGE
    // freopen("input00.txt","r",stdin);
    // #endif
    IOS;
    pre();
    ll T = 1;
    //cin>>T;
    while(T--){
        solve();   
    }
    return 0;
}

Measured memory_bytes: 50232
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const ll MOD = (ll) 998244353;
const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const double PI = acos(-1.0);

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

void finish() {
    cout << -1 << endl;
    exit(0);
}

//------------------------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20) << setiosflags(ios::fixed);

    int n;
    string s;
    cin >> n >> s;
    Yes(n % 2 == 0 && s.substr(0, n / 2) == s.substr(n / 2, n / 2));


    return 0;
}


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

int main() {
  char c;
  cin >> c;

  if (false) {}
  else if (c == 'a') {
    cout << "vowel" << endl;
  }
  else if (c == 'e') {
    cout << "vowel" << endl;
  }
  else if (c == 'i') {
    cout << "vowel" << endl;
  }
  else if (c == 'o') {
    cout << "vowel" << endl;
  }
  else if (c == 'u') {
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl;
  }
}


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

#define rep(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back
#define fi first
#define se second
template<class T1, class T2> bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

using ll = long long; using vll = vector<ll>; using vvll = vector<vll>; using P = pair<ll, ll>;
using ld = long double;  using vld = vector<ld>; 
using vi = vector<int>; using vvi = vector<vi>; vll conv(vi& v) { vll r(v.size()); rep(i, v.size()) r[i] = v[i]; return r; }

ll n; string s;
int main(void) {
    cin >> n; cin >> s;
    vll a;
    ll i = 0;
    while (i < n) { 
        if (s[i] == '0') {
            if (i < n-1 && s[i+1] == '0') 
                a.pb(0);
            while (s[i] == '0' && i < n) i++;
        } else {
            a.pb(0);
            while (s[i] == '1' && i < n) a.back()++, i++;
        }
    }

    n = a.size();
    // 配るDP
    vector<map<ll, ll>> dp(n+1);
    dp[0][0] = 0;
    rep(i, n) {
        for (auto x : dp[i]) {
            ll p = x.fi, score = x.se;
            if (p > 0 && a[i] > 0) {
                chmax(dp[i+1][a[i]-1], score + p);
                chmax(dp[i+1][0], score + a[i]);
                if (a[i] > 1) chmax(dp[i+1][1], score + a[i] - 1);
            }
            chmax(dp[i+1][a[i]], score);
        }
    }
    ll ret = 0;
    for (auto x : dp[n]) chmax(ret, x.se);
    cout << ret << endl;

    return 0;
}


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

using namespace std;

int h, w;
vector<string> grid;

int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};

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

	cin >> h >> w;

	grid = vector<string>(h);
	for(int i = 0; i < h; i++) {
		cin >> grid[i];
	}

	queue<pair<int, pair<int, int>>> bfs;

	for(int i = 0; i < h; i++) {
		for(int j = 0; j < w; j++) {
			if(grid[i][j] == '#') {
				for(int k = 0; k < 4; k++) {
					bfs.push(make_pair(1, make_pair(i+dirs[k][0], j+dirs[k][1])));
				}
			}
		}
	}

	int max_depth = 0;
	while(bfs.size() > 0) {
		int depth = bfs.front().first;
		auto loc = bfs.front().second;
		bfs.pop();

		if(loc.first < 0 || loc.first >= h) continue;
		if(loc.second < 0 || loc.second >= w) continue;
		if(grid[loc.first][loc.second] == '#') continue;

		grid[loc.first][loc.second] = '#';

		max_depth = max(max_depth, depth);

		for(int i = 0; i < 4; i++) {
			auto nloc = make_pair(loc.first + dirs[i][0], loc.second + dirs[i][1]);
			bfs.push(make_pair(depth+1, nloc));
		}
	}

	cout << max_depth << endl;

	return 0;
}


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

int main() {
  int A,B;
  cin >> A >> B;
  if(A%3==0 || (A+B)%3==0 || B%3==0){
    cout << "Possible" << endl;
  }
  else{
    cout << "Impossible" << endl;
  }
}


Measured memory_bytes: 256
def solve():
  ans = 0
  H, W = map(int, input().split())
  S = [0]*(H+2)
  S[0] = '*'*(W+2)
  S[H+1] = '*'*(W+2)
  for h in range(1,H+1):
    S[h] = '*' + input() + '*'
  L = [[0]*(W+2) for _ in range(H+2)]
  R = [[0]*(W+2) for _ in range(H+2)]
  U = [[0]*(W+2) for _ in range(H+2)]
  D = [[0]*(W+2) for _ in range(H+2)]
  for h in range(1,H+2):
    for w in range(1,W+2):
      if S[h][w]=='.':
        if S[h][w-1]=='.':
          L[h][w] = L[h][w-1]+1
        if S[h-1][w]=='.':
          U[h][w] = U[h-1][w]+1
  for h in range(H+1,0,-1):
    for w in range(W+1,0,-1):
      if S[h][w]=='.':
        if S[h][w+1]=='.':
          R[h][w] = R[h][w+1]+1
        if S[h+1][w]=='.':
          D[h][w] = D[h+1][w]+1
  total = [[0]*(W+2) for _ in range(H+2)]
  for h in range(1,H+2):
    for w in range(1,W+2):
      if S[h][w]=='.':
        total[h][w] = L[h][w]+R[h][w]+U[h][w]+D[h][w]+1
        ans = max(ans,total[h][w])
  return ans
print(solve())

Measured memory_bytes: 237032
#coding:utf-8

a = input()

if a == "RRR":
    print("3")

elif a == "RRS" :
    print("2")

elif a == "SRR" :
    print("2")

elif a == "SRS" :
    print("1")

elif a == "RSS" :
    print("1")

elif a == "SSR" :
    print("1")

elif a == "RSR" :
    print("1")

elif a == "SSS" :
    print("0")

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

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

#define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

int main() {
    int L,n;
    cin >> L >> n;
    vector<ll> l(n);
    for (int i = 0;i < n;++i) cin >> l[i];
    vector<ll> sumsl(n+1,0),sumsr(n+1,0);
    for (int i = 0;i < n;++i) {
        sumsr[i+1] = sumsr[i]+l[i];
        sumsl[i+1] = sumsl[i]+L-l[n-1-i];
    }
    ll ans = 0;
    for (int i = 0;i < n;++i) {
        int j = (n-i-1)/2,k = (n-i)/2;
        ll ret = (sumsr[i+j]+sumsl[k])*2;
        if (i) ret -= sumsr[i-1]*2;
        if (j == k) ret += max(l[i+j]-l[i+j-1],L-l[i+j]+l[i+j-1])-l[i+j-1];
        else ret += max(l[n-k]-l[n-k-1],L-l[n-k]+l[n-k-1])-L+l[n-k];
        ans = max(ans,ret);
    }
    for (int i = 0;i < n;++i) {
        int j = (n-i-1)/2,k = (n-i)/2;
        ll ret = (sumsl[i+j]+sumsr[k])*2;
        if (i) ret -= sumsl[i-1]*2;
        if (j == k) ret += max(l[n-i-j]-l[n-i-j-1],L-l[n-i-j]+l[n-i-j-1])-L+l[n-i-j];
        else ret += max(l[k]-l[k-1],L-l[k]+l[k-1])-l[k-1];
        ans = max(ans,ret);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4992
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		int m = Integer.parseInt(sa[1]);
		int v = Integer.parseInt(sa[2]);
		int p = Integer.parseInt(sa[3]);
		sa = br.readLine().split(" ");
		Obj[] arr = new Obj[n];
		for (int i = 0; i < n; i++) {
			Obj o = new Obj();
			o.i = i;
			o.a = Integer.parseInt(sa[i]);
			arr[i] = o;
		}
		br.close();

		Arrays.parallelSort(arr, (o1, o2) -> o2.a - o1.a);
		long[] sum = new long[n + 1];
		for (int i = 0; i < n; i++) {
			sum[i + 1] = sum[i] + arr[i].a;
		}
		int min = arr[p - 1].a;
		int over = 0;
		for (int i = 0; i < n; i++) {
			Obj o = arr[i];
			if (o.a > min) {
				over++;
			}
		}

		int ans = 0;
		for (int i = 0; i < n; i++) {
			Obj o = arr[i];
			if (o.a >= min) {
				ans++;
				continue;
			}
			if (o.a + m < min) {
				continue;
			}
			long num1 = n - over - (n - i);
			long num2 = v - over - (n - i);
			long s = num1 * (o.a + m);
			s -= sum[i] - sum[over];
			if (num2 * m <= s) {
				ans++;
			}
		}
		System.out.println(ans);
	}

	static class Obj {
		int i, a;
	}
}


Measured memory_bytes: 50196
//暑い日々
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<utility>
#include<map>
#include<queue>
#include<stack>
#include<cmath>
using namespace std;
#define MP make_pair
#define PB push_back
#define F_d first
#define S_d second
#define LARGE 100000000
#define MOD 100000
#define LL long long

int D, N, T[209], csum[209][3] = {};
vector<int>suit[209];
int main() {
	cin >> D >> N;
	for (int i = 0; i < D; i++)cin >> T[i];
	for (int i = 0; i < N; i++) {
		int a, b, c;  cin >> a >> b >> c;
		for (int j = 0; j < D; j++) {
			if (T[j] >= a && T[j] <= b) {
				suit[j].PB(c);
				//cout << i << " " << j << " " << T[j] << " " << c << endl;
			}
		}
	}

	int MAX[209], MIN[209];
	for (int i = 0; i < D; i++) {
		sort(suit[i].begin(), suit[i].end());
		MAX[i] = suit[i].back();
		MIN[i] = suit[i].front();
		//cout << "MIN = " << MIN[i] << ";  MAX = " << MAX[i] << endl;
	}
	for (int i = 1; i < D; i++) {
		int t1, t2, t3, t4;//NN,NX,XN,XX
		t1 = csum[i - 1][0] + abs(MIN[i - 1] - MIN[i]);
		t2 = csum[i - 1][1] + abs(MAX[i - 1] - MIN[i]);
		t3 = csum[i - 1][0] + abs(MIN[i - 1] - MAX[i]);
		t4 = csum[i - 1][1] + abs(MAX[i - 1] - MAX[i]);
		csum[i][0] = max(t1, t2); csum[i][1] = max(t3, t4);
	}
	cout << max(csum[D - 1][0], csum[D - 1][1]) << endl;

	return 0;
}




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

int main() {
  int A, B, X;
  cin >> A >> B >> X;

  if (A <= X && X <= A + B)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}

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

#define REP(i, start, count) for(int i=(start); i<(int)(count); ++i)
#define rep(i, count) REP(i, 0, count)
#define ALLOF(c) (c).begin(), (c).end()

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> veci;
typedef vector<long long> vecll;
typedef vector<unsigned long long> vecull;

string S;

int main(void) {
    cin >> S;
    int len = S.length();
    int i = 0;

    char mode = S[0];
    ll ans = 0;
    int t = 0;
    while(i < len) {
        char next = mode == '>' ? '<' : '>';
        int p = S.find(next, i);

        if (p == string::npos) {
            p = len;
        }

        if (mode == '>') {
            for (int k = p - i; k > 0; --k) {
                if (k == p - i) {
                    ans += max(t + 1, p - i);
                    continue;
                }
                ans += k;
            }
        }
        else {
            for (int k = 0; k < p - i; ++k)
            {
                ans += k;
                t = k;
            }

            if (p == len) ans += t + 1;
        }

        mode = next;
        i = p;
    }

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

Measured memory_bytes: 900
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  int check = 0;
  int now;
  int other_length_all = 0;
  vector<int> length(N);
  for(int i = 0; i < N; i++){
    cin >> length.at(i);
  }
  for(int j = 0; j < N; j++){
    now = length.at(j);
    other_length_all = other_length_all + now;
    check = max(check, now);
  }
  other_length_all = other_length_all - check;
  if(other_length_all > check){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

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

int main(){
 
  vector<int> vec(3);
  cin >> vec.at(0) >> vec.at(1) >> vec.at(2);
  
  sort(vec.begin(), vec.end());
  
  cout << (vec.at(2)-vec.at(1)) + (vec.at(1)-vec.at(0)) << endl;
  
}


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

int main () {
	
	int n=0, a=0, i=0, x=0;

	cin >> n;

	for (i=1; i<=n; i++) {
		cin >> a;
		if (a != i) x++;
	}

	if (x<=2) cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include <cmath>
#include <limits>
#include <utility>
#include <map>
#include <iomanip>
#include <queue>
#include <cctype>
#include <stack>
#include <random>
#include <list>
#include <numeric>
#include <chrono>
#include <set>


#define rep(i,p,q) for(ll i = p;i < q;i++)
#define ll long long

using namespace std;

vector<vector<ll>> graph;
vector<ll> query;
vector<ll> ans;
vector<ll> visited;


const long long MAX_N = 1 << 17;

long long dat[2 * MAX_N - 1];

ll ecd(ll a, ll b) {
	if (a < b) swap(a, b);
	if (b == 0) return a;
	else {
		return ecd(b, a % b);
	}
}

ll pow(ll a, ll b) {
	vector<ll> d = vector<ll>((ll)(log(b)) + 2);
	d[0] = a;
	rep(i, 1, d.size()) d[i] = d[i - 1] * d[i - 1];
	ll ret = 1;
	rep(i, 0, log(b) + 1) {
		if (b & 1 << i) ret *= d[i];
	}
	return ret;
}

/*
//144 E
int main(void) {
	ll n,k;
	cin >> n >> k;
	vector<ll> a = vector<ll>(n), b = vector<ll>(n);
	priority_queue<tuple<ll,ll,ll>> q = priority_queue<tuple<ll,ll,ll>>();
	rep(i, 0, n) cin >> a[i];
	rep(i, 0, n) cin >> b[i];
	sort(a.rbegin(), a.rend());
	sort(b.begin(), b.end());

	rep(i, 0, n) q.push(make_tuple(a[i] * b[i], a[i], b[i]));
	while(k > 0) {
		auto x = q.top();
		if (get<1>(x) == 0)break;
		else {
			q.pop();
			auto yValue = get<0>(q.top());
			ll dec;
			if (yValue % get<2>(x) == 0 && get<2>(x) < get<2>(q.top())) {
				dec = dec = yValue / get<2>(x);
			}
			else {
				dec = yValue / get<2>(x) + 1;
			}
			dec = min(k, dec);
			dec = min(get<1>(x), dec);
			ll newA = get<1>(x) - dec;
			k -= dec;
			q.push(make_tuple(newA * get<2>(x), newA, get<2>(x)));
		}
	}
	cout << get<0>(q.top()) << endl;
}
*/

//144 D
int main(void) {
	long double a, b, x;
	cin >> a >> b >> x;
	if(a * a * b / 2.0 > x)cout << fixed << setprecision(10) << atan(a * b * b / (2 * x)) * 180 / (3.141592653589793) << endl;
	else cout << fixed << setprecision(10) << atan((2 * b / a - 2 * x / a / a / a)) * 180 / (3.141592653589793) << endl;
}



Measured memory_bytes: 256
import numpy as np

N, K, Q = map(int, input().split())
person = np.asarray([K] * N)

ok_person = [int(input()) for i in range(Q)]
false_num = len(ok_person)
person -= false_num
#print(person)
for i in ok_person:
    person[i-1] += 1
#    print(person)

#print(person)

for i in range(N):
    if person[i] > 0:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 17612
using System;
using System.Collections.Generic;
using System.Linq;

namespace AOJ0005
{
    class Program
    {
        static void Main()
        {
            string line;
            while ((line = Console.ReadLine()) != null)
            {
                var values = line.Split(' ').Select(long.Parse).ToArray();
                long gcd;
                long lcm;
                CalculateGcdAndLcm(values[0], values[1], out gcd, out lcm);

                Console.WriteLine("{0} {1}", gcd, lcm);
            }
        }

        public static void CalculateGcdAndLcm(long a, long b, out long gcd, out long lcm)
        {
            var aFactors = Factorize(a);
            var bFactors = Factorize(b);

            gcd = (from aFactor in aFactors
                   where bFactors.ContainsKey(aFactor.Key)
                   select (long) Math.Pow(aFactor.Key, Math.Min(aFactor.Value, bFactors[aFactor.Key])))
                .Aggregate(1L, (v, g) => g*v);

            lcm = a*b/gcd;
        }

        private static Dictionary<long, long> Factorize(long n)
        {
            var map = new Dictionary<long, long>();

            for (long i = 2; i <= n; i++)
            {
                if (n%i != 0) continue;

                if (map.ContainsKey(i))
                {
                    map[i]++;
                }
                else
                {
                    map[i] = 1;
                }

                n /= i;
                i--;
            }

            return map;
        }
    }
}

Measured memory_bytes: 6540
import java.util.Scanner;
 
class Main {
    	public static void main(String[] args) {
        	Scanner sc = new Scanner(System.in);
 
        	int[] list = new int[26];
        	while (sc.hasNext()) {
            		String a = sc.nextLine();
            		for (int i = 0; i < a.length(); i++) {
                		int c = a.toLowerCase().codePointAt(i) - 97;
                		if (c >= 0){
                    			list[c]++;
				}
            		}
        	}
        	for (int i = 0; i < list.length; i++) {
            		System.out.println(String.format("%s : %d", (char) (i + 97),list[i]));
        	}
	}
}

Measured memory_bytes: 23936
#include <bits/stdc++.h>
#define ios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef unsigned long long ull;
using namespace std;


int main()
{
    ios;
    int t; cin >> t;
    string a = "ACL";
    for(int i = 1; i <= t; ++i)
        cout << a;
    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int n,m,x,c[15],a[15][15],algo[15],ans=INF,cost;
bool ok(){
  for(int i=0;i<m;i++)
    if(algo[i]<x)
      return false;
  return true;
}
void dfs(int i){
  if(i==n){
    if(ok())
      ans=min(ans,cost);
    return;
  }
  cost+=c[i];
  for (int j=0;j<m;j++)
    algo[j]+=a[i][j];
  dfs(i+1);
  cost-=c[i];
  for(int j=0;j<m;j++)
    algo[j]-=a[i][j];
  dfs(i+1);
}
int main(){
  cin>>n>>m>>x;
  for(int i=0;i<n;i++){
    cin>>c[i];
    for (int j=0;j<m;j++)
      cin >> a[i][j];
  }
  dfs(0);
  cout<<(ans==INF ? -1 : ans);
  return 0;
}

Measured memory_bytes: 3580
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>

using namespace std;
	
int main(){
	int n;
	cin >> n;
	vector<long long> a(n);
	
	int cnt_4=0,cnt_KI=0,cnt_GU=0;
	
	for(int i=0;i<n;i++){
		cin >> a[i];
		if(a[i]%4==0){
			cnt_4++;
			continue;
		}
		if(a[i]%2!=0){
			cnt_KI++;
			continue;
		}
		if(a[i]%2==0){
			cnt_GU++;
		}
	}
	
	if(cnt_GU == 0){
		if(cnt_KI-cnt_4<=1){
			cout << "Yes" <<endl;
		}else{
			cout << "No" << endl;
		}
	}else if(cnt_GU != 0){
		if(cnt_KI-cnt_4<=0){
			cout << "Yes" <<endl;
		}else{
			cout << "No" << endl;
		}
	}
	
	return 0;
}


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

namespace TYC
{
	typedef long long ll;
	typedef pair<int, int> pii;
	const int N = 1e5 + 5;

	int n, A[N], B[N], P[N];
	map<int, int> idA, idB;

	inline int read()
	{
		int x = 0, f = 0, ch = getchar();
		while (!isdigit(ch))
			f |= (ch == '-'), ch = getchar();
		while (isdigit(ch))
			x = x * 10 + ch - '0', ch = getchar();
		return f ? -x : x;
	}

	inline void End(const int t)
	{
		puts(t ? "Yes" : "No");
		exit(0);
	}

	void work()
	{
		n = read();
		for (int i = 1; i <= n; i++)
			A[i] = read(), idA[A[i]] = i;
		for (int i = 1; i <= n; i++)
			B[i] = read(), idB[B[i]] = i;
		sort(A + 1, A + 1 + n);
		sort(B + 1, B + 1 + n);
		for (int i = 1; i <= n; i++)
			if (A[i] > B[i])
				End(0);
		for (int i = 1; i < n; i++)
			if (A[i] == A[i + 1] || B[i] == B[i + 1])
				End(1);
		for (int i = 1; i <= n; i++)
			if (i < n && A[i + 1] <= B[i])
				End(1);
			else
				P[idA[A[i]]] = idB[B[i]];
		int c = 1, u = P[1];
		while (u != 1)
			c++, u = P[u];
		End(c != n);
	}
}

int main()
{
	TYC::work();
	return 0;
}

Measured memory_bytes: 10752
#include <stdio.h>
 
int main(void) {
    char mozi[1000001];
    int mozisuu;
    int kazu;
    int currentkazu;
    int kosuu;
    int i;
    while(1) {
        scanf("%d",&kazu);
        if(kazu==0)break;
        scanf("%d",&mozisuu);
        scanf("%s",mozi);
        currentkazu=0;
        kosuu=0;
        for(i=2;i<mozisuu;i++) {
            if(mozi[i]=='I') {
                if(mozi[i-1]=='O' && mozi[i-2]=='I')currentkazu++;
                else currentkazu=0;
                if(currentkazu>=kazu)kosuu++;
            }
        }
        printf("%d\n",kosuu);
    }
    return 0;
}

Measured memory_bytes: 2008