akhauriyash/Code-Regression huggingface dataset:
N = int(input())
A = list(map(int, input().split(" ")))
a_max = max(A)
cnts = [0] * (a_max + 1)
for a in A:
    v = a
    while v <= a_max:
        cnts[v] += 1
        v += a
cnt = 0
for a in A:
    if cnts[a] == 1:
        cnt += 1
print(cnt)

Measured memory_bytes: 131364
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
using namespace std;
using ll = long long;

char s[10][1001];

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

    int h, w, k;
    cin >> h >> w >> k;

    for (int i = 0; i < h; i++) {
        cin >> s[i];
        for (int j = 0; j < w; j++) {
            s[i][j] -= '0';
        }
    }

    int r = 1 << 30;
    for (int l = 0; l < 1 << (h - 1); l++) {
        int p[10] = {};
        int x = 0;
        for (int i = 0; i < h; i++) {
            x += l >> i & 1;
        }
        int j0 = -1;
        for (int j = 0; j < w; j++) {
            int f = 0;
            int t = 0;
            for (int i = 0; i < h; i++) {
                p[t] += s[i][j];
                if (p[t] > k) {
                    f = 1;
                    break;
                }
                t += l >> i & 1;
            }
            if (f) {
                if (j <= j0) {
                    x = 1 << 30;
                    break;
                }
                for (int i = 0; i < h; i++) {
                    p[i] = 0;
                }
                j0 = j;
                j--;
                x++;
            }
        }
        r = min(r, x);
    }

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 256
h, w = gets.split.map(&:to_i)
s = []
h.times do
    s << gets.chomp.chars
end

def calc_dist(h, w, s, x, y)
  ans = 0
  dist = Array.new(h){Array.new(w, -1)}
  dist[x][y] = 0
  queue = [[x, y]]

  dh = [1, 0, -1, 0]
  dw = [0, 1, 0, -1]
  until queue.empty?
    px, py = queue.shift
    ans = ans > dist[px][py] ? ans : dist[px][py]
    # p sprintf("search from [%d, %d]", px, py)

    4.times do |i|
      nx = px+dh[i]
      ny = py+dw[i]
      # p sprintf("  next [%d, %d]", nx, ny)

      next if nx < 0 || nx >= h || ny < 0 || ny >= w
      next if s[nx][ny] == '#'
      if dist[nx][ny] == -1
        # p sprintf("  ok for [%d, %d]", nx, ny)
        dist[nx][ny] = dist[px][py]+1
        queue.push([nx, ny])
      end
    end
  end

  return ans
end

max_dist = 0
for sh in 0..h-1
  for sw in 0..w-1
    if s[sh][sw] != '#'
      dist = calc_dist(h, w, s, sh, sw)
      max_dist = dist > max_dist ? dist : max_dist
      # p sprintf("x=%d y=%d dist=%d max=%d", sh, sw, dist, max_dist)
    end
  end
end

puts max_dist



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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO  cout << "NO"  << endl
#define No  cout << "No"  << endl

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    int H, W, N; cin >> H >> W >> N;
    cout << (N+max(H, W)-1) / max(H, W) << endl;
}
    
int main() 
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <queue>
#define inf 0x3f3f3f3f
#define maxm 10005
#define maxn 40005

using namespace std;

int m,n;
long long edgenum,head[maxm],dis[maxm],num[maxm],ans;
bool vis[maxm];

struct node
{
    int from,to,len,cost,next;
}edge[maxn];

void init()
{
    memset(head,-1,sizeof(head));
    memset(vis,0,sizeof(vis));
    memset(dis,inf,sizeof(dis));
    memset(num,inf,sizeof(num));
    edgenum=0;
}

void add(int u,int v,int len,int cost)
{
    node tp={u,v,len,cost,head[u]};
    edge[edgenum]=tp;
    head[u]=edgenum++;
}

long long SPFA(int st)
{
     queue<int> q;
     q.push(st);
     vis[st]=1;
     dis[st]=0;
     num[st]=0;
     ans=0;
     while(!q.empty())
     {
          int tmp=q.front();
          q.pop();
          vis[tmp]=0;
          for(int i=head[tmp];i!=-1;i=edge[i].next)
          {
                if((dis[edge[i].to]>dis[tmp]+edge[i].len)||((dis[edge[i].to]==dis[tmp]+edge[i].len)&&(num[edge[i].to]>edge[i].cost)))
                {
                    dis[edge[i].to]=dis[tmp]+edge[i].len;
                    num[edge[i].to]=edge[i].cost;
                    if(!vis[edge[i].to])
                    {
                        q.push(edge[i].to);
                        vis[edge[i].to]=1;
                    }
                }
          }
     }
     for(int i=1;i<=m;i++)
        ans+=num[i];
     return ans;
}

int main()
{
    int u,v,len,cost;
    while(cin>>m>>n&&m)
    {
        init();
        for(int i=1;i<=n;i++)
        {
            cin>>u>>v>>len>>cost;
            add(u,v,len,cost);
            add(v,u,len,cost);
        }
        cout<<SPFA(1)<<endl;
    }
    return 0;
}

Measured memory_bytes: 4184
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <set>
#include <map>
#include <math.h>
#include <queue>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define rev(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = INT_MAX;






int main() {

    ll a, b, c;
    cin >> a >> b >> c;

    bool flag;
    if (c - a - b <= 2) flag = false;
    else if (4 * a * b < (c - a - b) * (c - a - b)) flag = true;
    else flag = false;
    


    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}




