akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#define N 101
#define ll long long
int a[N][N],b[N][N],c[N*N],d[N*N],e[N],f[N][N],g[N][N],i,j,k,l,m,n,o,p,s,t;
int main()
{
    scanf("%d%d%d%d",&m,&n,&o,&p);
    for(*e=e[1]=f[0][0]=1,i=2;i<=m||i<=n;i++)e[i]=(ll)(p-p/i)*e[p%i]%p;
    for(i=2;i<=m||i<=n;i++)e[i]=(ll)e[i]*e[i-1]%p;
    for(*c=*d=i=1;i<=o;i++)
    {
        for(j=0,s=t=1;j<=n;j++,s=(ll)s*i%p,t=t*(i-1ll)%p)for(*a[j]=k=1;k<=m;k++)a[j][k]=(ll)a[j][k-1]*(p+s-t)%p;
        for(j=0,s=t=1;j<=m;j++,s=s*(o-i+1ll)%p,t=(ll)t*(o-i)%p)for(*b[j]=k=1;k<=n;k++)b[j][k]=(ll)b[j][k-1]*(p+s-t)%p;
        for(j=1,s=m*n;j<=s;j++)c[j]=(ll)c[j-1]*i%p;
        for(j=1;j<=s;j++)d[j]=d[j-1]*(o-i+1ll)%p;
        for(j=0;j<=m;j++)for(k=0;k<=n;f[j][k++]=0)for(l=0;j+l<=m;l++)g[j+l][k]=(g[j+l][k]+(ll)f[j][k]*e[l]%p*a[n-k][l]%p*d[k*l])%p;
        for(j=0;j<=m;j++)for(k=0;k<=n;g[j][k++]=0)for(l=0;k+l<=n;l++)f[j][k+l]=(f[j][k+l]+(ll)g[j][k]*e[l]%p*b[j][l]%p*c[(m-j)*l])%p;
    }
    for(s=f[m][n],i=1;i<=m;i++)s=(ll)s*i%p;
    for(i=1;i<=n;i++)s=(ll)s*i%p;
    return 0*printf("%d\n",s);
}

Measured memory_bytes: 384
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;


//mod演算ライブラリ
//mod=1000000007

LL add(LL a,LL b){
  return (a+b)%mod;
}

LL sub(LL a,LL b){
  return (a+mod-b)%mod;
}

LL mul(LL a,LL b){
  return ((a % mod) * (b % mod)) % mod;
}

LL power(LL x,LL y){//繰り返し二乗法 単品利用可
  if(y==0)return 1;
  else if(y==1)return x%mod;
  else if(y%2==0){
    LL tmp=power(x, y/2) % mod;
    return tmp*tmp%mod;
  }else {
    LL tmp=power(x, y/2) % mod;
    return ((tmp*tmp)%mod)*x%mod;
  }
}

LL dvs(LL a,LL b){
  return mul(a,power(b,mod-2));
}

const int SIZE_mod=200005;
int invfact[SIZE_mod];
int fact[SIZE_mod];

LL factset(int a){//aまでの階乗%mod表を作成
  fact[0]=1;
  FORQ(i,1,a){
    fact[i]=mul(fact[i-1],i);
  }
}

LL cmbset(int a){//1~aまでの階乗と階乗数の逆元のmod(mod)を用意 O(a)
  factset(a);
  invfact[a]=power(fact[a],mod-2);
  invfact[0]=1;
  FORD(i,a,1){
    invfact[i]=mul(invfact[i+1],i+1);
  }

}

LL cmb(int n,int r){//nCr%mod  (cmbset後に使用)
  if(n<r||r<0||n<0)return 0;
  return mul(fact[n],mul(invfact[r],invfact[n-r]));
}

LL prm(int n,int r){//nPr%mod
    return mul(cmb(n,r),fact[n]);
}

LL homo(int n,int r){//nHr%mod
  return cmb(n+r-1,r);
}


