akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main
{
    static int h;
    static int w;
    static int n;
    static int power;
    static int dx[]={0,-1,1,0};
    static int dy[]={-1,0,0,1};
    static Node startNode;
    static int dist[][];
    static String field[][];
    static boolean visit[][];
    static Queue<Node> nodeQueue=new ArrayDeque<>();
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        h=sc.nextInt();
        w=sc.nextInt();
        n=sc.nextInt();
        String s[]=new String[h];
        field=new String[h+2][w+2];
        visit=new boolean[h+2][w+2];
        dist=new int[h+2][w+2];
        power=1;
        int answer=0;

        for (int i=0;i<h;++i) { s[i]=sc.next();}
        for (int i=0;i<h+2;++i)
        {
            for (int j=0;j<w+2;++j)
            {
                if (i==0 || j==0 || j==w+1 || i==h+1) {field[i][j]="X";}
                else
                {
                    field[i][j]=s[i-1].substring(j-1,j);
                    if (field[i][j].equals("S")) { startNode=new Node(i,j); }
                    visit[i][j]=false;
                }
            }
            //System.out.println(Arrays.toString(field[i]));
        }

        for (int i=0;i<n;++i)
        {
            dfs();
            answer+=dist[startNode.getIdX()][startNode.getIdY()];
            ++power;
        }
        System.out.println(answer);
    }

    public static void dfs()
    {
        for (int i=0;i<h+2;++i) { for (int j=0;j<w+2;++j) { dist[i][j]=-1; } }
        nodeQueue.clear();
        dist[startNode.getIdX()][startNode.getIdY()]=0;
        nodeQueue.add(startNode);

        while (!nodeQueue.isEmpty())
        {
            Node node=nodeQueue.poll();
            for (int i=0;i<dx.length;++i)
            {
                int nx=node.getIdX()+dx[i];
                int ny=node.getIdY()+dy[i];
                Node node1=new Node(nx,ny);
                if (!field[nx][ny].equals("X") && dist[nx][ny]==-1)
                {
                    dist[nx][ny]=dist[node.getIdX()][node.getIdY()]+1;
                    if (!field[nx][ny].equals(".") && !field[nx][ny].equals("S"))
                    {
                        int needPower=Integer.parseInt(field[nx][ny]);
                        if (needPower<=power && !visit[nx][ny])
                        {
                            visit[nx][ny]=true;
                            startNode=node1;
                            return;
                        }else { nodeQueue.add(node1); }
                    }else { nodeQueue.add(node1); }
                }
            }
        }
    }
}

class Node
{
    int idX;
    int idY;
    public Node(int i,int j)
    {
        this.idX=i;
        this.idY=j;
    }

    public int getIdX() {return this.idX;}
    public int getIdY() {return this.idY;}
}


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

public:
    Combination(ll n){
        N = n;
        fac.push_back(1); fac.push_back(1);
        rep(i,2,N+1) fac.push_back(fac[i-1] * i % MOD);
        rep(i,0,N+1) facinv.push_back(power(fac[i], MOD-2));
    }
    ll power(ll x, ll n){
        if(n == 0) return 1LL;
        ll res = power(x * x % MOD, n/2);
        if(n % 2 == 1) res = res * x % MOD;
        return res;
    }
    ll nck(ll n, ll k){
        if(k == 0 || n == k) return 1LL;
        return fac[n] * facinv[k] % MOD * facinv[n-k] % MOD;
    }
    ll npk(ll n, ll k){
        if(k == 0 || n == k) return 1LL;
        return fac[n] * facinv[n-k] % MOD;
    }
    ll get(ll x){return fac[x];};
    ll getinv(ll x){return facinv[x];};
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,A,B;
    cin >> N >> A >> B;
    Combination cb(200010);
    ll ans = (cb.power(2, N) - 1 + MOD) % MOD;
    ll v1 = 1;
    rep(i,0,A){
        v1 *= N - i;
        v1 %= MOD;
    }
    v1 *= cb.getinv(A);
    v1 %= MOD;
    ll v2 = 1;
    rep(i,0,B){
        v2 *= N - i;
        v2 %= MOD;
    }
    v2 *= cb.getinv(B);
    v2 %= MOD;
    ans = (ans - v1 - v2 + 2 * MOD) % MOD;
    print(ans);


    

}

Measured memory_bytes: 4976
import functools

if __name__ == "__main__":
    num_rows, num_cols = list(map(int, input().split()))

    table = []

    for _ in range(num_rows):
        row = list(map(int, input().split()))

        table.append(row)

    table_added_row_sum = list(map(lambda row: row + [sum(row)], table))

    col_sum = functools.reduce(
        lambda acc, elem: acc + [sum(elem)],
        list(zip(*table_added_row_sum)),
        []
    )

    table_added_row_col_sum = table_added_row_sum + [col_sum]

    string_records = list(map(
        lambda row: ' '.join(map(str, row)),
        table_added_row_col_sum
    ))

    for string_record in string_records:
        print(string_record)



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

int main(){
	int a, b, tai, p1=0, p2=0;
	while(scanf("%d,%d,%d",&a,&b,&tai)!=EOF){
		if(a*a+b*b==tai*tai)p1++;
		if(a==b)p2++;
	}
	cout<<p1<<endl<<p2<<endl;
	return 0;
}

