akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = (1e+9)+7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int main() {
	int x, y; cin >> x >> y;
	int d[13][13] = {};
	d[4][6] = d[4][9] = d[4][11] = d[6][9] = d[6][11] = d[9][11] = 1;
	d[1][3] = d[1][5] = d[1][7] = d[1][8] = d[1][10] = d[1][12] = 1;
	d[3][5] = d[3][7] = d[3][8] = d[3][10] = d[3][12] = 1;
	d[5][7] = d[5][8] = d[5][10] = d[5][12] = 1;
	d[7][8] = d[7][10] = d[7][12] = 1;
	d[8][10] = d[8][12] = 1;
	d[10][12] = 1;
	if (x > y)swap(x, y);
	if (d[x][y])cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
s = [i for i in range(2,14)] + [1]
a, b = map(int, input().split())
if s.index(a) > s.index(b):
    ans = 'Alice'
elif s.index(a) < s.index(b):
    ans = 'Bob'
else:
    ans = 'Draw'
print(ans)

Measured memory_bytes: 3316
#include <iostream>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    int n,a,b,m=0,ans=-1; cin >> n;
    rep(i,n){
        cin >> a >> b;
        if (a>m){
            m = a;
            ans = a+b;
        }
    }
    cout << ans << endl;
}

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

int H, W;
vector<vector<char>> field;
vector<vector<vector<int>>> cost;

void ruiseki() {
    //[右, 左, 上, 下]
    for (int i = 1; i < H + 1; i++) {
        int tmpr = 0, tmpl = 0;
        //右
        for (int r = 1; r < W + 1; r++) {
            if (field[i][r] == '#') {
                cost[i][r][0] = 0;
                tmpr = 0;
            } else {
                cost[i][r][0] = tmpr + 1;
                tmpr++;
            }
        }
        //左
        for (int l = W; l > 0; l--) {
            if (field[i][l] == '#') {
                cost[i][l][1] = 0;
                tmpl = 0;
            } else {
                cost[i][l][1] = tmpl + 1;
                tmpl++;
            }
        }
    }
    for (int j = 1; j < W + 1; j++) {
        int tmpu = 0, tmpd = 0;
        //上
        for (int u = 1; u < H + 1; u++) {
            if (field[u][j] == '#') {
                cost[u][j][2] = 0;
                tmpu = 0;
            } else {
                cost[u][j][2] = tmpu + 1;
                tmpu++;
            }
        }
        //下
        for (int d = H; d > 0; d--) {
            if (field[d][j] == '#') {
                cost[d][j][3] = 0;
                tmpd = 0;
            } else {
                cost[d][j][3] = tmpd + 1;
                tmpd++;
            }
        }
    }
}

int solve() {
    int ret = 0;
    for (int i = 1; i < H + 1; i++) {
        for (int j = 1; j < W + 1; j++) {
            if (field[i][j] != '#') {
                int tmp = (cost[i][j - 1][0] + 1) + (cost[i][j + 1][1] + 1) + (cost[i - 1][j][2] + 1) + (cost[i + 1][j][3] + 1) - 3;
                ret = max(tmp, ret);
            }
        }
    }
    return ret;
}

int main(int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> H >> W;
    // 外堀とフィールドの構成
    field = vector<vector<char>>(H + 2, vector<char>(W + 2));
    cost = vector<vector<vector<int>>>(H + 2, vector<vector<int>>(W + 2, vector<int>(4, 0)));
    for (int i = 0; i < W + 2; i++) {
        field[0][i] = '#';
        field[H + 1][i] = '#';
    }
    for (int i = 1; i < H + 1; i++) {
        field[i][0] = '#';
        field[i][W + 1] = '#';
        for (int j = 1; j < W + 1; j++) {
            cin >> field[i][j];
        }
    }
    ruiseki();
    int ans = solve();
    cout << ans << endl;
}

Measured memory_bytes: 223616
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if((a == b && b == c && a == c) || (a != b && b != c && a != c)) cout << "No" << endl;
  else cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <cstdio>

int main(){
    int a,b;
    scanf("%d %d",&a,&b);
    if(a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0){
        printf("Possible\n");
    }else{
        printf("Impossible\n");
    }

    return 0;
}

Measured memory_bytes: 256
using System;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            long N = long.Parse(Console.ReadLine());
            long min = N;
            for (var i = 1L; i <= 1e6; i++)
            {
                // 存在しないことが断定できる
                if (i > N)
                {
                    break;
                }
                // 組み合わせが存在する場合
                if (N % i == 0)
                {
                    long j = N / i;
                    long dist = i + j - 2;
                    min = (min < dist) ? min : dist;
                }
            }
            Console.WriteLine(min);
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int A,B,C,X,Y;
  cin >> A >> B >> C >> X >> Y;
  
  long long sum1=0;
  long long sum2=0;
  long long sum3=0;
  
  sum1 = A*X + B*Y;
  
  for(int i=1;i<=max(X,Y);i++){
    sum2 = 2*i;
    sum3 = C*sum2 + A*max(0,X-i) + B*max(0,Y-i);
    sum1 = min(sum1,sum3);
  }
    
  cout << sum1 << endl;
  return 0;
}

