akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
struct mint {
    int x;
    mint(int 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 { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(int t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    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;
    }
};
mint F[2100010];
void fact(void) {
	F[0] = mint(1);
	F[1] = mint(1);
	for (int i = 2; i <= 2100000; i++) {
        mint x(i);
		F[i] = x * F[i - 1];
	}
}
 
mint square(mint x) {
    return x * x;
}
 
mint power(mint x, int y) {
    if (y == 0) return mint(1);
    else if (y == 1) return x;
    else if (y % 2 == 0) return square(power(x, y / 2));
    else return square(power(x, y / 2)) * x;
}
 
mint P(int n, int r) {
	if (n < r || n < 0 || r < 0) return mint(0);
	return F[n]/F[n - r];
}
 
mint C(int n, int r) {
	if (n < r || n < 0 || r < 0) return mint(0);
	mint ret;
	ret = F[n]/(F[n - r] * F[r]);
	return ret;
}
mint H(int n, int r) {
	if (n == 0 && r == 0) return mint(1);
	return C(n + r - 1, r);
}
signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    fact();
    int N, K;
    cin >> N >> K;
    int A[100010];
    rep(i, N) cin >> A[i];
    sort(A, A + N);
    mint sum = 0;
    rep(i, N) {
        sum += C(i, K - 1) * A[i];
        sum -= C(N - i - 1, K - 1) * A[i];
    }
    cout << sum.x << endl;


    return 0;
}
// 4 * 3 = 12
// 3 * 2 = 6
// 1 * 1 = 1

// 1 * 3 = 3
// 1 * 2 = 2
// 3 * 1 = 3

Measured memory_bytes: 20764
#include<iostream>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;
 
int main(){
  string s;
  cin >> s;
  int l = s.length();
  for (int i = 0; i < l; i++){
    cout << "x";
  }
  cout << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define endl "\n"
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);

using namespace std;

const int N = 1e6+7;
int n,a,b;

int32_t main()
{
	fast;

	cin>>n>>a>>b;
	cout<<min(n*a,b);
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<string>
#include<algorithm>
#include <bits/stdc++.h>
using namespace std;
int main(void){
	string s;
	int ans=700,i;
	cin>>s;
	for(i=0;i<3;i++){
		if(s[i]=='o') ans+=100;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {

            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }






        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);


            var qhsd = Reads();
            var n = Read();
            var q = qhsd[0];
            var h = qhsd[1];
            var s = qhsd[2];
            var d = qhsd[3];
            var x = new long[] { 8 * q, 4 * h, 2 * s, d };
            Array.Sort(x);
            if (x.Min() == d)
            {
                if (n % 2 == 0) Console.WriteLine(d * n / 2);
                else Console.WriteLine(n / 2*d + x[1] / 2);
            }
            else Console.WriteLine(x.Min() * n / 2);

            Console.Out.Flush();
        }
    }
}




Measured memory_bytes: 13396
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		ArrayList<U> aa = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			long a = in.nextLong();
			long b = in.nextLong();

			U u = new U();
			u.d = a + b;
			u.a = a;
			u.b = b;

			aa.add(u);
		}
		Collections.sort(aa, (u1, u2) -> -Long.compare(u1.d, u2.d));
		long r = 0;
		for (int i = 0; i < aa.size(); i = i + 2) {
			r += aa.get(i).a;
		}
		for (int i = 1; i < aa.size(); i = i + 2) {
			r -= aa.get(i).b;
		}

		in.close();
		System.out.println(r);
	}

}

class U {
	long d;
	long a;
	long b;
}

Measured memory_bytes: 90672
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int MOD = 1000000007;
const int INF = 1e9;

const int mod = 1000000007;
const int inf = 1e9;
#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};

void solve() {
    string s, t;
    cin >> s >> t;
    int sl = s.size(), tl = t.size();
    int dp[sl+1][tl+1];
    for(int i = 0; i < sl+1; i++) for(int j = 0; j < tl+1; j++) dp[i][j] = 0;
    for(int i = 0; i < sl; i++){
        for(int j = 0; j < tl; j++) {
            if(s[i] == t[j]) dp[i+1][j+1] = dp[i][j] + 1;
            chmax(dp[i+1][j+1], dp[i][j+1]);
            chmax(dp[i+1][j+1], dp[i+1][j]);
        }
    }
    cout << dp[sl][tl] << endl;
}

int main(){
    int t;
    cin >> t;
    while(t--) solve();
}