//              g++ -std=c++1z






Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n,k,mod=1e9+7;
ll sm[109][100009],dp[109][100009],a[100009];
ll bt(int i,int x,int o)
{
    //cout<<i<<" "<<x<<"\n";
    if(x<0)return 0;
    if(x==0)return 1;
    if(i==0)
    {
        if(x<=a[i])
        {
            if(o)return 1;
            else return x+1;
        }
        else if(o==0)return a[i]+1;
        else return 0;
    }
    if(dp[i][x]!=-1)
    {
        if(o)return dp[i][x];
        else return sm[i][x];
    }
    dp[i][x]=(bt(i-1,x,0)-bt(i-1,x-a[i]-1,0)+mod)%mod;
    sm[i][x]=(bt(i,x-1,0)+dp[i][x])%mod;
    if(o)return dp[i][x];
    else return sm[i][x];
}
int main()
{
    memset(dp,-1,sizeof(dp));
    cin>>n>>k;
    for(int i=0;i<n;i++)cin>>a[i];
    cout<<bt(n-1,k,1);
}
/*
 dp[i][j]=sm[i-1][j];
            if(j-a[i]>0)dp[i][j]-=sm[i-1][j-a[i]-1];
            dp[i][j]+=mod;
            dp[i][j]%=mod;
            sm[i][j]=(dp[i][j]+sm[i][j-1])%mod;
*/


Measured memory_bytes: 173184
#include<bits/stdc++.h>
using namespace std;
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
/*template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<int,int> pii;

#define int ll
#define LOCAL 0
#define dbg(x) cout << #x << " is " << x << "\n"
#define gll(x) scanf("%d",&x)
#define gll2(x,y) scanf("%d%d",&x,&y)
#define gll3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define gllarr(arr,n) f(i,n) gll(arr[i]);
#define sz(x) ((int)x.size())
#define s(x) sort(x.begin(),x.end())
#define all(v) v.begin(),v.end()
#define rs(v) { s(v) ; r(v) ; }
#define r(v) {reverse(all(v));}
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
#define fr(i,n) for(int i=n-1;i>=0;i--)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)

const ll mod = (ll)1e9 + 7;
const ll inf = (ll)1e16;
const ld eps = 1e-12;
const ll N = (int)1e5 + 5;
const ll LOGN = 19;
const ld PI = 3.14159265358979323846;
inline ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
inline ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
inline ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (LOCAL) {
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\input.txt", "r", stdin);
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\output.txt", "w", stdout);
    }
    int a, b;
    cin>>a>>b;
    if(a >= 10 || b >= 10) cout<<"-1";
    else cout<<a * b;
    return 0;
}

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

int main(){
	int x, t;
	cin >> x >> t;
	if (x - t < 0)
		cout << "0" << endl;
	else
		cout << x - t << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <iostream>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;

int main(void) {
  int n, h, w;
  cin >> n >> h >> w;
  int res = max(0, (n-h+1)*(n-w+1));
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 768
//Giorgi Kldiashvili

#include <bits/stdc++.h>

#define M 1000000007ll
#define ll long long
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define MAX(x, y) ((x) < (y) ? (y) : (x))

using namespace std;

const int N = 3020;

int n, a[N];
vector < int > G[N];

bool go(int v, int p = 0)
{
  for(int i = 0; i < G[v].size(); ++ i)
  {
    int to = G[v][i];
    if(to == p || a[v] <= a[to])
      continue;
    if(go(to, v) == false)
      return true;
  }
  return false;
}

int main()
{
  scanf("%d", &n);

  for(int i = 1; i <= n; ++ i)
    scanf("%d", &a[i]);
  for(int i = 1; i < n; ++ i)
  {
    int x, y;
    scanf("%d %d", &x, &y);
    G[x].push_back(y);
    G[y].push_back(x);
  }

  for(int i = 1; i <= n; ++ i)
  {
    if(a[i] == 0)
      continue;
    if(go(i))
      printf("%d ", i);
  }
}

Measured memory_bytes: 384
import std.algorithm, std.array, std.conv, std.stdio, std.string;

void main()
{
    readln;
    auto p = readln.chomp.split.to!(int[]);
    auto q = readln.chomp.split.to!(int[]);
    if (p > q)
    {
        auto r = p;
        p = q;
        q = r;
    }
    int ans;
    while (p != q)
    {
        p.nextPermutation;
        ans += 1;
    }
    ans.writeln;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main (String[] args)  {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		HashMap<String, Integer> map = new HashMap<>();
		for (int i = 0; i < n; i++) {
			char[] arr = sc.next().toCharArray();
			Arrays.sort(arr);
			String s = new String(arr);
			if (map.containsKey(s)) {
				map.put(s, map.get(s) + 1);
			} else {
				map.put(s, 1);
			}
		}
		long total = 0;
		for (int x : map.values()) {
			total += (long) x * (long)(x - 1) / 2L;
		}
		System.out.println(total);
	}
}


Measured memory_bytes: 53612
/*g++ main.cpp -o main.out*/
/*./main.out*/

#include<bits/stdc++.h>
using namespace std;

#define LL long long
#define ll long long
#define LD long double
#define Mod 1000000007
#define L_Mod 17100000013

const double eps = 1e-9;
const int INF = 0x3f3f3f3f;
const double PI = 3.1415926535;

#define NO_TLE std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define ree(a,n) memset(a,n,sizeof(a));

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define red(i,l,u) for(int (i)=(int)(l);(i)>=(int)(u);--(i))

