akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll LCM(ll a, ll b) { return a / GCD(a, b)* b; }
 
const int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
 
inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}
 
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  int n; cin>>n;
  vi p(n);
  rep(i,n){
    cin>>p[i];
    p[i]--;
  }
  int ans=0;
  rep(i,n-1){
    if(p[i]==i){
      swap(p[i],p[i+1]);
      ans++;
    }
  }
  if(p[n-1]==n-1) ans++;
  cout<<ans<<endl;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main(void){
  int k, s;
  int x, y, z;
  int i, j, l;
  int sum = 0;
  cin >> k >> s;
  for(i = 0; i <= k; i++){
    for(j = 0; j <= k; j++){
      if(s - i - j <= k && s - i - j >= 0){
        sum++;
      }
    }
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
n = int(raw_input())
A = map(int, raw_input().strip().split(' '))
q = int(raw_input())
M = map(int, raw_input().strip().split(' '))

def ans(i, m):
    if m == 0:
        return 1
    if i  >= n or m > sum(A):
        return 0
    res = ans(i + 1, m) or ans(i + 1, m - A[i])
    return res
           
for j in range(0, q):
    if ans(0, M[j]):
        print "yes"
    else:
        print"no"

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

using namespace std;

typedef short sho;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double db;
typedef string str; 
 
typedef pair<int,int> pii;
typedef pair<ll,ll> pll; 
typedef pair<ld,ld> pld;
 
typedef vector<int> vi; 
typedef vector<ll> vl; 
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<pld> vpd;

#define LOCAL
#define MP make_pair 
#define FF first
#define SS second
#define sz(x) (int)x.size()
#define begin(x) (x).begin() 
#define end(x) (x).end()
#define rbegin(x) (x).rbegin()
#define rend(x) (x).rend()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define PF push_front 
#define PB push_back
#define PP push
#define lb lower_bound 
#define ub upper_bound
#define lowbit(x) x&(-x)
#define testbit(x,i) x&(1<<i)

inline void checkmin(int &x,int y){x=min(x,y);}
inline void checkmax(int &x,int y){x=max(x,y);}

const int maxn=1e4+10;

int n,m;
int a[maxn];

int main() 
{
	#ifndef LOCAL
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /* start code */
    cin>>n>>m;
    int sum=0;
    for(int i=0;i<m;i++)
    {
    	cin>>a[i];
    	sum+=a[i];
	}
	cout<<(n<sum?-1:n-sum)<<endl;
    /* end code */
	return 0;
}

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

int main(void){
    int n,a,ans=1,tmp=1;
    scanf("%d",&n);
    for (int i=0; i<n; i++){
        ans*=3;
        scanf("%d",&a);
        if(a%2==0){
            tmp*=2;
        }
    }
    printf("%d\n",ans-tmp);
	return 0 ;
}

Measured memory_bytes: 128
#include <queue>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<vector<pair<int, int> > > G(N);
	for (int i = 0; i < N - 1; ++i) {
		int a, b;
		cin >> a >> b; --a, --b;
		G[a].push_back(make_pair(b, i));
		G[b].push_back(make_pair(a, i));
	}
	queue<pair<int, int> > que;
	que.push(make_pair(0, 0));
	vector<bool> vis(N);
	vis[0] = true;
	vector<int> ans(N - 1);
	while (!que.empty()) {
		pair<int, int> u = que.front();
		que.pop();
		int cur = 1;
		for (pair<int, int> i : G[u.first]) {
			if (ans[i.second] != 0) continue;
			while (cur == u.second) ++cur;
			ans[i.second] = cur;
			que.push(make_pair(i.first, cur));
			++cur;
		}
	}
	cout << *max_element(ans.begin(), ans.end()) << endl;
	for (int i = 0; i < N - 1; ++i) {
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 7040
import sys
import math
from collections import deque
import heapq
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

K = I()
a,b = IL()

for i in range(a,b+1):
  if i%K == 0:
    print("OK")
    exit()
print("NG")

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

public class Main {

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

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        while(true){

            double total = 0;
            double average = 0;
            double a = 0;

            int n = Integer.parseInt(br.readLine());

//          ???????????¶
            if(n == 0){
                break;
            }
            String[] score = br.readLine().split(" ");

//          ?????????????¨????total?????????
            for(int i = 0; i < n; i++){
                total += Double.parseDouble(score[i]);
            }
//          ??????????????????average?????????
            average = total / n;

//          ?¨??????????a?????????
            for(int i = 0; i < n; i++){
               a += Math.pow(Double.parseDouble(score[i]) - average, 2);
            }
            a = Math.sqrt(Math.abs(a / n));

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

Measured memory_bytes: 26464
N = int(input())
S = [0]*5
for _ in range(N):
    s = input()
    if s[0] == 'M':
        S[0] += 1
    elif s[0] == 'A':
        S[1] += 1
    elif s[0] == 'R':
        S[2] += 1
    elif s[0] == 'C':
        S[3] += 1
    elif s[0] == 'H':
        S[4] += 1

if sum(S) == 0:
    print(0)
    exit(0)

I = [0, 0, 0, 0, 0, 0, 1, 1, 1, 2]
J = [1, 2, 3, 1, 1, 2, 2, 3, 2, 3]
K = [2, 3, 4, 3, 4, 4, 3, 4, 4, 4]
ans = 0
for i in range(10):
    ans += S[I[i]]*S[J[i]]*S[K[i]]
print(ans)


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

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

  sort(d.begin(), d.end());

  int mid;
  if (N % 2 == 0) {
    cout << d[N/2] - d[N/2 - 1];
  } else {
    cout << d[(N-1)/2 + 1] - d[(N-1)/2 - 1] - 1;
  }
  cout << endl;
}


Measured memory_bytes: 640
package main
import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
)

func Factorial(N int) (F, Finv, Inv []int) {
  F = make([]int, N + 1)
  Finv = make([]int, N + 1)
  Inv = make([]int, N + 1)
  F[0] = 1
  F[1] = 1
  Finv[0] = 1
  Finv[1] = 1
  Inv[0] = 1
  Inv[1] = 1
  for i := 2; i < N + 1; i++ {
    F[i] = F[i - 1] * i % p
    Inv[i] = p - Inv[p % i] * (p / i) % p
    Finv[i] = Finv[i - 1] * Inv[i] % p
  }
  return
}

func Comb(F, Finv *[]int, A ...int) int {
  S := SumInt(A...)
  C := (*F)[S]
  for _, a := range A {
    C *= (*Finv)[a]
    C %= p
  }
  return C
}

const p = 998244353

func Solve() {
  var A, B, C, D int
  NextInt(&A, &B, &C, &D)
  DP := make([][][]int, C + 1)
  for i := range DP {
    DP[i] = make([][]int, D + 1)
    for j := range DP[i] {
      DP[i][j] = make([]int, 2)
    }
  }
  DP[A][B][1]++
  for i := A; i <= C; i++ {
    for j := B; j <= D; j++ {
      if i == A && j == B { continue }
      DP[i][j][0] = SumInt(DP[i - 1][j]...) * j % p
      DP[i][j][1] = (DP[i][j - 1][0] + DP[i][j - 1][1] * i) % p
    }
  }
  Write(SumInt(DP[C][D]...) % p)
}

func main() {
  Solve()
  Output()
}

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt(A ...*int) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.Atoi(L[i])
  }
}
func NextIntVec(A *[]int) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]int, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.Atoi(l)
  }
}
func NextFloat(A ...*float64) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.ParseFloat(L[i], 64)
  }
}
func NextFloatVec(A *[]float64) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]float64, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.ParseFloat(l, 64)
  }
}
func Write(S ...interface{}) {
  fmt.Fprintln(writer, S...)
}
func WriteIntVec(A []int) {
  B := make([]interface{}, len(A))
  for i, a := range A { B[i] = a }
  Write(B...)
}
func Output() {
  _ = writer.Flush()
}
func MaxInt(A ...int) int {
  max := A[0]
  for _, a := range A {
    if max < a { max = a }
  }
  return max
}
func MinInt(A ...int) int {
  min := A[0]
  for _, a := range A {
    if a < min { min = a }
  }
  return min
}
func SumInt(A ...int) int {
  sum := 0
  for _, a := range A {
    sum += a
  }
  return sum
}
func AbsInt(x int) int {
  if x < 0 { x = -x }
  return x
}

