akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<cstdlib>
#include<ctime>
#include<cctype>
#include<set>
#include<map>
#include<vector>

using namespace std;

int a;
int main()
{
	cin >> a;
	printf("%d\n", a + a * a + a * a * a);
	return 0;
}

Measured memory_bytes: 3624
using System;   
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            int b = int.Parse(Console.ReadLine());
            int c = int.Parse(Console.ReadLine());
            int d = int.Parse(Console.ReadLine());
            int e = int.Parse(Console.ReadLine());
            int k = int.Parse(Console.ReadLine());
            
            string answer = "Yay!";
            
            int[] antena = new int[] { a, b, c, d, e };

            for (int i = 0; i < antena.Length; i++)
            {
                for (int j = i + 1; j < antena.Length; j++)
                {
                    if ((antena[j] - antena[i]) > k)
                    {
                       answer = ":(";  
                        break;
                    }
                 }
            }
           Console.WriteLine(answer);  
        }
    }


Measured memory_bytes: 13140
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int i, x;
		for (i = 1; i<= n; i++) {
			x = i;
			if (x % 3 == 0) {
				System.out.print(" " + i);
				continue;
			}
			if (x % 10 == 3) {
				System.out.print(" " + i);
				continue;
			}
			x /= 10;
			while (x != 0) {
				if (x % 10 == 3) {
					System.out.print(" " + i);
					break;
				}
				x /= 10;
			}
			continue;
		}
		System.out.print("\n");
	}
}	

Measured memory_bytes: 28284
#include <iostream>
#include <string>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std;

int main(){
    string s;	cin >> s;
    bool ok=true;  //true:Yes false:No
    for(int i = 0; i < s.size() && ok; i++){
	if(i%2==0){
	    if(s[i]=='R' || s[i]=='U' || s[i]=='D') ok=true;
	    else    ok=false;
	}else{
	    if(s[i]=='L' || s[i]=='U' || s[i]=='D') ok=true;
	    else    ok=false;
	}
    }
    if(ok){
	cout << "Yes" << endl;
    }else{
	cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
LL a[1001],b[1001],c[1001];
int x,y,z,k;
priority_queue<LL>q;
int main(){
	cin>>x>>y>>z>>k;
	for(int i=0;i<x;i++) cin>>a[i];
	for(int i=0;i<y;i++) cin>>b[i];
	for(int i=0;i<z;i++) cin>>c[i];
	sort(a,a+x,greater<LL>());
	sort(b,b+y,greater<LL>());
	sort(c,c+z,greater<LL>());
	for(int i=0;i<x;i++)
		for(int j=0;j<y;j++){
			if((i+1)*(j+1)-1>=k) break;
			for(int t=0;t<z;t++){
				if((i+1)*(j+1)*(t+1)-1>=k) break;
				LL tmp=a[i]+b[j]+c[t];	
				q.push(tmp);
			}
		}
	for(int i=0;i<k;i++){
		cout<<q.top()<<endl;
		q.pop();
	}
	return 0;
}


Measured memory_bytes: 1400
import java.util.Scanner;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        for(;;){
            int n = sc.nextInt();
            sc.nextLine();
            if(n == 0)break;
            
            double sum = 0;
            
            int s[] = new int[n];
            for(int i=0;i<n;i++){
                s[i] = sc.nextInt();
                sum += s[i];
            }
            double ave = sum / n;
            
            double varian = 0;
            for(int i=0;i<n;i++){
                varian += Math.pow(s[i] - ave,2);
            }
            varian /= n;
            
            System.out.println(Math.sqrt(varian));
        }
    }
}


Measured memory_bytes: 31592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 0; i < n; ++i)
#define rep3(i, a, b) for (ll i = a; i < b; ++i)
#define rep4(i, a, b, c) for (ll i = a; i < b; i += c)
#define erep(n) for (ll i = 0; i <= n; ++i)
#define erep2(i, n) for (ll i = 0; i <= n; ++i)
#define erep3(i, a, b) for (ll i = a; i <= b; ++i)
#define erep4(i, a, b, c) for (ll i = a; i <= b; i += c)
#define rrep(i, a, b) for (ll i = a; i > b; --i)
#define rrep2(i, a, b, c) for (ll i = a; i > b; i -= c)
#define errep(i, a, b) for (ll i = a; i >= b; --i)
#define errep2(i, a, b, c) for (ll i = a; i >= b; i -= c)
#define print(a) cout << a << endl;
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define cin(x) cin >> x;
const ll MOD = 1000000007;
const double PI = 3.14159265358979323846264338327950;
inline int newline() { putchar('\n'); return 0; }

int main() {
    ll n;
    cin(n);

    vector<ll> a(n), b(n);
    rep2(i, n) {
        cin(a[i]); cin(b[i]);
    }

    sort(a.begin(), a.end());
    sort(b.begin(), b.end());

    ll result;

    if (n % 2 == 1) {
        ll min = a[(n + 1) / 2 - 1];
        ll max = b[(n + 1) / 2 - 1];
        result = max - min + 1;
    } else {
        ll min = a[n / 2 - 1] + a[n / 2];
        ll max = b[n / 2 - 1] + b[n / 2];
        result = max - min + 1;
    }

    print(result);
    return 0;
}

