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

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

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

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	string s;
	cin>>s;
	ll ans=0;
	int n=s.size();
	rep(i,1<<(n-1)){
		vector<int> ind;
		rep(j,n-1){
			if(i & 1<<j){
				ind.push_back(j);
			}
		}
		ind.push_back(n-1);
		string now="";
		rep(j,n){
			now+=s[j];
			rep(k,ind.size()){
				if(ind[k]==j){
					ans+=stoll(now);
					now="";
				}
			}
		}
	}
	cout<<ans<<endl;
}

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

using namespace std;
using ll = long long;

#pragma GCC optimize("O3")
static const auto __ = [] {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  return nullptr;
}();

int solve(int N, int M, int C) {
  int B[M];
  for (int& b : B) {
    cin >> b;
  }
  int ans {0};
  for (int i {0}; i < N; ++i) {
    int sum {C};
    for (int j {0}; j < M; ++j) {
      int a;
      cin >> a;
      sum += a * B[j];
    }
    ans += (sum > 0);
  }
  return ans;
}

int main(int argc, char* argv[]) {
  int N, M, C;
  cin >> N >> M >> C;
  cout << solve(N, M, C) << '\n';
  return 0;
}

Measured memory_bytes: 256
/*
Code By: Sai Harsha K
 */

#include <bits/stdc++.h>
using namespace std;
#define lli long long int

int main() {
#ifndef ONLINE_JUDGE
  // these lines to be executed in local machine not online judge
  // get input
  freopen("input.txt", "r", stdin);
  // put output
  freopen("output.txt", "w", stdout);
#endif
  ios_base::sync_with_stdio(false); cin.tie(NULL);

  // solution
  int t = 1;
  while(t--) {
    int n, W;
    cin>>n>>W;
    int w[n], v[n];
    for(int i = 0; i < n; i++) {
      cin>>w[i]>>v[i];
    }
    int sum_value = 0; // max 1e5 so int is fine
    for(int i = 0; i < n; i++) {
      sum_value += v[i];
    }
    lli INF = 1e12+5;
    // Here, in constraints, N bound is lower so we use N.
    vector<lli> dp(sum_value+1, INF); // dp[i] is exactly i value total, min number of weights reqd
    dp[0] = 0;
    // populate dp
    for(int i = 0; i < n; i++) {
      // consider some x value is already present in knapsack
      for(int value_already = sum_value-v[i]; value_already >= 0; value_already--) { // we can take item only once
        dp[value_already + v[i]] = min(dp[value_already + v[i]], dp[value_already] + w[i]);
      }
    }
    // now find the max val we can carry
    int answer = 0;
    for(int i = 1; i < sum_value+1; i++) {
      if(dp[i] <= W) {
        answer = max(answer, i);
      }
    }
    cout<<answer;
  }

  return 0;
}


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

namespace ABC080A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n, a, b, x;

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

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


			if (n * a <= b)
				x = n * a;
			else
				x = b;
           
             

            Console.WriteLine(x);
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 13268
#include <stdio.h>
#define INF 1000000000

void matrixchain();

int len,r[101],F[101][101];

int main(){
  int i,j=0;
  
  scanf("%d",&len);

  for(i = 0; i < len; i++){
    scanf("%d %d",&r[i],&r[i+1]);
  }

  matrixchain();

  printf("%d\n",F[1][len]);
  
  return 0;
}

void matrixchain(){
  int n,i,j,k,l,q;

  n = len;
  for(i = 1; i <= n; i++){
    F[i][i] = 0;
  }
  for(l = 2; l <= n; l++){
    for(i = 1; i <= n-l+1;i++){
      j = i+l-1;
      F[i][j] = INF;
      for(k = i; k <= j-1; k++){
	q = F[i][k] + F[k+1][j] + r[i-1]*r[k]*r[j];
	if(F[i][j] > q) F[i][j] = q;
	else F[i][j] = F[i][j];
      }
    }
  }
}
       

Measured memory_bytes: 636
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<set>
#include<map>
#include<queue>
using namespace std;
typedef long long LL;
#define sqr(x) ((x)*(x))
#define mp make_pair
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){
	int x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(int a){
	write(a); puts("");
}
const int N=2005;
int n,m,q;
char ch[N][N];
struct BIT{
	int sum[N][N];
	void change(int x,int y){
		sum[x][y]++;
	}
	void init(){
		for(int i=1;i<=n;i++){
			for(int j=1;j<=m;j++){
				sum[i][j]+=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1];
			}
		}
	}
	int ask(int a,int b,int c,int d){
		a--; b--;
		return sum[c][d]-sum[a][d]-sum[c][b]+sum[a][b];
	}
}T[3];
int main(){
	n=read(); m=read(); q=read();
	for(int i=1;i<=n;i++)scanf("%s",ch[i]+1);
	for(int i=1;i<=n;i++)for(int j=1;j<=m;j++)if(ch[i][j]=='1'){
		if(ch[i+1][j]=='1')T[0].change(i,j);
		if(ch[i][j+1]=='1')T[1].change(i,j);
		T[2].change(i,j);
	}
	T[0].init(); T[1].init(); T[2].init();
	for(int i=1;i<=q;i++){
		int x1=read(),y1=read(),x2=read(),y2=read();
		writeln(T[2].ask(x1,y1,x2,y2)-T[0].ask(x1,y1,x2-1,y2)-T[1].ask(x1,y1,x2,y2-1));
	}
}


