akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <map>
#include <queue>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

long long T1, A1, B1, X1;
long long T2, A2, B2, X2;

int signs(long long val) {
	if (val > 0) return 1;
	if (val == 0) return 0;
	return -1;
}

int main() {
	cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;
	X1 = T1 * (B1 - A1);
	X2 = T2 * (B2 - A2);

	if (X1 + X2 == 0) {
		cout << "infinity" << endl;
	}
	else if (signs(X1) == signs(X1 + X2)) {
		cout << "0" << endl;
	}
	else {
		long long V1 = -1LL * (X1 + X2);
		long long V2 = X1;
		if (V1 < 0) { V1 *= 1LL; V2 *= 1LL; }
		long long C = (V2 + V1) / V1; C *= 2LL; C -= 1LL;
		if (V2 % V1 == 0) C -= 1LL;
		cout << C << endl;
	}
	return 0;
}

Measured memory_bytes: 3620
import java.util.*;
 
class Main {
        public static void main(String args[]) {
               // new Thread(null, () -> {
                        try(Scanner sc = new Scanner(System.in)){
                                boolean[] prime = new boolean[100000005];
                                prime[0] = true; prime[1] = true;
                                for (int i = 2; i <= Math.sqrt(100000005); i++) {
                                        if (!prime[i]) {
                                                int j = 2;
                                                while (i * j < 100000005) {
                                                        prime[i*j] = true;
                                                        j++;
                                                }
                                        }
                                }
                                int N = sc.nextInt();
                                int ans = 0;
                                for (int i = 0; i < N; i++) {
                                        if (!prime[sc.nextInt()]) {
                                                ans++;
                                        }
                                }
                                System.out.println(ans);
                        }
                //}, "", 1<<24).start();
        }
}

Measured memory_bytes: 139040
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	vector<int>height(n);
	for (int i = 0; i < n; i++)
	{
		int d;
		cin >> d;
		height[i] = d;
	}
	vector<int>dp(n + 1);
	dp[0] = 0;
	dp[1] = abs(height[0] - height[1]);
	for (int i = 2; i < n; i++)
	{
		int pehla_op = abs(height[i] - height[i - 2]) + dp[i - 2];
		int dusra_op = abs(height[i] - height[i - 1]) + dp[i - 1];
		//cout << pehla_op << "   " << dusra_op << endl;
		dp[i] = min(pehla_op, dusra_op);
	}
	cout << dp[n - 1];
	return 0;
}

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

#define NUM_SIZE 100000

struct Q{
    string qname;
    int t;
};

class Queue
{
private:
    Q q[NUM_SIZE];

public:
    int head, tail = 0;
    
    Queue(){
        head = tail = 0;
    }
    bool isEmpty(){
        return head == tail;
    }
    bool isFull(){
        return head == (tail+1) % NUM_SIZE;
    }
    void enqueue(Q q_new){
        if (isFull()){
            runtime_error("buffer is full");
        }else{
            q[tail] = q_new;
            tail = (tail+1) % NUM_SIZE;
        }
    }
    
    Q dequeue(){
        if (isEmpty()){
            runtime_error("buffer is empty");
        }else{
            Q q_old = q[head];
            head = (head+1) % NUM_SIZE;
            return q_old;
        }
    }
};

int main(void){
    int n, timeout;
    cin >> n >> timeout;
    
    string qname,qnames[n];
    int time,times[n];
    Queue q;
    int elapse = 0;
    
    for (int i = 0; i < n; i++){
        cin >> qname >> time;
        Q new_q;
        new_q.qname = qname;
        new_q.t = time;
        q.enqueue(new_q);
    }
    
    while (q.head != q.tail){
        Q q_old = q.dequeue();
        int c = min(timeout, q_old.t);
        q_old.t -= c;
        elapse += c;
        if (q_old.t) q.enqueue(q_old);
        else{
            cout << q_old.qname << " " << elapse << endl;
        }
    }
    
    return 0;
}


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

int main(void)
{
	int n = 0, max = -1000001, min = 1000001, a;
	long long sum = 0;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a;
		sum += a;
		if (a < min)
			min = a;
		if (a > max)
			max = a;
	}
	cout << min << " " << max << " " << sum << endl;
}


Measured memory_bytes: 3080
import sys

readline = sys.stdin.buffer.readline


def binary_search(A, n, p):
    if p == "+":
        n += 0.5
    else:
        n -= 0.5

    left = 0
    right = len(A) - 1

    if n < A[0]:
        return 0
    else:
        while left <= right:
            mid = (left + right) // 2
            if A[mid] < n:
                left = mid + 1
            else:
                right = mid - 1

        return left


def main():
    N = int(readline())
    A = list(map(int, readline().split()))
    B = list(map(int, readline().split()))
    C = list(map(int, readline().split()))

    A, B, C = sorted(A), sorted(B), sorted(C)

    cnt = 0
    for b in B:
        ab = binary_search(A, b, "-")
        bc = N - binary_search(C, b, "+")
        cnt += ab * bc

    print(cnt)


main()


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

