akhauriyash/Code-Regression huggingface dataset:
/// You just can't beat the person who never gives up
/// ICPC next year


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sz(x) ((long long)(x).size())
#define all(x)  x.begin(),x.end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl "\n"
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define leastsigbit(x)     __builtin_ffs(x)
#define mod             1000000007
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define pii pair<ll,ll>
#define vpii vector<pii>
#define tt ll tt;cin >> tt;while(tt--)
#define  fio ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define D1(x) { cerr << " [" << #x << ": " << x << "]\n"; }
#define D2(x) { cerr << " [" << #x << ": "; for(auto it:x) cerr << it << " "; cerr << "]\n";}
const double PI = acos(-1);
ll power(ll a,ll b,ll m=mod){ ll ans=1; a=a%m;  while(b>0) {  if(b&1)  ans=(1ll*a*ans)%m; b>>=1;a=(1ll*a*a)%m;}return ans;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm( ll x, ll y) { return (x*y)/gcd(x,y);}
bool isprime(ll n){if(n < 2) return 0; ll i = 2; while(i*i <= n){if(n%i == 0) return 0; i++;} return 1;}
bool isPowerOfTwo(int x)
{
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));
}
void offset(vector<int>&a,int x) {
    for(int i = 0; i < sz(a);i++) {
        a[i] = x;
    }
}
struct cmp {
    bool operator() (const pair<int,int>& lhs, const pair<int,int>& rhs) const {
        return lhs.ff * rhs.ss < lhs.ss * rhs.ff;
    }
//for map<pii,int>
};


// auto cmp = [](pair<int,int>a,pair<int,int>b) {if(a.first==b.first)return a.second>b.second;
//      else return a.first > b.first;
//  };
//  multiset<pair<int,int>,decltype(cmp)>fc(cmp);
double distform(int x, int y, int z, int w) {//(x1,y1,x2,y2)
    return sqrt(1. * pow(x-z,2) + 1. * pow(y-w,2));
}
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
    //unordered_map<long long, int, custom_hash> safe_map;
};

const int MAXN = 2e5+ 10;

#define int long long
bool cmps(pair<int,int>p1,pair<int,int>p2) {
    return p1.ss > p2.ss;
}
int32_t main() {
    fio
    string s,t;
    cin >> s >> t;
    int a,b;
    cin >> a >> b;
    string u;
    cin >> u;
    if(s==u) cout << a-1 << " " << b;
    else cout << a << " " << b-1;


    cerr <<endl <<"[ Time : " << (float)clock() / CLOCKS_PER_SEC << " secs ]" << endl;


}






Measured memory_bytes: 3752
MOD = int(1e9+7)

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)

def lcm(a, b):
    return a // gcd(a,b) * b


N = int(input())
A = [int(i) for i in input().split()]

l = 1
for i in range(N):
    l = lcm(l, A[i])

ans = 0
for i in range(N):
    ans += l // A[i]

print(ans % MOD)

Measured memory_bytes: 4084
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define DEBUG true
#ifdef ONLINE_JUDGE
#undef DEBUG
#define DEBUG false
#endif 

using namespace std;

#define MAXN ((int)2e5+5)
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9 + 9)
#define ll long long
#define _ << " " <<
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define TRACE(x) if(DEBUG) cerr << #x << " = " << x << endl;
#define TRACE2(x,y) if(DEBUG) cerr << #x << " = " << x << " | " << #y << " = " << y << endl;
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"
#define pii pair<int,int>
#define mid ((l+r)/2)

string s;
int ct;

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

	int t = 0;
	char last = '1';
	while(t < s.size())
	{
		if(s[t] != last)
		{
			ct++;
			last = s[t];
		}
		t++;
	}	

	cout << ct << endl;
}

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

typedef pair<int,int > pp;
typedef long long ll;

int const N=3e5+10,oo=1e9,M=2e5+3;
ll const OO=1e18;
int mod=998244353;
double const eps=1e-4,PI=acos(-1);

int n;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>n;
    int od=0;
    for(int i=0,a;i<n;i++){
        cin>>a;
        od|=a%2;
    }
    if(od)cout<<"first\n";
    else cout<<"second\n";
    return 0;
}
/*
1 1
0 0 f

1 2
0 2
0 1
0 0 f

2 2
1 1
0 0 s

2 3
2 2 f
1 2 s
0 2 f
0 1 s
0 0 f

3 3
2 2 f
1 1 s
0 0 f

4 2
3 1 f
3 0 s
2 0 f
1 0 s
0 0 f

2 2 2
2 2 1 f
2 2 0 s
1 2 0 f
0 2 0 s
0 1 0 f
0 0 0 s

2 2 2
2 1 1 f
2 0 0 s
1 0 0 f
0 0 0 s

2 1 1
2 0 0 f
1 0 0 s
0 0 0 f
*/

Measured memory_bytes: 256
S = input()
N = len(S)


if N % 2 == 1:
    mid = N // 2
    K = N
    for i in range(mid):
        if S[mid] != S[mid + i + 1]:
            K = min(K, N - mid + i)
            break
    for i in range(mid):
        if S[mid] != S[mid - i - 1]:
            K = min(K, N - mid + i)
            break

