akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <cstdint>
#include <unordered_set>
#include <ctime>
#include <numeric>
typedef long long int llint;


template <std::uint_fast64_t Modulus> class modint {
  using u64 = std::uint_fast64_t;

public:
  u64 a;

  modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  u64 &value() noexcept { return a; }
  const u64 &value() const noexcept { return a; }
  modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  modint &operator/=(modint rhs) noexcept {
    u64 exp = Modulus - 2;
    while (exp) {
      if (exp % 2) {
	*this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};

modint<1000000007> exp(llint a, llint b){
  modint<1000000007> ret = 1;
  while(b){
    if(b%2){
      ret *= a;
    }
    a=(a*a)%1000000007;
    b/=2;
  }
  return ret;
}

int main(void){

  llint n, a, b;
  std::cin >> n >> a >> b;

  modint<1000000007> combi = 1; // nC0

  modint<1000000007> total = exp(2, n) - 1;
  //std::cout << total.a << std::endl;

  for(llint i=1; i<=b; i++){
    combi *= n-i+1;
    combi /= i;
    //std::cout << combi.a << std::endl;
    //std::cout << i << " " << combi.a << " " << total.a << std::endl;
    if(i == a || i == b){
      total -= combi;
      //std::cout << i << " " << combi.a << " " << total.a << std::endl;
    }
  }
  std::cout << total.a << std::endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<stack>
#include<queue>

using namespace std;
static const int INF=(1<<29);

int main(){
	int H,W;
	int dp[51][51];
	char s[51][51];
	scanf("%d %d",&H,&W);
	for(int i=0;i<H;i++){
		scanf("%s",s[i]);
	}
	for(int i=0;i<=H;i++){
		for(int j=0;j<=W;j++){
			dp[i][j]=INF;
		}
	}
	dp[0][0]=0;
	dp[0][1]=0;
	dp[1][0]=0;
	for(int i=1;i<=H;i++){
		for(int j=1;j<=W;j++){
			dp[i][j]=min(dp[i-1][j],dp[i][j-1])+s[i-1][j-1]-'0';
		}
	}
	printf("%d\n",dp[H][W]);
}


Measured memory_bytes: 3252
N = int(input())
S = input()
CW = [0]*N
CS = [0]*N
cw = 0
cs = 0
for i in range(N-1):
    if S[i] == 'W':
        cw += 1
    CW[i + 1] = cw
    if S[N - i - 1] == 'E':
        cs += 1
    CS[N - i - 2] = cs

C = [0]*N
for i in range(N):
    C[i] = CW[i] + CS[i]
ans = min(C)
# print(CW, CS, C)
print(ans)


Measured memory_bytes: 48092
#include <string>
#include <vector>
#include <iostream>
using namespace std;
string S; int n, junjo[4] = { 0, 0, 1, 1 };
long long calc(int L,int R){
    int K=0;
    vector<int>junjo2[4];
    for(int i=0;i<4;i++){
        junjo2[junjo[i]].push_back(i);
    }
    for(int i=0;i<4;i++){
        if(junjo2[i].size()>=1){
            for(int j=R-1;j>=L;j--){
                if(S[j]=='('){K++;}
                if(S[j]==')'){K--;}
                for(int k=0;k<junjo2[i].size();k++){
                    if(junjo2[i][k]==0){
                        if(S[j]=='+' && K==0){
                            return calc(L,j)+calc(j+1,R);
                        }
                    }
                    if(junjo2[i][k]==1){
                        if(S[j]=='-' && K==0){
                            return calc(L,j)-calc(j+1,R);
                        }
                    }
                    if(junjo2[i][k]==2){
                        if(S[j]=='*' && K==0){
                            return calc(L,j)*calc(j+1,R);
                        }
                    }
                    if(junjo2[i][k]==3){
                        if(S[j]=='/' && K==0){
                            return calc(L,j)/calc(j+1,R);
                        }
                    }
                }
            }
        }
    }
    if(S[L]=='(' && S[R-1]==')'){return calc(L+1,R-1);}
    return stoi(S.substr(L,R-L));
}
int main() {
	scanf("%d", &n);
	for(int i = 0; i < n; i++) cin >> S, printf("%d\n", calc(0, S.size() - 1));
	return 0;
}

Measured memory_bytes: 3308
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
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;}

const int NM = 2*1e5+10;
int ans[NM];
vector<vector<int>> g(NM);

void dfs(int now, int prev){
    ans[now] += ans[prev];
    for(auto next : g[now]){
        if(next == prev) continue;
        dfs(next, now);
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, q; cin>>n>>q;
    for(int i=1; i<=n-1; i++){
        int a, b; cin>>a>>b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    for(int i=1; i<=q; i++){
        int p, x; cin >> p>>x;
        ans[p] += x;
    }
    dfs(1, 0);
    for(int i=1;i<=n;i++){
        cout << ans[i] <<" ";
    }
}

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

char t[2000000];
int ts;

char u[1000000];
int us;

char ch;
int pos;

void input();
void funcA();
void funcE();
void funcP();
void funcN();
void funcF();
void funcB();
void funcD();
void funcK();
void funcY();

int main(){

  input();
  pos=0;

  while(1){
    cin>>ch;
    if(ch=='a')funcA();
    else if(ch=='e')funcE();
    else if(ch=='p')funcP();
    else if(ch=='n')funcN();
    else if(ch=='f')funcF();
    else if(ch=='b')funcB();
    else if(ch=='d')funcD();
    else if(ch=='k')funcK();
    else if(ch=='y')funcY();
    else break;
    /*
    cout<<ch<<' '<<pos<<endl;
    for(int i=0;i<ts;i++){
      cout<<t[i];
    }
    cout<<endl;
    */
  }
    for(int i=0;i<ts;i++){
      cout<<t[i];
    }

  return 0;
}

void funcA(){
  for(int i=pos-1;;i--){
    if(i<=0){pos=0;return;}
    if(t[i]=='\n'){pos=i+1;return;}
  }
}

void funcE(){
  for(int i=pos;;i++){
    if(i>=ts){pos=ts-1;return;}
    if(t[i]=='\n'){pos=i;return;}
  }
}

void funcP(){
  funcA();
  if(pos==0)return;
  pos--;
  funcA();
}

void funcN(){ 
  funcE();
  if(pos==ts-1){
    funcA();
    return;
  }else{
    pos++;
  }
}

void funcF(){ 
  if(pos+1<ts)pos++;
}

void funcB(){
  if(pos>0)pos--;
}

void funcD(){
  if(pos==ts-1)return;
  ts--;
  for(int i=pos;i<ts;i++){
    t[i]=t[i+1];
  }
}

void funcK(){
  if(pos==ts-1)return;

  if(t[pos]=='\n'){
    us=1;
    u[0]='\n';
    funcD();
    return;
  }
  us=0;
  int c=0;
  for(int i=pos;;i++){
    if(t[i]=='\n')break;
    u[us++]=t[i];
    c++;
  }
  ts-=c;
  for(int i=pos;i<ts;i++){
    t[i]=t[i+c];
  }
}

void funcY(){
  if(us==0)return;
  if(u[0]=='\n'&&us==1){
    ts++;
    for(int i=ts-1;i>pos;i--)t[i]=t[i-1];
    t[pos]='\n';
    pos++;return;
  }
  
  ts+=us;
  for(int i=ts-1;i>=pos+us;i--){
    t[i]=t[i-us];
  }
  for(int i=pos;i<pos+us;i++){
    t[i]=u[i-pos];
  }
  pos+=us;
}

void input(){
  ts=us=0;
  string str;
  while(1){
    getline(cin,str);
    if(str=="END_OF_TEXT")break;
    for(int i=0;i<(int)str.size();i++)
      t[ts++]=str[i];
    t[ts++]='\n';
  }

}

Measured memory_bytes: 1192
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
using ll=long long;
static const ll mod = 1e9 + 7;
static const ll INF = 1LL << 50;
using namespace std;

//ワーシャルフロイド法
vector<vector<int>>d;
//dをmain内で初期化
void warshall_floyd(int V){
    rep(i,V)d[i][i]=0;
	for(int k=0;k<V;++k){
		for(int i=0;i<V;++i){
			for(int j=0;j<V;++j)d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
		}
	}
}

signed main(){
    int n,m;
    cin>>n>>m;
    d.resize(n,vector<int>(n,1000000));
    vector<int>a(m),b(m),c(m);
    rep(i,m){
        cin>>a[i]>>b[i]>>c[i];
        a[i]--;b[i]--;
        d[a[i]][b[i]]=c[i];d[b[i]][a[i]]=c[i];
    }
    warshall_floyd(n);
    bool judge;
    ll ans=0;
    rep(i,m){
        judge=true;
        rep(j,n){
            rep(k,n){
                if(d[j][k]==(d[j][a[i]]+c[i]+d[b[i]][k]))judge=false;
            }
        }
        if(judge)++ans;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
"use strict"

const arg_str = require('fs').readFileSync('/dev/stdin', 'UTF-8')
const args= arg_str.split(' ')
const arg_1 = parseInt(args[0])
const arg_2 = parseInt(args[1])

const sum = arg_1 + arg_2
const div = Math.floor(sum / 2)
const mod = sum % 2

const IMPOSSIBLE = "IMPOSSIBLE"

if(mod != 0){
  console.log(IMPOSSIBLE)
  return
}

console.log(div)

Measured memory_bytes: 7372
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (b-a<=2){
            System.out.println(1+k);
        }else {
            int kk = k+1-a;
            System.out.println((b-a)*(kk/2L)+kk%2+a);
        }
    }
}


Measured memory_bytes: 35648
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#solve
def solve():
    n = II()
    s = S()
    if s[: n // 2] == s[n // 2 :]:
        print("Yes")
    else:
        print("No")
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 39152
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto nk = readln.split.to!(int[]);
    auto N = nk[0];
    auto K = nk[1];

    long[] as;
    foreach (i, a; readln.split) {
        as ~= a.to!long;
        if (i) as[i] += as[i-1];
    }
    long[long] cs;
    cs[0] = 1;
    long r;
    foreach (i, a; as) {
        if (i >= K-1) {
            if (i-K == -1) {
                --cs[0];
            } else {
                auto k = (as[i-K] - (i.to!long-K) - 1) % K;
                --cs[k];
            }
        }
        auto j = (a - i.to!long - 1) % K;
        if (j in cs) r += cs[j];
        ++cs[j];
    }
    writeln(r);
}

Measured memory_bytes: 27156
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)

vector<string>order(int N) {
	//長さNの順列列挙
	vector<string>ans;
	if (N == 1) {
		ans.push_back("1");
	}
	else {
		vector<string>TMP;
		TMP = order(N - 1);
		int A = TMP.size();
		string tmp;
		rep(i, A) {
			rep(j, TMP[i].size()+1) {
				tmp = TMP[i];
				tmp.insert(j, to_string(N));
				ans.push_back(tmp);
			}
		}
	}


	return ans;
}

int main() {
	int N;
	cin >> N;
	vector<int>P(N);
	vector<int>Q(N);
	rep(i, N) {
		cin >> P[i];
	}
	rep(i, N) {
		cin >> Q[i];
	}
	string SP, SQ;
	rep(i, N) {
		SP.push_back(char('0' + P[i]));
	}
	rep(i, N) {
		SQ.push_back(char('0' + Q[i]));
	}
	vector<string>V;
	V = order(N);
	sort(V);
	int A = V.size();
	int ip, iq;
	rep(i, A) {
		if (V[i] == SP) {
			ip = i;
		}
		if (V[i] == SQ) {
			iq = i;
		}
	}
	cout << abs(ip - iq) << endl;
}

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

int main() {
	int n;
	cin >> n;
	int sum = 0;
	while (n) {
		sum += n % 10;
		n /= 10;
	}
	if (sum == 1) sum = 10;
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
using AtCoderBeginnerContest153.Questions;
using AtCoderBeginnerContest153.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace AtCoderBeginnerContest153.Questions
{
    public class QuestionB : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var hn = inputStream.ReadIntArray();
            long h = hn[0];
            int n = hn[1];
            var a = inputStream.ReadLongArray();

            yield return h - a.Sum() <= 0 ? "Yes" : "No";
        }
    }
}


namespace AtCoderBeginnerContest153
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionB();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace AtCoderBeginnerContest153.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace AtCoderBeginnerContest153.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

Measured memory_bytes: 19296
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main()
{
    long long  N,K;
    cin >> N >> K;
    vector<pair<int,int> > v;
    for (int i=0; i<N; ++i)
    {
        int a,b;
        cin >> a >> b;
        pair<int,int> p = {a,b};
        v.push_back(p);
    }
    
    sort(v.begin(), v.end());
    long long sum = 0;
    for (int i=0; i<N; ++i)
    {
        sum += v[i].second;
        if(sum>=K)
        {
            cout << v[i].first << endl;
            return 0;
        }


        //cout << v[i].first() << " " << v[i].second() << endl;
    }

    // cout << v.back().first << endl;
    
    return 0;
}

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

using namespace std;
using ll = long long;

const int INF = 1e9;
const double PI = acos(-1.0);
const ll MOD = 1e9 + 7;

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << #x << ": " << x << endl;
#define popcnt __builtin_popcount


int main() {
    string s;
    cin>>s;
    int N = sz(s);
    map<char, int> cnt;
    for(int i = 0; i < N; i++)
    {
        cnt[s[i]]++;
    }

    if(N==1){
        puts("YES");
    }else if(N==2){
        if(cnt['a']>=2||cnt['b']>=2||cnt['c']>=2)puts("NO");
        else puts("YES");
    }else{
        if(cnt['a']>=N/3&&cnt['b']>=N/3&&cnt['c']>=N/3
        &&abs(cnt['a']-cnt['b'])<=1&&abs(cnt['b']-cnt['c'])<=1&&abs(cnt['c']-cnt['a'])<=1)puts("YES");
        else puts("NO");
    }

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<28;
const long long MOD =1000000000+7;
void solve(int a){cout<<( a?"Yes":"No")<<endl;}
int main(){
	string s,t;
	cin >>s;
	cin>>t;
	bool ans=true;
	map<char,char>transA;
	map<char, char> transB;
	for(char i ='a';i!=(char)('z'+1);i++){
		transA[i]='\0';
		transB[i] = '\0';
	}
	for(int i=0;i<s.size();i++){
		if(transA[s[i]]=='\0' or transA[s[i]]==t[i]){
			transA[s[i]]=t[i];
			
		}else{
			ans=false;
			break;
		}
		if (transB[t[i]] == '\0' or transB[t[i]] == s[i])
		{
			transB[t[i]] = s[i];
			
		}
		else
		{
			ans = false;
			break;
		}
	}
	solve(ans);
}

Measured memory_bytes: 776
#include<bits/stdc++.h>
#define ll long long
#define uint unsigned int
#define ull unsigned long long
#define inf 1010000000
#define infll 1010000000000000000ll
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define mpr make_pair
#define fi first
#define se second
#define pq priority_queue<int>
#define pqll priority_queue<ll>
#define up(x,y) (x<(y)?x=(y):0)
#define dn(x,y) (x>(y)?x=(y):0)
#define ad(x,y) (x=(x+(y))%mod)
#define cbn(x,y) ((ll)fac[x]*inv[y]%mod*inv[(x)-(y)]%mod)
#define N 1000009
using namespace std;

int read(); ll readll();

int n,tot=1,ch[N][26],a[N],sz[N],fa[N],e[N],g[26]; char s[N];
int main(){
	scanf("%d",&n);
	int i,j,k,now;
	for (i=1; i<=n; i++){
		scanf("%s",s+1);
		int l=strlen(s+1);
		//cerr<<l<<'\n';
		now=1;
		for (; l; l--){
			int c=s[l]-'a';
			if (!ch[now][c]){ ch[now][c]=++tot; fa[tot]=now; e[tot]=c; }
		//	cerr<<now<<' '<<(char)(c+'a')<<' '<<ch[now][c]<<'\n';
			now=ch[now][c];
		}
		a[now]=sz[now]=1;
	}
	ll ans=0;
	for (i=tot; i; i--)
		for (j=0; j<26; j++) sz[i]+=sz[ch[i][j]];
	for (i=1; i<=tot; i++) if (a[i]){
		memset(g,0,sizeof(g));
		for (j=i; j>1; j=fa[j]){
			g[e[j]]++;
			for (k=0; k<26; k++) if (g[k] && a[ch[fa[j]][k]]) ans++;
		}
	}
	printf("%lld\n",ans-n);
	return 0;	
}

int read(){
	int x=0; char ch=getchar(); bool flag=0;
	while (ch<'0' || ch>'9'){ if (ch=='-') flag=1; ch=getchar(); }
	while (ch>='0' && ch<='9'){ x=x*10+ch-'0'; ch=getchar(); }
	return flag?-x:x;
}
ll readll(){
	ll x=0; char ch=getchar(); bool flag=0;
	while (ch<'0' || ch>'9'){ if (ch=='-') flag=1; ch=getchar(); }
	while (ch>='0' && ch<='9'){ x=x*10+ch-'0'; ch=getchar(); }
	return flag?-x:x;
}


Measured memory_bytes: 119964
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long m,l=0;
  cin>>m;
  for(long long i=1;i<=m;i++){
    if(i%5!=0&&i%3!=0)
      l+=i;
  }
  cout<<l<<endl;
  return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    int n, a, b; cin >> n >> a >> b;
    cout << min(a * n, b) << endl;

    return 0;
}


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

#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define fcin ios::sync_with_stdio(false); cin.tie(nullptr);
#define INF 0x3f3f3f3f
#define all(x) x.begin(), x.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

template <typename A, typename B>
string to_string(pair<A, B> p){
    return "(" + to_string(p.fi) + ", " + to_string(p.se) + ")";
}

template <typename T>
string to_string(T v){
    string s = "{";
    bool first = true;
    for(const auto & x : v){
        if(!first) s += ", ";
        first = false;
        s += to_string(x);
    }
    return s + "}";
}

void debug_out(){ cerr << endl;}
template <typename First, typename... Next>
void debug_out(First F, Next... N){
    cerr << " " << to_string(F);
    debug_out(N...);
}

#ifdef LOCAL
    #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
    #define debug(...) 1
#endif

int main(){
    fcin;

    int n;
    cin >> n;

    string s;
    cin >> s;

    int m = s.size();
    for(int i = 0; i < m; i++){
        int k = int(s[i] - 'A');
        k += n;
        k %= 26;

        s[i] = char('A' + k);
    }

    cout << s << endl;
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;
int main(){
    int R[MAX], n;
    cin >> n;
    for(int i = 0 ; i < n ; i++) cin >> R[i];

    int maxv = -2000000000;
    int minv = R[0];

    for (int i = 1; i < n; i++){
        maxv = max(maxv, R[i] - minv);
        minv = min(minv, R[i]);
    }
    
    cout << maxv << endl;

    return 0;
}


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

int main(){
    int N,K;
    cin >> N >> K;
    int h[N];
    int count = 0;
    for(int i = 0;i<N;i++){
        cin >> h[i];
    }
    for(int i= 0;i<N;i++){
        if(h[i]>=K){
            count++;
        }
    }
    cout << count << endl;
}

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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<endl

int main(){
    int a,b;
    scanf("%d %d",&a,&b);
    printf("%d %d\n",a*b,2*a+2*b);
    return 0;
}


Measured memory_bytes: 3200
import math
def is_prime(N):
    if N == 1:
        return False
    for k in range(2, int(math.sqrt(N)) + 1):
        if N % k == 0:
            return False
    return True

X = int(input())
for i in range(X, 2 * 10 ** 7):
    if is_prime(i):
        print(i)
        exit()

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double a = sc.nextDouble();
		double b = sc.nextDouble();
		double C = sc.nextDouble();

		double S = 0.5*a*b*Math.sin(Math.PI*C/180.0);
		double c = Math.sqrt(a*a+b*b-2*a*b*Math.cos(Math.PI*C/180.0));

		System.out.printf("%.10f\n",S);
		System.out.printf("%.10f\n",a+b+c);
		System.out.printf("%.10f\n",2*S/a);
	}

}



Measured memory_bytes: 28144
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    long long sum=0;
    for(int i=1; i<=n; i++){
        if(i%3==0 || i%5==0){
            
        }
        else{
           sum+=i; 
        }
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 3580
x , n = map(int , input().split())
b = []
if n!=0:
    b = list(map(int,input().split()))
t = 0
ans = 0
while 1:
    if x-t not in b:
        ans = x - t
        break
    if x+t not in b:
        ans = x + t
        break
    t += 1
print(ans)

Measured memory_bytes: 9192
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, a, b) for (int i = a; i < (b); i++)
#define FOR(i, n) for (int i = n; i >= 0; i--)
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <vector>
#define ll long long
#define INF 1000000001;
using namespace std;

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

    ll a,b,c;

    RREP(a,1,3500){
        RREP(b,1,3500){
            ll waru = 4*a*b - n*a - n*b;
            if(waru > 0 && (a*b*n)%waru == 0){
                c = (a*b*n)/waru;
                cout << a << " " << b << " " << c << endl;
                return 0;
            }
        }
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int H,W;
	int i,j;
	while(1){
		scanf("%d %d",&H,&W);
		if(H==0 && W==0) break;
		for(i=0; i<H; i++){
			for(j=0 ;j<W; j++){
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

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

using namespace std;

int main(void) {
	int A, B, C;
	cin >> A >> B >> C;
	if((A == B && B != C) || (A == C && A != B) || (B == C && B != A)) {
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}
	return 0;
}



Measured memory_bytes: 256
s = list(input())
ans = "Yes"
n = len(s)
for i in range(n):
    if i % 2 == 0 and s[i] == "L":
        ans = "No"
        break
    elif i % 2 == 1 and s[i] == "R":
        ans = "No"
        break
print(ans)

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin >> n >> m;
  vector<int>a(n);
  vector<int>b(m);
  vector<int>c(m);
  vector<bool>d(n,1);
  for(int i = 0;i<n;i++) cin >> a[i];
  for(int i = 0;i<m;i++) {
    cin >> b[i];
    cin >> c[i];
  }
  for(int i = 0;i<m;i++){
    if(a[b[i]-1]<a[c[i]-1]) d[b[i]-1] = 0;
    else if(a[b[i]-1]>a[c[i]-1]) d[c[i]-1] = 0;
    else {d[b[i]-1]=0;d[c[i]-1]=0;}
  }
  int e = 0;
  for(int i = 0;i<n;i++){
    if(d[i]==1) e++;
  }
  cout << e;
  return 0;

}

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

using namespace std;

#define Vi vector<int>
#define FOR(i,s,e) for (int i=s; i<e; i++)
#define ITER(v) v.begin(), v.end()

constexpr int N_MAX = 100;

int adj_matrix[N_MAX+1][N_MAX+1];
array<int,N_MAX+1> depth;

int n;

void bfs(queue<int>& q, const int d) {
    if (q.empty()) { return; }
    queue<int> next_q;
    while (!q.empty()) {
        int node = q.front();
        if (depth[node] < 0) {
            depth[node] = d;
            FOR(i,1,n+1) {
                if (adj_matrix[node][i] && depth[i] < 0) {
                    next_q.push(i);
                }
            }
        }
        q.pop();
    }
    bfs(next_q, d+1);
}

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

    cin >> n;

    int id, k, v;
    FOR(i,0,n) {
        cin >> id;
        cin >> k;
        FOR(j,0,k) {
            cin >> v;
            adj_matrix[id][v] = 1;
        }
    }

    depth.fill(-1);

    queue<int> q;
    q.push(1);
    bfs(q, 0);

    FOR(i,1,n+1) {
        cout << i << " " << depth[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 3184
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(i = 0; i < n; i++)
//2D::rep(i,j)rep(j,j)cin>>bin[i][j];
//vector<int> a(n)
#define Graph vector<vector<int>>
#define A1 cout<<"No"<<endl
#define A2 cout<<"Yes"<<endl
#define A3 cout<<ans<<
#define AA(i) cout<<i<<endl;
const int U=2e5+5;
const ll MOD=1000000007;
const int INF = 1001001001;

int main(){
    string S,T; cin >> S>>T;
    int ns = 0,ans=10000;
    for(int i=0;i<S.size()-T.size()+1;i++){
        for(int j=0;j<T.size();j++){
            if(S[i+j]!=T[j]) ns++;
        }
        ans = min(ns,ans);
        ns = 0;
    }
    AA(ans);
    return 0;
}

Measured memory_bytes: 3620
N = int(input())
s = input()
s += s[0]
L = ["SS","SW","WS","WW"]

for e in L:
    for k in range(1,N+1):
        if s[k] == "o" and e[-1] == "S":
            e += e[-2]
        elif (s[k] == "x" and e[-1] == "S") or (s[k] == "o" and e[-1] == "W"):
            if e[-2] == "S":
                e += "W"
            else:
                e += "S"
        elif s[k] == "o" and e[-1] == "W":
            if e[-2] == "W":
                e += "S"
            else:
                e += "W"
        else:
            e += e[-2]
    if e[:2] == e[-2:]:
        print(e[:-2])
        exit(0)
print(-1)


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(),x.end()

int main() {

    int a,b;
    cin >> a >> b;

    string s,t;
    s="",t="";
    for(int i=0;i<a;i++) s+= char('0'+b);
    for(int i=0;i<b;i++) t+= char('0'+a);

    string ans = s<t?s:t;
    cout << ans << endl;

}



Measured memory_bytes: 256
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

int main(int argc, char const *argv[]) {
  int N, W;
  cin >> N >> W;
  vector<int> w;
  vector<int> v;
  for (int i = 0; i < N; i++) {
    int a, b;
    cin >> a >> b;
    w.push_back(a);
    v.push_back(b);
  }

  long **dp = new long *[N + 1];
  for (int i = 0; i <= N; i++) {
    dp[i] = new long[W + 1];
  }

  for (int i = 0; i <= W; i++) {
    dp[0][i] = 0;
  }

  for (int i = 1; i <= N; i++) {
    dp[i][0] = 0;
    for (int j = 1; j <= W; j++) {
      long temp = dp[i][j - 1] > dp[i - 1][j] ? dp[i][j - 1] : dp[i - 1][j];

      if (j - w[i-1] >= 0)
        if (dp[i - 1][j - w[i-1]] + v[i-1] > temp)
          temp = dp[i - 1][j - w[i-1]] + v[i-1];

      dp[i][j] = temp;
    }
  }

  cout << dp[N][W] << endl;

  for (int i = 0; i <= N; i++) {
    delete[] dp[i];
  }
  delete[] dp;

  return 0;
}


Measured memory_bytes: 79488
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <ccomplex>
#include <unordered_map>
#include <cstring>
#include <iostream>
#include <numeric>
#include <sstream>
#include <set>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <map>

using namespace std;
#define MAX 1LL << 60

typedef long long ll;
typedef unsigned long long ull;

#define rep(i, s, e) for(ll i = s; i < e; i++)
#define repR(i, s, e) for(ll i = s; i > e; i--)
#define reft0(i, j) setfill('0') << setw(i) << j

template<class T> inline bool chMax(T& a, T b){if(a < b) {a = b; return true;} return false;}
template<class T> inline bool chMin(T& a, T b){if(a > b) {a = b; return true;} return false;}

int main(){
    vector<int> antena;
    rep(i, 0, 5){
        int temp;
        cin >> temp;
        antena.push_back(temp);
    }
    int k;
    cin >> k;
    if (k < antena[4] - antena[0]){
        cout << ":(" << endl;
    }
    else{
        cout << "Yay!" << endl;
    }
    return 0;
}

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

#define FAST_IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define FOR(i,l,r) for(long long i=l; i<r; i++)
#define FOR_REV(i,r,l) for(long long i=r; i>=l; i--)
#define pb push_back
#define mp make_pair

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

    vector <long double> v;
    int x;
    FOR(i,0,n)
    {
        cin>>x;
        long double sum = x*(x+1);
        sum /= 2;

        sum /= (double)x;
        // cout<<sum<<endl;
        v.pb(sum);
    }
    
    long double exp=0;
    FOR(i,0,k)
    {
        exp += v[i];
    }

    long double ans=-1;
    if (exp > ans)
    {
        ans = exp;
    }
    FOR(i,k,n)
    {
        exp -= v[i-k];
        exp += v[i];

        if (exp > ans)
        {
            ans = exp;
        }
    }

    cout<<setprecision(7)<<ans<<endl;
}

Measured memory_bytes: 6384
# coding: utf-8
moto=input()
s=moto
gene='ABC'
f=True
log=[]
while len(s)>3 and f:
    f=False
    if s[:3]=='ABC':
        s=s.replace('ABC','A')
        log.append('A')
        f=True
    elif s[len(s)-3:]=='ABC':
        s=s.replace('ABC','C')
        log.append('C')
        f=True
    elif 'ABC' in s:
        s=s.replace('ABC','B')
        log.append('B')
        f=True
if s!=gene:
    print('No')
    exit()
l=len(log)
for i in range(l):
    s=s.replace(log[l-1-i],'ABC')
if s==moto:
    print('Yes')
else:
    print('No')



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

constexpr long long INF = (1LL << 55);

template<class T>
void chmin (T &a, T b) {
    if (a > b) a = b;
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<long long>> g(n, vector<long long>(n, INF));
    for (int i = 0; i < n; i++) g[i][i] = 0;

    for (int i = 0; i < m; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        g[a][b] = c;
    }

    for (int k = 0; k < n; k++) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (g[i][k] == INF or g[k][j] == INF) continue;
                chmin(g[i][j], g[i][k] + g[k][j]);
            }
        }
    }

    bool neg = false;
    for (int i = 0; i < n; i++) neg |= (g[i][i] < 0);

    if (neg) {
        cout << "NEGATIVE CYCLE" << '\n';
    } else {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (g[i][j] == INF) cout << "INF" << (j + 1 == n ? '\n' : ' ');
                else cout << g[i][j] << (j + 1 == n ? '\n' : ' ');
            }
        }
    }

    return 0;
}


Measured memory_bytes: 3240
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

using namespace std;

#define fori(x) for (int i = 0; i < x; ++i)
#define forj(x) for (int j = 0; j < x; ++j)

typedef long long ll;

const int INF = 2e9 + 5;
const int alength=100100;

int main() {
	ll n,c,k;
	cin>>n>>c>>k;
	ll t[alength]={};
	fori(n){cin>>t[i];}
	sort(t,t+n);
	ll ans=0;
	for(ll i=0;i<n;){
		++ans;
		ll count=0;
		for(ll j=0;i+j<n&&t[i+j]-t[i]<=k&&j<c;++j,++count);
		i+=count;
	}
	cout<<ans;
}

Measured memory_bytes: 4340
import java.util.Scanner;

class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int H1 = Integer.parseInt(sc.next());
		int M1 = Integer.parseInt(sc.next());
		int H2 = Integer.parseInt(sc.next());
		int M2 = Integer.parseInt(sc.next());
		int K = Integer.parseInt(sc.next());
		int wakeUp = H1*60+M1;
		int sleep = H2*60+M2;
		int study = sleep-wakeUp-K;

		System.out.println((study)>=0? study: 0);

	}

}


