akhauriyash/Code-Regression huggingface dataset:
import sys
from collections import defaultdict,deque

def main():
    input = sys.stdin.readline
    n,m = map(int,input().split())
    #+路線*chg : その路線ホーム
    chg = 10**6

    edge=defaultdict(set)
    used =defaultdict(bool)
    for i in range(m):
        p,q,c = map(int,input().split())
        edge[p].add(p+c*chg)
        edge[p+c*chg].add(p)
        edge[p+c*chg].add(q+c*chg)
        edge[q+c*chg].add(p+c*chg)
        edge[q].add(q+c*chg)
        edge[q+c*chg].add(q)
        used[p] = False
        used[q] = False
        used[p+c*chg] = False
        used[q+c*chg] = False

    edgelist = deque()
    edgelist.append((1,0))
    res = float("inf")
    while len(edgelist):
        x,cost = edgelist.pop()
        used[x] = True

        if x == n:
            res = cost
            break
        for e in edge[x]:
            if used[e]:
                continue
            #行先が改札
            if x <= 10**5 and chg <= e:
                edgelist.appendleft((e,cost+1))
            else:
                edgelist.append((e,cost))
            
    if res == float("inf"):
        print(-1)
    else:
        print(res)
if __name__ == '__main__':
    main()

Measured memory_bytes: 216172
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define rrep(i,n) for(int (i)=1;i<=(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define MOD 1000000007
#define INF 1e18
#define int long long
#define endl "\n"
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};

int h, w, k;
char c[8][8];
int hc[8], wc[8];

signed main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
	
	cin >> h >> w >> k;
	int dcnt = 0;
	rep(i, h) {
		rep(j, w) {
			cin >> c[i][j];
			if(c[i][j] == '#') {
				dcnt++;
				hc[i]++;
				wc[j]++;
			}
		}
	}
	int ans = 0;
	for(int biti = 0; biti < (1 << h); biti++) {
		rep(bitj, (1 << w)) {
			int now = 0;
			// rep(i, h) {
			// 	rep(j, w) {
			// 		// if((biti >> i) & 1) now += wc[i];
			// 		// if((bitj >> j) & 1) now += hc[j];
			// 		// if(((biti >> i) & 1) && ((bitj >> j) & 1)) {
			// 		// 	if(c[i][j] == '#') now--;
			// 		// }
			// 	}
			// }
			// // if(dcnt - now == k) ans++;
			// // cout << dcnt - now << endl;
			rep(i, h) {
				if((biti >> i) & 1) now += hc[i];
			}
			rep(j, w) {
				if((bitj >> j) & 1) now += wc[j];
			}
			rep(i, h) rep(j, w) {
				if(((biti >> i) & 1) && ((bitj >> j) & 1)) {
					if(c[i][j] == '#') now--;
				}
			}
			if(dcnt - now == k) ans++;
		}
	}
	cout << ans << endl;
	// int i, j;
	// cin >> i >> j;
	// if(c[i][j] == '#') cout << hc[i] + wc[j] - 1 << endl;
	// else cout << hc[i] + wc[j] << endl;
	//cout << ans << endl;

	// rep(bit, (1 << h)) {
	// 	rep(i, h) {
	// 		if((bit >> i) & 1) cout << i << " ";
	// 	}
	// 	cout << endl;
	// }
	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define god dimasi5eks
#pragma GCC optimize("O3")
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define mod 1000000007
#define dancila 3.14159265359
#define eps 1e-9

// #define fisier 1

using namespace std;

typedef long long ll;


int add(int a, int b)
{
    int x = a+b;
    if(x >= mod)
        x -= mod;
    if(x < 0)
        x += mod;
    return x;
}
ll mul(ll a, ll b)
{
    return (a*b) % mod;
}

ll pw(ll a, ll b)
{
    ll ans = 1;
    while(b)
    {
        if(b & 1)
            ans = (ans * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return ans;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long rand_seed()
{
    long long a = rng();
    return a;
}


int n;
pair<int, int> val[2002];

ll dp[2002][2002];
int main()
{

    #ifdef fisier
        ifstream f("input.in");
        ofstream g("output.out");
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    cin >> n;
    for(int i = 1; i <= n; ++i)
		cin >> val[i].fi, val[i].se = i;
	ll ans = 0;
	sort(val + 1, val + n + 1);
	for(int len = n; len >= 1; --len)
		for(int st = 1; st + len - 1 <= n; ++st)
		{
			if(len == 1)
				ans = max(ans, dp[st][st] + 1LL * val[len].fi * abs(val[len].se - st));
			else
			{
				dp[st+1][st + len - 1] = max(dp[st+1][st + len - 1], dp[st][st + len - 1] + 1LL * val[len].fi * abs(val[len].se - st));
				dp[st][st + len - 2] = max(dp[st][st + len - 2], dp[st][st + len - 1] + 1LL * val[len].fi * abs(val[len].se - (st + len - 1)));
			}
		}
	cout << ans;
	return 0;
}


Measured memory_bytes: 26292
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define mod 998244353
#define fi first
#define se second
#define pii pair<int,int>
#define int long long
#define endl '\n'
#define pll pair<long long,long long>
#define LONGLONG_MAX 100000000000000
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
long long power(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1){ans=(ans*a)%mod;}
                a=(a*a)%mod;
                b>>=1;
        }
    return ans;
        
}

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    cin>>s;
    if(s=="ABC")cout<<"ARC";
    else cout<<"ABC";
    return 0;
}


Measured memory_bytes: 3652
/*input

*/
#include <bits/stdc++.h>
#define up(i,a,b) for(int (i) = (a);(i)<=(b);++(i))
#define down(i,b,a) for(int (i) = (b);i>=(a);--i)
#define debug(x) cerr << (x) << '\n';
#define bits(x,i) ((x >> i) & 1)
#define mid ((l+r)/2)
#define pr pair<int,int>
using namespace std;
int n,x,t;
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> n >> x >> t;
	cout << (n / x + (n % x != 0)) * t;
}

