akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 10000;

int N;
int M;
int dp[505][505][3][2][10];

int solve(string& s, int i, int m, int udh, int full, int x){
  int& res = dp[i][m][udh][full][x];
  if(res != -1) return res;
  if(i == N){
	return res = (m == 0? 1: 0);
  }

  res = 0;
  int ub = (full? s[i] - '0' + 1: 10);
  int c = s[i] - '0';
  REP(nx, ub){
	int nfull = full && nx == c;
	int nm = (m * 10 + nx) % M;
	if(udh == 0 && x < nx)
	  (res += solve(s, i+1, nm, 1, nfull, nx)) %= MOD;
	else if(udh == 1 && x > nx)
	  (res += solve(s, i+1, nm, 0, nfull, nx)) %= MOD;
	else if(udh == 2){
	  if(x == 0)
		(res += solve(s, i+1, nm, 2, nfull, nx)) %= MOD;
	  if(x > 0 && nx != x)
		(res += solve(s, i+1, nm, (x<nx?1:0), nfull, nx)) %= MOD;
	}
  }

  return res;
}

void pre(string& s){
  for(int i=SZ(s)-1;i>=0;--i){
	if(s[i] != '0'){
	  s[i]--;
	  break;
	}
	else s[i] = '9';
  }

  if(s[0] == '0' && SZ(s) > 1){
	s.erase(begin(s));
  }
}

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

  string A, B;
  cin >> A >> B;
  cin >> M;
  pre(A);

  fill((int*)dp, (int*)dp+505*505*3*2*10, -1);
  N = SZ(A);
  int fa = solve(A, 0, 0, 2, 1, 0);
  fill((int*)dp, (int*)dp+505*505*3*2*10, -1);
  N = SZ(B);
  int fb = solve(B, 0, 0, 2, 1, 0);
  cout << (fb + MOD - fa) % MOD << endl;

  return 0;
}

Measured memory_bytes: 63040
// We only fail when we stop trying
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define D(x) cerr << #x << " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()

const int N = 1010;
const int Mod = 1e9 + 7;

int n, m;
string s[N];
int dp[N];

int main()
{
  cin >> n >> m;
  for(int i = 0 ; i < n ; i++)
    cin >> s[i];
  for(int i = 0 ; i < m && s[0][i] != '#' ; i++)
    dp[i] = 1;
  for(int i = 1 ; i < n ; i++) {
    for(int j = 0 ; j < m ; j++) {
      if(s[i][j] == '#') dp[j] = 0;
      else if(j > 0) dp[j] = (dp[j] + dp[j - 1]) % Mod;
    }
  }
  cout << dp[m - 1] << endl;
  return 0;
}


Measured memory_bytes: 1280
#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>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
constexpr int inf=1e9+7;
constexpr ll longinf=1LL<<60 ;
constexpr ll mod=1e9+7 ;

const int N=365, M=26;
int c[26], s[365][26];
int res[365];

set<int> st[26];

int calc(){
    int ret=0;
    vector<int> last(26,-1);
    rep(i,N){
        ret+=s[i][res[i]];
        last[res[i]]=i;
        rep(j,26)ret-=c[j]*(i-last[j]);
    }
    return ret;
}
inline int f(int n){
    return n*(n-1)/2;
}

int erase(int i, int j){
    auto itr=st[i].lower_bound(j);
    int nxt = *(next(itr)), prv=*(prev(itr));
    return -s[j][i] + c[i] * (f(j-prv)+f(nxt-j)-f(nxt-prv));
}
int insert(int i,int j){
    auto itr=st[i].lower_bound(j);
    int nxt = *itr, prv=*(prev(itr));
    return s[j][i] + c[i]*(-f(j-prv)-f(nxt-j)+f(nxt-prv));
}
struct Xor128{
    unsigned x,y,z,w;
 
    Xor128(unsigned w_=88675123):x(123456789),y(362436069),z(521288629),w(w_){};
 
    inline unsigned xor128(){
        unsigned t;
        t = x^(x<<11);
        x = y;
        y = z;
        z = w;
        return w = (w^(w>>19))^(t^(t>>8));
    }
 
    int nextInt(int x,int y){
		if(x>y)swap(x,y);
        return xor128()%(y-x)+x;
    }
 
    double nextDouble(double a,double b){
        return (double)(xor128()&0xffff)/0xffff*(b-a)+a;
    }
 
};

const int T = 15000000;
const double startT = 0, endT = 1000;
int main(){
    int _;cin>>_;
    rep(i,M)cin>>c[i];
    rep(i,N)rep(j,M)cin>>s[i][j];
    rep(i,M)st[i].insert(-1);
    rep(i,M)st[i].insert(N);
    auto rnd=Xor128();
    rep(i,N){
        res[i]=rnd.nextInt(0, M);
        st[res[i]].insert(i);
    }
    int cur = calc();
    rep(loop,T){
        int day=rnd.nextInt(0, N), con=rnd.nextInt(0,M);
        if(res[day]==con)continue;
        int diff = insert(con,day) + erase(res[day],day);
        double temp=startT+(endT-startT)*loop/T;
        double prob=exp((double)diff/temp);
        if(prob>rnd.nextDouble(0, 1)||diff>0) {
            cur += diff;
            st[res[day]].erase(day);
            st[con].insert(day);
            res[day]=con;
        }
    }
    rep(i,N)cout<<res[i]+1<<endl;
    cerr << cur << endl;
    return 0;
}

Measured memory_bytes: 4300
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,-1,0,1},dy={1,0,-1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}



int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<int> d(n);
	rep(i,n) cin >> d.at(i);
	sort(d.begin(),d.end());
	int ans=d.at(n/2)-d.at(n/2-1);
	cout << ans << endl;
}


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