Measured memory_bytes: 6332
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
typedef long long ll;
#define SIZE 262144
class BIT
{
public:
	ll bit[SIZE + 1];
	void init()
	{
		fill(bit, bit + 262144, 0);
	}
	void add(int a, int b)
	{
		a++;
		for (;;)
		{
			bit[a] += b;
			a += a&-a;
			if (a > SIZE)return;
		}
	}
	ll get(int a)
	{
		a++;
		ll ret = 0;
		for (;;)
		{
			ret += bit[a];
			a -= a&-a;
			if (a == 0)return ret;
		}
	}
};
BIT bi;
int cnt[26];
vector<int>now[26];
int main()
{
	string s;
	cin >> s;
	int num = s.size();
	fill(cnt, cnt + 26, 0);
	for (int i = 0; i < s.size(); i++)cnt[s[i] - 'a']++;
	int r = 0;
	for (int i = 0; i < 26; i++)r += cnt[i] % 2;
	if (r >= 2)
	{
		printf("-1\n");
	}
	else
	{
		vector<int>mok(num);
		int pt = 0;
		fill(now, now + 26, vector<int>(0));
		for (int i = 0; i < s.size(); i++)
		{
			int c = s[i] - 'a';
			int t = now[c].size() + 1;
			if (t + t <= cnt[c])mok[pt] = i, now[c].push_back(pt), pt++;
			else if (t + t - 1 == cnt[c])mok[num / 2] = i, now[c].push_back(num / 2);
			else mok[num - 1 - now[c][cnt[c] - t]] = i, now[c].push_back(num - 1 - now[c][cnt[c] - t]);
		}
		//for (int i = 0; i < mok.size(); i++)printf("%d ", mok[i]);
		ll ans = 0;
		for (int i = 0; i < mok.size(); i++)ans += i - bi.get(mok[i]), bi.add(mok[i], 1);
		printf("%lld\n", ans);
	}
}

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

using namespace std;

typedef long long ll;
#define x first
#define y second
#define mp make_pair

const ll MAXN = (int)1e4;
ll n, p;
ll br[MAXN + 5], nbr[5];
string s;

int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> p;
cin >> s;
ll sad = 0;
ll sol = 0;
br[0]++;
if(p == 2 || p == 5){
	for(int i = 0 ; i < n ; ++i){
		for(int j = 0 ; j < 5 ; ++j){
			nbr[j] = 0;
		}
		for(int j = 0 ; j < 5 ; ++j){
			ll novi = (j * 10) % p;
			nbr[novi] += br[j];
		}
		for(int j = 0 ; j < 5 ; ++j){
			br[j] = nbr[j];
		}
		sad = (sad * 10 + (ll)(s[i] - '0')) % p;
		sol += br[sad];
		br[sad]++;
	}
}
else{
	ll pot = 1;
	reverse(s.begin(), s.end());
	for(int i = 0 ; i < n ; ++i){
		sad = (sad + (ll)(s[i] - '0') * pot) % p;
		sol += br[sad];
		br[sad]++;
		pot = (pot * 10LL) % p;
	}
}
cout << sol << endl;

return 0;
}



Measured memory_bytes: 720
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	fsc := NewFastScanner()
	hands := fsc.Next()
	score := 0
	hp := 0
	for _, x := range hands {
		if x == 'g' {
			if hp == 0 { //g
				hp++
			} else { //p
				hp--
				score++
			}
		} else {
			if hp > 0 { //p
				hp--
			} else { //g
				hp++
				score--
			}
		}
	}
	fmt.Println(score)
}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 2028)
	return &FastScanner{r: rdr}
}

func (s *FastScanner) Next() string {
	s.Pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}

func (s *FastScanner) NextInt() int {
	val, err := strconv.Atoi(s.Next())
	if err != nil {
		panic(err)
	}
	return val
}
func (s *FastScanner) NextInt64() int64 {
	val, err := strconv.ParseInt(s.Next(), 10, 64)
	if err != nil {
		panic(err)
	}
	return val
}
func (s *FastScanner) Pre() {
	if s.p >= len(s.buf) {
		s.ReadLine()
		s.p = 0
	}
}

func (s *FastScanner) ReadLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, err := s.r.ReadLine()
		if err != nil {
			panic(err.Error())
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


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

int main(void) {
  const ll P = 43, K = P + 1, N = K * (K - 1) + 1;
  assert(K >= 1);
  assert(1000 <= N && N <= 2000);

  vector< vector<ll> > ans;

  REP(i, 0, K - 1) {
    ll s = i + 1;
    ll t = (K - 1) * (K - 1) + s;
    ll d = i;

    REP(j, 0, K - 1) {
      vector<ll> p;
      ll n = j + 1;
      p.push_back(n);
      REP(j, 1, K - 1) {
        n = (K - 1) * j + (n + d - 1) % (K - 1) + 1;
        p.push_back(n);
      }
      p.push_back(t);
      ans.push_back(p);
    }
  }

  REP(i, 0, K) {
    vector<ll> p;
    REP(j, 0, K - 1) p.push_back((K - 1) * i + j + 1);
    p.push_back(N);
    ans.push_back(p);
  }

  assert(ans.size() == N);

  cout << N << " " << K << endl;
  REP(i, 0, ans.size()) REP(j, 0, ans[i].size()) cout << ans[i][j] << (j + 1 != ans[i].size() ? " " : "\n");
}


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

int main(){
    char S[100];
    ll K;
    scanf("%s\n%lld", S, &K);

    for(ll i=0LL; i<K; i++){
        if(S[i]!='1' || i==K-1){
            printf("%c\n",S[i]);
            return 0;
        }
    }
    return 1;
}


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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#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, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int n, k;
    cin >> n >> k;
    vector<bool> v(10, true);
    REP(i, k){
        int a;
        cin >> a;
        v[a] = false;
    }

    FOR(i, n, 100000){
        bool ok = true;
        int a = i;
        while(a > 0){
            ok &= v[a%10];
            a /= 10;
        }
        if(ok){
            cout << i << endl;
            return 0;
        }
    }

    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))