int main(){
	string s;
	cin>>s;
	int d;
	cin>>d;
	int n=s.length();
	vector<LL> dp(d,0);
	vector<LL> dp2(d,0);
	vector<LL> dp3(d,0);
	vector<LL> dp4(d,0);
	dp[0]=1;
	FORD(rpt,n,0){
		int nw=s[rpt]-'0';
		FOR(i,0,d){
			FOR(j,0,nw+1){
				int nx=(i+j)%d;
				if(j==nw){
					dp2[nx]=add(dp[i],dp2[nx]);
					dp4[nx]=add(dp3[i],dp4[nx]);
					break;
				}
				dp2[nx]=add(dp[i],dp2[nx]);
				dp2[nx]=add(dp3[i],dp2[nx]);
			}

			FOR(j,nw+1,10){
				int nx=(i+j)%d;
				dp4[nx]=add(dp[i],dp4[nx]);
				dp4[nx]=add(dp3[i],dp4[nx]);
			}
		}
		swap(dp,dp2);
		dp2=vector<LL>(d,0);
		swap(dp3,dp4);
		dp4=vector<LL>(d,0);
	}
	cout<<sub(dp[0],1)<<endl;
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma warning(disable:4996)
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>
#include <set>
#include <map>
#include <iomanip> 
#include <ctime>
#include <numeric>
#include <cassert>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<string, int> P;
typedef vector<vector<int>> Graph;

const double PI = 3.14159265358979323846;
const int mod = 1000000007;



int main(int argc, char *args[]) {
	string s; cin >> s;
	int n = s.size();
	bool ok = true;
	for (int i = 0; i < n; i++) {
		if (s[i] != s[n - 1 - i]) {
			ok = false;
		}
		//cout << s[i] << " " << s[n - 1 - i] << endl;;
		//cout << i << " " << n - i << " " << ok << endl;
	}
	//cout << ok << endl;
	int mid = (n - 1) / 2;
	//cout << mid << endl;
	for (int i = 0; i < mid; i++) {
		if (s[i] != s[mid  - 1 - i]) ok = false;
		//cout << s[i] << " " << s[mid - 1 - i] << endl;;
		//cout << i << " " << n - i << " " << ok << endl;
	}
	//cout << ok << endl;
	mid = (n + 3) / 2;
	//cout << mid << endl;
	for (int i = mid - 1; i < n; i++) {
		if (s[i] != s[n  - 1 - i]) ok = false;
		//cout << s[i] << " " << s[n - 1 - i] << endl;;
		//cout << i << " " << n - i << " " << ok << endl;
	}
	//cout << ok << endl;
	if (ok) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;

int main(){
  int N, W, H;
  while(cin>>H>>W>>N &&( H || W || N )){
    int dp[1002][1002] = {};
    int grid[1002][1002];
    REP(y, H)REP(x, W) cin>>grid[y][x];
    dp[0][0] = N - 1;
    REP(y,H)REP(x,W){
      dp[y+1][x] += (dp[y][x] + !grid[y][x])/2;
      dp[y][x+1] += (dp[y][x] +  grid[y][x])/2;
    }
    REP(y,H)REP(x,W){
      grid[y][x] ^= dp[y][x] % 2;
    }
    int nx = 0, ny = 0;
    while(nx < W && ny < H){
      if(grid[ny][nx] == 0) ny++;
      else if(grid[ny][nx] == 1) nx++;
    }
    assert(nx == W || ny == H);
    printf("%d %d\n",ny + 1, nx + 1);
  }
  return 0;
}

Measured memory_bytes: 8716
#include <stdio.h>

void ShowData(int x[], int n);
void Swap(int x[], int i, int j);
void QSort(int x[], int left, int right);
void Input(int x[], int n);

int main()
{
	int hight[10] = {0};
	int i;
	Input(hight, 10);
	QSort(hight, 0, 9);
	
	for (i = 9; i >= 7; i--) {
		printf("%d\n", hight[i]);
	}

	return 0;
}

// ?????????????????¨???
void ShowData(int x[], int n)
{
	int i;
	for (i = 0; i < n; i++) {
		printf("%d ", x[i]);
	}
	printf("\n");
}

// ?????????????´??????????
void Swap(int x[], int i, int j)
{
	int temp;

	temp = x[i];
	x[i] = x[j];
	x[j] = temp;
}

// ?????????????????????
void QSort(int x[], int left, int right)
{
	int i, j;
	int pivot;
	
	i = left;
	j = right;

	pivot = x[(left + right) / 2];

	while (1) {
		while (x[i] < pivot) {
			i++;
		}
		while (x[j] > pivot) {
			j--;
		}
		if (i >= j) {
			break;
		}
		Swap(x, i, j);
		i++;
		j--;
	}

	if (left < i - 1)              /* ?????????????????? 2 ??\???????´????????????° */
		QSort(x, left, i - 1);     /* ??????????????? Q ??????????????? */
	if (j + 1 <  right)            /* ?????????????????? 2 ??\???????´????????????° */
		QSort(x, j + 1, right);    /* ??????????????? Q ??????????????? */
}

// ??\???
void Input(int x[], int n)
{
	int i;
	for (i = 0; i < n; i++) {
		scanf("%d", &x[i]);
	}
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define N 200006
#define mo 1000000007
using namespace std;
int n,T,x,y,ans;
int main()
{
	scanf("%d%d%d",&n,&T,&x);
	for(int i=2;i<=n;i++)scanf("%d",&y),ans+=min(T,y-x),x=y;
	printf("%d\n",ans+T);
}

Measured memory_bytes: 384
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    static List<Integer>[] graph;
    static int[] color;
    static long wCnt = 0;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        graph = new List[N+1];
        for (int i = 1; i <= N; i++) graph[i] = new ArrayList<Integer>();
        for (int i = 0; i < M; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            graph[a].add(b);
            graph[b].add(a);
        }
        long ans = 0;
        color = new int[N+1];
        if (dfs(0, 1, 1)) {
            ans = wCnt * (N - wCnt) - M;
        } else{
           ans = ((long) N * (N - 1)) / 2 - M;
        }
        System.out.println(ans);
        sc.close();

    }

    private static boolean dfs(int pre, int cur, int c) {
        if(color[cur] != 0){
            return color[cur] == c;
        }
        color[cur] = c;
        if(c == 1) wCnt++;
        boolean ret = true;
        for(int i = 0; i < graph[cur].size(); i++){
            int x = graph[cur].get(i);
            if(x == pre) continue;
            ret &= dfs(cur, x, -c);
        }

        return ret;
    }

}


Measured memory_bytes: 105480
w,h,x,y = gets.split(" ").map{|n|n.to_i}
if w%2 == 0 && h%2 == 0 && [x,y] == [(w/2), (h/2)]
  puts "#{w*h/2.0} #{1}"
else
  puts "#{w*h/2.0} #{0}"
end

Measured memory_bytes: 1788
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

struct PRODUCT {
	char name[10];
	int num;
	struct PRODUCT* next;
	struct PRODUCT* prev;
};

struct PRODUCT HashTable[6];

void Add(char name[], int num) {
	struct PRODUCT* pos;
	struct PRODUCT* newpro = (struct PRODUCT*)malloc(sizeof(struct PRODUCT));
	strcpy(newpro->name, name);
	newpro->num = num;
	if (HashTable[strlen(name)].next == &HashTable[strlen(name)]) {
		HashTable[strlen(name)].next = newpro;
		HashTable[strlen(name)].prev = newpro;
		newpro->next = &HashTable[strlen(name)];
		newpro->prev = &HashTable[strlen(name)];
		return;
	}
	for (pos = HashTable[strlen(name)].next; pos != &HashTable[strlen(name)]; pos = pos->next) {
		if (!strcmp(name, pos->name)) {
			pos->num += num;
			return;
		}
		else if (strcmp(name, pos->name) < 0) {
			newpro->prev = pos->prev;
			newpro->next = pos;
			pos->prev = newpro;
			newpro->prev->next = newpro;
			return;
		}
	}
	newpro->prev = HashTable[strlen(name)].prev;
	newpro->next = &HashTable[strlen(name)];
	HashTable[strlen(name)].prev = newpro;
	newpro->prev->next = newpro;
	return;
}

int main() {
	int N;
	char s[10];
	int num;
	for (int i = 0; i < 6; i++) {
		HashTable[i].next = &HashTable[i];
		HashTable[i].prev = &HashTable[i];
	}
	//def
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%s %d", s, &num);
		Add(s, num);
	}
	for (int i = 1; i < 6; i++) {
		for (struct PRODUCT* pos = HashTable[i].next; pos != &HashTable[i]; pos = pos->next) {
			printf("%s %d\n", pos->name, pos->num);
		}
	}
	return 0;
}