int ans = 1e9;
int N, M, X;
int C[20][20];
int level[10];
void dfs(int n, int sum) {
	if (n == N) {
		bool flag = 1;
		for (int i = 0; i < M; i++) if (level[i] < X) flag = 0;
		if (flag) ans = min(ans, sum);
		return;
	}
	for (int i = 0; i < M; i++) level[i] += C[n][i + 1];
	dfs(n + 1, sum + C[n][0]);
	for (int i = 0; i < M; i++) level[i] -= C[n][i + 1];
	dfs(n + 1, sum);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> N >> M >> X;
	for (int i = 0; i < N; i++)
		for (int j = 0; j < M + 1; j++)
			cin >> C[i][j];
	dfs(0, 0);
	if (ans == 1e9) cout << -1 << '\n';
	else cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 3664
#include<stdio.h>
#include<string.h>
int main()
{
	char s[5];
	scanf("%s",s);
	int len=strlen(s);
	int m=0;
	for(int i=0;i<len;i++)
	{
		if(s[i]-48==1)
		m++;
	}
	printf("%d\n",m);
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, k;
	cin >> n >> k;
	int k2 = 2*k;
	vector<vector<int>> cnt(2*k, vector<int>(k2, 0));
	vector<vector<int>> twoDimSum(4*k, vector<int>(4*k, 0));
	rep(i,n){
		int x, y;
		char c;
		cin >> x >> y >> c;
		if(c == 'W') x += k;
		x %= k2;
		y %= k2;
		++cnt[y][x];
	}
	rep(i,4*k)rep(j,4*k){
		twoDimSum[i][j] = cnt[i%k2][j%k2];
	}
	rep(i,4*k)rep(j,4*k-1){
		twoDimSum[i][j+1] += twoDimSum[i][j];
	}
	rep(i,4*k-1)rep(j,4*k){
		twoDimSum[i+1][j] += twoDimSum[i][j];
	}
	int ans = 0;
	rep(i,k2)rep(j,k2){
		int score = twoDimSum[i+k][j+k] - twoDimSum[i+k][j] - twoDimSum[i][j+k] + twoDimSum[i][j];
		score += twoDimSum[i+k2][j+k2] - twoDimSum[i+k2][j+k] - twoDimSum[i+k][j+k2] + twoDimSum[i+k][j+k];
		chmax(ans, score);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 81572
#include <iostream>
#include <cstdio>

using namespace std;

int main(){
    int n,l;
    scanf("%d",&n);
    int i;
    int max=0;
    int sum=0;
    for(i=1;i<=n;i++){
        scanf("%d",&l);
        if(max<l){
            max=l;
        }
        sum=sum+l;
    }
    if(max<(sum-max)){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    return 0;
}
    


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<char> vchar;
typedef vector<vector<char>> vvchar;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef priority_queue<long long> prque;
#define ain(i,n,a) for(long long i=0;i<(long long)(n);i++){cin>>a[i];}
#define aout(i,n,a) for(long long i=0;i<(long long)(n);i++){if(i){cout<<" ";}cout<<a[i];if(i==n-1){cout<<endl;}}
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define vsort(v) sort((v).begin(),(v).end())
#define vrsort(v) sort((v).rbegin(),(v).rend())
#define vreverse(v) reverse((v).begin(),(v).end())
#define pf(a) push_front(a)
#define pb(a) push_back(a)
#define INF 1998021900
#define MOD 1000000007
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;cin>>n;vector<string> s(n);map<string,ll> mp;
  ll i,ans;ans=0;
  rep(i,n){cin>>s[i];vsort(s[i]);ans+=mp[s[i]];mp[s[i]]++;}
  cout<<ans<<endl;
}

Measured memory_bytes: 16640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;
	
	public static void Main(string[] args)
	{
		int n = Console.ReadLine().ToInt();
		int[,] table = new int[n,3];
		for(int i = 0; i < n; i++)
		{
			int[] p = Input().ToInt();
			for(int j = 0; j < 3; j++)
				table[i,j] = p[j];
		}
		int[,] dp = new int[n+1,3];
		for(int i = 0; i < 3; i++)
			dp[0,i] = table[0,i];
			
		for(int i = 1; i < n; i++)
		{
			dp[i,0] = Math.Max(dp[i-1,1], dp[i-1,2]) + table[i,0];
			dp[i,1] = Math.Max(dp[i-1,0], dp[i-1,2]) + table[i,1];
			dp[i,2] = Math.Max(dp[i-1,0], dp[i-1,1]) + table[i,2];
		}
		Console.WriteLine(Math.Max(dp[n-1,0], Math.Max(dp[n-1,1], dp[n-1,2])));
	}
	
	public static long GCD(long a, long b)
	{
		if(b == 1)
			return a;
		long p = b / a;
		return GCD(a, b - a*p);
	}
	
	public static string[] Input() { return Console.ReadLine().Split(' '); }
	public static int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str)
	{
		int[] r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt();
		return r;
	 }
	
}

Measured memory_bytes: 17340
#include <cstdio>

int main() {
    int inm = 0;
    int ind = 0;
    while (scanf("%d %d", &inm, &ind) != EOF) {
        if ((inm == 0) && (ind == 0)) {
            break;
        }

        const int m[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
        int d = 2;

        for (int i = 0; i < inm; ++i) {
            for (int j = 0; j < m[i]; ++j) {
                if (d == 6) {
                    d = 0;
                } else {
                    d++;
                }

                if ((i == inm - 1) && (j == ind - 1)) {
                    goto end;
                }
            }
        }

        end:
        switch (d) {
        case 0:
            printf("Monday\n");
            break;
        case 1:
            printf("Tuesday\n");
            break;
        case 2:
            printf("Wednesday\n");
            break;
        case 3:
            printf("Thursday\n");
            break;
        case 4:
            printf("Friday\n");
            break;
        case 5:
            printf("Saturday\n");
            break;
        case 6:
            printf("Sunday\n");
            break;
    }
    }
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,int> event;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair 
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)

int main(){
	ll N,Q; cin>>N>>Q;
	set<event> se;
	multiset<ll> ans;
	rep(i,N){
		ll S,T,X; cin>>S>>T>>X;
		se.insert(mp(mp(S-X,X),1));
		se.insert(mp(mp(T-X,X),-1));
	}
	vector<ll> d(Q);
	rep(i,Q) cin>>d[i];

	ll i=0;
	auto itr=se.bg;
	while(i<Q){
		while(itr!=se.ed && (*itr).a.a<=d[i]){
			if((*itr).b==1) ans.insert((*itr).a.b);
			else{
				auto it=ans.find((*itr).a.b);
				ans.erase(it);
			}
			itr++;
		}
		if(ans.empty()) cout<<-1<<endl;
		else cout<<*ans.bg<<endl;
		i++;
	}
}

Measured memory_bytes: 37248
def main(argv)
  x = gets.chomp.to_i

  k = x / 100
  y = x % 100

  if (k * 5) >= y then
    puts 1.to_s
  else
    puts 0.to_s
  end
end

if self.to_s == 'main' then
  main(ARGV)
end

Measured memory_bytes: 1788
import std.stdio, std.conv, std.string;
import std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

int DEBUG_LEVEL = 0;
void print()(){ writeln(""); }
void print(T, A ...)(T t, lazy A a){ write(t), print(a); }
void print(int level, T, A ...)(T t, lazy A a){ if(level <= DEBUG_LEVEL) print(t, a); }

void main(string[] args){
	if(args.length > 1 && args[1] == "-debug"){
		if(args.length > 2 && args[2].isNumeric) DEBUG_LEVEL = args[2].to!int;
		else DEBUG_LEVEL = 1;
	}
	
	long n = read.to!long;
	long m = read.to!long;
	
	Node[] nodes;
	foreach(i; 0 .. n) nodes ~= new Node(i, 0);
	
	foreach(nd; nodes){
		nd.group = new Group(nd);
	}
	
	Edge[] edges;
	foreach(i; 0 .. m){
		long x = read.to!long - 1;
		long y = read.to!long - 1;
		long z = read.to!long - 1;
		edges ~= new Edge(nodes[x], nodes[y], i);
	}
	
	foreach(ed; edges){
		if(ed.node1.group.id != ed.node2.group.id){
			ed.node1.group.eat(ed.node2.group);
		}
	}
	
	long ans;
	foreach(nd; nodes) if(nd.group.id == nd.id) ans += 1;
	
	ans.writeln;
	
}


class Edge{
	Node node1;
	Node node2;
	long value;
	this(Node node1, Node node2, long value){
		this.node1 = node1, this.node2 = node2;
		this.value = value;
	}
}

class Node{
	long id;
	long value;
	Group group;
	this(long id, long value){
		this.id = id;
		this.value = value;
	}
}

class Group{
	long value;
	long pendingEdgeCount;
	long id;
	Node[] nodes;
	this(Node node){
		this.id = node.id;
		this.nodes = [node];
		this.value = node.value;
	}
	void eat(Group gp){
		if(gp.nodes.length > this.nodes.length) gp.eat(this);
		else{
			foreach(nd; gp.nodes){
				this.nodes ~= nd;
				nd.group = this;
				this.value += nd.value;
			}
			this.pendingEdgeCount += gp.pendingEdgeCount;
		}
	}
}



Measured memory_bytes: 46204
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <stdio.h>
#include <string.h>
using ll = long long;

//LLONG_MAX
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()

using namespace std;

int table[101][10][4];

char N[1000];
int K;

signed main()
{
	cin >> N;
	cin >> K;


	for (int i = 1; i < 10; i++)
	{
		table[0][i][1] = 1;
	}

	for (int i = 1; i < 100; i++)
	{
		for (int k = 1; k <= 3; k++)
		{
			int sum = 0;
			for (int j = 0; j < 10; j++)
			{
				sum += table[i - 1][j][k];
			}
			table[i][0][k] = sum;
		}

		for (int j = 1; j < 10; j++)
		{
			table[i][j][1] = 1;
		}
		for (int k = 2; k <= 3; k++)
		{
			for (int j = 1; j < 10; j++)
			{
				table[i][j][k] = table[i][0][k - 1];
			}
		}
	}

	//for (int ii = 1; ii <= 10000; ii++)
	{
		//for (int jj = 1; jj <= 3; jj++)
		{
			//itoa(ii, N, 10);
			//K = jj;

			//int _cnt = 0;
			//int _n = atoi(N);
			//for (int i = 1; i <= _n; i++)
			//{
			//	int n1 = (i / 1000 % 10) == 0 ? 0 : 1;
			//	int n2 = (i / 100 % 10) == 0 ? 0 : 1;
			//	int n3 = (i / 10 % 10) == 0 ? 0 : 1;
			//	int n4 = (i / 1 % 10) == 0 ? 0 : 1;

			//	if (n1 + n2 + n3 + n4 == K)
			//	{
			//		_cnt++;
			//		cout << i << endl;
			//	}
			//}
			//cout << _cnt << endl;



			int len = strlen(N);
			int k = K;
			int sum = 0;
			for (int s = 0; s < len; s++)
			{
				int i = len - s - 1;
				int a = N[s] - '0';

				if (a == 0) continue;

				if (k == 1)
				{
					for (int j = 0; j <= a; j++)
					{
						sum += table[i][j][k];
					}
					break;
				}
				else
				{
					for (int j = 0; j < a; j++)
					{
						sum += table[i][j][k];
					}
				}
				k--;
			}

			cout << sum << endl;

			//if (sum != _cnt)
			//{
			//	int a = 0;
			//}
		}
	}

}




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

int main() {
	int a, b;
	cin >> a >> b;
	if (a % 2 == 0 || b % 2 == 0) {
		cout << "Even" << endl;
	}
	else {
		cout << "Odd" << endl;
	}
	return 0;
}

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

using namespace std;

int main(){

	int v[5],k;

	for(int i=0;i<5;++i) cin >> v[i];

	cin >> k;

	bool ok = true;

	for(int i=0;i<5;++i){
		for(int j=i+1;j<5;++j){
			if(v[j] - v[i] > k) ok = false;
		}
	}

	cout << (ok ? "Yay!" : ":(" ) << '\n';

	return 0;

}

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

class Main
{
	public static void main(String[] args)
	{
		FastReader reader = new FastReader();
		PrintWriter writer = new PrintWriter(System.out);

		int x1 = reader.nextInt();
		int y1 = reader.nextInt();
		int x2 = reader.nextInt();
		int y2 = reader.nextInt();

		int vx = y2 - y1;
		int vy = x1 - x2;

		writer.print((x2-vx) + " " + (y2-vy) + " " + (x1-vx) + " " + (y1-vy));
		writer.close();
	}

	static class FastReader
	{
		BufferedReader br;
		StringTokenizer st;

		public FastReader()
		{
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next()
		{
			while (st == null || !st.hasMoreElements())
			{
				try
				{
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e)
				{
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt()
		{
			return Integer.parseInt(next());
		}

		long nextLong()
		{
			return Long.parseLong(next());
		}

		double nextDouble()
		{
			return Double.parseDouble(next());
		}

		String nextLine()
		{
			String str = "";
			try
			{
				str = br.readLine();
			}
			catch (IOException e)
			{
				e.printStackTrace();
			}
			return str;
		}
	}
}

Measured memory_bytes: 21204
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod=1000000007;
vector<ll> v[100010];
ll d[100010][2];
ll dfs(ll now,ll col,ll pa){
  if(d[now][col]>=0)return d[now][col];
  ll ret=1;
  for(int i=0;i<v[now].size();i++){
    if(v[now][i]==pa)continue;
    ll sum=0;
    sum+=dfs(v[now][i],1,now);
    ret%=mod;
    if(col==1){
      sum+=dfs(v[now][i],0,now);
      ret%=mod;
    }
    ret*=sum;
    ret%=mod;
  }
  return d[now][col]=ret;
}
int main(){
  ll n;cin>>n;
  for(int i=0;i<n-1;i++){
    ll s,t;cin>>s>>t;
    v[s].push_back(t);
    v[t].push_back(s);
  }
  for(int i=0;i<=n;i++){
    d[i][0]=-1;
    d[i][1]=-1;
  }
  v[0].push_back(1);
  ll ans=dfs(0,1,-1);
  cout<<ans<<endl;
}

Measured memory_bytes: 15616
# coding: utf-8
from collections import defaultdict

INF = 10 ** 20
MOD = 10 ** 9 + 7


def II(): return int(input())
def ILI(): return list(map(int, input().split()))


def read():
    N, M = ILI()
    edges = defaultdict(list)
    for __ in range(M):
        a, b = ILI()
        edges[a].append(b)
        edges[b].append(a)
    return N, M, edges


def solve(N, M, edges):
    s_from_1 = set(edges[1])
    s_from_n = set(edges[N])
    set_and = s_from_1 & s_from_n
    ans = ""
    if len(set_and) == 0:
        ans = "IMPOSSIBLE"
    else:
        ans = "POSSIBLE"
    return ans


def main():
    params = read()
    print(solve(*params))


if __name__ == "__main__":
    main()


Measured memory_bytes: 72168
#include <cstdio>
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include <cmath>
#include <iomanip>
#include <regex>
#include <bits/stdc++.h>
#include <string>
using namespace std;
using ll = long long;
const ll MOD = 1000000007; 
using plong = pair<long,long>;

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

ll min(ll a,ll b,ll c){
    return min(min(a,b),c);
}
ll H,W;
ll a=0,b=0,c=0;
ll _min = (ll)3e9;
void cmp(ll H,ll W){
    for(ll i=1;i<H;i++){
        a = W*i;
        if((H-i)%2==0){
            b = W*(H-i)/2;
            c = b;
        }else{
            a = W*i;
            b = W*((H-i)/2);
            c = W*((H-i)/2+1);
        }
        ll s_max = max(a,b,c);
        ll s_min = min(a,b,c);
        _min = min(_min,s_max-s_min);
    }
}

void cmp1(ll H,ll W){
    for(ll i=1;i<H;i++){
        a = W*i;
        if(W%2==0){
            b = W/2*(H-i);
            c = b;
        }else{
            b = W/2*(H-i);
            c = (W/2+1)*(H-i);
        }
        ll s_max = max(a,b,c);
        ll s_min = min(a,b,c);
        _min = min(_min,s_max-s_min);
    }
}

int main(){   
    cin>>H>>W;
    cmp(H,W);
    cmp(W,H);
    cmp1(H,W);
    cmp1(W,H);
    cout<<_min<<endl;
    
}

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

#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << "["<< *it << " = " << a << "]"<< endl;
    err(++it, args...);
}
using ll = long long;
const ll INF = 1e9 +7;

int main() {
    ios::sync_with_stdio(false);
    int N,M,b,s = 0;
    cin >> N >> M;

    vector<int> K(M+1);
    vector<int> C(M+1);

    for (int i = 1 ; i<= M; i++) {
        cin >> C[i] >> b;
        int keys = 0;
        for (int j = 0; j < b; j++) {
            int dd;
            cin >> dd;
            keys |= 1 << (dd-1);
        }
        K[i] = keys;
    }


    int S = 1 << N;
    vector<int> dp(S,INF);

    dp[0] = 0;
    debug(M,N,S);
    for (int i = 1; i<=M; i++) {
        for (int j = 0; j < S; j++) {
            s = K[i] | j;
            dp[s] = min(dp[s],dp[j] + C[i]);

        }
    }
    if (dp[S-1] == INF) {
        dp[S-1] = -1;
    }
    cout << dp[S-1];
}


Measured memory_bytes: 256
def main():
    N, Ma, Mb = map(int, input().split())
    A = []
    B = []
    C = []
    for _ in range(N):
        a, b, c = map( int, input().split())
        A.append(a)
        B.append(b)
        C.append(c)
    dp = [[10**5]*401 for _ in range(401)]
    dp[0][0] = 0
    for t in range(N):
        a, b, c = A[t], B[t], C[t]
        for i in range(400,-1,-1):
            for j in range(400,-1,-1):
                if i-a >= 0 and j-b >= 0:
                    if dp[i-a][j-b] + c < dp[i][j]:
                        dp[i][j] = dp[i-a][j-b] + c
    ans = 10**5
    for i in range(1, 401):
        if i*Ma > 400 or i*Mb > 400:
            break
        if dp[i*Ma][i*Mb] < ans:
            ans = dp[i*Ma][i*Mb]
    if ans == 10**5:
        print(-1)
    else:
        print(ans)
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 40816
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << max(0, c-(a-b));
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
int arr[26][100000];
signed main(){
    string s,t;
    cin>>s>>t;
    int n=s.size();
    s+=s;
    for(int i=0;i<26;i++)
        for(int j=n;j<2*n;j++)
            if(s[j]=='a'+i)
                for(int k=j-1;k==j-1||s[k+1]!='a'+i;k--)
                    arr[i][k%n]=j-k;
    string zip=t;
    sort(zip.begin(),zip.end());
    zip.erase(unique(zip.begin(),zip.end()),zip.end());
    int ans=n-1;
    for(int i=0;i<t.size();i++){
        if(arr[t[i]-'a'][ans%n]==0){
            cout<<-1<<endl;
            return 0;
        }
        ans+=arr[t[i]-'a'][ans%n];
    }
    cout<<ans-n+1<<endl;
}


Measured memory_bytes: 21120
#include<iostream>
#include<vector>
#include<utility>
using namespace std;
typedef long long LL;

int main() {
    vector<pair<LL, LL> > coordinate;
    vector<LL> coordinate_x;
    vector<LL> coordinate_y;
    int N, K;
    LL x, y, min_area = 4000000000000000000;
    cin >> N >> K;
    for (int i = 0; i < N; i++) {
        cin >> x >> y;
        coordinate.push_back(make_pair(x, y));
        coordinate_x.push_back(x);
        coordinate_y.push_back(y);
    }

    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
            for (int k = 0; k < N; k++) {
                for (int l = k + 1; l < N; l++) {
                    LL left_x = min(coordinate_x[i], coordinate_x[j]);
                    LL right_x = max(coordinate_x[i], coordinate_x[j]);
                    LL bottom_y = min(coordinate_y[k], coordinate_y[l]);
                    LL top_y = max(coordinate_y[k], coordinate_y[l]);

                    int count = 0;
                    for (int m = 0; m < N; m++) {
                        if (coordinate[m].first >= left_x && coordinate[m].first <= right_x && coordinate[m].second >= bottom_y && coordinate[m].second <= top_y) {
                            count++;
                        }
                    }

                    if (count >= K) {
                        min_area = min(min_area, (right_x - left_x) * (top_y - bottom_y));
                    }
                }
            }
        }
    }

    cout << min_area << endl;

    return 0;

}

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

int main(){
    int n;
    cin>>n;
    if (n%2==0)
    {
        /* code */
        cout<<n/2<<endl;
    }
    else
    {
        cout<<n/2+1<<endl;
    }
    
    
    

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (sc.hasNext()) {
			String input = sc.nextLine();
			String[] array = input.split(" ");
			int h = Integer.parseInt(array[0]);
			int w = Integer.parseInt(array[1]);
			if (h == 0 && w == 0) {
				System.exit(0);
			}
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					System.out.print("#");
				}
				System.out.print("\n");
			}
			System.out.print("\n");
			
		}
	}
}

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