Measured memory_bytes: 256
p[1000055],s,r;
main(i,j)
{
  for(;++i<9999;)for(j=i*2;j<1000055;j+=i)p[j]=1;
  for(;scanf("%d",&i),i;printf("%d\n",r))
      for(s=2,r=0;i;i-=!p[s++])r+=p[s]?0:s;exit(0);
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n; ll ans = 0;
	cin >> n;
	int p;
	rep(i, n){
		int a; cin >> a;
		if(i == 0){
			if(a){
				cout << -1 << endl;
				return 0;
			}
		}
		else{
			if(a > p + 1){
				cout << -1 << endl;
				return 0;
			}
			if(a == p + 1) ans++;
			else ans += a;
		}
		p = a;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		a,b,d,w,h,i,j,k,l,m,n,z;
	double	ans = 0;
	cin >> a >> b >> h >> m;
	double x = m*6;
	double y = h*30+(double)m/2;
	double rad = abs(x-y);
	//if (rad>180.0) rad = 360.0 - rad;
	//cout << x << " " << y << " " << rad << endl;
	//cout << cos(0) << endl;
	//cout << cos(180.0*180.0/M_PI) << endl;
	//if (rad==180.0) {
	//	ans = a+b;
	//} else {
		ans = sqrt( a*a + b*b - 2*a*b*cos(rad/180.0*M_PI) );
	//}
	printf("%.10f\n",ans);
	return 0;
}


Measured memory_bytes: 4112
use std::io::*;
use std::str::FromStr;

fn main() {
    let cin = stdin();
    let mut sc = Scanner::new(cin.lock());

    let n: usize = sc.next();
    let m: usize = sc.next();

    let a: Vec<Vec<u32>> = (0..n).map(|_| sc.vec(m)).collect();
    let b = sc.vec::<u32>(m);

    for i in 0..n {
        let mut c: u32 = 0;
        for j in 0..m {
            c += a[i][j] * b[j];
        }
        println!("{}", c);
    }
}

/* ========== Scanner ========== */

struct Scanner<R: Read> {
    reader: R,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(reader: R) -> Scanner<R> {
        Scanner { reader: reader }
    }

    fn read<T: FromStr>(&mut self) -> Option<T> {
        let token = self
            .reader
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            token.parse::<T>().ok()
        }
    }

    fn next<T: FromStr>(&mut self) -> T {
        if let Some(s) = self.read() {
            s
        } else {
            writeln!(stderr(), "Terminated with EOF").unwrap();
            std::process::exit(0);
        }
    }

    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.next()).collect()
    }

    fn chars(&mut self) -> Vec<char> {
        self.next::<String>().chars().collect()
    }

    fn char(&mut self) -> char {
        self.chars()[0]
    }
}



Measured memory_bytes: 5056
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif
int main(int argc, const char *argv[])
{
  char s[100001];
  char *pat1, *pat2;
  int n;
  scanf("%s", s);
  // eprintf("%s\n", s);
  n = (int)strlen(s);
  // eprintf("len = %d\n", n);
  pat1 = (char *)malloc(n * sizeof(char));
  pat2 = (char *)malloc(n * sizeof(char));

  for (int i = 0; i < n; i++) {
    pat1[i] = i % 2 ? '0' : '1';
    pat2[i] = i % 2 ? '1' : '0';
  }

  // eprintf("pat1 = %s %lu\n", pat1, strlen(pat1));
  // eprintf("pat2 = %s %lu\n", pat2, strlen(pat2));
  int count1, count2;
  for (int i = 0; i < n; i++) {
    if (pat1[i] != s[i])
      count1++;
    if (pat2[i] != s[i])
      count2++;
  }
  printf("%d\n", count1 > count2 ? count2 : count1);
  return 0;
}

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

int main(){
  int N; cin >> N;
  int m=0, sum=0;
  int price;
  for(int i=0; i<N; i++){
    cin >> price;
    m=max(m,price);
    sum+=price;
  }
  cout << sum-m/2 << endl;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        ArrayList<Integer> a = new ArrayList<Integer>();
        for (int i = 0; i < n; i++) {
            a.add(scanner.nextInt());
        }

        int count = 0;
        for (int i = 0; i < n; i++) {
            int minj = i;
            for (int j = i; j < n; j++) {
                if (a.get(j) < a.get(minj)) {
                    minj = j;
                }
            }
            if (i != minj) {
                count++;
            }
            int tmp = a.get(i);
            a.set(i, a.get(minj));
            a.set(minj, tmp);
        }
        for (int i = 0; i < a.size(); i++) {
            System.out.print(a.get(i));
            if (i != a.size() - 1) {
                System.out.print(" ");
            }
        }
        System.out.println("");
        System.out.println(count);
        scanner.close();
    }
}



Measured memory_bytes: 26332
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define DEBUG
#define PI 3.141592653589793238462643383279
 