Measured memory_bytes: 26904
//------------------------------------------------------------------------------MANAS UNIYAL---------------------------------------------------------
//																				NEVER GIVE UP
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
#define ll long long
#define pb push_back
#define fi first
#define se second
#define pii pair<ll,ll>
#define INF 0x3f3f3f3f
#define mod 100000007
#define testcases() ll t; cin>>t; while(t--)
#define debug1(x) cout<<#x<<" "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n";
#define rep(i,start,end) for(ll i=start;i<end;i++)
 
//----------------------------------------------------------------------------------------------------------------------------------------------------


int main()
{
	fast;
	float n;
	cin>>n;
	cout<<ceil(n/2);
	return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize ('O3')
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
#define mp make_pair
#define f first
#define s second
#define pb push_back

const int N = 2e5 + 5;
const int M = 5e5 + 5;
const int OO = 1e9;
const int mod = 1e9 + 7;

int n,k,a[N],I1=-1,I2=-1,J1=-1,J2=-1;
ll ans=1;

void init() {}

int mul(int a, int b) {

    a = (a + mod) % mod;
    b = (b + mod) % mod;
    return (1LL*a*b)%mod;

}

ll solve1() {

    for (int i = k-1; ~i ; --i) {
        if(a[i]<0) {
            I1 = i;
            break;
        }
    }

    for (int i = k; i < n; ++i) {
        if(a[i]>=0) {
            J1 = i;
            break;
        }
    }

    if(I1 == -1 || J1 == -1) return -1;

    int ret = a[J1];

    for (int i = 0; i < k; ++i) {
        if(i!=I1) ret = mul(ret, a[i]);
    }

    return ret;

}

ll solve2() {

    for (int i = k-1; ~i ; --i) {
        if(a[i]>=0) {
            I2 = i;
            break;
        }
    }

    for (int i = k; i < n; ++i) {
        if(a[i]<0) {
            J2 = i;
            break;
        }
    }

    if(I2 == -1 || J2 == -1) return -1;

    int ret = a[J2];

    for (int i = 0; i < k; ++i) {
        if(i!=I2) ret = mul(ret, a[i]);
    }

    return ret;

}

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> n >> k;

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

    sort(a,a+n, [](int a, int b){
        return abs(a)>abs(b);
    });
    

    int cnt = 0;

    for (int i = 0; i < k; ++i) {
        cnt += (a[i]<0);
    }

    if(cnt&1) {

        ll a1 = solve1();
        ll a2 = solve2();

        if(a1==-1 && a2==-1) {

            for (int i = n-1; i > n-1-k; --i) {
                ans = mul(ans, a[i]);
            }

            cout << ans << '\n';

        } else if(a1==-1) cout << a2 << '\n';
        else if(a2==-1) cout << a1 << '\n';
        else if(1LL*a[J1]*a[I2]>1LL*a[J2]*a[I1]) cout << a1 << '\n';
        else cout << a2 << '\n';

    } else {
        for (int i = 0; i < k; ++i) {
            ans = mul(ans, a[i]);
        }

        cout << ans << '\n';

    }

    return 0;
}