Measured memory_bytes: 2232
import java.util.*;
import java.lang.*;
import java.io.*;
class Main
{
    public static void main (String[] args)
    {
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        int arr[]=new int[n];
        for (int i = 0; i < arr.length; i++) {
            arr[i]=in.nextInt();
        }
        long ans=0;
        for (int i = 0; i < n; i++) {
            int temp=0;
            int t=arr[i];
            if(t%2==0) {
                while (t %2==0) {
                    t = t / 2;
                    temp++;
                }
            }
            ans+=(long)temp;
        }
        System.out.println(ans);

    }

}

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

typedef long long ll;
typedef pair<int,int> P;
ll const mod = 1e9+7;

#define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

int main() {
    string s;
    cin >> s;
    int n = s.size();
    vector<ll> dp0(n+1,0),dp1(n+1,0);
    dp0[0] = 1;
    for (int i = 0;i < n;++i) {
        if (s[i] == '1') {
            dp0[i+1] += dp0[i]*2%mod;
            dp1[i+1] += dp0[i];
        } else {
            dp0[i+1] += dp0[i];
        }
        (dp1[i+1] += dp1[i]*3) %= mod;
    }
    cout << (dp0[n]+dp1[n])%mod << endl;
    return 0;
}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

template<typename T>
constexpr T inf = static_cast<T>(pow(10, static_cast<int>(log10(numeric_limits<T>::max())))) + 7;
constexpr llong mod = 1e9+7;

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

	if (N % 2 == 1) {
		cout << 0 << endl;
	}
	else {
		uint64_t five = 0;
		uint64_t f = 5;
		while (f <= N) {
			five += N/(f*2ll);
			f *= 5ll;
		}

		cout << five << endl;
	}

	return 0;
}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,y;cin >> n >> y;
	rep(i,n+1){
		for(int j=0;j+i<=n;++j){
			int k=n-i-j;
			if(i*10000+j*5000+k*1000==y){
				cout << i << " " << j << " " << k << endl;
				return 0;
			}
		}
	}
	cout << -1 << " " << -1 << " " << -1 << endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)
func solve(s string) {
    for _, st := range s{
        if st == '9' {
            fmt.Println("Yes")
            return
        }
    }
    fmt.Println("No")
}

func main() {
    var s string
    fmt.Scan(&s)
    solve(s)
}


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

int main(){
    int N, A, B;
    cin >> N >> A >> B;
    int x, y;
    x = N * A;
    y = B;
    if(x < y){
        cout << x <<endl;
    }
    else{
        cout << y<< endl;
    }
}


Measured memory_bytes: 256
using System;
using System.Linq;

namespace agc_011_a
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] member = new int[x[0]];
            for (int i = 0; i < x[0]; i++)
            {
                member[i] = int.Parse(Console.ReadLine());
            }
          
            Array.Sort(member);
            int bus = 0;
            int kyaku = 0;
            int time = member[0];
            for (int i = 0; i < x[0]; i++)
            {
                kyaku++;
                if (kyaku > x[1] || member[i] - time > x[2])
                {
                    bus++;
                    kyaku = 1;
                    time = member[i];
                }
            }
            Console.WriteLine(kyaku == 0 ? bus : bus + 1);
        }
    }
}

Measured memory_bytes: 17632
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

def resolve():
    a,b,k=map(int,input().split())

    ans=[]
    if k>=b-a+1:
        for i in range(a,b+1):
            print(i)
    else:
        for i in range(a,a+k):
            ans.append(i)
        for j in range(b-k+1,b+1):
            if j not in ans:
                ans.append(j)


        for i in ans:
            print(i)


resolve()

Measured memory_bytes: 3064
#include <iostream>
#include <sstream>
#include <string>
#include <cmath>
#include <array>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <utility>
#include <iomanip>
#include <numeric>
#include <climits>
#include <algorithm>
#include <cstdint>
using namespace std;

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

    int n = min(a, b);
    while (1)
    {
        if (a % n == 0 && b % n == 0)
            k--;
        if (k == 0)
        {
            cout << n;
            break;
        }
        n--;
    }
}