#define _GLIBCXX_DEBUG
#ifdef DEBUG
#define s(...) show(__VA_ARGS__);
#define sl(...) show(__VA_ARGS__);cout<<endl;
#else
#define s(...)
#define sl(...)
#endif
void show() {}
template <class Head,class... Args>void show(Head t,Args... args){std::cout<<t<<" ";show(args...);}
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define REP1(i, n) for(ll i = 1; i <= n; i++)
#define REPR1(i, n) for(ll i = n; i >= 1; i--)
#define FOR1(i, m, n) for(ll i = m; i <= n; i++)
const ll INF = LLONG_MAX;
const ull MOD = 1000000007;
#define VEC(type,A,N) vector<type> A(N)
#define VECi(type,A,N,i) vector<type> A(N,i)
#define VEC2(type,A,N,M) vector<vector<type>> A(N,vector<type>(M))
#define VEC2i(type,A,N,M,i) vector<vector<type>> A(N,vector<type>(M,i))
#define ALL(v) v.begin(), v.end()
ll frac(ll k){
    int s = 1;
    for (ll i=1; i<=k; ++i)s *= i;
    return s;
}
ll gcd(ll a, ll b){
   if (a%b==0)return(b);
   else return(gcd(b, a%b));
}
ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}
ll antidiv(ll N,ll C,ll D){
    return N-floor(N/C)-floor(N/D)+floor(N/lcm(C,D));
}
vector<ll> yakusuu(ll N){
    vector<ll> ret;
    for (ll i = 1; i * i <= N; i++) {
        if (N % i == 0) {
            ret.push_back(i);
            if (i * i != N) ret.push_back(N / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}
ll digitPoor(ll n)
{
    assert(INT_MAX == 2147483647);
    assert(n >= 0);

    if (n < 10)         return 1;
    if (n < 100)        return 2;
    if (n < 1000)       return 3;
    if (n < 10000)      return 4;
    if (n < 100000)     return 5;
    if (n < 1000000)    return 6;
    if (n < 10000000)   return 7;
    if (n < 100000000)  return 8;
    if (n < 1000000000) return 9;
    return 10;
}
struct p{
  ll x;
  bool end;
};

int main(){
    ll N,M;
    cin>>N>>M;
    
    priority_queue<ll> q;
    REP(i,N){
        ll t;
        cin>>t;
        q.push(t);
    }
    ll cnt=0;
    ll m = M/2;
    REP(i,M){
        q.push(q.top()/2);
        q.pop();
    }
    REP(i,N){
        cnt+=q.top();
        q.pop();
    }
    cout<<cnt;
    //cout<<fixed<<setprecision(32)<<m;
    //sort(ALL(C),[](auto& a, auto& b) {return a[2] < b[2];});
    //if(equal(D.begin(), D.end()-1, K.begin()))cout<<"Yes";else cout<<"No";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 1400
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <fstream>
#include <string>
#include <math.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, P> T;

const ll mod = 1000000007;
const ll INF = 1000000100;

ll N, x[101], y[101];
vector<T> vec[2];
vector<ll> A, B;

double ans;

void init()
{
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> x[i] >> y[i];
	}
}

void output()
{
	printf("%.12f", ans);
}

void solve(ll a, ll b)
{
	ll X = 0, Y = 0;

	for (int i = 0; i < N; i++)
	{
		if (a * x[i] + b * y[i] > 0)
		{
			X += x[i], Y += y[i];
		}
	}

	ans = max(ans, sqrt(pow(X, 2) + pow(Y, 2)));
}

int main()
{
	init();

	for (int i = 0; i < N; i++)
	{
		if (x[i] * y[i] > 0)
		{
			vec[0].push_back(T((double)y[i] / x[i], P(abs(x[i]), abs(y[i]))));
		}
		else
		{
			vec[1].push_back(T((double)y[i] / x[i], P(-abs(x[i]), abs(y[i]))));
		}
	}

	sort(vec[0].begin(), vec[0].end());
	sort(vec[1].begin(), vec[1].end());

	if (vec[0].size() > 0)
	{
		A.push_back(vec[0][0].second.first + 1);
		B.push_back(vec[0][0].second.second);
		A.push_back(vec[0][vec[0].size() - 1].second.first);
		B.push_back(vec[0][vec[0].size() - 1].second.second + 1);
	}

	for (int i = 1; i < vec[0].size(); i++)
	{
		A.push_back(vec[0][i - 1].second.first + vec[0][i].second.first);
		B.push_back(vec[0][i - 1].second.second + vec[0][i].second.second);
	}

	if (vec[1].size() > 0)
	{
		A.push_back(vec[1][0].second.first);
		B.push_back(vec[1][0].second.second + 1);
		A.push_back(vec[1][vec[1].size() - 1].second.first - 1);
		B.push_back(vec[1][vec[1].size() - 1].second.second);
	}

	for (int i = 1; i < vec[1].size(); i++)
	{
		A.push_back(vec[1][i - 1].second.first + vec[1][i].second.first);
		B.push_back(vec[1][i - 1].second.second + vec[1][i].second.second);
	}

	for (int i = 0; i < A.size(); i++)
	{
		solve(B[i], -A[i]);
		solve(-B[i], A[i]);
	}

	output();

	cin >> N;
}

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

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

  vector<int> A(N);
  int sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    sum += A[i];
  }

  int cnt = 0;
  for (int a : A) {
    if (4 * M * a >= sum) {
      cnt++;
    }
  }

  cout << (cnt >= M ? "Yes" : "No") << endl;

  return 0;
}


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

void solve(long long N, std::vector<long long> a)
{
    long long k = 1, d = 0;
    for (size_t i = 0; i < N; i++)
    {
        if (a[i] == k)
        {
            k++;
            // cout << "k = " << k << ", ";
        }
        else
        {
            d++;
            // cout << "d = " << d << ", ";
        }
        // cout << "i = " << i << endl;
    }
    cout << (k == 1 ? (-1) : d) << 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()
{
    long long N;
    scanf("%lld", &N);
    std::vector<long long> a(N);
    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &a[i]);
    }
    solve(N, std::move(a));
    return 0;
}