int main()
{
    LL n,m;
    cin>>n>>m;
    cout<<n*(n-1)/2+m*(m-1)/2<<endl;
    return 0;
}













Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
inline char nchar() {
	static const int bufl=1<<20;
	static char buf[bufl],*a=NULL,*b=NULL;
	return a==b && (b=(a=buf)+fread(buf,1,bufl,stdin),a==b)?EOF:*a++;
}
inline int read() {
	int x=0,f=1;
	char c=nchar();
	for (;!isdigit(c);c=nchar()) if (c=='-') f=-1;
	for (;isdigit(c);c=nchar()) x=x*10+c-'0';
	return x*f;
}
const int maxn=2e5+10;
int n,a[maxn];
int sta[maxn],top=0;
long long ans=0;
int main() {
	n=read();
	for (int i=1;i<=n;++i) {
		int x=a[i]=read(),j,r=x;
		for (j=top;j>0;--j) {
			if (r&a[sta[j]]) break;
			r^=a[sta[j]];
		}
		ans+=i-sta[j];
		if (x) sta[++top]=i;
	}
	printf("%lld\n",ans);
	return 0;
}


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

int main(){
  int N, K;
  cin >> N >> K;
  vector<int> data(N);
  for(int i = 0; i < N; i++){
    cin >> data.at(i);
  }
  sort(data.begin(), data.end());
  reverse(data.begin(), data.end());
  int sum = 0;
  for (int i = 0; i < K; i++){
    sum += data.at(i);
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
N=int(input())
li=list(map(int,input().split()))
ave1=sum(li)//N
ave2=sum(li)//N+1
ans1=0
ans2=0
for n in range(len(li)):
  ans1+=(li[n]-ave1)**2
  ans2+=(li[n]-ave2)**2
print(min(ans1,ans2))

Measured memory_bytes: 3064
"use strict";

const main = arg => {
    const inputList = arg.trim().split("\n");
    // 回答を記述
    const S = inputList[0];
    let count = 0;
    let SList = S.split('');
    if (SList[0] === 'R') {
        if (SList[1] === 'R') {
            if (SList[2] === 'R') {
                count = 3;
            } else {
                count = 2;
            }
        } else {
            count = 1;
        }
    } else {
        if (SList[1] === 'R') {
            if (SList[2] === 'R') {
                count = 2;
            } else {
                count = 1;
            }
        } else {
            if (SList[2] === 'R') {
                count = 1;
            }
        }
    }
    console.log(count)

}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);

    int k;
    cin >> k;
    int num = 7 % k;
    int cnt = 1;
    map<int, int> ja_foi;
    while(num != 0 && !ja_foi[num]) {
        ja_foi[num] = 1;
        num = (num * 10 + 7) % k;
        cnt++;
    }
    if(!num) {
        cout << cnt << "\n";
    } else {
        cout << "-1\n";
    }

    return 0;
}


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

#define REP(i,n) for(decltype(n) i=0; i<(n); ++i)
#define ALL(c) (c).begin(), (c).end()
#define st first
#define nd second
#define pb push_back

typedef pair<int,int> pii;
typedef vector<int> vi;

int n;
int V[100], T[100];
int dp[101][101];

int calc(int i, int v){
    if(v > V[i])
        return -1;
    if(v > T[i] && dp[i+1][v-T[i]] == -1)
        return -1;
    int vp = max(0, v-T[i]);
    int ve = min(V[i], v+T[i]);
    assert(dp[i+1][vp] != -1);
    while(vp < ve && dp[i+1][vp+1] != -1)
        ++vp;
    int x = T[i] + vp - v;
    int y = T[i] + vp + v;
    int area = x*(2*v+y) + (2*T[i]-x)*(2*vp+y);
    if(y <= 2*V[i])
        return dp[i+1][vp] + area;
    else {
        int d = y - 2*V[i];
        return dp[i+1][vp] + area - 2*d*d;
    }
}

void solve(){
    cin>>n;
    REP(i,n)
        cin>>T[i];
    REP(i,n)
        cin>>V[i];
    dp[n][0] = 0;
    fill(dp[n]+1, dp[n]+101, -1);
    for(int i=n-1;i>=0;--i)
        for(int v=0;v<=100;++v)
            dp[i][v] = calc(i,v);
    cout<<setprecision(9)<<fixed<<double(dp[0][0])/8<<'\n';
}

int main(){
#ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
    solve();
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getInts(N int) []int {
	ret := make([]int, N)
	for i := 0; i < N; i++ {
		ret[i] = getInt()
	}
	return ret
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)
	s := getString()
	ans := 0
	for i := 0; i < len(s); i++ {
		ans += int(s[i] - '0')
	}
	if ans%9 == 0 {
		out("Yes")
		return
	}
	out("No")
}


Measured memory_bytes: 2432
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;
 
int main(){
    ll d; cin >> d;
    if(d==25) puts("Christmas");
    else if(d==24) puts("Christmas Eve");
    else if(d==23) puts("Christmas Eve Eve");
    else puts("Christmas Eve Eve Eve");
}


Measured memory_bytes: 256
#define MOD_TYPE 1

#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
/*
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using Int = boost::multiprecision::cpp_int;
using lld = boost::multiprecision::cpp_dec_float_100;
*/
/*
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
*/
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
//constexpr ll MOD = 1;
constexpr int INF = (int)1e9 + 10;
constexpr ll LINF = (ll)4e18;
constexpr double PI = acos(-1.0);
constexpr double EPS = 1e-11;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define REPI(i, m, n) for (int i = m; i < (int)(n); ++i)
#define repi(i, n) REPI(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

