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

namespace ABCO087A
{
    class Program
    {
        static void Main(string[] args)
        {
            int x, a, b, c;

            x = int.Parse(Console.ReadLine());
            a = int.Parse(Console.ReadLine());
            b = int.Parse(Console.ReadLine());

            c = (x - a) % b;

            Console.WriteLine(c);

            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 13140
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let s: String=read();
    println!("{}", s.chars().filter(|&c| c == '1').count());
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    string S;
    cin >> S;
    int max=0;
    int chk=0;
    for(int i=0; i<S.size(); i++)
    {
        if(S.at(i)=='I')
        {
            chk++;
        }
        else
        {
            chk--;
        }
        if(chk>max)
        {
            max=chk;
        }
    }
    cout << max << endl;
}

Measured memory_bytes: 3560
#include <cstdio>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR (i, 0, n)
#define _ << " _ " <<
#define TRACE(x) cerr << #x << " = " << x << endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
//#define debug
//#define TRACE(x)

using namespace std;

typedef long long llint;

const int MAXN = 100010;

int n, l, a[MAXN];

int main(void) {
  scanf("%d %d",&n,&l);
  REP(i, n) scanf("%d",&a[i]);

  REP(i, n - 1)
    if (a[i] + a[i+1] >= l) {
      printf("Possible\n");
      for (int j = 0; j < i; ++j)
	printf("%d\n",j+1);
      for (int j = n - 2; j > i; --j)
	printf("%d\n",j+1);
      printf("%d\n",i+1);
      return 0;
    }

  printf("Impossible\n");
  
  return 0;
}


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

#define INF (1LL << 60)
#define MOD 1000000007

#define REP(i,m,n) for(ll (i)=(m),i_len=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back
#define mp make_pair

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

    ll m = INF;
    for(ll i=1; i*i<=N; ++i) {
        if(N % i == 0) m = MIN(m,i+N/i-2);
    }
    PR(m);


