akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;
const long nPrime = 1000000007;

int main(){
    int n;
    scanf("%d", &n);
    vector <long> vi(n);
    long iSum = 0;
    for(int i = 0; i < n; i++){
        scanf("%ld", &vi[i]);
        iSum += vi[i];
        iSum %= nPrime;
    }
    long nAns = iSum * iSum;
    nAns %= nPrime;
    for(int i = 0; i < n; i++){
        long iSquare = vi[i] * vi[i];
        iSquare %= nPrime;
        nAns -= iSquare;
        nAns %= nPrime;
    }
    
    if(nAns < 0){
        nAns += nPrime;
    }
    if(nAns % 2 != 0){
        nAns += nPrime;
    }
    printf("%ld", nAns / 2);
    return 0;
}


Measured memory_bytes: 4456
import java.util.Scanner;
import java.math.BigInteger;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        BigInteger sum = new BigInteger("0");
        for(int i = 1; i <= N; i++){
            if((i%3!=0)&&(i%5!=0)){
                BigInteger t = new BigInteger(String.valueOf(i));
                sum = sum.add(t);
            }
        }
        System.out.print(sum);
    }

}


Measured memory_bytes: 56268
import java.util.Scanner;

public class Main{
	public static int x;
	public static int y;
	public static int z;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		x= sc.nextInt();
		y = sc.nextInt();
		if(x > y){
			solve(x,y);
		}
		else{
			solve(y,x);
		}
		System.out.println(z);

	}

	public static void solve(int big,int small){
		z = big % small;
		if (z == 0){
			z = small;
		}
		else{
			solve(small,z);
		}

	}

}

Measured memory_bytes: 26168
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _1_5_d
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            int a = int.Parse(str);

            

            for (int b =3; b <= a; b++)
            {
                if (b % 3 == 0)
                {
                    Console.Write(' ');
                    Console.Write(b);
                }
                else
                {
                    string c = b.ToString();
                    string target = "3";
                    if (c.Contains(target))
                    {
                        Console.Write(' ');
                        Console.Write(b);
                    }
                }
            }
            Console.Write("\n");
        }
    }
}



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

public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		
		int result = 1;
		boolean skipped = false;
		int i=1;
		for(; i<s.length(); i++){
			if( !skipped && s.charAt(i-1) == s.charAt(i) ){
				i++;
				skipped = true;
			}else
				skipped = false;
			
			result++;
		}
		if( i == s.length()+1 )
			result--;
		
		System.out.println(result);
	}
}


Measured memory_bytes: 27056
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int N, Q;
    string S;
    cin >> N >> S >> Q;

    vector<set<int>> alpha(26, set<int>());
    rep(i, S.size()) {
        alpha[(int)(S[i] - 'a')].insert(i);
    }

    rep(i, Q) {
        int a;
        cin >> a;
        if (a == 1) {
            int b;
            char c;
            cin >> b >> c;
            b--;
            alpha[(int)(S[b] - 'a')].erase(b);
            alpha[(int)(c - 'a')].insert(b);
            S[b] = c;
        }
        else {
            int b, c;
            cin >> b >> c;
            b--; c--;
            int cnt = 0;
            rep(j, 26) {
                auto itr = alpha[j].lower_bound(b);
                if (itr == alpha[j].end()) continue;
                if (*itr <= c) cnt++;
            }

            cout << cnt << endl;
        }
    }
    return 0;
}

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

public class Main
{

  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s = r.readLine();
    String[] sl = s.split(" ");
    int n = Integer.parseInt(sl[0]);
    
    s = r.readLine();
    sl = s.split(" ");
    int max = 0;
    int sum = 0;
    for(int i = 0; i < n; i++)
    {
      int z = Integer.parseInt(sl[i]);
      max = Math.max(z, max);
      sum += z;
    }

    System.out.println(max < (sum - max) ? "Yes" : "No");
  }


}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,Q,K,A,B;
string S;
const ll MOD = 998244353;
//const ll MOD = (1e+9) + 7;
typedef pair<ll, ll> P;
const ll INF = (1LL<<62);
int main() {
    cin>>K>>S;
    if(S.size() <= K){
        cout<<S<<endl;
    }else{
        rep(i,K) cout<<S[i];
        cout<<"..."<<endl;
    }
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define R(a) int a;cin>>a;
#define deb(x) cout<<#x<<" "<<x<<endl;
#define mod 1000000007
#define f_arr(n) for(int i=0;i<n;i++)
#define r_arr(n) for(int i=n-1;i>=0;i--)
#define pb push_back
#define all(x) x.begin(),x.end()
#define inf 1e18
// #define int long long int
using namespace std;

#ifndef ONLINE_JUDGE
template<typename T>    
void __p(T a) {
  cerr<<a;
}
template<typename T, typename F>
void __p(pair<T, F> a) {
  cerr<<"[";
  __p(a.first);
  cerr<<",";
  __p(a.second);
  cerr<<"]";
}
template<typename T>
void __p(std::vector<T> a) {
  cerr<<"[";
  for(auto it=a.begin(); it<a.end(); it++)
    __p(*it),cerr<<",]"[it+1==a.end()];
}
template<typename T, typename ...Arg>
void __p(T a1, Arg ...a) {
  __p(a1);
  __p(a...);
}
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
  cerr<<name<<" : ";
  __p(arg1);
  cerr<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
  int bracket=0,i=0;
  for(;; i++)
    if(names[i]==','&&bracket==0)
      break;
    else if(names[i]=='(')
      bracket++;
    else if(names[i]==')')
      bracket--;
  const char *comma=names+i;
  cerr.write(names,comma-names)<<" : ";
  __p(arg1);
  cerr<<" | ";
  __f(comma+1,args...);
}
#define trace(...) cerr<<"Line:"<<__LINE__<<" ", __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...)
#endif