Measured memory_bytes: 7044
#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define dep(i,a,b) for(int i = a; i >= b; i--) 
#define Rep(i,a) for(int i = 0; i < a; i++)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ab(x) ((x) < 0 ? -(x) : (x))
using namespace std;
typedef long long LL;
typedef map<int, int>::iterator mit;
typedef set<int>::iterator sit;
const int N = 510;
char s[N][N];
bool has[N];
int main() {
	int n; scanf("%d",&n);
	int tot = 0;
	rep(i,1,n) scanf("%s",s[i] + 1);
	rep(i,1,n) rep(j,1,n) if (s[i][j] == '#') tot++;
	if (tot == n * n) cout <<0<<endl;
	else if (tot == 0) cout <<-1<<endl;
	else {
		int nd = 0;
		rep(j,1,n) {
			int cnt = 0;
			rep(i,1,n) if (s[i][j] == '#') cnt++;
			if (cnt != n) nd++;
			if (cnt) has[j] = true;
		}
		int ans = 0x7fffffff;
		rep(i,1,n) {
			int tot = 0; if (!has[i]) tot++;
			rep(j,1,n) if (s[i][j] != '#') tot++;
			tot += nd;
			ans = min(ans, tot);
		}
		cout <<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 512
s=list(input())
K=int(input())
for i in range(len(s)-1):
    if s[i]!="a":
        a= ord("z")+1 - ord(s[i])
        if K>=a:
            s[i]="a"
            K-=a
if K:
    s[-1]=chr((K+ord(s[-1])-ord("a"))%(ord("z") - ord("a")+1)+ord("a"))
print("".join(s))


Measured memory_bytes: 50032
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <cstdlib>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional> 
#include <iomanip>
#include <unordered_map>
#include <memory.h>

using namespace std;

int main(void)
{
	int n, y;
	int a = -1, b = -1, c = -1;
	
	cin >> n >> y;

	for (int i = 0; i <= n; i++)
	{
		for (int j = 0; i + j <= n; j++)
		{
			int k = n - i - j;
			if (10000 * i + 5000 * j + 1000 * k == y)
			{
				if (i + j + k == n)
				{
					a = i;
					b = j;
					c = k;
					break;
				}
			}
		}
		if (a != -1 || b != -1 || c != -1)
		{
			break;
		}
	}

	cout << a << ' ' << b << ' ' << c << '\n';
	return 0;

}

Measured memory_bytes: 256
/* ex4-1
    kas056 */
#include <stdio.h>
#include <math.h>

int main(void){
    
    int N, D,people;
    double div;
    scanf("%d %d", &N, &D);


    /*ルールによって監視する木の本数((i+D)-(i-D)+1)
    が一人当たり監視する最低限の木の本数(N/people)を上回ればいい */

    // N/people = (i+D)-(i-D)+1を式変形して得られる値をdiv
    div = (double)N /(2* (double)D + 1);
    people = ceil(div);//divを切り上げて最低限の人間を算出
    printf("%d",people);
    
    return 0;
} 


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
const int INF=999999999;
char a[10][10];
int main() {
 int64_t X,Y;
 cin>>X>>Y;
 int64_t ai=X;
 int count=1;
 while(2*ai<=Y){
 ai*=2;
 count++;
 }
 cout<<count<<endl;
 return 0;}

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

int main() {
	int n, m; cin >> n >> m;
	vector< vector<char>>a(n, vector<char>(n)), b(m, vector<char>(m));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cin >> a[i][j];
		}
	}

	for (int i = 0; i < m; i++) {
		for (int j = 0; j < m; j++) {
			cin >> b[i][j];
		}
	}

	bool exist = false;

	for (int ly = 0; ly < n; ly++) {
		for (int lx = 0; lx < n; lx++) {
			if (ly + m - 1 >= n || lx + m - 1 >= n)continue;

			bool match = true;
			for (int y = 0; y < m; y++) {
				for (int x = 0; x < m; x++) {
					if (a[ly + y][lx + x] != b[y][x])match = false;
				}
			}
			if (match)exist = true;
		}
	}

	if (exist)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
// ABC_165_A

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

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

	bool flag = false;

	for(int i = a; i <= b; ++i) {
		if(i % k == 0) {
			flag = true;
			break;
		}
		else continue;
	}

	if(flag) cout << "OK" << "\n";
	else cout << "NG" << "\n";

	return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define VI         vector<int>
#define MOD 1000000007

typedef long long int ll;

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

const ll INF=(ll)1e19;
//const int INF=(1<<30);

int find(VI &s, int n){
  int l = 0;
  int r = s.size()-1;

  while(l<r){
    ll m = (l+r)/2;
//    cout << l << " " << r << " " << m << endl;
    if(s[m] >= n){
      r=m;
    }else{
      l=m+1;
    }
  }

  if(s[l]==n)return(1);
  else return(0);
}

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

  VI s(n);
  REP(i,n)cin >> s[i];

  int ans=0;
  cin >> q;
  REP(i,q){
    int t;
    cin >> t;

    ans += find(s, t);
  }
  cout << ans << endl;
}



Measured memory_bytes: 3100
#include <iostream>
using namespace std;
int main(void){
    int a,b;
    cin >>a>>b;
    if(a==1) a+=13;
    if(b==1) b+=13;
    
    if(a>b){
        cout <<"Alice";
    }
    else if(a==b){
        cout <<"Draw";
    }
    else{
        cout<<"Bob";
    }
 
    return 0;
    
}


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

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0);
  int n; cin >> n; vector<int> v(n);
  for(auto &x:v) cin >> x;
  int ans = v[0];
  for(int i=1;i<n;i++) ans = __gcd(ans, v[i]);
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

// c++11
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>

#define mp make_pair
#define mt make_tuple
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
template <class T>
using max_priority_queue = priority_queue<T>;
template <class T>
using min_priority_queue = priority_queue<T, std::vector<T>, std::greater<T>>;

const int INF = 1 << 29;
const ll LL_INF = 1LL << 60;
const double EPS = 1e-9;
const ll MOD = 1000000007;