using ll = long long;
using P = pair<int, int>;
using namespace std;

#define INF ((1<<30)-1)
#define LLINF (1LL<<60)
#define EPS (1e-10)

int main() {
    int N;
    cin >> N;
    vector<int> h(N);
    rep(i, N) cin >> h[i];

    vector<int> dp(N, INF);
    dp[0] = 0;
    for (int i = 1; i < N; ++i) {
        dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]));
        if (i >= 2) {
            dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]));
        }
    }

    cout << dp[N-1] << endl;
}


Measured memory_bytes: 4024
import collections

n = int(input())
a = list(map(int,input().split()))

#累積和
s = [0]*(n+1)
for i in range(n):
  s[i+1] = s[i] + a[i]

ans = 0
c = list(collections.Counter(s).values())
for i in c:
  ans += i*(i-1)//2
print(ans)


Measured memory_bytes: 41752
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
  return int(readline())
N = I()
for n in range(1,3501):
    for h in range(1,3501):
        if 4*n*h - N*(h+n) != 0:
            ans = n*h*N / (4*n*h-N*(h+n))
            if ans < 1:
                continue
            if int(ans) == ans:
                print(h,n,int(ans))
                exit()


Measured memory_bytes: 78816
// Template {{{
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
using namespace std;
typedef long long LL;

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

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

class range {
  struct Iterator {
    int val, inc;
    int operator*() {return val;}
    bool operator!=(Iterator& rhs) {return val < rhs.val;}
    void operator++() {val += inc;}
  };
  Iterator i, n;
public:
  range(int e) : i({0, 1}), n({e, 1}) {}
  range(int b, int e) : i({b, 1}), n({e, 1}) {}
  range(int b, int e, int inc) : i({b, inc}), n({e, inc}) {}
  Iterator& begin() {return i;}
  Iterator& end() {return n;}
};

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
inline bool valid(int x, int w) { return 0 <= x && x < w; }

void iostream_init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.setf(ios::fixed);
    cout.precision(12);
}
//}}}

struct Edge{
    int dst, type;
};
typedef vector<Edge> Node;
typedef vector<Node> Graph;
typedef tuple<int, int, int, int> TP;
const int INF = 1000000000;
int main(){
    iostream_init();
    int N, M, E, S, T, R;
    while(cin >> N >> M >> E >> S >> T >> R) {
        R++; // < R

        Graph G(N);
        REP(i, M) {
            int a, b;
            cin >> a >> b;
            G[a].push_back({b, -1});
            G[b].push_back({a, -1});
        }
        vector<int> eve[101];
        REP(i, E) {
            int a, b, c;
            cin >> a >> b >> c;
            eve[c].push_back(i);
            G[a].push_back({b, i});
            G[b].push_back({a, i});
        }
        static int dist[102][102][1 << 8] = {};
        REP(i, N) REP(j, R) REP(s, 1 << E) dist[i][j][s] = INF;
        priority_queue<TP, vector<TP>, greater<TP>> que;
        auto insert = [&](int a, int b, int c, int d) {
            for(int e : eve[b]) d |= 1 << e;
            if(a < dist[b][c][d]) {
                dist[b][c][d] = a;
                que.push(make_tuple(a, b, c, d));
            }
        };
        insert(0, S, 0, 0);
        while(!que.empty()) {
            int cost, cur, time, state;
            tie(cost, cur, time, state) = que.top(); que.pop();
            if(dist[cur][time][state] < cost) continue;

            // back
            insert(cost + 1, S, 0, state);

            if(time + 1 < R) {
                for(Edge ed : G[cur]) {
                    int next = ed.dst;
                    int type = ed.type;
                    if(type != -1 && !(state >> type & 1)) continue;
                    insert(cost+1, next, time+1, state);
                }
            }
        }

        int ans = INF;
        REP(i, R) REP(s, 1<<E) ans = min(ans, dist[T][i][s]);
        if(ans == INF) ans = -1;
        cout << ans << endl;
    }

    return 0;
}

/* vim:set foldmethod=marker: */

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

int main(void) {
    int n;
    long long sum[200001], ans = LLONG_MAX;
    sum[0] = 0;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        int a;
        cin >> a;
        sum[i] = sum[i - 1] + a;
    }
    for (int i = 1; i <= n - 1; i++) {
        ans = min(ans, abs(sum[i] - (sum[n] - sum[i])));
    }
    cout << ans << endl;
}


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