Measured memory_bytes: 375580
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<string>
#include<string.h>
#include<functional>
using namespace std;

#define INF 1<<21
#define DIV 1000000007

typedef pair<int, int>P;


int w, h;
int cnt;
char f[51][51];
int dx[] = { 1,-1,0,0 }, dy[] = { 0,0,1,-1 };

void rec(int x, int y, char c) {
  for (int i = 0; i < 4; i++) {
	int nx = x + dx[i];
	int ny = y + dy[i];
	if (nx <= 0 || w < nx || ny <= 0 || h < ny )continue;

	if (c == 'B') {
	  if (f[ny][nx] == 'w') {
		f[ny][nx] = 'u';
		rec(nx, ny, c);
	  }
	  else if (f[ny][nx] == '.') {
		f[ny][nx] = 'b';
		rec(nx, ny, c);
	  }
	}
	else if (c == 'W') {
	  if (f[ny][nx] == 'b') {
		f[ny][nx] = 'u';
		rec(nx, ny, c);
	  }
	  else if (f[ny][nx] == '.') {
		f[ny][nx] = 'w';
		rec(nx, ny, c);
	  }
	}
  }
}

int main() {
  while (cin >> w >> h, (w || h)) {
	memset(f, 0, sizeof(f));
	for (int y = 1; y <= h; y++) {
	  for (int x = 1; x <= w; x++) {
		cin >> f[y][x];
	  }
	}
	for (int y = 1; y <= h; y++) {
	  for (int x = 1; x <= w; x++) {
		if (f[y][x] == 'W' || f[y][x] == 'B') {
		  rec(x, y, f[y][x]);
		}
	  }
	}
	int blacks = 0, whites = 0;
	for (int y = 1; y <= h; y++) {
	  for (int x = 1; x <= w; x++) {
		if (f[y][x] == 'b') {
		  blacks++;
		}
		else if (f[y][x] == 'w') {
		  whites++;
		}
	  }
	}
	cout << blacks << " " << whites << endl;
  }
  return 0;
}

Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dd;
const long long INF = 10000000000000;

int main() {
  int N;
  cin >> N;
  vector<dd> A(N);
  for(int i = 0;i<N;i++){
    cin >> A[i];
  }
  dd sum = 0;
  for(int i = 0;i<N;i++){
    sum += 1/A[i];
  }
cout << fixed << setprecision(10);
  cout << 1/sum << endl;

}

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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> pll;

const ll N = 200001;
const ll MOD = 1000000007;
const ll INF = LLONG_MAX;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define yes cout<<"YES"<<nl
#define no cout<<"NO"<<nl
#define space ' '
#define nl '\n'

