akhauriyash/Code-Regression huggingface dataset:
/*     ####   ####  #               ####  #        ##   #    # #    # ###### #####
      #      #    # #              #      #       #  #  ##  ## ##  ## #      #    #
       ####  #    # #               ####  #      #    # # ## # # ## # #####  #    #
           # #  # # #                   # #      ###### #    # #    # #      #####
      #    # #   #  #              #    # #      #    # #    # #    # #      #   #
       ####   ### # ###### #######  ####  ###### #    # #    # #    # ###### #    #
*/
 
#include<bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef vector<long long> VLL;
typedef vector<string> VS;
typedef vector<pair<LL, LL> > VP;
 
 
#define For(in) for (LLi i = 0; i < (n); i++)
#define FOR(in) for(LLi i=1; i <= (n); i++)
#define pb push_back
#define sr(v) sort(v.begin(), v.end())
#define rev(v) reverse(v.begin(), v.end())
#define uniq(v) v.erase(unique(v.begin(), v.end()), v.end());
#define exit(); return 0;
#define no "NO"
#define yes "YES"
#define con continue;
 

 
 
int main()
{
	
	LL n,m,i,a;
	cin>>n>>m;
	bool neg[10] = {};
	for(i=0; i<m; i++)
	{
		cin>>a;
		neg[a] = true;
	}
	LL ans=n;
	while(true)
	{
		LL x = ans;
		bool check = false;
		while(x != 0)
		{
			auto u = x % 10;
			if(neg[u])
			{
				check = true;
				break;
			}
			x /= 10;
		}
		if(!check)
		{
			cout<<ans<<endl;
			return 0;
		}
		ans++;
	}

		
		
	
	


			
    exit()
 
 
}


Measured memory_bytes: 3584
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] an = new int[n];
        for (int i = 0; i < n; i++) {
            an[i] = sc.nextInt();
        }

        for (int i = n-1; i >= 0; i -= 2) {
            System.out.print(an[i] + " ");
        }
        for (int i = n%2; i < n; i += 2) {
            System.out.print(an[i] + " ");
        }
        System.out.println();
    }

}

Measured memory_bytes: 94272
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>

using namespace std;

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

const ll mod = 1000000007;

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

  int n;
  cin >> n;
  vector<int> p(n), q(n);
  for (auto &x: p) cin >> x;
  for (auto &x: q) cin >> x;

  vector<int> a(n);
  for (int i = 0; i < n; i++) a[i] = i+1;
  int c = 0;
  int pc = 0;
  int qc = 0;
  do {
    if (a == p) pc = c;
    if (a == q) qc = c;
    c++;
  } while (next_permutation(a.begin(), a.end()));

  cout << abs(pc - qc) << endl;

  return 0;
}


Measured memory_bytes: 256
def dist(x, y)
	sum = 0
	for i in 0..(x.length-1)
		xy = (x[i]-y[i]).abs
		sum += xy * xy
	end
	Math.sqrt(sum).to_s[-2..-1] == '.0'
end

def abc133b
	n,d = gets.chomp.split(/\s/).map{|x| x.to_i}

	ij = []
	for i in 1..n
		ij.push(gets.chomp.split(/\s/).map{|x| x.to_i})
	end

	num = 0
	for i in 0..(n-1)
		for j in i+1..(n-1)
			num += 1 if dist(ij[i], ij[j])
		end
	end

	puts num
end

abc133b

Measured memory_bytes: 1916
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() { 
    int a, b, c;
    cin >> a >> b >> c;
    if (a + b == c || b + c == a || a + c == b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}




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

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define M_PI 3.14159265358979323846

#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;
using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 0};
int dy[]={0, 1, 0, -1, 0};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
const int NIL = -1;
static mt19937 _g(time(nullptr));
 
std::string pad(int num){ char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer;}
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }



int main()
{
    fast_io();
    #ifdef __LOCAL
        fs::path p = __FILE__;
        fs::path input,output;
        input = output = p.parent_path();
        input += string("/input/") + string(p.stem()) + string(".txt");
        output += string("/output/") + string(p.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif
    vector<int> v(3);
    cin >> v[0] >> v[1] >> v[2];
    VSORT(v);
    bool isPoor = false;
    string ans;
    if((v[0]==v[1])&&(v[1]!=v[2])) {ans= "Yes"; isPoor=true;}
    else if((v[0]!=v[1])&&(v[1]==v[2])) {ans= "Yes"; isPoor=true;}
    if(!isPoor) ans= "No";
    cout << ans << endl;
    
    return 0;


}


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

using namespace std;

int main(){
	long long int x,a,b;
	cin>>x;
	cin>>a;
	cin>>b;
	int count=0;
	if(x -a >0){ x-=a; count++;}
	cout<< x%b;
	return 0;
	
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
      	int b = sc.nextInt();
      	int c = sc.nextInt();
      	String s = "";
      	if( (a > b) && (a > c) && (c > b) ){
          s = "Yes";
        }else if( (b > a) && (b > c) && (c > a) ){
          s = "Yes";
        }else{
          s = "No";
        }
      System.out.println(s);
	}
}

Measured memory_bytes: 35496
//       Author: Mostafa Mounir Shehab
 
