akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            double[] ints = new double[input.Length];
            double max = 0;
            for(int i=0; i<3; i++)
            {
                ints[i] = double.Parse(input[i]);
                if (ints[i] > max) max = ints[i];
            }

            var x = ints.Where(Y => Y != max);

            double area = 1;
            foreach(var i in x)
            {
                area *= i;
            }
            Console.WriteLine(area/2);

            //Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11220
#include<cstdio>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)

#ifdef __BORLANDC__
	typedef __int64 ll;
#else 
	typedef long long ll;
#endif


typedef pair<ll,ll> pll;

int n;
vector<int> d;
vector<int> s;
bool input(){
	cin>>n;
	if(n==0)return false;
	d=vector<int>(n);
	s=vector<int>(n);
	rep(i,n){
		cin>>d[i]>>s[i];
	}
	return true;
}


ll gcd(ll a, ll b){
	if(a<b)swap(a,b);
	while(1){
		ll c = a%b;
		if(c==0)return b;
		a=b;
		b=c;
	}
}

void tubun(ll* a, ll* b){
	ll c = gcd(*a, *b);
	*a /= c;
	*b /= c;
}

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


pll lcmexp(ll a, ll b, ll c, ll d)
{
	tubun(&a, &b); tubun(&c, &d);
	
	ll bunbo = b*d;
	ll A = a*d;
	ll B = b*c;
	
	//ll gcA = gcd(A, bunbo); A/=gcA; bunbo/=gcA;
	//ll gcB = gcd(B, bunbo); B/=gcB; bunbo/=gcB;
	
	ll C = gcd(A,B);
	ll bunshi = A/C*B/C*C;
	
	//cout<<"bunbo="<<bunbo<<" bunshi="<<bunshi<<"  A="<<A<<"  B="<<B<<endl;
	tubun(&bunbo, &bunshi);
	
	return pll(bunshi, bunbo);
}



vector<int> solve(){
	vector<int> ret;
	
	pll lcme = lcmexp(d[0], s[0], d[1], s[1]);
	reps(i,2,n){
		lcme = lcmexp(lcme.first, lcme.second, d[i], s[i]);
	}
	
	//cout<<"aaa"<<lcme.first<<" "<<lcme.second<<endl;
	
	rep(i,n){
		ret.push_back(lcme.first * s[i] / d[i] / lcme.second);
	}
	
	return ret;
}

void c_solve(){
	vector<int> ans = solve();
	rep(i,ans.size())cout<<ans[i]<<endl;
}

int main(){
	while(input())c_solve();	
}

Measured memory_bytes: 1216
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

int main() {
  int n;
  cin >> n;
  cout << (n + 1) / 2 << endl;
  return 0;
}


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

XY=[[list(map(int,input().split())) for i in range(int(input()))] for n in range(N)]
for i in range(N):
    for m in range(len(XY[i])):
        XY[i][m][0]-=1

num=set()
for i in range(2**N):
    AC=[-1 for Z in range(N)]
    lst=(N-len(bin(i)[2:]))*"0"+bin(i)[2:]
    flag=0
    for l in range(N):
        if lst[l]=="1":
            if AC[l]==0:
                flag=1
                break
            else:
                AC[l]=1

            for x,y in XY[l]:
                if AC[x]==-1:
                    AC[x]=y
                if AC[x]==1 and y==0 or AC[x]==0 and y==1 :
                    flag=1
                    break
            if flag:
                break
        else:
            if AC[l]==1:
                flag=1
                break
            else:
                AC[l]=0
    if not flag:
        num.add(sum(AC))
print(max(num))


Measured memory_bytes: 49752
#include <iostream>
#include <algorithm>
#include <climits>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>

#define barsik ios::sync_with_stdio(false)
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define rep(i, a, b) for(int i = a; i < b; i++)

typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair <int, int> pii;
typedef std::unordered_set <int> u_si;

using namespace std;

void solve(){
    int n = 3, sum = 0;
    rep(i, 0, n){
        int x;
        cin >> x;
        sum += x;
    }
    cout << ((sum >= 22) ? "bust" : "win");
}

int main(){
    barsik;
    int q = 1;
    //cin >> q;
    while(q--) solve();
}



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

def chk(n):
    for _ in [0]*D:
        if n % 100 == 0:
            n //= 100
            continue
        else:
            return False
    if n % 100 == 0: return False
    else: return True

i = 0
cnt = 0
while cnt < N:
    i += 1
    if chk(i):
        cnt += 1

print(i)

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

using namespace std;

int main()
{
  int N, K;
  int sum[26] = {};
  cin >> N >> K;
  for(int i = 0; i < N; i++) {
    string S;
    cin >> S;
    ++sum[S.front() - 'A'];
  }
  sort(sum, sum + 26, greater< int >());

  for(int i = 0;; i++) {
    int ret = 0;
    for(int j = 0; j < K; j++) {
      --sum[j];
      if(sum[j] < 0) {
        cout << i << endl;
        return (0);
      }
    }
    sort(sum, sum + 26, greater< int >());
  }

}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
typedef long long ll;
const ll MOD=1000000007;
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; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }

using P = pair<int,int> ;

int main(void){
    // Your code here!
    ll n,k;cin >> n >> k;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int c = 1,l = 0;
    vector<int> s;
    vector<int> ord(n+1,-1);
        int v = 1;
        while (ord[v]==-1){
            ord[v] = s.size();
            s.push_back(v);
            v = a[v-1];
        }
        c = s.size() - ord[v];
        l = ord[v];

    if ( k < l) cout << s[k] << endl;
    else {
        k -= l;
        k %= c;
        cout << s[l+k] << endl;
    }
    return 0 ;
}


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