const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
int K;
int main()
{
  cin >> K;
  int tmp = K;
  min_priority_queue<tuple<int, int, int, bool>> que; //(cost, mod, greater K)
  que.emplace(mt(0, 0, 0, false));
  set<pii> visited;
  int result = INF;
  while (not que.empty())
  {
    auto p = que.top();
    que.pop();
    int cost, mod, digit;
    bool greater;
    tie(cost, mod, digit, greater) = p;
    if (mod == 0 && greater)
    {
      result = min(result, cost);
      // cerr << " result = " << result << " " << cost << endl;
    }
    if (visited.count(mp(mod, greater)))
    {
      continue;
    }
    visited.emplace(mp(mod, greater));

    for (int i = 0; i <= 9; i++)
    {
      bool next_greater = greater | ((10 * mod + i) >= K);
      int next_mod = (10 * mod + i) % K;
      int next_digit = digit + 1;
      // cerr << "i = " << i << " next_mod = " << next_mod << " "<< next_greater << endl;
      if (visited.count(mp(next_mod, next_greater)))
      {
        continue;
      }
      if (cost + i > 100)
      {
        continue;
      }
      if (digit + 1 > 100000)
      {
        continue;
      }

      que.emplace(mt(cost + i, next_mod, next_digit, next_greater));
    }
  }
  cout << result << endl;

  return 0;
}


Measured memory_bytes: 17640
/**
*    created: 14.05.2020 12:22:19
**/
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n; cin >> n;
    vector<int> a(n);
    int cnt = 0; 
    rep(i,n) {
        cin >> a[i];
        if (a[i] < 0) cnt++;
    }
    if (cnt % 2 == 0) {
        int sum = 0;
        rep(i,n) {
            sum += abs(a[i]);
        }
        cout << sum << endl;
    }
    else {
        rep(i,n) {
            a[i] = abs(a[i]);
        }
        sort(a.begin(), a.end());
        a[0] = -a[0];
        int sum = 0;
        rep(i,n) {
            sum += a[i];
        }
        cout << sum << endl;
    }
    return 0;
}

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

int main()
{
    int n,s;
    cin>>n>>s;
    int tmp;
    for (int i=1; i<=s; i++){
        cin>>tmp;
        n-=tmp;
    }
    if (n<=0) cout<<"Yes";
    else cout<<"No";
    return 0;
}


Measured memory_bytes: 256
/* Author : Prasuk Jain */
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define int              long long int
#define ull              unsigned long long
#define ld               long double
#define fo(i, n)         for(int i=0; i<n; i++)
#define FOR(i, a, b)     for(int i=a; i<b; i++)
#define rfor(i, n)       for(int i=n-1; i>=0; i--)
#define RFOR(i, a, b)    for(int i=b-1; i>=a; i--)
#define tr(it, v)        for(auto it=a.begin(); it!=a.end(); it++)
#define vi               vector<int>
#define pii              pair<int,int>
#define mii              map<int,int>
#define pqb              priority_queue<int>
#define pqs              priority_queue<int,vi,greater<int>>
#define mp               make_pair
#define pb(x)            push_back(x)
#define hcf(x, y)        __gcd(x, y)
#define lcm(x, y)        boost::math::lcm(x,y)
#define setpre(x, y)     fixed << setprecision(y) << x
#define setbits(x)       __builtin_popcountll(x)
#define zerolead(x)      __builtin_clzll(x)
#define zerotrail(x)     __builtin_ctzll(x)
#define all(x)           x.begin(), x.end()
#define sortall(x)       sort(all(x))
#define PI               3.1415926535897932384626
const int mod = 1e9+7;
const int inf = 1e18;
int mpow(int base, int exp);
bool isprime(int num);
void prifact(int num);

//*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!//

void coderprasukj(){ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

int32_t main() {
    //coderprasukj();
    int t, n, k, x, y;
    char a;
    cin >> a;
    cout << char(a+1) << "\n";
    return 0;
}

//*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!//

int mpow(int base, int exp) {
    base %= mod;
    int result = 1;
    while (exp > 0) {
        if (exp & 1) result = ((int)result * base) % mod;
        base = ((int)base * base) % mod;
        exp >>= 1;
    }
  return result;
}

bool isprime(int num) {
    if(num <= 1) return false;
    for(int i=2; i*i <= num; i++)
        if(num%i == 0) return false;
    return true;
}

void prifact(int num){
    for(int i=2; i<=num; i++)
    if(num%i == 0){
        int cnt = 0;
        while(num%i == 0)
        cnt++ , num /= i;
        cout << i << "^" << cnt << " ";
    }
    if(num > 1)
    cout << num << "^" << "1" << " ";
}


Measured memory_bytes: 256
#include <cstdint>
#include <iostream>
#include <map>

using namespace std;

int main() {
  int64_t n;
  cin >> n;
  map<int64_t, int> m;
  for (int64_t i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      m[i]++;
      n /= i;
    }
  }
  if (n != 1) {
    m[n] = 1;
  }
  int ans = 0;
  for (auto p : m) {
    auto v = p.second;
    int b = 1;
    while (b <= v) {
      v -= b;
      b++;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = 1; i <= (int)(n); i++)
#define drep(i, n) for(int i = (n)-1; i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

// Mod int
const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%mod+mod)%mod){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%mod+mod)%mod; return *this;}
  mint operator-() const { return mint(0) - *this;}
  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{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}
//

int main() {
  int n;
  cin >> n;
  vector<int> a(n+1);
  rep(i,n) cin >> a[i+1];
  vector<int> b(n+1);
  for (int i = n; i >= 1; --i) {
    int sum = 0;
    for (int j = i+i; j <= n; j += i) {
      sum ^= b[j];
    }
    b[i] = sum^a[i];
  }
  vector<int> ans;
  for (int i = 1; i <= n; i++) {
    if (b[i]) ans.push_back(i);
  }
  cout << ans.size() << endl;
  rep(i,ans.size()) {
    printf("%d%c", ans[i], i+1==ans.size()?'\n':' ');
  }
  return 0;
}