if N % 2 == 0:
    mid_right = N // 2
    mid_left = N // 2 - 1
    K = N
    for i in range(N // 2):
        if S[mid_left] != S[mid_left + i + 1]:
            K = min(K, N//2 + i)
            break
    for i in range(N // 2):
        if S[mid_right] != S[mid_right - i - 1]:
            K = min(K, N//2 + i)


print(K)

Measured memory_bytes: 3316
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**13
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    def f(n):
        a = LI()
        dp = [inf] * (a[0]*2)
        for i in range(a[0]//2,a[0]*2):
            dp[i] = abs(i-a[0]) / a[0]
        for i in range(n-1):
            a1 = a[i+1]
            nn = a1 * 2
            ndp = [inf] * nn
            for j in range(1, len(dp)):
                if dp[j] == inf:
                    continue
                t = dp[j]
                for k in range(j,nn,j):
                    u = abs(a1-k) / a1
                    if u < t:
                        u = t
                    if ndp[k] > u:
                        ndp[k] = u
            dp = ndp
        return '{:0.9f}'.format(min(dp))

    while 1:
        n = I()
        if n == 0:
            break
        rr.append(f(n))
        # print('rr', rr[-1])
        break

    return '\n'.join(map(str,rr))


print(main())



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

using namespace std;

//vector string deque break continue
#define forn(i, s, f) for (int i = (int)s; i < (int)f; i++)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define fs first
#define sc second
#define pf push_front
#define pb push_back
#define pop_f pop_front
#define pop_b pop_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()

#ifdef DEBUG
#else
    #define cerr if (false) cerr
#endif

template <typename T> istream& operator>>(istream& in, vector <T>& a) {for (auto& i : a) in >> i; return in;}
template <typename T> ostream& operator<<(ostream& out, vector <T>& a)  {for (auto& i : a) out << i << " "; return out;}
template <typename T, typename U> void chkmin(T& a, U b) {if (a > b) a = b;}
template <typename T, typename U> void chkmax(T& a, U b) {if (a < b) a = b;}

#define int long long

const ll INF = 2e18;

main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int n, k;
    cin >> n >> k;
    vector <int> p(n);
    forn (i, 0, n) {
        cin >> p[i];
        p[i]--;
    }
    vector <int> c(n);
    cin >> c;
    long long ans = -INF;
    forn (i, 0, n) {
        vector <int> cycle; {
            int j = i;
            do {
                if (j != i)
                    cycle.pb(c[j]);
                j = p[j];
            } while (j != i);
            cycle.pb(c[i]);
        }
        vector <long long> pref(sz(cycle) + 1);
        forn (j, 0, sz(cycle))
            pref[j + 1] = pref[j] + cycle[j];
        long long full = pref.back();
        forn (j, 1, sz(cycle) + 1) {
            if (k - j < 0)
                continue;
            int cycles = (k - j) / sz(cycle);
            chkmax(ans, max(0LL, cycles * full) + pref[j]);
        }
        /*int r = k % sz(cycle);
        if (r == 0)
            r = sz(cycle);
        long long mx = cycle[0];
        forn (j, 0, r)
            chkmax(mx, pref[j + 1]);
        long long cur;
        int cycles = k / sz(cycle);
        if (k % sz(cycle) == 0)
            --cycles;
        if (cycles == 0 || full <= 0) {
            cur = mx;
        } else {
            --cycles;
            mx += full;
            forn (j, 0, sz(cycle))
                chkmax(mx, pref[j + 1]);
            cur = cycles * full + mx;
        }
        cerr << cycle << "\n" << cur << " " << mx << "\n---\n";
        chkmax(ans, cur);*/
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3800
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <functional>
#include <bitset>
#include <limits>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <random>

#ifdef DEBUG
#include "library/Utility/debug.cpp"
#else
#define debug(...)
#endif

#define rep(i,n) for(int i=0;i<(n);++i)
#define EL '\n'
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using lnt = long long;
constexpr lnt INF = 2e18;
struct FIO{FIO(){std::cin.tie(0);std::cout.tie(0);std::ios_base::sync_with_stdio(0);std::cout<<std::fixed<<std::setprecision(15);}}fIO;
/*-*/

int main() {
	int t;
	std::cin >> t;
	rep(tt,t) {
		int n;
		std::cin >> n;
		std::vector<lnt> a(n);
		rep(i,n) std::cin >> a[i];
		std::string s;
		std::cin >> s;
		// do from the back
		std::reverse(all(a));
		std::reverse(all(s));
		// hold current bases
		std::vector<lnt> bases(64,0);
		bool one = false;
		rep(i,n) {
			// apply bases to a[i] if s[i]==1
			if(s[i]=='1') {
				for(int j=63;j>=0;j--) {
					if(a[i]>>j&1) a[i]^=bases[j];
				}
				if(a[i]>0) one=true;
			} else {
				int j=63;
				for(;j>=0;j--){
					while(j>=0&&(a[i]>>j&1)==0) {
						j--;
					}
					if(bases[j]==0) {
						bases[j]=a[i];
						int o=j;
						j--;
						for(;j>=0;j--) if(bases[o]>>j&1) bases[o]^=bases[j];
						for(int k=o+1;k<64;k++) if(bases[k]>>o&1) bases[k]^=bases[o];
						break;
					} else {
						a[i]^=bases[j];
					}
				}
			}
		}
		if(one) print(1);
		else print(0);
	}
}


Measured memory_bytes: 3620
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

using namespace std;
typedef long long int ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD = 1000000007
#define INF (1e9)
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

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; }
typedef pair <ll,ll> P;


int main()
{
    ll N, K;
    cin >> N >> K;
    bool ans = N%K != 0;
    print(ans);
    return 0;
}


Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.Stack;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		while(true){
			int n = Integer.parseInt(scan.next());
			int m = Integer.parseInt(scan.next());
			if(n==0) break;
			V[] ver = new V[n];
			for (int i = 0; i < n; i++) ver[i] = new V();
			boolean[] used = new boolean[n];

			for (int i = 0; i < m; i++) {
				int a = Integer.parseInt(scan.next())-1;
				int b = Integer.parseInt(scan.next())-1;
				ver[a].to.add(b);
				ver[b].to.add(a);
			}

			Stack<int[]> stk = new Stack<int[]>();
			stk.push(new int[]{0,0});
			used[0]=true;
			int ans = 0;
			while(!stk.isEmpty()){
				int[] p = stk.pop();
				int num = p[0],deep = p[1];
				ans++;
				if(deep!=2) for (Integer i : ver[num].to) {
					if(!used[i]){
						used[i]=true;
						stk.push(new int[]{i,deep+1});
					}
				}
			}
			out.println(ans-1);
		}
		out.flush();
	}
}

class V{
	ArrayList<Integer> to = new ArrayList<Integer>();
}

Measured memory_bytes: 35236
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <cmath>
#include <string>
#include <algorithm>

#define REP(i, n) for(int i = 0; i != n; ++i)
#define REPR(i, n) for(int i = n - 1; i != -1; --i)
#define FOR(i, a, b) for(int i = a; i != b; ++i)
#define IN(n) (cin >> n)
#define OUT(n) (cout << n << endl)

using namespace std;
using ll = unsigned long long;

int main() {
	string S;
	cin >> S;
	int i, n, m = 2 * 753;
	size_t size = S.size();
	for(i = 0; i < size - 2; i++) {
		n = 100 * (S[i] - '0') + 10 * (S[i+1] - '0') + S[i+2] - '0';
		if(abs(n - 753) < abs(m - 753)) {
			m = n;
		}
	}
	cout << abs(m - 753) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define Tp template<typename Ty>
#define Ts template<typename Ty,typename... Ar>
#define Reg register
#define RI Reg int
#define Con const
#define CI Con int&
#define I inline
#define W while
#define N 10000000
#define X 998244353
#define C(x,y) (1LL*Fac[x]*IFac[y]%X*IFac[(x)-(y)]%X)
using namespace std;
int n,Fac[N+5],IFac[N+5];
I int Qpow(RI x,RI y) {RI t=1;W(y) y&1&&(t=1LL*t*x%X),x=1LL*x*x%X,y>>=1;return t;}
int main()
{
	RI i,t=0;for(scanf("%d",&n),Fac[0]=i=1;i<=n;++i) Fac[i]=1LL*Fac[i-1]*i%X;
	for(IFac[n]=Qpow(Fac[n],X-2),i=n-1;~i;--i) IFac[i]=1LL*IFac[i+1]*(i+1)%X;
	for(i=n/2+1;i<=n;++i) t=(1LL*C(n,i)*Qpow(2,n-i)+t)%X;
	return printf("%d",(Qpow(3,n)-2*t%X+X)%X),0;
}

Measured memory_bytes: 78464
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<math.h>
#include<queue>
#define mem(x) memset(x,0,sizeof(x)) 
#define sca(x) scanf("%d",&x)
#define scaa(x,y) scanf("%d%d",&x,&y)
#define inf 0x7f7f7f7f
#define io ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#pragma GCC optimize(2)
using namespace std;
const double pi=acos(-1); 
const double eps=1e-6;
typedef pair<long,long> pll;
typedef pair<int,int> pii;
typedef long long ll;
typedef pair<char,char> pcc;
int v[105];
int main()
{
	int n,k;
	cin>>n>>k;
	mem(v);
	while(k--)
	{
		
		int d;
		cin>>d;
		while(d--)
		{
			int x;
			cin>>x;
			v[x]=1;
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		if(v[i]==0)
		ans++;
	}
	cout<<ans<<endl;
} 

Measured memory_bytes: 3672
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
 
#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--)
 
int main(){
    int p[3],j[2];
    REP(i,3)
        scanf("%d",p + i);
    REP(i,2)
        scanf("%d",j + i);
 
    int mini = 1000000000;
    REP(i,3){
        REP(k,2){
            mini = min(p[i] + j[k],mini);
        }
    }
 
    printf("%d\n",mini - 50);
    return 0;
}
 

Measured memory_bytes: 3164
#include<bits/stdc++.h>
#define endl              "\n"
#define fast               ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int main()
{
    long long  i=0,j,n,c=0,d=0,e=0,f=0,a,b;
    string s;
    cin>>s;
    for(i=0;i<s.size();i++)
    {
        cout<<"x";
    }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int
main(int argc, char *argv[])
{
  int a[3], i, j;
  i = 0; j = 0;
  for(int k = 0; k < 3; k++){
    scanf("%d", &a[k]);
    if(a[k] == 5) i++;
    else if(a[k] == 7) j++;
  }
  if(i == 2 && j == 1) printf("YES\n");
  else printf("NO\n");
  
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n); i++)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
using namespace std;
using ll = long long;
int INF = 1001001001;

int main() {
  int n, x, t;
  cin >> n >> x >> t;
  int ans = ((n + x -1)/x) * t;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3580
N = int(input())
A = list(map(int, input().split()))
M_DICT = {}


def make_m(i, m):
    if (i, m) in M_DICT:
        return M_DICT[(i, m)]
    if m == 0:
        return True
    if i >= N or m < 0:
        return False

    res = make_m(i+1, m) or make_m(i+1, m-A[i])
    M_DICT[(i, m)] = res
    return res


def main():
    q = int(input())
    m_lst = list(map(int, input().split()))

    for i in range(q):
        if make_m(0, m_lst[i]):
            print("yes")
        else:
            print("no")


if __name__ == '__main__':
    main()



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

using namespace std;

#define FORE(i, a) for (auto i = a.begin(); i != a.end(); ++i)
#define REPU(i, a, b) for (int i = (a); i < (b); ++i)
#define REPD(i, a, b) for (int i = (a); i > (b); --i)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

vector<string> split(const string &s, char c) {
	vector<string> v; stringstream ss(s); string x;
	while (getline(ss, x, c)) v.push_back(x);
	return v;
}
#define DEBUG(args...) { vector<string> _v = split(#args, ','); err(_v.begin(), args); }
void err(vector<string>::iterator it) {}
template<typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
	cerr << "[DEBUG] " << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << '\n';
	err(++it, args...);
}

typedef long long ll;
const int MOD = 1000000007;

template<class T, class U> inline T tmin(T a, U b) { return (a < b) ? a : b; }
template<class T, class U> inline T tmax(T a, U b) { return (a > b) ? a : b; }
template<class T, class U> inline void amax(T &a, U b) { if (b > a) a = b; }
template<class T, class U> inline void amin(T &a, U b) { if (b < a) a = b; }
template<class T> T gcd(T a, T b) { while (b != 0) { T c = a; a = b; b = c % b; } return a; }

int main(int argc, char *argv[]) {
	ios_base::sync_with_stdio(false);

	int n, h, w; cin >> n >> h >> w;
	int ans = (n - h + 1) * (n - w + 1);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <ctype.h>
 
int main(void) {
     
    char c;
    int i;
    
    i = 'a'-'A';
     
    for(;;){
        scanf("%c",&c);
        if ('a' <= c && c<= 'z') 
            printf("%c",c-i);
        else if ('A' <= c && c<= 'Z')
            printf("%c",c+i);
        else if (c == '\n') 
            break;
        else
            printf("%c",c);
    }
     
    printf("\n");
    return 0;
}

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

int main(){  
  
  int n,m;
  cin >> n >> m;
  
  if(m == 0){
    if(n == 1){
      cout << 0 << endl;
    }else{
      cout << pow(10,n-1) << endl;
    }
    return 0;
  }
  
  map<int,int> p;
  
  rep(i,m){
    int s,c;
    cin >> s >> c;
    
    if(s == 1){
      if(c == 0 && n != 1){
        cout << -1 << endl;
      return 0;
      }
    }
    
    if(s > n){
      cout << -1 << endl;
      return 0;
    }
    
    if(p.count(s)){
      if(p[s] != c){
        cout << -1 << endl;
        return 0;
      }
    }else{
      p[s] = c;
    }
  }
  
  if(p.count(1) == 0){
    p[1] = 1;
  }
  int ans = 0;
  rep(i,n){
    ans += p[i+1]* pow(10,n-i-1);
  }
  cout << ans << endl;
  
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;

typedef long long ll;

int main() {
    ll x, y;
    ll a, b;
    ll ans = 1000000001;
    ll cnt;
    cin >> x >> y;
    
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 2; j++) {
            a = pow(-1, i) * x;
            b = pow(-1, j) * y;
            if (a <= b) {
                ans = min(ans, i+j+b-a);
            }
        }
    }
    cout << ans << endl;
}


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

#define all(C) C.begin(),C.end()
#define size(C) int(C.size())
typedef long long int Long;
typedef long double Double;
const int MAXN = 1e5 + 5;


int main() {
  int n, d, p[3] = { 1, 100, 10000 };
  scanf("%d%d", &d, &n);

  if(n == 100)
    ++n;
  printf("%d\n", n * p[d]);
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MOD 1000000007
#define MOD2 1000000006
#define TEMPMOD1 998244353
#define TEMPMOD2 998244352
#define INF 1000000000000000007
#define NEGINF -1000000000000000007
#define vll vector<ll> 
#define vvll vector<vector<ll>>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define plll pair<ll,pll>
#define vpll vector<pll>
using namespace std;
typedef long long int ll;



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0); 
    
    string str1,tofind;
    cin>>str1>>tofind;
    vector<ll>pos[26];
    ll len1=str1.size();
    for(ll i=0;i<len1;i++)
    {
        pos[str1[i]-'a'].push_back(i);
    }
    ll len2=tofind.size();
    for(ll i=0;i<len2;i++)
    {
        if(pos[tofind[i]-'a'].empty())
        {
            cout<<"-1";
            exit(0);
        }
    }
    vector<ll>::iterator it;
    ll currpos=-1;
    ll currlen=0;
    for(ll i=0;i<len2;i++)
    {
        it=upper_bound(pos[tofind[i]-'a'].begin(),pos[tofind[i]-'a'].end(),currpos);
        if(it==pos[tofind[i]-'a'].end())
        {
            currpos=pos[tofind[i]-'a'][0];
            currlen++;
        }
        else
        {
            currpos=*it;
        }
    }
    ll ans=currlen*len1;
    ans+=currpos+1;
    cout<<ans;
    return 0;
}

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

int main(){

    int n,m;
    int ans=0;
    cin>>n>>m;
    vector<int> check(m);
    for(int i=0;i<n;i++){
        int k;
        cin>>k;
        for(int j=0;j<k;j++){
           int a;
           cin>>a;
           check[a-1]++;
        }
    }

    for(int i=0;i<m;i++){
        if(check[i]==n) ans++;
    }
    cout<<ans<<endl;




    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>          // printf(), scanf()
#define MAX_V 100

int
main(int argc, char** argv)
{
	int g[MAX_V][MAX_V];
	int u, v;
	int V;
	int k;
	int i, j;

	scanf("%d", &V);
	for (i = 0; i < V; ++i)
	{
		scanf("%d", &u);
		for (v = 1; v <= V; ++v)
			g[u - 1][v - 1] = 0;

		scanf("%d", &k);
		for (j = 0; j < k; ++j)
		{
			scanf("%d", &v);
			g[u - 1][v - 1] = 1;
		}
	}

	for (u = 0; u < V; ++u)
	{
		for (v = 0; v < V; ++v)
			printf("%d%c", g[u][v], (v != V - 1) ? ' ' : '\n');
	}

	return 0;
}

Measured memory_bytes: 632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod=1e9+7;

int main(){
    int N;
    cin >> N;
    vector<ll> D(N);
    for(int i=0; i<N; i++){
        cin >> D[i];
    }
    int M;
    cin >> M;
    vector<ll> T(M);
    for(int i=0; i<M; i++){
        cin >> T[i];
    }
    sort(D.begin(), D.end());
    sort(T.begin(), T.end());
    int cnt=0;
    for(int i=0; i<N; i++){
        if(D[i]==T[cnt]){
            cnt++;
        }
        if(cnt==M){
            cout << "YES";
            return 0;
        }
    }
    cout << "NO";
}

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

using namespace std;

int main(int argc, char *argv[]) {
    int64_t h, w;
    cin >> h >> w;
    int64_t ans = ceil(h * w / 2.0);
    if (h == 1 || w == 1) {
        ans = 1;
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int64_t> a(n);
  int64_t totala = 1LL;
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
    if (a.at(i) == 0) {
      totala = 0LL;
      goto OUT;
    }
  }
  for (int i = 0; i < n; i++) {
    if (a.at(i) > 1000000000000000000 / totala) {
      totala = -1LL;
      break;
    }else {
      totala *= a.at(i);
    }
  }
  OUT:cout << totala;
}

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

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
  return x/gcd(x, y)*y;
}

int main(){
  ll n,k;cin >> n >> k;
  ll a,b,MAX;
  cin >> a;
  if(n==1){
    if(k==a){cout << "POSSIBLE" << endl;return 0;}
    else {cout << "IMPOSSIBLE" << endl;return 0;}
  }
  cin >> b;
  ll GCD = gcd(a,b);
 // cout << GCD << endl;
  MAX = max(a,b);
  for(ll i=0; i<n-2; i++){
    cin >> a;
    MAX = max(a,MAX);
    GCD = gcd(GCD,a);
    //cout << GCD << endl;
  }
  //cout << GCD << endl;
  //cout << "max" << MAX << endl;
  if(k<=MAX&&k%GCD==0){cout << "POSSIBLE" << endl;}
  else{cout << "IMPOSSIBLE" << endl;}
}
  


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  char a, b;std::cin >> a >> b;
  std::cout << (a==b?"H":"D") << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=200005,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string S;cin>>S;
    for(int i=0;i<si(S);i++){
        if(S[i]=='?') S[i]='D';
    }
    cout<<S<<endl;
}



Measured memory_bytes: 3780
s = list(input())
s = s[::-1]
ans = 1
while len(s):
    if len(s) <= 4:
        ans = 0
        break
    elif s[0:5] == list("maerd"):
        del s[0:5]
    elif s[0:5] == list("esare"):
        del s[0:5]
    elif len(s) <= 5:
        ans = 0
        break
    elif s[0:6] == list("resare"):
        del s[0:6]
    elif len(s) <= 6:
        ans = 0
        break
    elif s[0:7] == list("remaerd"):
        del s[0:7]
    else:
        ans = 0
        break
print(["NO","YES"][ans])

Measured memory_bytes: 4648
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
bool sqr[105][105];
int main()
{
    //freopen("out.txt","w",stdout);
    int A,B;scanf("%d%d",&A,&B);
    A--;B--;
    for(int i=0;i<100;i++)
        for(int j=0;j<100;j++)
            sqr[i][j]=i<50;
    int x,y;
    x=0,y=0;
    //white false/black true
    while(A--)
    {
        sqr[x][y]=false;
        y+=2;
        if(y>=100) x+=2,y=0;
    }
    x=99;y=0;
    while(B--)
    {
        sqr[x][y]=true;
        y+=2;
        if(y>=100) x-=2,y=0;
    }
    printf("100 100\n");
    for(int i=0;i<100;i++)
    {
        if(i) puts("");
        for(int j=0;j<100;j++)
            printf("%c",sqr[i][j]? '#':'.');
    }
    return 0;
}



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

using namespace std ;

int main()
{
	long long int n , a = 0 , b = 0 , ans  = 0 ;
	cin >> n  ;
	string s ;
	cin >> s ;
	// vector <int> v ;
	for(int i = 0 ; i < n ; i++)
	{
		if(s[i] == 'W')
		{
			a++ ;
		}
		else
		{
			b++ ;
			// v.push_back(i) ;
		}
	}
	for(int i = 0 ; i < b ; i++)
	{
		if(s[i] == 'W')
		{
			ans++ ;
		}
	}
	cout << ans << endl ;
}


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


void solve(std::string S){
    if (S=="ABC")  
        cout << "ARC" <<endl;

    else
        cout << "ABC" <<endl;
}

// Generated by 1.1.6 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(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

const int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}, dy[8] = {0, 0, -1, 1, -1, 1, -1, 1};

vector<int> v;
int L;

template<typename T>
T gcd(T a, T b){
    if(b == 0){return a;}
    return gcd(b, a % b);
}

template<typename T>
T lcm(T a, T b){
    T g = gcd(a, b);
    return a / g * b;
}

P add(const P p, const P q){
    int a1, b1, a2, b2;
    tie(a1, b1) = p;
    tie(a2, b2) = q;

    int l = lcm(b1, b2);
    a1 *= l / b1;
    a2 *= l / b2;

    int c = a1 + a2;
    int g = gcd(c, l);
    
    return std::make_tuple(c / g, l / g);
}

P f(int idx){
    if(idx + 1 == L){
        if(v[idx] == 0){
            return std::make_tuple(0, 1);
        }else{
            return std::make_tuple(90, 1);
        }
    }

    P p = f(idx + 1);

    if(v[idx] == 0){
        return add(p, std::make_tuple(-90, 1 << (L - (idx + 1))));
    }
    return add(p, std::make_tuple(90, 1 << (L - (idx + 1))));
}

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

    while(true){
        string S;
        std::cin >> S;
        if(S[0] == '#'){break;}
    
        v.clear();
    
        int i = 0;
        while(i < S.size()){
            if(S[i] == 'n'){
                v.emplace_back(0);
                i += 5;
            }else{
                v.emplace_back(1);
                i += 4;
            }
        }

        L = v.size();
        int a, b;
        tie(a, b) = f(0);

        if(b == 1){
            std::cout << a << std::endl;
        }else{
            std::cout << a << "/" << b << std::endl;
        }
    }
}



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

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if ((-d) <= a - b && a - b <= d && (-d) <= b - c && b - c <= d ||
      (-d) <= b - c && b - c <= d && (-d) <= c - a && c - a <= d ||
      (-d) <= c - a && c - a <= d && (-d) <= c - a && c - a <= d
     )
    cout << "Yes" << endl;
  else
    cout << "No" << endl;


}


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