Measured memory_bytes: 1208
#include<bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define rep(i,n) for(int i=0; i<(n); ++i)
#define per(i,n) for(int i=n-1;i>=0;++i)
#define rep1(i,n) for(int i=1; i<=n; ++i)
#define per1(i,n) for(int i=n; i>=1; ++i)
#define debug cout << "line : " << __LINE__ << " debug" << endl
#define Dcout(N) cout << setprecision(20) << N << endl
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ) //被り削除
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define INF 1e9
#define MOD 1000000007
typedef long long ll;
//------------------------------------------------------------------------

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

  int n; cin >> n;
  string s; cin >> s;
  int cntr=0,cntb=0;
  rep(i,n){
    if(s[i]=='R') cntr++;
    else cntb++;
  }

  if(cntr>cntb) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		System.out.println( b - a == c - b ? "YES" : "NO");
	}
}

Measured memory_bytes: 35672
import java.util.Scanner;


public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long H = sc.nextLong();
        long W = sc.nextLong();
        long ans = 0;
        if (H == 1 || W == 1) {
            System.out.println(1);
        } else if ((H*W)%2 == 0) {
            System.out.println((H*W)/2);
        } else {
            System.out.println(((H*W)/2)+1);
        }
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

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

  int n;
  cin >> n;

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

  int ans = 0;
  int next = 0;
  while (1) {
    if (a[next] == 1) {
      ans++;
      break;
    }

    next = a[next];
    ans++;

    if (ans > n) {
      ans = -1;
      break;
    }
  }

  cout << ans << endl;

  return 0;
}

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

int main() {
    string str;
    string copy[201];
    int m;
    int h;
    
    while(cin >> str) {
        if (str == "-") break;
        cin >> m;
        for (int i = 0; i < m; i++) {
            cin >> h;
        string cat = str.substr(0,h);
        str.erase(0,h);
        str+=cat;
        }
        cout << str << endl;
    }
}


Measured memory_bytes: 3200
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String line = sc.nextLine();
    String data[] = line.split("");
    int count = 0;
    int n = 0;
    int flag = 0;
    int max = 0;
    while(n < data.length){
      if(data[n].equals("R")){
        count++;
        if(max < count){
          max = count;
        }
      }
      else{
        count = 0;
      }
      n++;
    }
    System.out.println(max);
  }
}
      

Measured memory_bytes: 35596
A,B,C,K=map(int,input().split())
if A==B==C:
  print('0')
  exit()
  
else:
  if K%2==0:
    key=A-B
    if key>10**18:
      print('Unfair')
    else:
      print(key)
  else:
    key=B-A
    if key>10**18:
      print('Unfair')
    else:
      print(key)
      


Measured memory_bytes: 2940
#include <stdio.h>


int main(void)
{
	int n;
	int x1, y1, z1, w1;
	int x2, y2, z2, w2;
	int a, i, j, k;
	int loop;
	
	while (1){
		scanf("%d", &n);
		if (n == 0){
			break;
		}
		
		for (loop = 0; loop < n; loop++){
			scanf("%d%d%d%d", &x1, &y1, &z1, &w1);
			scanf("%d%d%d%d", &x2, &y2, &z2, &w2);
		
			a  = x1 * x2;
			i  = x1 * y2;
			j  = x1 * z2;
			k  = x1 * w2;
			
			i += y1 * x2;
			a -= y1 * y2;
			k += y1 * z2;
			j -= y1 * w2;
			
			j += z1 * x2;
			k -= z1 * y2;
			a -= z1 * z2;
			i += z1 * w2;
			
			k += w1 * x2;
			j += w1 * y2;
			i -= w1 * z2;
			a -= w1 * w2;
	
			printf("%d %d %d %d\n", a, i, j, k);
		}
	}
	return (0);
}

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

#define Fast            ios_base::sync_with_stdio(false);cin.tie(nullptr);
#define fWrite          freopen ("out.txt","w",stdout);
#define TC              int t;cin >> t;FOR(tc,1,t)
#define LL              long long
#define ULL             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define pii             pair<int,int>
#define all(a)          a.begin(),a.end()
#define MEM(a,x)        memset(a,x,sizeof(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)

#define Make(x,p)       (x  (1<<p))
#define DeMake(x,p)     (x & ~(1<<p))
#define Check(x,p)      (x & (1<<p))
#define popcount(x)     __builtin_popcount(x)

int n;
double prob[3003];
double dp[3003][3003];
int vis[3003][3003];

double call(int i,int win){
    if(i==n){
        if(win>n-win) return 1.0;
        else return 0;
    }
    if(vis[i][win]==1) return dp[i][win];
    vis[i][win]=1;
    double a=prob[i]*call(i+1,win+1);
    double b=(1.0-prob[i])*call(i+1,win);
    return dp[i][win]=(a+b);
}

int main()
{
    cin >> n;
    REP(i,n) cin >> prob[i];
    cout << fixed << setprecision(12) << call(0,0);
}


Measured memory_bytes: 104704
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m; i<n; i++)
#define ci(n) cin >> n
#define co(n) cout << n << endl
using namespace std;

int main(){
  long a, b, n, c=0;
  cin >> a >> b >> n;
  if(a==0){
    co(b/n+1);
  }
  else if(a==b){
    if(a%n==0) co(1);
    else co(0);
  }
  else{
    c+=b/n;
    c-=(a-1)/n;
    co(c);
  }
  
  return 0;
}


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

