akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
using namespace __gnu_pbds;
typedef tree<pair<ll,pair<ll,ll> >, null_type, less<pair<ll,pair<ll,ll> > >, rb_tree_tag, tree_order_statistics_node_update>ordered_set;
#define me BOSS
#define bug() cout<<"AIkahne aise"<<endl
#define PI acos(-1)
/* Precode Start Here *\
     Sieve
void sieve()
{
    for(ll i=3; i<=2000; i+=2)
    {
        for(ll j=i*i; j<=4000000; j+=i)
            A[j]=1;
    }
    v.push_back(2);
    for(ll i=3; i<=4000000; i+=2)
        if(A[i]==0)
            v.push_back(i);
}

     Power Function Modulo P

ll modPow(ll a, ll x, ll p) {
    //calculates a^x mod p in logarithmic time.
    long res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}


   factorial

ll fact(ll n)
{
    ll ans=1;
    for(ll i=1;i<=n;i++)
    {
        ans=(ans*i)%mod;
    }
    return ans;
}
     Calculating nCr using Fermats law Theorem

ll modInverse(ll a, ll p) {
    //calculates the modular multiplicative of a mod m.
    //(assuming p is prime).
    return modPow(a, p-2, p);
}


ll modBinomial(ll n, ll k, ll p) {
// calculates C(n,k) mod p (assuming p is prime).

    ll numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (ll i=0; i<k; i++) {
        numerator = (numerator * (n-i) ) % p;
    }

    ll denominator = 1; // k!
    for (ll i=1; i<=k; i++) {
        denominator = (denominator * i) % p;
    }

    // numerator / denominator mod p.
    return ( numerator* modInverse(denominator,p) ) % p;
}
     num of divisor and euler totient

ll phi[1000001],mark[1000001],divi[1000001];;
void divisorPhi(ll n)
{
    for(int i=1;i<=n;i++)
        phi[i]=i;
    for(int i=2;i<=n;i++)
    {
        if(!mark[i])
        {
            for(int j=i;j<=n;j+=i)
            {
                mark[j]=1;
                phi[j]*=(1-1/(double)i);
            }
        }
    }
    for(ll i=1;i<=n;i++)
    {
        for(ll j=i;j<=n;j+=i)
            divi[j]++;
    }
}
/* Precode Ends */
#define mod 1000000007
ll A[5000001],B[5000001];
vector<ll>v;
map<ll,ll>myMap;
set<ll>mySet;
vector<pair<ll,ll> >vp;
priority_queue<ll> pq;
priority_queue<ll, vector<ll>, std::greater<ll> > first;
ll po(ll a,ll n)
{
    ll ans=1;
    for(int i=1; i<=n; i++)
        ans*=a;
    return ans;
}

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

    ll n,k,q,ans=0;
    cin>>n>>k;
    ll a;
    for(int i=1;i<=k;i++)
    {
        cin>>a;
        while(a--)
        {

            ll b;
            cin>>b;
            myMap[b]++;
        }
    }
    for(int i=1; i<=n; i++)
    {
        if(myMap[i]==0)
            ans++;
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin(), v.end()
bool chmin(ll & a, ll  b) { if (b < a) { a = b; return 1; } return 0; }
bool chmax(ll & a, ll b) { if (b > a) { a = b; return 1; } return 0; }
const ll INF = 999999999999999;
const ll MOD = 1000000007;
const ll MAX_N=500010;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans;
int main() {
	p=INF;
    cin>>h>>w>>t;
    string s[10];
    ll dp[10];
    rep(i,h){
        cin>>s[i];
    }

            
 
    rep(i,(1<<h-1)){
        rep(j,h){
            dp[j]=0;
        }
        ans=0;
         vl A;
         vl C;
         C.push_back(-INF);
        A.push_back(0);
            rep(k,h-1){
                if((1<<k)&i)A.push_back(k+1);
            }
        A.push_back(h);
 
        rep(j,w){
        	next2:
            vl B;
            B.push_back(0);
            rep(k,h){
                dp[k]+=s[k][j]-'0';
                B.push_back(B.back()+dp[k]);
            }
            
       
 
 
            rep(k,A.size()-1){
                if(B[A[k+1]]-B[A[k]]>t){
                	ans++;
                    rep(k,h){
                        dp[k]=0;
                    }
                    if(C.back()==j)goto next;
                    
                    C.push_back(j);
                    goto next2;
                }
            }

        }
 
        rep(k,h-1){
            if((1<<k)&i)ans++;
        }
 
        p=min(p,ans);
        next:q=1;
    }
 
    cout<<p<<endl;
}

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

#ifndef bhartiya
    #pragma GCC optimize("Ofast")
    #pragma GCC optimize("unroll-loops")
    // #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif


typedef long long ll;
typedef pair<ll, ll> pll;
typedef gp_hash_table<long long, long long> umap;
typedef tree<int, null_type, less<int>, rb_tree_tag,
		tree_order_statistics_node_update> oset;
// not that imp
typedef pair<pll, ll> plll;
typedef vector<ll> vl;
typedef vector<pll> vll;

#define inf 200000000000000ll
#define mod 1000000007ll
#define eps 1e-7
#define PI 3.1415926535897932385
// #define PI acos(-1)

#define pb push_back
#define bitc  __builtin_popcountll
#define mp make_pair
#define ff first
#define ss second
#define all(ar) ar.begin(), ar.end()

#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define frr(i,a,b) for (ll i = (a), _b = (b); i >= _b; i--)
#define foreach(it,ar) for (auto it = ar.begin(); it != ar.end(); it++)
#define fill(ar,val) memset(ar, val, sizeof(ar))

#ifdef bhartiya
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; return 0;
#else
#define endl '\n'
#define trace(...)
#define end_routine() return 0;
#endif

mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
inline bool equals(double a, double b) {return fabs(a - b) < 1e-9;}
ll gcd(ll a, ll b){ return b==0 ? a : gcd(b, a%b); }

const ll maxn = 500005;

void solve(){
    ll n;cin>>n;
    vll work;
    ll curr = 0;
    rep(i,n){
        ll time,deadline;
        cin>>time>>deadline;
        work.pb(mp(deadline,time));
    }
    sort(all(work));
    rep(i,n){
        if(work[i].ss + curr > work[i].ff){
            cout<<"No";
            return;
        }
        curr += work[i].ss;
    }
    cout<<"Yes";
}

int main() 
{ 
	ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0), cout.precision(10); //cout<<fixed;
    cin.exceptions(cin.failbit);
    #ifdef bhartiya
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    solve();
    end_routine();
}

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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
const ll INF = 10e16;
const int maxN = 200010;
const int maxD = 15;
const int maxH = 100; 
const int MOD = 1000000007;