#define MAX 200000

int main(){
	int N;
	string str;
	vector<string> S;
	cin >> N;
	for(int i = 0; i < N; i++){
		cin >> str;
		S.push_back(str);
	}
	sort(S.begin(),S.end());

	int count = 1;
	
	str = S[0];
	for(int i= 0; i<S.size(); i++){
		if(str != S[i]){
			count++;
			str = S[i];
		}
	}
	cout << count;
	return 0;
}


Measured memory_bytes: 11636
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int h1 = sc.nextInt();
		int m1 = sc.nextInt();
		int h2 = sc.nextInt();
		int m2 = sc.nextInt();
		int k = sc.nextInt();
		
		System.out.println(((h2-h1)*60 + (m2 - m1)) - k);
	}
}


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

int main(){
  int H,W;
  cin >> H >> W;
  vector<vector<char>> A(H+2,vector<char>(W+2,'#'));
  for(int i=1;i<=H;i++){
    for(int j=1;j<=W;j++){
      cin >> A.at(i).at(j);
    }
  }
  for(int i=0;i<H+2;i++){
    for(int j=0;j<W+2;j++){
      cout << A.at(i).at(j);
    }
    cout << endl;
  }
}

Measured memory_bytes: 256
dic = {}
for i in range(int(input())):
    s = input()
    if s in dic:
        dic[s] = dic[s] + 1
    else:
        dic[s] = 1
max_v = max(dic.values())
ret = [k for k, v in dic.items() if v == max_v]

ret.sort()
print('\n'.join(ret))

Measured memory_bytes: 34140
using System;
using System.Linq;
using System.Collections.Generic;
class c
{
    static void Main()
    {
        var nm = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        var list = new List<int[]>();
        var sort = new List<int>[nm[0] + 1];
        for (int i = 0; i < nm[0] + 1; i++)
        {
            sort[i] = new List<int>();
        }
        for (int i = 0; i < nm[1]; i++)
        {
            var inp = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            list.Add(inp);
            sort[inp[0]].Add(inp[1]);
        }
        for (int i = 1; i <= nm[0]; i++)
        {
            sort[i] = sort[i].OrderBy(f => f).ToList();
        }
        for (int i = 0; i < list.Count(); i++)
        {
            Console.WriteLine("{0}{1}", list[i][0].ToString().PadLeft(6, '0'), (BS(sort[list[i][0]], list[i][1]) + 1).ToString().PadLeft(6, '0'));
        }
    }
    public static int BS(List<int> a, int n)
    {
        int min = 0;
        int max = a.Count() - 1;
        while (true)
        {
            // 範囲内に見つからなかった
            if (max < min) return -1;
            // 範囲内の中央値と比較する
            int mid = min + (max - min) / 2;
            switch (n.CompareTo(a[mid]))
            {
                case -1:// 中央値より小さい
                    max = mid - 1;
                    break;
                case 1:// 中央値より大きい
                    min = mid + 1;
                    break;
                case 0:// 見つかった
                    return mid;
            }
        }
    }

}

Measured memory_bytes: 40736
import sys
input = sys.stdin.readline

N, K = map(int, input().split())
L = [int(v) for v in input().split()]
NL = [0] * (N - K + 1)

for i in range(N - K + 1):
    left = L[i]
    right = L[i + K - 1]
    
    NL[i] = min(abs(left) + abs(left - right), abs(right) + abs(right - left))
    
print(min(NL))

Measured memory_bytes: 14480
import bisect

N, x = (list)(map(int, input().split()))
A = (list)(map(int, input().split()))

A = sorted(A)

for i in range(len(A)-1):
    A[i+1] += A[i]

ans = 0
ind = bisect.bisect_right(A, x)
if ind == 0:
    ans = 0
elif ind >= N:
    if A[-1] == x:
        ans = N
    else:
        ans = N-1
else:
    ans = ind
print(ans)


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

using ll=long long;

int main(){
    int n;
    cin>>n;
    vector<ll>v(n);
    ll x=0,y=0,ans=1e18;
    for(int i=0;i<n;++i){
        cin>>v[i];
        y+=v[i];
    }
    for(int i=0;i<n-1;++i){
        x+=v[i];
        y-=v[i];
        ans=min(abs(x-y),ans);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include <functional>
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <queue>
#include <string>
#include <cstring>
#include <math.h>
using namespace std;


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

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

}
int sum = 0;
  
for(int i = 0;i<n;i++){
     
  int anssub = a[i]-b[i];
  
  if(anssub>0){
    
    sum = sum+anssub;
  }

}
   cout << sum << endl;
   
  return 0;
}

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

