akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

// #include <iostream>
// #include <fstream>
// #include <string>
// #include <map>
// #include <vector>
// #include <algorithm>
// #include <regex>
// #include <chrono>
// #include <sstream>
// #include <iomanip>
// #include <queue>
// #include <stack>
// #include <set>
// #include <unordered_map>
// #include <unordered_set>


using namespace std;
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define int long long
struct IoSetup {
    IoSetup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
        cerr << fixed << setprecision(10);
    }
}IoSetup;

typedef long long ll;
typedef pair < int , int >  pii;
typedef vector<int> vec;
typedef vector< vec > Mat;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 998244353;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>bool chmax(T &a, const T&b){if(a<b)return(a=b,1);return 0;}
template<class T>bool chmin(T &a, const T&b){if(b<a)return(a=b,1);return 0;}

int n, m;
vector<pii> edge[1010];
Mat tour, retour;
vector<bool> node, renode;
int a[3010], b[3010], c[3010];

void dfs(int p, Mat& mat, vector<bool>& lis) {
	for(int i = 0; i < mat[p].size(); i++) {
		int v = mat[p][i];
		if(lis[v]) continue;

		lis[v] = true;
		dfs(v, mat, lis);
	}
}


signed main() {

	cin >> n >> m;

	for(int i = 0; i < m; i++) {

		cin >> a[i] >> b[i] >> c[i];
		c[i] = -c[i];
	}

	vec dist(n+1,LINF);	
	dist[1] = 0;
	for(int j = 0; j < n-1; j++) {
		for(int i = 0; i < m; i++) {

			if(dist[a[i]] == LINF) continue;
			chmin(dist[b[i]], dist[a[i]] + c[i]);
		}
	}

	ll ans = dist[n];

	vector<bool> neg(n+1, false);

	for(int j = 0; j < n; j++) {
		for(int i = 0; i < m; i++) {

			if(dist[a[i]] == LINF) continue;
			if(chmin(dist[b[i]], dist[a[i]] + c[i]))
				neg[b[i]] = true;
			
			if(neg[a[i]])
				neg[b[i]] = true;
		}
	}

	if(neg[n]) cout << "inf\n";
	else cout << -ans << endl;
			   

    return 0;
}



Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
int min(int a,int b){
    return a<b?a:b;
}
int main(void){
    int A,B,C;
    cin >> A >> B >> C;
    int count = 0;
    if(A == B)count++;
    if(A == C)count++;
    if(B == C)count++;
    
    if(count == 1){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
}


Measured memory_bytes: 3044
#include<bits/stdc++.h>
using namespace std;
#define maxn 100005
char a[maxn];
bool vis[maxn];
int main(){
	int n,k,r,s,p,ans=0;scanf("%d%d%d%d%d%s",&n,&k,&r,&s,&p,a);
	for(int i=0;i<n;i++){
		if(i>=k&&vis[i-k]&&a[i]==a[i-k])continue;
		vis[i]=1;ans+=a[i]=='r'?p:(a[i]=='s'?r:s);
	}
	printf("%d",ans);
	return 0;
}

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

using namespace std;

#define ll long long

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

	ll diff = abs(1 - N);
	ll x = 1;
	ll y = N;
	for (int i = 1; i <= N / i; i++) {
		int mod = N % i;
		if (mod == 0 && abs(N / i - i) < diff) {
			diff = abs(N / i - i);
			x = i;
			y = N / i;
		}
	}

	ll xDiff = max((ll) 0, x - 1);
	ll yDiff = max((ll) 0, y - 1);
	cout << xDiff + yDiff << endl;

	return 0;
}