void COUT(vector<ll>v){for(auto it:v)cout<<it<<space;cout<<nl;}
void CIN(vector<ll>&v){for(auto &it:v)cin>>it;}

ll ok(ll n)
{
    return (n*(n-1))/2;
}
int main()
{
    ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--)
    {
        ll n,i,s=0;
        cin>>n;
        vll v(n),cnt(n+1);
        CIN(v);
        for(auto it:v)
            cnt[it]++;
        for(i=1;i<=n;i++)
            if(cnt[i])
            s+=ok(cnt[i]);
        for(auto it:v)
        {
            ll temp=ok(cnt[it]-1);
            cout<<s-ok(cnt[it])+temp<<nl;
        }
    }
}


Measured memory_bytes: 5760
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

template<typename T>
struct BinaryIndexedTree{
    vector<T> data;
    int sz;

    BinaryIndexedTree(int n){
        sz = n + 1;
        data.assign(sz, 0);
    }

    void add(int i, T x){
        ++i;
        while(i < sz){
            data[i] += x;
            i += i & -i;
        }
    }

    // [0, i] の区間和
    T sum(int i){
        T res = 0;
        ++i;
        while(i > 0){
            res += data[i];
            i -= i & -i;
        }
        return res;
    }

    T sum(int l, int r){
        return sum(r - 1) - sum(l - 1);
    }

    // val 以上を満たす 0-indexed の位置を返す
    int lower_bound(T val){
        // if(val <= 0)    return -1;
        int res = 0;
        int n = 1;
        while(n < sz)   n <<= 1;
        for(int k = n >> 1; k > 0; k >>= 1){
            if(res + k < sz && data[res + k] < val){
                val -= data[res + k];
                res += k;
            }
        }
        return res;     // 1-indexed であれば、res + 1 を返す
    }
};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;
    vector<int> p(n + 1);
    for(int i = 0; i < n; ++i){
        int foo;
        cin >> foo;
        p[foo] = i + 1;
    }
    ll ans = 0;
    BinaryIndexedTree<int> bit(n + 5);
    bit.add(0, 1);
    bit.add(n + 1, 1);
    for(int i = n; i >= 1; --i){
        int S = bit.sum(p[i]);
        if(S >= 2){
            int l = bit.lower_bound(S - 1);
            int r = bit.lower_bound(S);
            int LeftLen = r - l;
            r = bit.lower_bound(S + 1);
            int RightLen = r - p[i];
            ans += (ll)LeftLen * RightLen * i;
        }
        S = bit.sum(n + 1) - bit.sum(p[i]);
        if(S >= 2){
            S = bit.sum(p[i]);
            int l = bit.lower_bound(S + 1);
            int r = bit.lower_bound(S + 2);
            int RightLen = r - l;
            l = bit.lower_bound(S);
            int LeftLen = p[i] - l;
            ans += (ll)LeftLen * RightLen * i;
        }
        bit.add(p[i], 1);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
use std::io;

fn main() {
    let mut line = String::new();
    io::stdin().read_line(&mut line).unwrap();
    let v: Vec<_> = line.split_whitespace()
        .map(|s| s.parse::<i32>().unwrap())
        .collect();
    let (d, r, f) = (v[0] / v[1], v[0] % v[1], (v[0] as f64) / (v[1] as f64));
    println!("{} {} {:.*}", d, r, 5, f);
}



Measured memory_bytes: 5060
num = int(input())
num_dict = {}
nums = [int(i) for i in input().split()]
count = 0

for i in range(num):
    if nums[i] in num_dict.keys():
        num_dict[nums[i]] += 1
    else:
        num_dict[nums[i]] = 1

for key, value in num_dict.items():
    if key < value:
        count += (value - key)
    elif key > value:
        count += value

print(count)

Measured memory_bytes: 17780
M, D = map(int, input().split())

ans = 0

for m in range(1, M+1):
    for d in range(1, D+1):
        if d >= 10:
            d_1 = str(d)[-1]
            d_10 = str(d)[-2]
            if int(d_1) * int(d_10) == m and int(d_1) >= 2 and int(d_10) >= 2:
                ans += 1
        else:
            continue

print(ans)


Measured memory_bytes: 3060
import java.util.*;

public class Main {
	public static void main(String[] args)  {
		Scanner scan = new Scanner(System.in);
		int n=Integer.parseInt(scan.nextLine());
		int[] x=new int [n];
		int[] sort_x=new int [n];
		for (int i=0;i<n;++i){
			x[i]=Integer.parseInt(scan.next());
			sort_x[i]=x[i];
		}
		Arrays.sort(sort_x);
		int middle_1 = sort_x[n/2];
		int middle_2 = sort_x[n/2-1];
		for (int i=0;i<n;++i){
			if (x[i]<middle_1){
				System.out.println(middle_1);
			}else{
				System.out.println(middle_2);
			}
		}

	}
}
//end

Measured memory_bytes: 91164
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<stack>
#include<set>
#include<map>
#include<vector>
#include<queue>
#define N 10
typedef long long ll;
using namespace std;
int a[N][N];
int main()
{
   int ans;
    for(int i=1;i<=3;i++)
        for(int j=1;j<=3;j++)
      cin>>a[i][j];
     ans=a[1][1]+a[2][2]+a[3][3];
    if(a[1][2]+a[2][3]+a[3][1]!=ans||a[1][3]+a[2][1]+a[3][2]!=ans)
    {
        cout << "No" << endl;
        return 0;
    }
    if(a[1][1]+a[2][3]+a[3][2]!=ans||a[1][2]+a[2][1]+a[3][3]!=ans||a[1][3]+a[2][2]+a[3][1]!=ans)
    {
        cout << "Yes" << endl;
        return 0;
    }
   cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
a = io.read()
a = tonumber(a)
s = {}
flag = "Yes"
last = nil
for i = 1, a do
	b = io.read()
	if s[b] or (last and string.sub(b, 1, 1) ~= last) then
		flag = "No"
	end
	s[b] = true
	last = string.sub(b, #b, #b)
end
print(flag)

Measured memory_bytes: 888
#include <stdio.h>
#include <math.h>
int main(void){
  int n;
  int tokuten[1000];
  int i;
  double SD;//standard deviation
  double average,sum; // average wo double ni siteokanaito gosa ga deru.
  // double ha mathematics fucntion wo tukau toki ha kanarazu shiyou suru koto
  average = 0;
  sum = 0;
  double variance;
  variance = 0;

  while(1)
    {
      scanf("%d",&n);
      if (n == 0)break;
      for(i = 0;i < n;i++)
        {
          scanf("%d",&tokuten[i]);
          sum += tokuten[i];
          }
      average = sum/n;
      for(i = 0;i < n;i++)
        {
          variance +=((tokuten[i] - average)*(tokuten[i] - average))/n;
          // variance no siki wo machigaete ita. n de warukoto.
        }
      SD = sqrt(variance) ; //SD ha Standard Deviation no ryaku 
      printf("%.16lf\n",SD);
      variance = 0;
      average = 0;
      sum = 0;
    }
  return 0;
}

Measured memory_bytes: 640
#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;
  vector<int> a(N);
  rep(i, N) cin >> a[i];
  vector<int> s = a;
  
  sort(s.rbegin(), s.rend()); 
  rep(i, N){
    int ans = s[0];
    if (s[0] == a[i]) ans = s[1];
    cout << ans << endl;
  }
}


Measured memory_bytes: 3200
import java.util.Scanner;

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

    int A = scanner.nextInt();
    int B = scanner.nextInt();
    if ((A + B) % 2 != 0) {
      System.out.println("IMPOSSIBLE");
    } else {
      System.out.println((A + B) / 2);
    }
  }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define ios ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
using namespace std;
typedef long long ll;
const int MAX = 1e5 + 10;
const int mod = 1e9+7;

int a[MAX];
void solve() {
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    int ans=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            for(int k=j+1;k<n;k++){
                if(a[i]+a[j]>a[k]&&a[i]!=a[j]&&a[j]!=a[k]){
                    ans++;
                }
            }
        }
    }
    cout<<ans;
}

