akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <climits>
#define ll   long long int 
#define mod 1000000007
#define inf  200000000000000
#define eps  0.0000000000001
using namespace std ;  
int main()
{
   ios::sync_with_stdio(false);cin.tie(0) ;cout.tie(0) ; 
   ll n , k ;cin>>n>>k  ; 
   ll arr[n + 1];
   ll mina =  inf ; 
   ll minindex ; 
   for(ll i  = 1 ; i <= n  ;++i)
   {
     cin>>arr[i] ; 
     if(arr[i] < mina) 
      {
         mina  =arr[i] ;  
         minindex  =  i ;  
      } 
   }
  ll i  = minindex ;
  if(i - k  <= 0)
  {
    ll cur = i + (k - i)  ; 
    ll ans = 1 ; 
     while(cur < n)
     {
       ans++ ; 
       cur += (k-1) ;
     
     }
     cout<<ans ;
  }
  else if(i + k - 1 >= n  )
  {

    ll cur =  i -  ( (i + k - 1 ) - n)  ; 
    ll ans = 1 ; 
     while(cur > 1 )
     {
       ans++ ; 
       cur -= (k-1) ;
      
     }
     cout<<ans ; 

  }
  else
  {
    ll x =  (n - i + ( k  - 2))/(k-1) ; 
    ll cur = n  -  (k-1)*x ; 
    ll ans  = x ; 
     while(cur > 1 )
     {
       ans++ ; 
       cur -= (k-1) ;
      
     }
     cout<<ans ; 
  }

  
return   0 ; }


Measured memory_bytes: 1024
/*
 * author :Sadik Hassan
 *
*/
#include "bits/stdc++.h"
using namespace std;
#define ll            long long
#define nl            "\n"
#define PB            push_back
#define fi            first
#define se            second
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define rep(i,n)      for(int i=0;i<n;i++)
#define repn(i,n)     for(int i=1;i<=n;i++)
#define rrep(i,n)     for(int i=n-1;i>=0;i--)
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
#define TSFL(s)       transform(s.begin(),s.end(),s.begin(),::toupper);
#define TSFH(s)       transform(s.begin(),s.end(),s.begin(),::tolower);
/*---------------------------------------------------------------------*/
const int N = 2e5+10;
const int INF = (int)1e9+5;

int main()
{
    _SAD()
    int x,y,a,b,c,t;
    cin>>x>>y>>a>>b>>c;
    vector<int>aa(a),bb(b),cc;
    rep(i,a)cin>>aa[i];
    rep(i,b) cin>>bb[i];
    rep(i,c) cin>>t,cc.PB(t);
    sort(aa.rbegin(),aa.rend());
    sort(bb.rbegin(),bb.rend());
    sort(cc.rbegin(),cc.rend());
    vector<int>sap;
    for(int i=0;i<min(x,a);i++)
    {
        sap.PB(aa[i]);
    }
    for(int i=0;i<min(y,b);i++)
    {
        sap.PB(bb[i]);
    }
    sap.insert(sap.end(),cc.begin(),cc.end());
    int ss=SZ(sap);
    VSRT(sap);
    ll ans=0;
    for(int i=ss-x-y;i<ss;i++)
    {
        ans+=sap[i];
    }
    cout<<ans<<nl;
    return 0;
}


Measured memory_bytes: 3316
import itertools
import sys
input = sys.stdin.readline

S = input().rstrip('\n')
N = len(S)

print(2*min(S.count('0'), S.count('1')))

# for i in itertools.count():
#     # print(S)
#     S = S.replace('01', '').replace('10', '')
#     if not S:
#         break
#     if S.count('0') == 0 or S.count('1') == 0:
#         break

# print(N-len(S))


Measured memory_bytes: 9072
#include<stdio.h>
int main()
{
	int i,a,b,c,d,max=0,s=0;
	scanf("%d",&a);
	while(a!=0){
		s=0;
max=0;
	for(i=0;i<a;i++){
		scanf("%d %d %d",&b,&c,&d);
		c=c+d;
		if(max<c){
			max=c;
			s=b;
		}
	}
	
	printf("%d %d\n",s,max);
	scanf("%d",&a);
	}
	return 0;
}

Measured memory_bytes: 600
n = int(input())
h = list(map(int,input().split()))
dp= [0]*n
dp[0]=0
dp[1]=abs(h[1]-h[0])
for i in range(2,n):    
  pre_1 = abs(h[i]-h[i-1]) + dp[i-1]
  pre_2 = abs(h[i]-h[i-2]) + dp[i-2]
  dp[i] = min(pre_1,pre_2)  
print(dp[-1])  

Measured memory_bytes: 13980
n=int(input())
l=list(map(int,input().split()))
l.sort()
k=[]
ans=0
import bisect
for i in range(1,n):
	for j in range(i):
		p=l[j]+l[i]
		q=bisect.bisect_left(l,p)
		ans+=q-i-1
print(ans)



Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define ll long long
struct act
{
	int a, b, c;
};

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

	int n;
	cin >> n;
	int dp[n][3];
	vector<act> vc(n + 1);
	for (int i = 0; i < n; i++)
		cin >> vc[i].a >> vc[i].b >> vc[i].c;
	dp[0][0] = vc[0].a;
	dp[0][1] = vc[0].b;
	dp[0][2] = vc[0].c;
	for (int i = 1; i < n; i++) {
		dp[i][0] = vc[i].a + max(dp[i - 1][1], dp[i - 1][2]);
		dp[i][1] = vc[i].b + max(dp[i - 1][0], dp[i - 1][2]);
		dp[i][2] = vc[i].c + max(dp[i - 1][0], dp[i - 1][1]);
	}
	cout << max({dp[n - 1][0], dp[n - 1][1], dp[n - 1][2]});
	return 0;
}