Measured memory_bytes: 52864
class bit:
  def __init__(self, n):
    self.size = n
    self.bit = [0] * (n + 1)
  
  def make(self, lst):
    self.bit = [0] + lst[:]
    for i in range(1, self.size + 1):
      if i + (i & -i) > self.size:
        continue
      self.bit[i + (i & -i)] += self.bit[i]
  
  def add(self, a, b):
    i = a + 1
    while i <= self.size:
      self.bit[i] += b
      i += i & -i
  
  def sum(self, a):
    i = a
    ret = 0
    while i > 0:
      ret += self.bit[i]
      i -= i & -i
    return ret
  
  def sub(self, a, b):
    return self.sum(b) - self.sum(a)

n, q = map(int, input().split())
lst = [int(i) for i in input().split()]
l = bit(n)
l.make(lst)
for _ in range(q):
  t, a, b = map(int, input().split())
  if t == 0:
    l.add(a, b)
  else:
    print(l.sub(a, b))

Measured memory_bytes: 65112
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <ctime>
#define INF 2000000000
#define LINF 9000000000000000000
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=(n);i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

bool debug=false;
/*---------------------------------------------------*/

int main(){
  string s;
  cin>>s;
  for(int i=0;i<int(s.size())-1;){
    if(s[i]=='S'&&s[i+1]=='T'){
      s.erase(s.begin()+i,s.begin()+i+2);
      i=max(0,i-1);
    }else{
      i++;
    }
    //cout<<i<<" "<<s<<endl;
  }
  cout<<s.size()<<endl;
  return 0;
}


Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
const int INF = 1 << 30;
const ll INFll = 1ll << 60;

int main() {
  string s;
  getline(cin, s);
  cout << 'A' << s.at(8) << "C" << endl;

  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		int period = Integer.parseInt(new BufferedReader(new InputStreamReader(System.in),32).readLine());
		int val = 100;//壱百千円
		double exactVal;
		for (; 0 < period; period--) {
			exactVal = val * 1.05;
			val = (int) (exactVal - (int) exactVal > 0 ? exactVal + 1 : exactVal);
		}
		System.out.println(val * 1000);
	}
}

Measured memory_bytes: 16844
N = int(input())
K = 2
import numpy as np
hights=np.array(list(map(int,input().split())))
steps=np.array([10**10]*N)
steps[0]=0
for i in range(N-1):
    gaps=hights[i+1:i+K+1]-hights[i]
    gaps=np.abs(gaps)
    gaps+=steps[i]
    steps[i+1:i+K+1]=np.minimum(steps[i+1:i+K+1],gaps)
print(steps[-1])

Measured memory_bytes: 23064
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;

int main(){
	string s;
	while(cin >> s){
		if(s.size()%2!=0) {
			printf("NA\n");
			continue;
		}
		
		int now=0;
		bool flag=false;
		string ans="";
		
		while(now<s.size()){
			int a=s[now]-'0', b=s[now+1]-'0';
			int p=(a-1)*5+b-1;
			
			//printf("a,b,p=%d,%d,%d\n",a,b,p);
			
			if(a<1 || 6<a || b<1 || 5<b){
				flag=true;
				break;
			}
			else if(p<=25) {
				string tmp(1,p+'a');
				ans.append(tmp);
			}
			else if(p==26) ans.append(".");
			else if(p==27) ans.append("?");
			else if(p==28) ans.append("!");
			else if(p==29) ans.append(" ");
			 
			now+=2;	
		}
		
		if(flag) printf("NA\n");
		else cout << ans << endl;
	}
	return 0;
}

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

int main(){
  int a,b; cin >> a >> b;
  if(a<10 && b<10) cout << a*b << endl;
  else cout << -1 << endl;
 
 return 0;
}


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

int main() {
  int n, k;
  cin >> n >> k;
  int board = 1;
  
  for (int i = 0; i < n; i++) {
    if (board * 2 < board + k) board *= 2;
    else board += k;
  }

  cout << board << endl;
}

Measured memory_bytes: 256
n = int(input())
listA = list(map(int, input().split()))
m = int(input())
listB = []
while True:
  try:
    listB.append(list(map(int,input().split())))
  except:
    break;
for i in range(m):
  x=listA[listB[i][0]-1]
  listA[listB[i][0]-1] = listB[i][1]
  s=0
  for j in range(n):
    s = s+listA[j]
  print(s)
  listA[listB[i][0]-1]=x



Measured memory_bytes: 3064
#![allow(unused_imports)]
#![allow(unused_macros)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(unused_mut)]
#![allow(unused_assignments)]
use proconio::input;
use proconio::marker::Usize1;
use std::collections::*;
use std::cmp::*;
use std::f64::consts::*;

const MOD: u64 = 1000000007;
const INF: usize = std::usize::MAX / 4;

fn main() {
    input! {
        N: usize,
        M: usize,
        AB: [(Usize1, Usize1); M],
    };

    let mut edges = vec![vec![]; N];

    for &(fr, to) in &AB {
        edges[fr].push(to);
        edges[to].push(fr);
    }

    let mut minDist = vec![INF; N];
    let mut ans = vec![N + 1; N];
    minDist[0] = 0;
    let mut que = VecDeque::new();
    que.push_back(0);

    while !que.is_empty() {
        let now = que.pop_front().unwrap();
        let dist = minDist[now];

        for &to in &edges[now] {
            if minDist[to] > dist + 1 {
                minDist[to] = dist + 1;
                ans[to] = now;
                que.push_back(to);
            }
        }
    }

    println!("Yes");
    for &a in &ans[1..N] {
        println!("{}", a + 1);
    }
}