#include <bits/stdc++.h>
using namespace std;
 
#define PI  acos(-1)
#define EPS (1e-10)
#define endl "\n"
#define SZ(v) (int)(v.size())
#define IO ios_base::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL), cerr.tie(NULL);
typedef long long ll;
typedef long double ld;
 
 
 
ll MOD=1e9 + 7;
ll OO=1e9 + 7;
const int N=1e5 + 10,M = 2750131 + 1;
int arr[N];
int vis[N];

int n,m,k,T,lvl,comp;
int a,b,c;

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


bool Solve(){
	
	for(int i=0;i<N;++i){
		bool flage = false;
		for(int j=0;j<n && arr[j]<=i;++j)
			flage |= !vis[i-arr[j]];
			
		vis[i] = flage;
	}
	
	return vis[k];
}



int main(){
	
	//freopen("algoritm.in","r",stdin);
//	freopen("algoritm.out","w",stdout);
	IO
	cin>>n>>k;
	for(int i=0;i<n;++i)
		cin>>arr[i];
	sort(arr,arr+n);
	
	cout<<(Solve() ? "First" : "Second")<<endl;
	
	return 0;
}

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

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<< #str << " " str<<endl

constexpr int INF = (1 << 30);
constexpr ll INFL = (1ll << 60);
constexpr ll MOD = 1000000007;// 10^9+7



int main()
{
	ll r, D, x;
	cin >> r >> D >> x;
	REP(i, 10) {
		x = r * x - D;
		cout << x << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define cs const
#define pb push_back
using namespace std;
cs int Mod = 1e9 + 7;
int add(int a, int b){ return a + b >= Mod ? a + b - Mod : a + b; }
int dec(int a, int b){ return a - b < 0 ? a - b + Mod : a - b; }
int mul(int a, int b){ return 1ll * a * b % Mod; }
void Add(int &a, int b){ a = add(a,b); }
void Mul(int &a, int b){ a = mul(a,b); }
void Dec(int &a, int b){ a = dec(a,b); }
cs int N = 55;
int n, dp[N][N], C[N][N];
int main(){
	#ifdef FSYolanda
	freopen("1.in","r",stdin);
	#endif
	scanf("%d",&n);
	for(int i=0; i<=n; i++) C[i][0]=1;
	for(int i=1; i<=n; i++)
	for(int j=1; j<=i; j++) C[i][j]=add(C[i-1][j-1],C[i-1][j]);
	dp[1][0]=dp[1][1]=n; 
	for(int i=1; i<n; i++)
	for(int j=0,coe; j<=i; j++) if(coe=dp[i][j]) 
 	for(int k=max(j,1); k<=n-i; k++) {
		if((k+j)&1) continue; 
		int t=(k+j)>>1; for(int x=0; x<=k; x++) 
		Add(dp[i+k][abs(t-x)],mul(coe,mul(C[n-i][k],C[k][x])));
	} cout<<dp[n][0]; return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<queue>
#include<set>
#define rep(i,s,t) for(register int i=s;i<=t;++i)
#define _rep(i,s,t) for(register int i=s;i>=t;--i)
#define Rep(i,s,t) for(register int i=s;i<t;++i)
#define go(x) for(register int e=las[x];e;e=nxt[e])
#define re register
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define gi(x) read(x)
#define gii(x,y) read(x),read(y)
#define giii(x,y,z) read(x),read(y),read(z)
#define ms(f,x) memset(f,x,sizeof f)
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
namespace IO{
    #define gc getchar()
    #define pc(x) putchar(x)
    template<typename T>inline void read(T &x){
        x=0;int f=1;char ch=gc;while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=gc;}
        while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=gc;x*=f;return;
    }
    template<typename T>inline void write(T x=0){
        T wr[51];wr[0]=0;if(x<0)pc('-'),x=-x;if(!x)pc(48);
        while(x)wr[++wr[0]]=x%10,x/=10;while(wr[0])pc(48+wr[wr[0]--]);
		putchar('\n');
		return;
    }
}
using IO::read;
using IO::write;
#define rep(i,s,t) for(register int i=s;i<=t;++i)
using namespace std;
const int N=2e3+11,mo=1e9+7;
int n,K,tmp,tot,u[N],v[N],gra,las[N],to[N+N],nxt[N+N];
inline void add(int x,int y){
	nxt[++tot]=las[x];
	las[x]=tot;
	to[tot]=y;
}
inline void dfs(int x,int fa,int dep){
    tmp++;
    if(!dep)return;
    for(register int i=las[x];i;i=nxt[i])
		if(to[i]!=fa)
        	dfs(to[i],x,dep-1);
}
int main(){
    scanf("%d%d",&n,&K);
    rep(i,1,n-1){
        scanf("%d%d",&u[i],&v[i]);
        add(u[i],v[i]);
        add(v[i],u[i]);
    }
    int ans=0;
    if(K&1)
        rep(i,1,n-1){
            tmp=0;
            dfs(u[i],v[i],K/2);
            dfs(v[i],u[i],K/2);
            ans=max(ans,tmp);
        }
	else
        rep(i,1,n){
            tmp=0;
            dfs(i,0,K/2);
            ans=max(ans,tmp);
        }
    printf("%d",n-ans);
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
 
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int T = sc.nextInt();
		long count = 0;
		long save = 0;
		long reset = 0;
		for (int i = 0; i < N; i++) {
			int Ti = sc.nextInt();
			if (count < Ti-reset) {
				save += count;
				reset = Ti;
				count = T;
			} else {
				count = Ti+T-reset;
			}		
		}
		System.out.println(count+save);
	}
}

Measured memory_bytes: 62852
// <------------- Template -----------------------> //

/*
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
*/

#pragma optimization_level 3   									//Comment optimisations for an interatcive problem - use endl
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);	
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll ,ll> 			pll;
typedef pair<ld,ld> 			pld;
typedef unordered_map<ll,ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5+7;
const ll 	MAX7 	= 	1e+7+7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9+7;

