akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

int main(){

    int i, j, W, H;

    while(1){
	    scanf("%d %d", &W, &H);
	    if ((W == 0) && (H == 0)) {
	    	break;
	    }
	    for ( i = 0 ; i < W ; i++ ) {
	    	for ( j = 0 ; j < H ; j++ ) {
	    		printf("#");
	    	}
		    printf("\n");
	    }
	    printf("\n");
	}
    return 0;
}

Measured memory_bytes: 572
# define _CRT_SECURE_NO_WARNINGS 1
# include <iostream>
# include <string>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <set>
# include <map>
# include <stack>
using namespace std;
# define M_PI 3.141592
# define FOR(i,n) for(int i=0;i<(int)n;i++)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define toRad 2.0*M_PI/360.0
# define inin(x) int x;cin>>x;
# define all(x) x.begin(),x.end()
# define debug(x) cout<<#x<<" :"<<x<<endl;
# define rep(i,n) for(int i=0;i<(int)n;i++)
# define EPS 1e-12
# define pri_max 60000
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;


int main()
{
	int v;
	while (cin >> v&&v)
	{
		int ans = INT_MAX;
		for (int a = 0;a<=30; a++)
		{
			for (int b = 0;b<=30; b++)
			{
				for (int c = 0; c <= 30; c++)
				{
					if (a * 200 + b * 300 + c * 500 == v)
					{
						int temp = a * 380 + b * 550 + c * 850;
						temp -= (a / 5) * 5 * (380 * 0.2);
						temp -= (b / 4) * 4 * (550 * 0.15);
						temp -= (c / 3) * 3 * (850 * 0.12);
						ans = min(ans, temp);
					}
				}
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1160
using System;

class Program
{
	static void Main(string[] args)
	{
        int W,H,x,y,r;

		string[] s = Console.ReadLine().Split(' ');

		// int a = int.Parse(Console.ReadLine());

		W = int.Parse(s[0]);
		H = int.Parse(s[1]);
        x = int.Parse(s[2]);
        y = int.Parse(s[3]);
        r = int.Parse(s[4]);

		if (r <= x && x <= W - r && r <= y && y <= H - r)
		{
			Console.WriteLine("Yes");

		}
		else
		{
			Console.WriteLine("No");
		}




		//Console.WriteLine("");


	}
}

Measured memory_bytes: 8860
from itertools import accumulate as acc
N, K, *a = map(int, open(0).read().split())
*b, = map(lambda x: max(x, 0), a)
*Sa, = acc([0] + a)
*Sb, = acc([0] + b)
print(max(Sb[i] + max(0,Sa[i+K]-Sa[i]) + Sb[N]-Sb[i+K] for i in range(N-K+1)))

Measured memory_bytes: 18444
#include<iostream>
using namespace std;
int main()
{
   int a,b,i;
   cin>>a>>b;
   if(a<b)
   {
       for(i=1;i<=b;i++)
       {
           cout<<a;
       }
   }
   else
   {
       for(i=1;i<=a;i++)
       {
           cout<<b;
       }

   }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 3520
using namespace std;

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <limits>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <numeric>
typedef long long ll;
typedef pair<int,int> p;

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




int main()
{
  // input & declare
  string s;
  cin >> s;
  int sum = 0;
  for(int i = 0; i < 6; i++)
  {
    if (s[i] == '1') {
      sum++;
    }
  }
  std::cout << sum << '\n';

}


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

const int maxn = 5005;

int n, m, res;
int f[maxn][maxn];

int main() {
    ///freopen("test.txt", "r", stdin);
    ios_base::sync_with_stdio(0);
    cin >> n >> m;
    while (m --) {
        int a, b, x; cin >> a >> b >> x;
        f[a][b] = max(f[a][b], x + 1);
    }
    for (int i = 1; i <= n; i ++) {
        for (int j = 1; j <= i; j ++) {
            f[i][j] = max(f[i][j], max(f[i - 1][j - 1], f[i - 1][j]) - 1);
            ///cout << f[i][j] << ' ';
            if(f[i][j]) res ++;
        }
        ///cout << endl;
    }
    cout << res << endl;
}

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

namespace {

#ifdef LOCAL
#define run_if_local(statement) statement
#else
#define run_if_local(statement)
#endif

#ifdef LOCAL
auto start_timestamp = clock();
void tag_execution_time() {
  std::cerr << "Execution timestamp: " << std::setprecision(4) << std::fixed
            << ((double)clock() - start_timestamp) / CLOCKS_PER_SEC << "s\n";
}
#else
void tag_execution_time() {}
#endif

template <typename Arg, typename... Args>
void __internal_print(std::ostream& out, Arg&& arg, Args&&... args) {
  out << std::forward<Arg>(arg);
  using expander = int[];
  (void)expander{0, (void(out << ' ' << std::forward<Args>(args)), 0)...};
  out << "\n";
}

template <typename Arg, typename... Args>
void __internal_read(Arg&& arg, Args&&... args) {
  std::cin >> std::forward<Arg>(arg);
  using expander = int[];
  (void)expander{0, (void(std::cin >> std::forward<Args>(args)), 0)...};
}

#define __internal_print_array(out, start, end)     \
  for (auto iter = start; iter != end; ++iter) {    \
    out << *iter << (iter + 1 == end ? "\n" : " "); \
  }

#define __internal_print_2d_array(out, array, rows, cols) \
  for (int i = 1; i <= rows; ++i) {                       \
    for (int j = 1; j <= cols; ++j) {                     \
      out << array[i][j] << (j == cols ? "\n" : " ");     \
    }                                                     \
  }

#define print(...) __internal_print(std::cout, __VA_ARGS__)
#define debug(...) __internal_print(std::cerr, __VA_ARGS__)
#define print_array(start, end) __internal_print_array(std::cout, start, end)
#define debug_array(start, end) __internal_print_array(std::cout, start, end)
#define print_2d_array(array, rows, cols) __internal_print_2d_array(std::cin, array, rows, cols)
#define read(...) __internal_read(__VA_ARGS__)
#define read_array(array, start, end)     \
  for (int _i = start; _i <= end; ++_i) { \
    std::cin >> (array)[_i];              \
  }
#define read_2d_array(array, n, m) \
  for (int i = 1; i <= n; ++i) {   \
    for (int j = 1; j <= m; ++j) { \
      std::cin >> array[i][j];     \
    }                              \
  }

#define update_max(a, b) if ((a) < (b)) (a) = (b)
#define update_min(a, b) if ((a) > (b)) (a) = (b)

}  // namespace

const int N = 10;

void run(int case_id = 0) {
  int n;
  read(n);
  print(n * n * n);
}

void multi_cases_main() {
  int num_tests;
  std::cin >> num_tests;
  for (int t = 1; t <= num_tests; ++ t) {
    run(t);
  }
}

int main() {
  std::ios::sync_with_stdio(false);
  run();
  return 0;
}


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

using namespace std;

int digit_sum(int n) {
  int ans = 0;
  while (n > 0) {
    ans += n % 10;
    n /= 10;
  }
  return ans;
}

int main() {
  int n;
  cin >> n;
  int ans = 1e9;
  for (int i = 1; i < n; i++) {
    ans = min(ans, digit_sum(i) + digit_sum(n - i));
  }
  cout << ans << endl;
}

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

using namespace std;

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

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

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

const string YES = "Yes";
const string NO = "No";

void solve(long long A, long long B, long long C, long long K) {
    while (A >= B) B *= 2, K--;
    while (B >= C) C *= 2, K--;
    if( K >= 0 ){
        cout << YES << endl;
    }else{
        cout << NO << endl;
    }

}

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


Measured memory_bytes: 3768
#include<stdio.h>
int main ()
{
	int a,b,c,d,e,i,j;
	int x[31]={0};
	for(i=0;i<28;i++)
	{
		scanf("%d",&a);
		x[a]=a;
	}
	for(i=1;i<=30;i++)
	{
		if(x[i]==0)
		{
	printf("%d\n",i);
		}
	}
	
	return 0;
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
using namespace std;
typedef unsigned long long ll;
typedef pair<int,int> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
// cout << fixed << setprecision(10) << ans << endl;
// *min_element(c + l, c + r) *max_element(c + l, c + r)
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// struct Edge {
//   int to, id;
//   Edge(int to, int id): to(to), id(id) {}
// };


int main() {
  ll N;cin>>N;
  if(N%2==1 || N<=9) {
    cout<<0<<endl;
    return 0;
  }
  ll ten = 10;
  ll ans = 0;
  while(1){
    ans += (N/ten);
    if(ten*5>N) break;
    ten*=5;
  }
  cout<<ans<<endl;
}


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

const int MOD=998244353;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

/*
#include <atcoder/segtree>
using namespace atcoder;
*/

int main(){
	string s="ACL";
	int K;cin>>K;
	rep(i,K)cout<<s;
	cout<<endl;
}

Measured memory_bytes: 3572
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

# https://atcoder.jp/contests/abc076/tasks/abc076_c
# Tの位置は全探索可能
# その他で?があればすべてaに埋めてしまえばいい

S = input()
T = input()
for i in range(len(S) - len(T), -1, -1):  # iの位置からTの挿入を試みる
    sub = S[i:i + len(T)]
    is_ok = True
    for s, t in zip(sub, T):
        if s == '?':
            continue
        if s == t:
            continue
        else:
            is_ok = False
            break
    if is_ok:
        break
else:
    print('UNRESTORABLE')
    exit()

ans = S[:i] + T + S[i + len(T):]
ans = ans.replace('?', 'a')
print(ans)


Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}


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

    vector<int> a(N);
    REP(i,N) cin >> a[i];

    sort(ALL(a));

    int cnt = 0;
    REP(i,N) {
        if ( x-a[i] >= 0 ) {
            x-=a[i];
            cnt++;
        }else break;
    }

    if (x != 0 ){
        if (cnt == N)cnt--;
    }

    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.util.Arrays;

/**
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_4_D
 * 
 * @author eitatsuro
 * 
 */
public class Main {
    private final static String SPACE = " ";
    public static void main(String[] args) {
        try {
            LineNumberReader stdReader = new LineNumberReader(
                    new InputStreamReader(System.in));
            
            String sStr;
            int n = 0;
            int[] an = null;
            while ((sStr = stdReader.readLine()) != null) {
                if (stdReader.getLineNumber() == 1) {
                    String[] inputs = sStr.split(" ");
                    n = Integer.valueOf(inputs[0]);
                }
                
                if (stdReader.getLineNumber() == 2) {
                    String[] inputs = sStr.split(" ");
                    int i = 0;
                    an = new int[n];
                    for (String input : inputs) {
                        an[i] = Integer.parseInt(input);
                        i++;
                    }
                }
            }
            // sort by ascending order.
            Arrays.sort(an);
            System.out.print(an[0]);
            System.out.print(SPACE);
            System.out.print(an[n - 1]);
            System.out.print(SPACE);
            long sum = 0;
            for (int a : an) {
                sum += a;
            }
            System.out.println(sum);
            
            stdReader.close();
        } catch (Exception e) {
            System.exit(-1);
        }
    }
}

Measured memory_bytes: 28708
#include<iostream>
#include<vector>
using namespace std;
typedef long long li;
//#define ceil(a,b) (((a)+(b)-1)/(b))
li ceil(li a,li b){
  return a/b+(a%b?1:0);
}
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

int main(){
  li n; cin >>n;
  vector<li> a(n);rep(i,n) cin >>a[i];
  if(a[n-1]!=2){
    print(-1);
    return 0;
  }
  li mi=2,ma=4;
  rep(_i,n){
    int i=n-1-_i;
    mi=ceil(mi,a[i])*a[i];
    ma=ceil(ma,a[i])*a[i];
  }
  if(mi==ma) print(-1);
  else print(mi,ma-1);
}


Measured memory_bytes: 4044
// AOJ 0557
#include <iostream>

using namespace std;

int main()
{
	int n;
	int num[128];
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> num[i];
	}

	long long dp[128][32] = {};
	dp[1][num[0]] = 1;
	for (int i = 1; i < n - 1; i++){
		for (int j = 0; j < 32; j++){
			if (!dp[i][j]) continue;
			int kotori = j + num[i], hanayo = j - num[i];
			if (0 <= kotori && kotori <= 20){
				dp[i + 1][kotori] += dp[i][j];
				// cout << dp[i + 1][kotori] << endl;
			}
			if (0 <= hanayo && hanayo <= 20){
				dp[i + 1][hanayo] += dp[i][j];
				// cout << dp[i + 1][hanayo] << endl;
			}
		}
	}
	// for (int i = 0; i < 32; i++){
	// 	cout << dp[n - 1][i] << " ";
	// }
	// cout << endl;
	cout << dp[n - 1][num[n - 1]] << endl;

	return 0;
}

Measured memory_bytes: 1196
#include<stdio.h>

int main(){
  int a,b,c;
  
  scanf("%d",&a);
  scanf("%d",&b);
  scanf("%d",&c);
  
  if(a < b && b < c){
      printf("Yes\n");
  }
  else{
      printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 2136
#include <bits/stdc++.h>
using namespace std;
#define int         long long
#define rep(i,a,b)  for (int i = a; i < b; ++i)
#define rrep(i,z,a) for (int i = z; i >= a; --i)
#define rep0(n)     for(int i = 0 ; i < n; ++i )
#define rep1(n)     for(int i = 1 ; i <= n; ++i )
#define pb          push_back
#define sd(x)       scanf("%d",&x)
#define tc          int test;cin>>test; while(test--)
#define all(v)      v.begin(),v.end()
#define ff          first
#define ss          second
#define mp          make_pair
#define IOS         ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl        "\n"
#define spc         " "
#define mem0(a)     memset(a,0,sizeof(a))
#define extime      cout << endl << endl << "____"<<(float)clock() / CLOCKS_PER_SEC << "s____";
#define maxn        998244353
#define mod         1000000007
//#define ll          long long int
//typedef vector<ll>  vll;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
void OJ()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
int solve()
{
	int n;
	cin >> n;
	int l[n], cnt = 0;
	rep0(n)cin >> l[i];
	sort(l, l + n);
	if (n < 3)return cout << 0,0;
	else
	{
		for (int i = 0; i < n; i++)
			for (int j = i + 1; j < n; j++)
				for (int k = j + 1; k < n; k++)
					if (l[i] + l[j] > l[k] && l[i] != l[j] && l[i] != l[k] && l[j] != l[k])cnt++;
	}
	cout << cnt;
	return 0;
}
signed main()
{
	OJ();
	IOS
	//tc
	solve();
	//extime
	return 0;
}

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

using ll=long long int;

int main()
{
    ll n,w;
    cin >> n >> w;
    ll val[n+1],wght[n+1];
    val[0] = wght[0] = 0;
    for(ll i=1;i<=n;i++)
        cin >> wght[i] >> val[i];
    
    ll dp[n+1][w+1];
    for(ll i=0;i<=n;i++) {
        for(ll j=0;j<=w;j++)
            dp[i][j] = 0;
    }

    for(ll i=1;i<=n;i++)
    {
        for(ll j=1;j<=w;j++)
        {
            if(j < wght[i])
                dp[i][j] = dp[i-1][j];
            else
                dp[i][j] = max(dp[i-1][j-wght[i]] + val[i], dp[i-1][j]);
        }
    }

    cout << dp[n][w];
    return 0;
}

Measured memory_bytes: 79104
import java.io.*;

class Main
{
  public static void main(String[] args) throws IOException
  {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringBuilder sb = new StringBuilder();

    int n = Integer.parseInt(br.readLine());
    if(n < 3 || n > 10000) System.exit(-1);

    for(int i = 1; i <= n; i++){

      if(i % 3 == 0){
        sb.append(" " + i);
        continue;
      }

      int x = i;
      do{
        if(x % 10 == 3){
          sb.append(" " + i);
          break;
        }
        x /= 10;
      }while(x > 0);
    }
    System.out.println(sb);
  }
}

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

int main(){
  int N;
  cin >> N;
  int oshop[N][10];//shop 曜日 時間帯  
  rep(i,N){
    rep(j,10){
      cin >> oshop[i][j];
    }
  }
  int p[N][11];//装置 被っている数
  rep(i,N){
    rep(j,11){
      cin >> p[i][j];
    }
  }
  //  cout <<  p[1][1] << endl;
  int ans=-INT_MAX;
  for(int bit=1; bit < (1<<10); bit++){
    int open[N];
    rep(j,N) open[j]=0;
    rep(i,10){
      if(bit & (1<<i)){
	rep(j,N){
	  if(oshop[j][i]==1) open[j]++;
	}	  
      }
    }
    int profit=0;
    rep(i,N) profit+=p[i][open[i]];
    /*    if(profit==0){
      cout << bitset<10>(bit) << endl;
      rep(i,N) cout << open[i];
      cout << ""  << endl;
      rep(i,N) cout << p[i][open[i]] << " ";
      cout << "" << endl;
      }*/
    ans=max(ans,profit);    
  }
  cout << ans << endl;

    
  return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(long long i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define rrep(i,n) for(long long i=int(n);i>0;i--)
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+5  
using ll = long long;
using P = pair<int, int>;
using lP = pair<ll, ll>;
using fP = pair<double, double>;
using PPI = pair<P, int>;
//ll const mod=998244353;
ll const mod = 1e9 + 7;
const ll MAX = 1000005;
using vi = vector<int>;
using vl = vector<ll>;
using vc = vector<char>;
using vd = vector<double>;
using vs = vector<string>;
using vp = vector<P>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvd = vector<vector<double>>;
using vvc = vector<vector<char>>;
using vvp = vector<vector<P>>;
using vvb = vector<vector<bool>>;
template <typename T>
bool chmax(T& a, const T b) { if (a < b) { a = b; return true; } return false; }
template <typename T>
bool chmin(T& a, const T b) { if (a > b) { a = b; return true; } return false; }
const ll LINF = 1e18 + 1;
int main() {
    int n;
    cin >> n;
    vvi f(n, vi(20));
    rep(i, n) {
        rep(j, 10) {
            cin >> f[i][j];
        }
    }
    vvi p(n, vi(15));
    rep(i, n)rep(j, 11)cin >> p[i][j];
    ll ans = -LINF;
    arep(i, 1, 1 << 10) {
        ll res = 0;
        vi cnt(n);
        rep(j, 10) {
            if (i >> j & 1) {
                rep(k, n) {
                    if (f[k][j] == 1)cnt[k]++;
                }
            }
        }
        rep(i, n)res += p[i][cnt[i]];
        chmax(ans, res);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3640
#include <stdio.h>
int n,a[110001];
void MRoy(){
    scanf("%d",&n);
    for ( int i = 0; i < n; i++){
        scanf("%d",a+i);
    }
    int Ans = 0, cnt = 0;
    for( int i=n-2;i>=0;i--){
        if(a[i]>=a[i+1]) cnt++;
        else cnt = 0;
        Ans = Ans<cnt?cnt:Ans;
    }
    printf("%d\n",Ans);
}
int main(){
    MRoy();
    return 0;
}

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

#define rep(i,n) for(ll i=0;i<n;i++)
#define repm(i,m,n) for(ll i=m;i<n;i++)
#define max(a,b) (((a)>(b))?(a):(b))
#define min(a,b) (((a)<(b))?(a):(b))
#define YesNo(a) (a)?cout<<"Yes"<<endl:cout<<"No"<<endl
#define YESNO(a) (a)?cout<<"YES"<<endl:cout<<"NO"<<endl
#define INF (2e9)
#define PI (acos(-1))
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007

typedef long long ll;

int main(){
  int n,m; cin >> n >> m;
  int a[m]; rep(i,m) cin >> a[i];

  int sum = 0;
  rep(i,m) sum += a[i];

  cout << max(-1, n-sum) << endl;
}

Measured memory_bytes: 3632
#include "bits/stdc++.h"
#define MOD 1000000007
#define INF 11234567890
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int A, B, C;
int A_c;

int main()
{
	in >> A >> B >> C;

	A_c = A;
	rep(loop, B)
	{
		if (A%B == C)
		{
			out << "YES" << std::endl;
			return 0;
		}
		A += A_c;
	}
	out << "NO" << std::endl;
	return 0;
}

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

class FordFulkerson {
    const int INF = 1e9;
    struct edge {
        int to, cap, rev;
    };

    int n;
    vector<vector<edge>> G;
    vector<bool> used;

    int dfs(int v, int t, int f) {
        if (v == t) return f;
        used[v] = true;

        for (edge& e : G[v]) {
            if (!used[e.to] && e.cap > 0) {
                int d = dfs(e.to, t, min(f, e.cap));
                if (d > 0) {
                    e.cap -= d;
                    G[e.to][e.rev].cap += d;
                    return d;
                }
            }
        }
        return 0;
    }

public:
    FordFulkerson(int n) : n(n), G(n), used(n) {}

    void add_edge(int from, int to, int cap) {
        G[from].push_back({to, cap, (int) G[to].size()});
        G[to].push_back({from, 0, (int) G[from].size() - 1});
    }

    int max_flow(int s, int t) {
        int flow = 0;
        while (1) {
            used.assign(n, false);
            int f = dfs(s, t, INF);
            if (f == 0) return flow;
            flow += f;
        }
    }
};

int main() {
    int n, m;
    cin >> n >> m;
    FordFulkerson flow(n);
    for (int i = 0; i < m; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        flow.add_edge(a, b, c);
    }
    cout << flow.max_flow(0, n - 1) << endl;
}


Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
#define int lint
typedef long long lint;
typedef pair<int ,int> P;
const int    INF = (int)1e9;
const int    MOD = (int)1e9+7;
const double EPS = (double)1e-10;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0);cout << fixed << setprecision(20);
    };
};



signed main(){
  int H,W,N;cin>>H>>W>>N;

  map<P,int>mp;
  for(int t=1;t<=N;t++){
    int a,b;cin>>a>>b;
    for(int x=0;x<=2;x++){
      for(int y=0;y<=2;y++){
        if(a-y<1||b-x<1)continue;
        mp[make_pair(a-y,b-x)]++;
      }
    }
  }

  int ans[20];
  memset(ans,0,sizeof(ans));

  for(auto e:mp){
    if(e.first.first<1||e.first.second<1||e.first.first>H-2||e.first.second>W-2)continue;
    ans[e.second]++;
  }

  ans[0]=(H-2)*(W-2);
  for(int t=1;t<10;t++)ans[0]-=ans[t];

  for(int t=0;t<10;t++)cout<<ans[t]<<endl;
  return 0;
}


Measured memory_bytes: 56448
# include <bits/stdc++.h>
#define INF 1e9
using namespace std;

int main(){

  int n = 5;
  int mod = 10;
  int a[n];
  int min_r = INF;
  int min_i = -1;
  for(int i=0; i < n; i++){
    cin >> a[i];
    int r = a[i] % mod;
    if(r > 0 && r < min_r){
      min_r = r;
      min_i = i;
    }
  }
  // cout << min_i << endl;
  int ans;
  for(int i=0; i < n; i++){
    if(i != min_i){
      ans += ceil((double) a[i] / (double) mod) * mod;
    } else {
      ans += a[i];
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    int n; cin>>n;
    cout<<(n+999)/1000*1000-n<<endl;
}

Measured memory_bytes: 3592
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<utility>
#include<cmath>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e9;
ll N;

int main(){
    while(cin>>N,N!=0){
        P p[210];
        ll minx=0,miny=0,maxx=0,maxy=0;
        p[0]=P(0,0);
        for(int i=1;i<=N-1;i++){
            ll n,d;
            cin>>n>>d;
            ll dx[4]={ -1, 0, 1, 0};
            ll dy[4]={ 0, 1 , 0,-1};
            p[i]=P(p[n].first+dx[d],p[n].second+dy[d]);
            maxx=max(maxx,p[i].first);
            maxy=max(maxy,p[i].second);
            minx=min(minx,p[i].first);
            miny=min(miny,p[i].second);
        }
        cout<<maxx-minx+1<<" "<< maxy-miny+1<<endl;
    }
    return 0;
}


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

int main(){
  ll ans,n,i,c,pans;
  cin >> n;
  ll a[n+1],b[n+1];
  for(i=0;i<=n;i++){
    b[i]=0;
  }
  for(i=1;i<=n;i++){
    cin >> c;
    a[i]=c;
    b[c]+=1;
  }
  ans=0;
  for(i=1;i<=n;i++){
    if(b[i]>1){
      c=b[i];
      ans+=c*(c-1)/2;
    }
  }
  for(i=1;i<=n;i++){
    pans=ans;
    c=a[i];
    c=b[c];
    if(c>=2){
      pans-=c-1;
    }
    cout << pans << endl;
  }
}

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

int main() {
    int n;
    cin >> n;
    int a[n][3];
    for (int i = 0; i < n; i++) {
        cin >> a[i][0] >> a[i][1] >> a[i][2];
    }
    int dp[n][3];
    memcpy(dp, a, sizeof(a));
    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: 2560
#include<bits/stdc++.h>

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define per(i, a, n)  for(int i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MAX 1000000001;
using namespace std;
typedef long long ll;

int n,T;

int main(){
  std::cin >> n >> T;
  int res = MAX;
  int res_ans = 0;
  int c, t;
  rep(i,1,n+1){
    std::cin >> c >> t;
    if(t <= T && c<res){
      res = c;
      res_ans = i;
    }
  }
  if(res_ans != 0){
    std::cout << res << '\n';
  }else{
    std::cout << "TLE" << '\n';
  }

}


Measured memory_bytes: 256
#include<math.h>
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ll long long int
#define ull unsigned long long
#define py printf("Yes\n")
#define pn printf("No\n")
#define in cin>>
using namespace std;
int INF = 1001001001;
const int MOD=1e9+7;

int main()
{
    string a,b;
    cin>>a>>b;
    if(a.length() < b.length())
    {
        cout<<"LESS"<<endl;
        return 0;
    }
    if(a.length() > b.length())
    {
        cout<<"GREATER"<<endl;
        return 0;
    }

    rep(i,a.size())
    {
        if(a[i]-'0' < b[i]-'0')
        {
            cout<<"LESS"<<endl;
            return 0;
        }
        if(a[i]-'0' > b[i]-'0')
        {
            cout<<"GREATER"<<endl;;
            return 0;
        }
    }
    cout<<"EQUAL"<<endl;;
}


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

using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))

#define MOD 1000000007
#define INF 1000000000

ll N;
ll a[200005];
int main()
{
    cin >> N;
    ll sunuke = 0;
    ll arai = 0;
    ll ans = 9223372036854775800;
    REP(i, N) {
        cin >> a[i];
        arai += a[i];
    }
    REP(i, N-1) {
        sunuke += a[i];
        arai -= a[i];
        ans = min(ans, abs(sunuke-arai));
    }
    printf("%lld\n", ans);

    return 0;
}


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

int main(){
	long N;
	cin >> N;
	vector<long> A(N);
	for (long i = 0; i < N; i++){
		cin >> A[i];
	}
	bool flag = 1;
	long cnt = 0;
	while (flag){
		flag = 0;
		for (long j = N - 1; j > 0; j--){
			if (A[j] < A[j - 1]){
				long tmp = 0;
				tmp = A[j];
				A[j] = A[j - 1];
				A[j - 1] = tmp;
				flag = 1;
				cnt++;
			}
		}
	}
	for (long i = 0; i < N - 1; i++){
		cout << A[i] << " ";
	}
	cout << A[N - 1] << endl;
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 1196
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int Q = sc.nextInt();
        sc.nextLine();
        String[] queries = new String[Q];
        for (int i = 0; i < queries.length; ++i) {
            queries[i] = sc.nextLine();
        }

        System.out.println(solve(queries));

        sc.close();
    }

    static String solve(String[] queries) {
        List<String> result = new ArrayList<>();

        PriorityQueue<Integer> leftHalf = new PriorityQueue<>(Collections.reverseOrder());
        long leftSum = 0;
        PriorityQueue<Integer> rightHalf = new PriorityQueue<>();
        long rightSum = 0;
        int middle = Integer.MIN_VALUE;
        long bSum = 0;

        for (String query : queries) {
            String[] parts = query.split(" ");
            if (parts[0].equals("1")) {
                int a = Integer.parseInt(parts[1]);
                int b = Integer.parseInt(parts[2]);

                if (middle == Integer.MIN_VALUE) {
                    if (leftHalf.isEmpty() || a <= leftHalf.peek()) {
                        leftHalf.offer(a);
                        leftSum += a;

                        middle = leftHalf.poll();
                        leftSum -= middle;
                    } else {
                        rightHalf.offer(a);
                        rightSum += a;

                        middle = rightHalf.poll();
                        rightSum -= middle;
                    }
                } else {
                    if (a <= middle) {
                        leftHalf.offer(a);
                        leftSum += a;

                        rightHalf.offer(middle);
                        rightSum += middle;
                    } else {
                        leftHalf.offer(middle);
                        leftSum += middle;

                        rightHalf.offer(a);
                        rightSum += a;
                    }

                    middle = Integer.MIN_VALUE;
                }

                bSum += b;
            } else {
                int x = (middle == Integer.MIN_VALUE) ? leftHalf.peek() : middle;
                long fx = rightSum - leftSum + bSum;

                result.add(String.format("%d %d", x, fx));
            }
        }

        return String.join("\n", result);
    }
}

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


int main(){
    long long n,a[300000];
    cin >> n;
    for (int i=1;i < n;i++){
        cin >> a[i];
    }

    long long b[300000] = {0};
    for (int i = 1;i <= n;i++){
        b[a[i]]++;
    }
    for(int i = 1;i <= n;i++){
        cout << b[i] << endl;
    }

}

Measured memory_bytes: 7544
import math

h,w=map(int,input().split())

if h == 1:
    print(1)
    exit()
if w == 1:
    print(1)
    exit()

a1 = math.floor(h / 2)
a2 = math.ceil(h / 2)
b1 = math.floor(w / 2)
b2 = math.ceil(w / 2)


print((a1 * b1) + (a2 * b2))

Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<functional>
#include<cstring>
#include<string>
#include<vector>
#include<queue>
#include<cmath>
#include<algorithm>
#include<map>
#include<ctime>
using namespace std;
typedef long long ll;
typedef long double ld;
const int maxn = 2e5+7;
const int inf = 1e5;
const int modn = 1e9+7;
const ld eps = 1e-8;
const long double PI = acos(-1.0);
void qRead(ll &x){x = 0;char a;for(a = getchar();a <'0' || a > '9';a = getchar());for(;a >= '0' && a <= '9';a = getchar())x = x*10 + a-'0';}
void qRead(int &x){x = 0;char a;for(a = getchar();a <'0' || a > '9';a = getchar());for(;a >= '0' && a <= '9';a = getchar())x = x*10 + a-'0';}
ll qpow(ll a,ll b,ll mo = modn){
//    printf("%lld\n",mo);
    ll res = 1;
    while(b){
        if(b & 1)res = (res*a) % mo;
        a = (a*a) % mo;
        b >>= 1;
    }
    return res;
}
ld qpow(ld a,ll b){
    ld res = 1;
    while(b){
        if(b & 1)res *= a;
        a = a*a;
        b >>= 1;
    }
    return res;
}
ll gcd(ll a,ll b){
    if(!b)return a;
    return gcd(b,a%b);
}
//ll vis[maxn],prime[maxn],cnt,smallP[maxn];
//void getPrime(int n){
//    cnt = 0;
//    for(int i = 1;i <= n;i++)vis[i] = 0;
//    for(ll i = 2;i <= n;i++){
//        if(!vis[i]){
//            prime[++cnt] = i;
//            smallP[i] = i;
//        }
//        for(int j = 1;j <= cnt && i*prime[j] <= n;j++){
//            vis[prime[j]*i] = 1;
//            smallP[prime[j]*i] = prime[j];
//            if((i % prime[j]) == 0)break;
//        }
//    }
//}
ll f[maxn],invF[maxn];
void getF(){
    f[0] = invF[0] = 1;
    for(int i = 1;i < maxn;i++){
        f[i] = f[i-1] *i %modn;
//        printf("%lld\n",f[i]);
    }
    invF[maxn-1] = qpow(f[maxn-1],modn-2);
    for(int i = maxn-2;i >= 1;i--){
        invF[i] = invF[i+1]*(i+1) % modn;
    }
//    for(int i = 1;i <= maxn-1;i++)if((invF[i]*f[i] % modn) != 1)printf("%d\n",i);
}
int main(){
    getF();
    int h,w,a,b;
    scanf("%d%d%d%d",&h,&w,&a,&b);
//    printf("%d %d %d %d\n",h,w,a,b);
    ll ans = 0;
    for(int i = 1;i <= h - a;i++){
        ans = (ans + f[b-1+i-1]*invF[b-1] % modn *invF[i-1] % modn*f[h-i+w-b-1] % modn * invF[h-i] % modn * invF[w-b-1] % modn) % modn;
//        printf("%d %d %d ||| %d %d %d\n",b-1+i-1,b,i-1,h-i+w-b-1,h-i,w-b-1);
//        printf("%lld %lld %lld ||| %lld %lld %lld\n",f[b-1+i-1],invF[b-1],invF[i-1],f[h-i+w-b-1],invF[h-i],invF[w-b-1]);
//        printf("%lld\n",ans);
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 3328
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	static BufferedReader reader;
	
	public static void main(String[] args){
		reader = new BufferedReader(new InputStreamReader(System.in));
		String[] argA = readLine().split(" ");
		if(argA.length<1){return;}
		try{
			int N = Integer.parseInt(argA[0]);
			String[] argB = readLine().split(" ");
			if(argB.length!=N){return;}
			int[] L = new int[N];
			for(int i=0;i<N;i++){
				L[i]=Integer.parseInt(argB[i]);
			}
			for(int i=0;i<N;i++){
				int sum_other = 0;
				for(int j=0;j<N;j++){
					if(j==i){continue;}
					sum_other+=L[j];
				}
				if(L[i]>=sum_other){System.out.print("No");return;}
			}
			System.out.print("Yes");return;
		}catch(Exception e){
			e.printStackTrace();
		}
		return;
	}

	private static String readLine(){
		//BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		try{
			return reader.readLine();
		}catch(Exception e){
			return e.getMessage();
		}
	}
}

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

int main() {
  string s, t;
  cin >> s >> t;
  
  if (s.size()+1==t.size() && s==t.substr(0,s.size())) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
      
      

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

typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define DECIM8  fixed<<setprecision(8) 
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

using namespace std;
int main(void)
{
  for(;;){
    int n,m;
    cin >> n >> m;
    if(!n&&!m) return 0;
    vector<int> t,h;
    int diff=0;
    t.resize(n);
    REP(i,n) cin >> t[i];
    REP(i,n) diff += t[i];
    h.resize(m);
    REP(i,m) cin >> h[i];
    REP(i,m) diff -= h[i];
    SORT(t);
    SORT(h);
    int st,sh;
    for(st=0,sh=0;st<n&&sh<m;){
      if(diff-(t[st]-h[sh])*2>0) ++st;
      else if(diff-(t[st]-h[sh])*2<0) ++sh;
      else{
	cout << t[st] << ' ' << h[sh] << endl;
	break;
      }
    }
    if(st<n&&sh<m) continue;
    cout << -1 << endl;
  }
}

Measured memory_bytes: 1212
#include <stdio.h>          // printf(), scanf()
#include <stdbool.h>

#define MAX_N 50000
#define MAX_SQRT_N 224
#define MAX_P 5140

bool f[MAX_N + 1];
int count[MAX_N + 1];
int primes[MAX_P];
int np;

int
main(int argc, char **argv)
{
	int i, j;

	for (i = 0; i <= MAX_N; ++i)
		f[i] = true;

	np = 0;
	for (i = 2; i <= MAX_N; ++i)
	{
		if (f[i])
		{
			primes[np++] = i;
			if (i <= MAX_SQRT_N)
			{
				for (j = i + i; j <= MAX_N; j += i)
					f[j] = false;
			}
		}
	}

	for (i = 0; primes[i] <= MAX_N / 2; ++i)
	{
		for (j = i; primes[i] + primes[j] <= MAX_N; ++j)
			count[primes[i] + primes[j]]++;
	}

	while (true)
	{
		int n;
		scanf("%d", &n);
		if (n == 0)
			break;

		printf("%d\n", count[n]);
	}

	return 0;
}

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

int main() {
  int N, M, C, B[30], A[30][30];
  cin >> N >> M >> C;
  for (int i=0; i<M; i++) cin >> B[i];
  for (int n=0; n<N; n++)
    for (int m=0; m<M; m++)
      cin >> A[n][m];
  
  int count=0;
  for (int n=0; n<N; n++) {
    int t=0;
    for (int m=0; m<M; m++) t += A[n][m]*B[m];
    if (t+C > 0) count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <set>
#include <vector>
#include <map>
#include <cstdio>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <cassert>
#include <climits>
#include <numeric>
#include <sstream>
using namespace std;
typedef long long ll;
#define DEBUG
#ifdef DEBUG
	#define debug printf
#else
	#define debug(...)
#endif
int ok(string s)
{
	// printf("%s\n",s.c_str());
	string s2 = s;
	reverse(s2.begin(),s2.end());
	return s2 == s;
}
int main(int argc, char const *argv[])
{
	string s;
	cin>>s;
	int n = s.size();
	printf("%s\n",(ok(s) 
					&& ok(s.substr(0,(n - 1) >> 1)) 
					&& ok(s.substr(((n + 3) >> 1) - 1)))
					? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

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

using namespace std;

int main()
{
    double x,y;
    cin>>x>>y;
    double m = (y-2*x)/2;
    rep(i,x+1){
        if(m==i){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3720
def fib(n):
    if n <= 1:
        return n
    result = [1, 0, 0, 1]
    matrix = [1, 1, 1, 0]
    while n > 0:
        if n % 2:
            result = mul(matrix, result)
        matrix = mul(matrix, matrix)
        n //= 2
    return result[2]

def mul(a, b):
    return [a[0]*b[0] + a[1]*b[2],
            a[0]*b[1] + a[1]*b[3],
            a[2]*b[0] + a[3]*b[2],
            a[2]*b[1] + a[3]*b[3]]





N, M = map(int, input().split())

a= []

for i in range(M):
    a.append(int(input()))

l = ["1"] * (N + 1)

for a_ele in a:
    l[a_ele] = "0"

l = ''.join(l)

# print(l)

if '00' in l:
    print(0)

else:
    l_arr = l.split('0')
    result = 1
    for l_ele in l_arr:
        result *= fib(len(l_ele))

        if result > 1000000007:
            result = result % 1000000007

    result = result % 1000000007

    print(result)


Measured memory_bytes: 7848
from collections import deque

H,W = map(int,input().split())

S = [None]*W
S = [list(input()) for i in range(H)]
light = []
for i in range(H):
    for j in range(W):
        if S[i][j] == "#":
            light.append((i,j))

dx = [1,-1,0,0]
dy = [0,0,1,-1]

not_visited = [[-1]*W for i in range(H)]
stack = deque()
for k in range(len(light)):
    stack.append(light[k])
    i,j = light[k]
    not_visited[i][j] = 0

while stack != deque([]):
    y,x = stack.popleft()
    for i in range(4):
        if 0<= x+dx[i] <W and 0<= y+dy[i] <H and not_visited[y+dy[i]][x+dx[i]] == -1:
            not_visited[y+dy[i]][x+dx[i]] =  not_visited[y][x] + 1
            stack.append((y+dy[i],x+dx[i]))

ans = -1
for i in range(H):
    ans = max(ans,max(not_visited[i]))

print(ans)

Measured memory_bytes: 182484
def temp(t, x):
    return t - x * 0.006


n = int(input())
t, a = map(int, input().split())
hs = list(map(int, input().split()))

index = None
min_diff = float('inf')
for i in range(n):
    diff = abs(temp(t, hs[i]) - a)
    if diff < min_diff:
        min_diff = diff
        index = i
print(index + 1)



Measured memory_bytes: 3060
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

N = I()
a = LI()

ans = 0
for i in range(0,N,2):
    if a[i] % 2 == 1:
        ans += 1

print(ans)

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

int main(void){
	int N;
	cin >> N;
	int var1[100];
	for(int i=0;i<N;i++){
	cin >> var1[i];
	}
	int var2[100];
	for(int i=0;i<N;i++){
	cin >> var2[i];
	}
	int max;
	int ans;
	for(int i = 0;i<=N-1;i++){
	ans=0;
	for(int j = 0;j<=N-1;j++){
	if(j<=i){ans = ans+var1[j];}
	if(j>=i){ans = ans+var2[j];}
}
	if(max<ans){max = ans;}
}
	cout << max<< endl;	
 return(0);
}


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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007

using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int iy[]={0, 0, 1, -1};
int ix[]={1, -1, 0, 0};

int n, m, ans, a[101], b[101], suma[101], sumb[101];

int main(){
	cin >> n;
	for(int i=1;i<=n;i++){
		cin >> a[i];
		suma[i] = a[i]+suma[i-1];
	}
	for(int i=1;i<=n;i++){
		cin >> b[i];
		sumb[i] = b[i]+sumb[i-1];
	}
	for(int i=1;i<=n;i++){
		ans=max(ans, suma[i]+sumb[n]-sumb[i-1]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

int main() {
	int A, B, C;
	cin >> A >> B >> C;
	for (int i = 1; i < B + 1; i++) {
		if ((A*i) % B == C) {
			cout << "YES" << endl;
			return 0;
		}
	}
	cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
nowx = 0
nowy = 0
nowt = 0

result = 'Yes'
for i in range(N):
  [t, x, y] = list(map(int,input().split(' ')))
  if (t - nowt) >= abs(x - nowx) + abs(y - nowy) and ((t - nowt) - (x - nowx) - (y - nowy)) % 2 == 0:
    nowx = x
    nowy = y
    nowt = t
    continue
  else:
    result = 'No'
    break
    
print(result)
    

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  int n;
  cin >> n;
  vector<ll> v(n);
  for (int i = 0; i < n; i++) { cin >> v[i]; }

  ll a = 0;
  for (int i = 0; i < n - 1; i++) {
    a += (v[i] - a) * 2;
  }

  ll ans = (v[n - 1] * 2 - a) / 2;
  for (int i = 0; i < n - 1; i++) {
    cout << ans << " ";
    ans += (v[i] - ans) * 2;
  }
  cout << ans << endl;
}


Measured memory_bytes: 2048
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var stdin = bufio.NewScanner(os.Stdin)

func main() {
	arr := scanArrayInt()
	o := arr[2] - (arr[0] - arr[1])
	if o < 0 {
		fmt.Println(0)
		return
	}
	fmt.Println(o)

}
func scanArrayInt() []int {
	var ret = []int{}
	stdin.Scan()
	for _, s := range strings.Split(stdin.Text(), " ") {
		i, _ := strconv.Atoi(s)
		ret = append(ret, i)
	}
	return ret
}

Measured memory_bytes: 640
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		TreeMap<String, ArrayList<Integer>> map = new TreeMap<>();
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
		    int type = sc.nextInt();
		    String key = sc.next();
		    if (type == 0) {
		        int value = sc.nextInt();
		        if (!map.containsKey(key)) {
		            map.put(key, new ArrayList<>());
		        }
		        map.get(key).add(value);
		    } else if (type == 1) {
		        if (map.containsKey(key)) {
		            for (int x : map.get(key)) {
		                sb.append(x).append("\n");
		            }
		        }
		    } else if(type == 2) {
		        map.remove(key);
		    } else {
		        String end = sc.next();
		        key = map.lowerKey(key);
		        if (key == null) {
		            key = "";
		        }
		        while ((key = map.higherKey(key)) != null && key.compareTo(end) <= 0) {
		            for (int x : map.get(key)) {
		                sb.append(key).append(" ").append(x).append("\n");
		            }
		        }
		    }
		}
		System.out.print(sb);
	}
}



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

// Inserted snippets: io, root
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }
// End snippets

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	int x; read(x);
	write((x + 999) / 1000 * 1000 - x);
}


Measured memory_bytes: 3560