using namespace std;
typedef long long ll;

const int N = int(1e6) + 7;

void init(){

}

void solve(){
    int A[N];
    int H[N];
    int n; scanf("%d", &n);
    for(int i = 0; i <= n; i++)
        scanf("%d", &A[i]);
    for(int i = 0; i < n; i++)
        scanf("%d", &H[i]);
    ll ans = 0;
    for(int i = n-1; i >= 0; i--){
        if(A[i+1] > 0){
            if(H[i] > A[i+1]){
                H[i] -= A[i+1];
                ans += A[i+1];
                A[i+1] = 0;
            }
            else{
                 A[i+1] -= H[i];
                 ans += H[i];
                 H[i] = 0;
            }
        }
        if(A[i] > 0){
            ans += min(H[i], A[i]);
            if(H[i] > A[i]) A[i] = 0;
            else A[i] -= H[i];
        }
    }
    printf("%lld\n", ans);
}

const bool mtc = false;

int main(){
    int t;
    if(mtc){
        scanf("%d", &t);
        while(t--) solve();
    }
    else solve();
}



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

int N;
int A[200100];

int main() {
  string x = "YES";
  cin >> N;
  for (int i = 0; i < N; i++) cin >> A[i];
  
  sort(A, A+N, greater<int>());
 
  for (int i = 0; i+1 < N; i++){
 
  if ( A[i] == A[i+1]){
  
  x = "NO";
  break;
  }
  }
  
  cout << x << endl;
  
  return 0;
}


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