// <------------- Declare Variables Here ------------> //

ll n,c[10][10];

// <------------- Implement Functions Here ----------> //

ll first_digit(ll n) {
	while(n>=10) {
		n/=10;
	}
	return n;
}

ll last_digit(ll n) {
	return n%10;
}

// <------------- Start of main() -------------------> //

int main() {
	fastio;
	cin>>n;
	for(ll i=1;i<=n;i++) {
		//cout<<i<<" "<<first_digit(i)<<" "<<last_digit(i);newl;
		c[first_digit(i)][last_digit(i)]++;
	}

	ll sum=0;

	for(ll i=0;i<=9;i++) {
		for(ll j=0;j<=9;j++) {
			//cout<<c[i][j]<<" ";
			sum+=c[i][j]*c[j][i];
		}
		//newl;
	}
	//newl;
	cout<<sum;newl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    int N; cin >> N;
    ll A[200200]; rep(i, N) cin >> A[i];
    ll sum[200200]; sum[0] = 0;
    rep1(i, N) {
        sum[i] = sum[i - 1] + A[i - 1];
    }
    sort(sum, sum + N + 1);
    ll ans = 0;
    rep(i, N + 1) {
        ans += upper_bound(sum, sum + N + 1, sum[i]) - lower_bound(sum, sum + N + 1, sum[i]) - 1;
    }
    ans /= 2;
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3456
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include<set>
using namespace std;

int main(){
    int ans= 0,n =0;
    cin >> n;
    for(int i = 1; i <= sqrt(n-1);i++ ){
        ans += ((n-1)/i - (i-1));
    }
    ans = ans*2-(int)sqrt(n-1);
    cout << ans << endl;
}

Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
int main(){ 
    string s;
    cin>>s;
  if(s.size()%2==1){
        cout<<"No";
        return 0;
    }
    sort(s.begin(),s.end());
    for(int i=0;i<s.size()-1;i+=2){
        if(s[i]!=s[i+1]){
            cout<<"No";
            return 0;
        }
    }
    cout<<"Yes";
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);
	if (a+b == c || a+c == b || b+c == a) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define ANTHRO(x...) cerr << "[" << #x << "] = [", _print(x)
#else
#define ANTHRO(x...)
#endif


#define ll long long
#define MOD 1000000007
#define INF (int)1e9
#define EPS 1e-9
#define con (int)1e5+5
/*
    This is G-Longest Path (Re-attempt)
*/
vector<bool> v(con,false);
vector<ll> adj[con];
vector<ll> i_D(con,0),dp(con,0);
void dfs(ll node){
    v[node]=true;
    for(ll i:adj[node]){
        dp[i]=max(dp[i],dp[node]+1);
        --i_D[i];
        if(i_D[i]==0){
            dfs(i);
        }
    }
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m; cin>>n>>m;

    for(ll i=0;i<m;i++){
        ll x,y; cin>>x>>y;
        //aE(adj,x,y); //This is to add the edge to a directed cyclic graph
        adj[x].push_back(y);
        ++i_D[y]; //This is something to do with in-degree
    }
    //vector<bool> v(n+1,false);
    for(ll i=1;i<=n;i++){
        if(!v[i] && i_D[i]==0){
            dfs(i);
        }
    }
    ll b=-INF;
    //ANTHRO(dp);
    for(ll i:dp){
        //ANTHRO(i);
        b=max(b,i);
    }
    printf("%lld",b);
    return 0;
}



Measured memory_bytes: 10496
import std.stdio;

void main() {
	for (;;) {
		int n, x;
		"%d %d\n".readf(&n, &x);
		if (n == 0 && x == 0) break;
		
		int c = 0;
		foreach (i; 1..n-1)
			foreach (j; i+1..n)
				foreach (k; j+1..n+1)
					if (i+j+k == x) ++c;
		c.writeln;
	}
}

Measured memory_bytes: 2484
S=gets.chomp
a=S[0..1].to_i
b=S[2..3].to_i
if (1 <= a && a <= 12) && (1 <= b && b <= 12)
    puts 'AMBIGUOUS'
elsif (1 <= a && a <= 12) && (b > 12 || b == 0)
    puts 'MMYY'
elsif (a > 12 || a == 0) && (1 <= b && b <= 12)
    puts 'YYMM'
else
    puts 'NA'
end


Measured memory_bytes: 1788
#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[int]"):
    dp = [[0,0] for _ in range(N+1)]
    dp[2] = [A[0],A[1]]
    
    for i in range(2,N):
        if (i+1)%2 ==0:
            dp[i+1][0] = dp[i-1][0]+A[i-1]
            dp[i+1][1] = max(dp[i-1])+A[i]
        else:
            dp[i+1][1] = max(dp[i-1])+A[i]
            dp[i+1][0] = dp[i][1]

    print(max(dp[N]))
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 111924
#include <bits/stdc++.h>
#define int long long
#define N 100010
using namespace std;
const int INF = 1LL<<55;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}