int main()
{
	int height[10];
	int roop_i, roop_j;
	int tmp;

	for ( roop_i = 0 ; roop_i < 10 ; roop_i++ )
	{
		scanf( "%d", &height[roop_i] );
	}

	/*Bubble Sort*/
	for ( roop_i = 0 ; roop_i < 10 ; roop_i++ )
	{
		for ( roop_j = 9 ; roop_j > roop_i ; roop_j-- )
		{
			if ( height[roop_j] > height[roop_i] )
			{
				tmp = height[roop_j];
				height[roop_j] = height[roop_i];
				height[roop_i] = tmp;
			}
		}
	}

	for ( roop_i = 0 ; roop_i < 3 ; roop_i ++ )
	{
		fprintf( stdout, "%d\n", height[roop_i] );
	}

	return 0;
}

Measured memory_bytes: 600
const line = require('fs').readFileSync('/dev/stdin', 'utf-8').split('\n');

const n = line[1].split(' ').map((x, i) => [i + 1, Number(x)]);

n.sort((xs, ys) => xs[1] - ys[1]);

console.log(n.map(xs => xs[0]).join(" "));


Measured memory_bytes: 37412
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<cctype>
#include<string.h>

int main()
{
	char s[101];
	char ss[201];
	char p[101];

	scanf("%s", &s);
	scanf("%s", &p);

	strcpy(ss, s);
	strcat(ss, s);

	if (strstr(ss, p) == NULL) {
		printf("No\n");
	}
	else {
		printf("Yes\n");
	}
	return 0;
}

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

int main() {
  long long N; cin >> N;
  long long A[N];
  for (int i = 0; i < N; i++) cin >> A[i];
  
  long long max_ = 0;
  long long count = 0;
  for (long long i = 0; i < N; i++){
    if (A[i] > max_){
      max_ = A[i];
    }
    else {
      count += max_ - A[i];
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 5192
#include <stdio.h>
int main(void)
{
  int N,i;
  scanf("%d",&N);
  char S[101],T[101];
  scanf("%s %s",S,T);
  
  for(i=0;i<N;i++)
    printf("%c%c",S[i],T[i]);	

  return 0;  
}


Measured memory_bytes: 128
IDENTIFICATION DIVISION.
PROGRAM-ID. PROGRAM_ID.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 maxlen     PIC 9(10) VALUE 100 COMP.
01 cur        PIC 9(10) VALUE 1 COMP.
01 i          PIC 9(10) VALUE 1 COMP.
01 k          PIC 9(10) VALUE 1 COMP.
01 len        PIC 9(10) COMP.
01 N          PIC 9(10).
01 num        PIC 9(10) VALUE 4.
01 ans        PIC X(12).
01 idx        PIC 9(10).
01 zs         PIC Z(9)9.
01 S          PIC X(3).
01 C1.
   03 C11 OCCURS 4 DEPENDING num.
      05 C    PIC 9(10) VALUE 0 COMP.
01 j1         PIC X(12) VALUE "AC WA TLERE".
01 REDEFINES j1.
  03 j        PIC X(3) OCCURS 4 INDEXED BY ix.
01 mul        PIC X(3) VALUE " x ".

PROCEDURE DIVISION.
  ACCEPT N.
  PERFORM VARYING i FROM 1 BY 1 UNTIL N < i
    ACCEPT S
    SET ix TO 1
    PERFORM UNTIL 4 < ix
      SEARCH j VARYING ix
        AT END
          CONTINUE
        WHEN S = j(ix)
          MOVE ix TO idx
          ADD 1 TO C(idx)
          SET ix UP BY 1
      END-SEARCH
    END-PERFORM
  END-PERFORM.
  PERFORM VARYING i FROM 1 BY 1 UNTIL num < i
    MOVE SPACE TO ans
    MOVE C(i) TO zs
    STRING FUNCTION TRIM(j(i)) mul FUNCTION TRIM(zs) INTO ans
    DISPLAY FUNCTION TRIM(ans)
  END-PERFORM.
  STOP RUN.


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

using namespace std;

int main() {
    int  n, k;
    cin >> n >> k; 
    vector<int>arr(n);

    for (int i = 0; i < n; ++i)
    {
        cin >> arr[i];
    }
    int sum{ 0 };
    vector<int>dp(n+1,0);
    dp[0] = 0;
    dp[1] = abs(arr[1] - arr[0]);
    int i = 0;
    for( i = 2;i <=k && i < n; ++i)
    {
        dp[i] = INT_MAX;
        for (int j = i-1; j >= 0; j--)
        {
            dp[i] = min(dp[i], abs(arr[i] - arr[j]) + dp[j]);
        }
    }
    for (; i < n; ++i)
    {
        dp[i] = INT_MAX;
        for (int j = i - 1; j >= i-k; j--)
        {
            dp[i] = min(dp[i], abs(arr[i] - arr[j]) + dp[j]);
        }
    }
    cout << dp[n-1];
}

Measured memory_bytes: 4032
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t N, M;
  cin >> N >> M;
  vector<int64_t> n(N);
  vector<int64_t> m(M);
  for(int i=0; i<N; i++){
    cin >> n.at(i);
  }
  for(int i=0; i<M; i++){
    cin >> m.at(i);
  }
  int64_t MOD = 1e9+7;
  int64_t ans_n = 0;
  int64_t ans_m = 0;
  for(int i=0; i<N-1; i++){
    //区間i~i+1の寄与を計算
    ans_n += (i+1)*(N-1-i)*(n.at(i+1) - n.at(i));
    ans_n %= MOD;
  }
  for(int i=0; i<M-1; i++){
    ans_m += (i+1)*(M-1-i)*(m.at(i+1) - m.at(i));
    ans_m %= MOD;
  }
  //cout << ans_n << " " << ans_m << endl;
  cout << (ans_n * ans_m) % MOD << endl;
}

Measured memory_bytes: 1792
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        n: usize,
        a: [i32; n],
    }
    let mut a = a;
    a.insert(0, 0);
    let mut b = vec![0; n + 1];
    for i in (1..n + 1).rev() {
        let mut sum = 0;
        for j in 2..n / i + 1 {
            sum ^= b[i * j];
        }
        b[i] = sum ^ a[i];
    }
    let mut pres = vec![];
    for i in 1..n + 1 {
        if b[i] == 1 {
            pres.push(i);
        }
    }
    puts!("{}\n", pres.len());
    for p in pres {
        puts!("{}\n", p);
    }
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define log_2(a) (log((a)) / log(2))
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int N;
    cin >> N;

    int mx = 0;
    int mn = INF;
    for(int i = 0; i < N; ++i) {
        int a;
        cin >> a;
        mx = max(mx, a);
        mn = min(mn, a);
    }
    cout << mx - mn << endl;
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
#define VIZ {printf("digraph G{\n"); for(int i=1;i<=n;i++) for es(i,e) printf("%d->%d;\n",i,vb[e]); puts("}");}
#define VIZ2 {printf("graph G{\n"); for(int i=1;i<=n;i++) for es(i,e) if(vb[e]>=i)printf("%d--%d;\n",i,vb[e]); puts("}");}
#define SZ 666666
char s[SZ],t[SZ];
int qs[SZ],qt[SZ],q,a,b,c,d;
int main()
{
	scanf("%s%s",s+1,t+1);
	for(int i=1;s[i];++i) qs[i]=qs[i-1]+(s[i]=='B');
	for(int i=1;t[i];++i) qt[i]=qt[i-1]+(t[i]=='B');
	scanf("%d",&q);
	while(q--)
	{
		scanf("%d%d%d%d",&a,&b,&c,&d);
		int B1=qs[b]-qs[a-1],A1=b-a+1-B1;
		int B2=qt[d]-qt[c-1],A2=d-c+1-B2;
		int a=B1+A1*2,b=B2+A2*2;
		if((a-b)%3==0) puts("YES");
		else puts("NO");
	}
}


Measured memory_bytes: 4992
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>

using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

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

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
string N;
vector<int> n;
int dp[101][2][5];
int k;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> N >> k;
  REP(i, N.length()) {
    n.push_back(N[i] - '0');
  }
  int l = N.size();

  dp[0][0][0] = 1;
  REP(i, l) {
    REP(smaller, 2) {
      REP(j, 4) {
        for(int x = 0; x <= (smaller ? 9 : n[i]); x++){
          dp[i + 1][smaller || x < n[i]][x == 0 ? j : j + 1] += dp[i][smaller][j];
        }
      }
    }
  }

  cout << dp[l][0][k] + dp[l][1][k] << endl;
}


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

