akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;
#define int              long long
#define ps(x,y)         fixed<<setprecision(y)<<x //how much precision is required
#define max(x,y)        ((x>y)?x:y)
#define min(x,y)        ((x<y)?x:y)
#define pb              push_back
#define mp              make_pair
#define vi              vector<int>
#define pii             pair<int,int>
#define setbits(x)      __builtin_popcountll(x)// how many 1 are present
#define zrobits(x)      __builtin_ctzll(x)//how many zero are present from left to first 1.
#define w(x)            int x; cin>>x; while(x--)
#define PI 3.1415926535897932384626
const int mod = 1000000007;//1e9+7
void ash()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("/home/ashish/Desktop/C++/in.txt", "r", stdin);
    freopen("/home/ashish/Desktop/C++/out.txt", "w", stdout);
#endif
}
int32_t main()
{
    ash();
int N;
cin>>N;
vi a;
int t;
while(N!=0)
 {
t=N%10;
a.emplace_back(t);
N=N/10;
 }   
 for(int x:a)
 {
     if(x==7)
     {
         cout<<"Yes";
         exit(0);
     }
     continue;
 }
cout<<"No";
}
 

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <algorithm>
#include <bitset>
#include <fstream>
#include <sstream>
#include <string>
#include <time.h>
#include <math.h>

using namespace std;

int main() {
  int N = 0;
  cin >> N;
  vector<int> s(N);
  int max = 0;
  for (int i=0; i<N; i++) {
    cin >> s[i];
    max += s[i];
  }
  int ans = 0;
  if (max%10 == 0) {
    sort(s.begin(), s.end());
    for (int i=0; i<N; i++) {
      if (s[i]%10 != 0) {
        ans = max - s[i];
        break;
      }
    }
  }else{
    ans = max;
  }
  cout << ans << endl;
}


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

using namespace std;

#define FC ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define FIN freopen("in.txt","r",stdin)
#define FOUT freopen("out.txt","w",stdout)
#define deb(x) cerr<<"DEBUG------"<<'\n';cerr<<#x<<"------>";err(x)

template<typename T>
void err(T a){
    cerr<<a<<'\n';
    cerr<<"END OF DEBUG"<<'\n'<<'\n';
}

const long double PI=acos(-1.0);  
const long double eps=1e-6;
const long long maxw=(long long)1e17+(long long)10;

using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

/*head------[@cordercorder]*/

const int maxn=(int)1e5+10; 

int a[maxn],n;
int dp[maxn];

void solve(){
    dp[1]=0;
    int mine;
    for(int i=2;i<=n;i++){
        mine=(int)1e9+10;
        for(int j=i-1;j>=i-2&&j>=1;j--){
            mine=min(mine,dp[j]+abs(a[i]-a[j]));
        }
        dp[i]=mine;
    }
    printf("%d\n",dp[n]);
}

int main(void){
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    solve();
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
const ll INF = 1LL<<60;
/*template*/

int main()
{
  ll n,k;cin>>n>>k;
  ll ans=0;
  while(n!=0){
    n/=k;
    ans++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define all(a)          (a).begin(), (a).end()
#define sort(a)         sort(all(a))
#define uniq(a)         sort(a);(a).erase(unique(all(a), (a).end())
#define reverse(a)      reverse(all(a))
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }
#define pb              push_back
#define fst             first
#define int             long long
#define INF             __LONG_LONG_MAX__

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve() {
  ll x; cin >> x;
  ll ans = x / 500 * 1000;
  x %= 500;
  outl(ans + x / 5 * 5);
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 888
using System;

namespace ABC046A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c, x=2;

            var word = Console.ReadLine().Split(' ');

            a = int.Parse(word[0]);
            b = int.Parse(word[1]);
            c = int.Parse(word[2]);

            if (a != b && a != c && b != c)
                x = 3;
            else if (a == b && a == c && b == c)
                x = 1;

            Console.WriteLine(x);

            Console.ReadKey();
        }
    }
}

Measured memory_bytes: 9044
#include <iostream>
#include <vector>
#include <map>

using namespace std;