int ok = 0,sum = 0;
int calc(int n,int m){
  int sum = 0;
  int t = 1<<m;
  sum += 100 * (n-m);
  sum += 1900 * (m);
  return sum;
}

signed main(){
  int n,m;
  cin>>n>>m;

  int ans = 0;
  for(int i=0;i<(1<<m);i++) ans += calc(n,m);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
n, d = gets.split.map &:to_i
pts = n.times.map {gets.split.map &:to_i}
cnt = pts.combination(2).count do |(p, q)|
  dist = d.times.sum { |i| (p[i]-q[i])**2 }
  (0..dist).any? { |d| d*d==dist }
end

p cnt

Measured memory_bytes: 14320
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#define N 102
using namespace std;
int n, m;
int main() {
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  cout<<max(a*b, c*d)<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner

object Main extends App  {
  val sc = new Scanner(System.in)

  val w = sc.nextInt
  val h = sc.nextInt
  val n = sc.nextInt

  val ql = List.fill(n)(((sc.nextInt, sc.nextInt),sc.next))

  val xMin = if(ql.exists(_._2 == "1")) ql.filter(_._2 == "1").map(_._1._1).max else 0
  val xMax = if(ql.exists(_._2 == "2")) ql.filter(_._2 == "2").map(_._1._1).min else w
  val yMin = if(ql.exists(_._2 == "3")) ql.filter(_._2 == "3").map(_._1._2).max else 0
  val yMax = if(ql.exists(_._2 == "4")) ql.filter(_._2 == "4").map(_._1._2).min else h

  val res = if(xMin > xMax || yMin > yMax ) 0 else (xMax - xMin) * (yMax - yMin)

  println(res)
}


Measured memory_bytes: 25788
#!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify

import itertools, bisect
import math, fractions
import sys, copy

def L(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline().rstrip())
def S(): return list(sys.stdin.readline().rstrip())
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return [list(x) for x in sys.stdin.readline().split()]
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def LIR1(n): return [LI1() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
def LR(n): return [L() for _ in range(n)]

alphabets = "abcdefghijklmnopqrstuvwxyz"

sys.setrecursionlimit(1000000)
dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
MOD = 1000000007

def main():
    N = I()
    A = LI()

    money = 1000

    partial = []
    tmp = [A[0]]
    last = A[0]

    for i in range(1, N):
        if A[i] >= last:
            tmp.append(A[i])
            last = A[i]
        else:
            partial.append(tmp)
            tmp = [A[i]]
            last = A[i]

    partial.append(tmp)

    for part in partial:
        if len(part) <= 1:
            continue
        last = part[-1]
        start = part[0]
        stock = money // start
        money = money % start + stock * last
    print(money)


if __name__ == '__main__':
    main()

Measured memory_bytes: 72500
#include<stdio.h>
int main(){
	
	while(1){
	
		int H , W , counth , countw;
		
		scanf("%d %d", &H , &W);
		
		if(H == 0 && W == 0){
		
			break;
		}
		
		for(counth = 0 ; counth < H  ; counth++){
		
				for(countw = 0 ; countw <= W - 1  ; countw++){
		
					printf("#");
				}
			
			printf("\n");
		
		}
		printf("\n");
	
	}
	return 0;
}


// int ??´??°
// char ??????
// double ???????°???°???
/*d = a / b;
r = a % b;
f = 1.0 * a / b;
// f = (double)a / b;*/

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

using namespace std;

//#define int long long
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define INF (1 << 30)
#define fi first
#define se second

typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;
typedef pair<P, P> PP;

const int MOD = 1e9 + 7;
const int dy[]={0, 0, 1, -1};
const int dx[]={1, -1, 0, 0};

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int x, y, z;
    cin >> x >> y >> z;
    x -= z;
    cout << x / (y + z) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String str = sc.next();
        char c[] = str.toCharArray();
        
        // set: 英小文字の出現位置
        TreeSet[] set = new TreeSet[26];
        for (int i = 0; i < 26; i++) {
            set[i] = new TreeSet<Integer>();
        }
        for (int i = 0; i < n; i++) {
            char chr = c[i];
            set[chr - 'a'].add(i);
        }
        
        int query = sc.nextInt();
        while (query-- > 0) {
            int type = sc.nextInt();
            
            if (type == 1) {
                // abcb => azcb
                //  ^       ^
                
                // chrの出現位置を消し、chr2の出現位置を追加、c[]を書き換え
                int index = sc.nextInt() - 1;
                char chr = c[index];
                char chr2 = (sc.next()).charAt(0);
                set[chr - 'a'].remove(index);
                set[chr2 - 'a'].add(index);
                c[index] = chr2;
            } else {
                // abcdbbd => 3
                //  ^^^^^
                
                // start以上end以下区間内にある英小文字の種類数を出力
                int start = sc.nextInt() - 1;
                int end = sc.nextInt() - 1;
                int count = 0;
                for (int i = 0; i < 26; i++) {
                    if (set[i].ceiling(start) == null) continue;
                    
                    if ((int)set[i].ceiling(start) <= end) {
                        count++;
                    }
                }
                System.out.println(count);
            }
        }
        
    }
}

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

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> pii;
typedef priority_queue< int, vector< int >, greater< int > >  minHeap;

#define ones(x) __builtin_popcount(x)
#define onesl(x) __builtin_popcountl(x)
#define onesll(x) __builtin_popcountll(x)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define scn(n) scanf("%d",&n)
#define scnll(n) scanf("%lld",&n)
#define scn2(n,m) scanf("%d%d",&n,&m)
#define scn3(n,m,w) scanf("%d%d%d",&n,&m,&w)
#define scn2ll(n,m) scanf("%lld%lld",&n,&m)
#define atoz(v) v.begin(),v.end()
#define ratoz(v) v.rbegin(),v.rend()
#define Fill(a,v) memset(a,v,sizeof(a))
#define fi first
#define se second
#define inf 1e9
#define pi acos(-1.0)
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define mod 1000000007
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define bug(x) cerr << __LINE__ << " says: " << #x << " = " << (x) << "\n"

int Set(int N,int pos)
{
    return N=N | (1<<pos);
}
int reset(int N,int pos)
{
    return N = N & ~(1<<pos);
}
bool check(int N,int pos)
{
    return (bool)(N & (1<<pos));
}

inline int addmod(lli x,lli y)
{
    return (x%mod + y%mod)%mod;
}
inline int submod(lli x,lli y)
{
    return (x%mod - y%mod + mod)%mod;
}
inline int mulmod(lli x,lli y)
{
    return (x%mod * y%mod)%mod;
}


inline int nextSubMask(int i, int mask)
{
    return (i-1)&mask;   /// returns next  submask
}

template<typename T>
void we_r_done(T mssg)
{
    cout<<mssg;
    exit(0);
}


int main()
{
    ///freopen("output.txt","w",stdout);
    //freopen("input.txt","r",stdin);
    FastIO;

    int n,m;
    while(cin>>n>>m)
    {
        string s[n];
        queue<pii>Q;

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

            for(int j=0; j<m; j++)
            {
                if(s[i][j] == '#')
                    Q.push(pii(i,j));
            }
        }

        int cnt = 0 , blacks = Q.size();
        int dx[5] = {1,-1,0,0};
        int dy[5] = {0,0,1,-1};


        while(Q.size()>0 && blacks<(n*m))
        {
            int now = Q.size();
            cnt++;
            while(now--)
            {
                pii p = Q.front();
                Q.pop();

                for(int i=0; i<4; i++)
                {
                    int xx = p.fi + dx[i];
                    int yy = p.se + dy[i];
                    if(xx<0 || yy<0 || xx>=n || yy>=m)
                        continue;

                    if(s[xx][yy] == '#')
                        continue;
                    Q.push(pii(xx,yy));
                    s[xx][yy] = '#';
                    blacks++;
                }
            }
        }
        cout<<cnt<<endl;
    }



    return 0;
}

