akhauriyash/Code-Regression huggingface dataset:
package main

import "fmt"

func main() {
	nums := make([]int, 5)
	var answer int
	for i := 0; i < 5; i++ {
		fmt.Scanf("%d", &nums[i])

		if nums[i] == 0 {
			answer = i + 1
		}
	}

	fmt.Println(answer)
}


Measured memory_bytes: 1804
import java.util.*;
 
public class Main{
  public static void main(String[]args){
    Scanner sc =  new Scanner(System.in);
    int N = Integer.parseInt(sc.nextLine());
    String[] S = sc.nextLine().split(" ");
    List<Integer> list = new ArrayList<>();
    for(int i = 0; i < N; i++){
      list.add(Integer.parseInt(S[i]));
    }
    Collections.sort(list);
    if(N == 1){
      System.out.println(1);
      return;
    }else if(N % 2 == 0){
      for(int i = 0; i < N-1 ; i+=2){
        if(list.get(i) != i+1 || list.get(i+1) != i+1){
          System.out.println(0);
          return;
        }
      }
    }else{
      for(int i = 1; i < N-1 ; i+=2){
        if(list.get(i) != i+1 || list.get(i+1) != i+1){
          System.out.println(0);
          return;
        }
      }
    }
    
    long ans = 2;
    for(int i = 1; i < N/2; i++){
      ans = ans * 2 % 1000000007;
    }
    System.out.println(ans);
  }
}

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

using namespace std;

using ll = long long;

int n;
const vector<int> add = {3, 5, 7};

int Solve(ll x, char flag) {
    if (n < x) return 0;

    int res = (flag == 7);
    for (int i = 0; i < 3; ++i)
        res += Solve(10 * x + add[i], flag | (1 << i));
    return res;
}

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

    cin >> n;
    cout << Solve(0, 0) << endl;;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cassert>
#define bogo_sort   std::sort
#define bozo_sort   std::stable_sort
#define alles(obj)  obj.begin(), obj.end()
#define elif        else if
#define unless(flg) if(!(flg))
#define elless(flg) else if(!(flg))
#define echo        std::cout <<
#define read        std::cin >>
#define endl        std::endl
#define fin         << '\n'
#define bash        push_back
#define makePair    std::make_pair
#define _           << ' ' <<
// type-define
#define Stack       std::stack
#define Queue       std::queue
#define Set         std::set
#define PQueue      std::priority_queue
#define Vector      std::vector
#define Pair        std::pair
#define Map         std::map
#define HashMap     std::unordered_map
#define Greater     std::greater
using String  =     std::string;
using llong   =     long long;
using boolean =     bool;
using Pii     =     Pair<int, int>;
using Vi      =     Vector<int>;
using Vii     =     Vector<Pii>;
// utils
constexpr int   dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int   dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
constexpr int   INF  = 0x3f3f3f3f;
constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;

namespace {
    template<class A, class B> A power ( llong x, llong n, llong mod ) {
        llong ans = 1;
        while ( n > 0 ) {
            if ( n & 1 ) ans = ( ans * x ) % mod;
            x = ( x * x ) % mod;
            n >>= 1;
        }
        return ans;
    }
    template<class A, class B> A power ( A x, B n ) { return power( x, n, 1000000007 ); }
    template<class A> A gcd ( A x, A y ) { return x % y ? gcd( y, x % y ) : y; }
    template<class A, class B> A lcm   ( A x,  B y ) { return ( x / gcd(x, y) * y ); }
    template<class A> inline A abs ( A n ) { return ( n < 0 ) ? -n : n; }
    template<class A, class B> inline bool chmax ( A &a, const B &b ) { return b > a ? a = b, true : false; }
    template<class A, class B> inline bool chmin ( A &a, const B &b ) { return b < a ? a = b, true : false; }
    boolean isMovable ( int x, int y, int w, int h ) {
        return ( x >= 0 && y >= 0 && x < w && y < h );
    }
}

namespace Rlyeh {

    int max = 0;
    Vi vi;

    signed call_of_Cthulhu( signed datum ) {

        int n;
        read n;
        for ( int i = 0; i < n; i++ ) {
            int a;
            read a;
            chmax(max, a);
            vi.bash(a);
        }
        
        bozo_sort(alles(vi));

        int ans = 0;
        int id = 0;

        for ( int i = 0; i < n; i++ ) {
            int tmp = std::min(vi[i], max-vi[i]);
            if ( chmax(ans, tmp) ) {
                id = i;
            }
        }

        echo max _ vi[id] fin;



        return 0;
    }
}

signed main(){std::cin.tie(0); std::ios::sync_with_stdio(false); int main_result = Rlyeh::call_of_Cthulhu(114514); return 0;}


Measured memory_bytes: 1016
cat<<EOF>Source.cpp
#include <iostream>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;

int max(int a,int b){
	return a>b?a:b;
}
int x[100000],y[100000],x_mod_k[100000],x_div_k[100000];
char s[100000][2];
int n,k;

void add(int*cnt,int x,int t){
	if((x_div_k[x]&1)==0){
		if(t==0){
			cnt[0]++;
			cnt[k-x_mod_k[x]]--;
		}
		else{
			cnt[k-x_mod_k[x]]++;
		}
	}
	else{
		if(t==0){
			cnt[k-x_mod_k[x]]++;
		}
		else{
			cnt[0]++;
			cnt[k-x_mod_k[x]]--;
		}
	}
}
int ans[2000];
int main(){
	scanf("%d%d",&n,&k);
	rep(i,n){
		scanf("%d%d%s",&x[i],&y[i],s[i]);
		x_mod_k[i]=y[i]%k;
		x_div_k[i]=y[i]/k;
	}
	int Max=0;
	#pragma omp parallel for num_threads(10)
	rep(i,k){
		int cnt[max(n,k)];
		rep(j,max(n,k))cnt[j]=0;
		rep(j,n){
			if(s[j][0]=='B'){
				if(((x[j]+i)/k)%2==0){
					add(cnt,j,0);
				}
				else{
					add(cnt,j,1);
				}
			}
			else{
				if(((x[j]+i)/k)%2==0){
					add(cnt,j,1);
				}
				else{
					add(cnt,j,0);
				}
			}
		}
		rep(j,k){
			if(j)cnt[j]+=cnt[j-1];
			ans[i]=max(ans[i],max(cnt[j],n-cnt[j]));
		}
	}
	rep(i,k)Max=max(Max,ans[i]);
	cout<<Max<<endl;
}
EOF
g++ -O3 Source.cpp -o Source -fopenmp -std=c++11
./Source