Measured memory_bytes: 256
/**
*    created: 07.07.2020 14:43:42
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b) {if (b < a) {a = b; return 1;} return 0;}
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1LL << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;

int a[MAX];
int t = 0;

int check (int n, int i) {
    t++;
    if (t == n+1) return -1;
    else if (a[i] == 2) return t;
    else return check(n, a[i]);
}

signed main() {

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

    int n; cin >> n;
    rep(i,n) cin >> a[i+1];
    cout << check(n,1) << endl;
    return 0;
}

Measured memory_bytes: 4436
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define rep(i,n) for(int i=0;i<n;i++)

int main() {
	ll N,C,K;
  	cin>>N>>C>>K;
  	ll A[N];
  	rep(i,N) cin>>A[i];
  	sort(A,A+N);
  	ll count=0;
    ll pass=0;
  	ll i=0;
  	while(i<N){
      	pass=0;
        count++;
		rep(j,C){
          	if(i+j>=N) break;
         	if(A[i]+K>=A[i+j]) pass++;
        }
      	i+=pass;
    }
  	
  	cout<<count<<endl;
}

Measured memory_bytes: 4312
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {

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

	private void solve() throws IOException {
		try {
			//			solveA();
			solveB();
			// solveC();
			// solveD();
			// solveE();
			// solveF();
		} finally {
			if (in != null) {
				in.close();
			}
			if (out != null) {
				out.flush();
				out.close();
			}
		}

	}

	private void solveA() {
		int numN = nextInt();
		if (numN < 1200) {
			out.print("ABC");
		} else {
			out.print("ARC");
		}

	}

	private void solveB() {
		String wk = next();

		int first = wk.indexOf("A");
		int last = wk.lastIndexOf("Z");

		String res = wk.substring(first, last + 1);

		out.println(res.length());
	}

	private void solveC() {
		int numN = nextInt();

		out.println("");
	}

	private void solveD() {
		int numN = nextInt();

		out.println("");
	}

	private void solveE() {
		int numN = nextInt();

		out.println("");
	}

	private void solveF() {
		int numN = nextInt();

		out.println("");
	}

	private final PrintWriter out = new PrintWriter(System.out);
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
}

Measured memory_bytes: 23764
for _ in range(int(input())):
    n, a = int(input()), list(map(int, input().split()))
    d = [0, 0]
    for i in range(1, n):d = [max(a[i] - a[i - 1], d[0]), max(a[i - 1] - a[i], d[1])]
    print(*d)


Measured memory_bytes: 5616
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
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; }
inline void init() { cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }

struct edge {
    int from, to; ll cost;
    edge(int s, int t, ll w = 0) : from(s), to(t), cost(w) {}
};

int main() {
    init();

    int v, e;
    cin >> v >> e;
    vector<vector<edge>> g(v);
    VI in(v, 0);
    int s, t;
    FOR(i, 0, e) {
        cin >> s >> t;
        g[s].push_back({ s,t });
        in[t]++;
    }

    queue<int> n;
    FOR(i, 0, v)if (in[i] == 0)n.push(i);

    VI ans;
    while (!n.empty()) {
        int now = n.front(); n.pop();
        ans.push_back(now);
        for (edge next : g[now]) {
            in[next.to]--;
            if (in[next.to] == 0)n.push(next.to);
        }
    }

    FOR(i, 0, v)cout << ans[i] << "\n";
}



Measured memory_bytes: 4420
n = int(input())
a = list(map(int, input().split()))
m4 = 0
m2 = 0
for i in range(len(a)):
    if (a[i] % 4 == 0):
        m4 += 1
    elif (a[i] % 2 == 0):
        m2 += 1

if (m4*2+m2 >= len(a) or m4*2+1 >= len(a)):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main(){
  long int a, b;
  cin >> a >> b;
  if(a-b<=0)cout<< 0 <<endl;
    else{cout<< a-b <<endl;}
 
  return 0;
}

Measured memory_bytes: 256
def main():
  s = ''.join(reversed(input()))
  multiplier = 1
  divisor = 10 ** 9 + 7
  list10 = list(range(10))
  list13 = list(range(13))
  p = [0 for i in list13]
  np = [0 for i in list13]
  rt = [i % 13 for i in range(100)]
  if s[0] != '?':
    p[int(s[0])] = 1
  else:
    for j in range(10):
      p[j] = 1
  for i in range(1, len(s)):
    multiplier = (10 * multiplier) % 13
    if s[i] != '?':
      r = int(s[i]) * multiplier
      for j in list13:
        np[(j + r) % 13] = p[j]
    else:
      for j in range(10):
        r = multiplier * j % 13
        for k in list13:
          np[rt[k + r]] += p[k]
    for j in list13:
      p[j] = np[j] % divisor
      np[j] = 0
  print(p[5] % divisor)
main()

Measured memory_bytes: 4084
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bits/stdc++.h>
#include<queue>
#include <numeric>
#include<stdio.h>
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define fore(i,a) for(auto &i:a)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 

LL gcd(LL a, LL b){
    if(b == 0) return a;
    return gcd(b,a%b);
}

LL lcm(LL a, LL b){
    LL g = gcd(a,b);
    return a/g *b;
}

int main(){
    int A[3];
    REP(i,3) cin >> A[i];
    sort(A,A+3);
    int num=A[0]+A[1];
    cout << num;
    }

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();
        int K = sc.nextInt();
        int R = sc.nextInt();
        int S = sc.nextInt();
        int P = sc.nextInt();
        String T = sc.next();
        char[] cr = T.toCharArray();
        long score = 0l;
        for (char c : cr) {
            if (c == 'r') {
                score += P;
            } else if (c == 's') {
                score += R;
            } else if (c == 'p') {
                score += S;
            }
        }
        char tmp = 0;
        for (int i = K; i < N; i++) {
            char c = cr[i];
            tmp = cr[i-K];
            if (c == tmp) {
                if (c == 'r') {
                    score -= P;
                } else if (c == 's') {
                    score -= R;
                } else if (c == 'p') {
                    score -= S;
                }
                cr[i] = 0;
            }
        }
        System.out.println(score);
    }
}

Measured memory_bytes: 39808
#include <iostream>
#include <string.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <functional>
#include <cassert>
#include <utility>
#include <stack>
#include <queue>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef pair<int,int> Pi;
typedef long long int ll;
const int INF=(1<<30)-1;
const ll INFl=9223372036854775807;
const int MAX=10000;
const ll MOD=1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}


ll n,a,b,c,d,e;
ll ans;

ll mini(ll a,ll b,ll c,ll d,ll e){
	ll t=min(a,b);
	ll s=min(c,d);
	t=min(t,s);
	t=min(t,e);
	return t;
}
int main(){
	cin>>n>>a>>b>>c>>d>>e;
	ll ans=mini(a,b,c,d,e);
	ans=(n-1)/ans+5;
	cout<<ans<<endl;
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> h(n);
    for (int i=0;i<n;i++) {
        cin >> h[i];
    }
    int ans = 1;
    for (int i=1;i<n;i++){
        bool flag = true;
        for (int j=0;j<i;j++){
            if (h[j] > h[i]) {
                flag = false;
                break;
            }
        }
        if (flag)
            ans += 1;
    }
    cout << ans << endl;
}



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

char ch;
template <typename T>
void read(T& x)
{
    x = 0;
    ch = getchar();
    for (; !isdigit(ch); ch = getchar());
    for (; isdigit(ch); x = x * 10 + (ch ^ 48), ch = getchar());
}
double n, m;

int main()
{
    read(n), read(m);
    printf("%.10f\n", n / m);
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
using namespace std;
typedef long long ll;
ll ans, n;
string s;
char ch;
int len, cnt1, cnt2, cnt;
int main() {
	cin >> s;
	len = s.length();
	scanf("%lld", &n);
	if(len == 1)
		return ! printf("%lld\n", n / 2);
	ch = s[0];
	cnt1 = 1;
	for(int i = 1; i < len; i ++)
		if(ch == s[i])
			cnt1 ++;
		else
			break;
	ch = s[len - 1];
	cnt2 = 1;
	for(int i = len - 2; i >= 0; i --)
		if(ch == s[i])
			cnt2 ++;
		else
			break;
	if(cnt1 + cnt2 <= len && s[0] == s[len - 1]) {
		//cout << cnt1 << " " << cnt2 << endl;
		ch = s[cnt1];
		cnt = 1;
		for(int i = cnt1 + 1; i < len - cnt2; i ++)
			if(s[i] == ch)
				cnt ++;
			else {
				ans += cnt / 2;
				cnt = 1;
				ch = s[i];
			}
		ans += cnt / 2;
		//cout << ans << endl;
		printf("%lld\n", cnt1 / 2 + ans * n + cnt2 / 2 + 1ll * (cnt1 + cnt2) / 2 * (n - 1)); 
		return 0;
	}
	else if(cnt1 + cnt2 > len && s[0] == s[len - 1]) {
		printf("%lld\n", n * len / 2);
		return 0;
	}
	else {
		ch = s[0];
		cnt = 1;
		for(int i = 1; i < len; i ++)
			if(s[i] == ch)
				cnt ++;
			else {
				ans += cnt / 2;
				cnt = 1;
				ch = s[i];
			}
		ans += cnt / 2;
	}
	printf("%lld\n", ans * n);
	return 0;
}
/*
aabcaaa
2

*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define eps 1e-3
#define pi acos(-1.0)
#define inf 0x3f
#define INF 0x3f3f3f3f
#define pb push_back
#define debug1 cout<<"&&";
#define debug2 cout<<"**";
#define ms(a, x) memset(a, x, sizeof(a))
#define for0(i, n) for(int i = 0; i < n; ++i)
#define for1(i, n) for(int i = 1; i <= n; ++i)
using namespace std;
typedef double db;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, int> pli;
typedef pair<long long, long long> pll;
const int mod = 1e9 + 7;
const int N = 2e5+10;
const int M = 1e6+10;
/*=================================================================================*/