int main() {
	int R;
	cin >> R;
	string result;

	if (R < 1200) result = "ABC";
	else if (R < 2800) result = "ARC";
	else result = "AGC";

	cout << result << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<string.h>
#include<stdio.h>
using namespace std;
const int maxn=305;
const int inf=0x7fffffff;
int r[maxn][maxn]; 
bool visit[maxn];
int pre[maxn];
int m,n;
int x,prin[100000];
bool bfs(int s,int t)  
{
    int p;
    queue<int > q;
    memset(pre,-1,sizeof(pre));
    memset(visit,false,sizeof(visit));

    pre[s]=s;
    visit[s]=true;
    q.push(s);
    while(!q.empty())
    {
        p=q.front();
        q.pop();
        for(int i=1;i<=n;i++)
        {
            if((r[p][i]>0||r[i][p]>0)&&!visit[i])
            {
                r[p][i]=1;
                pre[i]=p;
                visit[i]=true;
                if(i==t) return true;
                q.push(i);
            }
        }
    }
    return false;
}
int num[305][305]={0};
int EdmondsKarp(int s,int t)
{
   int flow=0,d,i;
   while(bfs(s,t))
   {
       d=inf;
       for(i=t;i!=s;i=pre[i])
       d=d<r[pre[i]][i]? d:r[pre[i]][i];
       for(i=t;i!=s;i=pre[i])
       {
           if(r[pre[i]][i]&&r[i][pre[i]])
           prin[x++]=num[i][pre[i]]+1;
           //cout<<num[i][pre[i]]<<endl;
           r[pre[i]][i]=0;
           r[i][pre[i]]=0;
       }
       flow+=d;
   }
   return flow;
}

int a,b;
int main()
{
    while(scanf("%d%d",&n,&m)!=EOF)
    {
        int u,v;
        memset(r,0,sizeof(r));
        for(int i=0;i<m;i++)
        {
            scanf("%d%d",&u,&v);
            num[v][u]=i;
            num[u][v]=i;
            r[u][v]+=1;
        }
        scanf("%d%d",&a,&b);
        x=0;
        printf("%d\n",EdmondsKarp(a,b));
        cout<<x<<endl;
        for(int i=0;i<x;i++)
        printf("%d\n",prin[i]);

    }
    return 0;
}

Measured memory_bytes: 1984
#include <bits/stdc++.h>
using namespace std;
typedef long long Long;
typedef vector<int> VI;
typedef vector<VI> VVI;


int main() {
	int N;
	cin >> N;
	int sq = sqrt(2*N);
	if (sq * (sq+1) == 2*N) {
		cout << "Yes" << endl;
		sq++;
		VVI V(sq);
		cout << V.size() << endl;
		int idx = 0;
		for (int i = 0; i < sq; ++i) {
			for (int j = i + 1; j < sq; ++j) {
				V[i].push_back(idx);
				V[j].push_back(idx);
				idx++;
			}
		}
		for (int i = 0; i < sq; ++i) {
			cout << V[i].size() << " ";
			for (int j = 0; j < V[i].size(); ++j) {
				cout << V[i][j]+1 << " ";
			}
			cout << endl;
		}
	} else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
 
using namespace std;
 
#define M 			50005
#define Fi			first
#define stop 		return
#define Se 			second
#define S(n) 		cin >> n
#define P(n) 	 	cout << n
#define mp 			make_pair
#define pb 			push_back
#define pp 			pop_back
#define pf 			pop_front
#define start 		int main()
#define sp   		cout << " "
#define nl      	cout << "\n"
#define	mem(n, a)	memset((n), (a), sizeof(n))
#define prec(n)		cout << fixed << setprecision(n)
#define F(i, n, r)  for(int i = (n); i < (r); i ++)
#define PI			3.14159265358979323846264338327951
#define fast 		ios_base:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
 
using ll = long long;
using ss = stringstream;
using ul = unsigned long long;
 
typedef set < int > 		st;
typedef vector < ll > 		vl;
typedef vector < int > 		vi;
typedef map < ll, ll > 		ml;
typedef pair <int, int> 	pr;
typedef vector < string > 	vs;
typedef map < string, ll > 	ms;
typedef map < string, int > mi;
typedef vector < pr > 		vp;
 
template < typename T > inline T LCM(T a, T b) 		 { return (a * b) / GCD(a, b); }
template < typename T > inline T GCD(T a, T b) 		 { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > inline T _max(T a, T b, T c) { return max( max( a, b ), c ); }
template < typename T > inline T _min(T a, T b, T c) { return min( min( a, b ), c ); }
 
const int inf 	  =  99999999;
const int neg_inf = -99999999;

start
{
    fast;
    int x, y, z;
    S(x), S(y), S(z);
    x -= z;
    int o = 0;
    int count = 0;
    while(1) {
        if(o + y + z > x) {
            break;
        }
        count ++;
        o += y + z;
    }
    P(count), nl;
    stop 0;
}

Measured memory_bytes: 256
// Original: https://github.com/tanakh/competitive-rs
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($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)*}
    };
}

#[allow(unused_macros)]
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)*}
    };

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

#[allow(unused_macros)]
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, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::HashMap;

fn main() {
    input!(n: usize, m: usize, a: [i64; m]);
    const MOD: i64 = 1_000_000_007;

    let mut ok = vec![true; n + 1];
    for &i in a.iter() {
        ok[i as usize] = false;
    }

    let mut dp = vec![0i64; n + 10];
    dp[0] = 1;
    for now in 0..n + 1 {
        for next in (now + 1)..now + 3 {
            if next >= n + 1 {
                continue;
            }
            if ok[next] {
                dp[next] += dp[now];
                dp[next] %= MOD;
            }
        }
    }

    println!("{}", dp[n]);
}


Measured memory_bytes: 6396
#include<stdio.h>
#define MAX 500000
#define BIG 1000000000
int L[MAX/2+2],R[MAX/2+2];
int count=0;
void merge(int A[], int n,int left, int mid, int right);
void mergeSort(int A[],int n, int left,int right);

int main() {
  int A[MAX],i,n;
  scanf("%d\n", &n);
  for (i = 0; i < n; i++) scanf("%d\n", &A[i]);

  mergeSort(A,n,0,n);

   for(i=0;i<n;i++) {
     if(i != 0) printf(" ");
     printf("%d",A[i]);
   }
   printf("\n");
   printf("%d\n", count);
   return 0;
}