namespace Maxflow{

const int maxn=22222;
const int maxm=4444444;
const int inf=1000000000;

int g[maxn],to[maxm],np[maxm],cp;
int n,u,v,now,source,sink;
int sum,cap[maxm],a[maxn];
int d[maxn],p[maxn],cur[maxn],cnt[maxn];

void add_edge(int x,int y,int z){
//	printf("add %d %d %d\n",x,y,z);
	cap[cp]=z;to[cp]=y;np[cp]=g[x];g[x]=cp++;cap[cp]=0;to[cp]=x;np[cp]=g[y];g[y]=cp++;
}

void init(){
//	printf("Init\n");
	cp=2; memset(g,0,sizeof(g));
}
int maxflow(){
	sum=0;
	for(u=1;u<=n;u++)cur[u]=g[u]; a[u=source]=inf; memset(d,0,sizeof(int)*(n+1)); memset(cnt,0,sizeof(int)*(n+1)); cnt[0]=n;
	while(d[source]<n)
	{
		for(now=cur[u];now;now=np[now])if(cap[now]&&d[v=to[now]]+1==d[u])break; cur[u]=now;
		if(now)
		{
			p[v]=now; a[v]=cap[now]; if(a[v]>a[u])a[v]=a[u];
			if((u=v)==sink)
			{
				do{cap[p[u]]-=a[sink]; cap[p[u]^1]+=a[sink]; u=to[p[u]^1];}while(u!=source);
				sum+=a[sink]; a[source]=inf;
			}
		}
		else
		{
			if(--cnt[d[u]]==0)break; d[u]=n; cur[u]=g[u];
			for(now=g[u];now;now=np[now]) if(cap[now] && d[u]>d[to[now]]+1) d[u]=d[to[now]]+1;
			cnt[d[u]]++;
			if(u!=source)u=to[p[u]^1];
		}
	}
	return sum;
}

}

char mp[111][111];
int main(){
	int _,row,col;
	for(_=1; _--;){
		scanf("%d%d",&row,&col);
		Maxflow::init();
		Maxflow::source = 2 * row * col + 1;
		Maxflow::sink = Maxflow::n = Maxflow::source + 1;
		for(int i=0; i<row; i++)
			scanf("%s",mp[i]);
		for(int i=0; i<row; i++)
			for(int j=0; j<col; j++)
				if(mp[i][j] == 'S'){
					mp[i][j] = 'o';
					Maxflow::add_edge(Maxflow::source, (i*col+j)*2+2, Maxflow::inf);
				}else
				if(mp[i][j] == 'T'){
					mp[i][j] = 'o';
					Maxflow::add_edge((i*col+j)*2+1,Maxflow::sink, Maxflow::inf);
				}
		for(int i=0; i<row; i++)
			for(int j=0; j<col; j++)
				if(mp[i][j] == 'o'){
					Maxflow::add_edge((i*col+j)*2+1, (i*col+j)*2+2, 1);
					for(int i2=0; i2<row; i2++)if(i2!=i && mp[i2][j] == 'o')
						Maxflow::add_edge((i*col+j)*2+2, (i2*col+j)*2+1, Maxflow::inf);
					for(int j2=0; j2<col; j2++)if(j2!=j && mp[i][j2] == 'o')
						Maxflow::add_edge((i*col+j)*2+2, (i*col+j2)*2+1, Maxflow::inf);
				}
		int res = Maxflow::maxflow();
		if(res > row*col)res = -1;
		printf("%d\n",res);
	}
	return 0;
}


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

#define ll long long
#define INF_LL 1LL << 60
#define INF 99999999
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

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; }


