akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;



int main(){
  int Case = 1;
  while(1){
    int w,n;
    int t[1001];
    int copy[1001];
    int takara[1000][2];
    for(int i=0;i<1001;i++){
      t[i]=0;
      copy[i]=0;
    }
                
    cin >> w;
    if ( w == 0)break;
    cin >> n;
    for(int i=0;i<n;i++){
      int kati,omosa;
      char conma;
      cin >> kati>>conma>>omosa;
      takara[i][0]=kati;
      takara[i][1]=omosa;
    }
                
    for(int i=1;i<=w;i++){
      if (i >= takara[0][1])copy[i] = takara[0][0]; 
    }
                
    for(int i=1;i<n;i++){
      for(int j=0;j<=w;j++){
        if (j <takara[i][1])t[j] = copy[j];
        else if (copy[j] < takara[i][0]+copy[j-takara[i][1]])t[j] = takara[i][0]+copy[j-takara[i][1]];
        else t[j] =copy[j]; 
      }
                
      for(int j=0;j<=w;j++){
        copy[j]=t[j];
      }
    }
                
    int max = t[w],maxweight = w;
    for(int i=w-1;i>=0 ;i--){
      //cout << t[i] <<" " << i << endl;                        
      if ( t[i] >= max ){
        max = t[i];
        maxweight = i;
      }
                
                
    }
                
    cout << "Case " << Case++ <<":" <<endl <<max <<  endl<< maxweight << endl;
                
                
                
                
  }


  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;
//const int mod = 998244353;

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

    string s, t;
    cin >> s >> t;
    cout << t << s << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
 
template< typename T >
struct SegmentTree
{
  const T INF;
 
  vector< T > seg;
  int sz;
 
  SegmentTree(int n) : INF(numeric_limits< T >::max())
  {
    sz = 1;
    while(sz < n) sz <<= 1;
    seg.assign(2 * sz - 1, INF);
  }
 
  T merge(T a, T b)
  {
    return (min(a, b));
  }
 
  void set(int k, int x)
  {
    seg[k + sz - 1] = x;
  }
 
  void build()
  {
    for(int k = sz - 2; k >= 0; k--) {
      seg[k] = merge(seg[2 * k + 1], seg[2 * k + 2]);
    }
  }
 
  T rmq(int a, int b, int k, int l, int r)
  {
    if(a >= r || b <= l) return (INF);
    if(a <= l && r <= b) return (seg[k]);
    return (merge(rmq(a, b, 2 * k + 1, l, (l + r) >> 1),
                  rmq(a, b, 2 * k + 2, (l + r) >> 1, r)));
  }
 
  T rmq(int a, int b)
  {
    return (rmq(a, b, 0, 0, sz));
  }
 
  void update(int k, T x)
  {
    k += sz - 1;
    seg[k] = x;
    while(k > 0) {
      k = (k - 1) >> 1;
      seg[k] = merge(seg[2 * k + 1], seg[2 * k + 2]);
    }
  }
};
 
int main()
{
  int N, A[200000], B[200000];
 
  scanf("%d", &N);
  for(int i = 0; i < N; i++) scanf("%d", &A[i]);
  for(int i = 0; i < N; i++) scanf("%d", &B[i]);
  SegmentTree< int > seg1(N), seg2(N);
  for(int i = 0; i < N; i++) seg1.set(i, A[i]);
  for(int i = 0; i < N; i++) seg2.set(i, B[i]);
  seg1.build();
  seg2.build();
 
  int Q;
  scanf("%d", &Q);
  bool first = false;
  vector< pair< int, int > > aa, bb, cc, dd;
  while(Q--) {
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    --b;
    if(a == 1) cc.emplace_back(b, seg1.rmq(b, b + 1)), seg1.update(b, c), aa.emplace_back(b, c);
    if(a == 2) dd.emplace_back(b, seg2.rmq(b, b + 1)), seg2.update(b, c), bb.emplace_back(b, c);
    if(a == 3) printf("%d\n", seg1.rmq(b, c));
    if(a == 4) printf("%d\n", seg2.rmq(b, c));
    if(a == 5) {
      if(!first) {
        for(int i = 0; i < N; i++) seg1.update(i, seg2.rmq(i, i + 1));
      } else {
        reverse(begin(cc), end(cc));
        for(auto &p : cc) seg1.update(p.first, p.second);
        for(auto &p : bb) seg1.update(p.first, p.second);
      }
      first = true;
      aa.clear();
      bb.clear();
      cc.clear();
      dd.clear();
    }
    if(a == 6) {
      if(!first) {
        for(int i = 0; i < N; i++) seg2.update(i, seg1.rmq(i, i + 1));
      } else {
        reverse(begin(dd), end(dd));
        for(auto &p : dd) seg2.update(p.first, p.second);
        for(auto &p : aa) seg2.update(p.first, p.second);
      }
      first = true;
      aa.clear();
      bb.clear();
      cc.clear();
      dd.clear();
    }
  }
}

Measured memory_bytes: 8696
def main():
    n = int(input())
    a = list(map(int, input().split()))
    for i in range(n-1):
        if a[i] >= a[i+1]:
            break
    else:
        print(1)
        return

    def value(kind):
        length = 0
        d = dict()
        for i in a:
            if length >= i:
                del_list = []
                for j in d:
                    if j > i:
                        del_list.append(j)
                for j in del_list:
                    d.pop(j)
                for j in range(i, 0, -1):
                    if j not in d:
                        d[j] = 2
                        break
                    else:
                        if d[j] < kind:
                            d[j] += 1
                            break
                        else:
                            d.pop(j)
                else:
                    return False
            length = i
        return True

    ok, ng = n, 1
    while abs(ok-ng) > 1:
        mid = (ok+ng)//2
        if value(mid):
            ok = mid
        else:
            ng = mid
    print(ok)


main()


Measured memory_bytes: 88276
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<ctime>
#include<cstdio>
//#include<string>
//#include<sstream>
using namespace std;
struct Num{
	int c;
	int t;
};
int main()
{
	int n,t,i,j,min,flag;
	Num num[100],temp;
	scanf("%d%d",&n,&t);
	for(i=0;i<n;i++)
	{
		scanf("%d%d",&num[i].c,&num[i].t);
	}
/*	for(i=0;i<n-1;i++)
	{
		min=i;
		for(j=i+1;j<n;j++)
		{
			if(num[min].c>num[j].c)
				min=j;
		}
		if(min!=i)
		{
			temp=num[min];
			num[min]=num[i];
			num[i]=temp;
		}
	}
*/
	flag=0;
	for(i=0;i<n;i++)
	{
		if(num[i].t<=t)
		{
			if(flag==0)
			{
				min=i;
				flag=1;
			}
			else
			{
				if(num[i].c<num[min].c)
				{
					min=i;
				}
			}
		}
	}

	if(flag==0)
	{
		printf("TLE\n");
	}
	else
	{
		printf("%d\n",num[min].c);
	}
}


Measured memory_bytes: 256
import java.io.BufferedReader;
//import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
	public static int cnt = 0;
	public static void main(String[] args) throws NumberFormatException, IOException {
		//System.setIn(new FileInputStream("./input.txt"));
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		//int[] s = Arrays.stream(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
		String[] t = br.readLine().split(" ");
		int[] s = new int[n];
		for(int i = 0; i < n; ++i){
			s[i] = Integer.parseInt(t[i]);
		}
		mergeSort(s, 0, n);
		
		StringBuilder sb = new StringBuilder();
		sb.append(s[0]);
		for(int i = 1; i < n; ++i) {
			sb.append(" " + s[i]);
		}
		System.out.println(sb);
		System.out.println(cnt);
	}
	public static void mergeSort(int[] s, int left, int right) {
		if(left + 1 < right) {
			int mid = (left + right) / 2;
			mergeSort(s, left, mid);
			mergeSort(s, mid, right);
			merge(s, left, mid, right);
		}
	}
	public static void merge(int[] s, int left, int mid, int right) {
		int[] s1 = Arrays.copyOfRange(s, left, mid + 1);
		int[] s2 = Arrays.copyOfRange(s, mid, right + 1);
		
		s1[mid - left] = Integer.MAX_VALUE;
		s2[right - mid] = Integer.MAX_VALUE;
		int i = 0;
		int j = 0;
		for(int k = left; k < right; ++k) {
			cnt += 1;
			if(s1[i] <= s2[j]){
				s[k] = s1[i];
				i += 1;
			}else{
				s[k] = s2[j];
				j += 1;
			}
		}
		
	}
	
}