Measured memory_bytes: 1792
#include<cstring>
#include<algorithm>
#include<cstdio>
#define rep(a,b,c) for (int a=b;a<=c;a++)
#define per(a,b,c) for (int a=b;a>=c;a--)
typedef long long LL;
typedef double dob;
using namespace std;
const int N=55;
const int M=110;
int n,sum,t[N];
char s0[M],s[N][M];
int cmp(int k){
	int l=strlen(s0+1);
	if (strlen(&s[k][1])!=l) return 0;
	rep(i,1,l) if (s0[i]!=s[k][i]) return 0;
	return 1;
}
int main(){
	scanf("%d",&n);
	rep(i,1,n) scanf("%s%d",&s[i][1],t+i);
	scanf("%s",s0+1);
	int k=1;
	while (!cmp(k)) ++k;
	rep(i,k+1,n) sum+=t[i];
	printf("%d\n",sum);
	return 0;
}


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

using namespace std;

#define mod1 1000000007
#define mod2 998244353
#define int long long int
#define pii pair<int,int>
#define vpii vector<pii>
#define vi vector<int>
#define fi first
#define se second
#define psb push_back
#define ppb pop_back
#define fio ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL)
#define all(x) x.begin(),x.end()
// #define endl "\n"

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

}

int32_t main()
{
	fio;
	int t;
	// cin>>t;
	t=1;
	while(t--)
	{
		solve();
	}
}

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

void solve(long long N, long long K)
{
    long long ans = N % K;

    long long a = abs(ans - K);

    if (ans > a)
        ans = a;

    cout << ans << 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()
{
    long long N;
    scanf("%lld", &N);
    long long K;
    scanf("%lld", &K);
    solve(N, K);
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func sumEveryDiget(n int) int {
	var sum int
	for n > 0 {
		sum += n % 10
		n /= 10
	}
	return sum
}

func main() {
	var (
		n, a, b, result int
	)
	fmt.Scan(&n, &a, &b)

	for i := 0; i <= n; i++ {
		if sum := sumEveryDiget(i); sum >= a && sum <= b {
			result += i
		}
	}
	fmt.Println(result)
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define reps(i,n) for(int i=1;i<=(int)n;i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define LB(a,x) lb(all(a), x) - a.begin()
#define UB(a,x) ub(all(a), x) - a.begin()
#define MOD 1000000007
#define itn int
#define enld endl
using namespace std;
typedef long long ll;
const double pi = 3.141592653589793;
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;}
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
    int N; cin>> N;
    string A,B,C; cin >> A >> B >> C;
    int ans  =0;
    rep(i,N){
        int cnt = 0;
        if((A[i] != B[i]) && (B[i] != C[i]) && (C[i] != A[i])) ans += 2;
        else if((A[i] == B[i]) && (B[i] == C[i]) && (C[i] == A[i])) continue;
        else ans += 1;
    }
    cout << ans << enld;
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  int n;
  cin >> n;
  vector<int> h(n);

  rep(i, n) cin >> h[i];
  int ans = 0;

  for (int i = 0; i < n; ++i) {
    int tmp = 1;
    if (h[i] == 0) continue;
    if (h[i] > 0) {
      int j = i;
      while (h[j] > 0 && j < n) {
        tmp = min(tmp, h[j]);
        j++;
      }
      for (int k = i; k < j; ++k) {
        h[k] -= tmp;
      }
      ans++;
      i--;
    }
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cmath>
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define PI 3.1415926535897932385
#define forl(i,a,b) for (ll i = a; i < b; i++)
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<int,int> pi;
int main() {
    ll r;
    cin>>r;
    cout<<fixed<<setprecision(2)<<2*PI*r<<endl;

	return 0;
}


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

#define ll long long 
#define pb push_back
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))
#define all(v) v.begin(),v.end()
#define sz(a) (ll)a.size()
#define F first
#define S second
#define INF 2000000000000000000
#define endl "\n"
#define _time_ 1.0 * clock() / CLOCKS_PER_SEC
#define popcount(x) __builtin_popcountll(x)
#define pll pair<ll,ll> 
#define ld long double

const int M=1000000007;
const int MM=998244353;
const long double PI = acos(-1);

ll power(ll b,ll e,ll m)
{
    if(e==0) return 1;
    if(e&1) return b*power(b*b%m,e/2,m)%m;
    return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
    if(e==0) return 1;
    if(e&1) return b*power(b*b,e/2);
    return power(b*b,e/2);
}
template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
template<typename T, typename U> static inline void amax(T &x, U y){ if(x<y) x=y; }
template<typename T, typename U> ostream& operator<<(ostream &os, const pair<T, U> &p)
{ 
    return os<<'('<<p.F<< ","<<p.S<<')'; 
}

int _runtimeTerror_()
{
    ll n;
    cin>>n;
    ll ans = 0;
    ans += power(10,n,M);
    ans -= 2*power(9,n,M)%M;
    ans = (ans%M + M)%M;
    ans += power(8,n,M);
    ans %=M;
    cout<<ans<<"\n";
    return 0;
}

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    #ifdef runSieve
        sieve();
    #endif
    #ifdef NCR
        initialize();
    #endif
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--)
        _runtimeTerror_();
    return 0;
}