vector<string> ans;
vector<int> p;


int n,m;
int a[maxN];
int b[maxN];
int main()
{
	scanf("%d",&n);
	for(int i=2;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	for(int i=2;i<=n;i++)
	{
		b[a[i]]++;
	}
	for(int i=1;i<=n;i++)
	{
		printf("%d\n",b[i]);
	}
	return 0;
}

Measured memory_bytes: 5388
/* Author: shivangi0802 */

#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define pb push_back
#define ll long long int
#define mod 1000000007
#define f(i,n) for(int i=0;i<n;i++)

using namespace std;

bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b);
 ll gcd(ll a, ll b) ;
 int prime(int n);



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

    ll n,k;
    cin>>n>>k;

    vector<ll> h(n),d(n,INT_MAX);

for(int i=0;i<n;i++){
    cin>>h[i];
}
d[0]=0;
for(int i=1;i<n;i++){
    for(int j=max(0LL,i-k);j<i;j++){
        d[i]=min(d[i],d[j]+abs(h[i]-h[j]));
    }
}
cout<<d[n-1];
}




bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
}
ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
int prime(int n){
    int flag=1;
for(int i=2;i<=sqrt(n);i++){
    if(n%i==0){flag=0;break;}
}
  return flag;
}



Measured memory_bytes: 1792
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
}

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

type Music struct {
	Name string
	Time int
}

func main() {
	var n int
	fmt.Scanf("%d", &n)

	playlist := make([]*Music, n) // [<nil> <nil> <nil>]
	for i := 0; i < n; i++ {
		var name string
		var time int
		fmt.Scanf("%s %d", &name, &time)
		playlist[i] = &Music{
			Name: name,
			Time: time,
		}
	}

	var x string
	fmt.Scanf("%s", &x)

	total := 0
	start := false
	for _, music := range playlist {
		if start {
			total += music.Time
		}
		if music.Name == x {
			start = true
		}
	}

	fmt.Printf("%d", total)
}


Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vl vector<LL>
#define vii vector<vi>
#define vll vector<vl>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;

int main(){
	int x;
    cin>>x;
    int t=x/500;
    int tt=x-t*500;
    cout<<t*1000+tt/5*5;
}


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

int main(){
  int g, p, w, y;
  int a, b, c, d;
  g = 0;
  p = 0;
  w = 0;
  y = 0;
  int n;
  cin >> n;
  int s = 0;
  char k;
  for(int i = 0; i < n; i++){
    cin >> k;
    if(k == 'G') g++;
    if(k == 'P') p++;
    if(k == 'W') w++;
    if(k == 'Y') y++;
  }
  if(g != 0) s++;
  if(p != 0) s++;
  if(w != 0) s++;
  if(y != 0) s++;

  if(s == 1) cout << "One";
  if(s == 2) cout << "Two";
  if(s == 3) cout << "Three";
  if(s == 4) cout << "Four";
  cout << endl;
}

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

int main()
{
	string s;
	cin >> s;
	int n = s.size();
	int cnt[2]={};
	for(int i = 0;i<n;i++)
	{
		cnt[s[i]-'0']++;
	}
	cout<<min(cnt[0],cnt[1])*2<<endl;
	return 0;
}


Measured memory_bytes: 512
import java.util.*
import java.util.ArrayDeque



fun main(args: Array<String>) {
    val sc = java.util.Scanner(System.`in`)
    val h = sc.nextInt()
    val w = sc.nextInt()

    val m = sc.asSequence().take(h).map {
        it.toCharArray().map { if (it == '#') 99999 else 0 }.toMutableList()
    }.toMutableList()

    var wall = 1
    var maxmax = 0
    (0 until h).forEach { y ->
        (0 until w).forEach { x ->
            wall++
            // 始点は x, y
            if (m[y][x] != 99999) {

                val start = Point(x, y)
                val dq = ArrayDeque<Point>()
                dq.add(start)

                val moves = Array(h) { IntArray(w) }
                var max = 0

                //スタート地点を"#"で埋めて、探索済みにする
                m[start.y][start.x] = wall

                val D4 = arrayOf(Point(0, 1), Point(1, 0), Point(0, -1), Point(-1, 0))

                //幅優先探索
                while (dq.size > 0) {

                    //Queueの先頭の座標を取り出し＆削除して、その四方を探索する。
                    val p = dq.removeFirst()

                    for (i in 0..3) {

                        val x = p.x + D4[i].x
                        val y = p.y + D4[i].y

                        if (x >= 0 && y >= 0 && x < w && y < h && m[y][x] < wall) {

                            //"."であれば探索可能なので、Queueの末尾に追加する
                            dq.addLast(Point(x, y))

                            //探索が終わった座標を"#"で埋めて、次回以降探索しないようにする
                            m[y][x] = wall

                            //座標pからpの四方の座標への移動距離は、pまでの移動距離+1
                            val m = moves[p.y][p.x] + 1
                            moves[y][x] = m
                            max = Math.max(max, m)
                        }

                    }

                }
                maxmax = Math.max(max, maxmax)

            }
        }
    }
    print(maxmax)
}