Measured memory_bytes: 32148
n = int(input())
s = input()
m = 3 ** n
ans = [0] * m
c = 3
t = [[0 if q == 'S' else 1 for q in s]]
for i in range(n) : 
    nt = [[]] * c
    for j in range(c) : 
        x = j
        x = x // (3**i)
        pre = j - x*c//3
        nxt = []
        for q in t[pre] : 
            if q == 0 : 
                if x != 0 : x = 3 - x
                if len(nxt) >= 1 and nxt[-1] == 0 : nxt.pop()
                else : nxt.append(0)
            else :
                x += 1
                if x == 3 :
                    x = 0
                    nxt.append(1)
        for k in range(j,m,c):
            ans[k] += x*c//3
        nt[j] = nxt
    t = nt
    c *= 3
print(*ans)

Measured memory_bytes: 193760
k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
sum = 0
d = []
for i in range(n):
    d.append(a[i]-a[0])
c = []
for i in range(n-1):
    sum = sum + d[i+1]-d[i]
    c.append(d[i+1]-d[i])
c.append(k-sum)
c.sort()
print(k-c[-1])


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

using ll=long long;
using namespace std;

#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vll(v) sort((v).begin(), (v).end(), greater<long long>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

ll gcd(ll a, ll b) { return b?gcd(b, a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a, b)*b;}