Measured memory_bytes: 3640
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
#include <complex>

const long INF = (1l << 30);
const long LINF = (1l << 60);

//geometric library
//#include <complex>
typedef std::complex<double> Com;

//内積
double dot_product(const Com a, const Com b){
	return (conj(a)*b).real();
}

//外積
double cross_product(const Com a, const Com b){
	return (conj(a)*b).imag();
}

//点と直線の距離
double dist_dot_line(const Com st, const Com en, const Com dt){
    return std::abs(cross_product(dt-st, en-st) / std::abs(en-st));
}

//点と線分の距離
double dist_dot_seg(const Com st, const Com en, const Com dt){
	if(dot_product(en-st, dt-st) <= 0){
		return std::abs(dt-st);
	}else if(dot_product(st-en, dt-en) <= 0){
		return std::abs(dt-en);
	}else{
		return dist_dot_line(st, en, dt);
	}
}

//線分の交差判定
//平行・接触は含まない(接触を含みたいときはdist_seg==0を使う)
bool seg_crossing(const Com st1, const Com en1, const Com st2, const Com en2){
	double cross1 = cross_product(en1-st1, st2-st1) * cross_product(en1-st1, en2-st1);
	double cross2 = cross_product(en2-st2, st1-st2) * cross_product(en2-st2, en1-st2);
	return (cross1 < 0) && (cross2 < 0);
}

//線分と線分の距離
double dist_seg(const Com st1, const Com en1, const Com st2, const Com en2){
	if(seg_crossing(st1, en1, st2, en2)){
		return 0;
	}
	return std::min(std::min(dist_dot_seg(st1, en1, st2), dist_dot_seg(st1, en1, en2)), std::min(dist_dot_seg(st2, en2, st1), dist_dot_seg(st2, en2, en1)));
}

//線分と線分の垂直判定
bool is_vertical(const Com st1, const Com en1, const Com st2, const Com en2){
    if(dot_product(en1-st1, en2-st2) == 0){
        return true;
    }else{
        return false;
    }
}

//平行判定
bool is_parallel(const Com st1, const Com en1, const Com st2, const Com en2){
    if(cross_product(en1-st1, en2-st2) == 0){
        return true;
    }else{
        return false;
    }
}

//直線・線分の交点
Com cross_point(const Com st1, const Com en1, const Com st2, const Com en2){
    /* 線分の時はコメントを外した方が良さそう
    if(dist_seg(st1, en1, st2, en2) > 0 || is_parallel(st1, en1, st2, en2)){
        printf("Error! cross_point invalid input\n");
        std::exit(EXIT_FAILURE);
    }
    //*/
    double den = (real(st1)-real(en1)) * (imag(en2)-imag(st2)) - (real(en2)-real(st2)) * (imag(st1)-imag(en1));
    double mol = (real(en2)-real(en1)) * (imag(en2)-imag(st2)) - (real(en2)-real(st2)) * (imag(en2)-imag(en1));
    double s = mol/den;
    return st1 * s + en1 * (1-s);
}
long n;
Com p[105];

int main(){
    scanf("%ld", &n);
    for(int i = 0; i < n; i++){
        double x, y;
        scanf("%lf%lf", &x, &y);
        p[i] = Com(x, y);
    }
    p[n] = p[0], p[n+1] = p[1];
    for(int i = 0; i < n; i++){
        if(cross_product(p[i+1]-p[i], p[i+2]-p[i+1]) < 0){
            printf("0\n");
            return 0;
        }
    }
    printf("1\n");
}



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

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

    vector<vector<int>> abc(N + 1, vector<int>(3, 0));
    for (int i = 1; i <= N; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            cin >> abc[i][j];
        }
    }

    vector<vector<int>> ans(N + 1, vector<int>(3, 0));

    for (int i = 1; i <= N; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            for (int k = 1; k < 3; k++)
            {
                ans[i][j] = max(ans[i][j], ans[i - 1][(j + k) % 3] + abc[i][j]);
            }
        }
    }
    cout << *max_element(ans[N].begin(), ans[N].end()) << endl;
}


Measured memory_bytes: 11136
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();

		if (X == 3 || X == 5 || X == 7) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}

	}
}

Measured memory_bytes: 21844
def main():
    s = list(input())
    acgt = ["A", "C", "G", "T"]
    
    tmp = 0
    tmp_max = 0
    for i in range(len(s)):
        if s[i] in acgt:
            tmp += 1
        else:
            tmp_max = max(tmp_max, tmp)
            tmp = 0
    tmp_max = max(tmp_max, tmp)
    print(tmp_max)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<functional>
#include<vector>
#include<map>

using namespace std;
#define endl '\n'
#define pb push_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1e9 + 7)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define REP(i,n) for(int i = 0;i < (n);i++)
#define FOR(i,a,b) for(int i = (a);i <= (b);i++)
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl


typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vector<int>> vii;

template <class T = int> T in() { T x; cin >> x; return (x); }
template <class T = int> void out(T x) { cout << (x) << endl; }

int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

void solve() {

	string s;
	cin >> s;

	bool ans = true;
	if (s[0] != 'A') ans = false;

	if (count(s.begin() + 2, s.end() - 1, 'C') != 1) ans = false;

	for (int i = 1; i < s.size(); i++) {
		if (s[i] != 'C' && s[i] < 'a') ans = false;
	}

	if (ans) {
		cout << "AC" << endl;
	}
	else {
		cout << "WA" << endl;
	}

	return;

}