int n, m;
ll sum[N<<2], tag[N<<2];
struct node {
   int l, r, a;
}b[N];

bool cmp(node x, node y) {
   return x.r < y.r;
}

void add(int rt, int L, int R, int x, int y, ll val) {
   if(x <= L && y >= R) {
      sum[rt] += val, tag[rt] += val;
      return;
   }
   int mid = (L + R) >> 1;
   if(x <= mid) add(rt<<1, L, mid, x, y, val);
   if(y > mid) add(rt << 1 | 1, mid+1, R, x, y, val);
   sum[rt] = max(sum[rt<<1], sum[rt<<1|1]) + tag[rt];
}

int main() {
   scanf("%d %d", &n, &m);
   for1(i, m) {
      scanf("%d %d %d", &b[i].l, &b[i].r, &b[i].a);   
   }
   sort(b+1, b+1+m, cmp);
   int idx = 1;
   for1(i, n) {
      add(1, 1, n, i, i, sum[1]);
      while(b[idx].r == i) {
         // debug1 printf("%d %d %d\n", b[idx].l, b[idx].r, b[i].a);
         add(1, 1, n, b[idx].l, i, b[idx].a);
         idx++;
      }
   }
   cout << max(sum[1], (ll)0) << endl;
   return 0;
}

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

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
#define maxn 100001
#define INF 1e9
int N,K;
int A[maxn];

int main(){
	fast;
	
	cin>>N>>K;
	
	FOR(i,0,N-1) cin>>A[i];
	
	
	int ans = INF;
	FOR(i,0,N-1){
		if (i + K - 1 >= N) break;
		
		int idx = i+K-1;
		
		if (A[i] >= 0 == A[idx] >= 0){
			ans = min(ans,max(abs(A[i]),abs(A[idx])));
		}else{
			ans = min({ans,abs(A[i]) * 2 + A[idx]});
			ans = min({ans,abs(A[i]) + A[idx] * 2});
		}
	}
	
	cout<<ans;
}



Measured memory_bytes: 640
#include<bits/stdc++.h>
#define pi acos(-1)
#define mx 1500000
#define mod 1000000007
#define pii pair<int,int>
typedef long long ll;
using namespace std;
void fastio()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