Measured memory_bytes: 3512
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const int MOD = 1e9+7;


#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<int>>

using namespace std;
ll dp[100005];

ll stair(ll i,vector<ll> h){
    if(dp[i] != -1){
        return dp[i];
    }
    return dp[i] = min(abs(h[i]-h[i-2])+stair(i-2,h),abs(h[i]-h[i-1])+stair(i-1,h));

}


int main(){
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<ll> h(n+1);
    h[0] = -MOD;
    REPP(i,1,n+1) cin >> h[i];
    REP(i,n+1) dp[i] = -1;
    if(h.size() > 1){
        dp[0] = MOD;
        dp[1] = 0;
        dp[2] = abs(h[2]-h[1]);
    }

    for(int i = 3; i < n+1;i++){
        // stair(i,h);
        dp[i] = min(abs(h[i]-h[i-2])+dp[i-2],abs(h[i]-h[i-1])+dp[i-1]);
    }

    cout << dp[n] << endl;
    return 0;
}

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

using namespace std;

typedef long long int ll;

vector < pair < char, char > > v;
int n, q;
string s;

bool checkL (int idx) {
  for (auto i : v) {
    if (idx < 0) break;
    if (i.first == s[idx]) {
      if (i.second == 'L') idx--;
      else idx++;
    }
  }

  return (idx < 0);
}

bool checkR (int idx) {
  for (auto i : v) {
    if (idx > n - 1) break;
    if (i.first == s[idx]) {
      if (i.second == 'R') idx++;
      else idx--;
    }
  }

  return (idx > n - 1);
}

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

  cin >> n >> q >> s;
  v.resize(q);
  for (auto &i : v) cin >> i.first >> i.second;

  int lo = 0, hi = n - 1, l = -1, r = n;
  while (lo <= hi) {
    int mid = (hi - lo) / 2 + lo;
    if (checkL (mid)) {
      lo = mid + 1;
      l = max (l, mid);
    } else {
      hi = mid - 1;
    }
  }

  lo = 0, hi = n - 1;
  while (lo <= hi) {
    int mid = (hi - lo) / 2 + lo;
    if (checkR (mid)) {
      hi = mid - 1;
      r = min (r, mid);
    } else {
      lo = mid + 1;
    }
  }

  cout << r - l - 1 << '\n';
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    string s;cin>>s;
    cout<<700+count(all(s),'o')*100<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <string.h>
#include <stdio.h>



int main(void){
	
	int n,m,a,b;

	scanf("%d %d",&n,&m);
	
	int h[n];

	int array[n];

	for(int i=0;i<n;i++)
{
	array[i]=1;
}



	for(int i=0;i<n;i++)
	{
		scanf("%d",&h[i]);
	}

	int count=0;

	for(int i=0;i<m;i++)
	{
		scanf("%d %d",&a,&b);

		if(h[a-1]>h[b-1]){			
			array[b-1]=0;
		}
		else if(h[a-1]<h[b-1]){
			array[a-1]=0;			
		}
		else
		{
			array[a-1]=array[b-1]=0;
			
		}
	}

	for(int i=0;i<n;i++)
	{
		if(array[i]!=0){count++;}
	}

	printf("%d",count);

	return 0;
	}


Measured memory_bytes: 2508
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
template<class T, class Compare = less<T> >
using MaxHeap = priority_queue<T, vector<T>, Compare>;
template<class T, class Compare = greater<T> >
using MinHeap = priority_queue<T, vector<T>, Compare>;
using llong = long long;

llong a, b, k;

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

    if (a - k <= 0) {
        cout << 0 << ' ' << max(0ll, b - (k - a)) << endl;
    }
    else {
        cout << a - k << ' ' << b << endl;
    }

    return 0;
}


Measured memory_bytes: 256
//#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
//using namespace atcoder;
#define int long long
   template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
    const int MAX =3001;
const int MOD =998244353;


  
signed main(){
  int n,x,m;
  cin>>n>>x>>m;
  int k=1,s[m]={};
  while(s[x]==0){
    s[x]=k;
    k++;
    x=x*x%m;
  }
  int ans=0;
  
  for(int i=0;i<m;i++){
    if(s[i]==0)continue;
    if(s[i]<s[x]&&s[i]<=n){
      ans+=i;
      continue;
    }
   if(s[i]<=n) ans+=i*(1+(n-s[i])/(k-s[x]));

  }
  cout<<ans<<endl;

}