void merge(int A[], int n,int left, int mid, int right) {
  int n1 = mid - left;
  int n2 = right - mid;
int i = 0,j = 0,k=0;
  for(i = 0;i<n1;i++) L[i]=A[left+i];
  for(i = 0;i<n2;i++) R[i]=A[mid+i];
  L[n1] = BIG;
  R[n2] = BIG;
  i=0;j=0;
  for(k=left;k < right;k++) {
    count++;
    if (L[i] <= R[j]) {
      A[k] = L[i++];
    }
    else{
      A[k] = R[j++];
    }
}
}

void mergeSort(int A[],int n, int left,int right){
  if (left+1 < right) {
    int mid = (left + right)/2;
    mergeSort(A,n, left, mid);
    mergeSort(A,n, mid, right);
    merge(A, n, left, mid, right);
  }
  }

Measured memory_bytes: 4512
//package com.zhangyong.algorithm;

import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

    FastScanner in;
    PrintWriter out;

    class FastScanner {

        BufferedReader br;
        StringTokenizer st;

        private FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        private FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

    }

    private void solve() {

        int n, l;
        n = in.nextInt();
        l = in.nextInt();
        String[] str = new String[n];
        for (int i = 0; i < str.length; i++) {
            str[i] = in.next();
        }
        Arrays.sort(str, (s1, s2) -> s1.compareTo(s2));
        for (int i = 0; i < str.length; i++) {
            out.print(str[i]);
        }
    }

    private void run() {
        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    public static void main(String[] args) {
        new Main().run();
    }
}


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

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

int main(void){

    string N;
    int sum=0;
    cin >> N;
    //cout << N << endl;
    rep(i, N.size()){
        sum += N.at(i) - '0';
    }
    //cout << sum << endl;

    if(sum % 9 == 0){
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }


    return 0;
}

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

int main(){
  long long n;
  cin>>n;
  long long a[n];
  for(long long i=0;i<n;i++){
    cin>>a[i];
  }
  long long b[n];
  b[0]=a[0];
  for(long long i=1;i<n;i++){
    b[i]=b[i-1]+a[i];
  }
  
  long long ans=INT_MAX;
  for(long long i=0;i<n;i++){
    long long dife=abs(2*b[i]-b[n-1]);
    if(ans>dife){
      ans=dife;
    }
  }
  
  cout<<ans<<endl;
}

Measured memory_bytes: 3328
#include <iostream>
#include <stdio.h>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <locale>
using namespace std;
#define FORN(i,m,n) for(int i=m; i<(n); i++)
#define PRINTVEC(v) FORN(i,0,v.size()) cout<<v[i]<<" "; cout<<endl
#define PRINTMAT(m) FORN(j,0,m.size()) {PRINTVEC(m[j]);}
#define p_b(x) push_back(x)
#define m_p(a,b) make_pair(a,b)
typedef long long ll;

int main(){
  ios_base::sync_with_stdio(false); cin.tie(NULL);
  int a; string s;
  cin>>a>>s;
  cout<<(a < 3200 ? "red" : s)<<endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
  for(;;){
    int N,M,A,B,C,T;
    cin >> N >> M >> A >> B >> C >> T;
    if(N == 0 && M == 0 && A == 0 && B == 0 && C == 0 && T == 0){ return 0; }
    int S[N+2];
    S[0] = 0; S[N+1] = 0;
    for(int i = 1 ; i <= N ; i++){cin >> S[i];}
    // matrix a
    int a[N+2][N+2];
    for(int i = 0 ; i <= N+1 ; i++){
      a[0][i] = 0; a[N+1][i] = 0;
    }
    for(int i = 1 ; i <= N ; i++){
      for(int j = 0 ; j <= N+1 ; j++){
	if(i == j+1)     {a[i][j] = A;}
	else if(i == j)  {a[i][j] = B;}
	else if(i == j-1){a[i][j] = C;}
	else             {a[i][j] = 0;}
      }
    }
    // culculate a^T mod M
    int  temp[N+2][N+2];
    int  ans [N+2][N+2];
    bool first = true;
    for(int i = 0 ; i <= N+1 ; i++){
      for(int j = 0 ; j <= N+1 ; j++){
	ans[i][j]=((i==j)?(1):(0));
      }
    }
    for(int p = 0 ; (1<<p) <= T ; p++){
      int tmp[N+2][N+2];
      if((T>>p) % 2 != 0){
	for(int i = 0 ; i <= N+1 ; i++){
	  for(int j = 0 ; j <= N+1 ; j++){
	    tmp[i][j] = 0;
	    for(int k = 0 ; k <= N+1 ; k++){
	      tmp[i][j] += ans[i][k] * a[k][j];
	    }
	  }
	}
	for(int i = 0 ; i <= N+1 ; i++){
	  for(int j = 0 ; j <= N+1 ; j++){
	    ans[i][j] = tmp[i][j] % M;
	  }
	}
      }
      for(int i = 0 ; i <= N+1 ; i++){
	for(int j = 0 ; j <= N+1 ; j++){
	  tmp[i][j] = 0;
	  for(int k = 0 ; k <= N+1 ; k++){
	    tmp[i][j] += a[i][k] * a[k][j];
	  }
	}
      }
      for(int i = 0 ; i <= N+1 ; i++){
	for(int j = 0 ; j <= N+1 ; j++){
	  a[i][j] = tmp[i][j] % M;
	}
      }
    }
    
    int ansv[N+2];
    for(int i = 0 ; i <= N+1 ; i++){
      ansv[i] = 0;
      for(int k = 0 ; k <= N+1 ; k++){
	ansv[i] += ans[i][k] * S[k];
      }
    }
    for(int i = 1 ; i <= N ; i++){
      cout << ansv[i] % M << ((i == N)?("\n"):(" "));
    }
  }
}