int main()
{
    fastio();
    int i,j,t,n,k,s,l,x,y;
    //cin>>t;
    //while(t--){
     cin>>n>>k>>x>>y;
     if(k>n)k=n;
     cout<<(k*x)+(n-k)*y<<endl;
     //}
 return 0;
}


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

using namespace std;
using ld = long double;
#define int long long
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define ff first
#define ss second

constexpr int INF = 1e9 + 9;

void run() {
    int n, m;
    cin >> n >> m;
    vector<int> cnt(n, 1), ans(n);
    ans[0] = 1;
    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        x--; y--;
        cnt[x]--;
        cnt[y]++;
        if (ans[x]) ans[y] = 1;
        if (ans[x] && !cnt[x]) {
            ans[x] = 0;
        }
    }
    int ansik = 0;
    for (auto el : ans) ansik += el;
    cout << ansik << '\n';
}

signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#else
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#endif
    int t = 1;
   // cin >> t;
    while (t--)
        run();
    return 0;
}

Measured memory_bytes: 1792
from collections import Counter

N = int(input())

a = list(map(int,input().split()))
c = Counter(a)

x = set(a)


res = 0
for k,v in c.items():
    if k <= 100000:
        if (v >= k):res += (v - k)
        else:res += v
    else:
        res+=v


print(res)
#
#
#for i in a:
#    if i > 100000:
#        res+=1
#
#for i in x:
#    if (a.count(i) >= i):res += (a.count(i) - i)
#    else:res += a.count(i)
#
#print(res)

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

