akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>

#define get(a, i, j) *((*(a+i))+j)


typedef long long ll;

//long long **mem, **util, N;
ll mem[100001][3], util[100001][3], N;

ll dp(ll d, ll u);

int main()
{
    //freopen("input.txt", "r", stdin);

    ll i, max, temp_util;

    //util = (ll**) malloc(N * sizeof(ll*));
    //mem = (ll**) malloc(N * sizeof(ll*));

    scanf("%lld", &N);

    for(i = 0; i<N; ++i){
        //*(util+i) = (ll*) malloc(3 * sizeof(ll));
        //*(mem+i) = (ll*) calloc(3, sizeof(ll));

        scanf("%lld%lld%lld", &get(util, i, 0), &get(util, i, 1), &get(util, i, 2));
    }


    //printf("%lld\n", dp(0, 0));
    max = 0;
    temp_util = 0;

    for(i = 0; i<3; ++i){
        //printf("calling dp(const 0, %lld)\n", i);
        temp_util = dp(0, i);
        if (max < temp_util) max = temp_util;
    }

    printf("%lld\n", max);

    return 0;
}


ll dp(ll d, ll u)
{
    //printf("inside dp with d = %lld, u = %lld\n", d, u);
    if (d == N-1) {
        //printf("returning %lld without setting\n\n", get(util, d, u));
        return get(util, d, u);
    }

    if(get(mem, d, u) > 0) {
        //printf("returning %lld without setting\n\n", get(util, d, u));
        return get(mem, d, u);
    }

    ll i, max, temp_util;

    max = 0;
    temp_util = 0;
    for(i = 0; i<3; ++i){
        if(i!=u) temp_util = dp(d+1, i);
        if(temp_util>max) max = temp_util;
    }

    //printf("setting value in mem[%lld][%lld] = %lld (%lld)\n\n", d, u, get(util, d, u)+max, get(util, d, u));
    return get(mem, d, u) = get(util, d, u) + max;
}


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

int match(string S, string T){
  vector<int> key(S.size());
  int min_cost=1000;
  for(int i=0; i<(int)S.size()-(int)T.size()+1;i++){
    int cost = 0;
    for(int j=0; j<T.size(); j++){
      if(S[i+j] != T[j]){
        cost++;
      }
    }
    if(cost<min_cost){
      min_cost = cost;
    }
  }
  return min_cost;
}
        

int main(){
  string S,T;
  cin >> S >> T;
  int ans = match(S,T);
  cout << ans << endl;
}


Measured memory_bytes: 3624
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
typedef long long ll;
using namespace std;

int r, g, b;
const int INF = 10e8;
void abcarc(){
	ll x;
	cin >> x;
	cout << (x < 1200 ? "ABC" : "ARC") << endl;
}

int main() {
	abcarc();
	return 0;
}



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


int main(void){
  int n, m; cin >> n >> m;
  double M = m;
  double a[n];
  double sum = 0;
  rep(i,n){
    cin >> a[i];
    sum += a[i];
  }
  sort(a,a+n);
  if(a[n - m] / sum < 1/(4*M)){
    cout << "No" << endl;
  }
  else cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        // 標準入力からデータを読み込む準備
        Scanner sc = new Scanner(System.in);
        // 最初の文字の固まりを整数値と想定して読み込む
        while (true) {
            int H = sc.nextInt();
            int W = sc.nextInt();
            if (H == 0 && W == 0) {
                break;
            }
            // 二重ループ(forの中にfor)を書いて、H x W個の # を表示しよう！
            for (int i = 0; i < H; i++) {

                if (i % 2 == 1) {
                    for (int j = 0; j < W; j++) {

                        if (j % 2 == 1) {
                            System.out.print("#");
                        } else {
                            System.out.print(".");
                        }
                    }
                } else {
                    for (int j = 0; j < W; j++) {
                        if (j % 2 == 0) {
                            System.out.print("#");
                        } else {
                            System.out.print(".");
                        }
                    }
                }
                System.out.printf("\n");
            }
            System.out.printf("\n");
        }
    }
}


Measured memory_bytes: 37608
max_num = 10 ** 6
pri = *(0..max_num)

2.upto(max_num) do |i|
    next if pri[i] != i
    i.step(max_num, i) {|x| pri[x] = i}
end

n = gets.to_i
a = gets.split.map(&:to_i)
f = true
g = 0

a.each do |e|
    g = g.gcd(e)

    if f
        while e > 1
            x = pri[e]
            if pri[x] == 0
                f = false
                break
            else
                e /= x while e % x == 0
                pri[x] = 0
            end
        end
    end
end

if f
    puts "pairwise coprime"
elsif g == 1
    puts "setwise coprime"
else
    puts "not coprime"
end


