akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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 (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

int ddx[] = {0,1};
int ddy[] = {1,0};
int h,w;

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

    cin >> h >> w;
    vvec field(105,vec(105,'#'));
    vvi dp(105,vi(105,INF));
    --h,--w;
    int cnt = 0;
    rep(i,h+1){
        rep(j,w+1){
            cin >> field[i][j];
        }
    }
    if(field[0][0]=='#') dp[0][0] = 1;
    else dp[0][0] = 0;


    rep(i,h+1){
        rep(j,w+1){
            rep(k,2){
                int ni = i+ddx[k], nj=j+ddy[k];
                int add = 0;
                if(field[ni][nj] == '#' && field[i][j] == '.') add = 1;
                chmin(dp[ni][nj], dp[i][j] + add);
            }
        }
    }
    /*
    rep(i,h+1){
        rep(j,w+1){
            cout << dp[i][j] << " ";
        }
        cout  << endl;
    }
    */
    cout << dp[h][w] << endl;

    return 0;
}


Measured memory_bytes: 384
#include <iomanip>
#include <limits>
#include <thread>
#include <utility>
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <cmath>
#include <numeric>
#include <cassert>
#include <random>
#include <chrono>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <list>
#include <functional>
#include <bitset>
#include <complex>
#include <tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double D;
typedef complex<D> P;
const ll E = 1e18 + 7;
const ll MOD = 1000000007;
#define REP(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define fill(x, y) memset(x, y, sizeof(x))
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
template <class... A>
void prints() { cout << endl; }
template <class... A>
void prints_rest() { cout << endl; }
template <class T, class... A>
void prints_rest(const T &first, const A &... rest) { cout << " " << first; prints_rest(rest...); }
template <class T, class... A>
void prints(const T &first, const A &... rest) { cout << first; prints_rest(rest...); }

template <class T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

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

    string s, t;
    cin >> s >> t;

    vector<vector<int>> indices(26, vector<int>(0));
    rep(i, sz(s)) {
        int c = s[i] - 'a';
        indices[c].push_back(i);
    }

    ll loc = -1;
    ll loop = 0;
    rep(i, sz(t)) {
        int c = t[i] - 'a';

        if (sz(indices[c]) == 0) {
            prints("-1");
            return 0;
        }

        auto nextIter = upper_bound(all(indices[c]), loc);
        if (nextIter == indices[c].end()) {
            ++loop;
            loc = indices[c][0];
        } else {
            loc = *nextIter;
        }

        // cout << i << " " << loc << " " << loop << endl;
    }

    ll lenS = s.length();
    ll ans = lenS * loop + loc + 1;
    prints(ans);
    return 0;
}



Measured memory_bytes: 1228
l = input()
m = 10**9+7
ans = 0
c = 1
while len(l) > 1:
  ans = (ans+c*pow(3,len(l)-1,m))%m
  j = 1
  while l[j] == '0':
    j += 1
    if j == len(l):
      j -= 1
      break
  l = l[j:]
  c = (2*c)%m
ans = (ans+(2*int(l)+1)*c)%m
print(ans)

Measured memory_bytes: 3188
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int mod = 1e9 + 7;
constexpr ll modpow(ll A, ll B) {
	ll kotae = 1;
	while (B > 0) {
		if (B & 1) kotae = kotae * A % mod;
		A = A * A % mod;
		B >>= 1;
	}
	return kotae;
}

char c[1000010];
int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);

	int K;
	scanf("%d ", &K);

	fread(c, 1, 1000010, stdin);
	int L = 0, R = 1000000;
	while (L + 1 < R) {
		int M = (L + R) / 2;
		if (c[M] >= 'a') L = M;
		else R = M;
	}
	int M = R;

	int inv[1000010];
	inv[0] = 1;
	inv[1] = 1;
	rep1(i, K - 1) inv[i + 1] = ll(inv[i]) * i % mod;
	ll tmp = modpow(ll(inv[K]) * K % mod, mod - 2);
	for (int i = K; i > 0; i--) {
		inv[i] = inv[i] * tmp % mod;
		tmp = tmp * i % mod;
	}

	const ll are = 423076927;
	tmp = modpow(26, K);
	ll kotae = 0;
	rep(i, K + 1) {
		tmp = tmp * inv[i] % mod;
		kotae += tmp;
		tmp = tmp * (M + i) % mod;
		tmp = tmp * are % mod;
	}

	printf("%lld\n", kotae % mod);

	Would you please return 0;
}

Measured memory_bytes: 8084
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll n,h;

    ll c=0;
    cin>>n>>h;
    vector<ll>v(n),v2(n);
    ll ma=0;
    for(ll i=0;i<n;i++)
    {
        cin>>v[i];
        cin>>v2[i];
        ma=max(ma,v[i]);
    }
    sort(v2.begin(),v2.end(),greater<ll>());
   // if(n==2)
    //{
    for(ll i=0;i<n;i++)
    {
        if(v2[i]>=ma)
        {
            h=h-v2[i];
            c=c+1;
            if(h<=0)
            {
                goto answer;
            }
        }
        else
        {
            break;
        }

    }
    if(h%ma==0)
    {
        c=c+(h/ma);
    }
    else{c=c+(h/ma)+1;}
    //}
    answer:
    cout<<c<<endl;

    }