Measured memory_bytes: 5572
/* Alohomora */
#include<bits/stdc++.h>
#define ll         long long
#define fl(i,n)    for(i=0;i<n;i++)
#define fld(i,a,b) for(i=a;i>b;i--)
#define fli(i,a,n) for(i=a;i<n;i++)
#define inp(i,a,n) for(i=0;i<n;i++) {cin>>a[i];}
#define op(i,a,n)  for(i=0;i<n;i++) {cout<<a[i]<<" ";}
#define pb         push_back
#define mp         make_pair
#define mod1        987654319 
#define speedup    ios_base::sync_with_stdio(false),cin.tie(0)
using namespace std;
ll fact(ll n){ if(n==0){return 1;}return (n*fact(n-1))%mod1;}
ll power(ll x, ll y,ll mod){ll out = 1;while (y > 0){if (y & 1) out=(out*x)%mod;y = y>>1;x = (x*x)%mod;}return out%mod;}
ll inverse(ll a){return power(a,mod1-2,mod1);}
ll gcd(ll a,ll b){if(b==0){return a;}gcd(b,a%b);}
ll a[2000000];
void sieve(){ll i,j;fli(i,2,1000001){if(a[i]==0){for(j=i*i;j<1000001;j+=i){a[j]=1;}}}}
map<ll,vector<ll> >m1;
vector<ll>v1;
bool compar(const pair<ll,ll> &a, const pair<ll,ll> &b) 
{ 
    return (a.second < b.second);
} 
ll level[1000000];
vector<ll>root;
void comp()
{
	ll i,j,n,p,k;
	cin>>n>>p>>k;
	cout<<min(n*p,k)<<"\n";
} 
int main()
{
	speedup;
	ll i=0,t;
	ll n;
	//cin>>t;
	t=1;
	while(t--)
	{
	 comp();
	}
}

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

using namespace std;
int main(){
    int a,c,d,b;
    cin >> a >> b >> c >> d;
    int flag = 0;
    if(abs(a-c)<=d) cout << "Yes" << endl;
    else{
       if(abs(a-b)<=d && abs(b-c)<=d)
         cout << "Yes" << endl;
       else cout << "No" << endl;
    }
    return 0;
}

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

enum Sauce{ NOT_DETERMINED = 0, Tomato = 1, Cream = 2, Basil = 3 };
enum Seq{ SAME, DIFF };

const int divisor = 10000;

class Pasta{
public:
	Pasta(int _N);
	~Pasta();

	void setSauce(int A, Sauce B){ sauceary[A] = B; }
	int schedule(int i, Sauce yesterday, Seq seq);

private:
	int N;
	int*** memo;
	Sauce* sauceary;
};

Pasta::Pasta(int _N){
	N = _N;
	sauceary = new Sauce[N + 1];
	memo = new int**[N + 1];

	for (int i = 0; i <= N; i++) sauceary[i] = NOT_DETERMINED;

	for (int i = 0; i <= N; i++){
		memo[i] = new int*[4];
		for (int j = 0; j < 4; j++){
			memo[i][j] = new int[2];
			memo[i][j][SAME] = -1;
			memo[i][j][DIFF] = -1;
		}
	}
}

Pasta::~Pasta(){
	delete[] sauceary;
	delete[] memo;
}

int Pasta::schedule(int i, Sauce yesterday, Seq seq){
	if (i == N + 1) return 1;
	if (memo[i][yesterday][seq] >= 0) return memo[i][yesterday][seq];

	if (seq == SAME && yesterday == sauceary[i]){
		memo[i][yesterday][SAME] = 0;
		return 0;
	}

	if (sauceary[i] == NOT_DETERMINED){
		int tmpmemo = 0;

		for (int si = 1; si <= 3; si++){
			if ((Sauce)si == yesterday && seq == SAME) continue;
			else tmpmemo += schedule(i + 1, (Sauce)si, ((Sauce)si == yesterday ? SAME : DIFF)) % divisor;
		}
		memo[i][yesterday][seq] = tmpmemo % divisor;
	}
	else {
		memo[i][yesterday][seq] = schedule(i + 1, sauceary[i], (yesterday == sauceary[i] ? SAME : DIFF)) % divisor;	
	}
	return memo[i][yesterday][seq];
}

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

	Pasta* pasta = new Pasta(N);

	for (int i = 0; i < K; i++){
		int A, B;
		cin >> A >> B;
		pasta->setSauce(A, (Sauce)B);
	}

	cout << pasta->schedule(1, NOT_DETERMINED, DIFF) << endl;

	delete pasta;
	return 0;
}

Measured memory_bytes: 1212
#include <stdio.h>
 
