akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <map>
#include <algorithm>    
#include <vector>       
#include <set>
#include <utility>  
#include <cstring>
#include <stdio.h>
#include <limits.h>
#include <queue>
#include <algorithm> 
#define MAX_DOUBLE  40000000000.0 
#include <math.h> 
#include <unistd.h>

using namespace std;

long long mod = 1e9 + 7; 

long long res[10010][100];


vector<vector<long long> > mult(vector<vector<long long> > &a, vector<vector<long long> > &b){
//	cout<<"dims: "<<a.size()<<" "<<a[0].size()<<" "<<b.size()<<" "<<b[0].size()<<endl;
	
	vector<vector<long long> > res;
	int n = a.size();
	int m = b[0].size();
	res.resize(n);
	
	for(int i = 0; i < n; i++){
		res[i].resize(m);
		for(int j = 0; j < m; j++){
			long long put = 0;
						
			for(int z = 0; z < a[0].size();  z++){
				put += a[i][z] * b[z][j];
				put %= mod;
			}
			
			res[i][j] = put; 
		}	
	}
	
	
	return res;
}

vector<vector<long long> > mat_pow(vector<vector<long long> > &a, long long b){
	
	if(b == 1){
		return a;
	}
	
	vector<vector<long long> > tmp = mat_pow(a, b/2);
	tmp = mult(tmp, tmp);
	
	if(b%2==0){
		return tmp;
	}else{
		return mult(tmp, a);
	}
	
}




int main(){
	long long n,m;
	cin>>n>>m;
		
	vector<vector<long long> > grap;
	grap.resize(n);
	
	for(int i = 0; i < n; i++){
		grap[i].resize(n);
		for(int j = 0; j < n; j++){
			int a;
			cin>>a;
			grap[i][j] = a;
		}
	}
	vector<vector<long long> > res = mat_pow(grap, m);
	
	vector<vector<long long> > s ;
	s.resize(1);
	s[0].resize(0);
	
	for(int i = 0; i < n; i++){
		s[0].push_back(1);
	}
	
//	for(int i = 0; i < n; i++){
//		for(int j = 0; j < n; j++){
//			cout<<res[i][j]<<" ";
//		}
//		cout<<endl;
//	}
	
	res = mult(s, res);
	
//	cout<<res.size()<<" "<<res.size();
//		
//	for(int i = 0; i < 1; i++){
//		for(int j = 0; j < n; j++){
//			cout<<res[i][j]<<" ";
//		}
//		cout<<endl;
//	}
		
	long long ans = 0;
	
	for(int i = 0; i<n; i++){
		ans += res[0][i];
		ans %= mod;
	}	
	
	cout<<ans<<endl;
}

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

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

using namespace std;

//v.push_back(123);
//sort(v.begin(), v.end(),greater<int>());
//for(int x : v) {cout << x << endl;}

//for(int x: v) cout << x << endl;
//vector<vector<char>> v(H, vector<char>(W));
//vector<int> v(1000);

signed main(){
  int N;
  cin>>N;
  cout << (N-2)*180 << endl;
  return 0;
}


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

using namespace std;

typedef long long ll;

int main () {
	ll a,b,c,k;
	ll i, j;
	ll ret=0;
	
	cin >>a>>b>>c>>k;
	
	if(a>k){
		cout << k << endl;
		return 0;
	} else if((a+b)>k){
		cout << a << endl;
		return 0;
	} else {
		cout << a-(k-a-b) << endl;
		return 0;
	}
	

	return 0;
}

Measured memory_bytes: 3600
// 27
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define fors(_, x, n, s) \
  for (int _ = x; _ < n; _ += s)
#define forn(_, x, n) fors(_, x, n, 1)
#define rep(_, n) forn(_, 0, n)
#define forrs(_, x, n, s) \
  for (int _ = x; _ > n; _ -= s)
#define forrn(_, x, n) forrs(_, x, n, 1)
#define rrep(_, n) forrn(_, n - 1, -1)
#define fi first
#define se second
#define pb push_back
#define pairii pair<int, int>
#define all(x) x.begin(), x.end()
#define len(x) int(x.size())
#define lli __int128_t
#define li long long int
#define ld long double
#ifdef LOCAL
#define debug(e)                             \
  cerr << "\033[48;5;196m\033[38;5;15m" << e \
       << "\033[0m";
#else
#define debug(e)
#endif
// 4
template <class A, class B>
ostream &operator<<(ostream &o, const pair<A, B> &p) {
  return o << "(" << p.fi << " " << p.se << ")";
}
// 8
template <class T>
ostream &operator<<(ostream &o, const vector<T> &v) {
  rep(i, (int)v.size()) o << setw(7) << left << v[i];
  return o << endl;
}
// 5
template <class A, class B>
ostream &operator<<(ostream &o, const map<A, B> &m) {
  for (auto &kv : m) o << kv;
  return o;
}
// 3
void _main(int tc) {
  vector<int> v(3);
  cin >> v[0] >> v[1] >> v[2];
  rep(i, 3) {
    int sum = 0;
    rep(j, 3) {
      if (i != j) {
        sum += v[j];
      }
    }
    if (sum == v[i]) {
      cout << "Yes" << endl;
      return;
    }
  }
  cout << "No" << endl;
}
// 7
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  _main(0), exit(0);
  int tc;
  cin >> tc;
  rep(i, tc) _main(i + 1);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//BEGIN CUT HERE