int main()
{
    int A,B;
    cin >> A >> B;
    string s;
    cin >> s;

    multiset<char> tmp;
    rep(i,s.size()) tmp.insert(s[i]);

    if( tmp.find('-') != tmp.end() && tmp.count('-') == 1 )
    {
        if( s[A] == '-' )
        {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
static int gcd(int a, int b){
    while(b) std::swap(a%=b,b);
    return a;
}
int main() {
    std::cin.tie(0);
    std::ios_base::sync_with_stdio(false);
    for(int N; std::cin >> N; ) {
        std::vector<int> a; a.reserve(N);
        int c=N-1;
        long t=0;
        for(int i=2; c; ++i) if(i%2==0 || i%3==0 || i%7==0) a.push_back(i),--c,t+=i;
        for(int i=a[N-2]+1; i<=30000; ++i)
            if((i+t)%42==0 && gcd(i,t)>1){ a.push_back(i); break; }
        if(a.size()<N) if(t==42-1) a.push_back(1); else a.resize(1000000000);
        for(const auto v:a)
            std::cout << v << ' ';
        std::cout << std::endl;
    }
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
 
#define FOR(n) for(int i=0;i<n;i++)
#define ll long long
 
using namespace std;
int main()
{ int n,k,r,s,p;int sum=0;char l[100001];
 cin>>n>>k;
 cin>>r>>s>>p;
 char t[100001];
 cin>>t;
 map<char,char> g;
 g.insert({'s','r'});
 g.insert({'r','p'});
 g.insert({'p','s'});
 map<char,int> g1;
 g1.insert({'s',s});
 g1.insert({'r',r});
 g1.insert({'p',p});
 
FOR(n)
{if(i<k)
{l[i]=g[t[i]];
  sum+=g1[g[t[i]]];}
 else
 {if(l[i-k]==g[t[i]])
 {
   sum=sum+0;}
  else
  { l[i]=g[t[i]];
    sum+=g1[g[t[i]]];}
  
 }
 
 
 }
 
 
 
 
cout<<sum;
 
return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int H,W;
		H = scan.nextInt();
		W = scan.nextInt();

		while(H != 0 && W != 0){
			for(int i = 0; i < H; i++){
				for(int j = 0; j < W; j++){
					if((i+j)%2 == 0)
						System.out.printf("#");
					else
						System.out.printf(".");
				}
				System.out.printf("\n");
			}
			System.out.printf("\n");
			H = scan.nextInt();
			W = scan.nextInt();
		}
	}
}

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


int main() {
    int N;
    cin >>N;
    vector<int>data(N);
    int sum =0;
    rep(i,N){
        cin>>data[i];
        sum +=data[i];
    }
    cout << sum -N<<endl;
}

Measured memory_bytes: 256
A,B = map(int,input().split())
S = list(input())
l = len(S)

for i in range(l):
    if i == A:
        if S[i] != '-':
            print("No")
            exit()
    else:
        if S[i].isdigit():
            continue
        else:
            print("No")
            exit()
print("Yes")

Measured memory_bytes: 3060
// Sky's the limit :)
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int T = 1; 
    // cin >> T; 
    while (T--) {
        int n;
        cin >> n;

        int ans = 0;
        for(int i = 1; i <= n; i++) {
            if(i % 3 && i % 5)
                ans += i;
        }

        cout << ans << '\n';
        
    }
    
    return 0;
}



Measured memory_bytes: 3616
N,M,C = map(int,input().split())
B = list(map(int,input().split()))
D = []
E = 0
ans = 0

for i in range(N):
    A = list(map(int,input().split()))
    D = [x * y for (x, y) in zip(A, B)]
    E = sum(D) + C
    if E > 0:
        ans += 1

print(ans)


Measured memory_bytes: 3064
#define _USE_MATH_DEFINES

#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<math.h>

using namespace std;

/* cout << fixed << setprecision(5); */

int main()
{	
	int a,b,c;
	char op;

	while (cin >>a >>op >>b)
	{
		if (op=='?')
		{
			break;
		}
	
		if (op=='+')
		{
			c=a+b;
		}

		if (op == '-')
		{
			c = a - b;
		}

		if (op == '*')
		{
			c = a * b;
		}

		if (op == '/')
		{
			c = a / b;
		}
	
		cout << c <<endl;

	}

	

	return 0;
}

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

int main() 
{
    // auto it = a.begin();
	// advance(it, k - 1);
	// cout << *it << endl;

//order:       sort(array.begin(),array.end());
//   unique(array.begin(),array.end());
    string s; int k;
    cin >> s >> k;
    set<string> v;
    for (int i=0; i<s.size(); i++)
        for (int j=0; j<6; j++)
            v.insert(s.substr(i,j));
    int i=0;
    string res;
    for (auto x:v)
    {
        i++;
        if (i==k+1)
        {
            res = x;
            break;
        }
    }
    cout << res;
    return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

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

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	ll N;
	cin >> N;
	ll res[10000];
	ll t = 0;
	if(N==0){
		cout << 0 << endl;
		return 0;
	}
	while(N!=0){
		ll ama= abs(N)%2;
		res[t] = ama;
		if(t%2==0){
			N -= ama;
		}else{
			N += ama;
		}
		N /= 2;
		t++;
	}
	REP(i, t){
		cout << res[t-i-1];
	}
	cout << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextLong()
    println(problem169d(n))
}

fun problem169d(n: Long): Long {
    /**
     * 素因数分解
     */
    fun computePrimeFactorList(n: Long): List<Pair<Long, Long>> {
        val p = mutableListOf<Pair<Long, Long>>()
        var primeFactor = n
        for (i in 2..(Math.sqrt(n.toDouble()) + 1).toLong()) {
            if (primeFactor % i != 0L) continue
            var count = 0L
            while (primeFactor % i == 0L) {
                primeFactor /= i
                count++
            }
            p.add(i to count)
        }
        if (primeFactor != 1L) p.add(primeFactor to 1L)
        return p
    }

    val pf = computePrimeFactorList(n)
    var count = 0L
    for (i in 0 until pf.size) {
        var (_, num) = pf[i]
        for (j in 1..num) {
            if (0 <= num - j) {
                num -= j
                count++
            }
        }
    }
    return count
}

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

typedef long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

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

//#define DBG(fmt, ...)
#define DBG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)

int main(){
    std::cout<<std::fixed<<std::setprecision(10);

    ll N;

    cin >> N;
    vector<ll> array(N, 0);

    std::unordered_map<string,int> table;
    REP(i, N){
        string c;
        cin >> c;
        table[c]++;
    }

    cout << "AC x "  << table["AC"]  << endl;
    cout << "WA x "  << table["WA"]  << endl;
    cout << "TLE x " << table["TLE"] << endl;
    cout << "RE x "  << table["RE"]  << endl;

    return 0;
}


Measured memory_bytes: 4040
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());

typedef long long ll;

int main(){
  string s,t;
  cin >>s>>t;
  sort(s);
  sort(t);
  reverse(t);
  if(s<t) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

ll s, ten, ma = 0;
int n;
VI ans;

ll diff(VI a){
    ll x = 0;
    REP(i,n) x = 10 * x + a[i];
    return min(abs(s-x), ten-abs(s-x));
}

void dfs(int i, VI a, VI used){
    if (i == n){
        if (diff(a) > ma){
            ans = a;
            ma = diff(a);
        }
        return;
    }
    REP(j,10){
        if (used[j]) continue;
        a[i] = j;
        used[j] = 1;
        dfs(i+1, a, used);
        used[j] = 0;
    }
}

int main() {
    string t;
    cin >> t;
    n = t.length();
    s = 0;
    REP(i,n) s = 10*s + t[i]-'0';
    ten = 1;
    REP(i,n) ten *= 10;

    ans.resize(n);
    VI a(n), used(10);

    dfs(0, a, used);

    REP(i,n) cout << ans[i];
    cout << endl;

    return 0;
}

Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
#define w(x) int x;cin>>x;while(x--)
#define ll long long
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define vi vector<int>
#define fr(a,b) for(int i=a;i<=b;i++)
#define inf 1e18
#define mod 1000000007
int main() {
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r",stdin);
	freopen("output.txt", "w",stdout);
#endif*/
	int n;
	cin>>n;
	ll ans=0;
	for(int i=1;i<=n;i++)
	{
		int k=n/i;
		if(n%i==0)
			ans+=(k-1);
		else
			ans+=k;
	}
	cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 3524
n = int(input())
A = list(map(int, input().split()))

B1 = [(-1)**i for i in range(n)]
B2 = [(-1)**(i+1) for i in range(n)]

def func(A, B):
    cum = 0
    res = 0
    for i in range(n):
        cum += A[i]
        if B[i] > 0 and cum <= 0:
            res += 1-cum
            cum = 1
        elif B[i] < 0 and cum >= 0:
            res += cum+1
            cum = -1
    return res
     
print(min(func(A, B1), func(A, B2)))


Measured memory_bytes: 64724
from heapq import heappush, heappop

N, M = map(int, input().split())

goods = list(map(int, input().split()))
goods_heap = []

for i in range(N):
    heappush(goods_heap, -goods[i])

for _ in range(M):
    heappush(goods_heap, -(-heappop(goods_heap)//2))
    
sum = -sum(goods_heap)

print(sum)


Measured memory_bytes: 64664
#include<iostream>
#include<vector>
#include<string.h>

using namespace std;

int main()
{
	int n, m, q;
	while (cin >> n >> m >> q && n != 0 || m != 0 || q != 0)
	{
		vector<string> S, B;
		for (int i = 0; i < q; i++)
		{
			char chars[40];
			char charb[1100];
			cin >> chars >> charb;
			S.push_back(chars);
			B.push_back(charb);
		}

		int SL[1100];
		memset(SL, -1, sizeof SL);
		for (int i = 0; i < m; i++)//light
		{
			for (int j = 0; j < n; j++)//switch
			{
				bool status = false;
				bool flag = true;
				for (int k = 0; k < q; k++)//query
				{
					if (S[k][j] == '1')
					{
						status = !status;
					}

					if (status && B[k][i] == '1' || !status && B[k][i] == '0')continue;
					flag = false;
					break;
				}
				if (flag)
				{
					if (SL[i] == -1)SL[i] = j;
					else SL[i] = -2;
				}
			}
		}

		for (int i = 0; i < m; i++)
		{
			if (SL[i] < 0)
			{
				cout << "?";
			}
			else
			{
				if (SL[i] < 10)
				{
					cout << SL[i];
				}
				else
				{
					cout << (char)((SL[i] - 10) + 'A');
				}
			}
		}
		cout << endl;
	}
	return 0;
}

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

int main(){
    int m;
    int n;
    int a[10], b;

    cin >> m;
    cin >> n;

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

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

    for (int i = m; i < 100000; i++){
        b = i;
        while (b != 0){
            if (a[b % 10] != 0){
                break;
            }
            b /= 10;
        }
        if (b == 0){
            printf("%d", i);
            return 0;
        }
    }
}

Measured memory_bytes: 3636
function Main(s) {
  const sl = s.length - 1;
  const sa = s.split("").map(a => parseInt(a));
  var ans = 0;
  for(var i = 0; i < 1 << sl; i++){
    var b = 0;
    for(var j = 0; j < sl; j++){
      b += sa[j];
      if(i & 1 << j){
        ans += b;
        b = 0;
      }
      else b *= 10;
    }
    ans += b + sa[sl];
 }
  console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());

Measured memory_bytes: 7372
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;
typedef long long ll;
int main(){
	int A, B;
	cin >> A >> B;
	if (A % 2 == 1 && B % 2 == 1) {
		cout << "Yes" << endl;
	}else {
		cout << "No" << endl;
	}


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define ld long double
using namespace std;
const int N = 1e5 + 10;
const int mod = 1e9 + 7;
int32_t main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);
  int n;
  cin >> n;
  int ans = 1e17;
  for(int i = 1; i * i <= n; i++){
    if(n % i == 0){
      int va1 = i;
      int va2 = n / i;
      ans = min(ans, va2 + va1 - 2);
    }
  }
  cout << ans;
}

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

using namespace std;

#define pb push_back
#define ll long long
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)

const ll INF = 1e9 + 5, N = 205;

int main(){
	ll x, k, d;
	cin >> x >> k >> d;
	x = abs(x);
	ll need = (x / d) + (x % d > 0);
	ll ans = abs((x - (k * d)));
	ans = min(ans, abs(x - ((k - 2) * d)));
	if(need >= k){
		cout << ans << endl;
		return 0;
	}
	if((k - (need + 1)) % 2 == 0) ans = min(ans, abs(x - ((need + 1) * d)));	
	if((k - (need)) % 2 == 0) ans = min(ans, abs(x - (need * d)));
	if((k - (need - 1)) % 2 == 0) ans = min(ans, abs(x - ((need - 1) * d)));
	cout << ans << endl;
}

Measured memory_bytes: 3584
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <cassert>
#include <map>
#include <set>
using namespace std;

int n, k;
string T[16];
vector<string> comb[16];
string pre[16];
int dp[1 << 16][16][6];

string now, ans;

void dfs(int bit, int p, int r) {
	if(dp[bit][p][r]) return;
	dp[bit][p][r] = 1;
	if(bit == (1 << n) - 1) {
		if(ans > now) ans = now;
		return;
	}

	string s = pre[p] + comb[p][r];
	int pos[26] = { 0 };
	for(int i = 0; i < s.size(); i++) {
		pos[s[i] - 'A'] = i;
	}

	if(now == "D") {
		//cout << endl;
	}
	for(int i = 0; i < n; i++) {
		if(bit >> i & 1) continue;
		bool ok = true;
		for(int j = 0; j < k - 1; j++) {
			if(pos[T[i][j] - 'A'] > pos[T[i][j + 1] - 'A']) {
				ok = false;
				break;
			}
		}
		if(!ok) continue;
		string rem;
		for(int j = 0; j < n; j++) {
			if(T[i].find(s[j]) == string::npos) rem += s[j];
		}
		assert(rem.size() == n - k);
		int idx = find(comb[i].begin(), comb[i].end(), rem) - comb[i].begin();
		now += 'A' + i;
		dfs(bit | (1 << i), i, idx);
		now.pop_back();
	}
}

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

	while(cin >> n >> k) {
		for(int i = 0; i < n; i++) {
			cin >> T[i];
			pre[i] = T[i];
			reverse(pre[i].begin(), pre[i].end());
		}

		for(int i = 0; i < n; i++) {
			string t;
			for(int j = 0; j < n; j++) {
				if(T[i].find('A' + j) == string::npos) t += 'A' + j;
			}
			assert(t.size() == n - k);
			comb[i].clear();
			do {
				comb[i].push_back(t);
			} while(next_permutation(t.begin(), t.end()));
		}

		memset(dp, 0, sizeof dp);
		ans = "zzzzzzzzzzzzzzzzz";
		now = "";

		for(int i = 0; i < n; i++) {
			for(int j = 0; j < comb[i].size(); j++) {
				now += 'A' + i;
				dfs(1 << i, i, j);
				now.pop_back();
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 27812
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>   
using namespace std;
using namespace __gnu_pbds;
typedef long long ll; 
#define int long long
typedef unsigned long long lu;
typedef vector<ll> v;
typedef vector<vector<ll> > vv;
typedef vector<string>  vs;
typedef vector<pair<ll,ll>> vpr;
typedef long double ld;
#define f(i,n) for(ll i = 0; i < n; i++)
#define ff(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define endl "\n"
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define amax(x,y) if(y>x) x=y;
#define amin(x,y) if(y<x)x=y;
#define bg(x) x.begin()
#define sz(x) (ll)x.size()
#define in(x,n) for(ll i=0;i<n;i++)cin>>x[i]
#define out(x,n) for(ll i=0;i<n;i++)cout<<x[i]<<" " 
#define mxt(a) *(max_element(a.begin(),a.end()))
#define mnt(a) *(min_element(a.begin(),a.end())
#define tc ll t;cin>>t;while(t--)
typedef pair<ll,ll> pi;
#define yes cout<<"YES\n";
#define no cout<<"NO\n";
#define yesno(f) if(f) yes else no
const v dx = {1, -1, 0, 0};
const v dy = {0, 0, 1, -1};
const ll mod=1e9+7;
const ld PI = 2 * acos(0.0);
ll m(ll a){ return (a+mod)%mod;}
ll cel(ll x1,ll y1){if((x1%y1)==0)return x1/y1;else return x1/y1+1;}
ll power(ll a,ll b,ll m)
{
	if(b==0)
		return 1;
	ll d=power(a,b/2,m);
	d=(d*d)%m;
	if(b&1)
		d=(d*a)%m;
	return d;
}
// set_name.find_by_order(k) It returns to an iterator to the kth element (counting from zero) in the set in O(logn) time
// set_name.order_of_key(k) It returns to the number of items that are strictly smaller than our item k in O(logn) time.
/*string operations :
str.substr (x,y) : returns a substring str[x],str[x+1],...str[x+y-1]
str.substr (x) : returns a substring str[x],... end of string
str.find(qtr) : returns the first occurenece of qtr in str */

int32_t main()
{
	ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
	int tt=1;
	int n;cin>>n;
	v arr(n);in(arr,n);
	v dp(n+1,0);
	v sum(n+2,0);
	for(int i=n-1;i>=0;i--)
		sum[i]=arr[i]+sum[i+2];
	// out(sum,n);
	// cout<<endl;
	dp[n-1]=0;
	dp[n-2]=max(arr[n-1],arr[n-2]);
	for(int i=n-3;i>=0;i--)
	{
		int len=n-i;
		if(len&1)
		{
			dp[i]=max(arr[i]+dp[i+2],dp[i+1]);
		}
		else
			dp[i]=max(sum[i+1],dp[i+2]+arr[i]);
	}
	cout<<dp[0]<<endl;
	return 0;
}

Measured memory_bytes: 7924
#include<bits/stdc++.h>
using namespace std;
int n,ri,le;
struct node{
	int x,y;
}a[1000005];
int tot;
char s[1000005];
int cmp(node a,node b){
	return a.x-a.y>b.x-b.y;
}
int main(){
	//n=read();
	int i,j;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		int l=0,r=0;
		scanf("%s",s+1);
		for(j=1;s[j];j++)
			if(s[j]=='(')l++;
			else if(s[j]==')'){
				if(l)l--;
				else r++;
			}
		if(!l&&r)ri+=r;
		else if(l&&!r)le+=l;
		else if(l&&r)a[++tot]=(node){l,r};	
	}
	sort(a+1,a+1+tot,cmp);
	for(int i=1;i<=tot;i++){
		if(le<a[i].y)
			return puts("No"),0;
		le-=a[i].y-a[i].x;
	}
	if(le!=ri)puts("No");
	else puts("Yes");
	return 0;
}


Measured memory_bytes: 5120
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            //ここから
            //string[] str = Console.ReadLine().Split(' ');
            //int n = int.Parse(Console.ReadLine());
            int n = int.Parse(Console.ReadLine());

            int ans = 0;
            ans += (n / 500) * 1000;
            ans += ((n % 500) / 5)*5;

            Console.WriteLine(ans);



            //ここまで
        }



    }

}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
    string s;
        vector<char>v;
    int main()
    {
        cin>>s;
        for(int i=0;i<s.length();i++)
        {
            if(s[i]!='B')
                v.push_back(s[i]);
            else if(v.size())
                v.pop_back();
        }
        for(int i=0;i<v.size();i++)
        {

            cout<<v[i];
        }
        return 0;
    }

Measured memory_bytes: 256
# _*_ coding:utf-8 _*_
#  Atcoder_Beginners_Contest085-B
#  https://atcoder.jp/contests/abc085/tasks/abc085_b

def  motiTower(givenRange):
	distMeter = []
	for i in givenRange:
		distMeter.append(int(input().strip()))
	setKagamiMoti = set()
	for i in givenRange:
		setKagamiMoti.add(distMeter[i])
	answer = len(setKagamiMoti)
	return answer

if __name__ == '__main__':
	N=int(input())
	distRange = range(0,N,+1)
	solution=motiTower(distRange)
	print("{}".format(solution))

Measured memory_bytes: 3064
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
#include <functional>

using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main()
{
	int N,D;
	cin>>N>>D;
	int o=N%(D*2+1)!=0?1:0;
	cout<<N/(D*2+1)+o<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x7f7f7f7f;
const int N = 2e5 + 5;
long long A[N] = {}, B[N] = {};
int n, m;
int bs(long long k) {
    int l = 1, r = m, mid;
    while (l <= r) {
        mid = (l + r) >> 1;
        if (B[mid] <= k) l = mid + 1;
        else r = mid - 1;
    }
    return r;
}
int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    long long k;
    cin >> n >> m >> k;
    for (int i = 1; i <= n; i++) {
        cin >> A[i];
        A[i] += A[i - 1];
    }
    for (int i = 1; i <= m; i++) {
        cin >> B[i];
        B[i] += B[i - 1];
    }
    int ans = 0;
    for (int i = 0; i <= n && A[i] <= k; i++) {
        ans = max(ans, i + bs(k - A[i]));
    }
    cout << ans << '\n';
}

Measured memory_bytes: 6772
#include <cstdio>
#include <string>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <iomanip>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <numeric>

typedef unsigned long long ULONG;
typedef long long LONG;
using namespace std;

#define PI 3.1415926535897932384626433
#define _DBG_

#define BIG 10000000000 //10

#define LAST 10000000 //10^7

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

	int n = N / 1000 + 1;

	int a = n * 1000 - N;
	if (a >= 1000) a -= 1000;

	cout << a << endl;
}


Measured memory_bytes: 3636
package main

import(
    "fmt"
    "sort"
    "strings"
)



func main() {
    var x1,y1,x2,y2 int
    fmt.Scan(&x1,&y1,&x2,&y2)
    dx := x2-x1
    dy := y2-y1
    x3 := x2-dy
    y3 := y2+dx
    x4 := x3-dx
    y4 := y3-dy
    fmt.Printf("%d %d %d %d", x3, y3, x4, y4)
}





func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func scanTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}