data class Point(val x: Int, val y: Int)

Measured memory_bytes: 38788
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll h[200001],dp[200001];
void DP(ll n)
{
    ll x,y,i;
    dp[n-1]=abs(h[n]-h[n-1]);
    //printf("dp[%lld]=%lld\n",n-1,dp[n-1]);
    for(i=n-2;i>=1;i--)
    {
        x=dp[i+1];
        //printf("x=%lld\n",x);
        y=dp[i+2];
        //printf("y=%lld\n",y);
        dp[i]=min(x+abs(h[i]-h[i+1]),y+abs(h[i]-h[i+2]));
        //printf("dp[%lld]=%lld\n",i,dp[i]);
    }
}
int main()
{
    ll n,i;
    scanf("%lld",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%lld",&h[i]);
    }
    DP(n);
    printf("%lld\n",dp[1]);
    return 0;
}


Measured memory_bytes: 1792
program main
	implicit none
    integer a, b, c, k, i
    read(*,*)a, b, c, k
    if (a>=k) then
    	write(*,*)k
    else if (a+b>=k) then
    	write(*,*)a
    else
    	i = a-(k-a-b)
        write(*,*)i
	end if
end program main

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

ll divisor=1e9+7;
int main(){
	ll n,k;
	cin>>n>>k;
	ll count=0;
	for(int i=k;i<n+2;i++){
		count+=(n-i+1)*i+1;
		count%=divisor;
	}
	puts(count);

}


Measured memory_bytes: 3636
using System;

namespace Project
{
	class MainClass
	{
		public static void Main(string[] args)
		{
			string str = Console.ReadLine();
			string S = str.ToUpper();
			string s = str.ToLower();
			char[] c = new char[str.Length];
			for (int i = 0; i < str.Length; i++)
			{
				if (str[i] != S[i]) { c[i] = S[i]; }
				else
				{
					if (str[i] != s[i]) { c[i] = s[i]; }
					else { c[i] = str[i]; }
				}
			}
			for (int i = 0; i < str.Length; i++)
			{
				Console.Write(c[i]);
			}
			Console.Write("\n");
		}
	}
}

Measured memory_bytes: 9012
from collections import Counter
n = int(input())
A = list(map(int, input().split()))
C = Counter(A)
ans = 1
for c in C.keys():
    for i in range(-1, 2):
        j = c + i
        ans = max(ans, sum([C[j - 1], C[j], C[j + 1]]))
print(ans)