Measured memory_bytes: 95996
a = int(input())
b = int(a//200)
if b == 2:
  print(8)
elif b == 3:
  print(7)
elif b== 4:
  print(6)
elif b== 5:
  print(5)
elif b==6:
  print(4)
elif b==7:
  print(3)
elif b==8:
  print(2)
elif b==9:
  print(1)
  
 

Measured memory_bytes: 9160
#include <iostream> // cout, endl, cin
#include <vector> // vector
#include <string> // string, to_string, stoi

using namespace std;
int main(){
    string N;
    cin >> N;

    int sum=0;
    for(int i=0;i<N.size();i++){
        char cnum = N.at(i);
        int num = atoi(&cnum);
        sum += num;
    }
    if(sum % 9 == 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3748
import java.io.{BufferedReader, InputStreamReader}

import scala.collection.mutable.ListBuffer

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val Array(h, w) = in.readLine().split("\\s+").map(_.toInt)

    val maze = (1 to h).map { _ =>
      in.readLine().toCharArray
    }

    def max(x: Int, y: Int): Int = {
      val log = Array.ofDim[Int](h, w)

      def update(step: Int, startPoints: List[(Int, Int)]): Int = {
        if (startPoints.isEmpty) {
          step - 1
        } else {
          val nexts = new ListBuffer[(Int, Int)]
          for {
            (y, x) <- startPoints
            (dx, dy) <- List((-1, 0), (1, 0), (0, -1), (0, 1))
            if x + dx != w
            if x + dx != -1
            if y + dy != h
            if y + dy != -1
            if log(y + dy)(x + dx) == 0
            if maze(y + dy)(x + dx) == '.'
          } {
            log(y + dy)(x + dx) = step + 1
            nexts.append((y + dy, x + dx))
          }
          update(step + 1, nexts.toList)
        }
      }

      log(y)(x) = -1
      update(0, List((y, x)))
    }

    System.out.println(
      (for {
        x <- (0 until w)
        y <- (0 until h)
        if maze(y)(x) == '.'
      } yield {
        max(x, y)
      }).max
    )
  }
}


Measured memory_bytes: 66028
#include <stdio.h>

int main(void)
{
    int house[4][3][10] = {};
    int n;
    int building, stage, room_n, person; 
    int i, j, k;
    
    scanf("%d", &n);
    
    for(i=0; i<n; i++){
        scanf("%d%d%d%d", &building, &stage, &room_n, &person);
        house[building-1][stage-1][room_n-1] += person;
    }
    
    for(i=0; i<4; i++){
        for(j=0; j<3; j++){
            for(k=0; k<10; k++){
                printf(" %d", house[i][j][k]);
            }
            printf("\n");
        }
        if(i<3){
            for(n=0; n<20; n++){
                printf("#");
            }
            printf("\n");
        }
    }
    
    return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<algorithm>
using namespace std;
int a[1005][1005];
int day[1005], pos[1005];
int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
		for (int j = 1; j < n; j++)
			cin >> a[i][j];
	for (int i = 1; i <= n; i++)pos[i] = 1;
	int uvis = n, flag;
	while (uvis)
	{
		flag = 0;
		for (int i = 1; i <= n; i++)
		{
			for (int j = pos[i]; j < n; j++)
			{
				if (i != a[a[i][j]][pos[a[i][j]]])break;
				flag = 1;
				day[i] = max(day[i], day[a[i][j]]) + 1;
				day[a[i][j]] = day[i];
				pos[i]++, pos[a[i][j]]++;
				if (pos[i] >= n)uvis--;
				if (pos[a[i][j]] >= n)uvis--;
			}
		}
		if (!flag)
		{
			cout << -1 << endl;
			return 0;
		}
	}
	uvis = 0;
	for (int i = 1; i <= n; i++)uvis = max(uvis, day[i]);
	cout << uvis << endl;
	return 0;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define reps(i, m, n) for (int i = m; i < n; i++)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

int main(void){
    int n, m;
    scanf("%d %d", &n, &m);
    vector<vector<int> > switch_list(n, vector<int>(0, 0));
    int k, s;
    rep(i, m){
        scanf("%d", &k);
        rep(j, k){
            scanf("%d", &s);
            switch_list[s-1].push_back(i);
        }
    }
    
    vector<int> p(m, 0);
    rep(i, m) scanf("%d", &p[i]);
    
    int ans = 0;
    rep(i, pow(2, n)){
        vector<int> light(m, 0);
        rep(j, n){
            if ((i>>j)&1 == true){
                rep(k, switch_list[j].size()) light[switch_list[j][k]]++;
            }
        }
        bool judge = true;
        rep(j, m){
            if (light[j]%2 != p[j]) judge = false;
        }
        if (judge) ans++;
    }
    
    printf("%d\n", ans);
    
    return 0;
}


Measured memory_bytes: 4252
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner (System.in);
        int N = sc.nextInt();
        int[] n = new int[N];
        int sum = 0;
        for(int i = 0;i < N;i++){
            n[i] = sc.nextInt();
        }
        Arrays.sort(n);
        for(int i = 0;i < N-1;i++){
            sum += n[i];
        }
        System.out.println(n[N-1] < sum ?"Yes":"No");
        }
    }


Measured memory_bytes: 25172
n = int(input())
v = list(map(int,input().split()))
do = [0 for i in range(100001)]
de = [0 for i in range(100001)]
for i in range(n):
    if i % 2 == 0:
        de[v[i]]+=1
    else:
        do[v[i]]+=1
if do.index(max(do))==de.index(max(de)):
    do.sort(reverse=True)
    de.sort(reverse=True)
    print(n-max(do[0]+de[1],do[1]+de[0]))
else:
    print(n-max(do)-max(de))


Measured memory_bytes: 57964
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
using namespace std;

int main(){
	int N;	//整数
	cin >> N;
	vector<int> vec(N, -1);
	for (int i = 0; i < N; ++i){
		cin >> vec[i];
	}

	double tmp = 0;
	for (int i = 0; i < N; ++i){
		tmp += 1.0 / (double) vec[i];
	}

	printf("%f\n", 1.0 / tmp);

	return 0;
}


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

int main(){

    int n;
    list<int> l;
    list<int>::iterator it;
    while(cin>>n){
        string op;
        int num;
        while(n--){
            cin>>op;
            if(op=="insert"){
                cin>>num;
                l.push_front(num);
            }
            else if(op=="delete"){
                cin>>num;
                for(it=l.begin();it!=l.end();++it){
                    if(*it==num){
                        l.erase(it);
                        break;
                    }
                        
                }
            }
            else if(op=="deleteFirst")
                l.pop_front();
            else
                l.pop_back();
        }

        int t=0;
        for(it=l.begin();it!=l.end();++it){
            if(t++) cout<<" ";
            cout<<*it;
        }
        cout<<endl;
    }
}