Measured memory_bytes: 5424
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
  int n,m,tt,i,j,res;
  string s,t;
  cin >> s >> t;
  n=t.size();
  m=s.size()-t.size();
  res=n;
  for(i=0;i<=m;i++){
    tt=0;
    for(j=0;j<n;j++)
      if(s[i+j]!=t[j])
        tt++;
    res=min(res,tt);
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 3628
s = input()

a = int(s[:2])
b = int(s[2:])

ma = 1 <= a <= 12
mb = 1 <= b <= 12

if ma:
    if mb:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if mb:
        print('YYMM')
    else:
        print('NA')


Measured memory_bytes: 38256
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var n string
	fmt.Scan(&n)
	m, _ := strconv.Atoi(n)
	var ans int
	for i := 1; i <= m; i++ {
		s := strconv.Itoa(i)
		if len(s)%2 == 1 {
			ans++
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1024
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll A[300010];
    rep(i,0,N) cin >> A[i];
    ll ans = 0;
    rep(bit,0,61){
        ll cnt = 0;
        rep(i,0,N){
            if((A[i] >> bit) & 1) cnt++;
        }
        ll amari = N - cnt;
        ans += (1LL<<bit) % MOD * cnt % MOD * (N - cnt) % MOD;
        ans %= MOD;
    }
    print(ans);

    

}

Measured memory_bytes: 2560
###template###
import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return map(int, input().split())
###template###

N = int(input())
V = list(mi())

oddl = V[0::2]
evenl = V[1::2]

#oddl, evenlに含まれる数をバケットソートする。個数をバケツに入れる
obuckets = [0]*(10**5 + 1)
ebuckets = [0]*(10**5 + 1)
for o in oddl:
  obuckets[o] += 1
for e in evenl:
  ebuckets[e] += 1

o1cnt = max(obuckets)
o1 = obuckets.index(o1cnt)
obuckets[o1] = 0

o2cnt = max(obuckets)
o2 = obuckets.index(o2cnt)
obuckets[o2] = 0

e1cnt = max(ebuckets)
e1 = ebuckets.index(e1cnt)
ebuckets[e1] = 0

e2cnt = max(ebuckets)
e2 = ebuckets.index(e2cnt)
ebuckets[e2] = 0

Nd2 = round(N/2) #それぞれの個数
if o1 != e1:
  print(Nd2-o1cnt + Nd2-e1cnt)
else: print(min(Nd2-o1cnt + Nd2-e2cnt, Nd2-o2cnt + Nd2-e1cnt))





Measured memory_bytes: 53588
from itertools import accumulate as ac

n,k=map(int,input().split())
*a,=ac([0]+list(map(int,input().split())))

l=[a[j]-a[i] for i in range(n+1) for j in range(i+1,n+1)]
f=lambda n:sum(map(lambda x:x&n==n,l))

ans=0
for i in range(41)[::-1]:
    if f(ans|1<<i)>=k:
        ans|=1<<i

print(ans)

Measured memory_bytes: 66300
n=int(input())
dp=list(range(110000))
for i in range(n+1):
    pow6=1
    while pow6<=i:
        dp[i]=min(dp[i],dp[i-pow6]+1)
        pow6 *=6
    pow9=1
    while pow9<=i:
        dp[i]=min(dp[i],dp[i-pow9]+1)
        pow9 *=9    
print(dp[n])

Measured memory_bytes: 42508
#include<iostream>
#include<string.h>
#define A 0
#define B 1
#define AB 2
#define O 3
using namespace std;

struct data{
	int num;
	char blood[2];
};

int main(){
	int num,judge[4]={0};
	char blood[3];
	
	while(scanf("%d,%s",&num,blood)!=EOF){
		if(blood[0]=='A'&& blood[1]=='B'){
			judge[AB]++;
		}
		else if(blood[0]=='A' && blood[1]=='\0'){
			judge[A]++;
		}
		else if(strcmp(blood,"B")==0){
			judge[B]++;
		}
		else if(strcmp(blood,"O")==0){
			judge[O]++;
		}
		
		memset(blood,'\0',sizeof(blood));
	}
	for(int i=0;i<4;i++){
		cout<<judge[i]<<endl;
	}
	return 0;
}

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define cinv(n,vec) V vec(n);for(auto&v:vec)cin>>v;
#define int long long
#define itn int
#define pb push_back
#define m_p make_pair
#define m_t meke_tuple
#define p_p(a,b) pb(m_p(a,b))
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(all(a));reverse(all(a))
#define UNIQUE(a) a.erase(unique(all(a)),a.end())
#define SZ(a) (ll)(a.size())
#define ENDL cout<<endl
#define debg(a) cout<<#a<<" "<<a<<endl;
#define debgp(a) cout<<#a<<" "<<a.fi<<" : "<<a.se<<endl
#define call(a) for(auto i:a)cout<<i<<" ";cout<<endl
#define show(a) rep(ghf,SZ(a)){rep(kjh,SZ(a[ghf])){cout<<(a[ghf][kjh]<10?" ":"")<<a[ghf][kjh]<<" ";}ENDL;}
#define out(a) cout<<(a)<<endl
#define fi first
#define se second
#define Vec vector
#define P pair
#define VV(type,name,y,x,a) vector<vector<type>> name = vector<vector<type>>(y,vector<type>(x,a))
typedef long long ll;
typedef double D;
typedef long double LD;
typedef string str;
typedef vector<ll> V;
typedef pair<ll,ll> Pi;
typedef vector<Pi> VP;
const long long INF = 1LL<<60;
const long long MOD = 1e9+7;
void Yes(){cout<<"Yes"<<endl;}
void No(){cout<<"No"<<endl;}
void YN(bool b){cout<<(b?"Yes":"No")<<endl;}
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n,m;
  cin>>n>>m;
  V a(n);
  rep(i,n)cin>>a[i];
  VP bc(m);
  rep(i,m)cin>>bc[i].se>>bc[i].fi;

  priority_queue< Pi > que;
  rep(i,n)que.push(m_p(a[i],1));
  rep(i,m)que.push(bc[i]);

  ll cnt=0,sum=0;
  while(1){
    Pi now=que.top(); que.pop();
    rep(i,now.se){
      sum+=now.fi;
      cnt++;
      if(cnt==n){
        cout<<sum<<endl;
        return 0;
      }
    }
  }

  
  
  
  
  return 0;
}



Measured memory_bytes: 8816
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 999999999
#define MINF -999999999
#define ALL(n) n.begin(),n.end()
string s;
ll dp[114][514];


int main() {
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	if (d % 2 == 0)cout << a - b << endl;
	else cout << b - a << endl;
	}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
     int n, num, digit, rev = 0;
     cin >>n;
     num=n;
     do
     {
         digit = num % 10;
         rev = (rev * 10) + digit;
         num = num / 10;
     } while (num != 0);
     if (n == rev)
         printf("Yes");
     else
         printf(" No");
    return 0;
}