int main(void){
  
  int k,n;
  int a[200000];
  int i,d=0;
  
  scanf("%d %d", &k, &n);
  for(i = 0; i < n; i++){
    scanf("%d", &a[i]);
  }
  
  for(i = 0; i < (n-1); i++){
    if((a[i+1]-a[i]) > d){
      d = (a[i+1]-a[i]);
    }
  }
  if((k-a[n-1]+a[0]) > d){
    d = (k-a[n-1]+a[0]);
  }
  printf("%d", (k-d));
  
  return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <cstdio>
#include <sstream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <cctype>
#include <stack>
#include <bitset>
#include <unordered_set>
#include <map>
#include <set>
#include <cmath>
//#include <bits/stdc++.h>

using namespace std;
typedef long long lolo;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef unsigned long long ulolo;

const int maxn = (int)1e5 + 5;
const lolo maxx = (lolo)10000001;
const int maxm =(int)2e3 + 5;
const int INF = 0x3f3f3f3f;
const lolo inf = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-6;
const int MOD = (int)1e6 + 3;

template<class T>
inline void read(T &x) {
    x = 0; T flag = 1;char c;
    do { c = (char) getchar(); if (c == '-') break; } while (c < '0' || c > '9');
    if (c == '-') { c = '0', flag = -1;}
    do { x = x * 10 + c - '0';c = (char) getchar();} while (c >= '0' && c <= '9');
    x *= flag;
}
template<class T>
inline void out(T x) {
    if (x > 9) out(x / 10);
    x = x % 10;
    putchar('0' + x);
}

int a[maxn];
int main() {
//    freopen("../in.txt", "r", stdin);
    int n;
    read(n);
    int cnt = 0, Min = INF;
    lolo ans = 0;
    for (int i = 1; i < n+1; ++i) {
        read(a[i]);
        if (a[i] < 0) {
            ++cnt;
        }
        Min = min(Min, abs(a[i]));
        ans += abs(a[i]);
    }
    if (cnt%2==1) {
        ans -= 2*Min;
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using vec=vector<ll>;
using mat=vector<vec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define mod 1000000007
using datas=pair<ll,ll>;
using tdata=pair<datas,ll>;

long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}

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

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

ll modncr(ll n,ll r){
  ll i,plus=1;
  rep(i,r){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}

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

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

void printmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  For(i,0,H+2){
    For(j,0,W+2){cout<<a[i*(W+2)+j];}
    cout<<endl;
  }
}
void inputmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  string ss;
  For(i,1,H+1){
    cin>>ss;
    For(j,1,W+1){
      if(ss[j-1]=='#'){
        a[i*(W+2)+j]=1;
      }else{
        a[i*(W+2)+j]=0;
      }
    }
  }
}

int main(){
  ll i,j,N,K,p,cnt=0;
  cin>>N>>K;
  vec v(N);
  rep(i,N)cin>>v[i];
  rep(i,N-1){
    For(j,i+1,N){
      if(v[i]!=v[j]){
        if(v[i]>v[j]){
          p=(K+1)*K/2;
          cnt=(cnt+p%mod)%mod;
        }else{
          p=(K-1)*K/2;
          cnt=(cnt+p%mod)%mod;
        }
      }
    }
  }
  cout<<cnt<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = 0;
		int a = 0;
		int b = 0;
		n = sc.nextInt();
		sc.nextLine();
		a = sc.nextInt();
		b = sc.nextInt();

		int t = b/n;
		int ans = t*n;

		if(a <= ans && ans <= b){
			System.out.println("OK");
		}else{
			System.out.println("NG");
		}

	}
}

Measured memory_bytes: 27096
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

constexpr ll infl = 10000000000000007LL;
constexpr int inf = 1000000007;

// 最大公約数
template <typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

ll lcm(ll a, ll b) {
    return a * b / gcd(a, b);
}