    return 0;
}

/*



*/

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

typedef long long ll;

const int inf = 1000000;

int main() {
    int N;
    ll a[200005];
    cin >> N;
    for (int i = 1; i <= N; i++) {
        cin >> a[i];
    }
    ll r = 0, ans = 0, sum1 = 0, sum2 = 0;
    for (int i = 1; i <= N; i++) {
        while (sum1==sum2 && r <= N) {
            r++;
            sum1 += a[r];
            sum2 ^= a[r];
        }
        ans += r-i;
        sum1 -= a[i];
        sum2 ^= a[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 5100
#include <algorithm>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define eps LDBL_EPSILON
#define moder 1000000007
#define int long long
#define ll long long
#define double long double
#define INF LLONG_MAX/3
#define P pair<int,int>
#define prique priority_queue<int,vector<int>,greater<int>>
using namespace std;
int h, w, n, sr, sc;
string s, t;
signed main() {
	cin >> h >> w >> n >> sr >> sc >> s >> t;
	sr--; sc--;
	int now = sr * w + sc;
	rep(i, n) {
		if (now < w && s[i] == 'U') {
			puts("NO");
			return 0;
		}
		if (s[i] == 'U')now -= w;
		if (t[i] == 'D' && now / w != h - 1)now += w;
	}
	now = sr * w + sc;
	rep(i, n) {
		if (now % w == 0 && s[i] == 'L') {
			puts("NO");
			return 0;
		}
		if (s[i] == 'L')now--;
		if (t[i] == 'R' && now % w != w - 1)now++;
	}
	now = sr * w + sc;
	rep(i, n) {
		if (now / w == h - 1 && s[i] == 'D') {
			puts("NO");
			return 0;
		}
		if (s[i] == 'D')now += w;
		if (t[i] == 'U' && now >= w)now -= w;
	}
	now = sr * w + sc;
	rep(i, n) {
		if (now % w == w - 1 && s[i] == 'R') {
			puts("NO");
			return 0;
		}
		if (s[i] == 'R')now++;
		if (t[i] == 'L' && now % w)now--;
	}
	puts("YES");
	return 0;
}

Measured memory_bytes: 776
import sys
L,R=map(int,input().split())
mod=2019
q,r=L//mod,L%mod
q1,r1=R//mod,R%mod
#print(r,q,r1,q1)
if r==0 or r1==0 or q<q1:
    print(0)
    sys.exit()
mi=10**9
for i in range(r,r1):
    for j in range(i+1,r1+1):
        #print(i,j)
        mi=min(mi,(i*j)%mod)
print(mi)

Measured memory_bytes: 40812
#include <string>
#include <algorithm>
#include <limits.h>
#include <iostream>

using namespace std;

int main()
{
	int i, j, k, al, sl;
	string s, a = { "abcdefghijklmnopqrstuvwxyz" };
	cin >> s;
	al = a.length();
	sl = s.length();

	for (i = 0; i < al; i++) {
		k = 0;
		for (j = 0; j < sl; j++) {
			if (a[i] != s[j]) {
				k++;
			}
		}
		if (k == sl) {
			cout << a[i] << endl;
			return 0;
		}
	}

	cout << "None" << endl;

	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>

using namespace std;

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

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

	sort(a, a + N);

	cout << a[N-1] - a[0] << endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
 long long int a,b=0,c=100,i=1;
 scanf("%lld",&a);
 if(a==100)
 {
 i=0;
 }
else
{
 while(1)
{
 b=c/100;
 c+=b;
 if(c>=a)
 break;
i++;
}
}
printf("%lld\n",i);
return 0;
}

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

using namespace std;

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

	vector<int> A(N + 1);
	vector<int> B(N);
	for (int i = 0; i < N + 1; i++) {
		cin >> A.at(i);
	}
	for (int i = 0; i < N; i++) {
		cin >> B.at(i);
	}

	int64_t ans = 0;
	for (int i = 0; i < N; i++) {
		ans += min(A.at(i), B.at(i));
		B.at(i) -= min(A.at(i), B.at(i));
		ans += min(A.at(i + 1), B.at(i));
		A.at(i + 1) -= min(A.at(i + 1), B.at(i));
	}

	cout << ans << endl;
}

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

int main() {
    string S;
    cin >> S;
    if (S == "Sunny") cout << "Cloudy" << endl;
    else if (S == "Cloudy") cout << "Rainy" << endl;
    else if (S == "Rainy") cout << "Sunny" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define FOR(i,l,r) for(i=l;i<r;i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define P pair<ll,ll>
#define F first
#define S second
signed main(){
  ll N;cin>>N;string S;
  while(N>0){
    char x='a';
    if(N%26==0){
      x='z';N--;
    }
    else x+=N%26-1;
    S+=x;N/=26;
  }
  reverse(ALL(S));
  cout<<S<<endl;
  return 0;
}

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

#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//以降 cin の入力元が 'input.txt' になる
//std::ifstream in("input.txt");
//std::cin.rdbuf(in.rdbuf());
 
signed main()
{
    gearup;
    ll n; 
    string s; cin >> n >> s;
    vl r;
    vl w;
    
    rep(i,n){
        if(s[i] == 'W')w.push_back(i);
        else r.push_back(i);
    }
    sort(rall(r)); //降順
    sort(all(w)); //昇順
    if(w.size() == n)out(0);
    else if(r.size() == n)out(0);
    else{
        int r_idx = 0,w_idx = 0;
        int R = r.size();
        int W = w.size();
        ll cnt = 0;
        while(r_idx < R && w_idx < W){
            if(r[r_idx] > w[w_idx])r_idx++,w_idx++,cnt++;
            else break;
        }
        out(cnt);
    }
}

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

vector<int> v;
priority_queue< pair< int, int > > p;

signed main() {

    int n, m;
    scanf("%d %d", &n, &m);
    for ( int i = 0; i < n; i++ ) {
        int a;
        scanf("%d", &a);
        v.push_back(a);
    }
    sort(v.begin(), v.end());
    for ( int i = 0; i < m; i++ ) {
        int b, c;
        scanf("%d %d", &b, &c);
        p.push( make_pair ( c, b ) );
    }
    int pos = 0;
    while ( !p.empty() ) {
        pair<int, int> P = p.top();
        p.pop();
        int left = P.second;
        int val = P.first;
        while ( left ) {
            if ( v[pos] < val ) {
                v[pos] = val;
                pos++;
                left--;
            }
            else {
                left = -100;
                break;
            }
            if ( pos == v.size() ) {
                left = -100;
                break;
            }
        }
        if ( left == -100 ) break;
    }
    long long sum = 0;
    for ( int i = 0; i < n; i++ ) {
        sum += (long long)v[i];
    }
    printf("%lld\n", sum);

    return 0;
}

Measured memory_bytes: 1784
#include <stdio.h>
#define N 10000
int tansaku(int a[],int n,int fig);
int main()
{
  int i,n,fig,a[N+1],b,sum=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  scanf("%d",&fig);
  for(i=0;i<fig;i++){
    scanf("%d",&b);
    if(tansaku(a,n,b))
      sum++;
  }
  printf("%d\n",sum);
  return 0;
}
int tansaku(int a[],int n,int b)
{
  int c=0;
  a[n]=b;
  while(a[c]!=b)
    c++;
  return c!=n;
}



Measured memory_bytes: 2048
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		char[] chs = scanner.next().toCharArray();
		int len = chs.length;
		int idx = 0;
		int ans = 0;
		while (idx < len) {
			int jc = 0;
			int oc = 0;
			int ic = 0;
			while (idx < len && chs[idx] == 'J') {
				jc++;
				idx++;
			}
			while (idx < len && chs[idx] == 'O') {
				oc++;
				idx++;
			}
			while (idx < len && chs[idx] == 'I') {
				ic++;
				idx++;
			}
			if (jc >= oc && oc <= ic)
				ans = Math.max(ans, oc);
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 32284
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

int main() {
  
  lint a, v;
  cin >> a >> v;
  lint b, w;
  cin >> b >> w;
  lint t; cin >> t;

  if (a == b) {
    cout << "YES" << endl;
    return 0;
  }

  if (w >= v) {
    cout << "NO" << endl;
    return 0;
  }

  lint x = (lint)abs(a - b);
  v = v - w;
  if (v * t >= x) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }


  return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define re(i,n,a) for(int i=a;i<n;i++)
using namespace std;
typedef pair<int,int>P;
int w,h,a[16][16],md=14,b[16][16],s1,s2;
bool used[16][16];
string s[16];
int dx[]={-1,-1,-1,0,0,0,1,1,1};
int dy[]={-1,0,1,-1,0,1,-1,0,1};
vector<P>v;
map<int,int>m;
int greedy(){
  int res=0,sum=0;
  memset(a,0,sizeof(a));
  memset(used,0,sizeof(used));
  r(i,h){
      r(j,w){
        if(s[i][j]=='0'){
        r(k,9){
          int y=i+dy[k];
          int x=j+dx[k];
          if(y<0||x<0||y>=h||w>=x)continue;
          used[y][x]=1;
        }
      }
      else if(s[i][j]=='.')used[i][j]=1;
      else if(isdigit(s[i][j]))a[i][j]=s[i][j]-'0',res+=a[i][j];
      }
    }
    while(res>0){
      memset(b,0,sizeof(b));
      int f=0;
      r(i,h)r(j,w)if(!used[i][j]){
        int p=0;
        r(k,9){
          int y=i+dy[k];
          int x=j+dx[k];
          if(y<0||x<0||y>=h||x>=w)continue;
          if(a[y][x])p++;
        }
        b[i][j]=p;
        f=max(p,f);
      }
      int i=0,j=0;
      r(kk,h*w){
        i=(i+1)%h;
        j=(j+1)%w;
        if((unsigned int)rand()%5==0)i=(unsigned int)rand()%h;
        if((unsigned int)rand()%5==0)j=(unsigned int)rand()%w;
        if(used[i][j])continue;
        if(b[i][j]==f){
          int p=0;
          r(k,9){
          int y=i+dy[k];
          int x=j+dx[k];
          if(y<0||x<0||y>=h||x>=w)continue;
          if(a[y][x])p++;
        }
        if(p==f){
          r(k,9){
            int y=i+dy[k];
            int x=j+dx[k];
            if(y<0||x<0||y>=h||x>=w)continue;
            if(used[y][x])continue;
            if(a[y][x])a[y][x]--;
          }
          sum++;
          res-=f;
          used[i][j]=1;
        }
      } 
    }}
    m[sum]++;
    return sum;
}
int main(){
  while(cin>>h>>w,w){
    int ans=1e9;
    r(i,h)cin>>s[i];
    r(t1,2){
      r(i,h/2)swap(s[i],s[h-1-i]);
      r(t2,2){
        r(i,h)reverse(s[i].begin(),s[i].end());
        r(t3,2){
          string t[16];
          r(i,16)t[i]="";
          r(i,w)r(j,h)t[i]+=s[j][i];
          swap(h,w);
          r(i,w)s[i]="";
          r(i,h)s[i]=t[i];
          int pp;
          set<int>st;
          m.clear();
          r(t4,111){
            //srand((unsigned int)time(NULL));
            pp=greedy();
            st.insert(pp);
            ans=min(ans,pp);
          }
          //cout<<m[ans]<<endl;
          if(st.count(ans)&&ans%md==0)
            if(rand()%2&&ans&&m[ans]>=1&&m[ans]<=100)ans--;
        }
      }
    }
    cout<<ans<<endl;
  }
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll, ll> Pll;
typedef pair<int, Pii > P1;

#define rep(i,n) for(int i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define mp1(a,b,c) P1(a,P(b,c))
#define get_arsize(a) (sizeof(a)/sizeof(a[0]))

const ll MOD = 1000000007;
const double EPS = 1e-10;
const int MAX = 200000;

int main() {
  int n, x, t;
  cin >> n >> x >> t;
  int ans = n / x * t;
  if (n % x > 0) {
    ans += t;
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n){
   cin >> a[i]; 
  }
  sort(a.begin(),a.end());
  int tairyoku = 0;
  ll minimum = 1e18;
  int place;
  rep(i,100){
    rep(j,n){
      tairyoku += (a[j]-i)*(a[j]-i);
    }
    if(tairyoku < minimum) {
      minimum = tairyoku;
      tairyoku = 0;
    }
    else tairyoku =0;
  }
  int sum =0;
  rep(i,n){
    sum += a[i];
  }
  if(sum ==0) minimum =0;
  cout << minimum << endl;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define mp make_pair
#define pb(x) push_back(x)
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mll map<long long, long long>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define flsh fflush(stdout)
#define gcd __gcd
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007LL
#define mod2 998244353LL
#define INF 1000000000007
 

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> o_tree;


void solve()
{
    string s;
    cin>>s;

    ll st=0;
    ll cn=0;
    ll res=0;
    for(auto it:s)
    {
        if(it=='R')
        {
            cn++;
        }
        else{
            res=max(res,cn);
            cn=0;
        }
    }    
    res=max(res,cn);         
    cout<<res<<"\n";
}


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


if (fopen("input.txt","r" ))
  {
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
  }
cout<<setprecision(20);


ll t=1;


// cin>>t;


while(t--)
{
solve();
} 


return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    cout << fixed << setprecision(10);
    int n,k;
    cin >> n >> k;
    vector<int> v(n);
    rep(i,n) cin >> v[i];
    cout << (n+k-3)/(k-1) << endl;
    return 0;
}


Measured memory_bytes: 3628
fn run_sieve(n: usize) -> Vec<bool> {
    let mut res = vec![true; n + 1];
    res[0] = false;
    res[1] = false;
    for i in 2..n + 1 {
        if res[i] {
            let mut j = i * 2;
            while j <= n {
                res[j] = false;
                j += i;
            }
        }
    }
    res
}
fn get_cum(sieve: &Vec<bool>, n: usize) -> Vec<usize> {
    let mut res = vec![0; n + 1];
    for i in 1..n {
        res[i] = res[i - 1] + if sieve[i] && sieve[(i + 1) / 2] { 1 } else { 0 };
    }
    res
}
fn main() {
    let max = 100010;
    let sieve = run_sieve(max);
    let cum = get_cum(&sieve, max);
    let q = readln();
    for i in 0..q {
        let (l, r): (usize, usize) = readln();
        let ans = cum[r] - cum[l - 1];
        println!("{}", ans);
    }
}

// --- template ---
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, VecDeque};

pub trait FromLn {
    fn fromln(s: &str) -> Self;
}
pub fn readln<T: FromLn>() -> T {
    let mut buf = String::new();
    let _ = ::std::io::stdin().read_line(&mut buf).unwrap();
    T::fromln(buf.trim())
}
pub fn readlns<T: FromLn>(n: usize) -> Vec<T> {
    let mut vs = vec![];
    for _ in 0..n {
        vs.push(readln());
    }
    vs
}
macro_rules! fromln_primitives {
    ($($t:ty),*) => { $(
        impl FromLn for $t {
            fn fromln(s: &str) -> $t {
                s.parse().unwrap()
            }
        }
    )* }
}
fromln_primitives!(
    String,
    bool,
    f32,
    f64,
    isize,
    i8,
    i16,
    i32,
    i64,
    usize,
    u8,
    u16,
    u32,
    u64
);
impl<T> FromLn for Vec<T>
where
    T: FromLn,
{
    fn fromln(s: &str) -> Vec<T> {
        s.split_whitespace().map(T::fromln).collect()
    }
}
impl FromLn for Vec<char> {
    fn fromln(s: &str) -> Vec<char> {
        s.chars().collect()
    }
}
macro_rules! fromln_tuple {
    ($($t:ident),*) => {
        impl<$($t),*> FromLn for ($($t),*) where $($t: FromLn),* {
            fn fromln(s: &str) -> ($($t),*) {
                let mut it = s.split_whitespace();
                let t = ($($t::fromln(it.next().unwrap())),*);
                assert_eq!(it.next(), None);
                t
            }
        }
    }
}
fromln_tuple!(A, B);
fromln_tuple!(A, B, C);
fromln_tuple!(A, B, C, D);
fromln_tuple!(A, B, C, D, E);
fromln_tuple!(A, B, C, D, E, F);


Measured memory_bytes: 4732
#include <iostream>
#include <vector>

using namespace std;

int dp[110][10010];

int main() {
    int n, W;
    cin >> n >> W;
    vector<int> value(n);
    vector<int> weight(n);
    for (int i = 0; i < n; ++i) cin >> value[i] >> weight[i];
    for (int w = 0; w <= W; ++w) dp[0][w] = 0; 

    for (int i = 0; i < n; ++i) {
        for (int w = 0; w <= W; ++w) {
            if (w >= weight[i]) dp[i+1][w] = max(dp[i][w-weight[i]] + value[i], dp[i][w]);
            else dp[i+1][w] = dp[i][w];
        }
    }
    cout << dp[n][W] << endl;
    return 0;
}


Measured memory_bytes: 7032
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;
	int[] nums1;
	int[] nums2;
	
	void run() {
		Scanner sc = new Scanner(System.in);
		for(;sc.hasNext();) {
			nums1 = new int[51];
			nums2 = new int[51];
			int n = sc.nextInt();
			for(int i=0;i<10;i++) {
				for(int j=0;j<10;j++) {
					nums1[i+j]++;
					if( n-i-j>=0 )
						nums2[n-i-j]++;
					
				}
			}
			int cnt = 0;
			for(int i=0;i<51;i++) {
//				debug(nums1);
//				debug(nums2);
				cnt += nums1[i] * nums2[i];
			}
			System.out.println(cnt);
		}

	}

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

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}
}

Measured memory_bytes: 11000
r1, c1, r2, c2 = map(int, input().split())

MOD = 10 ** 9 + 7
N = r2 + c2 + 10
fact = [0 for _ in range(N)]
invfact = [0 for _ in range(N)]
fact[0] = 1
for i in range(1, N):
    fact[i] = fact[i - 1] * i % MOD

invfact[N - 1] = pow(fact[N - 1], MOD - 2, MOD)

for i in range(N - 2, -1, -1):
    invfact[i] = invfact[i + 1] * (i + 1) % MOD
def nCk(n, k):
    if k < 0 or n < k:
        return 0
    else:
        return fact[n] * invfact[k] * invfact[n - k] % MOD
        
ans = nCk(r2 + c2 + 2, r2 + 1) - nCk(r2 + c1 + 1, r2 + 1) \
    - nCk(r1 + c2 + 1, c2 + 1) + nCk(r1 + c1, r1)
print(ans % MOD)

Measured memory_bytes: 167188
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int K = scan.nextInt();
		int X = scan.nextInt();

		if(500 * K  >= X) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

		System.out.println();

	}
}

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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if((a==5&&b==5&&c==7)||(a==5&&b==7&&c==5)||(a==7&&b==5&&c==5)) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
import math
import bisect
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n = ni()
s = ns()
c = 0
for i in range(n-2):
    if s[i] == "A":
        if s[i+1:i+3]=="BC":
            c += 1
print(c)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
int LOG = 20;
int INF = 100000000;
int main(){
  int N;
  cin >> N;
  vector<int> p(N);
  for (int i = 0; i < N; i++){
    cin >> p[i];
  }
  vector<vector<int>> pp(LOG, vector<int>(N));
  for (int i = 0; i < N; i++){
    pp[0][i] = i + p[i];
  }
  for (int i = 1; i < LOG; i++){
    for (int j = 0; j < N; j++){
      pp[i][j] = pp[i - 1][pp[i - 1][j]];
    }
  }
  vector<int> next(N);
  for (int i = 0; i < N; i++){
    if (p[pp[LOG - 1][i]] != 0){
      next[i] = -1;
    } else {
      next[i] = pp[LOG - 1][i];
    }
  }
  vector<int> d(N, INF);
  d[0] = 0;
  queue<int> Q;
  Q.push(0);
  while (!Q.empty()){
    int x = Q.front();
    Q.pop();
    for (int i = 1; i <= 6; i++){
      int y = min(x + i, N - 1);
      if (next[y] != -1){
        if (d[next[y]] == INF){
          d[next[y]] = d[x] + 1;
          Q.push(next[y]);
        }
      }
    }
  }
  cout << d[N - 1] << endl;
}


Measured memory_bytes: 11988
#include <iostream>
#include <algorithm>
#include <vector>
#include <complex>
#include <set>
#include <map>
#include <string>

using namespace std;

long mod = 1000000007;
bool isValid(int i)
{
    int before = 0;
    for(int j=0; j<7; j++)
    {
        if(before == 1 && (i & (1 << j)))
        {
            return false;
        }
        before = (i & (1 << j)) > 0;
    }

    return true;
}

int main() {
    int h, w, k;
    cin >> h; cin >> w; cin >> k;

    long dp[101][9] = {};
    dp[0][1] = 1;

    for(int i=0; i<h; i++)
    {
        for(int j=1; j<=w; j++)
        {
            if(dp[i][j] > 0)
            {
                for(int l=0; l<1<<(w-1); l++)
                {
                    if(isValid(l))
                    {
                        if(j-2 >=0 && (l & (1 << (j-2))))
                        {
                            dp[i+1][j-1] = (dp[i+1][j-1] + dp[i][j]) % mod;
                        }
                        else if(j-1 >= 0 && (l & (1 << (j-1))))
                        {
                            dp[i+1][j+1] = (dp[i+1][j+1] + dp[i][j]) % mod;
                        }
                        else
                        {
                            dp[i+1][j] = (dp[i+1][j] + dp[i][j]) % mod;
                        }
                    }
                }
            }
        }
    }

    cout << dp[h][k] << endl;

    return 0;
}


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

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

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

const int N = 1e5 + 5;
int n, m, k, ans;
unordered_set<string> seen;
string s, p;

int main() {
    bool ok = true;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> s;
        if (seen.count(s)) {
            ok = false;
        }
        seen.insert(s);
        if (i > 0) {
            if (s[0] != p.back()) {
                ok = false;
            }
        }
        p = s;
    }
    if (ok)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3648
# -*- coding: utf-8 -*-
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
import copy
import math
sys.setrecursionlimit(10**6)

# lis_of_lis = [[] for _ in range(N)]


def zz(): return list(map(int, sys.stdin.readline().split()))


def z(): return int(sys.stdin.readline())


def S(): return sys.stdin.readline()[:-1]


def C(line): return [sys.stdin.readline() for _ in range(line)]

# a,bの最大公約数


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

# a,bの最小公倍数


def lcm(a, b):
    return a * b // gcd(a, b)


def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]


max_a = pow(10, 6)+5
N = z()
A = zz()
pari_flg = True

set_flg = True
count = [0]*max_a
for i in range(N):
    count[A[i]] += 1
for i in range(2, max_a):
    c = 0
    for j in range(i, max_a, i):
        c += count[j]
        if (c > 1):
            pari_flg = False
res = A[0]
for a in A:
    res = math.gcd(res, a)
if (res != 1):
    set_flg = False

if (pari_flg):
    print('pairwise coprime')
elif (set_flg):
    print('setwise coprime')
else:
    print('not coprime')


Measured memory_bytes: 186028
import sys
import math

N = 1000000
primes = [1] * (N//2)
primes[0] = 0

for i in (x for x in range(3,int(math.sqrt(N)),2) if primes[x//2]):
    primes[(i*i)//2::i] = [0] * len(primes[(i*i)//2::i])

for i in sys.stdin:
    n = int(i)
    if n == 1:
        print(0)
    elif n == 2:
        print(1)
    else:
        print(sum(primes[0:(n+1)//2])+1)

Measured memory_bytes: 16956
/*
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_8_D
 */
#include <iostream>
#include <string>

using namespace std;

int
main()
{
  ios::sync_with_stdio(false);

  string s, p;
  getline(cin, s);
  s += s;
  getline(cin, p);

  size_t found = s.find(p);
  cout << (found == string::npos ? "No" : "Yes") << endl;

  return 0;
}

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

using namespace std;
using ll=long long;
using vi=vector<int>;
using vl=vector<ll>;
using vs=vector<string>;

#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define repr(i, a, n) for (int i = (n); i >= (a); --i)

template<typename T,typename U>
void Inparray(T &f,U n){
  for(int i=0;i<n;i++) cin>>f[i];
}

template<typename T,typename U>
void Printarray(T f,U n){
  for(int i=0;i<n;i++) i!=n ? cout<<f[i]<<" " : cout<<f[i];
}

void flagfunc(bool flag,string A,string B){
  flag ? cout<<A<<endl : cout<<B<<endl;
}

void flag2func(bool flag){
  flag ? cout<<"Yes"<<endl : cout<<"No"<<endl;
}

void flag3func(bool flag){
  flag ? cout<<"YES"<<endl : cout<<"NO"<<endl;
}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int x,a,b;cin>>x>>a>>b;
  b-a<=0 ? cout<<"delicious"<<endl : b-a<=x ? cout<<"safe"<<endl : cout<<"dangerous"<<endl;
}


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

int main () {
    string S;
    cin >> S;
    
    int pri = 700;
    
    if (S.at(0) == 'o') pri+=100;
    if (S.at(1) == 'o') pri+=100;
    if (S.at(2) == 'o') pri+=100;
    
    cout << pri << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include <string>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include<bits/stdc++.h>
#include <set>
#define ll   long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#define inf 0x3f3f3f
#define pi 3.1415926535898
using namespace std;
const int N=2e5+10;
const int mod=1e9+7;
int a[505];
int b[505];

int main()
{
    int n,k;
    cin>>n>>k;
    int ans=-inf;
    for(int i=1; i<=n; i++)
    {
        cin>>a[i];
    }
    for(int l=0; l<=n; l++)
    {
        for(int r=n+1; r>l; r--)
        {
            int cnt=0,sum=0;
            for(int i=1; i<=l; i++)
            {
                b[++cnt]=a[i];
            }
            for(int i=n; i>=r; i--)
            {
                b[++cnt]=a[i];
            }
            if(k<cnt)
                continue;
            sort(b+1,b+1+cnt);
            for(int i=cnt; i>=0; i--)
            {
                if(i<=k-cnt)
                    sum+=max(b[i],0);
                else
                    sum+=b[i];
            }
            ans=max(ans,sum);

        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=1e9+7;
const int INF=2e9;
const double PI=acos(-1);


int main() {
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<ll> a(n);
    ll ans=1000;
    rep(i,n) cin >> a[i];
    rep(i,n-1) {
        if (a[i]<a[i+1]) {
            ll j=ans/a[i];
            ans+=(a[i+1]-a[i])*j;
        }
    }
    cout << ans << endl;
    
    return 0;   
}

Measured memory_bytes: 3644
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<math.h>
#include<utility>

#define lli long long
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define rep0(i,j) for(int i=0;i<j;i++)
#define rep1(i,j) for(int i=1;i<=j;i++)
#define rep0d(i,j) for(int i=j-1;i>=0;i--)
#define MAX 1000000007
int a[2001][2001];
using namespace std;


int main() {
	lli n,d,a,ans=0;
	double m;
	cin >>n>>d;
	vector<vector<lli>> vec(n);
	rep0(i,n)rep0(j,d){
		cin >> a;
		vec[i].push_back(a);
	}
	
	rep0(i,n)for(int j=i+1;j<n;j++){
		m=0;
		rep0(k,d){
			m+=pow((vec[i][k]-vec[j][k]),2);
		}
		a=(lli)sqrt(m);
		
		if(a*a==(lli)m)ans++;
	}
	cout << ans;
}


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

int N, M;
unordered_map <string, int> mp;


int main(){
	int i;
	string a, b;
	scanf("%d", &N);
	cin >> a;
	mp[a] = 1;
	for(i = 1; i < N; i++){
		cin >> b;
		if(mp[b]){ printf("No"); return 0; }
		if(a.back() != b[0]){ printf("No"); return 0; }
		mp[b] = 1;
		a = b;
	}
	printf("Yes");
	return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>                          //include all library
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <string.h>
#include <functional> // greater<int> はfunctionalヘッダ
using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)          //REP(i, 10){...} //i=0～i=9までのループ
#define REPR(i, n) for(int i = n;i >= 0;i--)        //REPR(i, 10){...} //i=10～i=0までのループ
#define FOR(i, m, n) for(int i = m;i < n;i++)       //FOR(i, 3, 10){...} //i=3～i=9までのループ
#define FORR(i, m, n) for(int i = m;i >= n;i--)     //FORR(i, 10, 3){...} //i=10～i=3までのループ
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
#define PI 3.141592653589
#define npos -1


int main(){
	int N;
	cin >> N;
	pair<pair<string, int>, int> P[N];
	string s;
	int p;

	for(int i=0; i<N; i++){
		cin >> s >> p;
		P[i] = make_pair(make_pair(s, -p), i+1);
	}

	sort(P, P+N);

	for(int i=0; i<N; i++) cout << P[i].second << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		String s = sc.next();
		if (s.length() <= k) {
		    System.out.println(s);
		} else {
		    System.out.println(s.substring(0, k) + "...");
		}
	}
}
 

Measured memory_bytes: 38592
#include "bits/stdc++.h"

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);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;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int X, Y; cin >> X >> Y;

	Yes((Y - 2 * X) >= 0 and (Y - 2 * X) % 2 == 0 and (Y - 2 * X) / 2 <= X);

	return 0;
}


Measured memory_bytes: 3652
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>

using namespace std;

typedef  long long int lint;

#define rep(i, n) for (lint i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define mp make_pair
#define enld endl

int main() {
	string S;
	cin >> S;
	string a, b, c;
	a = S.substr(0, 5);
	b = S.substr(6, 7);
	c = S.substr(14, 5);
	cout << a << ' ' << b << ' ' << c << endl;
}

Measured memory_bytes: 3544
#include <iostream>
#include <algorithm>
#include <functional>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

int n, k;
int l[50];

int main() {
	int i;
	
	cin >> n >> k;
	rep(i, n) cin >> l[i];
	sort(l, l + n, greater<int>());
	
	int lsum = 0;
	rep(i, k) lsum += l[i];
	cout << lsum << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#define pi acos(-1)

using namespace std;

int main() {
  double r,ans;
  while(scanf("%lf", &r) != EOF) {
   ans = 2.0 * pi * r;
   printf("%lf\n", ans);
  }
  return 0;
}
  

Measured memory_bytes: 3784
A,B,C,X,Y=map(int, input().split())
if A+B<=C:
    print(X*A+Y*B)
else:
    ab=min(X,Y)*C*2
    if X>=Y:
        mod=min((X-Y)*A,(X-Y)*2*C)
    else:
        mod=min((Y-X)*B,(Y-X)*2*C)
    print(min(ab+mod,A*X+B*Y))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define pt pop_front
#define pk pop_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
template<class T> T count_bit(T p){
  if(typeid(p)==typeid(int))return __builtin_popcount(p);
  else if(typeid(p)==typeid(long))return __builtin_popcountl(p);
  else return __builtin_popcountll(p);
}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}

inline void solve(void){
  long a,b,c;
  in(a,b,c);
  if((a-b)>c)out(0);
  else out(c-(a-b));
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
#ifdef _MSC_VER
#include <__msvc_all_public_headers.hpp>
#undef min
#undef max
#else
#define NDEBUG
#include <bits/stdc++.h>
#endif

using namespace std;
using large = long long;

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

    cout << lcm(x, 360) / x << endl;
    return 0;
}


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

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

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

int n,ans=0;
void dfs(ll x,bool flag3,bool flag5,bool flag7){
    if(x>n)return;//打ち切り
    if(flag3 && flag5 && flag7)ans++;
    dfs(10*x+3,true,flag5,flag7);
    dfs(10*x+5,flag3,true,flag7);
    dfs(10*x+7,flag3,flag5,true);
}

int main(){
    cin >> n;
    ll res = 0;
    dfs(0,0,0,0);
    COUT(ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(vec) vec.begin(), vec.end()
#define tmax(x,y,z) max((x),max((y),(z)))
#define tmin(x,y,z) min((x),min((y),(z)))
typedef long long ll;ll MM = 1000000000;ll mod = MM + 7; ll MMM=9223372036854775807;//2^63 -1
ll GCD(ll x, ll y) {if (y == 0) return x;else return GCD(y, x % y);}
ll LCM(ll x, ll y) { return x / GCD(x, y) * y;}
//cout << fixed << setprecision(10);

int main(){
 string s; cin>>s;
  ll ans=0,cnt=0,n=s.size()+1;
  vector<ll>r(n),l(n);
  char t=s[0];
  for(ll i=0;i<n-1;i++){
  if(s[i]=='<'){
    cnt++; r[i+1]=cnt;
  }
    else{
    cnt=0;
    }
  }
  for(ll i=n-2;i>=0;i--){
  if(s[i]=='>'){
    cnt++; l[i]=cnt;
  }
    else{
    cnt=0;
    }
  }
  rep(i,n){
  ans+=max(r[i],l[i]);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 8708
a, b, c, d = map(int, input().split())
row = [0 for i in range(101)]
for i in range(a, b+1) : row[i] += 1
for i in range(c, d+1) : row[i] += 1
if row.count(2) == 0 : print(0)
else : print(row.count(2)-1)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
typedef int64_t ll;
using namespace std;
 
int main() {

  string A,B,C;

  cin >> A >> B >> C ;//入力終了

  int a=(int)(A.at(0)-'a'),b=(int)(B.at(0)-'a'),c=(int)(C.at(0)-'a');//A,B,Cの三つの文字列の先頭を'a'基準とした数値に変換

  string ans={(char)(a+'A'),(char)(b+'A'),(char)(c+'A')};
 
  cout << ans << endl;

  return 0;

}

Measured memory_bytes: 256
#include <stdio.h>

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

Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>
#define min(p,q)((p)<(q)?(p):(q))

double p[510],q[510];
double ps[510],qs[510];
double dp[510][510];

double f(int l,int r){
	//d[l-1],k[l],d[l+1],...,k[r],d[r]の最適配置
	if(dp[l][r])return dp[l][r];
	//pは[l,r]、qは[l-1,r]
	double s=ps[r+1]-ps[l]+qs[r+1]-qs[l-1];
	if(s==0)return 0;
	if(l>r)return 1;
	double ans=1e9;
	for(int i=l;i<=r;i++){
		double left =(ps[i  ]-ps[l  ]+qs[i  ]-qs[l-1])/s;
		double right=(ps[r+1]-ps[i+1]+qs[r+1]-qs[i  ])/s;
		ans=min(ans,left*f(l,i-1)+right*f(i+1,r)+1);
	}
	return dp[l][r]=ans;
}

int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%lf",p+i);
		ps[i+1]=ps[i]+p[i];
	}
	for(int i=0;i<=n;i++){
		scanf("%lf",q+i);
		qs[i+1]=qs[i]+q[i];
	}
	printf("%f\n",f(1,n));
}


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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q>
ostream& operator << (ostream& os, pair<P, Q> p)
{
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  lli a, b, n;
  while (cin >> n >> a >> b) {
    cout << min(b, a * n) << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import javax.print.attribute.SupportedValuesAttribute;
import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
import java.util.function.Predicate;

public class Main{
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(in, out);
        out.close();
    }

    static class TaskB {


        public static int binarySearch(int arr[], int low, int high, int key)
        {
            int mid = (low + high)/2;
            while( low <= high )
            {
                if ( arr[mid] < key )
                {
                    low = mid + 1;
                }
                else if ( arr[mid] == key )
                {
                    return mid;
                }else
                {
                    high = mid - 1;
                }
                mid = (low + high)/2;
            }
            if( low > high )
            {
                return -1;
            }
            return -1;
        }

        public static int[][] maxPos;

        public void solve(InputReader in, PrintWriter out) {
            int n = in.nextInt();
            for(int i = 1; i <=360; i++)
            {
                if((n*i)%360==0)
                {
                    out.println(i);
                    break;
                }
            }
        }
    }


    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer tokenizer = new StringTokenizer("");

        public InputReader(InputStream inputStream) {
            this.reader = new BufferedReader(
                    new InputStreamReader(inputStream));
        }

        public String next() {
            while (!tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return tokenizer.nextToken();
        }

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

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

    }
}

Measured memory_bytes: 32844