Measured memory_bytes: 3632
import java.util.Arrays;
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		int v[] = new int[n];
		double sum = 0;
		for (int i = 0; i < n; i++) {
			v[i] = sc.nextInt();
		}
		Arrays.sort(v);
		sum = (v[0] + v[1]) / 2.0;
		for (int i = 2; i < n; i++) {
			sum = (sum + v[i]) / 2.0;
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 21844
job = []
N = int(input())
for i in range(N):
    job.append(list(map(int, input().split())))
temp = 0
job.sort(key=lambda x: x[0])
job.sort(key=lambda x: x[1])
for i in range(N):
    temp += job[i][0]
    if temp > job[i][1]:
        print("No")
        quit()
print("Yes")

Measured memory_bytes: 54268
#include <cstdio>
using namespace std;
int main(){
	int n,now=0;
	scanf("%d",&n);
	for(int i=0,x,y; ++i<=n; ){
		scanf("%d%d",&x,&y);
		if(x!=y){
			now=0;
			continue;
		}
		if(++now==3){
			puts("Yes");
			return 0;
		}
	}
	puts("No");
	return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//BEGIN CUT HERE
template <typename T,typename E>
struct SegmentTree{
  typedef function<T(T,T)> F;
  typedef function<T(T,E)> G;
  typedef function<E(E,E)> H;
  typedef function<E(E,int)> P;
  int n;
  F f;
  G g;
  H h;
  P p;
  T d1;
  E d0;
  vector<T> dat;
  vector<E> laz;
  SegmentTree(int n_,F f,G g,H h,T d1,E d0,
	      vector<T> v=vector<T>(),P p=[](E a,int b){return a;}):
    f(f),g(g),h(h),d1(d1),d0(d0),p(p){
    init(n_);
    if(n_==(int)v.size()) build(n_,v);
  }
  void init(int n_){
    n=1;
    while(n<n_) n*=2;
    dat.clear();
    dat.resize(2*n-1,d1);
    laz.clear();
    laz.resize(2*n-1,d0);
  }
  void build(int n_, vector<T> v){
    for(int i=0;i<n_;i++) dat[i+n-1]=v[i];
    for(int i=n-2;i>=0;i--)
      dat[i]=f(dat[i*2+1],dat[i*2+2]);
  }
  inline void eval(int len,int k){
    if(laz[k]==d0) return;
    if(k*2+1<n*2-1){
      laz[k*2+1]=h(laz[k*2+1],laz[k]);
      laz[k*2+2]=h(laz[k*2+2],laz[k]);
    }
    dat[k]=g(dat[k],p(laz[k],len));
    laz[k]=d0;
  }
  T update(int a,int b,E x,int k,int l,int r){
    eval(r-l,k);
    if(r<=a||b<=l) return dat[k];
    if(a<=l&&r<=b){
      laz[k]=h(laz[k],x);
      return g(dat[k],p(laz[k],r-l));
    }
    return dat[k]=f(update(a,b,x,k*2+1,l,(l+r)/2),
		    update(a,b,x,k*2+2,(l+r)/2,r));
  }
  T update(int a,int b,E x){
    return update(a,b,x,0,0,n);
  }
  T query(int a,int b,int k,int l,int r){
    eval(r-l,k);
    if(r<=a||b<=l) return d1;
    if(a<=l&&r<=b) return dat[k];
    T vl=query(a,b,k*2+1,l,(l+r)/2);
    T vr=query(a,b,k*2+2,(l+r)/2,r);
    return f(vl,vr);
  }
  T query(int a,int b){
    return query(a,b,0,0,n);
  }
};
//END CUT HERE
signed main(){
  int n,q;
  cin>>n>>q;
  SegmentTree<Int,Int> ch(n,
			  [](Int a,Int b){return a+b;},
			  [](Int a,Int b){return a+b;},
			  [](Int a,Int b){return a+b;},
			  0,0,vector<Int>(n,0),
			  [](Int a,int b){return a*b;});
  for(int i=0;i<q;i++){
    int c,s,t,x;
    cin>>c;
    if(c){
      cin>>s>>t;
      cout<<ch.query(s-1,t)<<endl;
    }else{
      cin>>s>>t>>x;
      ch.update(s-1,t,x);
    }
  }
}

/*
verified on 2017/10/15
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_G
*/

Measured memory_bytes: 8380
#include "bits/stdc++.h"
using namespace std;

int main() {
	int N;
	long long DP[110][4][4][4] = {}, count = 0;
	DP[0][3][3][3] = 1;
	cin >> N;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < 4; j++) {
			for (int k = 0; k < 4; k++) {
				for (int l = 0; l < 4; l++) {
					for (int m = 0; m < 4; m++) {
						if (!(k == 0 && l == 1 && m == 2) &&
							!(k == 0 && l == 2 && m == 1) &&
							!(k == 1 && l == 0 && m == 2) &&
							!(j == 0 && l == 1 && m == 2) &&
							!(j == 0 && k == 1 && m == 2)) {
							DP[i + 1][k][l][m] += DP[i][j][k][l];
							DP[i + 1][k][l][m] = DP[i + 1][k][l][m] % 1000000007;
						}
					}
				}
			}
		}
	}
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 4; j++) {
			for (int k = 0; k < 4; k++) {
				count += DP[N][i][j][k];
				count = count % 1000000007;
			}
		}
	}
	cout << count;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<=n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define pb(x) push_back(x)
#define eb(x,y) emplace_back(x,y)
#define MOD 1000000007
#define MAX 1001
#define INF 1410065408
#define EPS 1e-9
#define DEBUG 0
#define ll long long
#define Pll pair<ll, ll>
#define Pii pair<int, int>
 
using namespace std;
struct edge{int from, to; ll cost;};

signed main(){
    int n, m, k;
    cin >> n >> m >> k;
    if(n > m) swap(n, m);

    repp(i, m+1){
        repp(j, n+1){
            if(n * i - i * j + (m-i) * j == k){
                cout <<"Yes\n";
                return 0;
            }
        }
    }
    cout << "No\n";
    return 0;
}

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

int main(void) {
    string s;
    int cnt = 0;
    cin >> s;
    for(int i=0; i<s.length(); i++) {
        if(s[i] == '+') cnt++;
        if(s[i] == '-') cnt--;
    }
    cout << cnt << endl;
    return 0;
}


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

int main(){
  int N;
  cin >> N;
  int A[N+2];
  A[0] = 0, A[N+1] = 0;
  for(int i = 1; i <= N; i++) cin >> A[i];
  int sum = 0, change = 0;
  for(int i = 0; i <= N; i++) sum += abs(A[i+1]-A[i]);
  for(int i = 1; i <= N; i++) {
    cout << sum + abs(A[i+1]-A[i-1]) - abs(A[i]-A[i-1]) - abs(A[i+1]-A[i]) << endl;
  }
  return 0;
}


Measured memory_bytes: 1664
use std::cmp;
use std::io;
use std::io::{BufRead, Write};