int main() {
    ll n, m;
    cin >> n >> m;
    string s, t;
    cin >> s >> t;
    ll ans = lcm(n, m);
    for (ll i = 0; i < n; ++i) {
        if (i * m % n == 0) {
            ll j = i * m / n;
            if (s[i] != t[j]) {
                cout << -1 << endl;
                return 0;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = int64_t;
using pii = pair<int, int>;
using pll = pair<int64_t, int64_t>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'

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

  int n, y; cin >> n >> y;
  for (int i = 0; i <= y / 10000; ++i){
    if (i > n) break;
    for (int j = 0; j <= y / 5000; ++j){
      if (i + j > n) break;
      for (int k = 0; k <= y / 1000; ++k){
        if (i + j + k > n) break;
        if (i + j + k == n && 10000 * i + 5000 * j + 1000 * k == y){
          cout << i << " " << j << " " << k << '\n'; return 0;
        }
      }
    }
  }
  cout << -1 << " " << -1 << " " << -1 << '\n';

  return 0;
}

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

#define ll long long

int m,d;
int a,b;

void solve(){
    cin>>m>>d;
    cin>>a>>b;
    if(m!=a){
        cout<<'1'<<endl;
    }else{
        cout<<'0'<<endl;
    }
}

signed main(){
    //while(1)
    solve();
}

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

using namespace std;

#define ll long long

const int mxN = 1e5+5;

int n,m;
vector<int> e[mxN];
int ind[mxN];
int dis[mxN];
bool visited[mxN];

void dfs(int a) {
    visited[a]=true;
    for (int b: e[a]) {
        dis[b] = max(dis[b], dis[a]+1);
        ind[b]--;
        if (ind[b]==0)
            dfs(b);
    }
}

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

    cin >> n >> m;
    while (m--) {
        int a,b;
        cin >> a >> b;
        e[a].push_back(b);
        ind[b]++;
    }

    for (int i=1; i<=n; i++) {
        if (!visited[i] && ind[i]==0) {
            dfs(i);
        }
    }

    int ans=0;
    for (int i=1; i<=n; i++)
        ans = max(ans, dis[i]);
    cout << ans << endl;
}


Measured memory_bytes: 9728
#include <stdio.h>
int main(){
  int n;
  scanf("%d", &n);
  int i = 1;
  for(;i <= n;i++){
    if(i%3 == 0){
      printf(" %d", i);
    }else{
      int temp = i;
      for(;temp >= 3;){
        if(temp%10 == 3){printf(" %d", i); break;}
        else{temp /= 10;}
      }
    }
  }
  printf("\n");
}

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

using namespace std;

const int md = int(1e9) + 7;

inline void add(int &a, int b) {
  a += b;
  if (a >= md) a -= md;
}

inline void sub(int &a, int b) {
  a -= b;
  if (a < 0) a += md;
}

inline int mul(int a, int b) {
  return (int) ((long long) a * b % md);
}

inline int power(int a, long long b) {
  int res = 1;
  while (b > 0) {
    if (b & 1) {
      res = mul(res, a);
    }
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}

inline int inv(int a) {
  a %= md;
  if (a < 0) a += md;
  int b = md, u = 0, v = 1;
  while (a) {
    int t = b / a;
    b -= t * a; swap(a, b);
    u -= t * v; swap(u, v);
  }
  assert(b == 1);
  if (u < 0) u += md;
  return u;
}

const int N = 100010;

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

  int n, a, d = -1;
  cin >> n;
  vector<int> last_pos(n, -1);
  for (int i = 0; i < n + 1; i++) {
    cin >> a; a--;
    if (last_pos[a] != -1) {
      d = i - last_pos[a];
    }
    last_pos[a] = i;
  }

  vector<int> fac(N), finv(N);
  fac[0] = finv[0] = 1;
  for (int i = 1; i < N; i++) {
    fac[i] = mul(fac[i - 1], i);
    finv[i] = inv(fac[i]);
  }

  auto comb = [&](int n, int m) {
    if (n < m) return 0;
    int res = fac[n];
    res = mul(res, finv[m]);
    res = mul(res, finv[n - m]);
    return res;
  };

  int ans;
  for (int i = 1; i <= n + 1; i++) {
    ans = comb(n + 1, i);
    sub(ans, comb(n - d, i - 1));
    cout << ans << '\n';
  }
  return 0;
}


Measured memory_bytes: 2432
A, B = map(int, input().split())

table = []
for x in range(1010):
    a = int(x * 0.08)
    b = int(x * 0.10)
    table.append((a, b))

res = -1
for x in range(1010):
    a, b = table[x]
    if a == A and b == B:
        res = x
        break

print(res)


Measured memory_bytes: 3060
#import<bits/stdc++.h>
#import<atcoder/all>
using namespace std;int I=1e9,N,K,a;int main(){cin>>N>>K;int s=2*N,t=s+1;atcoder::mcf_graph<int,long long>G(2*N+2);G.add_edge(s,t,N*K,I);for(int i=0;i<N;i++){G.add_edge(s,i,K,0),G.add_edge(N+i,t,K,0);for(int j=0;j<N;j++)cin>>a,G.add_edge(i,N+j,1,I-a);}cout<<1LL*N*K*I-G.flow(s,t,N*K).second<<'\n';vector A(N,string(N,'.'));for(auto e:G.edges())if(e.from!=s&&e.to!=t&&e.flow)A[e.from][e.to-N]='X';for(auto S:A)cout<<S<<'\n';}

Measured memory_bytes: 3892
#include <bits/stdc++.h>
#define L long long
#define ff first
#define ss second
using namespace std;
int main() {
long double n,k;
cin>>n>>k;
long double sum=0;
for(int i=1;i<=n;i++)
{
    int x=i,c=0;
    while(x<k)
    {
        x<<=1;
        c++;
    }
    sum+=(1/n)*(long double)pow((0.5),c);
}
cout<<setprecision(10)<<fixed<<sum<<endl;
return 0;
}


Measured memory_bytes: 512
#include <stdio.h>
#define M 100
#define N 100

void matrix(int ary[][N],int n,int m){
  int i,j;
  for(i=0;i<n;i++)
    for(j=0;j<m;j++)
      scanf("%d",&ary[i][j]);
}

int main(void) {
  int n,m,l,i,j,k;
   int ma[M][N],mb[M][N];
  unsigned long int mc[M][N]={0};
  scanf("%d %d %d",&n,&m,&l);
  matrix(ma,n,m);
  matrix(mb,m,l);
  for(i=0;i<n;i++)
    for(j=0;j<l;j++)
      for(k=0;k<m;k++)
	mc[i][j]+=ma[i][k]*mb[k][j];
  for(i=0;i<n;i++){
    for(j=0;j<l;j++){
      printf("%ld",mc[i][j]);
      if(j!=(l-1))
	printf(" ");
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;

int main() {
  int N;
  cin >> N;
  auto x = vector<int>(N);
  auto y = vector<int>(N);
  auto h = vector<int>(N);
  for (int i = 0; i < N; ++i) cin >> x[i] >> y[i] >> h[i];

  int cx, cy, ans = -1;
  for (int i = 0; i < 101; ++i) {
    for (int j = 0; j < 101; ++j) {
      int needH = -1;
      for (int k = 0; k < N; ++k) {
        if (h[k] > 0) {
          int tmp = h[k] + abs(x[k] - i) + abs(y[k] - j);
          if (needH == -1) {
            needH = tmp;
          } else if (needH != tmp) {
            needH = -2;
          }
        }
      }
      if (needH == -2) continue;

      for (int k = 0; k < N; ++k) {
        if (h[k] == 0) {
          int tmp = h[k] + abs(x[k] - i) + abs(y[k] - j);
          if (needH > tmp) {
            needH = -2;
          }
        }
      }
      if (needH == -2) continue;

      cx = i;
      cy = j;
      ans = needH;
    }
  }
  cout << cx << ' ' << cy << ' ' << ans << endl;
  return 0;
}


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

public class Main {
    static int n, k;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        k = sc.nextInt();
        n = sc.nextInt();

        if ((k & 1) == 0) {
            System.out.print(k / 2);
            for (int i = 1; i < n; i++) {
                System.out.print(" ");
                System.out.print(k);
            }
            return;
        }

        int[] ns = new int[n];
        Arrays.fill(ns, (k + 1) / 2);
        int cnt = n / 2;
        int trg = n - 1;

        for (int i = 0; i < cnt; i++) {
            while (trg >= 0 && ns[trg] == 0) trg--;
            if (ns[trg] == 1) {
                ns[trg] = 0;
                continue;
            }

            ns[trg]--;
            for (int j = trg + 1; j < n; j++) {
                ns[j] = k;
                trg++;
            }

        }

        for (int n : ns) {
            if (n != 0) {
                System.out.print(n);
                System.out.print(" ");
            }
        }
    }
}

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

int main(){
  long long n,i,j,cur,ans=1,mod=1000000007;
  string s;
  cin >> n >> s;
  vector<int> c(26);
  for(i=0; i<n; i++){
    c[s[i]-'a']++;
  }
  for(i=0; i<26; i++){
    cur=c[i]+1;
    ans=(ans*cur)%mod;
  }
  cout << ans-1;
}
  

Measured memory_bytes: 512
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String x = sc.next();
    Map<String, String> enki = new HashMap<String, String>();
    enki.put("A", "T");
    enki.put("T", "A");
    enki.put("C", "G");
    enki.put("G", "C");
    System.out.print(enki.get(x));
  }
}


Measured memory_bytes: 21588
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> x(n),y(n);
    for (int i=0; i<n; i++) cin >> x[i] >> y[i];
    double s=0;
    for (int i=0; i<n; i++) {
        for (int j=0; j<n; j++) {
            int p = x[i]-x[j];
            int q = y[i]-y[j];
            s += sqrt(p*p+q*q);
            }
        }
  printf("%20.20f", s/n);
}


Measured memory_bytes: 3772
#include <iostream>
#include <string>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <algorithm>
#include <ctime>
#include <vector>
#include <set>
#include <queue>
using namespace std;

#define PI 3.14159265358979323846264338327950L

int res;

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

    long long int N, K;
    cin >> N >> K;

    if (N % K < K - N % K)
    {
        cout << N % K << endl;
    }
    else
    {
        cout << K - N % K << endl;
    }
    return 0;
}

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