Measured memory_bytes: 18108
#include<cstdio>
#include<iostream>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<deque>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<limits>
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using namespace std;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define rep(I,N) up(I,0,N-1)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
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;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(ld p){printf("%.12Lf\n",p);}
template<class T>inline                             void outml(T p){for_each(all(p),out<decltype(p[0])>);}
template<class T>inline void outol(T V){int n=V.size();rep(i,n)cout<<V[i]<<" \n"[i==n-1];}
inline void solve(void){
  int N,K,C;
  string S;
  in(N,K,C,S);
  vector<int>L(K),R(K);
  {
    int last=-(1<<30);
    int pos=0;
    for(int i=0;i<N&&pos<K;++i){
      if(S[i]=='o'&&i>last+C){
        L[pos++]=i;
        last=i;
      }
    }
    assert(pos==K);
  }
  {
    int last=1<<30;
    int pos=K-1;
    for(int i=N-1;i>=0&&pos>=0;--i){
      if(S[i]=='o'&&i<last-C){
        R[pos--]=i;
        last=i;
      }
    }
    assert(pos==-1);
  }
  rep(i,K)if(L[i]==R[i])out(L[i]+1);
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


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

int main(){
  string str;
  int n,sum,j,cnt;
  cin>>n;
  for(int i=0;i<n;i++){
    j=0,cnt=0;
  cin>>str;
    while(str.size()!=1){
            sum=str[j]-'0'+str[j+1]-'0';
	str[j]=sum/10+'0',str[j+1]=sum%10+'0';
	if(j==(int)str.size()-1 && str[j-1]=='0') break;
	if(str[j]=='0') j++;
	cnt++;
  }
     if(cnt%2==0)cout<<"Audrey wins."<<endl;
  else cout<<"Fabre wins."<<endl;
  }
  return 0;
}

Measured memory_bytes: 1196
import sys
import  math
from statistics import *
from collections import *
from operator import itemgetter
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n = ni()
ans = -1
for i in range(1, 1000000000):
    num = i ** 2
    if n >= num:
        ans = num
    else:
        break
print(ans)


Measured memory_bytes: 5212
#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(){
    ll a,b;
    cin >> a >> b;

    ll tot;
    for(ll x=1;x<=b;x*=2) {
        ll ca = ((a-1)/(x*2)) * (x) + max((a-1)%(x*2)-x+1,(ll)0);
        ll cb = (b/(x*2)) * (x) + max((b)%(x*2)-x+1,(ll)0);
        ll c = cb-ca;
        // cout << x << " " << cb << " " << ca << endl;
        
        if(c%2==1) tot += x;
    }
    cout << tot << endl;
    return 0;
}

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

int main() {
    int h1, h2, m1, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;

    int t1 = h1 * 60 + m1;
    int t2 = h2 * 60 + m2;

    cout << t2 - t1 - k << endl;

    return 0;
}

Measured memory_bytes: 3632
import sys

X,N=map(int,input().split())
if N==0:
  print(X)
  sys.exit()
lis=[int(_) for _ in input().split()]
for i in range(200):
  s=X-i
  u=X+i
  if not(s in lis):
    print(s)
    sys.exit()
  if not (u in lis):
    print(u)
    sys.exit()
    

Measured memory_bytes: 9192
#include <iostream>
using std::cin;
using std::cout;

int main() {
	int W, H, x, y, r;
	cin >> W >> H >> x >> y >> r;
	if(x + r > W || y + r > H || x - r < 0 || y - r < 0) cout << "No\n";
	else cout << "Yes\n";
	return 0;
}


Measured memory_bytes: 3104
import math
import sys
n=int(input())
s=int(input())
l=n-s
def f(b):
    t=0
    u=n
    while u!=0:
        t+=u%b
        u=u//b
    return t
N=math.ceil(math.sqrt(n)+2)
T=10**12
if l<0:
    print(-1)
    sys.exit()
if l==0:
    print(n+1)
    sys.exit()