int main(){
  int n;
  while(cin >> n, n){
    vector<int> X(n), Y(n), R(n), C(n);
    map<int, vector<int> > M;
    for(int i = 0; i < n; ++i){
      cin >> X[i] >> Y[i] >> R[i] >> C[i];
      M[C[i]].push_back(i);
    }
    vector<int> DP(1<<n, -1);
    DP[0] = 0;
    for(int i = 0; i < 1<<n; ++i){
      if(DP[i] < 0) continue;
      for(int j = 0; j < n; ++j){
        bool f = true;
        if((i>>j) & 1) continue;
        for(int l = 0; l < j; ++l){
          if((!((i>>l)&1)) && (X[l] - X[j])*(X[l] - X[j]) + (Y[l] - Y[j])*(Y[l] - Y[j]) < (R[l] + R[j])*(R[l] + R[j])){
            f = false;
            break;
          }
        }
        if(!f) continue;
        int c = C[j];
        for(int k = 0; k < M[c].size(); ++k){
          int a = M[c][k];
          if(a == j || ((i>>a) & 1)) continue;
          f = true;
          for(int l = 0; l < a; ++l){
            if((!((i>>l)&1)) && (X[l] - X[a])*(X[l] - X[a]) + (Y[l] - Y[a])*(Y[l] - Y[a]) < (R[l] + R[a])*(R[l] + R[a])){
              f = false;
              break;
            }
          }
          if(f){
            //cout << j << " " << a << endl;
            DP[i|(1<<j)|(1<<a)] = max(DP[i|(1<<j)|(1<<a)], DP[i] + 2);
          }
        }
      }
    }
    int ans = 0;
    for(int i = 0; i < 1<<n; ++i){
      //cout << i << " " << DP[i] << endl;
      ans = max(ans, DP[i]);
    }
    cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 68476
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;



int main(){
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) {
        cin >> a[i];
        --a[i];
    }
    vi idx(n);
    rep(i, n) idx[a[i]] = i;
    if(n == 1) {
        cout << 0 << endl;
        return 0;
    }
    int k = 0;
    int l = 0, r = 1;
    while(1) {
        if(idx[r-1] > idx[r]) {
            k = max(k, r - l);
            l = r;
        }
        ++r;
        if(r == n) {
            k = max(k, r - l);
            break;
        }
    }
    cout << n - k << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
string s;
int main(){
	cin>>s;
	for(char ch='a';ch<='z';ch++)
		if(s.find(ch)==string::npos){
			cout<<ch<<endl;
			return 0;
		}
	cout<<"None"<<endl;
	return 0;
}

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

class dice{
    public:
    int num[6], new_num[6];
    void refresh();
    void turnN();
    void turnS();
    void turnE();
    void turnW();
};
void dice::refresh(){
    for(int i=0;i<6;i++){
        num[i] = new_num[i];
    }
}

void dice::turnN(){
    new_num[0] = num[1];
    new_num[1] = num[5];
    new_num[2] = num[2];
    new_num[3] = num[3];
    new_num[4] = num[0];
    new_num[5] = num[4];
    
}

void dice::turnS(){
    new_num[0] = num[4];
    new_num[1] = num[0];
    new_num[2] = num[2];
    new_num[3] = num[3];
    new_num[4] = num[5];
    new_num[5] = num[1];
}

void dice::turnE(){
    new_num[0] = num[3];
    new_num[1] = num[1];
    new_num[2] = num[0];
    new_num[3] = num[5];
    new_num[4] = num[4];
    new_num[5] = num[2];
}

void dice::turnW(){
    new_num[0] = num[2];
    new_num[1] = num[1];
    new_num[2] = num[5];
    new_num[3] = num[0];
    new_num[4] = num[4];
    new_num[5] = num[3];
}


int main(){
    
    int n;
    
    cin >> n;
    
    dice a[n];
    bool flag = false;
    
    //input
    for(int i=0;i<n;i++){
        for(int j=0;j<6;j++){
            cin >> a[i].num[j];
        }
    }
    
    for(int m=0;m<n-1;m++){
        for(int l=m+1;l<n;l++){
            for(int k=0;k<4;k++){
                for(int j=0;j<4;j++){
                    for(int i=0;i<4;i++){
                        if(a[m].num[1]==a[l].num[1] && a[m].num[2]==a[l].num[2] && a[m].num[3]==a[l].num[3] && a[m].num[4]==a[l].num[4] && a[m].num[5]==a[l].num[5] && a[m].num[0]==a[l].num[0]){
                            flag = true;
                        }
                        a[m].turnW();
                        a[m].refresh();
                    }
                    a[m].turnS();
                    a[m].refresh();
                }
                a[m].turnW();
                a[m].refresh();
            }
        }
    }

    if(flag == false){
        cout << "Yes" << endl;
    }else{
        cout << "No" <<endl;
    }
    
    return 0;
    
}


Measured memory_bytes: 3080
a,b,c = gets.split(" ").map(&:to_f)

s = a*b*Math.sin(c * Math::PI/180) / 2

d = Math.sqrt(a**2 + b**2 - 2*a*b*Math.cos(c/180 * Math::PI))
l = a+b+d

h = s*2/a

puts s, l, h

Measured memory_bytes: 8884
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)

using namespace std;

namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;

using ll = long long;
ll mod = pow(10, 9) + 7;

template <typename T> void output(T, ll);
ll gcd(ll, ll);
ll lcm(ll, ll);
Bint comb(Bint, Bint);
void prime_map(map<ll, ll> &, ll);

int main() {
    // source
    ll n, z, w;
    cin >> n >> z >> w;
    ll a[n];
    rep(i, n) { cin >> a[i]; }
    ll ans = 0;
    if (n == 1) {
        ans = abs(a[0] - w);
    } else {
        ans = max(abs(a[n - 1] - w), abs(a[n - 1] - a[n - 2]));
    }
    cout << ans << endl;
    return 0;
}

Bint comb(Bint a, Bint b) {
    Bint ans = 1;

    if (a < b) {
        return 0;
    }

    rep(i, b) {
        ans *= a - i;
        ans /= i + 1;
    }

    return ans;
}

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

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

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

void prime_map(map<ll, ll> &m, ll num) {

    if (num == 1) {
        return;
    }
    ll cache = num;
    repd(i, 2, sqrt(num) + 2) {
        if (num % i == 0) {
            if (m[i] == 0) {
                m[i] = 1;
            } else {
                m[i]++;
            }

            num /= i;
            break;
        }
    }
    if (cache == num) {
        if (m[num] == 0) {
            m[num] = 1;
        } else {
            m[num]++;
        }

        return;
    }
    prime_map(m, num);
    return;
}


Measured memory_bytes: 256
count e l = h e l 0
            where h e [] n = n
                  h e (car:cdr) n = if e == car then h e cdr (n+1) else h e cdr n

solve :: String -> [Int]
solve w = do c <- w
             return (count c w)

getAns :: [Int] -> String
getAns [] = "Yes"
getAns (e:es) = if even e then getAns es else "No"

main = do
  w <- getLine
  putStrLn $ getAns $ solve w


Measured memory_bytes: 508
#include<stdio.h>
#include<string.h>
#define ran 1001
#define ROOT 1
#define FREE 0
int n,z;
class Trie
{
public:
	int a[11],suff,fath,ch;
	int A, B, TA, TB;
	bool danger;
} trie[333333];
int op[333333],st,cl;

int tmp[22],len;
void ins(){
	int p=1;
	for(int j=0; j<len; j++)
	{
		int x=tmp[j];
		if(trie[p].a[x]==FREE)
		{
			z++;
			trie[p].a[x]=z;
			trie[z].fath=p;
			trie[z].ch=x;
			memset(trie[z].a,0,sizeof(trie[z].a));
			trie[z].danger=false;
		}
		p=trie[p].a[x];
	}
	if(!trie[p].danger){
		trie[p].danger=true;
	}
}

void dfs(int X,int Y,int Z){
	if(X){
		for(int i=1; i<=X; i++){
			tmp[len++]=i;
			dfs(X-i,Y,Z);
			len--;
		}
	}else
	if(Y){
		for(int i=1; i<=Y; i++){
			tmp[len++]=i;
			dfs(X,Y-i,Z);
			len--;
		}
	}else
	if(Z){
		for(int i=1; i<=Z; i++){
			tmp[len++]=i;
			dfs(X,Y,Z-i);
			len--;
		}
	}else
		ins();
}

#define mod 1000000007
int add(int x,int y){
	return (x+=y)<mod?x:x-mod;
}
void addto(int&x,int y){
	x+=y;
	if(x>=mod)x-=mod;
}

int main()
{
	int N,X,Y,Z;
	scanf("%d%d%d%d",&N,&X,&Y,&Z);
	//read data sets and build trie tree
	z=1;
	memset(trie[ROOT].a,0,sizeof(trie[ROOT].a));
	trie[ROOT].danger=false,trie[ROOT].suff=1,trie[ROOT].fath=1;
	len=0;
	dfs(X,Y,Z);
	//bfs and build trie graph
	op[0]=1;
	for(st=1,cl=0; st>cl; cl++)
	{
		int x=op[cl];
		if(trie[x].fath==1)
			trie[x].suff=1;
		else
			trie[x].suff=trie[trie[trie[x].fath].suff].a[trie[x].ch];
		if(trie[trie[x].suff].danger)
			trie[x].danger=true;
		for(int i=1; i<=10; i++)
			if(trie[x].a[i]!=FREE)
				op[st++]=trie[x].a[i];  
			else if(x==1)
				trie[x].a[i]=1;
			else 
				trie[x].a[i]=trie[trie[x].suff].a[i];
	}

	trie[1].A = 1;
	for(int i=0; i<N; i++){
		for(int p=1; p<=z; p++){
			for(int j=1; j<=10; j++){
				int son = trie[p].a[j];
				addto(trie[son].TA, trie[p].A);
				addto(trie[son].TB, trie[p].B);
			}
		}
		for(int p=1; p<=z; p++){
			if(trie[p].danger){
				trie[p].A = 0;
				trie[p].B = add(trie[p].TA, trie[p].TB);
			}else{
				trie[p].A = trie[p].TA;
				trie[p].B = trie[p].TB;
			}
			trie[p].TA = trie[p].TB = 0;
		}
	}
	int res = 0;
	for(int p=1; p<=z; p++)
		addto(res, trie[p].B);
	printf("%d\n",res);
	return 0;
}

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

int main() {
  int n,a,b,count;
  count = 0;
  b = 10000;
  cin >> n;
  rep(i,n) {
    cin >> a;
    count = 0;
    while(a%2 == 0) {
      a /= 2;
      count++;
  	}
    if(count < b){
      b = count;
    }
  }
  cout << b << endl;
}

Measured memory_bytes: 256
package main
import (
  "bufio"
  "fmt"
  "os"
)
func main() {
  var n int64 = 1
  var powoften bool = true
  for l:=1;l<11;l++ {
    if !query(n) {
      powoften = false
      n /= 10
      break
    }
    n *= 10
  }
  if powoften {
    n = 2
    for l:=1;l<11;l++ {
      if query(n) {
        fmt.Println("!",n/2)
        os.Exit(0)
      }
      n *= 10
    }
  }
  var min,max int64 = n, 10*n-1
  for max-min > 1 {
    n = (max+min)/2
    if query(10*n) {
      max = n
    } else {
      min = n
    }
  }
  fmt.Println("!",max)
}
var w = bufio.NewWriter(os.Stdout)
func query(n int64) bool {
  var c string
  fmt.Fprintln(w,"?",n)
  _ = w.Flush()
  fmt.Scan(&c)
  return c == "Y"
}

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

int numDigits(int x) {
    int res = 0;
    while (x) {
        res++;
        x /= 10;
    }
    return res;
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int N; cin >> N;
    int ans = 0;
    for (int i = 1; i <= N; i++) {
        if (numDigits(i) % 2 == 1) ans++;
    }
    cout << ans << '\n';
}



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

int main() {
    
    int n;
    cin >> n;
    map<std::string, int>s;

    for (auto i = 0; i < n; i++) {

        string tmp;
        cin >> tmp;

        try {
            s.at(tmp)++;
        }
        catch(out_of_range) {
            s.insert(make_pair(tmp, 1));
        }
    }


    auto mx = 0;

    for (auto itr = s.begin(); itr != s.end(); itr++) {
        mx = max(itr->second, mx);
    }

    for (auto itr = s.begin(); itr != s.end(); itr++) {
        if (itr->second == mx) cout << itr->first << endl;
    }


}

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

using namespace std;
typedef long long ll;

int main()
{
    int N;
    ll a, b, x, ans=0;
    cin >> N >> x;
    cin >> a;
    for(int i=0;i<N-1;++i){
        cin >> b;
        if(a+b > x){
            ans += a + b - x;
            if(b >= a + b - x)
                a = x - a;
            else{
                a = 0;
            }
        }
        else{
            a = b;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <vector>
#include <string>
#include <iostream>
#include <queue>
#include <climits>
#include <cfloat>
#include <algorithm>
using namespace std;

class Bit
{
	int n;
	vector<long long> data;
public:
	Bit(int n){
		this->n = n;
		data.assign(n+1, 0);
	}
	void add(int k, long long x){
		++ k;
		while(k <= n){
			data[k] += x;
			k += k & -k;
		}
	}
	long long sum(int k){
		++ k;
		long long ret = 0;
		while(k > 0){
			ret += data[k];
			k -= k & -k;
		}
		return ret;
	}
	long long sum(int a, int b){
		if(b < a)
			return 0;
		return sum(b) - sum(a-1);
	}
};

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

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

	vector<int> p(m);
	for(int i=0; i<m; ++i)
		cin >> p[i];
	sort(p.begin(), p.end());

	Bit pb(m+1);
	for(int i=0; i<m; ++i){
		if(i % 2 == 0)
			pb.add(i, p[i]);
		else
			pb.add(i, -p[i]);
	}

    long long ret = 0;
	for(int i=0; i<n; ++i){
		int a = lower_bound(p.begin(), p.end(), s[i]) - p.begin();
		int b = lower_bound(p.begin(), p.end(), t[i]) - p.begin();
		if(s[i] < t[i]){
			-- b;
			if((b - a + 1) % 2 == 1){
				t[i] = p[b];
				-- b;
			}
			if(a % 2 == 0){
				ret += t[i] - s[i] + pb.sum(a, b);
			}else{
				ret += t[i] - s[i] - pb.sum(a, b);
			}
		}else{
			swap(a, b);
			-- b;
			if((b - a + 1) % 2 == 1){
				t[i] = p[a];
				++ a;
			}
			if(b % 2 == 0){
				ret += s[i] - t[i] - pb.sum(a, b);
			}else{
				ret += s[i] - t[i] + pb.sum(a, b);
			}
		}
	}

	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 2824
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int h = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		double s = ((double)w*(double)h)/2;
		if (w%2==0&&h%2==0) {
			if (w/2==x&&y==h/2) {
				System.out.println(s+" "+1);
			} else {
				System.out.println(s+" "+0);
			}
		} else {
			System.out.println(s+" "+0);
		}
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <math.h>
using namespace std;

int main () {
    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-->0) {
        int sum = C;
        int X;
        for (int i=0; i<M; i++) {
            cin >> X;
            sum += X*B[i];
        }
        
        if (sum>0) ans++;
        
    }
    
    cout << ans;
    
    return 0;
}


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


int main (){
    int H, W, M;
    cin >> H >> W >> M;
    //vector<vector<bool> > m(H,vector<bool>(W,0));//爆破対象のある座標を
    map<pair<int, int>, bool> m;
    pair<int, int> temppair;
    vector<int> hx(H,0);//ｈ座標にある爆破対象の個数を
    vector<int> wy(W,0);//ｗ座標にある爆破対象の個数を
    int h, w;//一時的に置く場所
    for(int i = 0; i < M; i++) {
        cin >> h >> w;
        //m.at(h - 1).at(w - 1) = 1;//それぞれ，0から初め一個少なく終わる
        temppair = make_pair(h - 1,w - 1);
        m[temppair] = 1;
        hx.at(h - 1)++;//任意のH座標にある爆破対象数え上げる
        wy.at(w - 1)++;//任意のW座標にある爆破対象数え上げる
    }
    int hh = 0;
    int ww = 0;
    hh = *max_element(hx.begin(), hx.end());//同じ行にある爆破対象の最大個を
    ww = *max_element(wy.begin(), wy.end());//同じ列にある爆破対象の最大個を
    
    //cout << h + w << endl;
    vector<int> hl;//最大個数の爆破対象を持つ行をリストアップ
    int hln = 0;
    vector<int> wl;//最大個数の爆破対象を持つ列をリストアップ
    int wln = 0;
    for(int i = 0; i < H; i++) {
        if(hh == hx.at(i)) {
            hl.push_back(i);
            //cout << i << endl;
        }
    }
    for(int i = 0; i < W; i++) {
        if(ww == wy.at(i)) {
            wl.push_back(i);
            //cout << i << endl;
        }
    }
    int ans = hh + ww;//交差地点，つまり爆破する地点に爆破対象がある場合を考慮せず，とりあえず最大の爆破個数を答えとする

    hln = hl.size();//最大個数の爆破対象を持つ行の個数を
    wln = wl.size();//最大個数の爆破対象を持つ列の個数を


    for(int h = 0; h < hln; h++) {
        for(int w = 0; w < wln; w++) {
            //if(!m.at(hl.at(h)).at(wl.at(w))) {
            temppair = make_pair(hl.at(h),wl.at(w));
            if(!m.count(temppair)) {
                cout << ans << endl;//交差地点，つまり爆破スべき地点に爆破対象がない場合を見つけ出す
                return 0;
            }
        }
    }
    cout << ans - 1 << endl;//交差地点に爆破対象がない場合を見つけられない買ったため，重複して数えられた部分を減算する    
}

Measured memory_bytes: 28476
def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    """
    1...n

    1 - 1+d
    2 - 2+d
    .......
    n-d   n

    (n-d)*2*n^(m-2)*(m-1)
    /               
    n^m


    (n-d)*2*(m-1)
    /
    n^2
    """
    n, m, d = read_ints()
    if d == 0:
        return (n-d)*(m-1)/(n*n)
    return (n-d)*2*(m-1)/(n*n)


if __name__ == '__main__':
    print(solve())


Measured memory_bytes: 61452
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric> // accumulate(v.begin(), v.end(), 0)

using namespace std;
#define ll long long

int main(){
  int N;
  cin >> N;
  vector<ll> A(N);
  vector<ll> B(N);
  vector<ll> D;
  int ans = 0;
  ll minus = 0;
  ll sumA = 0;
  ll sumB = 0;
  for(int i=0; i<N; i++) {
    cin >> A[i];
    sumA += A[i];
  }
  for(int i=0; i<N; i++) {
    cin >> B[i];
    sumB += B[i];
    if(A[i] < B[i]) {
      ans++;
      minus += B[i] - A[i];
    } else if(A[i] > B[i]) {
      D.push_back(A[i] - B[i]);
    }
  }
  if(sumA < sumB) {
    cout << -1 << endl;
  } else {
    sort(D.begin(), D.end(), greater<ll>());
    int i = 0;
    while(minus > 0) {
      ans++;
      minus -= D[i];
      i++;
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 2428
X,Y=map(int,input().split())
#a,bをかめとつるの数とする、これはそんなに量多くないので行ける
for a in range(X+2):
    if a==X+1:
        print("No")
    elif (Y-4*a)%2==0 and int((Y-4*a)/2)==X-a:
        print("Yes")
        break
    else:
        continue

Measured memory_bytes: 61612
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        
        Scanner sc = new Scanner(System.in);
        
        while(true){
            int x = sc.nextInt();
            int y = sc.nextInt();
            
            if(x == 0 && y == 0) break;
            
            if(x > y){
                System.out.println(y + " " + x);
            }else{
                System.out.println(x + " " + y);
            }
        }
        
    }
}


Measured memory_bytes: 34564
n,k=gets.chomp.split(" ").map(&:to_i)
r,s,p=gets.chomp.split(" ").map(&:to_i)
t = gets.chomp

arr = Array.new(k).map{Array.new}
ans = 0
for i in 0..k-1
  j = i
  str = ""
  while j < n
    if str != t[j]
      if t[j] == "r"
        ans += p
      elsif t[j] == "s"
        ans += r
      else
        ans += s
      end
    end
    str = (str == t[j]) ? "" : t[j]
    j += k
  end
end

p ans

Measured memory_bytes: 10108
#!/usr/bin/env python3
import sys


def solve(N: int, W: int, w: "List[int]", v: "List[int]"):
    INF = 10**10
    VMAX=10**3*N
    dp=[[INF for j in range(VMAX+1)] for i in range(N+1)]
    dp[0][0] = 0
    for i in range(1,N+1):
        for j in range(VMAX+1):
            if j-v[i-1] >=0:
                dp[i][j] = min(dp[i-1][j],dp[i-1][j-v[i-1]]+w[i-1])
            else:
                dp[i][j] = dp[i-1][j]

    for i in range(VMAX,-1,-1):
        if dp[-1][i] <= W:
            print(i)
            break
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    w = [int()] * (N)  # type: "List[int]"
    v = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        w[i] = int(next(tokens))
        v[i] = int(next(tokens))
    solve(N, W, w, v)

if __name__ == '__main__':
    main()


Measured memory_bytes: 171120
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll n;
  cin >> n;
  for(int i = 1;i < 10;i++){
    for(int j = 1;j < 10;j++){
    if(i * j == n){
      cout << "Yes" << endl;
      return 0;
    }
  }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
int main(){
    int a,b;
    cin >> a >> b;
    if(a <= b) cout << a << endl;
    else cout << a-1 << endl;
    
    return 0;
}

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

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

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


void solve(long long K){
    string s = "";
    for(int i = 0 ; i < K ; i++){
        s += "ACL";
    }
    cout << s << endl;
}

int main(){
    long long K;
    scanf("%lld",&K);
    solve(K);
    return 0;
}



Measured memory_bytes: 3696
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<tuple>
#include<cmath>

#define MOD 1000000007
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back

typedef long long ll;

using namespace std;

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

int cal(int a){
    bool ans=true;
    rep(i,2,int(sqrt(a))){
        if(a%i == 0)ans=false;
    }
    return ans;
}

int main(){
    int X;
    cin>>X;
    while(true){
        if(cal(X)){
            break;
        }
        else X++;
    }

    cout<<X;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <iterator>
#include <utility>
#include <iomanip>
#include <stack>
#include<bitset>
#include <cmath>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
priority_queue<pair<ll,ll>,vector<pair<ll,ll> >,greater<pair<ll,ll> > >pq;
ll expo(ll b,ll n,ll m)
{
 ll r,p;
	p=1;
	 b=b%m;
	while(n>0)
	{ 
		r=n%2;
		if(r==1)
		   p=((p)*(b))%m;
		b=((b)*(b))%m; 
		n=n/2;		
	}
 return (p%m);
}
ll divide1(ll a,ll b,ll m)
	{ ll r,p,n;
			p=a%m;
				n=m-2;
				while(n>0){
						 r=n%2;
						if(r==1)
							p=((p%m)*(b%m))%m;
						b=((b%m)*(b%m))%m; 
						n=n/2;	
					}
	return (p%m); }
int main(int argc, char const *argv[])
{	ios_base::sync_with_stdio(false);
	cin.tie(NULL),cout.tie(NULL);
	ll n,x,t;
	cin>>n>>x>>t;
	cout<<(n/x)*t+(n%x>0)*t<<endl;
	return 0;
}


Measured memory_bytes: 3652
require 'set'

N = gets.to_i
S = gets.chomp.chars.map(&:to_i)

idx = Array.new(10) { [] }
S.each.with_index do |ch, i|
  idx[ch].push(i)
end

ans = 0
(0..999).each do |n|
  i = -1
  is_ok = n.to_s.rjust(3, '0').chars.all? do |ch|
    i = idx[ch.to_i].bsearch do |x|
      x > i
    end
    i != nil
  end
  ans += 1 if is_ok
end
puts ans

Measured memory_bytes: 4348
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;
typedef long long LL;

int main(){
  int X;
  cin >> X;
  int ans=1;
  for(int N=2; N<=X; N++){
    for(int i=2; i*i<=N; i++){
      int Nc=N;
      while(Nc%i==0) Nc/=i;
      if(Nc==1) ans=N;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
n = int(input())

li = [[0, 0, 0]]
for i in range(n):
    array = list(map(int, input().split()))
    li.append(array)

for i in range(n):
    period = li[i+1][0] - li[i][0]
    dist = abs(li[i+1][1] - li[i][1]) + abs(li[i+1][2] - li[i][2])
    if period % 2 == 0 and dist % 2 == 0 and period >= dist:
        continue
    elif period % 2 != 0 and dist % 2 != 0 and period >= dist:
        continue
    else:
        print('No')
        exit()

print('Yes')

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;
typedef long double ld;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

ll modpower(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

ll modinv(ll a, ll mod) {
    return modpower(a, mod - 2, mod);
}

ll largeCOM(ll n, ll r, ll mod) {
    ll u = 1, d = 1;
    rep (i, r) {
        u = (u * (n - i)) % mod;
        d = (d * (r - i)) % mod;
    }
    return u * modinv(d, mod) % mod;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int n;
    cin >> n;
    vector<ll> a(n), b(n), cnt(n + 1);
    rep (i, n) {
        cin >> a[i];
        cnt[a[i]]++;
    }
    ll res = 0;
    rep (i, n + 1) {
        res += (cnt[i] * (cnt[i] - 1) / 2);
    }
    rep (i, n) {
        ll t = cnt[a[i]] * (cnt[a[i]] - 1) / 2;
        ll u = (cnt[a[i]] - 1) * (cnt[a[i]] - 2) / 2; 
        cout << res - t + u << endl;
    }
    
    return 0;
}



Measured memory_bytes: 7296
#include<stdio.h>
int main(void){
	int i=0;
	int x[10000];
	for (i = 0; i <= 10000; i++){
		scanf("%d", &x[i]);
		if (x[i] == 0){
			break;
		}
	}
	for (i = 0; i <= 10000; i++){
		if (x[i] == 0){
			break;
		}
		printf("Case %d: %d\n", i + 1, x[i]);
		
	}
	return 0;
}

Measured memory_bytes: 2696
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
constexpr double eps=1e-8;
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int Random(int mi,int ma){
    random_device rnd;
    mt19937 mt(rnd());//32bit
    //[mi,ma]
    uniform_int_distribution<int>engine(mi,ma);
    return engine(mt);
}
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
vector<int>kaijo,invkaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    invkaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
    rep(i,n+1)invkaijo[i]=modpow(kaijo[i],mod-2);
}
int comb(int a,int b){
    if(a<b)return 0;
    if(a<0||b<0)return 0;
    return kaijo[a]*invkaijo[a-b]%mod*invkaijo[b]%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}

signed main(){
    cin.tie(0);ios::sync_with_stdio(false);
    string s,t;
    cin>>s>>t;
    int ans=0;
    rep(i,s.size()){
        if(s[i]!=t[i])ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3800
#include <iomanip>
#include <string>
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
int main()
{
	long long int a, b, c, d[2000] = {}, maxa = 0;
	cin >> a >> b >> c;
	long long int yan, yojo;
	for (int i = 0; i < a; i ++) {
		cin >> d[i];
	}
	if (a == 1) {
		a=d[0] - c;
		if (a < 0) {
			a = -a;
		}
		cout << a << endl;
		return 0;
	}
	yan = d[a - 2] - d[a - 1];
	if (yan < 0) {
		yan = -yan;
	}
	yojo = d[a - 1] - c;
	if (yojo < 0) {
		yojo = -yojo;
	}
	if (yan > yojo) {
		yojo = yan;
	}
	cout << yojo << endl;
	return 0;
}	

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
#include<algorithm>
#include<functional>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cout << VEC[i] << " ";
  }
  cout << "\n";
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i, MAT.size()){
    REP(j, MAT[i].size()){
      cout << MAT[i][j] << " ";
    }
    cout << "\n";
  }
};

template <typename CLASS1, typename CLASS2>
class HOGE{
  public:
    CLASS1 key;
    CLASS2 value;
    HOGE(void){
      return;
    };
    HOGE(CLASS1 key, CLASS2 value){
      this->key = key;
      this->value = value;
    };
    ~HOGE(void){
      return;
    };

    void print(void){
      cout << "key : " << key << ", value : " << value << "\n";
      return;
    };
    
    bool operator==(const HOGE &obj){
      return (this->value == obj.value);
    };
    bool operator<(const HOGE &obj){
      return (this->value < obj.value);
    };
    bool operator>(const HOGE &obj){
      return (this->value > obj.value);
    };
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll N;
  cin >> N;
  double coef = 380000.0;
  double ans = 0;
  REP(i, N){
    double x;
    string u;
    cin >> x >> u;
    if(u=="JPY"){
      ans += x;
    }else{
      ans += x*coef;
    }
  }

  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 256
n = int(input())
S = [int(x) for x in input().split()]

q = int(input())
T = [int(x) for x in input().split()]

ans = 0
for i in range(q):
    find = 0
    for j in range(n):
        if S[j] == T[i]:
            find = 1
    ans = ans + find
print(ans)



Measured memory_bytes: 6556
#include<stdio.h>
#include<algorithm>

using namespace std;

int main(void)
{
	int a,b,k; scanf("%d %d %d",&a,&b,&k);
	int p=0;
	while(k--)
	{
		if(p%2==0)
		{
			b += a/2;
			a/=2;
		}
		else
		{
			a+=b/2;
			b/=2;
		}
		p++;
	}
	printf("%d %d",a,b);
	return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define MAXN 100005
#define MAXK 105
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n,k,h[MAXN];
int dp[MAXN];
int main()
{
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++) scanf("%d",&h[i]);
    dp[1]=0;
    for(int i=2;i<=n;i++)
    {
        dp[i]=INF;
        for(int j=1;j<=k;j++)
        {
            if(j>=i) break;
            dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
        }
    }
    printf("%d\n",dp[n]);
    return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;
bool prime[1002];
int main(){
    memset(prime, 1, sizeof(prime));
    int n, ans = 1;
    scanf("%d", &n);
    for(int i=2;i<=n;i++){
        if(!prime[i]) continue;
        for(int j=i+i;j<=n;j+=i) prime[j] = 0;
        int cnt = 0;
        for(int j=i;j<=n;j*=i) cnt += n/j;
        ans = (ans*1ll*(cnt+1))%mod;
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define INF 999999999
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using llong = long long;
using namespace std;

int main(){
    llong n;
    cin >> n;
    n -= (n/100)*100;
    n -= (n/10)*10;
    if(n == 3) cout << "bon" << endl;
    else if(n == 0 || n == 1) cout << "pon" << endl;
    else if(n == 6 || n == 8) cout << "pon" << endl;
    else cout << "hon" << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
long long dp[105][100005];
int main()
{
  int n,m;
  cin>>n>>m;
  vector<pair<int,int>>a;
  for(int i=0;i<n;i++)
  {
    int u,v;
    cin>>u>>v;
    a.push_back(make_pair(u,v));
  }
  sort(a.begin(),a.end());
  for(int i=1;i<=n;i++)
  {
    for(int j=1;j<=m;j++)
    {
        if(j>=a[i-1].first){
        long long x=dp[i-1][j-a[i-1].first]+a[i-1].second;
        long long y=dp[i-1][j];
        dp[i][j]=max(x,y);}
        else dp[i][j]=dp[i-1][j];
    }
  }

  cout<<dp[n][m];
}


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

using namespace std;

string s;

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

    cin >> s;

    int l = s.length(), r = 0;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] == 'A') {
            l = min(l, i);
        }

        if (s[i] == 'Z') {
            r = max(r, i);
        }
    }

    cout << r - l + 1 << endl;

    return 0;
}


Measured memory_bytes: 720
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

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


int main(){
    
    ll n;
    cin >> n;
    ll ans = 0;
  
    for(ll i = 1; i < sqrt(n);i++){
	//PS(i);PS(n/i);P(n%i);

	if(n%i == 0 && n/i-1 > i)ans += n/i - 1;
    }


    P(ans);
    return  0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int k = scan.nextInt();
		List<Integer> list1 = new ArrayList<>();
		//List<Integer> list2 = new ArrayList<>();
		for(int i=a;i<=b;i++) {
			if(i<=a+k-1) {
				list1.add(i);
			}else {
				break;
			}
		}
		for(int i=b;i>=a;i--) {
			if(i>=b-k+1) {
				list1.add(i);
			}else {
				break;
			}
		}
		//System.out.println(list1);

		List<Integer> list2 = new ArrayList<>(new HashSet<>(list1));
		Collections.sort(list2);
		//System.out.println(list2);
		for(int i : list2) {
			System.out.println(i);
		}


	}

}


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

const int N = 1e5+7;
long long av[N];
const long long INF = 1e18;
long long a[N], mn[N], take[N];

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

    av[0] = 1;
    for (int i=1; i<N; i++) {
        av[i] = (av[i-1] + av[i-1]);
        if (av[i] >= INF)       av[i] = INF;
    }

    int n;
    cin>>n;

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

    long long ans = 0, sum = 0;
    for (int i=n; i>=0; i--) {
        mn[i] = a[i] + (mn[i+1]+1)/2;
        sum += a[i];
        if (mn[i] > av[i]) {
            cout<<-1<<endl;
            return 0;
        }
    }

    long long faka = 1;
    for (int i=0; i<=n; i++) {
        ans += min(faka, sum);
        sum -= a[i];
        faka -= a[i];
        faka = min(faka*2, INF);
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 5964
#include <algorithm>
#include <string.h>
#include <iostream>
#include <stdio.h>

using namespace std;

int main() {
	int n;
	cin >> n;
	int tot = n / 500;
	n -= 500 * tot;
	tot = tot * 1000;
	tot += n / 5 * 5;
	cout << tot << endl;
	return 0;
}

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

int main() {
  string S;
  cin >> S;
  int change_num=0;
  for (int i=0;i<S.size()-1;i++){
    if (S.at(i)==S.at(i+1)){
      if(S.at(i)=='0'){
        S.at(i+1)='1';
      } else {
        S.at(i+1)='0';
      }
      change_num++;
      continue;
    }
  }
  
  cout << change_num << endl;
}


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

#define rep3(i, s, n ,a) for (int i = (s); i < (int)(n); i+=a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

int solve(int now_h, int now_w, int** board, int step);

int h, w;

int main(){
    int answer=-1;
    cin >> h >> w;
    char **s = new char*[h];
    int **state = new int*[h];
    rep(i, h){
        s[i] = new char[w];
        state[i] = new int[w];
    }
    rep(i, h){
        rep(j, w){
            cin >> s[i][j];
            if(s[i][j]=='.'){
                state[i][j] = 0;
            }else{
                state[i][j] = -1;
            }
        }
    }

    rep(i, h){  //START指定
        rep(j, w){
            if(s[i][j]=='.'){
                answer = max(answer, solve(i, j, state, 1));
                rep(k, h){
                    rep(l, w){
                        // cout << state[k][l] << " ";
                        if(state[k][l]!=-1){
                            state[k][l] = 0;
                        }
                    }
                    // cout << endl;
                }
            }
            // cout << answer << endl;
        }
        // cout << endl;
    }

    cout << answer << endl;
    return 0;
}

//now_h, now_wからの最大移動回数 - 1
int solve(int now_h, int now_w, int** board, int step){    
    
    int max_step = step, flag=1;
    int cnt = 1;
    pair<int, int> place;
    queue<pair<int, int>> Q;
    queue<int> cnt_q;
    Q.push(make_pair(now_h, now_w));
    cnt_q.push(cnt+1);
    board[now_h][now_w] = step;

    //移動(右, 上, 左, 下の順)
    while(flag||!Q.empty()){
        cnt = cnt_q.front();
        cnt_q.pop();
        place = Q.front();
        Q.pop();

        now_h = place.first;
        now_w = place.second;

        // cout << now_h << " " << now_w << endl;

        flag = 0;
        //if(board[now_h][now_w]!=0&&!Q.empty()) continue;

        if(now_w!=w-1&&board[now_h][now_w+1]==0){
            //max_step = max(max_step, solve(now_h, now_w+1, board, step+1));
            board[now_h][now_w+1] = cnt;
            Q.push(make_pair(now_h, now_w+1));
            cnt_q.push(cnt+1);
            flag = 1;
        }
        if(now_h!=0&&board[now_h-1][now_w]==0){
            //max_step = max(max_step, solve(now_h-1, now_w, board, step+1));
            board[now_h-1][now_w] = cnt;
            Q.push(make_pair(now_h-1, now_w));
            cnt_q.push(cnt+1);
            flag = 1;
        }
        if(now_w!=0&&board[now_h][now_w-1]==0){
            //max_step = max(max_step, solve(now_h, now_w-1, board, step+1));
            board[now_h][now_w-1] = cnt;
            Q.push(make_pair(now_h, now_w-1));
            cnt_q.push(cnt+1);
            flag = 1;
        }
        if(now_h!=h-1&&board[now_h+1][now_w]==0){
            //max_step = max(max_step, solve(now_h+1, now_w, board, step+1));
            board[now_h+1][now_w] = cnt;
            Q.push(make_pair(now_h+1, now_w));
            cnt_q.push(cnt+1);
            flag = 1;
        }

        cnt++;
    }
    

    return cnt - 3;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <ctype.h>
#include <stdlib.h>
using namespace std;

int main()
{
    int N;
    cin >> N;
    string S;
    cin >> S;


    for (int i = 0; i < S.length(); i++)
    {
        /* code */
        S[i] += N;
        if(S[i] > 90){
            S[i] -= 26;
        }
    }
    cout << S << endl;
}


Measured memory_bytes: 384