akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define mp(a,b) make_pair(a,b)
#define ff first
#define setp setprecision(12)<<fixed
#define ss second
#define fori(v) for(ll i=0; i<v; i++)
#define forj(v) for(ll j=0; j<v; j++)
#define fork(v) for(ll k=0; k<v; k++)
#define forl(v) for(ll l=0; l<v; l++)
#define fort(v) for(ll t=0; t<v; t++)
#define forz(v) for(ll z=0; z<v; z++)
#define forx(v) for(ll x=0; x<v; x++)
#define ll long long
#define double long double
#define MAX (int)(5*pow(10,3) + 10)
#define pb(a) push_back(a)
// #define cout out
// #define cin in
ll inf = pow(10,18);
ll INF = inf;
ll modulo = pow(10,9) + 7;
double eps = 1e-10;
ifstream in;
ofstream out;

void deal(){
	ll n , m , p;
	cin>>n>>m>>p;
	vector<ll> Mx(n,-inf);
	Mx[0] = 0;
	vector<vector<pair<ll,ll> > > g(n);
	fori(m){
		ll a, b, c;
		cin>>a>>b>>c;
		--a, --b;
		c-=p;
		g[a].pb(mp(b,c));
	}
	fori(n){
		forj(n)
			for(auto& el: g[j])
				if(Mx[j]+el.ss > Mx[el.ff]  && Mx[j]!=-inf)
					Mx[el.ff] = Mx[j]+el.ss;
	}
	vector<ll> sv;
	sv = Mx;
	fori(n){
		forj(n)
			for(auto& el: g[j])
				if(Mx[j]+el.ss > Mx[el.ff]  && Mx[j]!=-inf)
					Mx[el.ff] = Mx[j]+el.ss;
	}
	vector<ll> bfs;
	vector<bool> vis(n,0);
	forj(n)
		if(Mx[j]!=sv[j])
			bfs.pb(j), vis[j] = 1;
	for(auto& el: bfs)
		for(auto& hr: g[el])
			if(!vis[hr.ff])
				vis[hr.ff] = 1, bfs.pb(hr.ff);
	if(vis[n-1])
		cout<<-1;
	else
		cout<<max(Mx[n-1],(ll)0);
}
 
int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	deal();
}

Measured memory_bytes: 512
import collections,sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
N = I()
S = S()
ans = 0
for i in range(1,N-1):
    set_top = set()
    set_bottom = set()
    for s in collections.Counter(S[:i]):
        set_top.add(s)
    for s in collections.Counter(S[i:]):
        set_bottom.add(s)
    ans = max(ans,len(set_top&set_bottom))
print(ans)


Measured memory_bytes: 3316
#include <stdlib.h>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define mini(vec) return *std::min_element(vec.begin(), vec.end());
#define maxi(vec) return *std::max_element(vec.begin(), vec.end());

int main() {
    string a;
    cin>>a;
    vector<int> vec(a.size()-2);
    rep(i,a.size()-2){
        string st=a.substr(i,3);
        int num = std::stoi(st);
        //cout<<num<<endl;
        vec.at(i)=abs(num-753);
    }
    cout<<*min_element(vec.begin(),vec.end())<<endl;
}



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


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

  vector<int> A(N), vec(N);

  for(int i=0;i<N-1;i++){
    cin >> A.at(i);
    vec.at(A.at(i)-1) ++;
  }
/*
  for(int i=0;i<N-1;i++){
      for(int j=0;j<N-1;j++){
        if(i == A.at(j)-1){
          vec.at(i)++;
        }
      }
  }
*/
  for(int i=0;i<N;i++){
    cout << vec.at(i) << endl;
  }

/*
  map<char, int> A(N);
  for(int i=0;i<N;i++){
    A()
  }
*/
}

  


Measured memory_bytes: 4844
#include <iostream>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){
    string N;
    cin >> N;
    string ans = "ABC" + N;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define txt                        \
    freopen("ip.txt", "r", stdin); \
    freopen("op.txt", "w", stdout)
#define a3 INT_MAX
#define i3 INT_MIN
#define a6 INT64_MAX
#define i6 INT64_MIN
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define fo(i, n) for (i = 0; i < n; i++)
#define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define quickie                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);
#define div2(a) (!(a & 1))
#define deb(x) cout << (#x) << " " << (x) << "\n";
#define newl cout << "\n"
#define pi 3.14159265358979323846
#define mod 1000000007
#define all(s) s.begin(), s.end()
#define fp(x) fixed << setprecision(x) <<
template <class T>
int sumAllInts(T n)
{
    int a = 1;
    int su = 0;
    while (n)
    {
        su += n % 10;
        n /= 10;
    }
    return su;
}
template <class T>
int digit(T a)
{
    vector<long long> dig = {
        0,
        9,
        99,
        999,
        9999,
        99999,
        999999,
        9999999,
        99999999,
        999999999,
        9999999999,
        99999999999,
        999999999999,
        9999999999999,
        99999999999999,
        999999999999999,
        9999999999999999,
        99999999999999999,
        999999999999999999,
        INT64_MAX};
    auto it = lower_bound(dig.begin(), dig.end(), a);
    int idx = (it - dig.begin());
    return idx;
}
template <class T>
void split(char c, T s)
{
    int n = s.size();
    int i = 0;
    while ((cout << s[i], i += 1) && (i < n) && (cout << c << ' '))
        ;
}
int digit(int a)
{
    int r;
    r = (a >= 1000000000) ? 9 : (a >= 100000000) ? 8 : (a >= 10000000) ? 7 : (a >= 1000000) ? 6 : (a >= 100000) ? 5 : (a >= 10000) ? 4 : (a >= 1000) ? 3 : (a >= 100) ? 2 : (a >= 10) ? 1 : 0;
    return r + 1;
}