Measured memory_bytes: 3152
N, *abc = map(int, input().split())
s = [input() for _ in range(N)]

ans = ["Yes"]

for i, si in enumerate(s):
    indices = [ord(sii) - 65 for sii in si]
    if sum(abc[ind] for ind in indices) == 0:
        ans = ["No"]
        break
    if min(abc[ind] for ind in indices) == 0:
        if abc[indices[1]]:
            ans.append(chr(65 + indices[0]))
            abc[indices[0]] += 1
            abc[indices[1]] += -1
        else:
            ans.append(chr(65 + indices[1]))
            abc[indices[1]] += 1
            abc[indices[0]] += -1
    elif i < N - 1 and si != s[i + 1]:
        adding = set(si) & set(s[i + 1])
        if len(adding) == 0:
            adding = si[0]
        else:
            adding = adding.pop()
        ans.append(adding)
        abc[ord(adding) - 65] += 1
        abc[-65 + ord(si[1 - si.index(adding)])] += -1
    else:
        adding = si[0]
        ans.append(adding)
        abc[ord(adding) - 65] += 1
        abc[-65 + ord(si[1 - si.index(adding)])] += -1
    # print(si, *abc)
print(*ans, sep="\n")
pass


Measured memory_bytes: 95488
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

namespace A_ABC162
{
    class MainClass
    {

        // static int[] s;

        public static void Main(string[] args)
        {
            // s = Array.ConvertAll(ReadLine().Split().ToArray(), int.Parse);
            string u = ReadLine();
            if(u[0]=='7' || u[1]=='7' || u[2] =='7'){
                WriteLine("Yes");
            }else{
                WriteLine("No");
            }
            
        }
    }
}


Measured memory_bytes: 25888
#include<stdio.h>
#include<stdlib.h>

#define min(a,b) ((a)<(b)?(a):(b))

int main(){
	int n,h[100001],i;
	scanf("%d",&n);
	for(i=1;i<=n;i++)scanf("%d",&h[i]);
	int dp[100001]={0};
	dp[1]=0;
	dp[2]=abs(h[2]-h[1]);
//	dp[3]=abs(h[3]-h[1]);
	for(i=3;i<=n;i++){
		dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
	}
	printf("%d\n",dp[n]);
	return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
map<int,int>mp;
int cnt[1000100];
int main()
{
	//cin>>ss;
	int n;
	int num=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		int x;
		scanf("%d",&x);
		if(mp[x]!=0) cnt[mp[x]]++;
		else
		{
			mp[x]=++num;
			cnt[num]=1;
		} 
	}
	int m;
	scanf("%d",&m);
	int p=1;
	for(int i=1;i<=m;i++)
	{
		int x;
		scanf("%d",&x);
		if(mp[x]!=0&&cnt[mp[x]]>0)
		{
			cnt[mp[x]]--;
		}
		else p=0;
	}
	if(p==1) printf("YES");
	else printf("NO");
	
}  

Measured memory_bytes: 10368
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		//intを受け取る
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		if(a<=9 && b<=9) {
			System.out.println(a*b);
		}else {
			System.out.println("-1");
		}
	}
}


Measured memory_bytes: 23892
#include <iostream>
#include<cstdlib>
#include<algorithm>
using namespace std;

int main() {
	char s[11];
	int si[10];
	int i = 0;
	int x = 1000;
	
	cin >> s;
	while(s[i]!='\0') {
		si[i] = (int)(s[i] - '0');
		if (i >= 2) {
			x = min(x, abs(753-(si[i - 2] * 100 + si[i - 1] * 10 + si[i])));
		}
		i++;
	}
	
	cout << x << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    int n, m, l, i, j, k;
    scanf("%d %d %d", &n, &m, &l);
    int a[n][m], b[m][l];
    long long int c[n][l];
    for(i=0; i<n; i++){
        for(j=0; j<l; j++){
            c[i][j]=0;
        }
    }
    for(i=0; i<n; i++){
        for(j=0; j<m; j++){
            scanf("%d", &a[i][j]);
        }
    }
    for(i=0; i<m; i++){
        for(j=0; j<l; j++){
            scanf("%d", &b[i][j]);
        }
    }
    for(i=0; i<n; i++){
        for(j=0; j<l; j++){
            for(k=0; k<m; k++){
                c[i][j]+=a[i][k]*b[k][j];
            }
            if(j==0){
                printf("%lld", c[i][j]);
            } else {
                printf(" %lld", c[i][j]);
            }
        }
        printf("\n");
    }
    return 0;
}


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

const int N = 200005;
typedef long long ll;

int a[N],b[N];
int ans[N];

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	int n,h;
	cin>>h>>n;
	
	ans[0] = 0;
	for(int i=0;i<n;i++){
		cin>>a[i]>>b[i];
	}
	
	for(int i=1;i<=h;i++){
		int mn = 1e9;
		for(int j=0;j<n;j++){
			int nh = max(0,i-a[j]);
			mn = min(mn,b[j] + ans[nh]);
		}
		ans[i] = mn;
	}
	
	cout<<ans[h]<<endl;
	
	return 0;
}

Measured memory_bytes: 3720
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a==b&&b==c)
    cout<<"No";
  else if(a==b||b==c||a==c)
    cout<<"Yes";
  else
    cout<<"No";
	return 0;
}


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