fn solve<R: BufRead, W: Write>(mut input: R, mut output: W) {
    let mut buf = String::new();
    input.read_line(&mut buf).unwrap();
    let (n, k): (usize, usize) = {
        let mut split = buf.split_whitespace();
        (
            split.next().unwrap().parse().unwrap(),
            split.next().unwrap().parse().unwrap(),
        )
    };
    buf.clear();
    input.read_line(&mut buf).unwrap();
    let x: Vec<i64> = buf.split_whitespace().map(|x| x.parse().unwrap()).collect();
    assert!(n == x.len());
    let zero_point = x.iter().position(|&x| x > 0).unwrap_or(x.len());
    let result = (0..k + 1)
        .flat_map(|i| {
            if i <= zero_point && zero_point + k - i - 1 < x.len() {
                let a = -cmp::min(x[zero_point - i], 0);
                let b = cmp::max(0, x[zero_point + k - i - 1]);
                vec![a * 2 + b, a + b * 2]
            } else {
                vec![]
            }
        })
        .min()
        .unwrap();
    writeln!(output, "{}", result).unwrap();
}

fn main() {
    let stdin = io::stdin();
    let stdout = io::stdout();
    solve(stdin.lock(), stdout.lock());
}

#[cfg(test)]
mod tests {
    fn test(input: &str, output: &str) {
        let mut v: Vec<u8> = Vec::new();
        ::solve(input.as_bytes(), &mut v);
        assert_eq!(String::from_utf8(v).unwrap(), output);
    }

    #[test]
    fn case1() {
        test(
            "5 3
-30 -10 10 20 50
",
            "40\n",
        );
    }

    #[test]
    fn case2() {
        test(
            "3 2
10 20 30
",
            "20\n",
        );
    }

    #[test]
    fn case3() {
        test(
            "1 1
0
", "0\n",
        );
    }
    #[test]
    fn case4() {
        test(
            "8 5
-9 -7 -4 -3 1 2 3 4
",
            "10\n",
        );
    }
}


Measured memory_bytes: 6396
from collections import Counter
while 1:
 N=int(input())
 if N==0:break
 C=raw_input().split()
 for i in range(N):
  c=Counter(C[:i+1]).most_common()+[('',0)]
  if c[0][1]>c[1][1]+N-i-1:
   print c[0][0],i+1
   break
 else:print("TIE")

Measured memory_bytes: 6756
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())
s = readline().decode().rstrip()

s1 = [s[i] for i in range(1,n) if s[i-1]!=s[i]]
s2 =s[0]+"".join(s1)
print(len(s2))


Measured memory_bytes: 4020
input_line = input()
tmpa,tmpb = input_line.split()
K = int(tmpa)
N = int(tmpb)
listin = input().split()
int_s = [int(s) for s in listin]
Distance = []

for i in range(N):
  if i != N-1:
    tmp = int_s[i+1] - int_s[i]
    Distance.append(tmp)
  else:
    tmp = (K - int_s[i])+int_s[0]
    Distance.append(tmp)

print(sum(Distance)-max(Distance))

Measured memory_bytes: 87244
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int iinf = 1 << 28;
const long long llinf = 1ll << 60;
const double PI = 3.14159265;

int N, K, R, S, P;
string T;
int dp[100001][3];

int win(char c, char d) {
    if (c == 'r') {
        if (d == 's')
            return 1;
        return 0;
    }
    if (c == 's') {
        if (d == 'p')
            return 1;
        return 0;
    }
    if (c == 'p') {
        if (d == 'r')
            return 1;
        return 0;
    }
}


int main() {
    cin >> N >> K >> R >> S >> P >> T;
    for (int i = N; i >= 1; --i) {
        if (i + K > N) {
            dp[i][0] = R * win('r', T[i-1]);
            dp[i][1] = S * win('s', T[i-1]);
            dp[i][2] = P * win('p', T[i-1]);
        } else {
            int w = win('r', T[i-1]);
            dp[i][0] = (w * R) + max(dp[i+K][1], dp[i+K][2]);
            w = win('s', T[i-1]);
            dp[i][1] = (w * S) + max(dp[i+K][0], dp[i+K][2]);
            w = win('p', T[i-1]);
            dp[i][2] = (w * P) + max(dp[i+K][0], dp[i+K][1]);
        }
    }
    int ans = 0;
    for (int i = 1; i <= K; ++i) {
        ans += max(dp[i][0], max(dp[i][1], dp[i][2]));
    }

    cout << ans;


    return 0;
}


Measured memory_bytes: 1664
def input_from_console():
    n = int(input())
    w_list = list(map(int, input().split()))
    return n, w_list


def solve(n, w_list):
    min_weight = max(w_list)
    for i in range(len(w_list)):
        min_weight = min(abs(sum(w_list[0:i])-sum(w_list[i:])), min_weight)
    return min_weight


def main():
    n, w_list = input_from_console()
    print(solve(n, w_list))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  # Check if the python interpreter is in debug mode or not.
        check_cases()
    else:
        main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

template <typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
int N;

void dijk(int s, vector<vector<pair<int, int>>> &E, vector<long long> &D) {
    int vis[101010];
    for(int i = 0; i < N; i++) {
        D[i] = INF;
        vis[i] = 0;
    }

    min_priority_queue<pair<long long, int>> que;

    D[s] = 0;
    que.push({0, s});

    while(!que.empty()) {
        auto q = que.top();
        que.pop();

        auto cst = q.first;
        auto cu = q.second;

        if(vis[cu]) {
            continue;
        } else {
            vis[cu] = 1;
        }
        for(auto p : E[cu]) {
            long long cst2 = cst + p.second;
            int to = p.first;

            if(D[to] > cst2) {
                D[to] = cst2;
                que.push({D[to], to});
            }
        }
    }
}

int main() {
    int N, M;
    //箱がN個
    //鍵がM個
    // i個目の鍵はai円で販売されており
    // bi種類の箱Ci1 to Cibiをあけることができる
    cin >> N >> M;
    vector<int> a(M), b(M);
    vector<int> c(M);
    vector<vector<pair<int, int>>> Edge(1 << N);
    vector<long long> D(1 << N, INF);
    REP(i, M) {
        cin >> a[i] >> b[i];
        int encode = 0;
        REP(j, b[i]) {
            int k;
            cin >> k;
            k--;
            encode |= 1LL << k;
        }
        REP(j, 1 << N) { Edge[j].push_back(make_pair(encode | j, a[i])); }
    }
    dijk(0, Edge, D);
    ll last = 1 << N;
    last--;
    if(D[last] != INF) {
        cout << D[last] << endl;
    } else {
        cout << "-1" << endl;
    }
    return 0;
}