Measured memory_bytes: 256
$R, $G, $B, $N = gets.split.map(&:to_i)
count = 0
(0..$N).each do |r|
  (0..$N).each do |g|
    b = ($N - $R * r - $G * g).to_f / $B
    if 0 <= b && b.ceil == b.to_i
      count += 1
    end
  end
end
puts count

Measured memory_bytes: 1788
#include <iostream>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <vector>
#include <functional>
using namespace std;

using ll = long long;
using P = pair<int, int>;

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

    string s;
    cin >> s;

    for (int i = s.size() - 1; i >= 0; i--) {
        if (s[i] == 'F') {
            for (int j = i - 1; j >= 0; j--) {
                if (s[j] == 'C') {
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#ITP1_6_D
n,m=map(int,input().split())
A=[[0 for j in range(m)]for i in range(n)]
B=[[0 for j in range(1)]for i in range(m)]
C=[[0 for j in range(1)]for i in range(n)]
for i in range(n):
  D=list(map(int,input().split()))
  for j in range(m):
    A[i][j]=D[j]
for i in range(m):
  B[i][0]=int(input())
S=int(0)
for j in range(n):
  for i in range(m):
    S=S+(A[j][i]*B[i][0])
  C[j][0]=S
  S=0
for i in range(n):
  print(C[i][0])



Measured memory_bytes: 6020
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    int N;
    cin >> N;
    vector<int> B(N - 1);
    for (int& i : B) cin >> i;
    int ans = B[0] + B[N - 2];
    for (int i = 1; i < N - 1; i++) ans += min(B[i], B[i - 1]);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,d,r;
	double f;
	cin>>a>>b;
	d=a/b;
	r=a%b;
	f=1.0*a/b;
	cout<<d<<" "<<r<<" ";
	printf("%.6lf\n", f);
}



Measured memory_bytes: 3216
#include <vector>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iterator>
#include <string>
using namespace std;

template<typename T, typename Comparison = less<T>>
class Heap {
    vector<T> dt;
    int n;
public:
    Heap(): n{} {}

    template<typename Itr>
    Heap(const Itr& begin, const Itr& end): dt(begin, end), n(distance(begin, end)) {
        build_heap();
        }

    Heap(initializer_list<T> list): dt(list), n(list.size()) {
        build_heap();
    }

    void insert(const T& v) {
        dt.push_back(v);
        n++;

        for(int i=n-1; check(par(i)) && Comparison()(dt[par(i)], dt[i]); i = par(i)) {
            swap(dt[i], dt[par(i)]);
        }
    }

    T top() {
        return *dt.begin();
    }

    void pop() {
        // delete root node
        dt[0] = dt[n-1];
        n--;

        dt.resize(n);

        heapify(0);
    }

    bool empty() const {
        return dt.empty();
    }

    void sort() {
        for(auto itr = dt.rbegin(); itr != dt.rend(); itr++) {
            swap(*dt.begin(), *itr);
            
        }
    }

    friend ostream& operator<< (ostream& os, const Heap& heap) {
        os << "==================================" << endl;
        for(auto itr = heap.dt.begin(); itr != heap.dt.end(); itr++) {
            cout << distance(heap.dt.begin(), itr) << ": " << *itr << endl;
        }
        os << "==================================" << endl;

        return os;
    }

    void print() {
        for(T x : dt) cout << " " << x;
        cout << endl;
    }

private:
    void build_heap() {
        for(auto itr = dt.rbegin(); itr != dt.rend(); itr++) {
            heapify(distance(dt.begin(), itr.base()) - 1);
        }
    }

    void heapify(int i){
        const int left = 2*i + 1, right = 2*i + 2;
        int max_itr = i;
        
        if(check(left) && Comparison()(dt[max_itr], dt[left])) {
            max_itr = left;
        }

        if(check(right) && Comparison()(dt[max_itr], dt[right])) {
            max_itr = right;
        }

        if(max_itr != i) {
            swap(dt[max_itr], dt[i]);
            heapify(max_itr);
        }
    }

    bool check(int i) {
        return 0 <= i && i < n;
    }

    int par(int i) {
        return (i-1) / 2;
    }
};

int main() {
    /*
    Heap<int> hp({1, 3, 2});

    while(true) {
        cout << "insert command: ";
        char s; cin >> s;
        switch(s) {
            case 'i':
                cout << "insert numer: ";
                int n; cin >> n;
                hp.insert(n);
                cout << "insert success!" << endl;
                break;
            case 'd':
                cout << "deleted number: " << hp.top() << endl;
                hp.pop();
                break;
            default:
                cout << hp << endl;
        }
    }
    */

    int n; cin >> n;
    vector<int> v(n);
    for(int i=0; i<n; i++) cin >> v[i];

    Heap<int> hp(v.begin(), v.end());

    hp.print();

    return 0;
}



Measured memory_bytes: 6764
#
# 172C Go to school
#
a = []
n = input()
nums = [int(e) for e in input().split()]

for i in range(int(n)):
    a.append([i, nums[i]])

a_sorted = sorted(a, key=lambda x: x[1])

for i in range(int(n)):
    print(str(a_sorted[i][0]+1), end=' ')

Measured memory_bytes: 27188
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define sc second
typedef pair<int,int> P;
int main()
{
	while(true){
		int N;
		scanf("%d",&N);
		if(N==0)break;
		vector<P>G[26];
		int k;
		for(int i=0;i<N;i++){
			string S;
			cin >> S;
			G[S[0]-'a'].pb(P(i,S[(int)S.length()-1]-'a'));
			k=S[0]-'a';
		}
		
		bool F[26];
		for(int i=0;i<26;i++)F[i]=false;
		
		vector<int>s;
		int l=0;int r=1;
		s.pb(k);
		while(l!=r){
			int num=s[l];l++;
			if(F[num])continue;
			F[num]=true;
			for(int i=0;i<(int)G[num].size();i++){
				if(!F[G[num][i].sc]){
					s.pb(G[num][i].sc);
					r++;
				}
			}
		}
		bool ans=true;
		
		
		
		int cou[26];
		for(int i=0;i<26;i++){
			cou[i]=0;
		}
		for(int i=0;i<26;i++){
			for(int j=0;j<(int)G[i].size();j++){
				cou[G[i][j].sc]++;
			}
		}
		
		for(int i=0;i<26;i++){
			if(((int)G[i].size()!=0||cou[i]!=0)&&!F[i]){
				ans=false;
			}
		}
		for(int i=0;i<26;i++){
			if(cou[i]!=(int)G[i].size())ans=false;
		}
		if(ans)printf("OK\n");
		else printf("NG\n");
	}
	return 0;
}

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

int main() {
    int ans = 0, N;
    string n;
    cin >> n;
    N = atoi(n.c_str());
    for (int i = 0; i <= n.size(); i += 2) {
        for (int j = pow(10, i); j < pow(10, i + 1); ++j) {
            if (j <= N)
                ans++;
            else {
                cout << ans << endl;
                return 0;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3956
#include <stdio.h>
int main()
{
    int a,b;
    scanf("%d %d",&a,&b);
        if (a<b){
          printf("a < b\n");}
        else if (a>b){
         printf("a > b\n");}
        else{ 
         printf("a == b\n");}
        return 0;
}


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

#define ll long long 

int main(void){
    int n;
    cin >> n;
    int a = 10 - n%10;
    int b = 10 - (n/10) % 10;
    int c = 10 - (n/100)% 10;
    cout << 100*c + 10 * b + a<< endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  if(a>b){
    cout<<(a+a-1);
  }if(a<b){
    cout<<(b+b-1);
  }if(a==b){
    cout<<(a+b);
  }
}

Measured memory_bytes: 256
def dijkstra_list(graph, startidx):
    # 頂点数
    n_nodes = len(graph)
    
    # 各頂点の情報
    nodes = []
    for i in range(n_nodes):
        nodes.append([
            float("inf"), # cost
            None,         # from
            False,        # 確定したか？
            i             # 自分自身の頂点番号(0-indexed)、nodesのindexと一致するはず
        ])

    # 優先度付きキューの準備
    import heapq
    priority_queue = []
    heapq.heapify(priority_queue)

    # 初期化
    nodes[startidx][0] = 0
    nodes[startidx][1] = None
    nodes[startidx][2] = True

    # 始点から到達できるnodeを優先度付きキューに入れる
    for dst, cost in graph[startidx]:
        if nodes[dst][0] > nodes[startidx][0]+cost:
            nodes[dst][0] = nodes[startidx][0]+cost
            nodes[dst][1] = startidx
            heapq.heappush(priority_queue, nodes[dst])
    
    # heapqから一つ取り出し（最小コストの未確定頂点が取り出される）確定させた上で、
    # 新たに確定した点から行ける頂点をキューに入れる
    # これをすべての点が確定するまで繰り返す
    n_done = 1
    while priority_queue:
        if n_done == n_nodes:
            break

        node = heapq.heappop(priority_queue)
        if node[2]: # 確定済みであれば次の頂点を取り出す
            continue
        
        node[2] = True
        n_done += 1

        for dst, cost in graph[node[3]]:
            if nodes[dst][0] > nodes[node[3]][0]+cost:
                nodes[dst][0] = nodes[node[3]][0]+cost
                nodes[dst][1] = node[3]
                heapq.heappush(priority_queue, nodes[dst])

    costs = [node[0] for node in nodes]
    froms = [node[1] for node in nodes]
    return  costs, froms

def resolve():
    N = int(input())
    adjs = [[] for _ in range(N)]
    for _ in range(N-1):
        a, b, c = list(map(int, input().split()))
        adjs[a-1].append([b-1, c])
        adjs[b-1].append([a-1, c])
    Q, K = list(map(int, input().split()))
    queries = [list(map(int, input().split())) for _ in range(Q)]
    costs, _ = dijkstra_list(adjs, K-1)
    for q in queries:
        print(costs[q[0]-1]+costs[q[1]-1])


if '__main__' == __name__:
    resolve()

Measured memory_bytes: 86780
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define MOD 998244353

LL powmod(LL a, LL n){
	if(n == 0) return 1;
	if(n % 2) return (a * powmod(a, n-1)) % MOD;
	LL c = powmod(a, n/2);
	return (c*c) % MOD;
}

struct UF{
	int n;
	vector<int> par;
	UF(int n) : n(n) {
		for(int i = 0; i < n; i++) par.push_back(i);
	}
	int find(int a){
		if(a != par[a]) par[a] = find(par[a]);
		return par[a];
	}
	void join(int a, int b){
		par[find(a)] = find(b);
	}
};


int main(){
	LL n = 0;
	cin >> n;
	pair<LL,LL> d[n];
	for(LL i = 0; i < n; i++){
		cin >> d[i].first >> d[i].second;
	}
	LL ans = powmod(2, n);
	//ans -= 1;
	//ans -= n;

	for(LL i = 0; i < n; i++){
		map<pair<LL,LL>, LL> f;
		for(LL j = i+1; j < n; j++){
			LL a1 = d[i].first - d[j].first;
			LL a2 = d[i].second - d[j].second;
			LL gc = __gcd(a1,a2);
			a1 /= gc; a2 /=gc;
			if(a1 < 0 || (a1 == 0 && a2 < 0)){
				a1 = -a1; a2 = -a2;
			}
			f[make_pair(a1,a2)] ++;
		}
		for(auto it = f.begin(); it != f.end(); it++){
			LL t = it->second;
			ans -= powmod(2,t);
			ans++;
		}
	}

	ans -= n;
	ans -= 1;
	ans %= MOD;
	while(ans < 0) ans += MOD;
	cout << ans << endl;
}


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

int main() {
	std::string s, t;
	std::cin >> s >> t;
	int n = s.size(), m = t.size();
	int next[26][n];
	for (int i = 0; i < 26; i++) {
		int cur = n;
		for (int j = n - 1; j >= 0; j--) {
			if (s[j] == i + 'a') cur = j;
			next[i][j] = cur;
		}
	}
	int times = 0;
	int head = 0;
	for (int i = 0; i < m; i++) {
		int nex = next[t[i] - 'a'][head];
		if (nex == n) {
			if (next[t[i] - 'a'][0] == n) {
				std::cout << -1 << std::endl;
				return 0;
			} else times++, head = next[t[i] - 'a'][0] + 1;
		} else if (nex == n - 1) times++, head = 0;
		else head = nex + 1;
	}
	std::cout << (int64_t) times * n + head << std::endl;
	
	
	return 0;
}


Measured memory_bytes: 10880
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#include <bitset>
#define M 1000000007
#define M1 998244353

#define tr(container, it) \
for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)

#define fast                        \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL);

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

ll power(ll x, ll n)
{
    ll result = 1;
    while (n)
    {
        if (n % 2 == 1)
            result = result * x;
        n = n / 2;
        x = x * x;
    }
    return result;
}

ll gcd(ll a, ll b)
{
    if (!b)
        return a;
    return gcd(b, a % b);
}

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

inline ll mul(ll x, ll y, ll m)
{
    ll z = 1LL * x * y;
    if (z >= m)
    {
        z %= m;
    }
    return z;
}

ll powmod(ll x, ll y, ll m)
{
    ll r = 1;
    while (y)
    {
        if (y & 1)
        {
            r = mul(r, x, m);
        }
        y >>= 1;
        x = mul(x, x, m);
    }
    return r;
}



void start()
{
    fast;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}
/***********************************************************************************************************/

int main()
{
    start();

    int n, m, c;
    cin>>n>>m>>c;
    int b[m];
    for (int i=0;i<m;i++)
    {
        cin>>b[i];
    }
    int ans=0;
    while (n--)
    {
        int a[m];
        for (int i=0;i<m;i++)
        {
            cin>>a[i];
        }
        int temp=0;
        for (int i=0;i<m;i++)
        {
            temp+=a[i]*b[i];
        }
        temp+=c;
        if (temp>0)
        {
            ans++;
        }
    }
    cout<<ans;
    return 0;
}

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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

int N;
string A, B;
int tol[2010], tor[2010];

bool ok(int to, int x, int df, vector<pii>& vec, vector<int>& mx, bool flg) // A[0]->B[to]
{
	int L = x, R = x + df;
	int sz = vec.size();
	int mn = 0;

	// if (L == 1 && R == 0) {
	// 	puts("wo");
	// 	rep(i, sz) printf("(%d %d)\n", vec[i].fi, vec[i].se);
	// }

	if (!flg) {
		for (int i = 0; i <= sz; ++i) {
			if (i - 1 >= 0) mn = min(mn, vec[i-1].fi);
			if (-mn > L) break;

			if (mn + R >= mx[i]) {
			// if (L == 1 && R == 0) {
			// 	cout<<"INDEX "<< i<<endl;
			// }
			// printf("ha??? %d %d %d\n", mn, R, mx[i]);
			// printf("DEBUG %d %d %d\n", to, L, R);
				return true;
			}
		}
	} else {
		for (int i = 0; i <= sz; ++i) {
			if (i - 1 >= 0) mn = min(mn, vec[i-1].fi);
			if (-mn > R) break;

			if (mn + L >= mx[i]) {
			// if (L == 1 && R == 0) {
			// 	cout<<"INDEX "<< i<<endl;
			// }
			// printf("ha??? %d %d %d\n", mn, R, mx[i]);
			// printf("DEBUG %d %d %d\n", to, L, R);
				return true;
			}
		}		
	}

	return false;
}

int main() {
	cin >> A >> B;
	N = A.size();

	if (A == B) {
		puts("0");
		return 0;
	}

	bool one = 0;
	rep(i, N) if (B[i] == '1') one = 1;

	if (!one) {
		puts("-1");
		return 0;
	}

	rep(i, N) {
		for (int j = 0; j < N; ++j) {
			if (B[(i-j+N)%N] == '1') {
				tol[i] = j;
				break;
			}
		}
		for (int j = 0; j < N; ++j) {
			if (B[(i+j)%N] == '1') {
				tor[i] = j;
				break;
			}
		}
		//cout << tol[i] << " " << tor[i] << endl;
	}

	int ret = 10000;

	rep(to, N) { //0->to mod N
		vector<pii> vec, vec2;

		rep(i, N) if (B[(i+to) % N] != A[i]) {
			vec.eb(-tol[i], tor[i]);
			vec2.eb(-tor[i], tol[i]);
		}

		sort(ALL(vec));
		reverse(ALL(vec));

		sort(ALL(vec2));
		reverse(ALL(vec2));

		vector<int> mx(vec.size() + 1), mx2(vec.size() + 1);
		mx.back() = mx2.back() = -100000;
		for (int i = (int)vec.size() - 1; i >= 0; --i) {
			mx[i] = max(mx[i+1], vec[i].se);
			mx2[i] = max(mx2[i+1], vec2[i].se);
		}

		for (int df : {to - N, to, to + N}) {
			int lo = max(0, -df), hi = N;
			if (ok(to, lo, df, vec, mx, 0)
				|| ok(to, lo, df, vec2, mx2, 1)) hi = lo;

				while (hi - lo > 1) {
					int m = (lo + hi) / 2;
					if (ok(to, m, df, vec, mx, 0)
						|| ok(to, m, df, vec2, mx2, 1)) {
						hi = m;
				} else {
					lo = m;
				}
			}
			ret = min(ret, hi + (hi + df) + (int)vec.size());
		}
	}

	cout << ret << endl;

	return 0;
}

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

using namespace std;
int main(){
    #ifndef ONLINE_JUDGE 
    freopen("i.txt", "r", stdin); 
    freopen("m.txt", "w", stdout); 
    #endif
    int k;
    cin>>k;
    string s;
    cin>>s;
    int n=s.length();
    if(n<=k){
    	cout<<s<<endl;
    }
    else{
    	string m="";
    	for(int i=0;i<k;i++){
    		m=m+s[i];
    		
    	}
    	m=m+"...";
    	cout<<m<<endl;
    }


    }

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=4e5+5;
const ll mod=998244353;
int n,m,op,x,y;
ll k,tree[N<<2],add[N<<2],mul[N<<2];
void pushup(int i)
{
    tree[i]=(tree[i<<1]+tree[i<<1|1])%mod;
}

void pushdown(int i,int l,int r){
    int mid=l+r>>1;
    if(add[i]) {
        tree[i << 1] = (tree[i << 1] + ll(mid - l + 1) * add[i]%mod) % mod;
        tree[i << 1 | 1] = (tree[i << 1 | 1] + ll(r - mid) * add[i]%mod) % mod;
        add[i << 1] = (add[i << 1] + add[i]) % mod;
        add[i << 1 | 1] = (add[i << 1 | 1] + add[i]) % mod;
        add[i] = 0;
    }
}

void build(int i,int l,int r)
{
    add[i]=0;
    if(l==r)
    {
        tree[i]=0;
        return ;
    }
    int mid=l+(r-l)/2;
    build(i<<1,l,mid);
    build(i<<1|1,mid+1,r);
    pushup(i);
}

void update2(int i,int l,int r,int m,int n,ll k)
{
    if(m<=l&&r<=n)
    {
        add[i]=(add[i]+k%mod)%mod;
        tree[i]=(tree[i]+(r-l+1LL)*k%mod)%mod;
        return ;
    }
    pushdown(i,l,r);
    int mid=l+(r-l)/2;
    if(m<=mid) update2(i<<1,l,mid,m,n,k);
    if(n>mid) update2(i<<1|1,mid+1,r,m,n,k);
    pushup(i);
}

ll query(int i,int l,int r,int x)
{
    if(l==r) return tree[i];
    int mid=l+(r-l)/2;
    pushdown(i,l,r);
    if(x<=mid) return query(i<<1,l,mid,x);
    else return query(i<<1|1,mid+1,r,x);
}

int main(){
    vector<pair<int,int>>v;
    cin>>n>>m;
    build(1,1,2*n);
    while(m--){
        cin>>x>>y;
        v.push_back({x,y});
    }
    //for(int i=1;i<=2*n;i++)cout<<tree[i]<<endl;
    update2(1,1,2*n,1,1,1);
    for(int i=1;i<=n;i++){
        ll k=query(1,1,2*n,i)%mod;
        //cout<<k<<endl;
        for(auto j:v){
            update2(1,1,2*n,i+j.first,i+j.second,k);
        }
    }
    cout<<query(1,1,2*n,n);
    return 0;
}


Measured memory_bytes: 19988
#include<cstdio>
main(){int a,b,c,d;scanf("%d%d%d", &a, &b, &c);c-=60;d=a+b;
while((c+=60)<3600)
if(0<=c%d&&c%d<=a)
break;
printf("%d\n",c>3599?-1:c);return 0;}

Measured memory_bytes: 2756