int main() {
    string S;
    cin >> S;

    rep(i, S.length()){
        S.at(i) = 'x';
    }

    cout << S << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <cctype>

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define ALL(v) (v).begin(), (v).end()
#define REV(s) (s).rbegin(), (s).rend()
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define MP make_pair
#define X first
#define Y second

using namespace std;

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

const int N = 40010;
int a[N], b[N];
int main(){
	int n;
	while(cin >> n, n){
		rep(i, n) cin >> a[i];
		rep(i, n) cin >> b[i];
		sort(a, a+n);
		sort(b, b+n);

		for(int i = n-1; i >= 1; --i){
			int x = lower_bound(b+i, b+n, a[i])-(b+i);
			if(x*2 > n-i){
				cout << n-i << endl;
				goto OK;
				break;
			}
		}
		cout << "NA" << endl;
OK:;
	}


	return 0;
}

Measured memory_bytes: 1492
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
typedef long long ll;
ll inf = 1000000000;
int dx[4] = { 1,-1,0,0 };
int dy[4] = { 0,0,1,-1 };

typedef pair<ll, ll> P;
ll h, w;
char s[55][55];
int dist[55][55];
int bfs(int x, int y) {
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			dist[i][j] = inf;
		}
	}
	dist[x][y] = 0;
	queue<P>q;
	q.push({ x,y });
	while (q.size()) {
		P now = q.front();
		q.pop();
		for (int k = 0; k < 4; k++) {
			int nextx = now.first + dy[k];
			int nexty = now.second + dx[k];
			if (nextx >= 0 && nextx < h && nexty >= 0 && nexty < w && s[nextx][nexty] != '#' && dist[nextx][nexty] == inf) {
				dist[nextx][nexty] = dist[now.first][now.second] + 1;
				q.push({ nextx,nexty });
			}
		}
	}
	return dist[h - 1][w - 1];
}

