akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < int(n); ++i)
#define rrep(i,n) for (int i = int(n)-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = int(s); i < int(n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
template<class T> istream& operator>>(istream &is,vector<T> &v) { for(T &t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) { os<<'[';rep(i,v.size())os<<v[i]<<(i==int(v.size()-1)?']':','); return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n;
    cin >> n;
    vi a(n);
    cin >> a;
    sort(all(a));
    int mx = a[n-1];
    for(int i = mx; i >= mx-i; i--) {
        int r = (i == mx-i ? 1 : 2);
        int v = upper_bound(all(a),i)-lower_bound(all(a),i);
        if(v < r) {
            cout << "Impossible" << endl;
            return 0;
        }
        if(i-(mx-i) <= 1 and v > r) {
            cout << "Impossible" << endl;
            return 0;
        }
    }
    cout << "Possible" << endl;
}


Measured memory_bytes: 3628
#include <stdio.h>
int main(){
	int w=1,fee=1150;
	while(1){
		scanf("%d",&w);
		if(w==-1) break;
		if(w>=30) fee += (w-30)*160;
		if(w>=20){
			if((w-20)>=10) fee += 10*140;
			else fee += (w-20)*140;
		}
		if(w>=10){
			if((w-10)>=10) fee += 10*125;
			else fee += (w-10)*125;
		}
		printf("%d\n",4280-fee);
		fee=1150;
	}
	return 0;
}

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

int main(){
	string a,b,c;
	cin >> a >> b >> c;
	cout << (char)(a[0]+'A'-'a') << (char)(b[0]+'A'-'a') << (char)(c[0]+'A'-'a') << endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template < typename T > string tost( const T& n ) { ostringstream stm; stm << n; return stm.str();}
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 const INF = 1001001001;


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

string s;
cin >> s;
if(s <= "2019/04/30") cout << "Heisei" << endl;
else cout << "TBD" << endl;
return 0;
}

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

const ll INF = 1001001001001;

int main(){
    ll a;
    //string b;
    long double b;
    cin>>a>>b;
    
    ll b2=a*b;
    cout << b2 << endl;
    
    //b2 = (b[0]-'0')*100 + (b[2]-'0')*10 + b[3]-'0';
    /*
    ll ans = a*b2;
    
    ans /= 100;
    
    cout << ans << endl;
    */
    return 0;
}


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

int num[510][510];
int n,m,A,B;

inline int rd()
{
	int x=0;char ch=getchar();
	for (;ch<'0'||ch>'9';ch=getchar());
	for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x;
}

inline void print(int x)
{
	static char s[233];
	if (x<0) putchar('-'),x=-x;
	if (!x) { putchar('0');putchar(' ');return; }
	int tot=0;
	for (;x;x/=10) s[++tot]=x%10+'0';
	for (;tot;tot--) putchar(s[tot]);
	putchar(' ');
}

int main()
{
	n=rd();m=rd();A=rd();B=rd();
	if (n%A==0&&m%B==0) { puts("No");return 0; }
	for (int i=1;i<=n;i++) for (int j=1;j<=m;j++) if (i%A==0&&j%B==0) num[i][j]=-2000*(A*B-1)-1;
	for (int i=1;i<=n;i++) for (int j=1;j<=m;j++) if (!num[i][j]) num[i][j]=2000;
	puts("Yes");
	for (int i=1;i<=n;i++)
	{
		for (int j=1;j<=m;j++) print(num[i][j]);
		putchar('\n');
	}
	return 0;
}

Measured memory_bytes: 2560
# include <iostream>
# include <string>
# include <algorithm>
# include <vector>
# include <cstring>
# include <stdio.h>
# include <map>
# include <queue>

# define ll long long
# define pii pair<int,int>
# define FOR(a,b) for(int a=1; a<=b; a++)
# define REP(a,b) for(int a=0; a<b; a++)
# define FORU(a,b,c) for(int a=b; a<=c; a++)
# define FORD(a,b,c) for(int a=b; a>=c; a--)

using namespace std;

char grid[505][505], red[505][505], blue[505][505];
int R,C;

int main(){

    ios :: sync_with_stdio(false);
    cin >> R >> C;
    FOR(i,R) FOR(j,C) cin >> grid[i][j];
    FOR(i,R){
        if(i&1){
            FOR(j,C-1) red[i][j] = '#';
            red[i][C] = '.';
        }
        else{
            red[i][1] = '#';
            FORU(j,2,C) red[i][j] = '.';
        }
    }

    FOR(i,R){
        if(i&1){
            blue[i][C] = '#';
            FOR(j,C-1) blue[i][j] = '.';
        }
        else{
            blue[i][1] = '.';
            FORU(j,2,C) blue[i][j] = '#';
        }
    }

    FOR(i,R){
        FOR(j,C){
            if(red[i][j] == '.' && grid[i][j] == '#') cout << '#';
            else cout << red[i][j];
        }
        cout << endl;
    }

    cout << endl;
    FOR(i,R){
        FOR(j,C){
            if(blue[i][j] == '.' && grid[i][j] == '#') cout << '#';
            else cout << blue[i][j];
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 1664
$<.readlines.map {|a| a.split.map(&:to_i)}.each do |my1, my2, opp1|
  deck = [*1..10] - [my1, my2, opp1]
  limit = 20 - (my1 + my2)
  p = 0
  deck.each do |opp2|  
    n = (deck - [opp2]).take_while {|i| i <= limit}.size
    p += 1/7r * Rational(n, 6)
  end
  puts p >= 1/2r ? "YES" : "NO"
end


Measured memory_bytes: 6912
#include<stdio.h>
int main() {
	int n, m;
	while (scanf("%d %d", &n, &m), n + m) {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++)
				if ((i + j)%2==0)
					putchar('#');
				else putchar('.');
				puts("");
		}
		puts("");
	}
	return 0;
}

Measured memory_bytes: 2596
/* Generated by powerful Codeforces Tool
 * You can download the binary file in here https://github.com/xalanq/cf-tool (Windows, macOS, Linux)
 * Author: alireza_kaviani
 * Time: 2020-08-31 09:51:31
**/
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define sep                         ' '
#define endl                        '\n'
#define SZ(x)                       ll(x.size())

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

const ll MAXN = 1e6 + 10;
const ll LOG = 22;
const ll INF = 8e18;
const ll MOD = 1e9 + 7; // 998244353; // 1e9 + 9;

int n , dp[MAXN][2];
vector<int> adj[MAXN];

void DFS(int v , int p = -1){
	for(int u : adj[v]){
		if(u == p)	continue;
		DFS(u , v);
		dp[v][1] += dp[u][0];
	}
	dp[v][0] = dp[v][1];
	for(int u : adj[v]){
		if(u == p)	continue;
		dp[v][0] = max(dp[v][0] , dp[v][1] - dp[u][0] + dp[u][1] + 1);
	}
}

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

	cin >> n;
	for(int i = 1 ; i < n ; i++){
		int v , u;
		cin >> v >> u;
		adj[v].push_back(u);
		adj[u].push_back(v);
	}
	DFS(1);
	if(dp[1][0] == (n + 1) / 2)	cout << "Second" << endl;
	else	cout << "First" << endl;

    return 0;
}
/*

*/


Measured memory_bytes: 31096
#include <cstdio>
#include <cstring>
#include <algorithm>
#define int long long

using namespace std;

int D[1000010], S[1000010];

int n, X, Ans = 1e18;

int mul(int a, int b) {
    if(a && (int) 2e18 / a < b) return 2e18;
    return a * b;
}
signed main() {
    scanf("%lld%lld", &n, &X);
    for(int i = 1; i <= n; i++) scanf("%lld", &D[i]), S[i] = S[i - 1] + D[i];
    for(int i = 1; i <= n; i++) {
        int cnt = 0, s = 0, ans = 0, q = 0;
        ans += n * X;
        ans += 2 * (S[n] - S[n - i]);
        ans += i * X;
        for(int j = n, f = 0; j >= 1; f++, j -= i) {
            int l = 2 * f + 3;
            if(j > i) ans += mul(l, (S[j] - S[j - i] - i * D[j - i])) + mul(q, (D[j] - D[j - i])); else ans += mul(l, S[j]) + mul(q, D[j]);
            q += l * i;
            if(ans > 1e18) break;
        }
        if(ans < Ans) Ans = ans;
    }
    printf("%lld\n", Ans);
    return 0;
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int main(){
    int A,B,C;
    cin>>A>>B>>C;
    if((A*100+B*10+C)%4==0){
       cout<<"YES"<<endl;
    }else{
       cout<<"NO"<<endl;
    }
	return(0);
}

Measured memory_bytes: 256
N, M = map(int, input().split())
K = [0]*N
A = [[0]*M for i in range(N)]
for i in range(N):
  x = list(map(int, input().split()))
  K[i] = x[0]
  A[i] = x[1:]
l = set(A[0])
for i in range(1, N):
  l &= set(A[i])
print(len(l))

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

int main() {

	int h, w ,k1,p{10}, mcnt{}; cin >> h >> w >> k1;
	vector<vector<int>> fld(2*h,vector<int>(w));
	for(int i=h-1; i>=0; i--) {
		string s; cin >> s;
		for(int j=0; j<w; j++) fld.at(i).at(j) = s.at(j)-'0';
	}
	for(int i=h; i<2*h; i++) for(int j=0; j<w; j++) fld.at(i).at(j) = p++;
	for(int e=0; e<h; e++){
		for(int f=0; f<w; f++){
			vector<vector<int>> a1(h,vector<int>(w));
			for(int i=0; i<h; i++) for(int j=0; j<w; j++) a1.at(i).at(j) = i;
			for(int k=e; k<h; k++) a1.at(k).at(f)++;
			int cnt{}, pt{1};
			bool flg{1};
			while(flg){
				auto a = a1;
				flg=0;
				for(int i=h-1; i>=0; i--){
					vector<int> g(w);
					for(int g1=0; g1<w; g1++) g.at(g1) = fld.at(a.at(i).at(g1)).at(g1);
					for(int sl=0; sl+k1-1<w;){
						int sr{sl+1};
						while(1){
							if(sr==w||g.at(sl)!=g.at(sr)) break;
							if(g.at(sl)==g.at(sr)) sr++;
						}
						sr--;
						if(sr-sl+1>=k1){
							flg=1;
							cnt += pt * g.at(sl) * (sr-sl+1);
							for(int k=i; k<h; k++) for(int l=sl; l<=sr; l++) {
								if(k==h-1)a1.at(k).at(l)++;
								else a1.at(k).at(l) = a1.at(k+1).at(l);
							}
						}
						sl = sr + 1;
					}
				}
				pt<<=1;
			}
			mcnt = max(cnt,mcnt);
		}
	}
	cout << mcnt << endl;
}

Measured memory_bytes: 508
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
using ll = long long;
 
int main(){
	long double a, b, n;
  	cin >> a >> b >> n;
  	
  	long double ans = 0;
	if(n < b) ans = floor(a*n/b) - a * floor(n/b);
   	else ans = floor(a*(b-1)/b) - a * floor((b-1)/b);
  	
  	cout << ans << endl;
}

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

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr_inv(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define rep(i,n) repr(i,0,n)
#define MOD 1000000007
#define PI 3.1415926535
using namespace std;
int main(void)
{
	int x, t;

	cin>>x>>t;

	if(x-t>=0){
		cout<<x-t<<endl;
	}else{
		cout<<0<<endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
void mins(int&a,int b){if(a>b)a=b;}
int min(int a,int b){return a<b?a:b;}
int max(int a,int b){return a>b?a:b;}
void upd(int&a,int&b,int c){
	if(c>=a)b=a,a=c;
	else if(c>b)b=c;
}
const int N=2e5+7;
long long ans=1;
int n;
char s[N];
struct edge{
	int to;
	edge*nx;
}e[N*2],*ep=e;
edge*e0[N];
int d1[N],d2[N],d3[N],d4[N],sz[N];
void f1(int w,int pa){
	sz[w]=s[w]-'0';
	for(edge*i=e0[w];i;i=i->nx){
		int u=i->to;
		if(u==pa)continue;
		f1(u,w);
		if(sz[u]){
			sz[w]+=sz[u];
			mins(d4[w],d1[u]+1);
		}
		upd(d1[w],d2[w],d1[u]+1);
	}
}
void f2(int w,int pa){
	for(edge*i=e0[w];i;i=i->nx){
		int u=i->to;
		if(u==pa)continue;
		int d=max(d3[w],d1[w]==d1[u]+1?d2[w]:d1[w])+1;
		if(sz[u]!=sz[1])mins(d4[u],d);
		d3[u]=d;
		f2(u,w);
	}
}
int main(){
	scanf("%d",&n);
	for(int i=1,a,b;i<n;++i){
		scanf("%d%d",&a,&b);
		*ep=(edge){b,e0[a]};e0[a]=ep++;
		*ep=(edge){a,e0[b]};e0[b]=ep++;
	}
	scanf("%s",s+1);
	for(int i=1;i<=n;++i)if(s[i]=='0')d4[i]=N;
	f1(1,0);f2(1,0);
	for(int i=1;i<=n;++i){
		upd(d1[i],d2[i],d3[i]);
		ans+=max(0,min(d1[i]-1,d2[i]+1)-d4[i]+1);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 18944
def acount(array, char, count)
    return Float::INFINITY if count > $min
    return count if array.all?{|a| a == char}
    n = array.size
    new_array = []
    (n-1).times do |i|
        b = (array[i] == char || array[i+1] == char) ? char : array[i+1]
        new_array << b
    end
    return acount(new_array, char, count + 1)
end 

s = gets.chomp().split("")
a = s.uniq
$min = s.size
a.each do |char|
    candidate = acount(s, char, 0)
    $min = candidate if $min > candidate
    break if $min == 0 
end
puts $min

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

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

    int ans = 0;
    while (x > 4)
    {
        if (x - 500 >= 0)
        {
            x -= 500;
            ans += 1000;
        }
        else
        {
            if (x - 5 >= 0)
            {
                x -= 5;
                ans += 5;
            }
        }
    }

    cout << ans;
}

Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    ll A, B; cin >> A >> B;
    map<ll, ll> mp;
    auto prime_factrize = [&](ll a) -> void {
        for (ll i = 2; i*i <= a; i++) {
            if (a%i != 0) continue;
            ll cnt = 0;
            while (a%i == 0) {
                cnt++;
                a /= i;
            }
            mp[i] += cnt;
        }
        if (a > 1) mp[a]++;
    };
    prime_factrize(A);
    ll ans = 1;
    for (auto v : mp) {
        if (B%v.first==0) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <tuple>
#include <iomanip>
#include <iterator>
#define PB push_back
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(c) c.begin(),c.end()
#define SHOWVEC(v) for (auto e : v) cerr << e << ' '; cerr << endl;
#define SHOWP(p) cerr << "[" << p.first << "," << p.second << "]" << endl;
#define FI first
#define SE second

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
constexpr int INF = 1100000000;
constexpr ll LLINF = 1100000000000000000;

ll dp[210000][2];
int main()
{
  int a; cin >> a;
  string s; cin >> s;
  if (a < 3200) cout << "red" << endl;
  else cout << s << endl;
  return 0;
}


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

int main() { 
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i += 2){
        cout << s[i];
    }
    cout << endl;
}


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

int main() {
    int N, K;
    cin >> N; cin >> K;
    if (K > ((N-1) * (N-2) / 2)) {
        cout << "-1" << "\n";
        return 0;
    }
    int M = N - 1;
    int to_add = (N-1) * (N-2) / 2 - K;
    M += to_add;
    cout << M << "\n";
    for (int i = 2; i <= N; ++i) {
        cout << "1 " << i << "\n";
    }
    if (to_add == 0) {
        return 0;
    }
    for (int i = 2; i <= N; ++i) {
        for (int j = i + 1; j <= N; ++j) {
            cout << i << " " << j << "\n";
            to_add--;
            if (to_add == 0) {
                return 0;
            }
        }
    }
    return 0;
}


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

#define LISTMAX 1000000

struct command {
	char str[20];
	int key;
};

class dlList {
private:
	int list[LISTMAX];
	int head, num;
public:
	dlList();
	void Ins(int);
	void Del(int);
	void DelFirst();
	void DelLast();
	void ShowList();
	void show();
};

dlList::dlList()
	:list()
	,head(0),
	num(0)
{}

void dlList::Ins(int x)
{
	this->head = (head + LISTMAX - 1) % LISTMAX;
	this->num++;
	this->list[head] = x;
	return;
}

void dlList::Del(int x)
{
	int flag = 0;
	for (int i = 0; i < this->num; i++)
		if (list[(head + i) % LISTMAX] == x && !flag)
			flag = 1;
		else
			list[(head + i - flag + LISTMAX) % LISTMAX] = list[(head + i) % LISTMAX];
	this->num -= flag;

	return;
}

void dlList::DelFirst()
{
	this->head = (this->head + 1) % LISTMAX;
	this->num--;
	return;
}

void dlList::DelLast()
{
	this->num--;
	return;
}

void dlList::ShowList()
{
	int tmp;
	tmp = this->head;
	for (int i = 0; i < this->num; i++)
	{
		if (i)
			cout << " ";
		cout << this->list[tmp];
		tmp = (tmp + 1) % LISTMAX;
	}
	cout << endl;
	return;
}

int main()
{
	int n;
	dlList dll;
	command tmp;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> tmp.str;
		if (!strcmp(tmp.str, "insert"))
		{
			cin >> tmp.key;
			dll.Ins(tmp.key);
		}
		else if (!strcmp(tmp.str, "delete"))
		{
			cin >> tmp.key;
			dll.Del(tmp.key);
		}
		else if (!strcmp(tmp.str, "deleteFirst"))
			dll.DelFirst();
		else
			dll.DelLast();
	}
	dll.ShowList();

	return 0;
}


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

int main(){
  int n;
  cin>>n;
  if(n%2==0 || n%5==0){cout<<-1<<endl;}
  else{
   int ones = 1;
    int val = 7;
    while(true){
     
      if(val % n == 0){
        cout<<ones<<endl;
       break; 
      }
      ++ones;
      val = val *10 + 7;
      val = val %n;
    }
    
  }
  
  return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <cmath>
#include <cstdio>
using namespace std;
typedef vector<double> array;
typedef vector<array> matrix;
const double EPS = 1e-8;
enum { OPTIMAL, UNBOUNDED, NOSOLUTION, UNKNOWN };
struct two_stage_simplex {
  int N, M, st;
  matrix a;
  vector<int> s;
  two_stage_simplex(const matrix &A, const array &b, const array &c)
    : N(A.size()), M(A[0].size()), a(N+2, array(M+N+1)), s(N+2), st(UNKNOWN) {
    for (int j = 0; j < M; ++j) a[N+1][j] = c[j]; // make simplex table
    for (int i = 0; i < N; ++i)
      for (int j = 0; j < M; ++j) a[i+1][j] = A[i][j];
    for (int i = 0; i < N; ++i) a[i+1][M+N] = b[i]; // add helper table
    for (int i = 0; i < N; ++i) a[ 0 ][i+M] = 1;
    for (int i = 0; i < N; ++i) a[i+1][i+M] = 1;
    for (int i = 0; i < N; ++i) s[i+1]      = i+M;
    for (int i = 1; i <= N; ++i)
      for (int j = 0; j <= N+M; ++j) a[0][j] += a[i][j];
    st = solve();
  }
  int status() const { return st; }
  double solution() const { return -a[0][M]; }
  double solution(array &x) const {
    x.resize(M, 0);
    for (int i = 0; i < N; ++i)
      x[s[i+1]] = a[i+1].back();
    return -a[0][M];
  }
  int solve() {
    M += N; N += 1;
    solve_sub(); // solve stage one
    if (solution() > EPS) return NOSOLUTION;
    N -= 1; M -= N;
    swap(a[0], a.back()); a.pop_back(); // modify table
    for (int i = 0; i <= N; ++i) {
      swap(a[i][M], a[i].back());
      a[i].resize(M+1);
    }
    return solve_sub(); // solve stage two
  }
  int solve_sub() {
    int p, q;
    while (1) {
      //print();
      for (q = 0; q <= M && a[0][q] >= -EPS; ++q);
      for (p = 0; p <= N && a[p][q] <=  EPS; ++p);
      if (q >= M || p > N) break;
      for (int i = p+1; i <= N; ++i) // bland's care for cyclation
        if (a[i][q] > EPS)
          if (a[i][M]/a[i][q] < a[p][M]/a[p][q] ||
             (a[i][M]/a[i][q] == a[p][M]/a[p][q] && s[i] < s[q])) p = i;
      pivot(p, q);
    }
    if (q >= M) return OPTIMAL;
    else        return UNBOUNDED;
  }
  void pivot(int p, int q) {
    for (int j = 0; j <= N; ++j)
      for (int k = M; k >= 0; --k)
        if (j != p && k != q)
          a[j][k] -= a[p][k]*a[j][q]/a[p][q];
    for (int j = 0; j <= N; ++j)
      if (j != p) a[j][q] = 0;
    for (int k = 0; k <= M; ++k)
      if (k != q) a[p][k] = a[p][k]/a[p][q];
    a[p][q] = 1.0;
    s[p] = q;
  }
};

double p[10],q[10];
int main(){
	cout.precision(20);
	int i,j,n,m;
	for(i=0;i<6;i++){
		cin >> p[i]; p[i] /= 100;
	}
	for(i=0;i<6;i++){
		cin >> q[i]; q[i] /= 100;
	}
	n = 7,m = 12;
	matrix A(n,array(m));
	for(i=0;i<6;i++){
		A[0][i] = p[i] + q[i];
	}
	for(i=1;i<7;i++){
		A[i][i - 1] = 1; A[i][i + 5] = 1;
	}
	array b(n); array c(m);
	for(i=0;i<n;i++){
		b[i] = 1;
	}
	for(i=0;i<6;i++){
		c[i] = -p[i];
	}
	two_stage_simplex tss(A,b,c);
	double ans = -tss.solution();
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6;
const ll LINF = 1e18;
using namespace std;

#define rep(i, n) for (int(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (int i = (a); i < (b); i++)
#define rrrep(i, a, b) for (int i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl

ll n, cnt, ans, a[ohara], b, c, d, tmp, tmpp, m, h, w, x, y, sum[ohara], pos, k;
ld doua;
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
bool fl;
struct edge
{
    int to, cost;
};

//-------------------------↓↓↓↓↓↓------------------------

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

    cin >> n;
    rep(i, n) cin >> a[i];
    sort(a, a + n);
    rep(i, n) sum[i] = a[i];
    rrep(i, 1, n) sum[i] += sum[i - 1];
    reverse(a, a + n);
    ans = 1;
    rrep(i, 1, n)
    {
        tmp = sum[n - i - 1];
        if (a[i - 1] <= tmp * 2)
            ans++;
        else
            break;
    }
    Cout(ans);
    return 0;
}


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

int main() {
	string s[]  = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
	string str;
	cin >> str;
	int ptr = 0;
	for(string cur : s) {
		if(cur == str) {
			break;
		}
		++ptr;
	}
	++ptr;
	int answer = 1;
	for(int i = ptr; i < 7; ++i) {
		i %= 7;
		if(s[i] == "SUN")
			break;
		++answer;
	}
	cout << answer;
}


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

int main()
{
  int N; cin >> N;
  vector<int> A(N), B(N), C(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i]; A[i]--;
  }
  for (int i = 0; i < N; i++) cin >> B[i];
  for (int i = 0; i < N - 1; i++) cin >> C[i];

  int tmp = -2;
  int ans = 0;
  for (int i = 0; i < N; i++)
  {
    int x = A[i];
    ans += B[x];
    if (tmp + 1 == x) ans += C[x - 1];
    tmp = x;
  }
  cout << ans << endl;
}

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

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

int main() {
  int x;
  cin >> x;
  int i = 1;
  int sum = 0;
  while(1) {
    sum += i;
    if (x <= sum) break;
    i++;
  }
  cout << i << endl;
  return 0;
}

Measured memory_bytes: 256
using System;

namespace AOJ0022
{
    class Program
    {
        static void Main()
        {
            string line;
            while ((line = Console.ReadLine()) != null && line != "0")
            {
                var dataCount = int.Parse(line);
                var data = new int[dataCount];
                for (var i = 0; i < dataCount; i++)
                {
                    data[i] = int.Parse(Console.ReadLine() ?? "");
                }

                var max = int.MinValue;
                for (var s = 0; s < dataCount; s++)
                {
                    var sum = 0;
                    for (var i = s; i < dataCount; i++)
                    {
                        sum += data[i];
                        max = Math.Max(max, sum);
                    }
                }

                Console.WriteLine(max);
            }

        }
    }
}

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

#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

signed main(){
	string s, t;
	cin >> s >> t;

	int ans = 0;
	for(int i = 0;i < s.size();i++){
		if(s[i] != t[i]) ans++;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3916
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int N;
    cin >> N;
    vector<int> x(N);
    for (int i = 0; i < N; i++) {
        cin >> x[i];
    }
    sort(x.begin(), x.end());
    int m = (x[N - 1] + x[0]) / 2;
    cout << max(m - x[0], x[N - 1] - m) << "\n";
    return 0;
}


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

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Question question = new Question();
        question.solve(sc);
    }

    static class Question {
        public void solve(Scanner sc) {
            int n = sc.nextInt();
            int x = sc.nextInt();
            int y = sc.nextInt();
            int[] res = new int[n];
            int t = 0;
            for (int i = 1; i < n + 1; ++i) {
                for (int j = i + 1; j < n + 1; ++j) {
                    t = Math.min(j - i, Math.abs(x - i) + Math.abs(j - y) + 1);
                    res[t]++;
                }
            }
            for (int i = 1; i < n; ++i) {
                System.out.println(res[i]);
            }
        }
    }
}


Measured memory_bytes: 24404
#include <bits/stdc++.h>
using namespace std;
/*
 *  JUST KEEP GOING
 */
#define endl			'\n'
#define ll				long long
#define all(v)			((v).begin()), ((v).end())
#define allr(v)			((v).rbegin()), ((v).rend())
#define sz(v)			((int)((v).size()))
#define clr(v, d)		memset(v, d, sizeof(v))
#define rep(i, v)		for(int i=0;i<sz(v);++i)
#define For(i,s)        for(auto i:s)
#define Forr(i,s)        for(auto &i:s)
#define lp(i, n)		for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)	for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)	for(int i=(j);i>=(int)(n);--i)
#define vi				vector <int>
#define vl				vector <ll>
#define ii				pair <ll,ll>
#define vii				vector <ii>
#define vll				vector <pair<ll,ll>>
#define PI				double PPPPPP = 3.14159265358979323846;
#define bit(mask,i) ((mask>>i)&1)
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
void run() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
}
const int N = 2e5+5;
int n,m;
ll A[N],B[N],k;
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    run();
    cin>>n>>m>>k;
    for (int i = 1; i <= n; ++i) {
        cin>>A[i];
        A[i]+=A[i-1];
    }
    for (int i = 1; i <= m; ++i) {
        cin>>B[i];
        B[i]+=B[i-1];

    }
    int ans=0;
    for (int i = 0; i <= n && A[i]<=k; ++i) {
        ll rem = k-A[i];
        int curAns=i;
        int l=0,r=m,mid,idx;
        while(l<=r){
            mid = (l+r)/2;
            if(B[mid]<=rem){
                l=mid+1;
                idx = mid;
            }else
                r=mid-1;
        }
        curAns+=idx;
        ans = max(curAns,ans);
    }

    cout<<ans;


}

Measured memory_bytes: 6756
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD (1e9+7)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<int, int> pii;

int dp[101][10001];

int main(void)
{
    int N, W;
    cin >> N >> W;
    
    vector<int> v(N), w(N);
    REP(i, N){
        cin >> v[i] >> w[i];
    }

    // vector<vector<int>> dp(N+1, vector<int>(W+1, -1));
    REP(i, N+1)REP(j, W+1)dp[i][j] = -1;

    dp[0][0] = 0;
    REP(i, N){
        REP(j, W+1){
            if(dp[i][j]<0)continue;
            
            dp[i+1][j] = max(dp[i+1][j], dp[i][j]);
            if(j+w[i] <= W)
                dp[i+1][j+w[i]] = max(dp[i+1][j+w[i]], dp[i][j] + v[i]);
        }
    }

    int ans = 0;
    REP(i, N+1){
        REP(j, W+1){
            ans = max(ans, dp[i][j]);
        }
    }
    pr(ans);
}


Measured memory_bytes: 6944
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int W, H;
int c[50][50];
int vy[8] = {-1,-1,0,1,1,1,0,-1};
int vx[8] = {0,1,1,1,0,-1,-1,-1};
void calc(int y, int x) {
  if(y < 0 || y >= H || x < 0 || x >= W) return;
  if(c[y][x] == 0) return;
  c[y][x] = 0;
  FOR(i,0,8) calc(y+vy[i],x+vx[i]);
  return;
}
int main()
{
  while(cin >> W >> H, (W || H)) {
    FOR(y,0,H) FOR(x,0,W) cin >> c[y][x];
    int ans = 0;
    FOR(y,0,H) {
      FOR(x,0,W) {
        if(c[y][x] == 0) continue;
        calc(y, x);
        ans++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

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

using namespace std;

#define DUMP(x) std::cout << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++ i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")

using ll = std::int64_t;
using vint = std::vector<int>;
using vll = std::vector<ll>;
using vstr = std::vector<std::string>;
using pint = std::pair<int, int>;

constexpr std::int32_t INF = 1001001001;

void Main() {
    string s, t;
    cin >> s >> t;

    vector<char> vs('z' + 5, 0);
    vector<char> vt('z' + 5, 0);
    rep(i, s.length()) {
        if (vt[t[i]] == 0) {
            vt[t[i]] = s[i];
        }
        if (vs[s[i]] == 0) {
            vs[s[i]] = t[i];
        }

        if (vt[t[i]] != s[i]) {
            No; return;
        }
        if (vs[s[i]] != t[i]) {
            No; return;
        }
    }
    Yes;
}

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


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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

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

    int k;
    cin >> k;

    vector<int> abc={a, b, c};

    sort(abc.begin(), abc.end());

    for(int ik=0;ik<k;ik++) {
        abc.at(2) *= 2;
    }

    cout << abc.at(0)+abc.at(1)+abc.at(2) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
typedef long double lb;
typedef vector<int,vector<int>> vvec;
typedef long double ld;
typedef pair<int,int> P;

//----***Like a Pythonista***----
#define REP(i,j,n) for (ll i=j;i<(n);i++)
#define RREP(i,n,j) for (ll i = n; j<i;i--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0L)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
inline ll lcm(ll a, ll b){ if(!a || !b) return 0; return a * b / gcd(a, b); }

//----***定数***----
const int MOD=1000000007;
#define INF 1e9;
#define EPS 1e-9;

//----***入出力***---
#define print(out) cout<< out  << "\n";
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
#define here  cout<<"Here"<<endl;


//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}initial_;

signed main(){
  string S;cin>>S;
  int N=S.size();
  vector<vector<int>> dp(N+1,vector<int>(13,0));
  dp[0][0]=1;
  REP(i,0,N){
    int c;
    if(S.at(i)=='?')c=-1;
    else {c=(int)S.at(i)-'0';}
    REP(j,0,10){
      if(c!=-1&&c!=j)continue;
      REP(k,0,13){
        dp[i+1][(k*10+j)%13]+=dp[i][k];
        dp[i+1][(k*10+j)%13]%=MOD;
      }
    }
  }
  print(dp[N][5])
}


Measured memory_bytes: 13648
n, a, b, c, d = gets.split.map(&:to_i)
a -= 1
b -= 1
c -= 1
d -= 1
s = gets.chomp

if s[a..c].include?'##' or s[b..d].include? '##'
  puts :No
elsif c < d
  puts :Yes
else
  if s[b-1..d+1].include? '...'
    puts :Yes
  else
    puts :No
  end
end


Measured memory_bytes: 2428
#include<iostream>

using namespace std;

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if (a == b || b == c || c == a)
    {
        if (a == b && b == c)
        {
            cout << "No" << endl;
            return 0;
        }
        cout << "Yes" << endl;
        return 0;
    }
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
// 2011/06/30 Tazoe

#include <iostream>
#include <string>
using namespace std;

int main()
{
	while(true){
		string r, a;
		cin >> r >> a;
		if(r=="0"&&a=="0")
			break;

		int hit = 0;
		int blw = 0;
		for(int i=0; i<4; i++)
			for(int j=0; j<4; j++)
				if(r[i]==a[j])
					if(i==j)
						hit++;
					else
						blw++;

		cout << hit << ' ' << blw << endl;
	}

	return 0;
}

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

int main(){
    int n;
    cin >> n;
    int a[n], i, x = 0, y = n - 1;
    for (i = 0; i < n; i++) cin >> a[i];
    while (x < y){
        swap(a[x], a[y]);
        x++;
        y--;
    }
    for (i = 0; i < n; i++){
        cout << a[i];
        if (i != n - 1) cout << " ";
    }
    cout << endl;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


int main() {
  int N, K; cin >> N >> K;
  int P[N]; rep(i,N) cin >> P[i];
  int rev[N] = {}; repr(i,1,N) rev[i] = rev[i-1] + (P[i-1]>P[i]);
  bool order = false;

  ll result = 0;
  set<int> now;
  rep(i,N-K+1) {
    bool ok = false;
    if (i==0) rep(j,K) now.insert(P[j]);
    else {
      // cout << i << " " << *(now.begin()) << " " << *(now.rbegin()) << endl;
      bool t1 = *(now.begin())==P[i-1];
      bool t2 = *(now.rbegin())<P[i+K-1];
      ok = t1 && t2;
      now.erase(P[i-1]); now.insert(P[i+K-1]);
    }
    if (rev[i]!=rev[i+K-1]) result += !ok;
    else order = true;
  }
  result += order;
  cout << result << endl;
  // debug(rev,rev+N);
  return 0;
}

Measured memory_bytes: 11136
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<stdbool.h>
#include<math.h>
#include<sstream>
#include<math.h>
#include<vector>
#include<functional>
#include<queue>
#include<utility>
#include<bitset>
#include<time.h>
#include<map>
#include<set>
typedef long long ll;
#define N (1000000000+7)
#define INF 1e16
using namespace std;
typedef pair<ll, ll> P;
vector<ll>a[100000];
ll sum[100010];

int main(void) {
	ll h, w, x, y;
	cin >> h >> w >> x >> y;
	if ((h == 2 * x) && (w == 2 * y)) {
		printf("%.9lf 1\n", (double)h*w / 2);
	}
	else {
		printf("%.9lf 0\n", (double)h*w / 2);
	}
	return 0;
}

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

int h[101][101];
vector<tuple<int, int, int>> pyramid;
vector<tuple<int, int, int>> measure;

void init_pyramid()
{
  for (auto y = 0; y <= 100; y++) {
    for (auto x = 0; x <= 100; x++) {
      pyramid.emplace_back(make_tuple(x, y, 0));
    }
  }
}

void read_measure_data(int n)
{
  for (auto i = 0; i < n; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    measure.emplace_back(make_tuple(a, b, c));
  }
}

void check1()
{
  for (auto&& m : measure) {
    for (auto&& p : pyramid) {
      if (get<2>(p) < 0) continue;
      if (get<2>(m) == 0) continue;
      int guess = get<2>(m) + abs(get<0>(p) - get<0>(m)) + abs(get<1>(p) - get<1>(m));
      if (get<2>(p) == 0) {
	get<2>(p) = guess;
      } else if (get<2>(p) != guess) {
	get<2>(p) = -1;
      }
    }
  }
}

void check2()
{
  for (auto&& m : measure) {
    for (auto&& p : pyramid) {
      if (get<2>(p) < 0) continue;
      if (get<2>(m) != 0) continue;
      int guess = abs(get<0>(p) - get<0>(m)) + abs(get<1>(p) - get<1>(m));
      if (guess - get<2>(p) < 0) {
	get<2>(p) = -1;
      }
    }
  }
}

void print_ans()
{
  for (auto&& p : pyramid) {
    if (get<2>(p) > 0) {
      cout << get<0>(p) << " " << get<1>(p) << " " << get<2>(p) << endl;
    }
  }
}

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

  init_pyramid();
  read_measure_data(n);
  check1();
  check2();
  print_ans();
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
#include <boost/range/adaptors.hpp>

using namespace std;
using namespace boost::adaptors;

using ll = long long;
using uint = unsigned int;

int main() {
    ll N, K;
    cin >> N >> K;
    vector<ll> xs(N, 0), ys(N, 0);
    for (auto &&i: boost::irange(0LL, N)) {
        cin >> xs.at(i) >> ys.at(i);
    }
    ll min_square = numeric_limits<ll>::max();
    vector<ll> xs_sorted(xs), ys_sorted(ys);
    sort(xs_sorted.begin(), xs_sorted.end());
    sort(ys_sorted.begin(), ys_sorted.end());

    for (auto &&i_x_min: boost::irange(0LL, N)) {
        ll x_min{xs_sorted.at(i_x_min)};
        for (auto &&i_x_max: boost::irange(i_x_min, N)) {
            ll x_max{xs_sorted.at(i_x_max)};
            for (auto &&i_y_min: boost::irange(0LL, N)) {
                ll y_min{ys_sorted.at(i_y_min)};
                for (auto &&i_y_max: boost::irange(i_y_min, N)) {
                    ll y_max{ys_sorted.at(i_y_max)};
                    ll count = 0;
                    for (auto &&i: boost::irange(0LL, N)) {
                        ll x{xs.at(i)};
                        ll y{ys.at(i)};
                        if (x_min <= x && x <= x_max && y_min <= y && y <= y_max) {
                            count++;
                        };
                    }
                    if (count >= K){
                        min_square = min(min_square, (x_max - x_min) * (y_max - y_min));
                    }
                }
            }
        }
    }
    cout << min_square;
}

Measured memory_bytes: 256
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');

            for (int i = 0; i < 5; i++)
            {
                if (input[i] == "0")
                    Console.WriteLine(i + 1);
            }
        }

    }
}



Measured memory_bytes: 25660
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    X = SS()

    # 一回の操作でnはN以下になる
    # 2回目以降の操作はメモ化再帰
    # 初回popcountは2種類しかない Xのpopcountから足し引きすればよい

    pc_X = X.count('1')

    if pc_X == 0:
        for i in range(N):
            print(1)
    elif pc_X == 1:
        for i in range(N):
            if i == X.index('1'):
                print(0)
            else:
                # 1が2つある場合、最後の位が1の場合、奇数
                if i == N - 1 or X.index('1') == N - 1:
                    print(2)
                else:
                    print(1)
    else:
        next_X_m1 = 0
        next_X_p1 = 0
        pc_m1 = pc_X - 1
        pc_p1 = pc_X + 1
        for i in range(N):
            if X[i] == '1':
                next_X_m1 += pow(2, N - 1 - i, pc_m1)
                next_X_p1 += pow(2, N - 1 - i, pc_p1)
        dp = [-1] * N
        dp[0] = 0

        # def dfs(n):
        #     if dp[n] == -1:
        #         dp[n] = 1 + dfs(n % bin(n).count('1'))
        #     return dp[n]

        def f(n):
            cnt = 0
            while n:
                n %= bin(n).count('1')
                cnt += 1
            return cnt

        for i in range(N):
            next = 0
            if X[i] == '0':
                next = (next_X_p1 + pow(2, N - 1 - i, pc_p1)) % pc_p1
            else:
                if pc_m1 >= 1:
                    next = (next_X_m1 - pow(2, N - 1 - i, pc_m1)) % pc_m1
                else:
                    next = next_X_m1 - pow(2, N - 1 - i)

            if pc_X == 1 and X[i] == '1' and i == N - 1:
                ans = 0
            else:
                # ans = dfs(next) + 1
                ans = f(next) + 1
            print(ans)
    # print(dp)

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 11812
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
from fractions import gcd
#from math import gcd
from math import ceil, floor
import bisect
sys.setrecursionlimit(10 ** 6)
inf = float("inf")

def input():
    return sys.stdin.readline()[:-1]

def chmin(a, b):
    if a > b:
        return b
    else:
        return a

def chmax(a, b):
    if a < b:
        return b
    else:
        return a

def main():
    n = int(input())
    h = tuple(map(int, input().split()))
    dp = [inf] * 100010
    dp[0] = 0
    for i in range(1, n):
        dp[i] = chmin(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
        if i > 1:
            dp[i] = chmin(dp[i], dp[i-2] + abs(h[i] - h[i-2]))
    print(dp[n-1])
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 81208
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include<stdio.h>
#include<algorithm>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define SZ(x) ((int)(x).size())

using namespace std;

int main(){
	int x, a, b;
	cin >> x >> a >> b;
	cout << (x - a) % b << endl;
	
	return 0;
}

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

using ll = long long;
const int mod = 1e9 + 7;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int H, N;
    cin >> H >> N;
    int sum = 0;
    for (int i = 0; i < N; i++) {
        int A;
        cin >> A;
        sum += A;
    }
    if (sum >= H)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 256