int n,m;
vector<P>g[100010];
int dist[100010];
bool visited[100010];
bool dfs(int v){
    visited[v]=1;
   for(auto u:g[v]){
       if(visited[u.first]){
           if(dist[u.first]!=dist[v]+u.second)return 0;
       }else{
           dist[u.first]=dist[v]+u.second;
           if(!dfs(u.first))return 0;
       }
   }

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

    cin>>n>>m;
    rep(i,m){
        int l,r,d;
        cin>>l>>r>>d;
        g[l].emplace_back(r,d);
        g[r].emplace_back(l,-d);
    }
    rep(i,n){
        if(visited[i+1])continue;
        if(!dfs(i+1))return cout<<"No"<<endl,0;
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 11136
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        string S = Console.ReadLine();
        int count = 0;
        int max = 0;
        for(int i = 0; i < N;i++)
        {
            if (S[i] == 'I')
                count++;
            else
                count--;
            if (count > max)
                max = count;
        }
        Console.WriteLine(max);
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
  
using namespace std;
using namespace __gnu_pbds;
 
#define ll long long
#define uint unsigned int
#define ull  unsigned long long
#define pb push_back
#define mk make_pair
#define ins insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define X first
#define Y second
#define umap unordered_map
#define speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define setvalue(d,s,e,n) for(int qwe = s; qwe < e; ++qwe) d[qwe] = n
#define mset multiset
#define pqueue priority_queue
   
template<class T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
        
const int  N = 2e5 + 314;
const int INF = 1e9;
const double PI = acos(-1);
const int MOD = 1e9 + 7;
const double eps = 1e-9;
const long long LINF = 1e18 + 3141;
 
void solve(){
    ll n, x, t;
    cin >> n >> x >> t;

    cout << (n + x - 1)/x * t;
     
}
 
int main(){
    speed();
    int t = 1;
    // cin >> t;
    while(t--)solve();
}

Measured memory_bytes: 3648
#include<stdio.h>
#include<string.h>
#include <math.h>
#include <stdlib.h>
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    if(n-2>=m)
        printf("%d\n",2*n-1);
    else if(m-2>=n)
        printf("%d\n",2*m-1);
    else
        printf("%d\n",n+m);
	return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#define N 10
#define MAX 1024

void dec_to_bin(int n,int BIT[]){
  int i;
  for (i=N-1;i>=0;i--){
    BIT[i]=n%2;
    n/=2;
  }
}

int tamaire(int A[],int data[],int BIT[],int c){
  int i,j=0;
  for (i=0;i<N;i++)
    if (BIT[i]==c){
      data[j++]=A[i];
    }
  return j;
}

int judge(int data[],int n){
  int i;
  for (i=0;i<n-1;i++)
    if (data[i]>data[i+1])
      return -1;
  return 1;
}

int main(){
  int A[N],B[N],C[N],BIT[N];
  int i,j,n;
  scanf("%d",&n);
  for (j=0;j<n;j++){
    for (i=0;i<N;i++)
      scanf("%d",&A[i]);
    for (i=0;i<MAX;i++){
      dec_to_bin(i,BIT);
      int b=tamaire(A,B,BIT,1);
      int c=tamaire(A,C,BIT,0);
      if ((judge(B,b)==1) && (judge(C,c)==1)){
        printf("YES\n");
        break;
      }
    }
    if (i==MAX)
      printf("NO\n");
  }
  return 0;
}

Measured memory_bytes: 576
#include <iostream>
#include <stdio.h>
using namespace std;

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

    int n;
    long long sum = 0;
    int max = -1000000, min = 1000000;
    cin >> n;
    for(int i = 0; i < n; i++){
        int in;
        cin >> in;
        if(in < min) min = in;
        if(in > max) max = in;
        sum += in;
    }
    cout << min << " " << max << " " << sum << endl;
    return 0;
}

Measured memory_bytes: 3196
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include <time.h>
typedef long long ll;
typedef long double ld;
#define INF (1LL<<60)
/*swap 交換*/
void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
/*2つのうち大きい数を返す*/
ll max2(ll a,ll b){return a>=b?a:b;}
/*2つのうち小さい数を返す*/
ll min2(ll a,ll b){return a>=b?b:a;}
/*絶対値*/
ll ABS(ll a){return a>=0?a:(-a);}
typedef struct{
    ll aa;
    ll bb;
}frequent;
// 小大
int compare(const void *a, const void *b){return *(ll *)a - *(ll *)b;}
ll judgeprime(ll n){
    ll a=sqrt(n),i; if(a%2==0) a--;
    for(i=a;i>2;i-=2){if(n%i==0) break;}
    return i==1?1:0;}

int main(void){
    ll n;
    scanf("%lld",&n);
    if(n==2){
        printf("2\n");
        return 0;
    }
    if(n%2==0) n++;
    while(1){
        // printf("%lld ",n);
        if(judgeprime(n)==1) break;
        n+=2;
    }
    printf("%lld\n",n);
    return 0;
}


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

int main(){

  while(1){

    int n, m, flower[100], tarou[100], cnt = 0, fsum = 0, tsum = 0, tchange, fchange;
    int ff, tt;
    int  fma = 99999, tma = 99999;

    cin >> n >> m;
    if(n == 0 && m == 0) break;

    for(int i = 0; i < n; i++){
      cin >> tarou[i];
      tsum+=tarou[i];
    }

    for(int i = 0; i < m; i++){
      cin >> flower[i];
      fsum+=flower[i];
    }

    for(int i = 0; i < m; i++){
      for(int j = 0; j < n; j++){
	tt = tsum - tarou[j] + flower[i];
	ff = fsum - flower[i] + tarou[j];
	//cout << tt << " " << ff << endl;
	if(tt == ff){
	  cnt = 1;
	  tchange = tarou[j];
	  fchange = flower[i];
	  if(tma + fma > tchange + fchange){
	    //  cout << 1111111;
	    tma = tarou[j];
	    fma = flower[i];
	  }
	}
      }
    }
    if(cnt == 1)     cout << tma << " " << fma << endl;
    else cout << -1 << endl;


  }

  return 0;
}

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

#define INF (1<<29)



int main(){
	int n;
	int dp[41][4];
	while(cin>>n&&n){
		vector<pair<int,int> > ev;
		for(int i=0;i<n;i++){
			int p,t;
			cin>>p>>t;
			ev.push_back(make_pair(t,p));
		}
		sort(ev.begin(),ev.end());
		int last=-1;
		for(int i=0;i<n;i++){
			for(int j=0;j<4;j++)dp[i][j]=INF;
		}
		if(ev[0].second<=ev[0].first){
			dp[0][1]=ev[0].second;
			last=0;
		}
		for(int i=0;i<n-1;i++){
			int t;
			int d1=ev[i+1].second+ev[i].second;
			int d2=abs(ev[i+1].second-ev[i].second);
			for(int j=1;j<3;j++){
				if(dp[i][j]==INF)continue;
				t=(j+1)*ev[i].second+ev[i+1].second;
				if(ev[i].first+t<=ev[i+1].first){
					dp[i+1][1]=min(dp[i+1][1],dp[i][j]+d1);
					last=i+1;
				}
				t=(j+1)*abs(ev[i+1].second-ev[i].second);
				if(ev[i].first+t<=ev[i+1].first){
					dp[i+1][j+1]=min(dp[i+1][j+1],dp[i][j]+d2);
					last=i+1;
				}
			}
			if(dp[i][3]==INF)continue;
			t=(3+1)*ev[i].second+ev[i+1].second;
			if(ev[i].first+t<=ev[i+1].first){
				dp[i+1][1]=min(dp[i+1][1],dp[i][3]+d1);
				last=i+1;
			}
		}
		if(last!=n-1)cout<<"NG "<<last+2<<endl;
		else {
			int ans=INF;
			for(int j=1;j<=3;j++)
				ans=min(ans,dp[n-1][j]+ev.back().second);
			cout<<"OK "<<ans<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1200
import numpy as np

N, D = map(int, input().split())
X = []

for n in range(N):
    L = list(map(int, input().split()))
    X.append(L)
X = np.array(X)
ans = -N

def distance(np_1, np_2):
    dif = np_1 - np_2
    dif_sq = np.square(dif)
    dist_sq = np.sum(dif_sq)
    dist = np.sqrt(dist_sq)
    return dist


for n in range(N):
    for i in range(n,N):
        x = distance(X[n], X[i])

        if x.is_integer():
            ans += 1

print(ans)

Measured memory_bytes: 12496
#include <iostream>
#include <string>

int main()
{
	std::string S;

	std::cin >> S;

	int cnt = 700;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == 'o') {
			cnt+=100;
		}
	}
	std::cout << cnt << std::endl;
	return 0;
}

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

#define TEST


void solve(long long A, long long B){
  if (A <= 8 && B <= 8) cout << "Yay!" << endl;
  else cout << ":(" << endl;
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


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


int main()
{
    /*A
    vector <int> a(3);
    for(int i=0;i<3;i++)
    {
        cin>>a[i];
    }

    sort(a.rbegin(),a.rend());
    cout<<a[1]+a[2]<<endl;
    */

    /*
    int n;
    cin>>n;
    int minimum=1000010;
    vector <int> w(n);
    for(int i=0; i<n; i++)
    {
        cin>>w[i];
    }

    for(auto it = w.begin(); it != w.end(); ++it)
    {
        int sum1 = accumulate(w.begin(),it,0);
        int sum2 = accumulate(it,w.end(),0);
        minimum = min(minimum,abs(sum1-sum2));
    }

    cout<<minimum<<endl;
    */

    int n,m;
    cin>>n>>m;
    vector <int> a(n+1,1);
    for(int i=0;i<m;i++)
    {
        int x;
        cin>>x;
        a[x]=0; //壊れていたらfalse
    }

    vector <long long int> dp(n+1);

    dp[0]=1;//スタートを1とする dp:はその段まで行く通り数
    for(int now=0;now<n;now++)
    {
        /*
        for(int next=now+1;next<=min(n,now+2);next++)
        {
            if(a[next])
            {   
                dp[next]+=dp[now];
                dp[next]%=MOD;
            }
        }
        */
        if(a[now+1])
        {
            dp[now+1]+=dp[now];
            dp[now+1]%=MOD;
        }
        if(a[now+2])
        {
            dp[now+2]+=dp[now];
            dp[now+2]%=MOD;
        }

    }

    cout<<dp[n]<<endl;


    return 0;
}

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

int main()
{
	int n;
	cin >> n;
	long long sum = 0, min = 999999999, max = -999999999;
	int a;
	for (int i = 0; i < n; i++)
	{
		cin >> a;
		sum = sum + a;

		if (a < min)
			min = a;
		if (a > max)
			max = a;
	}
	cout << min << " " << max << " " << sum << endl;
}


Measured memory_bytes: 3112
import std.stdio;
import std.string;
auto dx=[0,-1,1,0],dy=[-1,0,0,1];
string[] s;
int h,w;
void main()
{
	readf("%d %d\n",&h,&w);
	for (int i=0;i<h;++i) s~=readln.strip();
	for (int y=0;y<h;++y)
	{
		for (int x=0;x<w;++x)
		{
			if (s[y][x]=='.') continue;
			bool flag=false;
			for (int i=0;i<4;++i)
			{
				int x2=x+dx[i],y2=y+dy[i];
				if (x2<0 || y2<0 || w<=x2 || h<=y2) continue;
				if (s[y2][x2]=='#')
				{
					flag=true;
					break;
				}
			}
			if (!flag)
			{
				write("No");
				return;
			}
		}
	}
	write("Yes");
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdint>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <unordered_map>

int main()
{
    std::array<std::vector<uint64_t>, 100001> prefYears;
    std::array<int, 100000> p;
    std::array<uint64_t, 100000> y;

    int n, m;
    std::scanf("%d %d", &n, &m);

    for (std::size_t i = 0; i < m; ++i) {
        std::scanf("%d %lu", &(p[i]), &(y[i]));
        prefYears[p[i]].push_back(y[i]);
    }

    for (std::size_t i = 1; i <= n; ++i) {
        std::sort(prefYears[i].begin(), prefYears[i].end());
    }

    for (std::size_t i = 0; i < m; ++i) {
        const std::vector<uint64_t>& years = prefYears[p[i]];

        std::vector<uint64_t>::const_iterator it = std::lower_bound(years.begin(), years.end(), y[i]);
        std::fprintf(stdout, "%06d%06lu\n", p[i], (std::size_t)((it - years.begin())) + 1);
    }

    return 0;
}

Measured memory_bytes: 8192
#include <bits/stdc++.h>
using ll=long long;
using namespace std;
#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

ll gcd(ll a, ll b) { return b?gcd(b, a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a, b)*b;}
const int IINF=(1<<30);
const ll LLINF = 1LL<<60;

int a, b, c, d, e, f;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  cin >> a >> b >> c;
  if(a == b && a != c){
    cout << "Yes" << endl;
  }else if(a == c && a != b){
    cout << "Yes" << endl;
  }else if(b == c && b != a){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
using System;

namespace _0052
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int n = int.Parse(Console.ReadLine());
                if (n == 0)
                {
                    break;
                }
                int x = 0;
                while (true)
                {
                    if (n < 5)
                    {
                        break;
                    }
                    x += n / 5;
                    n = n / 5;
                }
                Console.WriteLine(x);
            }
        }
    }
}

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

int main() {
  int n;
  cin >> n;
  for(int i = 0; i < n; ++i) {
      int x, y, b, p;
      cin >> x >> y >> b >> p;
      int result1 = 0;
      result1 = x * b + y * p;
      if(b >= 5 && p >= 2) result1 *= 0.8;
      int result2 = 0;
      if(b < 5) b = 5;
      if(p < 2) p = 2;
      result2 = x * b + y * p;
      if(b >= 5 && p >= 2) result2 *= 0.8;
      cout << min(result1, result2) << endl;
  }
  return 0;
}

Measured memory_bytes: 1164
#!/usr/bin/env python3
import sys


def solve(a: int):
    print(a+a*a+a*a*a)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    a = int(next(tokens))  # type: int
    solve(a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9036
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MOD 1000000007
int main(){
	fast;
	ll n;
	cin>>n;
	ll fre[1000000]{};
	ll arr[n];
	for(ll i=0;i<n;i++)
		cin>>arr[i],fre[arr[i]]++;
	ll sum=0;
	for(ll i=0;i<1000000;i++)
		if(fre[i]!=0)
			sum+=fre[i]-1;
	if(sum%2==0)
		cout<<n-sum;
	else
		cout<<n-sum-1;
	return 0;
}



Measured memory_bytes: 12248
#include <bits/stdc++.h>
using namespace std;
#define N 100001
int a[N], v[N], n, m;
int main() {
    v[1] = true;
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++) a[i] = 1;
    for (int i = 1, x, y; i <= m; i++) {
        scanf("%d%d", &x, &y);
        if (v[x]) v[y] = true;
        if (a[x] == 1) v[x] = false;
        a[x]--, a[y]++;
    }
    int num = 0;
    for (int i = 1; i <= n; i++)
        if (v[i]) num++;
    printf("%d\n", num);
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define db(...) " [" << #__VA_ARGS__ << ": " << __VA_ARGS__ << "] "
using ii=long long;
vector<ii> fact(ii x)
{
    vector<ii>u;
    for (ii i = 2; i * i <= x; ++i) {
        while (x % i == 0) {
            u.push_back(i);
            x /= i;
        }
    }
    if (x != 1) u.push_back(x);
    return u;
}
int main()
{
    ii A, B;
    cin >> A >> B;
    vector<ii> AV = fact(A);
    vector<ii> BV = fact(B);
    map<ii, int> m;
    int r = 0;
    for (ii u : AV) {
        m[u] |= 1;
    }
    for (ii u : BV) {
        m[u] |= 2;
    }
    for (auto u : m) {
        if (u.second == 3) {
            ++r;
        }
    }
    cout << r + 1 << "\n";
}


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 = new int[3][3];
        for(int i = 0 ; i < 3 ; i++ ){
            for(int j = 0 ; j < 3 ; j++ ){
                a[i][j] = sc.nextInt();
            }
        }
        int n = sc.nextInt();
        int[] b = new int[n];
        for(int i = 0 ; i < n ; i++ ){
            b[i] = sc.nextInt();
        }
        for(int i = 0 ; i < 3 ; i++ ){
            for(int j = 0 ; j < 3 ; j++ ){
                for(int k = 0 ; k < n ; k++ ){
                    if(a[i][j] == b[k]){
                        a[i][j] = 0;
                    }
                }
            }
        }
        if(a[1][1] == 0 && a[1][2] == 0 && a[1][0] == 0){
            System.out.println("Yes");
        }else if(a[1][1] == 0 && a[2][1] == 0 && a[0][1] == 0){
            System.out.println("Yes");
        }else if(a[1][1] == 0 && a[2][2] == 0 && a[0][0] == 0){
            System.out.println("Yes");
        }else if(a[2][1] == 0 && a[2][2] == 0 && a[2][0] == 0){
            System.out.println("Yes");
        }else if(a[0][1] == 0 && a[0][2] == 0 && a[0][0] == 0){
            System.out.println("Yes");
        }else if(a[1][2] == 0 && a[2][2] == 0 && a[0][2] == 0){
            System.out.println("Yes");
        }else if(a[1][0] == 0 && a[2][0] == 0 && a[0][0] == 0){
            System.out.println("Yes");
        }else if(a[2][0] == 0 && a[1][1] == 0 && a[0][2] == 0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        sc.close();
    }
}

Measured memory_bytes: 35776