using namespace std;

#define intt long long
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);

const int N = 100005;

int main() {

	FAST;

	int a, v;
	int b, w;
	int t;
	cin >> a >> v >> b >> w >> t;
	if (v <= w) {
		cout << "NO\n";
	}
	else {
		int k = (abs(b - a) + (v - w - 1)) / (v - w);
		cout << ((k <= t) ? "YES\n" : "NO\n");
	}
	return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
	string s;
	cin >> s;
	int mx = 0;
	int t = 0;
	rep(i,s.size()) {
		if (s[i] == 'R') t++;
		else {
			mx = max(t, mx);
			t = 0;
		}
	}
	mx = max(mx, t);
	cout << mx << endl;
}

int main() {
	solve();
	return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
int digit(int n){
  int ans=0;
  while(n!=0){
    ans+=n%10;
    n=n/10;
  }
  return ans;
}
int main(){
  int n;
  cin >> n;
  if(n % digit(n)==0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std ;
#define rep(i,n) for(int i =0;i<n;i++)
const int maxN=100000;
int a[maxN];
int main(){
    int n,count=0;
	cin>>n;
	rep(i,n)
	{cin>>a[i];
	}
	sort(a,a+n);
	int ans=a[n/2]-a[(n/2)-1];
	cout<<ans<<endl;
	return 0;	
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

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

	int N;
	cin>>N;
	vector<vector<int>> A(N+1,vector<int>(3,0)),DP(N+1,vector<int>(3,0));

	rep(i,0,N)rep(j,0,3)
	{
		cin>>A[i][j];
	}

	rep(i,0,N)rep(j,0,3)rep(k,0,3)
	{
		if(j==k)continue;
		int ni=i+1,nj=k;
		chmax(DP[ni][nj],DP[i][j]+A[ni-1][nj]);
	}

	int ans=0;
	rep(i,0,3)
	{
		chmax(ans,DP[N][i]);
	}

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

Measured memory_bytes: 11264
#include <algorithm>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map> //pair is also included in this library
#include <stack>
#include <string>
#include <vector>

#define INF INT_MAX/3

#define REP(i, s, n) for(int i = (int)(s); i < (int)(n); i++)

using namespace std;

typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;

int solve(int N, int K, int X, int Y){
  int ans = 0;

  REP(i, 0, N){
    if(i < K){
      ans += X;
    } else {
      ans += Y;
    }
  }
  
  return ans;
}

int main(){
  int ans = 0, N, K, X, Y;
  cin >> N >> K >> X >> Y;

  ans = solve(N, K, X, Y);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define ll long long
#define pb push_back
#define sz(x) (int)(x).size()
#define mp make_pair
#define f first
#define s second
#define all(x) x.begin(), x.end()

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>; ///find_by_order(),order_of_key()
template<class T1, class T2> ostream& operator<<(ostream& os, const pair<T1,T2>& a) { os << '{' << a.f << ", " << a.s << '}'; return os; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& a) {
	os << '{';
	for(int i=0;i<sz(a);i++)
	{
		if(i>0&&i<sz(a)-1)
			os << ", ";
		os << a[i];
	}
	os << '}';
    return os;
}
const int N=2e5+5;
map<pair<int,int>,bool> mapa;
int main()
{
    int h,w,n;
    scanf("%i %i %i",&h,&w,&n);
    vector<pair<int,int> > niz;
    vector<vector<int> > ips(h+1);
    for(int i=0;i<n;i++)
    {
        int x,y;
        scanf("%i %i",&x,&y);
        mapa[{x,y}]=true;
        ips[x].pb(y);
    }
    for(int i=1;i<=h;i++)
        sort(all(ips[i]));
    int range=1;
    for(int i=2;i<=h;i++)
    {
        for(auto p:ips[i])
        {
            if(p<=range)
            {
                printf("%i\n",i-1);
                return 0;
            }
            if(p==range+1)
                range--;
        }
        range++;
    }
    printf("%i\n",h);
    return 0;
}


Measured memory_bytes: 23680
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

#define Int long long
#define pb push_back

using namespace std;
using namespace __gnu_pbds;

#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> 

//Int N,M,K;
Int X,Y,Z,D;

Int B,C;

const int MOD=(int)(1e9+7);
const int MAXN=500005;


vector<Int> adj[MAXN];
vector<Int> degree;
bool VIS[MAXN];     

void vector_input(){
     vector<Int> A(5);
     for(auto &x:A) cin>>x;
}


int main()
{
       double N,M,K;
       cin>>N>>M>>K;
       N=(double)N;
       M=(double)M;
       K=(double)K;
       
       double timer=N/K;
     
       cout<<(timer<= M ? "Yes\n":"No\n");
      
       
       
}

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

using namespace std;

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)

typedef long long ll;
typedef vector<int> vi;

ll mod = 1e9+7;

ll solve() {
    int N, a; cin >> N;
    vi nums;
    rep(i, N) {
        cin >> a;
        nums.push_back(a);
    }

    int res = numeric_limits<int>::max();
    reps(p, 1, 101) {
        int sum = 0;
        for (auto num : nums) {
            sum += (num - p)*(num - p);
        }
        res = min(res, sum);
    }

    return res;
}

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

	cout << solve() << endl;
}


Measured memory_bytes: 3656
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main(){
	long int n,m=0,v=0;
	cin >> n;
	int s[n];
	for(int i=0;i<n;i++){
		cin >> s[i];
		m+=s[i];
		if(s[i]%10==0)v++;
	}
	sort(s,s+n);
	if(v==n){m=0;}
	else if(m%10==0){
		for(int i=0;i<n;i++){
			if((m-s[i])%10!=0){
				m-=s[i];
				break;
		}
	}}
	cout << m << endl;
	

return 0;}

Measured memory_bytes: 256
#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 ALL(x) x.begin(),x.end()
#define REVERSE(x) reverse(x.begin(),x.end())
#define SORT(x,n) sort(x,x)
#define P pair<int,int>
typedef long long LL;
const int INF=1000000007;
using namespace std;
int main(){
    bool humiyasui=true;
    string S;
    int N;
    cin>>S;
    N=S.size();
    FOR(i,0,N){
        char b=S.at(i);
        if(i%2==0){
            if(b=='L'){
                humiyasui=false;
            }
        }
        if(i%2==1){
            if(b=='R'){
                humiyasui=false;
            }
        }
    }
    if(humiyasui){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
}

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

static const int MAX = 100100;
static const int INF = (1 << 29);

vector<int> G[MAX];	// 隣接リスト
list<int> out;	// トポロジカルソートした結果を格納するリスト
bool V[MAX];	// その頂点が完了したかどうか
int N;			// 頂点数
int indeg[MAX];	// その頂点の入次数

int dp[100100];

void tsort() {
	// 入次数の初期化
	for (int i = 0; i < N; i++) {
		indeg[i] = 0;
	}

	// 入次数の設定
	for (int u = 0; u < N; u++) {
		for (int i = 0; i < G[u].size(); i++) {
			// 頂点 u から頂点 v へ辺が繋がっているので入次数をインクリメント
			int v = G[u][i];
			indeg[v]++;
		}
	}

	queue<int> que;
	for (int u = 0; u < N; u++) {
		// 入次数が０で完了していない頂点を幅優先探索
		if (indeg[u] == 0 && !V[u]) {
			que.push(u);
		}
	}

	while (!que.empty()) {
		int v = que.front(); que.pop();
		for (auto nv : G[v]) {
			indeg[nv]--;
			if (indeg[nv] == 0 && !V[nv]) {
				que.push(nv);
				V[nv] = true;
				dp[nv] = max(dp[nv], dp[v]+1);
			}
		}
	}
}

int main() {
	int s, t, M;
	cin >> N >> M;

	for (int i = 0; i < N; i++) V[i] = false;

	// 閉路なし有向グラフ
	for (int i = 0; i < M; i++) {
		cin >> s >> t;
		s--; t--;
		G[s].push_back(t);
	}

	tsort();

	int res=0;
	for(int v=0; v<N; v++) res = max(res, dp[v]);
	cout << res << endl;
}

Measured memory_bytes: 6656
z=int(input())
n=500

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

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

def lcm3(a,b,c):
	return lcm(lcm(a,b),c)

def lcm4(a,b,c,d):
	return lcm(lcm(a,b),lcm(c,d))

a=[0]*(n*n)
x=set([1])
for i in range(n*n//4)[::-1]:
	j=i//((n*n)//16)
	if j==0:
		y1=0
		y2=0
	elif j==1:
		y1=1
		y2=1
	elif j==2:
		y1=0
		y2=1
	else:
		y1=1
		y2=0
	k=i%((n*n)//16)
	m=i+2
	a[n*(4*(k//(n//4))+2*y1)+4*(k%(n//4))+2*y2]=m
	x.add(m)
	while m in x:
		m+=i+2
	a[n*(4*(k//(n//4))+2*y1+1)+4*(k%(n//4))+2*y2+1]=m
	x.add(m)
#print(a)
for i in range(0,n*n):
	if a[i]==0:
		j=i//n
		k=i%n
		if j==0 and k==n-1:
			m=lcm(a[i-1],a[i+n])
			l=m+1
			while l in x:
				l+=m
			a[i]=l
			x.add(l)
		elif j==n-1 and k==0:
			m=lcm(a[i+1],a[i-n])
			l=m+1
			while l in x:
				l+=m
			a[i]=l
			x.add(l)
		elif j==0:
			m=lcm3(a[i-1],a[i+1],a[i+n])
			l=m+1
			while l in x:
				l+=m
			a[i]=l
			x.add(l)
		elif j==n-1:
			m=lcm3(a[i-1],a[i+1],a[i-n])
			l=m+1
			while l in x:
				l+=m
			a[i]=l
			x.add(l)
		elif k==0:
			m=lcm3(a[i+1],a[i-n],a[i+n])
			l=m+1
			while l in x:
				l+=m
			a[i]=l
			x.add(l)
		elif k==n-1:
			m=lcm3(a[i-1],a[i-n],a[i+n])
			l=m+1
			while l in x:
				l+=m
			a[i]=l
			x.add(l)
		else:
			m=lcm4(a[i+1],a[i-1],a[i-n],a[i+n])
			l=m+1
			while l in x:
				l+=m
			a[i]=l
			x.add(l)

#print(max(x))

for i in range(z):
	print(' '.join(map(str,a[i*n:i*n+z])))


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

using namespace std;


#define PI 3.14159265
#define int long long

const int MAXN = 2e5 + 5;

int t[MAXN];
set <int> g[MAXN];

void dfs(int v){

	for(auto to : g[v]){
		g[to].erase(v);
		t[to] += t[v];
		dfs(to);
	}
}

main(){


	int n, q; cin >> n >> q;


	vector <int> a(n), b(n), p(q), x(q);

	for(int i = 0; i < n - 1; i++){
		cin >> a[i] >> b[i];
		a[i]--; b[i]--;
		g[a[i]].insert(b[i]);
		g[b[i]].insert(a[i]);
	}



	for(int i = 0; i < q; i++){
		cin >> p[i] >> x[i];
		p[i]--;
	}


	dfs(0);


	for(int i = 0; i < q; i++){
		t[p[i]] += x[i];
	}


	dfs(0);


	for(int i = 0; i < n; i++){
		cout << t[i] << " ";
	}

	cout << endl;

	return 0;
}

Measured memory_bytes: 57088
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 18, INF = 1000000000;

int N, A[MAXN], B[MAXN], dp[1<<MAXN][51];

int f(int mask, int prev) {
    if (mask == (1<<N)-1) return 0;
    int &ret = dp[mask][prev];
    if (ret == -1) {
        ret = INF;
        int pos = __builtin_popcount(mask);
        int greaterMask = (1<<N)-1;
        for (int i = 0; i < N; i++) {
            greaterMask ^= (1<<i);
            if (mask&(1<<i)) continue;
            int diff = abs(pos - i);
            int val = diff&1 ? B[i] : A[i];
            int swap = abs(pos - (i + __builtin_popcount(mask&greaterMask)));
            if (val >= prev) ret = min(ret, f(mask|(1<<i), val) + swap);
        }
    }
    return ret;
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    
    cin >> N;
    for (int i = 0; i < N; i++) cin >> A[i];
    for (int i = 0; i < N; i++) cin >> B[i];
    
    memset(dp, -1, sizeof(dp));
    int ans = f(0, 0);
    if (ans == INF) ans = -1;
    cout << ans << "\n";
}


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

ll i,j,k;
const ll MOD = 1000000000 + 7;

int main(){
    int n;
    cin>>n;
    ll a[n];
    ll ans=0;
    map<ll,ll> memo;
    REP(i,n){
        cin>>a[i];
    }
    

    REP(i,n){
        if(memo.find(i+1-a[i])!=memo.end()){
            ans+=memo[i+1-a[i]];
        }
        if(memo.find(i+1+a[i])!=memo.end()){
            memo[i+1+a[i]]++;
        }
        else{
            memo[i+1+a[i]]=1;
        }
    }
    cout<<ans<<'\n';
    return 0;
}

Measured memory_bytes: 17664
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = 999999999;

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

    llint X, Y;
    cin >> X >> Y;
    
    llint i = 0;
    for(; X<=Y; i++) X*=2;
    cout << i << "\n";
    return 0;
}

Measured memory_bytes: 256
const main = (input) => {
    const args = input.split('\n');
    const N = parseInt(args[0], 10);
    const nums = args.slice(1, N + 1);
    const isValid = nums.every((n) => {
        const ns = n.split(' ');
        const t = parseInt(ns[0], 10),
            x = parseInt(ns[1], 10),
            y = parseInt(ns[2], 10);
        const sum = x + y;

        return (t >= sum) && ((t % 2) === (sum % 2));
    });

    if (isValid) {
        console.log('Yes');
    } else {
        console.log('No');
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29932
#include<iostream>
#include<stdio.h>
#include<string>
#include<cmath>
#include<math.h>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<unordered_map>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rep2(i,n) for(int i = -1; i < (n); i++)
#define PI 3.141592653589793

using namespace std;
using ll = unsigned long long;

const ll MA = 10000000 ;

ll to[MA];

int main() {

	ll n;
	cin >> n;
	ll ans = 1;

	for (ll i = 2; i <= n; i++) {
		ll j = i;
		while (j <= n) {
			to[j] += 1;
			j += i;
		}
		ans += i * (to[i]+1);
		
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 81740
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//pair sort
bool compare_by_b(pair<LL, LL> a, pair<LL, LL> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}


void solve(long long N){
    cout<<"ABC"<<N<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    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 M = sc.nextInt();
        int[] Lz = new int[M];
        int[] Rz = new int[M];
        for (int m = 0; m < M; m++){
            Lz[m] = sc.nextInt();
            Rz[m] = sc.nextInt();
        }
        int left = 0;
        int right = N;
        for (int m = 0; m < M; m++){
            if (Lz[m] > left) left = Lz[m];
            if (Rz[m] < right) right = Rz[m];
            if (left > right) {
                System.out.println("0");
//                break;
                System.exit(0);
            }
        }
        System.out.println(right-left+1);
    }
}

Measured memory_bytes: 74912
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
using namespace std;
int m;

struct Node {
	int key;
	Node* parent, * left, * right;
};

Node* root, * NIL;

void insert(int k)
{
	Node* y = NIL;
	Node* x = root;
	Node* z;

	z = (Node*)malloc(sizeof(Node));
	z->key = k;
	z->left = NIL;
	z->right = NIL;

	while (x != NIL)
	{
		y = x;
		if (z->key < x->key) {
			x = x->left;
		}
		else {
			x = x->right;
		}
	}
	z->parent = y;
	if (y == NIL) {
		root = z;
	}
	else {
		if (z->key < y->key) {
			y->left = z;
		}
		else {
			y->right = z;
		}
	}
}

void inorder(Node* u)
{
	if (u == NIL) return;
	inorder(u->left);
	printf(" %d", u->key);
	inorder(u->right);
}
void preorder(Node* u)
{
	if (u == NIL) return;
	printf(" %d", u->key);
	preorder(u->left);
	preorder(u->right);
}

int main()
{
	string cmd;
	int x;
	cin >> m;
	for (int i = 0; i < m; i++) {
		cin >> cmd;
		if (cmd == "insert") {
			cin >> x;
			insert(x);
		}
		else if (cmd == "print") {
			inorder(root);
			printf("\n");
			preorder(root);
			printf("\n");
		}
	}
	return 0;
}


Measured memory_bytes: 26684
def rc()
  while true
    x,y,s = gets.split(' ').map(&:to_i)
    break if [x,y,s] == [0,0,0]
    c = []
    for i in 1..s-1
      a = i
      for j in 1..s-1
        b = j
        if a*(100+x)/100 + b*(100+x)/100 == s
          c << a*(100+y)/100 + b*(100+y)/100
        end
      end
    end
    puts c.max
  end
end

rc()

Measured memory_bytes: 8876
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();
        
        out.println(Math.max(c-(a-b), 0));
        out.flush();
    }
    
    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
        
        public FastScanner(Reader in) {
            br = new BufferedReader(in);
        }
        
        public FastScanner() {
            this(new InputStreamReader(System.in));
        }
        
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        
        int nextInt() {
            return Integer.parseInt(next());
        }
        
        long nextLong() {
            return Long.parseLong(next());
        }
        
        double nextDouble() {
            return Double.parseDouble(next());
        }
        
        String readNextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 23124
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

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

	cin >> N >> M;
	N *= 500;
	if (N >= M)cout << "Yes\n";
	else cout << "No\n";
}


Measured memory_bytes: 256
import collections
N=int(input())
S=list(input())
c=collections.Counter(S)
Eleft=0
Wleft=0
Eright=c["E"]
Wright=c["W"]
cnt=0
mi=float("inf")
l=[c['E'],c['W']]
for i in range(N):
    if S[i]=="E":
        Eright=Eright-1
    elif S[i]=="W":
        Wright=Wright-1
    #print(Eleft,Wleft,Eright,Wright)
    cnt=Wleft+Eright
    if cnt<mi:
        mi=cnt
    if S[i]=="E":
        Eleft=Eleft+1
    elif S[i]=="W":
        Wleft=Wleft+1
print(mi)

Measured memory_bytes: 64240
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, s=0;
  cin >> n;
  vector<int>l(n);
  for(int i=0;i<n;i++) cin >> l[i];
  sort(l.begin(),l.end());
  for(int i=0;i<n-2;i++){
    for(int j=i+1;j<n-1;j++){
      for(int k=j+1;k<n;k++){
        if(l[j]<l[i]+l[k] && l[k]<l[j]+l[i]) s++;
      }
    }
  }
  cout<<s;
  
}


Measured memory_bytes: 256
//code by 27.
#include<stdio.h>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<queue>
#include<map>
#include<stack>
#include<fstream>
#include<stdlib.h>
#include<set>
#include<cassert>
#include<climits>
#include<cmath>
#include<memory.h>
using namespace std;
int main()
{
	int a[60];
	int n,k;
	cin>>n>>k;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	sort(a,a+n);
	int s=0;
	for(int i=n-1;i>=n-k;i--)
	{
		s+=a[i];
	}
	cout<<s;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = LLONG_MAX;

int main()
{
    int n, x;
    cin >> n >> x;
    int ans = 1;
    vector<int> l(n);
    int d = 0;
    for (int i = 0; i < n; i++)
    {
        int l;
        cin >> l;
        d = d + l;
        if (x >= d)
            ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
string s;
int main(void){
    cin>>s;
    for(int i=0;i<s.size();i++){
        if(s[i]!=','){
            cout<<s[i];
        }else{
            cout<<" ";
        }
    }
    cout<<endl;
    
}


Measured memory_bytes: 3596
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair< int, int> P;

static const double EPS = 1e-8;
static const double PI = 3.141592653589;
static ll INF = 9999999;
int mod = 1000000007;

#define REP(i,n)	for(int i=0;i<(int)n;++i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define MIN(a,b)    (a) < (b) ? (a):(b)
#define MAX(a,b)    (a) > (b) ? (a):(b)
#define debug(x) cerr << #x << " = " << x << endl;
int dx[] = {1,-1,0,0,1,-1,1,-1};
int dy[] = {0,0,1,-1,-1,1,1,-1};

using namespace std;





int main() {
    int a,b,c;
    int ans[12];
    cin >> a >> b >>c ;
    ans[a] ++;
    ans[b]++;
    ans[c]++;

    if(ans[7] == 1 && ans[5] == 2){
        cout << "YES" << endl;

    }else{
        cout << "NO" << endl;
    }


    




    return 0;
}

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

int main(){
	cout << fixed <<  setprecision(8);
	while(1){
		int n;
		int t[1000];
		cin >> n;
		if (n == 0) break;
		int sum=0;
		for (int i = 0; i < n; i++){
			cin >> t[i];
			sum += t[i];
		}
		double m = double(sum)/n;
		double sigma=0;
		for (int i = 0; i < n; i++){
			sigma += (t[i]- m)*(t[i] - m);
		}
		sigma /= n;
		cout << sqrt(sigma) << endl;
	}
}


Measured memory_bytes: 3304