///sin and cos expect input in radians not degrees. so use , sin(degrees * pi / 180)
///using bs = bitset<MX>; // how many distinct number can be form?
///sort(atoz(v), [](const data x, const data y){return (x.a==y.a?x.b>y.b : x.a<y.a);});


Measured memory_bytes: 9488
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define int ll
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a*b/gcd(a,b);
}

int sum[55] = {};
int p[55] = {};

int ans = 0;

void f(int n, int x){
    if(x <= 0)return;
    if(n == 0){
        ans++;
        return;
    }
    if(sum[n] <= x){
        ans += p[n];
        return;
    }
    x--;
    if(sum[n-1] <= x){
        ans += p[n-1];
        x -= sum[n-1];
        if(x>0)ans++;
        x--;
        f(n-1,x);
    }else{
        f(n-1,x);
    }

}

signed main(void) {
    int i,j;
    p[0] = sum[0] = 1;
    rep(i,50){
        sum[i+1] = 3 + 2 * sum[i];
        p[i+1] = 1 + 2 * p[i];
    }
    int n,x;
    cin >> n >> x;
    f(n,x);
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        String[] strArray = line.split(" ");
        int d = Integer.valueOf(strArray[0]);
        int A = Integer.valueOf(strArray[1]);
        int B = Integer.valueOf(strArray[2]);

        if(A >= B){
            System.out.println("delicious");
        }else if(A + d >= B){
            System.out.println("safe");
        }else{
            System.out.println("dangerous");
        }
    }
}