Measured memory_bytes: 159200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll one = 1;
const ll INF = 9223372036854775807; //10^18
const int inINF = 2147483647; //10^9
const ll MOD = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

// 1-indexedのBIT
struct BIT {
    vector<int> array;
    const int N;

    // 0として初期化
    BIT(int _N) : array(_N + 1, 0), N(_N) {}

    // 左からi番目にxを加える
    void add(int i, int x){
        int lsb;
        while(i <= N){
            array[i] += x;
            lsb = i & (-i);
            i += lsb;
        }
    }

    //左からi番目までのSUMを得る
    int getSUM1(int i){
        int ret = 0;
        int lsb;
        while(i >= 1){
            ret += array[i];
            lsb = i & (-i);
            i -= lsb;
        }
        return ret;
    }

    //左からi番目からj番目のSUMを得る
    int getSUM(int i, int j){
        return getSUM1(j) - getSUM1(i-1);
    }
};

// nのk乗を計算する
ll modpow(ll n, ll k){
    ll ret = 1;
    ll t = n;
    while(k > 0){
        if(k & 1) ret = ret * t % MOD;
        t = t * t % MOD;
        k = k>>1;
    }
    return ret;
}


int main(){
    ll N; cin >> N;
    vector<ll> x(N), y(N);
    for (ll i = 0; i < N; i++) {
        cin >> x[i] >> y[i];
    }   
    map<ll, ll> mx, my;
    for (ll i = 0; i < N; i++) {
        mx[x[i]] = 1;
        my[y[i]] = 1;
    }
    ll ind = 1;
    for (auto v : mx) {
        mx[v.first] = ind;
        ind++;
    }
    ind = 1;
    for (auto v : my) {
        my[v.first] = ind;
        ind++;
    }

    for (ll i = 0; i < N; i++) {
        x[i] = mx[x[i]];
        y[i] = my[y[i]];
    }

    vector<iint> z(N);
    for (int i = 0; i < N; i++) {
        z[i].first = x[i];
        z[i].second = y[i];
    }
    // for (int i = 0; i < N; i++) {
    //     printf("%d %d %d\n", i, z[i].first, z[i].second);
    // }
    sort(ALL(z));
    // for (int i = 0; i < N; i++) {
    //     printf("%d %d %d\n", i, z[i].first, z[i].second);
    // }
    ll ans = 0;
    ans = N * (modpow(2, N) - 1) % MOD;
    BIT bit(N);
    for (int i = 0; i < N; i++) {
        int xi = z[i].first;
        int yi = z[i].second;
        ans = (ans - modpow(2, N-xi) + 1 + MOD) % MOD;
        ans = (ans - modpow(2, xi-1) + 1 + MOD) % MOD;
        ans = (ans - modpow(2, N-yi) + 1 + MOD) % MOD;
        ans = (ans - modpow(2, yi-1) + 1 + MOD) % MOD;

        int two, thr;
        two = bit.getSUM(yi, N);
        thr = bit.getSUM(1, yi);
        ans = (ans + modpow(2, two) - 1) % MOD;
        ans = (ans + modpow(2, thr) - 1) % MOD;
        bit.add(yi, 1);
    }
    BIT bit2(N);
    for (int i = N-1; i >= 0; i--) {
        int xi = z[i].first;
        int yi = z[i].second;

        int on, fo;
        on = bit2.getSUM(yi, N);
        fo = bit2.getSUM(1, yi);
        ans = (ans + modpow(2, on) - 1) % MOD;
        ans = (ans + modpow(2, fo) - 1) % MOD;
        bit2.add(yi, 1);
    }
    printf("%lld\n", ans);


}

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