for i in range(1,N):
    if l%i==0:
        j=i+1
        if f(j)==s and T>j:
            T=j
        elif f((l//i)+1)==s and T>((l//j)+1):
            T=(l//i)+1
if T==10**12:
    print(-1)
    sys.exit()
print(T)

Measured memory_bytes: 39152
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pr;
const ll maxn = 100000 + 10;
const ll MOD = 1000000007;

ll a[maxn], b[maxn], val[maxn], N, n, m, tot = 0;
pr c[maxn];

inline bool cmp(pr a, pr b) {
  if(a.first != b.first) return a.first < b.first;
  return a.second > b.second;
}

struct BIT{
  ll c[maxn << 1];
  
  inline void init() {
    memset(c,0,sizeof(c));
  }
  inline ll lowbit(ll k) { return k & - k; }
  inline void add(ll x, ll k) {
    for(ll i = x;i <= maxn;i += lowbit(i)) c[i] += k, c[i] %= MOD;
  }
  inline ll query(ll x) {
    ll tmp = 0;
    for(ll i = x;i;i -= lowbit(i)) tmp += c[i], tmp %= MOD;
    return tmp;
  }
}B;

int main() {
  scanf("%lld%lld", &n, &m);
  for(ll i = 1;i <= n;i ++) scanf("%lld", &a[i]);
  for(ll i = 1;i <= m;i ++) scanf("%lld", &b[i]);
  for(ll i = 1;i <= n;i ++) {
    if(a[i] > b[1] && a[i] < b[m]) {
      ll tmp = lower_bound(b + 1,b + m + 1,a[i]) - b;
      if(b[tmp] == a[i]) continue;
      c[++ tot] = make_pair(a[i] - b[tmp - 1],b[tmp] - a[i]);
      val[tot] = b[tmp] - a[i];
	}
  }
  sort(val + 1,val + tot + 1);
  ll N = unique(val + 1,val + tot + 1) - val - 1;
  for(ll i = 1;i <= tot;i ++) c[i].second = lower_bound(val + 1,val + N + 1,c[i].second) - val;
  sort(c + 1,c + tot + 1,cmp);
  int NN = unique(c + 1,c + tot + 1) - c - 1;
  ll ans = 1;
  B.init();
  for(ll i = 1;i <= NN;i ++) {
    ll tmp = B.query(c[i].second - 1) + 1;
    ans += tmp;
    ans %= MOD;
    B.add(c[i].second,tmp);
  }
  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;

int main() {
    int n;
    cin >> n;
    vector <int> a(n);
    for(int i=0;i<n;++i) cin >> a[i];
    bool ok=true;
    for(int i=0;i<n;++i) {
        if(a[i]%2==0) {
            if(a[i]%3!=0 && a[i]%5!=0) ok=false;
        }
    }
    if(ok) cout << "APPROVED" << endl;
    else cout << "DENIED" << endl;
}



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

int main()
{
	int i,j,H,W;
	while(1)
	{
		cin >> H >> W ;
		if((H == 0)&& (W == 0)) break;

		for(i=0;i<H;i++)
		{
			for(j=0;j<W;j++)
			{
				cout << '#' ;
			}
			cout << endl ;
		}

		cout << endl ;

	}

	return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
int n;
string s[200005];
int l=1,p;
int qwq[200005];
int q;
int main() {
	cin>>n;
	for(int i=0;i<n;i++) cin>>s[i];
	sort(s,s+n);
	for(int i=1;i<=n;i++) 
		if(s[i]!=s[p]) {
			if(i-p<l) p=i;
			if(i-p==l) qwq[++q]=p,p=i;
			if(i-p>l) q=1,qwq[q]=p,l=i-p,p=i;
		}
	for(int i=1;i<=q;i++) cout<<s[qwq[i]]<<endl;
	return 0;
}

Measured memory_bytes: 15104
#pragma GCC optimize ("O3")
#include <iostream>
#include <algorithm>
 
inline void fastin(int &num) {
    bool neg = false;
    int c;
    num = 0;
    c = getchar_unlocked();
    if (c == '-') {
        neg = true;
        c = getchar_unlocked();
    }
    for (; (c > 47 && c < 58); c = getchar_unlocked()) num = num * 10 + c - 48;
    if (neg) num *= -1;
}

inline void fastout(int n) {
    int N = n, rev, count = 0;
    rev = N;
    if (N == 0) { putchar_unlocked('0'); putchar_unlocked('\n'); return ;}
    while ((rev % 10) == 0) { ++count; rev /= 10;}
    rev = 0;
    while (N != 0) { rev = (rev<<3) + (rev<<1) + N % 10; N /= 10;}
    while (rev != 0) { putchar_unlocked(rev % 10 + '0'); rev /= 10;}
    while (count--) putchar_unlocked('0');
}
 
inline int divide(int x, int y){
    if (x % y == 0) return x / y;
    else return x / y + 1;
}
 
int main(){    
    int N, H; fastin(N); fastin(H);
  	int a = 0;
	int b[N] = {};
    for (int i = 0; i < N; ++i) {
      	int ta, tb; fastin(ta); fastin(tb);
    	a = std::max(a, ta); b[i] = tb;
    }
 
    std::sort(b, b + N);
    auto it = std::lower_bound(b, b + N, a);
 
    int temp = 0; int cnt = 0;
 
    for (int i = N - 1; i >= (int) (it - b); --i){
        temp += b[i]; ++cnt;
        if (temp >= H){
            fastout(cnt); return 0;
        }
    }
    fastout(cnt + divide((H - temp), a));
    
    return 0;
}

Measured memory_bytes: 640
//abc162B
#include <malloc.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(void) {
  int n,i=1;
  long long sum=1;
  scanf(" %d", &n);

  while(i<n){
    i+=1;
    if(i>n)break;
    sum+=i;

    i+=2;
    if(i>n)break;
    sum+=i;

    i+=3;
    if(i>n)break;
    sum+=i;

    i+=1;
    if(i>n)break;
    sum+=i;

    i+=3;
    if(i>n)break;
    sum+=i;

    i+=2;
    if(i>n)break;
    sum+=i;

    i+=1;
    if(i>n)break;
    sum+=i;

    i+=2;
    if(i>n)break;
    sum+=i;
  }
printf("%lld",sum);
}

Measured memory_bytes: 1732
S = str(input())
T = str(input())
if T == S+"a":
  print("Yes")
elif T == S+"b":
  print("Yes")
elif T == S+"c":
  print("Yes")
elif T == S+"d":
  print("Yes")
elif T == S+"e":
  print("Yes")
elif T == S+"f":
  print("Yes")
elif T == S+"g":
  print("Yes")
elif T == S+"h":
  print("Yes")
elif T == S+"i":
  print("Yes")
elif T == S+"j":
  print("Yes")
elif T == S+"k":
  print("Yes")
elif T == S+"l":
  print("Yes")
elif T == S+"m":
  print("Yes")
elif T == S+"n":
  print("Yes")
elif T == S+"o":
  print("Yes")
elif T == S+"p":
  print("Yes")
elif T == S+"q":
  print("Yes")
elif T == S+"r":
  print("Yes")
elif T == S+"s":
  print("Yes")
elif T == S+"t":
  print("Yes")
elif T == S+"u":
  print("Yes")
elif T == S+"v":
  print("Yes")
elif T == S+"w":
  print("Yes")
elif T == S+"x":
  print("Yes")
elif T == S+"y":
  print("Yes")
elif T == S+"z":
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9164
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long ll;
int main(){
	ll n,w;
	cin>>n>>w;
	vector<ll> weight(n),value(n);
	for(ll i=0;i<n;i++){
		
		cin>>weight[i]>>value[i];
		
	}
	ll dp[n+1][w+1];
	for(ll i=0;i<=n;i++){
		for(ll j=0;j<=w;j++){
			if(i==0 || j==0){
				dp[i][j] = 0;
			}
			else if(weight[i-1]<=j){
				dp[i][j] = max(value[i-1]+dp[i-1][j-weight[i-1]],dp[i-1][j]);
			}
			else{
				dp[i][j] = dp[i-1][j];
			}
		}
	}
	cout<<dp[n][w]<<"\n";
	
}

Measured memory_bytes: 79104
n = int(input())
(*a,) = map(int, input().split())
(*b,) = map(int, input().split())
(*c,) = map(int, input().split())

ans = sum(c[a[i] - 1] for i in range(n - 1) if a[i + 1] - a[i] == 1)
print(ans + sum(b))

Measured memory_bytes: 8988
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b;
    int aa,bb,cc;
    scanf("%d%d",&a,&b);
    aa=a-b,bb=a+b,cc=a*b;
    if(aa>=bb){
        if(aa>=cc){
            printf("%d",aa);
        }else{
            printf("%d",cc);
        }
    }else{
        if(bb>=cc){
            printf("%d",bb);
        }else{
            printf("%d",cc);
        }
    }
    return 0;
}


Measured memory_bytes: 128
#c 別解法
n,m = map(int, input().split())
h_list = list(map(int, input().split()))
c_list= [[] for i in range(n)]
for i in range(m):
    a,b = map(int, input().split())
    c_list[a-1].append(b-1)
    c_list[b-1].append(a-1)
dn = 0
for i in range(n):
    
    for j in c_list[i]:
        if  h_list[i] <=h_list[j]:
            dn+=1
            break
print(n-dn)
        

Measured memory_bytes: 29488
n = gets.to_i
d = readlines.map(&:chomp)

a,b = [],[]
for i in 0..d.length-1 do
    ai, bi = d[i].split(" ").map(&:to_i)
    a << ai
    b << bi
end
a.sort!
b.sort!

if n.even? then
	upper = b[(n-1)/2+1]+b[(n-1)/2]
  	lower = a[(n-1)/2+1]+a[(n-1)/2]
  	puts upper-lower+1
else
    puts b[n/2]-a[n/2]+1  
end

Measured memory_bytes: 51488
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll n,a,b;
	cin>>n>>a>>b;
	ll ans=0;
	if(n>=(a+b))
	{
	if(n%(a+b)==0)
	{
		cout<<(n/(a+b))*a;
	}
	else 
	{
		// cout<<((n/(a+b))*a)+(n%(a+b));
		ans=(n/(a+b))*a;
		ll rem = n%(a+b);

		if(rem<a)
			ans+=rem;
		else 
		{
			ans+=a;
		}
		cout<<ans<<endl;
	}
	}
	else 
	{
		if(n<a)
			cout<<n;
		else 
		{
			cout<<a;
		}
	}
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
//#pragma GCC target("avx,tune=native")
#include<bits/stdc++.h>
#define int long long
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
inline string getstr(string &s,int l,int r){string ret="";for(int i=l;i<=r;i++)ret.push_back(s[i]);return ret;}
int modpow(int x,int y,int md=mod){if(y==0)return 1;int ret=modpow(x,y>>1,md);ret=(ll)ret*ret%md;if(y&1)ret=(ll)ret*x%md;return ret;}
set<pair<int,int> >S;
int n,a[200005],b[200005];
int get(int x){
	if(x==0)return b[n];
	if(x==n+1)return b[1];
	return b[x];
}
signed main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=n;i++){
		cin>>b[i];
		if(b[i]!=a[i])S.insert(make_pair(-b[i],i));
	}
	int ans=0;
	while(!S.empty()){
		pair<int,int>p=*S.begin();
		S.erase(S.begin());
		int v=p.first,id=p.second;
		int sub=get(id+1)+get(id-1);
		int nxt=(!S.size()?0ll:-S.begin()->first);
		int mul=(b[id]-max(max(get(id+1),get(id-1)),a[id]))/sub;
		mul=max(mul,1ll);
		b[id]-=sub*mul;
		ans+=mul;
		if(b[id]<a[id]){
			puts("-1");
			return 0;
		}
		if(b[id]!=a[id])S.insert(make_pair(-b[id],id));
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 15872
#include<bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define pt pop_front
#define pk pop_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
template<class T> T count_bit(T p){
  if(typeid(p)==typeid(int))return __builtin_popcount(p);
  else if(typeid(p)==typeid(long))return __builtin_popcountl(p);
  else return __builtin_popcountll(p);
}
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;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}

inline void solve(void){
  long n;
  in(n);
  vector<long>p(n);
  rep(i,n)in(p[i]);
  long cnt=0;
  up(i,1,n-2){
    if(!((p[i-1]<p[i]&&p[i+1]<p[i])||(p[i-1]>p[i]&&p[i+1]>p[i])))cnt++;
  }
  out(cnt);
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAX 15
#define rep(i,n) for(int i=0;i<int(n);i++)
int nn,m;
vector<int> g[MAX],r[MAX];
bool used[1<<MAX][MAX];
struct Q{
  bool is_move;
  bool is_on;
  int s;
  bool operator<(const Q& q)const{return s<q.s;}
  Q(){}
  Q(bool i,bool o,int s_):is_move(i),is_on(o),s(s_){}
};
struct P{
  int u,n;
  vector<Q> v;
  P(int u_,int n_,const vector<Q>& v_):u(u_),n(n_),v(v_){}
};
void solve(int u)
{
  memset(used,0,sizeof(used));
  queue<P> q;
  vector<Q> v;
  q.push( P(u,0,vector<Q>()) );
  used[u][0]=true;
  bool can=false,all=false;
  if( !(u&1) )goto END;
  while( !q.empty() ){
    P p=q.front(); q.pop();
    int n=p.n;
    u=p.u;
    if( n==nn-1 ){
      can=true;
      if( u==(1<<(nn-1)) ){
        all=true;
        v=p.v;
        goto END;
      }
    }
    //move
    rep(i,g[n].size()){
      //printf("%d -> %d %d\n",n,g[n][i],i);
      if( u&(1<<g[n][i]) && !used[u][g[n][i]] ){
        used[u][g[n][i]]=true;
        v=p.v;
        v.push_back( Q(true,false,g[n][i]) );
        q.push( P(u,g[n][i],v) );
      }
    }
    //switch
    rep(i,r[n].size()){
      bool is_on=!(u&(1<<r[n][i]));
      int uu=u^(1<<r[n][i]);
      if( !used[uu][n] ){
        used[uu][n]=true;
        v=p.v;
        v.push_back( Q(false,is_on,r[n][i]) );
        q.push( P(uu,n,v) );
      }
    }
  }
END:;
  if( !can ){
    puts("Help me!");
  } else if( !all ){
    puts("You can not switch off all lights.");
  } else {
    printf("You can go home in %d steps.\n",v.size());
    for(vector<Q>::iterator it=v.begin();it!=v.end();++it){
      if(!it->is_move){
        vector<Q>::iterator iit;
        for(iit=it;iit+1!=v.end() && !iit->is_move;++iit);
        sort(it,iit);
        it=iit;
      }
    }
    rep(i,v.size()){
      Q& q=v[i];
      if(q.is_move){
        printf("Move to room %d.\n",q.s+1);
      } else {
        printf("Switch %s room %d.\n",q.is_on?"on":"off",q.s+1);
      }
    }
  }
}
int main(void)
{
  for(;;){
    scanf("%d%d",&nn,&m); if(!nn)break;
    int s,t;
    rep(i,m){
      scanf("%d%d",&s,&t);
      s--; t--;
      g[s].push_back(t);
      g[t].push_back(s);
    }
    int a,u=0;
    rep(i,nn){
      scanf("%d",&a);
      u|=a<<i;
    }
    int k,l;
    rep(i,nn){
      scanf("%d",&k);
      rep(j,k){
        scanf("%d",&l); l--;
        if(l==i)continue;
        r[i].push_back(l);
      }
      sort(r[i].begin(),r[i].end());
      sort(g[i].begin(),g[i].end());
    }
    solve(u);
    rep(i,nn)g[i].clear();
    rep(i,nn)r[i].clear();
  }
}

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

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

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod 1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int tt[10];
int cou = 0;

void solve(int i, string num, string str) {
  if(i == 9) {
    int a = (char)(str[0] - 48);
    int b = (char)(str[1] - 48);
    int c = (char)(str[2] - 48);
    int d = (char)(str[3] - 48);
    int e = (char)(str[4] - 48);
    int f = (char)(str[5] - 48);
    int g = (char)(str[6] - 48);
    int h = (char)(str[7] - 48);
    int ii = (char)(str[8] - 48);

    if((a + c + f) % 10 != ii) return;
    int t = (a + c + f) / 10;
    if((b + e + t) % 10 != h) return;
    t = (b + e + t) / 10;
    if((d + t) == g) {
      cou++;
      return;
    }
  }
  if(tt[i] != -1) {
    if(num[tt[i] - 1] == '0') {
      num[tt[i] - 1] = '1';
      solve(i + 1, num, str + (char)(48 + tt[i]));
    }
  }else {
    for(int j = 0; j < 9; j++) {
      if(num[j] == '0') {
        num[j] = '1';
        solve(i + 1, num, str + (char)(48 + j + 1));
        num[j] = '0';
      }
    }
  }
}

int main() {
  rep(i, 0, 9) cin >> tt[i];
  solve(0, "000000000", "");
  cout << cou << endl;
}

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

#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define all(x) (x).begin(),(x).end()

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

const int MOD = 1e9 + 7;


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

    string s;
    ll k;
    cin >> s >> k;

    const ll len = s.size();
    ll cnt = 1, f = 1;
    ll ans = 0;
    bool flag = true;
    rept(i, 1, len) {
        if(s.at(i) == s.at(i-1)){
            cnt++;
        }else{
            ans += cnt / 2;
            cnt = 1;
            flag = false;
        }
        if(flag){
            f++;
        }

    }

    //cout << cnt << " " << f << endl;
    ans += cnt / 2;
    ans *= k;
    if(s.at(0) == s.at(len-1)){
        ans -= ((cnt/2 + f/2 - (cnt + f) / 2) * (k-1));
    }
    if(cnt == len){
        ans = len * k / 2;
    }

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



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int a,b,c;
 	cin >> a >> b >> c;
  	if ((a < c && c < b ) || (b < c && c < a)) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;

#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
#define pi  3.14159265359
#define mod 1000000007

int main()
{
    string s,t;
    cin>>s>>t;
    ll minn=1000000;
    for(int i=0;i<s.size();i++)
    {
        ll k=i,ch=0;
        if(i+t.size()>s.size()){
            break;
        }
        for(int j=0;j<t.size();j++)
        {
            if(s[k]!=t[j]){
                ch++;
            }
            k++;
        }
        minn=min(minn,ch);
    }
    if(minn!=1000000)
    cout<<minn<<endl;
    else
    cout<<0<<endl;

}


Measured memory_bytes: 3636
using System;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        double a = sc.NextInt();
        double b = sc.NextInt();
        double x = sc.NextInt();

        double size = a * a * b;

        if (x * 2 >= size)
        {
            double s = x / a;

            double ss = a * b - s;

            double l = ss * 2 / a;

            Console.WriteLine(Math.Atan2(l, a) * 180.0 / Math.PI);
        }
        else
        {
            double s = x / a;
            double l = s * 2 / b;
            Console.WriteLine(Math.Atan2(b, l) * 180 / Math.PI);
        }
    }

    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = Console.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}

Measured memory_bytes: 13140
def solve():
  ar = raw_input().split(' ')
  A = int(ar[0])
  B = int(ar[1])
  C = int(ar[2])

  s = set([])
  sum = 0
  while True:
    sum = sum + A
    m = sum % B
    #print 'sum=',sum,'m=',m
    if (m == C): return 'YES'
    if (m in s): return 'NO'
    s.add(m)

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

Measured memory_bytes: 2568
a = int(raw_input())
b = int(raw_input())
c = int(raw_input())
x = int(raw_input())

cnt = 0

for i in range(0, a+1):
	for j in range(0, b+1):
		for k in range(0, c+1):
			if x == 500 * i + 100 * j + 50 * k:
				cnt = cnt + 1

print cnt


Measured memory_bytes: 2568
[N,L]=[int(x) for x in raw_input().split()]
icelist=[]
for i in range(N):
    icelist+=[int(raw_input())]
peakindex=[0]
for i in range(1,N-1):
    if (icelist[i]-icelist[i-1])*(icelist[i+1]-icelist[i])<0:
            peakindex.append(i)
peakindex.append(N-1)
ans=0
for i in range(len(peakindex)-1):
    newans=sum([L-icelist[x] for x in range(peakindex[i],peakindex[i+1]+1)])
    ans=max(ans,newans)
print ans

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);  
	
	int n, m, q; cin >> n >> m >> q;
	vector<vector<int>> trains(n + 1, vector<int>(n + 1));
	for(int i =  0; i < m; i++){
		int a, b; cin >> a >> b;
		trains[a][b]++;
	}
	for(int i = 0; i <= n; i++){
		for(int j = 1; j <= n; j++){
			trains[i][j] += trains[i][j -1];
		}
	}
	for(int i = 1; i <= n; i++){
		for(int j = 0; j <= n; j++){
			trains[i][j] += trains[i - 1][j];
		}
	}
	for(int i = 0; i < q; i++){
		int l, r; cin >> l >> r;
		cout << trains[r][r] + trains[l - 1][l -1] - trains[r][l -1] - trains[l - 1][r] << endl;
	}
	return 0;	
}





  