Measured memory_bytes: 21076
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 998244353
inline void add(int &x, int v) { x += v; if (x >= MOD) x -= MOD; }
inline int mul(int x, int y) { return (1LL*x*y)%MOD; }
int fact[500001];
int modpow(int x, int k) {
  int a = 1;
  while (k) {
    if (k&1) a = mul(a, x);
    x = mul(x, x);
    k>>=1;
  }
  return a;
}
int inv(int x) {
  return modpow(x, MOD-2);
}
int nCr(int n, int k) {
  if (k < 0 || k > n) return 0;
  return mul(mul(fact[n], inv(fact[k])), inv(fact[n-k]));
}
int T(int n, int k) {
  int s = nCr(n, k);
  add(s, MOD-nCr(n, k-1));
  return s;
}

int N, K;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  fact[0] = 1;
  for (int i=1; i<=500000; i++) fact[i] = mul(fact[i-1], i);
  cin >> N >> K;

  int sum = 0;
  if (K%2 == 0) {
    int k = K/2;
    // diff = 0 & last = 0
    rep(j, K/2+1) if (j >= N) add(sum, T(K-1, j-1));
  }
  vector<int> vs;
  rep(i, K/2+1) vs.pb(T(K, i));
  rep(i, vs.size()) {
    int num = 2*((int)vs.size()-i)-(K%2==0);
    int k_min = max((K/2)+1, (N+K-i+1)/2);
    int lo = 0, hi = num-1;
    lo = max(lo, k_min-i);
    add(sum, mul(vs[i], max(hi-lo+1, 0)));
  }
  cout << sum << "\n";
  return 0;
}


Measured memory_bytes: 3320
# -*- coding: utf-8 -*-
"""
Created on Sun May  3 12:03:48 2020

@author: ybt07
"""

from collections import deque

# 入力
N, M, Q = map(int, input().split())

# 制約条件の配列初期化
a, b, c, d = [0]*Q, [0]*Q, [0]*Q, [0]*Q
for i in range(Q):
    a[i], b[i], c[i], d[i] = map(int, input().split())

def dfs(A):

    global ans
    
    # A = [(1), 1, 2, 2,...] と、先頭の 1 はダミー的に使用しているので、深さ N+1 で計算
    # 深さが N+1 まで来たら、値を計算
    if len(A) == N+1:  # 直前で M をコピーされて来たので
        now = 0

        # 得点計算
        for i in range(Q):
            if A[b[i]] - A[a[i]] == c[i]:
                now += d[i]
            
        ans = max(ans, now)  # 最高値の更新        
        return
    
    # 再帰呼出し部
    # （長さがN以下なので）末尾に要素を追加して（＝一段深くして）探索
    tmp = A[len(A)-1]
    while True:

        if tmp > M:
            break

        A.append(tmp)
        dfs(A)
        A.pop()
        tmp += 1

# main
ans = 0  # 値
A = deque([1]) # 後ろへコピーするための初期値　兼　インデックスを合わせる

dfs(A)

print(ans)


Measured memory_bytes: 9344
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdio>
#define ll long long
using namespace std;

int n,a[55],p;
int f[55][55];
int C(int x,int y){return f[y][x];}
void pre()
{
	f[1][1]=f[1][0]=f[0][0]=1;
	for(int i=2;i<=50;i++)
	{
		f[i][0]=f[i][i]=1;
		for(int j=1;j<i;j++)
			f[i][j]=f[i-1][j]+f[i-1][j-1];
	}
}
int main()
{
	int i;int zz=0,oo=0;ll ans=0,pw=1;
	scanf("%d%d",&n,&p);
	for(i=1;i<=n;i++)	scanf("%d",&a[i]),(a[i]&1)?oo++:zz++;
	for(i=1;i<=zz;i++)	pw<<=1ll;pre();
	if(p&1)
		for(i=1;i<=oo;i+=2)
			ans+=C(i,oo)*pw;
	else
		for(i=0;i<=oo;i+=2)
			ans+=C(i,oo)*pw;
	printf("%lld\n",ans);
	return 0;
}

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

vector<vector<int>> edge(1e5);
vector<int> dp(1e5, 0);
vector<bool> visited(1e5, false);
vector<bool> used(1e5, false);
vector<int> color(1e5, -1);
vector<int> solve(1e5);
map<pair<int, int>, int> mp;

void dfs(int u){
    if (visited[u]) return;
    visited[u] = true;
    for (int i = 0; i < edge[u].size(); i++){
        if (visited[edge[u][i]]) continue;
        dp[u]++;
        dfs(edge[u][i]);
    }
}

void dfs2(int u){
    if (used[u]) return;
    used[u] = true;
    int id = 1;
    for (int i = 0; i < edge[u].size(); i++){
        if (used[edge[u][i]]) continue;
        int a = u; int b = edge[u][i];
        if (a > b) swap(a, b);
        if (id == color[u]) id++;
        solve[mp[{a, b}]] = id;
        color[edge[u][i]] = id;
        id++;
        dfs2(edge[u][i]);
    }
}