Measured memory_bytes: 4808
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int A, B;

		final int N = scanner.nextInt();
		prepare(N);
		int[] except = new int[N];

		final int M = scanner.nextInt();
		final int K = scanner.nextInt();

		for (int i = 0; i < M; i++) {
			A = scanner.nextInt() - 1;
			B = scanner.nextInt() - 1;
			union(A, B);
			except[A]++;
			except[B]++;
		}

		for (int i = 0; i < K; i++) {
			A = scanner.nextInt() - 1;
			B = scanner.nextInt() - 1;
			if (find(A) == find(B)) {
				except[A]++;
				except[B]++;
			}
		}

		scanner.close();

		for (int i = 0; i < N; i++) {
			System.out.print(desc[find(i)] - except[i]);
			System.out.print(i == N - 1 ? "\n" : " ");
		}
	}

	static int[] parent;
	static int[] desc;

	static void prepare(int n) {
		parent = new int[n];
		for (int i = 0; i < n; i++) {
			parent[i] = i;
		}
		desc = new int[n];
	}

	static int find(int x) {
		if (parent[x] == x)
			return x;
		else
			return find(parent[x]);
	}

	static void union(int x, int y) {
		int xRoot = find(x);
		int yRoot = find(y);
		if (xRoot == yRoot)
			return;
		if (desc[xRoot] >= desc[yRoot]) {
			parent[yRoot] = xRoot;
			desc[xRoot] += desc[yRoot] + 1;
		} else {
			parent[xRoot] = yRoot;
			desc[yRoot] += desc[xRoot] + 1;
		}
	}
}


Measured memory_bytes: 97452
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
	
	ll nn;
	cin >> nn;
	
	int tmp;
	
	string res="";
	
	while(nn>0){
		tmp = nn%26;
		
		if(tmp==0) tmp = 26;
		
		nn = (nn-tmp)/26;
		res += char('a'+tmp-1);
	}
	
	reverse(res.begin(),res.end());
	
	cout << res << endl;
	
	
	return 0;
}

Measured memory_bytes: 3644
#include<iostream>
#include<vector>
//#include<algorithm>  -> sorting
using namespace std;

#define pb push_back
#define mp make_pair
#define st first
#define nd second
typedef pair < int , int > pp;
const int mod = 1e9 + 7;
const int N   = 2e5 + 5;

int a,b;

signed main(){
    cin >> a >> b;
    cout << (b*1900 + (a-b)*100) * (1 << b);
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

/*
	ax + by = c
	dx + ey = f

	ax = c - by
	x = (c - by) / a

	dx = f - ey
	x = (f - ey) / d

	(c - by) / a = (f - ey) / d
	d(c - by) = a(f - ey)
	dc - bdy = af - aey
	aey - bdy = af - dc
	y(ae - bd) = af - dc
	y = (af - dc) / (ae - bd)
*/

int main() {
	double a, b, c, d, e, f, x, y;
	while (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF) {
		y = (a * f - d * c) / (a * e - b * d);
//		x = (f - e * y) / d;
		x = (c - b * y) / a;

//		if (x > (double)-0.001 && x <= (double)0) x = 0;
//		if (y > (double)-0.001 && y <= (double)0) y = 0;

		printf("%.3f %.3f\n", x, y);
	}
	return 0;
}

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

int dist(int x1, int y1, int x2, int y2) {
	return pow(x1 - x2, 2) + pow(y1 - y2, 2);
}

int main(int argc, char const *argv[])
{
	int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
	printf("%d %d %d %d\n", x2 - (y2 - y1), y2 + (x2 - x1)
		, x1 - (y2 - y1), y1 + (x2 - x1));
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#include <math.h>
using namespace std;
int main(){
  /*int t;
  cin >> t;
  for (int j = 0; j < t; j++){*/
  long long int n;
  int k;
  cin >>n>>k;
  cout << (int)(log(n) / log(k))+1 << "\n";
      
  //}
  return 0;
}


Measured memory_bytes: 512
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
 
const double TL = 1.5 * CLOCKS_PER_SEC;
mt19937 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count());
#define clr(x, y) memset(x, y, sizeof(x))
#define forn(i, n) for (int i = 0; i < n; i++)
#define LL long long
const double pi = acos(-1.0);


int n, m;
int a[500005], ans[500005], idx[500005];
pair<pair<int, int>, int> p[500005];
queue<int> q[500005];


int lowbit(int x) {
  return x & -x;
}

int query(int x) {
  int ans = 0;
  for (int i = x; i >= 1; i -= lowbit(i)) {
    ans += idx[i];
  }
  return ans;
}

void update(int x, int w) {
  for (int i = x; i <= n; i += lowbit(i)) {
    idx[i] += w;
  }
}

int main() {
#ifdef LOCAL
  auto start_clock = clock();
  freopen("in", "r", stdin);
#endif
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    q[a[i]].push(i + 1);
  }
  for (int i = 0; i < m; i++) {
    int l, r;
    scanf("%d%d", &l, &r);
    p[i] = {{l - 1, r - 1}, i};
  }

  sort(p, p + m);
  for (int i = 1; i <= 500000; i++) {
    if (q[i].size() > 0) {
      update(q[i].front(), 1);
    }
  }

  for (int i = 0, j = 0; i < m; i++) {
    int l = p[i].first.first, r = p[i].first.second;
    while(l > j) {
      int x = a[j];
      update(q[x].front(), -1);
      q[x].pop();
      if (q[x].size() > 0) {
        update(q[x].front(), 1);
      }
      j += 1;
    }
    ans[p[i].second] = query(r + 1);
  }

  for (int i = 0; i < m; i++) {
    printf("%d\n", ans[i]);
  }

#ifdef LOCAL
 auto end_clock = clock();
 cout << "Time:" << (end_clock - start_clock) / CLOCKS_PER_SEC << endl;
#endif
  return 0;
}