int main() {
    int _ = 1;
    //cin >> _;
    while (_--) {
        solve();
    }
    return 0;
}

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

int A[100001], n;

int binarySearch(int A[], int key) {
    int left = 0;
    int right = n;
    int mid;
    while (left < right) {
        mid = (left + right) / 2;
        if (A[mid] == key) {
            return 1;
        }
        else if (key < A[mid]) {
            right = mid;
        }
        else {
            left = mid + 1;
        }
    }
    return 0;
}

int main() {
    int q, T[50001];
    int c = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> A[i];
    }
    cin >> q;
    for (int i = 0; i < q; i++) {
        cin >> T[i];
    }

    for (int i = 0; i < q; i++) {
        if (binarySearch(A, T[i]) == 1) {
            c++;
        }
    }
    cout << c << endl;
}



Measured memory_bytes: 3636
N = int(input())
dc={}
for i in range(N):
  s=input()
  if s in dc:
    dc[s]+=1
  else:
    dc[s]=1
m=max(dc.values())
w = [kv[0] for kv in dc.items() if kv[1] == m]
w.sort()
for p in w:
  print(p)

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

int main() {
  int N;
  cin >> N;
  vector<int64_t> D(N);
  for(int i=0; i<N; i++){
    cin >> D.at(i);
  }
  
  int64_t a=0;
  for(int i=0; i<N; i++){
    for(int j=i; j<N; j++){
      if(i!=j){
        a+= D.at(i)*D.at(j);
      }
    }
  }
  
  cout << a;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;
#define rep(i,n) for((i)=0;(i)<(int)(n);(i)++)
using ll = long long;
using P = pair<int,int>;

int main(void) {
  int a, b, c;
  cin >> a >> b >> c;

  if(a+b+c >= 22) cout << "bust" << endl;
  else if(a+b+c <= 21) cout << "win" << endl;
  return 0;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long

void solve()
{
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    //cout<<a*c<<endl;
    cout<<max({a*c,a*d,b*c,b*d});
}

int main()
{
    IOS
    ll t=1;
    //cin>>t;
    for(ll i=0;i<t;i++) solve();
    return 0;
}



Measured memory_bytes: 3644
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (a<10&&b<10){
            System.out.println(a*b);
        }else {
            System.out.println(-1);
        }
    }
}


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