const int IINF=(1<<30);
const ll LLINF = 1LL<<60;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    string s;
    int ans;
    while(true){
        cin >> s;
        if(s == "0"){
            break;
        }

        for (int i = 0; i < s.length(); i++){
            ans += int(s[i] - '0');
        }
        say(ans);
        ans = 0;
    }

}


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

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> B(N);
  vector<int> C(N-1);
  int ans=0;
  for(int i=0; i<N; i++) cin >> A.at(i);
  for(int i=0; i<N; i++){
    cin >> B.at(i);
    ans+= B.at(i);
  }
  for(int i=0; i<N-1; i++) cin >> C.at(i);
  for(int i=0; i<N-1; i++){
    if(A.at(i)+1==A.at(i+1)) ans+=C.at(A.at(i)-1);
  }
  cout << ans << endl;
}

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
    int k, x;
    cin >> k >> x;
    int start = x - k + 1;
    int end = x + k - 1;
    for (int i = start; i <= end; ++i) {
        cout << i;
        if (i != end) cout << " ";
        else cout << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
int main(){
  long long a, b, c; cin >> a >> b >> c;
  if (2*(a*b+b*c+c*a)<a*a+b*b+c*c && a+b < c){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
// https: //onlinejudge.u-aizu.ac.jp/courses/lesson/8/ITP2/4/ITP2_4_A
#include <iostream>
#include <vector>
#include <algorithm>

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

    std::vector<int> A(n);
    for (auto &x : A)
    {
        std::cin >> x;
    }

    int q;
    std::cin >> q;

    for (int i = 0; i < q; i++)
    {
        int b, e;
        std::cin >> b >> e;

        std::reverse(A.begin() + b, A.begin() + e);
    }

    for (auto itr = A.begin(); itr != A.end(); itr++)
    {
        std::cout << *itr;
        if (itr + 1 != A.end())
        {
            std::cout << " ";
        }
    }
    std::cout << std::endl;

    return 0;
}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
int main(){
  vector< vector<int> > a (3,vector<int> (3));
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      cin>>a[i][j];
    }
  }
  int n;
  cin>>n;
  vector<int> k(n);
  for(int i=0;i<n;i++){
    cin>>k[i];
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<3;j++){
      for(int l=0;l<3;l++){
        if(k[i]==a[j][l]){
          a[j][l]=101;
        }
      }
    }
  }
  int ans=0;
  for(int i=0;i<3;i++){
    if(a[i][0]==a[i][1]&&a[i][1]==a[i][2]){
        ans++;
      }
    if(a[0][i]==a[1][i]&&a[1][i]==a[2][i]){
      ans++;
    }
  }
  if(a[0][0]==a[1][1]&&a[1][1]==a[2][2]){
    ans++;
  }
  if(a[0][2]==a[1][1]&&a[1][1]==a[2][0]){
    ans++;
  }
  if(ans==0){
    cout<<"No"<<endl;
  }
  else{
    cout<<"Yes"<<endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<queue>
using namespace std;
#define MOD 1000000007

int main(void){
 int N;
 long long int ans=1;
 long long int cnt[100050];
 char s[100050];

 cin>>N;
 cin>>s;
 for(int i=0;i<=100040; i++)cnt[i]=0;
 for(int i=0; i<strlen(s);i++)cnt[s[i]-'a']++;
 
 for(int i=0; i<26; i++)ans=(ans*(cnt[i]+1))% MOD;
 cout<<(ans-1)%MOD<<endl;

 return 0;
}

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

int main()
{
  string s ;
  cin >> s ;
  vector<string> data = {"SAT", "FRI", "THU", "WED", "TUE", "MON", "SUN"} ;
  
  for(int i = 0; i < data.size(); i++)
  {
    if(data.at(i) == s)
    {
      cout << i + 1 << endl;
      return 0 ;
    }
  }

}


Measured memory_bytes: 256
#include <stdio.h>


 void change(int A[], int n){
   int i;

   for(i=0;i<n;i++){
     if(i > 0) printf(" ");
     printf("%d",A[i]);
   }
   printf("\n");
 }

void insert(int A[], int n){
  int j,i,v;
  
    for(i=1;i<n;i++){
      v = A[i];
      j = i - 1;
      while(j >= 0 && A[j] > v){
	A[j+1] = A[j];
	j--;
      }
      A[j+1] = v;
      change(A,n);
    }
 }

int main(){

  int n,i,j;
  int A[100];

  scanf("%d",&n);

  for(i=0;i<n;i++)
    scanf("%d",&A[i]);

    change(A,n);
    insert(A,n);

    return 0;
}





Measured memory_bytes: 2144
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
using namespace std;
long long Read() {
    long long x=0,f=1;
    char c=getchar();
    while(c<'0'||c>'9') {
        if(c=='-') f=-1;
        c=getchar();
    }
    while(c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*f;
}
int main(){
	int a=Read(),b=Read(),c=Read();
	if(2*b==a+c) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
	
}

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

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

int main(){
    int N;
    cin >> N;
    int a[N];
    rep(i, N) cin >> a[i];
    int ans = 0;
    rep(i, N){
        ans += (a[i]-1);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

int main() {
    int n, t;
    cin >> n >> t;
    vi a(n);
    rep(i, n) {
        cin >> a[i];
    }

    vi fm(n+1, INT_MAX), bm(n+1);
    rep(i, n) {
        fm[i+1] = min(fm[i], a[i]);
        bm[n-i-1] = max(bm[n-i], a[n-i-1]);
    }

    int mm = 0;
    vi vm(n);
    rep(i, n) {
        if(bm[i] - fm[i+1] > mm) {
            mm = bm[i] - fm[i+1];
            vm[i] = mm;
        } else {
            vm[i] = bm[i] - fm[i+1];
        }
    }

    set<int> se;
    rep(i, n) {
        if(vm[i] == mm) {
            se.insert(bm[i]);
        }
    }

    cout << (int)se.size() << endl;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define ll long long
int main(){
  int N,D;
  cin>>N>>D;
  if(N%(2*D+1)) cout<<N/(2*D+1)+1<<endl;
  else cout<<N/(2*D+1)<<endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

  int Fx = 0;

  for(auto &e: N)
  {
      Fx += e - '0';
  }

  string result;
  if((stoi(N) % Fx) == 0)
      result = "Yes";
  else {
      result = "No";
  }

  cout << result << endl;
  return 0;

}


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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    ll n,m;cin>>n>>m;
    priority_queue<ll> que;
    rep(i,n){
        int a;cin>>a;
        que.push(a);
    }
    rep(i,m){
        int b = que.top();
        que.pop();
        que.push(b/2);
    }
    ll res  = 0;
    rep(i,n){
        res += que.top();
        que.pop();
    }
    out(res);
}


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

int main() {
  int N;
  cin >> N;
  int a[110];
  for (auto i = 0; i < N; i++) {
    cin >> a[i];
  }
  int ans = 1000000007;
  for (auto i = -100; i <= 100; i++) {
    int temp = 0;
    for (auto j = 0; j < N; j++) {
      int x = (a[j] - i);
      temp += x * x;
    }
    ans = min(ans, temp);
  }
  assert(ans < 1000000000);
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Set;
import java.util.HashSet;

public class Main {

	public static void main(String args[]){

		Scanner scan = new Scanner(System.in);
		
		Set<Integer> set = new HashSet<Integer>();
		
		set.add(scan.nextInt());
		set.add(scan.nextInt());
		set.add(scan.nextInt());
		
		System.out.println(set.size()==2?"Yes":"No");
		
	}
}

Measured memory_bytes: 23764
#ifndef ONLINE_JUDGE
    #include "debug.cpp"
#endif

#include <bits/stdc++.h>
using namespace std;

#define endl '\n'
#define int long long

const int inf = 1e18 + 5;
const int MOD = 1e9 + 7;

void solve()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++)
        cin >> a[i];
    vector<int> suff(n + 1);
    vector<int> d(n);
    d = a;
    reverse(d.begin(), d.end());
    for(int i = 0; i < n; i++)
    {
        suff[i + 1] = (suff[i] + d[i]) % MOD;
    }
    // deb(suff);
    int ans = 0;
    for(int i = 0; i < n - 1; i++)
    {
        ans = (ans + (a[i] * (suff[n - 1 - i]) % MOD) % MOD) % MOD;
    }
    cout << ans % MOD << endl;
}

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

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


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

int main() {
    vector<int> a(10000, 0);

    for(int i = 0; i < 10000; i++) {
        cin >> a.at(i);
    }

    for(int i = 0; i < 10000; i++) {
        if(a.at(i) == 0) break;
        cout << "Case " << i+1 << ": " << a.at(i) << endl;
    }
}


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

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

const int MOD=1000000007;
int INF=100100100100100;

int a[1000],b[1000],c[1000];
signed main(){
  int n;cin>>n;
  rep(i,n){
    cin>>a[i];a[i]--;
  }
  rep(i,n)cin>>b[i];
  rep(i,n-1)cin>>c[i];
  
  int ans=0;
  rep(i,n){
    ans+=b[i];
    if(i!=0 && a[i-1]+1==a[i])ans+=c[a[i-1]];
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N, A,x,y,z;
    cin >> N >> A;
    x = N / 500;
    y = N - 500 * x;
    z = A - y;
    if (z >= 0){
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int i,a,b;
	string s;
	cin>>a>>b>>s;
	for(i=0;i<s.size();i++){
		if(i==a){
			if(s[i]!='-'){
				cout<<"No"<<endl;
				return 0;
			}
		}
		else{
			if(!isdigit(s[i])){
				cout<<"No"<<endl;
				return 0;
			}
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

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

using namespace std;

int N, M;
int d[500];
int a[50];

void dfs(int li, int ri, vector<bool> used, set< vector<int> >& ans){
    if(li > ri){
        vector<int> v;
        for(int i = 0; i < N - 1; i++){
            v.push_back( a[i + 1] - a[i] );
        }
        ans.insert(v);
        return ;
    }

    int max_d = 0;
    for(int i = M - 1; i >= 0; i--){
        if(!used[i]){
            max_d = d[i];
            break;
        }
    }

    bool ok = true;
    vector<bool> n_used = used;
    a[li] = a[N - 1] - max_d;
    for(int i = 0; i < N; i++) if(i < li || i > ri){
        int dist = abs(a[li] - a[i]);
        int k = lower_bound(d, d + M, dist) - d;
        while(d[k] == dist && n_used[k]) k++;
        if(d[k] == dist && !n_used[k]){
            n_used[k] = true;
        }else{
            ok = false;
            break;
        }
    }
    if(ok) {
        dfs(li + 1, ri, n_used, ans);
    }

    ok = true;
    n_used = used;
    a[ri] = max_d;
    for(int i = 0; i < N; i++) if(i < li || i > ri){
        int dist = abs(a[ri] - a[i]);
        int k = lower_bound(d, d + M, dist) - d;
        while(d[k] == dist && n_used[k]) k++;
        if(d[k] == dist && !n_used[k]){
            n_used[k] = true;
        }else{
            ok = false;
            break;
        }
    }
    if(ok) {
        dfs(li, ri - 1, n_used, ans);
    }
}

int main(){
    while(cin >> N && N){
        M = N * (N - 1) / 2;
        REP(i, M){
            cin >> d[i];
        }
        sort(d, d + M);
        vector<bool> used(M, false);
        a[N - 1] = d[M - 1];
        used[M - 1] = true;
        set< vector<int> > ans;
        dfs(1, N - 2, used, ans);
        for(auto& v : ans){
            for(int i = 0; i < N - 1; i++){
                cout << v[i];
                if(i == N - 2) cout << endl;
                else cout << " ";;
            }
        }
        cout << "-----" << endl;
    }
    return 0;
}

Measured memory_bytes: 1232
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a<b?a:b
#define REP(i,x,n) for(int i=x;i<n;i++)
#define REPR(i,x,n) for(int i=n-1;i>=x;i--)
#define pb  push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLr(obj) (obj).rbegin(), (obj).rend()
#define endl "\n"
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1e9 + 7;


int main() {
  ll n;
  cin>>n;
  ll wa=1;
  ll ans=0;
  REP(i,1,n+1){
      if(i/(wa*10)>=1)wa*=10;
      if(i%10==0)continue;
      ll a=i/wa,b=i%10,j;;
      if(wa==1)j=0;
      else j=10;
      if(a==b&&wa!=1){ans++;}
      while(b*j+a<=n){
          
          if(j==0){
              
              j=10;
              ans++;
              continue;
          }
          rep(k,j/10){
                if(b*j+a+k*10<=n)ans++;
                else break;
        }
          j*=10;
      }
      
  }
  cout<<ans<<endl;
  
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        long n = Long.parseLong(stdIn.next());
        long a = Long.parseLong(stdIn.next());
        long b = Long.parseLong(stdIn.next());

        long ans = (n / (a + b)) * a;
        if (n % (a + b) >= a) {
            ans += a;
        } else {
            ans += n % (a + b);
        }

        System.out.println(ans);
    }
}


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

using namespace std;

#define endl '\n'

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

const int N = 1e6+100;


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

	ll a , b , c;
	cin >> a >> b >> c;

	ll ans = 0;
	ans += min(a , c);
	c -= min(a , c);


	ans += 2 * min(b , c);

	int foo = min(b , c);
	b -= foo;
	c -= foo;

	if(b)
	ans += b;
	else if(c){
		ans++;
	}

	cout << ans << endl;


}


Measured memory_bytes: 256
// ABC067_A.cpp : Defines the entry point for the console application.
//

#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int r, g, b;
	cin >> r >> g >> b;
	if ((r * 100 + g * 10 + b) % 4 == 0) {
		cout << "YES" << endl;
		return 0;
	}
	cout << "NO" << endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
using namespace std;
int main(){
	int n,r;
	while(cin>>n>>r,n,r){
		int data[50],tmp[50];
		for(int i=0;i<n;i++){
			data[i]=n-i;
			tmp[i]=n-i;
		}
		for(int i=0;i<r;i++){
			int p,c;
			cin>>p>>c;
			for(int j=0;j<p+c-1;j++){
				if(j<p-1){
					tmp[j+c]=data[j];
				}else{
					tmp[j-p+1]=data[j];
				}
			}
			for(int j=0;j<n;j++){
				data[j]=tmp[j];
			}
		}
		cout<<data[0]<<endl;
	}
}

Measured memory_bytes: 1164
sx, sy, tx, ty = map(int, input().split())
dx = tx-sx
dy = ty-sy
s =  'U'*dy + 'R'*dx
s += 'D'*dy + 'L'*dx
s += 'L' + 'U'*(dy+1) + 'R'*(dx+1) + 'D'
s += 'R' + 'D'*(dy+1) + 'L'*(dx+1) + 'U'
print(s)

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

int max(int a,int b){return(a > b ? a : b);}
int asc(const void *a, const void *b) {return *(int *)a - *(int *)b;}

int main()
{
    int n,a[100000],left,right = 0,ans = 0,i,l = 0;
    scanf("%d",&n);
    for (i = 0; i < n; i++)
    {
        scanf("%d",&a[i]);
    }
    qsort(a,n,sizeof(int),asc);
    //for (i = 0; i < n; i++){printf("%d ",a[i]);}
    for (left = 0; left < n; left++)
    {
        while (right < n && a[right] - a[left] < 3)
        {
            right++;
        }
        l = max(l, right - left);
        if(left == right)right++;
    }
    printf("%d\n",l);
}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

int main(void){
	int32 a, b;
	cin >> a >> b;
	if(a+b == 15){
		cout << '+' << endl;
	}else if(a*b == 15){
		cout << '*' << endl;
	}else{
		cout << 'x' << endl;
	}
}

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

using namespace std;

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

	int n,k,t;
	vector <int> v;

	cin >> n >> k;

	for(int i=0;i<n;i++)
	{
		cin >> t;
		v.push_back(t);
	}

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

	long long int res = 0;

	for(int i=0;i<k;i++)
	{
		res += v[i];
	}

	cout << res << '\n';
	
	return 0;
}	

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <ctime>
#include <map>
#include <queue>

using namespace std; using ll=long long; using P=pair<ll,ll>; const int INF=1e9; const ll LNF=1e18;

int main(){
  int h,w,n; cin>>h>>w>>n;
  int a[n]; for(int i=0;i<n;i++) cin>>a[i];

  int b[h*w], ii=0;
  for(int i=0;i<h;i++) {
    for(int j=0;j<w;j++) {
      b[i*w+j] = ii;
      a[ii]--;
      if (a[ii] == 0) ii++;
    }
  }

  int jj=0, an[h][w];
  for(int i=0;i<h;i++) {
    if (i%2 == 0) {
      for(int j=0;j<w;j++) {
        an[i][j]=b[jj++];
      }
    } else {
      for(int j=w-1;j>=0;j--) {
        an[i][j]=b[jj++];
      }
    }
  }

  for(int i=0;i<h;i++) {
    for(int j=0;j<w;j++) {
      cout<<an[i][j]+1<<" ";
    } cout<<endl;
  }
}

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

int main()
{
  // 調理時間
  vector<int> cookingTime(5);
  // 調理時間 + 次の注文ができるまでの時間
  vector<int> spendTime(5);
  // 次の注文ができるまでの時間
  vector<int> waitTime(5);

  for (int i = 0; i < 5; i++)
  {
    cin >> cookingTime.at(i);
    spendTime.at(i) = (cookingTime.at(i) + 9) / 10 * 10;
    waitTime.at(i) = spendTime.at(i) - cookingTime.at(i);
  }

  int sum = accumulate(spendTime.begin(), spendTime.end(), 0);
  int maxWaitTime = *max_element(waitTime.begin(), waitTime.end());

  cout << sum - maxWaitTime << endl;
}


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

int main() {
	vector<int> a1(3), a2(3), a3(3), x(3);
	int y;
	bool finished = false;
	for (int i = 0; i < 3; i++) {
		y = 101;
		for (int j = 0; j < 3; j++) {
			cin >> x.at(j);
			y = min(y, x.at(j));
		}
		for (int j = 0; j < 3; j++)
			x.at(j) -= y;
		if (i == 0) a1 = x;
		else if (i == 1) a2 = x;
		else a3 = x;
	}
	for (int i = 0; i < 3; i++) {
		if (a1.at(i) - a2.at(i) != 0 || a2.at(i) - a3.at(i) != 0) {
			finished = true;
			break;
		}
	}
	if (finished == true) cout << "No" << endl;
	else cout << "Yes" << endl;
}

Measured memory_bytes: 256
object Main extends App {
    def find(m: Int, ar: Array[Int]): Int = 
        if(ar(m) == m) m else {ar(m) = find(ar(m), ar); ar(m)}
 
    def unite(x: Int, y: Int, ar: Array[Int]) = {
        val _x = find(x, ar)
        val _y = find(y, ar)
        if(_x != _y) ar(_x) = _y
    }
 
    val in = io.Source.stdin.getLines.map(_.trim.split(" ").map(_.toInt))
    val n = in.next.head
    val d = in.toSeq
    val es = (for (i <- (0 to n-2); j <- (i+1 to n-1) if d(i)(j) != -1) yield (i, j, d(i)(j))).sortBy(_._3)
    val t = (0 to n-1).toArray
    var cost = 0
    es.foreach(e => if (find(e._1, t) != find(e._2, t)) {unite(e._1, e._2, t); cost += e._3})
    println(cost)
}

Measured memory_bytes: 48964
'use strict';

function Main(input) {
  const N = Number(input.split("\n")[0])
  const V = input.split("\n")[1].split(" ").map(x => Number(x))
  const C = input.split("\n")[2].split(" ").map(x => Number(x))

  let ans = 0
  for (let i=0; i<N; i++) {
    if (V[i] - C[i] > 0) {
      ans += (V[i] - C[i])
    }
  }

  console.log(ans)
};

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());


Measured memory_bytes: 11468
//
//AtCoder Beginner Contest 138
//D - Ki
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;

const double PI = 3.14159265358979323846;

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

Graph t;
vector<int> ans;

void dfs(int v, int pv=-1){
    for(int vn: t[v]){
        if (vn == pv) continue;
        ans[vn]+=ans[v];
        dfs(vn, v);
    }
}

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

    t.resize(n);
    REP(i, n-1) {
        int a, b;
        cin >> a >> b;
        t[a-1].push_back(b-1);
        t[b-1].push_back(a-1);
    }
    
    ans.resize(n, 0);
    REP(i, q) {
        int p, x;
        cin >> p >> x;
        ans[p-1] += x;
    }
    dfs(0);

    REP(i, n) cout << ans[i] << ((i<n-1) ? " " : "");
    cout << endl;

    return 0;
}


Measured memory_bytes: 23552
while True:
    try:
        weight = float(raw_input())
        if weight <= 48.00:
            print 'light fly'
        elif 48.00 < weight <= 51.00:
            print 'fly'
        elif 51.00 < weight <= 54.00:
            print 'bantam'
        elif 54.00 < weight <= 57.00:
            print 'feather'
        elif 57.00 < weight <= 60.00:
            print 'light'
        elif 60.00 < weight <= 64.00:
            print 'light welter'
        elif 64.00 < weight <= 69.00:
            print 'welter'
        elif 69.00 < weight <= 75.00:
            print 'light middle'
        elif 75.00 < weight <= 81.00:
            print 'middle'
        elif 81.00 < weight <= 91.00:
            print 'light heavy'
        elif 91.00 < weight:
            print 'heavy'
    except EOFError:
        break

Measured memory_bytes: 4252
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
const int maxn = 1<<18, mod = 1e9 + 7;
ll C[60][60];
void precalc() {
	for(int i = 0; i < 55; i++)
		for(int j = 0; j <= i; j++) {
			if(!j) C[i][j] = 1;
			else C[i][j] = C[i-1][j] + C[i-1][j-1];
		}
}
ll nck(int n, int k) {
	if(n < k || k < 0) return 0;
	return C[n][k];
}

int n, k, s, t;
ll ans = 0;
ll a[maxn], A[maxn];
void transform() {
	for(int j = 0; j < 18; j++)//relax i-th bit
		for(int i = 0; i < maxn; i++) {
			if(i&(1<<j)) a[i] += a[i ^ (1<<j)];
		}
	for(int i = 0; i < maxn; i++)
		for(int j = 0; j < k; j++)
			A[i] += nck(a[i], j);
	for(int j = 0; j < 18; j++)//fix i-th bit
		for(int i = 0; i < maxn; i++)
			if(i&(1<<j)) A[i] -= A[i ^ (1<<j)];
}

int main() {
	cin.tie(0)->sync_with_stdio(0);
	precalc();
	cin >> n >> k >> s >> t;
	if((s&t) != s) return cout << 0, 0;
	int M = s^t;
	vector<int> v;
	for(int x, i = 0; i < n; i++) {
		cin >> x;
		if((x&s) == s && (x&t) == x) v.pb(x&M);
	}
	n = v.size();
	for(int i = 0; i < n; i++) {
		memset(a, 0, sizeof a);
		memset(A, 0, sizeof A);
		for(int j = i+1; j < n; j++) {
			a[v[j]^v[i]]++;
		}
		transform();
		ans += A[M];
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 7776
Option Infer On
Imports System.Collections.Generic
Imports System.Console

Module Program
    Sub Main()
        Dim A = NextString()
        Dim B = NextString()

        WriteLine(New String() {"GREATER", "LESS", "EQUAL"}(Judge(A, B)))
    End Sub

    Function Judge(A As String, B As String) As Integer
        Select Case A.Length - B.Length
            Case > 0
                Return 0
            Case < 0
                Return 1
            Case Else
                For i = 0 To A.Length - 1
                    Select Case Asc(A(i)) - Asc(B(i))
                        Case > 0
                            Return 0
                        Case < 0
                            Return 1
                    End Select
                Next
        End Select
        Return 2
    End Function

    Function NextString() As String
        Dim result As New List(Of Char)
        Do
            Dim tmp = Read()
            If tmp < 0 Then Exit Do
            Dim nextChar = Chr(tmp)

            If Not Char.IsWhiteSpace(nextChar) Then
                result.Add(nextChar)
            ElseIf nextChar <> vbCr Then
                Exit Do
            End If
        Loop
        Return New String(result.ToArray())
    End Function

End Module


Measured memory_bytes: 21968
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        List<Integer[]> edgeList = new ArrayList<>();
        for (int i = 0; i < m; i++) {
            int a = Integer.parseInt(sc.next());
            int b = Integer.parseInt(sc.next());
            edgeList.add(new Integer[] { a, b });
        }
        sc.close();

        // 主処理
        // グラフ
        Map<Integer, HashSet<Integer>> graph = createGraph(n, edgeList);

        // 探索
        Deque<Integer> deque = new ArrayDeque<>();
        deque.add(1);

        int[] distance = new int[n + 1];
        distance[1]++;

        while (!deque.isEmpty()) {
            int point = deque.poll();
            for (int nextPoint : graph.get(point)) {
                if (distance[nextPoint] == 0) {
                    deque.add(nextPoint);
                    distance[nextPoint] = point;
                }
            }
        }

        List<String> list = new ArrayList<>();
        boolean judge = true;

        for (int i = 2; i <= n; i++) {
            int dist = distance[i];
            if (dist == 0) {
                judge = false;
                break;
            } else {
                String s = Integer.toString(distance[i]);
                list.add(s);
            }
        }

        String result;
        if (judge) {
            result = "Yes\n" + String.join("\n", list);
        } else {
            result = "No";
        }

        // 出力
        System.out.println(result);
    }

    // グラフを作成
    public static Map<Integer, HashSet<Integer>> createGraph(int nodeSize, List<Integer[]> edgeList) {
        Map<Integer, HashSet<Integer>> graph = new HashMap<>();
        for (int i = 1; i <= nodeSize; i++) {
            graph.put(i, new HashSet<>());
        }
        for (Integer[] edge : edgeList) {
            graph.get(edge[0]).add(edge[1]);
            graph.get(edge[1]).add(edge[0]);
        }
        return graph;
    }

}


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

public class Main {

	public static final int MAX = 500000;
	public static final int SENTINAL = 1000000001;
	public static int[] L = new int[MAX / 2 + 2];
	public static int[] R = new int[MAX / 2 + 2];
	public static int count = 0;

	public static void main(String[] args) throws Exception {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String tmparray[] = br.readLine().split(" ");
		int s[] = new int[n];

		for(int i = 0 ; i < n ; i++){
			s[i] =Integer.parseInt(tmparray[i]);
		}

		mergeSort(s,0,n);
		StringBuffer sb = new StringBuffer();
		for(int i = 0 ; i < n ; i++){
			sb.append(s[i]);
			sb.append(" ");
		}

		System.out.println(sb.toString().trim());
		System.out.println(count);

	}

	public static void mergeSort(int[] s,int left, int right){

		if(right - left == 1){
			return;
		}
		int mid = (right + left) / 2;
		mergeSort(s,left,mid);
		mergeSort(s,mid,right);
 		merge(s,left,mid,right);
	}


	private static void merge(int[] s,int left, int mid, int right){

		int li = 0;
		int ri = 0;
		for(int i = left ; i < mid ; i++) L[li++] = s[i];
		L[li] = SENTINAL;
		for(int i = mid ; i < right ; i++) R[ri++] = s[i];
		R[ri] = SENTINAL;

		li = ri = 0;

		for(int i = left ; i < right ; i++){
			count++;
			if(L[li] < R[ri]){
				s[i] = L[li++];
			}else{
				s[i] = R[ri++];
			}
		}
	}
}

Measured memory_bytes: 174960
def solve(used,rest,sum,memo):
    
    if rest==0:
        return sum==0
    else:
        num=0
        for i in range(10):
            num*=2
            if used[i]:num+=1

        if (num,rest,sum) in memo:
            return memo[(num,rest,sum)]
        if sum<0:return 0
        ans=0
        for i in range(10):
            if not used[i]:
                used[i]=True
                ans+=solve(used,rest-1,sum-(i)*rest,memo)
                used[i]=False
        memo[(num,rest,sum)]=ans
        return memo[(num,rest,sum)]

memo={}
while True:
    try:
        n,s=map(int,input().split())
        used=[False for i in range(10)]
        ans=solve(used,n,s,memo)
        print(ans)
    except:
        break

Measured memory_bytes: 80612
#include<bits/stdc++.h>
#include <cstring>
#include <iostream>
#define pie acos(-1)
#define si(a) scanf("%d",&a)
#define sii(a,b) scanf("%d %d",&a,&b)
#define siii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define sl(a) scanf("%lld",&a)
#define sll(a,b) scanf("%lld %lld",&a,&b)
#define slll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define ss(st) scanf("%s",st)
#define sch(ch) scanf("%ch",&ch)
#define ps(a) printf("%s",a)
#define newLine() printf("\n")
#define pi(a) printf("%d",a)
#define pii(a,b) printf("%d %d",a,b)
#define piii(a,b,c) printf("%d %d %d",a,b,c)
#define pl(a) printf("%lld",a)
#define pll(a,b) printf("%lld %lld",a,b)
#define plll(a,b,c) printf("%lld %lld %lld",a,b,c)
#define pd(a) printf("%lf",a)
#define pdd(a,b) printf("%lf %lf",a,b)
#define pddd(a,b,c) printf("%lf %lf %lf",a,b,c)
#define pch(c) printf("%ch",c)
#define debug1(str,a) printf("%s=%d\n",str,a)
#define debug2(str1,str2,a,b) printf("%s=%d %s=%d\n",str1,a,str2,b)
#define debug3(str1,str2,str3,a,b,c) printf("%s=%d %s=%d %s=%d\n",str1,a,str2,b,str3,c)
#define debug4(str1,str2,str3,str4,a,b,c,d) printf("%s=%d %s=%d %s=%d %s=%d\n",str1,a,str2,b,str3,c,str4,d)
#define for0(i,n) for(i=0;i<n;i++)
#define for1(i,n) for(i=1;i<=n;i++)
#define forab(i,a,b) for(i=a;i<=b;i++)
#define forstl(i, s) for (__typeof ((s).end ()) i = (s).begin (); i != (s).end (); ++i)
#define NL puts("")
#define sd(a) scanf("%lf",&a)
#define sdd(a,b) scanf("%lf %lf",&a,&b)
#define sddd(a,b,c) scanf("%lf %lf %lf",&a,&b,&c)
#define SP printf(" ")
#define LL long long int
#define ULL unsigned long long int
#define N 1000007
#define MOD 100000009
#define pub(x) push_back(x)
#define pob(x) pop_back(x)
#define mem(ara,value) memset(ara,value,sizeof(ara))
#define INF INT_MAX
#define eps 1e-8
#define checkbit(n, pos) (n & (1<<pos))
#define setbit(n, pos) (n | (1<<pos))
#define para(a,b,ara)\
for(int i=a;i<=b;i++){\
    if(i!=0){printf(" ");}\
    printf("%d",ara[i]);\
}\
printf("\n");
#define pvec(vec)\
for(int i=0;i<vec.size();i++){\
    if(i!=0){printf(" ");}\
    printf("%d",vec[i]);\
}\
printf("\n");
#define ppara(n,m,ara)\
for(int i=0;i<n;i++){\
    for(int j=0;j<m;j++){\
        if(j!=0){printf(" ");}\
        printf("%d",ara[i][j]);\
    }\
    printf("\n");\
}
#define ppvec(n,vec)\
for(int i=0;i<n;i++){\
    for(int j=0;j<vec[i].size();j++){\
        if(j!=0){printf(" ");}\
        printf("%d",vec[i][j]);\
    }\
    printf("\n");\
}
#define sara(a,b,ara)\
for(int i=a;i<=b;i++){\
    scanf("%d",&ara[i]);\
}
using namespace std;
int n,a,b;
char str[100];
void input(){
    int i,j,cnt=0,fl=0;sii(a,b);
    ss(str);
    n=strlen(str);
    if(n!=(a+b+1)){
        printf("No\n");return;
    }
    for0(i,n){
        if(str[i]=='-'){cnt++;}
        if(!((str[i]>='0'&&str[i]<='9')||str[i]=='-')){
            fl=1;break;
        }
    }
    if(cnt>1){
        printf("No\n");return;
    }
    if(fl==1){
        printf("No\n");return;
    }
    if(str[a]!='-'){
        printf("No\n");return;
    }
    printf("Yes\n");

}
void solve(){

}
int main(){
//    freopen("input.txt","r",stdin);
    input();
    return 0;
}

Measured memory_bytes: 256
import java.io.*;

class Main
{
   public static void main(String[] args) throws IOException
   {

      BufferedReader br =
       new BufferedReader(new InputStreamReader(System.in));

      String str1 = br.readLine();
      String str2[] = str1.split(" ");
      int a = Integer.parseInt(str2[0]);
      int b = Integer.parseInt(str2[1]);
      int c = a*b;
      int d = 2*(a+b);
      System.out.println( c + " " + d );

   }
}

Measured memory_bytes: 24240
//
//  main.c
//  ITP1_3_D
//
//  Created by k16031kk on 2018/05/21.
//  Copyright © 2018年 AIT. All rights reserved.
//

#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int a,b,c;
    int count=0;
    scanf("%d %d %d",&a, &b, &c);
    for(int i=b; i>=a; i--) {//cをbからaまで順に割って行く
        if(c%i==0) {//割り切れた回数をカウント
            count++;
        }
    }
    printf("%d\n", count);
    return 0;
}



Measured memory_bytes: 2108
#include <iostream>
#include <string>
#define REP(i,n) for(int i=0;i<(n);++i)
#define MOD 1000000007
using namespace std;
typedef long long int LL;


int main(){
  int N;
  cin >> N;
  int ret = 0;
  REP(i, N) {
    int A;
    cin >> A;
    if(A == ret + 1) {
      ret++;
    }
  }
  cout << (ret == 0 ? -1 : N - ret) << endl;
}

Measured memory_bytes: 384
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <unordered_map>
#include <complex>
#include <iomanip>
#include <cmath>
#include <tuple>
using namespace std;

long long const MOD = 1000000007LL;

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

    // 幸福度を入れてあげる
    int a[n + 1], b[n + 1], c[n + 1];
    for (int i = 1; i <= n; i++) cin >> a[i] >> b[i] >> c[i];

    long dp[n + 1][3];
    for (int i = 0; i <= n; i++) {
        dp[i][0] = 0;
        dp[i][1] = 0;
        dp[i][2] = 0;
    }

    // 1日目から考えよう
    // 0 : 行動a
    // 1 : 行動b
    // 2 : 行動c
    for (int i = 1; i <= n; i++) {
        dp[i][0] = max(dp[i - 1][1] + a[i], dp[i - 1][2] + a[i]);
        dp[i][1] = max(dp[i - 1][0] + b[i], dp[i - 1][2] + b[i]);
        dp[i][2] = max(dp[i - 1][0] + c[i], dp[i - 1][1] + c[i]);
    }

    long res = max(dp[n][0], max(dp[n][1], dp[n][2]));

    cout << res << endl;
}


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

int main() {
  string s;
  cin >>s;
  
  if (s.at(3) == s.at(2) && s.at(4) == s.at(5)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

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

int main(){
    int x, y;
    cin >> x >> y;
    if(x==y) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
using System;

namespace Template
{
    class Program
    {
        static void Main(string[] args)
        {
            // 整数の入力
            // スペース区切りの整数の入力
            string[] input = Console.ReadLine().Split(' ');
            int h = int.Parse(input[0]);
            int w = int.Parse(input[1]);
            string[] s = new string[h];
            for (int i0 = 0; i0 < h; i0++)
            {
                s[i0] = Console.ReadLine();
            }

            for (int i0 = 0; i0 < h; i0++)
            {
                for (int i1 = 0; i1 < w; i1++)
                {
                    if (s[i0][i1] == '#' && !((0 < i0 && s[i0 - 1][i1] == '#') || (i0 < h-1 && s[i0 + 1][i1] == '#') || (0 < i1 && s[i0][i1 - 1] == '#') || (i1 < w-1 && s[i0][i1 + 1] == '#')))
                    {
                        Console.WriteLine("No");
                        return;
                    }
                }
            }

            //出力
            Console.WriteLine("Yes");
        }
    }
}

Measured memory_bytes: 13140
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

template <typename TYPE>
void print_vec(const vector<TYPE>& v){
	for(int i=0; i<v.size(); i++){
		cout << v[i] << " ";
	}
	cout << endl;
}

template <typename TYPE>
void print_vec2(const vector<vector<TYPE>>& v){
  cout << endl; cout << "       ";
  for(int i=0; i<v[0].size(); i++) cout << i << "   "; 
  cout << endl;
	for(int i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(int j=0; j<v[i].size(); j++){
			if(v[i][j] == 0) cout << "\x1B[0m" << v[i][j] << "   ";
      else cout << "\x1B[31m" << v[i][j] << "   ";//https://stackoverrun.com/ja/q/12618775
		}
		cout << "\x1B[0m" << endl;
	}
}
 

int main(){
	int H, W, K;
  	cin >> H >> W >> K;
  	vector<string> c(H);
  	for(int i=0; i<H; i++) cin >> c[i];
  
  	ll ans = 0;
  	for(int i=0; i< (1<<H); i++){
      	bitset<6> bit_h(i); //iを2進数表記したものを格納
    for(int j=0; j< (1<<W); j++){
      	bitset<6> bit_w(j); //jを2進数表記したものを格納
     	
      	int cnt = 0;
      	for(int h=0; h<H; h++){
        	if(bit_h[h]==1) continue;
         	for(int w=0; w<W; w++){
            	if(bit_w[w]==1) continue;
              	
              	if(c[h][w] == '#') cnt++;
            }
        }
        if(cnt == K) ans++;
    }
    }
  
  cout << ans << endl;
}


Measured memory_bytes: 3600
o = ""
for i in range(1, int(input())+1):
    x = i
    if x % 3 == 0:
        o += " " + str(i)
    else:
        while x > 0:
            if x % 10 == 3:
                o += " " + str(i)
                break
            x //= 10
print(o)

Measured memory_bytes: 7640
#include <bits/stdc++.h>
using namespace std;
 
long long N;
 
int main() {
	cin>>N;
	for(long long h=1;h<=3500;h++){
		for(long long n=1;n<=3500;n++){
			long long x = h*n*N;
			long long y = 4*h*n - n*N - h*N;
			if(y>0 and x%y==0){
				cout<<h<<" "<<n<<" "<<x/y<<endl;
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256