Measured memory_bytes: 33664
#include <iostream>
#include <string>
#include <cstdlib>
#include <map>
using namespace std;
typedef long long ll;

pair<ll,int> solve(string s, int cnt) {
	ll ans = stoll(s);
	int tmpcnt = 0;
	for (int i = 1; i < s.size(); i++) {
		string s1, s2;
		s1 = s.substr(0, i);
		s2 = s.substr(i, s.size()-i);
		pair<ll, int>res = solve(s2, cnt);
		ans += stoll(s1)*res.second;
		ans += res.first;
		tmpcnt += res.second;
	}
	tmpcnt++;
	cnt = tmpcnt;
	return make_pair(ans,cnt);
}


int main()
{
	string S; cin >> S;
	cout << solve(S,0).first << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define REP(i,n) FOR(i,0,n)
#define pb push_back
#define en "\n"
#define ITER(i,a) for( typeof(a.begin()) i=a.begin();i!=a.end();i++)
#define mod 1000000007
#define mpp make_pair
#define mes(a,b) memset((a),(b),sizeof((a))
typedef map<int,int> MI;
typedef pair<int,int>   PI;
typedef vector<int> VI;
typedef long long int LL;

int main() {
	// your code goes here
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    n=(n*(n+1))/2;
    cout<<n;
	return 0;
}

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

using i64 = int64_t;

#define rep(i, x, y) for (i64 i = i64(x), i##_max_for_repmacro = i64(y); i < i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf = 1.01e9;
const i64 inf64 = 4.01e18;
const double eps = 1e-9;

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

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

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

void solve() {
    //const i64 mod = 1'000'000'007;

    i64 N;
    cin >> N;

    using triple = tuple<i64,i64,i64>;
    vector<triple> wsv(N);
    rep(i,0,N) {
        i64 wi,si,vi;
        cin >> wi >> si >> vi;
        wsv[i]=make_tuple(wi,si,vi);
    }

    sort(begin(wsv),end(wsv),[](const triple& a, const triple& b){
       return get<0>(a)+get<1>(a)<get<0>(b)+get<1>(b);
    });

    vector<i64> w(N),s(N),v(N);
    rep(i,0,N){
        tie(w[i],s[i],v[i])=wsv[i];
    }

    const i64 maxws=20010;
    static i64 dp[maxws]; // (全体の重さ)
    fill_n((i64*)dp,maxws,-inf64);
    dp[0]=0;
    dp[w[0]]=v[0];

    rep(i,1,N){
        for(i64 j=s[i]+w[i]; j>=w[i]; --j){;
            chmax(dp[j],dp[j-w[i]]+v[i]);
        }
    }

    i64 ans=-inf64;
    rep(i,0,maxws) chmax(ans,dp[i]);

    cout << ans << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


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

using namespace std;

#define ll long long int

int main()
{
ios_base::sync_with_stdio(false);
cout.tie(NULL);
cin.tie(NULL);
              ll a,b,c,k,coun=0;
              cin>>a>>b>>c>>k;
              while(b<=a)
              {
                  b*=2;
                  coun++;
              }
              while(c<=b)
              {
                  c*=2;
                  coun++;
              }
              if(coun>k)
                cout<<"No";
              else
                cout<<"Yes";
              return(0);
}


Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
using namespace std;
int n;
int main()
{
	scanf("%d",&n);
	printf("%.2f",n*2*3.1415926);
	return 0;
	puts("当黑白之剑交叉时,那一刻就许下要永远守护你,彼此守护着对方");
}

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

using namespace std;

int n;
int dp[100000][3];

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

    cin >> n;

    for (int i = 0; i < n; i++)
        cin >> dp[i][0] >> dp[i][1] >> dp[i][2];

    for (int i = 1; i < n; i++)
    {
        dp[i][0] += max(dp[i - 1][1], dp[i - 1][2]);
        dp[i][1] += max(dp[i - 1][0], dp[i - 1][2]);
        dp[i][2] += max(dp[i - 1][0], dp[i - 1][1]);
    }

    cout << max(max(dp[n - 1][0], dp[n - 1][1]), dp[n - 1][2]);

	return 0;
}



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

int main(){
  int N, X, T;
  cin >> N >> X >> T;
  int ans = 0;
  
  while(N > 0){
    N -= X;
    ans += T;
  }
  cout << ans << endl;
  
}

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

typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define MP make_pair
#define MT make_tuple
#define F first
#define S second
#define PB push_back
#define dump(x)  cout << #x << " = " << (x) << endl;	//debug
#define SZ(x) ((ll)(x).size())
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (ll i = (a); i >= (b); i--)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;
#define pvd(v) cout << setprecision(16) << (v) << endl;
#define ALL(a)  (a).begin(),(a).end()
#define RANGE(a, start_index, num)  (a).begin()+(start_index),(a).begin()+(num)

int main() {
	string s;
	cin >> s;
	if (s.size() % 2) {
		ps(No);
		return 0;
	}
	FOR(i, 0, s.size() - 1) {
		if (i % 2) {
			if (s[i] != 'i') {
				ps(No);
				return 0;
			}
		}
		else {
			if (s[i] != 'h') {
				ps(No);
				return 0;
			}
		}
	}
	ps(Yes)
	return 0;
}

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

const unsigned int M = 1000000007;
int  N;

int main(){
    cin >> N;
    vector<long long> A;
    for(int i = 0; i < N; i++){
        long long x; 
        cin >> x;
        A.push_back(x);
    }

    long long sum = 0; 
    long long suffix = A[N-1];
    for(int i = N-2; i > -1; i--){
        sum += (A[i] * suffix);
        sum %= M;
        suffix += A[i];
        suffix %= M;
    }


    cout << sum << endl;
}


Measured memory_bytes: 5376
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <numeric>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define debug(x) cout << "debug: " << x << endl
#define MOD 1e9 + 7
#define INF 1e9

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;}
template <class T>
inline T GCD(T a, T b){if (b == 0) return a; else return GCD(b, a % b);}
template <class T>
inline T LCM(T a, T b) {return (a * b) / GCD(a, b);}