bool check(int i,int j,int n,int m,vector<string> a, vector<string> b){
    if((n - i + 1)<m) return false;
    if((n - j + 1)<m) return false;
    int rangex = m + i;
    int rangey = m + j;
    int rx = -1;
    for (int c = i; c < rangex; c++)
    {
        rx++;
        int ry = -1;
        for (int v = j; v < rangey; v++)
        {
            ry++;
            if(a[c][v] != b[rx][ry])
                return false;
        }
        
    }
    return true;
}


int main()
{
    quickie;
    //txt;
    int m, n;
    cin >> n >> m;
    vector<string> a(n);
    vector<string> b(m);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    for (int i = 0; i < m; i++)
    {
        cin >> b[i];
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if(check(i,j,n,m,a,b)){
                cout<<"Yes";
                return 0;
            }
        }
        
    }
    int xs;
    cout<<"No";
    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
 
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define lli long long int
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define all(x) (x).begin(), (x).end()
#define forn(i, n)  for(int i=0;i<n;++i)
#define rforn(i,start) for(int i = start; i >= 0;--i)
#define forsn(i,start,end) for(int i=start;i<end;++i)
#define rforsn(i,start,end) for(int i=start;i>=end;--i)
#define debug(x) cout<<#x<<" = "<<x<<"\n";
const int CONST = 1e9 + 7;

#define MAX 2000000

int32_t main(){
	fastio;
    #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	//  freopen("output.txt","w",stdout);
	#endif
	
	string n;
	cin>>n;

	lli sum=0;
	for(auto ch: n){
		int num = ch-'0';

		sum = (sum+num)%9;
	}

	if(sum>0)	cout<<"No\n";
	else	cout<<"Yes\n";

	return 0;
}

Measured memory_bytes: 3780
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <map>
#include <vector>
using namespace std;
int main()
{
    int n, a, b;
    cin >> n >> a >> b;
    if(n * a > b){
        cout << b << endl;
    }
    else cout << n * a << endl;
    return 0;
}

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

using namespace std;

#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()

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


int bit(ll mask, int i) {
    return (mask >> i) & 1;
}

const int LOG = 62;

ll b[LOG];

bool add(ll v) {
    for (int i = 0; i < LOG; ++i) {
        if (!bit(v, i)) continue;
        if (b[i] == -1) {
            b[i] = v;
            return true;
        } else {
            v ^= b[i];
        }
    }
    return v;
}

const int N = 202;

ll a[N];
char s[N];

int solve() {
    memset(b, -1, sizeof(b));
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; ++i)
        scanf("%lld", &a[i]);
    scanf("%s", s);
    for (int i = n - 1; i >= 0; --i) {
        if (s[i] == '0') {
            add(a[i]);
        } else if (add(a[i])) {
            return 1;
        }
    }
    return 0;
}

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


    int t;
    scanf("%d", &t);
    while(t--)
        printf("%d\n", solve());

}


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

using namespace std;

int n;
vector<int> A;
int q;
vector<int> m;

// i番目以降の数字を用いて
// mを作ることができるかを判定する
bool solve(int i, int m) {
	// 終了条件
	if (m == 0) return true;
	if (i >= n) return false; // 数字の組合せを使い切ったが解けない

	// 使える数字を絞ってmが作れるか判定
	// 前者は使わなかった
	// 後者の式は、i番目の要素を使ったことを意味する
	bool res = solve(i + 1, m) || solve(i + 1, m - A[i]);
	return res;
}