Measured memory_bytes: 34384
#include <bits/stdc++.h>
using namespace std;
int c[5][5];
int main() {
    ios_base::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) cin >> c[i][j];
    }
    for (int i1 = 0; i1 < 3; i1++) {
        for (int i2 = 0; i2 < 3; i2++) {
            for (int j1 = 0; j1 < 3; j1++) {
                for (int j2 = 0; j2 < 3; j2++) {
                    if (c[i1][j1] + c[i2][j2] != c[i1][j2] + c[i2][j1]) {
                        cout << "No";
                        return 0;
                    }
                }
            }
        }
    }
    cout << "Yes";
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
class Program
    {
    	static void Main(string[] args)
    	{
            string[] s1 = Console.ReadLine().Split(' ');
            int h = int.Parse(s1[0]), w = int.Parse(s1[1]), n = int.Parse(s1[2]);
            
            string[] s2 = Console.ReadLine().Split(' ');
            int sr = int.Parse(s2[0]), sc = int.Parse(s2[1]);

            string s = Console.ReadLine();
            string t = Console.ReadLine();

            
            int rMax = w - sc;
            int lMax = sc - 1;
            int rlFree = 0;
            for (int i=0; i<n; i++)
            {
                if (s[i] == 'R') rMax--;
                else if (s[i] == 'L') lMax--;

                if (rMax < 0 || lMax < 0)
                {
                    Console.WriteLine("NO");
                    return;
                }

                if (t[i] == 'L')
                {
                    rMax++;
                    rlFree = 0;
                }
                else if (t[i] == 'R')
                {
                    lMax++;
                    rlFree = 0;
                } 
                else 
                {
                    rlFree++;
                    if (rlFree >= w)
                    {
                        Console.WriteLine("NO");
                        return;
                    }
                }
            }

            int uMax = sr - 1;
            int dMax = h - sr;
            int udFree = 0;
            for (int i=0; i<n; i++)
            {
                if (s[i] == 'U') uMax--;
                else if (s[i] == 'D') dMax--;

                if (uMax < 0 || dMax < 0)
                {
                    Console.WriteLine("NO");
                    return;
                }

                if (t[i] == 'D')
                {
                    uMax++;
                    udFree = 0;
                }
                else if (t[i] == 'U')
                {
                    dMax++;
                    udFree = 0;
                } 
                else 
                {
                    udFree++;
                    if (udFree >= h)
                    {
                        Console.WriteLine("NO");
                        return;
                    }
                }
            }
            Console.WriteLine("YES");
            return;
        }
    }
    //mcs Main.cs
    //mono Main.exe