template<typename T> 
struct BIT2D{
  vector<vector<T> > bit;
  int n,m;
  //1-indexed
  BIT2D(){init(-1,-1,(T)0);}
  BIT2D(int n_,int m_,T d){init(n_,m_,d);}
  void init(int n_,int m_,T d){
    n=n_;
    m=m_;
    for(vector<T> &v:bit) v.clear();
    bit.clear();
    bit.resize(n+1,vector<T>(m+1,d));
  }
  T sum(int i,int j){
    T s=0;
    for(int x=i;x>0;x-=(x&-x))
      for(int y=j;y>0;y-=(y&-y))
	s+=bit[x][y];
    return s;
  }
  void add(int i,int j,T a){
    if(i==0||j==0) return;
    for(int x=i;x<=n;x+=(x&-x))
      for(int y=j;y<=m;y+=(y&-y))
	bit[x][y]+=a;
  }
  // (x1,x2] * (y1,y2];
  T sum(int x1,int y1,int x2,int y2){
    return sum(x1,y1)-sum(x1,y2)-sum(x2,y1)+sum(x2,y2);
  }
};

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  int h,w,t,q;
  cin>>h>>w>>t>>q;
  BIT2D<int> beet(h+100,w+100,0);
  BIT2D<int> ushi(h+100,w+100,0);
  typedef pair<int,int> P;
  typedef pair<int,P> PP;
  queue<PP> qq; 
  for(int i=0;i<q;i++){
    int a,c,x1,y1;
    cin>>a>>c>>x1>>y1;
    while(!qq.empty()&&qq.front().first<=a){
      P p=qq.front().second;qq.pop();
      int x=p.first,y=p.second;
      assert(beet.sum(x-1,y-1,x,y)==1);
      beet.add(x,y,-1);
      assert(ushi.sum(x-1,y-1,x,y)==0);
      ushi.add(x,y,1);
    }
    if(c==0){
      assert(beet.sum(x1-1,y1-1,x1,y1)==0);
      beet.add(x1,y1,1);
      qq.push(PP(a+t,P(x1,y1)));
    }
    if(c==1){
      if(ushi.sum(x1-1,y1-1,x1,y1)==0) continue;
      ushi.add(x1,y1,-1);
    }
    if(c==2){
      int x2,y2;
      cin>>x2>>y2;
      x1--;y1--;
      cout<<ushi.sum(x1,y1,x2,y2)<<" "<<beet.sum(x1,y1,x2,y2)<<endl;
    }
  }
  return 0;
}

/*
verified on 2017/09/22
http://judge.u-aizu.ac.jp/onlinejudge/cdescription.jsp?cid=ACPC2017Day3&pid=E
 */

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

typedef unsigned long long ull;
typedef long long ll;

const int M = (int)1e5;
const int N = (int)5e5;
const int inf = 0x3f3f3f3f;
const ll mod = (ll)998244353;
const double eps = 1e-6;

int main()
{
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    int d, t, s; scanf("%d %d %d", &d, &t, &s);
    puts(t * s >= d ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 3684
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		
        int A = 1;
		int sum = 0;
		
       for(int i=0;i<3;i++){
         A=A*a;
         sum+=A;
        }
      
		System.out.println(sum);
	}
}

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

int main()
{
        int n;
        double a,b,c,d,e,f;
        double x1,x2,x3,y1,y2,y3;
        double px,py;
        double r;

        cin >> n;

        for(int i=0;i<n;i++){
                cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
                a = (x2-x1)*2.0;
                b = (y2-y1)*2.0;
                c = (x2*x2 + y2*y2 - x1*x1 - y1*y1);
                d = (x3-x1)*2.0;
                e = (y3-y1)*2.0;
                f = (x3*x3 + y3*y3 - x1*x1 - y1*y1);
                px = (c*e-b*f)/(a*e-b*d);
                py = (a*f-c*d)/(a*e-b*d);
                r = sqrt((px-x1)*(px-x1) + (py-y1)*(py-y1));
                printf("%.3f %.3f %.3f\n",px,py,r);



        }

        return 0;
}

Measured memory_bytes: 1244
#include "bits/stdc++.h"

#define rep(i, a) for (int i = 0; i < (int)a; ++i)
#define REP(i, a, b) for (int i = (a); i < (int)b; ++i)

// debug methods
// usage: debug(x,y);
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cout << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) \
  cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3)                                               \
  cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << endl
#define debug_4(x1, x2, x3, x4)                                           \
  cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5)                                       \
  cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#ifdef _DEBUG
#define debug(...)                                                      \
  CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) \
  (__VA_ARGS__)
#else
#define debug(...)
#endif

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

ll comb(int n, int r) {
  ll x = 1;
  rep(i, r) x *= n - i;
  rep(i, r) x /= i + 1;
  return x;
}

void Main() {
  string N;
  cin >> N;
  int n = N.size();
  int k;
  cin >> k;

  int nines[] = {1, 9, 81, 729};
  ll ans = 0;
  if (k==1) ans += 1;
  else if (k==2) {
    REP(i, 1, n) if (N[i] != '0') {
      ans += N[i] - '0' + (n - i - 1) * 9;
      break;
    }
  } else {
    REP(i, 1, n) if (N[i] != '0') {
      ans += (N[i] - '0' - 1) * (n - i - 1) * 9;
      ans += comb(n - i - 1, 2) * nines[2];
      REP(j, i+1, n) {
        if (N[j] != '0') {
          ans += N[j] - '0' + (n - j - 1) * 9;
          break;
        }
      }
      break;
    }
  }
  debug(ans);
  ans += (N[0]-'0'-1) * comb(n-1, k-1) * nines[k-1];
  debug(ans);
  ans += comb(n-1, k) * nines[k];
  debug(ans);
  cout << ans << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  char s[5];  scanf("%s", s);

  for(int i=0; i<3; i++)
    if(s[i] == '9') printf("1");
    else if(s[i] == '1') printf("9");
    else  printf("%c", s[i]);

  puts("");

  return 0;
}


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