int main() {
    int A, B;
    cin >> A >> B;
    if (A <= 9 && B <= 9) {
        cout << A*B << endl;
    } else {
        cout << -1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef vector<double> Vec;
typedef vector<Vec> Mat;
typedef pair<ll,ll> P;
typedef pair<double,ll> Pd;
typedef pair<double,double> PD;
typedef priority_queue<P,vector<P>,greater<P> > P_queue;
typedef priority_queue<Pd,vector<Pd>,greater<Pd> > Pd_queue;

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
const double DEL=1e-6;


#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());
#define ADD(a,b) a=(a+b)%mod
#define MUL(a,b) a=(a*b)%mod

ll Solve(){
    ll K; cin>>K;
    if(K%2==0) return -1;
    if(K%5==0) return -1;
    if(K%7==0) K/=7;
    if(K==1) return 1;
    ll memo=1, SUM=1;
    rep(i,K+15){
        if(!SUM) return 1+i;
        memo=(memo*10)%K;
        SUM=(SUM+memo)%K;
    }
    return -1;
}

int main(){
    cout<<Solve()<<endl;
}

Measured memory_bytes: 3672
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//s[i]-'0'でchar文字→int数に;
//string s = to_string(int数);
//int n = stoi(string文字列)
//実行時間制約2秒では２×10^8回くらいまで計算できる



int main() {
  string s;
  cin >> s;
  int n=s.size();
  string ans ="";
  
  rep(i,n){
    if(s[i]=='0')ans+="0";
    else if(s[i]=='1')ans+="1";
    else if(ans!="")ans.pop_back();
  }

  cout << ans << endl;
  
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int N,X; cin>>N>>X;
	vector<int> t(N+1);
	t[N] = X;
	rep(i,N)cin>>t[i];
	sort(all(t));
	vector<int> dis(N);
	rep(i,N)dis[i] = t[i+1]-t[i];
	int ans = dis[0];
	REP(i,N-1)ans = __gcd(ans, dis[i]);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <queue>
using namespace std;
#define N 300050
#define M 2400050
int head[N],to[M],nxt[M],n,m,cnt,val[M],tot,vis[N],dis[N],S,T;
priority_queue<pair<int,int> >q;
struct A {
	int x,y,z,id;
	bool operator < (const A &u) const {return z<u.z;}
}e[N];
vector<A>G[N];
inline void add(int u,int v,int w) {
	to[++cnt]=v; nxt[cnt]=head[u]; head[u]=cnt; val[cnt]=w;
}
char buf[100000],*p1,*p2;
#define nc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++)
int rd() {
	int x=0; char s=nc();
	while(s<'0') s=nc();
	while(s>='0') x=(((x<<2)+x)<<1)+s-'0',s=nc();
	return x;
}
int main() {
	n=rd(),m=rd();
	int i,j;
	for(i=1;i<=m;i++) {
		e[i].x=rd(),e[i].y=rd(),e[i].z=rd(); e[i].id=i;
		G[e[i].x].push_back(e[i]);
		G[e[i].y].push_back(e[i]);
	}
	tot=m; S=n+m+1,T=n+m+2;
	for(i=1;i<=n;i++) {
		sort(G[i].begin(),G[i].end());
		int lim=G[i].size();
		tot++;
		for(j=0;j<lim;j++) {
			add(G[i][j].id,tot,0);
			add(tot,G[i][j].id,1);
		}
		int k=0,l;
		for(j=0;j<lim;j=k) {
			for(;k<lim&&G[i][j].z==G[i][k].z;k++) ;
			for(l=j+1;l<k;l++) {
				add(G[i][l].id,G[i][l-1].id,0);
				add(G[i][l-1].id,G[i][l].id,0);
			}
		}
		for(j=0;j<lim;j++) {
			if(i==1) add(S,G[i][j].id,0);
			if(i==n) add(G[i][j].id,T,0);
		}
	}
	tot+=2;
	memset(dis,0x3f,sizeof(dis));
	dis[S]=0;
	q.push(make_pair(0,S));
	while(!q.empty()) {
		int x=q.top().second; q.pop();
		if(vis[x]) continue;
		vis[x]=1;
		for(i=head[x];i;i=nxt[i]) if(dis[to[i]]>dis[x]+val[i]) {
			dis[to[i]]=dis[x]+val[i];
			q.push(make_pair(-dis[to[i]],to[i]));
		}
	}
	if(dis[T]>max(n,m)) puts("-1");
	else printf("%d\n",dis[T]+1);
}













Measured memory_bytes: 54064
/**
*    created: 14.06.2020 21:00:09
**/
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    rep(i,5) {
        int a;
        cin >> a;
        if (a == 0) {
            cout << i + 1 << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 3608
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <map>
#include <vector>
using namespace std;

int N,M;
int main(int argc, char const *argv[]) {
  cin>>N>>M;
vector<bool> is(M,true);
for(int i=0;i<N;i++){
  int temp=0;
  cin>>temp;
  vector<int> a(M);
  for(int j=0;j<temp;j++){
    int temp2=0;
    cin>>temp2;
    a[temp2-1]++;
  }
  for(int j=0;j<M;j++){
    if(a[j]==0){
      is[j]=false;
    }
  }

}

int ans=0;
for(int i=0;i<M;i++){
  if(is[i]==true){
    ans++;
  }
}
cout<<ans<<endl;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define fast ios::sync_with_stdio(false); cin.tie(NULL);
const double eps = 1e-6;



/////////////////////////////////////////////

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

////////////////////////////////

#define int long long


void solve(){

	int n , k;
	cin>>n>>k;

	vector<int> dp(k+1 , 0);
	vector<int> a(n);
	for(int i = 0 ; i < n ; ++i){

		cin>>a[i];
	}
	dp[0] = 0;
	for(int i = 1 ; i <= k ; ++i){

		for(int j = 0 ; j < n ; ++j){

			int val = i - a[j];
			if(val < 0)
				break;

			dp[i] = max(dp[i] ,dp[val]^1);
		}
	}

	if(dp[k]){

		cout<<"First\n";
	}
	else cout<<"Second\n";
}

signed main(){

    fast;
    int t = 1;
    //cin>>t;
    while(t--)
        solve();
}






Measured memory_bytes: 1024
#include <stdio.h>

int main(){
    int a, b;
    scanf("%d %d", &a, &b);
    int min, max;
    if (a < b) {
        min = a; max = b;
    } else {
        min = b; max = a;
    }
    for (int i = 0; i < max; ++i) {
        printf("%d", min);
    }
    printf("\n");
}

Measured memory_bytes: 128
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }


int main() {
    int M, K;
    cin >> M >> K;
    int t = int(pow(2, M)) - 1;
    if (K == 0) {
        rep(i, t + 1) {
            cout << i << " " << i << " ";
        }
        cout << endl;
        return 0;
    }
    if (K > t) {
        cout << -1 << endl;
        return 0;
    }
    int x = 0;
    rep(i, t + 1) {
        if (i != K)
            x = x ^ i;
    }
    if (x != K) {
        cout << -1 << endl;
        return 0;
    }
    rep(i, K) {
        cout << i << " ";
    }
    cout << K << " ";
    for (int i = K - 1; i >= 0; i--) {
        cout << i << " ";
    }
    REP(i, K + 1, t + 1) {
        cout << i << " ";
    }
    cout << K << " ";
    for (int i = t; i >= K + 1; i--) {
        cout << i << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
using namespace std;
int ans;
int e[8][8];
bool visited[8];
int n, m;
void dfs(int vis, int last) {
  if (vis == n) ans++;
  for (int i = 0; i < n; i++) {
    if (!e[last][i] || visited[i]) continue;
    visited[i] = 1;
    dfs(vis + 1, i);
    visited[i] = 0;
  }
}
int main(void) {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    e[a - 1][b - 1]++;
    e[b - 1][a - 1]++;
  }
  visited[0] = 1;
  dfs(1, 0);
  cout << ans << endl;
  return 0;
}

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



int main() {
	int A, B, C;
	cin >> A >> B >> C;
	if (A == B && A != C && B != C)cout << "Yes" << endl;
	else if (A == C && A != B && B != C) cout << "Yes" << endl;
	else if (B == C && A != B && A !=C) cout << "Yes" << endl;
	else cout << "No" << endl;

	
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
    int n, d;
    cin>>n>>d;
    int x[11][11];
    for(int i=0; i<n; i++){
        for(int j=0; j<d; j++) cin>>x[i][j];
    }
    bool sq[100010]={};
    for(int i=0; i<200; i++) sq[i*i]=1;
    int ans=0;
    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            int s=0;
            for(int k=0; k<d; k++){
                s+=(x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
            }
            if(sq[s]) ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 384
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val s = sc.next()
    println(problem114b(s))
}

fun problem114b(s: String): Int {
    var min = Integer.MAX_VALUE
    for (i in 0 until s.length - 2) {
        val si = (s[i].toString() + s[i+1] + s[i+2]).toInt()
        min = Math.min(min, Math.abs(si - 753))
    }
    return min
}

Measured memory_bytes: 31272
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        int N, cnt = 0;
        Scanner scanner = new Scanner(System.in);

        List<Integer> numbers = new ArrayList<>();
        N = Integer.parseInt(scanner.next());

        for (int i = 0; i < N; i++) {
            numbers.add(Integer.parseInt(scanner.next()));
        }

        numbers.sort(Comparator.naturalOrder());
        int max = 0;
        for(int num : numbers) {
            if (max < num) {
                max = num;
                cnt++;
            }
        }
        System.out.println(cnt);
    }
}

Measured memory_bytes: 21972
#include <stdio.h>

int min (int a, int b)
{
    if (a > b) return b;
    return a;
}

int main ()
{
    int N,A,B;
    scanf("%d%d%d", &N, &A, &B);

    int ans1 = A * N;
    int ans2 = B;

    printf("%d\n", min(ans1, ans2));

    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define rFORe(i, a, n) for(int (i) = (int)(n); (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 1, (n))
#define REPo(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rREPe(i, n) rFORe((i), 1, (n))
#define rREPo(i, n) rFORe((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define dup(x, y) (((x)+(y)-1)/(y))
#define vc(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using P = pair<int,int>;
using pll = pair<ll,ll>;
using T = tuple<int,int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using vp = vector<P>;
using vt = vector<T>;

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() {
  int n, k;
  cin >> n >> k;
  vi a(n);
  REP(i, n) cin >> a[i];
  FOR(i, k, n) {
    if (a[i-k] < a[i]) cout << "Yes" << endl;
    else cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 4048
#include <iostream>

using namespace std;

int a[100001][3];
int dp[100001][3];

int main() {
	int N;
	cin >> N;
	for (int i = 1; i <= N; ++i) cin >> a[i][0] >> a[i][1] >> a[i][2];

	dp[0][0] = dp[0][1] = dp[0][2] = 0;
	for (int i = 1; i <= N; ++i) {
		for (int j = 0; j < 3; ++j) {
			dp[i][j] = 0;
			for (int k = 0; k < 3; ++k) if (j != k) {
				dp[i][j] = max(dp[i][j], dp[i - 1][k] + a[i][j]);
			}
		}
	}
	int ans = max(dp[N][0], max(dp[N][1], dp[N][2]));
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
int dp[1005];
int main(){
	memset(dp, -1, sizeof(dp));
	int d, g;
	scanf("%d%d", &d, &g);
	dp[0] = 0;
	int mx = 0;
	for(int i=1;i<=d;i++){
		int p, c;
		scanf("%d%d", &p, &c);
		for(int j=mx;j>=0;j--){
			if(dp[j] == -1) continue;
			for(int k=1;k<=p;k++){
				if(k != p) dp[j+k] = max(dp[j+k], dp[j] + 100*i*k);
				else dp[j+k] = max(dp[j+k], dp[j] + 100*i*k + c);
			}
			mx = max(mx, j+p);
		}
	}
	for(int i=0;i<=1000;i++){
		if(dp[i] >= g) return !printf("%d\n", i);
	}
}

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

int main() {
  int N;
  cin >> N;
  
  int c = 0;

  
  int t = N;
  while(t > 0){
    c = c + t%10;
    t = t/10;
 
  }
  
  if(N%c == 0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256