int main() {

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

	solve();

	return 0;

}

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

using namespace std;


char c[] = {'0', '1'};
int main() {
	string S;
	cin >> S;

	int cnt0 = 0, cnt1 = 0, i = 0;
	for (auto var : S) {
		int t0 = i % 2;
		int t1 = !t0;

		if (var == c[t0]) {
			cnt0++;
		}
		if (var == c[t1]) {
			cnt1++;
		}
		i++;
	}

	if (cnt0 > cnt1) cnt0 = cnt1;
	cout << cnt0 << endl;

	//system("pause");

	return 0;
}

Measured memory_bytes: 512
n = int(input())
la = list(map(int, input().split()))
l1 = []
l2 = []
for i in range(n):
    if i % 2 == 0:
        l1.append(la[i])
    else:
        l2.append(la[i])

if n % 2 == 0:
    for i in reversed(l2):
        print(i, end=' ')
    for i in l1:
        print(i, end=' ')
else:
    for i in reversed(l1):
        print(i, end=' ')
    for i in l2:
        print(i, end=' ')

Measured memory_bytes: 30880
#include <bits/stdc++.h>
#include <utility>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <cmath>
#include <math.h>
#include <string>
#define ll long long
#define ull unsigned long long
#define make(type,x) type x; cin>>x
#define make2(type,x,y) type x,y; cin>>x>>y
#define fr(x,y) for(long long x=0;x<y;x++)
#define makevec(x,y,n) vector <x> y(n); for(ll i=0;i<n;i++) cin>>y[i]
#define M (ll)1000000007
#define INF (ll) 1e18
# define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)
#define _USE_MATH_DEFINES
using namespace std;
//double M_PI=3.1415926535897932384;
struct cmp {
	bool operator() (const pair<int, int> &a, const pair<int, int> &b) const {
		int lena = a.second - a.first + 1;
		int lenb = b.second - b.first + 1;
		if (lena == lenb) return a.first < b.first;
		return lena > lenb;
	}
};


int main(){
    IOS;
    make2(ll,n,w);
    vector <pair <ll,ll> >vec(n);
    fr(i,n) {
        cin>>vec[i].first;
        cin>>vec[i].second;
    }
    vector <vector <ll> >dp(n+1,vector <ll> (w+1));
    fr(i,w) dp[0][i]=0;
    for(ll i=1;i<=n;i++){
        for(ll j=0;j<=w;j++){
           if(j>=vec[i-1].first) dp[i][j]=max(dp[i-1][j],vec[i-1].second+dp[i-1][j-vec[i-1].first]);
           else dp[i][j]=dp[i-1][j];
        }
    }

    cout<<dp[n][w]<<endl;



    return 0;
}


Measured memory_bytes: 80256
#include<iostream>
#include<vector>

using namespace std;

int main(){
  vector<int> n(1000000);
  int s;
  cin>>s;
  for(int i=2;i<=1000000;i++){
    n.at(s)=s;
    if(s%2==0) s/=2;
    else s=3*s+1;
    if(n.at(s)!=0){
      cout<<i<<endl;
      break;
    }
  }
  return 0;
}


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

int main(){
int a, b, c;
  cin >> a >> b >> c;
int ab = a + b;
int bc = b + c;  
int ca = c + a;
  
  cout << min(ab, min(bc, ca)) << endl;
  
  return 0;


}

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

constexpr int MOD = 1000000007;
// constexpr int MOD = 998244353;
constexpr int MAX = 5000000;

vector<long> fact(MAX), finv(MAX), inve(MAX);

void init() {
  fact.at(0) = fact.at(1) = 1;
  finv.at(0) = finv.at(1) = 1;
  inve.at(1) = 1;
  for (int i = 2; i < MAX; i++) {
    fact.at(i) = fact.at(i - 1) * i % MOD;
    inve.at(i) = MOD - inve.at(MOD % i) * (MOD / i) % MOD;
    finv.at(i) = finv.at(i - 1) * inve.at(i) % MOD;
  }
}

long com(long n, long r) {
  if (n < r || n < 0 || r < 0) return 0;
  return fact.at(n) * (finv.at(r) * finv.at(n - r) % MOD) % MOD;
}

long mpow(long a, long b) {
  long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % MOD;
    a = a * a % MOD;
    b >>= 1;
  }
  return res;
}

long com2(long n, long r) {
  if (n < r || n < 0 || r < 0) return 0;
  long x = 1, y = 1;
  for (int i = 1; i <= r; i++) {
    x = x * (n - i + 1) % MOD;
    y = y * i % MOD;
  }
  return x * mpow(y, MOD - 2) % MOD;
}