Measured memory_bytes: 4396
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#define ll long long
#define pb push_back
#define pf push_front			
#define mp make_pair
#define x first
#define y second
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pi 3.14159265358
#define xmod 1000000007
using namespace std;

ll ans,n,m;
pll d[100005];
int main(){
	scanf("%lld%lld",&n,&m);
	for (int i=1;i<=n;i++){
		scanf("%lld%lld",&d[i].x,&d[i].y);
	}
	sort(d+1,d+1+n);
	for (int i=1;i<=n;i++){
		if (d[i].y < m)
		ans+=d[i].x*d[i].y;
		else
		{
			ans+=d[i].x*m;
			break;
		}
		m-=d[i].y;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1664
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;


int main(){
  ll n; cin >> n; vl an(n);
  rep(i,n){ ll x; cin >> x; an[i] = x; }
  
  ll zougenn = 0; ll count = 0;
  
  for(ll i=0; i < n-1; i++){
    if(an[i] < an[i+1] && zougenn == 0) zougenn = 1;
    if(an[i] > an[i+1] && zougenn == 0) zougenn = -1;
    
    if(an[i] < an[i+1] && zougenn == -1){
      count++; zougenn = 0;
    }
    if(an[i] > an[i+1] && zougenn == 1){
      count++; zougenn = 0;
    }
  }
  
  cout << count+1 << endl;
}
      

Measured memory_bytes: 1024
N = int(input())
A = {}
for i in range(N):
  s = input()
  if s in A:
    A[s] += 1
  else:
    A[s] = 1
s_max = max(A.values())
for j in sorted(k for k in A if A[k] == s_max):
  print(j)

Measured memory_bytes: 35388
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;

int main(void)
{
    string num;
    cin >> num;

    int A = num[0] - '0';
    int B = num[1] - '0';
    int C = num[2] - '0';
    int D = num[3] - '0';

    vector<char> op{'+', '-'};
    int sum;
    for (int i = 0; i < 2; i++)
    {
        for (int j = 0; j < 2; j++)
        {
            for (int k = 0; k < 2; k++)
            {
                sum = 0;
                if (op[i] == '+')
                {
                    sum += A + B;
                }
                else
                {
                    sum += A - B;
                }

                if (op[j] == '+')
                {
                    sum += C;
                }
                else
                {
                    sum -= C;
                }

                if (op[k] == '+')
                {
                    sum += D;
                }
                else
                {
                    sum -= D;
                }

                if (sum == 7)
                {
                    printf("%d%c%d%c%d%c%d=7\n", A, op[i], B, op[j], C, op[k], D);
                    return (0);
                }
            }
        }
    }
    return (0);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll        long long
#define  sci(x)   scanf("%d", &x)
#define  scl(x)   scanf("%lld", &x)
#define  scd(x)   scanf("%lf", &x)
#define l0(i,n)   for(ll i=0; i<n; i++)
 
int main ()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	//CODE TONOY
	ll n,k;
	cin >> n >> k;
	cout<<(ll) min(n%k,k-(n%k));
	return 0;
}
 

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

typedef long long ll;

ll GCD(ll a, ll b) {
    if(b == 0)
	return a;
    return GCD(b,a%b);
}


ll LCM(ll a, ll b) {
    
    ll G = GCD(a,b);

    return a/G * b/G * G;

}

int main() {

    ll a,b;

    while(cin >> a >> b) {

	cout << GCD(a,b) << " " << LCM(a,b) << endl;
    }

    return 0;
}

Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
void search(map<int, int> &a, int &max, int &index)
{
    for (auto i : a)
    {
        if (i.second > max)
        {
            index = i.first;
            max = i.second;
        }
    }
}
void search_sub(map<int, int> &a, int max, int index, int &sub_max, int &sub_index)
{
    for (auto i : a)
    {
        if (i.first != index && i.second > sub_max)
        {
            sub_index = i.first;
            sub_max = i.second;
        }
    }
}
int main()
{
    int n;
    cin >> n;
    int v[n + 1];
    for (int i = 1; i <= n; ++i)
        cin >> v[i];
    map<int, int> even{}, odd{};
    for (int i = 1; i <= n; i += 2)
        odd[v[i]]++;
    for (int i = 2; i <= n; i += 2)
        even[v[i]]++;
    int odd_max(0), even_max(0), odd_index(-1), even_index(-1), sub_odd_max(0), sub_even_max(0), sub_odd_index(-1), sub_even_index(-1);
    search(even, even_max, even_index);
    search(odd, odd_max, odd_index);
    int ans(0);
    if (even_index == odd_index)
    {
        search_sub(even, even_max, even_index, sub_even_max, sub_even_index);
        search_sub(odd, odd_max, odd_index, sub_odd_max, sub_odd_index);
        if (sub_odd_max == 0 && sub_even_max == 0)
            ans += even_max;
        else if (sub_odd_max > sub_even_max)
            odd_max = sub_odd_max;
        else
            even_max = sub_even_max;
    }
    ans += (n / 2 - even_max + (n - n / 2) - odd_max);
    cout << ans << endl;
}

Measured memory_bytes: 5376
program hitachi_string
  implicit none
  character(10) :: s
  integer :: n = 0, i
  read(*,*) s
  n = len_trim(s)
  if (mod(n,2) == 0) then
    do i = 1, n, 2
      if (s(i:i+1) /= "hi") goto 100
    end do
    write(*,'(a)') "Yes"
    stop
  end if
100 write(*,'(a)') "No"
end program hitachi_string

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
int main(){
    int h,w;
    cin>>h>>w;
    long ans=1e10;
    for(long i=1;i<=h;i++){
        long s1=i*w;
        long s2=((h-i)/2)*w;
        long s3=((h-i)/2+(h-i)%2)*w;
        long s4=(h-i)*(w/2);
        long s5=(h-i)*(w/2+(w%2));
        ans=min(ans,max(max(s1,s2),s3)-min(min(s1,s2),s3));
        ans=min(ans,max(max(s1,s4),s5)-min(min(s1,s4),s5));
    }
    for(long i=1;i<=w;i++){
        long s1=i*h;
        long s2=((w-i)/2)*h;
        long s3=((w-i)/2+(w-i)%2)*h;
        long s4=(w-i)*(h/2);
        long s5=(w-i)*(h/2+(h%2));
        ans=min(ans,max(max(s1,s2),s3)-min(min(s1,s2),s3));
        ans=min(ans,max(max(s1,s4),s5)-min(min(s1,s4),s5));
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <typeinfo>
#include <cxxabi.h>
#ifdef LOCAL
  #include "dbgtoki.hpp"
  #define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i)  
#else
  #define DUMP(i)  
#endif

#define TOSTRING(x) #x
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define SSTR( x ) static_cast< std::ostringstream & >( \
        ( std::ostringstream() << std::dec << x ) ).str()
#define ALL(s) (s).begin(), (s).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()) , v.end());
#define SZ(x) ((int) (x).size())
using namespace std;
typedef long long unsigned int llu;
typedef long long ll;


int main (){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  while(cin >> N){
    int prex = 0;
    int prey = 0;
    int pret = 0;
    int ans = true;
    REP(i,N){
      int t,x,y;
      cin >> t >> x >> y;
      int minturn = abs(prex - x) + abs(prey - y);
      int rest = t - pret - minturn;
      if(rest < 0 || rest % 2 == 1){
	ans = false;
      }
      prex = x;
      prey = y;
      pret = t;
    }

    if(ans)cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
def main():
    n, k = map(int, input().split())
    a = [int(i) - 1 for i in input().split()]
    s = 0
    m, l = 0, 0
    p = []
    h = set()
    for _ in range(n):
        p.append(s)
        h.add(s)
        s = a[s]
        if s in h:
            m = p.index(s)
            l = len(h) - m
            break
    if k <= m:
        print(p[k] + 1)
    else:
        print(p[(k - m) % l + m] + 1)

if __name__ == '__main__':
    main()

Measured memory_bytes: 32524
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long min = Long.MAX_VALUE;

        long n = sc.nextLong();
        for (int i = 0; i < 5; i++) {
            long a = sc.nextLong();
            min = Math.min(a, min);
        }

        long ans = 0;
        if (n <= min)
            ans = 5;
        else
            ans = n / min + 5;

        if (n % min == 0)
            ans--;

        System.out.println(ans);
    }
}


Measured memory_bytes: 22996
import java.util.Scanner;
 
class Main{
 
	public static void main(String[] args) {
		
		Scanner stdIn = new Scanner(System.in);
 
		int A = stdIn.nextInt();
		int B = stdIn.nextInt();
		int C;
		
		if (A <= 10) {
			C = B + (100 * (10 - A));
			System.out.println(C);
		}else{
			System.out.println(B);
		}
		
	
	}
}

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


int main()
{
    int n=0;
    cin >> n;
    int p[n], q[n];
    for(int i=0; i<n; i++)
    {
        cin >> p[i];
    }
    for(int i=0; i<n; i++)
    {
        cin >> q[i];
    }
    int arr[n];
    for(int i=0; i<n; i++)
    {
        arr[i] = i+1;
    }


    int a = 0, b = 0, k = 0;

    do {
        k++;
        for(int i=0; i<n; i++)
        {
            if(p[i]!=arr[i]){
                break;
            }
            if(i==n-1){
                if(p[i]==arr[i]){
                    a = k;
                }
            }
        }
        for(int i=0; i<n; i++)
        {
            if(q[i]!=arr[i]){
                break;
            }
            if(i==n-1){
                if(q[i]==arr[i]){
                    b = k;
                }
            }
        }
    } while (next_permutation(arr, arr + n));

    cout << abs(a-b);
}


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

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

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

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


signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,m; cin>>n>>m;
  vector<set<ll>> s(m);
  rep(i,m){
    ll k; cin>>k;
    rep(j,k){
      ll a; cin>>a; a--;
      s[i].insert(a);
    }
  }
  vll p(m);
  rep(i,m) cin>>p[i];
  
  ll ans=0;
  for(ll bit=0; bit<(1<<n); bit++){
    vll cnt(m);
    rep(i,n){
      if(bit>>i&1){
        rep(j,m){
          if(s[j].count(i)) cnt[j]++;
        }
      }
    }
    bool ok=true;
    rep(i,m){
      if(cnt[i]%2!=p[i]) ok=false;
    }
    if(ok) ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define f(i,l,r) for(int i=l;i<=r;i++)
#define debug(x) cout<<#x<<'='<<(x)<<endl
using namespace std;
template<class T> bool maxs(T& a,T& b)
{
    if(a<b)
    {
        T t;
        t=a;
        a=b;
        b=t;
        return true;
    }
    return false;
}
template<class T> bool maxi(T& a,T b)
{
    if(a<b)
    {
        a=b;
        return true;
    }
    return false;
}
template<class T> bool mini(T& a,T b)
{
    if(a>b)
    {
        a=b;
        return true;
    }
    return false;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,wi;
    cin>>n>>wi;
    ll w[n+1],v[n+1];
    f(i,1,n)
    {
        cin>>w[i]>>v[i];
    }
    ll dp[n+1][100001];
    f(i,0,n)
        f(j,0,100000)
            dp[i][j]=INT_MAX;
    f(i,1,n)
    {
        f(j,0,v[i])
            dp[i][j]=min(dp[i-1][j],w[i]);
        f(j,v[i],100000)
            dp[i][j]=min(dp[i-1][j],w[i]+dp[i-1][j-v[i]]);
    }
    for(ll j=100000;j>=0;j--)
    {
        for(ll i=0;i<=n;i++)
        {
            if(dp[i][j]<=wi)
            {

                cout<<j+1;
                return 0;
            }
        }
    }
    cout<<"hi";
    
    return 0;
}

Measured memory_bytes: 79232
using System;
using System.Linq;
class Program
{
	static void Main(string[] args)
	{
		// get a integer
		var N =int.Parse(Console.ReadLine());
				var S =Console.ReadLine();
	var count =0;
		for(int i = 0; i < N; i++){
			if(i>0&&i<(N-1)&&S[i-1]=='A'&&S[i]=='B'&&S[i+1]=='C'){
				count ++;
			}
		}
		Console.Write(count);
	}

}

Measured memory_bytes: 11092
#include <iostream>
#include <algorithm>
#include <vector>
#define SIZE 10
using namespace std;

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

	int a;
	string s;

	cin >> a;
	cin >> s;

	if(a>=3200){
		cout << s << endl;
	}else{
		cout << "red" << endl;
	}

	return 0;
}



Measured memory_bytes: 256
//package Test;

import java.util.*;

public class Main {

    static class Solution {

        void solve(long a, long b, long c, long d){
            long ans1 = Math.max(a * c, a * d);
            long ans2 = Math.max(b * c, b * d);
            System.out.println(Math.max(ans1, ans2));
        }
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long a = scanner.nextLong();
        long b = scanner.nextLong();
        long c = scanner.nextLong();
        long d = scanner.nextLong();
        Solution solution = new Solution();
        solution.solve(a, b, c, d);

    }
}


Measured memory_bytes: 35636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    // Your code here!
    ll n,m;
    cin>>n>>m;
    if(n==m)cout<<"Yes";
    else cout<<"No";
}


Measured memory_bytes: 3608
a,b,c,d=gets.split.map(&:to_i)
s = b-a+1
sc = (b/c) - ((a-1)/c)
sd = (b/d) - ((a-1)/d)
lcm = c.lcm(d)
sl = (b/lcm) - ((a-1)/lcm)
p s - sc - sd + sl


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

int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  cout << ((b - a) % 2 == 0 ? (b - a) / 2 : (b - a) / 2 + min(a, n - b + 1)) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <algorithm>
using namespace std;
long long int lcm(long long int a,long long int b)
{
 
  long long int r, x, tmp;
  x = a * b;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return x/b;
}
int main() {
    long long int ans,a,b,c,d,n;
    cin >> a >> b >> c >> d;
    n = b-a+1;
    a--;
    ans = (b/c) + (b/d) -(b/lcm(c,d)) - (a/c) - (a/d) + (a/lcm(c,d));
    cout << n-ans << endl;
    return 0;
}

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

int main(){
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        int gx,gy;
        cin >> gx >> gy;
        int vert[gx+2][gy+2],horiz[gx+2][gy+2];
        int k;
        cin >> k;
        for(int i = 0; i < gx+2; i++){
            for(int j = 0; j < gy+2; j++){
                if(i == 0 || j == 0){
                    vert[i][j] = 0;
                    horiz[i][j] = 0;
                }else{
                    vert[i][j] = 1;
                    horiz[i][j] = 1;
                }
            }
        }
        for(int i = 0; i < k; i++){
            int mxs,mys,mxg,myg;
            cin >> mxs >> mys >> mxg >> myg;
            if(mxs == mxg && mys > myg){
                horiz[mxs+1][mys+1] = 0;
            }else if(mxs == mxg && mys < myg){
                horiz[mxg+1][myg+1] = 0;
            }if(mys == myg && mxs > mxg){
                vert[mxs+1][mys+1] = 0;
            }else if(mys == myg && mxs < mxg){
                vert[mxg+1][myg+1] = 0;
            }
        }
        //debug
        /*
         for(int j = 0; j < gy+2; j++){
             for(int i = 0; i < gx+2; i++){
                cout << vert[i][j] << horiz[i][j] << " ";
             }
             cout << "\n";
        }
        */
        int hmap[gx+2][gy+2];
        for(int i = 0; i < gx+2; i++){
            for(int j = 0; j < gy+2; j++){
                hmap[i][j] = 0;
            }
        }
        for(int i = 1; i < gx+2; i++){
            for(int j = 1; j < gy+2; j++){
                if(i == 1 && j == 1){
                    hmap[i][j] = 1;
                }else{
                    if(vert[i][j]&& horiz[i][j]){
                        hmap[i][j] = hmap[i-1][j] + hmap[i][j-1];
                    }else if(!vert[i][j] && horiz[i][j]){
                        hmap[i][j] = hmap[i][j-1];
                    }else if(vert[i][j] && !horiz[i][j]){
                        hmap[i][j] = hmap[i-1][j];
                    }else if (!vert[i][j] && !horiz[i][j]){
                        hmap[i][j] = 0;
                    }
                }
            }
        }
        //debug
        /*
        for(int j = 0; j < gy+2; j++){
             for(int i = 0; i < gx+2; i++){
                 cout << hmap[i][j] << " ";
             }
             cout << "\n";
         }
         */
        
        if(hmap[gx+1][gy+1] == 0)
            cout << "Miserable Hokusai!\n";
        else
            cout << hmap[gx+1][gy+1] << "\n";
    }
}

Measured memory_bytes: 3048
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,m;
	cin>>n>>m;
	if(n==1 && m==1){
		cout<<1<<endl;
		return 0;
	}
	if(n>1 && m>1) cout<<n*m-(2*(n+m)-4)<<endl;
	else{
		cout<<n*m-2<<endl;
	}
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
    ost<<"{"<<p.first<<","<<p.second<<"}";
    return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
    ost<<"{";
    for(int i=0;i<v.size();i++){
        if(i)ost<<",";
        ost<<v[i];
    }
    ost<<"}";
    return ost;
}

int N,D;
int X[11][11];

bool sq[22222];

signed main(){
    for(int i=0;i*i<22222;i++)sq[i*i]=true;
    scanf("%lld%lld",&N,&D);
    rep(i,N)rep(j,D)scanf("%lld",&X[i][j]);

    int ans=0;
    rep(i,N)reps(j,i+1,N){
        int s=0;
        rep(k,D)s+=(X[i][k]-X[j][k])*(X[i][k]-X[j][k]);
        if(sq[s])ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <math.h>
#include <utility>
#include <set>
#include <map>
#define INF 1000000000
#define rep(i,n) for(int i =0;i<n;i++)
using namespace std;
typedef long long int ll;


int main(){
    int h,w;
    cin >>h >> w;
    vector<int> area(h*w);
    vector<int> ch(h*w,0);
    queue<pair<int,int> > lis;
    rep(i, h){
        rep(j, w){
            char hoge;
            cin >> hoge;
            if (hoge == '.') {
                area[i*w+j]=-1;
                for (int k=-1; k<2; k++) {
                    for (int l=-1; l<2; l++) {
                        if(k==0 and l==0) continue;
                        if (i+k>0 and i+k<h-1 and j+l>0 and j+l<w-1) {
                            ch[(i+k)*w+j+l]++;
                        }
                    }
                }
            }else{
                area[i*w+j]=(int)hoge-(int)'0';
            }
        }
    }
    rep(i, h){
        rep(j, w){
            if (area[i*w+j]!=-1 and ch[i*w+j]>=area[i*w+j]) {
                lis.push({i,j});
            }
        }
    }
    int ans = 0;
    int flag = 1;
    while (flag > 0) {
        int si = lis.size();
        flag = 0;
        rep(p, si){
            if (ans==0) ans = 1;
            int i = lis.front().first;
            int j = lis.front().second;
            lis.pop();
            area[i*w+j]=-1;
            for (int k=-1; k<2; k++) {
                for (int l=-1; l<2; l++) {
                    if(k==0 and l==0) continue;
                    if (i+k>0 and i+k<h-1 and j+l>0 and j+l<w-1) {
                        ch[(i+k)*w+j+l]++;
                        if (area[(i+k)*w+j+l]!=-1 and ch[(i+k)*w+j+l]==area[(i+k)*w+j+l]) {
                            lis.push({i+k,j+l});
                            flag++;
                        }
                    }
                }
            }
        }
        if(flag > 0) ans++;
    }
    cout << ans << endl;
}

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

using namespace std;

typedef long long ll;

const double eps = 0.00001;
const int MOD = 1000000007; //998244353
const int INF = 1070000055;
const long long LINF = 1223372000000000555;
const int N = 1050555;
const int M = 6525;

void solve(){
    ll d, t, s;
    cin >> d >> t >> s;

    cout << (d <= t * s ? "Yes" : "No");


}


int main() {
    ios_base::sync_with_stdio(false);
#ifdef dddxxz
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else

#endif

    int T = 1;
    //cin >> T;

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

    return 0;
}

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

#define pb push_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define REP(i,n) for(int _n=n, i=0;i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)
#define FORD(i,a,b) for(int i=(a),_b=(b);i>=_b;--i)
using ull = uint64_t;
using ll = int64_t;
using PII = pair<int, int>;
using VI = vector<int>;

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B> string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A> string to_string(A v) {
bool first = true; string res = "{";
for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); }
res += "}"; return res; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H); debug_out(T...); }
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

