akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main(void){
    long long int n,k,d;
    cin >> n >> k >> d;
    long long int tmp = k;


    k = (abs(n) /  d > k)? 0 : k - (abs(n) /  d);
    n = (abs(n) /  d <= tmp)? abs(n) % d : abs(abs(n) - (d * tmp));

    if(k % 2 == 1){
        if(abs(n + d) > abs(n - d)){
            n = abs(n - d);
        } else {
            n = abs(n + d);
        }
    }
    cout << abs(n) << endl;
}

Measured memory_bytes: 3516
n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=list(input())
L=[[] for i in range(k)]

for i in range(n):
  L[i%k].append(t[i])

ans=0
for i in range(k):
  dp=[[0]*3 for i2 in range(len(L[i])+1)]
  for j in range(1,len(L[i])+1):
    dp[j][0]=max(dp[j-1][1],dp[j-1][2])
    if L[i][j-1]=='s':
      dp[j][0]+=r
    dp[j][1]=max(dp[j-1][0],dp[j-1][2])
    if L[i][j-1]=='r':
      dp[j][1]+=p
    dp[j][2]=max(dp[j-1][0],dp[j-1][1])
    if L[i][j-1]=='p':
      dp[j][2]+=s
  ans+=max(dp[len(L[i])])
print(ans)

Measured memory_bytes: 74508
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define INF 2e9
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n;
  cin>>n;
  cout<<(n%2==0 ? n : n*2)<<'\n';
  return(0);
}


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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;