vector<pair<int,int>> primeFact(int p){
    vector<pair<int, int>> ret;         //{<素数p1, 指数部分e1>, <素数p2, 指数部分e2>,....,<素数pk, 指数部分ek>} 
    int root = sqrt(p);                 //素数pの平方根まで回す
    for (int i = 2; i <= root; i++){
        int exp = 0;                    //指数部分
        while(p % i == 0){
            exp++;
            p /= i;
        }

        if(exp != 0) ret.push_back(make_pair(i, exp));
    }
    return ret;
}

int main(){
    int N;

    cin >> N;

    int cnt = 0;


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

        int divNum = 1;    

        vector<pair<int, int>> n_pri = primeFact(i);

        for (int j = 0; j < n_pri.size(); j++){
            int r = n_pri[j].second;
            divNum *= (r+1);
        }

        if(divNum == 8){
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
K, S = map(int, input().split())
num = 0

for x in range(K + 1):
    ukou = S - x
    if (S >= x) and (ukou <= K * 2):
        y = K if K <= ukou else ukou
        z = ukou - y
        num += ((y + 1) - z)

print(num)


Measured memory_bytes: 3316
//第8回シンデレラガール総選挙は是非本田未央ちゃんに投票をお願いします！
//ファンのことも他のアイドルの子たちのことも本当に大事にしてて、今まで周りに色んなものを与えてくれました。
//今度は私たちが未央ちゃんにお返しをする番です。みんなでガラスの靴を履かせてあげましょう！
// #本田未央を一番星に #本田未央を令和のシンデレラガールに #第8回シンデレラガール総選挙
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
typedef pair<lint,lint> pl;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
ostream &operator<<(ostream &os, const vector<int> &a) {
	os<<"[";
	rep(i,a.size()){
		os<<a[i];
		if(i<a.size()-1) os<<",";
	}
	os<<"]";
	return os; 
}
int a[512810],b[512810];
lint sum[512810];
map<int,vector<int> > me;
lint mo=1000000007;
pl cal(int x){
	vector<int> v=me[x];
	lint s1=0,s2=1;int n=v.size();
	REP(i,1,n){
		lint d=sum[v[i]]-sum[v[i-1]];
		lint now=(s1+s2*d+1)%mo;
		lint ns1=(s1+s2*d)%mo,ns2=(s2+now)%mo;
		s1=ns1;s2=ns2;
	}
	//cout<<v<<endl;cout<<s1<<' '<<s2<<endl;
	return mp(s1,s2);
}
int main()
{
	int n;cin>>n;b[0]=0;
	rep(i,n){
		cin>>a[i];
		b[i+1]=(a[i]^b[i]);
		me[b[i+1]].pb(i+1);
	}
	sum[0]=0;
	rep(i,n){
		sum[i+1]=sum[i];
		if(b[i+1]==0) sum[i+1]++;
	}
	//cout<<b[n]<<endl;
	if(b[n]>0){
		cout<<(cal(b[n]).fi+1)%mo<<endl;
		return 0;
	}
	//cout<<me[0]<<endl;
	lint out=0;
	REP(i,1,(1<<20)+10){
		if(me[i].size()<1) continue;
		out+=cal(i).se;out%=mo;
	}
	lint t=1;
	rep(i,me[0].size()-1){
		t*=2;t%=mo;
	}
	out+=t;out%=mo;
	cout<<out<<endl;
}


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

using ll = long long;

int main() {
    int N, D;
    cin >> N >> D;
    vector<vector<int>> X(N, vector<int>(D));
    rep(i, N) rep(j, D) cin >> X[i][j];
    int ans = 0;
    rep(i, N - 1) for (int j = i + 1; j < N; j++) {
        int d2 = 0;
        rep(k, D) d2 += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
        int d1 = pow(d2, 0.5);
        if (d1 * d1 == d2) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>
#include <numeric>
#include <list>
#include <bitset>
using namespace std;

int main()
{
    int H, W;
    cin >> H >> W;
    vector<vector<char>> S(H);
    for (int i = 0; i < H; i++)
    {
        vector<char> tmp(W);
        for (int j = 0; j < W; j++)
        {
            cin >> tmp[j];
        }
        S[i] = tmp;
    }
    int h[3] = {-1, 0, 1}, w[3] = {-1, 0, 1};
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            int tmp = 0;
            if (S[i][j] == '.')
            {
                for (int k = 0; k < 3; k++)
                {
                    for (int l = 0; l < 3; l++)
                    {
                        if (((i + h[k]) < 0) || ((i + h[k]) >= H))
                        {
                            continue;
                        }
                        else if (((j + w[l]) < 0) || ((j + w[l]) >= W))
                        {
                            continue;
                        }
                        else
                        {
                            if (S[i + h[k]][j + w[l]] == '#')
                            {
                                tmp++;
                            }
                        }
                    }
                }
                cout << tmp;
            }
            else
            {
                cout << S[i][j];
            }
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
typedef complex<D> P;
#define F first
#define S second
const ll MOD=1000000007;
//const ll MOD=998244353;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){ll i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}



int main(){
  ll N;
  cin>>N;
  vector<ll> A(N),B(N),C(N-1);
  cin>>A>>B>>C;
  for(auto &I:A){I--;}
  ll ans=0;
  for(int i=0;i+1<N;i++){
    if(A[i+1]-A[i]==1){
      ans+=C[A[i]];
    }
  }
  for(auto &I:B){ans+=I;}
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <vector>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <algorithm>
using namespace std;
#define x first
#define y second
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define ll long long
#define ld long double
#define ii pair<int,int>
#define heap priority_queue
#define all(k) k.begin(),k.end()
#define rall(k) k.rbegin(),k.rend()
#define len(v) ((int)v.size())
#define fa(a,c) for(auto &a:c)
#define endl '\n'
vector<int> pre(100001);




int32_t main(){
  ios::sync_with_stdio(0); cin.tie(0);
  for(int i=1;i<100001;i++){
    int n=i;
    int c=0;
    while(n){
      c++;
      n/=10;
    }
    pre[i] = pre[i-1]+(c&1);

  }

  int n;
  cin>>n;
  cout<<pre[n]<<endl;



}


Measured memory_bytes: 640
import copy
n=input()
s=input()
ln=len(n)
ls=len(s)
n=int(n)
s=int(s)
if n==s:
    print(n+1)
elif n<s:
    print(-1)
else:
    for b in range(2,pow(10,6)+1):
        N = copy.deepcopy(n)
        f = 0
        while N >= b:
            f += N % b
            N = N // b
        f += N
        if f == s:
            print(b)
            exit()
    ans=-1
    for p in range(1,pow(10,6)+1):
        if (n-s)%p==0:
            b=(n-s)//p+1
        N = copy.deepcopy(n)
        f = 0
        while N >= b:
            f += N % b
            N = N // b
        f += N
        if f == s:
            ans=b
    print(ans)

Measured memory_bytes: 68652
#include <iostream>
#include<string>

using namespace std;

int main()
{
  int r;
  int c;
  int rc[101][101]={0};
  int rsum[100]={0};
  int csum[100]={0};
  int sum;
  int i;
  int j;
  
  cin >> r >> c;
  for(i=0;i<r;i++)
  {
    for(j=0;j<c;j++)
    {
    cin >> rc[i][j];
    }
  }
  
    for(i=0;i<r;i++)
  {
    for(j=0;j<c;j++)
    {
    rsum[i]+=rc[i][j];
    csum[j]+=rc[i][j];
    sum+=rc[i][j];
    }
  }
  
  for(i=0;i<r;i++)
    rc[i][c]=rsum[i];
  
  for(j=0;j<c;j++)
    rc[r][j]=csum[j];
  
  rc[r][c]=sum;
  
  for(i=0;i<r+1;i++)
  {
    for(j=0;j<c+1;j++)
    {
    cout << rc[i][j];
    if(j!=c)
      cout << " ";
    }
    cout << "\n";
  }
}

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

int main() {
    //
    string str;

    cin >> str;

    int cnt = 0;
    if (str.at(1) == 'S') {
        if (str.at(0) == 'R' || str.at(2) == 'R') {
            cout << 1;
            return 0;
        } else {
            cout << 0;
        }
    } else {
        if (str.at(0) == 'R' && str.at(2) == 'R') {
            cout << 3;
            return 0;
        } else if(str.at(0) == 'S' && str.at(2) == 'S'){
            cout << 1;
        } else {
            cout << 2;
        }
    }
    //
}


Measured memory_bytes: 3624
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;


public class Main{

	public static void main(String[] args) throws Exception {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int i = 0;
        String str;

	    double max = 0.0;
	    double min = 0.0;
	    double tmp = 0.0;
	    
        while((str = br.readLine()) != null ){
    	tmp = Double.parseDouble(str);
//        for (int j=0;j<5;j++){
//        	tmp = Double.parseDouble(br.readLine());

        	if(i==0){
        		max = tmp;
        		min = tmp;
        	}
        	
        	if(tmp>max){
        		max=tmp;
        	}
        	else if(tmp<min){
        		min=tmp;
        	}
        	i++;
        }
        System.out.println(max-min);

	}
	

}

Measured memory_bytes: 16904
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define INF 0x3f3f3f3f
using namespace std;
 
int x[1000];
vector<int>E[1000];
int memo[2000];
unordered_map<int,int>dp[2000];
 
void dfs(int v){
	if(E[v].empty()){
		memo[v]=0;
		return;
	}
	for(auto u:E[v]){
		dfs(u);
	}
	dp[0][0]=0;
	rep(i,E[v].size()){
		dp[i+1].clear();
		for(auto&p:dp[i]){
			int j=p.first,k=x[E[v][i]],t=memo[E[v][i]];
			if(j+x[E[v][i]]<=x[v]){
				if(dp[i+1].count(j+k)==0)dp[i+1][j+k]=dp[i][j]+t;
				else dp[i+1][j+k]=min(dp[i+1][j+k],dp[i][j]+t);
			}
			if(j+t<=x[v]){
				if(dp[i+1].count(j+t)==0)dp[i+1][j+t]=dp[i][j]+k;
				else dp[i+1][j+t]=min(dp[i+1][j+t],dp[i][j]+k);
			}
		}
	}
	memo[v]=INF;
	rep(i,x[v]+1){
		if(dp[E[v].size()].count(i)==0)continue;
		memo[v]=min(memo[v],dp[E[v].size()][i]);
	}
	if(memo[v]==INF){
		puts("IMPOSSIBLE");exit(0);
	}
}
int main(){
	int n;scanf("%d",&n);
	rep(i,n-1){
		int p;scanf("%d",&p);p--;
		E[p].push_back(i+1);
	}
	rep(i,n)scanf("%d",&x[i]);
	dfs(0);
	puts("POSSIBLE");
}

Measured memory_bytes: 1280
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <iomanip>
#include <string>
#include <queue>
#include <numeric>
#include <functional>
#include <array>
#include <map>
#include <set>

using namespace std;
using P = pair<int, int>;
using T = tuple<long, long, long>;

long long MOD = 1000000007;
long long dp[100005][4];

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

	vector<long long>a(n);
	for (int i = 0; i < n; ++i) cin >> a[i];

	sort(a.begin(), a.end());
	int middle = (a[n-1] % 2 == 0) ? a[n-1] / 2 : a[n-1]/2+1 ;
	int minDistance = 1000000005;
	int num = 0;
	for (int j = n-2; 0 <= j;--j) {
		if (abs(a[j] - middle) < minDistance) {
			minDistance = abs(a[j] - middle);
			num = a[j];
		}
	}

	cout << a[n - 1] << " " << num << endl;
}


Measured memory_bytes: 1024
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#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>
#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>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1e9
#define LINF 1e18
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
#define int long long
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int dx[]={0,1,0,-1,1,-1};
int dy[]={1,0,-1,0,1,-1};
struct edge{int to,cost;};
typedef pair<int,int> P;

bool isupper(char c){if('A'<=c&&c<='Z')return 1;return 0;}
bool islower(char c){if('a'<=c&&c<='z')return 1;return 0;}
bool isPrime(int x){if(x==1)return 0;if(x==2)return 1;if(x%2==0)return 0;for(int i=3;i*i<=x;i++)if(x%i==0)return 0;return 1;}
bool iskaibun(string s){for(int i=0;i<s.size()/2;i++)if(s[i]!=s[s.size()-i-1])return 0;return 1;}
bool isnumber(char c){return ('0'<=c&&c<='9');}
bool isalpha(char c){return (isupper(c)&&islower(c));}
void printvi(vector<int> v){rep(i,0,v.size()){if(i)cout<<" ";cout<<v[i];}cout<<endl;}
void printvil(vector<int> v){rep(i,0,v.size()){cout<<v[i]<<endl;}}
void printvvi(vector<vector<int>> v){
    rep(i,0,v.size()){
        rep(j,0,v[i].size())cout<<v[i][j];
        cout<<endl;
    }
}
void printvstr(vector<string> v){
    rep(i,0,v.size()){
        cout<<v[i]<<endl;
    }
}

signed main (){
    int v[2];
    rep(i,0,2)cin>>v[i];
    sort(v,v+2);
    if(v[1]-v[0]>=2)cout<<v[1]+v[1]-1<<endl;
    else cout<<v[1]+v[0]<<endl;

    




}
/*
(()()())
*/


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = ReadInt();

            var a = ReadInts();
            var b = ReadInts();
            var c = ReadInts();

            var ans = b.Sum();


            for (int i = 0; i < n; i++)
            {
                try
                {
                    if (a[i] == a[i + 1] - 1)
                    {
                        ans += c[a[i]-1];
                    }

                }
                catch (Exception)
                {

                }
            }
            WriteLine(ans);
        }


        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }


        public static bool IsPrime(int num)
        {
            if (num < 2) return false;
            else if (num == 2) return true;
            else if (num % 2 == 0) return false;

            double sqrtNum = Sqrt(num);
            for (int i = 3; i <= sqrtNum; i += 2)
            {
                if (num % i == 0)
                {
                    return false;
                }
            }
            return true;
        }

        //最大公約数
        public static int Gcd(int a, int b)
        {
            if (a < b)
            {
                return Gcd(b, a);
            }
            while (b != 0)
            {
                var reminder = a % b;
                a = b;
                b = reminder;
            }
            return a;
        }

        //最小公倍数
        public static int Lcm(int a, int b)
        {
            return a * b / Gcd(a, b);
        }

        //文字数を数える
        public static int CountChar(string s, char c)
        {
            return s.Length - s.Replace(c.ToString(), "").Length;
        }
        public static void debuglist(List<int> x)
        {
            foreach (var item in x)
            {
                WriteLine(item);
            }
        }
        public static void debuglist(List<string> x)
        {
            foreach (var item in x)
            {
                WriteLine(item);
            }
        }
        public static void debugarray(int[] x)
        {
            foreach (var item in x)
            {
                WriteLine(item);
            }
        }
        public static void debugarray(string[] x)
        {
            foreach (var item in x)
            {
                WriteLine(item);
            }
        }
    }
}


Measured memory_bytes: 13268
N = int(input())
A = list(map(int,input().split()))
A.insert(0,0)
tot = abs(A[1])
for i in range(2,N+1):
    tot += abs(A[i]-A[i-1])
tot += abs(A[N])
print(tot-abs(A[1])-abs(A[2]-A[1])+abs(A[2]))
for i in range(2,N):
    print(tot-abs(A[i]-A[i-1])-abs(A[i+1]-A[i])+abs(A[i+1]-A[i-1]))
print(tot-abs(A[N])-abs(A[N]-A[N-1])+abs(A[N-1]))

Measured memory_bytes: 83384
public class Main {
	public static void main(String args[]) {
		java.util.Scanner sc = new java.util.Scanner(System.in);
		long N = sc.nextInt();

		long result = 0;

		if (N == 1) {
			result = 0;
		}

		if (N % 2 == 0) {
			result = (N - 1 + 1) * ((N-1) / 2) + ((N-1) / 2 + 1);
		} else {
			result = (N - 1 + 1) * (N / 2);
		}

		System.out.println(result);

	}
}

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

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

    sort (s.begin(), s.end());
    vector<pair<int,string>> v = {{1, s[0]}};
    int c = 0;
    for (int i = 1; i < n; i++) {
        if (s[i] == v[c].second) v[c].first++;
        else {
            v.push_back({1, s[i]});
            c++;
        }
    }
    sort (v.begin(), v.end());
    int m = v[c].first;
    for (int i = 0; i <= c; i++) {
        if (v[i].first == m) cout << v[i].second << endl;
    }
}