Measured memory_bytes: 352968
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <string.h>
int counter(int D,int K)
{ int count = 0;
    while (D<K)
    {
      D=D*2;
      count++;
    }

    return count ;
}
int main()
{
   int N , K;
   scanf("%d %d",&N,&K);
   double prob=0.0;
   double tester = 0.0;
   for (double i = 1;i<=N;i++)
   {
    tester = pow(0.5,(double)counter(i,K));
    prob+=(double)1/N * tester;

   }
   printf("%.12lf",prob);

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main(int argc, char *argv[])
{
  for(;;) {
    int n, m;
    cin >> n >> m;
    if(n == 0) break;
    vector<bool> bs;
    for(int i = 0; i < n; i++) {
      int c;
      cin >> c;
      bs.push_back(c == 1);
    }
    vector<bool> ts, fs;
    int c = 0;
    bool cur = false;
    for(int i = 0; i < n; i++) {
      if(c == 0) { cin >> c; cur = !cur; }
      ts.push_back(cur);
      fs.push_back(!cur);
      c--;
    }
    auto popcount = [&n](vector<bool> &src) {
      int c = 0;
      for(int i = 0; i < src.size(); i++) {
        if(src[i]) c++;
      }
      return c;
    };
    // now, let's swap!
    auto swaps = [&n,&popcount](vector<bool> &src, vector<bool> &tgt) {
      vector<bool> x(src.size());
      copy(src.begin(), src.end(), x.begin());
      if(popcount(src) != popcount(tgt)) return n * n;
      int cnt = 0;
      for(int i = 0; i < n; i++) {
        if(x[i] != tgt[i]) {
          for(int j = i + 1; j < n; j++) {
            cnt++;
            if(x[j] == tgt[i]) {
              x[j] = x[i];
              x[i] = tgt[i];
              break;
            }
          }
        }
      }
      return cnt;
    };
    cout << min(swaps(bs, ts), swaps(bs,fs)) << endl;
    break;
  }
  return 0;
}




Measured memory_bytes: 3120
import java.util.Scanner;

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

    while (in.hasNext()) {
      long N = in.nextLong();
      long maxGroup = 0;

      for (int i = 0; i < 5; ++i) {
        long transport = in.nextLong();
        long group = N / transport + (N % transport > 0 ? 1 : 0);

        maxGroup = Math.max(maxGroup, group);
      }

      System.out.println(maxGroup + 5 - 1);
    }
  }
}

Measured memory_bytes: 22612
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    static class CGotoSchool
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var aList = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();
            var aDic = aList.Select((x, i) => new { x, i }).ToDictionary(y => y.x - 1, y => y.i + 1);

            var answer = new List<int>();
            for (int i = 0; i < aList.Count; i++)
            {
                answer.Add(aDic[i]);
            }

            Console.WriteLine(string.Join(" ", answer));
            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 33116
//#pragma GCC optimize ("-O3","unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include <random>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb(a) push_back
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), n)
#define ub(v,n) upper_bound(v.begin(), v.end(), n)
#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")

template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 998244353;const int MAX = 50000;
const double pi = acos(-1); const double EPS = 1e-12;
const ll INF = 1e18;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll add(ll x, ll y) {
	x += y;
	if (x >= MOD) return x - MOD;
	return x;
}
ll sub(ll x, ll y) {
	x -= y;
	if (x < 0) return x + MOD;
	return x;
}

ll mult(ll x, ll y) {
	return (x * y) % MOD;
}
ll bin_pow(ll x, ll p) {
	if (p == 0) return 1;
	if (p & 1) return mult(x, bin_pow(x, p - 1));
	return bin_pow(mult(x, x), p / 2);
}