int main()
{
	int N, A, B, C, X;
	int Y[100] = {};
	while (true)
	{
		cin >> N >> A >> B >> C >> X;
		if (N == 0 && A == 0 && B == 0 && C == 0 && X == 0)break;
		for (int i = 0; i < N; i++)
		{
			cin >> Y[i];
		}
		int frame = 0;
		int index = 0;
		while (frame <= 10000)
		{
			if (X == Y[index])
			{
				index++;
			}
			if (index > N - 1)
			{
				break;
			}
			X = (A * X + B) % C;
			frame++;
		}

		if (frame > 10000)
		{
			frame = -1;
		}


		cout << frame << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define ll long long
#define dd double
#define MOD 1000000007
#define nl cout<<endl
#define rt ll Q[100005]={0}
#define mp make_pair
#define test() ull t;cin>>t;while(t--)
#define pb push_back
#define ff first    
#define ss second
#define all(v) v.begin(),v.end()
#define s(ar,n) sort(ar,ar+n)
#define rs(ar,n) sort(ar, ar+n, greater<ll>()) 
#define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i];
#define ov(a,n) for(ll i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
#define ovp(a,n) for(ll i=0;i<n;i++)cout<<a[i].ff<<" "<<a[i].ss<<endl;
#define maxa(ar,N) *max_element(ar,ar+N)
#define mina(ar,N) *min_element(ar,ar+N)
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef pair<int,int> pii;
ll powe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);if(m%2==0)return (t*t);return (((t*t))*n);}
ll mpowe(ll n,ll m){if(m==0)return 1;ll t=mpowe(n,m/2);t%=MOD;if(m%2==0)return (t*t)%MOD;return (((t*t)%MOD)*n)%MOD;}
ll logtwo(ll n){if(n==1)return 0;return logtwo(n/2)+1;}
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
ll fac[100000+6]; 
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      // Initialize result 
  
    x = x % p;  // Update x if it is more than or 
                // equal to p 
  
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % p; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 
  
// Returns n^(-1) mod p 
ll modInverse(ll n, ll p) 
{ 
    return mpowe(n, p-2); 
} 
  
// Returns nCr % p using Fermat's little 
// theorem. 
ll nCrModPFermat(ll n,ll r, ll p) 
{ 
   // Base case 
    if (r==0) 
      return 1;
    if(r>n)
        return 0;
    if (r==0) 
      return 1; 
    return (fac[n]* modInverse(fac[r], p) % p * 
            modInverse(fac[n-r], p) % p) % p; 
} 
int main()
{
    fastio();
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/
    ll n,k;
    cin>>n>>k;
    ll a[n];
    cn(a,n);
    sort(a,a+n);
    ll sum=0;
    fac[0] = 1;
    for (int i=1 ; i<=100000+5; i++) 
        fac[i] = (fac[i-1])*i%MOD;
    for(int i=1;i<n;i++)
    {
        ll c=nCrModPFermat(i,k-1,MOD);
        //cout<<i<<" "<<c<<endl;
        sum= (sum+a[i]*c)%MOD;
    }
    //cout<<sum<<endl;
    if(k==1)
    {
        cout<<0<<endl;
        return 0;
    }
    for(int i=0;i<n-1;i++)
    {
        ll c=nCrModPFermat(n-i-1,k-1,MOD);
        sum= (sum-a[i]*c+MOD)%MOD;
    }

    cout<<sum<<endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
const long long int INF = 1e16;

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

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

    vector<vector<vector<long long int>>> dp(n+1, vector<vector<long long int>>(3, vector<long long int>(2, -INF)));
    // dp[i][j][k] = max sum up to i-th element, "xx" apeared j times, last choice o(0) or x(1)
    dp[0][0][1] = 0;
    for(int i=0; i<n; i++){
        for(int j=0; j<3; j++){
            // xo
            if(dp[i][j][1] != -INF) dp[i+1][j][0] = max(dp[i+1][j][0], dp[i][j][1] + a[i]);
            // ox
            dp[i+1][j][1] = max(dp[i+1][j][1], dp[i][j][0]);

            // basically above two transition, but some exceptions are
            // xx
            if(j+1 < 3) dp[i+1][j+1][1] = max(dp[i+1][j+1][1], dp[i][j][1]);
            // oo : impossible
        }
    }

    long long int ans = -INF;
    if(n % 2 == 0){
        ans = max(ans, dp[n][1][0]);
        ans = max(ans, dp[n][0][1]);
        ans = max(ans, dp[n][1][1]);
    }
    if(n % 2 == 1){
        ans = max(ans, dp[n][2][0]);
        ans = max(ans, dp[n][1][1]);
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ld> vld;
typedef vector<vld> vvld;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

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

#define mod (ll)(1e9 + 7)
// #define mod (998244353ll)

const long long INF = 1LL << 60;

bool is_prime(const unsigned n) {
  if (n % 2 == 0 || n % 3 == 0) {
    if (n == 2 || n == 3) {
      return true;
    }
    return false;
  }
  if (n == 1) {
    return false;
  }

  for (unsigned i = 5; i * i <= n; i += 6) {
    if (n % i == 0 || n % (i + 2) == 0) {
      return false;
    }
  }

  return true;
}

// prime factorization (素因数分解)
// key: value of prime factor
// value: number of prime factor
std::map<ll, ll> prime_factorization(ll n) {
  std::map<ll, ll> prime_factors;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      prime_factors[i]++;
      n /= i;
    }
  }
  if (n != 1)
    prime_factors[n] = 1;
  return prime_factors;
}