void test_case()
{
  R(n);R(k);
  vector<int> h(n),dp(n,INT_MAX);
  for(int &x : h){
    cin>>x;
  }
  dp[0]=0;
  for(int i=1;i<n;i++){
    for(int j=1;j<=min(k,i);j++){
      dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
    }
    trace(dp);
  }
  cout<<dp[n-1];
  /*
  #define int long long int
  */
}
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
 
    int t=1;
    // cin>>t;
    while(t--)
    {
        test_case();
    }

    cerr<<endl<<"Time : "<<1000*((double)clock())/(double)CLOCKS_PER_SEC<<"ms\n";

    return 0;
}


Measured memory_bytes: 3956
fun main(a:Array<String>){
    val n = readLine()!!.toInt()
    val d = readLine()!!.split(" ").map { it.toInt() }
    var sum = 0
    for (i in 0 until n){
        for (j in i+1 until n){
            sum += d[i] * d[j]
        }
    }
    println(sum)
}

Measured memory_bytes: 37800
#include<stdio.h>
int main()
{
	int a[10],i,j,t;
	for(i=0;i<10;i++)
		scanf("%d",&a[i]);
	for(i=0;i<10;i++)
		for(j=i+1;j<10;j++)
			if(a[i]<a[j])
			{t=a[i];a[i]=a[j];a[j]=t;}
	for(i=0;i<3;i++)
		printf("%d\n",a[i]);
	return 0;
}

Measured memory_bytes: 600
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String t = sc.nextLine();
    int count = 0;
    for (int i = 0; i < 3; i++) {
      count += s.charAt(i) == t.charAt(i) ? 1 : 0;
    }
    sc.close();
    System.out.println(count);
  }
}


Measured memory_bytes: 21844
package main

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

func main() {
	N := ReadInt()
	A := ReadInts(N)

	s := 0
	for i := 0; i < N; i++ {
		if A[i] == 0 {
			continue
		}
		s += A[i]
		s %= Mod
	}

	ans := 0
	for i := 0; i < N-1; i++ {
		if A[i] == 0 {
			continue
		}
		s = s + Mod - A[i]
		s %= Mod
		ans += A[i] * s % Mod
		ans %= Mod
	}
	fmt.Println(ans % Mod)
}

const Mod = int(1e9) + 7

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 5988
H, W = map(int, input().split())

mod = pow(10, 9) + 7

grid = [
    [1 if c == '#' else 0 for c in input()]
    for row in range(H)]

dp = [[0 for i in range(W)] for j in range(H)]

dp[0][0] = 1

for y in range(H):
    for x in range(W):
        # Move down
        if y > 0 and not grid[y-1][x]:
            dp[y][x] += dp[y-1][x]

        # Move right
        if x > 0 and not grid[y][x-1]:
            dp[y][x] += dp[y][x-1]
            
        dp[y][x] %= mod

print(dp[-1][-1])


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

int main()
{
    int a, b;
    cin >> a;
    if (a < 10) {
        if (a == 2 || a == 4 || a == 5 || a == 7 || a == 9) {
            cout << "hon" << endl;
        }
        else if (a == 3)
            cout << "bon" << endl;
        else
            cout << "pon" << endl;

        return 0;
    }
    else if (a < 100) {
        b = 10;
    }
    else {
        b = 10;
    }
    if (a % b == 2 || a % b == 4 || a % b == 5 || a % b == 7 || a % b == 9) {
        cout << "hon" << endl;
    }
    else if (a % b == 3)
        cout << "bon" << endl;
    else
        cout << "pon" << endl;
}

Measured memory_bytes: 3568
#include<iostream>
#include<string>
#include<map>

using namespace std;