const int N = 100005;
vector<VI> tree;
int dist1[N], dist2[N];


void dfs(int v, int d, int from, int *arr) {
    arr[v] = d;
    for (int u : tree[v]) {
        if (u == from) continue;
        dfs(u, d + 1, v, arr);
    }
}


int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    int n, u, v;
    cin >> n >> u >> v;
    tree.assign(n + 2, VI());
    REP(i, n - 1) {
        int x, y;
        cin >> x >> y;
        tree[x].pb(y);
        tree[y].pb(x);
    }
    dfs(u, 0, 0, dist1);
    dfs(v, 0, 0, dist2);
    int mx = 0;
    for (int i = 1; i <= n; i++) {
        if (dist1[i] < dist2[i]) {
            mx = max(mx, dist2[i]);
        }
    }
    cout << mx - 1 << "\n";
}

Measured memory_bytes: 11648
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
 
typedef vector<int> vi;;
typedef vector<ll> vll;

#define l() length()
#define sz() size()
 
#define b() begin()
#define e() end()
#define all(x) x.begin(), x.end()
 
#define pb(i) push_back(i)
#define PB() pop_back()
 
 
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
#define mp make_pair
#define Fi first
#define Se second
 
const int maxx=1e6+9;
 
// Happy Coding!



vi arr={100,101,102,103,104,105};
    
    
// Simple combination Sum
bool calc(int sum,int n,vector<vi> &dp){
    if(sum==0){
        return 1;
    }
    if(n<=0 || sum<0){
        return false;
    }
    if(dp[sum][n]!=-1){return dp[sum][n];}
    
    return dp[sum][n]=calc(sum-arr[n-1],n,dp) || calc(sum,n-1,dp);
}
void solve(){

    int sum;
    cin>>sum;
    int n=6;
    vector<vector<int>> dp(sum+1,vector<int> (n+1,-1));
    
    cout<<calc(sum,n,dp)<<endl;
    
}