Measured memory_bytes: 19980
#coding:utf-8
import sys
N,K,C=map(int,input().split())
S=input()
S_R=S[::-1]
L=[]
R=[]
loop=0
cnt=0
while (loop<N):
	if S[loop]=="o":
		L.append(loop+1)
		cnt+=1
		loop+=C+1
	else:
		loop+=1
	if cnt>K:
		break
if cnt<K:
	exit()
loop=0
cnt=0

while (loop<N):
	if S_R[loop]=="o":
		R.append(N-loop)
		cnt+=1
		loop+=C+1
	else:
		loop+=1
	if cnt>K:
		break
if cnt<K:
	exit()

R=R[::-1]
for i in range(K):
	if L[i]==R[i]:
		print(L[i])

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

int main(){
	int n;
	cin>>n;
	if(n>=64){
		cout<<64<<endl;
		return 0;
	}
	if(n>=32){
		cout<<32<<endl;
		return 0;
	}
	if(n>=16){
		cout<<16<<endl;
		return 0;
	}
	if(n>=8){
		cout<<8<<endl;
		return 0;
	}
	if(n>=4){
		cout<<4<<endl;
		return 0;
	}
	if(n>=2){
		cout<<2<<endl;
		return 0;
	}
	cout<<"1"<<endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int n, a, b, ans = 0, k, sum;
    cin >> n >> a >> b;
    for(int i = 1; i <= n; i++){
        k = i;
        sum = 0;
        while(k != 0){
            sum += k % 10;
            k /= 10;
        }
        if(a <= sum && sum <= b) ans += i;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main(void){
  	string s;
	cin >> s;

    for(int i = 0; i < s.length(); i++){
        if(i%2 != 0 && s[i] == 'R'){
            cout << "No" << endl;
            return 0;
        }
        else if(i%2 == 0 && s[i] == 'L'){
            cout << "No" << endl;
            return 0;
        }
    }

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


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#define LL long long
#define rg register
#define N 100010
using namespace std;
int cnt1,cnt2,n,m,a[N],b[N],mx,mx1,mx2,num1,num2,cx1,cx2;
inline int read(){
    int k=0,f=1; char c=getchar();
    while(c<'0'||c>'9')c=='-'&&(f=-1),c=getchar();
    while('0'<=c&&c<='9')k=k*10+c-'0',c=getchar();
    return k*f;
}
int main(){
	n=read();
	for(rg int i=1;i<=n;i++){
		int x=read();
		if(i&1) a[x]++,cnt1++;
		else b[x]++,cnt2++;
		mx=max(mx,x);
	}
	for(rg int i=1;i<=N-10;i++){
		if(a[i]>mx1){
			mx1=a[i];
			num1=i;
		}
		if(b[i]>mx2){
			mx2=b[i];
			num2=i;
		}
	}
	if(num1==num2){
		a[num1]=0; b[num2]=0;
		for(rg int i=1;i<=N-10;i++){
			if(a[i]>cx1) cx1=a[i];
			if(b[i]>cx2) cx2=b[i];
		}
		printf("%d\n",min(cnt1-mx1+cnt2-cx2,cnt1-cx1+cnt2-mx2));
//		printf("%d %d\n",cx1,cx2);
	}
	else printf("%d\n",cnt1-mx1+cnt2-mx2);
	return 0;
}

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

string solve(int k, string s) {
  string res = "";
  for(int i= 0;i<(int) s.size();i++) {
    if(i<k) {
      res.push_back(s[i]);
    } else {
      res = res + "...";
      break;
    }
  }
  return res;
}

int main() {
  int k;
  string s;
  cin >> k >> s;
  cout << solve(k, s);
}

Measured memory_bytes: 3612
import java.io.*;
import java.math.*;
import java.util.*;
public class Main { 
 
	public static void main(String[] args) { 
		Scanner input = new Scanner(System.in);
		int SX = input.nextInt();
		int SY = input.nextInt();
		int EX = input.nextInt();
		int EY = input.nextInt();
		int disX = Math.abs(EX-SX);
		int disY = Math.abs(EY-SY);
		for (int i = 0; i < disX; i++) {
			System.out.print("R");
		}
		for (int i = 0; i < disY; i++) {
			System.out.print("U");
		}
		for (int i = 0; i < disX; i++) {
			System.out.print("L");
		}
		for (int i = 0; i <= disY; i++) {
			System.out.print("D");
		}
		for (int i = 0; i <= disX; i++) {
			System.out.print("R");
		}
		for (int i = 0; i <= disY; i++) {
			System.out.print("U");
		}
		System.out.print("L");
		System.out.print("U");
		for (int i = 0; i <= disX; i++) {
			System.out.print("L");
		}
		for (int i = 0; i <= disY; i++) {
			System.out.print("D");
		}
		System.out.print("R");
	}
}

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


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

    string sa,sb;
    rep(i,b) sa += to_string(a);  
    rep(i,a) sb += to_string(b);  
    
    if(sa<sb) cout<<sa<<endl;
    else cout<<sb<<endl;
    
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
  int A;
  int sum_A = 0;
  for (int i = 0; i < 3; i++) {
    cin >> A;
    sum_A += A;
  }
  if (sum_A >= 22)
    cout << "bust" << endl;
  else
    cout << "win" << endl;
}

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

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


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);

int main() {
    ll x;
    cin >> x;
    
    frep(i, -120, 120) {
        frep(j, -120, i-1) {
            if((a_n(i, 5)-a_n(j, 5))==x) {
                cout << i << ' ' << j << endl;
                return 0;
            }
        }
    }

    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        ret %= MOD;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

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

ll inv(ll a) {
    return a_n(a, MOD-2);
}



Measured memory_bytes: 3676