Measured memory_bytes: 4392
import java.util.*;
class Main{
	Scanner sc=new Scanner(System.in);
	int[] su=new int[100];
	int sum;
	void go(){
		int n=sc.nextInt();
		for(int i=0; i<n; i++)su[i]=sc.nextInt();
		for(int i=0; i<n-1; i++){
			int min=100;
			int mindex=0;
			for(int j=i+1; j<n; j++){
				if(min>su[j]){
					min=su[j];
					mindex=j;
				}
			}
			if(su[i]>su[mindex]){	
				sum++;
				int a=su[mindex];
				su[mindex]=su[i];
	  			su[i]=a;
			}
		}
		for(int i=0; i<n; i++){
			if(i<n-1)System.out.print(su[i]+" ");
			else System.out.println(su[i]);
		}
		System.out.println(sum);
	}
	public static void main(String[]agrs){
		new Main().go();
	}
}

Measured memory_bytes: 26320
use proconio::input;

fn main() {
    input! {
        n: usize,
    }
    let mut ans = 0;
    
    for i in 1..n+1 {
        if i % 3 != 0 && i % 5 != 0 {
            ans += i
        }
    }
    println!("{}", ans)
}

Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
 
#define oo 1e9
#define fi first
#define se second
#define sp(iiii) setprecision(iiii)
#define IO ios_base::sync_with_stdio(false); cin.tie(0)
#define ms(aaaa,xxxx) memset(aaaa,xxxx,sizeof(aaaa))
#define cntbit(xxxx) __builtin_popcount(xxxx)
#define getbit(xxxx,aaaa) ((xxxx>>(aaaa-1))&1)
#define _cos(xxxx) cos(xxxx*acos(-1)/180)
#define _sin(xxxx) sin(xxxx*acos(-1)/180)
#define _tan(xxxx) tan(xxxx*acos(-1)/180)
#define PE cout<<fixed
 
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pair<int,int>,int> piii;
typedef pair<long long,long long> pll;
typedef pair<pair<long long,long long>,long long> plll;
 