func SortString(s string) string{
    t := strings.Split(s, "")
    sort.Strings(t)
    return strings.Join(t, "")
}


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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    string s, t = "ABC"; cin >> s;
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        if (s.substr(i, 3) == t) cnt++;
    }
    cout << cnt << "\n";
    return 0;
}

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

ll fact[1000006], inv[1000006];

ll fp(ll base, ll exp)
{
    if (exp == 0)
        return 1;
    ll ans = fp(base, exp / 2);
    ans = (ans * ans) % mod;
    if (exp % 2 != 0)
        ans = (ans * (base % mod)) % mod;
    return ans;
}

void calcFacAndInv(ll n)
{
    fact[0] = inv[0] = 1;
    for (ll i = 1; i <= n; i++)
    {
        fact[i] = (i * fact[i - 1]) % mod;
        inv[i] = fp(fact[i], mod - 2);
    }
}

ll ncr(ll n, ll r)
{
    return ((fact[n] * inv[r]) % mod * inv[n - r]) % mod;
}

ll npr(ll n, ll r)
{
    return (fact[n] * inv[n - r]) % mod;
}
int main() {
    int n, k;
    cin>>n>>k;
    calcFacAndInv(n);
    vector<ll> arr(n);
    for (int i = 0; i < n; ++i) {
        cin>>arr[i];
    }
    sort(arr.begin(), arr.end());
    ll min = 0, max = 0;
    for (int i = 1; i <= n; ++i) {
        if(n - i < k - 1)
            break;
        min += (ncr(n - i, k - 1) * arr[i - 1]) % mod;
    }
    for (int i = n - 1; i >= 0; i--) {
        if(i < k-1)
            break;
        max += (ncr(i, k - 1) * arr[i]) % mod;
    }
    ll result = (max - min);
    while(result < 0)
    {
        result += mod;
    }
    cout<< result % mod;
}



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