long inv(long a) {
  long b = MOD, u = 1, v = 0;
  while (b) {
    long t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= MOD;
  if (u < 0) u += MOD;
  return u;
}

int main() {
  init();
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int K;
  string S;
  cin >> K >> S;
  int N = S.size();
  K += N;
  long ans = 0;
  for (int i = N; i <= K; i++) {
    long tmp = com(i - 1, N - 1);
    (tmp *= mpow(25, i - N)) %= MOD;
    (tmp *= mpow(26, K - i)) %= MOD;
    (ans += tmp) %= MOD;
  }
  cout << ans << "\n";
}

Measured memory_bytes: 121452
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define fast ios::sync_with_stdio(0),cin.tie(0);
#define big 1000000001
int main(){
    fast
    ll n,W;
    cin>>n>>W;
    ll w[n],v[n];
    for(ll i=0;i<n;i++) cin>>w[i]>>v[i];
    ll dp[100001]={0},ans=0;
    for(ll i=1;i<=100000;i++) dp[i]=big;
    //cout<<dp[0];
    for(ll i=0;i<n;i++){
        for(ll j=100000;j>=0;j--){
            if(dp[j]<big and j+v[i]<=100000) {
                dp[j + v[i]] = min(dp[j + v[i]], dp[j] + w[i]);
                if (dp[j + v[i]] <= W) ans = max(ans, j + v[i]);
            }
        }
    }
    cout<<ans;
}

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

using namespace std;

char maze[23][23];
bool visited[23][23];
int level[23][23];
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
int h, w;
int hx, hy;

int bfs(int fx, int fy)
{
    memset(visited, 0, sizeof(visited));
    memset(level, 0, sizeof(level));
    int mx = 0;
    queue<pair<int, int>> q;
    q.push({fx, fy});
    visited[fx][fy] = 1;
    level[fx][fy] = 0;

    while (!q.empty())
    {
        int px = q.front().first;
        int py = q.front().second;
        q.pop();
        for (int i = 0; i < 4; i++)
        {
            int x = px + dx[i];
            int y = py + dy[i];
            if (!visited[x][y] && maze[x][y] == '.' && x >= 0 && y >= 0 && x < h && y < w)
            {
                level[x][y] = level[px][py] + 1;
                visited[x][y] = 1;
                q.push({x, y});
                if (mx < level[x][y])
                {
                    mx = level[x][y];
                    hx = x;
                    hy = y;
                }
            }
        }
    }
    return mx;
}

int main()
{

    cin >> h >> w;
    int x, y;
    bool f = 1;
    int ans = 0;
    queue<pair<int, int>> nodes;
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            cin >> maze[i][j];
            if (f && maze[i][j] == '.')
            {
                nodes.push({i, j});
            }
        }
    }
    for (int i = 0; !nodes.empty(); i++)
    {
        x = nodes.front().first;
        y = nodes.front().second;
        nodes.pop();
        ans = max(ans, bfs(x, y));
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <set>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)

int main(){
  int h,w;
  cin >> h >> w;
  vector<string> v(h);
  rep(i,h){
    string s;
    cin >> s;
    s="#"+s;
    s+="#";
    v[i]=s; 
  }
  rep(i,w+2){
    cout << '#';
  }
  cout << endl;
  rep(i,h){
    cout << v[i] << endl;
  }
  rep(i,w+2){
    cout << '#';
  }
  cout << endl;
  


  
}

Measured memory_bytes: 256
import java.util.*;


public class Main {

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

        String N = sc.next();
        int ans = 0;
        int counter = 0;

        for (int i = N.length(); i > 0; i--) {
            int n = Integer.parseInt(N.substring(i-1,i)) + counter;

            counter = 0;
            if(n == 10) {
                counter = 1;
                n = 0;
            }

            if(10 - n <= n){
                if(i > 1 && Integer.parseInt(N.substring(i-2,i-1)) < 5 && n == 5){
                    ans += 5;
                    //System.out.println("P" + (N.length() -i) + ":" +5);
                } else if(i == 1 && n == 5) {
                    ans += 5;
                } else{
                        counter = 1;
                        ans += 10 -n;
                        //System.out.println("R" + (N.length() -i) + ":" +Math.min(n, 10 - n));
                    }


            } else {
                ans += n;
               //System.out.println("P" + (N.length() -i) + ":" +Math.min(n, 10 - n));
            }

        }
        if(counter == 1){
            ans++;
           // System.out.println("P"  + N.length() + ":" +1);
        }
        System.out.println(ans);
    }

}








Measured memory_bytes: 61172
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

struct edge{
    int u,v,w;
};

int main(){
    int L;
    cin >> L;
    int p = 1;
    int c = 0;
    while((p<<1)<L) p<<=1,++c;
    if(L!=p*2){
        p>>=1;
        --c;
    }
    int n = c+2;
    
    vector<edge> ans;

    int q = 1;
    int sum = 1;
    for(int i=n-1;i>=1;i--){
        ans.push_back(edge{i,i+1,q});
        ans.push_back(edge{i,i+1,0});
        q <<= 1;
        sum *= 2;
    }

    for(int i=n-2;i>=0;i--){
        if(L>>i&1){
            ans.push_back(edge{1,n-i,sum});
            sum += (1<<i);
        }
    }

    cout << n << " " << ans.size() << endl;
    rep(i,ans.size()){
        cout << ans[i].u << " " << ans[i].v << " " << ans[i].w << endl;
    }
    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
int main(void)
{
 char ABT[26] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
 char S[10001];
 int i,j,k,N;
 scanf("%d",&N);
 scanf("%s",S);
 for(i=0;i<strlen(S);i++)
  for(j=0;j<26;j++)
  if(S[i] == ABT[j]) printf("%c",ABT[(j+N)%26]);

 return 0;
}

Measured memory_bytes: 128
import java.util.HashSet;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        HashSet<Integer> set = new HashSet<>();
        for (int i = 0; i < 3; i++) {
            set.add(sc.nextInt());
        }
        System.out.println(set.size());
    }
}