Measured memory_bytes: 1920
def f(n):
  ans = 0
  for i in range(2, n // 2):
    if ans == 0:
      if n % i == 0:
        ans = 1
        break
      else:
        next
  return ans

x = int(input())
ans = 0
while ans == 0:
  if f(x) == 1:
    x += 1
  elif f(x) == 0:
    ans = x
    break
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

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

int main() {
  int a, b;
  cin >> a >> b;
  if (a < b) {
    rep(i, b) {
      cout << a;
    }
  } else {
    rep(i, a) {
      cout << b;
    }
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#define INF 1e9+7
using namespace std;
typedef long long int ll;


int main() {

	int a, b;
	cin >> a >> b;
	if (a % 2 == 1 && b % 2 ==1 ) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAX 300010
#define MOD 998244353
using namespace std;

char str[MAX];
int kind[MAX];
int leftPartial[MAX];
int rightPartial[MAX];
int rIdx[MAX];
int gIdx[MAX];
int bIdx[MAX];

int prod(int a, int b)
{
	return 1LL * a * b % MOD;
}

int min(int a, int b, int c)
{
	return min(min(a, b), c);
}

int max(int a, int b, int c)
{
	return max(max(a, b), c);
}

int main(void)
{
	int N;
	cin >> N;
	cin >> str;
	int rCnt = 0;
	int gCnt = 0;
	int bCnt = 0;
	int ans = 1;
	for (int i = 0; i < 3 * N; i++)
	{
		if (str[i] == 'R') rIdx[rCnt++] = i;
		else if (str[i] == 'G') gIdx[gCnt++] = i;
		else bIdx[bCnt++] = i;
	}
	for (int i = 0; i < N; i++)
	{
		if (rIdx[i] == min(rIdx[i], gIdx[i], bIdx[i])) kind[rIdx[i]] = 0;
		if (gIdx[i] == min(rIdx[i], gIdx[i], bIdx[i])) kind[gIdx[i]] = 0;
		if (bIdx[i] == min(rIdx[i], gIdx[i], bIdx[i])) kind[bIdx[i]] = 0;
		if ((rIdx[i] < gIdx[i]) ^ (rIdx[i] < bIdx[i])) kind[rIdx[i]] = 1;
		if ((gIdx[i] < rIdx[i]) ^ (gIdx[i] < bIdx[i])) kind[gIdx[i]] = 1;
		if ((bIdx[i] < rIdx[i]) ^ (bIdx[i] < gIdx[i])) kind[bIdx[i]] = 1;
		if (rIdx[i] == max(rIdx[i], gIdx[i], bIdx[i])) kind[rIdx[i]] = 2;
		if (gIdx[i] == max(rIdx[i], gIdx[i], bIdx[i])) kind[gIdx[i]] = 2;
		if (bIdx[i] == max(rIdx[i], gIdx[i], bIdx[i])) kind[bIdx[i]] = 2;
		ans = prod(ans, i + 1);
	}
	for (int i = 0; i < 3 * N; i++)
	{
		leftPartial[i + 1] = leftPartial[i];
		if (kind[i] == 0) leftPartial[i + 1]++;
	}
	for (int i = 3 * N - 1; i >= 0; i--)
	{
		rightPartial[i] = rightPartial[i + 1];
		if (kind[i] == 2) rightPartial[i]++;
	}
	int idx = 0;
	for (int i = 0; i < 3 * N; i++)
	{
		if (kind[i] != 1) continue;
		ans = prod(ans, (leftPartial[i] - idx++));
	}
	idx = 0;
	for (int i = 3 * N - 1; i >= 0; i--)
	{
		if (kind[i] != 1) continue;
		ans = prod(ans, (rightPartial[i] - idx++));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 6272
class Problem
  attr_accessor *(?a..?z).to_a.map(&:to_sym)
  def initialize
    @s = gets.chomp
    @t = gets.chomp
  end

  def solve
    s == t.reverse
  end

  def show(ans)
    puts ans ? "YES" : "NO"
  end
end

Problem.new.instance_eval do
  show(solve)
end


Measured memory_bytes: 14352
import           Control.Applicative
import           Control.DeepSeq
import           Control.Monad
import           Control.Monad.ST
import qualified Data.Array                    as A
import qualified Data.Array.IArray             as IA
import qualified Data.Array.IO                 as AI
import qualified Data.Array.MArray             as MA
import qualified Data.Array.ST                 as STA
import qualified Data.Array.Unboxed            as AU
import           Data.Bits
import qualified Data.ByteString.Char8         as BS
import           Data.Char
import qualified Data.Graph                    as G
import           Data.Int
import qualified Data.IntMap                   as IM
import qualified Data.IntSet                   as IS
import           Data.List
import qualified Data.Map.Strict               as M
import           Data.Maybe
import           Data.Ord
import qualified Data.Sequence                 as SQ
import qualified Data.Set                      as S
import           Data.Time
import qualified Data.Tree                     as T
import qualified Data.Vector                   as V
import qualified Data.Vector.Mutable           as VM
import qualified Data.Vector.Unboxed           as VU
import qualified Data.Vector.Unboxed.Mutable   as VUM

readInt :: IO Int
readInt = fst . fromJust . BS.readInt <$> BS.getLine

readInts :: IO [Int]
readInts = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

readIntLists :: Int -> IO [[Int]]
readIntLists n = replicateM n readInts

readInteger :: IO Integer
readInteger = fst . fromJust . BS.readInteger <$> BS.getLine

readIntegers :: IO [Integer]
readIntegers = map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine

readIntegerLists :: Int -> IO [[Integer]]
readIntegerLists n = replicateM n readIntegers

readStrings :: IO [String]
readStrings = map BS.unpack . BS.words <$> BS.getLine

readStringLists :: Int -> IO [[String]]
readStringLists n = replicateM n <$> readStrings

toPair :: [a] -> (a, a)
toPair [x, y] = (x, y)

count :: Eq a => a -> [a] -> Int
count a as = length $ filter (== a) as

put :: Show a => a -> IO ()
put = putStr . show

putList :: Show a => [a] -> IO ()
putList [n     ] = print n
putList (n : ns) = do
  put n
  putStr " "
  putList ns

putStrList :: [String] -> IO ()
putStrList [n     ] = putStrLn n
putStrList (n : ns) = do
  putStr n
  putStr " "
  putStrList ns

yesNoUpper b | b         = putStrLn "YES"
             | otherwise = putStrLn "NO"

yesNo b | b         = putStrLn "Yes"
        | otherwise = putStrLn "No"

divCeiling x n | b == 0    = a
               | otherwise = a + 1
  where (a, b) = x `divMod` n

main = do
  o <- getLine
  e <- getLine
  putStrLn $ solve o e 0

solve [] [] _ = []
solve o e n | n == 0    = (head o) : solve (tail o) e 1
            | otherwise = (head e) : solve o (tail e) 0


Measured memory_bytes: 508
#include<stdio.h>
#define MAX 100
#define INFTY 10000000
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n;
int M[MAX][MAX];

int prim(){
  int i, u, minv, v, sum;
  int d[MAX], p[MAX], color[MAX];

  for( i = 0; i < n; i++ ){
    d[i] = INFTY;
    p[i] = -1;
    color[i] = WHITE;
  }

  d[0] = 0;

  while(1){
    minv = INFTY;
    u = -1;
    for( i=0; i < n; i++ ){
      if( minv > d[i] && color[i] != BLACK ){
	u = i;
	minv = d[i];
      }
    }
    
    if(u == -1)break;
    color[u] = BLACK;
    
    for( v = 0; v < n; v++ ){
      if( color[v] != BLACK && M[u][v] != INFTY ){
	if( d[v] > M[u][v] ){
	  d[v] = M[u][v];
	  p[v] = u;
	  color[v] = GRAY;
	}
      }
    }
  }
  sum = 0;
  for( i = 0; i < n; i++ ){
    if( p[i] != -1 ) sum += M[i][p[i]];
  }

  return sum;
}

int main(){

  int i,j,e;

  scanf("%d",&n);

  for( i = 0; i < n; i++ ){
    for( j = 0; j < n; j++ ){
      scanf("%d",&e);
      if( e == -1) M[i][j] = INFTY;
      else M[i][j] = e;
    }
  }

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

  return 0;
}



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

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

    string S;
    cin >> S;
    bool ret = true;
    for (int i = 0; i < S.size(); i++) {
        if (i % 2 == 0) {
            if (S[i] == 'L') {
                ret = false;
                break;
            }
        } else {
            if (S[i] == 'R') {
                ret = false;
                break;
            }
        }
    }
    if (ret) cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256