int main(){
  int w, h;
  cin >> w >> h;
  int n;
  cin >> n;
  vector<int> v1(1, 0);
  vector<int> v2(1, w);
  vector<int> v3(1, 0);
  vector<int> v4(1, h);
  for(int i = 0; i < n; i++){
    int x, y, a;
    cin >> x >> y >> a;
    if(a == 1){
      v1.push_back(x);
    }
    else if(a == 2){
      v2.push_back(x);
    }
    else if(a == 3){
      v3.push_back(y);
    }
    else if(a == 4){
      v4.push_back(y);
    }   
  }
  sort(v1.begin(), v1.end());
  sort(v2.begin(), v2.end());
  sort(v3.begin(), v3.end());
  sort(v4.begin(), v4.end());
  if(v1[v1.size() - 1] >= v2[0] || v3[v3.size() - 1] >= v4[0]){
    cout << 0 << endl;
  }
  else{
    cout << (v2[0] - v1[v1.size() - 1]) * (v4[0] - v3[v3.size() - 1]) << endl;
  }

}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
double v[200000];
double adder[200000];
int n,k;

double max_v(){
    double max_now = adder[k-1];
    for(int i = 0;i < n - k + 1; i++){
        max_now = max(max_now,adder[k+i]-adder[i]);
    }
    return max_now;
}