int main(void){

    int N; cin>>N;
    map<string, int> a;
    long long ans=0;
    for (int i = 0; i < N; ++i) {
        string tmp;
        cin>>tmp;
        sort(tmp.begin(), tmp.end());
        ans+=a[tmp];
        a[tmp]++;
    }


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

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

int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main(){
    int n;
    cin>>n;
    
    cout<<a[n-1]<<endl;
}

Measured memory_bytes: 256
n=int(input())
s=[[]for i in range(n)]
for i in range(n):
    a=int(input())
    for j in range(a):
        x,y=map(int,input().split())
        s[i].append([x-1,str(y)])
an=0
for i in range(2**n):
    b=bin(i)[2:]
    b="0"*(n-len(b))+b
    c=["a"]*n
    d=0
    for i in range(n):
        if b[i]!=c[i] and c[i]!="a":
            break
        else:
            c[i]=b[i]
            if b[i]=="1":
                for (j,h) in s[i]:
                    if c[j]!="a" and h!=c[j]:
                        d=1
                        break
                    else:
                        c[j]=h
        if d==1:
            break
    else:
        an=max(an,b.count("1"))
print(an)

Measured memory_bytes: 3188
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
#include <ctype.h>
#include <vector>
#include <numeric>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (int i = a; i < n; i++)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define vi vector<int>
#define vll vector<ll>
#define ALL(a) (a).begin(), (a).end()
#define sort_v(a) sort(a.begin(), a.end())
#define fi first
#define se second

void print(bool a)
{
    if (a == true)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

ll gcdll(ll a, ll b)
{
    while (1)
    {
        if (a < b)
            swap(a, b);
        if (b == 0)
            break;
        a %= b;
    }
    return a;
}

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main()
{
    int n, k;
    string s;

    cin >> n >> k >> s;
    s[k - 1] = tolower(s[k - 1]);
    cout << s << endl;
}


Measured memory_bytes: 256
#include <stdio.h> // matrix chain
#include <limits.h>
#define MAX 110
int cost[MAX][MAX];
int matrix[MAX];
int len;
 
void matrixChain()
{
  int n = len;
  int i,j,k,l;
  int q;
 
  for(i=1;i<=n;i++) cost[i][i]=0;
 
  for(l=2;l<=n;l++)
{
    for(i=1;i<=n-l+1;i++)
{
      j=i+l-1;
      cost[i][j]=INT_MAX;
      for(k=i;k<=j-1;k++)
{
    q=cost[i][k]+cost[k+1][j]+matrix[i-1]*matrix[k]*matrix[j];
    if(cost[i][j]>q) cost[i][j]=q;
      }
    }
  }
}
 
int main()
{
  int i,j;
  scanf("%d",&len);
  for(i=0;i<len;i++)
{
    scanf("%d %d",&matrix[i],&j);
  }
  matrix[len]=j;
  matrixChain();
  printf("%d\n",cost[1][len]);
return 0;
}

Measured memory_bytes: 644
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
using namespace std;
using ll = long long;
using P = pair<int, int>;


int main(){
    int n;
    cin >> n;
    int ans = 0;
    for(int i=1; i<=n; i++){
        string s = to_string(i);
        if((s.size())%2 == 1) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const Ld pi = M_PI;
const Int MOD = 1000000007;
const Int INF = 1LL << 61;

Int Floor(Int a, Int b) {
    return (a - (a % b)) / b;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    Int n, m, k;
    cin >> n >> m >> k;
    vector<Int> a(n + 1), b(m + 1);
    for (Int i = 0; i < n; i++) {
        cin >> a[i + 1];
        a[i + 1] += a[i];
    }
    for (Int i = 0; i < m; i++) {
        cin >> b[i + 1];
        b[i + 1] += b[i];
    }

    Int ans = 0;
    for (Int i = 0; i < n + 1; i++) {
        Int books = i;
        Int times = k - a[i];
        if (times < 0) {
            continue;
        }

        books += distance(b.begin(), upper_bound(b.begin(), b.end(), times)) - 1;

        ans = max(books, ans);
    }

    cout << ans << endl;

    return 0;
}

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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  int num = A;
  for (int i = 0; i < B; ++i) {
    if (num % B == C) {
      cout << "YES\n";
      return 0;
    }
    else {
      num += A;
    }
  }
  cout << "NO\n";
}
    

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
vector<int> longest_common_subsequence(vector<int> &A, vector<int> &B){
	vector<vector<int>> dp(A.size() + 1, vector<int>(B.size() + 1, 0));
	for (int i = 0; i < A.size(); i++){
		for (int j = 0; j < B.size(); j++){
			if (A[i] == B[j]){
				dp[i + 1][j + 1] = dp[i][j] + 1;
			} else {
				dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1]);
			}
		}
	}
	vector<int> ans;
	int i = A.size();
	int j = B.size();
	while (dp[i][j] > 0){
		if (dp[i - 1][j] == dp[i][j]){
			i--;
		} else if (dp[i][j - 1] == dp[i][j]){
			j--;
		} else {
			i--;
			j--;
			ans.push_back(A[i]);
		}
	}
	reverse(ans.begin(), ans.end());
	return ans;
}
int main(){
  string s, t;
  cin >> s >> t;
  vector<int> S(s.begin(), s.end()), T(t.begin(), t.end());
  vector<int> C = longest_common_subsequence(S, T);
  string c(C.begin(), C.end());
  cout << c;
}

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

template<class T>
void printIter(const T &a, string delimiter) {
    if (a.size() == 0) return;
    auto it = a.begin();
    cout << *it;
    it++;
    while (it != a.end()) {
        cout << delimiter << *it;
        it++;
    }
    cout << endl;
}

int main() {
    int N;
    cin >> N;
    vector<int> a(N + 1);
    for (int i = 1; i <= N; ++i) {
        cin >> a[i];
    }
    vector<int> b(N + 1);
    for (int i = N; i >= 1; i--) {
        int s = 0;
        for (int j = 2; i * j <= N; ++j) {
            s += b[i * j];
        }
        if (s % 2 == a[i]) continue;
        b[i] = 1;
    }
    vector<int> c;
    for (int i = 1; i <= N; ++i) {
        if (b[i] == 1) c.push_back(i);
    }
    cout << c.size() << endl;
    printIter(c, " ");
}


Measured memory_bytes: 5260
n = gets.chomp.to_i
arr = gets.chomp.split(" ").map(&:to_i)
$count = 0

def check( t, i, arr )
  for j in (-1..1) do
    total = t
    total *= arr[i] + j
    if i == arr.length-1 
      $count +=1 if total % 2 == 0
    else
      check( total, i+1, arr )
    end
  end
end

check( 1, 0, arr )

puts $count

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

using namespace std;

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

  int N;
  cin >> N;

  long long a, b;
  cin >> a >> b;
  int x, y;
  for (int i = 1; i < N; ++i) {
    cin >> x >> y;
    long long n = max((a - 1) / x + 1, (b - 1) / y + 1);
    a = n * x;
    b = n * y;
  }
  cout << a + b << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = INF+7;
const ll LINF = 1e18;
#define rep(i,N) for(int (i)=0;(i)<(N);++(i))
#define rrep(i,N) for(int (i)=(N-1);(i)>0;--i)
#define FOR(i,j,N) for(int (i)=(j);(i)<(N);++(i))
#define put(n) cout<<(n)<<endl;
#define VI vector<int>
#define VII vector<vector<int>>
#define all(v) v.begin(),v.end()
#define MP make_pair
#define pb(n) push_back(n)
#define int long long 

signed main(){
    int N,M;
    cin>>N>>M;
    int ans = 1;
    int p = sqrt(M) + 1;
    while(p-1 > 0){
        if(M%p == 0 && M >= N*p) ans = max(ans,p);
        if(M%p == 0 && M >= N*(M/p)) ans = max(ans,M/p);
        --p;
    }
    if(N == 1) ans = M;
    cout<<ans<<endl;
    
}

Measured memory_bytes: 384
import math
def factorization(n):
  arr=[]
  temp=n
  for i in range(2,int(math.sqrt(n))):
    if temp%i==0:
      cnt=0
      while temp%i==0:
        cnt+=1
        temp//=i
      arr.append([i,cnt])
  if temp!=1:
    arr.append([temp,1])
  if arr==[]:
    arr.append([n,1])
  return arr

n=int(input())
if n==1:
  print(0)
  exit()
ans=0
for i in factorization(n):
  if i[1]>=3:
    cnt=1
    while i[1]-cnt>cnt:
      ans+=1
      i[1]-=cnt
      cnt+=1
    if i[1]!=0:
      ans+=1
  else:
    ans+=1
print(ans)

Measured memory_bytes: 63184
import java.awt.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.List;

public class Main {
    public static void main(String args[]) throws IOException {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        int w[]=new int[n];
        for (int i=0;i<n;i++){
            w[i]=sc.nextInt();
            if (i>0){
                w[i]+=w[i-1];
            }
        }
        int min=Integer.MAX_VALUE;
        for (int i=1;i<n;i++){
            if (Math.abs(w[i-1]-(w[n-1]-w[i-1]))<min){
                min=Math.abs(w[i-1]-(w[n-1]-w[i-1]));
            }
        }
        System.out.println(min);
    }


}



Measured memory_bytes: 23764
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <complex>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long ll;

int main()
{
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;
  int w = tx - sx;
  int h = ty - sy;

  for (int i = 0; i < h; i++) cout << 'U';
  for (int i = 0; i < w; i++) cout << 'R';
  for (int i = 0; i < h; i++) cout << 'D';
  for (int i = 0; i < w; i++) cout << 'L';
  cout << 'L';
  for (int i = 0; i <= h; i++) cout << 'U';
  for (int i = 0; i <= w; i++) cout << 'R';
  cout << 'D';
  cout << 'R';
  for (int i = 0; i <= h; i++) cout << 'D';
  for (int i = 0; i <= w; i++) cout << 'L';
  cout << 'U' << endl;
}


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

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define chmax(a,b) (a<(b)?(a=b,1):0)
#define chmin(a,b) (a>(b)?(a=b,1):0)
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
const int INF = 1<<29;
const double EPS = 1e-8;
const double PI = acos(-1);
typedef pair<int,int> pii;
typedef long long ll;

int main() {
  string A,B;
  while(cin >> A >> B) {
    int n = A.size();
    int m = B.size();
    bool f;
    for (int i=0; i<n-m+1; ++i) {
      f = 1;
      for (int j=0; j<m; ++j) {
        if (B[j] == '_') continue;
        if (A[i+j] != B[j]) f = 0;
      }
      if (f) break;
    }
    cout << (f?"Yes":"No") << endl;
  }
}


Measured memory_bytes: 1184
import java.util.Scanner;

public class Main {

  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);

    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();

    if(a != b && b != c && c != a){
      System.out.println(3);
    }
    else if(a == b && b == c){
      System.out.println(1);
    }
    else {
      System.out.println(2);
    }
  }
}


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