const int MOD = 1e9 + 7;

int main( void ) {
    
    int n;
    cin >> n;
    
    int ans = 1;
    for( int i = 2; i <= n; i ++ )
        ans = ( 1LL * ans * i ) % MOD;
    
    cout << ans << endl;
    return 0;
}

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

using namespace std;
using namespace __gnu_cxx;

#define REP(i,n) for( (i)=0 ; (i)<(n) ; (i)++ )
#define rep(i,x,n) for( (i)=(x) ; (i)<(n) ; (i)++ )
#define REV(i,n) for( (i)=(n) ; (i)>=0 ; (i)-- )
#define FORIT(it,x) for( (it)=(x).begin() ; (it)!=(x).end() ; (it)++ )
#define foreach(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define rforeach(it,c) for(__typeof((c).rbegin()) it=(c).rbegin();it!=(c).rend();++it)
#define foreach2d(i, j, v) foreach(i,v) foreach(j,*i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define SZ(x) ((int)(x).size())
#define MMS(x,n) memset(x,n,sizeof(x))
#define mms(x,n,s) memset(x,n,sizeof(x)*s)
#define pb push_back
#define mp make_pair
#define NX next_permutation
#define UN(x) sort(all(x)),x.erase(unique(all(x)),x.end())
#define CV(x,n) count(all(x),(n))
#define FIND(x,n) find(all(x),(n))-(x).begin()
#define ACC(x) accumulate(all(x),0)
#define PPC(x) __builtin_popcountll(x)
#define LZ(x) __builtin_clz(x)
#define TZ(x) __builtin_ctz(x)
#define mxe(x) *max_element(all(x))
#define mne(x) *min_element(all(x))
#define low(x,i) lower_bound(all(x),i)
#define upp(x,i) upper_bound(all(x),i)
#define NXPOW2(x) (1ll << ((int)log2(x)+1))
#define PR(x) cout << #x << " = " << (x) << endl ;

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

const int OO = (int) 2e9;
const double eps = 1e-9;

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
//	freopen("in.txt", "rt", stdin);
//	freopen("out.txt", "wt", stdout);
#endif
	string s;
	cin >> s;
	if (SZ(s) > 3 && s.substr(0, 4) == "YAKI") {
		puts("Yes");
	} else {
		puts("No");
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int d = a / b;
        int r = a % b;
        double f = 1.0 * a / b;
        System.out.print(d + " " + r + " ");
        System.out.println(String.format("%.8f",f));
    }
}


Measured memory_bytes: 26592
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			String s = sc.next();

			if (n % 2 != 0) {
				System.out.println("No");
				return;
			}

			String tmp1 = s.substring(0, n / 2);
			String tmp2 = s.substring(n / 2);
			if (tmp1.equals(tmp2)) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		}
	}
}


Measured memory_bytes: 23124
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = println(solve(new Scanner(System.in)))

  def solve(in: String): String = solve(new Scanner(in))

  def solve(sc: Scanner): String = {
    val A = sc.nextInt
    val B = sc.nextInt

    val result = if ((A * B) % 2 == 0) "No" else "Yes"

    result.toString
  }
}


Measured memory_bytes: 26048
#include <iostream>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define INF 10000000000000000LL

using namespace std;
typedef long long ll;

bool is_palindrome(string &s) {
  int n = s.size();
  for (int i = 0; i < n / 2; ++i)
    if (s[i] != s[n - i - 1])
      return false;
  return true;
}

int n;
unordered_map<string, ll> memo[2];
unordered_set<string> vis[2];
vector<string> S[2];
vector<ll> C;
ll dfs(string s, int p) {
  if (memo[p].count(s))
    return memo[p][s];
  if (is_palindrome(s))
    return 0;
  if (vis[p].count(s))
    return INF;
  vis[p].insert(s);
  ll ans = INF;
  int ls = s.size();
  for (int i = 0; i < n; ++i) {
    string t = S[!p][i];
    int lt = t.size();
    int l = min(ls, lt);
    string ps = s.substr(0, l);
    string pt = t.substr(0, l);
    if (ps != pt)
      continue;
    ll cost =
        ls > lt ? dfs(s.substr(l, ls - l), p) : dfs(t.substr(l, lt - l), !p);
    if (cost < ans)
      ans = min(ans, cost + C[i]);
  }
  vis[p].erase(s);
  return ans;
}

int main() {
  cin >> n;
  S[0] = vector<string>(n);
  S[1] = vector<string>(n);
  C = vector<ll>(n);
  ll ans = INF;
  for (int i = 0; i < n; ++i) {
    cin >> S[0][i] >> C[i];
    S[1][i] = string(S[0][i].rbegin(), S[0][i].rend());
  }
  for (int i = 0; i < n; ++i)
    ans = min(ans, dfs(S[0][i], 0) + C[i]);
  cout << (ans == INF ? -1 : ans);
}


Measured memory_bytes: 3668
#include <stdio.h>

int main(void){
	int W,H,x,y,r;
	do{
		scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	}while(W<1 || H>100 || H<1 || H>100 || r<1 || r>100 || x<-100 || x>100 || y<-100 || y>100);

	if(x-r < 0)
		puts("No");
	else if(x+r > W)
		puts("No");
	else if(y - r < 0)
		puts("No");
	else if(y + r > H)
		puts("No");
	else
		puts("Yes");

	return 0;
}