//const double pi = 3.1415926535; //10^-10までの円周率

int p(int a[], int p, int r) {
    int x = a[r];
    int i = p - 1;
    for (int j = p; j < r; j++) {
        if (a[j] <= x) {
            i++;
            swap(a[j], a[i]);
        }
    }
    swap(a[i + 1], a[r]);
    return i + 1;
}

int main(){
    int n;
    cin >> n;
    int a[n];
    rep(i, n) cin >> a[i];
    int k = p(a, 0, n - 1);
    rep(i,n) {
        if (i == k)
            cout << '[' << a[i] << ']' << ' ';
        else if (i == n - 1)
            cout << a[i] << endl;
        else
            cout << a[i] << ' ';
    }
}


Measured memory_bytes: 3508
#include<iostream>
using namespace std;
int main()
{
    int a, b;
    cin >> a >> b;
    //string s;
    //cin >> s;
    if(a<=8 && b<= 8){
    cout << "Yay!" << endl;
    }
    else{
    cout << ":(" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c,d,e,k;
  cin >>a>>b>>c>>d>>e>>k;
  if(e-d<=k&&e-c<=k&&e-b<=k&&e-a<=k)
    cout << "Yay!" <<endl;
  else  cout <<":("<<endl;
}

Measured memory_bytes: 256
import bisect
N, M, K = map(int, input().split())

A = list(map(int, input().split()))
B = list(map(int, input().split()))
a_sum = []
b_sum = []
sm = 0
for a in A:
    sm += a
    if sm > K:
        break
    a_sum.append(sm)
sm = 0
for b in B:
    sm += b
    if sm > K:
        break
    b_sum.append(sm)
index_max = 0
# a_size = len(a_sum)
# for i in range(a_size):
while a_sum:
    a_size = len(a_sum)
    b_index = bisect.bisect_right(b_sum, K - a_sum.pop())
    index_max = max(index_max, a_size + b_index)
    # print(a_size, b_index)
b_index = bisect.bisect_right(b_sum, K)
index_max = max(index_max, b_index)
print(index_max)

Measured memory_bytes: 42796
# coding: utf-8
import sys
from bisect import bisect_left
import itertools

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# 番兵を左右に置いて、4通り試す
A, B, Q = lr()
INF = 10 ** 12
S = [-INF] + [ir() for _ in range(A)] + [INF]
T = [-INF] + [ir() for _ in range(B)] + [INF]
S.sort(); T.sort()
for _ in range(Q):
    x = ir()
    si = bisect_left(S, x)
    ti = bisect_left(T, x)
    answer = INF
    for s, t in itertools.product(S[si-1:si+1], T[ti-1:ti+1]):
        temp = min(abs(s-x), abs(t-x)) + abs(s-t)
        if temp < answer:
            answer = temp
    print(answer)
# 


Measured memory_bytes: 12944
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>

using namespace std;
using lli = long long int;
// #define DEBUG
#ifdef DEBUG
#define debug(var) cout << (#var) << ": " << (var) << endl;
template<class T> void dump_array_impl(const T& a) {
  bool first = true;
  for (auto&& x : a) {
    if (!first) { cout << ", "; first = false; }
    cout << x;
  }
}
#define debug_array(a) cout<<(#a)<<": ";dump_array_impl(a);cout<<endl
#else
#define debug(var) {}
#define debug_array(a) {}
#endif
template<class T> void read_n(vector<T>& v, size_t n) {
  v = vector<T>(n);
  for (lli i=0; i<n; ++i) cin >> v[i];
}


int main() {
  int a, b;
  cin >> a >> b;
  cout << (a*b%2==1 ? "Yes" : "No") << endl;
  return 0;
}


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

public class Program
{
    public static void Main(string[] args)
    {
        MainModule(Console.In);
    }

    static string S;

    static readonly string[] tails = new string[]
    {
        "dream",
        "dreamer",
        "erase",
        "eraser",
    };
       

    public static void MainModule(TextReader In)
    {
        S = In.ReadLine();

        while (S.Length > 0)
        {
            foreach (var tail in tails)
            {
                if (S.EndsWith(tail))
                {
                    S = S.Substring(0, S.Length - tail.Length);
                    goto contine_while;
                }
            }
            goto L_No;
        contine_while:
            ;
        }
        // Yes
        Console.WriteLine("YES");
        return;
    L_No:
        Console.WriteLine("NO");
        return;
    }
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define endl '\n'
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)
#define trace(x) cerr << #x << ": " << x << " " << endl;
#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define line cout << __LINE__;
#define prv(a) for(auto x : a) cout << x << ' ';cout << '\n';
#define decimal_digits cout << fixed << setprecision(15);
#define sp cout << " ";
#define dbg2(a,b) cerr << #a << " = " << a << " " << #b << " = " << b << '\n';        
#define debug(x) cerr << __LINE__ << ' ' << #x << " = " << x << '\n';

typedef unordered_map<int,int> umi;
typedef unordered_map<ll,ll> uml;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;


clock_t time_p = clock();

void ktj(){
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (float)(time_p)/CLOCKS_PER_SEC << "\n";
}

bool cmp(pll x,pll y){
  if(x.ff != y.ff)
    return x.ff < y.ff;
  return x.ss > y.ss;
}

int main(){
  fastio
  ll n;
  cin >> n;
  ll i,j,k;

  pll p[n];
  forn(0,n,i){
    cin >> p[i].ss >> p[i].ff;
  }

  sort(p,p + n);

  bool ok = 1;

  ll pr = 0;

  forn(0,n,i){
    if(pr + p[i].ss <= p[i].ff){
      pr += p[i].ss;
    }else{
      ok = 0;break;
    }
  }

  cout << (ok ? "Yes\n" : "No\n");

  ktj();
}


Measured memory_bytes: 3328
n = int(input())
A = []
for i in range(n):
    x, l = map(int, input().split())
    a = x - l
    b = x + l
    A.append((a, b))
A = sorted(A, key = lambda x:x[1])
cnt = 0
right = -float('inf')
for i in range(n):
    if right <= A[i][0] :
        cnt += 1
        right = A[i][1]
print(cnt)








Measured memory_bytes: 24772
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define INF 1LL << 55
#define MAX (1LL << 31) -1
#define MOD 1000000007
typedef long long ll;
//typedef pair<int,int> P;
//typedef pair<pair<int,int>,ll> p;
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)
struct edge{ll to,cost,val;};
template<class T,class U>bool chmin(T&a,const U&b){if(a<=b)return false;a=b;return true;}
template<class T,class U>bool chmax(T&a,const U&b){if(a>=b)return false;a=b;return true;}
//__builtin_popcount(S);
//C.erase(unique(C.begin(),C.end()),C.end());
//#define int ll
int dx[]={1,-1,0,0},dy[]={0,0,-1,1};
//#define F function<T(T,T)>