#define rep(i, n) for(int i=0; i < (int)n; i++)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;

int main(void) {
  string s, p;
  cin >> s >> p;
  s += s;

  string result = "No";
  rep(i, s.length()-p.length()+1) {
    if(s[i] == p[0]) {
      if(s.substr(i, p.length()) == p) {
        result = "Yes";
        break;
      }
    }
  }

  cout << result << endl;
}



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

signed main() {
  int N, M;
  cin >> N >> M;
  int a[3];
  a[0] = -1, a[1] = -1, a[2] = -1;

  if (N == 1 && M == 0) {
    cout << 0 << endl;
    return 0;
  }

  for (int i = 0; i < M; i++) {
    int s, c;
    cin >> s >> c;
    s--;
    if (a[s] == -1) {
      a[s] = c;
    } else {
      if (a[s] != c) {
        cout << -1 << endl;
        return 0;
      }
    }
  }

  bool flag = false;
  for (int i = 0; i < N; i++) {
    if (a[i] == -1 || a[i] != 0) {
      if (a[i] == -1) {
        if (flag) {
          a[i] = 0;
        } else {
          a[i] = 1;
        }
      }
      flag = true;
    } else {
      if (flag == false) {
        if (N == 1) {
          cout << 0 << endl;
          return 0;
        } else {
          cout << -1 << endl;
          return 0;
        }
      }
    }
  }

  for (int i = 0; i < N; i++) {
    cout << a[i];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
n = gets.to_i
b = gets.split.map(&:to_i)

ans = []
n.downto(1) do |i|
  i.downto(1) do |j|
    if b[j -1] == j
      b.delete_at(j - 1)
      ans.insert(0, j)
      break
    end
  end
  if b.size == i
    puts -1
    exit
  end
end

puts ans.join("\n")


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

int main()
{
  int a[3];
  int count_five = 0, count_seven = 0;

  for (int i = 0; i < sizeof(a) / sizeof(a[0]); i++) {
    cin >> a[i];
  }

  for (int i = 0; i < sizeof(a) / sizeof(a[0]); i++) {
    if (a[i] == 5) {
      count_five++;
    } else if (a[i] == 7) {
      count_seven++;
    } else {
      cout << "NO" << endl;
      return 0;
    }
  }

  if (count_five == 2 && count_seven == 1) {
    cout << "YES" << endl;
    return 0;
  }

  cout << "NO" << endl;
  return 0;
}

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

void dfs(int pos, int v, vector<int>* tree, int* value, int* vis) {
    vis[pos-1] = 1;
    value[pos] += v;
    for (int i = 0; i < tree[pos].size(); i++) {
        if (vis[tree[pos][i]-1] == 1) continue;
        dfs(tree[pos][i], value[pos], tree, value, vis);
    }
}

int main() {
    int n, q; cin >> n >> q;
    vector<int> tree[n+1];
    int value[n+1] = {};
    int vis[n+1] = {};

    for (int i = 0; i < n - 1; i++) {
        int w, y; cin >> w >> y;
        tree[y].push_back(w);
        tree[w].push_back(y);
    }

    for (int i = 0; i < q; i++) {
        int w, y; cin >> w >> y;
        value[w] += y;
    }

    dfs(1, 0, tree, value, vis);
    
    for (int i = 1; i <= n; i++) {
        cout << value[i] << (i == n ? '\n' : ' ');
    }

    return 0;
}


Measured memory_bytes: 27392
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rel register ll
#define rec register char
#define gc getchar
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
template <typename mitsuha>
inline bool read(mitsuha &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return 0&pc(48);
  if (x<0) pc('-'),x=-x;
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  return 0;
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
map<ll,int> mp;
int main(){
int i,n=read(),m=read();
ll sum=0,llx=0;
for (i=1;i<=n;++i) llx+=mp[sum],mp[sum]++,sum=(sum+read())%m;
write(llx+mp[sum]);
}

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

int main() {
	ll n,ans=0,a[105],now=0,MAX=0,MIN=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n;i++){
		if(a[i]>now){
			ans+=a[i]-now;
			now=a[i];
		}
		if(a[i]<now){
			now=a[i];
		}
	}
	cout <<ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 1000000007 // //100000000 998244353 //
#define inf 1000000000000000000
#define ll long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << "\t"; cout << endl;}

ll dx[4] = {0, 0, 1, -1};
ll dy[4] = {1, -1, 0, 0};

void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}


void solve(){
    string s;
    cin >> s;
    ll n = s.size();
    ll pre[n+1], post[n+1]; mem(pre,-1); mem(post, 0);
    ll k = 0;
    for(ll i = 0 ; i  < n;i++){
        if(s[i] == '>'){pre[i] = k; k = 0; continue;}
        pre[i] = k++;
    }
    if(s[n-1] == '<') pre[n] = k;
    k =  0;
    //print(pre, n+1);
    for(ll i = n-1; i >= 0; i--)
    {
        if( s[i] == '>') pre[i+1] = k++;
        else {
            pre[i+1] = max(pre[i+1], k); k = 0;
        }
    }
    if(s[0] == '>') pre[0] = k;
    //print(pre, n+1);
    ll sum = 0;
    rep(i, n+1) sum += pre[i];
    cout << sum;
}
main(){
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 8732
#include<iostream>

using namespace std;

int fib(int n);

int memo[45];

int main(){
  int n;

  //??\???
  cin >> n;

  //??????
  cout << fib(n) << endl;

  return 0;
}

int fib(int n){

  if(n == 0){
    return 1;
  }else if(n == 1){
    return 1;
  }else if(memo[n] != 0){
    return memo[n];
  }else{
    return memo[n] = fib(n-1) + fib(n-2);
  }
}

Measured memory_bytes: 3092
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using flt = double;
const flt eps = 1e-12, inf = 1e18, PI = acos(-1.0);
template<typename T>
inline T sqr(T x) {return x * x;}
inline flt cmp(flt a, flt b, flt e = eps) {
  return fabs(a - b) >= e + fabs(a) * e ? a - b : 0;
}
inline int sgn(flt x, flt e = eps) {return x < -e ? -1 : (x > e);}
inline flt fix(flt x, flt e = eps) {return cmp(x, 0, e);}

struct point {
  flt x, y;
  point(flt x = 0, flt y = 0): x(x), y(y) {}
  bool operator < (const point &rhs) const {
    return cmp(x, rhs.x) < 0 || (cmp(x, rhs.x) == 0 && cmp(y, rhs.y) < 0);
  }
  bool operator == (const point &rhs) const {
    return cmp(x, rhs.x) == 0 && cmp(y, rhs.y) == 0;
  }
  point operator + (const point &rhs) const {
    return point(x + rhs.x, y + rhs.y);
  }
  point operator - (const point &rhs) const {
    return point(x - rhs.x, y - rhs.y);
  }
  point operator * (const flt k) const {
    return point(x * k, y * k);
  }
  point operator / (const flt k) const {
    return point(x / k, y / k);
  }
  point operator ~ () const {// counter clockwise rotate 90 degree
    return point(-y, x);
  }
  flt dot(const point &rhs) const {
    return x * rhs.x + y * rhs.y;
  }
  flt det(const point &rhs) const {
    return x * rhs.y - y * rhs.x;
  }
  flt norm2() const {
    return x * x + y * y;
  }
  flt norm() const {
    return hypot(x, y);
  }
  point rot(flt a) const {// counter clockwise rotate A rad
    return point(x * cos(a) - y * sin(a), x * sin(a) + y * cos(a));
  }
  point rot(flt cosa, flt sina) const {// counter clockwise rotate using cos/sin
    return point(x * cosa - y * sina, x * sina + y * cosa);
  }
  point trunc(flt a = 1.0) const {
    return (*this) * (a / this->norm());
  }
};

// check if point O is on segment AB
bool on_segment(const point &A, const point &B, const point &O) {
  return sgn((A - O).det(B - O)) == 0 && sgn((A - O).dot(B - O)) <= 0;
}

// check if AB is parallel to CD
bool is_parallel(const point &A, const point &B, const point &C, const point &D) {
  return sgn((B - A).det(D - C)) == 0;
}

// check intersection of line AB and CD
bool line_intersect(const point &A, const point &B, const point &C, const point &D, point &res) {
  point AB(B - A), CD(D - C);
  if (sgn(AB.det(CD)) == 0) return false; // parallel
  res = A + AB * (CD.det(C - A) / CD.det(AB));
  return true;
}

int main() {
  int q;
  scanf("%d", &q);
  for (int i = 0; i < q; ++i) {
    point A, B, C, D, O;
    scanf("%lf%lf%lf%lf", &A.x, &A.y, &B.x, &B.y);
    scanf("%lf%lf%lf%lf", &C.x, &C.y, &D.x, &D.y);
    line_intersect(A, B, C, D, O);
    printf("%.10f %.10f\n", O.x, O.y);
  }
  return 0;
}

Measured memory_bytes: 2736
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
using namespace std;
int main(){
    int n,m,p;
    cin >> n >> m;
    string s;
    int rnum=0;
    int pnum=0;
    vector<vector<int>> a;
    a.resize(n);
    for(int i=0;i<n;i++)a[i].push_back(0);//acしてるかどうか
    for(int i=0;i<n;i++)a[i].push_back(0);//ACするまでのWAの数
    for(int i=0;i<m;i++){
        cin >> p >> s;
        p--;
        if(a[p][0] == 0){
            if(s == "AC"){
                a[p][0]=1;
                rnum++;
            }
            else a[p][1]++;
        }

    }
    for(int i=0;i<n;i++){
        pnum += a[i][0]*a[i][1];
    }
    cout << rnum << " " << pnum << endl;

}

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

int main() {
  int w, h;
  cin >> h >> w;
  
  vector<string> img;
  
  int sum = 0;
  for(int j=0; j<h; j++)
  {
    string line;
    cin >> line;
    
    img.push_back(line);
    
  }
  
  for(int j=-1; j<h+1; j++)
  {
    for(int i=-1; i<w+1; i++)
    {
      if(j<0 || j>=h){
        cout << "#";
//        continue;
      }else
      
      if(i<0 || i>=w){
        cout << "#";
      }else{
        cout << img[j].at(i);
      }
      
    }
    cout << endl;
  }
  
}


Measured memory_bytes: 256
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007

int main() {
  ll n;
  cin>>n;
  ll a = 0;
  rep(i,1,n+1){
    if(i%2==1)a++;
  }
  printf("%20.20f\n",1.*a/n);
  return 0;
}

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

#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define mem(x,val) memset((x),(val),sizeof(x))
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define PI acos(-1.0) 
#define N 111111

const int INF = 1 << 30 ;
typedef long long ll ;
typedef pair < int , int > pii ;

int powOf2(int n) {
  if (n == 0) return 1 ;

  int result = powOf2(n/2) ;
  result = result*result ;

  if(n&1) result*=2 ;
  return result ;
}

int main() {
  int a, b, c ,k;
  cin >> a >> b >> c >> k ;

  if(a<b) swap(a,b) ;
  if(a<c)swap(a,c) ;

  int temp = powOf2(k) ;
  ll result = temp*a + b + c ;
  cout << result << endl ;
	
  return 0 ;
}



Measured memory_bytes: 256