inline void init_main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);
}
template <typename T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
inline ll CEIL(ll a, ll b)
{
  return (a + b - 1) / b;
}
template <typename A, size_t N, typename T>
inline void Fill(A (&array)[N], const T &val)
{
  fill((T *)array, (T *)(array + N), val);
}
template <typename T, typename U>
constexpr istream &operator>>(istream &is, pair<T, U> &p) noexcept
{
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename U>
constexpr ostream &operator<<(ostream &os, pair<T, U> &p) noexcept
{
  os << p.first << " " << p.second;
  return os;
}
#pragma endregion

void solve()
{
  int cnt = 0;
  int l, r, d;
  cin >> l >> r >> d;
  REP(i, l, r + 1)
  {
    if (i % d == 0)
      cnt++;
  }
  cout << cnt << "\n";
}

int main()
{
  init_main();
  solve();
}

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

int main(){
	int max1=0,max2=0,tmp,n,s;
	cin>>n;
	for(int i=1;i<=n;++i){
		cin>>tmp;
		if(tmp>max1){
			max2=max1;
			max1=tmp;
			s=i;
		}
		else if(max2<tmp)	max2=tmp;
	}
	for(int i=1;i<=n;++i){
		if(i==s)	cout<<max2<<endl;
		else		cout<<max1<<endl;
	}
} 

Measured memory_bytes: 1664
#include <iostream>

using namespace std;
int m, k;
int main()
{
    cin >> m >> k;

    if(((1 << m) <= k) || (m == 1 && k != 0) || (m == 0 && k != 0))
        cout << -1;
    else if(m == 1 && k == 0)
    {
        cout << "0 0 1 1";
    }
    else if(m == 0 && k == 0)
    {
        cout << "0 0";
    }
    else
    {
        int n = 1 << m;
        --n;

        for(int i = 0; i <= n; ++i)
        {
            if(i == k)
                continue;

            cout << i << ' ';
        }

        cout << k << ' ';

        for(int i = n; i >= 0; --i)
        {
            if(i == k)
                continue;

            cout << i << ' ';
        }

        cout << k;
    }

    return 0;
}


Measured memory_bytes: 1792
H, W = gets.split.map(&:to_i)
 
G = []
 
H.times do
  a = Array.new(W)
  line = gets.chomp.chars.push '#'
  i, j = 0, 0
  while i <= W
    if line[i] == '#'
      if j < i
        c = i - j
        k = j
        while k < i
          a[k] = c
          k += 1
        end
      end 
      i += 1
      j = i
    else
      i += 1
    end
  end
  G << a
end 
G << Array.new(W)
 
ans = 0
G.transpose.each do |ar|
  i, j = 0, 0
  local_max = 0
  while i <= H
    v = ar[i]
    if v.nil?
      if j < i
        local_max += (i - j)
        ans = local_max if ans < local_max
        local_max = 0
      end 
      i += 1
      j = i
    else
      local_max = v if local_max < v  
      i += 1
    end 
  end 
end
puts ans - 1

Measured memory_bytes: 74560
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b) - 1; (i) >= (a); --(i)) //Reversi for
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main()
{
    int n;
    string s,t;
    cin >> n >> s >> t;
    rep(i, n){
        rep(j, n - i){
            if (s[i + j] != t[j]) {
                goto loopend;
            }
        }
        cout << n * 2 - (n - i)  << endl;
        return 0;
    loopend:;
    }
    cout << n * 2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

typedef long long LL;
const int MN = 100005;

int N, A[MN], B[MN];
int Apos[MN], Bpos[MN];
LL Ans, Sum;

struct dat {
	int val, pos, typ;
	dat() {}
	dat(int v, int p, int t)
		: val(v), pos(p), typ(t) {}
	inline friend bool operator < (dat i, dat j) {
		return i.val < j.val;
	}
} D[MN * 2];
int C;

int main() {
	Ans = 0x3f3f3f3f3f3f3f3f;
	scanf("%d", &N);
	for (int i = 1; i <= N; ++i) scanf("%d%d", &A[i], &B[i]);
	for (int i = 1; i <= N; ++i) Sum += A[i];
	Ans = std::min(Ans, Sum), Sum = 0;
	for (int i = 1; i <= N; ++i) Sum += B[i];
	Ans = std::min(Ans, Sum), Sum = 0;
	for (int i = 1; i <= N; ++i)
		D[++C] = dat(A[i], i, 1),
		D[++C] = dat(B[i], i, 0);
	std::sort(D + 1, D + C + 1);
	for (int i = 1; i <= 2 * N; ++i) {
		if (D[i].typ) Apos[D[i].pos] = i;
		else Bpos[D[i].pos] = i;
	}
	for (int i = 1; i <= N; ++i) Sum += D[i].val;
	int ok = 0;
	for (int i = 1; i <= N; ++i)
		if (Apos[i] <= N && Bpos[i] <= N)
			{ ok = 1; break; }
	if (ok) return printf("%lld\n", Sum), 0;
	for (int i = 1; i <= N; ++i) {
		int pos1 = Apos[i], pos2 = Bpos[i];
		if (pos1 > pos2) std::swap(pos1, pos2);
		if (pos1 == N) Ans = std::min(Ans, Sum - D[N - 1].val + D[pos2].val);
		else Ans = std::min(Ans, Sum - D[N].val + D[pos2].val);
	}
	printf("%lld\n", Ans);
	return 0;
}

Measured memory_bytes: 4096
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF (1e9+1)
//#define INF (1LL<<59)



//0-index ?????????????????¶?????°?????????(????????????) verified AOJ DSL_2_G, CODEFESTIVAL2015-D
template<class T>
class segtree{
private:
	vector<T> dat;
	vector<T> lazy;
	int _size;  //the number of leaves
	T _init;
	
public:
	segtree(int __size=0 , T init=numeric_limits<T>::max() ):_size(__size), _init(init), dat(4*__size,init), lazy(4*__size,init){
		if(__size==0)return ;
		int x=1;
		while(x<_size)x*=2;
		_size = x;
	}
	
	
	void update(int s,int t, T x ,int num=1,int a=0,int b=-1){
		if(b==-1)b=_size; //I couldn't "int b=_size".
		if(b<=s||t<=a)return ;
		if(s<=a&&b<=t){
			lazy[num]+=x;	//addition
			
			//dat[num] += x;			//minimum	isn't verified
			//dat[num] += x;			//maximum
			dat[num] += x*(b-a);	//sum
			return ;
		}
		update(s,t,x,num*2+0,a,(a+b)/2);
		update(s,t,x,num*2+1,(a+b)/2,b);
		//dat[num] = lazy[num]+min(dat[num*2],dat[num*2+1]);	//minimum	isn't verified
		//dat[num] = lazy[num]+max(dat[num*2],dat[num*2+1]);	//maximum
		dat[num] = dat[num*2]+dat[num*2+1]+lazy[num]*(b-a);	//sum
	}
	
	
	// call find[s,t)
	T find(int s,int t,int num=1,int a=0,int b=-1){
		if(b==-1)b=_size; //I couldn't "int b=_size".
		if(b<=s||t<=a)return _init;
		if(s<=a&&b<=t)return dat[num];
		T l = find(s,t,num*2,a,(a+b)/2);
		T r = find(s,t,num*2+1,(a+b)/2,b);
		//return lazy[num]+min(l,r);					//minimum	isn't verified
		//return lazy[num]+max(l,r);					//maximum
		return l+r+lazy[num]*(min(b,t)-max(a,s));	//sum
	}
	
	int size(){return _size;}
};



int main(){
	int n,q;
	cin>>n>>q;
	segtree<ll> st(n,0);
	
	rep(i,q){
		int p;
		cin>>p;
		if(!p){
			int s,t,x;
			cin>>s>>t>>x;
			s--,t--;
			st.update(s,t+1,x);
			//          rep(i,n)cout<<st.find(i,i)<<" ";cout<<endl;
		}else{
			int s,t;
			cin>>s>>t;
			s--,t--;
			cout<<st.find(s,t+1)<<endl;
		}
	}
}

Measured memory_bytes: 9168
s=list(input())
t=list(input())

from collections import defaultdict
ds=defaultdict(list)
dt=defaultdict(list)

for i in range(len(s)):
    if t[i] not in ds[s[i]]:
        ds[s[i]].append(t[i])
    if s[i] not in dt[t[i]]:
        dt[t[i]].append(s[i])

for k in ds.keys():
    if len(ds[k])>1:
        print('No')
        exit()
for k in dt.keys():
    if len(dt[k])>1:
        print('No')
        exit()
print('Yes')

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

void editorial(){
  int N;
  cin>>N;
  int ans = 0;
  for(int i=1;i<=N;i++){
    int l = to_string(i).size();
    if(l%2==1)ans++;
  }
  cout<<ans<<endl;
}

int main(){editorial();}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int n ,tmp ,allay[10] ,total[2];
  for( int i=0 ; i<2 ; i++ ){
    
    for( int j=0 ; j<10 ; j++ ){
      cin >> allay[j];
    }
    
    for( int j=0 ; j<10 ; j++ ){
      for( int k=9 ; k>j ; k-- ){
	if( allay[k] > allay[k-1] ){
	  tmp = allay[k-1];
	  allay[k-1] = allay[k];
	  allay[k] = tmp;
	}
      }
    }
    
    total[i] = allay[0] + allay[1] + allay[2];
  }
  
  cout << total[0] << " " << total[1] << endl;
}
  

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