const ld pi=acos(-1);

map<pll,ll> f,calc;
ll h,w,sl[29],a[500009],b[500009],n,i,j,l,k;

ll solve(ll x,ll y) {
    ll kq=0;
    for (int ii=0;ii<=2;ii++) {
        for (int ij=0;ij<=2;ij++) {
            kq+=f[{x+ii,y+ij}];
        }
    }
    return kq;
}

int main() {
    cin>>h>>w>>n;
    for (i=1;i<=n;i++) {
        cin>>a[i]>>b[i];
        f[{a[i],b[i]}]=1;
    }
    sl[0]=(h-2)*(w-2);
    for (i=1;i<=n;i++) {
        for (j=a[i]-2;j<=a[i];j++) {
            for (l=b[i]-2;l<=b[i];l++) {
                if ((j>0)&&(l>0)&&(j+2<=h)&&(l+2<=w)) {
                    if (!calc[{j,l}]) {
                        k=solve(j,l);
                        calc[{j,l}]=true;
                        sl[0]--;
                        sl[k]++;
                    }
                }
            }
        }
    }
    for (i=0;i<=9;i++) {
        cout<<sl[i]<<'\n';
    }
}
  

Measured memory_bytes: 217640
import Control.Monad
import Control.Applicative
import Data.Functor
import Data.List
import Data.List.Split
import Data.Char