int main(){
    double tmp;
    double v_i;

    cin >> n >> k;

    for(int i = 0;i < n ;i++){
        cin >> tmp;
        v_i = (tmp+1.0)/2.0;
        v[i] = v_i;
        if(i == 0) adder[i] =  v_i;
        else adder[i] = adder[i-1] +  v_i;
    }
    printf("%.8lf",max_v());
    //cout << max_v();
    return 0;
}

Measured memory_bytes: 3328
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
	int n,d;cin>>n>>d;
	if(d!=100)
	{
		cout<<d;
	}
	else
	{
		cout<<"101";
	}
	for(int i=0;i<n;i++)
	{
		cout<<"00";
	}
	cout<<endl;
	return 0;
}


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


//最大の掛け算の組を求める
void max_pair(long long number,long long& second,long long& first){
    long long sqr = sqrt(number);
    for(long long i=sqr;i>0;i--){
        long long d = number%i;
        if(d==0){
            second = number/i;
            first = number/second;
            return ;
        }
    }
}

int main()
{
    long long N,a,b;
    cin>>N;
    max_pair(N,a,b);
    cout<<a+b-2<<endl;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;

const double PI=acos(-1.0);

int N,M; bool A[100010]; ll mod=1e9+7;
int input()
{  
    cin>>N>>M;
    for(int i=0;i<100010;++i) A[i]=true;
    for(int i=0;i<M;++i){
        int a; cin>>a; A[a]=false;
    }
}

int solve()
{
    ll dp[N+10];
    dp[N]=1ll; 
    for(int i=N-1;i>=0;--i){
        if(A[i]==false){
            dp[i]=0ll; continue;
        }
        else if(i==N-1) dp[i]=1ll;
        else dp[i]=(dp[i+1]+dp[i+2])%mod;
    }
    cout<<dp[0]<<endl;
}

int main(){
    cin.tie();
    ios::sync_with_stdio(false);
    input();
    solve();
    return 0;
}


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

int main() {
    long long int X;
    cin >> X;
    long long int A = 100;
    
    long long int cnt = 0;
    while (A < X) {
        A = A + A/100;
        cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3632
import math
N, L = map(int,input().split())
min = 1000
ans = 0
A = [0] * N
for i in range(N):
    A[i] = L + (i+1) - 1
    ans += A[i]

for i in range(N):
    a = math.fabs(A[i])
    if a < min:
        min = a
        if A[i] < 0:
            judge = False
        else:
            judge = True
if judge:
    ans -= min
else:
    ans += min
print(int(ans))

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>  // Including tree_order_statistics_node_update

using namespace __gnu_pbds;
using namespace std;

#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(), (c).end()
#define tr(c, i) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define present(c, x) ((c).find(x) != (c).end())
#define cpresent(c, x) (find(all(c), x) != (c).end())
#define minei(x) min_element(x.begin(), x.end()) - (x).begin()
#define maxei(x) max_element(x.begin(), x.end()) - (x).begin()
#define LSOne(S) (S & (-S))

#define uns(v) sort((v).begin(), (v).end()), v.erase(unique(v.begin(), v.end()), v.end())
#define acusum(x) accumulate(x.begin(), x.end(), 0)
#define acumul(x) accumulate(x.begin(), x.end(), 1, multiplies<int>());
#define bits(x) __builtin_popcount(x)
#define oo INT_MAX
#define inf 1000000000
#define MAXN 1000007
#define MOD 1000000007

const double pi = acos(-1.0);
const double eps = 1e-11;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

int main() {
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, a;
    cin >> n;
    map<int, bool> exists;
    bool res = true;
    for (int i = 0; i < n; i++) {
        cin >> a;
        if (exists.count(a)) res = false;
        exists[a] = true;
    }
    cout << (res ? "YES" : "NO") << "\n";
    return 0;
}


Measured memory_bytes: 9600
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

using ll = long long;

int solve(const string& s, const ll k) {
  for (int i = 0; i < min(k, static_cast<ll>(s.size())); ++i) {
    if (s[i] >= '2') {
      return s[i] - '0';
    }
  }
  return 1;
}

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


Measured memory_bytes: 256