int main() {
    faster;
    int t=1;
    // cin>>t;
    while(t-->0){
        solve();
    }
	return 0;
}

Measured memory_bytes: 10136
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define endl '\n'
const int mod=1e9+7,u=1e5+5;

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

    int n;
    cin>>n;
    vector<int> h(n+1),dp(n+1);
    for(int i=1;i<=n;i++){
        cin>>h[i];
    }   

    dp[1]=0;
    dp[2]=abs(h[2]-h[1]);
    for(int i=3;i<=n;i++){
        dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
    }
    cout<<dp[n];

    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
 
using namespace std;
int main()
{
  long long int n;
  cin>>n;
  string s;
  cin>>s;
  if(!(n&1))
  {
    int flag=0;
    for(int i=0; i<n/2; i++)
    {
      if(s[i]!=s[n/2+i])
      {
        flag=1;
        break;
      }
    }
    if(flag) cout<<"No";
    else cout<<"Yes";
  } else cout<<"No";
  cout<<"\n";
}

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

using namespace std;
#define int long long
#define x first
#define y second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

mt19937 rand1(136786931);
int randlr(int l, int r) {
    return rand1() % (r - l + 1) + l;
}

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

    int h, w;
    cin >> h >> w;

    if (h == 1 || w == 1) {
        cout << 1;
        return 0;
    }

    cout << ((h + 1) / 2) * ((w + 1) / 2) + (h / 2) * (w / 2);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <string>