// 安直にやるとO(n^3)になってしまう
// a + b = Kの倍数
// b + c = Kの倍数
// c + a = Kの倍数
// 制限があるので、それを考える
//  * 線形性を考えると、a % k = 0 ならばb % k = 0 で c % k = 0である。
//      * つまり、a % k == 0 ならば、
//      * わかんね〜
//      * 実例でやってみると
//          * a = 3 で K = 4 ならば a % 4 = 3 なので b は b % K == 1(例えば5とか) だったら8なので割り切れる。5ならば、c % k = 3 にすると割り切れる。
//          * a = i であまりがでるとき、あまりを相殺するようなあまりがでるbを選べばいい
//          * 3変数にすると...
//          * a % k = i を相殺するために b  % k = k - i - 1 であり、b + cを考えると、 bのあまりを相殺しないといけないので c % k = i である必要がある。
//          * しかし、それはa % k == iに対して a + c がKの倍数であることを満たさなくなる。つまり、いい数字でなければならない。
//      * a % k == k/2ならば、絶対に割り切れる。a + bも a + c もあまりを相殺できる。
//          * これ、Kが偶数でないと無理だ！
//          * a % k == k/2であるならばbたちは一意にきまるので、a % k == k/2の数だけ、a,b,cも取れる。
//      * a % k == 0 ならば、絶対に割り切れる。
//          * a % k == 0, b % k == 0, c % k == 0のなる個数
//  * a,b,cは入れ替えられるので、３乗をあとからすればいい