int main(){
    string w;
    cin >> w;
    map<char, int> str;
    for(int i = 0; i < w.size(); i++){
        str[w[i]]++;
    }

    map<char,int>::iterator ite;
    for(ite = str.begin(); ite != str.end(); ++ite){
        if(ite->second % 2 != 0) {
            cout << "No" << endl;
            return 0;
        } 
    }

    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 888
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main() {
	string s;
	cin >> s;
	int k = s.find("AC");
	if (k >= 0) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int dp[105][4][2];
int main(){
  string s;
  cin >> s;
  int n = s.size();
  int K;
  cin >> K;
  dp[0][0][0] = 1;
  rep(i,n)rep(j,4)rep(k,2){
    int nd = s[i]-'0';
    rep(d,10){
      int ni = i+1, nj=j, nk=k;
      if (d!=0) nj++;
      if(nj>K) continue;
      if(k==0){
        if(d > nd) continue;
        if(d< nd) nk=1;
      }
      dp[ni][nj][nk] += dp[i][j][k];
    }
  }
  int ans = dp[n][K][0] + dp[n][K][1];
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for i in range(d)]
lastd = [0] * 26

for i in range(d):
    ans = 0
    tmp = 0
    for j in range(26):
        if tmp < s[i][j] + (i - lastd[j] + 1) * c[j]:
            tmp = s[i][j] + (i - lastd[j] + 1) * c[j]
            ans = j + 1
    lastd[ans - 1] = i
    print(ans)
        
    

Measured memory_bytes: 9256
import java.util.Scanner;
 
public class Main {
public static void main(String[] args) {
  Scanner in = new Scanner(System.in);
  while (in.hasNext()) {
    int d = in.nextInt();
    int val = 0;
    int x;
    for (int i = 1; (x = i * d) < 600; i++) {
      val += d * x * x;
    }
    System.out.println(val);
  }
}
}


Measured memory_bytes: 25968
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	// AtCoder Beginner Contest 115
	// https://atcoder.jp/contests/abc115/tasks
	public static void main(String[] args) {
		FastReader sc = new FastReader();
		int n = sc.nextInt();
		int maxPrice = 0;
		int sum = 0;
		
		for (int i = 0; i < n; i++) {
			int cost = sc.nextInt();
			maxPrice = Math.max(maxPrice, cost);
			sum += cost;
		}
		
		System.out.println(sum - (maxPrice / 2));
		
	}
	
	static class FastReader { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        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()); 
        } 
  
        String nextLine() { 
            String str = ""; 
            try{ 
                str = br.readLine(); 
            } catch (IOException e) { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
}


Measured memory_bytes: 21204
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define Graph vector<vector<int>>;
#define iterG(next_v, G, v) for(auto next_v : G[v]
int h, w;
vector<vector<int>> s(100);
vector<vector<int>> memo(100);

int main(){
    string a;

    cin >> h >> w;
    rep(i, h){
        cin >> a;
        rep(j, w){
            if (a[j] == '.'){
                s[i].push_back(0);
            }else{
                s[i].push_back(1);
            }
            memo[i].push_back(-1);
        }
    }
    int migi, sita;
    memo[0][0] = 0;
    if (s[0][0] == 1){
        memo[0][0] = 1;
    }
    rep(i, h){
        rep(j, w){
            if(i > 0 && j > 0){
                sita = memo[i-1][j];
                migi = memo[i][j-1];
                if (s[i-1][j] != s[i][j] && s[i][j] == 1){
                    sita++;
                }
                if (s[i][j-1] != s[i][j] && s[i][j] == 1){
                    migi++;
                }
                memo[i][j] = min(migi, sita);
            }else if(i > 0){
                sita = memo[i-1][j];
                if(s[i-1][j] != s[i][j] && s[i][j] == 1){
                    sita++;
                }
                memo[i][j] = sita;
            }else if(j > 0){
                migi = memo[i][j-1];
                if(s[i][j-1] != s[i][j] && s[i][j] == 1){
                    migi++;
                }
                memo[i][j] = migi;
            }

        }

    }

    cout << memo[h-1][w-1] << endl;
    return 0;
}



Measured memory_bytes: 384
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;

int main() {
    int N;
    ll D;
    cin>>N>>D;
    D=D*D;
    int count=0;
    for (int i = 0; i < N; i++){
        ll X,Y;
        cin>>X>>Y;
        if(X*X+Y*Y<=D)count++;
    }
    cout<<count<<endl;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
map<long long,long long>mp;
int main()
{
    long long t,n,m,i,j,k,x=0,y=0,z;
    cin>>n;
    long long a[n+5],b[n+5];
    vector<long long>c;
    for(i=1; i<=n; i++)
    {
        cin>>a[i];
        x=max(a[i],x);
        b[i]=x;
        mp[a[i]]++;
        c.push_back(a[i]);
    }
    sort(c.begin(),c.end());
    z=unique(c.begin(),c.end())-c.begin();
    //cout<<z<<endl;
    for(i=1; i<=n; i++)
    {
        if(a[i]==x)
        {
            if(z==1 || mp[a[i]]>1)
            {
                cout<<a[i]<<endl;
            }
            else
            {
                cout<<c[z-2]<<endl;
            }
        }
        else
        {
            cout<<x<<endl;
        }
    }
}


Measured memory_bytes: 13680
use std::fmt::{Debug, Display};
use std::io::{self, Read};
use std::str::{self, FromStr};


fn solve(x: i32, a: i32, b: i32) -> char {
    if (x - a).abs() < (x - b).abs() {
        'A'
    } else {
        'B'
    }
}


fn main() {
    let stdin = io::stdin();
    let mut sc = Scanner::new(stdin.lock().bytes());
    println!("{}", solve(sc.next(), sc.next(), sc.next()));
}


struct Scanner<R: Read> {
    buf: Vec<u8>,
    bytes: io::Bytes<R>,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(bytes: io::Bytes<R>) -> Self {
        Scanner {
            buf: Vec::with_capacity(256),
            bytes: bytes,
        }
    }

    fn next<T: FromStr>(&mut self) -> T
    where
        <T as FromStr>::Err: Debug,
    {
        self.buf.clear();
        for c in self.bytes
            .by_ref()
            .map(|c| c.unwrap())
            .skip_while(|&c| c == ' ' as u8 || c == '\n' as u8)
            .take_while(|&c| !(c == ' ' as u8 || c == '\n' as u8))
        {
            self.buf.push(c);
        }
        str::from_utf8(&self.buf).unwrap().parse().unwrap()
    }

    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        (0..n).map(|_| self.next()).collect()
    }

    fn pairs<A: FromStr, B: FromStr>(&mut self, n: usize) -> Vec<(A, B)>
    where
        <A as FromStr>::Err: Debug,
        <B as FromStr>::Err: Debug,
    {
        (0..n).map(|_| (self.next(), self.next())).collect()
    }

    fn trios<A: FromStr, B: FromStr, C: FromStr>(&mut self, n: usize) -> Vec<(A, B, C)>
    where
        <A as FromStr>::Err: Debug,
        <B as FromStr>::Err: Debug,
        <C as FromStr>::Err: Debug,
    {
        (0..n)
            .map(|_| (self.next(), self.next(), self.next()))
            .collect()
    }

    fn mat<T: FromStr>(&mut self, m: usize, n: usize) -> Vec<Vec<T>>
    where
        <T as FromStr>::Err: Debug,
    {
        (0..n).map(|_| self.vec(m)).collect()
    }
}


#[allow(dead_code)]
fn print_foreach<T: Display>(answer: &[T]) {
    for x in answer {
        println!("{}", x);
    }
}


#[allow(dead_code)]
fn print_yn(answer: bool, yes: &str, no: &str) {
    println!("{}", if answer { yes } else { no });
}


#[allow(dead_code)]
fn print_or<T: Display>(answer: &Option<T>, or: &T) {
    match *answer {
        Some(ref x) => println!("{}", x),
        None => println!("{}", or),
    }
}


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

using namespace std;

int64_t a,n,b;

int main()
{
    string s;
    cin>>s;
    int w;
    cin>>w;
    for(int i=0;i<s.size();)
    {
        cout<<s[i];
        i=i+w;

    }
   return 0;
}


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

// Macros and Constants
#define ll long long
const ll mod=1000000007LL;

int main(int argc, char const *argv[])
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int N;
    cin >> N;
    cout << N*N*N;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
//double pi=3.1415926535898;
//double pi=acos(-1.0);
#define scarr(a,s,e) for(int i=s;i<=int(e);i++) scanf("%d ",&a[i]);
#define prarr(a,s,e) for(int i=s;i<=int(e);i++) printf("%d ",a[i]);
#define speed      ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
#define rng(i,a,b) for(int i=a;i>=int(b);i--)
#define rep(i,a,b) for(int i=a;i<=int(b);++i)
#define lop(i,n)   for(int i=0;i<int(n);i++)
#define ms(x,a)    memset(x,a,sizeof(x))
#define all(x)     (x).begin(),(x).end()
#define sz(x)      int(x.size())
#define pb         push_back
#define mkp        make_pair
#define fr         first
#define se         second
#define sc(x)      scanf("%d",&x)
#define pr(x)      printf("%d ",x)
#define scl(x)     scanf("%lld",&x)
#define prl(x)     printf("%lld ",x)
#define prln(x)    printf("%d\n",x)
#define r0         return 0;
#define CC         continue;
#define scd(x)     scanf("%lf",&x)
#define prd(x)     printf("%.10f\n",x);
#define bb(x)      cerr<< x <<endl;
#define ii         pair<int,int>
//#define max(a,b) a<b?b:a
//#define min(a,b) a<b?a:b
const ll M   = 1e7+9 ;
const ll inf = 1e19  ;
const int si = 1e5+9 ;
//////////////////////    Hi    ^_^  hack me if you can :P

ll a,b,c;
ll x[3];
int main()
{
    cin>>x[0]>>x[1]>>x[2];
    sort(x,x+3);
    a=x[0];
    b=x[1];
    c=x[2];
    ll xx = a*b*c;
    if(xx&1){
        cout<<a*b;
    }
    else
        cout<<0;
    
    r0;
}





Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
import Control.Arrow
import Control.Monad.Fix
import Data.Foldable
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VMM
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VM
import qualified Data.ByteString.Char8 as B
import qualified Data.Set as S
import System.IO.Unsafe
import Debug.Trace

uread :: VU.Unbox a => Int -> VM.IOVector a -> a    
uread i v = unsafePerformIO $ VM.read v i

uwrite :: VU.Unbox a => Int -> a -> VM.IOVector a -> VM.IOVector a
uwrite i a v = unsafePerformIO $ VM.write v i a >> return v

umodify :: VU.Unbox a => Int -> (a -> a) -> VM.IOVector a -> VM.IOVector a
umodify i f v = unsafePerformIO $ VM.modify v f i >> return v

uthaw :: VU.Unbox a => VU.Vector a -> VM.IOVector a
uthaw = unsafePerformIO . VU.thaw

ufreeze :: VU.Unbox a => VM.IOVector a -> VU.Vector a
ufreeze = unsafePerformIO . VU.freeze

dijkstra
  :: Int  -- ^ nodes
  -> (Int -> VU.Vector (Int, Double))  -- ^ edges from i-th node: (end, cost)
  -> Int  -- ^ start node
  -> VU.Vector Double  -- ^ constructed graph
dijkstra n edges s =
  ufreeze $ snd $ fix (\f (nodes,costs) -> case S.minView nodes of
    Nothing -> (S.empty,costs)
    Just ((c,n), nodes) ->
      if c <= uread n costs
        then
          let es = edges n in
            f $ VU.foldl' (\(ns,cs) (e,ec) ->
              let c' = c + ec in if c' < uread e costs
                then (S.insert (c',e) ns, uwrite e c' cs)
                else (ns,cs)
              ) (nodes,costs) es
        else f (nodes,costs)) (nodes0,costs0)
  where
    costs0 :: VM.IOVector Double
    costs0 = uwrite s 0 (uthaw $ VU.replicate n $ fromIntegral (maxBound :: Int))

    nodes0 :: S.Set (Double,Int)
    nodes0 = S.singleton (0,s)

solve :: Int -> Int -> Int -> Int -> Int -> VU.Vector (Int,Int,Int) -> Double
solve xs ys xt yt n xyr = graph VU.! (n+1)
  where
    big = fromIntegral (maxBound :: Int)

    dist2C :: (Int,Int,Int) -> (Int,Int,Int) -> Double
    dist2C (x1,y1,r1) (x2,y2,r2) = (sqrt (fromIntegral $ (x1-x2)^2 + (y1-y2)^2) - fromIntegral (r1+r2)) `max` 0

    toIndex (i,j) = i * (n+2) + j

    {-# NOINLINE distMemo #-}
    distMemo = ufreeze $ foldl' (\acc (i,j) ->
      let c1 = if i == n then (xs,ys,0) else if i == n+1 then (xt,yt,0) else xyr VU.! i
          c2 = if j == n then (xs,ys,0) else if j == n+1 then (xt,yt,0) else xyr VU.! j in
        uwrite (toIndex (i,j)) (dist2C c1 c2) acc
      ) (uthaw $ VU.replicate ((n+2)*(n+2)) big) [(i,j) | i <- [0..n+1], j <- [0..n+1], i /= j]
    graph = dijkstra (n+2) (\e -> VU.map (\i -> (i, distMemo VU.! toIndex (i,e))) $ VU.fromList [0..n+1]) n

main = do
  let readInt = fmap (second B.tail) . B.readInt

  (xs,ys,xt,yt) <- (\vec -> (vec VU.! 0, vec VU.! 1, vec VU.! 2, vec VU.! 3)) . VU.unfoldrN 4 readInt <$> B.getLine
  n <- (\vec -> (vec VU.! 0)) . VU.unfoldrN 1 readInt <$> B.getLine
  xyr <- VU.replicateM n $ (\vec -> (vec VU.! 0, vec VU.! 1, vec VU.! 2)) . VU.unfoldrN 3 readInt <$> B.getLine
  print $ solve xs ys xt yt n xyr


Measured memory_bytes: 89468
#include<bits/stdc++.h>
#define endl '\n'
#define ll long long int
#define loop(i,a,b)           for(ll i=a;i<=b;++i)
#define pb                    push_back
#define F                     first
#define S                     second
#define mp                    make_pair
#define clr(x)                x.clear()
#define MOD                   1000000007
#define itoc(c)               ((char)(((int)'0')+c))
#define vl                    vector<ll>
#define SZ(x)                 (x).size()
#define all(p)                p.begin(),p.end()
#define mid(s,e)              (s+(e-s)/2)
#define sv()                  ll t,n; scanf("%lld",&t);n=t; while(t--)
#define tcase()               ll t,n; cin>>t;n=t; while(t--)
#define iscn(num)             scanf("%d",&num);
#define scn(num)              scanf("%lld",&num);
#define scn2(num,num2)        scanf("%lld%lld",&num,&num2);
#define dbg(x)                cerr <<"( "<<#x << " = " << x << " )"<<endl
using namespace std;
const ll INF = 2e18 + 99;
typedef pair<ll,ll> Pair;
typedef vector<ll> vec;;
void FAST_IO();
void ara_read(vec &v,ll n);
////////////////////////

int main()
{
	ll n, knapsack ;
	scanf("%lld%lld",&n,&knapsack);
	/* now in this problem knapsack size is huge,
	 * so we can't use it as dp dimension. but here now value 
	 * is kinda small , we can this as dp dimension..
	 * we will use raw swapping to solve this dp problem */
	ll nax = n* 1000 + 10;
	vector< vector<ll > > dp(2,vector<ll> (nax,INF));
	bool prev=0, next =1;
	dp[0][0]=0 ;
	ll w, v ;
	
	for(int i=0 ; i < n ; i++){
		scanf("%lld%lld",&w,&v);
		for(int value =0 ; value < nax ; ++value){
			if(value<v){
				dp[next][value]= dp[prev][value];
			}else{
				dp[next][value]= min(dp[prev][value],dp[prev][value-v]+ w);
				
			}
		}
		swap(prev, next);
	}
	
	ll ans =0 ;
	for (int x = 0 ; x < nax ; ++x){
		if(dp[prev][x] <= knapsack){
			ans = x ;
			
		}
	}
	
	printf("%lld\n",ans);
    return 0;
}

void FAST_IO()
{
    // ios_base::sync_with_stdio(0);
    //cin.tie(NULL);
    //cout.tie(NULL);
    //cout.setf(ios::fixed);
    //cout.precision(2);

}
void ara_read(vec &v,ll n){
	ll temp;
	for(ll i=0; i<n; i++){
		scanf("%lld",&temp);
		v.emplace_back(temp);
	}
	
}


Measured memory_bytes: 2560
#include <iostream>
#include<stdio.h>
#include<ctype.h>
#include<string.h>
#include <algorithm>
#include <cstring>
#include<queue>
#include <stack>
using namespace std;

int main(){
    int a,b;
    int ans[4];
    memset(ans, 0, sizeof(ans));
    for(int i = 1;i<=2;i++){
        cin >> a;
        ans[a] = 1;
    }
    for(int i = 1;i <= 3;i++){
        if(ans[i] == 0){
            cout << i << endl;
        }
    }
    
    return 0;
}

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

int main(){
    ll a,b,n;
    cin>>a>>b>>n;
    ll x;
    x=min(n,b-1);
    ll ans=a*x/b-a*(x/b);
    cout<<ans<<endl;
    return 0;
}

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

string sol(int a,int b,int c){

  if(a==b and b==c and c==a){
  	return "No";
  }

  if(a!=b and b!=c and c!=a){
  	return "No";
  }

  return "Yes";

}
  

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  
  cout<<sol(a,b,c);
}

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

using namespace std;

const int md = 1e9 + 7;

inline void add(int &a, int b) {
  a += b;
  if (a >= md) a -= md;
}

inline void sub(int &a, int b) {
  a -= b;
  if (a < 0) a += md;
}

inline int mul(int a, int b) {
  return (int) ((long long) a * b % md);
}

int main() {
  int n;
  string s;
  cin >> n >> s;
  vector<int> cnt(26, 1);
  for (auto c : s) {
    cnt[c - 'a']++;
  }

  int res = 1;
  for (int i = 0; i < 26; i++) {
    res = mul(res, cnt[i]);
  }
  sub(res, 1);
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 512
class UF():
  def __init__(self, N):
    self._parent=[n for n in range(0, N)]
    self._size=[1] * N

  def find_root(self, x):
    if self._parent[x]==x:return x
    self._parent[x]=self.find_root(self._parent[x])
    return self._parent[x]

  def unite(self, x, y):
    gx=self.find_root(x)
    gy=self.find_root(y)
    if gx==gy:return

    if self._size[gx]<self._size[gy]:
      self._parent[gx]=gy
      self._size[gy]+=self._size[gx]
    else:
      self._parent[gy]=gx
      self._size[gx]+=self._size[gy]

  def size(self, x):
    return self._size[self.find_root(x)]

  def samegroup(self, x, y):
    return self.find_root(x)==self.find_root(y)

  def groupnum(self):
    N=len(self._parent)
    ans=0
    for i in range(N):
      if self.find_root(i)==i:
        ans+=1
    return ans

n,m=map(int,input().split())
UFa=UF(n)
for i in range(m):
  x,y=map(int,input().split())
  UFa.unite(x-1,y-1)
ans=[]
for i in range(n):
  ans.append(UFa.size(i))
print(max(ans))

Measured memory_bytes: 95960
import java.util.Scanner;

class Main{

	public static void main(String[] args) {


		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int[] data = new int[N];
		int sum = 0;
		for(int i= 0;i < N;i++){
			sum += scan.nextInt()-1;
		}

		
		
		System.out.println(sum);


	}

	


}








Measured memory_bytes: 24048
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(long long i = 0; i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    ll x, k=1;
    cin >> x;
    while(x*k%360 != 0) k++;
    cout << k << endl;
    return 0;
}

Measured memory_bytes: 3580
n = gets.to_i
as = gets.to_s.split(' ').map(&:to_i)
bs = gets.to_s.split(' ').map(&:to_i)
cs = gets.to_s.split(' ').map(&:to_i)

score = 0
as.each_with_index do |a, idx|
  score += cs[a - 1] if idx != as.size - 1 && as[idx + 1] == a + 1
  score += bs[a - 1]
end

puts score


Measured memory_bytes: 1788
n=int(input())
h=[0]+list(map(int,input().split()))
dp=[0]*(n+1)

dp[2]=abs(h[2]-h[1])
for i in range(3,n+1):
  jump1=dp[i-2]+abs(h[i-2]-h[i])
  jump2=dp[i-1]+abs(h[i-1]-h[i])
  dp[i]=min(jump1,jump2)

print(dp[n])

Measured memory_bytes: 13980
#include <iostream>
#include <cstdio>
using namespace std;
int main(void){
    double r;
    cin >> r;
    double a=3.14159265358979;
    printf("%.7f %.7f\n",r*r*a,r*2*a);
    return 0;
    // Your code here!
    
}



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

#define endl "\n"
#define f first
#define s second
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ll long long
#define faster ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const ll M = 998244353;
const int N = 1e6+5;
const ll INF = 1e18;

ll n,m;
pll a[N];

int main() {
	faster;
	cin>>n>>m;
	for (int i = 1; i<=n; i++) {
		cin>>a[i].f>>a[i].s;
	}
	sort(a+1,a+1+n);
	ll cnt = 0,ans = 0;
	int i = 1;
	while (cnt < m) {
			//cout<<cnt<<' ';
		ll q = min(m - cnt,a[i].s);
		ans+= q*(a[i].f);
		cnt+=q;
		i++;
	}
	cout<<ans;

    return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>

int main()
{

  int a,b;
  int g;
  
  
  scanf("%d %d",&a,&b);
  
  if(a < b){
    while (a != 0){
      g = b % a;
      b = a;
      a = g;
    }
 
    printf("%d\n",b);
   }
  
  else if(a > b){
    while (b != 0){
      g = a % b;
      a = b;
      b = g;
    }
    
    printf("%d\n",a);
   
  }

  else if(a == b){
    printf("%d\n",a);
  }

  return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>

typedef long long ll;

using namespace std;

#define all(x) x.begin(), x.end()

const ll INF = 1e9;

ll n;
ll xs, ys, xf, yf;
ll x[5000], y[5000], r[5000];
double d[1111][1111];

double dist(int i, int j)
{
    return sqrt((double)(x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> xs >> ys >> xf >> yf >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> x[i] >> y[i] >> r[i];
    }
    x[0] = xs;
    y[0] = ys;
    x[n + 1] = xf;
    y[n + 1] = yf;
    n += 2;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            d[i][j] = max((double)0, dist(i, j) - r[i] - r[j]);
        }
    }
    for (int k = 0; k < n; k++)
    {
        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < n; j++)
            {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
    printf("%.9f", d[0][n - 1]);
}


Measured memory_bytes: 8960
import java.util.Scanner;

public class Main {

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

	    int N=gi();
	    int K=gi();
	    int[] A=new int[N];
	    for (int i=0; i<N;i++) {
	    	A[i]=gi();
	    }
	    
	    for (int i=K; i<N;i++) {
	    	int b=A[i-K];
	    	int a=A[i];
	    	if(b<a) {
	    		System.out.println("Yes");
	    	} else {
	    		System.out.println("No");
	    	}
	    }

//
//	    if(A<B && B<C) {
//	        System.out.println("Yes");
//	    } else {
//	    	System.out.println("No");
//	    }
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 60608
import java.io.*;
import java.util.Arrays;
public class Main {
        public static void main(String[] args) throws IOException {
                BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
                String is; 
                String ia[];
                while(true){
                        ia = in.readLine().split(" ");
                        int a, b, c;
                        a = Integer.parseInt(ia[0]);
                        b = Integer.parseInt(ia[1]);
                        c = Integer.parseInt(ia[2]);
                        if(a == 0 && b == 0 && c == 0){ 
                                break;
                        }   
                        int cm[][][] = new int[a][][];
                        for(int i = 0;i < a; ++i){
                                int d = Integer.parseInt(in.readLine());
                                cm[i] = new int[2][d];
                                ia = in.readLine().split(" ");
                                for(int j = 0;j < d; ++j){
                                        cm[i][0][j] = Integer.parseInt(ia[2*j]);
                                        cm[i][1][j] = Integer.parseInt(ia[2*j+1]);
                                }   
                        }

                        int max = 0, t = 0;
                        for(int i = b;i < c;){
                                boolean x[] = new boolean[a];
                                Arrays.fill(x,true);
                                for(int j = 0;j < a; ++j){
                                        for(int k = 0;k < cm[j][0].length; ++k){
                                                if(cm[j][0][k] <= i && i < cm[j][1][k]){
                                                        x[j] = false;
                                                }
                                        }
                                }
                                boolean y = false;
                                for(int j = 0;j < a; ++j){
                                        if(x[j] == true){
                                                y = true;
                                                break;
                                        }
                                }
                                if(y){
                                        ++t;
                                } else {
                                        if(max < t){
                                                max = t;
                                        }
                                        t = 0;
                                }

                                if((++i)%100 == 60){
                                        i+=40;
                                }
                        }
                        if(max < t){
                                max = t;
                        }
                        System.out.println(max);
                }
        }
}

Measured memory_bytes: 9796
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <string>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
using namespace std;

#define REP(i,p,n) for(ll i=p;i<ll(n);++i)
#define rep(i,n) REP(i,0,n)

using ll = long long int;
using pll = pair<ll, ll>;

int main()
{
    ll K, A, B;
    cin >> K >> A >> B;

    bool res = false;

    for (ll x=A;x<=B;++x)
    {
        if ((x % K) == 0) { res = true; }
    }

    cout << (res ? "OK" : "NG") << endl;

    return 0;
}


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

#define _fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pi acos(-1)
#define MAXS 1e(18)
#define MOD 1000000007
#define all(v) v.begin(),v.end()

using namespace std;
typedef long long ll;

int main()
{

    _fastIO;

    ll x,y; cin>>x>>y; if(x==y)cout<<"Yes"<<endl; else cout<<"No"<<endl;

    return 0;
}


Measured memory_bytes: 256
import numpy as np
N = int(input())
A = np.array([int(input()) for _ in range(N)])
ans = 0
for i in range(N-1):
    d,m = divmod(A[i],2)
    ans += d
    if m == 1:
        if A[i+1] > 0:
            A[i+1] -= 1
            ans += 1

ans += A[-1]//2
print(ans)

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

int main() {
   int N, K;
   cin >> N >> K;
   
   vector<int> x(N);

   for(int i = 0; i < N; i++) {
       cin >> x[i];
   }
    ll res = 1000000000000000;
    for(int i = 0; i <= N - K; i++) {
        ll left = x[i];
        ll right = x[i + K - 1];

        res = min(res, right - left + min(abs(left), abs(right)));

    }

    cout << res << endl;
    return 0;

}

Measured memory_bytes: 640
N,K=map(int,input().split(" "))
H=[int(input()) for _ in range(N)]
H.sort()
tmax=10**9
for a in range(N-K+1):
    h1,h2=H[a],H[a+K-1]
    tmax=min(tmax,abs(h1-h2))
    if(tmax==0):
        break
print(tmax)

Measured memory_bytes: 7384
#![allow(unused_macros)]

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

#[allow(unused_imports)]
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars, Isize1, Usize1};

macro_rules! chmin {
    ($a:ident,$b:expr) => {
        $a = {
            let tmp = $b;
            if ($a > $b) {
                $b
            } else {
                $a
            }
        }
    };
}

macro_rules! chmax {
    ($a:ident,$b:expr) => {
        $a = {
            let tmp = $b;
            if ($a < $b) {
                $b
            } else {
                $a
            }
        }
    };
}

const LG: usize = 30;

#[allow(non_snake_case)]
#[allow(unused)]
fn main() {
    input! {
        N:usize,
        K:Isize1,
        P:[Usize1;N],
        C:[i32;N],
    }
    let mut dst = vec![vec![0usize; N]; LG];
    let mut sum = vec![vec![0i64; N]; LG];
    let mut opt = vec![vec![0i64; N]; LG];

    for i in 0..N {
        dst[0][i] = P[i];
        sum[0][i] = C[P[i]] as i64;
        opt[0][i] = max(C[P[i]], 0) as i64;
    }

    for k in 1..LG {
        for i in 0..N {
            dst[k][i] = dst[k - 1][dst[k - 1][i]];
            sum[k][i] = sum[k - 1][i] + sum[k - 1][dst[k - 1][i]];
            opt[k][i] = max(opt[k - 1][i], sum[k - 1][i] + opt[k - 1][dst[k - 1][i]]);
        }
    }

    let mut ans = i64::min_value();
    for i in 0..N {
        let mut v = P[i];
        let mut sm = C[v] as i64;
        chmax!(ans, sm);
        //ans = max(ans, sm);
        for k in 0..LG {
            if (K >> k & 1) == 0 {
                continue;
            }
            chmax!(ans, sm + opt[k][v]);
            sm += sum[k][v];
            v = dst[k][v];
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 5764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd_(ll a,ll b){if(a%b==0)return b;return gcd_(b,a%b);}
ll lcm_(ll a,ll b){ll c=gcd_(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
//tie(a,b,c) = make_tuple(10,9,87);
#define pop_(a) __builtin_popcount((a))
ll keta(ll a){ll r=0;while(a){a/=10;r++;}return r;}



int main(){

  string S;
  cin >> S;
  vector<ll> x(S.size()+3,INF),ans(S.size()+100,0);
  x[0] = 0;
  FOR(i,1,S.size()){
    x[i] = x[i-1] + (S[i]!=S[i-1]);
  }


  FOR(i,0,S.size()){    
    if(S[i]=='L'){//左に行く
      ll ind = POSU(x,(x[i]-1));
      ll sa = (i-ind)%2;
      if(i<ind)cout << "EEEE" << i << " " << ind << endl;
      if(sa==0){
        ans[ind]++;
      }else{
        ans[ind-1]++;
      }
    }else{
      ll ind = POSU(x,x[i]);
      ll sa = (ind-i)%2;
      if(i>ind)cout << "EEEEA" << endl;
      if(sa==0){
        ans[ind]++;
      }else{
        ans[ind-1]++;
      }
    }
  }

  FOR(i,0,S.size()){
    if(i!=0)cout<<" ";
    cout << ans[i];
  }
  cout << endl;


}




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

class Main {
	static BufferedReader br;

	public static void main(String[] args) throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		System.out.println((Integer.parseInt(br.readLine())
				+ Integer.parseInt(br.readLine()))
				* Integer.parseInt(br.readLine()) / 2);
	}
}

Measured memory_bytes: 7892
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long a = sc.nextInt();
    long b = sc.nextInt();
    long[] x = new long[n];
    for(int i=0;i<n;i++){
      x[i] = sc.nextInt();
    }
    long ans = 0;
    for(int i=0;i<n-1;i++){
      long delta = a*(x[i+1]-x[i]);
      ans += Math.min(delta,b);
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 56752
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
#define mp  std::make_pair
#define ll long long int
#define abs(n) ((n>0)?(n):((n)*(-1)))
#define CEIL(a,b) (((a) + ((b)-1)) / (b))
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
#define VREP_ll(v) for(std::vector<ll>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VREP_int(v) for(std::vector<int>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VALL(v) ((v).begin(),(v).end())
#define errln(v) cerr << (v) << endl;
#define println(v) cout << (v) << endl;

int main(int argc, const char * argv[]) {
	int a;
	string s;
	cin >> a >> s;
	if(a>=3200){
		println(s);
	}else{
		println("red");
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long

int main() {
	std::string S;
	std::cin >> S;
	for(int i = 0; i < (int)S.size(); ++i) {
		if(S[i] == '?') putchar('D');
		else putchar(S[i]);
	}
	return 0;
}


Measured memory_bytes: 3728
import java.util.Scanner;

class Main{



	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int K = sc.nextInt();
		int gu = 0;
		int ki = 0;
		if(K % 2 == 0){
			gu = K/2;
			ki = K/2;
		}else{
			gu = K/2;
			ki = K/2+1;
		}
		System.out.println(gu*ki);
		

	}


}




class Pair implements Comparable{
	int from;		//p
	int end;		//y
	int num;
	int bango;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return from - otherpair.from;
	}
}



Measured memory_bytes: 25300
#include <stdio.h>

int count(int *a, int num, int b) {
    int count = 0;
    for (int i=0; i<num; i++) {
        if (a[i]%b != 0) count++;
        if (count > 1) return 0;
    }
    return 1;
}

int main() {
    int num = 0;
    scanf("%d\n", &num);
    int a[num];
    for (int i=0; i<num; i++) {
        scanf("%d", a+i);
    }
    int min = 0, min2 = 0;
    if (a[0] > a[1]) min = a[1], min2 = a[0];
    else min = a[0], min2 = a[1];
    for (int i=2; i<num; i++) {
        if (a[i] < min) min = a[i];
        else if (a[i] < min2) min2 = a[i];
    }
    int max = 0;
    if (num == 2) printf("%d\n", min2);
    else {
        for (int i=min; i>0; i--) {
            if (min%i == 0) {
                if (count(a, num, i)) {
                    max = i;
                    break;
                }
            }
        }
        for (int i=min2; i>0; i--) {
            if (min2%i == 0) {
                if (count(a, num, i)) {
                    if (i > max) max = i;
                    break;
                }
            }
        }
        printf("%d\n", max);
    }
    return 0;
}


Measured memory_bytes: 512
#include <stdio.h>
int main(void){
    // Your code here!
    int a[3],b[2],k;
    for(int i=0;i<3;i++)scanf("%d",&a[i]);
    for(int i=0;i<2;i++)scanf("%d",&b[i]);
    for(int i=0;i<3;i++){
        for(int j=i+1;j<3;j++){
            if(a[i]>a[j]){
                k=a[i];
                a[i]=a[j];
                a[j]=k;
            }
        }
    }
    if(b[0]>b[1])printf("%d\n",a[0]+b[1]-50);
    else printf("%d\n",a[0]+b[0]-50);
    return 0;
}



Measured memory_bytes: 2036
N=int(input())
c=[[0 for j in range(9)] for i in range(9)]

for i in range(1, N+1):
  istr=str(i)
  x=int(istr[0])
  y=int(istr[-1])
  if y!=0:
    c[x-1][y-1]+=1
    
out=0
for i in range(9):
  for j in range(9):
    out+=c[i][j]*c[j][i]
print(out)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n, t ;
    cin >> n >> t;
    ll x, y;
    ll ans = INF;
    while(n--){
    	cin >> x >> y;
    	if(y <= t) ans = min(ans, x);
    }
    if(ans == INF) cout << "TLE" << endl;
    else cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3648