Measured memory_bytes: 584
t = [[0 for i in range(10)] for j in range(10)]
case1 = [(0, 0), (0, -1), (1, 0), (0, 1), (-1, 0)]
case2 = [(1, -1), (1, 1), (-1, 1), (-1, -1)]
case3 = [(0, -2), (2, 0), (0, 2), (-2, 0)]
while True:
    try:
        x, y, s = map(int, input().split(','))
    except:
        break
    for c in [case1, case2, case3][:s]:
        for _x, _y in c:
            if y+_y < 0 or x+_x < 0:
                continue
            try:
                t[y+_y][x+_x] += 1
            except IndexError:
                continue

print(sum(1 for l in t for v in l if not v))
print(max(v for l in t for v in l))

Measured memory_bytes: 7612
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int n;
char s[maxn];
int a[maxn], b[maxn];
int solve()
{
	int k;
	for(k = (n + 3) / 2; k <= n; ++k)
		if(b[k] || b[n - k + 2])
			return k - 1;
	return n;
}
int main()
{
	scanf("%s", s + 1);
	n = strlen(s + 1);
	for(int i = 1; i <= n; ++i) a[i] = s[i] - '0';
	for(int i = 1; i <= n; ++i) b[i] = a[i] ^ a[i - 1];
	printf("%d\n", solve());
	return 0;
}

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