int num[100010];
void solve() {
	int N; cin >> N;
	vector<int>D(N);
	REP(i, N)cin >> D[i];
	if (D[0] != 0) {
		print(0);
		return;
	}
	int mx = 0;
	REP(i, N) {
		num[D[i]]++;
		mx = max(mx, D[i]);
	}
	ll ans = 1;
	FOR(i, 1, N) {
		if (D[i] == 0)ans = 0;
		ans = mult(ans, num[D[i] - 1]);
	}
	print(ans);
}


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

	solve();
}




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

char raw_char(char a) {
    if ('D' <= a && a <= 'Z') {
        return a-3;
    } else if (a == 'A') {
        return 'X';
    } else if (a == 'B') {
        return 'Y';
    } else if (a == 'C') {
        return 'Z';
    }
}

string decipher(string s) {
    for (int i = 0; i < s.length(); i++) {
        s[i] = raw_char(s[i]);
    }
    return s;
}

int main() {
    string s;
    cin >> s;
    cout << decipher(s) << endl;
    return 0;
}

Measured memory_bytes: 0
#include <iostream>
using namespace std;
int main(void){
  int a,b;
  cin >> a >> b;
  
  if(a % 3 == 0 ||b % 3 == 0||(a + b) % 3 == 0)
    cout << "Possible" << endl;
  else
    cout << "Impossible" << endl;
  
  return 0;
}

    

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,i,n;
	scanf("%d %d %d",&a,&b,&c);
	scanf("%d",&n);
	if(a>=b&&a>=c)
	{
		for(i=0;i<n;i++)
			a*=2;
	}
	else if(b>a&&b>c)
	{
		for(i=0;i<n;i++)
			b*=2;
	}
	else if(c>a&&c>b)
	{
		for(i=0;i<n;i++)
			c*=2;
	}
	printf("%d",a+b+c);
	return 0;
}

Measured memory_bytes: 256
N = int(input())
A = input()
B = input()

ptn = []
i = 0
while i < N:
    if A[i] == B[i]:
        ptn.append(1)
        i += 1
    else:
        ptn.append(2)
        i += 2

MOD = 10**9+7
ans = 3 * ptn[0]
for a,b in zip(ptn,ptn[1:]):
    if a == 1 and b == 1:
        ans *= 2
    elif a == 1 and b == 2:
        ans *= 2
    elif a == 2 and b == 2:
        ans *= 3
    ans %= MOD
print(ans)

Measured memory_bytes: 3188
import sys
def input():
    return sys.stdin.readline()[:-1]

S = input()
if S=='SUN':
    print(7)
elif S=='MON':
    print(6)
elif S=='TUE':
    print(5)
elif S=='WED':
    print(4)
elif S=='THU':
    print(3)
elif S=='FRI':
    print(2)
elif S=='SAT':
    print(1)

Measured memory_bytes: 3060
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        boolean isok = false;
        for (int i = 1; i <= 9; i++) {
            for (int j = 1; j <= 9; j++) {
                if (i * j == n) {
                    isok = true;
                    break;
                }
            }
        }
        if (isok) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


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

using namespace std;

int main() {
	int n;
	cin >> n;
	for (int i = 1; i <= 9; ++i)
		if (i*100+i*10+i >= n) {
			cout << i*100+i*10+i << endl;
			break;
		}	
	return 0;
}

Measured memory_bytes: 256
// unihernandez22
// https://atcoder.jp/contests/abc150/tasks/abc150_c
// implementation

import std.stdio;
import std.array;
import std.conv: to;
import std.string: chomp;
import std.algorithm;
import std.range: iota;
import std.math: abs;

void main() {
	int n = readln.chomp.to!int;
	int[] p = readln.split.map!(to!int).array;
	int[] q = readln.split.map!(to!int).array;
	int[] x = iota(1, n+1).array;
	
	int a, b;
	int step = 1;
	while (x.nextPermutation) {
		if (x == p)
			a = step;
		if (x == q)
			b = step;
		step++;
	}
	abs(a-b).writeln;
}


Measured memory_bytes: 3244
#include<bits/stdc++.h>
using namespace std;
#define maxn 205
#define mod 998244353
int x[maxn],y[maxn];
inline int mul(int a, int b) {
  return (long long) a * b % mod;
}

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