int main() {
    int n,k;cin >> n >> k;
    ll countZero = 0;
    ll countHalf = 0;

    for (int i=1;i<=n;i++){
        if (i%k == 0) {
            countZero++;
        } else if (k % 2 == 0) {
            if (i%k == k/2){
                countHalf++;
            }
        }
    }

    cout << countZero*countZero*countZero +  countHalf*countHalf*countHalf << endl;
    return 0;
}



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

#define MOD 1000000007
#define ll long long int
#define vi vector<int>
#define vii vector< vector<int> >
#define PI 3.1415926535897932384626433832795
#define INF 9223372036854775807LL

bool op[105][11];
int profit[105][11];

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++) {
		for(int d = 1; d <= 10; d++) {
			int x;
			cin >> x;
			op[i][d] = (x == 1);
		}
	}
	for(int i = 1; i <= n; i++) {
		for(int d = 0; d <= 10; d++) {
			cin >> profit[i][d];
		}
	}
	ll ans = -INF;
	for(int open = 1; open < 1024; open++) {
		ll sum = 0;
		for(int j = 1; j <= n; j++) {
			int cn = 0;
			for(int i = 1; i <= 10; i++) {
				if((open&(1<<(i-1))) > 0) {
					if((op[j][i])) {
						cn++;
					}
				}
			}
			sum+= profit[j][cn];
		}
		ans = max(ans,sum);
	}
	cout << ans;
	return 0;
}



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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define repp(i, n) rep(i, n)
#define reppp(i, n) repp(i, n)
#define rrepp(i, n) rrep(i, n)
#define repss(i, n) reps(i, n)
#define repcc(i, n) repc(i, n)
#define repii(i, a, b) repi(i, a, b)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  vf80 v;
  f80 x;
  while (cin >> x) v.push_back(x);
  sort(all(v));
  cout << v[v.size() - 1] - v[0] << '\n';
}



Measured memory_bytes: 3196
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
      return Array.new(size1){init}
  else
      return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

N=gets.to_i
def division(x)
    ret=[]
    1.upto((N**0.5).to_i+1) do|i|
        if (x%i).zero?
            ret<< i
        end
    end
    return ret
end
ans=0
division(N).each do|v|
  m=N/v-1
  next unless m.nonzero? and N/m==N%m
  ans+=m
end
puts ans

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

using namespace std;

#define all(x) x.begin(), x.end()
typedef vector <int> vi;
typedef pair<int,int> ii;
typedef long long ll;

const int mod = 1e9 + 7;
const ll inf = 3e18 + 5;

int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }

ll sz[100500];
int parent[100500];

void make_set(int x){
	parent[x] = x;
	sz[x] = 1;
}

int find_set(int x){
	return (x == parent[x] ? x : parent[x] = find_set(parent[x]));
}

ll connect(int x, int y){
	x = find_set(x);
	y = find_set(y);
	if(x != y){
		if(sz[y] > sz[x]) swap(x, y);
		ll p = sz[y], d = sz[x];
		parent[y] = x;
		sz[x] += sz[y];
		return p * d;
	}
	return 0;
}

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


	int n, m;
	cin >> n >> m;
	vector <ii> E;
	for(int i = 1; i <= n; i++) make_set(i);
	for(int i = 0; i < m; i++){
		int a, b;
		cin >> a >> b;
		E.emplace_back(a, b);
	}
	reverse(all(E));
	ll res = 1LL * n * (n - 1) / 2;
	vector <ll> rez;
	rez.push_back(res);
	for(auto cur : E){
		ll ret = connect(cur.first, cur.second);
		res -= ret;
		rez.push_back(res);
	}
	rez.pop_back();
	reverse(all(rez));
	for(auto x : rez){
		cout << x << "\n";
	}
}

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