int main(int argc, char const *argv[]) {
    string s;
    cin >> s;
    map<char,vector<int>> mp;
    int n = s.length();
    for (int i = 2; i <= n-2; ++i) {
        mp[s[i]].push_back(i);
    }
    bool ok = true;
    if (s[0] != 'A') ok = false;
    if (mp['C'].size() != 1) ok = false;

    if (!ok) {
        cout << "WA" << endl;
        return 0;
    }
    int A = 0;
    int C = mp['C'].back();
    
    REP(i,n) {
        if (i == A || i == C) continue;
        if ('A' <= s[i] && s[i] <= 'Z') ok = false;
    }

    if (ok) cout << "AC" << endl;
    else cout << "WA" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>

using namespace std;

void b_five_dishes(void) {
	int t[5];
	int max_index = 0;
	int max_remain = 0;
	int min_time = 0;
	for (int i = 0; i < 5; i++) {
		cin >> t[i];
		if (t[i] % 10 != 0) {
			int remain = 10 - (t[i] % 10);
			if (remain >= max_remain) {
				max_remain = remain;
				max_index = i;
			}
		}
	}

	for (int i = 0; i < 5; i++) {
		if (i == max_index)continue;
		
		min_time += t[i];
		if (t[i] % 10 != 0) {
			int remain = 10 - (t[i] % 10);
			min_time += remain;
		}
	}
	min_time += t[max_index];

	cout << min_time << endl;
}
int main()
{
    b_five_dishes();

    return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main(){
  
  while(1){
  
    int T, D, L;
    
    cin>>T>>D>>L;
    if( !T && !D && !L ) break;
    
    int ans = 0, prev = -1e9;
    
    for(int i=0;i<T;i++){
      
      int x;
      cin>>x;

      if( i <= prev + D ) ans++;
      
      if( x >= L ) prev = i;
      
    }
    
    cout<<ans<<endl;
    
  }
  
  return 0;
}



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

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
//  ba;
signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n, a, b;
  cin >> n >> a >> b;
  int res = 0;
  repz(i, 1, n + 1) {
    int sum = 0;
    int temp = i;
    while (temp > 0) {
      sum += temp % 10;
      temp /= 10;
    }
    if (sum >= a and sum <= b) res += i;
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
from fractions import gcd

n = int(input())
A = list(map(int, input().split()))

L, R = [0] * (n + 1), [0] * (n + 1)
for i in range(n):
    L[i + 1] = gcd(L[i], A[i])
    R[n - i - 1] = gcd(R[n - i], A[n - i - 1])
ans = 0
for i in range(n):
    ans = max(ans, gcd(L[i], R[i + 1]))

print(ans)

Measured memory_bytes: 16612
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
	int a,b,c,m,n,f,sum=0;
	cin>>a>>b>>c>>m>>n;
	if(a+b>=2*c) f=2*c;
	else f=a+b;
	if(m>=n)
	{
		sum+=n*f;
		m-=n;
		n=0;
		if(a>=2*c)
		{
			sum+=m*2*c;
		}
		else
		{
			sum+=m*a;
		}
	}
	else
	{
		sum+=m*f;
		n-=m;
		m=0;
		if(b>=2*c)
		{
			sum+=n*2*c;
		}
		else
		{
			sum+=n*b;
		}
	}
	cout<<sum;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int main() {
  int N; cin >> N;
  for(int i = 1; i <= N; ++i) {
    int ans = 0;
    bool flag = false;
    for(int k = 1; k <= N; ++k) {
      int x = k * k;
      for(int m = 1; m <= N; ++m) {
        int y = m * m;
        ll res = x + y + (k * m);
        if(res > i) {
          break;
        }
        for(int l = 1; l <= N; ++l) {
          int z = l * l;
          ll tmp = x + y + z + (k * m) + (m * l) + (l * k);
          if(tmp > i) {
            break;
          }
          if(i == tmp) {
            ans++;
          }
        }
      }
    }
    cout << ans << endl;
  }
}

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

typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100003;

ll rui(ll a,ll b){
    if(b==1) return a%mod;
    else if(b==0) return 1;
    else if(b%2==0) return (rui(a,b/2)*rui(a,b/2))%mod;
    else return (rui(a,b-1)*a)%mod;
}

ll comb(ll a,ll b){
    ll ans=1;
    for(ll i=a;i>a-b;i--){
        ans=ans*i%mod;
    }
    for(ll i=1;i<=b;i++){
        ans=(ans*rui(i,mod-2))%mod;
    }
    return ans;
}

int main(){
   
    ll N,K;cin>>N>>K;
    if((N+1)/2>=K){
        for(ll i=1;i<=K;i++){
            ll ans=1;
            ans*=comb(K-1,i-1);
            ans=ans%mod;
            ans*=comb(N-K+1,i);
            ans=ans%mod;
            cout<<ans<<endl;
        }
    }else{
        for(ll i=1;i<=(N+1)/2;i++){
            ll ans=1;
            ans*=comb(K-1,i-1);
            ans=ans%mod;
            ans*=comb(N-K+1,i);
            ans=ans%mod;
            cout<<ans<<endl;
        }
        for(ll i=(N+1)/2+1;i<=K;i++){
            cout<<0<<endl;
        }
    }
    
}



Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	var flg bool
	fmt.Scan(&n)
	
	flg = false
	for i := 1; i < 10; i++ {
		for j:= 1; j < 10; j++ {
			if i * j == n {
				flg = true
			}
		}
	}
	
	if flg {
		fmt.Printf("%s","Yes")
	} else {
		fmt.Printf("%s","No")
	}
}

Measured memory_bytes: 512
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author NikuKyabe
 */

#include <iostream>
#include <fstream>

#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define RFOR(i,a,b) for(int i = (int)(b-1);i>=(int)(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " <<
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

class ACurtain {
public:
	void solve(std::istream& in, std::ostream& out) {
    int a,b;
    in >> a >> b;
    out << max(a - b * 2, 0ll) << endl;
	}
};


signed main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout.precision(20);
	ACurtain solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

int32_t main() {
    int a,b,c,x,y;
    cin >> a >> b >> c >> x >> y;
    int ans = 0;
    if(2LL*c <= a+b){
    	ans += 2LL*c*min(x,y);
    	int tira = min(x,y);
    	x -= tira;
    	y -= tira;
    }
    else {
    	ans += x*a + y*b;
    	x = 0;
    	y = 0;
    }
    if(x == 0){
    	swap(x,y);
    	swap(a,b);
    }
    if(2*c <= a){
    	ans += 2*c*x;
    }
    else {
    	ans += x*a;
    }
    cout << ans << endl;
}

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

using namespace std;

typedef vector<int> vi;

int x;

vi str2vi(string s) {
  vi ret(127);
  
  reverse(s.begin(), s.end());
  
  for(int i=0; i<126; i++) {
	if(i<s.size()) ret[i] = s[i]=='X' ? x : s[i]-'0';
  }
  
  return ret;
}

vi pls(string s1, string s2) {
  vi ret(127);
  vi v1, v2;

  v1 = str2vi(s1), v2 = str2vi(s2);
  
  for(int i=0; i<126; i++) {
	ret[i] += v1[i]+v2[i];
	
	while(ret[i]>9) {
	  ret[i+1]++;
	  ret[i]-=10;
	}
  }
  return ret;
}

bool check(string s) {
  return !(s.size() > 1 && s[0] == 'X');
}

int main() {
  string str;
  string s1, s2, rhs;
  while(cin >> str) {
	int ppos = str.find("+");
	int epos = str.find("=");
	rhs = str.substr(epos+1);
	s1 = str.substr(0, ppos);
	s2 = str.substr(ppos+1, epos-ppos-1);
	
	//cout << s1 << " " << s2 << " " << rhs << endl;
	
	int ans = -1;
	for(x=0; x<10; x++) {
	  if((x || (check(s1) && check(s2) && check(rhs)))
		 && pls(s1, s2) == str2vi(rhs)) {
		ans = x;
		break;
	  }
	}
	
	if(ans == -1) cout << "NA";
	else cout << ans;
	cout << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1220
// Half and Half
// 所要時間 分
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
using P = pair<int, int>;

int main() {

    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;

    int ans = 0;
    if(a + b > 2 * c){
        ans += min(x, y) * 2 * c;
        if(x > y){
            x -= y;
            y = 0;
            if(a * x < 2 * c * x){
                ans += a * x;
            }
            else{
                ans += 2 * c * x;
            }
        }
        else{
            y -= x;
            x = 0;
            if(b * y < 2 * c * y){
                ans += b * y;
            }
            else{
                ans += 2 * c * y;
            }
        }
    }
    else{
        ans += x * a + y * b;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
ll gcd(ll a, ll b) {
    if (a % b == 0) return b;
    return gcd(b, a % b);
}
vector<ll> genPrime(ll n) {
    vector<ll> ret;
    for (ll i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            ret.push_back(i);
            n /= i;
        }
    }
    if (n != 1) ret.push_back(n);
    ret.erase(unique(ret.begin(), ret.end()), ret.end());
    return ret;
}
int main() {
    ll A, B;
    cin >> A >> B;
    cout << genPrime(gcd(A, B)).size() + 1 << endl;
}

Measured memory_bytes: 256
n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(1,n -1):
    if p[i - 1] < p[i] < p[i + 1] or p[i - 1] > p[i] > p[i +1]:
        ans += 1
    else:
        pass
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long 
#define pb push_back
#define ff first
#define ss second
#define setbits(x)          __builtin_popcountll(x)
#define lp(a,n) for(ll i=a; i<n; i++)
#define lpi(a,n) for(int i=a; i<n; i++)
#define w(t) int t; cin>>t; while(t--)
#define vi vector<int> 
#define vll vector<ll>
#define pll pair<ll, ll>
#define pii pair<int, int>
#define inf 1e9
#define LB lower_bound
#define UB upper_bound
const int mod = 1000000007;
using namespace std;
ll gcd(ll a,ll b){
    if(a==0)return b;
    return gcd(b%a,a);
}
ll lcm(ll a, ll b){
    return (a*b)/gcd(a,b);
}

int prime[100007];
void SieveOfEratosthenes(int n) 
{ 
    memset(prime, -1, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
         
        if (prime[p] == -1) 
        { 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = p; 
        } 
    } 
    
} 
int lps(string s){
    int len = 0;
    int n = s.length();
    int dp[n];
    dp[0] = 0;
    for(int i=1; i<n; i++){
        if(s[i] == s[len]){
            len++;
            dp[i] = len;
            continue;
        }
        if(len!=0){
            len = dp[len-1];
            i--;
            continue;
        }
        dp[i]=0;
    }
    return dp[n-1];
}
 
ll power(unsigned ll x,unsigned  ll y) 
{ 
    ll res = 1;     
    while (y > 0) 
    { 
        if (y & 1) 
            res = res*x; 
   
        y = y>>1;
        x = x*x;  
    } 
    return res; 
}

//to calculate p1^x  *  p2^x2  *p3^x3 ----------
//i.e. prime factorization and store pi and xi in vector 
vector<pair<ll, ll>> pFactor;

void factorize(long long n) 
{ 
    int count = 0; 
  
    // count the number of times 2 divides  
    while (!(n % 2)) { 
        n >>= 1; // equivalent to n=n/2; 
        count++; 
    } 
  
    // if 2 divides it 
    if (count) 
        pFactor.pb({2,count}); 
  
    // check for all the possible numbers that can  
    // divide it 
    for (long long i = 3; i <= sqrt(n); i += 2) { 
        count = 0; 
        while (n % i == 0) { 
            count++; 
            n = n / i; 
        } 
        if (count) 
            pFactor.pb({i,count});
    } 
  
    // if n at the end is a prime number. 
    if (n > 2) 
        pFactor.pb({n,1}); 
} 



int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
   int i=1;
   for(int j=0; j<5; j++){
       int n;
       cin>>n;
       if(n==0){
          cout<<i<<endl;
          break;
           
       }
       i++;
   }
   
}

Measured memory_bytes: 3532
#include <iostream>
#include <string.h>
#include <algorithm>
#include <array>
#include <vector>

using namespace std;

int main( void ) {

    int price = 700;
    string s;
    cin >> s;

    price += (s[0] == 'o') ? 100 : 0;
    price += (s[1] == 'o') ? 100 : 0;
    price += (s[2] == 'o') ? 100 : 0;

    cout << price << endl;
    
    return 0;   
}

Measured memory_bytes: 256
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
# import statistics
import bisect
import copy
import fractions
import math
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))
def unite(x, y):
    # それぞれのノードの根を求める
    x = root(x)
    y = root(y)
    if x == y:
        return
    # node[x]の根をyに変更する
    node[x] = y
def same(x,y): return bool(root(x) == root(y))
def root(x):
    if node[x] == x:  # xが根の場合
        return x
    else:
        node[x] = root(node[x])  # 経路圧縮
        return node[x]
def dfs(v):
    # ノードに訪れた
    visited[v] = True
    for v2 in range(n):
        if graph[v][v2] == False:  # そもそもvとv2が辺でつながっていない
            continue
        if visited[v2] == True:  # もう見た
            continue
        dfs(v2)


n, a, b = MI()
ans = 0
for i in range(1, n+1):
    if a <= sum([int(i) for i in str(i)]) <= b:
        ans += i
print(ans)




Measured memory_bytes: 71016
//

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

int main()
{
  int N, K;
  cin >> N;
  cin >> K;
  int kyori;
  for (int i = 0; i < N; i++)
  {
    int x;
    cin >> x;
    if (x <= K - x)
    {
      kyori += x * 2;
    }
    else
    {
      kyori += (K - x) * 2;
    }
  }
  cout << kyori << endl;
}


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

int main() {
  string s,ans="WA";
  cin>>s;
  map<string,int> cnt;
  if(s[0]=='A'){
    for(int i=2; i<s.size()-1; i++){
      if(s[i]=='C'){
        cnt["C"]++;
      }
    }
    if(cnt["C"]==1){
      int A=0;
      rep(j,s.size()){
        int p=s[j];
        if(65<=p&&p<=90){
          A++;
        }
      }
      if(A==2){
        ans="AC";
      }
    }
  }
  cout<<ans<<endl;
}

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

bool is_triangle(ll a, ll b, ll c)
{
    return a + b > c
        && b + c > a
        && c + a > b
        && a != b
        && b != c
        && c != a;
}

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

    vector<ll> L(N);
    rep (i, N) {
        cin >> L[i];
    }

    int ret = 0;
    for (int i = 0; i < N - 2; ++i) {
        for (int j = i + 1; j < N - 1; ++j) {
            for (int k = j + 1; k < N; ++k) {
                if (is_triangle(L[i], L[j], L[k])) {
                    ++ret;
                }
            }
        }
    }

    cout << ret << endl;
}


Measured memory_bytes: 3600
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		long N = long.Parse(str[0]);
		long M = long.Parse(str[1]);
		long Q = long.Parse(str[2]);
		long[,] A = new long[N+1,N+1];
		for(var i=0;i<M;i++){
			string[] str2 = Console.ReadLine().Split();
			long L = long.Parse(str2[0]);
			long R = long.Parse(str2[1]);
			A[L,R] += 1;
		}
		long[,] B = new long[N+1,N+1];
		for(var i=1;i<=N;i++){
			B[i,i] = A[i,i];
			for(var j=i+1;j<=N;j++){
				B[i,j] = B[i,j-1];
				for(var k=i;k<=j-1;k++){
					B[i,j] += A[k,j];
				}
				for(var k=i;k<=j;k++){
					B[i,j] += A[j,k];
				}
			}
		}
		for(var i=0;i<Q;i++){
			string[] str3 = Console.ReadLine().Split();
			long p = long.Parse(str3[0]);
			long q = long.Parse(str3[1]);
			Console.WriteLine(B[p,q]);
		}
	}
}