int main() {
	cin >> h >> w;
	ll count = 0;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> s[i][j];
			if (s[i][j] == '#') {
				count++;
			}
		}
	}
	int ans = bfs(0, 0);
	if (ans == inf) {
		cout << "-1" << endl;
		return 0;
	}
	cout << h*w-count-ans-1 << endl;
	return 0;
	ll cnt = 0;
	ll kai = 0;
	for (int k = 1; k <= ans; k++) {
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (dist[i][j] == k) {
					cnt++;
				}
			}
		}
		kai += cnt - 1;
		cnt = 0;
	}
	ll kai2 = 0;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (dist[i][j] == inf) {
				kai2++;
			}
		}
	}
	cout << kai+abs(kai2-count) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    ll n, k;
    cin >> n >> k;
    ll sum = 0;
    for (ll i = k; i <= n + 1; ++i) {
        ll min = (0LL + i-1LL) * i / 2LL;
        ll max = (n-i+1LL + n) * i / 2LL;
        //cout << i << " " << min << " " << max << endl;
        sum = (sum + max - min + 1LL) % mod;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3564
#include <bits/stdc++.h>
#include <string>
#include <vector>

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

int main() {
    int n;
    cin >> n ;
    vector<int> seq(n);
    vector<int> ans(n);

    rep(i, n) { 
        cin >> seq[i];
        seq[i]--;
    }
    rep (i, n) {
        ans[seq[i]] = i + 1;
    }
    rep (i, n) {
        cout << ans[i] << " ";
    }
}

Measured memory_bytes: 1536
import java.util.*

class Node(val depth: Int, val index: Int, val parent: Int) : Comparable<Node> {
    override fun compareTo(other: Node): Int {
        return this.depth - other.depth
    }

}

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val n = scanner.nextInt()
    val q = scanner.nextInt()

    val children = Array(n + 1) { mutableListOf<Int>() }
    (1 until n).forEach {
        val a = Integer.parseInt(scanner.next())
        val b = Integer.parseInt(scanner.next())
        children[a].add(b)
        children[b].add(a)
    }

    val count = LongArray(n + 1) { 0 }
    (1..q).forEach {
        val p = Integer.parseInt(scanner.next())
        val x = Integer.parseInt(scanner.next())
        count[p] = count[p] + x
    }


    val pq = PriorityQueue<Node>()
    pq.add(Node(1, 1, 0))
    val visited = BooleanArray(n + 1) { false }
    while (pq.isNotEmpty()) {
        val node = pq.poll()
        if (visited[node.index]) continue

        visited[node.index] = true
        count[node.index] = count[node.index] + count[node.parent]

        children[node.index].forEach { child ->
            if (visited[child]) return@forEach
            pq.add(Node(node.depth + 1, child, node.index))
        }
    }

    val sb = StringBuilder()
    for (i in 1 until n) {
        sb.append(count[i])
        sb.append(" ")
    }
    sb.append(count[n])
    println(sb)
}



Measured memory_bytes: 149996
#include<stdio.h>

int main()
{
	long long int hp;
	int num, buf, total = 0;
	scanf("%lld %d", &hp, &num);

	for (int i = 0; i < num; i++) {
		scanf("%d", &buf);
		total += buf;
	}
	if (total >= hp) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}

	return 0;
}

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

int main() {
	string a,b;
	int hit=0,blow=0;

		while(cin>>a>>b){
		if(a=="0"&&b=="0")break;
		for(int i=0;i<4;i++){
			if(a[i]==b[i])hit++;
		}
		
		for(int j=0;j<4;j++){
			for(int k=0;k<4;k++){
				if(j!=k&&a[j]==b[k])blow++;
			}
		}
		cout<<hit<<" "<<blow<<endl;
		blow=0;
		hit=0;
		}
	
	
	return 0;
}

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

template <class T> using V = vector<T>;

using ll = long long;
using db = double;
using st = string;
using ch = char;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;


#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(b);i>(ll)(a);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;


ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}


ll combi(ll n,ll m) {
  ll ans=1;
  rFOR(i,n,n-m){
    ans*=i;
  }
  FOR(i,1,m+1){
    ans/=i;
  }
  return ans;
}


ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}


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


signed main() {
  ll n;
  	ci(n);
  vll A(3*n);
  ll m=0;
  for(int i=0;i<3*n;i+=3){
    ci(A[i])
    A[i+1]=A[i]-1;
    A[i+2]=A[i]+1;
  }
  SORT(A);
  ll count=1;
  ll ans=1;
  FOR(i,1,3*n){
    if(A[i-1]==A[i]){
      count++;
    }
    else{
      ans=M(count,ans);
      count=1;
    }
  }
  ans=M(count,ans);
  co(ans)
}

Measured memory_bytes: 2560
#include<iostream>
using namespace std;
int main(){
  int a,b,c,d,e,f;
  cin>>a>>b>>c>>d;
  e=c-a;
  f=d-b;
  
  cout<<c-f<<" "<<d+e<<" "<<a-f<<" "<<b+e;
  return 0;
}


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