void solve(){
  int n; cin >> n;
  int ans = 0;
  for(int i = 1; i <= n; i++) ans += i;
  cout << ans << endl;
  return;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long
#define ll long long
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define mk make_pair
#define all(x) x.begin(),x.end()
#define SZ(x) x.size()
#define fi first
#define se second
const int INF = 1e9;
using namespace std;

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    int N; cin >> N;
    int A[N]; rep(i,N) cin >> A[i];
    sort(A,A+N);
    int ans=0;
    int sum=0;
    rep(i,N){
        if(!i) sum+=A[i];
        else {
            if(sum*2<A[i]) ans=i;
            sum+=A[i];
        }
    }
    cout << N-ans << endl;
}

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

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        string s = sc.Next();
        int[] ch = s.Select(c => c - 'A').ToArray();
        for (int i = 0; i < ch.Length; i++)
        {
            ch[i] = (ch[i] + n) % 26;
        }

        Console.WriteLine(new string(ch.Select(i => (char) (i + 'A')).ToArray()));
    }

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


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

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

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

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

        return _line[_pos++];
    }

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

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

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

    #endregion

    #region 型変換

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

        return result;
    }

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

        return result;
    }

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

        return result;
    }

    #endregion

    #region 配列取得

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

        _pos = _line.Length;
        return _line;
    }

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

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

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

    #endregion
}

Measured memory_bytes: 13448
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)

	p := make([]int, n)
	q := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&p[i])
		p[i]--
	}
	for i := 0; i < n; i++ {
		fmt.Scan(&q[i])
		q[i]--
	}

	tmp := make([]int, n)
	for i := 0; i < n; i++ {
		tmp[i] = i
	}
	perms := permutations(tmp)
	ss := make([]string, len(perms))
	for i := 0; i < len(perms); i++ {
		ss[i] = fmt.Sprint(perms[i])
	}
	sort.Strings(ss)

	a := make([]int, 0)
	ps := fmt.Sprint(p)
	qs := fmt.Sprint(q)
	for i, s := range ss {
		if ps == s || qs == s {
			a = append(a, i+1)
		}
	}

	if len(a) < 2 {
		fmt.Println(0)
		return
	}

	ans := abs(a[0] - a[1])
	fmt.Println(ans)
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

// https://stackoverflow.com/questions/30226438/generate-all-permutations-in-go
func permutations(arr []int) [][]int {
	var helper func([]int, int)
	res := [][]int{}

	helper = func(arr []int, n int) {
		if n == 1 {
			tmp := make([]int, len(arr))
			copy(tmp, arr)
			res = append(res, tmp)
		} else {
			for i := 0; i < n; i++ {
				helper(arr, n-1)
				if n%2 == 1 {
					tmp := arr[i]
					arr[i] = arr[n-1]
					arr[n-1] = tmp
				} else {
					tmp := arr[0]
					arr[0] = arr[n-1]
					arr[n-1] = tmp
				}
			}
		}
	}
	helper(arr, len(arr))
	return res
}


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

int main(){
   
  while(1){
    int a, b;
    string op;
    cin>>a>>op>>b;
    if(op == "?") break;
    
    int ans;
    if(op == "+") ans = a + b;
    if(op == "-") ans = a - b;
    if(op == "*") ans = a * b;
    if(op == "/") ans = a / b;

    cout<<ans<<endl;
    }

}


Measured memory_bytes: 3136
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,x,n) for(ll i=x;i<n;i++)
#define S(v) sort(v.begin(), v.end())
#define SS(v) sort(v.begin(), v.end(), greater<int>())
#define print(v) for(auto i:v)cout<<i<<" "


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	// freopen("in.txt","r", stdin);
	ll t=1;
	// cin>>t;
	while(t--)
	{
		ll n;
		cin>>n;
		vector<ll> v(n,0);
		loop(i,0,n){
			ll a, b;
			cin>>a>>b;
			if(a==b)v[i] = 1;			
		}	
		ll ct = 0;
		if(v[0] == 1)ct++;
		bool ok =0;
		loop(i,1,n){
			if(v[i] == 1){
				ct++;
				if(ct>= 3){
					ok = 1;
					break;
				}
			}
			else{
				ct = 0;
			}
		}
		cout<<(ok?"Yes":"No");
	}
	
} 





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

namespace abc68
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            if (N >= 64)
            {
                Console.WriteLine(64);
            }else if(N>=32)
            {
                Console.WriteLine(32);
            }
            else if (N >= 16)
            {
                Console.WriteLine(16);
            }
            else if (N >= 8)
            {
                Console.WriteLine(8);
            }
            else if (N >= 4)
            {
                Console.WriteLine(4);
            }
            else if (N >= 2)
            {
                Console.WriteLine(2);
            }
            else if (N >= 1)
            {
                Console.WriteLine(1);
            }
           

        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
#define rep(i, n) for (int i = 0; i < (int)(n); i++
using namespace std;
const int MAX_N=int(1e8+5);
vector<bool> is_prime(MAX_N,true);