Measured memory_bytes: 35592
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <string>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;
using pii = pair<int,int>;

int main(){
    int n,m;
    cin >> n >> m;
    string s;
    vector<pii> vec(m);
    rep(i,m){
        int s,c;
        cin >> s >> c;
        vec[i] = make_pair(s,c);
    }
    //cout << pow(10,n-1) << " " << pow(10,n) << endl;
    

    bool flag;
    
    int start = pow(10,n-1);
    if(start == 1) start = 0;

    reps(i,start,pow(10,n)){
        s = to_string(i);
        flag = true;
        rep(j,m){
            if((int)(s[vec[j].first-1]-'0') != (vec[j].second) ){
                flag = false;
                break;
            }
        }
        if(flag){
            cout << i << endl;
            return 0;
        }
    }

    cout << -1 << endl;

    return 0;
}

Measured memory_bytes: 4120
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define MODB 998244353
#define INF 9223372036854775807
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}
signed main()
{
  int x=0,y=0,z=0,w=0,n=0,m=0;
std::cin >> x>>y;
std::vector<int> v(x);
rep(i,y){
  std::cin >> z>>w;
  v[z-1]++;
  v[w-1]++;
}
rep(i,x)std::cout << v[i] << '\n';
}


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

int main() {

  int a[4],b[4];

  while(cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]) {

    int hit = 0;
    int blow = 0;

    for ( int i = 0; i < 4; i++ ) {

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

	int k = ( i + j ) % 4;

	if ( a[i] == b[k] ) {

	  if ( i == k ) {
	    hit++;
	  }else {
	    blow++;
	  }
	  break;

	}

      }

    }

    cout << hit << " " << blow << endl;

  }

  return 0;

}

Measured memory_bytes: 1160
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
template <class T> T ceil(T a, T b) {
    return (a + b - 1) / b;
}
template <class T> T round(T a, T b) {
    return (a + b / 2) / b;
}
template <class T> T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T> T lcm(T a, T b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;
    C *= 2;
    int mi = min(X, Y), ma = max(X, Y);
    int res = min(A + B, C) * mi;
    int d1 = A * (X - mi) + B * (Y - mi);
    int d2 = C * (ma - mi);
    cout << res + min(d1, d2) << endl;
    return 0;
}


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

int main(void){
    
    int n,k;
    
    cin >> n >> k;
    
    int i,ans=1;
    
    for(i=0;i<n;++i){
        if(ans>k)ans+=k;
        else ans*=2;
    }
    
    
    cout << ans;
    
    
    
    return 0;
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int N,H,W; cin>>N>>H>>W;
  cout<<(N-H+1)*(N-W+1)<<endl;
  }


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))

using namespace std;
typedef pair<llint, llint> P;

llint D;
llint c[30];
llint s[400][30];
llint ans[405];

llint score(llint ans[], llint n)
{
	llint last[26];
	for(int i = 0; i < 26; i++) last[i] = 0;
	
	llint ret = 0;
	for(int i = 1; i <= n; i++){
		ret += s[i][ans[i]];
		last[ans[i]] = i;
		for(int j = 0; j < 26; j++){
			if(j != ans[i]) ret -= (i - last[j]) * c[j];
		}
	}
	return ret;
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> D;
	for(int i = 0; i < 26; i++) cin >> c[i];
	for(int i = 1; i <= D; i++){
		for(int j = 0; j < 26; j++){
			cin >> s[i][j];
		}
	}
	
	for(int i = 1; i <= D; i++){
		llint max_val = -inf, max_j;
		for(int j = 0; j < 26; j++){
			ans[i] = j;
			llint res = score(ans, i);
			if(res > max_val){
				max_j = j;
				max_val = res;
			}
		}
		ans[i] = max_j;
	}
	
	for(int i = 1; i <= D; i++) cout << ans[i]+1 << endl;
	return 0;
}

Measured memory_bytes: 3752
#include <bits/stdc++.h>
#include <math.h>
int i,j,k;
using namespace std;
void ABC110(void);
void ABC111(void);
void ABC112(void);
void ABC113(void);
void ABC114(void);
void ABC115(void);
void ABC116(void);
void ABC117(void);
void ABC118(void);
void ABC119(void);

int main(void){
    ABC114();
}

void ABC114(){
    int min,x;
    string s;
    cin>>s;
    for(i=0;i<s.length()-2;i++){
        k=stoi(s.substr(i,3));
        cerr<<k<<" ";
        x=abs(k-753);
        if(i==0)min=x;
        if(x<min)min=x;
    }
    cout<<min<<endl;
}

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


int main(){

int n,m;

cin>>n>>m;
if(n==1&& n!=m) {cout<<" Alice"; return 0;}
if(m==1&& n!=m) {cout<<"Bob"; return 0;}
if(n!=1&&m!=1&&n>m){cout<<"Alice" ;}
else if(n!=1&& m!=1&& m>n) cout<<"Bob";
else if(n==m ) cout<<"Draw";




return 0;

}



Measured memory_bytes: 256
n = int(input())


ans = [0 for i in range(n)]

for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            cand = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if cand <= n:
                ans[cand-1] += 1

for i in range(n):
    print(ans[i])


Measured memory_bytes: 69424