int main(){
    int n;
    cin >> n;
    int a, b;
    for (int i = 0; i < n - 1; i++){
        cin >> a >> b;
        a--; b--;
        //aの方が小さいとしておく
        if (a > b) swap(a, b);
        mp[{a, b}] = i;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    dfs(0);
    int ans = dp[0];
    for (int i = 1; i < n; i++) ans = max(ans, dp[i] + 1);
    dfs2(0);
    cout << ans << endl;
    for (int i = 0; i < n - 1; i++) cout << solve[i] << endl;
}

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	int n, k;
	cin >> n >> k;
	ll p[n];
	for(int i=0; i<n; i++) cin >> p[i];

	double s[n-k+1];
	fill(s, s+n-k+1, 0.0);
	for(int i=0; i<k; i++) s[0]+=(p[i]+1)/2.0;
	for(int i=1; i+k<=n; i++) s[i]=s[i-1]+(p[i+k-1]+1)/2.0-(p[i-1]+1)/2.0;
	sort(s, s+n-k+1);
	printf("%.9f\n", s[n-k]);
	return 0;
}

Measured memory_bytes: 3328
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    String[] str = new String[3];
    int[] len = new int[3];
    
    for(int i = 0; i < 3; i++){
      str[i] = scan.next();
      len[i] = str[i].length();
    }
    
    int a, b, c;
    char work;
    
    a = 0;
    b = 0;
    c = 0;
    
    work = str[0].charAt(0);
    len[0]--;
    a++;
    
    while(true){
      if(work == 'a'){
        if(len[0] == 0){
          System.out.println("A");
          return;
        }
        work = str[0].charAt(a);
    	len[0]--;
    	a++;
      }
      else if(work == 'b'){
        if(len[1] == 0){
          System.out.println("B");
          return;
        }
        work = str[1].charAt(b);
    	len[1]--;
    	b++;
      }
      else{
        if(len[2] == 0){
          System.out.println("C");
          return;
        }
        work = str[2].charAt(c);
    	len[2]--;
    	c++;
      }
    }
  }

}

Measured memory_bytes: 22604
#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,a,b) for (int i = (a); i < (b); ++i)



ll a,b,x;

ll f(ll i){
    if(i == -1) return 0;
    else return i/x + 1; 
}


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

    cout << f(b) - f(a-1)  <<endl;

    return 0;
}

Measured memory_bytes: 256
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    S = input()
    ans = 0
    cnt = 0
    for i in range(len(S)):
        if S[i] == 'R':
            cnt += 1
            ans = max(ans, cnt)
        else:
            cnt = 0
    # if S[0] == 'R' and S[1] == 'R' and S[2] == 'R':
    #     ans = 3
    # elif (S[0] == 'R' and S[1] == 'R') or S[1] == 'R' and S[2] == 'R':
    #     ans = 2
    # elif 'R' in S:
    #     ans = 1
    # else:
    #     ans = 0
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 61776
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int A, B;
    cin >> A >> B;
    cout << (A <= 8 && B <= 8 ? "Yay!" : ":(") << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
 
 
int main() {
    long long int a,b,n,max = INT_MIN,ans,x;
    cin>>a>>b>>n;
    if(a<b)
    {
    	x  = n-1;
    	ans = floor((a*x)/b)-(a*(floor(x/b)));
    	if(ans>max)
    	{
    		max = ans;
		}
	}
	else if (b!=n)
	{
		x  = n;
    	ans = floor((a*x)/b)-(a*(floor(x/b)));
    	if(ans>max)
    	{
    		max = ans;
		}	
	}
	else
	{
		x  = n-1;
    	ans = floor((a*x)/b)-(a*(floor(x/b)));
    	if(ans>max)
    	{
    		max = ans;
		}
	}
	if(n>b)
	{
		x  = b-1;
    	ans = floor((a*x)/b)-(a*(floor(x/b)));
    	if(ans>max)
    	{
    		max = ans;
		}
	}
	cout<<max<<endl;
}

Measured memory_bytes: 3624
while True:
    try:
        num=int(input())
    except:
        break
    sum=0
    Range=10
    for a in range(Range):
        for b in range(Range):
            for c in range(Range):
                for d in range(Range):
                    if num==a+b+c+d:
                        sum+=1
    print(sum)

Measured memory_bytes: 7552
<?php
fscanf(STDIN, "%d %d %d", $n, $k, $q);

$entrys = array();
$entry = $k - $q;

for ($i = 0; $i < $n; $i++) {
 $entrys[] = $entry;
}

for ($i = 0; $i < $q; $i++) {
 fscanf(STDIN,"%d",$a);
 $entrys[$a - 1] += 1;
}

$result = '';
foreach ($entrys as $entry) {
 if ($entry > 0) {
   $result .= 'Yes';
   $result .= "\n";
 } else {
   $result .= 'No';
   $result .= "\n";
 }
}

echo $result;

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

int main() {
  int n,k,q;
  cin>>n>>k>>q;
  int a[q];
  for(int i=0; i<q; i++){
    cin>>a[i];
  }
  int b[n]={};
  for(int j=0; j<q; j++){
    b[a[j]-1]+=1;
  }
  for(int l=0; l<n; l++){
    if(b[l]>q-k){
      cout<<"Yes"<<endl;
    }
    else{
      cout<<"No"<<endl;
    }
  }
}

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