void sieve(int n) {
	fill(is_prime.begin(),is_prime.end(),true);
		is_prime[0]=false;
		is_prime[1]=false;
		for (int i = 2; i * i <= n; i++) {
			if (is_prime[i]) {
				for (int j = i * i; j <= n; j += i) is_prime[j] = false;
			}
		}
	return;
}
int main() {
	int n;
	while (cin >> n) {
		int cnt = 0;
		sieve(n);
		for (int i = 2; i <= n; i++) {
			if (is_prime[i]) {
				cnt++;
			}
		}
		cout << cnt << endl;
	}
}



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

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
double pi=acos(-1);
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
// #define mp make_pair
#define pq priority_queue
const ll mod=1000000007;
#define f first
#define s second
#define pii pair< ll, ll >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace boost::multiprecision;
using namespace std;
void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}


const int N=1000005;
ll fact[N],invfact[N];
ll power(ll x,ll y){
  if(y<=0) return 1LL;
  ll z=power(x,y/2);
  if(y%2) return (((z*z)%mod)*x)%mod;
  return (z*z)%mod;
}

void pre(){
  fact[0]=invfact[0]=invfact[1]=fact[1]=1;
  rep(i,2,N) fact[i]=(i*fact[i-1])%mod;
  rep(i,2,N) invfact[i]=(invfact[i-1]*power(i,mod-2))%mod;
}
ll nCr(ll n,ll k){ return (((fact[n]*invfact[n-k])%mod)*invfact[k])%mod; }



const int N1=1e6+1;
vector<int> isprime(N1,1),prime;
void seive(){
  rep(i,2,sqrt(N1)+1){
      if(isprime[i]){
        for(int j=i*i;j<N1;j+=i) isprime[j]=0;
        prime.pb(i);
      }
  }
  rep(i,sqrt(N1)+1,N1) if(isprime[i]) prime.pb(i);
}



struct dsu {
    vector<int> par, rank;
    dsu(int n): par(n+1), rank(n+1) {
        for (int i = 0; i <= n; i++) {
            par[i] = i;
            rank[i]= 1;
        }
    }
    int root(int a) {
        if (a == par[a]) return a;
        return par[a] = root(par[a]);
    }
    void merge(int a, int b) {
        a = root(a);
        b = root(b);
        if (a == b) return;
        if (rank[a] > rank[b]) swap(a, b);
        par[b] = a;
    }
    set<int> parent(int n){
        set<int> s;
        for(int i=1;i<=n;i++){
            s.insert(root(i));
        }
        return s;
    }
};

void solve(){
  int a,b;
  cin>>a>>b;
  a++;
  string s;
  cin>>s;
  int cnt1=0,cnt2=0;
  rep(i,0,a+b){
    if(s[i]>='0' && s[i]<='9') cnt1++;
  }
  if(cnt1==a+b-1 && s[a-1]=='-') cout<<"Yes\n";
  else cout<<"No\n";
}

int main(){
    optimizeIO();
    int r=1;
    {solve();}
}


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

struct init_ { init_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } init_;