int main(){
    int n,m;
    cin >> n >> m;
    ll time = 1900*m+100*(n-m);
    ll s = pow(2,m);
    cout << time*s << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

class Main {

	static class Comb implements Comparable<Comb> {
		private int[] array;
		private int dec; //十進数

		//コンストラクタ
		public Comb(int[] a) {
			array = new int[a.length];
			for (int i = 0; i < array.length; i++) {
				array[i] = a[i];
				dec += Math.pow(2, array[i]); //十進数にする
			}
		}

		public int[] getArray() { return array; }

		public int getDec() {
			return dec;
		}

		@Override
		public int compareTo(Comb c) { //比較の標準を作る
			return this.dec - c.getDec();
		}
	}

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			//入力と配列準備
			sc.nextInt();
			int tLen = sc.nextInt();
			ArrayList<Integer> list = new ArrayList<Integer>();
			for (int i = 0; i < tLen; i++) {
				list.add(sc.nextInt());
			}
			System.out.println("0:");
			//--------------------------------------------------------
			ArrayList<Comb> arrayC = new ArrayList<Comb>();
			ArrayList<int[]> array = combination(tLen - 1);
			for (int[] arrayi : array) {
				int[] arrayNum = new int[arrayi.length];
				for (int i=0; i<arrayi.length; i++) arrayNum[i]=list.get(arrayi[i]);
				arrayC.add(new Comb(arrayNum));
			}
			Collections.sort(arrayC);
			for (Comb c : arrayC) {
				System.out.print(c.getDec() + ":");
				for (int i : c.getArray()) {
					System.out.print(" " + i);
				}
				System.out.print('\n');
			}
		}
	}

	static ArrayList<int[]> combination(int numbers) {
		ArrayList<int[]> a = new ArrayList<int[]>();
		for (int i = 1; i <= numbers + 1; i++) 	a.addAll(nCr(numbers, i));
		return a;
	}

	//組み合わせを配列に保存
		static ArrayList<int[]> nCr(int numbers, int target){  //保存用list、0～numbersから選べる、何個取る
			ArrayList<int[]> list = new ArrayList<int[]>();
			int[] keep = new int[target];
			int[] finalt = new int[target];
			for (int i=0; i<target; i++) {
				keep[i] = 0 + i;  //最初の組み合わせを作成
				finalt[i] = numbers + (i - target) + 1;  //最後の組み合わせを作成
			}
			int[] k = new int[target];
			System.arraycopy(keep,0,k,0,target);
			list.add(k);
			while (!Arrays.equals(keep, finalt)) { //最後の組み合わせではない場合
				if (keep[target-1] != numbers) {  //最後の桁がnumbersではない場合
					keep[target-1]++;
					k = new int[target];
					System.arraycopy(keep,0,k,0,target);
					list.add(k);
				} else {
					int now = target-2;
					while (now > 0) {
						if (keep[now+1] - keep[now] == 1) now--; //右の桁-1はnowの最大値
						else break;
					}
					keep[now]++;
					for (int i=now+1; i<target; i++) {
						keep[i] = keep[i-1]+1;
					}
					k = new int[target];
					System.arraycopy(keep,0,k,0,target);
					list.add(k);
				}
			}
			return list;
		}
}


Measured memory_bytes: 204684
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;

const long long MOD = 1000000007LL;
const long long INF = 1e18;

int GCD(int a, int b){return b == 0 ? a : GCD(b, a % b);}
long long fast_exp(long long base, long long exp, long long mod = MOD) {
    long long tot = 1;
    for(;exp > 0;exp >>= 1) {
       if((exp & 1) == 1) tot = tot * base % mod;
       base = base * base % mod;
    }
    return tot;
}
long long slow_mult(long long base, long long exp, long long mod = MOD) {
    long long tot = 0;
    for(;exp > 0;exp >>= 1){
       if((exp & 1) == 1) tot = (tot + base) % mod;
       base = base * 2 % mod;
    }
    return tot;
}

struct chash {
    static uint64_t splitmix64(uint64_t x) {x += 0x8e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf54876d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb; return x ^ (x >> 31);}
    size_t operator()(uint64_t x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x + FIXED_RANDOM);}
    size_t operator()(pair<uint64_t,uint64_t> x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x.first + FIXED_RANDOM)^(splitmix64(x.second + FIXED_RANDOM) >> 1);}
};

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

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

    cout << max(0, c - (a - b));

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <queue>
#include <list>
#include <stack>
#include <math.h>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

#define ll long long
#define ull unsigned long long

#define	max	1000000007

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

class mod
{
public:
	ll val;

	mod(ll v)
	{
		val = v % max;
	}

	mod()
	{
		val = 0;
	}

	void operator -=(const mod &v)
	{
		val -= v.val;

		if (val < 0)
			val += max;
	}

	void operator +=(const mod &v)
	{
		if (val + v.val >= max)
			val -= max;
		val += v.val;
	}

	void operator +=(ll &v)
	{
		if (val + v >= max)
			val -= max;
		val += v;
	}

	void operator *=(const mod &v)
	{
		val *= v.val;
		val %= max;
	}

	void operator *=(ll &v)
	{
		val *= v;
		val %= max;
	}

	ll modinv(ll a)
	{
		ll b = max, u = 1, v = 0;
		while (b)
		{
			ll t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		u %= max;
		if (u < 0)
			u += max;
		return u;
	}

	void operator /=(const mod &v)
	{
		val *= modinv(v.val);
		val %= max;
	}

	void operator /=(ll &v)
	{
		val *= modinv(v);
		val %= max;
	}
};

int main()
{
	ull x;
	cin >> x;
	vector<ull> p(1001);
	p[0] = 0;
	for (ull i = 1; i <= 1000; i++)
		p[i] = i * i * i * i * i;

	for (int i = 0; i <= 1000; i++)
	{
		for (int j = 0; j <= 1000; j++)
			if (p[i] + p[j] == x)
			{
				printf("%d %d", i, j * -1);
				return 0;
			}
			else if (p[i] - p[j] == x)
			{
				printf("%d %d", i, j);
				return 0;
			}
	}
	return 0;
}

Measured memory_bytes: 3180
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
      int a, b, c, x, y, maxpizza, ans;
      cin >> a >> b >> c >> x >> y;
      int max1 = max(x, y);
      int min1 = min(x, y);
      if (max1 == x) maxpizza = a;
      else maxpizza = b;
      
      if (2 * c <= a + b && (max1 - min1) * maxpizza <= 2 * c * (max1 - min1)) ans = 2 * c * min1 + (max1 - min1) * maxpizza;
      else if (2 * c <= a + b && (max1 - min1) * maxpizza > 2 * c * (max1 - min1)) ans = 2 * c * max1;
      else ans = a * x + b * y;
      cout << ans << endl;
    }

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <fstream>
 