Measured memory_bytes: 61228
#include <bits/stdc++.h>
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(int i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(int i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;

const ll INF=(1LL<<50);

template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}

const string YES = "Yes";
const string NO = "No";
map<char,int> a;
void add(map<char,int> &a,char b){
  if(a.count(b)){
    ++a[b];
  }else{
    a[b]=1;
  }
}
void solve(std::string S){
  for (auto &&i : S)
  {
    add(a,i);
  }
  if(a.size()==2){
    for (auto &&j : a)
    {
      if(j.second!=2){
        goto no;
      }
    }
  }else{
    goto no;
  }
  cout<<YES<<endl;
  return;
  no:
  cout<<NO<<endl;
  return;
}

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
from collections import deque
def A(a):
    x=a.popleft()
    return x,a
def B(b):
    x=b.popleft()
    return x,b
def C(c):
    x=c.popleft()
    return x,c
Sa=list(input())
Sb=list(input())
Sc=list(input())
a=deque(Sa)
b=deque(Sb)
c=deque(Sc)
x=a.popleft()

#print(a,b,c,x)
while True:

    if x=="a":
        if len(a)==0:
            print("A")
            exit()
        x,a=A(a)
    elif x=="b":
        if len(b)==0:
            print("B")
            exit()
        x,b=B(b)
    elif x=="c":
        if len(c)==0:
            print("C")
            exit()
        x,c=C(c)
    #print(a,b,c,x)
    


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

#define _ << " " <<
#define tr(x) cout << #x _ x << endl
#define fi first
#define se second

#ifdef _WIN32
#define LD "%I64d"
#else
#define LD "%ld"
#endif

using namespace std;

typedef long long ll;

int n, k, x, y;

int read() {
    if (scanf("%d %d %d %d", &n, &k, &x, &y) < 4) {
        return 0;
    }
    return 1;
}

void solve() {
    int total = 0;
    while (n--) {
        if (k-- > 0) 
            total += x;
        else 
            total += y;
    }
    printf("%d\n", total);
}

int main(int argc, char *argv[]) {
    while (read()) {
        solve();
    }
}


Measured memory_bytes: 256
def seive(num,n):
    li=[True]*(n+1)
    x=2
    li[0]=False
    li[1]=False
    while x*x<n:
        if li[x]:
            for i in range(x*x,len(li),x):
                
                li[i]=False
                
        x+=1
        
        
    for i in range(num,len(li)):
        if li[i]:
            return i
num=int(input())
print(seive(num,1000000))

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

int main() {
  int T;
  cin >> T;
  while(T--) {
    int n;
    string s;
    cin >> n >> s;
    bool a[2][n+1];
    memset(a,0,sizeof(a));
    for(int i=0; i<4*n; i++) {
      if(i<2*n) a[0][(i+1)/2]|=s[i]=='Y';
      else a[1][(i+1-2*n)/2]|=s[i]=='Y';
    }
    int x=1<<29,y=0;
    for(int i=0; i<2; i++) {
      for(int j=0; j<n+1; j++) {
        if(a[i][j]) {
          x=min(x,j);
          y=max(y,j);
        }
      }
    }
    int ans=n;
    for(int j=x+1; j<y; j++) {
      for(int i=0; i<2; i++) {
        if(a[i][j]) ans++;
      }
    }
    if(a[1][x]) ans+=2;
    else if(a[0][x]) ans++;
    if(a[1][y]) ans+=2;
    else if(a[0][y]) ans++;
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1332
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import _collections
import string

class cin():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def mapInt():
        return [int(x) for x in cin.string().split()]
    def stringList(n):
        return [input() for i in range(n)]
    def intListList(n):
        return [cin.mapInt() for i in range(n)]
    def intColsList(n):
        return [int(input()) for i in range(n)]

class Util():
    def roundUp(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Util.round_up(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x
class Math():
    def gcd(a,b):
        if b == 0:
            return a
        return Math.gcd(b,a % b)

def main():
    N = cin.int()
    A = cin.mapInt()
    ans = A[0]
    for i in range(1,N):
        ans = Math.gcd(ans,A[i])
    print(ans)
    return

if __name__ == "__main__":
    main()


Measured memory_bytes: 62960
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int K=sc.nextInt();
		int S=sc.nextInt();
		int count=0;
		for(int p=0;p<=K;p++) {
			for(int q=0;q<=K;q++) {
				if(S-p-q<=K&&0<=S-p-q) {
					count++;
				}
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 35628
#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, k;
  cin >> n >> k;
  vector<int> p(n);
  rep(i, n) cin >> p[i];
  sort(p.begin(), p.end());
  int ans = 0;
  rep(i, k) ans += p[i];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3628
#include "bits/stdc++.h"
using namespace std;

double PI = 3.14159265359879323846;

void calc(double r, double xx, double& x, double& y)
{
	x = r * cos(xx);
	y = r * sin(xx);
}

int main()
{
	double a, b, h, m;
	cin >> a >> b >> h >> m;

	double x_h = (30 * h + 0.5 * m) * PI / 180;
	double hx, hy;
	calc(a, x_h, hx, hy);
	double x_m = (6 * m) * PI / 180;
	double mx, my;
	calc(b, x_m, mx, my);

	double ans = sqrt(pow(hx - mx, 2) + pow(my - hy, 2));
	cout << fixed << setprecision(12) << ans << endl;
}


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

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, n, m) for (int i = n; i < m; i++)
#define ll long long int

using namespace std;

int size = 1e5 + 1;
int main() {
  int n;
  int h[size];
  int dp[size]; //dp[i]は足場iにたどり着くのに必要な最小コスト

  cin >> n;
  h[0] = -1000000;
  REP(i,n) {
    cin >> h[i+1];
  }

  dp[0] = 0;
  dp[1] = 0;
  REP(i, n+1) {
    if (i == 0 || i == 1) continue;

    dp[i] = min(dp[i - 1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]));
  }

  cout << dp[n] << endl;

}


Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main (){
  string s;
  cin >> s;
  int l = s.length();
  int i;
  for(i=0;i<l-1;i++){
      if(s[i]==s[i+1]){
          cout<<"Bad\n";
          return 0;
      }
  }
  cout <<"Good\n";
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <numeric>
#include <cmath>
#include <iomanip> //cout << fixed << setprecision(15) << << endl;
#include <cassert>
//#include "atcoder/all"

using namespace std;
//using namespace atcoder;

typedef long long ll;

#define pb push_back
#define rep(i, n) for(int i=0;i<(n);i++)
#define REP(i, n) for(int i=1;i<=(n);i++)
#define P pair<int,int>
template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

int mx8[] = {0, 0, 1, -1, -1, 1, -1, 1};
int my8[] = {-1, 1, 0, 0, -1, -1, 1, 1};
int mx4[] = {1, -1, 0, 0};
int my4[] = {0, 0, -1, 1};

const int MOD = 1000000007;

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

    string s;
    cin >> s;
    int m=0;

    int n = s.size();
    int a = 0;
    rep(i, n) {
        a += int(s[i])-48;
        m += pow(10,n-i-1) * (int(s[i])-48);
    }

    if(m % a == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 4004
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
using namespace std;
int main(void){
    char a[3];
    cin >> a;

    int count = 0;
    for( int i = 0; i < 3; i++ ){
        if( a[i] == '1'){
            count++;
        }
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
typedef long long ll;
#define vint vector<int>
#define vstring vector<string>
#define vll vector<ll>

int gcm(int a,int b);

int main(){
  string s;
  cin >> s;
  int ans = 0;
  int have0 = 0;
  int have1 = 0;
  rep(i,s.size()){
    if(s[i] == '0' && have1){
      ans += 2;
      have1--;
    }
    else if(s[i] == '1' && have0){
      ans += 2;
      have0--;
    }
    else if(s[i] == '1' && !(have0)){
      have1++;
    }
    else if(s[i] == '0' && !(have1)){
      have0++;
    }
    //cout << have0 << ' ' << have1 << endl;
  }
  cout << ans << endl;
}

int gcm(int a,int b){
  if(a < b) swap(a,b);
  if(b == 0) return a;
  return gcm(a%b,b);
}

//i番目までにはいくつ入ってる、っていう配列を作って
//それを参照するようにしたらいけそう 

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

int main() {
  vector<vector<int> > bingo(3, vector<int> (3));
  for(int i=0; i<3; i++){
    cin >> bingo[i][0] >> bingo[i][1] >> bingo[i][2];
  }
  int N;
  cin >> N;
  int b;
  for(int i=0; i<N; i++){
    cin >> b;
    for(int j=0; j<3; j++){
      for(int k=0; k<3; k++){
        if(b==bingo[j][k]){
          bingo[j][k] = -1;
        }
      }
    }
  }
  int flag = 0;
  for(int i=0; i<3; i++){
    if(bingo[i][0] == -1 && bingo[i][1] == -1 && bingo[i][2]==-1) {flag=1; break;}
    if(bingo[0][i] == -1 && bingo[1][i] == -1 && bingo[2][i]==-1) {flag=1; break;}
  }
  if(bingo[0][0]==-1 && bingo[1][1]==-1 && bingo[2][2] ==-1)flag = 1;
  if(bingo[0][2]==-1 && bingo[1][1]==-1 && bingo[2][0] ==-1)flag = 1;

  if(flag == 1) cout << "Yes"<<endl;
  if(flag==0) cout << "No"<<endl;

  return 0;
}

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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;

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

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

ll h=2,w;
ll ans=0;
ll G[2][105];

void dfs(ll y, ll x, ll sum){
  if(y==1 && x==w-1){
    chmax(ans,sum+G[y][x]);
    return;
  }
  if(y>=2||x>=w) return;
  sum+=G[y][x];
  dfs(y+1,x,sum);
  dfs(y,x+1,sum);
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  cin>>w;
  rep(i,2) rep(j,w) cin>>G[i][j];
  dfs(0,0,0);
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    int N,M;cin>>N>>M;
    vector<pair<int,int>> cond(M);
    REP(i,M){
        int s;
        char c;
        cin>>s>>c;
        s--;
        cond[i]=make_pair(s,int(c));
    }
    REP(i,1000){
        string s=to_string(i);
        if(s.size()!=N) continue;
        bool ok=true;
        for(auto c:cond) if(int(s[c.first])!=c.second) ok=false;
        if(ok){
            cout<<s<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
}


Measured memory_bytes: 256
import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop

#BIG_NUM = 2000000000
BIG_NUM = 2147483647
HUGE_NUM = 9999999999999999
MOD = 1000000007
EPS = 0.000000001


global N
global table

def MIN(A,B):
    if A <= B:
        return A
    else:
        return B


def init(first_N):
    global N
    while N < first_N:
        N *= 2

def update(loc,value):
    global N
    loc += N-1

    table[loc] = value

    if N == 1:
        return

    parent = (loc-1)//2

    while True:
        table[parent] = MIN(table[2*parent+1],table[2*parent+2])

        if parent == 0:
            break

        parent = (parent-1)//2


def query(search_left,search_right,node_id,node_left,node_right):

    if search_right < node_left or search_left > node_right:
        return BIG_NUM
    if search_left <= node_left and search_right >= node_right:
        return table[node_id]
    else:
        left_min = query(search_left,search_right,2*node_id+1,node_left,(node_left+node_right)//2)
        right_min = query(search_left,search_right,2*node_id+2,(node_left+node_right)//2+1,node_right)
        return MIN(left_min,right_min)



first_N,num_query = map(int,input().split())
N = 1
init(first_N)

table = [None]*(2*N-1)

for i in range(2*N-1):
    table[i] = BIG_NUM


for loop in range(num_query):
    command,left,right = map(int,input().split())

    if command == 0:

        update(left,right)

    else:
        print("%d"%(query(left,right,0,0,N-1)))





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

int A, B, M;
const int MAX = 1.0e5 + 10;
int a[MAX], b[MAX];

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

    vector<int> sum;
    for (int i = 0; i < M; i++) {
        int x, y, c;
        cin >> x >> y >> c;
        sum.push_back(a[x-1] + b[y-1] - c);
    }

    sort(a, a+A);
    sort(b, b+B);

    sum.push_back(a[0] + b[0]);

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


    cout << sum[0] << endl;

    return 0;
}

Measured memory_bytes: 1660
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD=1e9+7;

int main() {
	string s;
    cin >> s;
    int ans = 0;
    string t, p = "";
    rep(i, s.size()) {
        t += s[i];
        if (t == p) continue;
        p = t;
        t = "";
        ++ans;
    }
	cout << ans << endl;
	return 0;
}


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

int main() {
  const ll m = 1e9 + 7;
  ll n, k;
  cin >> n >> k;

  ll ans = 0;
  ll csum = 0;
  rep2(i, 1, n + 2) {
    if (i >= k) {
      ans += (i * n) % m - 2 * csum + 1;
      ans %= m;
      ans = (ans + m) % m;
    }
    csum += i;
  }

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

Measured memory_bytes: 3632
INF = 10**5
N,C = map(int,input().split())
table = [0]*(INF+1)
prog = [list(map(int,input().split())) for i in range(N)]
prog.sort(key=lambda x:x[0])
cs = [set() for i in range(INF+1)]
for s,t,c in prog:
    cs[s].add(c)
for i in range(N):
    table[prog[i][0]-1] += 1
    if prog[i][2] in cs[prog[i][1]]:
        table[prog[i][1]-1] -= 1
    else:
        table[prog[i][1]] -= 1
ans,tmp = 0,0
for i in range(INF+1):
    tmp += table[i]
    ans = max(tmp,ans)
print(ans)


Measured memory_bytes: 87640
#include <stdio.h>
#include <limits.h>
#define MAX 110
int cost[MAX][MAX];
int matrix[MAX];
int len;

void matrixChain(){
  int n = len;
  int i,j,k,l;
  int q;

  for(i=1;i<=n;i++) cost[i][i]=0;

  for(l=2;l<=n;l++){
    for(i=1;i<=n-l+1;i++){
      j=i+l-1;
      cost[i][j]=INT_MAX;
      for(k=i;k<=j-1;k++){
	q=cost[i][k]+cost[k+1][j]+matrix[i-1]*matrix[k]*matrix[j];
	if(cost[i][j]>q) cost[i][j]=q;
      }
    }
  }
}

int main(){
  int i,j;
  scanf("%d",&len);
  for(i=0;i<len;i++){
    scanf("%d %d",&matrix[i],&j);
  }
  matrix[len]=j;
  matrixChain();
  printf("%d\n",cost[1][len]);
return 0;
}

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


def main():
    n = int(input())
    s = input()
    ts = list()

    # KeyInsight
    # 制約条件の小さいものに着目する
    # 部分列では貪欲的に探索することを検討する
    for i in range(10):
        for j in range(10):
            for k in range(10):
                t = ''
                t += str(i)
                t += str(j)
                t += str(k)

                ts.append(t)

    ans = 0

    for ti in ts:
        pos = 0

        for si in s:
            if si == ti[pos]:
                pos += 1

                if pos == 3:
                    break

        if pos == 3:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 40684
#include <stdio.h>

int main(void)          
{
	int a, b;
	scanf("%d %d", &a, &b);

	if(a<b)
	{
		printf("a < b\n");
	}
	if (a==b)
	{
		printf("a == b\n");
	}
	if (a>b)
	{
		printf("a > b\n");
	}
	return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
using namespace std;
#define rep0(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rep1(i,n) for(long long i=1;i<=(long long)(n);i++)
#define all(v) v.begin(),v.end()
#define Sort(v) sort(all(v))
#define Reverse(v) reverse(all(v))
#define Rsort(v) sort(all(v),greater)
#define pub(v) push_back(v)
#define pob(v) pop_back(v)
typedef long long ll;
typedef vector<ll> vel;
typedef vector<vector<ll>> vel2d;
typedef string str;
typedef pair<ll,ll> pal;
typedef vector<str> ves;
typedef vector<char> vech;


int main() {
    const ves data={"ABC","ARC"};
    str S; cin>>S;
    if(S==data[0]){cout<<data[1]<<endl;}
    else{cout<<data[0]<<endl;} 
}


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

#define for_(i,a,b) for(int i=a;i<b;++i)
using lint = long long;

template<typename T> T modMul(T& a, T b, T MOD) { return a = (a * b) % MOD; }
lint extgcd(lint a, lint b, lint &x, lint &y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	lint d = extgcd(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

lint invmod(lint a, lint MOD) {
    lint x, y;
    extgcd(a, MOD, x, y);
    return (x % MOD + MOD) % MOD;
}

lint powmod(lint x, lint k, lint MOD) {
	lint ret = 1;	
	while (k > 0) {
		if (k & 1) modMul(ret, x, MOD);
		modMul(x, x, MOD);
		k >>= 1;
	}
	return ret;
}

lint comb(lint n, lint k, lint MOD) {
    lint ret = 1;
    for (int i=1; i<=k; ++i) {
        // n - i + 1 / i
        lint mul = n - i + 1;
        modMul(mul, invmod(i, MOD), MOD);
        modMul(ret, mul, MOD);
    }
    return ret;
}

int main() {
    int n, a, b;
    cin >> n >> a >> b;

    const lint MOD = 1e9 + 7;

    lint ans = powmod(2, n, MOD);
    ans -= comb(n, a, MOD);
    ans = (ans + MOD) % MOD;

    ans -= comb(n, b, MOD);
    ans = (ans + MOD) % MOD;

    cout << ans - 1 << endl;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;
int main()
{
    string s,s1;
    cin>>s>>s1;
    int x,x1;cin>>x>>x1;
    string s3;cin>>s3;
    if(s3==s) cout<<x-1<<" ";
    else if(s3!=s) cout<<x<<" ";
    if(s3==s1) cout<<x1-1<<endl;
    else cout<<x1<<endl;


    return 0;
}


Measured memory_bytes: 256
X=int(input())
n = 200000
primes = set(range(2, n+1))
for i in range(2, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes=list(primes)
for i in range(len(primes)-1):
    if X==2:
        print("2")
        break
    elif (primes[i]<X)and(X<=primes[i+1]):
        print(primes[i+1])
        break

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
#define PER(i,n) for(int i = n; i >= 1; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
using vP = vector<P>;
using vPl = vector<Pl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
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; }

const ll mod = 2019;

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

  int l, r;
  cin >> l >> r;
  if(r-l > 10000) {
    cout << 0 << endl;
    return 0;
  }
  ll ans = inf;
  for(ll i = l; i < r; i++)
    for(ll j = i+1; j <= r; j++)
      ans = min(ans, i*j % mod);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define repk(i,m,n) for(ll i=m;i<n;i++)
#define IOS ios::sync_with_stdio(false);cin.tie(0);
#define F first
#define S second
typedef long long ll;
typedef long double ld;
using namespace std;
const int MOD=1e9+7;
ll fp[2000005];
ll fpow(ll a,ll b)
{
    if(a==0) return 0;
    if(b==0) return 1;
    if(b==1) return a;
    ll t=fpow(a,b/2);
    ll ans=(t*t)%MOD;
    if(b%2==1) ans=(ans*a)%MOD;
    return ans;
}
ll comb(ll n,ll r)
{
    ll ans=1;
    for(ll i=n;i>n-r;i--) ans=(ans*i)%MOD;
    rep1(i,r) ans=(ans*fp[i])%MOD;
    return ans;
}
ll total(ll a,ll b)
{
    return comb(a+b+2,a+1);
}
int main()
{
    ll r1,r2,c1,c2;
    rep1(i,1000005) fp[i]=fpow(i,MOD-2);
    cin>>r1>>c1>>r2>>c2;
    ll ans=(total(r2,c2)-total(r1-1,c2)-total(r2,c1-1)+total(r1-1,c1-1))%MOD;
    while(ans<0) ans+=MOD;
    cout<<ans;
}


Measured memory_bytes: 8960
import fractions
n=int(input())
a=list(map(int,input().split()))
a=[0]+a+[0]
l=[0]*(n+2)
r=[0]*(n+2)
for i in range(1,n+1):
    l[i]=fractions.gcd(l[i-1],a[i])
for i in range(n,0,-1):
    r[i]=fractions.gcd(r[i+1],a[i])
print(max(fractions.gcd(l[i-1],r[i+1]) for i in range(1,n+1)))

Measured memory_bytes: 16152
import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    
    if(a < 10 && b < 10){
      System.out.println(a*b);
    }else{
      System.out.println(-1);
    }
  }
}


Measured memory_bytes: 21844
#include<stdio.h>
#pragma GCC target("avx")
#pragma GCC optimize("Ofast")
typedef long long lint;
const int mod=1000000007;
int k,n=-1,cnt=13;
char c[15];
lint fact[2000010],inv[2000010];
int main(){
	while(true){
		*c=getchar_unlocked();
		if(*c=='\n')break;
		k*=10;
		k+=*c-'0';
	}
	while(getchar_unlocked()!=-1)n++;
	fact[0]=1;
	for(int i=1;i<=n+k;i++)fact[i]=fact[i-1]*i%mod;
	inv[n+k]=1;
	lint now=fact[n+k];
	int b=mod-2;
	while(b){
		if(b&1){
			inv[n+k]*=now;
			inv[n+k]%=mod;
		}
		b>>=1;
		now*=now;
		now%=mod;
	}
	for(int i=n+k-1;i>=0;i--)inv[i]=inv[i+1]*(i+1)%mod;
	lint ans=1;now=1;
	for(int i=1;i<=k;i++){
		now*=25;
		now%=mod;
		ans+=fact[n+k]*inv[n+k-i]%mod*inv[i]%mod*now;
		ans%=mod;
	}
	*(c+14)='\n';
	while(ans){
		*(c+cnt)=ans%10+'0';
		ans/=10;
		cnt--;
	}
	fwrite(c+cnt+1,1,14-cnt,stdout);
	return 0;
}

Measured memory_bytes: 32720
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int a[100010];
int main(){
    int n;
    string s;
    while(cin>>s){
        ll ans=0;
        bool l=0;
        for(int i=0; i<s.size(); ++i){
        	if(s[i]=='7'){
        		l=1;
        	}
        }
        if(l){
        	printf("Yes\n");
        }
        else{
        	printf("No\n");
        }
    }
  return 0;
}




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

int main() {
    string s;cin >> s;
    int r=0; for (auto c:s) r += c-'0';
    int t; t = s[0] - '0' - 10 + 9 * s.length();
    cout << max(r,t) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
  long long int n,i,j,k,count,answer,data;
  cin >> n;
  string a = "ACL";
  count = 0;
  answer = 0;
  for(i=1;i<n;i++)
  {
    a += "ACL";
  }
  cout << a;
  return 0;
}

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

const int cost[6] = { 500, 100, 50, 10, 5, 1};

int main()
{
	int p;
	while (cin >> p, p!=0)
	{
		int chg = 1000 - p;
		int c=0, cnt=0;
		while (c < 6)
		{
			while (1)
			{
				if (chg-cost[c] >= 0) { cnt++; chg-=cost[c]; }
				else break;
			}
			c++;
		}
		cout << cnt << endl;
	}
	return 0;
}

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

void printRect( int h, int w ) {
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cout << '#';
        }
        cout << endl;
    }
}

  
int main() {
    int h, w;
    while (1) {
        cin >> h >> w;
        if (h == 0 && w == 0) return 0;
        printRect( h, w);
        cout << endl;
    }
}

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

int main(){
	string s;
	cin>>s;
	for(int i = 0; i<s.size();i++){
		if(s[i]=='A' && s[i+1]=='C'){
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
	return 0;
}

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

int main(){
    int N;
    cin >> N;
    string s;
    int count = 0;
    cin >> s;
    for (int i = 0; i < N - 2; i++)
    {
        if(s[i] == 'A' && s[i+1] == 'B' &&  s[i+2] == 'C'){
            count++;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
using namespace std;
using ll=long long;
using pll=pair<ll,ll>;
const ll MOD=1000000007;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const vector<pll> dir={{0,1},{1,0},{-1,0},{0,-1},{1,1},{-1,1},{1,-1},{-1,-1}};
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=b-1;i>=a;i--)
#define range(i) (i).begin(),(i).end()
#define rrange(i) (i).rbegin(),(i).rend()
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline ll lcm (ll a,ll b) {return a*b/gcd(a,b);}
inline constexpr int intpow(ll a,ll b){
    if(b==0) return 1;
    ll ans=intpow(a,b/2);
    return ans*ans%MOD*(b&1?a:1)%MOD;
}
inline constexpr int modf(ll n){
    ll ans=1;
    rep(i,0,n) {ans=ans*(n-i)%MOD;}
    return ans;
}

vector<ll> func,inv;
void init(ll n){
    func.resize(n+1);inv.resize(n+1);
    func[0]=1;
    rep(i,0,n) {func[i+1]=func[i]*(i+1)%MOD;}
    inv[n]=intpow(func[n],MOD-2);
    rrep(i,1,n+1) {inv[i-1]=inv[i]*i%MOD;}
}
ll comb(ll a,ll b) {return func[a]*inv[b]%MOD*inv[a-b]%MOD;}

inline long double median(vector<ll> v){
    ll size=v.size();
    sort(v.begin(),v.end());
    if (size % 2 == 1) return v[(size - 1) / 2];
    else return v[(size / 2) - 1] ;
}
template<class T> inline bool chmax(T& a,T b) {if(a<b){a=b;return 1;} return 0;}
template<class T> inline bool chmin(T& a,T b) {if(a>b){a=b;return 1;} return 0;}

int main(){
    ll n;
    cin>>n;
    vector<ll> h(n),r(n+1);
    rep(i,0,n) cin>>h[i];
    ll ans=0,j=1;
    r[0]=0;
    rep(i,0,n-1){
        if(h[i]<h[i+1]){
            r[j]=i+1;
            j++;
        }
    }
    r[j]=n;
    rep(i,0,j) chmax(ans,r[i+1]-r[i]-1);
    cout<<ans;
}

Measured memory_bytes: 1792
using System;

namespace ABC095A
{
    class Program
    {
        static void Main(string[] args)
        {
            string s1 = Console.ReadLine();
 
            string[] ss = s1.Split(' ');
            int N = int.Parse(ss[0]);
            int X = int.Parse(ss[1]);

            int price = 0;
            int[] prices = new int[N];
            int sum = 0;
            int i = 0;
            for ( i = 0; i < N ; i++ )
            {
                price = int.Parse(Console.ReadLine());
                sum += price;
                prices[i] = price;
            }
            int res = N;
            int tmp = 0;
            tmp = X - sum;
            Array.Sort(prices);
            res += tmp / prices[0];

            Console.WriteLine(res);
        }
    }
}


Measured memory_bytes: 11220
#include <bits/stdc++.h>
#define sz(v) (int)v.size()
#define debug(var) cout << #var << ": " << var << endl;
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int h, w, m;
    cin >> h >> w >> m;
    vector<int> cntrow(h + 1), cntcol(w + 1);
    set<pair<int, int>> targets;
    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        cntrow[x]++, cntcol[y]++;
        targets.insert({x, y});
    }

    int mxcntrow = 0;
    for (int e : cntrow)
        mxcntrow = max(mxcntrow, e);
    int mxcntcol = 0;
    for (int e : cntcol)
        mxcntcol = max(mxcntcol, e);

    vector<int> rows, cols;
    for (int i = 0; i < sz(cntrow); i++) {
        int &e = cntrow[i];
        if (e == mxcntrow)
            rows.push_back(i);
    }
    for (int i = 0; i < sz(cntcol); i++) {
        int &e = cntcol[i];
        if (e == mxcntcol)
            cols.push_back(i);
    }
    int flag_perfect = 0;
    for (int ei : rows) {
        for (int ej : cols)
            if (targets.find({ei, ej}) == targets.end()) {
                flag_perfect = 1;
                break;
            }
        if (flag_perfect)
            break;
    }
    cout << mxcntrow + mxcntcol - 1 + flag_perfect;
}

Measured memory_bytes: 23836
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    V< P<ll, int> > a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i].first; a[i].second = i;
    }
    sort(a.rbegin(), a.rend());

    vvll dp(n + 1, vll(n + 1, 0));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i + j >= n) break;
            chmax(dp[i + 1][j], dp[i][j] + a[i + j].first * abs(a[i + j].second - i));
            chmax(dp[i][j + 1], dp[i][j] + a[i + j].first * abs(n - j - 1 - a[i + j].second));
        }
    }

    // for (int i = 0; i <= n; i++) DEBUG_VLL(dp[i])

    ll ans = 0;
    for (int i = 0; i <= n; i++) {
        chmax(ans, dp[i][n - i]);
    }
    cout << ans << '\n';
    return 0;
}


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

using ll = long long;

int main() {
    int N;
    cin >> N;
    vector<double> x(N), y(N);
    rep(i, N) cin >> x[i] >> y[i];
    double s = 0;
    rep(i, N - 1) {
        for (int j = i + 1; j < N; j++) {
            s += sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));
        }
    }
    cout << setprecision(12) << s / N * 2 << endl;
}

Measured memory_bytes: 256