Measured memory_bytes: 21536
# include <iostream>
# include <string>
# include <cctype>
# include <vector>
# include <cstdlib>
# include <cstring>
# include <algorithm>
# include <iomanip>
# include <cmath>

using namespace std ;

const double pi=acos(-1.0) ;//也可以用cmath中的M_PI
int main()
{
    ios::sync_with_stdio(false) ;
    int a ;
    while(cin>>a)
	{
		if(a<4)
		{
			cout << "No" << endl ;
			continue ;
		}
		
		int tmp=a ;
		int num=a/4 ;
		int flag=0 ;
		for(int i=0;i<=num;i++)
		{
			for(int j=0;j<=num;j++)
			{
				if(i*4+j*7==tmp)
				{
					flag=1 ;
					break ;
				}
			}
		}
		
		if(flag)
		cout << "Yes" << endl ;
		else
		cout << "No" << endl ;
	} 
	return 0 ;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;

int main(void)
{
    int N;
    cin >> N;

    if (N == 1)
    {
        cout << "Hello World" << endl;
    }
    else
    {
        int A, B;
        cin >> A >> B;

        cout << A + B << endl;
    }
    return (0);
}

Measured memory_bytes: 384
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cstdint>   // int64_t, int*_t
#include <cstdio>    // printf
#include <deque>     // deque
#include <iomanip>
#include <iostream> // cout, endl, cin
#include <map>      // map
#include <math.h>
#include <numeric>
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <string>        // string, to_string, stoi
#include <tuple>         // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define chmin(x, y) x = min(x, y)
const int INF = 1001001001;
const int BG = 1000000007;

int main()
{
    int N, R;
    cin >> N >> R;
    if (N >= 10)
    {
        cout << R << endl;
    }
    else
    {
        cout << R + (100 * (10 - N)) << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

#include <set>
#include <map>
#include <iomanip>

using namespace std;

#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define rrep(i, n) for(long long i = (long long)(n - 1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()

using ll = long long;

int main()
{
	int h, a;
	cin >> h >> a;

	cout << ceil(h / (double)a) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int h, w, k;
    cin >> h >> w >> k;
    vector<vector<ll>> a(h, vector<ll>(w));
    for (int i = 0; i < k; i++) {
        int r, c;
        cin >> r >> c;
        r--, c--;
        cin >> a[r][c];
    }
    vector<vector<vector<ll>>> dp(h, vector<vector<ll>>(w, vector<ll>(4)));
    dp[0][0][1] = a[0][0];
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (i) {
                dp[i][j][0] = dp[i - 1][j][3];
                dp[i][j][1] = dp[i - 1][j][3] + a[i][j];
            }
            for (int l = 0; l < 4; l++) {
                if (j) {
                    dp[i][j][l] = max(dp[i][j][l], dp[i][j - 1][l]);
                    if (l) {
                        dp[i][j][l] = max(dp[i][j][l], dp[i][j - 1][l - 1] + a[i][j]);
                    }
                }
                if (l) {
                    dp[i][j][l] = max(dp[i][j][l], dp[i][j][l - 1]);
                }
            }
        }
    }
    debug(dp);
    cout << dp[h - 1][w - 1][3] << '\n';
    return 0;
}


Measured memory_bytes: 706648
// Submitted By SUbhash Yadav

import java.util.*;
import java.lang.*;
import java.io.*;


public class Main
{
	
	public static void main (String[] args) throws java.lang.Exception
	{
		
		FastScanner sc=new FastScanner();
		int t=sc.nextInt();
		int ans=0;
		if(t>=400&&t<600) ans=8;
		else if(t>=600&&t<800) ans=7;
		else if(t>=800&&t<1000) ans=6;
		else if(t>=1000&&t<1200) ans=5;
		else if(t>=1200&&t<1400) ans=4;
		else if(t>=1400&&t<1600) ans=3;
		else if(t>=1600&&t<1800) ans=2;
		else if(t>=1800&&t<2000) ans=1;
		
		System.out.println(ans);
		
		}
		static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
}
}