int main() {
  string s;
  cin >> s;
  int ans = 0;
  for (int i = 0; i < 4; i++) {
    if (s[i] == '+') {
      ans++;
    } else {
      ans--;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 760
def inpl(): return list(map(int, input().split()))

A, B = inpl()

def calca(x):
    return x//A + x%A

X = -(-B//A)*A
Y = calca(X - X//B*B) + X//B
if -(-B//A) < Y:
    print(X)
else:
    print(-1)


Measured memory_bytes: 5600
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repn(i,n) for(ll i=0;i<=(ll)(n);i++)
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
//cin.tie(0);
//ios::sync_with_stdio(false);



signed main(){
    ll n,ans=0;cin>>n;
    vector<ll> v(n);rep(i,n)cin>>v[i];

    for(int i=0;i < n;i++)
    {
        ans+=v[i]/2;
        v[i]%=2;

        if(i<n-1 && v[i] && v[i+1]>0){
            ans++;
            v[i+1]--;
        }
    }
    cout<<ans<<endl;
}

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

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

#define long long ll

int main(){
    string s;
    cin >> s;
    bool judge = true;
    vector<int> count(26,0);
    int idx_a = 'a';
    rep(i,s.size()){
        int idx = s[i];
        count[idx-idx_a] += 1;
    }
    rep(i,count.size()){
        if(count[i] %2 == 1) judge = false;
    }
    if (judge == true){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import sys
SA = list(caracter for caracter in input())
SB = list(caracter for caracter in input())
SC = list(caracter for caracter in input())
queue = []
queue.append(SA[0])
del SA[0]
while len(queue) != 0:
    card = queue[0]
    if card == 'a':
        del queue[0]
        if len(SA) != 0:
            queue.append(SA[0])
            del SA[0]
        else:
            print('A')
            sys.exit(0)
    elif card == 'b':
        del queue[0]
        if len(SB) != 0:
            queue.append(SB[0])
            del SB[0]
        else:
            print('B')
            sys.exit(0)
    else:
        del queue[0]
        if len(SC) != 0:
            queue.append(SC[0])
            del SC[0]
        else:
            print('C')
            sys.exit(0)


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

string S;

int main() {
	cin >> S;

	int ans = INT32_MAX;
	for( int i = 0; i < S.size() - 2; i++ ) {
		int n = (S[i] - '0') * 100 + (S[i + 1] - '0') * 10 + (S[i + 2] - '0');
		ans = min( ans, abs( n - 753 ) );
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    System.out.println((n * (n - 1) / 2) + (m * (m - 1))/2);
  }
}

Measured memory_bytes: 21844
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;

public class Main {

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

		long n = Long.parseLong(br.readLine());

		long ans = modpow(10, n, 1000000007) - modpow(9, n, 1000000007) - modpow(9, n, 1000000007)
				+ modpow(8, n, 1000000007);
		ans = mod(ans, 1000000007);
		System.out.println(ans);
	}

	static long modpow(long a, long n, long mod) {
		long res = 1;
		while (n > 0) {
			if ((n & 1) == 1)
				res = res * a % mod;
			a = a * a % mod;
			n >>= 1;
		}
		return res;
	}

	static long mod(long val, long m) {
		long res = val % m;
		if (res < 0)
			res += m;
		return res;
	}
}

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

int main(){
    int h, w, k;
    int x1, y1, x2, y2;
    static string s[1000002];
    cin >> h >> w >> k;
    cin >> x1 >> y1 >> x2 >> y2;
    for(int i=1;i<=h;++i){
        string c;
        cin >> c;
        s[i] = "@" + c + "@";
    }
    s[0] = ""; s[h+1] = "";
    for(int j=0;j<=w+1;++j){ s[0].push_back('@'); s[h+1].push_back('@'); }

    auto idx = [&](int i, int j){ return (i-1)*w+(j-1); };
    static int64_t dist[4000005];
    for(int i=0;i<idx(h,w)*4+4;++i) dist[i] = INT64_MIN;
    int dx[4] = {0, -1, 1, 0}, dy[4] = {1, 0, 0, -1};
    
    priority_queue<pair<int64_t, tuple<int,int,int>>> q;
    for(int i=0;i<4;++i){
        dist[idx(x1, y1)*4+i] = 0;
        q.emplace(0, tuple<int,int,int>{x1, y1, i});
    }
    
    while(!q.empty()){
        auto [c, pos] = q.top();
        auto [x, y, d] = pos;
        int64_t ccl = (-c+k-1) / k;
        q.pop();
        if(idx(x, y) == idx(x2, y2)){ cout << ccl << endl; return 0; }
        for(int i=0;i<4;++i){
            if(d == i){
                if(s[x+dx[i]][y+dy[i]] == '.' && c-1 > dist[idx(x+dx[i], y+dy[i])*4+i]){
                    dist[idx(x+dx[i], y+dy[i])*4+i] = c-1;
                    q.emplace(c-1, tuple<int,int,int>{x+dx[i], y+dy[i], i});
                }
            }else{
                if(-ccl*k > dist[idx(x, y)*4+i]){ dist[idx(x, y)*4+i] = -ccl * k; q.emplace(-ccl*k, tuple<int,int,int>{x, y, i}); }
            }
        }
    }
    cout << -1 << endl;

    return 0;
}

Measured memory_bytes: 79372