Measured memory_bytes: 13140
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<vector>
#include<functional>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll N;
ll p[200010];
int main(){
    cin>>N;
    for(ll i=0;i<N;i++){
        cin>>p[i];
    }
    ll mi=INF;
    ll ans=0;
    for(ll i=0;i<N;i++){
        mi=min(mi,p[i]);
        if(mi>=p[i]){
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

ll gcd(ll a, ll b) {
    if (a % b == 0) return b;
    else return gcd(b, a % b);
}

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

int main() {
    long long a, b, c, d;
    scanf("%ld %ld %ld %ld", &a, &b, &c, &d);

    a--;
    ll cd = lcm(c, d);
    ll nb = b / c + b / d - b / cd;
    ll na = a / c + a / d - a / cd;

    cout << b - a - (nb - na) << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sint(a) scanf("%d", &a)
#define sint2(a, b) scanf("%d %d", &a, &b)
#define sll(a) scanf("%lld", &a)
#define sll2(a, b) scanf("%lld %lld", &a, &b)
#define mem(a, i) memset(a, i, sizeof(a))
const double pi = acos(-1);
const int maxn = 1e6 + 5;
const int mod = 1e9 + 7;

ll h[maxn];
ll ex_gcd(ll a, ll b, ll &x, ll &y)
{
    if (!b)
    {
        x = 1;
        y = 0;
        return a;
    }
    else
    {
        ll d = ex_gcd(b, a % b, x, y);
        ll k = x;
        x = y;
        y = k - a / b * y;
        return d;
    }
}
void init(int x)
{
    h[0]=0;
    h[1]=1;
    for(int i=2; i<=x; i++)
        h[i]=(h[i-1]*i)%mod;
}
ll iv(ll a)
{
    ll x,y;
    if(ex_gcd(a,mod,x,y))
        return (x+mod)%mod;
}
ll zhs(ll a, ll b)
{
    if(a==0)
        return b;
     if(a==b)
        return 1;
    return h[b]*iv(h[a])%mod*iv(h[b-a])%mod;
}
int main()
{
    ll x, y;
    while (~sll2(x, y))
    {
        if((2*x-y)%3&&(2*y-x)%3)
            cout<<0<<endl;
        else
        {
            ll a,b;
            if(2*x-y>0)
            {
                a=(2*x-y)/3;
                b=x-2*a;
            }
            else
            {
                a=(2*y-x)/3;
                b=y-2*a;
            }
            init(maxn);
            if(a>=0&&b>=0)
                cout<<zhs(a,a+b)<<endl;
            else
                cout<<0<<endl;
        }
    }
    return 0;
}


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

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

    vector<int> a(n);
    rep(i,n) cin >> a[i];

    auto calc = [&](int y){
        int ret = 0;
        rep(i, n) ret += (a[i]-y)*(a[i]-y);
        return ret;
    };

    int min_n = *min_element(a.begin(), a.end());
    int max_n = *max_element(a.begin(), a.end());

    int ans = calc(min_n);
    for(int i=min_n+1; i<=max_n; i++){
        int tmp = calc(i);
        if(ans>tmp) ans = tmp;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
const int N = 2e5+1;
int A[N];
int cnt[N];
int main()
{
 	int n;
 	cin>>n;
 	for(int i=2;i<=n;i++)
 	{
 		cin>>A[i];
 		cnt[A[i]]++;
	}
	for(int i=1;i<=n;i++)
	{
		printf("%d\n",cnt[i]);
	}
	return 0;
}

Measured memory_bytes: 5212
import qualified Data.ByteString.Char8 as C
import Data.Maybe
  ( fromJust )
import Data.List
  ( findIndex, minimumBy )

main = do
  _ <- getLine
  [t,a] <- map read . words <$> getLine
  hs <- map (fst . fromJust . C.readInt) . C.words <$> C.getLine 
  
  print . findIndex4Minimum $ map (f t a . toEnum) hs

f :: Double -> Double -> Double -> Double
f t a h = abs( (t-h*0.006) - a )

findIndex4Minimum :: [Double] -> Int
findIndex4Minimum ws = snd . minimumBy c . zip ws $ [1..]
  where
    c x y = compare (fst x) (fst y)


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

int main()
{
  int n; cin >> n;
  int ans = 0;
  for(int i = 1; i < n+1; i++) {
    if (i % 2 == 0) continue;

    int yaku = 0;
    for(int j = 1; j < i + 1; j++) {
      if(i%j == 0) {
        yaku++;
      }
    }
    if (yaku == 8) {
      ans++;
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
using System;

namespace _3026
{
	class Program
	{
		static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			Console.Write("ai1333");
			for (int i = 0; i < n / 100; i++) Console.Write(3);
			Console.WriteLine();
		}
	}
}



Measured memory_bytes: 17940
#include<bits/stdc++.h>
#define LL long long 
using namespace std;
LL imosu[100001];
LL town[100001];
LL kipu[100000];
LL ickipu[100000];
LL icmn[100000];
int main(void){
	int n,m;
	cin>>n>>m;
	int i,j;
	LL ans=0;
	for(i=0;i<=n;i++)	imosu[i]=0;
	for(i=0;i<m;i++){
		cin>>town[i];
	}
	for(i=0;i<m-1;i++){
		if(town[i]<town[i+1]){
			imosu[town[i]]++;
			imosu[town[i+1]]--;
		}
		else{
			imosu[town[i+1]]++;
			imosu[town[i]]--;
		}
	}
	//sort(town,town+m);
	/*for(i=0;i<m;i++){
		d.push_back(town[i]);
	}*/
	for(i=0;i<=n;i++){
		if(0<i) imosu[i]+=imosu[i-1];
	}

	//cout<<endl;
	for(i=1;i<=n-1;i++){
		cin>>kipu[i];
		cin>>ickipu[i];
		cin>>icmn[i];
	}
	/*for(i=0;i<=n;i++){
		cout<<imosu[i]<<" ";
	}*/
	/*for(i=0;i<d.size();i++){
		cout<<d[i]<<" ";
	}*/
	ans=0;
	for(i=0;i<n;i++){
		if(imosu[i]>0){
			LL x=kipu[i]*imosu[i];
			//cout<<"D="<<town[i]<<" "<<"KIPU="<<kipu[town[i]]<<" "<<"IMOSU="<<imosu[town[i]]<<endl;
			LL y=ickipu[i]*imosu[i];
			//cout<<"D="<<town[i]<<" "<<"ICKIPU="<<ickipu[town[i]]<<" "<<"IMOSU="<<imosu[town[i]]<<endl;
			//cout<<"X="<<x<<" "<<"Y="<<y;
			//cout<<"ICMN="<<icmn[town[i]]<<endl;
			ans+=min(x,y+icmn[i]);
		}
	}
	cout<<ans<<endl;
	return 0;
}

	


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

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

  int Ans = 0;
  rep( i, 1, N+1 ) {
    if (     1<=i && i<=    9 ) Ans++;
    if (   100<=i && i<=  999 ) Ans++;
    if ( 10000<=i && i<=99999 ) Ans++;
  }
  cout << Ans << endl;
}


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

int main()
{
	char chIn[20] = { '\0' };
	int n = 0, nIn = 0;
	list<int> lIn;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		cin >> chIn;
		if ('i' == chIn[0])
		{
			cin >> nIn;
			lIn.push_front(nIn);
		}
		else if ('F' == chIn[6])
		{
			lIn.pop_front();
		}
		else if ('L' == chIn[6])
		{
			lIn.pop_back();
		}
		else
		{
			cin >> nIn;
			for (auto a = lIn.begin(); a != lIn.end(); ++a)
			{
				if (*a == nIn)
				{
					lIn.erase(a);
					break;
				}
			}
		}
	}
	n = 0;
	for (auto a = lIn.begin(); a != lIn.end(); ++a)
	{
		if (n++)
		{
			cout << " ";
		}
		cout << *a;
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 34376
#include<bits/stdc++.h>
#define lld long long int
#define vec vector<lld>
#define pll pair<lld,lld>
#define pb push_back
#define ss second
#define ff first
#define mp make_pair
#define mod 1000000007
#define answer cout<<endl<<"answer : ";
#define maxn 100005
#define messi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main() {messi lld t=1;//cin>>t;
    while(t--)
    {
        lld n=0,m=0,k=0,i=0,j=0,p=0,q=0,x=0,y=0,z=0,ans=0,cnt=0;string s;bool flag=false;
        cin>>x>>y;
        p=max((lld)-1000000,y-x+1);
        q=min((lld)1000000,y+x-1);
        for(i=p;i<=q;i++)
            cout<<i<<" ";
        cout<<endl;
    }
	return 0;
}
/*  CODED BY:-
 ________________________________________
|            __        __                |
|  /\   /\  |__)  /\  |  \ |__| \ /  /\  |
| /~~\ /~~\ |  \ /~~\ |__/ |  |  |  /~~\ |
|________________________________________|

*/


Measured memory_bytes: 3628
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,b,n) for(int i=b;i<n;i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

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

int main(){
	int n;
	int board[9][9];
	char board1[9][9];
	cin>>n;
	int N =n;
	while(n--){
		string str;
		for(int j =1;j <=8;j++){
			cin>>board1[j];
		}
		for(int i=1;i <=8;i++){
			for(int j=1;j <=8;j++){
				board[i][j]=board1[i][j-1]-'0';
			}
		}
		queue<pii> bom;
		int x,y;
		scanf("%d %d",&x,&y);
		bom.push(pii(y,x));
		while(!bom.empty()){
			int nx = bom.front().second;
			int ny = bom.front().first;
			bom.pop();
			board[ny][nx]=0;
			//右方向
			for(int i = 1;i <= 3;i++){
				if(nx+i<=8&&board[ny][nx+i]==1){
					bom.push(pii(ny,nx+i));
					board[ny][nx+i]=0;
				}
			}
			//上方向
			for(int i = 1;i <=3;i++){
				if(ny-i>=1&&board[ny-i][nx]==1){
					bom.push(pii(ny-i,nx));
					board[ny-i][nx]=0;
				}
			}
			//下方向
			for(int i = 1;i <=3;i++){
				if(ny+i<=8&&board[ny+i][nx]==1){
					bom.push(pii(ny+i,nx));
					board[ny+i][nx]=0;
				}
			}
			//左方向
			for(int i =1;i <=3;i++){
				if(nx-i>=1&&board[ny][nx-i]==1){
					bom.push(pii(ny,nx-i));
					board[ny][nx-i]=0;
				}
			}
		}
		printf("Data %d:\n",N-n);
		for(int i=1;i <=8;i++){
			for(int j= 1;j <=8;j++){
				cout <<board[i][j];
			}
			cout <<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1280
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();
        }
        public static long kaijyo(long n)
        {
            long inf = (long)Math.Pow(10, 9) + 7;
            long anwer = 1;
            for (int i = 2; i <=n; i++)
            {
                anwer = anwer * i % inf;
            }
            return anwer;
        }

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

            Console.Out.Flush();
        }
    }
}

Measured memory_bytes: 11092
#include<iostream>
using namespace std;
int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    for(int i = a; i <= a * b; i += a){
        if(i % b == c){
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}

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

int main()
{

    int i,j,k,n,x,y,z,a,b,c;
    string s,sp;
    cin>>s;
    sp=s;
    reverse(s.begin(),s.end());
    if(s!=sp)
    {
        cout<<"No";
        return 0;
    }
    n=s.size();
    x=(n-1)/2;
    y=(n+3)/2;
    a=x/2;
    b =(n+y)/2;
    x--;
    y--;
    for(i=0;i<a;i++)
    {
        if(s[i]!=s[x-i])
        {
            cout<<"No";
            return 0;
        }
    }
    for(i=y,c=0;i<b;i++,c++)
    {
        if(s[i]!=s[n-1-c])
        {
            cout<<"No";
            return 0;
        }
        //c++;
    }
    cout<<"Yes";
    return 0;

}


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

int main()
{
  string s, t, temp;
  int a, b;
  
  cin >> s >> t >> a >> b >> temp;
  
  if(s == temp)
    a--;
  else
    b--;
  
  cout << a << " " << b << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int K,N;
  cin>>K>>N;
  int house[N+9],distance[N+9];
  for(int i=0;i<N;i++){
    cin>>house[i];
  }
  
  for(int i=0;i<N;i++){
    distance[i]=house[i+1]-house[i];
    if(i==N-1){
      distance[i]=K-house[i]+house[0];
    }
  }
  
  int max=distance[0];
  for(int i=1;i<N;i++){
    if(distance[i]>max){
      max=distance[i];
    }
  }
  
  cout<<K-max<<endl;
}

Measured memory_bytes: 1792
from itertools import groupby, accumulate

N = int(input())
S = input()

l = [len(list(g)) for k, g in groupby(S)]
if S[0] == ".":
    l.pop(0)
if S[-1] == "#":
    l.pop()

if len(l) == 0:
    print(0)
    exit()

min_num = 10**18

black = [0] + list(accumulate(l[::2]))
white = [0] + list(accumulate(l[1::2]))

x = len(l)//2
for i in range(x+1):
    m = (black[i] - black[0]) + (white[x] - white[i])
    min_num = min(m, min_num)

print(min_num)


Measured memory_bytes: 14244
import sys
input = sys.stdin.readline
def print_ans(A, B):
    """Test Case
    >>> print_ans(-13, 3)
    -10
    >>> print_ans(1, -33)
    34
    >>> print_ans(13, 3)
    39
    """
    print(max(max(A + B, A - B), A * B))

if __name__ == '__main__':
    A, B = map(int,input().rstrip().split())
    print_ans(A, B)


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

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


int main()
{
  int A, B, K;
  cin >> A >> B >> K;
  REP(i, K) {
    if (i%2 == 0) {
      if (A % 2 == 1) A--;
      A /= 2;
      B += A;
    } else {
      if (B % 2 == 1) B--;
      B /= 2;
      A += B;
    }
  }
  cout << A << ' ' << B << endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int min(int a, int b){
  if(a>b)
    return b;
  else
    return a;
}


int main(void){
  int A, B, C, D;
  cin >> A >> B >> C >> D;

  int price_min = 0;
  price_min += min(A, B);
  price_min += min(C, D);

  cout << price_min << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
#define pb push_back
#define ll long long
ll n , m , k ;
const ll N= 100 ;
ll a[N][N] , cost[N] ;

int main() {

    cin >> n >> m >> k ;
    ll i , j ;
    for(i = 0 ; i< n ;i++) {
        cin >> cost[i] ;
           for (j =0  ; j< m ; j++) cin >> a[i][j] ;
    }
    ll ans = LLONG_MAX ;
    for ( i = 0 ; i <= (1<<n) ; i++) {
            ll temp = 0 ;
            ll x[N] = {} ;
        for ( j = 0 ; j< n ; j++) {
            if ( i& (1<<j) ) {
                temp+=cost[j] ;
               // cout << j << ' ' ;
                for (ll l = 0 ; l< m ; l++) x[l]+=a[j][l] ;
            }
        }
        ll t = 1 ;
        for (ll l = 0 ; l< m ; l++) if ( x[l] < k ) t = 0 ;
        if (t) ans = min(ans,temp) ;
        //cout << temp << endl ;
    }
    cout  <<( ans== LLONG_MAX ? -1 : ans ) ;


    return 0 ;
 }


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

#define REP(i, n) for(int i=0; i<n;i++)
#define REPR(i, n) for(int i=n-1 ; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)

#define INF 2e9
#define ll long long

int main(){
    int l, r;
    cin>>l>>r;
    int i, j;
    int min = 2020;
    int ans;
    if(r-l>=673){
        cout<<"0"<<endl;
        return 0;
    }
    else{
        for(i=l; i<r; i++){
            for(j=i+1; j<=r; j++){
                ans = (i%2019) * (j%2019) % 2019;
                if(min>ans){
                    min = ans;
                }
            }
        }
        cout<<min<<endl;
        return 0;
    }
}

Measured memory_bytes: 256
#include<cstdio>

int main(void){
	bool isOdd=false;
	int n, a[100000], _min=2000000000, i;
	long long int sum=0;
	scanf("%d", &n);
	for(i=0; i<n; ++i){
		scanf("%d", a+i);
		isOdd=(a[i]<0)?!isOdd:isOdd;
		sum+=(a[i]<0)?-a[i]:a[i];
		_min=(_min>((a[i]<0)?-a[i]:a[i]))?((a[i]<0)?-a[i]:a[i]):_min;
	}
	printf("%lld\n", (isOdd)?sum-_min*2:sum);
	
	return(0);
}

Measured memory_bytes: 512
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

pub fn bsearch<F>(ok: i64, ng: i64, pred: F) -> Option<i64>
where
    F: Fn(i64) -> bool,
{
    let orig_ok = ok;
    let mut ok = ok;
    let mut ng = ng;
    while (ok - ng).abs() > 1 {
        let mid = (ok + ng) / 2;
        if pred(mid) {
            ok = mid;
        } else {
            ng = mid;
        }
    }
    if ok == orig_ok {
        None
    } else {
        Some(ok)
    }
}

fn solve() {
    input! {
        n: usize, k: u64,
        mut av: [u64; n],
        mut fv: [u64; n],
    };

    av.sort();
    fv.sort_by_key(|&x| -(x as i64));
    let res = bsearch(10_i64.pow(18), -1, |x| {
        let mut rest = k as i64;
        for i in 0..n {
            let a = av[i];
            let max_a = x as u64 / fv[i];
            if a > max_a {
                rest -= (a - max_a) as i64;
            }
        }
        rest >= 0
    });
    println!("{}", res.unwrap());
}

fn main() {
    std::thread::Builder::new()
        .name("big stack size".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(|| {
            solve();
        })
        .unwrap()
        .join()
        .unwrap();
}


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

int main() {
  
  int a,b,c,d,x;
  double da,db;
  string s,ss,sss;
  
  int ans = 0;
  string anss = "";
  
  cin >> s;
  
  int ab [] = {0 , 1 , 3 , 1 , 2 , 1 , 2 , 1 , 1 , 2 , 1 , 2 , 1};
  int result3 = std::max({a, b, c});
//--------------------------------------------------------------------------------

  if(s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) anss = "Yes";
  else if(s[1] == s[2] && s[1] != s[0] && s[0] == s[3]) anss = "Yes";
  else if(s[0] == s[2] && s[1] != s[2] && s[1] == s[3]) anss = "Yes";
  else anss = "No";

  cout << anss << endl;

}

Measured memory_bytes: 256
N = int(input())

H = list(map(int,input().split(" ")))
H_orig = H[:]
heights = [0 for i in range(N)]

#print(H,N,heights)

cnt = 0

while True:
    #print(heights,H)
    if min(H) > min(heights):
        for i in range(N):
            heights[i] += 1
            H[i] -= 1
        cnt += 1
    else:
        flag = False
        for i in range(N):
            #H[i]
            if H[i] > 0:
                heights[i] += 1
                H[i] -= 1
                flag = True
            else:
                if flag:
                    cnt += 1
                    flag = False
                    
            if i == N-1 and flag:
                cnt += 1
        
    if H_orig == heights:
        break
    
print(cnt)


Measured memory_bytes: 3064
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val s = readLine()!!
    (0 until n - 2)
            .filter {
                "${s[it]}${s[it + 1]}${s[it + 2]}" == "ABC"
            }
            .count()
            .let { println(it) }
}


Measured memory_bytes: 33828
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <numeric>
#include <regex>
#include <climits>

#define FOR(i, f, n) for(int (i) = (f); (i) < (n); (i)++)
#define RFOR(i, f, n) for(int (i) = (f); (i) >= (n); (i)--)
#define REP(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define RREP(i, n) for(int (i) = (n); (i) >= 0; (i)--)
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for(int (i) = (n); (i) >= 0; (i)--)
#define forin(i, a) for(auto i: (a))
#define p(...) printf(__VA_ARGS__); cout << endl;
#define in(...) __VA_ARGS__; input__(__VA_ARGS__);
#define input(...) in(__VA_ARGS__)
#define out(...) output__(__VA_ARGS__);
#define output(...) out(__VA_ARGS__)
#define list_input(x, n) x[(n)]; for(int (i) = 0; (i) < (n); (i)++) cin >> x[i];
#define lambda(a, b, c) [](auto const &a, auto const &b){ return c ;}
#define key(t, x, compare) [](const t &a, const t &b){ return a x compare b x ;}
#define unless(a) if(!(a))

using namespace std;

using pii = pair<int, int>;

template <class... T>
void input__(T &...a) {
  for(auto v: {&a...}) {
    cin >> *v;
  }
}

void output__(){
  cout << endl;
}

template <class Head, class... T>
void output__(Head const &v, T const &...a) {
  if(sizeof...(a) == 0) {
    cout << v;
  } else {
    cout << v << " ";
  }
  output__(a...);
}

int main(){
  long in(n);
  long list_input(a, n);

  int n4 = 0;
  int n2 = 0;
  int n1 = n;
  rep(i, n) {
    if(a[i] % 4 == 0) {
      n4++;
    } else if(a[i] % 2 == 0) {
      n2++;
    }
  }

  int other = n1 - n4;
  if(n4 + 1 >= other) {
    out("Yes");
  } else if(n2 % 2 == 0 and other == 0) {
    out("Yes");
  } else if(n4 + 1 >= (n1 - (n2 / 2) * 2 - n4)) {
    out("Yes");
  } else {
    out("No");
  }
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
 
using namespace std;
 
int main()
{
  string S;
  cin >> S;
  int sum = 0;
  for(int i = 0; i < S.size(); i++) {
    if(S[i] == '(') {
      ++sum;
    } else if(S[i] == ')') {
      --sum;
    } else {
      cout << sum << endl;
    }
  }
}

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//MOD
//--------------------------------------------
#define MUL(a,b) (((a) % MOD) * ((b) % MOD)) % MOD

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//main code

int main(int argc, char const* argv[])
{
	int a,b;
	cin >> a >> b;
	if (a ==  b) {
		cout << a*2 << endl;
	}
	else {
		int c = max(a,b);
		cout << 2*c - 1 << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dunk(n) cout << n << endl
#define all(v) v.begin(), v.end()


int main() {
    int h,a;
    cin>>h>>a;
    
    int n;
    n=h/a;
    if(h%a==0) dunk(n);
    else dunk(n+1);
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main (){
	int a;
	int b;
	scanf("%d",&a);
	scanf("%d",&b);
	if(a==b){
		printf("Draw\n"); 
	}
	else if(a==1){
		printf("Alice\n");
	}
	else if(b==1){
		printf("Bob\n");
	}
	else if(a>b){
		printf("Alice\n");
	}
	else if(a<b){
		printf("Bob\n");
	}
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef map<int, int> mii;
typedef map<char,int> mci;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vii;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define F first
#define S second
#define in insert
const int INF = 1e9 + 7;


int main(){
    string s; cin>>s;
    int ans = INF;
    for(int i = 0; i < s.size()-2; i++){
        int cur = (s[i]-'0') * 100 + (s[i+1]-'0')*10 + (s[i+2]-'0');
        ans = min(ans,abs(753-cur));
    }
    cout<<ans;

}

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

int main(){
    int n, x;
    int count=0;
    while(true){
        cin>>n>>x;
        if(n==0&&x==0) break;
        count=0;
        for(int i=1;i<=n;i++){
            for(int j=i+1;j<=n;j++){
                if(x-i-j>j&&x-i-j<=n){
                    count++;
                }
            }
        }
        cout<<count<<endl;
    }
}


Measured memory_bytes: 3108
//Author ::  ABHINAV3010 ::

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define fast ios_base::sync_with_stdio(false)
typedef long long ll;
typedef pair<ll,ll> p;
ll mod=1000000007;
ll gcd(ll a,ll b)
{
    return (b==0)?a:gcd(b,a%b);
}
ll power(ll x, ll y, ll p=mod)
{ll res = 1;x = x % p;while (y > 0){if (y & 1){res = (res*x) % p;}y = y>>1;x = (x*x) % p;}return res;}
int main()
{
fast;
ll n,m;
cin>>n>>m;
ll ans=0;
ans+=(n*(n-1))/2;
ans+=(m*(m-1))/2;
cout<<ans<<endl;
return 0;
}


Measured memory_bytes: 764
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			String in = sc.next();
			int max = 0;
			int count = 0;
			String base = "ACGT";
			boolean continuous = false;
			for (String c : in.split("")) {
				if (base.contains(c)) {
					if (continuous) {
						count++;
					}
					else {
						count = 1;
						continuous = true;
					}
					if (count > max) {
					    max = count;
					}
					continue;
				}
				continuous = false;
			}
            System.out.println(max);
		}
	}
}

Measured memory_bytes: 23508
#include<bits/stdc++.h>
using namespace std;
#define int ll
#define ll long long
using pi=pair<int,int>;
#define mp make_pair
signed main(){
  int n,t;
  cin>>n>>t;
  vector<pi> v(n);
  for(auto& i:v)cin>>i.first>>i.second;
  vector<vector<int>> dpl(n,vector<int>(t,0));
  
  sort(v.begin(),v.end(),[](pi a,pi b){return a.first<b.first;});
  for(int i=v[0].first;i<t;++i)dpl[0][i]=v[0].second;
  
  for(int i=1;i<n;++i){
    for(int j=0;j<t;++j)dpl[i][j]=dpl[i-1][j];
    for(int j=v[i].first;j<t;++j){
      dpl[i][j] = max(dpl[i][j],dpl[i-1][j-v[i].first]+v[i].second);
    }
  }
  
  int res=0;
  for(int i=0;i<n;++i){
    int resi = 0;
    for(int j=0;j<t;++j){
      resi = max(resi,i-1<0?0:dpl[i-1][j]);
    }
    res=max(res,resi+v[i].second);
  }
  cout<<res;
}

Measured memory_bytes: 70784
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    
    int a,b,c;
    int ans = 0;
    cin >> a >> b >> c;
    for(int i = a; i <= b; i++){
        if(c % i == 0){
            ans++;
        }
    }
    cout << ans << endl;
    
}



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

int gcd(int a,int b)
{
    if(a>b) swap(a,b);
    if(a==1)
        return 1;
    else if(b%a==0)
        return a;
    else
        return gcd(b%a,a);
}

int main()
{
    int n;
    cin>>n;
    int d = gcd(360,n);
    cout<<360/d;
}


Measured memory_bytes: 3628
#include<iostream>
#include<cstdio>
#include<iomanip>
#include<algorithm>
using namespace std;
int num[3];
int main() {
	int a, b; cin>>a>>b;
	cout<<a/b<<" "<<a%b<<" ";
	cout<<fixed<<setprecision(5)<<a*1.0/(b*1.0)<<endl;
	return 0;
}


Measured memory_bytes: 3256
program A326B
    implicit none
    integer(8)::N,K,ans,i
    integer(8),allocatable,dimension(:)::H
    read*,N,K
    allocate(H(N))
    read*,H
    call heapsort(N,H)
    ans=H(N)-H(N-K+1)

    do i=1,N-K+1
        ans=min(ans,H(i+K-1)-H(i))
    end do

    print'(i0)',ans
end program A326B

subroutine heapsort(n,array)
    implicit none
    integer(8),intent(in) :: n
    integer(8),intent(inout) :: array(1:n)
   
    integer(8) ::i,k,j,l
    integer(8) :: t
   
    if(n.eq.1)return
  
    l=n/2+1
    k=n
    do while(k.ne.1)
       if(l.gt.1)then
          l=l-1
          t=array(L)
       else
          t=array(k)
          array(k)=array(1)
          k=k-1
          if(k.eq.1) then
             array(1)=t
             exit
          endif
       endif
       i=l
       j=l+l
       do while(j.le.k)
          if(j.lt.k)then
             if(array(j).lt.array(j+1))j=j+1
          endif
          if (t.lt.array(j))then
             array(i)=array(j)
             i=j
             j=j+j
          else
             j=k+1
          endif
       enddo
       array(i)=t
    enddo
  
    return
  end subroutine heapsort

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

using namespace std;
using LL = long long int;

#define int long long

const int MAX_N = 100005;

int N;
LL L;
string S[MAX_N];

class Node{
public:
  int next[2];
  Node()
  {
    next[0] = next[1] = -1;
  }
}Node[MAX_N];
int NodeSize = 1;
const int RootNode = 0;

void addTrie(const string &str, int strIndex = 0, int nodeIndex = RootNode)
{
  if(strIndex >= (int)str.length()) {
    return;
  }
  int nextNodeIndex;
  if(Node[nodeIndex].next[str[strIndex] - '0'] == -1){
    nextNodeIndex = NodeSize; NodeSize++;
    Node[nodeIndex].next[str[strIndex] - '0'] = nextNodeIndex;
  } else {
    nextNodeIndex = Node[nodeIndex].next[str[strIndex] - '0'];
  }

  addTrie(str, strIndex+1, nextNodeIndex);
}

vector<int> G;
void setG(int pos = RootNode, int depth = 0)
{
  if(Node[pos].next[0] == -1 || Node[pos].next[1] == -1) {
    if(Node[pos].next[0] == -1 && Node[pos].next[1] == -1) {
      return;
    } else {
      G.push_back(L - depth);
    }
  }
  if(Node[pos].next[0] != -1)
    setG(Node[pos].next[0], depth+1);
  if(Node[pos].next[1] != -1)
    setG(Node[pos].next[1], depth+1);
}

int grundy(int g)
{
  LL n = (LL)1 << 32;
  while(g%n != 0) {
    n >>= 1;
  }
  return n;
}

signed main()
{
  cin >> N >> L;
  for(int i = 0; i < N; i++) {
    cin >> S[i];
    addTrie(S[i]);
  }

  setG();

  int ans = 0;
  for(unsigned int i = 0; i < G.size(); i++) {
    //cerr << G[i] << " ";
    ans ^= grundy(G[i]);
  }
  //cerr << endl;

  if(ans == 0) {
    cout << "Bob" << endl;
  } else {
    cout << "Alice" << endl;
  }

  return 0;
}


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

int main(){
    vector<vector<int>> A(3, vector<int>(3));
    vector<vector<bool>> bingo(3, vector<bool>(3, false));

    for(int i=0; i<3; i++){
        for(int j=0; j<3; j++){
            cin>> A[i][j];
        }
    }

    int N;
    cin>> N;


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

        for(int j=0; j<3; j++){
            for(int k=0; k<3; k++){
                if(b[i] == A[j][k]){
                    bingo[j][k] = true;
                }
            }
        }
    
    }

    for(int i=0; i<3; i++){
        if(bingo[i][0] && bingo[i][1] && bingo[i][2]){
            cout<<"Yes"<<endl;
            return 0;
        }
        if(bingo[0][i] && bingo[1][i] && bingo[2][i]){
            cout<<"Yes"<<endl;
            return 0;            
        }
        if(bingo[0][0] && bingo[1][1] && bingo[2][2]){
            cout<<"Yes"<<endl;
            return 0;                       
        }
        if(bingo[0][2] && bingo[1][1] && bingo[2][0]){
            cout<<"Yes"<<endl;
            return 0;                       
        }        
    }

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

Measured memory_bytes: 3624
n=int(input())
g=[]
for i in range(n):
    u,k,*varray= map(int,input().split())
    g.append(varray)

time = 1
d= [-1]* n
f= [-1]* n

def dfs(src):
    global time
    d[src]= time
    time+=1
    for i in g[src]:
        if d[i-1]== -1:
            dfs(i-1)
    f[src]= time
    time+=1

for i in range(n):
    if d[i]== -1:
        dfs(i)
for i in range(n):
    print(i+1,d[i],f[i])


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

#define PI 3.14159265359
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descsort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;

int main(void)
{
    string s;
    cin>>s;
    int ans;
    if(0==count(s.begin(),s.end(),'R'))ans=0;
    else if(1==count(s.begin(),s.end(),'R'))ans=1;
    else if(3==count(s.begin(),s.end(),'R'))ans=3;
    else {
        if(s[1]=='S')ans=1;
        else ans=2;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3624