Measured memory_bytes: 32796
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
ll MOD = 1000000007;
ll INF = 214748364700000000;
double EPS = 1e-12;
double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;

ll F[100010];
ll fact(ll x){
    if(x == 0) return F[0] = 1;
    if(F[x] != 0) return F[x];
    F[x] = fact(x-1)*x%MOD;
    return F[x];
}

ll modpow(ll a,ll n,ll m){//modpow(a,n,m) := a ^ n (mod m)
  ll res = 1;
  while(n > 0){
    if(n & 1)res = res * a % m;
    a = a * a % m;
    n >>= 1;
  }
  return res;
}

int main(){
   ll m = fact(100001);
   ll N;cin >> N;
   vector<ll> X(N);
   rep(i,N) cin >> X[i];
   ll coeff = 0,ans = 0;
   FOR(i,1,N){
       coeff += (F[N-1] * modpow(i,MOD-2,MOD)) % MOD;
       ans += (X[i]-X[i-1]) * coeff;
       ans %= MOD;
   }
   cout << ans << endl;
}


Measured memory_bytes: 3328
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

//std::cout << std::fixed << std::setprecision(10)
constexpr long long MOD = 1000000007;

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

int main()
{
  long long h, w;
  std::cin >> h >> w;
  long long ans;
  if(h == 1 || w == 1)
    ans = 1;
  else if (h % 2 == 0)
    ans = w * (h/2);
  else if (w % 2 == 0)
    ans = h * (w/2);
  else
    ans = ((h+1)/2)*((w+1)/2) + ((h-1)/2)*((w-1)/2);
  std::cout << ans << std::endl;
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 100005;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int val = 0;
    bool flag = false;
    rep(i,n){
        int a;
        cin >> a;
        if(a % 2) flag = true;
        val ^= a;
    }
    if(val >= 2 || (val == 0 && flag)){
        cout << "Alice\n";
    }else{
        cout << "Bob\n";
    }
    return 0;
}