// 約数リスト
vector<ll> get_divisors(const ll n) {
  vector<ll> divs;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      divs.push_back(i);
      if (i != n / i) {
        divs.push_back(n / i);
      }
    }
  }

  // 必要に応じてソート
  // sort(divs.begin(), divs.end());

  return divs;
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  ll n;
  cin >> n;
  cout << n << ":";

  std::map<ll, ll> factors = prime_factorization(n);

  for (pair<ll, ll> it : factors) {
    rep(i, it.second) {
      cout << " " << it.first;
    }
  }

  cout << endl;

  return 0;
}



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

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

int s,w;

int main()
{
	cin>>s>>w;
	if(w>=s) puts("unsafe");
	else puts("safe");
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> L(N);
    rep(i, N) cin >> L[i];
    sort(all(L));
    int ans = 0;
    for (int i=0; i<N-2; ++i) {
        for (int j=i+1; j<N-1; ++j) {
            if (L[i] == L[j]) continue;
            for (int k=j+1; k<N; ++k) {
                if (L[j] == L[k]) continue;
                if (L[k] < L[i]+L[j]) ++ans;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3552
import java.io.*;

public class Main{
    public static void main(String[]args) throws NumberFormatException, IOException {
     
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        String[]str= br.readLine().split(" ");
        int a = Integer.parseInt(str[0]);
        int b = Integer.parseInt(str[1]);
        int d = a/b;
        int r = a%b;
        double f = (double)a/b;
        System.out.printf("%d %d %.7f \r\n", d, r, f);
       
    }
}

Measured memory_bytes: 16928
import java.util.Scanner;

class Main{
  public static void main (String[] args){
    Scanner sc = new Scanner(System.in);
      while (true){
        int H = sc.nextInt();
        int W = sc.nextInt();
        if ((H == 0) && (W == 0)) break;
          for(int h = 0; h < W; h++){
            System.out.print("#");
          }
          System.out.println("");


            for(int i = 0; i < H-2 ; i++){
              System.out.print("#");
              for(int j = 0;  j < W-2 ; j++){
                System.out.print(".");
                }
                System.out.print("#");
                System.out.println("");
              }
          for(int k = 0; k < W; k++){
            System.out.print("#");
          }
          System.out.println("");
          System.out.println("");
  }
}
}


Measured memory_bytes: 34360
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<algorithm> // sort
#include<map> // pair
#include<cmath>
using namespace std;
using ll = long long;
const ll mod = 1e9+7;

int main(){
  int n,m,c,count=0;
  cin >> n >> m >> c;
  int a[n][m],b[m];
  for(int j=0;j<m;j++){
    cin >> b[j];
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      cin >> a[i][j];
    }
  }
  for(int i=0;i<n;i++){
    int x=0;
    for(int j=0;j<m;j++){
      x += a[i][j]*b[j];
    }
    if(x + c > 0){
      count++;
    }
  }
  cout << count;
}


Measured memory_bytes: 256
N=int(input())
T=[int(x) for x in input().split()]
M=int(input())
PX=[]
for i in range(M):
    p,x=map(int,input().split())
    PX.append([p,x])
def sum(A):
    ans=0
    for i in range(len(A)):
        ans+=A[i]
    return ans
sum=sum(T)
for i in range(M):
    a=PX[i][0]
    b=PX[i][1]
    print(sum-T[a-1]+b)


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

using namespace std;

const int MAX_N = 100 + 7;

int A[MAX_N];

int main() {
  int N;
  scanf("%d", &N);

  long long avg = 0;

  for (int i = 0; i < N; i++) {
    scanf("%d", &A[i]);

    A[i] *= N;
    avg += A[i];
  }

  avg /= N;

  int ans = 0;
  for (int i = 1; i < N; i++) {
    if (abs(A[i] - avg) < abs(A[ans] - avg))
      ans = i;
  }

  printf("%d\n", ans);


  return 0;
}


Measured memory_bytes: 256
import java.io.*;

class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        String[] ary = br.readLine().split(" ");
        int num = 0;
        int min = 1000000;
        int max = -1000000;
        long sum = 0;
        for(int i=0;i<N;i++){
            num = Integer.parseInt(ary[i]);
            if(num<min) min = num;
            if(num>max) max = num;
            sum += num;
        }
        System.out.println(min+" "+max+" "+sum);
	}
}

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

class UnionFind():
    def __init__(self, N):
        self.parent = [-1 for i in range(N)]  # 親のときは負の値をとり、-(そのグループのサイズ)
    
    def find(self, x):
        """ xがどのグループに属するかを返す """
        if self.parent[x] < 0: return x
        
        self.parent[x] = self.find(self.parent[x])
        return self.parent[x]

    def unite(self, x, y):
        """ xとyのグループを併合する """
        gx = self.find(x)
        gy = self.find(y)

        if gx == gy: return
        
        if self.size(gx) < self.size(gy):
            self.parent[gy] -= self.size(gx)
            self.parent[gx] = gy
        else:
            self.parent[gx] -= self.size(gy)
            self.parent[gy] = gx
    
    def size(self, x):
        """ xが属するグループのサイズ """
        gx = self.find(x)
        return -self.parent[gx]

    def is_same_group(self, x, y):
        """ xとyが同じグループに属するかを調べる """
        return self.find(x) == self.find(y)


def solve():
    """ 方針
    ・「つなげる処理は簡単。切り離す処理は難しい」

    すべてが崩落している状態から、 時間を巻き戻すように橋をかけていき不便度を計算していく。

    UnionFindで、島aと島bが同じグループに属するということは、いずれかの橋を渡っていけば島aから島bまで到達可能という意味
    """
    N, M = list(map(int, input().split()))
    A, B = [], []
    for m in range(M):
        a, b = list(map(int, input().split()))
        A.append(a-1)
        B.append(b-1)

    uf = UnionFind(N)
    ans = [(N-1)*N/2] * (M) # すべてが崩落した状態を初期状態とする

    for i in range(M-1, 0, -1):
        if not uf.is_same_group(A[i], B[i]):
            # 同じグループではないので、つながっていない
            # ので、つなげる
            ans[i-1] = ans[i] - uf.size(A[i]) * uf.size(B[i])
            uf.unite(A[i], B[i])
        else:
            ans[i-1] = ans[i]
    
    for i in range(M):
        print(int(ans[i]))


if __name__ == "__main__":
    solve()

Measured memory_bytes: 16268
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <cassert>
#include <unordered_map>

#define _(x) { cout << #x << " = " << x << " "; }

const double E = 1e-8;
const double PI = acos(-1);

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int X = (a + d - 1) / d;
    int Y = (b + c - 1) / b;
    if ( Y <= X ) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i < (n);i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define SCANF(i) int i;scanf("%d",&i)
typedef long long ll;
using namespace std;
using P = pair<int,int>;
const long long INF = 1LL << 60;
const int IINF=100000000;
const int MOD = (int)1e9 + 7;
//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    //sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
vector<int> dx={1,0,-1,0};vector<int> dy={0,-1,0,1};

signed main () {
    int n;cin >> n;
    map<string,int> cnt;
    vector<string> lis = {"AC","WA","TLE","RE"};
    cnt["AC"]=0;
    cnt["TLE"]=0;
    cnt["WA"]=0;
    cnt["RE"]=0;
    REP(i,n){
        string tmp;cin >> tmp;
        cnt[tmp]++;
    }
    for(string a : lis){
        cout << a << " x " << cnt[a] << endl;
    }
}//https://atcoder.jp/contests/abc173/tasks/abc173_b

Measured memory_bytes: 3644
#include <cstdio>
int main()
{
	int a = 0,b = 0,c = 0;
	scanf("%d %d %d",&a,&b,&c);
	if (a + b==c)printf ("Yes");
	else if (a + c==b)printf ("Yes");
	else if (b + c==a)printf ("Yes");
	else printf ("No");
	return 0;
	}

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

int main(){
    string s;
    cin >> s;
    int i;
    int h=0;
    for(i=0;i<s.size();i++){
        if(i%2==0){
            if(s.at(i)!='h'){
                h++;
            }
        }
        else{
            if(s.at(i)!='i'){
                h++;
            }
        }
    }
    if((h==0)&&(s.size()%2==0)){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import bisect
l = [[i**2+j**2,i,j] for j in range(1,151) for i in range(1,151) if i!=j and i<j]
l.sort()
while True:
    h,w = map(int,input().split())
    if w==h==0: break
    r = l[bisect.bisect_right(l,[w**2+h**2,h,w])]
    print(r[1],r[2])

Measured memory_bytes: 8964
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

int n;
vector<string> s(2);

bool check(int x) {
    if (x == n-1) return true;
    else if (s[0][x] == s[1][x]) return true;
    else return false;
}

int main(int argc, char const *argv[]) {
    cin >> n;
    REP(i,2) cin >> s[i];
    ll ans = 0ll;
    int i = 0;
    if (check(0)) ans += 3, ++i;
    else ans += 6, i+=2;

    for (i; i < n; ++i) {
        if (check(i)) {
            if (check(i-1)) {
                ans = ans*2%MOD;
            }
            else {
                ans = ans*1%MOD;
            }
        }
        else {
            if (check(i-1)) {
                ans = ans*2%MOD;
            }
            else {
                ans = ans*3%MOD;
            }
            ++i;
        }
    }
    cout << ans << endl;
    return 0;
}

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

Measured memory_bytes: 13928
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        #[allow(unused_mut)]
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::cmp::min;

fn main() {
    input! {
        n: usize,
        x: [isize; n],
    }
    let mut ans = isize::max_value();
    for i in 1..101 {
        let t = x.iter().map(|xi| (xi - i).pow(2)).sum::<isize>();
        ans = min(ans, t);
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stack>
using ll = long long;
using uint = unsigned int;
using graph = std::vector<std::vector<ll>>;
using wGraph = std::vector<std::vector<std::pair<ll,ll>>>;
#define rep(i,n) for (int i=0; i < int(n); i++)

using namespace std;
ll MOD7 = 1000000007;
ll MOD9 = 1000000009;
vector<ll> InputVec(ll N){
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    return A;
}
void OutputVec(vector<ll> A){
    for (int i = 0; i < A.size(); ++i) {
        cout << A[i] << ",";
    }
    cout << endl;
}
vector<vector<ll>> InputVec2d(ll H,ll W){
    vector<vector<ll>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<ll>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        for (int xi = 0; xi < W; ++xi) {
            cin >> A[yi][xi];
        }
    }
    return A;
}
vector<vector<char>> InputVec2dStr(ll H,ll W){
    vector<vector<char>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<char>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        string S;
        cin >> S;
        for (int xi = 0; xi < W; ++xi) {
            A[yi][xi] = S[xi];
        }
    }
    return A;
}
void OutputVec2d(vector<vector<ll>> A){
    for (int yi = 0; yi < A.size(); ++yi) {
        for (int xi = 0; xi < A[yi].size(); ++xi) {
            cout << A[yi][xi] << ",";
        }
        cout << endl;
    }
}
graph InputGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    return G;
}
graph InputDGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
    }
    return G;
}
void OutputGraph(graph G){
    for (int i = 0; i < G.size(); ++i) {
        cout << i << ":";
        for (int j = 0; j < G[i].size(); ++j) {
            cout << G[i][j]<< ",";
        }
        cout << endl;
    }
}
void OutputAnswerBool(bool b,bool isUpperCase = false){
    if(b){
        if(isUpperCase){
            cout << "YES" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }else{
        if(isUpperCase){
            cout << "NO" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

int main() {
    string s;
    cin >> s;
    bool isEdge = true;
    for (int i = 0; i < s.size(); ++i) {
        if(i == 0){

        }else{
            if(s[i] == '9'){

            }else{
                isEdge = false;
                break;
            }
        }
    }
    if(isEdge){
        cout << (s[0] - '0') + 9 * (s.size() - 1) << endl;
    }else{
        cout << (s[0] - '0' - 1) + 9 * (s.size()-1) << endl;
    }
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define db(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl
#define ll long long
#define ld long double
#define pll pair<ll, ll>
#define MOD 1000000007
using namespace std;
const long long INF = 3*1e18;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll K, N;
    cin >> K >> N;
    vector<ll> A(N);
    for(ll i = 0; i < N; i++)
        cin >> A[i];
    vector<ll> dist;
    for(ll i = 1; i < N; i++)
        dist.push_back(A[i] - A[i-1]);
    dist.push_back(K - A[N-1] + A[0]);
    ll sum = *max_element(dist.begin(), dist.end());
    cout << accumulate(dist.begin(), dist.end(), 0) - sum << "\n";
}

Measured memory_bytes: 4980
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
    int N;
    cin>>N;
    string S;
    cin>>S;
    int K;
    cin>>K;
    for(int i = 0;i < N;i++){
        if(S[i] == S[K-1]){
            S[i]=S[K-1];
        }else{
           S[i]='*';
        }
    }
    cout<<S<<endl;
      return 0;
}


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

int main() {
	int n;
	scanf("%d", &n);
	string s;
	cin >> s;

	priority_queue<int> red;
	priority_queue<int, vector<int>, greater<int>> white;

	for (int i = 0; i < s.length(); i++)
		if (s[i] == 'R')
			red.push(i);
		else
			white.push(i);

	int ans = 0;
	while (!red.empty() && !white.empty()) {
		int rr = red.top(), lw = white.top();
		if (rr > lw) {
			ans++;
			red.pop(), white.pop();
			red.push(lw), white.push(rr);
		}
		else {
			break;
		}
	}

	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 4852
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <string>

using std::cin;
using std::cout;
using std::endl;
using std::terminate;
using std::string;

void solve() {
    long a; string s; cin >> a >> s;
    s.erase(1,1);
    long b = stoi(s);

    cout << a * b / 100 << endl;
}

int main() {

#ifdef DEV
    std::ifstream in("input");
    cin.rdbuf(in.rdbuf());

    int t; cin >> t;
    for (int x = 1; x <= t; ++x) {
        solve();
    }
#else
    solve();
#endif

    return 0;
}


Measured memory_bytes: 3628
while True:
  try:
    data_set = map(int, raw_input().split())
  except EOFError:
    break
  count = 0
  a = data_set[0]
  b = data_set[1]
  sum = a + b
  while sum > 0:
    sum /= 10
    count += 1
  print count

Measured memory_bytes: 6344
def solve():
    n = int(input())
    l = 0
    ans = ''
    for i in range(1, 12):
        if n <= 26 ** i:
            l = i
            break
        n = n - 26 ** i
    k = n - 1
    for i in range(l):
        ans = chr(k % 26 + 97) + ans
        k = k // 26

    print(ans)











if __name__ == '__main__':
    solve()


Measured memory_bytes: 9120
n = int(input())
A = list(map(int, input().split()))
A = [0]+A+[0]

s = sum([abs(A[i] - A[i+1]) for i in range(len(A)-1)])

for i in range(1, n+1):
    res = s - abs(A[i-1]-A[i]) - abs(A[i]-A[i+1]) + abs(A[i-1]-A[i+1])
    print(res)

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

int main() {

    int n, cnt = 0;
    cin >> n;
    vector<int> a(n);
    rep(i, n) { cin >> a[i]; }
    rep(i, n) {
        if ((i + 1) % 2 == 1 && a[i] % 2 == 1) {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3596
import qualified Data.Map as M

main = do
  [n,k] <- map read.words <$> getLine :: IO [Int]
  as    <- map read.words <$> getLine :: IO [Int]
  let shortages = M.fromList $ zip [1..] $ map ((k+1)-) as
  putStr $ solve n k shortages [] 0

solve n k shortages lasts step
  | step == k && win   = show (n+k*(n-1)) ++ "\n" ++ unwords ( map show $ ans n k lasts 0 )
  | step == k && not win = "-1"
  | otherwise = solve n k (M.insert l (s-1) shortages) (l:lasts) (step+1)
  where
  win = all (<=0) shortages
  (l,s) = M.foldlWithKey (\(mk,mv) k v -> if v > mv && k /= prev then (k,v) else (mk,mv)) (0,-100) shortages
  prev = if null lasts then 0 else head lasts
  ans n k (a:as) 0 = filter (/=a) [1..n] ++ a : ans n k (a:as) 1
  ans n k [a] _    = filter (/=a) [1..n]
  ans n k (a:b:as) step = filter (\i -> i/=a && i/=b) [1..n] ++ b : ans n k (b:as) (step+1)

-- ↓ 解法

-- 下記の操作で、財宝が見つからなかったとき、移動回数は1以上消費される。
-- 操作：財宝が存在する可能性のあるすべての箱を開ける。最後の箱は開けたままにする。
-- 操作をK+1回繰り返せば、必ず財宝が見つかる。(最初のK回で移動回数がすべて消費されるから。)
-- 1回目の操作で、財宝が存在する可能性がある箱はN個である。
-- 2回目以降の操作で、財宝が存在する可能性がある箱はN-1個(開いている箱を除く)である。
-- それぞれの箱が開けられる回数は、(K+1)-(最初のK回の操作のうち、最後に開けられた回数) である。
-- K回の操作で、どの箱を最後に開けるかを選べばよいが、下記の不足回数が最大の箱を選び、選ぶたびに1減らせばよい。
-- 不足回数：すべての操作で開けるには何回足りないか、すなわち最後に開けられる回数の必要最小限。(K+1-a_i)
-- ※ただし、連続して2度選ばれることはできない。(操作で開けない箱を最後に開けることはできないから。)
-- 最後に開ける箱をすべて選び終わった後、すべての箱の不足回数がゼロ以下であれば、勝てる。
-- 箱を開ける回数は、N + K(N-1) である。


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

int lcm(int a,int b){	//a,b < 20だしいいよね
		if (a < b){
			swap(a,b);
		}
		int times = a * b;
		int gcd,lcm;
		while(1){
			int n;
			n = a % b;
			if(n == 0){	break;}
			a = b;
			b = n;
		}
		gcd = b;
		lcm = times / gcd;
	return lcm;
}

int main(){
	int h,w;
	while(1){
		cin >> h >> w ;
		if(h == 0 && w == 0){	break;}
		char donut[10][20];
		for(int i=0;i<10;i++){
			for(int j=0;j<20;j++){
				donut[i][j] = 0;
			}
		}
		string code[1600];
		bool much[1600];
		for(int i = 0; i < 1600; i++){
			code[i] = "";
			much[i] = true;
		}	//初期化…

		unsigned int l = lcm(w,h);	//ななめの最大数
		int a = 0;	//strの数を数えます

		for(int i = 0; i < h; i++){
			for(int j =0; j < w; j++){
				cin >> donut[i][j];
			}
		}	//input

		for(int y = 0; y < h; y++){
			for(int x = 0; x < w; x++){
				for(int i = 0; i < h; i++){	//縦列
					code[a].append(1,donut[(y + i)%h][x]);
					code[a+1].append(1,donut[h-(y + i)%h-1][x]);
				}
				a += 2;
				for(int j = 0; j < w; j++){	//横列
					code[a].append(1,donut[y][(x + j)%w]);
					code[a+1].append(1,donut[y][w-(x+j)%w-1]);//absつけなくても0になりません！
				}
				a += 2;
				for(unsigned int k = 0; k < l; k++){	//ななめ
					code[a].append(1,donut[(y + k)%h][(x + k)%w]);
					code[a+1].append(1,donut[(y + k)%h][(l + x - k)%w]);
					code[a+2].append(1,donut[(l + y - k)%h][(x + k)%w]);
					code[a+3].append(1,donut[(l + y - k)%h][(l + x - k)%w]);
				}
				a += 4;
			}
		}
		string mag = "";	//a:strの数-1
		sort(code,code+a);//nとn+1を比べます

		for(unsigned int i = 1; i < l; i++){	//2文字目から
			for(int j = a-1; j > 0; j--){	//逆順
				if(much[j] == true && code[j].length() >= i+1 && code[j-1].length() >= i+1){//=を忘れていました
					//jのi+1文字目とj-1のi+1文字目を比べるよ
					if(code[j][i] != code[j-1][i]){
						much[j] = false;
					}else{
						mag = code[j];
						mag.resize(i+1);
					}
				}
			}
		}
		if(mag == ""){
			cout << "0" << endl;
		}else{
			cout << mag << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1532
#include<iostream>
#include <iomanip>
using namespace std;
int main()
{
	int n;cin>>n;
	int a=0;
	if(n%2==0)
		a=n/2;
	else
		a=n/2+1; 
	double m=(double)a/n;
	cout<<setiosflags(ios::fixed)<<setprecision(10);
	cout<<m<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>

using namespace std;

int main(void)
{
    string a;

    cin >> a;

    if(a[a.size()-1]=='s')
        cout << a << "es" << endl;
    else
    {
        cout << a << "s" << endl;
    }
    

    return 0; 
}

Measured memory_bytes: 3040
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

struct data_t {
    int number;
    string store_name;
    int point;

    bool operator<(const data_t& other) const {
        if (store_name != other.store_name)
            return store_name < other.store_name;
        if (point != other.point)
            return point > other.point;
        return true;
    }
};

bool compare_name(const data_t &lhs, const data_t &rhs) {
    return lhs.store_name < rhs.store_name;
}

bool compare_point(const data_t &lhs, const data_t &rhs) {
    return lhs.store_name == rhs.store_name && lhs.point > rhs.point;
}

int main() {
    int N; cin >> N;
    vector<data_t> v;
    REP(0, i, N) {
        string S; cin >> S;
        int P; cin >> P;
        v.push_back((data_t){i + 1, S, P});
    }

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

    REP(0, i, N) {
        // cout << v[i].number << " " << v[i].store_name << " " << v[i].point << endl;
        cout << v[i].number << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
#define MAXN 100010
int n,x,ans1,ans2;
char a[MAXN];
inline int read(){
	int x=0,t=1,c;
	while(!isdigit(c=getchar())) if(c=='-') t=-1;
	while(isdigit(c)) x=x*10+c-'0',c=getchar();
	return x*t;
}
int main(){
	scanf("%s",a+1);
	n=strlen(a+1);
	for(int i=1;i<=n;i++){
		if(a[i]-'0'!=x) ans1++;
		x^=1;
	}
	x=1;
	for(int i=1;i<=n;i++){
		if(a[i]-'0'!=x) ans2++;
		x^=1;
	}
	printf("%d\n",min(ans1,ans2));
	return 0;
}


Measured memory_bytes: 384
// template
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<long long, long long> LP;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define REP_AB(i, a, b) for (ll i = ll(a); i < ll(b); i++)
#define REP_IN(i, n, x) for (ll i = 0; i < n; i++)in>>x;
#define REP_OUT(i, n, x) for (ll i = 0; i < n; i++)out<<x<<endl;
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)), v.end());
#define SIZE(x) ((ll)(x).size())
#define REVERSE(v) reverse(ALL(v))
// true / false
#define BIN_SEARCH(v, a) binary_search(ALL(v), a)
// index
#define BIN_LEFT(v, a) (lower_bound(ALL(v), a) - v.begin())
#define BIN_RIGHT(v, a) (upper_bound(ALL(v), a) - v.begin())
#define BIN_INSERT(v, a) (v.insert(v.begin() + BIN_LEFT(v, a), a))
#define DEL(v, i) v.erase(v.begin() + i)
#define INSERT(v, i, a) v.insert(v.begin() + i, a)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a / gcd(a, b)) * b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
#define out cout
#define in cin
#define endl '\n'
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; }
// template end
 
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    //ll N;
    //in >> N;
    //vector<ll> X(N);
    string s;
    in >> s;
    //vector<string> s;
    //s.resize(N);

    if(s[0]==s[1] && s[1]==s[2]){
        out << "No" << endl;
    }else{
        out << "Yes" << endl;
    }


    
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<cmath>

#define pi acos(-1)

#define Rep(i,x,y) for (int i=x,_Lim=y;i<=_Lim;i++)
#define Dep(i,x,y) for (int i=x,_Lim=y;i>=_Lim;i--)

using namespace std;

inline int read(){
	int f=1,res=0,ch=getchar();
	while (ch<'0' || ch>'9'){
		if (ch=='-') f=-1;ch=getchar();
	}
	while (ch>='0' && ch<='9') res=res*10+ch-48,ch=getchar();
	return f*res;
}

typedef long long ll;

const int N=100005;
const int M=2*N;

int n,m,fa[N],dis[N];
inline int find(int u){
	if (fa[u]!=u){
		int res=find(fa[u]);
		dis[u]+=dis[fa[u]];
		fa[u]=res;
	}
	return fa[u];
}
inline int Merge(int x,int y,int d){
	int fx=find(x),fy=find(y);
//	printf("fx=%d fy=%d dx=%d dy=%d\n",fx,fy,dis[x],dis[y]);
	if (fx!=fy){
		dis[fx]=d-dis[x]+dis[y];
		fa[fx]=fy;
		return 1;
	}
	if (dis[x]-dis[y]!=d) return -1;
	return 0;
}
int main(){
	n=read(),m=read();
	Rep(i,1,n) fa[i]=i,dis[i]=0;
	Rep(i,1,m){
		int x=read(),y=read(),d=read();
		if (Merge(x,y,d)==-1) return puts("No"),0;
	}
	puts("Yes");
}

Measured memory_bytes: 896
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Edge=pair<ll,ll>;
using Graph=vector<vector<int>>;
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();}
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;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

////////// 繰り返し二乗法 //////////

ll power(ll a,ll b){
  ll res=1;
  while(b>0){
    if(b&1) res=res*a%MOD;
    a=a*a%MOD;
    b>>=1;
  }
  return res;
}

//////////////////////////////////////////////////

int main(){
  ll N,K,ans=0;
  cin>>N>>K;
  
  ll CNT[K+1];
  RREP(i,K) CNT[i]=0;
  
  for(ll i=K; i>0; --i){
    ll cnt=0;
    cnt+=power(K/i,N);
    for(ll j=2; j<=K/i; ++j){
      cnt-=CNT[j*i];
    }
    cnt%=MOD;
    if(cnt<0) cnt+=MOD;
    CNT[i]=cnt;
    
    ans+=i*CNT[i];
    ans%=MOD;
  }
  
  co(ans);
  return 0;
}

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

using namespace std;

int n;
vector<long long> a;
vector<long long> t;

void hawawa()
{
	cin >> n;
	a.resize(n);
	t.resize(n);
	for (auto&& i : t) {
		cin >> i;
	}
	for (auto&& i : a) {
		cin >> i;
	}
	for (int i = 1; i < n; i++) {
		if (t[i - 1] < t[i]) {
			if (t[i] > a[i]) {
				cout << "0\n";
				return;
			}
		}
	}
	int mod = 1e9 + 7;
	for (int i = n - 2; i >= 0; i--) {
		if (a[i + 1] < a[i]) {
			if (a[i] > t[i]) {
				cout << "0\n";
				return;
			}
		}
	}
	if (t[n - 1] != a[0]) {
		cout << "0\n";
		return;
	}
	long long ans = 1;
	for (int i = 1; i < n - 1; i++) {
		if (t[i - 1] < t[i]) continue;
		if (a[i + 1] < a[i]) continue;
		ans *= min(a[i], t[i]);
		ans %= mod;
	}
	cout << ans << "\n";
}

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


Measured memory_bytes: 1792