bool flag[210000];
template<class T>
struct SegmentTree{
    using F=function<T(T,T)>;

    const F f;
    int size;
    vector<T> seg;
    const T inf;

    SegmentTree(int N,const F f,const T &inf) :f(f),inf(inf){
        size=1;
        while(size<N) size<<=1;
        seg.assign(2*size,inf);
    }
    void set(int k,const T &x){
        seg[k+size]=x;
    }
    void build(){
        for(int k=size-1;k>0;k--){
            seg[k]=f(seg[2*k],seg[2*k+1]);
        }
    }
    void update(int k,const T &x){
        k+=size;
        seg[k]=x;
        while(k>>=1){
            seg[k]=f(seg[2*k],seg[2*k+1]);
        }
    }
    //[a:b)
    T query(int a,int b){
        T L=inf,R=inf;
        for(a+=size,b+=size;a<b;a>>=1,b>>=1){
            if(a&1) L=f(L,seg[a++]);
            if(b&1) R=f(seg[--b],R);
        }
        return f(L,R);
    }

    T operator[](const int &k) const{
        return seg[k+size];
    }
};


signed main(){
    int N,K;
    cin>>N>>K;
    vector<int> P(N);
    SegmentTree<int> smin(N,[](int a,int b){return min(a,b);},MAX);
    SegmentTree<int> smax(N,[](int a,int b){return max(a,b);},0);

    for(int i=0;i<N;i++) cin>>P[i],smin.set(i,P[i]),smax.set(i,P[i]);
    smin.build(); smax.build();

    int count=1,countf=0;
    for(int i=1;i<N;i++){
        if(P[i]>P[i-1]) count++;
        else count=1;
        if(count>=K) flag[i-(K-1)]=true,countf++;
    }

    int ans=0;
    if(countf>0) ans++;
    for(int i=0;i+K-1<N;i++){
        if(flag[i]) continue;
        if(i+K<N && smin.query(i,i+K+1)==smin[i] && smax.query(i,i+K+1)==smax[i+K]) continue;
        ans++;
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 5376
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>
#include <numeric>
#include <iomanip>

using namespace std;
const long long MOD = 1000000007;
long long x[100000];

long long fact(int n){
  long long ans = 1;
  for(int i = 1; i <= n; i++){
    ans = (ans * i) % MOD;
  }
  return ans;
}

int main(){
  int N;
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> x[i];
  }

  long long ans = 1;
  int removed = 0;
  for(int i = 1; i < N; i++){
    if(x[i] % 2 == 0){
        if(x[i] / 2 < (i + 1 - removed)){
            ans = (ans * (i - removed + 1)) % MOD;
            removed ++;
        }
    } else {
        if((x[i] + 1) / 2 < (i + 1 - removed)){
            ans = (ans * (i - removed + 1)) % MOD;
            removed ++;
        }
    }
  }
  ans = (ans * fact(N - removed)) % MOD;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
//Tenki
#include<iostream>
#include<cstring>
using namespace std;
int main() {
	int count = 0;
	string a, b;
	cin >> a >> b;
	for (int i = 0; i < 3; i++) {
		if (a[i] == b[i]) {
			count += 1;
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 256
import java.io.*;

class Main {
	public static void main(String[] args) {
		BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
		try {
			String str = kb.readLine();
			int q = Integer.parseInt( kb.readLine() );
			
			StringBuilder output = new StringBuilder( str );
			StringBuilder tmp = new	StringBuilder( 1000+1 );
			int start, end;
			while( 0 < q-- ) {
				String[] instruction = kb.readLine().split( " " );
				start = Integer.parseInt( instruction[1] );
				end = Integer.parseInt( instruction[2] );
				if( instruction[0].equals( "print" ) ) {
		        	System.out.println( str.substring( start, end+1 ) );
				} else if( instruction[0].equals( "reverse" ) ) {
					tmp.setLength( 0 );
					tmp.append( output.substring( start, end+1 ) );
					tmp.reverse();
					output.replace( start, end+1, tmp.toString()  );
					str = output.toString();
				} else if( instruction[0].equals( "replace" ) ) {
					output.replace( start, end+1, instruction[3]  );
					str = output.toString();
				}
			}
				        
		} catch( IOException e ) {
			System.err.println( e );
		}
	}
}

Measured memory_bytes: 21392
#include <iostream>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){
  int n, i;
  cin >> n;
  int t[n+1], x[n+1], y[n+1];
  t[0]=x[0]=y[0]=0;
  for(i=0; i<n; i++){
    cin >> t[i+1] >> x[i+1] >> y[i+1];
    if(abs(x[i+1]-x[i])+abs(y[i+1]-y[i])>abs(t[i+1]-t[i])||(abs(x[i+1]-x[i])+abs(y[i+1]-y[i])+abs(t[i+1]-t[i]))%2==1){
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
  return 0;
}


Measured memory_bytes: 1408