#include <stack>
#include <iomanip>
#include <numeric>
#include <queue>
#include <climits>
#include <set>
#include <complex>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;
#define MOD 1000000007
#define INF 1LL << 59

bool operator<(const pair<int, int> &a, const pair<int, int> &b)
{
    if (a.first == b.first)
    {
        return a.second < b.second;
    }
    return a.first < b.first;
}
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    //cout << fixed << setprecision(7);

    int cnt = 0;

    string s;
    while (cin >> s)
    {
        int n = s.size();
        bool f = true;
        if (n % 2 == 1)
        {
            for (int i = 0; i < n / 2; ++i)
            {
                if (s[i] == s[n - i - 1])
                    continue;
                else
                    f = false;
            }
        }
        else
        {
            for (int i = 0; i <= n / 2; ++i)
            {
                if (s[i] == s[n - i - 1])
                    continue;
                else
                    f = false;
            }
        }
        if (f)
            cnt++;

        if (cin.eof())
            break;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 2976
#include<stdio.h>

int main()
{
    int n, a[10000+5];
    while(1)
    {
        scanf("%d",&n);
        if(n==0) return 0;
        int i, j, sum=0;
        for(i=1;i<=n;i++)
        {
            scanf("%d",&a[i]);
            sum+=a[i];
        }
        float t=(1.0*sum)/n;
        int m=0;
        for(i=1;i<=n;i++)
        {
            if(a[i]<=t) m++;
        }
        printf("%d\n",m);
    }
}



Measured memory_bytes: 2040
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
 
int main(void)
{
    int a,b;
    cin >> a >> b;

    if(a+b == 15)
        cout << "+" << endl;
    else if(a*b==15)
        cout << "*" << endl;
    else
        cout << "x" << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
// #include "prettyprint.hpp"

int get(int v, int i) { return (v - 1) * 3 + i; }

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> adj[N * 3];

  for (int i = 0; i < M; i++) {
    int u, v;
    cin >> u >> v;
    adj[get(u, 0)].push_back(get(v, 1));
    adj[get(u, 1)].push_back(get(v, 2));
    adj[get(u, 2)].push_back(get(v, 0));
  }

  int S, T;
  cin >> S >> T;

  int color[3 * N];
  for (int i = 0; i < 3 * N; i++) color[i] = 1;
  int d[3 * N];
  queue<int> bfsQueue;

  bfsQueue.push(get(S, 0));
  color[get(S, 0)] = 0;
  d[get(S, 0)] = 0;

  bool found = false;
  while (bfsQueue.size() > 0 && !found) {
    int u = bfsQueue.front();
    bfsQueue.pop();

    for (int i = 0; i < adj[u].size(); i++) {
      int v = adj[u][i];
      if (color[v]) {
        bfsQueue.push(v);
        color[v] = 0;
        d[v] = d[u] + 1;
      }

      if (v == get(T, 0)) {
        found = true;
      }
    }
  }

  if (found) {
    cout << (d[get(T, 0)] / 3) << endl;
  } else {
    cout << -1 << endl;
  }

  return 0;
}

Measured memory_bytes: 18944
#include<cstdio>
#include <iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>

#define rep(i,n) for(int i=0; i<int(n); i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;


int main() {
	int a, b;
	for (int i = 0; i < 7; i++) {
		cin >> a >> b;
		cout << a - b << endl;
	}
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> P(N), Q(N);
  for (int i = 0; i < N; i++) cin >> P.at(i);
  for (int i = 0; i < N; i++) cin >> Q.at(i);
  
  int A = 0, B = 0;
  do {
    A += 1;
  } while (next_permutation(P.begin(), P.end()));
  do {
    B += 1;
  } while (next_permutation(Q.begin(), Q.end()));
  
  cout << abs(A - B) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
const ll MOD = 998244353;
const int n_max = 1e5+10;


int main(){
    ll n; cin >> n;
    bool ok = true;
    map<ll,ll> mp;
    vector<ll> dv(n);
    ll ma = 0;
    rep(i,n){
        cin >> dv[i];
        mp[dv[i]]++;
        ma = max(ma,dv[i]);
    }
    ll res = 1;
    if(mp[0] != 1 || dv[0] != 0){
        ok =false;
        // cout << 0 << endl;
        // return 0;
    }
    ll pre;
    rep(i,ma+1){
        if(mp[i] == 0){
            ok = false;
            break;
        }
        if(i == 0){
            pre = mp[i];
            continue;
        }
        ll now = mp[i];
        // res = (res * ll(pow(pre, now))) % MOD;
        rep(j,now){
            res = (res * pre) % MOD;
        }
        pre = now;
    }
    cout << (ok ? res : 0) << endl;
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
#define forn(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef unsigned int ui32;
using namespace std;

int main() {
    //ios_base::sync_with_stdio(false);
    //cin.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    string s;
    cin >> s;
    if (s.size() >= 4) {
        if (s[0] == 'Y' && s[1] == 'A' && s[2] == 'K' && s[3] == 'I') {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    } else {
        cout << "No\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_STR_MAX		100000									// 最大文字列長

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpT, *szpFpA;
#endif

// 実行メイン
int
fMain(
	int piTNo					// <I> テスト番号 1～
)
{
	int i;
	char lc1Buf[1024], lc1Out[1024];

	// テストファイルオープン
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", piTNo);
	szpFpT = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", piTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#endif

	// 文字列取得
	char lc1Str[D_STR_MAX + 5];
#ifdef D_TEST
	fgets(lc1Str, sizeof(lc1Str), szpFpT);
#else
	fgets(lc1Str, sizeof(lc1Str), stdin);
#endif

	// 文字列長
	int liSLen = strlen(lc1Str);
	liSLen--;
	lc1Str[liSLen] = '\0';			// 改行カット

	// チェック文字数
	int liCCnt = liSLen / 2;

	// 変更に必要な長さ - 初期値
	int liNLen = liSLen;

	// 文字変更の必要性をチェック - 左側
	for (i = 0; i < liCCnt; i++) {

		// 一致チェック
		if (lc1Str[i] == lc1Str[i + 1]) {
			continue;
		}

		// 変更に必要な長さ
		liNLen = liSLen - i - 1;
	}

	// 文字変更の必要性をチェック - 右側
	for (i = 0; i < liCCnt; i++) {

		// 一致チェック
		if (lc1Str[liSLen - i - 1] == lc1Str[liSLen - i - 2]) {
			continue;
		}

		// 変更に必要な長さ
		int liLen = liSLen - i - 1;
		if (liNLen > liLen) {
			liNLen = liLen;
		}
	}

	// 結果セット
	sprintf(lc1Out, "%d\n", liNLen);

	// 結果表示
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, lc1Out)) {
		siRes = -1;
	}
#else
	printf("%s", lc1Out);
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpT);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", piTNo);
	}
	else {
		printf("NG %d\n", piTNo);
	}
#endif

	return 0;
}

int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		fMain(i);
	}
#else
	fMain(0);
#endif

	return 0;
}



Measured memory_bytes: 256