void add(int &a,int b)
{
    a+=b;
    if(a>=mod)a-=mod;
}
main()
{
    int n;scanf("%d",&n);
    for(int i=0;i<n;i++)scanf("%d%d",&x[i],&y[i]);
    int ans=pow(2,n);
    add(ans,mod-1);
    add(ans,mod-n);
    add(ans,mod-n*(n-1)/2);
    for(int i=0;i<n;i++)for(int j=i+1;j<n;j++)
    {
        int a=y[j]-y[i];
        int b=x[i]-x[j];
        int c=-a*x[i]-b*y[i];
        int cnt=2;
        for(int k=0;k<n;k++)
        {
            if (k==i || k==j)continue;
            int z=a*x[k]+b*y[k]+c;
            if(z!=0)continue;
            if(k<j)break;
            cnt++;
        }
        add(ans,mod-pow(2,cnt));
        add(ans,1);
        add(ans,cnt);
        add(ans,cnt*(cnt-1)/2);
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>

using namespace std;
using i64=long long int;

int main() {
    int N;
    cin >> N;
    multiset<int> A;

    for (int i = 0; i < N; ++i) {
        int t;
        cin >> t;
        A.insert(t);
    }

    int ans = 0;
    auto it = A.end();
    while (A.size() > 1 && --it != A.begin()) {
        int n = *it;
        A.erase(it);

        int mask = 0;
        int tmp = n;
        while (tmp) {
            tmp >>= 1;
            mask = (mask << 1) | 1;
        }
        int op = (~n & mask) + 1;

        auto opi = A.find(op);
        if (opi != A.end()) {
            ++ans;
            A.erase(opi);
        }

        it = A.end();
    }

    cout << ans << endl;

    

    return 0;
}


Measured memory_bytes: 9600
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

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

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
#define MOD (1e9+7)
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")


template <typename T>
T gcd(T a,T b){
  if(a%b==0)return b;
  else return gcd(b,a%b);
}
template <typename T>
T lcm(T a,T b){
  return a/gcd(a,b)*b;
}
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
int main() { 
  long long a,b;cin>>a>>b;
  cout << lcm(a,b) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
    int W , H ;
    while(1){
        cin >> H >> W;
        if ( H == 0 && W == 0 ) break;
        
        for (int i = 0; i < H; i++ ){
            for(int j = 0; j < W; j++ ){
                if( i == 0 || i == H-1 || j == 0 || j== W-1 ){
                cout << '#';       
                } else {
                cout << '.';  
            }
        }
        cout << "\n";
    }
        cout << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <vector>

using namespace std;

struct UnionFind{
    int n;
    vector<int> parent;
    vector<int> depth;
    vector<int> groupnum;

    UnionFind(int num){
        n = num;
        parent.resize(n);
        depth.resize(n);
        groupnum.resize(n);
        for(int i=0;i<n;i++){
            parent[i] = i;
            depth[i] = 0;
            groupnum[i] = 1;
        }

    }
    void unite(int a, int b){
        int ra = find_root(a);
        int rb = find_root(b);
        if(ra == rb)
            return;
        if(depth[ra] > depth[rb]){
            parent[rb] = ra;
            groupnum[ra] += groupnum[rb];
        }
        else{
            parent[ra] = rb;
            groupnum[rb] += groupnum[ra];
            if(depth[ra] == depth[rb])
                depth[rb]++;
        }
        
    }

    int find_root(int a){
        if(parent[a] == a)
            return a;
        return parent[a] = find_root(parent[a]);

    }

    bool same(int a, int b){
        return find_root(a) == find_root(b);
    }
    int get_groupnum(int x){
        return groupnum[find_root(x)];
    }
};
int main(){
    int n, m;
    cin >> n >> m;
    vector<vector<int>> edges(n);
    vector<pair<int,int>> edge_list;
    vector<long long> result(m);
    for(int i=0;i<m;i++){
        int a, b;
        cin >> a >> b;
        a--, b--;
        edges[a].push_back(b);
        edges[b].push_back(a);
        edge_list.push_back(make_pair(a, b));
    }
    long long now = (long long)n * (n - 1) / 2;

    UnionFind uf(n);
    for(int i=m-1;i>=0;i--){
        result[i] = now;
        int n1 = edge_list[i].first;
        int n2 = edge_list[i].second;
        long long con = (long long)uf.get_groupnum(n1) * uf.get_groupnum(n2);
        if(!uf.same(n1, n2))
            now -= con;
        uf.unite(n1, n2);

    }
    for(auto res: result)
        cout << res << endl;
    return 0;
}


Measured memory_bytes: 9968
/*input
2 2
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
int a[maxn];
int main()
{
	IOS;
	int n,m;
	cin>>n>>m;
	int ans=0;
	for(int i=0;i<=n;i++) for(int j=0;j<=n;j++){
		if(m-i-j>=0&&m-i-j<=n) ans++;
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 256
n=int(input())
dp=list(range(n+1))
C=[]
i=1
while n>=6**i:
    C.append(6**i)
    i+=1
i=1
while n>=9**i:
    C.append(9**i)
    i+=1
C.sort()


for c in C:
    for i in range(n+1):
        if i-c<0:continue
        dp[i]=min(dp[i],dp[i-c]+1)
print(dp[-1])


Measured memory_bytes: 6900
import std.stdio, std.conv, std.array, std.string;
import std.algorithm;
import std.container;
import std.range;
import core.stdc.stdlib;
import std.math;

void main() {
  auto N = readln.chomp.to!ulong;
  auto halfN = N / 2;
  writeln(halfN - (N%2 == 0 ? 1 : 0));
}


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

int main(){
	int n;
	cin >> n;
	vector<int> v2(n);
	vector<pair<int,int>> v(n);
	for (int i=0; i<n; ++i){
		cin >> v[i].first;
		v[i].second = i;
		v2[i] = v[i].first;
	}
	sort(v.begin(),v.end());
	for (int i=0; i<n; ++i){
		if (v.back().second == i) cout << v[n-2].first;
		else cout << v.back().first;
		cout << '\n';
	}
}

Measured memory_bytes: 3968
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n;
string k;

int32_t main(){_

   cin>>k;

   n = sz(k);

   int tot = 0;
   for (int i = 0; i < n; ++i)
   {
      tot += (k[i] == 'o');
   }

   if (tot+15-n >= 8){
      cout<<"YES";
   }
   else{
      cout<<"NO";
   }
   

   return 0;
}

// Common sense: do smth instead of nothing
// Even a single second counts...
// If other's can do it, even I can do it. It wouldn't be that tough. Let me give it a try.
// Mistakes made in past
// -Ques. ask for max-min => think binary_search, DP, greedy
// -not reading question properly / skipping to read & understand all samples properly & wasting time in wrong direction.
// -Using wrong indexing in nested loops something like a[i], when it is supposed to be a[j](WA)
// -value of const int N is not correct (WA/RTE).
// -Did you memset dp to -1 ?
// -check for small edges cases and work on small test cases manually if WA
// -not deallocating memory to pointers can lead to MLE. Use delete :))
// -not reading problem statements of harder problems E,..., thinking it couldn't be solved, but it isn't the case.
// -Avoid using #define int long long as much as possible when it's dp problem and requires high memory say, O(N^2, N=5000) (MLE)
// -Check Bitwise Operator Precedence 
// -Use pragmas to optimize (by constant factor) when necessary..
// -Think before coding & starting to debug. Have patience to look inside code and actually see how it works

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
INF = 1<<31
from heapq import heapify,heappop,heappush
from collections import defaultdict

N,Q = map(int,input().split())
event = []
for _ in range(N):
    s,t,x = map(int,input().split())
    event.append((s - x,-1,x))
    event.append((t - x,0,x))
for i in range(Q):
    d = int(input())
    event.append((d,1,i))

q = []
ans = [-1] * Q
event.sort()
push = defaultdict(int)
pop = defaultdict(int)
for i in range(2*N + Q):
    t,typ,x = event[i]
    if typ == -1:
        heappush(q,x)
        push[x] += 1
    elif typ == 0:
        pop[x] += 1
    else:
        p = -1
        if q:
            p = q[0]
        while p != -1 and push[p] - pop[p] == 0:
            heappop(q)
            if q:
                p = q[0]
            else:
                p = -1
                break
        ans[x] = p
print('\n'.join(map(str,ans)))

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

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

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);

    ll n;
    Vec v(3);
    cin>>v[0]>>v[1]>>v[2];
    sort(ALL(v));
    n = v[0]+v[1]+v[2];

    ll ans=0;
    rep(i,10){
        ll x = v[2]*3+3*i;
        if((x-n)%2==0){
            ans = (x-n)/2;
            break;
        }
    }

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


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

public class Main {
	FastScanner in;
	PrintWriter out;

	void solve() {
		char[] s = in.next().toCharArray();
		int k = in.nextInt();
		for (int i = 0; i < s.length; i++) {
			if (s[i] == 'a') {
				continue;
			}
			int need = 'z' + 1 - s[i];
			if (need <= k) {
				s[i] = 'a';
				k -= need;
			}
		}
		int last = s[s.length - 1] - 'a';
		last = (last + k) % 26;
		s[s.length - 1] = (char) ('a' + last);
		out.println(new String(s));
	}

	void run() {
		try {
			in = new FastScanner(new File("object.in"));
			out = new PrintWriter(new File("object.out"));

			solve();

			out.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
	}

	void runIO() {

		in = new FastScanner(System.in);
		out = new PrintWriter(System.out);

		solve();

		out.close();
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		public FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				String s = null;
				try {
					s = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (s == null)
					return null;
				st = new StringTokenizer(s);
			}
			return st.nextToken();
		}

		boolean hasMoreTokens() {
			while (st == null || !st.hasMoreTokens()) {
				String s = null;
				try {
					s = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (s == null)
					return false;
				st = new StringTokenizer(s);
			}
			return true;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}
	}

	public static void main(String[] args) {
		new Thread(null, new Runnable() {
			public void run() {
				new Main().runIO();
			}
		}, "1", 1 << 26).start();
	}
}

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

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};
// combination
mint choose(int n, int a) {
    mint x = 1, y = 1;
    rep(i,a) {
        x *= n-i;
        y *= i+1;
    }
    return x / y;
}


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

  for(int i = 1; i <= k; ++i) {
    mint ans = choose(n-k+1,i) * choose(k-1,i-1);
    cout << ans.x << endl;
  }
  
  return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(x) x.begin(),x.end()
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

int a;
ll solve(){
   ll ans=0;
   

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

    cin>>a;
    int ans=a+a*a+a*a*a;
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
constexpr int INF = 1 << 29;
constexpr int MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;

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

int main() {
	int N, C;
	cin >> N >> C;
	vector<vector<int>> D(C, vector<int>(C, 0));
	vector<vector<int>> cnt(3, vector<int>(C, 0));
	for (int i = 0; i < C; i++) {
		for (int j = 0; j < C; j++) {
			cin >> D[i][j];
		}
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			int c;
			cin >> c;
			c--;
			cnt[(i + j) % 3][c]++;
		}
	}

	int ret = INF;
	for(int i = 0; i < C; i++) {
		for (int j = 0; j < C; j++) {
			for (int k = 0; k < C; k++) {
				if (i == j || j == k || i == k) continue;
				int sum = 0;
				for (int c = 0; c < C; c++) {
					sum += cnt[0][c] * D[c][i];
					sum += cnt[1][c] * D[c][j];
					sum += cnt[2][c] * D[c][k];
				}
				ret = min(ret, sum);
			}
		}
	}
	cout << ret << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>


using namespace std;


int main(){
	long long int N,A,B;
	cin >> N >> A >> B;
	if(A > B){
		cout << 0 << endl;
	}
	else if(N == 1 && B == A){
		cout << 1 << endl;
	}
	else if(N == 1){
		cout << 0 << endl;
	}
	else {
		long long int maxNumb = A + B + (B * (N - 2));
		long long int minNumb = A + B + (A * (N - 2));
		cout << (maxNumb - minNumb + 1) << endl;
	
	
	}


}

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

int main() {
  int n, m; cin >> n >> m;
  vec h(n); rep(i,n) cin >> h[i];
  vec a(m), b(m);
  vector<vec> g(n);
  vector<bool> f(n, true);
  rep(i,m) {
    cin >> a[i] >> b[i]; a[i]--; b[i]--;
    g[a[i]].push_back(b[i]);
    g[b[i]].push_back(a[i]);
    if (h[a[i]] > h[b[i]]) {
      f[b[i]] = false;
    } else if (h[a[i]] < h[b[i]]) {
      f[a[i]] = false;
    } else {
      f[a[i]] = false;
      f[b[i]] = false;
    }
  }
  int c = 0;
  rep(i,n) {
    if (f[i]) c++;
  }

  cout << c << endl;
}


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

# スペース区切りの整数の入力
a, b, c = map(int, input().split())

if a > b:
	if a > c:
		print("{}".format((a*10)+b+c))
	else:
		print("{}".format(a+b+(c*10)))
else:
	if b > c:
		print("{}".format(a+(b*10)+c))
	else:
		print("{}".format(a+b+(c*10)))

Measured memory_bytes: 3060
#include <stdio.h>

int ruijou(int);

main(){
  int data[8][8], num[8]={4,1,4,1,2,1,2,1};
  int i, j, k, ans[8], p[8], sum[8], temp, v[8], a=0, min;


  for(i=0;i<8;i++){
    k=i;
    for(j=0;j<8;j++,k++){
      if(k==8) k%=8;
      data[i][j]=num[k];
    }
  }


  while(1){
    
    for(i=0;i<8;i++){
      if(scanf("%d", &p[i])==EOF){
	a=1;
	break;
      }
    }
    if(a==1) break;
    for(i=0;i<8;i++){
      sum[i]=0;
      ans[i]=-1;
      v[i]=0;
    }

    for(i=0;i<8;i++){
      for(j=0;j<8;j++){
	temp=p[j]-data[i][j];
	if(temp<0) temp=0;
	sum[i]+=temp;
      }
    }

    temp=1000000;

    for(i=0;i<8;i++){
      if(temp>sum[i]) temp=sum[i];
    }

    for(i=0,j=0;i<8;i++){
      if(sum[i]==temp){
	ans[j]=i;
	j++;
      }
    }

    if(j==1){
      printf("%d", data[ans[0]][0]);
      for(i=1;i<8;i++){
	printf(" %d", data[ans[0]][i]);
      }
      printf("\n");
    }

    else{
      for(i=0;i<j;i++){
	for(k=0;k<8;k++){
	  v[i]+=data[ans[i]][k]*ruijou((8-k));
	}
      }
      temp=-1;
      k=0;
      for(i=0;i<j;i++){
	if(temp==-1 || temp>v[i]){
	  temp=v[i];
	  k=i;
	}
      }
      printf("%d", data[ans[k]][0]);
      for(i=1;i<8;i++){
	printf(" %d", data[ans[k]][i]);
      }
      printf("\n");
    }
  }
  return 0;
}

int ruijou(int a){
  int sum=1,i;
  
  for(i=0;i<a;i++){
    sum*=10;
  }
  return sum;
}

Measured memory_bytes: 0
import sys
sys.setrecursionlimit(10**9)

S = input()
N = len(S)
P = 2019
if P == 2 or P == 5:
    ans = 0
    for i in range(N):
        if int(S[i]) % P == 0:
            ans += i + 1
    print(ans)
    sys.exit()

num = [0] * P
num[0] = 1
now, ans = 0, 0
_10 = 1
for i in range(N-1, -1, -1):
    now = (now + int(S[i]) * _10) % P
    _10 *= 10
    _10 %= P
    ans += num[now]
    num[now] += 1

print(ans)


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

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

int main(void)
{
    ll r,d,x; cin>>r>>d>>x;
    ll ans[10];
    rep(i,10){
        ll x2=r*x-d;
        ans[i]=x2;
        x=x2;
    }
    rep(i,10){
        cout<<ans[i]<<endl;
    }
    return 0;
} 

Measured memory_bytes: 256
class Store:
    def __init__(self, c, p, id):
        self.city = c
        self.point = p
        self.id = id
N = int(input())
stores = []
for i in range(N):
    c, p = input().split()
    stores.append(Store(c, int(p), i+1))
stores.sort(key = lambda x: (x.city, -x.point))
for i in range(N):
    print(str(stores[i].id))

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long int
#define fast  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(t)            int t; cin>>t; while(t--)
const int mod = 1000000007;
bool comp(pair<ll,ll>& a, pair<ll,ll>& b)
{
    if(a.second == b.second)
    return a.first > b.first;
    else
    return b.second < a.second;
}
ll MOD(ll x)
{
    return (x%mod + mod)%mod;
}
ll mul(ll a ,ll b)
{
    return MOD(MOD(a) * MOD(b));
}
int main()
{
    fast
    ll n,k;

    cin>>n>>k;

    vector<ll> pos;
    vector<ll> neg;

    for(int i=0;i<n;i++){
            int x;
            cin>>x;
            if(x>0)
                pos.push_back(x);
            else
                neg.push_back(x);
    }
    ll ans = 1;
    int po = pos.size();
    int ne = neg.size();
    if(po==n)
    {
        sort(pos.rbegin(),pos.rend());
        for(int i=0;i<k;i++)
        {
            ans = mul(ans,pos[i]);

        }
        cout<<ans<<endl;
    }
    else if(ne==n)
    {
        sort(neg.begin(),neg.end());
        if(k%2==1)
            sort(neg.rbegin(),neg.rend());
        for(int i=0;i<k;i++)
        {
            ans = mul(ans,neg[i]);
        }
        cout<<ans<<endl;
    }
    else
    {
        if(k%2==1)
        {
            sort(pos.begin(),pos.end());
            ans = mul(ans,pos.back());
            pos.pop_back();
            k--;
        }
        vector<ll> res;
        sort(neg.begin(),neg.end());
        sort(pos.rbegin(),pos.rend());
        for(int i=0;i+1<(int)neg.size();i+=2)
        {
            res.push_back(neg[i]*neg[i+1]);
        }
        for(int i=0;i+1<(int)pos.size();i+=2)
        {
            res.push_back(pos[i]*pos[i+1]);
        }
        if((int)pos.size()%2 && (int)neg.size()%2)
            res.push_back(pos.back()*neg.back());
        sort(res.rbegin(),res.rend());
        for(int i=0;i<(k/2);i++)
        {
            ans = mul(ans,res[i]);
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 6592
using System;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{
    
    class Program
    {
      
        static void Main(string[] args)
        {
            
            string[] str = Console.ReadLine().Split(' ');
            int N = int.Parse(str[0]);
            int K = int.Parse(str[1]);
           
            long cnt = 0;
            long cnt_half = 0;
           
            for(int a = 1; a <= N; a++)
            {
                //Kが奇数の時、かつ、aがKの倍数
                if (K % 2 == 1 && a % K == 0)
                {
                    cnt++;
                }//Kが偶数の時、かつ、aがKの倍数か2分のKの倍数
                else if (K % 2 == 0)
                {
                    if(a % K == 0)
                    {                        
                        cnt++;
                    }
                    else if(a % K == K / 2)
                    {                        
                        cnt_half++;
                    }
                      
                }
            }

            Console.WriteLine((long)Math.Pow(cnt, 3) + (long)Math.Pow(cnt_half, 3));

        }
    }
}


Measured memory_bytes: 13140
w = []
d = []
n,k = map(int,input().split())
for i in range(n):
	w1,d1 = map(int,input().split())
	w.append(w1)
	d.append(d1)

range_min = 0
range_max = 2 * 10 ** 18

while abs(range_max - range_min) > 1:
	mid = (range_max + range_min) // 2

	sum_flowers = 0
	for i in range(n):
		if mid >= w[i]:
			sum_flowers +=  (mid - w[i]) // d[i] + 1

	if sum_flowers < k:
		range_min = mid 
	else:
		range_max = mid

print(range_max)

Measured memory_bytes: 57816