Measured memory_bytes: 3232
// #include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) (((x) < 0)?-(x):(x))
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

using cat = long long;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

cat M;

int encode(int s0, int s1, int mx0, int mx1) {
	return (s0 << 24) + (s1 << 16) + (mx0 << 8) + mx1;
}

map<int, cat> states[200];

cat solve_2(int N, int K, int pos, int s0, int s1, int mx0, int mx1) {
	if(pos == N) return (mx0 == N && mx1 == N);
	if(mx0 < pos || mx1 < pos) return 0;
	s0 = min(s0, K/2+1);
	s1 = min(s1, K/2+1);

	auto it = states[pos].find(encode(s0, s1, mx0, mx1));
	if(it != states[pos].end()) return it->ss;

	// remove
	int mx0_nw = N, mx1_nw = N;
	if(pos%2 == 0 && 2*s1-1 >= K) mx1_nw = pos + K - 2 * min(K/2, s0);
	if(pos%2 == 1 && 2*s0-1 >= K) mx0_nw = pos + K - 2 * min(K/2, s1);
	int s0_nw = s0 + (pos%2 == 0), s1_nw = s1 + (pos%2 == 1);
	cat ret1 = solve_2(N, K, pos+1, s0_nw, s1_nw, min(mx0, mx0_nw), min(mx1, mx1_nw));

	// don't remove
	s0_nw = (pos%2 == 0) ? 0 : s0, s1_nw = (pos%2 == 1) ? 0 : s1;
	cat ret2 = solve_2(N, K, pos+1, s0_nw, s1_nw, (pos%2==0)?N:mx0, (pos%2==1)?N:mx1);

	states[pos][encode(s0, s1, mx0, mx1)] = (ret1 + ret2) % M;
	return (ret1 + ret2) % M;
}

cat solve_1(int N, int K) {
	vector< vector<cat> > dp(N+1, vector<cat>(K+1, 0));
	dp[0][0] = 1;
	for(int i = 0; i < N; i++) {
		for(int j = 0; j <= K; j++) dp[i+1][0] += dp[i][j];
		for(int j = 0; j < K; j++) dp[i+1][j+1] += dp[i][j];
		for(int j = 0; j <= K; j++) dp[i+1][j] %= M;
	}
	cat ret = 0;
	for(int i = 0; i <= K; i++) ret += dp[N][i];
	ret %= M;
	return ret;
}

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int N, K;
	cin >> N >> K >> M;
	if(K%2 == 0 || K == 1) {
		if(K == 1) cout << solve_1(N, 2) << "\n";
		else cout << solve_1(N/2, K/2) * solve_1(N-N/2, K/2) % M << "\n";
	}
	else cout << solve_2(N, K, 0, 0, 0, N, N) << "\n";
	return 0;
}

// look at my code
// my code is amazing


Measured memory_bytes: 18432