int main()
{
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    cout << (a[0] + a[1] == a[2] ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
h = list(map(int, input().split()))
g = [[] for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    g[a - 1].append(b - 1)
    g[b - 1].append(a - 1)
ans = 0
for i in range(n):
    for node in g[i]:
        if h[i] <= h[node]:
            break
    else:
        ans += 1
print(ans)


Measured memory_bytes: 92840
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#define ALL(x) (x).begin(), (x).end()
#define dll(x) scanf("%I64d",&x)
#define xll(x) printf("%I64d\n",x)
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define gg(x) getInt(&x)
#define db(x) cout<<"== [ "<<x<<" ] =="<<endl;
using namespace std;
typedef long long ll;
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;}
ll powmod(ll a,ll b,ll MOD){ll ans=1ll;while(b){if(b&1)ans=ans*a%MOD;a=a*a%MOD;b>>=1;}return ans;}
inline void getInt(int* p);
const int maxn=10010;
const int inf=0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/
int n;
int aa,b,c;
int a[maxn];
int ans=inf;
int bj[maxn];
int dfs(int x,int ia,int ib,int ic)
{
    if(x==n+1)
    {
        if(min(ia,min(ib,ic))>0)
        {
            return abs(ia-aa)+abs(ib-b)+abs(ic-c)-30;
        }else
        {
            return inf;
        }
    }else
    {
        int res=inf;
        res=min(dfs(x+1,ia,ib,ic),res);
        res=min(dfs(x+1,ia+a[x],ib,ic)+10,res);
        res=min(dfs(x+1,ia,ib+a[x],ic)+10,res);
        res=min(dfs(x+1,ia,ib,ic+a[x])+10,res);
        return res;
    }
}
int main()
{
//	   freopen("C:\\Users\\DH_M\\Desktop\\code_io\\in.txt.txt","r",stdin);
//	   freopen("C:\\Users\\DH_M\\Desktop\\code_io\\out.txt.txt","w",stdout);
	gg(n);
	gg(aa);gg(b);gg(c);
	repd(i,1,n)
	{
		gg(a[i]);
	}
	printf("%d\n",dfs(1,0,0,0));
    return 0;
}

inline void getInt(int* p) {char ch;do {ch = getchar();}
while (ch == ' ' || ch == '\n');if (ch == '-') {*p = -(getchar() - '0');
while ((ch = getchar()) >= '0' && ch <= '9') {*p = *p * 10 - ch + '0';}}
else {*p = ch - '0';while ((ch = getchar()) >= '0' && ch <= '9')
{*p = *p * 10 + ch - '0';}}}


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

int main()
{
    int n, ans=0, sum=0;
    string s;
    cin >> n >> s;
    for(int i = 0; i < n; i++)
    {
        if(s[i]=='I') sum++;
        else ans=max(ans, sum), sum--;
    }
    ans=max(ans, sum);
    cout << ans;
}


Measured memory_bytes: 3628
#include <iostream>
using namespace std;
int main(void){
    // Here your code !
    int a,b,c;
    cin >> a >> b >> c;
    if(a == b && a == c){
        cout << 1 << endl;
    }else if( a == b || b == c || a == c){
        cout << 2 << endl;
    }else{
        cout << 3 << endl;
    }
    
}


Measured memory_bytes: 256
// Amsal toro ma ba cheshm migaiim
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#define ll long long int
int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}
using namespace std;
//const int inf = -1e6;
//const int minf = 1e9;
const int MAXN = 1e5+10;
//const int MAXM = 105;
int a[MAXN];
int dp[MAXN];
//int Primes[10]={2 , 3 , 5 , 7 , 11 , 13 , 17 , 19 , 23 , 29};
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    // امروز اصن روز خوبی نبود :)))))))))))))))))
    for (int i = 0 ; i < n ; i++)
    {
        cin >> a[i];
    }
    
    dp[0] = 0;
    dp[1] = abs(a[1] - a[0]);
    
    for(int i = 2 ; i < n ; i++)
    {
        dp[i] = min(dp[i-1]+(abs(a[i] - a[i-1])) , dp[i-2]+(abs(a[i] - a[i-2])));
    }
    
    cout << dp[n-1] << endl;

    return 0;
}


Measured memory_bytes: 4392
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {

            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }

       




        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var abck = Reads();
            var h = abck[0];
            var w = abck[1];
            var a = new string[h];
            for (int i = 0; i < h; i++)
            {
                a[i] = Console.ReadLine();
            }
            for (int i = 0; i < w+2; i++)
            {
                Console.Write("#");
            }
            Console.WriteLine();
            for (int i = 0; i < h; i++)
            {
                Console.Write("#");

                Console.Write(a[i]);

                Console.WriteLine("#");
            }
            for (int i = 0; i < w+2; i++)
            {
                Console.Write("#");
            }
            Console.WriteLine();
            

            Console.Out.Flush();
        }
    }
}




Measured memory_bytes: 13396
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

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