template<class C> using iodef_rng_t = typename enable_if<decltype(declval<C>().begin(), true_type{})::value && !is_same<C, string>::value>::type;
template<class C, class = iodef_rng_t<C>> istream& operator>>(istream& in, C& c) { for (auto& v : c) { in >> v; } return in; }
template<class C, class = iodef_rng_t<C>> ostream& operator<<(ostream& out, const C& c) { int i = 0; for (const auto& v : c) { if (i++) { out << ' '; } out << v; } return out; }
template<size_t N, class T, class R> using when_last = typename enable_if<N == tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N, class T, class R> using when_init = typename enable_if<N != tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_last<N, T, istream&> { return in >> get<N>(t); }
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_init<N, T, istream&> { return operator>><N + 1>(in >> get<N>(t), forward<T>(t)); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_last<N, T, ostream&> { return out << get<N>(t); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_init<N, T, ostream&> { return operator<<<N + 1>(out << get<N>(t) << ' ', t); }

#ifdef LOCAL
template<class T> void trace_(const char* s, const T& v) { cerr << s << "=" << v; }
template<class T, class... Ts> void trace_(const char* s, const T& v, const Ts&... vs) { for (; *s != ','; ++s) { cerr << *s; } cerr << "=" << v << ","; trace_(++s, vs...); }
#define TRACE(...) (cerr << "\033[2m\033[33m", trace_(#__VA_ARGS__, __VA_ARGS__), cerr << "\033[0m\n")
#else
#define TRACE(...)
#endif

int main() {
    int n;
    cin >> n;
    vector<int> d(n);
    cin >> d;
    int64_t ans = 0;
    for (int j = 1; j < n; j++) {
        for (int i = 0; i < j; i++) {
            ans += d[i] * d[j];
        }
    }
    cout << ans << '\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
void _main() {
	int N;
	cin >> N;
	pair<pair<string, int>, int> p[110];
	rep(i, 0, N) {
		string S;
		int P;
		cin >> S >> P;
		p[i] = make_pair(make_pair(S, -P), i);
	}
	sort(p, p + N);
	rep(j, 0, N) {
		cout << p[j].second+1 << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(V) V.begin(),V.end()
#define ll long long
const ll MOD = 1000000007;

int main() {
	ll N, X, L;
	cin >> N;
	vector<pair<ll, ll>> V(N);
	vector<ll> A(N);
	for (int i = 0;i < N;i++) {
		cin >> X >> L;
		V[i] = { X + L,L };
		//腕の右端
	}
	sort(all(V));
	pair<ll, ll> P;
	A[0] = 1;
	for (int i = 1;i < N;i++) {
		tie(X, L) = V[i];
		X -= L;
		P = { X - L,INT64_MAX };
		auto it = lower_bound(all(V), P);
		int b = it - V.begin();
		if (b == 0) {
			A[i] = A[i - 1];
		}
		else {
			A[i] = max(A[i - 1], A[b - 1] + 1);
		}
	}
	cout << A[N - 1] << endl;
}

Measured memory_bytes: 2560
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"

using namespace std;

const long long int MOD = 1000000007;
//const int MOD = 998244353;

//long long int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

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

	cin >> N >> K;
	vector<long long int>v(41);
	for (int i = 0; i < N; i++) {
		cin >> M;
		for (int i = 0; i < 40; i++) {
			if (M & 1)v[i]++;
			M >>= 1;
		}
	}
	vector<long long int>w(1 << 20);
	for (long long int i = 0; i < 1 << 20; i++) {
		long long int box = i;
		for (long long int j = 0; j < 20; j++) {
			if (box & 1) {
				w[i] += (N - v[j]) << j;
			}
			else {
				w[i] += v[j] << j;
			}
			box >>= 1;
		}
	}
	M = 0;
	for (int i = 0; i < 1 << 20; i++)M = max(M, w[i]);
	long long int ans = 0;
	for (long long int i = 0; i < 1 << 20; i++) {
		long long int box = i;
		long long int bag = 0;
		for (long long int j = 20; j < 40; j++) {
			if (box & 1) {
				bag += (N - v[j]) << j;
			}
			else bag += v[j] << j;
			box >>= 1;
		}
		box = i << 20;
		if (box + (1 << 20) - 1 <= K) {
			ans = max(ans, bag + M);
		}
		else {
			for (long long int j = 0; j < 1 << 20; j++) {
				if (box + j > K)break;
				ans = max(ans, bag + w[j]);
			}
			break;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 8448
import sys
sys.setrecursionlimit(pow(10,6))
readline = sys.stdin.readline

def dfs(nw, d):
    V[nw] = d
    for nx in G[nw]:
        if V[nx[0]]==-1:
            dfs(nx[0], d+nx[1])

n = int(readline())
G = [[] for _ in range(n)]
for i in range(n-1):
    a,b,c = map(int, readline().split())
    G[a-1].append((b-1,c))
    G[b-1].append((a-1,c))
q, k = map(int, readline().split())

V = [-1]*n
dfs(k-1, 0)

for i in range(q):
    x,y = map(lambda x:int(x)-1, readline().split())
    print(V[x]+V[y])

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


#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cmath>
#include <numeric>
#include <iterator>
#include <fstream>

#define SIZE 100005
#define MOD 1000000007

using namespace std;

class DFlippingSigns {
public:
  static void solve(std::istream &cin, std::ostream &cout) {
    int64_t n;
    cin >> n;
    vector<int64_t> vec(n);
    int64_t min_value = INT64_MAX;
    int64_t count = 0;
    for (int i = 0; i < n; ++i) {
      cin >> vec[i];
      if (vec[i] < 0) count++;
      vec[i] = abs(vec[i]);
      min_value =  min(min_value,vec[i]);
    }
    if (count %2 == 1){
      cout << accumulate(vec.begin(), vec.end(), 0ll) - 2*min_value << endl;
    }else{
      cout << accumulate(vec.begin(), vec.end(), 0ll) << endl;
    }
  }
};


int main() {
    DFlippingSigns solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 1024
import java.util.*;
 
class Main {
    public static void main(String[] args) {
    	
    	Scanner sc = new Scanner(System.in);
    	ArrayList<String> ynJudge = new ArrayList<>();
    	
    	int N = sc.nextInt();
    	int sideA, sideB, sideC;
    	int cnt = 0;
    	for(int i = 0; i < N; i++) {
    		sideA = sc.nextInt();
    		sideB = sc.nextInt();
    		sideC = sc.nextInt();
    		if(sideA * sideA == sideB * sideB + sideC * sideC ||
    		   sideB * sideB == sideA * sideA + sideC * sideC ||
    		   sideC * sideC == sideA * sideA + sideB * sideB) {
    			ynJudge.add("YES");
    			cnt++;
    		} else {
    			ynJudge.add("NO");
    			cnt++;
    		}
    	}
    	for(int i = 0; i < cnt; i++) {
    		System.out.println(ynJudge.get(i));
    	}
    }
}

Measured memory_bytes: 34152
#include<iostream>
using namespace std;
#define f(i,a,b) for(int i=a;i<=b;++i)
int main()
{
	int x,ans;
	for(int i=1;i<=5;++i){
		cin>>x;
		if(!x) ans=i;
	}
	cout<<ans;
	return 0;
 } 

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

const ll MOD = 1e9 + 7;
int N;
int T[100010], A[100010];
int L[100010], R[100010];

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> T[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  fill_n((int*)L, 100010, -1);
  fill_n((int*)R, 100010, -1);

  int tmp = -1;
  for (int i = 0; i < N; i++) {
    if (tmp != T[i]) {
      L[i] = tmp = T[i];
    }
  }
  tmp = -1;
  for (int i = N - 1; i >= 0; i--) {
    if (tmp != A[i]) {
      R[i] = tmp = A[i];
    }
  }

  ll ans = 1;
  for (int i = 0; i < N; i++) {
    if (L[i] < 0 && R[i] < 0) {
      ans *= min(T[i], A[i]);
      ans %= MOD;
    } else if (L[i] < 0) {
      if (T[i] < A[i]) ans = 0;
    } else if (R[i] < 0) {
      if (T[i] > A[i]) ans = 0;
    } else {
      if (T[i] != A[i]) ans = 0;
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  ll X;
  cin >> X;
  ll N = 100;
  ll cnt = 0;
  while(N < X) {
    cnt++;
    N += N/100;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3636
def BinarySearch(A, c):
	left = 0
	right = len(A)
	while(left < right):
		mid = (left + right) // 2
		if A[mid] == c:
			return True
		elif (A[mid] < c):
			left = mid + 1
		else:
			right = mid 
	else:
		return False
	
	
	

N = int(input())
S = list(map(int, input().split()))
Q = int(input())
T = list(map(int, input().split()))

ctr = 0



for i in range(Q):
	if BinarySearch(S, T[i]):
		ctr += 1

print(ctr)

Measured memory_bytes: 18800
#include <stdio.h>

int main(void){
    int i,j,k;
    int N,K,answer;
    
    scanf("%d %d",&N,&K);
    
    answer = N - K;
    answer++;
    
    if(K == 1){
        printf("0\n");
        return 0;
    }
    printf("%d\n",answer - 1);
    
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
ll dp[2555555]={0},rsum[2555555]={0};
const ll mod=1e9+7;
int main(){
  ll n;
  cin>>n;
  ll ans=0;
  dp[1]=1;
  rsum[1]=1;
  for(ll i=2;i<=2*n+1;i++){
    if(i<=n){
      ll v1=dp[i-1];
      ll v2=0;
      if(i-3>0){
        v2+=rsum[i-3];
        v2%=mod;
      }
      if(i-n-2>0){
        v2-=rsum[i-n-2];
        v2+=mod;
        v2%=mod;
      }
      dp[i]=(v1+v2)%mod;
      ans+=v2*(n-1);
      ans%=mod;
    //  cout<<i<<":"<<v1<<" "<<v2<<" "<<ans<<endl;
    }
    else if(i<=2*n){
      ll kans=0;
      ll L=max((ll)1,i-n-1),R=min(n-1,i-3);
      kans+=rsum[R];
      kans-=rsum[L-1];
      kans+=mod;
      kans%=mod;

      ans+=kans*n;
      ans%=mod;

      if(i-3>=n){
        ans+=dp[n];
        ans%=mod;
      }
      else if(i-1==n){
        ans+=dp[n];
        ans%=mod;
      }
  //    cout<<i<<":"<<kans<<" "<<ans<<endl;

    }
    else if(n>1){
      ans+=dp[n];
//      cout<<i<<":"<<dp[n]<<" "<<ans<<endl;
      ans%=mod;
    }
    rsum[i]=(rsum[i-1]+dp[i])%mod;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 26880
N,x=map(int,input().split())
a=list(map(int,input().split()))
result=0
a.sort()
for i in range(N):
  n=a.pop(0)
  if x>=n:
    x-=n
    result+=1
  else:
    break
else:
  if not x==0:
    result-=1
print(result)

Measured memory_bytes: 9172
import numpy as np
import heapq as hq
N = int(input())
F = np.array([[int(x) for x in input().split()] for _ in range(N)])
P = np.array([[int(x) for x in input().split()] for _ in range(N)])

Profit = []
for i in range(1,2**10): #bit全探索
    Open = np.array([int(x) for x in format(i, '010b')]) #2進数をベクトルに変換
    prf = 0
    for f, p in zip(F, P):
        cnt = np.dot(Open, f)
        prf += p[cnt]
    hq.heappush(Profit, -prf)
print(-Profit[0])
        

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

vector<unsigned long long> next_p_mod(unsigned N, long long mod) { //next_permutation
  vector<unsigned long long> Next_p(N);
  unsigned long long Next_p_buff = 1;
  for (int i = 0; i < N; i++)
  {
    Next_p_buff *= (i + 1) % mod;
    Next_p.at(i) = Next_p_buff % mod;
  }
  return Next_p;
}
unsigned long long modpow(unsigned long long a, unsigned long long n, unsigned long long mod) {
   unsigned long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
void comb(vector<vector <long long int> > &v,unsigned long long mod) {
  //vector<入れたい型> v(配列の個数(x),vector<入れたい型> (配列の個数,初期値));
  for (int i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (int k = 1; k < v.size(); k++) {
    for (int j = 1; j < k; j++) {
      v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%mod;
    }
  }
}
// a^{-1} mod を計算する
unsigned long long modinv(unsigned long long a, unsigned long long mod) {
    return modpow(a, mod - 2, mod);
}


int main() {
  string S;
  bool flag=0;
  cin >> S;
  for(int i=0;i<S.size()-1;i++){
    if(S.at(i)==S.at(i+1)){
    cout<<"Bad"<<endl;
      flag=1;
      break;
    }
  }
  if(flag!=1){
    cout<<"Good"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
N, Ma, Mb = map(int, input().split())
A, B, C = [], [], []
for i in range(N):
    ai, bi, ci = map(int, input().split())
    A.append(ai)
    B.append(bi)
    C.append(ci)

INF = float('inf')
dp = [[[INF] * 401 for i in range(401)] for j in range(N + 1)]
dp[0][0][0] = 0

for i in range(1, N + 1):
    for a in range(401):
        for b in range(401):
            if a - A[i - 1] >= 0 and b - B[i - 1] >= 0:
                dp[i][a][b] = min(dp[i][a][b], dp[i - 1][a][b], dp[i - 1][a - A[i - 1]][b - B[i - 1]] + C[i - 1])
            else:
                dp[i][a][b] = min(dp[i][a][b], dp[i - 1][a][b])
ans = INF
for i in range(1, 401):
    target_a = Ma * i
    target_b = Mb * i
    if target_a > 400 or target_b > 400:
        break
    ans = min(ans, dp[N][target_a][target_b])

print(ans if ans != INF else -1)

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

#define MOD 998244353

using namespace std;

int pow(int x, int pow) {
	int res = 1, t = x;
	while (pow) {
		if (pow & 1) {
			res = 1LL * res * t % MOD;
		}
		t = 1LL * t * t % MOD;
		pow >>= 1;
	}
	return res;
}

int main() {
	int n, m;
	cin >> n >> m;
	int** mat = new int*[n];
	for (int i = 0; i < n; i++) {
		mat[i] = new int[m];
		for (int j = 0; j < m; j++) {
			cin >> mat[i][j];
		}
	}
	int cur = 0;
	for (int c = 0; cur < n && c < m; c++) {
		for (int r = cur; r < n; r++) {
			if (mat[r][c]) {
				swap(mat[cur], mat[r]);
				break;
			}
		}
		if (!mat[cur][c]) {
			continue;
		}
		for (int r = 0; r < n; r++) {
			if (r != cur && mat[r][c]) {
				for (int k = c; k < m; k++) {
					mat[r][k] ^= mat[cur][k];
				}
			}
		}
		cur++;
	}

	int tot = pow(2, n + m - 1);
	tot -= pow(2, n + m - cur - 1);
	if (tot < 0) {
		tot += MOD;
	}
	cout << tot << endl;

	for (int i = 0; i < n; i++) {
		delete mat[i];
	}
	delete mat;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
 
int main () {
  string S;
  cin >> S;
  if (S[2] == S[3] && S[4] == S[5]) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 256
h, w = gets.split.map(&:to_i)
pixels = h.times.map { gets.chomp }

valid = true

h.times do |i|
  break unless valid

  w.times do |j|
    next if pixels[i][j] == "."

    next if (j - 1 >= 0) && pixels[i][j - 1] == "#"
    next if (j + 1 < w) && pixels[i][j + 1] == "#"
    next if (i - 1 >= 0) && pixels[i - 1][j] == "#"
    next if (i + 1 < h) && pixels[i + 1][j] == "#"

    valid = false
    break
  end
end

puts valid ? "Yes" : "No"


Measured memory_bytes: 14324
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std; 

int main(void) {
	vector<int> t(5);
	for (int i = 0; i < 5; ++i) {
		cin >> t[i];
	}
	int res = (1 << 28);
	do {
		int now = 0;
		for (int i = 0; i < 5; ++i) {
			now += t[i];
			if (i < 4 && now%10 != 0) {
				now += (10 - now%10);
			}
		}
		res = min(res,now);
	} while (std::next_permutation(t.begin(), t.end()));
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
        
    int main() {
    
        int n;
        int cnt;
        int ntemp;
        int maxdata;
        int idx;

        scanf("%d", &n);
    
        int arr[n];
    
        for (int i = n; i >= 1; i--) {
            cnt = 0;
            ntemp = i;
    
            while (ntemp >= 1) {
                if (ntemp % 2 == 0) {
                    cnt++;
                    ntemp /= 2;
                } else {
                    break;
                }
            }
            arr[i] = cnt;
        }

        maxdata = -1;
        idx = 0;

        for (int i = 1; i <= n; i++) {
            if (maxdata < arr[i]) {
                idx = i;
                maxdata = arr[i];
            }
        }
    
        printf("%d\n", idx);
    
        return 0;
    
    }

Measured memory_bytes: 128
//     . .. ... ..... be naame khodaa ..... .... ... .. .     \\

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

typedef long long ll;
typedef long double ld;

inline int in(){int x, y; y = scanf("%d", &x); return x;}

const int N = 202;

int sd[N];

int main() {
	int n = in();
	int sum = n - +1-(n%2);
	int m = n*(n-1)/2 - n/2;
	cout << m << endl;
	for(int i = 0; i < n; i++)
		for(int j = i + 1; j < n; j++)
			if(j != sum - i) {
				sd[i] += (j + 1);
				sd[j] += i + 1;
				cout << i + 1 << " " << j + 1 << "\n";
			}
	for(int i = 0; i < n; i++)
		assert(sd[i] == sd[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, b;
		a = sc.nextInt();
		b = sc.nextInt();
		if (a <= b) {
			System.out.println(a);
		} else {
			System.out.println(a - 1);
		}
		sc.close();
	}

}


Measured memory_bytes: 21460
import java.util.*;
import java.io.*;

public class Main {
	
	public static int unfair(int a, int b, int c){
		int max = a;
		int min = a;
		if(max<b)max=b;
		if(min>b)min=b;
		if(max<c)max=c;
		if(min>c)min=c;
		return max-min;
	}
	
	public static int div1(int H, int W){
		//upper parts leq than 1/3
		int upper = H/3;
		int piece1 = upper*W;
		int lower = H-upper;
		return Math.min(unfair(piece1, (lower/2)*W, (lower-(lower/2))*W),
						unfair(piece1, (W/2)*lower, (W-(W/2))*lower));
	}
	public static int div2(int H, int W){
		//upper parts geq than 1/3
		int upper = 1+H/3;
		int piece1 = upper*W;
		int lower = H-upper;
		return Math.min(unfair(piece1, (lower/2)*W, (lower-(lower/2))*W),
						unfair(piece1, (W/2)*lower, (W-(W/2))*lower));
	}
	
	public static int div3(int H, int W){
		//left parts leq than 1/3
		return div1(W,H);
	}
	public static int div4(int H, int W){
		//left parts geq than 1/3
		return div2(W,H);
	}
	
	
	
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();
        int ans = Math.min(Math.min(div1(H,W),div2(H,W)),Math.min(div3(H,W),div4(H,W)));
        System.out.println(ans);
    }    
}

Measured memory_bytes: 21972
N, M, C = map(int, input().split(' '))
B = list(map(int, input().split(' ')))

ret = 0
for _ in range(N):
    A = list(map(int, input().split(' ')))
    n = sum([a*b for a, b in zip(A, B)]) + C
    if n > 0:
        ret += 1

print(ret)

Measured memory_bytes: 38256
A, B, N = input().split()
A = float(A)
B = float(B)
N = float(N)
import math
value = math.floor(A*(B-1)/B)
a = int(math.floor(A*N/B)-A*math.floor(N/B))
if N < B-1:
  print(a)
else:
  print(value)

Measured memory_bytes: 9004
//2018.09.21 8min

#include <iostream>
#include <math.h>
using namespace std;

int ctoi(char c) {
    switch (c) {
        case '0': return 0;
        case '1': return 1;
        case '2': return 2;
        case '3': return 3;
        case '4': return 4;
        case '5': return 5;
        case '6': return 6;
        case '7': return 7;
        case '8': return 8;
        case '9': return 9;
        default: return 0;
    }
}

int main() {

    string n;
    cin >> n;

    int ns = 0;
    for(int i=0;i<n.size();i++){
        ns += ctoi(n[i]);
    }

    int nn = stoi(n);

    if(nn%ns == 0) cout<<"Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>

int main(){
    int n,m;
    scanf("%d %d", &n, &m);

    int matrix[n][m];
    int vector[m];

    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            scanf("%d", &matrix[i][j]);
        }
    }

    for(int i = 0; i < m; i++){
        scanf("%d", &vector[i]);
    }

    int solution[n];

    for(int i = 0; i < n; i++) solution[i] = 0;

    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            solution[i] += matrix[i][j]*vector[j];
        }
    }

    for(int i = 0;i < n; i++)
        printf("%d\n", solution[i]);

    return 0;
}

Measured memory_bytes: 1064
/*  -*- coding: utf-8 -*-
 *
 * 2799.cc: Yamanote-line Game
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 1000;

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  int n, d;
  scanf("%d%d", &n, &d);

  int sum = 0;
  for (int i = 0; i < n; i++) {
    int pi;
    scanf("%d", &pi);
    if (pi > d) sum += pi - d;
  }

  if (sum == 0) puts("kusoge");
  else printf("%d\n", sum);
  return 0;
}



Measured memory_bytes: 3220
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;

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

    cout << max(a+b, max(a-b, a*b));

    return 0;
}

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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef priority_queue<VL> PQ_DESC_VL;
typedef priority_queue<VL, vector<VL>, greater<VL>> PQ_ASC_VL;
typedef priority_queue<PLL> PQ_DESC_PLL;
typedef priority_queue<PLL, vector<PLL>, greater<PLL>> PQ_ASC_PLL;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    int n;cin>>n;
    VI l(n);
    REP(i,n){
        cin>>l[i];
    }
    SORT_ASC(l);
    int sum = 0;
    REP(i,n-1){
        sum += l[i];
    }
    if(sum > l[n-1]){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

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

int main() {
    string s;
    cin >> s;
    rep(i, 0, s.size() - 1) {
        if(s[i] == 'A' && s[i + 1] == 'C'){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

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

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0, a; i < N; i++) {
		cin >> a;
		A[i] = a;
	}
	sort(A.begin(), A.end());
	float sum = (A[0] + A[1]) / 2.0f;
	for (int i = 2; i < N; i++) {
		sum = (sum + A[i]) / 2.0f;
	}
	cout << sum;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int in = 1;
	int i = 1;
	while( scanf("%d", &in) != EOF ){
		if(in == 0) {
			break;
		} else {
			printf("Case %d: %d\n", i, in);
			i++;
		}
	}

	return 0;
}

Measured memory_bytes: 600
# %%
n = int(input())
def func(n):
    flag = True
    ans = 0
    i = 5
    while flag == True:
        temp = n // (i *2)
        ans += temp
        i = i*5
        if temp == 0:
            flag = False
    return ans

if (n % 2 )!= 0:
    print(0)
else:
    print(func(n))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
  cin>>s;
  if(s.size()&1)
    cout<<"No\n";
  else
  {
        bool game=true;
  for(int i=0;i<s.size()-1;i+=2)
  {
  		if(s[i]!='h'||s[i+1]!='i')
        {
        		game=false;
          break;
        }
  }
  if(game)
    cout<<"Yes\n";
  else
    cout<<"No\n";
  }

}


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

int main() {
    string s;
    cin >> s;

    int count = 0;

    for (int i = 0; i < s.length() / 2; i++) {
        char c_1 = s[i], c_2 = s[s.length() - 1 - i];
        if (c_1 != c_2) count++;
    }

    cout << count << endl;

}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;

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

    int n;
    cin >> n;
    int* dp = new int[n];
    int h1, h2;
    cin >> h1 >> h2;
    dp[0] = 0;
    dp[1] = abs(h1 - h2);
    for (int i = 2; i < n; i++)
    {
        int h;
        cin >> h;
        dp[i] = min(dp[i - 1] + abs(h - h2), dp[i - 2] + abs(h - h1));
        h1 = h2;
        h2 = h;
    }
    cout << dp[n - 1] << endl;

    return 0;
}

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

using namespace std;

int digits[10];

bool works(int x){
	bool is = true;
	while(x){
		int d = x%10;
		if(digits[d]==1){
			is = false;
			break;
		}
		x/=10;
	}
	return is;
}

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

	while(k--){
		int c;
		cin >> c;
		digits[c] = 1;
		//cout << "se marco el digito " << c << endl;
	}
	bool found = false;
	while(!found){
		if(works(n))break;
		else{
			n++;
		}
	}
	cout << n << endl;

	return 0;
}

Measured memory_bytes: 256