#define fill(a,x) memset(a,x,sizeof(a)) 
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) x.begin(),x.end() 
#define F first
#define S second
#define FOR(i,a,b) for(int i = a; i<=b; ++i)
#define NFOR(i,a,b) for(int i = a; i>=b; --i)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
const ll INF = 1e18;
const int mod = 1e9+7;
const int N = 1e5+10; 
inline int add(int x,int y){
  x += y;
  if(x >= mod) x -= mod;
  return x;
}
inline int mul(int x,int y){
  x = (1LL * x * y) % mod;
  return x;
}
int main(){
  fast;
  int n,c,k;
  cin >> n >> c >> k;
  vi t(n);
  FOR(i,0,n-1)cin >> t[i];
  sort(all(t));
  int ans = 0;
  int cc = c;
  int last = -1;
  while(sz(t)){
  	last = t.back();
  	ans++;t.pop_back();
  	cc = c - 1;
  	while(sz(t)){
  		if(t.back() + k < last)break;
  		if(cc == 0)break;
  		cc -= 1;
  		t.pop_back();
  	}
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 640
def myAnswer(N:int,A:int,B:int) -> int:
   result = 0
   for i in range(1,N+1):
      string = list(str(i))
      total=sum([int(s) for s in string]) 
      if(A<=total and total <= B):
         result +=i
   return result


def modelAnswer():
   tmp=1
def main():
   N,A,B = map(int,input().split())
   print(myAnswer(N,A,B))


if __name__ == '__main__':
   main()

Measured memory_bytes: 3064
#include<cstdio>
inline int getint(){
  int ret = 0,f = 1;
  char c = getchar();
  while(c<'0'||c>'9'){
    if(c=='-')f=-1;
    c = getchar();
  }
  while(c>='0'&&c<='9')
    ret=ret*10+c-'0',c=getchar();
  return ret*f;
}
int N,a,t,s=0;
int main(){
  N=getint();
  while(N--){
    a=getint();
    asm volatile(
      "bsf %0,%1\n\t"
      :"=r"(t)
      :"r"(a)
    );
    s+=t;
  }
  printf("%d\n",s);
}

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

using namespace std;

typedef long long ll;

void solve() {
   int k;
   string s;
   
   cin>>k;
   cin>>s;
   
   
   if(k >= s.length()) cout<<s;
   
   else {
       cout<<s.substr(0, k)<<"...";
   }
}



int main() {
 
        solve();
     
    
  return 0; 
}

Measured memory_bytes: 3628
#include <iostream>
using namespace std;
long long h;
int a[101010],n,goukei;
int main()
{
    cin >> h >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        goukei += a[i];
    }
    if (goukei >= h)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 640
require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

A, B = get_ints

a = (A * 12.5).ceil

a_min = a
loop do
  break if ((a_min - 1) * 0.08).to_i != A
  a_min -= 1
end
a_max = a
loop do
  break if ((a_max + 1) * 0.08).to_i != A
  a_max += 1
end

b_min = 10 * B
b_max = 10 * B + 9

ans = ([*a_min..a_max] & [*b_min..b_max]).first
if ans.nil?
  puts '-1'
else
  puts ans
end


Measured memory_bytes: 14404
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define YY cout << "Yes" << endl;
#define NN cout << "No" << endl;
#define ve vector
#define pint pair<int,int>
const int INF = 1000000007;
const long double EPS = 1e-15;
const long double PI = acos(-1);
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
// *max_element(all(d))
// priority_queue<int,vector<int>,greater<int>>
int cost[10][10];
int solve(){
  int h,w;
  cin >> h >> w;
  rep(i,10)rep(j,10)cin >> cost[i][j];
  rep(k,10)rep(i,10)rep(j,10)chmin(cost[i][j],cost[i][k] + cost[k][j]);
  int ans = 0;
  rep(i,h)rep(j,w){
    int tmp;
    cin >> tmp;
    if(tmp == -1)continue;
    ans += cost[tmp][1];
  }
  cout << ans << endl;
  return 0;
}
int main(){
  // ios::sync_with_stdio(false);cin.tie(nullptr);
  // cout << fixed;cout << setprecision(16);
  solve();
  return 0;
}

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

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

    int ans = 0;
    while (sum) {
        int flag = 1;
        for (int i = 0; i < n; i++) {
            if (h[i] != a[i]) {
                if (flag) {ans++; flag = 0;}
                a[i]++;
                sum--;
            } else {
                flag = 1;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int n, kk, f;
int k[30];
int u[30];
int a[100000][30];
long long b[100000];
long long s, ans;
int main() {
	scanf("%d%d", &n, &kk);
	for (int i = 0; i < 30; i++) {
		k[i] = kk % 2;
		kk /= 2;
	}
	for (int i = 0; i < n; i++) {
		scanf("%d%lld", &kk, b + i);
		for (int j = 0; j < 30; j++) {
			a[i][j] = kk % 2;
			kk /= 2;
		}
	}
	s = 0;
	for (int m = 0; m < 30; m++)u[m] = k[m];
	for (int i = 0; i < n; i++) {
		f = 1;
		for (int j = 0; j < 30; j++) {
			if (a[i][j] == 1 && u[j] == 0)f = 0;
		}
		if (f)s += b[i];
	}
	if (s > ans)ans = s;
	for (int l = 0; l < 30; l++) {
		s = 0;
		if (k[l] == 0) {
			for (int m = 0; m < 30; m++)u[m] = k[m];
		}
		else {
			for (int m = 0; m < l; m++) u[m] = 1;
			u[l] = 0;
			for (int m = l + 1; m < 30; m++)u[m] = k[m];
		}
		for (int i = 0; i < n; i++) {
			f = 1;
			for (int j = 0; j < 30; j++) {
				if (a[i][j] == 1 && u[j] == 0)f = 0;
			}
			if (f)s += b[i];
		}
		if (s > ans)ans = s;
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 12672
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    private static Scanner in = new Scanner(System.in);
    private static PrintWriter out = new PrintWriter(System.out);

    private static final long MOD = (long) 1e9 + 7;

    public static void main(String[] args) {
        solve();
        out.flush();
    }

    private static void solve() {
        String s = in.next();

        char[] ch = s.toCharArray();

        int ans = 0, i = 0;
        String before = "";
        String current = "";
        while (i < s.length()) {
            current += ch[i];
            if (!current.equals(before)) {
                ans++;
                before = current;
                current = "";
            }
            i++;
        }
        out.println(ans);
    }

}


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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
  cout << a << endl;
  exit(0);
}

//実行部
void Main()
{
  vll a(3), b(3);
  map<ll, ll> ans;
  rep(i, 3)
  {
    cin >> a[i] >> b[i];
    if(ans.count(a[i])) ans[a[i]]++;
    else ans[a[i]]++;
    if(ans.count(b[i])) ans[b[i]]++;
    else ans[b[i]]++;  
  }
  vll s;
  for(ll i = 1;i <= 4;i++)
  {
    s.pb(ans[i]);
  }
  sort(all(s));
  if(s[0] == 1&&s[1] == 1&&s[2] == 2&&s[3] == 2) fin("YES");
  fin("NO");
}

//前処理
int main()
{
  //ios::sync_with_stdio(false);
  //cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}

/*
//test時
  g++ test.cpp -o test;./test
*/


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

int gcd(int a,int b) {
if(a%b == 0) return b;
else return gcd(b,a%b);
}

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

Measured memory_bytes: 1160
use strict;
my $a;
my $b;
my $kiroku;
my $sl  = 1000;
my $tl = 0;
my $min= 100000;
my $s;
my $t;
my $skari;
my $skakou;
my $tkakou;
$skari  = <>;chomp($skari);
$t      = <>;chomp($t);

for ( $a = 0 ; $tl < $sl ; $a = $a + 1 ) {
    $s      = substr( $skari, $a );
    $sl     = length($s);
    $tl     = length($t);
    $kiroku = 0;
    for ( $b = 0 ; $b < $tl ; $b = $b + 1 ) {
        $skakou = substr( $s, $b, 1 );
        $tkakou = substr( $t, $b, 1 );
        if ( $skakou ne $tkakou ) { $kiroku = $kiroku + 1; }
    }
    if ( $min > $kiroku ) { $min = $kiroku; }
}
print "$min";

Measured memory_bytes: 4900
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int sum[100005];
map<int, int> dp;
int main(){
	int n, m, a;
	scanf("%d%d", &n, &m);
	LL ans = 0;

	int tmp = 0;
	dp[0] = 1;
	for(int i=1;i<=n;i++){
		scanf("%d", &a);
		tmp += a;
		tmp %= m;
		ans += dp[tmp];
		dp[tmp]++;
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 3200
def d_alter_altar_2():
    N = int(input())
    C = input()

    left, right = 0, N - 1
    ans = 0
    while left < right:
        while left < right and C[left] == 'R':
            left += 1
        while right >= 0 and C[right] == 'W':
            right -= 1

        if left >= right:
            break
        left += 1
        right -= 1
        ans += 1
    return ans

print(d_alter_altar_2())

Measured memory_bytes: 9476
N=int(input())
K=int(input())
x=input()
x=x.split()
ans=0
for i in range(N):
    B=K-int(x[i])
    A=int(x[i])
    if B<A:
        ans=ans+B*2
    else:
        ans=ans+A*2
print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
long long n,a,b;
int main()
{
	cin>>n>>a>>b;
	if (a>b) return puts("0"),0;
	if (a==b) return puts("1"),0;
	if (n==1) return puts("0"),0;
	cout<<(b-a)*(n-2)+1<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int wdy;
	int mon,day,all=0,i;
	char week[][10]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"},c;


	while(1)
	{
		scanf("%d%c%d",&mon,&c,&day);
		if(!mon)
			break;
		all=0;
		for(i=1;i<mon;i++)
		{
			switch(i)
			{
			case 4:
			case 6:
			case 9:
			case 11:
				all+=30;
				break;
			case 2:
				all+=29;
				break;
			default :
				all+=31;
				break;
			}
		}
		wdy = (all+day)%7;
		printf("%s\n",week+wdy);
	}
	return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

int a[211111];
vector<ii> interval[19];
int pre[(1<<19)+11];
int suf[(1<<19)+11];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n,v; cin>>n>>v;
	for(int i=0;i<n;i++) cin>>a[i];
	int cur=v;
	int id=0;
	while(cur)
	{
		int curl=0;
		for(int i=1;i<n;i++)
		{
			if(a[i]-a[i-1]>cur)
			{
				interval[id].pb(mp(curl,i-1));
				curl=i;
			}
		}
		interval[id].pb(mp(curl,n-1));
		cur>>=1; id++;
	}
	for(int i=0;i<n;i++) interval[id].pb(mp(i,i));
	id++;
	pre[0] = -1; suf[0]=n;
	for(int i=1;i<(1<<id);i++)
	{
		pre[i]=-1; suf[i]=n;
		for(int j=0;j<id;j++)
		{
			if(i&(1<<j))
			{
				int mx = pre[i^(1<<j)];
				int tmp=upper_bound(interval[j].begin(),interval[j].end(),mp(mx+2,-1))-interval[j].begin();
				tmp--;
				if(tmp>=0&&tmp<interval[j].size())
				{
					int r=interval[j][tmp].se;
					pre[i]=max(pre[i],r);
				}
				int mn = suf[i^(1<<j)];
				tmp=lower_bound(interval[j].begin(),interval[j].end(),mp(mn,-1))-interval[j].begin();
				tmp--;
				if(tmp>=0&&tmp<interval[j].size())
				{
					int l=interval[j][tmp].fi; 
					suf[i]=min(suf[i],l);
				}
			}
		}
	}
	if(interval[0].size()>20)
	{
		for(int i=0;i<n;i++)
		{
			cout<<"Impossible\n";
		}
		return 0;
	}
	for(int i=0;i<interval[0].size();i++)
	{
		int l=interval[0][i].fi; int r=interval[0][i].se;
		bool pos=0;
		for(int j=0;j<(1<<id);j+=2)
		{
			int tot=(1<<id)-1; tot^=1;
			if(pre[j]>=l-1&&suf[tot^j]<=r+1)
			{
				for(int k=l;k<=r;k++) cout<<"Possible\n";
				pos=1; break;
			}
		}
		if(!pos)
		{
			for(int k=l;k<=r;k++) cout<<"Impossible\n";
		}
	}
}


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

// using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)

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

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

int W, H;
std::string map[50];
int Xs[15], Ys[15];
int dist[15][15], d[50][50], dp[12][1<<12];

void generateMap(int x0, int y0){
    std::queue<P> qu;
    qu.emplace(x0, y0);

    std::fill(&d[0][0], &d[0][0]+50*50, 1001001001);
    d[x0][y0] = 0;
    
    while(!qu.empty()){
        int x, y;
        std::tie(x, y) = qu.front();
        qu.pop();

        for(int i=0;i<4;++i){
            int nx = x + dx[i], ny = y + dy[i];
            if(0 <= nx && nx < W &&
               0 <= ny && ny < H &&
               map[ny][nx] != 'x' &&
               d[nx][ny] > d[x][y] + 1){
                d[nx][ny] = d[x][y] + 1;
                qu.emplace(nx, ny);
            }
        }
    }
}

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

    while(true){
        std::cin >> W >> H;
        if(W == 0){return 0;}

        int ast_idx = 1;
    
        for(int i=0;i<H;++i){
            std::cin >> map[i];

            for(int j=0;j<W;++j){
                if(map[i][j] == 'o'){
                    Xs[0] = j;
                    Ys[0] = i;
                }else if(map[i][j] == '*'){
                    Xs[ast_idx] = j;
                    Ys[ast_idx++] = i;
                }
            }
        }

        for(int i=0;i<ast_idx;++i){
            generateMap(Xs[i], Ys[i]);

            // printf("# %d\n", i);
            // for(int j=0;j<H;++j){
            //     for(int k=0;k<W;++k){
            //         printf("%2d%c", d[k][j], " \n"[k+1==W]);
            //     }
            // }
        
            for(int j=0;j<ast_idx;++j){
                dist[i][j] = d[Xs[j]][Ys[j]];
            }
        }

        std::fill(&dp[0][0], &dp[0][0]+12*(1<<12), 1001001001);
        dp[0][1] = 0;

        for(int i=0;i<(1<<ast_idx);++i){
            for(int j=0;j<ast_idx;++j){
                for(int k=0;k<ast_idx;++k){
                    dp[k][i | (1 << k)]
                        = std::min(dp[k][i | (1 << k)],
                                   dp[j][i] + dist[j][k]);
                }
            }
        }

        int res = 1001001001;
        for(int i=0;i<ast_idx;++i){
            res = std::min(res, dp[i][(1<<ast_idx)-1]);
        }

        if(res == 1001001001){res = -1;}
        printf("%d\n", res);
    }
}

Measured memory_bytes: 3352
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

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

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

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

#define MOD 1000000007

void solve(int test_case) {//227
	int n;
	cin>>n;
	if(n==1)cout<<"Hello World";
	else {
		int a,b;
		cin>>a>>b;
		cout<<a+b;
	}
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3620
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2")
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<vector>
#include<set>
#include<unordered_map>
#include<assert.h>
#include<time.h>
#include<stdlib.h>
#include<random>
#include<queue>
using namespace std;
using lld = long long int;
using pll = pair<lld, lld>;
using lf = double;
using pff = pair<lf, lf>;
using pif = pair<int, lf>;
using pii = pair<int, int>;
using pli = pair<lld, int>;
using pil = pair<int, lld>;
using piii = pair<int, pii>;
#define M 998244353
int n, m;
int b[1000009];
int main() {
	int i, j, k, l;
	int t = 1, tv = 0;
	//scanf("%d", &t);
	while (t--) {
		for (i = 1; i <= 1000000; i++) {
			for (j = 1; j <= 1000000 / i; j++) {
				b[i * j]++;
			}
		}
		scanf("%d", &n);
		int res = 0;
		for (i = 1; i < n; i++) {
			res += b[i];
		}
		printf("%d\n", res);
	}
	return 0;
}

Measured memory_bytes: 5640
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>

using namespace std;

int main(){
   int X;
   cin >> X;
   for(int a=0;a<=1000;a++){
      long long A=1;
      for(int i=0;i<5;i++){ A*=a; }
      for(int b=-1000;b<=1000;b++){
         long long B=1;
         for(int i=0;i<5;i++){ B*=b; }
         if(X==A-B){
            cout << a << " " << b << endl;
            return 0;
         }
      }
   }
   return 0;
}


Measured memory_bytes: 3636
import numpy as np

N = int(input())
A = list(map(int, input().split()))

X = [0]*N
X[0] = sum(A) - 2 * (sum(A[1:N-1:2]))
for i in range(1, N):
  X[i] = 2 * A[i-1] - X[i-1]
print (' '.join(map(lambda x: str(x), X)))

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

const int MAX_V=210;

int V;
vector<int> G[MAX_V];
int match[MAX_V]; //マッチングのペア
bool used[MAX_V];

void add_edge(int u, int v){
  G[u].push_back(v);
  G[v].push_back(u);
}

// 増加道を探す
bool dfs(int v){
  used[v]=1;
  for(int i=0;i<G[v].size();i++){
    int u=G[v][i], w=match[u];
    if(w<0 || !used[w] && dfs(w)){
      match[v]=u;
      match[u]=v;
      return 1;
    }
  }
  return 0;
}

// 二部グラフの最大マッチングを求める
int bipartite_matching(){
  int res=0;
  memset(match,-1,sizeof(match));
  for(int v=0;v<V;v++){
    if(match[v]<0){
      memset(used,0,sizeof(used));
      if(dfs(v)){
        res++;
      }
    }
  }
  return res;
}


int main(){
  cin>>V;
  int x[2][V],y[2][V];
  rep(i,2) rep(j,V) cin>>x[i][j]>>y[i][j];
  rep(i,V) rep(j,V){
    if(x[0][i]<x[1][j]&&y[0][i]<y[1][j]){
      add_edge(i,V+j);
    }
  }
  cout<<bipartite_matching()<<endl;
  return 0;
}


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

char itoc(int i)
{
    return i + '0';
}

void solve(int N, string S)
{
    long long cnt = 0;
    for (int i = 0; i <= 9; i++)
    {
        for (int j = 0; j <= 9; j++)
        {
            for (int k = 0; k <= 9; k++)
            {
                int pos = 0;
                // bool matched = false;

                for (size_t l = 0; l < S.length(); l++)
                {
                    pos++;
                    if (S[l] == itoc(i))
                    {
                        break;
                    }
                }

                for (size_t l = pos; l < S.length(); l++)
                {
                    pos++;
                    if (S[l] == itoc(j))
                    {
                        break;
                    }
                }

                for (size_t l = pos; l < S.length(); l++)
                {
                    pos++;
                    if (S[l] == itoc(k))
                    {
                        cnt++;
                        break;
                    }
                }
            }
        }
    }

    cout << cnt << 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()
{
    int N = 0;
    cin >> N;
    string S;
    cin >> S;

    solve(move(N), move(S));
    return 0;
}


Measured memory_bytes: 256
d = []
a = input()
a = int(a)
for i in range(a):
    i = input()
    i = int(i)
    d.append(int(i))
d.sort()
pre_i = -1
cnt = 0
for i in d:
    if(pre_i!=i):
        cnt = cnt + 1
    pre_i = i

print(cnt)


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

#define stirng string
#define vvi vector<vector<int>>
#define vi vector<int>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

const int inf = 1e9 + 7;

int main() {
  int a, b;
  cin >> a >> b;
  int ans = 0;
  for (int i = a; i <= b; i++) {
    string s = to_string(i);
    string t = s;
    reverse(t.begin(), t.end());
    if (s == t) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int main() {
	int n;
	while(n=in()){
		int ice[10]={};
		int i;
		while(n--){
			cin>>i;
			ice[i]++;
		}
		for(i=0;i<10;i++){
			int j;
			if(ice[i]==0){
				cout<<"-\n";
			}else{
				for(j=0;j<ice[i];j++){
					cout<<"*";
				}
				cout<<endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 0
N = int(input())
AList = list(map(int,input().split()))
BList = list(map(int,input().split()))
CList = list(map(int,input().split()))

manzoku = 0
prev = -1
for a in AList:
    manzoku += BList[a-1]
    if prev + 1 == a:
        manzoku += CList[prev-1]
    prev = a
print(manzoku)


Measured memory_bytes: 3060
import java.util.*;

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

        for(int i = 0;i < n;i++){
            arr[i] = sc.nextInt();
        }

        int ans = 0;
        for(int i = 1;i < n-1;i++){
            if(arr[i] > arr[i-1] && arr[i] < arr[i+1]){
                ans++;
            } else if(arr[i] < arr[i-1] && arr[i] > arr[i+1]){
                ans++;
            }
        }
        System.out.println(ans);

    }

}



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

int main() {

    int N, K;
    cin >> N >> K;
    
    double ans = 0;
    
    for (int i=1; i<=N; i++) {
        int count = 0;
        int kake = 1;
        
        while (i * kake < K) {
            kake = kake * 2;
            count++;
        }
        
        ans += pow(0.5, count);
    }
    
    printf("%.10lf\n", ans / N);
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
const int NMAX=100000;
int dp[NMAX];
int N;
void solve(int a){
  for(int i=a;i<=N;i*=a){
    for(int j=0;j+i<=N;j++)
      dp[j+i]=min(dp[j+i],dp[j]+1);
  }
}
int main(){
  cin>>N;
  for(int i=0;i<=N;i++)
    dp[i]=i;
  solve(6);
  solve(9);
  cout<<dp[N]<<endl;
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string S;
    cin >> S;
    bool flag = true;
    for (int i = 0; i < S.size()-1; i++) {
        if (S[i] == S[i+1])
            flag = false;
    }
    
    if (flag)
        cout << "Good" << endl;
    else
        cout << "Bad" << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

	int t = 0;
	while (a >= b) {
		t++;
		b *= 2;
	}
	while (b >= c) {
		t++;
		c *= 2;
	}

	cout << (t <= k ? "Yes" : "No") << endl;
	
	return 0;
}

Measured memory_bytes: 3628
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

type Val struct {
	i, num int
}

type ByNum []Val

func (a ByNum) Len() int           { return len(a) }
func (a ByNum) Less(i, j int) bool { return a[i].num < a[j].num }
func (a ByNum) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N := sc.nextInt()
	A := make([]Val, N)
	for i := 0; i < N; i++ {
		A[i] = Val{i, sc.nextInt()}
	}
	sort.Sort(ByNum(A))
	for i := 0; i < N; i++ {
		if i == A[N-1].i {
			fmt.Fprintln(wtr, A[N-2].num)
		} else {
			fmt.Fprintln(wtr, A[N-1].num)
		}
	}
	wtr.Flush()
}


Measured memory_bytes: 7680
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
const long long mod = 1e9 + 7;
typedef long long ll;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII;  // VII a(n,vector<int>(m)) n * m
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;  // MP a;
typedef vector<pair<ll, ll>> PS;

template <class T, class U>
bool chmax(T &a, U b) {
  if (a <= b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class U>
bool chmin(T &a, U b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
  os << "}";
  return os;
}

// g++ -std=c++11 prac.cpp
// operator << (cout,a);
// chmin(min,a)

int main() {
  ll n, m, x, y = 0, z = 0, h, w, sum = 0, Max = -1, Min = 1e9+1;
  string s, t, u;
  bool ok=true;
  cin >> n >> m;

  VII g(n);
  rep(i,m){
    cin >> x >> y; x--;y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }

  queue<int> que;
  VI ans(n,-1);
  que.push(0);
  ans[0] = 0;

  while(!que.empty()){
    int q = que.front();
    que.pop();
    for(int v : g[q]){
      if(ans[v] == -1){
        ans[v] = q+1;
        que.push(v);
      }
    }
  }
  pri("Yes");
  rep2(i,1,n) pri(ans[i]);
  return 0;
}


Measured memory_bytes: 10240
num=int(input())
dic={}
for i in range(num):
  s=input()
  if s not in dic:
    dic[s]=1
  else:
    dic[s]+=1
sorteddic=sorted(dic.items(),reverse=True,key=lambda x:x[1])
res = []
cnt=0
temp = 0
for i in sorteddic:
  if cnt ==0 or temp == i[1]:
    res.append(i[0])
    temp = i[1]
  else:
    break
  cnt+=1  
for i in sorted(res):
  print(i)


Measured memory_bytes: 114776
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
//#define int long long  
int main(){
    int N;
    int t[114514],x[114514],y[114514];
    int sum;
    cin >> N;
    t[0]=0;x[0]=0;y[0]=0;
    REP(i,N){cin >> t[i+1] >> x[i+1] >> y[i+1];}
    REP(i,N){
        sum = abs(x[i+1]-x[i])+abs(y[i+1]-y[i]);
        //cout << sum << endl;
         if(sum<=t[i+1]-t[i] && (sum+t[i+1]-t[i])%2==0){
       }else{
           cout<< "No" << endl;
           return 0;
       }
    }
    cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int LIM = 200000;

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

    vector<int> backet(LIM+1, 0);
    for(int i = 0; i < n; i++) backet[a[i]]++;

    sort(backet.begin(), backet.end(), greater<int>());

    int ans = 0;
    for(int i = k; i <= LIM; i++) ans += backet[i];

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

Measured memory_bytes: 4780
#include<iostream>
#include<cstdio>
#include<cstring> 
using namespace std;
char a[100007],b[100007];
int main()
{
	scanf("%s",a);
	int len=strlen(a);
	for(int i=0;i<(len/2);i++)
		{
			b[i]=a[len-i-1];
			b[len-i-1]=a[i];
		}
	for(int i=0;i<len;i++)
		{
			if(b[i]=='b')
				{
				b[i]='d';
				continue;
				}
			if(b[i]=='d')
				{
				b[i]='b';
				continue;
				}
			if(b[i]=='p')
					{
				b[i]='q';
				continue;
				}
			if(b[i]=='q')
				{
				b[i]='p';
				continue;
				}
		}
	int k=0;
	for(int i=0;i<len;i++)
		{
			if(a[i]==b[i])
				continue;
			else
				{
					k=1;
					break;
				}
		}
	if(k==0)
		cout<<"Yes";
	else
		cout<<"No";
}

Measured memory_bytes: 384
#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()
#define ll int64_t
#define _GLIBCXX_DEBUG
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
//約数列挙(√N)
vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}
//素因数分解(√N)
map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}
//素数テーブル(NloglogN)
vector< bool > prime_table(int n) {
  vector< bool > prime(n + 1, true);
  if(n >= 0) prime[0] = false;
  if(n >= 1) prime[1] = false;
  for(int i = 2; i * i <= n; i++) {
    if(!prime[i]) continue;
    for(int j = i + i; j <= n; j += i) {
      prime[j] = false;
    }
  }
  return prime;
}
//二項係数(K)
template< typename T >
T binomial(int64_t N, int64_t K) {
  if(K < 0 || N < K) return 0;
  T ret = 1;
  for(T i = 1; i <= K; ++i) {
    ret *= N--;
    ret /= i;
  }
  return ret;
}
//二項係数テーブル(N^2)
template< typename T >
vector< vector< T > > binomial_table(int N) {
  vector< vector< T > > mat(N + 1, vector< T >(N + 1));
  for(int i = 0; i <= N; i++) {
    for(int j = 0; j <= i; j++) {
      if(j == 0 || j == i) mat[i][j] = 1;
      else mat[i][j] = mat[i - 1][j - 1] + mat[i - 1][j];
    }
  }
  return mat;
}
//unionfind
struct UnionFind {
  vector< int > data;
 
  UnionFind(int sz) {
    data.assign(sz, -1);
  }
 
  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }
 
  int find(int k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }
 
  int size(int k) {
    return (-data[find(k)]);
  }
};
int main(){
  int 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: 3596
#include<cstdio>
#include<cstring>
#include<algorithm>
const int MAXN=100010;
int h[MAXN],f[MAXN];

int main(){
	int n;scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&h[i]);
	f[0]=1<<30;
	for(int i=2;i<=n;i++)
		f[i]=std::min(std::abs(h[i]-h[i-1])+f[i-1],abs(h[i]-h[i-2])+f[i-2]);
	printf("%d\n",f[n]);
}

Measured memory_bytes: 896
import math
A,B,H,M = map(int,input().split())
h = H
m = M
if h >= 9:
  h -= 12
if m >= 45:
  h -= 60
a1 = math.pi/2 - (h/12+M/60/12)*2*math.pi
a2 = math.pi/2 - M/60*2*math.pi
d = math.sqrt((A*math.cos(a1)-B*math.cos(a2))**2+(A*math.sin(a1)-B*math.sin(a2))**2)
#print(A*math.cos(a1),A*math.sin(a1),B*math.cos(a2),B*math.sin(a2))
print(d)

Measured memory_bytes: 9548
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=1; i<=(int)(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    int n;
    cin>>n;
    vi a(n);
    rep(i,n) cin>>a[i];
    if(n%2==0) {
        for(int i=n-1; i>=0; i-=2) cout<<a[i]<<" ";
        for(int i=0; i<n; i+=2) cout<<a[i]<<" ";
    }
    else {
        for(int i=n-1; i>=0; i-=2) cout<<a[i]<<" ";
        for(int i=1; i<n; i+=2) cout<<a[i]<<" ";
    }
    cout<<endl;
}

Measured memory_bytes: 2944
#include<bits/stdc++.h>
#define S second
#define F first
#define EPS (1e-7)
#define INF (1e9)
#define N 31
using namespace std;
typedef pair<double,int> P;
typedef pair<int,int> P1;
typedef pair<int,P1> P2;
typedef pair<P,P1> P3;
typedef pair<P3,int> P4;

vector<P2> G[N];
int n,m,s,g;

double dijkstra(){
  P d[N][N][N];
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
      for(int k=0;k<N;k++)
	d[i][j][k]=P(INF,INF);
  priority_queue<P4,vector<P4>,greater<P4> > q;
  for(int i=0;i<G[s].size();i++){
    int nx=G[s][i].first,cost=G[s][i].second.first;
    d[s][nx][1]=P(cost,cost);
    q.push(P4(P3(P(cost,cost),P1(s,nx)),1));
  }
  while(!q.empty()){
    P4 t=q.top(); q.pop();
    int px=t.F.S.F,x=t.F.S.S,v=t.S,sum=t.F.F.S;
    double cost=t.F.F.F;
    if(d[px][x][v].F+EPS<cost)continue;
    if(abs(cost-d[px][x][v].F)<EPS)
      if(d[px][x][v].S<sum)continue;
    if(x==g&&v==1)return cost;
    for(int i=0;i<G[x].size();i++){
      int nx=G[x][i].F,cost2=G[x][i].S.F;
      int lim=G[x][i].S.S;
      if(nx==px)continue;
      for(int j=-1;j<=1;j++){
	int nv=v+j;
	if(nv<1||30<nv||nv>lim)continue;
	double ncost=cost+1.0*cost2/nv;
	if(d[x][nx][nv].F>ncost+EPS){
	  d[x][nx][nv]=P(ncost,sum+cost);
	  q.push(P4(P3(P(ncost,sum+cost),P1(x,nx)),nv));
	}
	/*if(abs(d[x][nx][nv].F-ncost)<EPS)
	  if(d[x][nx][nv].S>sum+cost){
	    d[x][nx][nv]=P(ncost,sum+cost);
	    q.push(P4(P3(P(ncost,sum+cost),P1(x,nx)),nv));
	    }*/
      }
    }
  }
  return -1;
}

int main(){
  while(1){
    cin>>n>>m;
    if(!n&&!m)break;
    cin>>s>>g;
    s--,g--;
    int a,b,c,d;
    for(int i=0;i<m;i++){
      cin>>a>>b>>c>>d;
      a--,b--;
      G[a].push_back(P2(b,P1(c,d)));
      G[b].push_back(P2(a,P1(c,d)));
    }
    double r=dijkstra();
    if(r==-1)cout<<"unreachable"<<endl;
    else printf("%.5f\n",r);
    for(int i=0;i<n;i++)G[i].clear();
  }
  return 0;
}

Measured memory_bytes: 4156
fn main() {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).unwrap();

    let input: Vec<_> = input.split_whitespace().map(|x| x.parse::<i32>().unwrap()).collect();

    if input[0] % input[1] == 0 {
        println!("0");
    } else {
        println!("1");
    }
}


Measured memory_bytes: 4352
character s*3
integer a,b,c,d,i,j,k

read*, s
do i=1,3
   if(s(i:i)=="a")then
      do j=1,3
         if ( s(j:j)=="b" ) then
            do k =1,3
               if ( s(k:k)=="c" ) then
                  write (*,"(A)") "Yes"
                  stop                    
               end if
            end do
         end if
      end do
   end if
end do

write(*,"(A)") "No"
end

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
#define PII pair<int, int>
#define MP make_pair
#define PB push_back
#define FF first
#define SS second
using namespace std;
template<typename T> inline void gmax(T &x, T y){x = x > y ? x : y;}
template<typename T> inline void gmin(T &x, T y){x = x < y ? x : y;}
const int MAXN = 100010;
int n, m;
LL a[MAXN], b[MAXN], v[MAXN];
int id[MAXN];
vector<int> G[MAXN];
inline bool cmp(const int &a, const int &b){return v[a] < v[b];}
int f[MAXN];
inline int find(int x){return f[x] == x ? f[x] : f[x] = find(f[x]);}
int main(){
	scanf("%d%d", &n, &m);
	for(int i = 1; i <= n; i++) scanf("%lld%lld", &a[i], &b[i]), v[i] = max(a[i] - b[i], 0LL), id[i] = i;
	sort(id + 1, id + n + 1, cmp);
	for(int i = 1; i <= m; i++){
		int x, y;
		scanf("%d%d", &x, &y);
		G[x].PB(y);
		G[y].PB(x);
	}
	for(int i = 1; i <= n; i++){
		int x = id[i];
		f[x] = x;
		LL tmp = v[x];
		for(unsigned j = 0; j < G[x].size(); j++){
			int y = G[x][j];
			if(!f[y] || (y = find(y)) == x) continue;
			f[y] = x;
			b[x] += b[y];
			gmin(v[x], max(v[y], tmp) - b[y]); 
		}
		v[x] += b[x];
	}
	printf("%lld\n", v[id[n]]);
	return 0;
}

Measured memory_bytes: 9084
#![allow(non_snake_case, unused_imports)]

// Input
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} };}
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,BTreeMap,VecDeque};

// Functions

// Main
fn main(){
    input!{
        N: u32,
    }
    println!("{}",((N-1)/111 +1)*111);
}

Measured memory_bytes: 4352
# coding: utf-8


def main():
    n = int(input())

    coordinates = []
    for _ in range(n):
        coordinates.append(list(map(int, input().split())))

    for coordinate in coordinates:
        if coordinate[2] > 0:
            xx = coordinate[0]
            yy = coordinate[1]
            hh = coordinate[2]
            break

    for px in range(101):
        for py in range(101):
            ph = hh + abs(xx - px) + abs(yy - py)

            suit = True
            for x, y, h in coordinates:
                if h != max(ph - abs(x - px) - abs(y - py), 0):
                    suit = False
                    break

            if suit == True:
                print(px, py, ph)
                return


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func lowerBound(a []int, x int) int {
	// (l, r]
	n := len(a)
	l := -1
	r := n
	for r-l > 1 {
		mid := (l + r) / 2
		if a[mid] >= x {
			r = mid
		} else {
			l = mid
		}
	}
	return r
}

func main() {
	var n int
	fmt.Scan(&n)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	a := make([]int, n)
	b := make([]int, n)
	c := make([]int, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		a[i], _ = strconv.Atoi(sc.Text())
	}
	for i := 0; i < n; i++ {
		sc.Scan()
		b[i], _ = strconv.Atoi(sc.Text())
	}
	for i := 0; i < n; i++ {
		sc.Scan()
		c[i], _ = strconv.Atoi(sc.Text())
		c[i] = -c[i]
	}
	sort.Ints(a)
	sort.Ints(c)

	ans := int64(0)
	for _, x := range b {
		ans += int64(lowerBound(a, x)) * int64(lowerBound(c, -x))
	}
	fmt.Println(ans)
}


Measured memory_bytes: 6016
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 105;
const int mod = 1000000007;

ll f[maxn];
int a[maxn];

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int n;
  cin>>n;
  for(int i=1;i<=n;i++){
    cin>>a[i];
  }
  f[0] = 1000;
  f[1] = 1000;
  ll ret = 1000;
  for(int i=2;i<=n;i++){
    f[i] = f[i-1];
    for(int j=i-1;j>=1;j--){
      if(a[i]>a[j]){
        ll tt = f[j]/a[j];
        ll cur = tt * a[i] + f[j]%a[j];
        f[i] = max(f[i], cur);
      }
    }
    ret = max(ret, f[i]);
  }
  cout<<ret<<endl;
  return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,r;
    scanf("%d %d",&n,&r);
    int k=n;
    if(n<10 && n>=1){
        cout<<(100*(10-k)+r)<<"\n";
    }
    else
        printf("%d\n",r);
    return 0;
}


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

int main(){
	int N;
	cin>>N;
	unordered_map<int,int> arr;
	int tmp;
	for(int i=0;i<N;++i){
		cin>>tmp;
		if(arr[tmp]==0)arr[tmp]=1;
		else arr.erase(tmp);
	}
	cout<<arr.size()<<endl;
}


Measured memory_bytes: 4388
#include <stdio.h>
#include <string.h>

int main(void) {
	static char message[1000][1064];
	int n;
	while(scanf("%d",&n)==1 && n>0) {
		int i,j;
		char plus_flag[1064]={0};
		memset(message,0,sizeof(message));
		for(i=0;i<n;i++)scanf("%s",message[i]);
		for(i=0;i<n;i++) {
			for(j=0;message[i][j]=='.';j++);
			if(j>0)message[i][j-1]='+';
		}
		for(i=n-1;i>=0;i--) {
			for(j=0;message[i][j]=='.' || message[i][j]=='+';j++) {
				if(message[i][j]=='.') {
					message[i][j]=(plus_flag[j]?'|':' ');
				} else {
					plus_flag[j]=1;
				}
			}
			for(;j<1064;j++)plus_flag[j]=0;
		}
		for(i=0;i<n;i++)puts(message[i]);
	}
	return 0;
}

Measured memory_bytes: 1632
H, W = map(int, input().split())
a = [["#" for i in range(W + 2)]]
for i in range(1, H + 1):
    a.append(["#"])
    a[i].extend(input())
    a[i].extend(["#"])
a.append(["#" for i in range(W + 2)])
for i in a:
    for j in i:
        print(j, end = "")
    print()
print()


Measured memory_bytes: 4596
<?php
// Your code here!

    $num1 = intval(trim(fgets(STDIN)));
    
    $num_array = array_map('intval', explode(" ",trim(fgets(STDIN))));
    
    $num_array = array_reverse($num_array);
    
    $count = count($num_array);
    
    $i=0;
    
    // var_dump($num_array);
    
    foreach($num_array as $value){
        echo "$value";
        $i++;
        if($i!=$count){
            echo " ";
        }
    }
    echo "\n";
    
    
?>


Measured memory_bytes: 9280
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int,  int>;

const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

int main(){
     int n; cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; ++i){cin >> a[i];}
  
   ll sum = 0, prev =0;
   ll ans1 =0, ans2 =0;
   for(int i = 0; i < n; ++i){
     sum += a[i];
     if(i % 2 ==0){
       if(sum <= 0){
         ans1 += abs(sum)+1;
         sum = 1;
       }
     }
     else{
       if(sum>=0){
         ans1 += abs(sum)+1;
         sum = -1;
       }
     }
   }
  sum=0;
   for(int i = 0; i < n; ++i){
     sum += a[i];
     if(i % 2 !=0){
       if(sum <= 0){
         ans2 += abs(sum)+1;
         sum = 1;
       }
     }
     else{
       if(sum>=0){
         ans2 += abs(sum)+1;
         sum = -1;
       }
     }       
   }
   ll ans = min(ans1, ans2);
   cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long M = 200010;
long long fact[M+1];
long long factinv[M+1];
long long combin(long long n, long long r) {
	return ((fact[n] * factinv[r]) % mod * factinv[n-r]) % mod;
}
long long modpow(long long a, long long b) {
	long long x = 1;
	while (b) {
		if(b & 1) x = (x * a) % 1000000007;
		a = (a * a) % 1000000007;
		b >>= 1;
	}
	return x;
}
long long f(long long a, long long b) {
	return combin(a+b-2, a-1);
}
int main() {
	fact[0] = 1;
	for (long long i = 1; i <= M; ++ i) fact[i] = (fact[i-1] * i) % mod;
	for (long long i = 0; i <= M; ++ i) factinv[i] = modpow(fact[i], 1000000005);
	long long H, W, A, B;
	cin >> H >> W >> A >> B;
	long long r = 0;
	for (long long i = B+1; i <= W; ++ i) {
		r = (r + f(H-A, i) * f(A, W-i+1)) % mod;
	}
	cout << r << endl;
}


Measured memory_bytes: 3328