readInt = read :: String -> Int
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
-- end of templete


main = getInts >>= putStrLn . sjoin . sortBy (flip compare)

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

int main(){
  int n;
  cin>>n;
  long long a_0=2,a_1=1;
  long long a_n;
  if(n==1){
	cout<<1<<endl;
    return 0;
  }
  for(int i=0;i<n-1;i++){
	a_n=a_0+a_1;
    a_0=a_1;
    a_1=a_n;
  }
  cout<<a_n<<endl;
}


Measured memory_bytes: 256
H, N = map(int, input().split())

inf = float('inf')
dp = [inf] * (H + 1)
dp[0] = 0
for _ in range(N):
    A, B = map(int, input().split())
    for i in range(H):
        t1 = i + A
        if t1 > H:
            t1 = H
        t2 = dp[i]
        if t2 == inf:
            continue
        t2 += B
        if t2 < dp[t1]:
            dp[t1] = t2
print(dp[H])


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

int main(int argc, char *argv[]){
        int a,b;
        int d,r;
        double f;
        cin >> a >> b;
        d = a / b;
        r = a % b;
        f = (double)a / b;
        cout << d << " " << r << " " << fixed << f << "\n";
        return 0;
}

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

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

    for (auto &&p : P) {
        cin >> p;
    }

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

    int64_t ans = 0;
    for (int i = 0; i < K; ++i) {
        ans += P[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr long long INF = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int a,b,c,d,e;
    cin>>a>>b>>c>>d>>e;
    int x=60*a+b;
    int y=60*c+d;
    y-=e;
    int ans=max(0LL,y-x);
    cout << ans << endl;




    



}


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

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

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int a, b ,x;
    
    scanf("%d%d%d", &a, &b, &x);
    
    if (x>=a&&a+b>=x) {
        printf("YES");
    } else {
        printf("NO");
    }
    
    return 0;
}



Measured memory_bytes: 1692
#include<bits/stdc++.h>
using namespace std;
bool isprime(int x){
  if(x==2) return true;
  if(x<2||x%2==0) return false;
  int i = 3;
  while(i<=sqrt(x)){
    if(x%i==0) return false;
    i+=2;
  }
  return true;
}

int main(){
  int n;
  int count=0;
  cin >> n;
  int a[n];
  for(auto& i:a) cin >> i;
  for(int i=0;i<n;i++){
    if(isprime(a[i])) count++;
  }
  cout << count << endl;
  return 0;
}



Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
int main(){
  int s , ans=1,end=0;
  cin>>s;
  vector<int> a;
  a.push_back(s);
  while(1){
    ans+=1;
    if(s%2==0){
      s = s / 2;
    }else{
      s = 3 * s + 1;
    }
    for(int i=0;i<a.size();i++){
      if(s==a.at(i)){
        cout<<ans;
        end=1;
        break;
      }
    }
    if(end==1) break;
    a.push_back(s);
  }
}
      

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b,c;cin >> a >> b >> c;
    cout << min({abs(a-a/2*2)*b*c,abs(b-b/2*2)*c*a,abs(c-c/2*2)*a*b}) << endl;
}

Measured memory_bytes: 3572