int main() {
	int x;
	int y;
	int min;
	int count = 1;
	cin >> x;
	cin >> y;
	min = y;
	for (int i=1; i<x; i++)
	{
		cin >>y;
		if (y<min)
		{
			count++;
			min=y;
		}
	}
	cout << count;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
a_li = list(map(int,input().split()))
a_li.sort()
ans_min = [0]*8
ans_max = [0]*8
dum = 0
for i in a_li:
    if 0 < i < 400:
        ans_max[0] = 1
        ans_min[0] = 1
    elif 400 <= i < 800:
        ans_max[1] = 1
        ans_min[1] = 1
    elif 800 <= i < 1200:
        ans_max[2] = 1
        ans_min[2] = 1
    elif 1200 <= i < 1600:
        ans_max[3] = 1
        ans_min[3] = 1
    elif 1600 <= i < 2000:
        ans_max[4] = 1
        ans_min[4] = 1
    elif 2000 <= i < 2400:
        ans_max[5] = 1
        ans_min[5] = 1
    elif 2400 <= i < 2800:
        ans_max[6] = 1
        ans_min[6] = 1
    elif 2800 <= i < 3200:
        ans_max[7] = 1
        ans_min[7] = 1
    else:
        dum += 1
ans_max_sum = sum(ans_max) + dum
ans_min_sum = sum(ans_min)
if ans_min_sum == 0:
    ans_min_sum = 1
#if ans_max_sum > 8:
#    ans_max_sum = 8
print(ans_min_sum,ans_max_sum)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if ((A + B) > (C + D)) {
    cout << "Left" << endl;
  }
  else if ((A + B) == (C + D)) {
    cout << "Balanced" << endl;
  }
  else {
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <deque>
#include <queue>

using namespace std;
typedef long long ll;
ll dp[10005][100][2]; 
const int MOD = 1000000007;
int N,M,Q,l[200005],r[200005], x[505][505], c[505][505];
int main(){
    cin >> N >> M >> Q;
    for(int i = 1; i <= M; i++){
        cin >> l[i] >> r[i];
        x[l[i]][r[i]]++;
    }
    for(int i = 1; i <= N; i++){
        for(int j = 1; j <= N; j++){
            c[i][j] = c[i][j-1] + x[i][j];
        }
    }
    for(int i = 1; i <= Q; i++){
        int p,q;
        cin >> p >> q;
        int ans = 0;
        for(int j = p; j <= q; j++){
            ans += c[j][q]-c[j][p-1];
        }
        cout << ans << endl;
    }
}



Measured memory_bytes: 4992
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>

#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
using namespace std;

int N;
int A[200000];

signed main()
{
	cin >> N;
	REP(i, N)
	{
		cin >> A[i];
	}

	for (int i = 0; i < N; i++)
	{
		if (i < A[i])
		{
			cout << -1 << endl;
			return 0;
		}
	}

	int flg = false;
	int ans = 0;
	int sum = 0;
	for (int i = 1; i < N; i++)
	{
		if (!flg)
		{
			if (A[i] == 0)
			{
				continue;
			}
			if (A[i] == 1)
			{
				sum = 1;
				flg = true;
				continue;
			}

			cout << -1 << endl;
			return 0;
		}
		else
		{
			if (A[i] == sum + 1)
			{
				sum += 1;
				continue;
			}
			if (A[i] > sum + 1)
			{
				cout << -1 << endl;
				return 0;
			}
			if (A[i] < sum + 1)
			{
				ans += sum;
				if (A[i] == 0)
				{
					sum = 0;
					flg = false;
				}
				else
				{
					sum = A[i];
					flg = true;
				}
			}
		}
	}
	ans += sum;

	cout << ans << endl;
}







Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
typedef long long int ll;
using namespace std;

int main(int argc, char const *argv[]) {
  std::vector<ll> ans(6);
  ans[0] = ans[1] = 0;
  ll S;
  std::cin >> S;
  // S = |x1y2-x2y1|
  ll yaku = S/1000000000 + (S%1000000000==0?0:1);
  ll Sd = yaku * 1000000000;
  ans[2] = 1000000000, ans[3] = Sd-S;
  ans[4] = 1, ans[5] = yaku;
  for(int i=0;i<6;i++) std::cout << ans[i] << (i==5?"\n":" ");
  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

def solve():
    N = int(input())
    res = N*(N+1)//2 - 3*(N//3)*((N//3)+1)//2 - 5*(N//5)*((N//5)+1)//2 + 15*(N//15)*((N//15)+1)//2
    return str(res)


if __name__ == '__main__':
    print(solve())



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

int main() {
    int n;
    int tmp;
    int x;
    
    cin >> n;
    
    for (int i = 1; i < 10; i++) {
        tmp = i * 100 + i * 10 + i;
        
        if (tmp >= n) {
            x = tmp;
            break;
        }
    }
    
    cout << x << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;
typedef long long ll;

ll a[100000];
int N, Q;

int main() {
	cin >> N >> Q;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	//[left, right)の半開区間でしゃくとりを考える。
	for (int q = 0; q < Q; q++) {

		ll x;
		cin >> x;
		ll ans = 0;
		ll sum = 0;
		int left = 0, right = 0;
		for (left = 0; left < N; left++) {
			while (right < N && sum + a[right] <= x) {
				sum += a[right];
				right++;
			}
			ans += (right - left);

			if (left == right)right++;//左も右もインクリメント rightはそのままじゃ足されないのでたしとく
			else sum -= a[left];

		}

		cout << ans << endl;

	}

	return 0;
}


Measured memory_bytes: 3824
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>

using ll = long long;
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	int x1 = a + b;
	int x2 = a - b;
	int x3 = a * b;
	int tmp;
	if (x1 >= x2) {
		tmp = x1;
	}
	else {
		tmp = x2;
	}
	if (tmp >= x3) {
		cout << tmp;
	}
	else {
		cout << x3;
	}
}







Measured memory_bytes: 256
#include<cstdio>
#include <iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<cstdlib>
#include<list>
#include<set>
#include<numeric>

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

int N, M, Q;
vector<int> G[100010];
int dp[11][100010];
int color[100010];

int main() {
	cin >> N >> M;
	memset(dp, 0, sizeof(dp));
	for (int i = 0; i < M; i++) {
		int a, b;
		scanf("%d %d",&a,&b);
		a--,b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}

	cin >> Q;
	for (int i = 1; i <= Q; i++) {
		int v, d;
		scanf("%d %d %d",&v,&d,&color[i]);
		v--;
		dp[d][v] = max(dp[d][v], i);
	}
	
	for (int i = 10; i > 0; i--) {
		for (int j = 0; j < N; j++) {
			dp[i - 1][j] = max(dp[i - 1][j], dp[i][j]);
			for (int &to: G[j]) {
				dp[i - 1][to] = max(dp[i - 1][to], dp[i][j]);
			}
		}
	}

	for (int i = 0; i < N; i++) {
		printf("%d\n",color[dp[0][i]]);
	}
	return 0;
}

Measured memory_bytes: 11128
#include <bits/stdc++.h>
using namespace std;
int n, a[200010], b[200010][20];
int main() {
	scanf("%d", &n);
	for(int i=1; i<=n; i++) {
		scanf("%d", a+i);
		for(int j=0; j<20; j++) {
			b[i][j] = b[i-1][j];
			if(a[i] >> j & 1) {
				b[i][j]++;
			}
		}
	}
	long long res = 0;
	for(int i=1; i<=n; i++) {
		int lo = i, hi = n;
		while(lo < hi) {
			int mid = (lo + hi + 1) / 2, flag = 1;
			for(int j=0; j<20; j++) {
				if(b[mid][j] - b[i-1][j] > 1) { flag = 0; break; }
			}
			if(flag) lo = mid;
			else hi = mid - 1;
		}
		//printf("%d %d\n", i, lo);
		res += lo - i + 1;
	}
	printf("%lld", res);
	return 0;
}

Measured memory_bytes: 16640
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int s=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			for(int k=1;k<=n;k++){
				s+=__gcd(i,__gcd(j,k));
			}
		}
	}
	cout<<s<<endl;
}

Measured memory_bytes: 3548
#include <bits/stdc++.h>
using namespace std;
typedef pair<double,double> P;
double S(double a,double b,double c) {
  double s=(a+b+c)/2;
  return sqrt(s*(s-a)*(s-b)*(s-c));
}
double D(P a,P b) {
  return sqrt((a.first-b.first)*(a.first-b.first)+(a.second-b.second)*(a.second-b.second));
}
double calc(P a,P b, P c) {
  return S(D(a,b),D(a,c),D(b,c));
}
  
double toRad(double agl) {
  return agl*M_PI/180.0;
}
P Q(double e) {
  double w=toRad(360*e);
  return P(sin(w),cos(w));
}