int main()
{
  string s;
  cin >> s;
  int size = s.size();
  int o = count(s.cbegin(), s.cend(), 'o');
  string ans = (15 - size + o >= 8) ? "YES" : "NO";
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
Module Program

    Sub Main(args As String())

        Dim count As Integer = CInt(Console.ReadLine())
        Dim objName As List(Of String) = New List(Of String)()
        For i As Integer = 1 To count
            objName.Add(Console.ReadLine())
        Next

        Console.WriteLine(objName.Distinct().Count().ToString())

    End Sub

End Module

Measured memory_bytes: 48736
#!/usr/bin/perl
use Data::Dumper;
use POSIX qw(floor ceil);

# 引数取り込み
my $a = <>;
my ( $b, $c, $d ) = split( / /, $a );
chomp( $d );

# 処理開始
my $ans = "No";

$ans = "Yes" if( $b eq $c );
$ans = "Yes" if( $c eq $d );
$ans = "Yes" if( $d eq $b );

$ans = "No" if( $b eq $c and $c eq $d and $d eq $b );

print $ans;

1;

Measured memory_bytes: 7168
while n = gets.chomp.to_i
  break if n == 0

  sales = Hash.new(0)

  n.times do
    i, p, q = gets.chomp.split.map(&:to_i)
    value = sales[i]
    sales[i] += p * q
  end

  if sales.select { |key, value| value >= 1_000_000 }.any?
    sales.each do |key, value|
      puts key if value >= 1_000_000
    end
  else
    puts 'NA'
  end

end

Measured memory_bytes: 8808
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <queue>
#include <utility>
#include <climits>
#include <bitset>
#include <cmath>

#define MOD 1000000007

using namespace std;

typedef long long ll;

typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<vl> vvl;
typedef vector<vi> vvi;

typedef pair<ll, ll> pll;
typedef pair<int, int> pi;

typedef vector<pll> vpl;
typedef vector<pi> vpi;

typedef queue<ll> ql;
typedef queue<int> qi;

template <class T>
void printv(vector<T> vc)
{
    for (auto e : vc)
        cout << e << " ";
    cout << endl;
}

template <class T>
void printvv(vector<T> vvc)
{
    for (auto vc : vvc)
    {
        for (auto e : vc)
            cout << e << " ";
        cout << endl;
    }
}

template <class T>
void printvp(vector<pair<T, T>> vp)
{
    for (auto pT : vp)
        cout << pT.first << " " << pT.second << endl;
}

int main()
{
    int N;
    cin >> N;
    auto v = vi(N);
    for (int i = 0; i < N; ++i) cin >> v[i];
    int c;
    while (true) {
        bool flag = false;
        for (int i = 0; i < N; ++i) {
            flag = flag || v[i] % 2 == 1;
        }
        if (flag) break;
        for (int i = 0; i < N; ++i) {
            v[i] /= 2;
        }
        c++;
    }
    cout << c << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val list: List<Long> = readLine()!!.split(" ").map { it.toLong() }

    if(list[1] == 0.toLong()) {
        print("0")
        return
    }

    val count = (list[0]/(list[1] + list[2]))
    val pulas = if (list[1] < (list[0]%(list[1] + list[2]))) { 
        (count+1) * list[1]
    } else { 
       count * list[1] + (list[0]%(list[1] + list[2]))
    }

    print(pulas)
}

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

int main(){
  int a,b,e;
  e=0;
  cin>>a>>b;
  vector<vector<char>> c(a,vector<char>(a));
  vector<vector<char>> d(b,vector<char>(b));
  for(int i=0;i<a;i++){
    for(int j=0;j<a;j++)
      cin>>c.at(i).at(j);
  }
  for(int i=0;i<b;i++){
    for(int j=0;j<b;j++)
      cin>>d.at(i).at(j);
  }
  for(int i=0;i<a-b+1;i++){
    for(int j=0;j<a-b+1;j++){
      if(d.at(0).at(0)==c.at(i).at(j)){
        for(int k=0;k<b;k++){
          for(int l=0;l<b;l++){
            if(d.at(k).at(l)!=c.at(i+k).at(j+l)){
              e=1;
              break;
            }
            if(k==b-1&&l==b-1){
              e=2;
              break;
            }
          }
            if(e==1){
              e=0;
              break;
            }
            if(e==2)
              break;
        }
      }
      if(e==2)
              break;
    }
    if(e==2)
              break;
  }
  if(e==2)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define umax(x,y) x=max(x,y)
#define umin(x,y) x=min(x,y)
#define ll long long
#define ii pair<int,int>
#define iii pair<int,ii>
#define iiii pair<ii,ii>
#define sz(x) ((int) x.size())
#define orta ((bas+son)/2)
#define all(x) x.begin(),x.end()
#define inf 1000000000
#define MOD 1000000007 
#define N 100005
#define M 1000000
#define LOG 20
#define KOK 300
#define EPS 0.0000001
using namespace std;

bool vis[2005][2005];
int dp[2005][2005];
int plc[2][2005];
int u[2*2005];
int pos[2][2005][2*2005];
int n;

int f(int w,int b) {

	bool& v=vis[w][b];
	int& r=dp[w][b];

	if(v) return r;

	v=1;
	r=inf;

	int pnw=plc[0][w+1]+pos[0][w][plc[0][w+1]]+pos[1][b][plc[0][w+1]];
	int pnb=plc[1][b+1]+pos[0][w][plc[1][b+1]]+pos[1][b][plc[1][b+1]];

	if(w<n && b<n) {

		umin(r,f(w+1,b)+pnw-(w+b+1));
		umin(r,f(w,b+1)+pnb-(w+b+1));

	}
	else if(w<n) {

		umin(r,f(w+1,b)+pnw-(w+b+1));

	}
	else if(b<n) {

		umin(r,f(w,b+1)+pnb-(w+b+1));

	}
	else return r=0;

	return r;

} 

int main() {

	scanf("%d",&n);

	for(int i=1;i<=2*n;i++) {

		char c;
		int x;

		scanf(" %c %d",&c,&x);

		plc[(c=='B')][x]=i;

	}

	for(int c=0;c<2;c++) {

		memset(u,0,sizeof(u));

		for(int i=1;i<=n;i++) {

			u[plc[c][i]]=1;

			int cnt=0;

			for(int j=2*n;j>=1;j--) {

				if(u[j]) cnt++;
				else {

					pos[c][i][j]=cnt;

				}

			}

		}

	}

	printf("%d",f(0,0));

}	

Measured memory_bytes: 82944