using namespace std;
 
int main(void){
    float a,b,n,mx,i,temp;
    cin>>a>>b>>n;
    mx=floor(a*1/b)-a*floor(1/b);
    for(i=1;i<=b;i+=floor(b/a)){
        if(i>n)break;
        temp=floor(a*i/b)-a*floor(i/b);
        if(mx<=temp){
            mx=temp;
        }else{
            break;
        }
        if(b/a<1){
            i++;
        }
    }
    cout<<(long long)mx<<endl;
    return 0;
}

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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int std_in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};
const int MOD = 1000000007;

signed main(){
    ll N, ans = 0;
    cin >> N;
    for(ll i = 2; i * i <= N; i++){
        ll n = N;
        while(n % i == 0) n /= i;
        if(n < N && n % i == 1) ans++;
    }
    ans++;
    for(ll i = 2; i * i <= N - 1; i++){
        if((N - 1) % i == 0){
            if(i * i == N - 1) ans++;
            else ans += 2;
        }
    }
    if(N > 2) ans++;
    PRINT(ans);
    return 0;
}

Measured memory_bytes: 256
import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    s = input()
    t = input()
    for i in range(len(s)):
        if s[i] == t[i]:
            pass
        else:
            print("No")
            exit()
    print("Yes")

Measured memory_bytes: 9156
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
class Program
{
    static void Main()
    {
        //入力
        //int[] input = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();
        //string input= Console.ReadLine();
        int input =int.Parse(Console.ReadLine());
        string st = input.ToString();
        Console.WriteLine(st[0]==st[2]?"Yes":"No");


        /*
        //処理速度計測
        var sw = new System.Diagnostics.Stopwatch();
        sw.Start();
        //解法
 
        //処理速度表示
        sw.Stop();
        TimeSpan ts = sw.Elapsed;
        Console.WriteLine((int)(Math.Floor((ts).TotalMilliseconds))+"ms");
        */
        Console.ReadLine();

    }
}

Measured memory_bytes: 13140
package main

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

var bw = bufio.NewWriter(os.Stdout)

func isOdd(n int) bool { return n%2 != 0 }

func printf(format string, a ...interface{}) { fmt.Fprintf(bw, format, a...) }

func main() {
	defer bw.Flush()
	var s string
	fmt.Scan(&s)
	n := len(s)
	ans := make([]int, n)
	ctR := 0
	for i := 0; i < n; i++ {
		if s[i] == 'R' {
			ctR++
		} else {
			ans[i-1] += (ctR + 1) / 2
			ans[i] += ctR / 2
			ctR = 0
		}
	}
	ctL := 0
	for i := n - 1; i >= 0; i-- {
		if s[i] == 'L' {
			ctL++
		} else {
			ans[i] += ctL / 2
			ans[i+1] += (ctL + 1) / 2
			ctL = 0
		}
	}
	for _, v := range ans {
		printf("%v\n", v)
	}
}


Measured memory_bytes: 3200
import java.util.Arrays;
import java.util.Scanner;

class Main {

	@SuppressWarnings("unchecked")
	public void run() {
		Scanner sc = new Scanner(System.in);
		int[] p = new int[100];
		long[][][] f = new long[100 + 1][100 * 500 + 1][2];
		while (true) {
			int n = sc.nextInt();
			if (n == 0)
				break;
			for (int i = 0; i < n; ++i) {
				p[i] = sc.nextInt();
			}
			for (int i = 0; i < f.length; ++i) {
				for (int j = 0; j < f[i].length; ++j) {
					f[i][j][0] = -Integer.MAX_VALUE / 3;//500yen硬貨の枚数
					f[i][j][1] = Integer.MAX_VALUE / 3;//支払い金額
				}
			}
			f[0][0][0] = 0;
			f[0][0][1] = 0;
			for (int i = 0; i < n; ++i) {
				for (int j = 0; j < 500 * n + 1; ++j) {
					f[i + 1][j][0] = f[i][j][0];
					f[i + 1][j][1] = f[i][j][1];
				}
				for (int j = 0; j < 500 * n + 1; ++j) {
					if (f[i][j][0] < 0)
						continue;
					if (1 <= p[i] % 1000 && p[i] % 1000 <= 500) {
						int coin = (1000 - p[i] % 1000) % 500;
						f[i + 1][j + coin] = choice(f[i + 1][j + coin],
								new long[] { f[i][j][0] + 1, p[i] + f[i][j][1] });
					} else {
						int coin = (1000 - p[i] % 1000) % 500;
						f[i + 1][j + coin] = choice(f[i + 1][j + coin], new long[] { f[i][j][0], p[i] + f[i][j][1] });
						int need = (p[i] + 500) % 1000;
						if (need == 0)
							need = 500;
						if (need <= j) {
							f[i + 1][j - need] = choice(f[i + 1][j - need],
									new long[] { f[i][j][0] + 1, p[i] + f[i][j][1] });
						}
					}
				}
			}

			long[] ans = new long[] { 0, 0 };
			for (int i = 0; i < f[n].length; ++i) {
				ans = choice(ans, f[n][i]);
			}
			System.out.println(ans[0] + " " + ans[1]);
		}

	}

	long[] choice(long[] a, long[] b) {
		if (a[0] != b[0]) {
			if (a[0] > b[0]) {
				return a;
			} else {
				return b;
			}
		} else {
			if (a[1] < b[1]) {
				return a;
			} else {
				return b;
			}
		}
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

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



Measured memory_bytes: 484120