int main() {
  int n,m;
  while(cin >> n >> m && n) {
    P p[n];
    for(int i=0; i<n; i++) {
      double x;
      cin >> x;
      p[i]=Q(x);
    }
    double ans=0;
    for(int i=0; i<n; i++) {
      double dp[n][m+1];
      for(int j=0;j<n;j++)for(int k=0;k<=m;k++)dp[j][k]=-1; 
      for(int j=i+1; j<n; j++) dp[j][2]=0;
      for(int j=i+1; j<n; j++) {
        for(int k=2; k<m; k++) {
          if(dp[j][k]<0) continue;
          for(int l=j+1; l<n; l++) {
            dp[l][k+1]=max(dp[l][k+1],dp[j][k]+calc(p[i],p[j],p[l]));
            if(k+1==m) ans=max(ans,dp[l][k+1]);
          }
        }
      }                                      
    }
    printf("%.6f\n",ans);
  }
  return 0;
}


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

void solve()
{
	int n, m;
	cin >> n >> m;
	
	if(n == m)
	{
		cout << "Yes";
	}
	else
	{
		cout << "No";
	}
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sz(v) ((int)(v).size())
using namespace std;
using pi = pair<int, int>;
using lint = long long;
const int MAXN = 200005;

string s;

int main(){
	cin >> s;
	int ret = 0;
	for(int i=1; i<s.size(); i++){
		if(s[i] != s[i-1]) ret++;
	}
	cout << ret << endl;
}


Measured memory_bytes: 512
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;

class Main {
    public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    public static PrintWriter pw = new PrintWriter(System.out);
    public static String line;
    public static StringTokenizer st;
    public static ArrayList<ArrayList<Integer>> adjList;
    public static int[] dx = {-1, 0, 1, 0, -1, 1, 1, -1};
    public static int[] dy = {0, 1, 0, -1, 1, 1, -1, -1};
    public static int INF = 0x3f3f3f3f;
    public static long LINF = 0x3f3f3f3f3f3f3f3fL;
    public static int MOD = 1000000007;

    public static void main(String[] args) throws Exception{
        st = new StringTokenizer(br.readLine());
        int N = Integer.parseInt(st.nextToken());
        int C = Integer.parseInt(st.nextToken());
        int K = Integer.parseInt(st.nextToken());

        int[] A = new int[N];
        for(int i = 0; i < N; i++){
            A[i] = Integer.parseInt(br.readLine());
        }

        Arrays.sort(A);
        int last = A[0];
        int ans = 1;
        int passengers = 1;

        for(int i = 1; i < N; i++){
            if(last + K < A[i] || passengers >= C){
                ans++;
                last = A[i];
                passengers = 1;
            } else{
                passengers++;
            }
        }
        pw.print(ans + "\n");
        pw.close(); 
        br.close();
    }
}

class Pair {
    public int a, b;

    Pair(int a, int b){
        this.a = a;
        this.b = b;
    }

}

Measured memory_bytes: 30904
//ABC106B
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
#include <unordered_map>
using namespace std;

int main(){
	int n;
	cin >> n;
	int count = 0;
	for(int i=1;i<=n;i+=2){
		int num = 0;
		for(int j=1;j<=i;j++){
			if(i%j == 0){
				num++;
			}
		}
		if(num == 8){
			count++;
		}
	}
	cout << count << endl;
	return 0;
}

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

int main(){
  
  long long N, K, i, Max = 0, Head, Sum = 0;
  double Kitai = 0;
  cin >> N >> K;
  vector<long long> p(N);
  
  for(i = 0; i < N; i++){
    
    cin >> p.at(i);
    
    if (i < K) Sum += p.at(i);
  }
  
  
  for(i = 0; i < N - K; i++){
    
    Sum = Sum - p.at(i) + p.at(i + K);
    if (Max < Sum){
      
      Max  = Sum;
      Head = i + 1;
    }
  }
  
  for(i = Head; i < Head + K; i++){
    
    Kitai += (double) p.at(i) * (p.at(i) + 1) / 2 / p.at(i);
  }

  printf("%.6f", Kitai);
  return 0;
}

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

int main(){
    long long n, d;
    cin >> n >> d;

    long long x[n][d];

    for(long long i = 0; i < n; i++){
        for(long long j = 0; j < d; j++){
            cin >> x[i][j];
        }
    }

    long long count = 0;
    for(long long i1 = 0; i1 < n; i1++){
        for(long long i2 = i1+1; i2 < n; i2++){
            long long distance = 0;
            for(long long j = 0; j < d; j++){
                distance += (x[i1][j] - x[i2][j])*(x[i1][j] - x[i2][j]);
            }
            long long a = (long long)sqrt((double)distance);
            if(a*a == distance){
                count++;
            } 
        }
    }
    cout << count << endl;
    return 0;
}

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

int main(){
    int n;
    cin >> n;
    int a[n];
    
    for (int i=0;i<n;i++) cin >> a[i];
    
    int cnt=0,i;
    
    do{
        int f=1;
        for (i=0;i<n;i++)
        if (a[i]%2==1){
            cout << cnt;
            return 0;
		}
		
		cnt++;
		for (int j=0;j<n;j++) a[j]=a[j]/2;
	}while (1);
}

Measured memory_bytes: 256
#include <stdio.h>
int n, m, i, j, k;
int main(){
	scanf("%d", &n);
	for(i=1; i<=n; i++){
		scanf("%d", &k);
		if((i&1) & (k&1)) m++;
	}
	printf("%d\n", m);
	return 0;
}

Measured memory_bytes: 1736
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  (n : _) <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  (s : t : _) <- words <$> getLine :: IO [String]
  let
    st = concat $ zipWith op s t
      where
        op x y = [x, y]
  putStrLn st

unsafeSignedDecimal :: T.Text -> Int
unsafeSignedDecimal s = case T.signed T.decimal s of
  Right (n, _) -> n


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

int main() {
	int n=0;
	while(cin >> n){
		if(n==0)	break;
		int ans=0,m=0;
		while(m<600){
			ans+=m*m*n;
			m+=n;
		}
		cout << ans <<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <cstdio>

char grid[105][105];
int good[105][105];

int main()
{
    int H, W;
    scanf("%d %d", &H, &W);
    for(int h = 0; h < H; h++)
        scanf("%s", grid + h);

    good[0][0] = (grid[0][0] == '#')? 1 : 0;

    for(int step = 1; step <= H + W - 2; step++)
    {
        for(int h = 0; h <= step; h++)
        {
            int w = step - h;
            if(h > H || w > W) continue;

            if(!h)
            {
                good[h][w] = good[h][w - 1];
                if(grid[h][w] == '#')
                {
				    ++good[h][w];        
            	    if(grid[h][w - 1] == '#') --good[h][w];
                }
            }
            else if(!w)
            {
                good[h][w] = good[h - 1][w];
                if(grid[h][w] == '#')
                {
				    ++good[h][w];      
            	    if(grid[h - 1][w] == '#') --good[h][w];
                }
            }
            else
            {
                int up = good[h - 1][w];
                if(grid[h][w] == '#')
                {
				    ++up;        
            	    if(grid[h - 1][w] == '#') --up;
                }

                int left = good[h][w - 1];
                if(grid[h][w] == '#')
                {
				    ++left;     
            	    if(grid[h][w - 1] == '#') --left;
                }

                good[h][w] = (up < left)? up : left;

            }
        }
    }

    printf("%d", good[H - 1][W - 1]);
    return 0;
}

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

using namespace std;

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

    int max = 0, ct = 0;
    for (int i = n - 1; i >= 0; i--)
    {
        if(i == n-1 || h[i] < h[i+1]) ct = 0;
        ct++;
        if(max < ct) max = ct;
    }
    cout << max -1 << endl;
}

Measured memory_bytes: 640
#include <cstdio>

int line[10001];

int rec(int n){
	if(line[n] != -1) return line[n];
	if(n == 0) return line[n] = 0;
	if(n == 1) return line[n] = 2;
	return line[n] = rec(n-1) + n;
}
int main(){
	int n;
	for(int i = 0; i < 10001; i++) line[i] = -1;
	while(scanf("%d", &n) != EOF){
		printf("%d\n", rec(n));
	}
	return 0;
}

Measured memory_bytes: 1336
#include <bits/stdc++.h>
using ll = long long;
const int MOD = 1000000007;
#define rep(i,n) for (ll i=0; i < (n); i++)
using namespace std;
int get_gcd(int a, int b) {
  while(1) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    a %= b;
  }
}
int get_lcm(int a, int b){return a * b / get_gcd(a, b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

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

  vector<int> v_org(n);
  rep(i,n) cin >> v_org[i];

  int ans = 0;
  for (int a = 0; a <= min(n,k); a++) {
    for (int b = 0; b <= min(n,k) - a; b++) {
      vector<int> v(v_org);
      copy(v.end() - b, v.end(), v.begin() + a);
      v.resize(a+b);
      sort(v.begin(), v.end(), greater<int>());
      for (int i = 0; i < k - (a+b); i++) {
        if (!v.empty() && v.back() < 0) {
          v.pop_back();
        }
        else {
          break;
        }
      }
      int sum = accumulate(v.begin(), v.end(), 0);
      if (sum > ans) ans = sum;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
n, *v = map(int, open(0).read().split())
a, b = [[[0, 0] for i in range(100000)] for i in (1,1)]
for i in range(n):
        if i%2:
                b[v[i]-1][0] += 1
                b[v[i]-1][1] = v[i]
        else:
                a[v[i]-1][0] += 1
                a[v[i]-1][1] = v[i]
a.sort(key=lambda x:-x[0]);
b.sort(key=lambda x:-x[0]);

if a[0][1]==b[0][1]:
        print(n-max(a[0][0]+b[1][0], a[1][0]+b[0][0]))
else: print(n-a[0][0]-b[0][0])

Measured memory_bytes: 28660
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	char retu[201],kara[201],zan[200];
	int i,j,m,len,h,len2,rr,x;
	while(1){
		scanf("%s",retu);
		if(retu[0]=='-') break;
		len=strlen(retu);
		scanf("%d",&m);
		for(i=0;i<m;i++) {
			scanf("%d",&h);
			x=len-h;
			for(j=0;j<h;j++) {
				kara[x]=retu[j];
				x++;
			}
			x=0;
			for(j=h;j<len;j++){
				kara[x]=retu[j];
				x++;
			}
			for(j=0;j<len;j++){
				retu[j]=kara[j];
			}
		}
		printf("%s\n",retu);
	}
	return 0;
}
			
	
	
	

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

int main() {
    int n, count, ans;
    cin >> n;
    vector<int> vec(n);

    for(int i = 0; i < n; i++) {
	    cin >> vec.at(i);
    }

    for(int j = 0; j < n; j++) {
      
	    if(j == 0) {
            ans = vec.at(j);
            count++;
        }
		else {
	        ans = min(ans, vec.at(j));
            if(ans == vec.at(j)) count++;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for(ll i=0;i<n;i++)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (b>a) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 2LL << 60;
using ll = long long;
using P = pair<ll, ll>;

int main(int argc, char const *argv[]){
    ll n, k;
    cin >> n >> k;
    vector<ll> v(n,-1);
    vector<ll> a(n);
    rep(i, n){
        cin >> a[i];
        a[i]--;
    }
    vector<ll> t;
    ll p=0, np;
    ll rs;
    bool flg=true;
    t.push_back(p);
    int j;
    for(j=0;j<k;j++){
        np=a.at(p);
        if(v.at(p)!=-1){
            rs = v.at(p);
            flg = false;
            break;
        }
        v.at(p)=j;
        t.push_back(np);
        p=np;
    }
    if(flg){
        cout << t.back()+1 << endl;
        return 0;
    }
    ll rp = t.size()-rs-1;
    k-=rs;
    k%=rp;
    cout << t.at(rs+k)+1 << endl;
    return 0;
}



Measured memory_bytes: 8404
#include <bits/stdc++.h>
using namespace std;
#define print(x) cout << (x) << endl;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ld W, H, x, y;
    cin >> W >> H >> x >> y;
    cout << W*H/2.0 << " ";
    if (x == W/2 && y == H/2) {
        cout << 1 << endl;
    }
    else {
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#define FOR0(var, max) for (ui var = 0; var < max; ++var)
#define FORINV(var, min, max) for (ui (var) = (max) - 1; (var) + 1 > (min); --(var))

using namespace std;

using ui = unsigned int;
using ul = unsigned long long int;
using uc = unsigned char;

const static ui NMAX = 100000;
static ui N;
static vector<ui> Pi;
static map<ui, ui> Pi_inv;

ul solve(void) {
  ul res = 0;
  multiset<ui> all;

  all.insert(0);
  all.insert(0);
  all.insert(N + 1);
  all.insert(N + 1);

  FORINV(P, 1, N + 1) {
    ul i = Pi_inv[P] + 1;

    auto it = all.lower_bound(i);
    ul wi = *prev(it, 2);
    ul xi = *prev(it, 1);
    ul yi = *it;
    ul zi = *next(it);

    ul Ci = (xi - wi) * (yi - i) + (i - xi) * (zi - yi);
    res += P * Ci;
    all.insert(i);
  }

  return res;
}

int main(int ac, char **av) {
  cin >> N;
  FOR0(i, N) {
    ui t;
    cin >> t;
    Pi.push_back(t);
  }
  FOR0(i, N) {
    Pi_inv[Pi[i]] = i;
  }
  cout << solve() << endl;
  return 0;
}

Measured memory_bytes: 9976
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

int main()
{
    string s;
    cin >>s;

    int S = s.size();
    set<char> X;
    rep(i,S) X.insert(s[i]);

    cout << (X.size()==S?"yes":"no") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <functional>
#include <bitset>
#include <utility>
#include <sstream>
#include <fstream>
#include <stack>
#include <cstdlib>
#include <complex>
#include <set>

using namespace std;

#define INF 1070000000LL
#define pb push_back
#define irep(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) irep(i,0,n)

typedef long long lint;
typedef pair<int, int> pint;
struct Edge{
    int to,weight;
};
typedef vector<vector<Edge> > Graph;


int main(){
    int a[5];
    int b=10;
    int temp_max=100000;
    rep(i,5)cin >> a[i];
    rep(i,5){
	if(a[i]%10 != 0){
	    b = min(a[i]%10, b);
	    a[i] = (a[i]/10 + 1) * 10;
	}
	else{
	    a[i] = (a[i]/10)*10;
	}
    }
    int sum = 0;
    if(b != 10)sum -= (10-b);
    rep(i,5)sum += a[i];
    cout << sum << endl;
}


Measured memory_bytes: 256
N = int(input())
s, t = [], []
for i in range(N):
    s_i, t_i = input().split()
    s.append(s_i)
    t.append(int(t_i))
X = input()

flag = False
ans = 0

for s_i, t_i in zip(s, t):
    if flag:
        ans += t_i
    if s_i == X:
        flag = True

print(ans) 

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



int main(){
    int stack[100];
    int idx = 0;
    string input;
    
    while(cin >> input){
        //if(input==' ')cout << "??????" << endl;
        if(input == "+"){
            stack[idx-2] = stack[idx-2] + stack[idx-1];
            idx--;
        }else if(input == "-"){
            stack[idx-2] = stack[idx-2] - stack[idx-1];
            idx--;            
        }else if(input == "*"){
            stack[idx-2] = stack[idx-2] * stack[idx-1];
            idx--;
        }else{
            stack[idx] = atoi(input.c_str());
            idx++;
        }
        
        //cout << stack[0] << " " << stack[1] << " " << stack[2] << " " << stack[3] << " " << stack[4] << endl;
        
    }
    
    
    cout << stack[0] << endl;
    return 0;

}

Measured memory_bytes: 3192