int main() {
	cin >> n;
	A.resize(n);

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

	cin >> q;
	m.resize(q);
	for (int i = 0; i < q; i++) {
		cin >> m[i];
	}

	for (int i = 0; i < q; i++) {
		if (solve(0, m[i])) {
			cout << "yes" << endl;
		}
		else {
			cout << "no" << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
int main()
{
  string a,b;
  cin >> a >> b;
  int i = 0,ii = 0;
  while(a.length() >= i){
    if(a[i] != b[i]){
    ii++;
    }
    i++;
  }
  cout << ii;
  return 0;
}

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

namespace ABC104
{
    class Program
    {
        static void Main(string[] args)
        {
            int r = int.Parse(Console.ReadLine());
            string ans = "AGC";
            if (r < 1200) { ans = "ABC"; }
            else if (r < 2800) { ans = "ARC"; }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 11092
n, m = map(int, input().split())
a = []
for _ in range(n):
    a.append(list(map(int, input().split())))
b = sorted(a)
pm = s = 0
m_minus_1 = m - 1
for item in b:
    tmp = pm + item[1]
    if tmp > m_minus_1:
        print(s + item[0] * (m - pm))
        break
    else:
        pm = tmp
        s += item[0] * item[1]


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

typedef long long ll;
const int INF = 1e9+5;

int main(){
	int n;
	scanf("%d", &n);
	vector<int> dp(3);
	vector<int> abc(3);
	for(int i = 0; i < 3; i++){
		scanf("%d", &dp[i]);
	}
	for(int i = 1; i < n; i++){
		for(int j = 0; j < 3; j++){
			scanf("%d", &abc[j]);
		}
		vector<int> tmp(3, 0);
		for(int k = 0; k < 3; k++){
			for(int h = 0; h < 3; h++){
				if(k != h){
					tmp[h] = max(tmp[h], dp[k]+abc[h]);
				}			
			}
		}
		
		for(int k = 0; k < 3; k++){
			dp[k] = tmp[k];
		}

	}
	
	int ans = 0;
	for(int i = 0; i < 3; i++){
		ans = max(ans, dp[i]);
	}
	
	printf("%d\n", ans); 
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int , input().split()))
ans = 0

#a.sort(reverse=True)
import collections
cnt = collections.Counter(a)
for i, ci in cnt.items():
    cnt[i] = ci * 2

cnt[max(a)] -= 1
n -= 1
#print(cnt)

keys = list(cnt.keys())
keys.sort(reverse=True)
for i in keys:
    if n == 0:
        break
    ans += i * min(n, cnt[i])
    n -= min(n, cnt[i])
    #print(i, n, ans)

print(ans)

Measured memory_bytes: 35244
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
using Pair = System.Tuple<int, int>;
using Edge = System.Tuple<int, int, long>;
//using Debug;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {
        var nc = Input.ar;
        const int NUM = 2 * (int)1e5 + 2;
        var stc = Input.twodim(nc[0]);
        var res = new int[NUM];
        for(var i = 1; i <= nc[1]; i++)
        {
            var imos = new int[NUM];
            for(var j=0;j<nc[0];j++)
                if(stc[j][2]==i)
                {
                    imos[2 * stc[j][0] - 1]++;
                    imos[2 * stc[j][1] + 1]--;
                }
            for (var j = 1; j <NUM; j++)
                imos[j] += imos[j - 1];
            for (var j = 0; j <NUM; j++)
                if (imos[j] == 1)
                    res[j]++;
        }
        WriteLine(res.Max());
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public static char[][] gred(int h) 
        => Enumerable.Repeat(0, h).Select(v => read.ToCharArray()).ToArray();
    public static int[][] twodim(int num)
        => Enumerable.Repeat(0, num).Select(v => ar).ToArray();
    public static long[][] twodimL(int num)
        => Enumerable.Repeat(0, num).Select(v => arL).ToArray();
    public const long Inf = (long)1e18/2;
    public const double eps = 1e-6;
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


Measured memory_bytes: 40360
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for (int i = a; i < b; i++)
using namespace std;
 
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <tuple>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <stack>
#include <bitset>

int main() {
  int H, W;
  cin >> H >> W;
  
  string S[50];
  rep(i, H) {
    cin >> S[i];
  }
  
  const int dx[8] = { -1, -1, -1, 0, 0, 1, 1, 1 };
  const int dy[8] = { -1, 0, 1, -1, 1, -1, 0, 1 };
  
  rep(i, H) {
    rep(j, W) {
      if (S[i][j] == '#') continue;
      
      int cnt = 0;
      rep(d, 8) {
        int ni = i + dx[d];
        int nj = j + dy[d];
        
        if (ni < 0 || ni >= H) continue;
        if (nj < 0 || nj >= W) continue;
        if (S[ni][nj] == '#') cnt++;        
      }
      
      S[i][j] = char(cnt + '0');
    }
  }
  
  rep(i, H) {
    cout << S[i] << endl;
  }  
}

Measured memory_bytes: 256
def main():
    A = [int(e) for e in input().split()]
    A.extend([int(e) for e in input().split()])
    A.extend([int(e) for e in input().split()])
    n = int(input())
    B = [int(input()) for i in range(n)]

    S = set()
    for ai, a in enumerate(A):
        if a in B:
          S.add(ai + 1)

    bingo = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [1, 4, 7], [2, 5, 8], [3, 6, 9], [1, 5, 9], [3, 5, 7]]
    for bi in bingo:
        if S.issuperset(set(bi)):
            print('Yes')
            exit()

    print('No')

if __name__ == "__main__":
    main()


Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;

int n,k;
int a[200001];
//二分探索テンプレ

// index が条件を満たすかどうか
bool isOK(int index, int k) {
    int res = 0;
    rep(i,n) {
        res += (a[i]+index-1)/index-1;
    }
    if (res <= k) return true;
    else return false;
}

// 汎用的な二分探索のテンプレ
int binary_search(int k) {
    int ng = 0; //「index = 0」が条件を満たすこともあるので、初期値は -1
    int ok = 1e9; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

    /* ok と ng のどちらが大きいかわからないことを考慮 */
    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (isOK(mid, k)) ok = mid;
        else ng = mid;
    }
    return ok;
}
 
int main() {

    cin >> n >> k;
    rep(i,n)    cin >> a[i];

    int ans = binary_search(k);
    cout<<ans<<endl;

 return 0;
}


Measured memory_bytes: 4380
import java.util.*;
import java.io.*;

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

   String inStr = br.readLine();
   String[] sp = inStr.split(" ");

   int a = Integer.parseInt(sp[0]);
   char[] op = sp[1].toCharArray();
   int b = Integer.parseInt(sp[2]);

   while(op[0] != '?'){
    switch(op[0]){
        case '+':
            System.out.println(a+b);
            break;
        case '-':
            System.out.println(a-b);
            break;
        case '*':
            System.out.println(a*b);
            break;
        case '/':
            System.out.println(a/b);
            break;
        default:
            break;
    }
   inStr = br.readLine();
   sp = inStr.split(" ");

   a = Integer.parseInt(sp[0]);
   op = sp[1].toCharArray();
   b = Integer.parseInt(sp[2]);
   }
 }
}

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

int main(){
  
  int n, k, x, y;
  cin >> n >> k >> x >> y;
  
  int total;
  
  if(n > k)
    total = (k * x) + ((n - k) * y);
  else
    total = n * x;
  
  cout << total << endl;
  
  return 0;
  
}


Measured memory_bytes: 256
c = []
for i in range(3):
    c.append([int(x) for x in input().split()])
d = []
for x in range(3):
    d.append(min(c[x]))

#print(d)

for x in range(d[0]+1):
    for y in range(d[1]+1):
        for z in range(d[2]+1):
            for i in range(3):
                if(c[0][i]-x+1==c[1][i]-y+1):
                    if(c[1][i]-y+1==c[2][i]-z+1):
                        pass                        
                    else:
                        break
                else:
                    break
            else:
                print('Yes')
                exit()
else:
    print('No')

Measured memory_bytes: 3064
#!/usr/bin/env python3
import math

def main():
    s = input().split()
    N, K = int(s[0]), int(s[1])

    c = 0
    for b in range(K + 1, N + 1):
        db, mb = int(N / b), N % b
        if mb == 0 or mb < K:
            c += (b - K) * db
        else:
            c += (b - K) * db
            if K == 0:
                c += N - (b * db + K)
            else:
                c += N - (b * db + K) + 1
#        print(c)

    print(c)


if __name__ == '__main__':
    main()



Measured memory_bytes: 3060
// Mahesh Sharma
// Beauty is in the struggle!
#include<bits/stdc++.h>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <cstring>
#include <memory.h>
#include <cassert>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

using namespace std;
// using namespace __gnu_pbds;

#define ford(i, a, b, c)        for(int i=(a); i<(b); i+=(c))
#define fori(i, a, b)           ford(i,a,b,1)
#define rep(i, n)               fori(i,0,n)
#define ifor(i, a, b)           for(int i=(a); i>=(b); i--)
#define si(x)                   ((int)x.size())
#define SS                      ({int x;scanf("%d",&x);x;})
#define pb                      push_back
#define mp                      make_pair
#define all(a)                  a.begin(),a.end()
#define inf                     (int)1e9
#define linf                    (long long)1e18
#define V                       vector
#define S                       string
#define XX                      first
#define YY                      second
#define PVI(v)                  rep(i, si(v)) cout<<v[i]<<" "; puts("")
#define PPI(p)                  cout<<"("<<p.first<<", "<<p.second<<")\n"
#define PVPI(v)                 rep(i, si(v)) cout<<"("<<v[i].first<<", "<<v[i].second<<")"<<(i==si(v)-1?"":", ");puts("")
#define PA(arr1, arr2)          for(auto it = arr1; it != arr2; it++) cout<<*it<<" "; puts("");

typedef V<int> vi;
typedef V<S> vs;
typedef long long ll;
typedef pair<int,int> pii;
const int MOD7 = 1000000000+7;
const int MOD9 = 1000000000+9;
/* ################### Program Body starts here ################ */

int a[200000];

int main() {
    int n = SS, k = SS;
    rep(i, n) a[i] = SS;
    sort(a, a+n);
    reverse(a, a+n);
    rep(i, min(k,n)) {
        a[i] = 0;
    }
    ll ans = 0;
    rep(i, n) ans += a[i];
    cout<<ans<<"\n";
}


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

int main() {
  int data[6];
  bool flag;
  int sum;
  while(1) {
    flag = true;
    for(int i = 0; i < 6; i++) {
      cin >> data[i];
      if(data[i] != 0) flag = false;
    }
    if(flag) break;

    sum = 100;
    sum += data[0]*(5*15+15);
    sum += data[1]*(3*15+15);
    sum += data[2]*7;
    sum += data[3]*2;
    sum -= (data[5]-data[4]-data[0]*5-data[1]*3) * 3;
    sum -= (data[0]*5+data[1]*3) * 2;

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

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

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

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

  int x,y;
  x=d[n/2-1];
  y=d[n/2];

  if(x==y){
    cout << 0 << endl;
  }
  else
  cout << y-x << endl;

  return 0; 
}

  




Measured memory_bytes: 640
/*  ex9_1
    Graku   */
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define SIZE 100

typedef struct stack {
    int size;
    int count;
    char data[SIZE];
    char *top;
} stack;

void initialize_stack(stack *stk);
char pop(stack *stk);
void push(stack *stk, char c);
void print_stack(stack *stk);

int main(void) {
    stack stk;
    initialize_stack(&stk);

    char s[SIZE];
    scanf("%s", s);

    for (int i = 0; i < (int)strlen(s); ++i) {
        if (s[i] == 'B') { //delete a element
            if (stk.count > 0) { //stk has elements
                pop(&stk);
            }
        }
        else {
            push(&stk, s[i]); //add a element to stk
        }
    }

    print_stack(&stk);

    return 0;
}

void initialize_stack(stack *stk) {
    stk->size = SIZE;
    stk->count = 0;
    stk->top = stk->data; //stk.data[0] is always empty
}

char pop(stack *stk) {
    char c;
    if (stk->count <= 0) { //stk has no elements
        printf("Error: stack underflow.\n");
        exit(1);
    }
    c = *(stk->top);
    stk->top--;
    stk->count--;
    return c;
}

void push(stack *stk, char c) {
    if (stk->count >= stk->size) { //stk has biggest elements it can have
        printf("Error: stack overflow.\n");
        exit(1);
    }
    *(++stk->top) = c;
    stk->count++;
}

void print_stack(stack *stk) {
    char *p = stk->data;
    for (int i = 0; i < stk->count; ++i) {
        printf("%c", p[i+1]); //stk.data[0] is always empty
    }
    printf("\n");
}


Measured memory_bytes: 1608
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define SZ(x) ((int)(x).size())
#define MEM(x,a) memset(x,a,sizeof(x))
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VL;
const ll mod=1000000007,N=1e5+5,M=1e5+5,INF=0x3f3f3f3f;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
//head

int main(void){
    ll a,b,n;
    cin>>a>>b>>n;
    if(n>=2*b-1)cout<<(a-a/b);
    else if(n>=b&&n<2*b-1)cout<<a*(b-1)/b;
    else cout<<(a*n)/b;
    return 0;
}

Measured memory_bytes: 3604
local S = io.read()
local a = {}
a[#S+1] = 0
for i=#S,1,-1 do
  local c = S:sub(i,i)
  if c == '>' then
    a[i] = a[i+1] + 1
  else
    a[i] = 0
  end
end
for i=1,#S do
  local c = S:sub(i,i)
  if c == '<' and a[i+1] <= a[i] then
    a[i+1] = a[i] + 1
  end
end
local s = 0
for i=1,#a do
  s = s + a[i]
end
print(s)


Measured memory_bytes: 17304
h,w = map(int,input().split())
a = []
for i in range(h):
    a.append(list(map(int,input().split())))

ni=0
nj=0
st=0
sw=0
lis = []
while (True):
    #print(ni,nj)
    tmp =[]
    if a[ni][nj]%2==1:
        st=1
        tmp.extend([ni+1,nj+1])
    if sw==0 and nj<w-1:
        nj+=1
    elif sw==1 and nj>0:
        nj-=1
    elif nj==w-1 or nj==0:
        ni+=1
        sw=1-sw
    #print(ni,nj)
    if ni>h-1:
        break
    if st==1:
        a[ni][nj]+=1
        tmp.extend([ni+1,nj+1])
        lis.append(tmp)
    st=0
print(len(lis))
for i in range(len(lis)):
    print(*lis[i])


Measured memory_bytes: 74588
#include <iostream>
#include <cstdio>

using namespace std;

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

  for(int i=0;i<=n;i++) {
    for(int k=0;k<=n-i;k++) {
      int l = n-i-k; 
      int sum = 10000 * i + 5000 * k + 1000 * l;
      if (sum == y) {
        printf("%d %d %d\n",i,k,l);
        return 0;
      }
    }
  }

  cout << "-1 -1 -1\n";

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  int k;
  cin>>k;
  cin>>s;
  if(s.size()<=k){cout<<s;}
  else{for(int i=0;i<k;i++){cout<<s[i];}cout<<"...";}
  return 0;
}


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

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

/* Macros reg. ends here */

const ll INF = 1LL << 50;

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll a, b;
  cin >> a >> b;
  ll ans = (a - 1) * (b - 1);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<vector>
int main()
{
	int n,m,l,k,i,j;
	scanf("%d%d",&n,&m);l=n*2;
	std::vector<int>a(l),b(l),c(l);
	for(i=0;i<l;++i)a[i]=i+1;
	for(i=0;i<m;++i)
	{
		scanf("%d",&k);
		if(k)
		{
			b.assign(a.begin(),a.begin()+k),c.assign(a.begin()+k,a.end());
			a=c,a.insert(a.end(),b.begin(),b.end());
		}
		else
		{
			b.assign(a.begin(),a.begin()+n),c.assign(a.begin()+n,a.end());
			for(j=0;j<l;++j)a[j]=(j&1?c[j/2]:b[j/2]);
		}
	}
	for(i=0;i<l;++i)printf("%d\n",a[i]);
	return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;

const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int main() {
    int N, K;

    cin >> N >> K;

    vector<int> h;

    ll acc = 0;

    for(int i=0; i<N; i++){
        int tmp;
        cin >> tmp;
        h.push_back(tmp);
        acc += tmp;
    }

    sort(h.rbegin(), h.rend());

    for(int i=0; i<min(K, N); i++){
        acc -= h[i];
    }

    cout << acc << endl;

}


Measured memory_bytes: 1400
import sys
input = sys.stdin.readline
 
H,W = map(int , input().split())
sh,sw = map(int , input().split())
eh,ew = map(int , input().split())
mv_a_pts = [[-1,0],[1,0],[0,-1],[0,1]]
mv_b_pts = [(-2, -2), (-2, -1), (-2, 0), (-2, 1), (-2, 2),
        (-1, -2), (-1, -1), (-1, 0), (-1, 1), (-1, 2),
        (0, -2), (0, -1), (0, 1), (0, 2),
        (1, -2), (1, -1), (1, 0), (1, 1), (1, 2),
        (2, -2), (2, -1), (2, 0), (2, 1), (2, 2),]
maze = [input() for _ in range(H)]
warp_cnts = [[None]*(W) for j in range(H)]
 
def mv_a():
  while len(mv_a_tgs):
    h,w = mv_a_tgs.pop()
    mv_b_tgs.append([h,w])
    warp_cnts[h][w] = cnt
    for vh,vw in mv_a_pts:
      tgh = h + vh
      tgw = w + vw
      if 0 <= tgh <= H-1 and 0 <= tgw <= W-1 :
        if warp_cnts[tgh][tgw] is None and maze[tgh][tgw] != "#":
          mv_a_tgs.append([tgh,tgw])

def mv_b():
  while len(mv_b_tgs):
    h,w = mv_b_tgs.pop()
    for vh,vw in mv_b_pts:
      tgh = h + vh
      tgw = w + vw
      if 0 <= tgh <= H-1 and 0 <= tgw <= W-1 :
        if warp_cnts[tgh][tgw] is None and maze[tgh][tgw] != "#":
          mv_a_tgs.append([tgh,tgw])
        
mv_b_tgs=[]
mv_a_tgs = [[sh-1,sw-1]]
cnt = 0
while len(mv_a_tgs)>0:
  mv_a()
  mv_b()
  cnt+=1
print(-1 if warp_cnts[eh-1][ew-1] is None else warp_cnts[eh-1][ew-1])

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

#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    string s;
    cin >> s;
    int cnt = 0;
    rep(i, s.size() - 1) if (s[i] != s[i + 1])
        cnt++;

    OP(cnt);

    return 0;
}

Measured memory_bytes: 512
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

typedef long long ll;
const int INF = 1e9;
using namespace std;

string input;
void solve(){
    bool n = false,s = false,w = false,e = false;
    for(int i=0;i<input.size();i++){
        if(input[i]=='N') n = true;
        if(input[i]=='S') s = true;
        if(input[i]=='W') w = true;
        if(input[i]=='E') e = true;
    }
    if(n == s && w == e)printf("Yes");
    else printf("No");
}

int main() {
    cin >> input;
    solve();
    printf("\n");
    return 0;
}

Measured memory_bytes: 256
import sys
import numpy as np
from math import factorial

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, A, B = lr()
V = np.array(lr())
V.sort()
if A == 1:
    ave = V[-A]
else:
    ave = V[-A:].sum() / A
print(ave)
left_i = np.searchsorted(V, V[-A], side='left')
right_i = np.searchsorted(V, V[-A], side='right')
num = right_i - left_i
done = N - right_i

bottom = A-done
top = B-done

def combinations_count(n, r):
    ''' 組み合わせ '''
    return factorial(n) // (factorial(n - r) * factorial(r))

answer = combinations_count(num, bottom)
if ave == V[-A] and num > 1:
    for i in range(bottom+1, min(num, top)+1):
        answer += combinations_count(num, i)

print(answer)
# 15

Measured memory_bytes: 12400
#include<iostream>

using namespace std;

int main(){
  int b,r,g,s,c,t;
  while(cin >> b >> r >> g >> c >> s >> t&&t){
    int ans = 100-3*t+3*s+2*c+7*g+15*b+80*b+15*r+16*3*r;
    cout << ans << endl;
  }
  return 0;
  }

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

using namespace std;

const double PI = acos(-1);

int main(){

    long long int N, D;
    int count = 0;

    cin >> N >> D;

    // vector<vector<int>> point(N, vector<int>(2));
    for (int i = 0; i < N; i++){
        long long int x, y;
        cin >> x >> y;
        if (x*x + y*y <= D*D) count++;
    }

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 3144
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

int table[1000];
int bisect_right(int x,int a[],int left,int right){
    int mid;
    right++;
    while (left < right) {
        mid = (left + right) / 2;
        if (a[mid] <= x) {
            left = mid + 1;
        } else {
            right = mid;
        }
    }
    return left;
}


int counter(int i) {
    if (i == 0) {
        return 0;
    }
    return bisect_right(i,table,0,999) - 1;
    
}

void solve(long long N, int *ans ){
    int cnt = 0;
    while (N % 2 == 0) {
        cnt++;
        N /= 2;
    }
    *ans += counter(cnt);
    long long now = 3;
    cnt = 0;
    while (now * now <= N) {
        while (N % now == 0) {
            cnt++;
            N /= now;
        }
        *ans += counter(cnt);
        cnt = 0;
        now += 2;
    }
    if (N != 1) {
        *ans += counter(1);
    }
}



int main(void){
    long long N;
    scanf("%lld", &N);
    for (int i = 0; i < 1000; i++) {
        table[i] = i * (i + 1) / 2;
    }
    int ans = 0;
    solve(N, &ans);
    printf("%d\n",ans);
    return 0;
}



Measured memory_bytes: 1732
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string> 
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
typedef long long ll;
typedef long double ld;
int main(){
     string s;
     cin>>s;
     ll n=SIZE(s);
     string a,b;
     REP(i,n){
         if(i%2==0){
             a+="0";
             b+="1";
         }else{
             a+="1";
             b+="0";
         }
     }
     ll a_cost=0, b_cost=0;
     REP(i,n){
         char s_num=s[i], a_num=a[i], b_num=b[i];
         if(s_num!=a_num){
             a_cost++;
         }else{
             b_cost++;
         }
     }
     cout<< min(a_cost, b_cost);
     
    return 0;
}


Measured memory_bytes: 3936
#include <stdio.h>

int main(void) {
	int a,b,c;
	scanf("%d", &a);
	scanf("%d", &b);
	c = a * 500; 
	if(c >= b)
	{
		printf("Yes");
	}
	else
	{
		printf("No");
	}
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0 ,-1};
signed main() {
    string s;
    int K;
    cin >> s >> K;
    for(int i = 0; i < s.size(); i++) {
        if(s[i] == 'a') {
            continue;
        }
        else if('z'-s[i]+1 <= K) {
            K-='z'-s[i]+1;
            s[i] = 'a';
        }
    }
    for(int i = 0; i < K; i++) {
        if(s[s.size()-1] == 'z') {
            s[s.size()-1] = 'a';
        }
        else {
            s[s.size()-1] = (s[s.size()-1]-'a'+1)+'a';
        }
    }
    cout << s << endl;
}


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

int main(){
    int n;
    cin >> n;
    vector<int> l(n);
    for(int i=0; i<n; i++){
        cin >> l.at(i);
    }
    sort(l.begin(), l.end());
    int cnt=0;
    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            for(int k=j+1; k<n; k++){
                if(l.at(i)+l.at(j)>l.at(k)){
                    if(l.at(i)!=l.at(j)&& l.at(i)!=l.at(k)&&l.at(j)!=l.at(k)) cnt++;
                }
            }
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3628
#include <cstdio>

int main()
{
  int n, a;
  scanf("%d %d", &n, &a);
  
  int ans = 1;
  int dir = 0;
  for (int i = 1; i < n; ++i)
  {
    int last = a;
    scanf("%d", &a);
    if (dir == 0)
    {
      if (a != last)
      {
        dir = a > last ? 1 : -1;
      }
    }
    else if (dir == 1)
    {
      if (a < last)
      {
        ++ans;
        dir = 0;
      }
    }
    else if (dir == -1)
    {
      if (a > last)
      {
        ++ans;
        dir = 0;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
void print_err() {
	cerr << "\n";
}
template <class T, class... Arg>
void print_err(T x, Arg&&... args) {
	cerr << x << " ";
	print_err(args...);
}
#ifdef local
#define debug(...) print_err(__VA_ARGS__)
#else
#define debug(...)
#endif
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define mod 1000000007
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define vl vector<ll>
#define vpll vector<pair<ll,ll>>
#define mll map<ll,ll>
#define mllrev map<ll,ll,greater<int>>
#define ps(x,y) fixed<<setprecision(y)<<x
#define w(t) ll t;cin>>t;while(t--)
#define fo(i,n) for(ll i=0;i<n;++i)
#define foab(i,a,b) for(ll i=a;i<b;++i)
#define inp cin>>
#define pr cout<<
#define fastio ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
class Graph {
public:
	list<ll> *adj_list;
	ll v;
	Graph(ll v) {
		this->v = v;
		adj_list = new list<ll>[v];
	}
	void add_edge(ll u, ll v, bool bidirectional = true) {
		adj_list[u].push_back(v);
		if (bidirectional) {
			adj_list[v].push_back(u);
		}
	}
	void print();
	void connected_compo();
	void dfs(ll v, bool visited[]);
	void bfs(ll v, bool visited[]);
};
void solve() {
	// // http://codeforces.com/problemset/problem/445/A
	// inp n >> m;
	// fo(i, n) {
	// 	fo(j, m) {
	// 		inp ch[i][j];
	// 	}
	// }
	ll n, w;
	inp n >> w;
	ll wt[n + 1], val[n + 1], sum = 0;
	fo(i, n) {
		inp wt[i + 1] >> val[i + 1];
		sum += val[i + 1];
	}
	vector<vector<ll>> dp(n + 1, vector < ll> (sum + 1, INT_MAX));
	fo(i, sum + 1) {
		dp[0][i] = INT_MAX;
	}
	foab(i, 1, n + 1) {
		dp[i][0] = 0;
	}
	dp[1][val[1]] = wt[1];
	foab(i, 2, n + 1) {
		for (ll j = 0; j < sum + 1; j++) {
			dp[i][j] = dp[i - 1][j];
			if (val[i] <= j) {
				dp[i][j] = min(dp[i][j], wt[i] + dp[i - 1][j - val[i]]);
			}
		}
	}
	ll ans = 0;
	fo(i, sum + 1) {
		if (dp[n][i] <= w) {
			ans = i;
		}
	}
	cout << ans << endl;
	return ;
}
int main() {
	fastio
#ifdef local
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error.txt", "w", stderr);
#endif
	solve();
	return 0;
}
// ll n, m;
// char ch[100][100];
// bool istrue = false;
// ll dx[] = { -1, 1, 0, 0}, dy[] = {0, 0, -1, 1};
// void dfs(ll row, ll col, char ch) {
// 	if (ch[row][col] == 'B' or ch[row][col] == 'W' or ch[row][col] == '-' or istrue) {
// 		return;
// 	}
// 	fo(i, 4) {
// 		if (isvalid(ch, row + dx[i], col + dy[i])) {
// 			if (ch == 'B') {
// 				dfs(row + dx[i], col + dy[i], 'W');
// 			} else if (ch == 'W') {
// 				dfs(row + dx[i], col + dy[i], 'B');
// 			}
// 		}
// 	}
// }

Measured memory_bytes: 83088
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>
#include <stack>
using namespace std;
int N;
int a[1001];
int is_prime[1001];
int prime[1001];
const int mod=1000000007;
int sieve(int n){
  int p=0;
  for(int i=0;i<=n;i++)is_prime[i]=1;
  is_prime[0]=is_prime[1]=0;
  for(int i=2;i<=n;i++){
    if(is_prime[i]){
      prime[p++]=i;
      for(int j=2*i;j<=n;j+=i)	is_prime[j]=0;
    }
  }
  return p;
}
int main(){
  scanf("%d",&N);
  int p=sieve(N);
  long long int ans=1;
  for(int x=2;x<=N;x++){
    int t=x;
    for(int i=0;i<p && t>1;i++){
	while(t%prime[i]==0){
	  if(a[i]==0)a[i]++;
	  a[i]++;
	  t/=prime[i];
	}
    }
  }
  for(int i=0;i<p;i++){
    if(a[i]!=0) ans=(ans*a[i])%mod;
  }
  printf("%lld\n",ans%mod);
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

ll calc_gcd(ll x, ll y) {
    if (!y) {
        return x;
    }
    return calc_gcd(y, x % y);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll A, B;
    cin >> A >> B;
    cout << A * B / calc_gcd(A, B) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;

int main(){
    int a,b,c,s;
    int ans = 10000000;
    int ai[1000000];
    cin >> s;
    ai[0] = s;
    
    
    for(int i = 1; i < 1000000; i++)
    {
        if (s%2 == 0) {
        s = s/2;
        ai[i] = s;
        }else{
            s = 3*s+1;
            ai[i] = s;
        }
        
        for(int z = 0; z < i; z++)
        {
            
            if (ai[z] == ai[i]) {
                ans = i;
                break;
            }
            
        }

        
        if (ans == i) {
            break;
        }
        
        
    }

    cout << ans+1 <<endl;

}

Measured memory_bytes: 256
using System;

#region Program
namespace Program
{
    #region Solver
    public class Solver
    {

        // ?????? ????´???° ??????
        public static int upper = 100;

        // ????´???°
        int N;

        // ??°???
        int[] A = new int[upper];

        #region Solver
        public Solver()
        {
            N = int.Parse(Console.ReadLine());

            /* ?????????????????¨?????????????????? */
            string[] strAryA = Console.ReadLine().Split(' ');

            /* ????????????????????´??°?????????????????? */
            A = Array.ConvertAll<string, int>(
                    strAryA
                    , delegate (string value)
                    {
                        return int.Parse(value);
                    }
                );
        }
        #endregion

        #region Solve
        public void Solve()
        {
            /* ??????????????? ???????????? */
            int ans = selectionSort(A, N);
            /* ?????? ?????? */
            trace(A, N);
            /* ?????? ???????????° */
            Console.WriteLine(ans);
        }
        #endregion

        #region selectionSort
        /* ??????????????? 0?????????????????? */
        public int selectionSort(int[] A, int N)
        {
            int i;
            int j;
            int t;
            int sw = 0;
            int minj;
            for (i = 0; i < N - 1; i++)
            {
                minj = i;
                for (j = i; j < N; j++)
                {
                    if (A[j] < A[minj])
                    {
                        minj = j;
                    }
                }
                t = A[i];
                A[i] = A[minj];
                A[minj] = t;
                if (i != minj)
                {
                    sw++;
                }
            }
            return sw;
        }
        #endregion

        #region trace
        /* ?????????????´??????????????????? */
        public void trace(int[] A, int N)
        {
            int i;
            for (i = 0; i < N; i++)
            {
                if (i > 0)
                {
                    /* ??£??\??????????´??????????1????????????????????? */
                    Console.Write(" ");
                }
                Console.Write(A[i]);
            }
            /* ????°??????????????????? */
            Console.Write(Environment.NewLine);
        }
        #endregion
    }
    #endregion
}
#endregion

#region Execute
class Execute
{
    public static void Main(string[] args)
    {
        new Program.Solver().Solve();
    }
}
#endregion

Measured memory_bytes: 9180
import math

#n = int(input())
#a = int(input())
a,b = list(map(int,input().split(" ")))
#ls = list(input().split(" "))
#ls = list(map(int,input().split(" ")))
#a,b = list(input().split())
#string = input()
#ls = [int(input()) for i in range(n)]
#ls1 = [input() for i in range(n)]
#m = int(input())
#ls2 = [input() for i in range(m)]
ans = 0
for i in range(a, b+1):
  tmp = str(i)
  flag = True
  for j in range(len(tmp)//2):
    if tmp[j] != tmp[len(tmp)-1-j]:
      flag = False
  if flag:
    ans += 1
print(ans)

Measured memory_bytes: 3060
#include <cstdio>

typedef long long int ll;

bool arr[1000005];

int main(){

    ll cur=7;
    ll count=1;
    ll K;
    scanf("%lld",&K);
    cur=cur%K;
    while(cur&&!arr[cur]){
        arr[cur]=1;
        count++;
        cur=(cur*10+7)%K;
    }

    if (!cur)
        printf("%lld\n",count);
    else 
        puts("-1");

    return 0;
}

Measured memory_bytes: 2660
import java.io.*;
import java.util.Arrays;
class Main{
    public static void main(String[] args) throws IOException {
        String strS,strP;
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        strS = in.readLine();
        strP = in.readLine();
        StringBuffer sb = new StringBuffer(strS);
        sb.append(strS);
        System.out.println((sb.indexOf(strP)==-1 ? "No" : "Yes"));
        System.out.flush();
    }
}

Measured memory_bytes: 24428
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod * mod;
constexpr int MAX = 200010;

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

Measured memory_bytes: 3828